Beispiel #1
0
 public function __construct()
 {
     parent::__construct();
     // SMARTY_PLUGINS_DIR is initialized into parent
     $xoops = Xoops::getInstance();
     $xoops->preload()->triggerEvent('core.template.construct.start', array($this));
     $this->left_delimiter = '<{';
     $this->right_delimiter = '}>';
     $this->setTemplateDir(\XoopsBaseConfig::get('themes-path'));
     $this->setCacheDir(\XoopsBaseConfig::get('smarty-cache'));
     $this->setCompileDir(\XoopsBaseConfig::get('smarty-compile'));
     $this->compile_check = $xoops->getConfig('theme_fromfile') == 1;
     $this->setPluginsDir(\XoopsBaseConfig::get('smarty-xoops-plugins'));
     $this->addPluginsDir(SMARTY_PLUGINS_DIR);
     $this->setCompileId();
     $this->assign(array('xoops_url' => \XoopsBaseConfig::get('url'), 'xoops_rootpath' => \XoopsBaseConfig::get('root-path'), 'xoops_langcode' => XoopsLocale::getLangCode(), 'xoops_charset' => XoopsLocale::getCharset(), 'xoops_version' => \Xoops::VERSION, 'xoops_upload_url' => \XoopsBaseConfig::get('uploads-url')));
 }
Beispiel #2
0
 public function test__construct()
 {
     $xoops = \Xoops::getInstance();
     $this->assertSame('{', $this->object->left_delimiter);
     $this->assertSame('}', $this->object->right_delimiter);
     $this->assertTrue(in_array(\XoopsBaseConfig::get('themes-path') . DIRECTORY_SEPARATOR, $this->object->getTemplateDir()));
     $this->assertSame(\XoopsBaseConfig::get('var-path') . '/caches/smarty_cache' . DIRECTORY_SEPARATOR, $this->object->getCacheDir());
     $this->assertSame(\XoopsBaseConfig::get('var-path') . '/caches/smarty_compile' . DIRECTORY_SEPARATOR, $this->object->getCompileDir());
     $this->assertSame($xoops->getConfig('theme_fromfile') == 1, $this->object->compile_check);
     $this->assertSame(array(\XoopsBaseConfig::get('lib-path') . '/smarty/xoops_plugins' . DIRECTORY_SEPARATOR, SMARTY_DIR . 'plugins' . DS), $this->object->plugins_dir);
     $this->assertSame(\XoopsBaseConfig::get('url'), $this->object->getTemplateVars('xoops_url'));
     $this->assertSame(\XoopsBaseConfig::get('root-path'), $this->object->getTemplateVars('xoops_rootpath'));
     $this->assertSame(\XoopsLocale::getLangCode(), $this->object->getTemplateVars('xoops_langcode'));
     $this->assertSame(\XoopsLocale::getCharset(), $this->object->getTemplateVars('xoops_charset'));
     $this->assertSame(\Xoops::VERSION, $this->object->getTemplateVars('xoops_version'));
     $this->assertSame(\XoopsBaseConfig::get('uploads-url'), $this->object->getTemplateVars('xoops_upload_url'));
 }
Beispiel #3
0
$myts = MyTextSanitizer::getInstance();
if (!$tpl->isCached('module:publisher/publisher_rss.tpl')) {
    $channel_category = $publisher->getModule()->getVar('name');
    $tpl->assign('channel_charset', XoopsLocale::getCharset());
    $tpl->assign('channel_title', htmlspecialchars($xoops->getConfig('sitename'), ENT_QUOTES));
    $tpl->assign('channel_link', PUBLISHER_URL);
    $tpl->assign('channel_desc', htmlspecialchars($xoops->getConfig('slogan'), ENT_QUOTES));
    $tpl->assign('channel_lastbuild', XoopsLocale::formatTimestamp(time(), 'rss'));
    $tpl->assign('channel_webmaster', $xoops->getConfig('adminmail'));
    $tpl->assign('channel_editor', $xoops->getConfig('adminmail'));
    if ($categoryid != -1) {
        $channel_category .= " > " . $categoryObj->getVar('name');
    }
    $tpl->assign('channel_category', htmlspecialchars($channel_category));
    $tpl->assign('channel_generator', $publisher->getModule()->getVar('name'));
    $tpl->assign('channel_language', XoopsLocale::getLangCode());
    $tpl->assign('image_url', \XoopsBaseConfig::get('url') . '/images/logo.gif');
    $dimention = getimagesize(\XoopsBaseConfig::get('root-path') . '/images/logo.gif');
    if (empty($dimention[0])) {
        $width = 140;
        $height = 140;
    } else {
        $width = $dimention[0] > 140 ? 140 : $dimention[0];
        $dimention[1] = $dimention[1] * $width / $dimention[0];
        $height = $dimention[1] > 140 ? $dimention[1] * $dimention[0] / 140 : $dimention[1];
    }
    $tpl->assign('image_width', $width);
    $tpl->assign('image_height', $height);
    $sarray = $publisher->getItemHandler()->getAllPublished(10, 0, $categoryid);
    if (is_array($sarray)) {
        $count = $sarray;
Beispiel #4
0
 /**
  * Render Simple Header
  *
  * @param bool $closehead true to close the HTML head element
  *
  * @return void
  */
 public function simpleHeader($closehead = true)
 {
     $this->events()->triggerEvent('core.header.start');
     $this->theme();
     $xoopsConfigMetaFooter = $this->getConfigs();
     if (!headers_sent()) {
         header('Content-Type:text/html; charset=' . XoopsLocale::getCharset());
         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, max-age=1, s-maxage=1, must-revalidate, post-check=0, pre-check=0');
         header("Pragma: no-cache");
     }
     echo "<!DOCTYPE html>\n";
     $xoops_url = \XoopsBaseConfig::get('url');
     echo '<html lang="' . XoopsLocale::getLangCode() . '">
           <head>
           <meta http-equiv="content-type" content="text/html; charset=' . XoopsLocale::getCharset() . '" />
           <meta name="robots" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_robots']) . '" />
           <meta name="keywords" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_keywords']) . '" />
           <meta name="description" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_description']) . '" />
           <meta name="rating" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_rating']) . '" />
           <meta name="author" content="' . htmlspecialchars($xoopsConfigMetaFooter['meta_author']) . '" />
           <meta name="generator" content="XOOPS" />
           <title>' . htmlspecialchars($this->getConfig('sitename')) . '</title>
           <script type="text/javascript" src="' . $xoops_url . '/include/xoops.js"></script>
           <script type="text/javascript" src="' . $xoops_url . '/media/jquery/jquery.js"></script>
           <script type="text/javascript" src="' . $xoops_url . '/media/bootstrap/js/bootstrap.min.js"></script>';
     $themecss = $this->getCss($this->getConfig('theme_set'));
     echo '<link rel="stylesheet" type="text/css" media="all" href="' . $xoops_url . '/xoops.css" />';
     $locale = $this->getConfig('locale');
     if (XoopsLoad::fileExists($this->path('locale/' . $locale . '/style.css'))) {
         echo '<link rel="stylesheet" type="text/css" media="all" href="' . $xoops_url . '/locale/' . $locale . '/style.css" />';
     }
     if ($themecss) {
         echo '<link rel="stylesheet" type="text/css" media="all" href="' . $themecss . '" />';
         echo '<link rel="stylesheet" type="text/css" media="screen" href="' . $this->url('themes/' . $this->getConfig('theme_set') . '/media/bootstrap/css/xoops.bootstrap.css') . '" />';
     }
     if ($closehead) {
         echo '</head><body>';
     }
 }
Beispiel #5
0
 /**
  * get language
  *
  * @return    string
  */
 function getLanguage()
 {
     if ($this->language) {
         return $this->language;
     }
     if (defined("_XOOPS_EDITOR_TINYMCE_LANGUAGE")) {
         $this->language = strtolower(constant("_XOOPS_EDITOR_TINYMCE_LANGUAGE"));
     } else {
         $this->language = str_replace('_', '-', strtolower(XoopsLocale::getLangCode()));
         if (strtolower(XoopsLocale::getCharset()) == "utf-8") {
             $this->language .= "_utf8";
         }
     }
     return $this->language;
 }
Beispiel #6
0
include $path . '/mainfile.php';
if (!defined('XOOPS_ROOT_PATH')) {
    exit;
}
include_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/user.php';
$op = isset($_POST['op']) && $_POST['op'] == 'dologin' ? 'dologin' : 'login';
$username = isset($_POST['username']) ? trim($_POST['username']) : '';
$password = isset($_POST['userpass']) ? trim($_POST['userpass']) : '';
if ($username == '' || $password == '') {
    $op = 'login';
}
echo '
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=' . XoopsLocale::getCharset() . '" />
    <meta http-equiv="content-language" content="' . XoopsLocale::getLangCode() . '" />
    <title>' . $xoopsConfig['sitename'] . '</title>
    <link rel="stylesheet" type="text/css" media="all" href="' . XOOPS_URL . '/xoops.css" />
';
$style = xoops_getcss($xoopsConfig['theme_set']);
if ($style == '') {
    $style = xoops_getcss($xoopsConfig['theme_set']);
}
if ($style != '') {
    echo '<link rel="stylesheet" type="text/css" media="all" href="' . $style . '" />';
}
echo '
  </head>
  <body>
';
if ($op == 'dologin') {
Beispiel #7
0
 /**
  * init - called by parent::_construct
  *
  * @return void
  */
 protected function init()
 {
     $this->setTemplate('module:xmf/xmf_feed.tpl');
     //$this->disableLogger();
     global $xoopsConfig;
     $this->_title = $xoopsConfig['sitename'];
     $this->_url = \XoopsBaseConfig::get('url');
     $this->_description = $xoopsConfig['slogan'];
     $this->_language = \XoopsLocale::getLangCode();
     $this->_charset = \XoopsLocale::getCharset();
     $this->_pubdate = \XoopsLocale::formatTimestamp(time(), 'short');
     $this->_lastbuild = \XoopsLocale::formatTimestamp(time(), 'D, d M Y H:i:s');
     $this->_webmaster = $xoopsConfig['adminmail'];
     $this->_editor = $xoopsConfig['adminmail'];
     $this->_generator = \Xoops::VERSION;
     $this->_copyright = 'Copyright ' . \XoopsLocale::formatTimestamp(time(), 'Y') . ' ' . $xoopsConfig['sitename'];
     $this->_image_title = $this->_title;
     $this->_image_url = \XoopsBaseConfig::get('url') . '/images/logo.gif';
     $this->_image_link = $this->_url;
 }
Beispiel #8
0
    /**
     * Dump output
     * 
     * @param string $mode unused
     * 
     * @return string output
     */
    public function dump($mode = '')
    {
        $ret = '';
        // -------------------------------------------------------------
        $xoops = Xoops::getInstance();
        /* @var $this LoggerLegacy */
        $ret = '';
        if ($mode == 'popup') {
            $dump = $this->dump('');
            $content = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
    <meta http-equiv="content-language" content="' . XoopsLocale::getLangCode() . '" />
    <meta http-equiv="content-type" content="text/html; charset=' . XoopsLocale::getCharset() . '" />
    <title>' . $xoops->getConfig('sitename') . ' - ' . _MD_LOGGER_DEBUG . ' </title>
    <meta name="generator" content="XOOPS" />
    <link rel="stylesheet" type="text/css" media="all" href="' . $xoops->getCss($xoops->getConfig('theme_set')) . '" />
</head>
<body>' . $dump . '
    <div style="text-align:center;">
        <input class="formButton" value="' . XoopsLocale::A_CLOSE . '" type="button" onclick="javascript:window.close();" />
    </div>
';
            $ret .= '
<script type="text/javascript">
    debug_window = openWithSelfMain("about:blank", "popup", 680, 450, true);
    debug_window.document.clear();
';
            $lines = preg_split("/(\r\n|\r|\n)( *)/", $content);
            foreach ($lines as $line) {
                $ret .= "\n" . 'debug_window.document.writeln("' . str_replace(array('"', '</'), array('\\"', '<\\/'), $line) . '");';
            }
            $ret .= '
    debug_window.focus();
    debug_window.document.close();
</script>
';
        }
        $this->addExtra(_MD_LOGGER_INCLUDED_FILES, sprintf(_MD_LOGGER_FILES, count(get_included_files())));
        /*
        $included_files = get_included_files();
        foreach ($included_files as $filename) {
            $this->addExtra('files',$filename);
        }
        
        if (function_exists('memory_get_peak_usage')) {
            $this->addExtra('Peak memory',memory_get_peak_usage());
        }
        */
        $memory = 0;
        if (function_exists('memory_get_usage')) {
            $memory = memory_get_usage() . ' bytes';
        } else {
            if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
                $out = array();
                exec('tasklist /FI "PID eq ' . getmypid() . '" /FO LIST', $out);
                if (isset($out[5])) {
                    $memory = sprintf(_MD_LOGGER_MEM_ESTIMATED, substr($out[5], strpos($out[5], ':') + 1));
                }
            }
        }
        if ($memory) {
            $this->addExtra(_MD_LOGGER_MEM_USAGE, $memory);
        }
        if (empty($mode)) {
            $views = array('errors', 'deprecated', 'queries', 'blocks', 'extra');
            $ret .= "\n<div id=\"xo-logger-output\">\n<div id='xo-logger-tabs'>\n";
            $ret .= "<a href='javascript:xoSetLoggerView(\"none\")'>" . _MD_LOGGER_NONE . "</a>\n";
            $ret .= "<a href='javascript:xoSetLoggerView(\"\")'>" . _MD_LOGGER_ALL . "</a>\n";
            foreach ($views as $view) {
                $count = count($this->{$view});
                $ret .= "<a href='javascript:xoSetLoggerView(\"{$view}\")'>" . constant('_MD_LOGGER_' . strtoupper($view)) . " ({$count})</a>\n";
            }
            $count = count($this->logstart);
            $ret .= "<a href='javascript:xoSetLoggerView(\"timers\")'>" . _MD_LOGGER_TIMERS . "({$count})</a>\n";
            $ret .= "</div>\n";
        }
        if (empty($mode) || $mode == 'errors') {
            $class = 'even';
            $ret .= '<table id="xo-logger-errors" class="outer"><thead><tr><th>' . _MD_LOGGER_ERRORS . '</th></tr></thead><tbody>';
            foreach ($this->errors as $error) {
                $ret .= "\n<tr><td class='{$class}'>";
                $ret .= $error;
                $ret .= "<br />\n</td></tr>";
                $class = $class == 'odd' ? 'even' : 'odd';
            }
            $ret .= "\n</tbody></table>\n";
        }
        if (empty($mode) || $mode == 'deprecated') {
            $class = 'even';
            $ret .= '<table id="xo-logger-deprecated" class="outer"><thead><tr><th>' . _MD_LOGGER_DEPRECATED . '</th></tr></thead><tbody>';
            foreach ($this->deprecated as $message) {
                $ret .= "\n<tr><td class='{$class}'>";
                $ret .= $message;
                $ret .= "<br />\n</td></tr>";
                $class = $class == 'odd' ? 'even' : 'odd';
            }
            $ret .= "\n</tbody></table>\n";
        }
        if (empty($mode) || $mode == 'queries') {
            $class = 'even';
            $ret .= '<table id="xo-logger-queries" class="outer"><thead><tr><th>' . _MD_LOGGER_QUERIES . '</th></tr></thead><tbody>';
            $pattern = '/\\b' . preg_quote(\XoopsBaseConfig::get('db-prefix')) . '\\_/i';
            foreach ($this->queries as $q) {
                $sql = preg_replace($pattern, '', $q['sql']);
                $query_time = isset($q['query_time']) ? sprintf('%0.6f - ', $q['query_time']) : '';
                if (isset($q['error'])) {
                    $ret .= '<tr class="' . $class . '"><td><span style="color:#ff0000;">' . $query_time . htmlentities($sql) . '<br /><strong>Error number:</strong> ' . $q['errno'] . '<br /><strong>Error message:</strong> ' . $q['error'] . '</span></td></tr>';
                } else {
                    $ret .= '<tr class="' . $class . '"><td>' . $query_time . htmlentities($sql) . '</td></tr>';
                }
                $class = $class == 'odd' ? 'even' : 'odd';
            }
            $ret .= '</tbody><tfoot><tr class="foot"><td>' . _MD_LOGGER_TOTAL . ': <span style="color:#ff0000;">' . count($this->queries) . '</span></td></tr></tfoot></table>';
        }
        if (empty($mode) || $mode == 'blocks') {
            $class = 'even';
            $ret .= '<table id="xo-logger-blocks" class="outer"><thead><tr><th>' . _MD_LOGGER_BLOCKS . '</th></tr></thead><tbody>';
            foreach ($this->blocks as $b) {
                if ($b['cached']) {
                    $ret .= '<tr><td class="' . $class . '"><strong>' . $b['name'] . ':</strong> ' . sprintf(_MD_LOGGER_CACHED, (int) $b['cachetime']) . '</td></tr>';
                } else {
                    $ret .= '<tr><td class="' . $class . '"><strong>' . $b['name'] . ':</strong> ' . _MD_LOGGER_NOT_CACHED . '</td></tr>';
                }
                $class = $class == 'odd' ? 'even' : 'odd';
            }
            $ret .= '</tbody><tfoot><tr class="foot"><td>' . _MD_LOGGER_TOTAL . ': <span style="color:#ff0000;">' . count($this->blocks) . '</span></td></tr></tfoot></table>';
        }
        if (empty($mode) || $mode == 'extra') {
            $class = 'even';
            $ret .= '<table id="xo-logger-extra" class="outer"><thead><tr><th>' . _MD_LOGGER_EXTRA . '</th></tr></thead><tbody>';
            foreach ($this->extra as $ex) {
                $ret .= '<tr><td class="' . $class . '"><strong>';
                $ret .= htmlspecialchars($ex['name']) . ':</strong> ' . htmlspecialchars($ex['msg']);
                $ret .= '</td></tr>';
                $class = $class == 'odd' ? 'even' : 'odd';
            }
            $ret .= '</tbody></table>';
        }
        if (empty($mode) || $mode == 'timers') {
            $class = 'even';
            $ret .= '<table id="xo-logger-timers" class="outer"><thead><tr><th>' . _MD_LOGGER_TIMERS . '</th></tr></thead><tbody>';
            foreach ($this->logstart as $k => $v) {
                $ret .= '<tr><td class="' . $class . '"><strong>';
                $ret .= sprintf(_MD_LOGGER_TIMETOLOAD, htmlspecialchars($k) . '</strong>', '<span style="color:#ff0000;">' . sprintf("%.03f", $this->dumpTime($k)) . '</span>');
                $ret .= '</td></tr>';
                $class = $class == 'odd' ? 'even' : 'odd';
            }
            $ret .= '</tbody></table>';
        }
        if (empty($mode)) {
            $ret .= <<<EOT
</div>
<script type="text/javascript">
    function xoLogCreateCookie(name,value,days) {
        if (days) {
            var date = new Date();
            date.setTime(date.getTime()+(days*24*60*60*1000));
            var expires = "; expires="+date.toGMTString();
        }
        else var expires = "";
        document.cookie = name+"="+value+expires+"; path=/";
    }
    function xoLogReadCookie(name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for(var i=0;i < ca.length;i++) {
            var c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(1,c.length);
            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
        }
        return null;
    }
    function xoLogEraseCookie(name) {
        createCookie(name,"",-1);
    }
    function xoSetLoggerView( name ) {
        var log = document.getElementById( "xo-logger-output" );
        if ( !log ) return;
        var i, elt;
        for ( i=0; i!=log.childNodes.length; i++ ) {
            elt = log.childNodes[i];
            if ( elt.tagName && elt.tagName.toLowerCase() != 'script' && elt.id != "xo-logger-tabs" ) {
                elt.style.display = ( !name || elt.id == "xo-logger-" + name ) ? "block" : "none";
            }
        }
        xoLogCreateCookie( 'XOLOGGERVIEW', name, 1 );
    }
    xoSetLoggerView( xoLogReadCookie( 'XOLOGGERVIEW' ) );
</script>

EOT;
        }
        // -------------------------------------------------------------
        return $ret;
    }
<?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.
*/
/**
 * CAPTCHA configurations for Recaptcha mode
 *
 * @category  Xoops\Class\Captcha\config.recaptcha
 * @package   config.recaptcha
 * @author    trabis <*****@*****.**>
 * @copyright 2013 XOOPS Project (http://xoops.org)
 * @license   GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @version   $Id$
 * @link      http://xoops.org
 * @since     2.6.0
 */
return $config = array('private_key' => 'YourPrivateApiKey', 'public_key' => 'YourPublicApiKey', 'theme' => 'white', 'lang' => XoopsLocale::getLangCode());