function csp_po_ajax_handle_change_permission() { csp_po_check_security(); load_plugin_textdomain(CSP_PO_TEXTDOMAIN, PLUGINDIR.'/codestyling-localization','codestyling-localization'); $filename = $_POST['file']; $error = false; if (file_exists($filename)) { @chmod($filename, 0644); if(!is_writable($filename)) { @chmod($filename, 0664); if (!is_writable($filename)) { @chmod($filename, 0666); } if (!is_writable($filename)) $error = __('Server Restrictions: Changing file rights is not permitted.', CSP_PO_TEXTDOMAIN); } } else $error = sprintf(__("You do not have the permission to modify the file rights for a not existing file '%s'.", CSP_PO_TEXTDOMAIN), $filename); if ($error) { header('Status: 404 Not Found'); header('HTTP/1.1 404 Not Found'); echo $error; } else{ header('Content-Type: application/json'); echo '{ title: "'.date(__('m/d/Y H:i:s',CSP_PO_TEXTDOMAIN), filemtime($filename))." ".file_permissions($filename).'" }'; } exit(); }
function csp_po_ajax_handle_change_permission() { csp_po_check_security(); load_plugin_textdomain(CSP_PO_TEXTDOMAIN, PLUGINDIR . '/codestyling-localization/languages', 'codestyling-localization/languages'); $filename = strip_tags($_POST['file']); $error = false; require_once 'includes/class-filesystem-translationfile.php'; $transfile = new CspFileSystem_TranslationFile(); $transfile->change_permission($filename); header('Content-Type: application/json'); echo '{ title: "' . date(__('m/d/Y H:i:s', CSP_PO_TEXTDOMAIN), filemtime($filename)) . " " . file_permissions($filename) . '" }'; exit; }