Logo Search packages:      
Sourcecode: dacode version File versions  Download package

index.php3

<?php
/* daCode _ http://www.dacode.org/
 * $Id: index.php3,v 1.22.2.3 2002/09/15 17:31:30 netsabes Exp $
 */

      $topdir = '..';
      require $topdir."/dacode.php3";

      $html = LoadClass('Html');
      $user = LoadClass('User');
      $news = LoadClass('News');
      $sidebox = LoadClass('Sidebox');
      $session = LoadClass('Session');

      // We check if the news exists.
      if (isset($table['news_id'])) {
            $news_id = $table['news_id'];
      }


      if ($op == lecho("Change")) {
            if ($HTTP_POST_VARS['hide_sig']=="on") {
                  $config->hide_sig=1;
            } else {
                  $config->hide_sig=0;
            }

            header("Location: ".
                  $session->newsurls($news_id,$section,$topic,$year,$month,$day,$score));
            exit;
      }

      $db = LoadClass('Db');
      $ret = $db->query("SELECT state FROM news WHERE id='".
            addslashes($news_id)."'");
      if (!$ret)
            return $db->error();
      list($state_of_news) = $db->fetch_array();
      if ($state_of_news != 1) {
            $db->free();
            echo lecho("You can't answer a ghost news.");
            exit;
      }

      // We check if the comment exists.
      if (isset($com_id)) {
            $ret = $db->query("SELECT id FROM comments WHERE id='".
                  addslashes($com_id)."' AND news_id='".addslashes($news_id)."'");
            if (!$ret) return $db->error();
            list($com_id_ok) = $db->fetch_array();
            $db->free();
            if (! $com_id_ok) {
                  echo lecho("To which comment do you want to answer?");
                  exit;
            }
      }


      unset($config->obj['Comments']);
      if ($op == lecho("Reply")) {
            $comments = LoadClass('Comments',1);
            $comments->init($news_id,$com_id);
            echo $html->header(lecho("Submit a comment"));
      } else {
            $comments = LoadClass('Comments');
            echo $html->header(lecho("comments").": ".$news->show_title($news_id));
      }


?>

<table border="0" cellpadding="3" cellspacing="3" width="100%">
<tr><td valign="top" size="100">
<br />

<?php

      echo $sidebox->dacode();
      echo $sidebox->local_links();
      echo $comments->get_hrefs();

?>

</td><td valign=top width="80%">

<?php

      // echo $comments->com_print2($ci);
      if ($op == lecho("Reply")) {
            echo $comments->a_add("",$news_id,$com_id,$table);
            if ($com_id) {
                  /* reply to a comment: we show it. */
                  echo $html->simplebox(
                        "<ul>\n".
                        " <li>\n".
                        "  ".$comments->ac(
                              $comments->comments[0],
                              $comments->comments[0][news_id])."\n".
                        " </li>\n".
                        "</ul>\n");
            } else {
                  /* Reply to a news: we show it. TODO */
            }
      } elseif ($op == lecho("Change")) {
            echo $comments->com_print2("","",$score);
      }

?>

</td>
</tr>
</table>
<br />
<br />

<?php

      echo $html->footer();

?>


Generated by  Doxygen 1.6.0   Back to index