Dotclear

Changeset 1468:3132a0aca046 for inc


Ignore:
Timestamp:
08/19/13 09:55:29 (12 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Parents:
1466:e67efe636ce1 (diff), 1467:917fc08f3a59 (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 2.5 commits into default branch (should be verified)

Location:
inc
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • inc/admin/lib.dc.page.php

    r1461 r1468  
    164164          if ($core->error->flag()) { 
    165165               echo 
    166                '<div class="error"><p><strong>'.(count($core->error->getErrors()) > 1 ? __('Errors:') : __('Error:')).'</p></strong>'. 
     166               '<div class="error"><p><strong>'.(count($core->error->getErrors()) > 1 ? __('Errors:') : __('Error:')).'</strong></p>'. 
    167167               $core->error->toHTML(). 
    168168               '</div>'; 
     
    508508          self::jsVar('dotclear.msg.confirm_delete_theme', 
    509509               __('Are you sure you want to delete "%s" theme?')). 
     510          self::jsVar('dotclear.msg.confirm_delete_backup', 
     511               __('Are you sure you want to delete this backup?')). 
    510512          self::jsVar('dotclear.msg.zip_file_content', 
    511513               __('Zip file content')). 
  • inc/admin/lib.dc.page.php

    r1462 r1468  
    4949 
    5050     # Top of admin page 
    51      public static function open($title='', $head='') 
     51     public static function open($title='',$head='',$breadcrumb='') 
    5252     { 
    5353          global $core; 
     
    7373               } 
    7474               $blog_box = 
    75                '<p><label for="switchblog" class="classic">'. 
    76                __('Blogs:').' '. 
     75               '<p><label for="switchblog" class="classic nomobile">'. 
     76               __('Blogs:').'</label> '. 
    7777               $core->formNonce(). 
    7878               form::combo('switchblog',$blogs,$core->blog->id). 
    79                '</label></p>'. 
     79               '</p>'. 
    8080               '<noscript><p><input type="submit" value="'.__('ok').'" /></p></noscript>'; 
    8181          } 
     
    9393          "<head>\n". 
    9494          '  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n". 
    95           '  <title>'.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.'</title>'."\n". 
    96  
    9795          '  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n". 
    9896          '  <meta name="GOOGLEBOT" content="NOSNIPPET" />'."\n". 
     97          '  <meta name="viewport" content="width=device-width, initial-scale=1.0" />'."\n". 
     98          '  <title>'.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.'</title>'."\n". 
     99 
    99100 
    100101          self::jsLoadIE7(). 
     
    133134          '<form action="index.php" method="post">'. 
    134135          $blog_box. 
    135           '<p><a href="'.$core->blog->url.'" onclick="window.open(this.href);return false;" title="'.__('Go to site').' ('.__('new window').')'.'">'.__('Go to site').' <img src="images/outgoing.png" alt="" /></a>'. 
     136          '<p class="nomobile"><a href="'.$core->blog->url.'" onclick="window.open(this.href);return false;" title="'.__('Go to site').' ('.__('new window').')'.'">'.__('Go to site').' <img src="images/outgoing.png" alt="" /></a>'. 
    136137          '</p></form>'. 
    137138          '</div>'. 
    138139          '<div id="info-box2">'. 
    139           '<a'.(preg_match('/index.php$/',$_SERVER['REQUEST_URI']) ? ' class="active"' : '').' href="index.php">'.__('My dashboard').'</a>'. 
    140           '<span> | </span><a'.(preg_match('/preferences.php(\?.*)?$/',$_SERVER['REQUEST_URI']) ? ' class="active"' : '').' href="preferences.php">'.__('My preferences').'</a>'. 
    141           '<span> | </span><a href="index.php?logout=1" class="logout">'.sprintf(__('Logout %s'),$core->auth->userID()).' <img src="images/logout.png" alt="" /></a>'. 
     140          '<a class="smallscreen'.(preg_match('/index.php$/',$_SERVER['REQUEST_URI']) ? ' active' : '').'" href="index.php">'.__('My dashboard').'</a>'. 
     141          '<span class="smallscreen"> | </span><a class="smallscreen'.(preg_match('/preferences.php(\?.*)?$/',$_SERVER['REQUEST_URI']) ? ' active' : '').'" href="preferences.php">'.__('My preferences').'</a>'. 
     142          '<span class="smallscreen"> | </span><a href="index.php?logout=1" class="logout">'.sprintf(__('Logout %s'),$core->auth->userID()).' <img src="images/logout.png" alt="" /></a>'. 
    142143          '</div>'. 
    143144          '</div>'. 
     
    158159          } 
    159160 
     161          // Display breadcrumb (if given) before any error message 
     162          echo $breadcrumb; 
     163 
    160164          if ($core->error->flag()) { 
    161165               echo 
     
    176180          "</div>\n".         // End of #main 
    177181 
    178           '<div id="main-menu">'."\n"; 
     182          '<div id="main-menu">'."\n". 
     183 
     184          '<form id="search-menu" action="search.php" method="get">'. 
     185          '<p><label for="q" class="hidden">'.__('Search:').' </label>'.form::field('q',30,255,''). 
     186          '<input type="submit" value="'.__('OK').'" /></p>'. 
     187          '</form>'; 
    179188 
    180189          foreach ($menu as $k => $v) { 
     
    193202          echo 
    194203          '</div>'."\n".      // End of #main-menu 
    195           '<div id="footer"><a href="http://dotclear.org/" title="'.$text.'"><img src="style/dc_logo_footer.png" alt="'.$text.'" /></a></div>'."\n". 
     204          '<div id="footer"><a href="http://dotclear.org/" title="'.$text.'"><img src="style/dc_logos/w-dotclear90.png" alt="'.$text.'" /></a></div>'."\n". 
    196205          "</div>\n";         // End of #wrapper 
    197206 
     
    204213     } 
    205214 
    206      public static function openPopup($title='', $head='') 
     215     public static function openPopup($title='',$head='',$breadcrumb='') 
    207216     { 
    208217          global $core; 
     
    216225          'xml:lang="'.$core->auth->getInfo('user_lang').'" '. 
    217226          'lang="'.$core->auth->getInfo('user_lang').'">'."\n". 
     227          '<meta name="viewport" content="width=device-width, initial-scale=1.0" />'."\n". 
    218228          "<head>\n". 
    219229          '  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n". 
     
    241251          '<body id="dotclear-admin" class="popup">'."\n". 
    242252 
    243           '<div id="top"><h1>'.DC_VENDOR_NAME.'</h1></div>'."\n"; 
     253          '<div id="top hidden"><h1>'.DC_VENDOR_NAME.'</h1></div>'."\n"; 
    244254 
    245255          echo 
     
    247257          '<div id="main">'."\n". 
    248258          '<div id="content">'."\n"; 
     259 
     260          // display breadcrumb if given 
     261          echo $breadcrumb; 
    249262 
    250263          if ($core->error->flag()) { 
     
    264277          "</div>\n".         // End of #wrapper 
    265278          '</body></html>'; 
     279     } 
     280 
     281     public static function breadcrumb($elements=null,$with_home_link=true,$echo=false) 
     282     { 
     283          // First item of array elements should be blog's name, System or Plugins 
     284          $res = '<h2>'.($with_home_link ? 
     285               '<a class="go_home" href="index.php"><img src="style/dashboard.png" alt="'.__('Go to dashboard').'" /></a>' : 
     286               '<img src="style/dashboard-alt.png" alt="" />'); 
     287          $index = 0; 
     288          foreach ($elements as $element => $url) { 
     289               $res .= ($with_home_link ? ($index == 1 ? ' : ' : ' &rsaquo; ') : ($index == 0 ? ' ' : ' &rsaquo; ')). 
     290                    ($url ? '<a href="'.$url.'">' : '').$element.($url ? '</a>' : ''); 
     291               $index++; 
     292          } 
     293          $res .= '</h2>'; 
     294          if ($echo) { 
     295               echo $res; 
     296          } 
     297          return $res; 
    266298     } 
    267299 
     
    333365     { 
    334366          $args = func_get_args(); 
     367 
     368          $args = new ArrayObject($args); 
     369 
     370          # --BEHAVIOR-- adminPageHelpBlock 
     371          $GLOBALS['core']->callBehavior('adminPageHelpBlock',$args); 
     372 
    335373          if (empty($args)) { 
    336374               return; 
     
    411449 
    412450          self::jsVar('dotclear.msg.help', 
    413                __('help')). 
     451               __('Help about this page')). 
     452          self::jsVar('dotclear.msg.help_hide', 
     453               __('Hide')). 
    414454          self::jsVar('dotclear.msg.no_selection', 
    415455               __('no selection')). 
     
    436476          self::jsVar('dotclear.msg.confirm_delete_post', 
    437477               __("Are you sure you want to delete this entry?")). 
     478          self::jsVar('dotclear.msg.click_to_unlock', 
     479               __("Click here to unlock the field")). 
    438480          self::jsVar('dotclear.msg.confirm_spam_delete', 
    439481               __('Are you sure you want to delete all spams?')). 
     
    478520          self::jsVar('dotclear.msg.confirm_change_post_format', 
    479521               __('You have unsaved changes. Switch post format will loose these changes. Proceed anyway?')). 
    480           self::jsVar('dotclear.msg.confirm_change_post_format_noconvert', 
    481                __("Warning: post format change will not convert existing content. You will need to apply new format by yourself. Proceed anyway?")). 
    482522          self::jsVar('dotclear.msg.load_enhanced_uploader', 
    483523               __('Loading enhanced uploader, please wait.')). 
     
    489529     { 
    490530          return 
    491           '<!--[if lt IE 8]>'."\n". 
    492           self::jsLoad('js/ie7/IE8.js'). 
     531          '<!--[if lt IE 9]>'."\n". 
     532          self::jsLoad('js/ie7/IE9.js'). 
    493533          '<link rel="stylesheet" type="text/css" href="style/iesucks.css" />'."\n". 
    494534          '<![endif]-->'."\n"; 
     
    692732     '<link rel="stylesheet" type="text/css" href="style/jsUpload/style.css" />'."\n". 
    693733 
    694      '<script id="template-upload" type="text/x-tmpl"> 
    695      {% for (var i=0, file; file=o.files[i]; i++) { %} 
    696      <div class="template-upload fade"> 
    697      <div class="upload-file"> 
    698      <div class="upload-fileinfo"> 
    699           <span class="upload-filename">{%=file.name%}</span> 
    700           <span class="upload-filesize">({%=o.formatFileSize(file.size)%})</span> 
    701           <span class="upload-filecancel cancel">'.__('Cancel').'</span> 
    702           {% if (!o.files.error && !i && !o.options.autoUpload) { %} 
    703           <input type="submit" class="button start"  value="'.__('Send').'"/> 
    704           {% } %} 
    705           <span class="upload-filemsg"></span> 
    706      </div> 
    707      {% if (!o.files.error) { %} 
    708      <div class="upload-progress progress progress-success progress-striped active"><div class="bar" style="width:0%;"></div></div> 
    709      {% } %} 
    710      </div> 
    711      {% } %} 
    712      </script> 
    713      <!-- The template to display files available for download --> 
    714      <script id="template-download" type="text/x-tmpl"> 
    715      {% for (var i=0, file; file=o.files[i]; i++) { %} 
    716      <div class="template-download fade"> 
    717      <div class="upload-file"> 
    718      <div class="upload-fileinfo"> 
    719           <span class="upload-filename">{%=file.name%}</span> 
    720           <span class="upload-filesize">({%=o.formatFileSize(file.size)%})</span> 
    721           <span class="upload-filemsg{% if (file.error) { %} upload-error{% } %}"> 
    722           {% if (file.error) { %} 
    723           '.__('Error:').' {%=file.error%} 
    724           {% } else { %} 
    725           '.__('File successfully uploaded.').' 
    726           {% } %} 
    727           </span> 
    728      </div> 
    729      <div class="upload-progress"> 
    730           {% if (!file.error) { %} 
    731           <div class="bar" style="width:100%;">100%</div> 
    732           {% } %} 
    733      </div> 
    734      </div> 
    735      {% } %} 
    736      </script>'. 
    737  
    738      self::jsLoad('js/jsUpload/vendor/jquery.ui.widget.js'). 
    739      self::jsLoad('js/jsUpload/tmpl.js'). 
    740      self::jsLoad('js/jsUpload/load-image.js'). 
    741      self::jsLoad('js/jsUpload/jquery.iframe-transport.js'). 
    742      self::jsLoad('js/jsUpload/jquery.fileupload.js'). 
    743      self::jsLoad('js/jsUpload/jquery.fileupload-process.js'). 
    744      self::jsLoad('js/jsUpload/jquery.fileupload-resize.js'). 
    745      self::jsLoad('js/jsUpload/jquery.fileupload-ui.js'). 
    746  
    747734     '<script type="text/javascript">'."\n". 
    748735     "//<![CDATA[\n". 
     
    761748     self::jsVar('dotclear.jsUpload.msg.clean',__('Clean')). 
    762749     self::jsVar('dotclear.jsUpload.msg.upload',__('Upload')). 
     750     self::jsVar('dotclear.jsUpload.msg.send',__('Send')). 
     751     self::jsVar('dotclear.jsUpload.msg.file_successfully_uploaded',__('File successfully uploaded.')). 
    763752     self::jsVar('dotclear.jsUpload.msg.no_file_in_queue',__('No file in queue.')). 
    764753     self::jsVar('dotclear.jsUpload.msg.file_in_queue',__('1 file in queue.')). 
     
    767756     self::jsVar('dotclear.jsUpload.base_url',$base_url). 
    768757     "\n//]]>\n". 
    769      "</script>\n"; 
     758     "</script>\n". 
     759 
     760     self::jsLoad('js/jsUpload/vendor/jquery.ui.widget.js'). 
     761     self::jsLoad('js/jsUpload/tmpl.js'). 
     762     self::jsLoad('js/jsUpload/template-upload.js'). 
     763     self::jsLoad('js/jsUpload/template-download.js'). 
     764     self::jsLoad('js/jsUpload/load-image.js'). 
     765     self::jsLoad('js/jsUpload/jquery.iframe-transport.js'). 
     766     self::jsLoad('js/jsUpload/jquery.fileupload.js'). 
     767     self::jsLoad('js/jsUpload/jquery.fileupload-process.js'). 
     768     self::jsLoad('js/jsUpload/jquery.fileupload-resize.js'). 
     769     self::jsLoad('js/jsUpload/jquery.fileupload-ui.js'); 
    770770} 
    771771 
  • inc/admin/lib.pager.php

    r1415 r1468  
    8787               html::escapeHTML($this->rs->cat_title)); 
    8888          } else { 
    89                $cat_title = __('None'); 
     89               $cat_title = __('(No cat)'); 
    9090          } 
    9191           
  • inc/admin/lib.pager.php

    r1364 r1468  
    5858               } 
    5959                
    60                echo '<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>'; 
     60               echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>'; 
    6161                
    6262               $blocks = explode('%s',$html_block); 
     
    7171               echo $blocks[1]; 
    7272                
    73                echo '<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>'; 
     73               echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>'; 
    7474          } 
    7575     } 
     
    9393          switch ($this->rs->post_status) { 
    9494               case 1: 
    95                     $img_status = sprintf($img,__('published'),'check-on.png'); 
     95                    $img_status = sprintf($img,__('Published'),'check-on.png'); 
    9696                    break; 
    9797               case 0: 
    98                     $img_status = sprintf($img,__('unpublished'),'check-off.png'); 
     98                    $img_status = sprintf($img,__('Unpublished'),'check-off.png'); 
    9999                    break; 
    100100               case -1: 
    101                     $img_status = sprintf($img,__('scheduled'),'scheduled.png'); 
     101                    $img_status = sprintf($img,__('Scheduled'),'scheduled.png'); 
    102102                    break; 
    103103               case -2: 
    104                     $img_status = sprintf($img,__('pending'),'check-wrn.png'); 
     104                    $img_status = sprintf($img,__('Pending'),'check-wrn.png'); 
    105105                    break; 
    106106          } 
     
    108108          $protected = ''; 
    109109          if ($this->rs->post_password) { 
    110                $protected = sprintf($img,__('protected'),'locker.png'); 
     110               $protected = sprintf($img,__('Protected'),'locker.png'); 
    111111          } 
    112112           
    113113          $selected = ''; 
    114114          if ($this->rs->post_selected) { 
    115                $selected = sprintf($img,__('selected'),'selected.png'); 
     115               $selected = sprintf($img,__('Selected'),'selected.png'); 
    116116          } 
    117117           
     
    170170               } 
    171171                
    172                echo '<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>'; 
     172               echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>'; 
    173173                
    174174               $blocks = explode('%s',$html_block); 
     
    183183               echo $blocks[1]; 
    184184                
    185                echo '<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>'; 
     185               echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>'; 
    186186          } 
    187187     } 
     
    192192          switch ($this->rs->post_status) { 
    193193               case 1: 
    194                     $img_status = sprintf($img,__('published'),'check-on.png'); 
     194                    $img_status = sprintf($img,__('Published'),'check-on.png'); 
    195195                    break; 
    196196               case 0: 
    197                     $img_status = sprintf($img,__('unpublished'),'check-off.png'); 
     197                    $img_status = sprintf($img,__('Unpublished'),'check-off.png'); 
    198198                    break; 
    199199               case -1: 
    200                     $img_status = sprintf($img,__('scheduled'),'scheduled.png'); 
     200                    $img_status = sprintf($img,__('Scheduled'),'scheduled.png'); 
    201201                    break; 
    202202               case -2: 
    203                     $img_status = sprintf($img,__('pending'),'check-wrn.png'); 
     203                    $img_status = sprintf($img,__('Pending'),'check-wrn.png'); 
    204204                    break; 
    205205          } 
     
    207207          $protected = ''; 
    208208          if ($this->rs->post_password) { 
    209                $protected = sprintf($img,__('protected'),'locker.png'); 
     209               $protected = sprintf($img,__('Protected'),'locker.png'); 
    210210          } 
    211211           
    212212          $selected = ''; 
    213213          if ($this->rs->post_selected) { 
    214                $selected = sprintf($img,__('selected'),'selected.png'); 
     214               $selected = sprintf($img,__('Selected'),'selected.png'); 
    215215          } 
    216216           
     
    267267               } 
    268268                
    269                echo '<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>'; 
     269               echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>'; 
    270270                
    271271               $blocks = explode('%s',$html_block); 
     
    280280               echo $blocks[1]; 
    281281                
    282                echo '<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>'; 
     282               echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>'; 
    283283          } 
    284284     } 
     
    306306          switch ($this->rs->comment_status) { 
    307307               case 1: 
    308                     $img_status = sprintf($img,__('published'),'check-on.png'); 
     308                    $img_status = sprintf($img,__('Published'),'check-on.png'); 
    309309                    break; 
    310310               case 0: 
    311                     $img_status = sprintf($img,__('unpublished'),'check-off.png'); 
     311                    $img_status = sprintf($img,__('Unpublished'),'check-off.png'); 
    312312                    break; 
    313313               case -1: 
    314                     $img_status = sprintf($img,__('pending'),'check-wrn.png'); 
     314                    $img_status = sprintf($img,__('Pending'),'check-wrn.png'); 
    315315                    break; 
    316316               case -2: 
    317                     $img_status = sprintf($img,__('junk'),'junk.png'); 
     317                    $img_status = sprintf($img,__('Junk'),'junk.png'); 
    318318                    break; 
    319319          } 
     
    374374               } 
    375375                
    376                echo '<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>'; 
     376               echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>'; 
    377377                
    378378               $blocks = explode('%s',$html_block); 
     
    387387               echo $blocks[1]; 
    388388                
    389                echo '<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>'; 
     389               echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>'; 
    390390          } 
    391391     } 
  • inc/core/class.dc.blog.php

    r1353 r1468  
    634634     private function checkCategory($title,$url,$id=null) 
    635635     { 
    636           $strReq = 'SELECT cat_id '. 
    637                     'FROM '.$this->prefix.'category '. 
    638                     "WHERE cat_url = '".$this->con->escape($url)."' ". 
    639                     "AND blog_id = '".$this->con->escape($this->id)."' "; 
    640            
    641           if ($id !== null) { 
    642                $strReq .= 'AND cat_id <> '.(integer) $id.' '; 
    643           } 
     636          # Let's check if URL is taken... 
     637          $strReq =  
     638               'SELECT cat_url FROM '.$this->prefix.'category '. 
     639               "WHERE cat_url = '".$this->con->escape($url)."' ". 
     640               ($id ? 'AND cat_id <> '.(integer) $id. ' ' : ''). 
     641               "AND blog_id = '".$this->con->escape($this->id)."' ". 
     642               'ORDER BY cat_url DESC'; 
    644643           
    645644          $rs = $this->con->select($strReq); 
    646645           
    647           if (!$rs->isEmpty()) { 
    648                throw new Exception(__('Category URL must be unique.')); 
    649           } 
     646          if (!$rs->isEmpty()) 
     647          { 
     648               if ($this->con->driver() == 'mysql') { 
     649                    $clause = "REGEXP '^".$this->con->escape($url)."[0-9]+$'"; 
     650               } elseif ($this->con->driver() == 'pgsql') { 
     651                    $clause = "~ '^".$this->con->escape($url)."[0-9]+$'"; 
     652               } else { 
     653                    $clause = "LIKE '".$this->con->escape($url)."%'"; 
     654               } 
     655               $strReq =  
     656                    'SELECT cat_url FROM '.$this->prefix.'category '. 
     657                    "WHERE cat_url ".$clause.' '. 
     658                    ($id ? 'AND cat_id <> '.(integer) $id. ' ' : ''). 
     659                    "AND blog_id = '".$this->con->escape($this->id)."' ". 
     660                    'ORDER BY cat_url DESC '; 
     661                
     662               $rs = $this->con->select($strReq); 
     663               $a = array(); 
     664               while ($rs->fetch()) { 
     665                    $a[] = $rs->cat_url; 
     666               } 
     667                
     668               natsort($a); 
     669               $t_url = end($a); 
     670                
     671               if (preg_match('/(.*?)([0-9]+)$/',$t_url,$m)) { 
     672                    $i = (integer) $m[2]; 
     673                    $url = $m[1]; 
     674               } else { 
     675                    $i = 1; 
     676               } 
     677                
     678               return $url.($i+1); 
     679          } 
     680           
     681          # URL is empty? 
     682          if ($url == '') { 
     683               throw new Exception(__('Empty category URL')); 
     684          } 
     685           
     686          return $url; 
    650687     } 
    651688      
     
    669706           
    670707          # Check if title or url are unique 
    671           $this->checkCategory($cur->cat_title,$cur->cat_url,$id); 
     708          $cur->cat_url = $this->checkCategory($cur->cat_title,$cur->cat_url,$id); 
    672709           
    673710          if ($cur->cat_desc !== null) { 
  • inc/core/class.dc.blog.php

    r1429 r1468  
    8181               $this->desc = $b->blog_desc; 
    8282               $this->url = $b->blog_url; 
    83                $this->host = preg_replace('|^([a-z]{3,}://)(.*?)/.*$|','$1$2',$this->url); 
     83               $this->host = http::getHostFromURL($this->url); 
    8484               $this->creadt = strtotime($b->blog_creadt); 
    8585               $this->upddt = strtotime($b->blog_upddt); 
     
    9191               $this->public_path = path::fullFromRoot($this->settings->system->public_path,DC_ROOT); 
    9292                
    93                $this->post_status['-2'] = __('pending'); 
    94                $this->post_status['-1'] = __('scheduled'); 
    95                $this->post_status['0'] = __('unpublished'); 
    96                $this->post_status['1'] = __('published'); 
    97                 
    98                $this->comment_status['-2'] = __('junk'); 
    99                $this->comment_status['-1'] = __('pending'); 
    100                $this->comment_status['0'] = __('unpublished'); 
    101                $this->comment_status['1'] = __('published'); 
     93               $this->post_status['-2'] = __('Pending'); 
     94               $this->post_status['-1'] = __('Scheduled'); 
     95               $this->post_status['0'] = __('Unpublished'); 
     96               $this->post_status['1'] = __('Published'); 
     97                
     98               $this->comment_status['-2'] = __('Junk'); 
     99               $this->comment_status['-1'] = __('Pending'); 
     100               $this->comment_status['0'] = __('Unpublished'); 
     101               $this->comment_status['1'] = __('Published'); 
    102102                
    103103               # --BEHAVIOR-- coreBlogConstruct 
     
    203203     @param    ids       <b>mixed</b>        Comment(s) ID(s) 
    204204     @param    del       <b>boolean</b>      If comment is delete, set this to true 
    205      @param    affected_posts      <b>mixed</b>        Posts(s) ID(s) 
    206      */ 
    207      public function triggerComments($ids, $del=false, $affected_posts=null) 
     205     */ 
     206     public function triggerComments($ids,$del=false) 
    208207     { 
    209208          $co_ids = dcUtils::cleanIds($ids); 
    210           $a_ids = dcUtils::cleanIds($affected_posts); 
    211           $a_tbs = array(); 
    212209           
    213210          # a) Retrieve posts affected by comments edition 
    214           if (empty($a_ids)) { 
    215                $strReq =  
    216                     'SELECT post_id, comment_trackback '. 
    217                     'FROM '.$this->prefix.'comment '. 
    218                     'WHERE comment_id'.$this->con->in($co_ids). 
    219                     'GROUP BY post_id,comment_trackback'; 
    220                 
    221                $rs = $this->con->select($strReq); 
    222                 
    223                while ($rs->fetch()) { 
    224                     $a_ids[] = (integer) $rs->post_id; 
    225                     $a_tbs[] = (integer) $rs->comment_trackback; 
    226                } 
     211          $strReq =  
     212               'SELECT post_id, comment_trackback '. 
     213               'FROM '.$this->prefix.'comment '. 
     214               'WHERE comment_id'.$this->con->in($co_ids). 
     215               'GROUP BY post_id,comment_trackback'; 
     216           
     217          $rs = $this->con->select($strReq); 
     218           
     219          $a_ids = $a_tbs = array(); 
     220          while ($rs->fetch()) { 
     221               $a_ids[] = (integer) $rs->post_id; 
     222               $a_tbs[] = (integer) $rs->comment_trackback; 
    227223          } 
    228224           
     
    259255          { 
    260256               $nb_comment = $nb_trackback = 0; 
    261                //$cur->nb_comment = $nb_comment; 
    262257               foreach($b_ids as $b_key => $b_id) 
    263258               { 
     
    510505          $this->core->callBehavior('coreBeforeCategoryCreate',$this,$cur); 
    511506           
    512           $id = $this->categories()->addNode($cur,$parent); 
    513           # Update category's cursor 
    514           $rs = $this->getCategory($id); 
    515           if (!$rs->isEmpty()) { 
    516                $cur->cat_lft = $rs->cat_lft; 
    517                $cur->cat_rgt = $rs->cat_rgt; 
    518           } 
     507          $this->categories()->addNode($cur,$parent); 
    519508           
    520509          # --BEHAVIOR-- coreAfterCategoryCreate 
     
    22292218          $co_ids = dcUtils::cleanIds($ids); 
    22302219           
    2231           if (empty($co_ids)) { 
     2220          if (empty($ids)) { 
    22322221               throw new Exception(__('No such comment ID')); 
    2233           } 
    2234            
    2235           # Retrieve posts affected by comments edition 
    2236           $affected_posts = array(); 
    2237           $strReq = 
    2238                'SELECT distinct(post_id) '. 
    2239                'FROM '.$this->prefix.'comment '. 
    2240                'WHERE comment_id'.$this->con->in($co_ids); 
    2241            
    2242           $rs = $this->con->select($strReq); 
    2243            
    2244           while ($rs->fetch()) { 
    2245                $affected_posts[] = (integer) $rs->post_id; 
    22462222          } 
    22472223           
     
    22732249           
    22742250          $this->con->execute($strReq); 
    2275           $this->triggerComments($co_ids, true, $affected_posts); 
     2251          $this->triggerComments($co_ids,true); 
    22762252          $this->triggerBlog(); 
    22772253     } 
     
    23282304           
    23292305          if ($cur->comment_site !== null && $cur->comment_site != '') { 
    2330                if (!preg_match('|^http(s?)://|i',$cur->comment_site, $matches)) { 
     2306               if (!preg_match('|^http(s?)://|',$cur->comment_site)) { 
    23312307                    $cur->comment_site = 'http://'.$cur->comment_site; 
    2332                }else{ 
    2333                     $cur->comment_site = strtolower($matches[0]).substr($cur->comment_site, strlen($matches[0])); 
    23342308               } 
    23352309          } 
  • inc/core/class.dc.media.php

    r1280 r1468  
    3030      
    3131     public $thumb_tp = '%s/.%s_%s.jpg';     ///< <b>string</b> Thumbnail file pattern 
     32     public $thumb_tp_alpha = '%s/.%s_%s.png'; ///< <b>string</b> Thumbnail file pattern (with alpha layer) 
    3233      
    3334     /** 
     
    298299               $f->media_thumb = array(); 
    299300               $p = path::info($f->relname); 
    300                $thumb = sprintf($this->thumb_tp,$this->root.'/'.$p['dirname'],$p['base'],'%s'); 
    301                $thumb_url = sprintf($this->thumb_tp,$this->root_url.$p['dirname'],$p['base'],'%s'); 
     301               $alpha = ($p['extension'] == 'png') || ($p['extension'] == 'PNG'); 
     302               $thumb = sprintf(($alpha ? $this->thumb_tp_alpha : $this->thumb_tp),$this->root.'/'.$p['dirname'],$p['base'],'%s'); 
     303               $thumb_url = sprintf(($alpha ? $this->thumb_tp_alpha : $this->thumb_tp),$this->root_url.$p['dirname'],$p['base'],'%s'); 
    302304                
    303305               # Cleaner URLs 
     
    920922           
    921923          $p = path::info($file); 
    922           $thumb = sprintf($this->thumb_tp,$p['dirname'],$p['base'],'%s'); 
     924          $alpha = ($p['extension'] == 'png') || ($p['extension'] == 'PNG'); 
     925          $thumb = sprintf(($alpha ? $this->thumb_tp_alpha : $this->thumb_tp),$p['dirname'],$p['base'],'%s'); 
    923926           
    924927          try 
     
    939942                         $rate = ($s[0] < 100 ? 95 : ($s[0] < 600 ? 90 : 85)); 
    940943                         $img->resize($s[0],$s[0],$s[1]); 
    941                          $img->output('jpeg',$thumb_file,$rate); 
     944                         $img->output(($alpha ? 'png' : 'jpeg'),$thumb_file,$rate); 
    942945                         $img->loadImage($file); 
    943946                    } 
     
    958961          { 
    959962               $p = path::info($file->relname); 
    960                $thumb_old = sprintf($this->thumb_tp,$p['dirname'],$p['base'],'%s'); 
     963               $alpha = ($p['extension'] == 'png') || ($p['extension'] == 'PNG'); 
     964               $thumb_old = sprintf(($alpha ? $this->thumb_tp_alpha : $this->thumb_tp),$p['dirname'],$p['base'],'%s'); 
    961965                
    962966               $p = path::info($newFile->relname); 
    963                $thumb_new = sprintf($this->thumb_tp,$p['dirname'],$p['base'],'%s'); 
     967               $alpha = ($p['extension'] == 'png') || ($p['extension'] == 'PNG'); 
     968               $thumb_new = sprintf(($alpha ? $this->thumb_tp_alpha : $this->thumb_tp),$p['dirname'],$p['base'],'%s'); 
    964969                
    965970               foreach ($this->thumb_sizes as $suffix => $s) { 
     
    974979     { 
    975980          $p = path::info($f); 
    976           $thumb = sprintf($this->thumb_tp,'',$p['base'],'%s'); 
     981          $alpha = ($p['extension'] == 'png') || ($p['extension'] == 'PNG'); 
     982          $thumb = sprintf(($alpha ? $this->thumb_tp_alpha : $this->thumb_tp),'',$p['base'],'%s'); 
    977983           
    978984          foreach ($this->thumb_sizes as $suffix => $s) { 
  • inc/core/class.dc.media.php

    r1381 r1468  
    499499     @param    post_id   <b>integer</b>      Post ID 
    500500     @param    media_id  <b>integer</b>      Optionnal media ID 
    501      @param    return_rs <b>boolean</b>      Whether to return a resultset (true) or an array (false, default value). 
    502      @return   <b>array</b> Array or ResultSet of fileItems 
    503      */ 
    504      public function getPostMedia($post_id,$media_id=null,$return_rs=false) 
     501     @return   <b>array</b> Array of fileItems 
     502     */ 
     503     public function getPostMedia($post_id,$media_id=null) 
    505504     { 
    506505          $params = array( 
     
    518517               $f = $this->fileRecord($rs); 
    519518               if ($f !== null) { 
    520                     $res[] = $return_rs ? new ArrayObject($f) : $f; 
    521                } 
    522           } 
    523            
    524           return $return_rs ? staticRecord::newFromArray($res) : $res; 
     519                    $res[] = $f; 
     520               } 
     521          } 
     522           
     523          return $res; 
    525524     } 
    526525      
  • inc/prepend.php

    r1352 r1468  
    123123# Constants 
    124124define('DC_ROOT',path::real(dirname(__FILE__).'/..')); 
    125 define('DC_VERSION','2.5.3-dev'); 
     125define('DC_VERSION','2.6-dev'); 
    126126define('DC_DIGESTS',dirname(__FILE__).'/digests'); 
    127127define('DC_L10N_ROOT',dirname(__FILE__).'/../locales'); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map