Login   Register  
PHP Classes
elePHPant
Icontem

File: comment.php4

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Matthias Richter  >  phpMyCoCo  >  comment.php4  >  Download  
File: comment.php4
Role: ???
Content type: text/plain
Description: comment mainfile
Class: phpMyCoCo
Author: By
Last change:
Date: 2001-03-11 13:55
Size: 5,054 bytes
 

Contents

Class file image Download
<?php 
if(@mysql_connect("139.18.184.107","matthias","abraxas"))
{
  $COCOPATH="/homepages/33/d17681433/htdocs/public/phpmycoco/include";
  if(!include
    ("$COCOPATH/coco.main.php4")) 
  {echo "Cannot include coco!\n";} ?>
<?php

  global $COCO_CONF_VARS;

  $coco = new phpMyCoCo;
  $coco -> init();
  
  // read comments
  if($coco -> httpgetvars[action] == "read")
  {
    include("$COCOPATH/coco.read.head.php4");
    $coco -> cocohtml -> showPageDescription
      ($coco -> cocodb, $coco->httpgetvars[pgid]);
    $coco -> cocohtml -> showComments 
      ($coco -> cocodb, $coco -> httpgetvars[pgid]);
    include("$COCOPATH/coco.read.foot.php4");
    exit;
  }
  
  // write a comment
  if($coco -> httpgetvars[action] == "write")
  {
    include("$COCOPATH/coco.read.head.php4");
    $coco -> cocohtml -> showPageDescription
      ($coco -> cocodb, $coco->httpgetvars[pgid]);
    if($coco -> httpgetvars[paid] > 0)
    {
      $coco -> cocohtml -> showComment 
        ($coco -> cocodb, $coco -> httpgetvars[paid]);
    }
    $coco -> cocohtml -> showCommentInput
      ($coco -> httpgetvars[pgid], $coco -> httpgetvars[paid]);
    include("$COCOPATH/coco.read.foot.php4");
    exit;
  }

  // input comment into database
  if($coco -> httpgetvars[action] == "input")
  {
    if($coco -> cococommenter -> enterComment
      (  $coco -> cocodb,
         $coco -> httpgetvars[pgid],
	 $coco -> httpgetvars[paid],
	 $coco -> cocolog -> accessid))
    {
      header ("Location: $COCO_CONF_VARS[COMMENT]?" 
        . "action=read&pgid=" . $coco->httpgetvars[pgid]);
    } else {
      include("$COCOPATH/coco.read.head.php4");
      $coco -> cocohtml -> showPageDescription
        ($coco -> cocodb, $coco->httpgetvars[pgid]);
      if($coco -> httpgetvars[paid] > 0)
      {
        $coco -> cocohtml -> showComment 
          ($coco -> cocodb, $coco -> httpgetvars[paid]);
      }
      $coco -> cocohtml -> showErrorMessage
        ($coco -> cococommenter -> errors);
      $coco -> cocohtml -> showCommentInput
        ($coco -> httpgetvars[pgid], $coco -> httpgetvars[paid]);
      include("$COCOPATH/coco.read.foot.php4");
    }
    exit;
  }
  
  // edit a comment
  if($coco -> httpgetvars[action] == "edit")
  {
    if(isset($HTTP_POST_VARS[password]))
    {
      if(!empty($HTTP_POST_VARS[password]) && 
        $HTTP_POST_VARS[password] == $COCO_CONF_VARS[PASSWORD])
      {
        if(isset($HTTP_POST_VARS[drop]))
	{
          if($coco -> dropComment
	    ( $coco -> cocodb, 
	      $coco -> httpgetvars[cid], 
	      $coco -> httpgetvars[pgid] ))
	  {
            header ("Location: $COCO_CONF_VARS[COMMENT]?" 
              . "action=read&pgid=" . $coco->httpgetvars[pgid]);
	  }
	} else {
          $coco -> updateComment
	    ( $coco -> cocodb, 
	      $coco -> httpgetvars[cid], 
	      $coco -> httpgetvars[pgid]);
          header ("Location: $COCO_CONF_VARS[COMMENT]?" 
            . "action=read&pgid=" .  $coco->httpgetvars[pgid]);
	}
      } else {
        include("$COCOPATH/coco.read.head.php4");
        $coco -> cocohtml -> showErrorMessage
          ($COCO_STRINGS[WRONGPASSWORD]);
        $coco -> cocohtml -> showEditCommentForm
          ( $coco -> cocodb, 
	    $coco -> httpgetvars[cid],
	    $coco -> httpgetvars[pgid]);
        include("$COCOPATH/coco.read.foot.php4");
      }
    } else {
      include("$COCOPATH/coco.read.head.php4");
      $coco -> cocohtml -> showEditCommentForm
        ( $coco -> cocodb, 
	  $coco -> httpgetvars[cid],
	  $coco -> httpgetvars[pgid]);
      include("$COCOPATH/coco.read.foot.php4");
    }
    exit;
  }
  
  // add page description
  if($coco -> httpgetvars[action] == "addesc")
  {
    if(isset($HTTP_POST_VARS[password]))
    {
      if(!empty($HTTP_POST_VARS[password]) && 
        $HTTP_POST_VARS[password] == $COCO_CONF_VARS[PASSWORD])
      {
        if($coco -> insertDescription
	  ( $coco -> cocodb, 
	    $coco -> httpgetvars[pgid], 
	    $HTTP_POST_VARS[description]))
	{
          header ("Location: $COCO_CONF_VARS[COMMENT]?" 
            . "action=read&pgid=" . $coco->httpgetvars[pgid]);
	}
      } else {
      include("$COCOPATH/coco.read.head.php4");
      $coco -> cocohtml -> showErrorMessage
        ($COCO_STRINGS[WRONGPASSWORD]);
      $coco -> cocohtml -> showPageDescInput
        ($coco -> cocodb, $coco -> httpgetvars[pgid]);
      include("$COCOPATH/coco.read.foot.php4");
      }
    } else {
      include("$COCOPATH/coco.read.head.php4");
      $coco -> cocohtml -> showPageDescInput
        ($coco -> cocodb, $coco -> httpgetvars[pgid]);
      include("$COCOPATH/coco.read.foot.php4");
    }
    exit;
  }
} else {
  echo "Oops, die Verbindung zur Datenbank ist verloren gegangen. Das bedeutet wahrscheinlich, dass dass der Datenbankrechner entweder runtergefahren wurde (wenn es jetzt Schlafenszeit ist) oder dass unser Netz mal wieder h&auml;ngt. Sorry for the inconvenience.";
}
?>