public static function getInstance() { if (!self::$instance) { self::$instance = new self(); } return self::$instance; }
} else { trigger_error(sprintf("[ <b>%s</b> ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); } } $backend = CAT_Backend::getInstance('Settings', 'settings', false); $users = CAT_Users::getInstance(); header('Content-type: application/json'); if (!$users->checkPermission('Settings', 'settings')) { $ajax = array('message' => $backend->lang()->translate("Sorry, but you don't have the permissions for this action"), 'success' => false); print json_encode($ajax); exit; } require_once dirname(__FILE__) . '/../../config.php'; require_once dirname(__FILE__) . '/functions.php'; $settings = CAT_Registry::getSettings(); $region = CAT_Helper_Validate::get('_REQUEST', 'template'); $tpl = 'backend_settings_index_' . $region . '.tpl'; $data = getSettingsTable(); $tpl_data = array('values' => $data); $tpl_data['DISPLAY_ADVANCED'] = $users->checkPermission('Settings', 'settings_advanced'); switch ($region) { case 'frontend': $tpl_data['templates'] = getTemplateList('frontend'); $tpl_data['variants'] = array(); $info = CAT_Helper_Addons::checkInfo(CAT_PATH . '/templates/' . CAT_Registry::get('DEFAULT_TEMPLATE')); if (isset($info['module_variants']) && is_array($info['module_variants']) && count($info['module_variants'])) { $tpl_data['variants'] = $info['module_variants']; } break; case 'backend': $tpl_data['backends'] = getTemplateList('backend');
/** * initialize current page **/ private static final function init($page_id) { global $parser; $parser->setGlobals('PAGE_ID', $page_id); self::$instances[$page_id]->_page_id = $page_id; $prop = self::$instances[$page_id]->getProperties(); foreach ($prop as $key => $value) { if (!$value) { continue; } if (CAT_Registry::exists(strtoupper($key))) { continue; } if (is_array($value)) { continue; } CAT_Registry::register(strtoupper($key), $value, true); $parser->setGlobals(strtoupper($key), $value); } // Work-out if any possible in-line search boxes should be shown if (SEARCH == 'public') { CAT_Registry::register('SHOW_SEARCH', true, true); } elseif (SEARCH == 'private' and VISIBILITY == 'private') { CAT_Registry::register('SHOW_SEARCH', true, true); } elseif (SEARCH == 'private' and CAT_User::getInstance()->is_authenticated() == true) { CAT_Registry::register('SHOW_SEARCH', true, true); } elseif (SEARCH == 'registered' and CAT_User::getInstance()->is_authenticated() == true) { CAT_Registry::register('SHOW_SEARCH', true, true); } else { CAT_Registry::register('SHOW_SEARCH', false, true); } $parser->setGlobals('SHOW_SEARCH', SHOW_SEARCH); // Work-out if menu should be shown if (!defined('SHOW_MENU')) { CAT_Registry::register('SHOW_MENU', true, true); } // Work-out if login menu constants should be set if (FRONTEND_LOGIN) { $constants = array('LOGIN_URL' => CAT_URL . '/account/login.php', 'LOGOUT_URL' => CAT_URL . '/account/logout.php', 'FORGOT_URL' => CAT_URL . '/account/forgot.php', 'PREFERENCES_URL' => CAT_URL . '/account/preferences.php', 'SIGNUP_URL' => CAT_URL . '/account/signup.php'); // Set login menu constants CAT_Registry::register($constants, NULL, true); $parser->setGlobals(array('username_fieldname' => CAT_Helper_Validate::getInstance()->createFieldname('username_'), 'password_fieldname' => CAT_Helper_Validate::getInstance()->createFieldname('password_'), 'redirect_url' => isset($_SESSION['HTTP_REFERER']) && $_SESSION['HTTP_REFERER'] != '' ? $_SESSION['HTTP_REFERER'] : CAT_URL)); $parser->setGlobals($constants); } }
/** * sanitize URL (remove '/./', '/../', '//') **/ function sanitize_url($href) { return CAT_Helper_Validate::sanitize_url($href); }
/** * let admin set access permissions for modules of type 'page' and 'tool' * * @access public * @return **/ public static function setModulePermissions($addon_info) { $self = self::getInstance(); $check_permission = $addon_info['addon_function'] . '_permissions'; // get groups $stmt = $self->db()->query('SELECT * FROM `:prefix:groups` WHERE group_id <> 1'); if ($stmt->rowCount() > 0) { $group_ids = CAT_Helper_Validate::sanitizePost('group_id'); $allowed_groups = array(); // get marked groups if (is_array($group_ids)) { foreach ($group_ids as $gid) { $allowed_groups[$gid] = $gid; } } // get all known groups $groups = array(); while ($row = $stmt->fetchRow(MYSQL_ASSOC)) { $groups[$row['group_id']] = $row; $gid = $row['group_id']; // add newly installed module to any group that's NOT in the $allowed_groups array if (!array_key_exists($gid, $allowed_groups)) { // get current value $addons = explode(',', $groups[$gid][$check_permission]); // add newly installed module $addons[] = $addon_info['module_directory']; $addons = array_unique($addons); asort($addons); // Update the database $addon_permissions = implode(',', $addons); $self->db()->query(sprintf('UPDATE `:prefix:groups` SET `%s`=:val WHERE `group_id`=:id', $check_permission), array('val' => $addon_permissions, 'id' => $gid)); if ($self->db()->isError()) { self::printError($self->db()->getError()); return false; } } } return true; } else { return true; } }
$info = NULL; if (CAT_Helper_Validate::getInstance()->sanitizePost('submit')) { $val = CAT_Helper_Validate::getInstance(); $diffs = 0; foreach ($settings as $i => $set) { $field = $set['name']; if ($field == 'source') { continue; } $new = $val->sanitizePost($field); if ($new != $set['value']) { $settings[$i]['value'] = $new; $diffs++; } } if ($diffs) { $inc = file_get_contents(dirname(__FILE__) . '/data/config.inc.php'); $ainc = preg_split('~// --- do not change this manually, use the Admin Tool! ---~', $inc, NULL, PREG_SPLIT_DELIM_CAPTURE); $fh = fopen(dirname(__FILE__) . '/data/config.inc.php', 'w'); fwrite($fh, $ainc[0]); fwrite($fh, "// --- do not change this manually, use the Admin Tool! ---\n\$current = array(\n"); foreach ($settings as $i => $set) { fwrite($fh, " '" . $set['name'] . '\' => \'' . $set['value'] . '\',' . "\n"); } fwrite($fh, ');'); fclose($fh); $info = CAT_Helper_Validate::getInstance()->lang()->translate('Settings saved'); } } $parser->setPath(dirname(__FILE__) . '/templates/default'); $parser->output('tool.tpl', array('settings' => $settings, 'current' => $current, 'info' => $info));
/** * **/ function saveGroup($backend, $group) { global $groups; $settings = array(); $val = CAT_Helper_Validate::getInstance(); foreach ($groups[$group] as $key) { $settings[$key] = $val->sanitizePost($key); } saveSettings($settings); }
public function checkIDKEY($fieldname, $default = 0, $request = 'POST') { $val = CAT_Helper_Validate::get('_' . $request, $fieldname); return $val ? $val : $default; }
if (empty($sub)) { continue; } $dir .= '/' . $sub; if (file_exists($dir . '/framework/class.secure.php')) { include $dir . '/framework/class.secure.php'; $inc = true; break; } } if (!$inc) { trigger_error(sprintf("[ <b>%s</b> ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); } } // handle upload if (CAT_Helper_Validate::sanitizePost('upload') && isset($_FILES['userfile']) && is_array($_FILES['userfile'])) { $p = CAT_Helper_Upload::getInstance($_FILES['userfile'], CAT_PATH . '/temp'); $p->file_overwrite = true; $p->process(CAT_PATH . '/temp'); if ($p->processed) { $subdir = $p->file_dst_name_body; $z = CAT_Helper_Zip::getInstance(CAT_PATH . '/temp/' . $p->file_dst_name)->config('Path', CAT_PATH . '/modules/lib_jquery/plugins/' . $subdir); $z->extract(); } } // get already installed plugins $files = CAT_Helper_Directory::getInstance()->maxRecursionDepth(0)->getDirectories(CAT_PATH . '/modules/lib_jquery/plugins', CAT_PATH . '/modules/lib_jquery/plugins/'); $readmes = jqpmgr_getReadmes($files); $parser->setPath(CAT_PATH . '/modules/jquery_plugin_mgr/templates/default'); $parser->output('tool', array('plugins' => $files, 'readmes' => $readmes)); function jqpmgr_getReadmes($plugins)
$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); } } $backend = CAT_Backend::getInstance('pages', 'pages_modify'); $update_when_modified = true; // Tells script to update when this page was last updated require CAT_PATH . '/modules/admin.php'; // Update the mod_wrapper table with the contents if (isset($_POST['url'])) { $url = CAT_Helper_Validate::sanitize_url($_POST['url']); $height = isset($_POST['height']) ? $_POST['height'] : '400px'; $width = isset($_POST['width']) ? $_POST['width'] : '100%'; $type = isset($_POST['wrapper_type']) ? $_POST['wrapper_type'] : 'object'; if (is_numeric($height)) { $height .= 'px'; } if (is_numeric($width)) { $width .= 'px'; } $query = "UPDATE `:prefix:mod_wrapper` SET `url`=:url,`height`=:height,`width`=:width,`wtype`=:wtype WHERE `section_id`=:sec"; $database->query($query, array('url' => $url, 'height' => $height, 'width' => $width, 'wtype' => $type, 'sec' => $section_id)); } // Check if there is a database error, otherwise say successful if ($database->isError()) { $admin->print_error($database->getError(), $js_back);
/** * methods declared in class.wb.php in WB, needed here for modules like Bakery **/ public function add_slashes($input) { return CAT_Helper_Validate::add_slashes($input); }
function Dwoo_Plugin_get_session(Dwoo $dwoo, $key, $require = NULL) { return CAT_Helper_Validate::getInstance()->fromSession($key, $require); }
} 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); } } $backend = CAT_Backend::getInstance('Access', 'groups', false); $users = CAT_Users::getInstance(); header('Content-type: application/json'); if (!$users->checkPermission('Access', 'groups')) { $ajax = array('message' => $backend->lang()->translate('You do not have the permission to view groups'), 'success' => false); print json_encode($ajax); exit; } $group_id = CAT_Helper_Validate::sanitizePost('id', 'numeric'); if (!$group_id) { $ajax = array('message' => $backend->lang()->translate('You sent an invalid value'), 'success' => false); print json_encode($ajax); exit; } $get_group = $backend->db()->query("SELECT * FROM `:prefix:groups` WHERE group_id = :id", array('id' => $group_id)); $members = array(); $group_members = $users->getMembers($group_id); if (count($group_members)) { foreach ($group_members as $member) { $members[] = $member['display_name'] . ' (' . $member['username'] . ')'; } } // ============================================== // ! Insert admin group and current group first
$backend->print_error('Cannot save file', CAT_ADMIN_URL . '/pages/modify.php?page_id=' . $page_id); } else { $backend->print_success('Success', CAT_ADMIN_URL . '/pages/modify.php?page_id=' . $page_id); } } } else { if (!CAT_Helper_Validate::sanitizePost('edit_file')) { // find JS files $js = CAT_Helper_Directory::getInstance()->maxRecursionDepth(5)->setSuffixFilter(array('js'))->scanDirectory($path, true, true, $path); // find CSS files $css = CAT_Helper_Directory::getInstance()->maxRecursionDepth(5)->setSuffixFilter(array('css'))->scanDirectory($path, true, true, $path); $list = true; } else { $file = CAT_Helper_Directory::sanitizePath($path . '/' . CAT_Helper_Validate::sanitizePost('edit_file')); if (!file_exists($file)) { $backend->printFatalError("No such file"); } $in = fopen($file, 'r'); $code = fread($in, filesize($file)); fclose($in); if (file_exists(CAT_PATH . '/modules/edit_area/include.php')) { include_once CAT_PATH . '/modules/edit_area/include.php'; ea_syntax('css'); $js = show_wysiwyg_editor('code', 'code', $code, '100%', '350px', false); $code = NULL; } } $page = CAT_Helper_Page::properties($page_id); $parser->output('backend_addons_editfile.tpl', array('code' => $code, 'js' => $js, 'css' => $css, 'page_id' => $page_id, 'section_id' => $section_id, 'mod_dir' => CAT_Helper_Validate::sanitizePost('mod_dir'), 'edit_file' => CAT_Helper_Validate::sanitizePost('edit_file'), 'list' => $list, 'PAGE_TITLE' => $page['page_title'], 'PAGE_ID' => $page_id, 'PAGE_HEADER' => $backend->lang()->translate('Modify file'))); } $backend->print_footer();
$installer_uri = dirname($installer_uri); $installer_uri = str_ireplace('update', '', $installer_uri); $lang = CAT_Helper_I18n::getInstance(); $lang->addFile($lang->getLang() . '.php', dirname(__FILE__) . '/../languages'); if (!CAT_Helper_Addons::versionCompare(CAT_VERSION, '0.11.0Beta')) { pre_update_error($lang->translate('You need to have <strong>BlackCat CMS v0.11.0Beta</strong> installed to use the Update.<br />You have <strong>{{version}}</strong> installed.', array('version' => CAT_VERSION))); } // get new version from tag.txt if (file_exists(dirname(__FILE__) . '/../tag.txt')) { $tag = fopen(dirname(__FILE__) . '/../tag.txt', 'r'); list($current_version, $current_build, $current_build) = explode('#', fgets($tag)); fclose($tag); } else { pre_update_error($lang->translate('The file <pre>tag.txt</pre> is missing! Unable to upgrade!')); } if (!CAT_Helper_Validate::getInstance()->sanitizeGet('do')) { update_wizard_header(); echo ' <h1>BlackCat CMS Update Wizard</h1> <h2>' . $lang->translate('Welcome!') . '</h2> ' . $lang->translate('This wizard will help you to upgrade your current BlackCat CMS Version') . '<br /> <span style="font-weight:bold;color:#f00;">' . CAT_VERSION . '</span><br /> ' . $lang->translate('to Version') . '<br /> <span style="font-weight:bold;color:#f00;">' . $current_version . ' Build ' . $current_build . '</span> <form method="get" action="' . $installer_uri . '/update/update.php"> <input type="hidden" name="do" value="1" /> <input type="submit" value="' . $lang->translate('To start the update, please click here') . '" /> </form> '; update_wizard_footer(); }
$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; }
/** * load headers.inc.php for sections * * @access private * @param string $for - frontend | backend * @return void **/ private static function _load_sections($for = 'frontend') { global $page_id; // make sure we have a page_id if (!$page_id) { $page_id = CAT_Helper_Validate::get('_REQUEST', 'page_id', 'numeric'); } if ($page_id && is_numeric($page_id)) { $sections = self::getSections($page_id); $wysiwyg_seen = false; self::$instance->log()->logDebug('sections:', $sections); if (is_array($sections) && count($sections)) { global $current_section; global $wysiwyg_seen; foreach ($sections as $block_id => $item) { foreach ($item as $section) { $module = $section['module']; $file = CAT_Helper_Directory::sanitizePath(CAT_PATH . '/modules/' . $module . '/headers.inc.php'); // find header definition file if (file_exists($file)) { self::$instance->log()->logDebug(sprintf('loading headers.inc.php for module [%s]', $module)); $current_section = $section['section_id']; self::_load_headers_inc($file, $for, 'modules/' . $module, $current_section); } array_push(CAT_Helper_Page::$css_search_path, '/modules/' . $module, '/modules/' . $module . '/css'); array_push(CAT_Helper_Page::$js_search_path, '/modules/' . $module, '/modules/' . $module . '/js'); } // foreach ($sections as $section) } } // if (count($sections)) // always add WYSIWYG headers, some modules may use show_wysiwyg_editor() later on if (!$wysiwyg_seen) { if (file_exists(CAT_PATH . '/modules/' . WYSIWYG_EDITOR . '/headers.inc.php')) { self::$instance->log()->logDebug('adding headers.inc.php for wysiwyg'); self::_load_headers_inc(CAT_Helper_Directory::sanitizePath(CAT_PATH . '/modules/' . WYSIWYG_EDITOR . '/headers.inc.php'), $for, CAT_PATH . '/modules/' . WYSIWYG_EDITOR); } $wysiwyg_seen = true; } // search if ($for == 'frontend' && CAT_Registry::get('SHOW_SEARCH') === true) { array_push(CAT_Helper_Page::$js_search_path, '/modules/' . CAT_Registry::get('SEARCH_LIBRARY') . '/templates/custom/', '/modules/' . CAT_Registry::get('SEARCH_LIBRARY') . '/templates/default/'); } } }
/** * set login error and increase number of login attempts * * @access private * @param string $msg - error message * @return void **/ private static function setLoginError($msg) { self::$loginerror = $msg; self::$lasterror = $msg; self::$errorstack[] = $msg; if (!isset($_SESSION['ATTEMPTS'])) { $_SESSION['ATTEMPTS'] = 0; } else { $_SESSION['ATTEMPTS'] = CAT_Helper_Validate::getInstance()->fromSession('ATTEMPTS') + 1; } }
/** * get globally stored data * * @access public * @param string $key * @param string $require - function to check value with * i.e. 'array' => is_array() * @param mixed $default - default value to return if the key is not found **/ public static function get($key, $require = NULL, $default = NULL) { $return_value = NULL; if (isset(self::$REGISTRY[$key])) { if ($require) { $return_value = CAT_Helper_Validate::check(self::$REGISTRY[$key], $require); } else { $return_value = self::$REGISTRY[$key]; } } if (!$return_value) { if ($require && $require == 'array') { if ($default && is_array($default)) { return $default; } else { return array(); } } return NULL; } return $return_value; }
$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; } } }
/** * get currently used timezone string **/ public static function getTimezone() { $tz = CAT_Helper_Validate::getInstance()->fromSession('TIMEZONE_STRING'); return isset($tz) ? $tz : DEFAULT_TIMEZONE_STRING; }
/** * **/ 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; }
readfile("{$filename}"); exit; } } else { echo CAT_Helper_Validate::getInstance()->lang()->translate("File not found") . ": " . str_ireplace(array(str_replace('\\', '/', CAT_PATH), '\\'), array('/abs/path/to', '/'), $file); } exit; } // remove if (CAT_Helper_Validate::sanitizePost('remove')) { $date = CAT_Helper_Validate::sanitizePost('remove'); $file = CAT_Helper_Directory::sanitizePath(CAT_PATH . '/temp/logs/log_' . $date . '.txt'); if (file_exists($file)) { unlink($file); } else { echo CAT_Helper_Validate::getInstance()->lang()->translate("File not found") . ": " . str_ireplace(array(str_replace('\\', '/', CAT_PATH), '\\'), array('/abs/path/to', '/'), $file); } exit; } // clean up log files (older than 24 hours and size 0) $files = CAT_Helper_Directory::findFiles('log_\\d{4}-\\d{2}-\\d{2}\\.txt', CAT_PATH . '/temp'); 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) {
include CAT_PATH . '/framework/class.secure.php'; } 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'])) {
* @package CAT_Core * */ define('CAT_LOGIN_PHASE', 1); if (defined('CAT_PATH')) { include CAT_PATH . '/framework/class.secure.php'; } 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 (CAT_Helper_Validate::getInstance()->fromSession('ATTEMPTS') > MAX_ATTEMPTS) { $redirect = CAT_URL . '/templates/' . DEFAULT_THEME . '/templates/warning.html'; $ajax = array('url' => $redirect, 'success' => true, 'message' => NULL); } else { #CAT_Helper_Protect::getInstance()->enableCSRFMagic(); $redirect = CAT_Users::getInstance()->handleLogin(); $error = CAT_Users::getInstance()->loginError(); $ajax = array('url' => $redirect, 'success' => CAT_Users::getInstance()->is_authenticated(), 'message' => $redirect === false || $error ? $error : NULL); } header('Content-type: application/json'); print json_encode($ajax); exit;
include CAT_PATH . '/framework/class.secure.php'; } 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); } } $update_when_modified = true; $val = CAT_Helper_Validate::getInstance(); $user = CAT_Users::getInstance(); $backend = CAT_Backend::getInstance('Pages', 'pages_modify'); // =============== // ! Get page id // =============== $page_id = $val->get('_REQUEST', 'page_id', 'numeric'); $section_id = $val->get('_REQUEST', 'section_id', 'numeric'); if (!$page_id) { header("Location: index.php"); exit(0); } // ============= // ! Get perms // ============= if (CAT_Helper_Page::getPagePermission($page_id, 'admin') !== true) {
} else { trigger_error(sprintf("[ <b>%s</b> ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); } } require_once dirname(__FILE__) . '/../../config.php'; require_once dirname(__FILE__) . '/../../framework/functions.php'; $backend = CAT_Backend::getInstance('Addons', 'addons', false); $users = CAT_Users::getInstance(); header('Content-type: application/json'); if (!$users->checkPermission('Addons', 'addons')) { $ajax = array('message' => $backend->lang()->translate("Sorry, but you don't have the permissions for this action"), 'success' => false); print json_encode($ajax); exit; } $module = CAT_Helper_Validate::sanitizePost('module'); $type = CAT_Helper_Validate::sanitizePost('type'); if (CAT_Helper_Addons::isModuleInstalled($module, NULL, $type)) { $info = CAT_Helper_Addons::checkInfo(CAT_Helper_Directory::sanitizePath(CAT_PATH . '/' . $type . 's/' . $module)); } else { $path = CAT_Helper_Directory::sanitizePath(CAT_PATH . '/' . $type . '/' . $module . ($type == 'languages' ? '.php' : '')); $info = CAT_Helper_Addons::checkInfo($path); } if (!is_array($info) || !count($info)) { $ajax = array('message' => $backend->lang()->translate("No Addon info available, seems to be an invalid addon!"), 'success' => false); print json_encode($ajax); exit; } $addon = array('type' => $info['addon_function'], 'installed' => NULL, 'upgraded' => NULL, 'removable' => 'Y'); foreach ($info as $key => $value) { $key = preg_replace('/^(module_|addon_)/i', '', $key); $addon[$key] = $value;