
Бывалый

Профиль
Группа: Участник
Сообщений: 216
Регистрация: 29.9.2007
Где: Vilnius
Репутация: нет Всего: нет
|
| Код | Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/wandering/www/class/mm.control.php on line 4
|
подскажите в чём дело. вот файл | Код | <?php class MMcontrol { public $path='./'; public $check_post=false;
function __construct() { $this->_path=$path; }
function parse_incoming() { global $_GET, $_POST; require ($this->path.'class/class.Decoder.php'); $decode = new Decoder(); $return=array(); if (is_array($_GET)) { while (list($k,$v)=each($_GET)) { if(is_array($_GET[$k])) { while(list($k2,$v2)=each($_GET[$k])) { $return[$k][$this->clean_key($k2)]=$decode->_ucs2EntitiesDecode($this->clean_value($v2)); } }else { $return[$k]=$decode->_ucs2EntitiesDecode($this->clean_value($v, $k)); } } } if (is_array($_POST) && count ($_POST)>0) { $this->check_post = 'true'; while (list($k,$v)=each($_POST)) { if(is_array($_POST[$k])) { while(list($k2,$v2)=each($_POST[$k])) { $return[$k][$this->clean_key($k2)]=$decode->_ucs2EntitiesDecode($this->clean_value($v2)); } }else { $return[$k]=$decode->_ucs2EntitiesDecode($this->clean_value($v, $k)); } } } $_POST=''; $_GET=''; return $return; }
function clean_key($key) { /* if ($key == "") return ""; $key = preg_replace( "/\.\./" , "" , $key ); $key = preg_replace( "/\_\_(.+?)\_\_/" , "" , $key ); $key = preg_replace( "/^([\w\.\-\_]+)$/", "$1", $key ); */ return $key; }
function clean_value($val, $key='') { /* if ($val == "") return ""; $val = preg_replace( "/&/" , "&" , $val ); $val = preg_replace( "/<!--/" , "<!--" , $val ); $val = preg_replace( "/-->/" , "-->" , $val ); $val = preg_replace( "/<script/i" , "<script" , $val ); $val = preg_replace( "/>/" , ">" , $val ); $val = preg_replace( "/</" , "<" , $val ); $val = preg_replace( "/\"/" , """ , $val ); $val = preg_replace( "/\|/" , "|" , $val ); $val = preg_replace( "/\n/" , "<br>" , $val ); // Convert literal newlines $val = preg_replace( "/\\\$/" , "$" , $val ); $val = preg_replace( "/\r/" , "" , $val ); // Remove literal carriage returns $val = preg_replace( "/!/" , "!" , $val ); $val = preg_replace( "/'/" , "'" , $val ); // IMPORTANT: It helps to increase sql query safety. $val = stripslashes($val); // Swop PHP added backslashes $val = preg_replace( "/\\\/" , "\" , $val ); // Swop user inputted backslashes */ return $val; }
function select_Lang($Url='./', $default='ru') { global $VARS; if($VARS['action'] == 'select_l') { if (!session_is_registered('s_lang')) session_register('s_lang'); $HTTP_SESSION_VARS['s_lang'] = $VARS['s_s_lang']; Header('Location: ?'); exit; } if(!isset($HTTP_SESSION_VARS['s_lang'])) { if (!session_is_registered('s_lang')) session_register('s_lang'); $HTTP_SESSION_VARS['s_lang'] = $default; } $file = file($Url."lang/".$HTTP_SESSION_VARS['s_lang']); for ($i=0; $i<count($file); $i++) { $stringFile = split("\|", $file[$i], 2); $arrayLang[trim($stringFile[0])] = trim($stringFile[1]); } return $arrayLang; }
function StartS() { Header("WWW-Authenticate: Basic realm=\"Administator panel\""); Header("HTTP/1.0 401 Unauthorized"); exit; }
function ExitS() { global $HTTP_SERVER_VARS; unset($HTTP_SERVER_VARS['PHP_AUTH_USER']); unset($HTTP_SERVER_VARS['PHP_AUTH_PW']); Header("HTTP/1.0 401 Auth Required"); Header("WWW-authenticate: basic realm=\"Administator panel\""); exit; }
function ParsingPostVars($array, $dis_array, $act, $slash = '') { $zap_start = ""; $zap_finish = ""; while (list($key, $val) = each($array)) { if (@in_array($key, $dis_array)) { if($act == "insert") { $zap_start .= $key.", "; if ($slash == "Yes") { $zap_finish .= "'".addslashes($val)."', "; }else{ $zap_finish .= "'".$val."', "; } }else{ if ($slash == "Yes") { $zap_start .= $key." = '".addslashes($val)."', "; }else{ $zap_start .= $key." = '".$val."', "; } } } } $zap_start = substr($zap_start, 0, -2); $zap_finish = substr($zap_finish, 0, -2); return array($zap_start, $zap_finish); }
function delfiles($catalog) { $dir = opendir($catalog); while(($file = readdir($dir))) { if(is_file($catalog."/".$file)) unlink($catalog."/".$file); //else if (is_dir($catalog."/".$file) && //($file != ".") && //($file != "..")) delfiles($catalog."/".$file); } closedir($dir); return true; }
function check($need) { global $VARS; foreach($need as $key=>$val) { if (empty($VARS[$key])) { $this->error("Вы не заполнили поле '{$val}'!"); } } }
function error($msg) { echo "{ALERT}:{$msg}"; exit; }
function ImageSize($file) { $max_height=Preview_height; $max_width=Preview_width; if ($image=@getimagesize($file)) { if (strstr($image[mime], 'image')) { $width=$image[0]; $height=$image[1]; if ($width>=$height AND ($width>$max_width OR $height>$max_height)) { $h=intval($height*$max_width/$width); if ($h>$max_height) { $w=intval($w*$max_height/$h)."px"; $h=$max_height."px"; }else { $w=$max_width."px"; $h.="px"; } }else if ($width>$max_width OR $height>$max_height) { $w=intval($width*$max_height/$height); if ($w>$max_width) { $h=intval($h*$max_width/$w)."px"; $w=$max_width."px"; }else { $h=$max_height."px"; $w.="px"; } }else { $w=$width."px"; $h=$height."px"; } } } $size=array('width'=>$w, 'height'=>$h); return $size; }
function get_map($id, $par, $table, $sort='id_sort', $WHERE='') { $this->map=array(); if($WHERE!=''){$WHERE1='WHERE '.$WHERE;} if($WHERE!=''){$WHERE2='and '.$WHERE;} $array=mysql::return_array(mysql::exec("SELECT $id AS 'id', $par AS 'parent' FROM $table ".$WHERE1." ORDER BY $par, $sort")); foreach ($array as $key=>$pg) { $parent = $pg['parent']; $maps['key_'.$key] = "[".$parent."][".$pg['id']."]=array();"; while ($parent != 0) { $pg1=mysql::return_array(mysql::exec("SELECT $par AS 'parent' FROM $table WHERE $id = '{$parent}' ".$WHERE2." ORDER BY id_sort"), true); $maps['key_'.$key] = "[".$pg1['parent']."]".$maps['key_'.$key]; $parent = $pg1['parent']; } $maps['key_'.$key] = "\$this->map".$maps['key_'.$key]; } foreach ($maps as $map) { $map = explode("=", $map); eval("$map[0]=$map[1];"); } return($this->map[0]); } } ?>
|
Добавлено через 14 минут и 46 секундах да, забыл написать, прикол в том что на локальном сервере всё работает.
|