Dotclear

Changeset 1155:49ba58cbf593


Ignore:
Timestamp:
04/09/13 09:15:41 (13 years ago)
Author:
Dsls <dsls@…>
Branch:
twig
Parents:
1154:e85c1417b8a4 (diff), 1143:fbf575ae9bda (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

Files:
2 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • admin/post.php

    r1139 r1155  
    1515dcPage::check('usage,contentadmin'); 
    1616 
    17 $post_id = ''; 
    18 $cat_id = ''; 
    19 $post_dt = ''; 
    20 $post_format = $core->auth->getOption('post_format'); 
    21 $post_password = ''; 
    22 $post_url = ''; 
    23 $post_lang = $core->auth->getInfo('user_lang'); 
    24 $post_title = ''; 
    25 $post_excerpt = ''; 
    26 $post_excerpt_xhtml = ''; 
    27 $post_content = ''; 
    28 $post_content_xhtml = ''; 
    29 $post_notes = ''; 
    30 $post_status = $core->auth->getInfo('user_post_status'); 
    31 $post_selected = false; 
    32 $post_open_comment = $core->blog->settings->system->allow_comments; 
    33 $post_open_tb = $core->blog->settings->system->allow_trackbacks; 
     17function savePost($form) { 
     18     global $_ctx; 
     19     $_ctx->setAlert('save'); 
     20 
     21} 
     22 
     23function deletePost($form) { 
     24     print_r($form); exit; 
     25} 
    3426 
    3527$page_title = __('New entry'); 
     
    4739# If user can't publish 
    4840if (!$can_publish) { 
    49      $post_status = -2; 
     41     $form->post_status = -2; 
    5042} 
    5143 
     
    5547     $categories = $core->blog->getCategories(array('post_type'=>'post')); 
    5648     while ($categories->fetch()) { 
    57           $categories_combo[] = new formSelectOption( 
    58                str_repeat('&nbsp;&nbsp;',$categories->level-1).($categories->level-1 == 0 ? '' : '&bull; ').html::escapeHTML($categories->cat_title), 
    59                $categories->cat_id 
    60           ); 
     49          $categories_combo[$categories->cat_id] =  
     50               str_repeat('&nbsp;&nbsp;',$categories->level-1). 
     51               ($categories->level-1 == 0 ? '' : '&bull; '). 
     52               html::escapeHTML($categories->cat_title); 
    6153     } 
    6254} catch (Exception $e) { } 
     
    6456# Status combo 
    6557foreach ($core->blog->getAllPostStatus() as $k => $v) { 
    66      $status_combo[$v] = (string) $k; 
     58     $status_combo[$k] = $v; 
    6759} 
    68 $img_status_pattern = '<img class="img_select_option" alt="%1$s" title="%1$s" src="images/%2$s" />'; 
    6960 
    7061# Formaters combo 
     
    8879unset($rs); 
    8980 
    90 # Validation flag 
    91 $bad_dt = false; 
    92  
     81$form = new dcForm($core,'post','post.php'); 
     82$form 
     83     ->addField( 
     84          new dcFieldText('post_title','', array( 
     85               'size'         => 20, 
     86               'required'     => true, 
     87               'label'        => __('Title')))) 
     88     ->addField( 
     89          new dcFieldTextArea('post_excerpt','', array( 
     90               'cols'         => 50, 
     91               'rows'         => 5, 
     92               'label'        => __("Excerpt:")))) 
     93     ->addField( 
     94          new dcFieldTextArea('post_content','', array( 
     95               'required'     => true, 
     96               'label'        => __("Content:")))) 
     97     ->addField( 
     98          new dcFieldTextArea('post_notes','', array( 
     99               'label'        => __("Notes")))) 
     100     ->addField( 
     101          new dcFieldSubmit('save',__('Save'),array( 
     102               'action' => 'savePost'))) 
     103     ->addField( 
     104          new dcFieldSubmit('delete',__('Delete'),array( 
     105               'action' => 'deletePost'))) 
     106     ->addField( 
     107          new dcFieldCombo('post_status',$core->auth->getInfo('user_post_status'),$status_combo,array( 
     108               'disabled' => !$can_publish, 
     109               'label' => __('Entry status:')))) 
     110     ->addField( 
     111          new dcFieldCombo('cat_id','',$categories_combo,array( 
     112               "label" => __('Category:')))) 
     113     ->addField( 
     114          new dcFieldText('post_dt','',array( 
     115               "label" => __('Published on:')))) 
     116     ->addField( 
     117          new dcFieldCombo('post_format',$core->auth->getOption('post_format'),$formaters_combo,array( 
     118               "label" => __('Text formating:')))) 
     119     ->addField( 
     120          new dcFieldCheckbox ('post_open_comment',$core->blog->settings->system->allow_comments,array( 
     121               "label" => __('Accept comments')))) 
     122     ->addField( 
     123          new dcFieldCheckbox ('post_open_tb',$core->blog->settings->system->allow_trackbacks,array( 
     124               "label" => __('Accept trackbacks')))) 
     125     ->addField( 
     126          new dcFieldCheckbox ('post_selected',false,array( 
     127               "label" => __('Selected entry')))) 
     128     ->addField( 
     129          new dcFieldCombo ('post_lang',$core->auth->getInfo('user_lang'),$lang_combo, array( 
     130               "label" => __('Entry lang:')))) 
     131     ->addField( 
     132          new dcFieldHidden ('id','')) 
     133; 
    93134# Get entry informations 
    94135if (!empty($_REQUEST['id'])) 
     
    105146     else 
    106147     { 
    107           $post_id = $post->post_id; 
    108           $cat_id = $post->cat_id; 
    109           $post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); 
    110           $post_format = $post->post_format; 
    111           $post_password = $post->post_password; 
    112           $post_url = $post->post_url; 
    113           $post_lang = $post->post_lang; 
    114           $post_title = $post->post_title; 
    115           $post_excerpt = $post->post_excerpt; 
    116           $post_excerpt_xhtml = $post->post_excerpt_xhtml; 
    117           $post_content = $post->post_content; 
    118           $post_content_xhtml = $post->post_content_xhtml; 
    119           $post_notes = $post->post_notes; 
    120           $post_status = $post->post_status; 
    121           $post_selected = (boolean) $post->post_selected; 
    122           $post_open_comment = (boolean) $post->post_open_comment; 
    123           $post_open_tb = (boolean) $post->post_open_tb; 
     148          $form->id = $post->post_id; 
     149          $form->cat_id = $post->cat_id; 
     150          $form->post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); 
     151          $form->post_format = $post->post_format; 
     152          $form->post_password = $post->post_password; 
     153          $form->post_url = $post->post_url; 
     154          $form->post_lang = $post->post_lang; 
     155          $form->post_title = $post->post_title; 
     156          $form->post_excerpt = $post->post_excerpt; 
     157          $form->post_excerpt_xhtml = $post->post_excerpt_xhtml; 
     158          $form->post_content = $post->post_content; 
     159          $form->post_content_xhtml = $post->post_content_xhtml; 
     160          $form->post_notes = $post->post_notes; 
     161          $form->post_status = $post->post_status; 
     162          $form->post_selected = (boolean) $post->post_selected; 
     163          $form->post_open_comment = (boolean) $post->post_open_comment; 
     164          $form->post_open_tb = (boolean) $post->post_open_tb; 
     165          $form->can_edit_post = $post->isEditable(); 
     166          $form->can_delete= $post->isDeletable(); 
    124167           
    125           $page_title = __('Edit entry'); 
    126            
    127           $can_edit_post = $post->isEditable(); 
    128           $can_delete= $post->isDeletable(); 
    129            
    130           $next_rs = $core->blog->getNextPost($post,1); 
    131           $prev_rs = $core->blog->getNextPost($post,-1); 
    132            
    133           if ($next_rs !== null) { 
    134                $next_link = sprintf($post_link,$next_rs->post_id, 
    135                     html::escapeHTML($next_rs->post_title),__('next entry').'&nbsp;&#187;'); 
    136                $next_headlink = sprintf($post_headlink,'next', 
    137                     html::escapeHTML($next_rs->post_title),$next_rs->post_id); 
    138           } 
    139            
    140           if ($prev_rs !== null) { 
    141                $prev_link = sprintf($post_link,$prev_rs->post_id, 
    142                     html::escapeHTML($prev_rs->post_title),'&#171;&nbsp;'.__('previous entry')); 
    143                $prev_headlink = sprintf($post_headlink,'previous', 
    144                     html::escapeHTML($prev_rs->post_title),$prev_rs->post_id); 
    145           } 
    146            
    147           try { 
    148                $core->media = new dcMedia($core); 
    149           } catch (Exception $e) {} 
    150168     } 
    151169} 
    152170 
    153 # Format excerpt and content 
    154 if (!empty($_POST) && $can_edit_post) 
    155 { 
    156      $post_format = $_POST['post_format']; 
    157      $post_excerpt = $_POST['post_excerpt']; 
    158      $post_content = $_POST['post_content']; 
    159       
    160      $post_title = $_POST['post_title']; 
    161       
    162      $cat_id = (integer) $_POST['cat_id']; 
    163       
    164      if (isset($_POST['post_status'])) { 
    165           $post_status = (integer) $_POST['post_status']; 
    166      } 
    167       
    168      if (empty($_POST['post_dt'])) { 
    169           $post_dt = ''; 
    170      } else { 
    171           try 
    172           { 
    173                $post_dt = strtotime($_POST['post_dt']); 
    174                if ($post_dt == false || $post_dt == -1) { 
    175                     $bad_dt = true; 
    176                     throw new Exception(__('Invalid publication date')); 
    177                } 
    178                $post_dt = date('Y-m-d H:i',$post_dt); 
    179           } 
    180           catch (Exception $e) 
    181           { 
    182                $core->error->add($e->getMessage()); 
    183           } 
    184      } 
    185       
    186      $post_open_comment = !empty($_POST['post_open_comment']); 
    187      $post_open_tb = !empty($_POST['post_open_tb']); 
    188      $post_selected = !empty($_POST['post_selected']); 
    189      $post_lang = $_POST['post_lang']; 
    190      $post_password = !empty($_POST['post_password']) ? $_POST['post_password'] : null; 
    191       
    192      $post_notes = $_POST['post_notes']; 
    193       
    194      if (isset($_POST['post_url'])) { 
    195           $post_url = $_POST['post_url']; 
    196      } 
    197       
    198      $core->blog->setPostContent( 
    199           $post_id,$post_format,$post_lang, 
    200           $post_excerpt,$post_excerpt_xhtml,$post_content,$post_content_xhtml 
    201      ); 
    202 } 
    203  
    204 # Delete post 
    205 if (!empty($_POST['delete']) && $can_delete) 
    206 { 
    207      try { 
    208           # --BEHAVIOR-- adminBeforePostDelete 
    209           $core->callBehavior('adminBeforePostDelete',$post_id); 
    210           $core->blog->delPost($post_id); 
    211           http::redirect('posts.php'); 
    212      } catch (Exception $e) { 
    213           $core->error->add($e->getMessage()); 
    214      } 
    215 } 
    216  
    217 # Create or update post 
    218 if (!empty($_POST) && !empty($_POST['save']) && $can_edit_post && !$bad_dt) 
    219 { 
    220      $cur = $core->con->openCursor($core->prefix.'post'); 
    221       
    222      $cur->post_title = $post_title; 
    223      $cur->cat_id = ($cat_id ? $cat_id : null); 
    224      $cur->post_dt = $post_dt ? date('Y-m-d H:i:00',strtotime($post_dt)) : ''; 
    225      $cur->post_format = $post_format; 
    226      $cur->post_password = $post_password; 
    227      $cur->post_lang = $post_lang; 
    228      $cur->post_title = $post_title; 
    229      $cur->post_excerpt = $post_excerpt; 
    230      $cur->post_excerpt_xhtml = $post_excerpt_xhtml; 
    231      $cur->post_content = $post_content; 
    232      $cur->post_content_xhtml = $post_content_xhtml; 
    233      $cur->post_notes = $post_notes; 
    234      $cur->post_status = $post_status; 
    235      $cur->post_selected = (integer) $post_selected; 
    236      $cur->post_open_comment = (integer) $post_open_comment; 
    237      $cur->post_open_tb = (integer) $post_open_tb; 
    238       
    239      if (isset($_POST['post_url'])) { 
    240           $cur->post_url = $post_url; 
    241      } 
    242       
    243      # Update post 
    244      if ($post_id) 
    245      { 
    246           try 
    247           { 
    248                # --BEHAVIOR-- adminBeforePostUpdate 
    249                $core->callBehavior('adminBeforePostUpdate',$cur,$post_id); 
    250                 
    251                $core->blog->updPost($post_id,$cur); 
    252                 
    253                # --BEHAVIOR-- adminAfterPostUpdate 
    254                $core->callBehavior('adminAfterPostUpdate',$cur,$post_id); 
    255                 
    256                http::redirect('post.php?id='.$post_id.'&upd=1'); 
    257           } 
    258           catch (Exception $e) 
    259           { 
    260                $core->error->add($e->getMessage()); 
    261           } 
    262      } 
    263      else 
    264      { 
    265           $cur->user_id = $core->auth->userID(); 
    266            
    267           try 
    268           { 
    269                # --BEHAVIOR-- adminBeforePostCreate 
    270                $core->callBehavior('adminBeforePostCreate',$cur); 
    271                 
    272                $return_id = $core->blog->addPost($cur); 
    273                 
    274                # --BEHAVIOR-- adminAfterPostCreate 
    275                $core->callBehavior('adminAfterPostCreate',$cur,$return_id); 
    276                 
    277                http::redirect('post.php?id='.$return_id.'&crea=1'); 
    278           } 
    279           catch (Exception $e) 
    280           { 
    281                $core->error->add($e->getMessage()); 
    282           } 
    283      } 
    284 } 
     171$form->setup(); 
    285172 
    286173/* DISPLAY 
     
    294181} 
    295182 
    296 dcPage::open($page_title.' - '.__('Entries'), 
    297      dcPage::jsDatePicker(). 
    298      dcPage::jsToolBar(). 
    299      dcPage::jsModal(). 
    300      dcPage::jsMetaEditor(). 
    301      dcPage::jsLoad('js/_post.js'). 
    302      dcPage::jsConfirmClose('entry-form','comment-form'). 
    303      # --BEHAVIOR-- adminPostHeaders 
    304      $core->callBehavior('adminPostHeaders'). 
    305      dcPage::jsPageTabs($default_tab). 
    306      $next_headlink."\n".$prev_headlink 
    307 ); 
     183$_ctx 
     184     ->fillPageTitle(__('Entries'),'posts.php') 
     185     ->fillPageTitle($page_title) 
     186     ->default_tab = $default_tab; 
    308187 
    309 if (!empty($_GET['upd'])) { 
    310      dcPage::message(__('Entry has been successfully updated.')); 
    311 } 
    312 elseif (!empty($_GET['crea'])) { 
    313      dcPage::message(__('Entry has been successfully created.')); 
    314 } 
    315 elseif (!empty($_GET['attached'])) { 
    316      dcPage::message(__('File has been successfully attached.')); 
    317 } 
    318 elseif (!empty($_GET['rmattach'])) { 
    319      dcPage::message(__('Attachment has been successfully removed.')); 
    320 } 
    321  
    322 if (!empty($_GET['creaco'])) { 
    323      dcPage::message(__('Comment has been successfully created.')); 
    324 } 
    325  
    326 # XHTML conversion 
    327 if (!empty($_GET['xconv'])) 
    328 { 
    329      $post_excerpt = $post_excerpt_xhtml; 
    330      $post_content = $post_content_xhtml; 
    331      $post_format = 'xhtml'; 
    332       
    333      dcPage::message(__('Don\'t forget to validate your XHTML conversion by saving your post.')); 
    334 } 
    335  
    336 echo '<h2>'.html::escapeHTML($core->blog->name).' &rsaquo; '.'<a href="posts.php">'.__('Entries').'</a> &rsaquo; <span class="page-title">'.$page_title; 
    337 if ($post_id) { 
    338      switch ($post_status) { 
    339           case 1: 
    340                $img_status = sprintf($img_status_pattern,__('published'),'check-on.png'); 
    341                break; 
    342           case 0: 
    343                $img_status = sprintf($img_status_pattern,__('unpublished'),'check-off.png'); 
    344                break; 
    345           case -1: 
    346                $img_status = sprintf($img_status_pattern,__('scheduled'),'scheduled.png'); 
    347                break; 
    348           case -2: 
    349                $img_status = sprintf($img_status_pattern,__('pending'),'check-wrn.png'); 
    350                break; 
    351           default: 
    352                $img_status = ''; 
    353      } 
    354      echo ' &ldquo;'.$post_title.'&rdquo;'.' '.$img_status; 
    355 } 
    356 echo '</span></h2>'; 
    357  
    358 if ($post_id && $post->post_status == 1) { 
    359      echo '<p><a href="'.$post->getURL().'" onclick="window.open(this.href);return false;" title="'.$post_title.' ('.__('new window').')'.'">'.__('Go to this entry on the site').' <img src="images/outgoing-blue.png" alt="" /></a></p>'; 
    360 } 
    361 if ($post_id) 
    362 { 
    363      echo '<p>'; 
    364      if ($prev_link) { echo $prev_link; } 
    365      if ($next_link && $prev_link) { echo ' - '; } 
    366      if ($next_link) { echo $next_link; } 
    367       
    368      # --BEHAVIOR-- adminPostNavLinks 
    369      $core->callBehavior('adminPostNavLinks',isset($post) ? $post : null); 
    370       
    371      echo '</p>'; 
    372 } 
    373  
    374 # Exit if we cannot view page 
    375 if (!$can_view_page) { 
    376      dcPage::helpBlock('core_post'); 
    377      dcPage::close(); 
    378      exit; 
    379 } 
    380  
    381 /* Post form if we can edit post 
    382 -------------------------------------------------------- */ 
    383 if ($can_edit_post) 
    384 { 
    385      echo '<div class="multi-part" title="'.__('Edit entry').'" id="edit-entry">'; 
    386      echo '<form action="post.php" method="post" id="entry-form">'; 
    387      echo '<div id="entry-wrapper">'; 
    388      echo '<div id="entry-content"><div class="constrained">'; 
    389       
    390      echo 
    391      '<p class="col"><label class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Title:'). 
    392      form::field('post_title',20,255,html::escapeHTML($post_title),'maximal'). 
    393      '</label></p>'. 
    394       
    395      '<p class="area" id="excerpt-area"><label for="post_excerpt">'.__('Excerpt:').'</label> '. 
    396      form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). 
    397      '</p>'. 
    398       
    399      '<p class="area"><label class="required" '. 
    400      'for="post_content"><abbr title="'.__('Required field').'">*</abbr> '.__('Content:').'</label> '. 
    401      form::textarea('post_content',50,$core->auth->getOption('edit_size'),html::escapeHTML($post_content)). 
    402      '</p>'. 
    403       
    404      '<p class="area" id="notes-area"><label for="post_notes">'.__('Notes:').'</label>'. 
    405      form::textarea('post_notes',50,5,html::escapeHTML($post_notes)). 
    406      '</p>'; 
    407       
    408      # --BEHAVIOR-- adminPostForm 
    409      $core->callBehavior('adminPostForm',isset($post) ? $post : null); 
    410       
    411      echo 
    412      '<p>'. 
    413      ($post_id ? form::hidden('id',$post_id) : ''). 
    414      '<input type="submit" value="'.__('Save').' (s)" '. 
    415      'accesskey="s" name="save" /> '; 
    416      if ($post_id) { 
    417           $preview_url = 
    418           $core->blog->url.$core->url->getURLFor('preview',$core->auth->userID().'/'. 
    419           http::browserUID(DC_MASTER_KEY.$core->auth->userID().$core->auth->getInfo('user_pwd')). 
    420           '/'.$post->post_url); 
    421           echo '<a id="post-preview" href="'.$preview_url.'" class="button" accesskey="p">'.__('Preview').' (p)'.'</a> '; 
    422      } 
    423      echo 
    424      ($can_delete ? '<input type="submit" class="delete" value="'.__('Delete').'" name="delete" />' : ''). 
    425      $core->formNonce(). 
    426      '</p>'; 
    427       
    428      echo '</div></div>';          // End #entry-content 
    429      echo '</div>';      // End #entry-wrapper 
    430  
    431      echo '<div id="entry-sidebar">'; 
    432       
    433      echo 
    434      '<p><label for="cat_id">'.__('Category:'). 
    435      form::combo('cat_id',$categories_combo,$cat_id,'maximal'). 
    436      '</label></p>'. 
    437       
    438      '<p><label for="post_status">'.__('Entry status:'). 
    439      form::combo('post_status',$status_combo,$post_status,'','',!$can_publish). 
    440      '</label></p>'. 
    441       
    442      '<p><label for="post_dt">'.__('Published on:'). 
    443      form::field('post_dt',16,16,$post_dt,($bad_dt ? 'invalid' : '')). 
    444      '</label></p>'. 
    445       
    446      '<p><label for="post_format">'.__('Text formating:'). 
    447      form::combo('post_format',$formaters_combo,$post_format). 
    448      '</label>'. 
    449      '</p>'. 
    450      '<p>'.($post_id && $post_format != 'xhtml' ? '<a id="convert-xhtml" class="button" href="post.php?id='.$post_id.'&amp;xconv=1">'.__('Convert to XHTML').'</a>' : '').'</p>'. 
    451       
    452      '<p><label for="post_open_comment" class="classic">'.form::checkbox('post_open_comment',1,$post_open_comment).' '. 
    453      __('Accept comments').'</label></p>'. 
    454      ($core->blog->settings->system->allow_comments ?  
    455           (isContributionAllowed($post_id,strtotime($post_dt),true) ?  
    456                '' : 
    457                '<p class="form-note warn">'.__('Warning: Comments are not more accepted for this entry.').'</p>') :  
    458           '<p class="form-note warn">'.__('Warning: Comments are not accepted on this blog.').'</p>'). 
    459  
    460      '<p><label for="post_open_tb" class="classic">'.form::checkbox('post_open_tb',1,$post_open_tb).' '. 
    461      __('Accept trackbacks').'</label></p>'. 
    462      ($core->blog->settings->system->allow_trackbacks ?  
    463           (isContributionAllowed($post_id,strtotime($post_dt),false) ?  
    464                '' : 
    465                '<p class="form-note warn">'.__('Warning: Trackbacks are not more accepted for this entry.').'</p>') :  
    466           '<p class="form-note warn">'.__('Warning: Trackbacks are not accepted on this blog.').'</p>'). 
    467  
    468      '<p><label for="post_selected" class="classic">'.form::checkbox('post_selected',1,$post_selected).' '. 
    469      __('Selected entry').'</label></p>'. 
    470       
    471      '<p><label for="post_lang">'.__('Entry lang:'). 
    472      form::combo('post_lang',$lang_combo,$post_lang). 
    473      '</label></p>'. 
    474       
    475      '<p><label for="post_password">'.__('Entry password:'). 
    476      form::field('post_password',10,32,html::escapeHTML($post_password),'maximal'). 
    477      '</label></p>'. 
    478       
    479      '<div class="lockable">'. 
    480      '<p><label for="post_url">'.__('Basename:'). 
    481      form::field('post_url',10,255,html::escapeHTML($post_url),'maximal'). 
    482      '</label></p>'. 
    483      '<p class="form-note warn">'. 
    484      __('Warning: If you set the URL manually, it may conflict with another entry.'). 
    485      '</p>'. 
    486      '</div>'; 
    487       
    488      # --BEHAVIOR-- adminPostFormSidebar 
    489      $core->callBehavior('adminPostFormSidebar',isset($post) ? $post : null); 
    490       
    491      echo '</div>';      // End #entry-sidebar 
    492  
    493      echo '</form>'; 
    494       
    495      # --BEHAVIOR-- adminPostForm 
    496      $core->callBehavior('adminPostAfterForm',isset($post) ? $post : null); 
    497       
    498      echo '</div>'; 
    499       
    500      if ($post_id && $post->post_status == 1) { 
    501           echo '<p><a href="trackbacks.php?id='.$post_id.'" class="multi-part">'. 
    502           __('Ping blogs').'</a></p>'; 
    503      } 
    504       
    505 } 
    506  
    507  
    508 /* Comments and trackbacks 
    509 -------------------------------------------------------- */ 
    510 if ($post_id) 
    511 { 
    512      $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 
    513       
    514      $comments = $core->blog->getComments(array_merge($params,array('comment_trackback'=>0))); 
    515      $trackbacks = $core->blog->getComments(array_merge($params,array('comment_trackback'=>1))); 
    516       
    517      # Actions combo box 
    518      $combo_action = array(); 
    519      if ($can_edit_post && $core->auth->check('publish,contentadmin',$core->blog->id)) 
    520      { 
    521           $combo_action[__('publish')] = 'publish'; 
    522           $combo_action[__('unpublish')] = 'unpublish'; 
    523           $combo_action[__('mark as pending')] = 'pending'; 
    524           $combo_action[__('mark as junk')] = 'junk'; 
    525      } 
    526       
    527      if ($can_edit_post && $core->auth->check('delete,contentadmin',$core->blog->id)) 
    528      { 
    529           $combo_action[__('Delete')] = 'delete'; 
    530      } 
    531       
    532      # --BEHAVIOR-- adminCommentsActionsCombo 
    533      $core->callBehavior('adminCommentsActionsCombo',array(&$combo_action)); 
    534       
    535      $has_action = !empty($combo_action) && (!$trackbacks->isEmpty() || !$comments->isEmpty()); 
    536       
    537      echo 
    538      '<div id="comments" class="multi-part" title="'.__('Comments').'">'; 
    539       
    540      if ($has_action) { 
    541           echo '<form action="comments_actions.php" id="form-comments" method="post">'; 
    542      } 
    543       
    544      echo '<h3>'.__('Trackbacks').'</h3>'; 
    545       
    546      if (!$trackbacks->isEmpty()) { 
    547           showComments($trackbacks,$has_action,true); 
    548      } else { 
    549           echo '<p>'.__('No trackback').'</p>'; 
    550      } 
    551       
    552      echo '<h3>'.__('Comments').'</h3>'; 
    553      if (!$comments->isEmpty()) { 
    554           showComments($comments,$has_action); 
    555      } else { 
    556           echo '<p>'.__('No comment').'</p>'; 
    557      } 
    558       
    559      if ($has_action) { 
    560           echo 
    561           '<div class="two-cols">'. 
    562           '<p class="col checkboxes-helpers"></p>'. 
    563            
    564           '<p class="col right"><label for="action" class="classic">'.__('Selected comments action:').'</label> '. 
    565           form::combo('action',$combo_action). 
    566           form::hidden('redir','post.php?id='.$post_id.'&amp;co=1'). 
    567           $core->formNonce(). 
    568           '<input type="submit" value="'.__('ok').'" /></p>'. 
    569           '</div>'. 
    570           '</form>'; 
    571      } 
    572       
    573      echo '</div>'; 
    574 } 
    575  
    576 /* Add a comment 
    577 -------------------------------------------------------- */ 
    578 if ($post_id) 
    579 { 
    580      echo 
    581      '<div class="multi-part" id="add-comment" title="'.__('Add a comment').'">'. 
    582      '<h3>'.__('Add a comment').'</h3>'. 
    583       
    584      '<form action="comment.php" method="post" id="comment-form">'. 
    585      '<div class="constrained">'. 
    586      '<p><label for="comment_author" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Name:'). 
    587      form::field('comment_author',30,255,html::escapeHTML($core->auth->getInfo('user_cn'))). 
    588      '</label></p>'. 
    589       
    590      '<p><label for="comment_email">'.__('Email:'). 
    591      form::field('comment_email',30,255,html::escapeHTML($core->auth->getInfo('user_email'))). 
    592      '</label></p>'. 
    593       
    594      '<p><label for="comment_site">'.__('Web site:'). 
    595      form::field('comment_site',30,255,html::escapeHTML($core->auth->getInfo('user_url'))). 
    596      '</label></p>'. 
    597       
    598      '<p class="area"><label for="comment_content" class="required"><abbr title="'.__('Required field').'">*</abbr> '. 
    599      __('Comment:').'</label> '. 
    600      form::textarea('comment_content',50,8,html::escapeHTML('')). 
    601      '</p>'. 
    602       
    603      '<p>'.form::hidden('post_id',$post_id). 
    604      $core->formNonce(). 
    605      '<input type="submit" name="add" value="'.__('Save').'" /></p>'. 
    606      '</div>'. 
    607      '</form>'. 
    608      '</div>'; 
    609 } 
    610  
    611 # Controls comments or trakbacks capabilities 
    612 function isContributionAllowed($id,$dt,$com=true) 
    613 { 
    614      global $core; 
    615  
    616      if (!$id) { 
    617           return true; 
    618      } 
    619      if ($com) { 
    620           if (($core->blog->settings->system->comments_ttl == 0) ||  
    621                (time() - $core->blog->settings->system->comments_ttl*86400 < $dt)) { 
    622                return true; 
    623           } 
    624      } else { 
    625           if (($core->blog->settings->system->trackbacks_ttl == 0) ||  
    626                (time() - $core->blog->settings->system->trackbacks_ttl*86400 < $dt)) { 
    627                return true; 
    628           } 
    629      } 
    630      return false; 
    631 } 
    632  
    633 # Show comments or trackbacks 
    634 function showComments($rs,$has_action,$tb=false) 
    635 { 
    636      echo 
    637      '<table class="comments-list"><tr>'. 
    638      '<th colspan="2">'.__('Author').'</th>'. 
    639      '<th>'.__('Date').'</th>'. 
    640      '<th class="nowrap">'.__('IP address').'</th>'. 
    641      '<th>'.__('Status').'</th>'. 
    642      '<th>&nbsp;</th>'. 
    643      '</tr>'; 
    644       
    645      while($rs->fetch()) 
    646      { 
    647           $comment_url = 'comment.php?id='.$rs->comment_id; 
    648            
    649           $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; 
    650           switch ($rs->comment_status) { 
    651                case 1: 
    652                     $img_status = sprintf($img,__('published'),'check-on.png'); 
    653                     break; 
    654                case 0: 
    655                     $img_status = sprintf($img,__('unpublished'),'check-off.png'); 
    656                     break; 
    657                case -1: 
    658                     $img_status = sprintf($img,__('pending'),'check-wrn.png'); 
    659                     break; 
    660                case -2: 
    661                     $img_status = sprintf($img,__('junk'),'junk.png'); 
    662                     break; 
    663           } 
    664            
    665           echo 
    666           '<tr class="line'.($rs->comment_status != 1 ? ' offline' : '').'"'. 
    667           ' id="c'.$rs->comment_id.'">'. 
    668            
    669           '<td class="nowrap">'. 
    670           ($has_action ? form::checkbox(array('comments[]'),$rs->comment_id,'','','',0,'title="'.($tb ? __('select this trackback') : __('select this comment')).'"') : '').'</td>'. 
    671           '<td class="maximal">'.html::escapeHTML($rs->comment_author).'</td>'. 
    672           '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$rs->comment_dt).'</td>'. 
    673           '<td class="nowrap"><a href="comments.php?ip='.$rs->comment_ip.'">'.$rs->comment_ip.'</a></td>'. 
    674           '<td class="nowrap status">'.$img_status.'</td>'. 
    675           '<td class="nowrap status"><a href="'.$comment_url.'">'. 
    676           '<img src="images/edit-mini.png" alt="" title="'.__('Edit this comment').'" /></a></td>'. 
    677            
    678           '</tr>'; 
    679      } 
    680       
    681      echo '</table>'; 
    682 } 
    683  
    684 dcPage::helpBlock('core_post','core_wiki'); 
    685 dcPage::close(); 
     188$core->tpl->display('post.html.twig'); 
    686189?> 
  • admin/style/default.css

    r1140 r1155  
    4040     margin-bottom: 0.6em; 
    4141} 
     42 
    4243h2 { 
    4344     color: #666; 
     
    5253     font-size: 1.2em; 
    5354} 
     55 
    5456p, div.p { 
    5557     margin: 0 0 1em 0; 
    5658} 
     59 
    5760hr { 
    5861     height: 1px; 
     
    6164     border-style: solid; 
    6265} 
     66 
    6367pre, code { 
    6468     font: 100% "Andale Mono","Courier New",monospace; 
     
    7781     cursor: help; 
    7882} 
     83 
    7984 
    8085/* LAYOUT 
     
    431436     color: #666; 
    432437} 
     438 
    433439#dashboard-items { 
    434440     float: left; 
     
    536542     height: 500px; 
    537543} 
     544 
    538545#add-file-f { 
    539546     position: relative; 
     
    619626     display: inline; 
    620627} 
     628 
    621629#default-favs h3 { 
    622630     margin-top: 2em; 
    623631     margin-bottom: 1em; 
    624632} 
     633 
    625634.fav-list { 
    626635     list-style-type: none; 
     
    915924     vertical-align: middle; 
    916925} 
     926 
    917927/* Si quelque chose a besoin d'être caché sauf pour les revues d'écran */ 
    918928.hidden { 
     
    949959     overflow: auto; 
    950960} 
     961 
    951962.grid { 
    952963     background: transparent repeat url('grid.png') 0 0; 
    953964} 
     965 
    954966.line p { 
    955967     margin: 0; 
     
    958970     color: #666; 
    959971} 
     972 
    960973ul.nice { 
    961974     margin: 1em 0; 
     
    10061019     margin-bottom: .5em; 
    10071020} 
    1008  
    10091021th, td { 
    10101022     border-width: 0 0 1px 0; 
     
    10211033     border-width: 0; 
    10221034} 
     1035 
    10231036table .maximal, table.maximal { 
    10241037     width: 100%; 
     
    10271040     width: 1px; 
    10281041} 
     1042 
    10291043table .nowrap { 
    10301044     white-space: nowrap; 
     
    11171131     font-weight: normal; 
    11181132} 
     1133 
    11191134input, textarea, select { 
    11201135     background: #f9f9f9; 
     
    11491164     background: transparent; 
    11501165} 
     1166 
    11511167label { 
    11521168     display: block; 
     
    11941210     resize: vertical; 
    11951211} 
     1212 
    11961213label.required { 
    11971214     font-weight: bold; 
     
    12181235     top: 0; 
    12191236} 
     1237 
    12201238label .maximal, textarea.maximal, input.maximal { 
    12211239     width: 100%; 
     
    12321250     padding-left: 20px; 
    12331251} 
     1252 
     1253a#toggle-filters { 
     1254     font-weight: bold; 
     1255     background: url(../images/plus.png) no-repeat 0 0; 
     1256     padding-left: 20px; 
     1257} 
     1258 
     1259a#toggle-filters.opened { 
     1260     background: url(../images/minus.png) no-repeat 0 0; 
     1261} 
     1262 
    12341263.constrained { 
    12351264     margin: 0; 
     
    13511380     background-color: #2373A8; 
    13521381} 
    1353  
    13541382/* jQuery Autocomplete plugin */ 
    13551383.ac_results { 
     
    13841412     color: white; 
    13851413} 
     1414 
     1415form#filters {font-size: 100%; background: #f0f0f0; padding: 1em; border-radius: .5em; border: 1px solid #ddd;} 
     1416form#filters .margintop {padding-top: 1.33em;} 
     1417form#filters ul, form#filters p {list-style-type:none;margin: 0; padding: 0 0 .5em 0; margin-left: 1em;} 
     1418form#filters .col30 {border-left: 1px solid #999;} 
     1419form#filters .col30 h3 {margin-left: 1em;} 
     1420 
     1421p.line, li.line { position: relative; padding: 3px 0 0 28px; margin: 0 0 1em 0;} 
     1422li.line input[type=submit] {position: absolute; left:0;top:0; padding: 0 .1em; margin: 0;} 
     1423li.line input[type=checkbox], li.line input[type=checkbox] {position: absolute; left: 0; top: .2em; padding: 0 .1em; margin: 0;} 
     1424li.line select { margin-right: 2em;} 
     1425li.line label { display: block; width: 8em; float: left;} 
     1426li.line label img {margin-right: 8px;} 
     1427li.line span.or { 
     1428     text-align: right; 
     1429     margin-left: 5em; 
     1430     font-weight: bold; 
     1431} 
     1432p.line label.or + select {margin-left: 2em;} 
     1433li.line { padding: 0 0 0 20px; height: 1em;} 
     1434li.line label {width: auto;} 
     1435 
     1436#available_filters input[type=submit] {padding: 0 .1em; margin-left: .5em;} 
     1437 
     1438div.pagination span, div.pagination a { 
     1439     margin-right: 1em; 
     1440} 
  • admin/style/default.css

    r1147 r1155  
    1111# -- END LICENSE BLOCK ----------------------------------------- 
    1212*/ 
     13 
     14/* ------------------------------------------------------------------ html */ 
    1315body { 
    1416     font: 75%/1.5em Helvetica,Arial,sans-serif; 
     
    151153     height: 2em; 
    152154} 
     155#info-box1 p { 
     156     margin: 0; 
     157     display: inline; 
     158} 
    153159#info-box1 select { 
    154160     width: 15em; 
     
    193199} 
    194200#content { 
    195      margin: 1.5em 1.5em 4em 13em; 
     201     margin: 1.5em 1.5em .5em 13em; 
    196202     padding: 1em; 
    197203     background: #fff; 
    198      -webkit-border-radius: .5em; 
    199      -moz-border-radius: .5em; 
    200204     border-radius: .5em; 
    201205     border: 1px solid #ddd; 
     
    255259     background: #dfdfdf; 
    256260     text-decoration: none; 
    257      -webkit-border-top-left-radius: .3em; 
    258      -webkit-border-top-right-radius: .3em; 
    259      -moz-border-radius-topleft: .3em; 
    260      -moz-border-radius-topright: .3em; 
    261261     border-top-left-radius: .3em; 
    262262     border-top-right-radius: .3em; 
     
    282282     float: left; 
    283283     margin-top: 1.2em; 
    284      margin-bottom: 1em; 
     284     margin-bottom: .5em; 
    285285} 
    286286#main-menu h3 { 
     
    302302     padding: .2em 0 0 32px; 
    303303     background-repeat: no-repeat; 
    304      background-position: 12px .2em; 
     304     background-position: 12px .4em; 
    305305} 
    306306#main-menu a { 
     
    340340#footer { 
    341341     clear: both; 
    342      padding: .75em 2em; 
    343      margin: 6em 15px .5em 15px; 
    344      -webkit-border-radius: .3em; 
    345      -moz-border-radius: .3em; 
    346      border-radius: .3em; 
    347      background: #575859 url(dc_logo_small.png) no-repeat right bottom; 
    348      color: #fff; 
     342     padding: .75em .75em 0 0; 
     343     text-align: right; 
    349344} 
    350345#footer p { 
     
    355350} 
    356351#footer a { 
    357      color: #f5f5f5; 
    358352} 
    359353#footer p span.credit { 
     
    378372     border: 1px solid #999; 
    379373     padding: 1em 1em 0 1em; 
    380      -moz-border-radius: 4px; 
    381      -webkit-border-radius: 4px; 
    382374     border-radius: 4px; 
    383375} 
     
    513505     border: 1px solid #ccc; 
    514506     border-left: 1em solid #E5E3DA; 
    515      -moz-border-radius: .3em; 
    516      -webkit-border-radius: .3em; 
    517507     border-radius: .3em; 
    518508} 
     
    668658     border: 1px solid #ddd; 
    669659     padding: .2em; 
    670      -moz-border-radius: .5em; 
    671      -webkit-border-radius: .5em; 
    672660     border-radius: .5em; 
    673661} 
     
    764752     border: 1px solid #f3f3f3; 
    765753     cursor: pointer; 
    766      -moz-border-radius: 4px; 
    767      -webkit-border-radius: 4px; 
    768754     border-radius: 4px; 
    769755} 
     
    804790} 
    805791#help-button { 
    806      position: absolute; 
    807      top: 6.2em; 
     792     position: fixed; 
     793     top: 3.2em; 
    808794     right: 0px; 
    809795     cursor: pointer; 
     
    815801     text-transform: capitalize; 
    816802     padding: .33em .75em .33em 1em; 
    817      -moz-border-radius: 1em 0 0 1em; 
    818      -webkit-border-top-left-radius: 1em; 
    819      -webkit-border-bottom-left-radius: 1em; 
     803     border-radius: 1em 0 0 1em; 
    820804     color: #444; 
    821805} 
     
    879863div.message, p.message,  
    880864div.static-msg, p.static-msg { 
    881      padding: 0.5em 0.5em 0.5em 40px; 
     865     padding: 0.5em 0.5em 0.5em 48px; 
    882866     margin-bottom: 1em; 
    883      -moz-border-radius: 8px; 
    884      -webkit-border-radius: 8px; 
    885867     border-radius: 8px; 
    886868} 
     
    890872} 
    891873div.error, p.error { 
    892      background: #e5bfbf url(msg-error.png) no-repeat 5px 5px; 
    893      color: #600; 
     874     background: #ffdec8 url(msg-error.png) no-repeat .7em .7em; 
     875     color: #000; 
    894876} 
    895877div.message, p.message,  
    896878div.static-msg, p.static-msg { 
    897      background: #666 url(msg-std.png) no-repeat 5px 5px; 
     879     background: #666 url(msg-std.png) no-repeat .7em .7em; 
    898880     color: #fff; 
    899881} 
     
    1015997     right: 0; 
    1016998} 
     999.distrib img { 
     1000     display: block; 
     1001     float: right; 
     1002     margin-top: -1em; 
     1003} 
    10171004/* TABLES 
    10181005-------------------------------------------------------- */ 
     
    10411028th { 
    10421029     text-align: left; 
     1030     border-bottom-color: #666; 
    10431031} 
    10441032.noborder td, td.noborder, .noborder th, th.noborder { 
     
    10561044     white-space: nowrap; 
    10571045     vertical-align: top; 
     1046} 
     1047table.settings, table.prefs { 
     1048     width: 80%; 
     1049} 
     1050table.settings th:first-child, table.prefs th:first-child { 
     1051     width: 20%; 
     1052} 
     1053table.settings th + th, table.prefs th + th { 
     1054     width: 30%; 
     1055} 
     1056table.settings th + th + th, table.prefs th + th + th { 
     1057     width: 10%; 
     1058} 
     1059table.settings th:last-child, table.prefs th:last-child { 
     1060     width: 40%; 
    10581061} 
    10591062 
     
    11361139     border-color: #000 #ccc #ccc #000; 
    11371140} 
     1141input.invalid, textarea.invalid, select.invalid { 
     1142     border: 1px solid red; 
     1143     background: #fff;  
     1144     color: red; 
     1145     box-shadow: 0 0 0 1px rgba(218, 62, 90, 0.3) 
     1146} 
    11381147input, textarea, select, option { 
    11391148     font: 1em "DejaVu Sans","Lucida Grande","Lucida Sans Unicode",Arial,sans-serif; 
     
    11671176     color: #666; 
    11681177} 
     1178span.form-note { 
     1179     font-style:italic; 
     1180     font-weight: normal; 
     1181     color: #666; 
     1182} 
    11691183p.form-note.warn, p.form-note.info, p.warning { 
    11701184     font-style: normal; 
     
    11721186} 
    11731187p.form-note.warn, p.warning { 
    1174      background: #ffd url(warning.png) no-repeat .2em .2em; 
     1188     background: #ffd url(warning.png) no-repeat .3em .3em; 
    11751189     border: 1px solid #f0c020; 
    11761190} 
    11771191p.form-note.info { 
    1178      background: #eef url(info.png) no-repeat .2em .2em; 
     1192     background: #eef url(info.png) no-repeat .3em .2em; 
    11791193     border: 1px solid #99f; 
    11801194} 
     
    12091223p.field { 
    12101224     position: relative; 
    1211  
     1225      
    12121226} 
    12131227p.field label { 
     
    12751289     padding: .1em .5em 0 .5em; 
    12761290     text-shadow: 0 1px 1px rgba(0,0,0,.3); 
    1277      -webkit-border-radius: .2em; 
    1278      -moz-border-radius: .2em; 
    12791291     border-radius: .2em; 
    12801292     margin-bottom: .1em; 
     
    13581370} 
    13591371a.button.add { 
    1360      -webkit-border-radius: .5em; 
    1361      -moz-border-radius: .5em; 
    13621372     border-radius: .5em; 
    13631373     margin-bottom: .1em;      
    1364      background: #2C8FD1 url(add.png) no-repeat 6px center; 
     1374     background: #2C8FD1 url(../images/add.png) no-repeat 6px center; 
    13651375     color: #fff; 
    13661376     padding: .2em 16px .2em 30px; 
     
    13691379a.button.add:hover, a.button.add:focus { 
    13701380     background-color: #2373A8; 
     1381} 
     1382/* jQuery Autocomplete plugin */ 
     1383.ac_results { 
     1384     padding: 0px; 
     1385     border: 1px dotted #f90; 
     1386     background-color: white; 
     1387     overflow: hidden; 
     1388     z-index: 99999; 
     1389} 
     1390.ac_results ul { 
     1391     width: 100%; 
     1392     list-style-position: outside; 
     1393     list-style: none; 
     1394     padding: 0; 
     1395     margin: 0; 
     1396} 
     1397.ac_results li { 
     1398     margin: 0px; 
     1399     padding: 2px 5px; 
     1400     cursor: default; 
     1401     display: block; 
     1402     font: menu; 
     1403     font-size: 1em; 
     1404     line-height: 16px; 
     1405     overflow: hidden; 
     1406} 
     1407.ac_loading { 
     1408     background: transparent url('loader.gif') right center no-repeat; 
     1409} 
     1410.ac_over { 
     1411     background-color: #06c; 
     1412     color: white; 
    13711413} 
    13721414 
  • inc/admin/lib.dc.page.php

    r1142 r1155  
    4949      
    5050     # Top of admin page 
    51      public static function open($title='', $head='') 
    52      { 
    53           global $core; 
    54            
    55           # List of user's blogs 
    56           if ($core->auth->blog_count == 1 || $core->auth->blog_count > 20) 
    57           { 
    58                $blog_box = 
    59                '<p>'.__('Blog:').' <strong title="'.html::escapeHTML($core->blog->url).'">'. 
    60                html::escapeHTML($core->blog->name).'</strong>'; 
    61                 
    62                if ($core->auth->blog_count > 20) { 
    63                     $blog_box .= ' - <a href="blogs.php">'.__('Change blog').'</a>'; 
    64                } 
    65                $blog_box .= '</p>'; 
    66           } 
    67           else 
    68           { 
    69                $rs_blogs = $core->getBlogs(array('order'=>'LOWER(blog_name)','limit'=>20)); 
    70                $blogs = array(); 
    71                while ($rs_blogs->fetch()) { 
    72                     $blogs[html::escapeHTML($rs_blogs->blog_name.' - '.$rs_blogs->blog_url)] = $rs_blogs->blog_id; 
    73                } 
    74                $blog_box = 
    75                '<p><label for="switchblog" class="classic">'. 
    76                __('Blogs:').' '. 
    77                $core->formNonce(). 
    78                form::combo('switchblog',$blogs,$core->blog->id). 
    79                '</label></p>'. 
    80                '<noscript><p><input type="submit" value="'.__('ok').'" /></p></noscript>'; 
    81           } 
    82            
    83           $safe_mode = isset($_SESSION['sess_safe_mode']) && $_SESSION['sess_safe_mode']; 
    84            
    85           # Display 
    86           header('Content-Type: text/html; charset=UTF-8'); 
    87           echo 
    88           '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '. 
    89           ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n". 
    90           '<html xmlns="http://www.w3.org/1999/xhtml" '. 
    91           'xml:lang="'.$core->auth->getInfo('user_lang').'" '. 
    92           'lang="'.$core->auth->getInfo('user_lang').'">'."\n". 
    93           "<head>\n". 
    94           '  <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            
    97           '  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n". 
    98           '  <meta name="GOOGLEBOT" content="NOSNIPPET" />'."\n". 
    99            
    100           self::jsLoadIE7(). 
    101           '    <link rel="stylesheet" href="style/default.css" type="text/css" media="screen" />'."\n";  
    102           if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') { 
    103                echo 
    104           '    <link rel="stylesheet" href="style/default-rtl.css" type="text/css" media="screen" />'."\n";  
    105           } 
    106  
    107           $core->auth->user_prefs->addWorkspace('interface'); 
    108           $user_ui_hide_std_favicon = $core->auth->user_prefs->interface->hide_std_favicon; 
    109           if (!$user_ui_hide_std_favicon) { 
    110                echo '<link rel="icon" type="image/png" href="images/favicon.png" />'; 
    111           } 
    112            
    113           echo 
    114           self::jsCommon(). 
    115           $head; 
    116            
    117           # --BEHAVIOR-- adminPageHTMLHead 
    118           $core->callBehavior('adminPageHTMLHead'); 
    119            
    120           echo 
    121           "</head>\n". 
    122           '<body id="dotclear-admin'. 
    123           ($safe_mode ? ' safe-mode' : ''). 
    124           '">'."\n". 
    125            
    126           '<div id="header">'. 
    127           '<ul id="prelude"><li><a href="#content">'.__('Go to the content').'</a></li><li><a href="#main-menu">'.__('Go to the menu').'</a></li></ul>'."\n". 
    128           '<div id="top"><h1><a href="index.php">'.DC_VENDOR_NAME.'</a></h1></div>'."\n";  
    129            
    130           echo 
    131           '<div id="info-boxes">'. 
    132           '<div id="info-box1">'. 
    133           '<form action="index.php" method="post">'. 
    134           $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></form>'. 
    137           '</div>'. 
    138           '<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>'. 
    142           '</div>'. 
    143           '</div>'. 
    144           '</div>'; 
    145            
    146           echo 
    147           '<div id="wrapper">'."\n". 
    148           '<div id="main">'."\n". 
    149           '<div id="content">'."\n"; 
    150            
    151           # Safe mode 
    152           if ($safe_mode) 
    153           { 
    154                echo 
    155                '<div class="error"><h3>'.__('Safe mode').'</h3>'. 
    156                '<p>'.__('You are in safe mode. All plugins have been temporarily disabled. Remind to log out then log in again normally to get back all functionalities').'</p>'. 
    157                '</div>'; 
    158           } 
     51     public static function open($title='',$head='',$popup=false) 
     52     { 
     53          global $core, $_ctx; 
     54           
     55          $_ctx->popup = (boolean) $popup; 
     56          $_ctx->page_header = $head; 
     57          $_ctx->fillPageTitle($title); 
     58           
     59          ob_start(); 
     60     } 
     61      
     62     public static function close() 
     63     { 
     64          $res = ob_get_contents(); 
     65          ob_end_clean(); 
     66           
     67          global $core, $_ctx; 
    15968           
    16069          if ($core->error->flag()) { 
    161                echo 
    162                '<div class="error"><p><strong>'.(count($core->error->getErrors()) > 1 ? __('Errors:') : __('Error:')).'</p></strong>'. 
    163                $core->error->toHTML(). 
    164                '</div>'; 
    165           } 
    166      } 
    167       
    168      public static function close() 
    169      { 
    170           global $core; 
    171  
    172           $menu =& $GLOBALS['_menu']; 
    173            
    174           echo 
    175           "</div>\n".         // End of #content 
    176           "</div>\n".         // End of #main 
    177            
    178           '<div id="main-menu">'."\n"; 
    179            
    180           foreach ($menu as $k => $v) { 
    181                echo $menu[$k]->draw(); 
    182           } 
    183            
    184           $text = sprintf(__('Thank you for using %s.'),'Dotclear '.DC_VERSION); 
    185  
    186           # --BEHAVIOR-- adminPageFooter 
    187           $textAlt = $core->callBehavior('adminPageFooter',$core,$text); 
    188           if ($textAlt != '') { 
    189                $text = $textAlt; 
    190           } 
    191           $text = html::escapeHTML($text); 
    192  
    193           echo 
    194           '</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". 
    196           "</div>\n";         // End of #wrapper 
    197            
    198           if (defined('DC_DEV') && DC_DEV === true) { 
    199                echo self::debugInfo(); 
    200           } 
    201            
    202           echo 
    203           '</body></html>'; 
    204      } 
    205       
    206      public static function openPopup($title='', $head='') 
    207      { 
    208           global $core; 
    209            
    210           # Display 
    211           header('Content-Type: text/html; charset=UTF-8'); 
    212           echo 
    213           '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '. 
    214           ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n". 
    215           '<html xmlns="http://www.w3.org/1999/xhtml" '. 
    216           'xml:lang="'.$core->auth->getInfo('user_lang').'" '. 
    217           'lang="'.$core->auth->getInfo('user_lang').'">'."\n". 
    218           "<head>\n". 
    219           '  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n". 
    220           '  <title>'.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.'</title>'."\n". 
    221            
    222           '  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n". 
    223           '  <meta name="GOOGLEBOT" content="NOSNIPPET" />'."\n". 
    224            
    225           self::jsLoadIE7(). 
    226           '    <link rel="stylesheet" href="style/default.css" type="text/css" media="screen" />'."\n";  
    227           if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') { 
    228                echo 
    229                '    <link rel="stylesheet" href="style/default-rtl.css" type="text/css" media="screen" />'."\n";  
    230           } 
    231            
    232           echo 
    233           self::jsCommon(). 
    234           $head; 
    235            
    236           # --BEHAVIOR-- adminPageHTMLHead 
    237           $core->callBehavior('adminPageHTMLHead'); 
    238            
    239           echo 
    240           "</head>\n". 
    241           '<body id="dotclear-admin" class="popup">'."\n". 
    242            
    243           '<div id="top"><h1>'.DC_VENDOR_NAME.'</h1></div>'."\n"; 
    244            
    245           echo 
    246           '<div id="wrapper">'."\n". 
    247           '<div id="main">'."\n". 
    248           '<div id="content">'."\n"; 
    249            
    250           if ($core->error->flag()) { 
    251                echo 
    252                '<div class="error"><strong>'.__('Errors:').'</strong>'. 
    253                $core->error->toHTML(). 
    254                '</div>'; 
    255           } 
     70               foreach($core->error->getErrors() as $e) { 
     71                    $_ctx->addError($e); 
     72               } 
     73          } 
     74          $_ctx->page_content = $res; 
     75          $core->tpl->display('page_layout.html.twig'); 
     76     } 
     77      
     78     public static function openPopup($title='',$head='') 
     79     { 
     80          self::open($title,$head,true); 
    25681     } 
    25782      
    25883     public static function closePopup() 
    25984     { 
    260           echo 
    261           "</div>\n".         // End of #content 
    262           "</div>\n".         // End of #main 
    263           '<div id="footer"><p>&nbsp;</p></div>'."\n". 
    264           "</div>\n".         // End of #wrapper 
    265           '</body></html>'; 
     85          self::close(); 
    26686     } 
    26787 
     
    27999               } 
    280100          } 
    281           return $res; 
    282      } 
    283       
    284      private static function debugInfo() 
    285      { 
    286           $global_vars = implode(', ',array_keys($GLOBALS)); 
    287            
    288           $res = 
    289           '<div id="debug"><div>'. 
    290           '<p>memory usage: '.memory_get_usage().' ('.files::size(memory_get_usage()).')</p>'; 
    291            
    292           if (function_exists('xdebug_get_profiler_filename')) 
    293           { 
    294                $res .= '<p>Elapsed time: '.xdebug_time_index().' seconds</p>'; 
    295                 
    296                $prof_file = xdebug_get_profiler_filename(); 
    297                if ($prof_file) { 
    298                     $res .= '<p>Profiler file : '.xdebug_get_profiler_filename().'</p>'; 
    299                } else { 
    300                     $prof_url = http::getSelfURI(); 
    301                     $prof_url .= (strpos($prof_url,'?') === false) ? '?' : '&'; 
    302                     $prof_url .= 'XDEBUG_PROFILE'; 
    303                     $res .= '<p><a href="'.html::escapeURL($prof_url).'">Trigger profiler</a></p>'; 
    304                } 
    305                 
    306                /* xdebug configuration: 
    307                zend_extension = /.../xdebug.so 
    308                xdebug.auto_trace = On 
    309                xdebug.trace_format = 0 
    310                xdebug.trace_options = 1 
    311                xdebug.show_mem_delta = On 
    312                xdebug.profiler_enable = 0 
    313                xdebug.profiler_enable_trigger = 1 
    314                xdebug.profiler_output_dir = /tmp 
    315                xdebug.profiler_append = 0 
    316                xdebug.profiler_output_name = timestamp 
    317                */ 
    318           } 
    319            
    320           $res .= 
    321           '<p>Global vars: '.$global_vars.'</p>'. 
    322           '</div></div>'; 
    323            
    324101          return $res; 
    325102     } 
  • inc/admin/lib.dc.page.php

    r1089 r1155  
    173173          self::jsLoad('js/jquery/jquery.biscuit.js'). 
    174174          self::jsLoad('js/jquery/jquery.bgFade.js'). 
    175           self::jsLoad('js/jquery/jquery.constantfooter.js'). 
    176175          self::jsLoad('js/common.js'). 
    177176          self::jsLoad('js/prelude.js'). 
  • inc/core/class.dc.blog.php

    r1111 r1155  
    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.blog.php

    r1154 r1155  
    228228               'SELECT post_id, COUNT(post_id) AS nb_comment,comment_trackback '. 
    229229               'FROM '.$this->prefix.'comment '. 
    230                'WHERE post_id'.$this->con->in($a_ids). 
    231                'AND comment_status = 1 '; 
     230               'WHERE comment_status = 1 '. 
     231               (count($a_ids) > 0 ? 'AND post_id'.$this->con->in($a_ids) : ' '); 
    232232           
    233233          if ($del) { 
  • inc/prepend.php

    r1119 r1155  
    1212 
    1313/* ------------------------------------------------------------------------------------------- */ 
    14 #  ClearBricks, DotClear classes auto-loader 
     14#  ClearBricks, Twig, DotClear classes auto-loader 
    1515if (@is_dir('/usr/lib/clearbricks')) { 
    1616     define('CLEARBRICKS_PATH','/usr/lib/clearbricks'); 
     
    4646$__autoload['dcWorkspace']              = dirname(__FILE__).'/core/class.dc.workspace.php'; 
    4747$__autoload['dcPrefs']                  = dirname(__FILE__).'/core/class.dc.prefs.php'; 
     48$__autoload['dcTwigPage']               = dirname(__FILE__).'/core/class.dc.twig.page.php'; 
    4849 
    4950$__autoload['rsExtPost']                = dirname(__FILE__).'/core/class.dc.rs.extensions.php'; 
     
    5253$__autoload['rsExtUser']                = dirname(__FILE__).'/core/class.dc.rs.extensions.php'; 
    5354 
     55$__autoload['dcAdminContext']                = dirname(__FILE__).'/admin/class.dc.admincontext.php'; 
    5456$__autoload['dcMenu']                   = dirname(__FILE__).'/admin/class.dc.menu.php'; 
    5557$__autoload['dcPage']                   = dirname(__FILE__).'/admin/lib.dc.page.php'; 
     
    6365$__autoload['context']                  = dirname(__FILE__).'/public/lib.tpl.context.php'; 
    6466$__autoload['dcUrlHandlers']            = dirname(__FILE__).'/public/lib.urlhandlers.php'; 
     67$__autoload['dcForm']              = dirname(__FILE__).'/admin/class.dc.form.php'; 
     68$__autoload['dcFormExtension']               = dirname(__FILE__).'/admin/class.dc.form.php'; 
     69$__autoload['dcTabExtension']           = dirname(__FILE__).'/admin/class.dc.tab.php'; 
     70$__autoload['dcItemList']               = dirname(__FILE__).'/admin/class.dc.list.php'; 
     71$__autoload['dcListFetcher']            = dirname(__FILE__).'/admin/class.dc.list.php'; 
     72 
     73foreach (array('dcFilterSet', 'dcFilter','dcFilterCombo','dcFilterText','dcFilterBoolean') as $c) { 
     74     $__autoload[$c] = dirname(__FILE__).'/admin/class.dc.filter.php'; 
     75} 
    6576 
    6677# Clearbricks extensions 
    6778html::$absolute_regs[] = '/(<param\s+name="movie"\s+value=")(.*?)(")/msu'; 
    6879html::$absolute_regs[] = '/(<param\s+name="FlashVars"\s+value=".*?(?:mp3|flv)=)(.*?)(&|")/msu'; 
     80 
     81if (@is_dir('/usr/lib/twig')) { 
     82     define('TWIG_PATH','/usr/lib/Twig'); 
     83} elseif (is_dir(dirname(__FILE__).'/libs/Twig')) { 
     84     define('TWIG_PATH',dirname(__FILE__).'/libs/Twig'); 
     85} elseif (isset($_SERVER['TWIG_PATH']) && is_dir($_SERVER['TWIG_PATH'])) { 
     86     define('TWIG_PATH',$_SERVER['TWIG_PATH']); 
     87} 
     88 
     89if (!defined('TWIG_PATH') || !is_dir(TWIG_PATH)) { 
     90     exit('No Twig path defined'); 
     91} 
     92require TWIG_PATH.'/Autoloader.php'; 
     93Twig_Autoloader::register(); 
     94 
    6995/* ------------------------------------------------------------------------------------------- */ 
    7096 
     
    123149# Constants 
    124150define('DC_ROOT',path::real(dirname(__FILE__).'/..')); 
    125 define('DC_VERSION','2.5.1-dev'); 
     151define('DC_VERSION','2.99-dev'); 
    126152define('DC_DIGESTS',dirname(__FILE__).'/digests'); 
    127153define('DC_L10N_ROOT',dirname(__FILE__).'/../locales'); 
  • inc/prepend.php

    r1154 r1155  
    149149# Constants 
    150150define('DC_ROOT',path::real(dirname(__FILE__).'/..')); 
    151 define('DC_VERSION','2.5-dev'); 
     151define('DC_VERSION','2.99-dev'); 
    152152define('DC_DIGESTS',dirname(__FILE__).'/digests'); 
    153153define('DC_L10N_ROOT',dirname(__FILE__).'/../locales'); 
  • plugins/aboutConfig/index.php

    r1109 r1155  
    1212if (!defined('DC_CONTEXT_ADMIN')) { return; } 
    1313 
    14 # Local navigation 
    15 if (!empty($_POST['gs_nav'])) { 
    16      http::redirect($p_url.$_POST['gs_nav']); 
    17      exit; 
    18 } 
    19 if (!empty($_POST['ls_nav'])) { 
    20      http::redirect($p_url.$_POST['ls_nav']); 
    21      exit; 
    22 } 
    23  
    24 # Local settings update 
    25 if (!empty($_POST['s']) && is_array($_POST['s'])) 
     14class adminPageAboutConfig 
    2615{ 
    27      try 
     16     public static $p_url = 'plugin.php?p=aboutConfig'; 
     17      
     18     # Update local settings 
     19     public static function updLocal($form) 
    2820     { 
    29           foreach ($_POST['s'] as $ns => $s) 
    30           { 
    31                $core->blog->settings->addNamespace($ns); 
     21          self::updSettings($form); 
     22     } 
     23      
     24     # Update global settings 
     25     public static function updGlobal($form) 
     26     { 
     27          self::updSettings($form,true); 
     28     } 
     29      
     30     # Update settings 
     31     protected static function updSettings($form,$global=false) 
     32     { 
     33          global $core,$_ctx; 
     34           
     35          $part = $global ? 'global' : 'local'; 
     36          $prefix = $part.'_'; 
     37           
     38          try { 
     39               foreach ($core->blog->settings->dumpNamespaces() as $ns => $namespace) { 
     40                    $core->blog->settings->addNamespace($ns); 
     41                    $ns_settings = $global ?  
     42                         $namespace->dumpGlobalSettings() : $namespace->dumpSettings(); 
     43                     
     44                    foreach ($ns_settings as $k => $v) { 
     45                         // need to cast type 
     46                         $f = (string) $form->{$prefix.$ns.'_'.$k}; 
     47                         settype($f,$v['type']); 
     48                          
     49                         $core->blog->settings->$ns->put($k,$f,null,null,true,$global); 
     50                         $form->{$prefix.$ns.'_'.$k} = $f; 
     51                    } 
     52               } 
     53               $core->blog->triggerBlog(); 
    3254                
    33                foreach ($s as $k => $v)      { 
    34                     $core->blog->settings->$ns->put($k,$v); 
    35                } 
    36                 
    37                $core->blog->triggerBlog(); 
     55               http::redirect(self::$p_url.'&upd=1&part='.$part); 
     56          } 
     57          catch (Exception $e) { 
     58               $_ctx->addError($e->getMessage()); 
     59          } 
     60     } 
     61      
     62     # Set nav and settings forms 
     63     public static function setForms($global=false) 
     64     { 
     65          global $core, $_ctx; 
     66           
     67          $prefix = $global ? 'global_' : 'local_'; 
     68          $action = $global ? 'updGlobal' : 'updLocal'; 
     69           
     70          if (!empty($_POST[$prefix.'nav'])) { 
     71               http::redirect(self::$p_url.$_POST[$prefix.'nav']); 
     72               exit; 
    3873          } 
    3974           
    40           http::redirect($p_url.'&upd=1'); 
    41      } 
    42      catch (Exception $e) 
    43      { 
    44           $core->error->add($e->getMessage()); 
     75          $nav_form = new dcForm($core,$prefix.'nav_form','plugin.php'); 
     76          $settings_form = new dcForm($core,$prefix.'settings_form','plugin.php'); 
     77           
     78          $settings = $combo = array(); 
     79          foreach ($core->blog->settings->dumpNamespaces() as $ns => $namespace) { 
     80               $ns_settings = $global ?  
     81                    $namespace->dumpGlobalSettings() : $namespace->dumpSettings(); 
     82                
     83               foreach ($ns_settings as $k => $v) { 
     84                    $settings[$ns][$k] = $v; 
     85               } 
     86          } 
     87           
     88          ksort($settings); 
     89          foreach ($settings as $ns => $s) { 
     90               $combo['#'.$prefix.$ns] = $ns; 
     91               ksort($s); 
     92               foreach ($s as $k => $v) { 
     93                    if ($v['type'] == 'boolean') { 
     94                         $settings_form->addField( 
     95                              new dcFieldCombo($prefix.$ns.'_'.$k, 
     96                                   '',array(1 => __('yes'),0 => __('no')))); 
     97                    } 
     98                    else { 
     99                         $settings_form->addField( 
     100                              new dcFieldText($prefix.$ns.'_'.$k,'')); 
     101                    } 
     102                    $settings_form->{$prefix.$ns.'_'.$k} = $v['value']; 
     103               } 
     104          } 
     105           
     106          $nav_form 
     107               ->addField( 
     108                    new dcFieldCombo($prefix.'nav','',$combo,array( 
     109                         "label" => __('Goto:')))) 
     110               ->addField( 
     111                    new dcFieldSubmit($prefix.'nav_submit',__('OK'))) 
     112               ->addField( 
     113                    new dcFieldHidden ('p','aboutConfig')) 
     114               ; 
     115           
     116          $settings_form 
     117               ->addField( 
     118                    new dcFieldSubmit($prefix.'submit',__('Save'),array( 
     119                         'action' => array('adminPageAboutConfig',$action)))) 
     120               ->addField( 
     121                    new dcFieldHidden ('p','aboutConfig')) 
     122               ; 
     123           
     124          $_ctx->{$prefix.'settings'} = $settings; 
     125           
     126          $nav_form->setup(); 
     127          $settings_form->setup(); 
    45128     } 
    46129} 
    47130 
    48 # Global settings update 
    49 if (!empty($_POST['gs']) && is_array($_POST['gs'])) 
    50 { 
    51      try 
    52      { 
    53           foreach ($_POST['gs'] as $ns => $s) 
    54           { 
    55                $core->blog->settings->addNamespace($ns); 
    56                 
    57                foreach ($s as $k => $v)      { 
    58                     $core->blog->settings->$ns->put($k,$v,null,null,true,true); 
    59                } 
    60                 
    61                $core->blog->triggerBlog(); 
    62           } 
    63            
    64           http::redirect($p_url.'&upd=1&part=global'); 
    65      } 
    66      catch (Exception $e) 
    67      { 
    68           $core->error->add($e->getMessage()); 
    69      } 
     131# Local settings forms 
     132adminPageAboutConfig::setForms(); 
     133 
     134# Global settings forms 
     135adminPageAboutConfig::setForms(true); 
     136 
     137# Commons 
     138if (!empty($_GET['upd'])) { 
     139     $_ctx->setAlert(__('Configuration successfully updated')); 
    70140} 
    71  
    72 $part = !empty($_GET['part']) && $_GET['part'] == 'global' ? 'global' : 'local'; 
    73  
    74 function settingLine($id,$s,$ns,$field_name,$strong_label) 
    75 { 
    76      if ($s['type'] == 'boolean') { 
    77           $field = form::combo(array($field_name.'['.$ns.']['.$id.']',$field_name.'_'.$id), 
    78           array(__('yes') => 1, __('no') => 0),$s['value'] ? 1 : 0); 
    79      } else { 
    80           $field = form::field(array($field_name.'['.$ns.']['.$id.']',$field_name.'_'.$id),40,null, 
    81           html::escapeHTML($s['value'])); 
    82      } 
    83       
    84      $slabel = $strong_label ? '<strong>%s</strong>' : '%s'; 
    85       
    86      return 
    87      '<tr>'. 
    88      '<td scope="raw"><label for="s_'.$id.'">'.sprintf($slabel,html::escapeHTML($id)).'</label></td>'. 
    89      '<td>'.$field.'</td>'. 
    90      '<td>'.$s['type'].'</td>'. 
    91      '<td>'.html::escapeHTML($s['label']).'</td>'. 
    92      '</tr>'; 
     141if (!empty($_GET['upda'])) { 
     142     $_ctx->setAlert(__('Settings definition successfully updated')); 
    93143} 
     144$_ctx->default_tab = !empty($_GET['part']) && $_GET['part'] == 'global' ? 'global' : 'local'; 
     145$_ctx->fillPageTitle('about:config'); 
     146$core->tpl->display('@aboutConfig/index.html.twig'); 
    94147?> 
    95 <html> 
    96 <head> 
    97   <title>about:config</title> 
    98   <?php echo dcPage::jsPageTabs($part); ?> 
    99   <style type="text/css"> 
    100   table.settings { border: 1px solid #999; margin-bottom: 2em; } 
    101   table.settings th { background: #f5f5f5; color: #444; padding-top: 0.3em; padding-bottom: 0.3em; } 
    102   p.anchor-nav {float: right; } 
    103   </style> 
    104      <script type="text/javascript"> 
    105      //<![CDATA[ 
    106      $(function() { 
    107           $("#gs_submit").hide(); 
    108           $("#ls_submit").hide(); 
    109           $("#gs_nav").change(function() { 
    110                window.location = $("#gs_nav option:selected").val(); 
    111           }) 
    112           $("#ls_nav").change(function() { 
    113                window.location = $("#ls_nav option:selected").val(); 
    114           }) 
    115      }); 
    116      //]]> 
    117      </script> 
    118 </head> 
    119  
    120 <body> 
    121 <?php 
    122 if (!empty($_GET['upd'])) { 
    123      dcPage::message(__('Configuration successfully updated')); 
    124 } 
    125  
    126 if (!empty($_GET['upda'])) { 
    127      dcPage::message(__('Settings definition successfully updated')); 
    128 } 
    129 ?> 
    130 <h2><?php echo html::escapeHTML($core->blog->name); ?> &rsaquo; <span class="page-title">about:config</span></h2> 
    131  
    132 <div id="local" class="multi-part" title="<?php echo __('blog settings'); ?>"> 
    133  
    134 <?php  
    135 $table_header = '<table class="settings" id="%s"><caption>%s</caption>'. 
    136 '<thead>'. 
    137 '<tr>'."\n". 
    138 '  <th class="nowrap">Setting ID</th>'."\n". 
    139 '  <th>'.__('Value').'</th>'."\n". 
    140 '  <th>'.__('Type').'</th>'."\n". 
    141 '  <th class="maximalx">'.__('Description').'</th>'."\n". 
    142 '</tr>'."\n". 
    143 '</thead>'."\n". 
    144 '<tbody>'; 
    145 $table_footer = '</tbody></table>'; 
    146  
    147 $settings = array(); 
    148 foreach ($core->blog->settings->dumpNamespaces() as $ns => $namespace) { 
    149      foreach ($namespace->dumpSettings() as $k => $v) { 
    150           $settings[$ns][$k] = $v; 
    151      } 
    152 } 
    153 ksort($settings); 
    154 if (count($settings) > 0) { 
    155      $ns_combo = array(); 
    156      foreach ($settings as $ns => $s) { 
    157           $ns_combo[$ns] = '#l_'.$ns; 
    158      } 
    159      echo  
    160           '<form action="plugin.php" method="post">'. 
    161           '<p class="anchor-nav">'. 
    162           '<label for="ls_nav" class="classic">'.__('Goto:').'</label> '.form::combo('ls_nav',$ns_combo). 
    163           ' <input type="submit" value="'.__('Ok').'" id="ls_submit" />'. 
    164           '<input type="hidden" name="p" value="aboutConfig" />'. 
    165           $core->formNonce().'</p></form>'; 
    166 } 
    167 ?> 
    168  
    169 <form action="plugin.php" method="post"> 
    170  
    171 <?php 
    172 foreach ($settings as $ns => $s) 
    173 { 
    174      ksort($s); 
    175      echo sprintf($table_header,'l_'.$ns,$ns); 
    176      foreach ($s as $k => $v) 
    177      { 
    178           echo settingLine($k,$v,$ns,'s',!$v['global']); 
    179      } 
    180      echo $table_footer; 
    181 } 
    182 ?> 
    183  
    184 <p><input type="submit" value="<?php echo __('Save'); ?>" /> 
    185 <input type="hidden" name="p" value="aboutConfig" /> 
    186 <?php echo $core->formNonce(); ?></p> 
    187 </form> 
    188 </div> 
    189  
    190 <div id="global" class="multi-part" title="<?php echo __('global settings'); ?>"> 
    191  
    192 <?php 
    193 $settings = array(); 
    194  
    195 foreach ($core->blog->settings->dumpNamespaces() as $ns => $namespace) { 
    196      foreach ($namespace->dumpGlobalSettings() as $k => $v) { 
    197           $settings[$ns][$k] = $v; 
    198      } 
    199 } 
    200  
    201 ksort($settings); 
    202  
    203 if (count($settings) > 0) { 
    204      $ns_combo = array(); 
    205      foreach ($settings as $ns => $s) { 
    206           $ns_combo[$ns] = '#g_'.$ns; 
    207      } 
    208      echo  
    209           '<form action="plugin.php" method="post">'. 
    210           '<p class="anchor-nav">'. 
    211           '<label for="gs_nav" class="classic">'.__('Goto:').'</label> '.form::combo('gs_nav',$ns_combo). 
    212           ' <input type="submit" value="'.__('Ok').'" id="gs_submit" />'. 
    213           '<input type="hidden" name="p" value="aboutConfig" />'. 
    214           $core->formNonce().'</p></form>'; 
    215 } 
    216 ?> 
    217  
    218 <form action="plugin.php" method="post"> 
    219  
    220 <?php 
    221 foreach ($settings as $ns => $s) 
    222 { 
    223      ksort($s); 
    224      echo sprintf($table_header,'g_'.$ns,$ns); 
    225      foreach ($s as $k => $v) 
    226      { 
    227           echo settingLine($k,$v,$ns,'gs',false); 
    228      } 
    229      echo $table_footer; 
    230 } 
    231 ?> 
    232  
    233 <p><input type="submit" value="<?php echo __('Save'); ?>" /> 
    234 <input type="hidden" name="p" value="aboutConfig" /> 
    235 <?php echo $core->formNonce(); ?></p> 
    236 </form> 
    237 </div> 
    238  
    239 </body> 
    240 </html> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map