function cookie($key) { if (NJB_REMOVE_MAGIC_QUOTES == false) { return @$_COOKIE[$key]; } else { return removeMagicQuotes(@$_COOKIE[$key]); } }
/** * Remove magic quotes recursivly * * @author Andreas Gohr <*****@*****.**> * @param array $array */ function removeMagicQuotes(&$array) { foreach (array_keys($array) as $key) { if (is_array($array[$key])) { removeMagicQuotes($array[$key]); } else { $array[$key] = stripslashes($array[$key]); } } }
function removeMagicQuotes(&$array) { if (!get_magic_quotes_gpc()) { return; } foreach ($array as $key => $val) { if (is_array($val)) { removeMagicQuotes($array[$key], $trim); } else { $array[$key] = stripslashes($val); } } }
function removeMagicQuotes(&$postArray, $trim = false) { if (!get_magic_quotes_gpc()) { return; } foreach ($postArray as $key => $val) { if (is_array($val)) { removeMagicQuotes($postArray[$key], $trim); } else { if ($trim == true) { $val = trim($val); } $postArray[$key] = stripslashes($val); } } }
$controller = ucwords($controller); $model = rtrim($controller, 's'); $controller .= 'Controller'; $dispatch = new $controller($model, $controllerName, $action); if ((int) method_exists($controller, $action)) { call_user_func_array(array($dispatch, $action), $queryString); } else { /* Error Generation Code Here */ } } /** Autoload any classes that are required **/ function __autoload($className) { if (file_exists(ROOT . DS . 'library' . DS . strtolower($className) . '.class.php')) { require_once ROOT . DS . 'library' . DS . strtolower($className) . '.class.php'; } else { if (file_exists(ROOT . DS . 'application' . DS . 'controllers' . DS . strtolower($className) . '.php')) { require_once ROOT . DS . 'application' . DS . 'controllers' . DS . strtolower($className) . '.php'; } else { if (file_exists(ROOT . DS . 'application' . DS . 'models' . DS . strtolower($className) . '.php')) { require_once ROOT . DS . 'application' . DS . 'models' . DS . strtolower($className) . '.php'; } else { /* Error Generation Code Here */ } } } } setReporting(); removeMagicQuotes(); unregisterGlobals(); callHook();
<?php require_once 'toolbox.php'; removeMagicQuotes($_GET); $turtle = new Turtle($_GET['commands'], 350, 350); $maxFilenameLength = 20; $filename = str_replace(array(' ', ':', '"', '?'), array('-', 'c', 'q', 'p'), $_GET['commands']); if (strlen($filename) > $maxFilenameLength) { $filenameMd5 = md5($filename); $filename = substr($filename, 0, $maxFilenameLength) . '_' . $filenameMd5; } header("Content-Disposition: Attachment;filename={$filename}.png"); header('Content-Type: image/png'); echo $turtle->getImage();