plugins/Newsboy.php
changeset 16 3d96dbb770b5
parent 15 f0cf0b512fbb
child 17 f6edf51a9479
equal deleted inserted replaced
15:f0cf0b512fbb 16:3d96dbb770b5
   426          GROUP BY p.urlname
   426          GROUP BY p.urlname
   427          ORDER BY urlname DESC;');
   427          ORDER BY urlname DESC;');
   428   if ( !$q )
   428   if ( !$q )
   429     $db->_die();
   429     $db->_die();
   430   
   430   
       
   431   $num_articles = intval(getConfig('nb_portal_num_articles', 5));
       
   432   
   431   if ( $row = $db->fetchrow() )
   433   if ( $row = $db->fetchrow() )
   432   {
   434   {
   433     $i = 0;
   435     $i = 0;
   434     do
   436     do
   435     {
   437     {
   436       if ( $i < 5 )
   438       if ( $i < $num_articles )
   437       {
   439       {
   438         $content = $row['page_text'];
   440         $content = $row['page_text'];
   439         
   441         
   440         $trimmed = false;
   442         $trimmed = false;
   441         if ( $pos = strpos($content, '<!--BREAK-->' ) )
   443         if ( $pos = strpos($content, '<!--BREAK-->' ) )
  1099     setConfig('nb_portal_title', $_POST['portal_name']);
  1101     setConfig('nb_portal_title', $_POST['portal_name']);
  1100     if ( isPage($_POST['announce_page']) )
  1102     if ( isPage($_POST['announce_page']) )
  1101       setConfig('nb_announce_page', $_POST['announce_page']);
  1103       setConfig('nb_announce_page', $_POST['announce_page']);
  1102     else
  1104     else
  1103       setConfig('nb_announce_page', '');
  1105       setConfig('nb_announce_page', '');
       
  1106     
       
  1107     $num_articles = intval($_POST['num_articles']);
       
  1108     if ( $num_articles > 0 )
       
  1109       setConfig('nb_portal_num_articles', $num_articles);
       
  1110     
  1104     // Submit
  1111     // Submit
  1105     echo '<div class="info-box">Your changes have been saved.</div>';
  1112     echo '<div class="info-box">Your changes have been saved.</div>';
  1106   }
  1113   }
  1107   echo '<form name="main" action="'.htmlspecialchars(makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module'])).'" method="post">';
  1114   echo '<form name="main" action="'.htmlspecialchars(makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module'])).'" method="post">';
  1108   echo '<div class="tblholder">
  1115   echo '<div class="tblholder">
  1129               <td class="row1">
  1136               <td class="row1">
  1130                 ' . $template->pagename_field('announce_page', htmlspecialchars(getConfig('nb_announce_page'))) . '
  1137                 ' . $template->pagename_field('announce_page', htmlspecialchars(getConfig('nb_announce_page'))) . '
  1131               </td>
  1138               </td>
  1132             </tr>
  1139             </tr>
  1133             <tr>
  1140             <tr>
       
  1141               <td class="row2">
       
  1142                 Number of articles to show on portal:
       
  1143               </td>
       
  1144               <td class="row1">
       
  1145                 <input type="text" name="num_articles" value="' . getConfig('nb_portal_num_articles', '5') . '" size="7" />
       
  1146               </td>
       
  1147             </tr>
       
  1148             <tr>
  1134               <th class="subhead" colspan="2">
  1149               <th class="subhead" colspan="2">
  1135                 <input type="submit" name="submit" value="Save changes" />
  1150                 <input type="submit" name="submit" value="Save changes" />
  1136               </th>
  1151               </th>
  1137             </tr>
  1152             </tr>
  1138           </table>
  1153           </table>