/** * execute the command * * @param InputInterface $input input handler * @param OutputInterface $output output handler * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { $xoops = \Xoops::getInstance(); $module = $input->getArgument('module'); if (false === \XoopsLoad::fileExists($xoops->path("modules/{$module}/xoops_version.php"))) { $output->writeln(sprintf('<error>No module named %s found!</error>', $module)); return; } $output->writeln(sprintf('Installing %s', $module)); if (false !== $xoops->getModuleByDirname($module)) { $output->writeln(sprintf('<error>%s module is already installed!</error>', $module)); return; } $xoops->setTpl(new XoopsTpl()); \XoopsLoad::load('module', 'system'); $sysmod = new \SystemModule(); $result = $sysmod->install($module); foreach ($sysmod->trace as $message) { if (is_array($message)) { foreach ($message as $subMessage) { if (!is_array($subMessage)) { $output->writeln(strip_tags($subMessage)); } } } else { $output->writeln(strip_tags($message)); } } if ($result === false) { $output->writeln(sprintf('<error>Install of %s failed!</error>', $module)); } else { $output->writeln(sprintf('<info>Install of %s completed.</info>', $module)); } $xoops->cache()->delete('system'); }
/** * XOOPS class loader wrapper * * Temporay solution for XOOPS 2.3 * * @param string $name Name of class to be loaded * @param string $type domain of the class, potential values: core - locaded in /class/; framework - located in /Frameworks/; other - module class, located in /modules/[$type]/class/ * @return boolean */ function xoops_load($name, $type = "core") { if (!class_exists('XoopsLoad')) { require_once XOOPS_ROOT_PATH . "/class/xoopsload.php"; } return XoopsLoad::load($name, $type); }
protected function execute(InputInterface $input, OutputInterface $output) { $module = $input->getArgument('module'); $output->writeln(sprintf('Uninstalling %s', $module)); $xoops = \Xoops::getInstance(); if (false === $xoops->getModuleByDirname($module)) { $output->writeln(sprintf('<error>%s is not an installed module!</error>', $module)); return; } $xoops->setTpl(new \XoopsTpl()); \XoopsLoad::load('module', 'system'); $sysmod = new \SystemModule(); $result = $sysmod->uninstall($module); foreach ($sysmod->trace as $message) { if (is_array($message)) { foreach ($message as $subMessage) { if (!is_array($subMessage)) { $output->writeln(strip_tags($subMessage)); } } } else { $output->writeln(strip_tags($message)); } } if ($result === false) { $output->writeln(sprintf('<error>Uninstall of %s failed!</error>', $module)); } else { $output->writeln(sprintf('<info>Uninstall of %s completed.</info>', $module)); } $xoops->cache()->delete('system'); }
/** * @param MyTextSanitizer $ts * @param string $text * @param bool $force * @return mixed */ public function load(MyTextSanitizer &$ts, $text, $force = false) { $xoops = Xoops::getInstance(); if (empty($force) && $xoops->userIsAdmin) { return $text; } // Built-in fitlers for XSS scripts // To be improved $text = $ts->filterXss($text); if (XoopsLoad::load("purifier", "framework")) { $text = XoopsPurifier::purify($text); return $text; } $tags = array(); $search = array(); $replace = array(); $config = parent::loadConfig(__DIR__); if (!empty($config["patterns"])) { foreach ($config["patterns"] as $pattern) { if (empty($pattern['search'])) { continue; } $search[] = $pattern['search']; $replace[] = $pattern['replace']; } } if (!empty($config["tags"])) { $tags = array_map("trim", $config["tags"]); } // Set embedded tags $tags[] = "SCRIPT"; $tags[] = "VBSCRIPT"; $tags[] = "JAVASCRIPT"; foreach ($tags as $tag) { $search[] = "/<" . $tag . "[^>]*?>.*?<\\/" . $tag . ">/si"; $replace[] = " [!" . strtoupper($tag) . " FILTERED!] "; } // Set meta refresh tag $search[] = "/<META[^>\\/]*HTTP-EQUIV=(['\"])?REFRESH(\\1)[^>\\/]*?\\/>/si"; $replace[] = ""; // Sanitizing scripts in IMG tag //$search[]= "/(<IMG[\s]+[^>\/]*SOURCE=)(['\"])?(.*)(\\2)([^>\/]*?\/>)/si"; //$replace[]=""; // Set iframe tag $search[] = "/<IFRAME[^>\\/]*SRC=(['\"])?([^>\\/]*)(\\1)[^>\\/]*?\\/>/si"; $replace[] = " [!IFRAME FILTERED! \\2] "; $search[] = "/<IFRAME[^>]*?>([^<]*)<\\/IFRAME>/si"; $replace[] = " [!IFRAME FILTERED! \\1] "; // action $text = preg_replace($search, $replace, $text); return $text; }
/** * execute the command * * @param InputInterface $input input handler * @param OutputInterface $output output handler * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { // install the 'system' module $xoops = \Xoops::getInstance(); $module = 'system'; $output->writeln(sprintf('Installing %s', $module)); if (false !== $xoops->getModuleByDirname($module)) { $output->writeln(sprintf('<error>%s module is alreay installed!</error>', $module)); return; } $xoops->setTpl(new \XoopsTpl()); \XoopsLoad::load('module', 'system'); $sysmod = new \SystemModule(); $result = $sysmod->install($module); foreach ($sysmod->trace as $message) { if (is_array($message)) { foreach ($message as $subMessage) { if (!is_array($subMessage)) { $output->writeln(strip_tags($subMessage)); } } } else { $output->writeln(strip_tags($message)); } } if ($result === false) { $output->writeln(sprintf('<error>Install of %s module failed!</error>', $module)); } else { $output->writeln(sprintf('<info>Install of %s module completed.</info>', $module)); } $xoops->cache()->delete('system'); // add an admin user $adminname = 'admin'; $adminpass = password_hash($adminname, PASSWORD_DEFAULT); // user: admin pass: admin $regdate = time(); $result = $xoops->db()->insertPrefix('system_user', array('uname' => $adminname, 'email' => 'nobody@localhost', 'user_regdate' => $regdate, 'user_viewemail' => 1, 'pass' => $adminpass, 'rank' => 7, 'level' => 5, 'last_login' => $regdate)); $output->writeln(sprintf('<info>Inserted %d user.</info>', $result)); }
* * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package kernel * @subpackage class * @since 2.4.0 * @author trabis <*****@*****.**> * @version $Id: preload.php 3437 2009-08-27 13:52:28Z trabis $ * @deprecated To be deprecated in XOOPS 3 */ /** * XOOPS preload implemented in XOOPS is different from methods defined in this class, thus module developers are advised to be careful if you use current preload methods */ defined('XOOPS_ROOT_PATH') or die('Restricted access'); XoopsLoad::load('XoopsLists'); XoopsLoad::load('XoopsCache'); /** * Class for handling events * * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package kernel * @subpackage class * @author trabis <*****@*****.**> */ class XoopsPreload { /** * @var array $_preloads array containing information about the event observers */ var $_preloads = array();
<tr><td> <textarea id="code_mirror" name="filemanager" rows=24 cols=110>' . $content . '</textarea> </td></tr> </table>'; echo '<input type="hidden" name="path_file" value="' . $path_file . '"><input type="hidden" name="path" value="' . $path . '"><input type="hidden" name="file" value="' . trim($_REQUEST['file']) . '"><input type="hidden" name="ext" value="' . $ext . '"></form>'; break; case 'filemanager_unzip_file': $path_file = trim($_REQUEST['path_file']); if ($_REQUEST['path'] != '') { $path = trim($_REQUEST['path']); } else { $path = XOOPS_ROOT_PATH . '/'; } $file = $_REQUEST['file']; XoopsLoad::load('pclzip', 'system'); XoopsLoad::load('pcltar', 'system'); $file1 = XoopsFile::getHandler('file', $path_file); $extension = $file1->ext(); switch ($extension) { case 'zip': $archive = new PclZip($path_file); if ($archive->extract(PCLZIP_OPT_PATH, $path) == 0) { echo $xoops->alert('error', _AM_SYSTEM_FILEMANAGER_EXTRACT_ERROR); } else { echo $xoops->alert('info', _AM_SYSTEM_FILEMANAGER_EXTRACT_FILE); } break; case 'tar': case 'gz': PclTarExtract($path_file, $path); break;
* You may not change or alter any portion of this comment or credits * of supporting developers from this source code or any supporting source code * which is considered copyrighted (c) material of the original comment or credit authors. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) * @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html) * @package core * @since 2.0.0 */ defined('XOOPS_ROOT_PATH') || exit('Restricted access'); xoops_loadLanguage('user'); // from $_POST we use keys: uname, pass, rememberme, xoops_redirect XoopsLoad::load('XoopsRequest'); $uname = XoopsRequest::getString('uname', '', 'POST'); $pass = XoopsRequest::getString('pass', '', 'POST'); $rememberme = XoopsRequest::getString('rememberme', '', 'POST'); $redirect = XoopsRequest::getUrl('xoops_redirect', '', 'POST'); if ($uname == '' || $pass == '') { redirect_header(XOOPS_URL . '/user.php', 1, _US_INCORRECTLOGIN); } $member_handler = xoops_getHandler('member'); $myts = MyTextSanitizer::getInstance(); include_once $GLOBALS['xoops']->path('class/auth/authfactory.php'); xoops_loadLanguage('auth'); $xoopsAuth = XoopsAuthFactory::getAuthConnection($myts->addSlashes($uname)); $user = $xoopsAuth->authenticate($uname, $pass); if (false !== $user) { if (0 == $user->getVar('level')) {
/** * Constructor * * @param string $path Path to file * @param boolean $create Create file if it does not exist (if true) * @param integer $mode Mode to apply to the folder holding the file * @access private */ function __construct($path, $create = false, $mode = 0755) { XoopsLoad::load('XoopsFile'); $this->folder = XoopsFile::getHandler('folder', dirname($path), $create, $mode); if (!is_dir($path)) { $this->name = basename($path); } if (!$this->exists()) { if ($create === true) { if ($this->safe($path) && $this->create() === false) { return false; } } else { return false; } } }
/** * Clean up an input variable. * * @param mixed $var The input variable. * @param int $mask Filter bit mask. * - 1=no trim: If this flag is cleared and the input is a string, * the string will have leading and trailing whitespace trimmed. * - 2=allow_raw: If set, no more filtering is performed, higher bits are ignored. * - 4=allow_html: HTML is allowed, but passed through a safe HTML filter first. * If set, no more filtering is performed. * - If no bits other than the 1 bit is set, a strict filter is applied. * @param string $type The variable type. See {@link XoopsFilterInput::clean()}. * * @return string */ private static function cleanVar($var, $mask = 0, $type = null) { // Static input filters for specific settings static $noHtmlFilter = null; static $safeHtmlFilter = null; // If the no trim flag is not set, trim the variable if (!($mask & 1) && is_string($var)) { $var = trim($var); } // Now we handle input filtering if ($mask & 2) { // If the allow raw flag is set, do not modify the variable } else { XoopsLoad::load('xoopsfilterinput'); if ($mask & 4) { // If the allow html flag is set, apply a safe html filter to the variable if (is_null($safeHtmlFilter)) { $safeHtmlFilter = XoopsFilterInput::getInstance(null, null, 1, 1); } $var = $safeHtmlFilter->clean($var, $type); } else { // Since no allow flags were set, we will apply the most strict filter to the variable if (is_null($noHtmlFilter)) { $noHtmlFilter = XoopsFilterInput::getInstance(); } $var = $noHtmlFilter->clean($var, $type); } } return $var; }
* System Header * * @copyright XOOPS Project (http://xoops.org) * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @package system * @version $Id$ */ // Include XOOPS control panel header include_once dirname(dirname(__DIR__)) . '/include/cp_header.php'; $xoops = Xoops::getInstance(); XoopsLoad::load('system', 'system'); XoopsLoad::load('module', 'system'); XoopsLoad::load('extension', 'system'); $system = System::getInstance(); // Check user rights if (!$system->checkRight()) { $xoops->redirect(\XoopsBaseConfig::get('url'), 3, XoopsLocale::E_NO_ACCESS_PERMISSION); } // System Class //include_once $xoops->path('/modules/system/class/cookie.php'); // Load Language $xoops->loadLocale('system'); // Include System files include_once $xoops->path('/modules/system/include/functions.php'); // include system category definitions include_once $xoops->path('/modules/system/constants.php'); // Get request variable $fct = $system->cleanVars($_REQUEST, 'fct', '', 'string'); XoopsLoad::load('systembreadcrumb', 'system'); $system_breadcrumb = SystemBreadcrumb::getInstance($fct); $system_breadcrumb->addLink(SystemLocale::CONTROL_PANEL, \XoopsBaseConfig::get('url') . '/admin.php', true);
list($clickurl) = $xoopsDB->fetchRow($bresult); if ($clickurl) { if ($GLOBALS['xoopsSecurity']->checkReferer()) { $xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("banner") . " SET clicks=clicks+1 WHERE bid={$bid}"); header('Location: ' . $clickurl); } else { //No valid referer found so some javascript error or direct access found echo _BANNERS_NO_REFERER; } exit; } } redirect_header(XOOPS_URL, 3, _BANNERS_NO_ID); exit; } XoopsLoad::load('XoopsFilterInput'); $myts =& MyTextSanitizer::getInstance(); $op = ''; if (!empty($_POST['op'])) { // from $_POST we use keys: op, login, pass, url, pass, bid, cid $op = trim(XoopsFilterInput::clean($_POST['op'], 'STRING')); $clean_login = ''; if (isset($_POST['login'])) { $clean_login = trim(XoopsFilterInput::clean($myts->stripSlashesGPC($_POST['login']), 'STRING')); } $clean_pass = ''; if (isset($_POST['pass'])) { $clean_pass = trim(XoopsFilterInput::clean($myts->stripSlashesGPC($_POST['pass']), 'STRING')); } $clean_url = ''; if (isset($_POST['url'])) {
$modversion['dirname'] = 'xlanguage'; //about $modversion['release_date'] = '2012/10/01'; $modversion['module_website_url'] = 'dugris.xoofoo.org'; $modversion['module_website_name'] = 'XooFoo.org - Laurent JEN'; $modversion['module_status'] = 'alpha'; $modversion['min_php'] = '5.3.7'; $modversion['min_xoops'] = '2.6.0'; // paypal $modversion['paypal'] = array('business' => '*****@*****.**', 'item_name' => _MI_XLANGUAGE_DESC, 'amount' => 0, 'currency_code' => 'USD'); // Admin menu $modversion['system_menu'] = 1; // Manage extension $modversion['extension'] = 1; $modversion['extension_module'][] = 'system'; // Admin things $modversion['hasAdmin'] = 1; $modversion['adminindex'] = 'admin/index.php'; $modversion['adminmenu'] = 'admin/menu.php'; // Scripts to run upon installation or update $modversion['onInstall'] = 'include/install.php'; $modversion['onUpdate'] = 'include/install.php'; // SQL informations $modversion['schema'] = 'sql/schema.yml'; $modversion['sqlfile']['mysql'] = 'sql/mysql.sql'; $modversion['tables'] = array('xlanguage'); //language selection block $modversion['blocks'][] = array('file' => 'xlanguage_blocks.php', 'name' => _MI_XLANGUAGE_BNAME, 'description' => '', 'show_func' => 'b_xlanguage_select_show', 'edit_func' => 'b_xlanguage_select_edit', 'options' => 'images| |5', 'template' => 'xlanguage_block.tpl'); // Config XoopsLoad::load('xoopslists'); $modversion['config'][] = array('name' => 'theme', 'title' => '_MI_XLANGUAGE_THEME', 'description' => '_MI_XLANGUAGE_THEME_DESC', 'formtype' => 'select', 'valuetype' => 'text', 'default' => '64', 'options' => XoopsLists::getDirListAsArray(Xoops::getInstance()->path('media/xoops/images/flags')));
function header() { $xoops = Xoops::getInstance(); $xoops->loadLocale('system'); $xoops->theme()->addBaseStylesheetAssets('@jqueryuicss'); $xoops->theme()->addStylesheet('media/xoops/css/moduladmin.css'); $xoops->theme()->addStylesheet(\XoopsBaseConfig::get('adminthemes-url') . '/default/css/style.css'); $xoops->theme()->addBaseScriptAssets('@jquery'); // bootstrap has to come before jquery.ui or dialog close buttons are blank $xoops->theme()->addBaseScriptAssets('@bootstrap'); $xoops->theme()->addBaseScriptAssets('@jqueryui'); $xoops->theme()->addBaseScriptAssets('@jgrowl'); // ddsmoothmenu $xoops->theme()->addScript(\XoopsBaseConfig::get('adminthemes-url') . '/default/js/ddsmoothmenu.js'); $xoops->theme()->addScript(\XoopsBaseConfig::get('adminthemes-url') . '/default/js/tooltip.js'); $quick = array(); $quick[] = array('title' => SystemLocale::CONTROL_PANEL, 'link' => \XoopsBaseConfig::get('url') . '/admin.php'); $quick[] = array('title' => XoopsLocale::HOME_PAGE, 'link' => \XoopsBaseConfig::get('url')); $quick[] = array('title' => DefaultThemeLocale::XOOPS_NEWS, 'link' => \XoopsBaseConfig::get('url') . '/admin.php?xoopsorgnews=1'); $quick[] = array('title' => 'separator'); $quick[] = array('title' => XoopsLocale::A_LOGOUT, 'link' => \XoopsBaseConfig::get('url') . '/user.php?op=logout'); $xoops->tpl()->assign('quick_menu', $quick); XoopsLoad::load('module', 'system'); XoopsLoad::load('extension', 'system'); $system_module = new SystemModule(); $system_extension = new SystemExtension(); $adminmenu = null; include __DIR__ . '/menu.php'; if (!$xoops->isModule() || 'system' == $xoops->module->getVar('dirname', 'n')) { $modpath = \XoopsBaseConfig::get('url') . '/admin.php'; $modname = DefaultThemeLocale::SYSTEM_OPTIONS; $modid = 1; $moddir = 'system'; $mod_options = $adminmenu; foreach (array_keys($mod_options) as $item) { $mod_options[$item]['link'] = empty($mod_options[$item]['absolute']) ? \XoopsBaseConfig::get('url') . '/modules/' . $moddir . '/' . $mod_options[$item]['link'] : $mod_options[$item]['link']; $mod_options[$item]['icon'] = empty($mod_options[$item]['icon']) ? '' : \XoopsBaseConfig::get('adminthemes-url') . '/default/' . $mod_options[$item]['icon']; unset($mod_options[$item]['icon_small']); } } else { $moddir = $xoops->module->getVar('dirname', 'n'); $modpath = \XoopsBaseConfig::get('url') . '/modules/' . $moddir; $modname = $xoops->module->getVar('name'); $modid = $xoops->module->getVar('mid'); $mod_options = $xoops->module->getAdminMenu(); foreach (array_keys($mod_options) as $item) { $mod_options[$item]['link'] = empty($mod_options[$item]['absolute']) ? \XoopsBaseConfig::get('url') . "/modules/{$moddir}/" . $mod_options[$item]['link'] : $mod_options[$item]['link']; if (XoopsLoad::fileExists($xoops->path("/media/xoops/images/icons/32/" . $mod_options[$item]['icon']))) { $mod_options[$item]['icon'] = $xoops->url("/media/xoops/images/icons/32/" . $mod_options[$item]['icon']); } else { $mod_options[$item]['icon'] = $xoops->url("/modules/" . $xoops->module->dirname() . "/icons/32/" . $mod_options[$item]['icon']); } } } $xoops->tpl()->assign('mod_options', $mod_options); $xoops->tpl()->assign('modpath', $modpath); $xoops->tpl()->assign('modname', $modname); $xoops->tpl()->assign('modid', $modid); $xoops->tpl()->assign('moddir', $moddir); // Modules list $module_list = $system_module->getModuleList(); $xoops->tpl()->assign('module_menu', $module_list); unset($module_list); // Extensions list $extension_list = $system_extension->getExtensionList(); $xoops->tpl()->assign('extension_menu', $extension_list); unset($extension_list); $extension_mod = $system_extension->getExtension($moddir); $xoops->tpl()->assign('extension_mod', $extension_mod); // add preferences menu $menu = array(); $OPT = array(); $menu[] = array('link' => \XoopsBaseConfig::get('url') . '/modules/system/admin.php?fct=preferences', 'title' => XoopsLocale::PREFERENCES, 'absolute' => 1, 'url' => \XoopsBaseConfig::get('url') . '/modules/system/', 'options' => $OPT); $menu[] = array('title' => 'separator'); // Module adminmenu if ($xoops->isModule() && $xoops->module->getVar('dirname') != 'system') { if ($xoops->module->getInfo('system_menu')) { //$xoops->theme()->addStylesheet('modules/system/css/menu.css'); $xoops->module->loadAdminMenu(); // Get menu tab handler /* @var $menu_handler SystemMenuHandler */ $menu_handler = $xoops->getModuleHandler('menu', 'system'); // Define top navigation $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=preferences&op=showmod&mod=" . $xoops->module->getVar('mid', 'e'), XoopsLocale::PREFERENCES); if ($xoops->module->getInfo('extension')) { $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=extensions&op=update&module=" . $xoops->module->getVar('dirname', 'e'), XoopsLocale::A_UPDATE); } else { $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=modulesadmin&op=update&module=" . $xoops->module->getVar('dirname', 'e'), XoopsLocale::A_UPDATE); } if ($xoops->module->getInfo('blocks')) { $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=blocksadmin&op=list&filter=1&selgen=" . $xoops->module->getVar('mid', 'e') . "&selmod=-2&selgrp=-1&selvis=-1", XoopsLocale::BLOCKS); } if ($xoops->module->getInfo('hasMain')) { $menu_handler->addMenuTop(\XoopsBaseConfig::get('url') . "/modules/" . $xoops->module->getVar('dirname', 'e') . "/", SystemLocale::GO_TO_MODULE); } // Define main tab navigation $i = 0; $current = $i; foreach ($xoops->module->adminmenu as $menu) { if (stripos($_SERVER['REQUEST_URI'], $menu['link']) !== false) { $current = $i; } $menu_handler->addMenuTabs($xoops->url('modules/' . $xoops->module->getVar('dirname') . '/' . $menu['link']), $menu['title']); ++$i; } if ($xoops->module->getInfo('help')) { if (stripos($_SERVER['REQUEST_URI'], 'admin/' . $xoops->module->getInfo('help')) !== false) { $current = $i; } $menu_handler->addMenuTabs('../../system/help.php?mid=' . $xoops->module->getVar('mid', 's') . '&' . $xoops->module->getInfo('help'), XoopsLocale::HELP); } // Display navigation tabs $xoops->tpl()->assign('xo_system_menu', $menu_handler->render($current, false)); } } }
* @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package core * @since 2.4.0 * @author Taiwen Jiang <*****@*****.**> * @version $Id$ */ defined('DS') or define('DS', DIRECTORY_SEPARATOR); defined('NWLINE') or define('NWLINE', "\n"); $xoopsOption['nocommon'] = true; require_once dirname(__FILE__) . DS . 'mainfile.php'; error_reporting(0); include_once XOOPS_ROOT_PATH . DS . 'include' . DS . 'defines.php'; include_once XOOPS_ROOT_PATH . DS . 'include' . DS . 'version.php'; require_once XOOPS_ROOT_PATH . DS . 'class' . DS . 'xoopsload.php'; XoopsLoad::load('xoopskernel'); $xoops = new xos_kernel_Xoops2(); $xoops->pathTranslation(); // Fetch path from query string if path is not set, i.e. through a direct request if (!isset($path) && !empty($_SERVER['QUERY_STRING'])) { $path = $_SERVER['QUERY_STRING']; $path = substr($path, 0, 1) == '/' ? substr($path, 1) : $path; $path_type = substr($path, 0, strpos($path, '/')); if (!isset($xoops->paths[$path_type])) { $path = "XOOPS/" . $path; $path_type = "XOOPS"; } } //We are not allowing output of xoops_data if ($path_type == 'var') { header("HTTP/1.0 404 Not Found");
/** * Read a key from the cache * * @param string $key Identifier for the data * @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it * @access public */ function read($key) { if ($this->setKey($key) === false || !$this->init) { return false; } if ($this->settings['lock']) { $this->file->lock = true; } $cachetime = $this->file->read(11); if ($cachetime !== false && intval($cachetime) < time()) { $this->file->close(); $this->file->delete(); return false; } $data = $this->file->read(true); if (!empty($data) && !empty($this->settings['serialize'])) { $data = stripslashes($data); $data = preg_replace('!s:(\\d+):"(.*?)";!se', "'s:'.strlen('\$2').':\"\$2\";'", $data); $data = unserialize($data); if (is_array($data)) { XoopsLoad::load('XoopsUtility'); $data = XoopsUtility::recursive('stripslashes', $data); } } else { if ($data && empty($this->settings['serialize'])) { $data = eval($data); } } $this->file->close(); return $data; }
/** * Constructor * * @param string $caption form element caption * @param string $name form element name * @param bool $includeAnonymous Include user "anonymous"? * @param mixed $value Pre-selected value (or array of them). * For an item with massive members, such as "Registered Users", "$value" * should be used to store selected temporary users only instead of all * members of that item * @param int $size Number or rows. "1" makes a drop-down-list. * @param bool $multiple Allow multiple selections? */ public function __construct($caption, $name, $includeAnonymous = false, $value = null, $size = 1, $multiple = false) { /** * @var mixed array|false - cache any result for this session. * Some modules use multiple copies of this element on a single page, so this call will * be made multiple times. This is only used when $value is null. * @todo this should be replaced with better interface, with autocomplete style search * and user specific MRU cache */ static $queryCache = false; /** * @var int - limit to this many rows */ $limit = 200; /** * @var string - cache time to live - will be interpreted by strtotime() */ $cachettl = '+5 minutes'; /** * @var string - cache key */ $cachekey = 'formselectuser'; $select_element = new XoopsFormSelect('', $name, $value, $size, $multiple); if ($includeAnonymous) { $select_element->addOption(0, $GLOBALS['xoopsConfig']['anonymous']); } $member_handler = xoops_getHandler('member'); $value = is_array($value) ? $value : (empty($value) ? array() : array($value)); $selectedUsers = array(); if (count($value) > 0) { // fetch the set of uids in $value $criteria = new Criteria('uid', '(' . implode(',', $value) . ')', 'IN'); $criteria->setSort('uname'); $criteria->setOrder('ASC'); $selectedUsers = $member_handler->getUserList($criteria); } // get the full selection list // we will always cache this version to reduce expense if (empty($queryCache)) { XoopsLoad::load('XoopsCache'); $queryCache = XoopsCache::read($cachekey); if ($queryCache === false) { $criteria = new CriteriaCompo(); if ($limit <= $member_handler->getUserCount()) { // if we have more than $limit users, we will select who to show based on last_login $criteria->setLimit($limit); $criteria->setSort('last_login'); $criteria->setOrder('DESC'); } else { $criteria->setSort('uname'); $criteria->setOrder('ASC'); } $queryCache = $member_handler->getUserList($criteria); asort($queryCache); XoopsCache::write($cachekey, $queryCache, $cachettl); // won't do anything different if write fails } } // merge with selected $users = $selectedUsers + $queryCache; $select_element->addOptionArray($users); if ($limit > count($users)) { parent::__construct($caption, '', $name); $this->addElement($select_element); return null; } xoops_loadLanguage('findusers'); $js_addusers = "<script type='text/javascript'>\n function addusers(opts)\n {\n var num = opts.substring(0, opts.indexOf(':'));\n opts = opts.substring(opts.indexOf(':')+1, opts.length);\n var sel = xoopsGetElementById('" . $name . "');\n var arr = new Array(num);\n for (var n=0; n < num; n++) {\n var nm = opts.substring(0, opts.indexOf(':'));\n opts = opts.substring(opts.indexOf(':')+1, opts.length);\n var val = opts.substring(0, opts.indexOf(':'));\n opts = opts.substring(opts.indexOf(':')+1, opts.length);\n var txt = opts.substring(0, nm - val.length);\n opts = opts.substring(nm - val.length, opts.length);\n var added = false;\n for (var k = 0; k < sel.options.length; k++) {\n if (sel.options[k].value == val) {\n added = true;\n break;\n }\n }\n if (added == false) {\n sel.options[k] = new Option(txt, val);\n sel.options[k].selected = true;\n }\n }\n\n return true;\n }\n </script>"; $token = $GLOBALS['xoopsSecurity']->createToken(); $action_tray = new XoopsFormElementTray('', ' | '); $action_tray->addElement(new XoopsFormLabel('', '<a href="#" onclick="var sel = xoopsGetElementById(\'' . $name . '\');for (var i = sel.options.length-1; i >= 0; i--) {if (!sel.options[i].selected) {sel.options[i] = null;}}; return false;">' . _MA_USER_REMOVE . '</a>')); $action_tray->addElement(new XoopsFormLabel('', '<a href="#" onclick="openWithSelfMain(\'' . XOOPS_URL . '/include/findusers.php?target=' . $name . '&multiple=' . $multiple . '&token=' . $token . '\', \'userselect\', 800, 600, null); return false;" >' . _MA_USER_MORE . '</a>' . $js_addusers)); parent::__construct($caption, '<br><br>', $name); $this->addElement($select_element); $this->addElement($action_tray); }
$modversion['config'][] = array('name' => 'print_header', 'title' => '_MI_PUBLISHER_HEADERPRINT', 'description' => '_MI_PUBLISHER_HEADERPRINTDSC', 'formtype' => 'textarea', 'valuetype' => 'text', 'default' => '', 'category' => 'print'); $modversion['config'][] = array('name' => 'print_logourl', 'title' => '_MI_PUBLISHER_PRINTLOGOURL', 'description' => '_MI_PUBLISHER_PRINTLOGOURLDSC', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => \XoopsBaseConfig::get('url') . '/images/logo.gif', 'category' => 'print'); $modversion['config'][] = array('name' => 'print_footer', 'title' => '_MI_PUBLISHER_FOOTERPRINT', 'description' => '_MI_PUBLISHER_FOOTERPRINTDSC', 'formtype' => 'select', 'valuetype' => 'text', 'default' => 'item footer', 'options' => array(_MI_PUBLISHER_ITEMFOOTER_SEL => 'item footer', _MI_PUBLISHER_INDEXFOOTER_SEL => 'index footer', _MI_PUBLISHER_BOTH_FOOTERS => 'both', _MI_PUBLISHER_NO_FOOTERS => 'none'), 'category' => 'print'); // ################### FORMAT #################### $modversion['config'][] = array('name' => 'format_date', 'title' => '_MI_PUBLISHER_DATEFORMAT', 'description' => '_MI_PUBLISHER_DATEFORMATDSC', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'd-M-Y H:i', 'category' => 'format'); $modversion['config'][] = array('name' => 'format_order_by', 'title' => '_MI_PUBLISHER_ORDERBY', 'description' => '_MI_PUBLISHER_ORDERBYDSC', 'formtype' => 'select', 'valuetype' => 'text', 'options' => array(_MI_PUBLISHER_ORDERBY_TITLE => 'title', _MI_PUBLISHER_ORDERBY_DATE => 'date', _MI_PUBLISHER_ORDERBY_WEIGHT => 'weight'), 'default' => 'date', 'category' => 'format'); $modversion['config'][] = array('name' => 'format_image_nav', 'title' => '_MI_PUBLISHER_IMAGENAV', 'description' => '_MI_PUBLISHER_IMAGENAVDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, 'category' => 'format'); $modversion['config'][] = array('name' => 'format_realname', 'title' => '_MI_PUBLISHER_USEREALNAME', 'description' => '_MI_PUBLISHER_USEREALNAMEDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, 'category' => 'format'); $modversion['config'][] = array('name' => 'format_highlight_color', 'title' => '_MI_PUBLISHER_HLCOLOR', 'description' => '_MI_PUBLISHER_HLCOLORDSC', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '#FFFF80', 'category' => 'format'); $modversion['config'][] = array('name' => 'format_linked_path', 'title' => '_MI_PUBLISHER_LINKPATH', 'description' => '_MI_PUBLISHER_LINKPATHDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1, 'category' => 'format'); $modversion['config'][] = array('name' => 'format_breadcrumb_modname', 'title' => '_MI_PUBLISHER_BCRUMB', 'description' => '_MI_PUBLISHER_BCRUMBDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1, 'category' => 'format'); // ################### SEARCH #################### $modversion['config'][] = array('name' => 'search_cat_path', 'title' => '_MI_PUBLISHER_PATHSEARCH', 'description' => '_MI_PUBLISHER_PATHSEARCHDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, 'category' => 'search'); // ################### SUBMIT #################### $modversion['config'][] = array('name' => 'submit_intro_msg', 'title' => '_MI_PUBLISHER_SUBMITMSG', 'description' => '_MI_PUBLISHER_SUBMITMSGDSC', 'formtype' => 'textarea', 'valuetype' => 'text', 'default' => _MI_PUBLISHER_SUBMITMSGDEF, 'category' => 'submit'); XoopsLoad::load('XoopsEditorHandler'); $editor_handler = XoopsEditorHandler::getInstance(); $modversion['config'][] = array('name' => 'submit_editor', 'title' => '_MI_PUBLISHER_EDITOR', 'description' => '_MI_PUBLISHER_EDITOR_DSC', 'formtype' => 'select', 'valuetype' => 'text', 'options' => array_flip($editor_handler->getList()), 'default' => 'dhtmltextarea', 'category' => 'submit'); $modversion['config'][] = array('name' => 'submit_editor_rows', 'title' => '_MI_PUBLISHER_EDITOR_ROWS', 'description' => '_MI_PUBLISHER_EDITOR_ROWS_DSC', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '35', 'category' => 'submit'); $modversion['config'][] = array('name' => 'submit_editor_cols', 'title' => '_MI_PUBLISHER_EDITOR_COLS', 'description' => '_MI_PUBLISHER_EDITOR_COLS_DSC', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '60', 'category' => 'submit'); $modversion['config'][] = array('name' => 'submit_editor_width', 'title' => '_MI_PUBLISHER_EDITOR_WIDTH', 'description' => '_MI_PUBLISHER_EDITOR_WIDTH_DSC', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '100%', 'category' => 'submit'); $modversion['config'][] = array('name' => 'submit_editor_height', 'title' => '_MI_PUBLISHER_EDITOR_HEIGHT', 'description' => '_MI_PUBLISHER_EDITOR_HEIGHT_DSC', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '400px', 'category' => 'submit'); $modversion['config'][] = array('name' => 'submit_status', 'title' => '_MI_PUBLISHER_FORM_STATUS', 'description' => '_MI_PUBLISHER_FORM_STATUS_DSC', 'formtype' => 'select', 'valuetype' => 'text', 'options' => array(_MI_PUBLISHER_PUBLISHED => _PUBLISHER_STATUS_PUBLISHED, _MI_PUBLISHER_OFFLINE => _PUBLISHER_STATUS_OFFLINE, _MI_PUBLISHER_SUBMITTED => _PUBLISHER_STATUS_SUBMITTED, _MI_PUBLISHER_REJECTED => _PUBLISHER_STATUS_REJECTED), 'default' => _PUBLISHER_STATUS_SUBMITTED, 'category' => 'submit'); $modversion['config'][] = array('name' => 'submit_allowcomments', 'title' => '_MI_PUBLISHER_FORM_ALLOWCOMMENTS', 'description' => '_MI_PUBLISHER_FORM_ALLOWCOMMENTS_DSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1, 'category' => 'submit'); $modversion['config'][] = array('name' => 'submit_dohtml', 'title' => '_MI_PUBLISHER_FORM_DOHTML', 'description' => '_MI_PUBLISHER_FORM_DOHTML_DSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1, 'category' => 'submit'); $modversion['config'][] = array('name' => 'submit_dosmiley', 'title' => '_MI_PUBLISHER_FORM_DOSMILEY', 'description' => '_MI_PUBLISHER_FORM_DOSMILEY_DSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1, 'category' => 'submit'); $modversion['config'][] = array('name' => 'submit_doxcode', 'title' => '_MI_PUBLISHER_FORM_DOXCODE', 'description' => '_MI_PUBLISHER_FORM_DOXCODE_DSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1, 'category' => 'submit'); $modversion['config'][] = array('name' => 'submit_doimage', 'title' => '_MI_PUBLISHER_FORM_DOIMAGE', 'description' => '_MI_PUBLISHER_FORM_DOIMAGE_DSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1, 'category' => 'submit'); $modversion['config'][] = array('name' => 'submit_dobr', 'title' => '_MI_PUBLISHER_FORM_DOBR', 'description' => '_MI_PUBLISHER_FORM_DOBR_DSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1, 'category' => 'submit'); // ################### PERMISSIONS #################### $modversion['config'][] = array('name' => 'perm_submit', 'title' => '_MI_PUBLISHER_ALLOWSUBMIT', 'description' => '_MI_PUBLISHER_ALLOWSUBMITDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, 'category' => 'permissions');
if (!$helper) { ob_end_flush(); return; } require_once dirname(__FILE__) . '/../../../../../../mainfile.php'; $xoops = Xoops::getInstance(); $xoops->disableErrorReporting(); $xoops->simpleHeader(false); $helper->loadLanguage('admin'); $helper->loadLanguage('tinymce'); $op = Request::getCmd('op', ''); if ($op == 'save') { if (!$xoops->security()->check()) { $xoops->redirect('xoops_xlanguage.php', 2, implode(',', $xoops->security()->getErrors())); } XoopsLoad::load('system', 'system'); $lang = $helper->getHandlerLanguage()->create(); $lang->CleanVarsForDB(); if ($helper->getHandlerLanguage()->insert($lang)) { $helper->getHandlerLanguage()->createConfig(); $xoops->redirect('xoops_xlanguage.php', 2, _AM_XLANGUAGE_SAVED); } } // check user/group $groups = $xoops->getUserGroups(); $gperm_handler = $xoops->getHandlerGroupPermission(); $admin = false; if ($gperm_handler) { $xlanguage = $xoops->getHandlerModule()->getByDirName('xlanguage'); if ($xlanguage) { $admin = $gperm_handler->checkRight('system_admin', $xlanguage->getVar('mid'), $groups);
<img src="' . system_AdminIcons('save.png') . '" alt="' . _AM_SYSTEM_TEMPLATES_SAVE . '" /> </button> ' . $restore . ' <button class="ui-corner-all tooltip" type="button" onclick="$(\'#display_contenu\').hide();$(\'#display_form\').fadeIn(\'fast\');" title="' . _AM_SYSTEM_TEMPLATES_CANCEL . '"> <img src="' . system_AdminIcons('cancel.png') . '" alt="' . _AM_SYSTEM_TEMPLATES_CANCEL . '" /> </button> <div class="clear"></div> </div> </div> </td> </tr> <tr> <td><textarea id="code_mirror" name="templates" rows=24 cols=110>' . $content . '</textarea></td> </tr> </table>'; XoopsLoad::load('XoopsFormHiddenToken'); $xoopsToken = new XoopsFormHiddenToken(); echo $xoopsToken->render(); echo '<input type="hidden" name="path_file" value="' . $clean_path_file . '"><input type="hidden" name="file" value="' . trim($clean_file) . '"><input type="hidden" name="ext" value="' . $ext . '"></form>'; break; // Restore backup file // Restore backup file case 'tpls_restore': $extensions = array('.html', '.htm', '.css', '.tpl'); //check if the file is inside themes directory $valid_dir = stristr(realpath($_REQUEST['path_file']), realpath(XOOPS_ROOT_PATH . '/themes')); $old_file = $_REQUEST['path_file'] . '.back'; $new_file = $_REQUEST['path_file']; $extension_verif = strrchr($new_file, '.'); if ($valid_dir && in_array($extension_verif, $extensions) && file_exists($old_file) && file_exists($new_file)) { if (unlink($new_file)) {
/** * @param $data * * @return bool */ public function writeConfig($data) { if ($this->createPath($this->configPath)) { $path_file = $this->configPath . $this->configFile . $this->configFileExt; XoopsLoad::load('XoopsFile'); $file = XoopsFile::getHandler('file', $path_file); return $file->write('return ' . var_export($data, true) . ';'); } }
/** * @deprecated * @param string $name Name of class to be loaded * @param string $type domain of the class, potential values: core - locaded in /class/; framework - located in /Frameworks/; other - module class, located in /modules/[$type]/class/ * @return boolean */ function xoops_load($name, $type = 'core') { $xoops = Xoops::getInstance(); $xoops->deprecated(__FUNCTION__ . ' is deprecated. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__); return XoopsLoad::load($name, $type); }
*/ /** * Xoops Editor usage guide * * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @package kernel * @subpackage core * @since 2.0.0 * @author Kazumi Ono <*****@*****.**> * @author John Neill <*****@*****.**> * @version $Id: errorhandler.php 3795 2009-10-27 20:24:29Z trabis $ */ defined('XOOPS_ROOT_PATH') or die('Restricted access'); xoops_loadLanguage('errors'); XoopsLoad::load('xoopslogger'); /** * Xoops ErrorHandler * * Backward compatibility code, do not use this class directly * * @package kernel * @subpackage core * @author Kazumi Ono <*****@*****.**> * @author John Neill <*****@*****.**> * @copyright copyright (c) 2000-2003 XOOPS.org */ class XoopsErrorHandler extends XoopsLogger { /** * Activate the error handler
/** * @param string $source * @param string $language * @return bool */ public function geshi($source, $language) { if (!@XoopsLoad::load("geshi", "framework")) { return false; } // Create the new XoopsGeshi object, passing relevant stuff // XoopsGeshi should be extending geSHi in Frameworks/geshi/xoopsgeshi.php $geshi = new XoopsGeshi($source, $language); // Enclose the code in a <div> $geshi->set_header_type(GESHI_HEADER_NONE); // Sets the proper encoding charset other than "ISO-8859-1" $geshi->set_encoding(XoopsLocale::getCharset()); $geshi->set_link_target("_blank"); // Parse the code $code = $geshi->parse_code(); return $code; }
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ /** * TinyMCE adapter for XOOPS * * @copyright XOOPS Project (http://xoops.org) * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @package class * @subpackage editor * @since 2.3.0 * @author Taiwen Jiang <*****@*****.**> * @version $Id: formtinymce.php 810 2012-09-21 21:26:54Z kris_fr $ */ XoopsLoad::load('XoopsEditor'); class XoopsFormTinymce extends XoopsEditor { var $language; var $width = "100%"; var $height = "500px"; var $editor; /** * Constructor * * @param array $configs Editor Options */ function __construct($configs) { $current_path = __FILE__; if (DIRECTORY_SEPARATOR != "/") {
/** * Initialize parent::__construct calls this after verifying module object. * * @return void */ public function init() { \XoopsLoad::load('xoopscache'); $this->prefix = $this->module->getVar('dirname') . '_'; $this->cache = \XoopsCache::getInstance(); }