function wysiwyg_search($func_vars) { extract($func_vars, EXTR_PREFIX_ALL, 'func'); // how many lines of excerpt we want to have at most $max_excerpt_num = $func_default_max_excerpt; $divider = "."; $result = false; // we have to get 'content' instead of 'text', because strip_tags() // doesn't remove scripting well. // scripting will be removed later on automatically $query = $func_database->query(sprintf("SELECT content FROM `%smod_wysiwyg` WHERE section_id='%d'", CAT_TABLE_PREFIX, $func_section_id)); if ($query->numRows() > 0) { if ($res = $query->fetchRow()) { if (CAT_Helper_Addons::isModuleInstalled('kit_framework')) { // remove all kitCommands from the content preg_match_all('/(~~)( | )(.){3,512}( | )(~~)/', $res['content'], $matches, PREG_SET_ORDER); foreach ($matches as $match) { $res['content'] = str_replace($match[0], '', $res['content']); } } $mod_vars = array('page_link' => $func_page_link, 'page_link_target' => SEC_ANCHOR . "#section_{$func_section_id}", 'page_title' => $func_page_title, 'page_description' => $func_page_description, 'page_modified_when' => $func_page_modified_when, 'page_modified_by' => $func_page_modified_by, 'text' => $res['content'] . $divider, 'max_excerpt_num' => $max_excerpt_num); if (print_excerpt2($mod_vars, $func_vars)) { $result = true; } } } return $result; }
} // reload settings $config = wysiwyg_admin_config(); } } if (isset($config['plugins']) && $config['plugins'] != '') { $seen = explode(',', $config['plugins']); foreach ($seen as $item) { $plugins_checked[$item] = 1; } } if (isset($config['filemanager']) && $config['filemanager'] != '') { $filemanager_checked[$config['filemanager']] = true; } $parser->setPath(dirname(__FILE__) . "/templates/default"); $parser->output('tool', array('width_unit_em' => '', 'width_unit_px' => '', 'width_unit_proz' => '', 'height_unit_em' => '', 'height_unit_px' => '', 'height_unit_proz' => '', 'action' => CAT_ADMIN_URL . '/admintools/tool.php?tool=wysiwyg_admin', 'id' => WYSIWYG_EDITOR, 'skins' => $skins, 'toolbars' => $toolbars, 'current_toolbar' => $c->getToolbar($config), 'width' => $width, 'height' => $height, 'current_skin' => $c->getSkin($config), 'preview' => $preview, 'settings' => $settings, 'config' => $config, 'errors' => $errors, 'plugins' => $plugins, 'filemanager' => $filemanager, 'plugins_checked' => $plugins_checked, 'filemanager_checked' => $filemanager_checked, 'htmlpurifier' => CAT_Helper_Addons::isModuleInstalled('lib_htmlpurifier'), 'enable_htmlpurifier' => $enable_htmlpurifier, 'width_unit_' . ($width_unit == '%' ? 'proz' : $width_unit) => 'checked="checked"', 'height_unit_' . ($height_unit == '%' ? 'proz' : $height_unit) => 'checked="checked"')); // get current settings function wysiwyg_admin_config() { global $backend; $query = "SELECT * from `:prefix:mod_wysiwyg_admin_v2` where `editor`='" . WYSIWYG_EDITOR . "'"; $result = $backend->db()->query($query); $config = array(); if ($result->numRows()) { while (false !== ($row = $result->fetch())) { if (substr_count($row['set_value'], '#####')) { $row['set_value'] = explode('#####', $row['set_value']); } $config[$row['set_name']] = $row['set_value']; } }
} 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); } } $local = array('pages' => 'backend_pages_modify.js', 'access' => 'backend_users_index.js', 'addons' => 'backend_addons.js', 'media' => 'backend_media.js', 'preferences' => 'backend_preferences.js', 'settings' => array('backend_pages_modify.js', 'backend_settings_index.js'), 'login_index' => 'login.js'); $mod_headers = array('backend' => array('meta' => array(array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1')), 'css' => array(array('media' => 'screen', 'file' => 'templates/freshcat/css/default/index.css'), array('media' => 'screen', 'file' => 'modules/lib_jquery/plugins/qtip2/qtip2.min.css')), 'jquery' => array(array('core' => true, 'ui' => true, 'all' => array('jquery.highlight', 'jquery.cookies', 'tag-it', 'qtip2', 'jquery.form', 'jquery.livesearch', 'jquery.smarttruncation', 'cattranslate'))), 'js' => array(array('debug.js', 'jquery.fc_set_tab_list.js', 'jquery.fc_toggle_element.js', 'jquery.fc_resize_elements.js', 'jquery.fc_show_popup.js', 'general.js', 'pages_tree.js', 'session.js')))); // get current backend section to add local JS $page = strtolower(CAT_Backend::getInstance()->section_name); if (isset($local[$page])) { if (!is_array($local[$page])) { $local[$page] = array($local[$page]); } $mod_headers['backend']['js'][0] = array_merge($mod_headers['backend']['js'][0], $local[$page]); } if ($page == 'addons') { array_push($mod_headers['backend']['css'], array('file' => 'templates/freshcat/css/default/tabs.css')); if (CAT_Helper_Addons::isModuleInstalled('lib_dropzone')) { $mod_headers['backend']['js'][0][] = '/modules/lib_dropzone/vendor/dropzone.min.js'; array_push($mod_headers['backend']['css'], array('file' => 'modules/lib_dropzone/vendor/dropzone.min.css')); } array_push($mod_headers['backend']['css'], array('file' => 'templates/freshcat/css/default/addons.css')); } // check for custom JS for current backend page if (CAT_Registry::get('DEFAULT_THEME_VARIANT') == 'custom') { if (file_exists(dirname(__FILE__) . '/templates/custom/backend_' . $page . '.js')) { $mod_headers['backend']['js'][0][] = '/custom/backend_' . $page . '.js'; } }
} if ($get_tool == '') { header("Location: index.php"); exit(0); } // check tool permission if (!CAT_Users::get_permission($get_tool, 'module')) { header("Location: index.php"); exit(0); } global $parser; $parser->setGlobals('CAT_ADMIN_URL', CAT_ADMIN_URL); // ============================== // ! Check if tool is installed // ============================== if (!CAT_Helper_Addons::isModuleInstalled($get_tool)) { header("Location: index.php"); exit(0); } $tool = CAT_Helper_Addons::getAddonDetails($get_tool); // Set toolname $tpl_data['TOOL_NAME'] = $tool['name']; $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;
$ajax = array('message' => $backend->lang()->translate('You do not have the permissions to modify this page.'), 'success' => false); print json_encode($ajax); exit; } // ========================== // ! Set module permissions // ========================== $module_permissions = $_SESSION['MODULE_PERMISSIONS']; $add_module = $val->add_slashes($val->sanitizePost('add_module')); $add_to_block = $val->add_slashes($val->sanitizePost('add_to_block')); if ($add_module != '') { // Get section info $module = preg_replace("/\\W/", "", $add_module); // fix secunia 2010-91-4 // check if the module exists if (!CAT_Helper_Addons::isModuleInstalled($add_module)) { $ajax = array('message' => $backend->lang()->translate('The module [{{module}}] does not exist / is not installed', array('module' => $add_module)), 'success' => false); print json_encode($ajax); exit; } // check module permission if (!CAT_Helper_Addons::checkModulePermissions($add_module)) { $ajax = array('message' => $backend->lang()->translate('Sorry, but you don\'t have the permissions for this action.'), 'success' => false); print json_encode($ajax); exit; } // make sure we have a valid block id $add_to_block = is_numeric($add_to_block) && $add_to_block > 0 ? $add_to_block : 1; // re-order require CAT_PATH . '/framework/class.order.php'; $order = new order(CAT_TABLE_PREFIX . 'sections', 'position', 'section_id', 'page_id');
break; case 'administration': $type_name = $backend->lang()->translate('Administration'); break; case 'snippet': $type_name = $backend->lang()->translate('Code-Snippet'); break; case 'library': $type_name = $backend->lang()->translate('Library'); break; default: $type_name = $backend->lang()->translate('Unknown'); } $addon['function'] = $type_name; // Check if the module is installable or upgradeable $addon['INSTALL'] = file_exists(CAT_PATH . '/' . $addon['type'] . 's/' . $addon['directory'] . '/install.php') ? true : false; $addon['UPGRADE'] = file_exists(CAT_PATH . '/' . $addon['type'] . 's/' . $addon['directory'] . '/upgrade.php') ? true : false; // add some more details $addon = array_merge($addon, array('installed' => $addon['installed'] != '' ? CAT_Helper_DateTime::getDate($addon['installed']) : NULL, 'upgraded' => $addon['upgraded'] != '' ? CAT_Helper_DateTime::getDate($addon['upgraded']) : NULL, 'is_installed' => CAT_Helper_Addons::isModuleInstalled($addon['directory'], NULL, $addon['type']), 'is_removable' => $addon['removable'] == 'N' ? false : true, 'link' => $link)); $tpl_data['token_name'] = $GLOBALS['csrf']['input-name']; $tpl_data['token'] = csrf_get_tokens(); $result = true; $message = NULL; $output = $parser->get('backend_addons_index_details', array_merge($tpl_data, array('addon' => $addon))); if (!$output || $output == '') { $result = false; $message = 'Unable to load settings sub page'; } $ajax = array('message' => $message, 'success' => $result, 'content' => $output); print json_encode($ajax); exit;