function XML2TXT_END($parser, $name) { global $mem, $namespaces, $tags, $page_counter, $dir; if ($mem['name'] == 'NAMESPACE') { $namespaces[$mem['key']] = $mem['text']; } else { if ($mem['name'] == 'PAGE') { $loc = get_file_location_global($dir, $mem['namespace'], $mem['title'], true); store_file($loc, $mem['text'], 'text'); $page_counter++; if ($page_counter % 1000 == 0) { print '.'; if ($page_counter % 50000 == 0) { print "<br/>"; } flush(); } } } array_pop($tags); if (count($tags) > 0) { $mem['name'] = array_pop($tags); $tags[] = $mem['name']; } else { $mem['name'] = ""; } }
exit; } if (isset($_GET["events-list"])) { events_search(); exit; } if (isset($_GET["container-list"])) { container_list(); exit; } if (isset($_GET["log-js"])) { log_js(); exit; } if (isset($_GET["store-file"])) { store_file(); exit; } if (isset($_GET["downloadgz"])) { downloadgz(); exit; } if (isset($_GET["downloadf"])) { downloadf(); exit; } if (isset($_GET["uncompress"])) { uncompress_file(); exit; } if (isset($_GET["uncompress-check"])) {
function optimizejs($js_urls, $overwrite = false) { $content = ''; $files = ''; jimport('joomla.filesystem.file'); foreach ($js_urls as $url) { $files .= $url[1]; $srcurl = cleanUrl($url[1]); if (!$srcurl) { if (preg_match('/http/', $url[0])) { $external = file_get_contents($url[0]); } else { $external = file_get_contents('http:' . $url[0]); } $content .= "/* FILE: {$url[0]} */\n" . $external . "\n\n"; } else { $content .= "/* FILE: {$url[1]} */\n" . @JFile::read($url[0]) . "\n\n"; } } $file = md5($files) . '.js'; if (useGZip()) { $file = $file . '.php'; } $path = JPATH_SITE . DS . 'cache' . DS . 'gk' . DS . $file; if (is_file($path) && filesize($path) > 0) { // skip compression and leave current URL } else { $content = compressjs($content); } $expireHeader = (int) 30 * 24 * 60 * 60; if (useGZip()) { $headers = "<?php if(extension_loaded('zlib')){ob_start('ob_gzhandler');} header(\"Content-type: text/javascript\");"; $headers .= "header(\"Content-Encoding: gzip\");"; } $headers .= "header('Expires: " . gmdate('D, d M Y H:i:s', strtotime(date('D, d M Y H:i:s')) + $expireHeader) . " GMT');"; $headers .= "header('Last-Modified: " . gmdate('D, d M Y H:i:s', strtotime(date('D, d M Y H:i:s'))) . " GMT');"; $headers .= "header('Cache-Control: Public');"; $headers .= "header('Vary: Accept-Encoding');?>"; $content = $headers . $content; $url = store_file($content, $file, true); return $url; }
include_once('ressources/class.tcpip.inc'); $usersmenus=new usersMenus(); if(!$usersmenus->AsDansGuardianAdministrator){ $tpl=new templates(); $alert=$tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS}'); echo "alert('$alert');"; die(); } if(isset($_POST["DisableLogFileDaemonMySQL"])){logfile_daemon_save();exit;} if(isset($_GET["tabs-all"])){tabs_all();exit;} if(isset($_GET["external"])){external();exit;} if(isset($_GET["events-list"])){events_search();exit;} if(isset($_GET["container-list"])){container_list();exit;} if(isset($_GET["log-js"])){log_js();exit;} if(isset($_GET["store-file"])){store_file();exit;} if(isset($_GET["downloadgz"])){downloadgz();exit;} if(isset($_GET["downloadf"])){downloadf();exit;} if(isset($_GET["uncompress"])){uncompress_file();exit;} if(isset($_GET["uncompress-check"])){uncompress_file_check();exit;} if(isset($_GET["delete-check"])){uncompress_file_delete();exit;} if(isset($_POST["csv-delete"])){csv_delete();exit;} if(isset($_POST["empty-store"])){empty_store();exit;} if(isset($_GET["change-date-js"])){change_date_js();exit;} if(isset($_GET["change-date-popup"])){change_date_popup();exit;} if(isset($_GET["logfile-daemon-js"])){logfile_daemon_js();exit;} if(isset($_GET["logfile-daemon-popup"])){logfile_daemon_popup();exit;} page(); function tabs_all(){
enforce_authentication(CONST_USER_CLASS_MODERATOR); if ($_SERVER['REQUEST_METHOD'] == 'POST') { validate_id($_POST['id']); validate_xsrf_token($_POST[CONST_XSRF_TOKEN_KEY]); if ($_POST['action'] == 'edit') { db_update('challenges', array('title' => $_POST['title'], 'description' => $_POST['description'], 'flag' => $_POST['flag'], 'automark' => $_POST['automark'], 'case_insensitive' => $_POST['case_insensitive'], 'points' => $_POST['points'], 'category' => $_POST['category'], 'exposed' => $_POST['exposed'], 'available_from' => strtotime($_POST['available_from']), 'available_until' => strtotime($_POST['available_until']), 'num_attempts_allowed' => $_POST['num_attempts_allowed'], 'min_seconds_between_submissions' => $_POST['min_seconds_between_submissions'], 'relies_on' => $_POST['relies_on']), array('id' => $_POST['id'])); redirect(CONFIG_SITE_ADMIN_RELPATH . 'edit_challenge.php?id=' . $_POST['id'] . '&generic_success=1'); } else { if ($_POST['action'] == 'delete') { if (!$_POST['delete_confirmation']) { message_error('Please confirm delete'); } delete_challenge_cascading($_POST['id']); invalidate_cache(CONST_CACHE_NAME_FILES . $_POST['id']); invalidate_cache(CONST_CACHE_NAME_CHALLENGE_HINTS . $_POST['id']); redirect(CONFIG_SITE_ADMIN_RELPATH . '?generic_success=1'); } else { if ($_POST['action'] == 'upload_file') { store_file($_POST['id'], $_FILES['file']); invalidate_cache(CONST_CACHE_NAME_FILES . $_POST['id']); redirect(CONFIG_SITE_ADMIN_RELPATH . 'edit_challenge.php?id=' . $_POST['id'] . '&generic_success=1'); } else { if ($_POST['action'] == 'delete_file') { delete_file($_POST['id']); invalidate_cache(CONST_CACHE_NAME_FILES . $_POST['id']); redirect(CONFIG_SITE_ADMIN_RELPATH . 'edit_challenge.php?id=' . $_POST['challenge_id'] . '&generic_success=1'); } } } } }
function file_attach($id) { $con = connection(); $date = date("Y-m-d H:i:s"); $max_file_size = 4194304; if (!$_FILES['userfile']['name'][0] == '') { if (isset($_FILES['userfile']['tmp_name'])) { for ($i = 0; $i < count($_FILES['userfile']['tmp_name']); $i++) { //$allowed_filetypes = array('.pdf','.txt','.word','.doc','.xls','.docx','.ppt','.xlsx'); $allowed_filetypes = array('.png', '.jpeg', '.jpg'); $final_path = "../attachment/"; $final_path_thumb = "../attachment/thumb"; $filename = $_FILES['userfile']['name'][$i]; $ext = substr($filename, strpos($filename, '.'), strlen($filename) - 1); if (!in_array($ext, $allowed_filetypes)) { die('The file that you are trying to upload is not allowed.'); } if (!is_uploaded_file($_FILES['userfile']['tmp_name'][$i])) { $message = 'No file uploaded'; } if ($_FILES['userfile']['size'][$i] > $max_file_size) { $message = "File size exceeds {$max_file_size} limit"; } $new_filename = md5(date("Y-m-d H:i:s")) . rand() . $ext; $p = $final_path . $new_filename; //echo $_FILES['userfile']['tmp_name'][$i]; //echo "<br>"; if (move_uploaded_file($_FILES['userfile']['tmp_name'][$i], $p)) { require_once 'image.class.php'; $image = new Image($p); $image->destination = $final_path_thumb . '/' . $new_filename; //echo $final_path_thumb.'/'.$new_filename; $image->constraint = 'w'; $image->size = 220; $image->quality = 100; $image->render(); if (store_file($id, $new_filename)) { return true; } else { return false; } // } else { return false; } } } } }
$target_dir = 'uploads/'; $target_file_small = ''; $target_file = path_microtime($_FILES['fileToUpload']['name'], $target_file_small); $uploadOk = 1; $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION); // Check if image file is a actual image or fake image if (isset($_POST['submit'])) { $check = getimagesize($_FILES['fileToUpload']['tmp_name']); $uploadOk = $check !== false; } // Check if file already exists if (file_exists($target_file)) { $uploadOk = 0; } // Check file size if ($_FILES['fileToUpload']['size'] > 10000000) { $uploadOk = 0; } // Allow certain file formats if ($imageFileType != 'jpg' && $imageFileType != 'png' && $imageFileType != 'jpeg') { $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 1 && store_file($target_file, $target_file_small)) { echo file_get_contents("./views/success.php"); } else { echo file_get_contents("./views/error.php"); } } else { echo file_get_contents("./views/main.php"); }