if (count($files)) { foreach ($files as $f) { if (filemtime($f) < time() - 24 * 60 * 60 && filesize($f) == 0) { unlink($f); } } } $files = CAT_Helper_Directory::findFiles('log_\\d{4}-\\d{2}-\\d{2}\\.txt', CAT_PATH . '/temp/logs'); if (count($files)) { foreach ($files as $f) { if (filemtime($f) < time() - 24 * 60 * 60 && filesize($f) == 0) { unlink($f); } } } $widget_name = CAT_Object::lang()->translate('Logfiles'); $current = strftime('%Y-%m-%d'); $logs = array(); $list = array(); $files = CAT_Helper_Directory::getInstance()->maxRecursionDepth(2)->setSuffixFilter(array('txt'))->setSkipDirs(array('cache', 'compiled'))->setSkipFiles(array('index.php'))->findFiles('log_\\d{4}-\\d{2}-\\d{2}\\.txt', CAT_PATH . '/temp'); if (count($files)) { foreach ($files as $f) { if (filesize($f) !== 0) { $list[] = array('file' => $f, 'size' => filesize($f)); } } } if (count($list)) { foreach (array_values($list) as $f) { $file = str_ireplace(CAT_Helper_Directory::sanitizePath(CAT_PATH . '/temp/'), '', CAT_Helper_Directory::sanitizePath($f['file'])); if (substr($file, 0, 1) == "/") {
} else { $root = "../"; $level = 1; while ($level < 10 && !file_exists($root . '/framework/class.secure.php')) { $root .= "../"; $level += 1; } if (file_exists($root . '/framework/class.secure.php')) { include $root . '/framework/class.secure.php'; } else { trigger_error(sprintf("[ <b>%s</b> ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); } } if (!file_exists(CAT_PATH . '/modules/' . SEARCH_LIBRARY . '/library.php')) { $page_id = CAT_Helper_Validate::get('_REQUEST', 'page_id'); CAT_Object::printFatalError(CAT_Object::lang()->translate('No search library installed!'), CAT_Helper_Page::getLink($page_id)); } // Required page details $page_id = -1; $page_description = ''; $page_keywords = ''; // load search library require_once CAT_PATH . '/modules/' . SEARCH_LIBRARY . '/library.php'; $s = new CATSearch(); $page_id = $s->getSearchPageID(); // load droplets extensions $h = CAT_Helper_Droplet::getInstance(); $h->register_droplet_css('SearchBox', $page_id, '/modules/' . SEARCH_LIBRARY . '/templates/default/', 'search.box.css'); $h->register_droplet_js('SearchBox', $page_id, '/modules/' . SEARCH_LIBRARY . '/templates/default/', 'search.box.js'); if (isset($_GET['string'])) { CAT_Helper_Page::addCSS(CAT_URL . '/modules/' . SEARCH_LIBRARY . '/templates/default/frontend.css');
/** * Print a message and redirect the user to another page * * @access public * @param mixed $message - message string or an array with a couple of messages * @param string $redirect - redirect url; default is "index.php" * @param boolean $auto_footer - optional flag to 'print' the footer. Default is true. * @param boolean $auto_exit - optional flag to call exit() (default) or not * @return void exit()s */ public static function printMsg($message, $redirect = 'index.php', $auto_footer = true, $auto_exit = true) { global $parser; if (true === is_array($message)) { $message = implode("<br />", $message); } $parser->setPath(CAT_THEME_PATH . '/templates'); $parser->setFallbackPath(CAT_THEME_PATH . '/templates'); $parser->output('success', array('MESSAGE' => CAT_Object::lang()->translate($message), 'REDIRECT' => $redirect, 'REDIRECT_TIMER' => CAT_Registry::get('REDIRECT_TIMER'))); if ($auto_footer == true) { $caller = debug_backtrace(); // remove first item (it's the printMsg() method itself) array_shift($caller); $caller_class = isset($caller[0]['class']) ? $caller[0]['class'] : NULL; if ($caller_class && method_exists($caller_class, "print_footer")) { if (is_object($caller_class)) { $caller_class->print_footer(); } else { $caller_class::print_footer(); } } else { //echo "unable to print footer - no such method $caller_class -> print_footer()"; } if ($auto_exit) { exit; } } }