/** * **/ function delete_droplets() { global $parser, $val, $backend; $groups = CAT_Users::get_groups_id(); if (!CAT_Helper_Droplet::is_allowed('delete_droplets', $groups)) { $backend->print_error($backend->lang()->translate("You don't have the permission to do this")); } $errors = array(); // get all marked droplets $marked = isset($_POST['markeddroplet']) ? $_POST['markeddroplet'] : array(); if (isset($marked) && !is_array($marked)) { $marked = array($marked); } if (!count($marked)) { list_droplets($backend->lang()->translate('Please mark some Droplet(s) to delete')); return; // should never be reached } foreach ($marked as $id) { $data = CAT_Helper_Droplet::getDroplet($id); $error = CAT_Helper_Droplet::deleteDroplet($id); if ($error) { $errors[] = $error; } // look for a data file if (file_exists(dirname(__FILE__) . '/data/' . $data['name'] . '.txt')) { @unlink(CAT_Helper_Directory::sanitizePath(dirname(__FILE__) . '/data/' . $data['name'] . '.txt')); } elseif (file_exists(dirname(__FILE__) . '/data/' . strtolower($data['name']) . '.txt')) { @unlink(CAT_Helper_Directory::sanitizePath(dirname(__FILE__) . '/data/' . strtolower($data['name']) . '.txt')); } elseif (file_exists(dirname(__FILE__) . '/data/' . strtoupper($data['name']) . '.txt')) { @unlink(CAT_Helper_Directory::sanitizePath(dirname(__FILE__) . '/data/' . strtoupper($data['name']) . '.txt')); } } if (CAT_Helper_Validate::sanitizeGet('ajax')) { echo json_encode(array('success' => true, 'message' => 'Done')); } else { list_droplets(implode("<br />", $errors)); } return; }
$backend = CAT_Backend::getInstance('Start', 'start', false, false); if (!CAT_Users::is_authenticated()) { exit; } // just to be _really_ sure... require CAT_PATH . '/framework/CAT/ExceptionHandler.php'; // register exception/error handlers set_exception_handler(array("CAT_ExceptionHandler", "exceptionHandler")); set_error_handler(array("CAT_ExceptionHandler", "errorHandler")); register_shutdown_function(array("CAT_ExceptionHandler", "shutdownHandler")); include dirname(__FILE__) . '/../data/config.inc.php'; $widget_name = 'Version check'; $error = $version = $newer = $last = $last_version = NULL; $debug = false; $doit = true; if (!CAT_Helper_Validate::sanitizeGet('blackcat_refresh')) { $file = CAT_Helper_Directory::sanitizePath(dirname(__FILE__) . '/../data/.last'); if (file_exists($file)) { $fh = @fopen($file, 'r'); if (is_resource($fh)) { $last = fgets($fh); fclose($fh); } } if ($last) { list($last, $last_version) = explode('|', $last); if ($last > time() - 60 * 60 * 24) { $doit = false; } } }
$parser->setGlobals('TOOL_URL', CAT_ADMIN_URL . '/admintools/tool.php?tool=' . $tool['directory']); // Check if folder of tool exists if (file_exists(CAT_PATH . '/modules/' . $tool['directory'] . '/tool.php')) { // load language file (if any) $langfile = CAT_Helper_Directory::sanitizePath(CAT_PATH . '/modules/' . $tool['directory'] . '/languages/' . LANGUAGE . '.php'); if (file_exists($langfile)) { if (!$backend->lang()->checkFile($langfile, 'LANG', true)) { // old fashioned language file require $langfile; } else { // modern language file $backend->lang()->addFile(LANGUAGE . '.php', CAT_Helper_Directory::sanitizePath(CAT_PATH . '/modules/' . $tool['directory'] . '/languages')); } } // Cache the tool and add it to dwoo if (!CAT_Helper_Validate::sanitizeGet('ajax')) { ob_start(); require CAT_Helper_Directory::sanitizePath(CAT_PATH . '/modules/' . $tool['directory'] . '/tool.php'); $tpl_data['TOOL'] = ob_get_contents(); ob_clean(); // allow multiple buffering for csrf-magic } else { require CAT_Helper_Directory::sanitizePath(CAT_PATH . '/modules/' . $tool['directory'] . '/tool.php'); return; } // Check whether icon is available for the admintool if (file_exists(CAT_PATH . '/modules/' . $tool['directory'] . '/icon.png')) { list($width, $height, $type, $attr) = getimagesize(CAT_PATH . '/modules/' . $tool['directory'] . '/icon.png'); // Check whether file is 32*32 pixel and is an PNG-Image $tpl_data['ICON'] = $width == 32 && $height == 32 && $type == 3 ? CAT_URL . '/modules/' . $tool['directory'] . '/icon.png' : false; }
if (CAT_Helper_Validate::sanitizePost('file')) { $date = CAT_Helper_Validate::sanitizePost('file'); $file = CAT_Helper_Directory::sanitizePath(CAT_PATH . '/temp/logs/log_' . $date . '.txt'); if (file_exists($file)) { $lines = file($file); $output = implode('<br />', $lines); $output = str_replace(array('INFO', 'WARN', 'CRIT'), array('<span style="color:#006600">INFO</span>', '<span style="color:#FF6600">WARN</span>', '<span style="color:#990000;font-weight:900;">CRIT</span>'), $output); echo $output; } else { echo CAT_Helper_Validate::getInstance()->lang()->translate("File not found") . ": " . str_ireplace(array(str_replace('\\', '/', CAT_PATH), '\\'), array('/abs/path/to', '/'), $file); } exit; } // download if (CAT_Helper_Validate::sanitizeGet('dl')) { $date = CAT_Helper_Validate::sanitizeGet('dl'); $file = CAT_Helper_Directory::sanitizePath(CAT_PATH . '/temp/logs/log_' . $date . '.txt'); if (file_exists($file)) { $zip = CAT_Helper_Zip::getInstance(pathinfo($file, PATHINFO_DIRNAME) . '/' . pathinfo($file, PATHINFO_FILENAME) . '.zip'); $zip->config('removePath', pathinfo($file, PATHINFO_DIRNAME))->create(array($file)); if (!$zip->errorCode() == 0) { echo CAT_Helper_Validate::getInstance()->lang()->translate("Unable to pack the file") . ": " . str_ireplace(array(str_replace('\\', '/', CAT_PATH), '\\'), array('/abs/path/to', '/'), $file); } else { $filename = pathinfo($file, PATHINFO_DIRNAME) . '/' . pathinfo($file, PATHINFO_FILENAME) . '.zip'; header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); // required for certain browsers header("Content-Type: application/zip");
/** * Print the admin header * * @access public * @return void */ public function print_header() { global $parser; $tpl_data = array(); $addons = CAT_Helper_Addons::getInstance(); $user = CAT_Users::getInstance(); // Connect to database and get website title if (!CAT_Registry::exists('WEBSITE_TITLE')) { $title = $this->db()->query("SELECT `value` FROM `:prefix:settings` WHERE `name`='website_title'")->fetchColumn(); CAT_Registry::define('WEBSITE_TITLE', $title, true); } // check current URL for page tree $uri = CAT_Helper_Validate::get('_SERVER', 'SCRIPT_NAME'); // init template search paths self::initPaths(); // ================================= // ! Add permissions to $tpl_data // ================================= $tpl_data['permission']['pages'] = $user->checkPermission('pages', 'pages', false); $tpl_data['permission']['pages_add'] = $user->checkPermission('pages', 'pages_add', false); $tpl_data['permission']['pages_add_l0'] = $user->checkPermission('pages', 'pages_add_l0', false); $tpl_data['permission']['pages_modify'] = $user->checkPermission('pages', 'pages_modify', false); $tpl_data['permission']['pages_delete'] = $user->checkPermission('pages', 'pages_delete', false); $tpl_data['permission']['pages_settings'] = $user->checkPermission('pages', 'pages_settings', false); $tpl_data['permission']['pages_intro'] = $user->checkPermission('pages', 'pages_intro', false) != true || INTRO_PAGE != 'enabled' ? false : true; if ($tpl_data['permission']['pages'] == true) { $tpl_data['DISPLAY_MENU_LIST'] = CAT_Registry::get('MULTIPLE_MENUS') != false ? true : false; $tpl_data['DISPLAY_LANGUAGE_LIST'] = CAT_Registry::get('PAGE_LANGUAGES') != false ? true : false; $tpl_data['DISPLAY_SEARCHING'] = CAT_Registry::get('SEARCH') != false ? true : false; // ========================== // ! Get info for pagesTree // ========================== $pages = CAT_Helper_Page::getPages(true); $sections = CAT_Helper_Page::getSections(); // create LI content for ListBuilder foreach ($pages as $i => $page) { if (isset($sections[$page['page_id']]) && count($sections[$page['page_id']])) { $page['page_title'] .= "\n" . count($sections[$page['page_id']]) . ' ' . $user->lang()->translate('active sections') . ':'; foreach ($sections[$page['page_id']] as $block_id => $section) { foreach ($section as $item) { $page['page_title'] .= "\n" . $item['module'] . ' (ID:' . $item['section_id'] . ')'; } } } $text = $parser->get('backend_pagetree_item', array_merge($page, array('action' => pathinfo($uri, PATHINFO_FILENAME) == 'lang_settings' ? 'lang_settings' : 'modify'))); $pages[$i]['text'] = $text; } // list of first level of pages $tpl_data['pages'] = CAT_Helper_ListBuilder::getInstance()->config(array('__li_level_css' => true, '__li_id_prefix' => 'pageid_', '__li_css_prefix' => 'fc_page_', '__li_has_child_class' => 'fc_expandable', '__is_open_key' => 'be_tree_is_open', '__li_is_open_class' => 'fc_tree_open', '__li_is_closed_class' => 'fc_tree_close', '__title_key' => 'text'))->tree($pages, 0); // number of editable pages (for current user) $tpl_data['pages_editable'] = CAT_Helper_Page::getEditable(); // ========================================== // ! Get info for the form to add new pages // ========================================== $tpl_data['templates'] = $addons->get_addons(CAT_Registry::get('DEFAULT_TEMPLATE'), 'template', 'template'); $tpl_data['languages'] = $addons->get_addons(CAT_Registry::get('DEFAULT_LANGUAGE'), 'language'); $tpl_data['modules'] = $addons->get_addons('wysiwyg', 'module', 'page'); $tpl_data['groups'] = $user->get_groups(); // =========================================== // ! Check and set permissions for templates // =========================================== foreach ($tpl_data['templates'] as $key => $template) { $tpl_data['templates'][$key]['permissions'] = $user->get_permission($template['VALUE'], 'template') ? true : false; } } // ========================= // ! Add Metadatas to Dwoo // ========================= $tpl_data['META']['CHARSET'] = true === defined('DEFAULT_CHARSET') ? DEFAULT_CHARSET : 'utf-8'; $tpl_data['META']['LANGUAGE'] = strtolower(CAT_Registry::get('LANGUAGE')); $tpl_data['META']['WEBSITE_TITLE'] = WEBSITE_TITLE; $tpl_data['CAT_VERSION'] = CAT_Registry::get('CAT_VERSION'); $tpl_data['CAT_CORE'] = CAT_Registry::get('CAT_CORE'); $tpl_data['PAGE_EXTENSION'] = CAT_Registry::get('PAGE_EXTENSION'); $date_search = array('Y', 'j', 'n', 'jS', 'l', 'F'); $date_replace = array('yy', 'y', 'm', 'd', 'DD', 'MM'); $tpl_data['DATE_FORMAT'] = str_replace($date_search, $date_replace, CAT_Registry::get('CAT_DATE_FORMAT')); $time_search = array('H', 'i', 's', 'g'); $time_replace = array('hh', 'mm', 'ss', 'h'); $tpl_data['TIME_FORMAT'] = str_replace($time_search, $time_replace, CAT_Registry::get('TIME_FORMAT')); $tpl_data['SESSION'] = session_name(); $tpl_data['HEAD']['SECTION_NAME'] = $this->lang()->translate(strtoupper(self::$instance->section_name)); $tpl_data['DISPLAY_NAME'] = $user->get_display_name(); $tpl_data['USER'] = $user->get_user_details($user->get_user_id()); // =================================================================== // ! Add arrays for main menu, options menu and the Preferences-Button // =================================================================== $tpl_data['MAIN_MENU'] = array(); $tpl_data['MAIN_MENU'][0] = array('link' => CAT_ADMIN_URL . '/start/index.php', 'title' => $this->lang()->translate('Start'), 'permission_title' => 'start', 'permission' => $user->checkPermission('start', 'start') ? true : false, 'current' => 'start' == strtolower($this->section_name) ? true : false); $tpl_data['MAIN_MENU'][1] = array('link' => CAT_ADMIN_URL . '/media/index.php', 'title' => $this->lang()->translate('Media'), 'permission_title' => 'media', 'permission' => $user->checkPermission('media', 'media') ? true : false, 'current' => 'media' == strtolower($this->section_name) ? true : false); $tpl_data['MAIN_MENU'][2] = array('link' => CAT_ADMIN_URL . '/settings/index.php', 'title' => $this->lang()->translate('Settings'), 'permission_title' => 'settings', 'permission' => $user->checkPermission('settings', 'settings') ? true : false, 'current' => 'settings' == strtolower($this->section_name) ? true : false); $tpl_data['MAIN_MENU'][3] = array('link' => CAT_ADMIN_URL . '/addons/index.php', 'title' => $this->lang()->translate('Addons'), 'permission_title' => 'addons', 'permission' => $user->checkPermission('addons', 'addons') ? true : false, 'current' => 'addons' == strtolower($this->section_name) ? true : false); $tpl_data['MAIN_MENU'][4] = array('link' => CAT_ADMIN_URL . '/admintools/index.php', 'title' => $this->lang()->translate('Admin-Tools'), 'permission_title' => 'admintools', 'permission' => $user->checkPermission('admintools', 'admintools') ? true : false, 'current' => 'admintools' == strtolower($this->section_name) ? true : false); $tpl_data['MAIN_MENU'][5] = array('link' => CAT_ADMIN_URL . '/users/index.php', 'title' => $this->lang()->translate('Access'), 'permission_title' => 'access', 'permission' => $user->checkPermission('access', 'access') ? true : false, 'current' => 'access' == strtolower($this->section_name) ? true : false); // ======================================= // ! Seperate access-link by permissions // ======================================= if ($user->get_permission('users')) { $tpl_data['MAIN_MENU'][5]['link'] = CAT_ADMIN_URL . '/users/index.php'; } elseif ($user->get_permission('groups')) { $tpl_data['MAIN_MENU'][5]['link'] = CAT_ADMIN_URL . '/groups/index.php'; } $tpl_data['PREFERENCES'] = array('link' => CAT_ADMIN_URL . '/preferences/index.php', 'title' => $this->lang()->translate('Preferences'), 'permission_title' => 'preferences', 'permission' => $this->get_link_permission('preferences') ? true : false, 'current' => 'preferences' == strtolower($this->section_name) ? true : false); $tpl_data['section_name'] = strtolower($this->section_name); $tpl_data['page_id'] = CAT_Helper_Validate::sanitizeGet('page_id', 'numeric') && CAT_Helper_Validate::sanitizeGet('page_id') != '' ? CAT_Helper_Validate::sanitizeGet('page_id') : (CAT_Helper_Validate::sanitizePost('page_id', 'numeric') && CAT_Helper_Validate::sanitizePost('page_id') != '' ? CAT_Helper_Validate::sanitizePost('page_id') : false); // ==================== // ! Parse the header // ==================== $parser->output('header', $tpl_data); }
public function get_get($field) { return CAT_Helper_Validate::sanitizeGet($field); }