Location: PHPKode > projects > ProNuke. Postnuke To Oracle > postnuke/html/modules/NS-Admin/admin.php
<?php
// File: $Id: admin.php,v 1.19 2001/12/05 16:25:40 eugeniobaldi Exp $ $Name:  $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the Post-Nuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Pascal Riva
//          (extract of admin.php from Francisco Burzi)
// Purpose of file : common admin tools
// ----------------------------------------------------------------------
// Changelog:
// November 14th, 2001:
//      Chris van de Steeg:
//      Added ADOdb support, changed security-schema to userid:cattitle:storyid
// ================================================================================================================
// internal tools
// ================================================================================================================
   function admin_main_automated()
   {
      global $pntable, $dbconn, $myts;

      if (authorised(0, 'Stories::', '::', ACCESS_EDIT)) {
          OpenTable();
          echo  '<center><b>'._AUTOMATEDARTICLES.'</b></center>'."\n"
               .'<br>'."\n";
          $count = 0;
          $column = &$pntable['autonews_column'];
          $query = buildSimpleQuery ('autonews', array ('anid', 'catid', 'aid', 'title', 'time', 'alanguage'), "$column[anid]!='" . language_sql('a','AND') . "'", "$column[time] ASC");
          $result = $dbconn->Execute($query);
          if ($result->EOF)
          {
             echo '<center><i>'._NOAUTOARTICLES.'</i></center>'."\n";
          }
          else
          {
             echo '<table border="1" width="100%">'."\n";
             while(list($anid,$catid,$said,$title,$time,$alanguage) = $result->fields)
             {
				$myts = new MyTextSanitizer; // MyTextSanitizer object
		        $title = $myts->makeTareaData4Show($title);
                echo '<tr>'."\n";
                if ($alanguage == '') $alanguage = 'x_all';
                if ($count == 0) $count = 1;
                $time = ereg_replace(" ", "@", $time);
                if ($catid == 0) {
                   // Default category
                   $cattitle = "";
                } else {
                    $catcolumn = &$pntable['stories_cat_column'];
                    $catquery = buildSimpleQuery('stories_cat', array('title'), "$catcolumn[catid] = $catid");
                    $catresult = $dbconn->Execute($catquery);
                    list($cattitle) = $catresult->fields;
                }
                if (authorised(0, 'Stories::', "$said:$cattitle:", ACCESS_EDIT)) {
                    echo '<td align="right" nowrap>(<a href="admin.php?op=autoEdit&amp;anid='.$anid.'">'._EDIT.'</a>';
                    if (authorised(0, 'Stories::', "$said:$cattitle:", ACCESS_DELETE)) {
                        echo '-<a href="admin.php?op=autoDelete&amp;anid='.$anid.'">'._DELETE.'</a>)'."\n";
                    } else {
                        echo ')';
                    }
                }
                echo  '<td width="100%">&nbsp;'.$title.'&nbsp;</td>'."\n"
                     .'<td align="center">&nbsp;'.language_name($alanguage).'&nbsp;</td>'."\n"
                     .'<td nowrap>&nbsp;'.$time.'&nbsp;</td>'."\n"
                     .'</tr>'."\n";
                $result->MoveNext();
             }
             echo '</table>'."\n";
          }
          CloseTable();
          echo '<br>'."\n";
      }
   }

   function admin_main_article()
   {
      global $pntable,$admart, $dbconn;
      global $bgcolor1;
      global $bgcolor1,$pnconfig;
      
      if (authorised(0, 'Stories::', '::', ACCESS_EDIT)) {
          OpenTable();
          echo  '<center><b>'._LAST.' '.$admart.' '._ARTICLES.'</b></center>'."\n"
               .'<br>'."\n"
               .'<center>'."\n"
               .'<table border="1" width="100%" bgcolor="'.$bgcolor1.'">';
          $storiescolumn = &$pntable['stories_column'];
          $topicscolumn = &$pntable['topics_column'];

//FTO : Test every oracle drivers
    if ( strstr('oci8,oracle,oci8po,oracle_odbc',$pnconfig['dbtype'] ) )
         {
          $myquery = "SELECT $storiescolumn[sid],
                             $storiescolumn[cid],
                             $storiescolumn[aid],
                             $storiescolumn[title],
                             $storiescolumn[time],
                             $storiescolumn[topic],
                             $storiescolumn[informant],
                             $storiescolumn[alanguage],
                             $topicscolumn[topicname]
                             FROM $pntable[stories], $pntable[topics]
                             WHERE  $storiescolumn[topic]=$topicscolumn[topicid](+)
                             ORDER BY  $storiescolumn[time] DESC LIMIT 20";
     }    else   {
          $myquery = "SELECT $storiescolumn[sid],
                             $storiescolumn[cid],
                             $storiescolumn[aid],
                             $storiescolumn[title],
                             $storiescolumn[time],
                             $storiescolumn[topic],
                             $storiescolumn[informant],
                             $storiescolumn[alanguage],
                             $topicscolumn[topicname]
                             FROM $pntable[stories]
                             LEFT JOIN $pntable[topics] ON  $storiescolumn[topic]=$topicscolumn[topicid]
                             ORDER BY  $storiescolumn[time] DESC LIMIT 20";
          }
          $result = $dbconn->Execute($myquery);
          while(list($sid, $cid, $said, $title, $time, $topic, $informant, $alanguage,$topicname) = $result->fields)
          {
             if ($alanguage=='') $alanguage = 'x_all';
             formatTimestamp($time);
             if ($title == "")
                {
                    $title = '- No title -';
                }
			else
				{
				$myts = new MyTextSanitizer; // MyTextSanitizer object
		        $title = $myts->makeTareaData4Show($title);
				}

             echo  '<tr>'."\n"
                  .'<td align="right"><b>'.$sid.'</b></td>'
                  .'<td align="left" width="100%"><a href="modules.php?op=modload&amp;name=News&amp;file=article&amp;sid='.$sid.'">'.$title.'</a></td>'."\n"
                  .'<td align="center">'.language_name($alanguage).'<td>'."\n"
                  .'<td align="right" nowrap>'.$topicname.'</td>'."\n";
             if ($cid == 0) {
                // Default category
                $cattitle = "";
             } else {
                 $catcolumn = &$pntable['stories_cat_column'];
                 $catquery = buildSimpleQuery('stories_cat', array('title'), "$catcolumn[catid] = $cid");
                 $catresult = $dbconn->Execute($catquery);
                 list($cattitle) = $catresult->fields;
             }
             if (authorised(0, 'Stories::', "$said:$cattitle:", ACCESS_EDIT)) {
                 echo '<td align="right" nowrap>(<a href="admin.php?op=EditStory&amp;sid='.$sid.'">'._EDIT.'</a>';
                 if (authorised(0, 'Stories::', "$said:$cattitle:", ACCESS_DELETE)) {
                     echo '-<a href="admin.php?op=RemoveStory&amp;sid='.$sid.'">'._DELETE.'</a>)</td>'."\n";
                 } else {
                     echo ')</td>';
                 }
             } else {
                 echo '<td>&nbsp;</td>';
             }
             echo '</tr>'."\n";
             $result->MoveNext();
          }
          echo '</table>'."\n";
          if (authorised(0, 'Stories::', '::', ACCESS_EDIT)) {
             echo  '<center>'."\n"
                  .'<form action="admin.php" method="post">'."\n"
                  ._STORYID.' : <input type="text" NAME="sid" SIZE="10">'."\n"
                  .'<select name="op">'."\n"
                  .'<option value="EditStory" SELECTED>'._EDIT.'</option>'."\n";
             if (authorised(0, 'Stories::', '::', ACCESS_DELETE)) {
                  echo '<option value="RemoveStory">'._DELETE.'</option>'."\n";
             }
             echo  '</select>'."\n"
                  .'<input type="submit" value="'._GO.'">'."\n"
                  .'</form>'."\n"
                  .'</center>'."\n";
          }
          CloseTable();
          echo '<br>'."\n";
      }
   }
   function admin_main_poll()
   {
      global $pntable, $dbconn;
      $column = &$pntable['poll_desc_column'];
      $myquery = buildSimpleQuery ('poll_desc', array ('polltitle', 'pollid'), language_sql('p'), "$column[pollid] DESC", 1);
      $result = $dbconn->Execute($myquery);
      list($pollTitle, $pid) = $result->fields;
      if (authorised(0, 'Polls::', "$pollTitle::$pid", ACCESS_EDIT)) {
          OpenTable();
          echo "<center>"._CURRENTPOLL.": $pollTitle</center>";
          CloseTable();
          echo "<br>";
      }
   }
// ================================================================================================================
// Function to manage admin op
// ================================================================================================================

// View main admin page
// ====================
   function admin_admin_main($var)
   {
      include 'header.php';
      menu_draw();
      admin_main_automated();
      admin_main_article();
      admin_main_poll();
      include 'footer.php';
   }

?>
Return current item: ProNuke. Postnuke To Oracle