Example #1
0
 /**
  * Get a reference to the only instance of database class and connects to DB
  *
  * if the class has not been instantiated yet, this will also take
  * care of that
  *
  * @static
  * @staticvar object  The only instance of database class
  * @return object Reference to the only instance of database class
  */
 static function &getDatabaseConnection()
 {
     static $instance;
     if (!isset($instance)) {
         if (file_exists($file = XOOPS_ROOT_PATH . '/class/database/' . XOOPS_DB_TYPE . 'database.php')) {
             require_once $file;
             if (!defined('XOOPS_DB_PROXY')) {
                 $class = 'Xoops' . ucfirst(XOOPS_DB_TYPE) . 'DatabaseSafe';
             } else {
                 $class = 'Xoops' . ucfirst(XOOPS_DB_TYPE) . 'DatabaseProxy';
             }
             $xoopsPreload =& XoopsPreload::getInstance();
             $xoopsPreload->triggerEvent('core.class.database.databasefactory.connection', array(&$class));
             $instance = new $class();
             $instance->setLogger(XoopsLogger::getInstance());
             $instance->setPrefix(XOOPS_DB_PREFIX);
             if (!$instance->connect()) {
                 trigger_error('notrace:Unable to connect to database', E_USER_ERROR);
             }
         } else {
             trigger_error('notrace:Failed to load database of type: ' . XOOPS_DB_TYPE . ' in file: ' . __FILE__ . ' at line ' . __LINE__, E_USER_WARNING);
         }
     }
     return $instance;
 }
function smarty_function_xoInboxCount($params, &$smarty)
{
    $xoops = Xoops::getInstance();
    if (!$xoops->isUser()) {
        return;
    }
    $time = time();
    if (isset($_SESSION['xoops_inbox_count']) && @$_SESSION['xoops_inbox_count_expire'] > $time) {
        $count = (int) $_SESSION['xoops_inbox_count'];
    } else {
        $pm_handler = $xoops->getHandlerPrivateMessage();
        $xoopsPreload = XoopsPreload::getInstance();
        $xoopsPreload->triggerEvent('core.class.smarty.xoops_plugins.xoinboxcount', array($pm_handler));
        $criteria = new CriteriaCompo(new Criteria('read_msg', 0));
        $criteria->add(new Criteria('to_userid', $xoops->user->getVar('uid')));
        $count = (int) $pm_handler->getCount($criteria);
        $_SESSION['xoops_inbox_count'] = $count;
        $_SESSION['xoops_inbox_count_expire'] = $time + 60;
    }
    if (!@empty($params['assign'])) {
        $smarty->assign($params['assign'], $count);
    } else {
        echo $count;
    }
}
/**
 * @param $params
 * @param $smarty
 */
function smarty_function_xoInboxCount($params, &$smarty)
{
    global $xoopsUser;
    if (!isset($xoopsUser) || !is_object($xoopsUser)) {
        return;
    }
    $time = time();
    if (isset($_SESSION['xoops_inbox_count']) && @$_SESSION['xoops_inbox_count_expire'] > $time) {
        $count = intval($_SESSION['xoops_inbox_count']);
    } else {
        $pm_handler =& xoops_gethandler('privmessage');
        $xoopsPreload =& XoopsPreload::getInstance();
        $xoopsPreload->triggerEvent('core.class.smarty.xoops_plugins.xoinboxcount', array($pm_handler));
        $criteria = new CriteriaCompo(new Criteria('read_msg', 0));
        $criteria->add(new Criteria('to_userid', $xoopsUser->getVar('uid')));
        $count = intval($pm_handler->getCount($criteria));
        $_SESSION['xoops_inbox_count'] = $count;
        $_SESSION['xoops_inbox_count_expire'] = $time + 60;
    }
    if (!@empty($params['assign'])) {
        $smarty->assign($params['assign'], $count);
    } else {
        echo $count;
    }
}
Example #4
0
 function header()
 {
     global $xoops, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsUser, $xoopsOption, $xoTheme, $xoopsTpl;
     ob_start();
     xoops_loadLanguage('admin', 'system');
     xoops_loadLanguage('cpanel', 'system');
     xoops_loadLanguage('modinfo', 'system');
     $xoopsLogger =& XoopsLogger::getInstance();
     $xoopsLogger->stopTime('Module init');
     $xoopsLogger->startTime('XOOPS output init');
     if (!headers_sent()) {
         header('Content-Type:text/html; charset=' . _CHARSET);
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
         header('Cache-Control: no-store, no-cache, must-revalidate');
         header("Cache-Control: post-check=0, pre-check=0", false);
         header("Pragma: no-cache");
     }
     require_once XOOPS_ROOT_PATH . '/class/template.php';
     require_once XOOPS_ROOT_PATH . '/class/theme.php';
     $adminThemeFactory = new xos_opal_AdminThemeFactory();
     $this->xoTheme =& $adminThemeFactory->createInstance(array('folderName' => $this->foldername, 'themesPath' => 'modules/system/class/gui'));
     $this->xoTheme->loadLocalization('admin');
     $this->template =& $this->xoTheme->template;
     $GLOBALS['xoTheme'] =& $this->xoTheme;
     $GLOBALS['adminTpl'] =& $this->xoTheme->template;
     $xoopsLogger->stopTime('XOOPS output init');
     $xoopsLogger->startTime('Module display');
     $xoopsPreload =& XoopsPreload::getInstance();
     $xoopsPreload->triggerEvent('system.class.gui.header');
 }
Example #5
0
 /**
  * Get a reference to the only instance of database class and connects to DB
  *
  * if the class has not been instantiated yet, this will also take
  * care of that
  *
  * Legacy support function
  *
  * NOTE: Persistance connection is not supported nor needed with Doctrine.
  *       XOOPS_DB_PCONNECT is ignored.
  *
  * @return XoopsDatabase Reference to the only instance of database class
  */
 public static function getDatabaseConnection()
 {
     static $legacy;
     $file = \XoopsBaseConfig::get('root-path') . '/class/database/mysqldatabase.php';
     if (!isset($legacy) && file_exists($file)) {
         require_once $file;
         if (!defined('XOOPS_DB_PROXY')) {
             $class = 'XoopsMysqlDatabaseSafe';
         } else {
             $class = 'XoopsMysqlDatabaseProxy';
         }
         $xoopsPreload = XoopsPreload::getInstance();
         $xoopsPreload->triggerEvent('core.class.database.databasefactory.connection', array(&$class));
         $legacy = new $class();
         $legacy->setPrefix(\XoopsBaseConfig::get('db-prefix'));
         $legacy->conn = \Xoops\Core\Database\Factory::getConnection();
     }
     if (is_null($legacy->conn)) {
         trigger_error('notrace:Unable to connect to database', E_USER_ERROR);
     }
     return $legacy;
 }
 /**
  * xos_logos_PageBuilder::retrieveBlocks()
  *
  * @return
  */
 function retrieveBlocks()
 {
     global $xoopsConfig;
     $xoopsPreload =& XoopsPreload::getInstance();
     $startMod = $xoopsConfig['startpage'] == '--' ? 'system' : $xoopsConfig['startpage'];
     if (isset($GLOBALS['xoopsModule']) && is_object($GLOBALS['xoopsModule'])) {
         list($mid, $dirname) = array($GLOBALS['xoopsModule']->getVar('mid'), $GLOBALS['xoopsModule']->getVar('dirname'));
         $isStart = substr($_SERVER['PHP_SELF'], -9) == 'index.php' && $xoopsConfig['startpage'] == $dirname && empty($_SERVER['QUERY_STRING']);
     } else {
         list($mid, $dirname) = array(0, 'system');
         $isStart = !empty($GLOBALS['xoopsOption']['show_cblock']);
     }
     $groups = isset($GLOBALS['xoopsUser']) && is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
     $oldzones = array(XOOPS_SIDEBLOCK_LEFT => 'canvas_left', XOOPS_SIDEBLOCK_RIGHT => 'canvas_right', XOOPS_CENTERBLOCK_LEFT => 'page_topleft', XOOPS_CENTERBLOCK_CENTER => 'page_topcenter', XOOPS_CENTERBLOCK_RIGHT => 'page_topright', XOOPS_CENTERBLOCK_BOTTOMLEFT => 'page_bottomleft', XOOPS_CENTERBLOCK_BOTTOM => 'page_bottomcenter', XOOPS_CENTERBLOCK_BOTTOMRIGHT => 'page_bottomright');
     foreach ($oldzones as $zone) {
         $this->blocks[$zone] = array();
     }
     if ($this->theme) {
         $template =& $this->theme->template;
         $backup = array($template->caching, $template->cache_lifetime);
     } else {
         $template = null;
         $template = new XoopsTpl();
     }
     $xoopsblock = new XoopsBlock();
     $block_arr = array();
     $block_arr = $xoopsblock->getAllByGroupModule($groups, $mid, $isStart, XOOPS_BLOCK_VISIBLE);
     $xoopsPreload->triggerEvent('core.class.theme_blocks.retrieveBlocks', array(&$this, &$template, &$block_arr));
     foreach ($block_arr as $block) {
         $side = $oldzones[$block->getVar('side')];
         if ($var = $this->buildBlock($block, $template)) {
             $this->blocks[$side][$var["id"]] = $var;
         }
     }
     if ($this->theme) {
         list($template->caching, $template->cache_lifetime) = $backup;
     }
 }
Example #7
0
 /**
  * All contract specified methods go here
  *
  * @param string $name      method to call
  * @param mixed  $arguments any arguments
  *
  * @return Response Response
  */
 public function __call($name, $arguments)
 {
     $mode = $this->getProviderMode();
     // for right now only one provider will be called, and it should be at the top
     $object = reset($this->providers);
     $method = array($object, $name);
     $response = new Response();
     if (is_callable($method)) {
         try {
             //$object->$name($response, $arguments);
             array_unshift($arguments, $response);
             call_user_func_array($method, $arguments);
         } catch (\Exception $e) {
             \XoopsPreload::getInstance()->triggerEvent('core.exception', $e);
             $response->setSuccess(false)->addErrorMessage($e->getMessage());
         }
     } else {
         $response->setSuccess(false)->addErrorMessage(sprintf('No method %s', $name));
     }
     return $response;
 }
Example #8
0
 *
 * 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       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
 * @since           2.0.0
 * @version         $Id: footer.php 12537 2014-05-19 14:19:33Z beckmi $
 */
defined('XOOPS_ROOT_PATH') || die('Restricted access');
$xoopsPreload =& XoopsPreload::getInstance();
$xoopsPreload->triggerEvent('core.footer.start');
if (!defined("XOOPS_FOOTER_INCLUDED")) {
    define("XOOPS_FOOTER_INCLUDED", 1);
    $xoopsLogger =& XoopsLogger::getInstance();
    $xoopsLogger->stopTime('Module display');
    if ($xoopsOption['theme_use_smarty'] == 0) {
        // the old way
        $footer = htmlspecialchars($xoopsConfigMetaFooter['footer']) . '<br /><div class="txtcenter small">Powered by XOOPS &copy; <a href="http://xoops.sourceforge.net" rel="external" title="The XOOPS Project">The XOOPS Project</a></div>';
        if (isset($xoopsOption['template_main'])) {
            $xoopsTpl->caching = 0;
            $xoopsTpl->display('db:' . $xoopsOption['template_main']);
        }
        if (!isset($xoopsOption['show_rblock'])) {
            $xoopsOption['show_rblock'] = 0;
        }
Example #9
0
<?php

/*
 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.
*/
/**
 * XOOPS image access
 *
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package         core
 * @since           2.6.0
 * @version         $Id$
 */
include __DIR__ . '/mainfile.php';
XoopsPreload::getInstance()->triggerEvent('core.image');
header('Content-type: image/gif');
readfile(\XoopsBaseConfig::get('uploads-path') . '/blank.gif');
Example #10
0
 /**
  * perform a query on the database
  *
  * @param string $sql   a valid MySQL query
  * @param int    $limit number of records to return
  * @param int    $start offset of first record to return
  *
  * @return bool|resource query result or FALSE if successful
  * or TRUE if successful and no result
  * @deprecated since version 2.6.0 - alpha 3. Switch to doctrine connector.
  */
 public function queryF($sql, $limit = 0, $start = 0)
 {
     $this->deprecated();
     if (!empty($limit)) {
         if (empty($start)) {
             $start = 0;
         }
         $sql = $sql . ' LIMIT ' . (int) $start . ', ' . (int) $limit;
     }
     $xoopsPreload = XoopsPreload::getInstance();
     $xoopsPreload->triggerEvent('core.database.query.start');
     try {
         $result = $this->conn->query($sql);
     } catch (Exception $e) {
         $result = false;
     }
     $this->lastResult = $result;
     $xoopsPreload->triggerEvent('core.database.query.end');
     if ($result) {
         $xoopsPreload->triggerEvent('core.database.query.success', array($sql));
         return $result;
     } else {
         $xoopsPreload->triggerEvent('core.database.query.failure', array($sql, $this));
         return false;
     }
 }
Example #11
0
/**
 * @return array|bool
 */
function b_system_user_show()
{
    global $xoopsUser;
    if (!is_object($xoopsUser)) {
        return false;
    }
    $block = array();
    $block['lang_youraccount'] = _MB_SYSTEM_VACNT;
    $block['lang_editaccount'] = _MB_SYSTEM_EACNT;
    $block['lang_notifications'] = _MB_SYSTEM_NOTIF;
    $block['uid'] = $xoopsUser->getVar('uid');
    $block['lang_logout'] = _MB_SYSTEM_LOUT;
    $criteria = new CriteriaCompo(new Criteria('read_msg', 0));
    $criteria->add(new Criteria('to_userid', $xoopsUser->getVar('uid')));
    $pm_handler = xoops_getHandler('privmessage');
    $xoopsPreload = XoopsPreload::getInstance();
    $xoopsPreload->triggerEvent('system.blocks.system_blocks.usershow', array(&$pm_handler));
    $block['new_messages'] = $pm_handler->getCount($criteria);
    $block['lang_inbox'] = _MB_SYSTEM_INBOX;
    $block['lang_adminmenu'] = _MB_SYSTEM_ADMENU;
    return $block;
}
Example #12
0
 public function header()
 {
     global $xoops, $xoopsConfig, $xoopsModule, $xoopsUser, $xoopsOption, $xoTheme, $xoopsTpl;
     ob_start();
     xoops_loadLanguage('admin', 'system');
     xoops_loadLanguage('cpanel', 'system');
     xoops_loadLanguage('modinfo', 'system');
     $xoopsLogger = XoopsLogger::getInstance();
     $xoopsLogger->stopTime('Module init');
     $xoopsLogger->startTime('XOOPS output init');
     if (!headers_sent()) {
         header('Content-Type:text/html; charset=' . _CHARSET);
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
         header('Cache-Control: no-store, no-cache, must-revalidate');
         header('Cache-Control: post-check=0, pre-check=0', false);
         header('Pragma: no-cache');
     }
     require_once XOOPS_ROOT_PATH . '/class/template.php';
     require_once XOOPS_ROOT_PATH . '/class/theme.php';
     if (@$GLOBALS['xoopsOption']['template_main']) {
         if (false === strpos($GLOBALS['xoopsOption']['template_main'], ':')) {
             $GLOBALS['xoopsOption']['template_main'] = 'db:' . $GLOBALS['xoopsOption']['template_main'];
         }
     }
     $adminThemeFactory = new xos_opal_AdminThemeFactory();
     $this->xoTheme =& $adminThemeFactory->createInstance(array('folderName' => $this->foldername, 'themesPath' => 'modules/system/themes', 'contentTemplate' => @$GLOBALS['xoopsOption']['template_main']));
     $this->xoTheme->loadLocalization('admin');
     $this->template =& $this->xoTheme->template;
     $GLOBALS['xoTheme'] =& $this->xoTheme;
     $GLOBALS['adminTpl'] =& $this->xoTheme->template;
     $xoopsLogger->stopTime('XOOPS output init');
     $xoopsLogger->startTime('Module display');
     $xoopsPreload = XoopsPreload::getInstance();
     $xoopsPreload->triggerEvent('system.class.gui.header');
     if (isset($xoopsModule) && $xoopsModule->getVar('dirname') === 'system') {
         $xoopsModule->loadAdminMenu();
         foreach (array_keys($xoopsModule->adminmenu) as $item) {
             $sys_menu[$item]['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/' . $xoopsModule->adminmenu[$item]['link'];
             $GLOBALS['xoopsTpl']->append_by_ref('sys_menu', $sys_menu);
             unset($sys_menu);
         }
     }
     // Module adminmenu
     if (isset($xoopsModule) && $xoopsModule->getVar('dirname') !== 'system') {
         if ($xoopsModule->getInfo('system_menu')) {
             $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/modules/system/css/menu.css');
             $xoopsModule->loadAdminMenu();
             // Get menu tab handler
             $menu_handler = xoops_getModuleHandler('menu', 'system');
             // Define top navigation
             $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod=' . $xoopsModule->getVar('mid', 'e'), _AM_SYSTEM_PREF);
             $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&amp;op=update&amp;module=' . $xoopsModule->getVar('dirname', 'e'), _AM_SYSTEM_UPDATE);
             $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?fct=blocksadmin&amp;op=list&amp;filter=1&amp;selgen=' . $xoopsModule->getVar('mid', 'e') . '&amp;selmod=-2&amp;selgrp=-1&amp;selvis=-1', _AM_SYSTEM_BLOCKS);
             $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?fct=tplsets&amp;op=listtpl&amp;tplset=default&amp;moddir=' . $xoopsModule->getVar('dirname', 'e'), _AM_SYSTEM_TPLSETS);
             $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?module=' . $xoopsModule->getVar('mid', 'e') . '&amp;status=0&amp;limit=10&amp;fct=comments', _AM_SYSTEM_COMMENTS);
             $menu_handler->addMenuTop(XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&amp;op=uninstall&amp;module=' . $xoopsModule->getVar('dirname', 'e'), _AM_SYSTEM_UNINSTALL);
             $menu_handler->addMenuTop(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'e') . '/', _AM_SYSTEM_GOTOMODULE);
             // Define main tab navigation
             $i = 0;
             $current = $i;
             foreach ($xoopsModule->adminmenu as $menu) {
                 if (stripos($_SERVER['REQUEST_URI'], $menu['link']) !== false) {
                     $current = $i;
                 }
                 $menu_handler->addMenuTabs($menu['link'], $menu['title']);
                 ++$i;
             }
             if ($xoopsModule->getInfo('help')) {
                 if (stripos($_SERVER['REQUEST_URI'], 'admin/' . $xoopsModule->getInfo('help')) !== false) {
                     $current = $i;
                 }
                 $menu_handler->addMenuTabs('../system/help.php?mid=' . $xoopsModule->getVar('mid', 's') . '&amp;' . $xoopsModule->getInfo('help'), _AM_SYSTEM_HELP);
             }
             // Display navigation tabs
             $GLOBALS['xoopsTpl']->assign('xo_system_menu', $menu_handler->render($current, false));
         }
     }
 }
Example #13
0
/**
 * Function to redirect a user to certain pages
 */
function redirect_header($url, $time = 3, $message = '', $addredirect = true, $allowExternalLink = false)
{
    global $xoopsConfig, $xoopsLogger, $xoopsUserIsAdmin;
    $xoopsPreload =& XoopsPreload::getInstance();
    $xoopsPreload->triggerEvent('core.include.functions.redirectheader', array($url, $time, $message, $addredirect, $allowExternalLink));
    if (preg_match("/[\\0-\\31]|about:|script:/i", $url)) {
        if (!preg_match('/^\\b(java)?script:([\\s]*)history\\.go\\(-[0-9]*\\)([\\s]*[;]*[\\s]*)$/si', $url)) {
            $url = XOOPS_URL;
        }
    }
    if (!$allowExternalLink && ($pos = strpos($url, '://'))) {
        $xoopsLocation = substr(XOOPS_URL, strpos(XOOPS_URL, '://') + 3);
        if (strcasecmp(substr($url, $pos + 3, strlen($xoopsLocation)), $xoopsLocation)) {
            $url = XOOPS_URL;
        }
    }
    if (defined('XOOPS_CPFUNC_LOADED')) {
        $theme = 'default';
    } else {
        $theme = $xoopsConfig['theme_set'];
    }
    require_once XOOPS_ROOT_PATH . '/class/template.php';
    require_once XOOPS_ROOT_PATH . '/class/theme.php';
    $xoopsThemeFactory = null;
    $xoopsThemeFactory = new xos_opal_ThemeFactory();
    $xoopsThemeFactory->allowedThemes = $xoopsConfig['theme_set_allowed'];
    $xoopsThemeFactory->defaultTheme = $theme;
    $xoTheme =& $xoopsThemeFactory->createInstance(array("plugins" => array(), "renderBanner" => false));
    $xoopsTpl =& $xoTheme->template;
    $xoopsTpl->assign(array('xoops_theme' => $theme, 'xoops_imageurl' => XOOPS_THEME_URL . '/' . $theme . '/', 'xoops_themecss' => xoops_getcss($theme), 'xoops_requesturi' => htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES), 'xoops_sitename' => htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES), 'xoops_slogan' => htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES), 'xoops_dirname' => isset($xoopsModule) && is_object($xoopsModule) ? $xoopsModule->getVar('dirname') : 'system', 'xoops_pagetitle' => isset($xoopsModule) && is_object($xoopsModule) ? $xoopsModule->getVar('name') : htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)));
    if ($xoopsConfig['debug_mode'] == 2 && $xoopsUserIsAdmin) {
        $xoopsTpl->assign('time', 300);
        $xoopsTpl->assign('xoops_logdump', $xoopsLogger->dump());
    } else {
        $xoopsTpl->assign('time', intval($time));
    }
    if (!empty($_SERVER['REQUEST_URI']) && $addredirect && strstr($url, 'user.php')) {
        if (!strstr($url, '?')) {
            $url .= '?xoops_redirect=' . urlencode($_SERVER['REQUEST_URI']);
        } else {
            $url .= '&amp;xoops_redirect=' . urlencode($_SERVER['REQUEST_URI']);
        }
    }
    if (defined('SID') && SID && (!isset($_COOKIE[session_name()]) || $xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] != '' && !isset($_COOKIE[$xoopsConfig['session_name']]))) {
        if (!strstr($url, '?')) {
            $url .= '?' . SID;
        } else {
            $url .= '&amp;' . SID;
        }
    }
    $url = preg_replace("/&amp;/i", '&', htmlspecialchars($url, ENT_QUOTES));
    $xoopsTpl->assign('url', $url);
    $message = trim($message) != '' ? $message : _TAKINGBACK;
    $xoopsTpl->assign('message', $message);
    $xoopsTpl->assign('lang_ifnotreload', sprintf(_IFNOTRELOAD, $url));
    $xoopsTpl->display('db:system_redirect.html');
    exit;
}
 /**
  * Replace emoticons in the message with smiley images
  *
  * @param string $message
  * @return string
  */
 public function smiley($message)
 {
     XoopsPreload::getInstance()->triggerEvent('core.class.module.textsanitizer.smiley', array(&$message));
     return $message;
 }
Example #15
0
 /**
  * installconfigs
  *
  * @param XoopsModule $module module being installed
  *
  * @return void
  */
 public function installConfigs(XoopsModule $module)
 {
     $xoops = Xoops::getInstance();
     // now reinsert them with the new settings
     $configs = $module->getInfo('config');
     if (!is_array($configs)) {
         $configs = array();
     }
     XoopsPreload::getInstance()->triggerEvent('onModuleUpdateConfigs', array($module, &$configs));
     if (is_array($configs) && count($configs) > 0) {
         $this->trace[] = SystemLocale::MANAGING_PREFERENCES;
         $config_handler = $xoops->getHandlerConfig();
         $order = 0;
         foreach ($configs as $config) {
             // only insert ones that have been deleted previously with success
             if (!in_array($config['name'], $this->config_delng)) {
                 $confobj = $config_handler->createConfig();
                 $confobj->setVar('conf_modid', $module->getVar('mid'));
                 $confobj->setVar('conf_catid', 0);
                 $confobj->setVar('conf_name', $config['name']);
                 $confobj->setVar('conf_title', $config['title']);
                 $confobj->setVar('conf_desc', $config['description']);
                 $confobj->setVar('conf_formtype', $config['formtype']);
                 $confobj->setVar('conf_valuetype', $config['valuetype']);
                 if (isset($this->config_old[$config['name']]['value']) && $this->config_old[$config['name']]['formtype'] == $config['formtype'] && $this->config_old[$config['name']]['valuetype'] == $config['valuetype']) {
                     // preserver the old value if any
                     // form type and value type must be the same
                     $confobj->setVar('conf_value', $this->config_old[$config['name']]['value']);
                 } else {
                     $confobj->setConfValueForInput($config['default']);
                     //$confobj->setVar('conf_value', $config['default']);
                 }
                 $confobj->setVar('conf_order', $order);
                 $confop_msgs = '';
                 if (isset($config['options']) && is_array($config['options'])) {
                     foreach ($config['options'] as $key => $value) {
                         $confop = $config_handler->createConfigOption();
                         $confop->setVar('confop_name', $key);
                         $confop->setVar('confop_value', $value);
                         $confobj->setConfOptions($confop);
                         $confop_msgs .= '<br />&nbsp;&nbsp;&nbsp;&nbsp;';
                         $confop_msgs .= SystemLocale::S_CONFIG_OPTION_ADDED;
                         $confop_msgs .= '&nbsp;';
                         $confop_msgs .= XoopsLocale::C_NAME;
                         $confop_msgs .= ' <strong>' . Xoops_Locale::translate($key, $module->getVar('dirname')) . '</strong> ';
                         $confop_msgs .= XoopsLocale::C_VALUE . ' <strong>' . $value . '</strong> ';
                         unset($confop);
                     }
                 }
                 ++$order;
                 if (false != $config_handler->insertConfig($confobj)) {
                     $this->trace[]['sub'] = sprintf(SystemLocale::SF_CONFIG_ADDED, "<strong>" . $config['name'] . "</strong>") . $confop_msgs;
                 } else {
                     $this->trace[]['sub'] = '<span class="red">' . sprintf(SystemLocale::EF_CONFIG_NOT_ADDED, "<strong>" . $config['name'] . "</strong>") . '</span>';
                 }
                 unset($confobj);
             }
         }
         unset($configs);
     }
 }
Example #16
0
 /**
  * XoopsFormDhtmlTextArea::codeIcon()
  *
  * @return string
  */
 function codeIcon()
 {
     $textarea_id = $this->getName();
     $code = "<a name='moresmiley'></a>" . "<img src='" . XOOPS_URL . "/images/url.gif' alt='" . _XOOPS_FORM_ALT_URL . "' title='" . _XOOPS_FORM_ALT_URL . "' onclick='xoopsCodeUrl(\"{$textarea_id}\", \"" . htmlspecialchars(_ENTERURL, ENT_QUOTES) . "\", \"" . htmlspecialchars(_ENTERWEBTITLE, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/>&nbsp;" . "<img src='" . XOOPS_URL . "/images/email.gif' alt='" . _XOOPS_FORM_ALT_EMAIL . "' title='" . _XOOPS_FORM_ALT_EMAIL . "' onclick='xoopsCodeEmail(\"{$textarea_id}\", \"" . htmlspecialchars(_ENTEREMAIL, ENT_QUOTES) . "\");'  onmouseover='style.cursor=\"hand\"'/>&nbsp;" . "<img src='" . XOOPS_URL . "/images/imgsrc.gif' alt='" . _XOOPS_FORM_ALT_IMG . "' title='" . _XOOPS_FORM_ALT_IMG . "' onclick='xoopsCodeImg(\"{$textarea_id}\", \"" . htmlspecialchars(_ENTERIMGURL, ENT_QUOTES) . "\", \"" . htmlspecialchars(_ENTERIMGPOS, ENT_QUOTES) . "\", \"" . htmlspecialchars(_IMGPOSRORL, ENT_QUOTES) . "\", \"" . htmlspecialchars(_ERRORIMGPOS, ENT_QUOTES) . "\", \"" . htmlspecialchars(_XOOPS_FORM_ALT_ENTERWIDTH, ENT_QUOTES) . "\");'  onmouseover='style.cursor=\"hand\"'/>&nbsp;" . "<img src='" . XOOPS_URL . "/images/image.gif' alt='" . _XOOPS_FORM_ALT_IMAGE . "' title='" . _XOOPS_FORM_ALT_IMAGE . "' onclick='openWithSelfMain(\"" . XOOPS_URL . "/imagemanager.php?target={$textarea_id}\",\"imgmanager\",400,430);'  onmouseover='style.cursor=\"hand\"'/>&nbsp;" . "<img src='" . XOOPS_URL . "/images/smiley.gif' alt='" . _XOOPS_FORM_ALT_SMILEY . "' title='" . _XOOPS_FORM_ALT_SMILEY . "' onclick='openWithSelfMain(\"" . XOOPS_URL . "/misc.php?action=showpopups&amp;type=smilies&amp;target={$textarea_id}\",\"smilies\",300,475);'  onmouseover='style.cursor=\"hand\"'/>&nbsp;";
     $myts =& MyTextSanitizer::getInstance();
     $extensions = array_filter($myts->config['extensions']);
     foreach (array_keys($extensions) as $key) {
         $extension = $myts->loadExtension($key);
         @(list($encode, $js) = $extension->encode($textarea_id));
         if (empty($encode)) {
             continue;
         }
         $code .= $encode;
         if (!empty($js)) {
             $this->js .= $js;
         }
     }
     $code .= "<img src='" . XOOPS_URL . "/images/code.gif' alt='" . _XOOPS_FORM_ALT_CODE . "' title='" . _XOOPS_FORM_ALT_CODE . "' onclick='xoopsCodeCode(\"{$textarea_id}\", \"" . htmlspecialchars(_ENTERCODE, ENT_QUOTES) . "\");'  onmouseover='style.cursor=\"hand\"'/>&nbsp;" . "<img src='" . XOOPS_URL . "/images/quote.gif' alt='" . _XOOPS_FORM_ALT_QUOTE . "' title='" . _XOOPS_FORM_ALT_QUOTE . "' onclick='xoopsCodeQuote(\"{$textarea_id}\", \"" . htmlspecialchars(_ENTERQUOTE, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/>";
     $xoopsPreload =& XoopsPreload::getInstance();
     $xoopsPreload->triggerEvent('core.class.xoopsform.formdhtmltextarea.codeicon', array(&$code));
     return $code;
 }