예제 #1
0
 public function strip_slashes($input)
 {
     return CAT_Helper_Validate::strip_slashes($input);
 }
예제 #2
0
// check module dir
$mod_path = CAT_Helper_Validate::sanitizePost('mod_dir');
if (!$mod_path) {
    $backend->printError("Missing param" . ($debug ? ' (missing mod_dir)' : ''));
}
$path = CAT_Helper_Directory::sanitizePath(CAT_PATH . '/modules/' . $mod_path);
if (!is_dir($path)) {
    $backend->printError("No such module");
}
// save changes
if (CAT_Helper_Validate::sanitizePost('action') && CAT_Helper_Validate::sanitizePost('action') == 'save') {
    if (!CAT_Helper_Validate::sanitizePost('cancel')) {
        $content = '';
        $bytes = 0;
        if (CAT_Helper_Validate::sanitizePost('code') && strlen(CAT_Helper_Validate::sanitizePost('code')) > 0) {
            $content = CAT_Helper_Validate::strip_slashes(CAT_Helper_Validate::sanitizePost('code'));
            $file = CAT_Helper_Directory::sanitizePath($path . '/' . CAT_Helper_Validate::sanitizePost('edit_file'));
            if (!file_exists($file)) {
                $backend->printFatalError("No such file");
            }
            $mod_file = fopen($file, 'wb');
            $bytes = fwrite($mod_file, $content);
            fclose($mod_file);
        }
        if ($bytes == 0) {
            $backend->print_error('Cannot save file', CAT_ADMIN_URL . '/pages/modify.php?page_id=' . $page_id);
        } else {
            $backend->print_success('Success', CAT_ADMIN_URL . '/pages/modify.php?page_id=' . $page_id);
        }
    }
} else {