Witam
Mam problem z moim panelem CMS.
Błąd polega na tym, że w trakcie dodawania nowej podstrony na stronie internetowej poprzez panel CMS
i kliknięcia zapisz pojawia się biała strona zamiast dodawać nową podstronę na stronę internetową.
Panel oparty o PHP Smarty.
Poniżej screeny pokazujące o co chodzi.
http://prnt.sc/og82qt
http://prnt.sc/og830p
http://prnt.sc/og859i
Jedyne co ci mozemy powiedziec na podstawie takiej masie informacji to: przejrzyj logi
A widzisz jakies interesujace info w logach consoli chrome?
Tak, na serwerze. Logi apache/nginx ewentualnie logi twojej aplikacji bo i ona moze jakies logi zapisywac
/home/srw_strona/strona.pl/lib/classes/Session.class.php on line 29 [17-Jul-2019 13:55:37 Europe/Warsaw] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function valid_text(), 3 passed in /home/srw_strona/strona.pl/admin/action/content.module.php on line 485 and at least 4 expected in /home/srw_strona/strona.pl/lib/MVC.function.php:460 Stack trace: #0 /home/srw_strona/strona.pl/admin/action/content.module.php(485): valid_text('text', 'Jakas tresc<br ...', Object(Form)) #1 /home/srw_strona/strona.pl/admin/index.php(109): contentMultiActionController->form_action() #2 /home/srw_strona/strona.pl/admin/index.php(162): MVC_Controller->Process() #3 {main} thrown in /home/srw_strona/strona.pl/lib/MVC.function.php on line 460
public function form_action() { $field = "content_id"; $content_id = get_http_request($field); $this->form->setValue($field, $content_id); $field = "subaction"; $subaction = get_http_request($field); $this->form->setValue($field, $subaction); if($content_id != '' && http://www.php.net/eregi('^[0-9]+$', $content_id) && $this->content->check_id($content_id)) { $field_1 = "title"; $title = valid_input($field_1, get_http_request($field_1), $this->form, true); $field_2 = "text"; $text = valid_text($field_2, get_http_request($field_2), $this->form); //$purifier = new HTMLPurifier(); //$text = $purifier->purify($text);
No ja tez nie wiem.
Blad wyraznie mowi, ze funkcja valid_text() wymaga przynajmniej 4 parametrow, a w kodzie jest odpalana tylko z 3.
Nie aktualizowales ostatnio czegos tam w tej swojej appce?
Jak wyglada kod funkcji valid_text() ?
function valid_text($field, $value, &$form, $required, $nl2br = false) { if (!$value || http://www.php.net/strlen($value = http://www.php.net/trim($value)) == 0) { if ($required == true) $form->setError($field, 'empty'); else $value = ''; } else { if (http://www.php.net/get_magic_quotes_gpc()) $value = http://www.php.net/stripslashes($value); if ($nl2br) { $value = http://www.php.net/nl2br($value); } $form->setValue($field, $value); $value = http://www.php.net/addslashes($value); } return $value; }
No to zmien
text = valid_text($field_2, get_http_request($field_2), $this->form);
na
text = valid_text($field_2, get_http_request($field_2), $this->form, true);
albo
text = valid_text($field_2, get_http_request($field_2), $this->form, false);
w zaleznosci czy wymagasz by pole bylo wymagane czy nie
[17-Jul-2019 16:43:05 Europe/Warsaw] PHP Warning: http://www.php.net/session_regenerate_id(): Cannot regenerate session id - session is not active in /home/srw_strona/strona.pl/lib/classes/Session.class.php on line 29
<?php class Session { private http://www.php.net/static $instance; private function __construct() { $this->startSession(); } public http://www.php.net/static function singleton() { if (!http://www.php.net/isset(self::$instance)) { $c = __CLASS__; self::$instance = new $c; } return self::$instance; } public function __clone() { http://www.php.net/trigger_error('Klonowanie zabronione.', E_USER_ERROR); } private function startSession() { $session_key = http://www.php.net/substr(http://www.php.net/md5(http://www.php.net/dirname(__FILE__)), 0, 8); http://www.php.net/session_name('SESSID' . $session_key); http://www.php.net/ini_set('session.use_trans_sid', 0); http://www.php.net/session_regenerate_id(); http://www.php.net/session_start(); } }
Komunikat jest dosc wyrazny...
zmien kolejnosc o tutaj
session_regenerate_id();
session_start();
[17-Jul-2019 16:58:52 Europe/Warsaw] PHP Warning: http://www.php.net/preg_match(): Unknown modifier ']' in /home/srw_strona/strona.pl/lib/MVC.function.php on line 632
if (!function_exists('eregi')) { function http://www.php.net/eregi($pattern, $value, $output = false) { if (!$output) { return http://www.php.net/preg_match('/' . $pattern . '/', $value); } else { http://www.php.net/preg_match('/' . $pattern . '/', $value, $output); return $output; } } }
Dobrzy by zobaczyc co zawiera zmienna $pattern. Da sie?
/** * Method to sanitize incoming html. * Take from cakephp (http://cakephp.org) * Licensed under the MIT License * * @param unknown_type $string * @param unknown_type $remove * @return unknown */ function clean_html($string, $remove = false) { if ($remove) { $string = http://www.php.net/strip_tags($string); } else { $patterns = http://www.php.net/array("/\&/", "/%/", "/</", "/>/", '/"/', "/'/", "/\(/", "/\)/", "/\+/", "/-/"); $replacements = http://www.php.net/array("&", "%", "<", ">", """, "'", "(", ")", "+", "-"); $string = http://www.php.net/preg_replace($patterns, $replacements, $string); } return $string; } function seo_html($string) { $a = http://www.php.net/array('"', '\''); $b = http://www.php.net/array('', ''); $string = http://www.php.net/str_replace($a, $b, $string); $string = http://www.php.net/preg_match("[^ĘÓĄŚŁŻŹĆŃęóąśłżźćńA-Za-z0-9]", " ", $string); $string = http://www.php.net/preg_replace("/\s+/", " ", $string); $string = http://www.php.net/preg_replace("/^\W+|\W+$/", "", $string); return $string; } // ================================================================================
===================== // internal function for utf8 decoding // thanks to Jamie Pratt for noticing that PHP's function is a little // screwy function my_utf8_decode($string) { return http://www.php.net/strtr($string, "?ĽľŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖŘŮÚŰÜÝßŕáâăäĺćçčéęëěíîďđńňóôőöřůúűüý˙", "SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy"); } // sanitize a string in prep for passing a single argument to system() (or similar) // input string, returns string stripped of special characters function sanitize_system_string($string) { $pattern = '/(;|\||`|>|<|&|^|"|' . "\n|\r|'" . '|{|}|[|]|\)|\()/i'; // no piping, passing possible environment variables ($), // seperate commands, nested execution, file redirection, // background processing, special commands (backspace, etc.), quotes // newlines, or some other special characters $string = http://www.php.net/preg_replace($pattern, '', $string); $string = '"' . http://www.php.net/preg_replace('/\$/', '\\\$', $string) . '"'; //make sure this is only interpretted as ONE argument return $string; } // sanitize a string for SQL input (simple slash out quotes and slashes) // input string, returns string with slashed out quotes function sanitize_sql_string($string) { $pattern[0] = '/(\\\\)/'; $pattern[1] = "/\"/"; $pattern[2] = "/'/"; $replacement[0] = '\\\\\\'; $replacement[1] = '\"'; $replacement[2] = "\\'"; return http://www.php.net/preg_replace($pattern, $replacement, $string); } // sanitize a string for HTML (make sure nothing gets interpretted!) function sanitize_html_string($string) { $pattern[0] = '/\&/'; $pattern[1] = '/</'; $pattern[2] = "/>/"; $pattern[3] = '/\n/'; $pattern[4] = '/"/'; $pattern[5] = "/'/"; $pattern[6] = "/%/"; $pattern[7] = '/\(/'; $pattern[8] = '/\)/'; $pattern[9] = '/\+/'; $pattern[10] = '/-/'; $replacement[0] = '&'; $replacement[1] = '<'; $replacement[2] = '>'; $replacement[3] = '<br>'; $replacement[4] = '"'; $replacement[5] = '''; $replacement[6] = '%'; $replacement[7] = '('; $replacement[8] = ')'; $replacement[9] = '+'; $replacement[10] = '-'; return preg_replace($pattern, $replacement, $string); } // ================================================================================
=====================
czyli nie da sie....
strzelam:
Zamien
return preg_match('/' . $pattern . '/', $value);
na
return preg_match($pattern, $value);
a jak to nie pomoze to zamien na
return preg_match('#' . $pattern . '#', $value);
[17-Jul-2019 17:33:54 Europe/Warsaw] PHP Warning: http://www.php.net/array_pop() expects parameter 1 to be http://www.php.net/array, null given in /home/srw_strona/strona.pl/lib/classes/ScoutAgent.class.php on line 392
/** * Browser. */ private function _get_browser_addon() { while (list(,$addon) = http://www.php.net/each(parent::$tblb)) { /* if (eregi($addon[0], $this->user_agent, $wersja)) { return $addon[1]; } * */ } return null; } private function _get_browser() { while (list(,$browser) = http://www.php.net/each (parent::$tblc)) { if (http://www.php.net/eregi($browser[0], $this->user_agent, $wersja)) { $addon = ($browser[1] == 'Internet Explorer') ? $this->_get_browser_addon() : null; if (!http://www.php.net/isset($browser[2])) { $browser[2] = false; } $this->user_browser = http://www.php.net/array('name' => $browser[1], 'addon' => $addon, 'version' => http://www.php.net/array_pop($wersja), 'bot' => $browser[2]); return; } } $this->user_browser = false; } public function is_browser() { if (!http://www.php.net/isset($this->user_browser)) { $this->_get_browser(); } return http://www.php.net/is_array($this->user_browser); } public function browser($case = '') { if (!$this->is_browser()) { return; } switch (http://www.php.net/strtolower($case)) { case 'name' : return $this->user_browser['name']; break; case 'addon' : return $this->user_browser['addon']; break; case 'version' : return $this->user_browser['version']; break; default : $out = $this->user_browser['name'].' '.$this->user_browser['version']; if (!http://www.php.net/empty($this->user_browser['addon'])) { $out .= ' ('.$this->user_browser['addon'].')'; } return $out; break; } } /** * System. */
Przed ta linia daj
if ($wersja === null) {
$wersja = [];
}
private function _get_browser() { while (list(,$browser) = http://www.php.net/each (parent::$tblc)) { if (http://www.php.net/eregi($browser[0], $this->user_agent, $wersja)) { $addon = ($browser[1] == 'Internet Explorer') ? $this->_get_browser_addon() : null; if (!http://www.php.net/isset($browser[2])) { $browser[2] = false; } if ($wersja === null) { $wersja = []; } $this->user_browser = http://www.php.net/array('name' => $browser[1], 'addon' => $addon, 'version' => http://www.php.net/array_pop($wersja), 'bot' => $browser[2]); return; } } $this->user_browser = false; }
A jaka masz wersje php?
Zamien
$wersja = [];
na
$wersja = array();
Bo operacje jakies dziwne sa robione?
Patrzac jak kiepsko napisany jest ten skrypt nie zdziwilbym sie jakby byl totalnie nieoptymalny pod katem bazy rowniez
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)