示例#1
0
 function deep_stripslashes($v)
 {
     if (is_array($v)) {
         foreach ($v as $a => $b) {
             $v[$a] = deep_stripslashes($b);
         }
     } else {
         return stripslashes($v);
     }
     return $v;
 }
示例#2
0
function deep_stripslashes($str)
{
    if (is_array($str)) {
        foreach ($str as $key => $val) {
            $str[$key] = deep_stripslashes($val);
        }
    } else {
        $str = stripslashes($str);
    }
    return $str;
}
示例#3
0
    }
    if (!($handle = @fopen($file_dir, 'rb'))) {
        adminmsg('打开目标模板文件失败', 0);
    }
    $tpl['content'] = fread($handle, filesize($file_dir));
    $tpl['content'] = htmlentities($tpl['content'], ENT_QUOTES, QISHI_CHARSET);
    fclose($handle);
    $tpl['name'] = $file;
    $tpl['dir'] = $_GET['tpl_dir'];
    $smarty->assign('tpl', $tpl);
    $smarty->display('tpl/admin_templates_file_edit.htm');
} elseif ($act == 'do_edit') {
    check_token();
    check_permissions($_SESSION['admin_purview'], "tpl_edit");
    $tpl_name = !empty($_POST['tpl_name']) ? trim($_POST['tpl_name']) : '';
    $tpl_content = !empty($_POST['tpl_content']) ? deep_stripslashes($_POST['tpl_content']) : '';
    if (empty($tpl_name)) {
        adminmsg('保存模板文件出错', 0);
    }
    $temp_arr = explode(".", $tpl_name);
    $file_ext = array_pop($temp_arr);
    $file_ext = trim($file_ext);
    $file_ext = strtolower($file_ext);
    $tpl_type = array("htm", "html");
    if (!in_array($file_ext, $tpl_type)) {
        exit("err");
    }
    $file_dir = '../templates/' . $_POST['tpl_dir'] . '/' . $tpl_name;
    if (!($handle = @fopen($file_dir, 'wb'))) {
        adminmsg("打开目标模版文件 {$tpl_name} 失败,请检查模版目录的权限", 0);
    }
示例#4
0
function deep_stripslashes($mix)
{
    if (gettype($mix) == "array") {
        foreach ($mix as $key => $value) {
            if (gettype($value) == "array") {
                $mix[$key] = deep_stripslashes($value);
            } else {
                $mix[$key] = stripslashes($value);
            }
        }
        return $mix;
    } else {
        return stripslashes($mix);
    }
}
 /**
  * Remove slashes from strings, arrays and objects
  * 
  * @param    mixed   input data
  * @return   mixed   cleaned input data
  */
 public static function deep_stripslashes($input)
 {
     if (is_array($input)) {
         $input = array_map(array(__CLASS__, 'deep_stripslashes'), $input);
     } elseif (is_object($input)) {
         $vars = get_object_vars($input);
         foreach ($vars as $k => $v) {
             $input->{$k} = deep_stripslashes($v);
         }
     } else {
         $input = stripslashes($input);
     }
     return $input;
 }
示例#6
0
function deep_htmlspecialchars($mix, $quotestyle = ENT_QUOTES)
{
    if (get_magic_quotes_gpc()) {
        $mix = deep_stripslashes($mix);
    }
    if (gettype($mix) == 'array') {
        foreach ($mix as $key => $value) {
            if (gettype($value) == 'array') {
                $mix[$key] = deep_htmlspecialchars($value, $quotestyle);
            } else {
                $value = htmlspecialchars($value, $quotestyle);
                $value = str_replace(' ', ' ', $value);
                $mix[$key] = $value;
            }
        }
        return $mix;
    } else {
        $mix = htmlspecialchars($mix, $quotestyle);
        $mix = str_replace(' ', ' ', $mix);
        return $mix;
    }
}