Exemplo n.º 1
0
 function parse($html = null, $blockName = 'document', $blockParams = null)
 {
     $blockParams = (array) $blockParams;
     $blockParams += array('url' => SL::url(SL::nodeUrl($this->_getVar('Node'))), 'style' => null, 'source' => 'tweetmeme');
     $this->vars = $blockParams;
     return parent::parse($html, $blockName);
 }
Exemplo n.º 2
0
 function parse($html = null, $blockName = 'document', $blockParams = null)
 {
     $blockParams = (array) $blockParams;
     $blockParams += array('id' => null);
     if ($blockParams['id']) {
         $oldVars = $this->vars;
         $this->vars = SlNode::get($blockParams['id'], array('auth' => true));
     }
     if ($blockName === 'NodeView') {
         $skin = empty(SL::getInstance()->view->params['named']['skin']) ? Inflector::camelize($this->_getVar('CmsNode.skin')) : Inflector::camelize(SL::getInstance()->view->params['named']['skin']);
         $skin = $skin && Pheme::init("NodeView{$skin}") ? "NodeView{$skin}" : "NodeViewDefault";
     } else {
         $skin = $blockName;
     }
     if ($skin != $blockName) {
         PhemeParser::$parseCallStack[] = Pheme::get($skin);
         $result = parent::parse($html, $skin);
         array_pop(PhemeParser::$parseCallStack);
     } else {
         $result = parent::parse($html, $skin);
     }
     if (isset($oldVars)) {
         $this->vars = $oldVars;
     }
     return $result;
 }
Exemplo n.º 3
0
 function parse($html = null, $blockName = 'document', $blockParams = null)
 {
     $blockParams = (array) $blockParams;
     $blockParams += array('range' => true, 'min' => 0, 'max' => 100, 'values' => array(0, 100), 'domId' => SL::uniqid());
     $options = $blockParams;
     unset($options['domId']);
     $key = "jqueryUiSlider-{$blockParams['domId']}";
     SlConfigure::write("Asset.js.ready.{$key}", "\$('#{$blockParams['domId']}').slider(" . json_encode($options) . ')');
     return parent::parse($html, $blockName);
 }
Exemplo n.º 4
0
 /**
  * Class constructor.
  *
  * @param string $method Method producing the error
  * @param array $messages Error messages
  */
 function __construct($method, $messages)
 {
     $this->_requested = !SL::getInstance()->main;
     // Make a more user-friendly "No Database Connection"
     if ($method === 'missingTable') {
         $db = @ConnectionManager::getDataSource('default');
         if (!$db->isConnected()) {
             $method = 'dbConnectionError';
         }
     }
     parent::__construct($method, $messages);
 }
Exemplo n.º 5
0
 function parse($html = null, $blockName = 'document', $blockParams = null)
 {
     $blockParams = (array) $blockParams;
     $blockParams += array('width' => 300, 'height' => 120, 'version' => '9.0.0.0', 'src' => 'swfobject/test.swf', 'id' => SL::uniqid(), 'flashvars' => array(), 'params' => array(), 'attributes' => array());
     if ($html && !preg_match('/[\\n]/', $html)) {
         $blockParams['src'] = $html;
         $html = null;
     }
     foreach (array('flashvars', 'params', 'attributes') as $key) {
         $blockParams[$key] = json_encode($blockParams[$key]);
     }
     $this->vars = $blockParams;
     return parent::parse($html, $blockName);
 }
Exemplo n.º 6
0
 function parse($html = null, $blockName = 'document', $blockParams = null)
 {
     $blockParams = (array) $blockParams;
     $blockParams += array('id' => false, 'skin' => null);
     if ($blockName === 'NodeIndex') {
         $skin = empty(SL::getInstance()->view->params['named']['skin']) ? Inflector::camelize($blockParams['skin']) : Inflector::camelize(SL::getInstance()->view->params['named']['skin']);
         $skin = $skin && Pheme::init("NodeIndex{$skin}") ? "NodeIndex{$skin}" : "NodeIndexDefault";
     } else {
         $skin = $blockName;
     }
     $this->vars['ajaxId'] = SL::uniqid();
     if ($blockParams['id'] === false) {
         $nodes = $this->_getVar('nodes');
     } else {
         if ($blockParams['id'] === 0) {
             $blockParams['id'] = null;
         }
         $nodes = SlNode::find('all', array('conditions' => array('CmsNode.parent_id' => $blockParams['id'], 'CmsNode.visible' => true), 'order' => array('CmsNode.lft' => 'asc'), 'auth' => 'index'));
     }
     if ($nodes) {
         foreach ($nodes as &$node) {
             $node['href'] = h(SlNode::url($node));
         }
         $this->blocks["loop"]->params[0] =& $nodes;
         if ($skin != $blockName) {
             PhemeParser::$parseCallStack[] = Pheme::get($skin);
         }
         PhemeParser::$parseCallStack[] = Pheme::get('NodeView');
         $html = parent::parse($html, $skin);
         array_pop(PhemeParser::$parseCallStack);
         if ($skin != $blockName) {
             array_pop(PhemeParser::$parseCallStack);
         }
         return $html;
     }
 }
Exemplo n.º 7
0
<?php

/* ---  incializace jadra  --- */
require '../require/load.php';
SL::init('../');
/* ---  nacteni argumentu  --- */
if (!isset($_GET['redir_id'], $_GET['redir_type'])) {
    die;
}
$id = intval($_GET['redir_id']);
$type = intval($_GET['redir_type']);
if ($type !== 1) {
    $type = 0;
}
/* ---  test existence  --- */
if (0 === $type) {
    $query = DB::query('SELECT `id`,`title_seo` FROM `' . _mysql_prefix . '-root` WHERE `id`=' . $id);
} else {
    $query = DB::query('SELECT art.`id`,art.`title_seo`,cat.`title_seo` AS cat_title_seo FROM `' . _mysql_prefix . '-articles` AS art JOIN `' . _mysql_prefix . '-root` AS cat ON(cat.id=art.home1) WHERE art.`id`=' . $id);
}
$query = DB::row($query);
if ($query === false) {
    // neexistuje
    $_GET = array('m' => '404');
    define('_index_noinit', true);
    require _indexroot . 'index.php';
    die;
}
/* ---  presmerovani  --- */
// sestavit adresu
$redir = $type === 0 ? _linkRoot($query['id'], $query['title_seo']) : _linkArticle($query['id'], $query['title_seo'], $query['cat_title_seo']);
Exemplo n.º 8
0
<?php

/* ---  incializace jadra  --- */
require '../require/load.php';
define('_header', 'Content-Type: text/plain; charset=UTF-8');
SL::init('../', null, true, false, true, false);
/* --- autorizace --- */
$auth = explode(':', SL::$settings['cron_auth'], 2);
if (2 !== sizeof($auth) || !isset($_GET['user'], $_GET['password']) || $_GET['user'] !== $auth[0] || $_GET['password'] !== $auth[1]) {
    header('HTTP/1.0 401 Unauthorized');
    echo 'Unauthorized';
    exit(1);
}
/* ---  spusteni cronu  --- */
// priprava
$start = microtime(true);
$names = array();
function cron_log_name($args)
{
    $GLOBALS['names'][] = $args['name'];
}
_extend('reg', 'sys.cron', 'cron_log_name');
// spusteni
SL::runCron();
// vysledek
echo 'OK(', round((microtime(true) - $start) * 1000), 'ms) ', implode(', ', $names);
Exemplo n.º 9
0
 /**
  * Redirects to given $url, after turning off $this->autoRender.
  * Script execution is halted after the redirect.
  *
  * @param mixed $url A string or array-based URL pointing to another location within the app, or an absolute URL
  * @param integer $status Optional HTTP status code (eg: 404)
  * @access public
  * @link http://book.cakephp.org/view/425/redirect
  */
 public function redirect($url, $status = null, $useReferer = true)
 {
     if ($useReferer) {
         $ref = SlSession::read('Routing.ref');
         if ($ref) {
             SlSession::delete('Routing.ref');
             if (Sl::url($ref) !== Sl::url()) {
                 $url = $ref;
             }
         }
     }
     // cyclic check
     if (Sl::url($url) === Sl::url()) {
         die('Infinite redirection loop detected.');
     }
     // code inspired from RequestHandlerComponent
     if ($this->RequestHandler->isAjax()) {
         foreach ($_POST as $key => $val) {
             unset($_POST[$key]);
         }
         echo Sl::requestAction($url, array('requested' => false));
         $this->_stop();
     }
     // show a human readable redirect message allowing debug output to be read
     if (headers_sent() || $this->output && Configure::read()) {
         $url = h(SL::url($url));
         if (empty($status)) {
             $status = 'null';
         }
         echo "<p style='background: #ff7; color: #000; padding: 1em;'>Redirect to <a href='{$url}'>{$url}</a> (code: {$status}) cancelled.</p>";
         while (ob_get_level()) {
             ob_end_flush();
         }
         $this->_stop();
     }
     parent::redirect(Sl::url($url, true), $status);
 }
Exemplo n.º 10
0
 public function parse($html, $blockName = 'document', $blockParams = null)
 {
     $blockParams = (array) $blockParams;
     $blockParams += array('XFBML' => false, 'name' => 'recommendations', 'site' => SL::url(SL::nodeUrl($this->_getVar('Node'))), 'width' => 300, 'height' => 300, 'header' => false, 'colorscheme' => 'light', 'font' => 'tahoma', 'border_color' => '#fff');
     if (empty($blockParams['XFBML'])) {
         $blockParams['border_color'] = urlencode($blockParams['border_color']);
         $blockParams['site'] = urlencode($blockParams['site']);
         $blockParams['font'] = urlencode($blockParams['font']);
     }
     return parent::parse($html, $blockName, $blockParams);
 }
Exemplo n.º 11
0
 /**
  * Ziskat instanci cache komponentu
  * @return FileCache
  */
 public static function getCache()
 {
     if (null === self::$cache) {
         self::$cache = new FileCache(_indexroot . 'data/tmp/cache');
         self::$cache->setVerifyBoundFiles(1 == _dev);
     }
     return self::$cache;
 }
Exemplo n.º 12
0
     } else {
         $users_group = " AND `group`=" . $users_group;
     }
     if ($prev) {
         $prev_count['admin.users.users'] = DB::count(_mysql_prefix . '-users', 'id!=0 AND activitytime<' . $users_time . $users_group);
     } else {
         $userids = DB::query("SELECT id FROM `" . _mysql_prefix . "-users` WHERE id!=0 AND activitytime<" . $users_time . $users_group);
         while ($userid = DB::row($userids)) {
             _deleteUser($userid['id']);
         }
         DB::free($userids);
     }
 }
 // udrzba
 if (_checkboxLoad('maintenance') && !$prev) {
     SL::doMaintenance();
 }
 // optimalizace
 if (_checkboxLoad('optimize') && !$prev) {
     $tables = array();
     $q = DB::query('SHOW TABLES LIKE \'' . _mysql_prefix . '-%\'');
     while ($r = DB::rown($q)) {
         DB::query('OPTIMIZE TABLE `' . $r[0] . '`');
     }
 }
 // zprava
 if ($prev) {
     if (empty($prev_count)) {
         $message = _formMessage(2, $_lang['global.noaction']);
         break;
     }
Exemplo n.º 13
0
 function parse($html = null, $blockName = 'document', $blockParams = null)
 {
     $blockParams = (array) $blockParams;
     $blockParams += array('id' => false, 'width' => 0, 'colspan' => 1);
     if (empty($blockParams['id']) && preg_match('/^[a-z0-9]+$/i', $html)) {
         $blockParams['id'] = $html;
         $html = null;
     }
     if (empty($html) && $blockParams['id']) {
         $html = $blockParams['id'] == 'Content' ? '{SiteContent/}' : "{Blocks(\"id\":\"{$blockParams['id']}\")/}";
     }
     if ($html) {
         $uid = SL::uniqid();
         $this->referrer()->columns[$uid] = array(parent::parse($html, $blockName), $blockParams);
         return $uid;
     }
 }
Exemplo n.º 14
0
<?php

/* ----  inicializace jadra  ---- */
chdir('../');
// nasimulovat skript v rootu
require './require/load.php';
SL::init('');
// kontrola pristupu a dat
if (!_loginright_administration || SL::$settings['admin_index_custom'] === '') {
    die;
}
// funkce motivu a administrace
require _indexroot . "require/functions-template.php";
require _indexroot . "admin/functions.php";
/* ----  vystup  ---- */
// konstanty
define('_indexOutput_url', _indexroot);
define('_indexOutput_pid', null);
define('_indexOutput_ptype', 'aindex');
define('_indexOutput_content', '');
define('_indexOutput_title', '');
// tmave schema?
$scheme_dark = _admin_schemeIsDark();
// html hlavicka
require 'require/headstart.php';
?>
<base href="./../" target="_blank" />
<link href="admin/remote/style.css.php?s=<?php 
echo _adminscheme . ($scheme_dark ? '&amp;d' : '') . '&amp;' . _cacheid;
?>
" type="text/css" rel="stylesheet" />
Exemplo n.º 15
0
<?php

/* --  inicializace jadra  -- */
require '../require/load.php';
SL::init('../', null, true, true);
$msg = "";
/* --  instalace databaze  -- */
if (isset($_POST['license'])) {
    // nacteni promennych
    $url = _removeSlashesFromEnd($_POST['url']);
    $pass = $_POST['pass'];
    $pass2 = $_POST['pass2'];
    $email = $_POST['email'];
    $rewrite = _checkboxLoad("rewrite");
    $title = DB::esc(_htmlStr($_POST['title']));
    $descr = DB::esc(_htmlStr($_POST['descr']));
    $keywords = DB::esc(_htmlStr($_POST['kwrds']));
    // kontrola promennych
    $errors = array();
    if ($url == "" or $url == "http://") {
        $errors[] = "Nebyla zadána adresa serveru.";
    }
    if ($pass == "" or $pass2 == "") {
        $errors[] = "Nebylo vyplněno heslo.";
    }
    if ($pass != $pass2) {
        $errors[] = "Zadaná hesla nejsou shodná.";
    }
    if (!_validateEmail($email)) {
        $errors[] = "E-mailová adresa není platná.";
    }