Dotclear

Changeset 1315:220e119ae6c8 for inc/core


Ignore:
Timestamp:
08/09/13 08:01:31 (12 years ago)
Author:
Dsls
Branch:
twig
Parents:
1158:9d7267aec27b (diff), 1314:99a1319b79fc (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge with default

Location:
inc/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inc/core/class.dc.blog.php

    r1280 r1315  
    44# This file is part of Dotclear 2. 
    55# 
    6 # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear 
     6# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear 
    77# Licensed under the GPL version 2.0 license. 
    88# See LICENSE file or 
     
    8181               $this->desc = $b->blog_desc; 
    8282               $this->url = $b->blog_url; 
    83                $this->host = http::getHostFromURL($this->url); 
     83               $this->host = preg_replace('|^([a-z]{3,}://)(.*?)/.*$|','$1$2',$this->url); 
    8484               $this->creadt = strtotime($b->blog_creadt); 
    8585               $this->upddt = strtotime($b->blog_upddt); 
     
    805805           
    806806          if (!empty($params['user_id'])) { 
    807                $strReq .= "AND U.user_id = '".$this->con->escape($params['user_id'])."' "; 
     807               $strReq .= "AND U.user_id ".$this->con->in($params['user_id'])." "; 
    808808          } 
    809809           
     
    889889                    $strReq .= 'ORDER BY post_dt DESC '; 
    890890               } 
    891           } 
    892            
    893           if (!$count_only && !empty($params['limit'])) { 
    894                $strReq .= $this->con->limit($params['limit']); 
     891               if (!empty($params['limit'])) { 
     892                    $strReq .= $this->con->limit($params['limit']); 
     893               } 
    895894          } 
    896895           
  • inc/core/class.dc.core.php

    r1179 r1315  
    44# This file is part of Dotclear 2. 
    55# 
    6 # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear 
     6# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear 
    77# Licensed under the GPL version 2.0 license. 
    88# See LICENSE file or 
     
    3939     public $rest;       ///< <b>dcRestServer</b> dcRestServer object 
    4040     public $log;        ///< <b>dcLog</b>             dcLog object 
     41     public $tpl;        ///< <b>Twig_Environment</b>  Twig_Environment object 
    4142      
    4243     private $versions = null; 
     
    9596          $this->addFormater('xhtml', create_function('$s','return $s;')); 
    9697          $this->addFormater('wiki', array($this,'wikiTransform')); 
     98          $this->loadTemplateEnvironment(); 
    9799     } 
    98100      
     
    118120     } 
    119121      
     122     /** 
     123     Create template environment (Twig_Environment instance) 
     124      
     125     default-templates path must be added from admin|public/prepend.php with: 
     126     $core->tpl->getLoader()->addPath('PATH_TO/default-templates'); 
     127     Selected theme path must be added with: 
     128     $core->tpl->getLoader()->prependPath('PATH_TO/MY_THEME'); 
     129     */ 
     130     public function loadTemplateEnvironment() 
     131     { 
     132          $cache_dir = path::real(DC_TPL_CACHE.'/twtpl',false); 
     133          if (!is_dir($cache_dir)) { 
     134               try { 
     135                    files::makeDir($cache_dir); 
     136               } catch (Exception $e) { 
     137                    $cache_dir = false; 
     138               } 
     139          } 
     140           
     141          $this->tpl = new Twig_Environment( 
     142               new Twig_Loader_Filesystem(dirname(__FILE__).'/../swf'), 
     143               array( 
     144                    'auto_reload' => true, 
     145                    'autoescape' => false, 
     146                    'base_template_class' => 'Twig_Template', 
     147                    'cache' => $cache_dir,  
     148                    'charset' => 'UTF-8', 
     149                    'debug' => DC_DEBUG, 
     150                    'optimizations' => -1, 
     151                    'strict_variables' => 0 //DC_DEBUG // Please fix undefined variables! 
     152               ) 
     153          ); 
     154          $this->tpl->addExtension(new dcFormExtension($this)); 
     155          $this->tpl->addExtension(new dcTabExtension($this)); 
     156     } 
    120157      
    121158     /// @name Blog init methods 
Note: See TracChangeset for help on using the changeset viewer.

Sites map