Dotclear


Ignore:
Files:
43 edited

Legend:

Unmodified
Added
Removed
  • admin/blog_pref.php

    r1615 r1620  
    111111# Image default size combo 
    112112$img_default_size_combo = array(); 
    113 $media = new dcMedia($core); 
    114 $img_default_size_combo[__('original')] = 'o'; 
    115 foreach ($media->thumb_sizes as $code => $size) { 
    116      $img_default_size_combo[__($size[2])] = $code; 
     113try { 
     114     $media = new dcMedia($core); 
     115     $img_default_size_combo[__('original')] = 'o'; 
     116     foreach ($media->thumb_sizes as $code => $size) { 
     117          $img_default_size_combo[__($size[2])] = $code; 
     118     } 
     119} catch (Exception $e) { 
     120     $core->error->add($e->getMessage()); 
    117121} 
    118122 
  • admin/index.php

    r1558 r1620  
    247247} 
    248248 
     249$err = array(); 
     250 
     251# Check cache directory 
     252if (!is_dir(DC_TPL_CACHE)) { 
     253     $err[] = '<p>'.sprintf(__('Cache directory %s does not exist.'),DC_TPL_CACHE).'</p>'; 
     254} else if (!is_writable(DC_TPL_CACHE)) { 
     255     $err[] = '<p>'.sprintf(__('Cache directory %s is not writable.'),DC_TPL_CACHE).'</p>'; 
     256} 
     257 
     258# Check public directory 
     259if (!is_dir($core->blog->public_path)) { 
     260     $err[] = '<p>'.sprintf(__('Directory %s does not exist.'),$core->blog->public_path).'</p>'; 
     261} else if (!is_writable($core->blog->public_path)) { 
     262     $err[] = '<p>'.sprintf(__('Directory %s is not writable.'),$core->blog->public_path).'</p>'; 
     263} 
     264 
     265# Error list 
     266if (count($err) > 0) { 
     267     echo '<div class="error"><p><strong>Erreur&nbsp;:</strong></p>'. 
     268     '<ul><li>'.implode("</li><li>",$err).'</li></ul></div>'; 
     269} 
     270 
    249271# Plugins install messages 
    250272if (!empty($plugins_install['success'])) 
     
    267289# Dashboard columns (processed first, as we need to know the result before displaying the icons.) 
    268290$dashboardItems = ''; 
     291 
     292# Dotclear updates notifications 
     293if ($core->auth->isSuperAdmin() && is_readable(DC_DIGESTS)) 
     294{ 
     295     $updater = new dcUpdate(DC_UPDATE_URL,'dotclear',DC_UPDATE_VERSION,DC_TPL_CACHE.'/versions'); 
     296     $new_v = $updater->check(DC_VERSION); 
     297     $version_info = $new_v ? $updater->getInfoURL() : ''; 
     298      
     299     if ($updater->getNotify() && $new_v) { 
     300          $dashboardItems .= 
     301          '<div id="upg-notify" class="static-msg"><p>'.sprintf(__('Dotclear %s is available!'),$new_v).'</p> '. 
     302          '<ul><li><strong><a href="update.php">'.sprintf(__('Upgrade now'),$new_v).'</a></strong>'. 
     303          '</li><li><a href="update.php?hide_msg=1">'.__('Remind me later').'</a>'. 
     304          ($version_info ? ' </li><li>'.sprintf(__('<a href=\"%s\">Information about this version</a>.'),$version_info) : ''). 
     305          '</li></ul></div>'; 
     306     } 
     307} 
    269308 
    270309# Errors modules notifications 
  • admin/install/index.php

    r1553 r1620  
    267267 
    268268  <script type="text/javascript" src="../js/jquery/jquery.js"></script> 
     269  <?php echo dcPage::jsLoad('../js/jquery/jquery.pwstrength.js'); ?> 
    269270  <script type="text/javascript"> 
    270271  //<![CDATA[ 
     
    278279      $(this).val(this.value.replace(login_re,'')); 
    279280    }); 
     281     
     282     <?php echo "\$('#u_pwd').pwstrength({texts: ['". 
     283                    sprintf(__('Password strength: %s'),__('very weak'))."', '". 
     284                    sprintf(__('Password strength: %s'),__('weak'))."', '". 
     285                    sprintf(__('Password strength: %s'),__('mediocre'))."', '". 
     286                    sprintf(__('Password strength: %s'),__('strong'))."', '". 
     287                    sprintf(__('Password strength: %s'),__('very strong'))."']});\n"; ?> 
    280288     
    281289    $('#u_login').parent().after($('<input type="hidden" name="u_date" value="' + Date().toLocaleString() + '" />')); 
     
    329337      
    330338     '<fieldset><legend>'.__('Username and password').'</legend>'. 
    331      '<p><label for="u_login" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Username:').'</label> '. 
    332      form::field('u_login',30,32,html::escapeHTML($u_login)).'</p>'. 
    333      '<p><label for="u_pwd" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Password:').'</label> '. 
    334      form::password('u_pwd',30,255).'</p>'. 
    335      '<p><label for="u_pwd2" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Confirm password:').'</label> '. 
    336      form::password('u_pwd2',30,255).'</p>'. 
     339     '<p><label for="u_login" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Username:').' '. 
     340     form::field('u_login',30,32,html::escapeHTML($u_login)).'</label></p>'. 
     341     '<div class="pw-table">'. 
     342          '<p class="pw-cell">'. 
     343               '<label for="u_pwd" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('New password:').'</label>'. 
     344               form::password('u_pwd',30,255,'','','',false,' data-indicator="pwindicator" '). 
     345          '</p>'. 
     346          '<div id="pwindicator">'. 
     347          '    <div class="bar"></div>'. 
     348          '    <p class="label no-margin"></p>'. 
     349          '</div>'. 
     350     '</div>'. 
     351     '<p><label for="u_pwd2" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Confirm password:').' '. 
     352     form::password('u_pwd2',30,255).'</label></p>'. 
    337353     '</fieldset>'. 
    338354      
  • admin/post.php

    r1619 r1620  
    147147          try { 
    148148               $core->media = new dcMedia($core); 
    149           } catch (Exception $e) {} 
     149          } catch (Exception $e) { 
     150               $core->error->add($e->getMessage()); 
     151          } 
    150152     } 
    151153} 
  • admin/post_media.php

    r1179 r1537  
    2626} 
    2727 
    28 if ($post_id && $media_id && !empty($_POST['attach'])) 
    29 { 
    30      $core->media = new dcMedia($core); 
    31      $core->media->addPostMedia($post_id,$media_id); 
    32      http::redirect($core->getPostAdminURL($rs->post_type,$post_id,false)); 
    33 } 
     28try { 
     29     if ($post_id && $media_id && !empty($_POST['attach'])) 
     30     { 
     31          $core->media = new dcMedia($core); 
     32          $core->media->addPostMedia($post_id,$media_id); 
     33          http::redirect($core->getPostAdminURL($rs->post_type,$post_id,false)); 
     34     } 
    3435 
    35 try { 
    3636     $core->media = new dcMedia($core); 
    3737     $f = $core->media->getPostMedia($post_id,$media_id); 
  • admin/services.php

    r1500 r1538  
    238238          } 
    239239           
    240           $core->media = new dcMedia($core); 
    241           $file = $core->media->getFile($id); 
     240          try { 
     241               $core->media = new dcMedia($core); 
     242               $file = $core->media->getFile($id); 
     243          } catch (Exception $e) {} 
    242244           
    243245          if ($file === null || $file->type != 'application/zip' || !$file->editable) { 
  • admin/style/install.css

    r1330 r1620  
    158158     border: 1px solid #2C8FD1; 
    159159} 
     160 
     161 
     162/* --------------------------------------------------------------- password indcator */ 
     163.pw-table { 
     164     display: table; 
     165     margin-bottom: 1em; 
     166} 
     167.pw-cell { 
     168     display: table-cell; 
     169     margin-bottom: 1em; 
     170} 
     171#pwindicator { 
     172     display: table-cell; 
     173     vertical-align: bottom; 
     174     padding-left: 1.5em; 
     175     height: 3.8em; 
     176} 
     177#pwindicator .bar { 
     178     height: 6px; 
     179     margin-bottom: 4px; 
     180} 
     181.pw-very-weak .bar { 
     182     background: #900; 
     183     width: 30px; 
     184} 
     185.pw-weak .bar { 
     186     background: #c00; 
     187     width: 60px; 
     188} 
     189.pw-mediocre .bar { 
     190     background: #f60; 
     191     width: 90px; 
     192} 
     193.pw-strong .bar { 
     194     background: #060; 
     195     width: 120px; 
     196} 
     197.pw-very-strong .bar { 
     198     background: #0c0; 
     199     width: 150px; 
     200} 
  • admin/update.php

    r1553 r1620  
    249249     '<p class="message">'. 
    250250     __("Congratulations, you're one click away from the end of the update."). 
    251      ' <strong><a href="index.php?logout=1">'.__('Finish the update').'</a>.</strong>'. 
     251     ' <strong><a href="index.php?logout=1">'.__('Finish the update.').'</a></strong>'. 
    252252     '</p>'; 
    253253} 
  • admin/user.php

    r1609 r1620  
    172172dcPage::open($page_title, 
    173173     dcPage::jsConfirmClose('user-form'). 
     174     dcPage::jsLoad('js/jquery/jquery.pwstrength.js'). 
     175          '<script type="text/javascript">'."\n". 
     176          "//<![CDATA[\n". 
     177          "\$(function() {\n". 
     178          "    \$('#new_pwd').pwstrength({texts: ['". 
     179                    sprintf(__('Password strength: %s'),__('very weak'))."', '". 
     180                    sprintf(__('Password strength: %s'),__('weak'))."', '". 
     181                    sprintf(__('Password strength: %s'),__('mediocre'))."', '". 
     182                    sprintf(__('Password strength: %s'),__('strong'))."', '". 
     183                    sprintf(__('Password strength: %s'),__('very strong'))."']});\n". 
     184          "});\n". 
     185          "\n//]]>\n". 
     186          "</script>\n". 
    174187      
    175188     # --BEHAVIOR-- adminUserHeaders 
     
    211224 
    212225echo 
    213 '<p><label for="new_pwd" '.($user_id != '' ? '' : 'class="required"').'>'. 
    214 ($user_id != '' ? '' : '<abbr title="'.__('Required field').'">*</abbr> '). 
    215 ($user_id != '' ? __('New password:') : __('Password:')).'</label> '. 
    216 form::password('new_pwd',20,255). 
    217 '</p>'. 
     226'<form action="user.php" method="post" id="user-form">'. 
     227'<fieldset><legend>'.__('User information').'</legend>'. 
     228'<div class="two-cols">'. 
     229'<div class="col">'. 
     230'<p><label for="user_id" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Username:').' '. 
     231form::field('user_id',20,255,html::escapeHTML($user_id)). 
     232'</label></p>'. 
     233'<p class="form-note">'.__('At least 2 characters using letters, numbers or symbols.').'</p>'. 
     234 
     235'<div class="pw-table">'. 
     236     '<p class="pw-cell">'. 
     237          '<label for="new_pwd" '.($user_id != '' ? '' : 'class="required"').'>'. 
     238          ($user_id != '' ? '' : '<abbr title="'.__('Required field').'">*</abbr> '). 
     239          ($user_id != '' ? __('New password:') : __('Password:')).'</label>'. 
     240          form::password('new_pwd',20,255,'','','',false,' data-indicator="pwindicator" '). 
     241     '</p>'. 
     242     '<div id="pwindicator">'. 
     243     '    <div class="bar"></div>'. 
     244    '    <p class="label no-margin"></p>'. 
     245    '</div>'. 
     246'</div>'. 
    218247'<p class="form-note">'.__('Password must contain at least 6 characters.').'</p>'. 
    219248 
  • inc/admin/prepend.php

    r1604 r1620  
    322322          $core->auth->check('usage,contentadmin',$core->blog->id),'menu-new-post'); 
    323323      
    324      $_menu['System']->prependItem(__('Updates'),'update.php','images/menu/update.png', 
     324     $_menu['System']->prependItem(__('Update'),'update.php','images/menu/update.png', 
    325325          preg_match('/update.php(\?.*)?$/',$_SERVER['REQUEST_URI']), 
    326326          $core->auth->isSuperAdmin() && is_readable(DC_DIGESTS)); 
  • inc/config.php.in

    r1179 r1535  
    5050 
    5151// Template cache directory 
    52 define('DC_TPL_CACHE',dirname(__FILE__).'/../cache'); 
     52define('DC_TPL_CACHE',path::real(dirname(__FILE__).'/..').'/cache'); 
    5353 
    5454 
  • inc/core/class.dc.blog.php

    r1610 r1620  
    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      */ 
    206      public function triggerComments($ids,$del=false) 
    207      { 
    208           $co_ids = dcUtils::cleanIds($ids); 
    209            
    210           # a) Retrieve posts affected by comments edition 
     205     @param    affected_posts      <b>mixed</b>        Posts(s) ID(s) 
     206     */ 
     207     public function triggerComments($ids, $del=false, $affected_posts=null) 
     208     { 
     209          $comments_ids = dcUtils::cleanIds($ids); 
     210           
     211          # Get posts affected by comments edition 
     212          if (empty($affected_posts)) { 
     213               $strReq =  
     214                    'SELECT post_id '. 
     215                    'FROM '.$this->prefix.'comment '. 
     216                    'WHERE comment_id'.$this->con->in($comments_ids). 
     217                    'GROUP BY post_id'; 
     218                
     219               $rs = $this->con->select($strReq); 
     220                
     221               $affected_posts = array(); 
     222               while ($rs->fetch()) { 
     223                    $affected_posts[] = (integer) $rs->post_id; 
     224               } 
     225          } 
     226           
     227          if (!is_array($affected_posts) || empty($affected_posts)) { 
     228               return; 
     229          } 
     230           
     231          # Count number of comments if exists for affected posts 
    211232          $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; 
    223           } 
    224            
    225           # b) Count comments of each posts previously retrieved 
    226           # Note that this does not return posts without comment 
    227           $strReq =  
    228                'SELECT post_id, COUNT(post_id) AS nb_comment,comment_trackback '. 
     233               'SELECT post_id, COUNT(post_id) AS nb_comment, comment_trackback '. 
    229234               'FROM '.$this->prefix.'comment '. 
    230235               'WHERE comment_status = 1 '. 
    231                (count($a_ids) > 0 ? 'AND post_id'.$this->con->in($a_ids) : ' '); 
    232            
    233           if ($del) { 
    234                $strReq .=  
    235                     'AND comment_id NOT'.$this->con->in($co_ids); 
    236           } 
    237            
    238           $strReq .=  
     236               'AND post_id'.$this->con->in($affected_posts). 
    239237               'GROUP BY post_id,comment_trackback'; 
    240238           
    241239          $rs = $this->con->select($strReq); 
    242240           
    243           $b_ids = $b_tbs = $b_nbs = array(); 
     241          $posts = array(); 
    244242          while ($rs->fetch()) { 
    245                $b_ids[] = (integer) $rs->post_id; 
    246                $b_tbs[] = (integer) $rs->comment_trackback; 
    247                $b_nbs[] = (integer) $rs->nb_comment; 
    248           } 
    249            
    250           # c) Update comments numbers on posts 
    251           # This compare previous requests to update also posts without comment 
     243               if ($rs->comment_trackback) { 
     244                    $posts[$rs->post_id]['trackback'] = $rs->nb_comment; 
     245               } else { 
     246                    $posts[$rs->post_id]['comment'] = $rs->nb_comment; 
     247               } 
     248          } 
     249           
     250          # Update number of comments on affected posts 
    252251          $cur = $this->con->openCursor($this->prefix.'post'); 
    253            
    254           foreach($a_ids as $a_key => $a_id) 
    255           { 
    256                $nb_comment = $nb_trackback = 0; 
    257                foreach($b_ids as $b_key => $b_id) 
    258                { 
    259                     if ($a_id != $b_id || $a_tbs[$a_key] != $b_tbs[$b_key]) { 
    260                          continue; 
    261                     } 
    262                      
    263                     if ($b_tbs[$b_key]) { 
    264                          $nb_trackback = $b_nbs[$b_key]; 
    265                     } else { 
    266                          $nb_comment = $b_nbs[$b_key]; 
    267                     } 
    268                } 
    269                 
    270                if ($a_tbs[$a_key]) { 
    271                     $cur->nb_trackback = $nb_trackback; 
     252          foreach($affected_posts as $post_id) 
     253          { 
     254               $cur->clean(); 
     255                
     256               if (!array_key_exists($post_id,$posts)) { 
     257                    $cur->nb_trackback = 0; 
     258                    $cur->nb_comment = 0; 
    272259               } else { 
    273                     $cur->nb_comment = $nb_comment; 
    274                } 
    275                $cur->update('WHERE post_id = '.$a_id); 
     260                    $cur->nb_trackback = empty($posts[$post_id]['trackback']) ? 0 : $posts[$post_id]['trackback']; 
     261                    $cur->nb_comment = empty($posts[$post_id]['comment']) ? 0 : $posts[$post_id]['comment']; 
     262               } 
     263                
     264               $cur->update('WHERE post_id = '.$post_id); 
    276265          } 
    277266     } 
     
    509498          $this->core->callBehavior('coreBeforeCategoryCreate',$this,$cur); 
    510499           
    511           $this->categories()->addNode($cur,$parent); 
     500          $id = $this->categories()->addNode($cur,$parent); 
     501          # Update category's cursor 
     502          $rs = $this->getCategory($id); 
     503          if (!$rs->isEmpty()) { 
     504               $cur->cat_lft = $rs->cat_lft; 
     505               $cur->cat_rgt = $rs->cat_rgt; 
     506          } 
    512507           
    513508          # --BEHAVIOR-- coreAfterCategoryCreate 
     
    739734     - no_content: Don't retrieve entry content (excerpt and content) 
    740735     - post_type: Get only entries with given type (default "post", array for many types and '' for no type) 
    741      - post_id: (integer) Get entry with given post_id 
     736     - post_id: (integer or array) Get entry with given post_id 
    742737     - post_url: Get entry with given post_url field 
    743738     - user_id: (integer) Get entries belonging to given user ID 
     
    759754     - limit: Limit parameter 
    760755     - sql_only : return the sql request instead of results. Only ids are selected 
     756     - exclude_post_id : (integer or array) Exclude entries with given post_id 
    761757      
    762758     Please note that on every cat_id or cat_url, you can add ?not to exclude 
     
    852848               } 
    853849               $strReq .= 'AND P.post_id '.$this->con->in($params['post_id']); 
     850          } 
     851           
     852          if (isset($params['exclude_post_id']) && $params['exclude_post_id'] !== '') { 
     853               if (is_array($params['exclude_post_id'])) { 
     854                    array_walk($params['exclude_post_id'],create_function('&$v,$k','if($v!==null){$v=(integer)$v;}')); 
     855               } else { 
     856                    $params['exclude_post_id'] = array((integer) $params['exclude_post_id']); 
     857               } 
     858               $strReq .= 'AND P.post_id NOT '.$this->con->in($params['exclude_post_id']); 
    854859          } 
    855860           
     
    22352240          $co_ids = dcUtils::cleanIds($ids); 
    22362241           
    2237           if (empty($ids)) { 
     2242          if (empty($co_ids)) { 
    22382243               throw new Exception(__('No such comment ID')); 
     2244          } 
     2245           
     2246          # Retrieve posts affected by comments edition 
     2247          $affected_posts = array(); 
     2248          $strReq = 
     2249               'SELECT post_id '. 
     2250               'FROM '.$this->prefix.'comment '. 
     2251               'WHERE comment_id'.$this->con->in($co_ids). 
     2252               'GROUP BY post_id'; 
     2253           
     2254          $rs = $this->con->select($strReq); 
     2255           
     2256          while ($rs->fetch()) { 
     2257               $affected_posts[] = (integer) $rs->post_id; 
    22392258          } 
    22402259           
     
    22662285           
    22672286          $this->con->execute($strReq); 
    2268           $this->triggerComments($co_ids,true); 
     2287          $this->triggerComments($co_ids, true, $affected_posts); 
    22692288          $this->triggerBlog(); 
    22702289     } 
     
    23212340           
    23222341          if ($cur->comment_site !== null && $cur->comment_site != '') { 
    2323                if (!preg_match('|^http(s?)://|',$cur->comment_site)) { 
     2342               if (!preg_match('|^http(s?)://|i',$cur->comment_site, $matches)) { 
    23242343                    $cur->comment_site = 'http://'.$cur->comment_site; 
     2344               }else{ 
     2345                    $cur->comment_site = strtolower($matches[0]).substr($cur->comment_site, strlen($matches[0])); 
    23252346               } 
    23262347          } 
  • inc/core/class.dc.core.php

    r1179 r1593  
    928928           
    929929          if (!empty($params['q'])) { 
    930                $params['q'] = str_replace('*','%',$params['q']); 
     930               $params['q'] = strtolower(str_replace('*','%',$params['q'])); 
    931931               $where .= 
    932932               'AND ('. 
  • inc/public/lib.tpl.context.php

    r1179 r1537  
    416416          global $core, $_ctx; 
    417417           
    418           $media = new dcMedia($core); 
    419           $sizes = implode('|',array_keys($media->thumb_sizes)).'|o'; 
    420           if (!preg_match('/^'.$sizes.'$/',$size)) { 
    421                $size = 's'; 
    422           } 
    423           $p_url = $core->blog->settings->system->public_url; 
    424           $p_site = preg_replace('#^(.+?//.+?)/(.*)$#','$1',$core->blog->url); 
    425           $p_root = $core->blog->public_path; 
    426            
    427           $pattern = '(?:'.preg_quote($p_site,'/').')?'.preg_quote($p_url,'/'); 
    428           $pattern = sprintf('/<img.+?src="%s(.*?\.(?:jpg|jpeg|gif|png))"[^>]+/msui',$pattern); 
    429            
    430           $src = ''; 
    431           $alt = ''; 
    432            
    433           # We first look in post content 
    434           if (!$cat_only && $_ctx->posts) 
    435           { 
    436                $subject = ($content_only ? '' : $_ctx->posts->post_excerpt_xhtml).$_ctx->posts->post_content_xhtml; 
    437                if (preg_match_all($pattern,$subject,$m) > 0) 
     418          try { 
     419               $media = new dcMedia($core); 
     420               $sizes = implode('|',array_keys($media->thumb_sizes)).'|o'; 
     421               if (!preg_match('/^'.$sizes.'$/',$size)) { 
     422                    $size = 's'; 
     423               } 
     424               $p_url = $core->blog->settings->system->public_url; 
     425               $p_site = preg_replace('#^(.+?//.+?)/(.*)$#','$1',$core->blog->url); 
     426               $p_root = $core->blog->public_path; 
     427                
     428               $pattern = '(?:'.preg_quote($p_site,'/').')?'.preg_quote($p_url,'/'); 
     429               $pattern = sprintf('/<img.+?src="%s(.*?\.(?:jpg|jpeg|gif|png))"[^>]+/msui',$pattern); 
     430                
     431               $src = ''; 
     432               $alt = ''; 
     433                
     434               # We first look in post content 
     435               if (!$cat_only && $_ctx->posts) 
    438436               { 
    439                     foreach ($m[1] as $i => $img) { 
    440                          if (($src = self::ContentFirstImageLookup($p_root,$img,$size)) !== false) { 
    441                               $dirname = str_replace('\\', '/', dirname($img));  
    442                               $src = $p_url.($dirname != '/' ? $dirname : '').'/'.$src; 
    443                               if (preg_match('/alt="([^"]+)"/',$m[0][$i],$malt)) { 
    444                                    $alt = $malt[1]; 
     437                    $subject = ($content_only ? '' : $_ctx->posts->post_excerpt_xhtml).$_ctx->posts->post_content_xhtml; 
     438                    if (preg_match_all($pattern,$subject,$m) > 0) 
     439                    { 
     440                         foreach ($m[1] as $i => $img) { 
     441                              if (($src = self::ContentFirstImageLookup($p_root,$img,$size)) !== false) { 
     442                                   $dirname = str_replace('\\', '/', dirname($img));  
     443                                   $src = $p_url.($dirname != '/' ? $dirname : '').'/'.$src; 
     444                                   if (preg_match('/alt="([^"]+)"/',$m[0][$i],$malt)) { 
     445                                        $alt = $malt[1]; 
     446                                   } 
     447                                   break; 
    445448                              } 
    446                               break; 
    447449                         } 
    448450                    } 
    449451               } 
    450           } 
    451            
    452           # No src, look in category description if available 
    453         if (!$src && $with_category && $_ctx->posts->cat_desc) 
    454         { 
    455                if (preg_match_all($pattern,$_ctx->posts->cat_desc,$m) > 0) 
    456                { 
    457                     foreach ($m[1] as $i => $img) { 
    458                          if (($src = self::ContentFirstImageLookup($p_root,$img,$size)) !== false) { 
    459                               $dirname = str_replace('\\', '/', dirname($img));  
    460                               $src = $p_url.($dirname != '/' ? $dirname : '').'/'.$src; 
    461                               if (preg_match('/alt="([^"]+)"/',$m[0][$i],$malt)) { 
    462                                    $alt = $malt[1]; 
     452                
     453               # No src, look in category description if available 
     454             if (!$src && $with_category && $_ctx->posts->cat_desc) 
     455             { 
     456                    if (preg_match_all($pattern,$_ctx->posts->cat_desc,$m) > 0) 
     457                    { 
     458                         foreach ($m[1] as $i => $img) { 
     459                              if (($src = self::ContentFirstImageLookup($p_root,$img,$size)) !== false) { 
     460                                   $dirname = str_replace('\\', '/', dirname($img));  
     461                                   $src = $p_url.($dirname != '/' ? $dirname : '').'/'.$src; 
     462                                   if (preg_match('/alt="([^"]+)"/',$m[0][$i],$malt)) { 
     463                                        $alt = $malt[1]; 
     464                                   } 
     465                                   break; 
    463466                              } 
    464                               break; 
    465467                         } 
    466                     } 
    467                }; 
    468           } 
    469            
    470           if ($src) { 
    471                if ($no_tag) { 
    472                     return $src; 
    473                } else { 
    474                     return '<img alt="'.$alt.'" src="'.$src.'" class="'.$class.'" />'; 
    475                } 
     468                    }; 
     469               } 
     470                
     471               if ($src) { 
     472                    if ($no_tag) { 
     473                         return $src; 
     474                    } else { 
     475                         return '<img alt="'.$alt.'" src="'.$src.'" class="'.$class.'" />'; 
     476                    } 
     477               } 
     478                
     479          } catch (Exception $e) { 
     480               $core->error->add($e->getMessage()); 
    476481          } 
    477482     } 
     
    485490          $base = $info['base']; 
    486491           
    487           $media = new dcMedia($core); 
    488           $sizes = implode('|',array_keys($media->thumb_sizes)); 
    489           if (preg_match('/^\.(.+)_('.$sizes.')$/',$base,$m)) { 
    490                $base = $m[1]; 
    491           } 
    492            
    493           $res = false; 
    494           if ($size != 'o' && file_exists($root.'/'.$info['dirname'].'/.'.$base.'_'.$size.'.jpg')) 
    495           { 
    496                $res = '.'.$base.'_'.$size.'.jpg'; 
    497           } 
    498           else 
    499           { 
    500                $f = $root.'/'.$info['dirname'].'/'.$base; 
    501                if (file_exists($f.'.'.$info['extension'])) { 
    502                     $res = $base.'.'.$info['extension']; 
    503                } elseif (file_exists($f.'.jpg')) { 
    504                     $res = $base.'.jpg'; 
    505                } elseif (file_exists($f.'.jpeg')) { 
    506                     $res = $base.'.jpeg'; 
    507                } elseif (file_exists($f.'.png')) { 
    508                     $res = $base.'.png'; 
    509                } elseif (file_exists($f.'.gif')) { 
    510                     $res = $base.'.gif'; 
    511                } elseif (file_exists($f.'.JPG')) { 
    512                     $res = $base.'.JPG'; 
    513                } elseif (file_exists($f.'.JPEG')) { 
    514                     $res = $base.'.JPEG'; 
    515                } elseif (file_exists($f.'.PNG')) { 
    516                     $res = $base.'.PNG'; 
    517                } elseif (file_exists($f.'.GIF')) { 
    518                     $res = $base.'.GIF'; 
    519                } 
     492          try { 
     493               $media = new dcMedia($core); 
     494               $sizes = implode('|',array_keys($media->thumb_sizes)); 
     495               if (preg_match('/^\.(.+)_('.$sizes.')$/',$base,$m)) { 
     496                    $base = $m[1]; 
     497               } 
     498                
     499               $res = false; 
     500               if ($size != 'o' && file_exists($root.'/'.$info['dirname'].'/.'.$base.'_'.$size.'.jpg')) 
     501               { 
     502                    $res = '.'.$base.'_'.$size.'.jpg'; 
     503               } 
     504               else 
     505               { 
     506                    $f = $root.'/'.$info['dirname'].'/'.$base; 
     507                    if (file_exists($f.'.'.$info['extension'])) { 
     508                         $res = $base.'.'.$info['extension']; 
     509                    } elseif (file_exists($f.'.jpg')) { 
     510                         $res = $base.'.jpg'; 
     511                    } elseif (file_exists($f.'.jpeg')) { 
     512                         $res = $base.'.jpeg'; 
     513                    } elseif (file_exists($f.'.png')) { 
     514                         $res = $base.'.png'; 
     515                    } elseif (file_exists($f.'.gif')) { 
     516                         $res = $base.'.gif'; 
     517                    } elseif (file_exists($f.'.JPG')) { 
     518                         $res = $base.'.JPG'; 
     519                    } elseif (file_exists($f.'.JPEG')) { 
     520                         $res = $base.'.JPEG'; 
     521                    } elseif (file_exists($f.'.PNG')) { 
     522                         $res = $base.'.PNG'; 
     523                    } elseif (file_exists($f.'.GIF')) { 
     524                         $res = $base.'.GIF'; 
     525                    } 
     526               } 
     527          } catch (Exception $e) { 
     528               $core->error->add($e->getMessage()); 
    520529          } 
    521530           
  • locales/bn/main.po

    r1615 r1620  
    836836msgstr "পড়ে মনে করিয়ে দিও" 
    837837 
    838 msgid "information about this version" 
     838msgid "<a href=\"%s\">Information about this version</a>." 
    839839msgstr "" 
    840840 
     
    23972397msgstr "ব্লগ" 
    23982398 
    2399 msgid "Updates" 
     2399msgid "Update" 
    24002400msgstr "" 
    24012401 
  • locales/ca/main.po

    r1615 r1620  
    867867msgstr "" 
    868868 
    869 msgid "information about this version" 
     869msgid "<a href=\"%s\">Information about this version</a>." 
    870870msgstr "" 
    871871 
     
    24782478msgstr "Blog" 
    24792479 
    2480 msgid "Updates" 
     2480msgid "Update" 
    24812481msgstr "" 
    24822482 
  • locales/cs/main.po

    r1615 r1620  
    844844msgstr "Připomenout později" 
    845845 
    846 msgid "information about this version" 
     846msgid "<a href=\"%s\">Information about this version</a>." 
    847847msgstr "" 
    848848 
     
    23992399msgstr "Blog" 
    24002400 
    2401 msgid "Updates" 
     2401msgid "Update" 
    24022402msgstr "Aktualizace" 
    24032403 
  • locales/da/main.po

    r1615 r1620  
    845845msgstr "Påmind mig senere" 
    846846 
    847 msgid "information about this version" 
     847msgid "<a href=\"%s\">Information about this version</a>." 
    848848msgstr "" 
    849849 
     
    24092409msgstr "" 
    24102410 
    2411 msgid "Updates" 
     2411msgid "Update" 
    24122412msgstr "" 
    24132413 
  • locales/de/main.po

    r1615 r1620  
    841841msgstr "Erinnere mich später" 
    842842 
    843 msgid "information about this version" 
     843msgid "<a href=\"%s\">Information about this version</a>." 
    844844msgstr "Informationen zu dieser Version" 
    845845 
     
    24002400msgstr "Blog" 
    24012401 
    2402 msgid "Updates" 
     2402msgid "Update" 
    24032403msgstr "Aktualisierungen" 
    24042404 
  • locales/en/main.po

    r1615 r1620  
    829829msgstr "" 
    830830 
    831 msgid "information about this version" 
     831#, php-format 
     832msgid "<a href=\"%s\">Information about this version</a>." 
    832833msgstr "" 
    833834 
     
    23582359msgstr "" 
    23592360 
    2360 msgid "Updates" 
     2361msgid "Update" 
    23612362msgstr "" 
    23622363 
  • locales/eo/main.po

    r1615 r1620  
    826826msgstr "" 
    827827 
    828 msgid "information about this version" 
     828msgid "<a href=\"%s\">Information about this version</a>." 
    829829msgstr "" 
    830830 
     
    23462346msgstr "" 
    23472347 
    2348 msgid "Updates" 
     2348msgid "Update" 
    23492349msgstr "" 
    23502350 
  • locales/es-ar/main.po

    r1615 r1620  
    847847msgstr "Recordar mas tarde" 
    848848 
    849 msgid "information about this version" 
     849msgid "<a href=\"%s\">Information about this version</a>." 
    850850msgstr "" 
    851851 
     
    24162416msgstr "Blog" 
    24172417 
    2418 msgid "Updates" 
     2418msgid "Update" 
    24192419msgstr "Actualizaciones" 
    24202420 
  • locales/es/main.po

    r1615 r1620  
    850850msgstr "Recordármelo más tarde" 
    851851 
    852 msgid "information about this version" 
     852msgid "<a href=\"%s\">Information about this version</a>." 
    853853msgstr "" 
    854854 
     
    24212421msgstr "Blog" 
    24222422 
    2423 msgid "Updates" 
     2423msgid "Update" 
    24242424msgstr "Actualizaciones" 
    24252425 
  • locales/eu/main.po

    r1615 r1620  
    826826msgstr "" 
    827827 
    828 msgid "information about this version" 
     828msgid "<a href=\"%s\">Information about this version</a>." 
    829829msgstr "" 
    830830 
     
    23462346msgstr "" 
    23472347 
    2348 msgid "Updates" 
     2348msgid "Update" 
    23492349msgstr "" 
    23502350 
  • locales/fr/main.po

    r1615 r1620  
    889889msgstr "Me le rappeler plus tard" 
    890890 
    891 msgid "information about this version" 
    892 msgstr "Information à propos de cette version" 
     891#, php-format 
     892msgid "<a href=\"%s\">Information about this version</a>." 
     893msgstr "<a href=\"%s\">Information à propos de cette version</a>." 
    893894 
    894895msgid "Some plugins are installed twice:" 
     
    25162517msgstr "Blog" 
    25172518 
    2518 msgid "Updates" 
    2519 msgstr "Mises à jour" 
     2519msgid "Update" 
     2520msgstr "Mise à jour" 
    25202521 
    25212522msgid "Languages" 
  • locales/hu/main.po

    r1615 r1620  
    867867msgstr "Értesíts később" 
    868868 
    869 msgid "information about this version" 
     869msgid "<a href=\"%s\">Information about this version</a>." 
    870870msgstr "" 
    871871 
     
    24572457msgstr "Blog" 
    24582458 
    2459 msgid "Updates" 
     2459msgid "Update" 
    24602460msgstr "Frissítések" 
    24612461 
  • locales/it/main.po

    r1615 r1620  
    843843msgstr "Ricorda in seguito" 
    844844 
    845 msgid "information about this version" 
     845msgid "<a href=\"%s\">Information about this version</a>." 
    846846msgstr "" 
    847847 
     
    23982398msgstr "Blog" 
    23992399 
    2400 msgid "Updates" 
     2400msgid "Update" 
    24012401msgstr "Aggiornamenti" 
    24022402 
  • locales/ja/main.po

    r1615 r1620  
    852852msgstr "後で再度知らせる" 
    853853 
    854 msgid "information about this version" 
     854msgid "<a href=\"%s\">Information about this version</a>." 
    855855msgstr "" 
    856856 
     
    24302430msgstr "ブログ" 
    24312431 
    2432 msgid "Updates" 
     2432msgid "Update" 
    24332433msgstr "アップデート" 
    24342434 
  • locales/ko/main.po

    r1615 r1620  
    851851msgstr "나중에 다시 알려줌" 
    852852 
    853 msgid "information about this version" 
     853msgid "<a href=\"%s\">Information about this version</a>." 
    854854msgstr "" 
    855855 
     
    24312431msgstr "블로그" 
    24322432 
    2433 msgid "Updates" 
     2433msgid "Update" 
    24342434msgstr "DotClear 갱신" 
    24352435 
  • locales/lt/main.po

    r1615 r1620  
    22052205msgstr "Blogas" 
    22062206 
    2207 msgid "Updates" 
     2207msgid "Update" 
    22082208msgstr "Atnaujinimai" 
    22092209 
  • locales/nl/main.po

    r1615 r1620  
    829829msgstr "" 
    830830 
    831 msgid "information about this version" 
     831msgid "<a href=\"%s\">Information about this version</a>." 
    832832msgstr "" 
    833833 
     
    23612361msgstr "" 
    23622362 
    2363 msgid "Updates" 
     2363msgid "Update" 
    23642364msgstr "" 
    23652365 
  • locales/oc/main.po

    r1615 r1620  
    835835msgstr "" 
    836836 
    837 msgid "information about this version" 
     837msgid "<a href=\"%s\">Information about this version</a>." 
    838838msgstr "" 
    839839 
     
    23792379msgstr "Blòg" 
    23802380 
    2381 msgid "Updates" 
     2381msgid "Update" 
    23822382msgstr "" 
    23832383 
  • locales/pl/main.po

    r1615 r1620  
    837837msgstr "Przypomnij mi później" 
    838838 
    839 msgid "information about this version" 
     839msgid "<a href=\"%s\">Information about this version</a>." 
    840840msgstr "informacje o tej wersji" 
    841841 
     
    23722372msgstr "Blog" 
    23732373 
    2374 msgid "Updates" 
     2374msgid "Update" 
    23752375msgstr "Uaktualnienia" 
    23762376 
  • locales/pt-br/main.po

    r1615 r1620  
    870870msgstr "" 
    871871 
    872 msgid "information about this version" 
     872msgid "<a href=\"%s\">Information about this version</a>." 
    873873msgstr "" 
    874874 
     
    24972497msgstr "Blog" 
    24982498 
    2499 msgid "Updates" 
     2499msgid "Update" 
    25002500msgstr "" 
    25012501 
  • locales/pt/main.po

    r1615 r1620  
    848848msgstr "Lembrar-me mais tarde" 
    849849 
    850 msgid "information about this version" 
     850msgid "<a href=\"%s\">Information about this version</a>." 
    851851msgstr "" 
    852852 
     
    24082408msgstr "Blog" 
    24092409 
    2410 msgid "Updates" 
     2410msgid "Update" 
    24112411msgstr "Actualizações" 
    24122412 
  • locales/ro/main.po

    r1615 r1620  
    828828msgstr "" 
    829829 
    830 msgid "information about this version" 
     830msgid "<a href=\"%s\">Information about this version</a>." 
    831831msgstr "" 
    832832 
     
    23572357msgstr "" 
    23582358 
    2359 msgid "Updates" 
     2359msgid "Update" 
    23602360msgstr "" 
    23612361 
  • locales/ru/main.po

    r1615 r1620  
    847847msgstr "Напомнить мне позже" 
    848848 
    849 msgid "information about this version" 
     849msgid "<a href=\"%s\">Information about this version</a>." 
    850850msgstr "" 
    851851 
     
    23992399msgstr "Блог" 
    24002400 
    2401 msgid "Updates" 
     2401msgid "Update" 
    24022402msgstr "Обновления" 
    24032403 
  • locales/sr/main.po

    r1615 r1620  
    858858msgstr "" 
    859859 
    860 msgid "information about this version" 
     860msgid "<a href=\"%s\">Information about this version</a>." 
    861861msgstr "" 
    862862 
     
    24442444msgstr "Blog" 
    24452445 
    2446 msgid "Updates" 
     2446msgid "Update" 
    24472447msgstr "" 
    24482448 
  • locales/sv/main.po

    r1615 r1620  
    826826msgstr "" 
    827827 
    828 msgid "information about this version" 
     828msgid "<a href=\"%s\">Information about this version</a>." 
    829829msgstr "" 
    830830 
     
    23462346msgstr "" 
    23472347 
    2348 msgid "Updates" 
     2348msgid "Update" 
    23492349msgstr "" 
    23502350 
  • locales/te/main.po

    r1615 r1620  
    854854msgstr "" 
    855855 
    856 msgid "information about this version" 
     856msgid "<a href=\"%s\">Information about this version</a>." 
    857857msgstr "" 
    858858 
     
    24262426msgstr "బ్లాగు" 
    24272427 
    2428 msgid "Updates" 
     2428msgid "Update" 
    24292429msgstr "" 
    24302430 
  • locales/tr/main.po

    r1615 r1620  
    840840msgstr "Gelecekte beni hatırla" 
    841841 
    842 msgid "information about this version" 
     842msgid "<a href=\"%s\">Information about this version</a>." 
    843843msgstr "" 
    844844 
     
    24042404msgstr "Blog" 
    24052405 
    2406 msgid "Updates" 
     2406msgid "Update" 
    24072407msgstr "Güncellemeler" 
    24082408 
  • locales/zh-cn/main.po

    r1615 r1620  
    845845msgstr "稍后提醒我" 
    846846 
    847 msgid "information about this version" 
     847msgid "<a href=\"%s\">Information about this version</a>." 
    848848msgstr "" 
    849849 
     
    24072407msgstr "博客" 
    24082408 
    2409 msgid "Updates" 
     2409msgid "Update" 
    24102410msgstr "更新" 
    24112411 
  • plugins/pages/page.php

    r1619 r1620  
    139139               $core->media = new dcMedia($core); 
    140140               $post_media = $core->media->getPostMedia($post_id); 
    141           } catch (Exception $e) {} 
     141          } catch (Exception $e) { 
     142               $core->error->add($e->getMessage()); 
     143          } 
    142144     } 
    143145} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map