Well,
Short introduction:
class PostColumn extends PostArticle
(as well as class PostNews extends PostArticle)
The difference is that different subclasses of PostArticle call super in their constructor with different Article type, i.e. PostColumn calls super in it's constructor with an instance of ColumnArticle while PostNews initializes super with NewsArticle.
All processing happens in PostArticle while Article itself (extended by either NewsArticle or ColumnArticle) handles storage in database, retrieval from DB etc.
Now the script itself:
<?php
#
$Id: PostArticle.php3,v 1.13 2000/11/23 15:17:39 star Exp $
#
require_once ('DB.php3');
require_once ('UserInfo.php3');
require_once ('Article.php3');
class PostArticle {
var $user, $date, $time, $article;
var $form_action, $self, $title, $body;
var $connection, $userInfo;
function PostArticle (
$connection
,$article
) {
$this->user = getenv("REMOTE_USER");
$this->article = $article;
$this->userInfo = new UserInfo($connection, $this->user);
$this->connection = $connection;
}
function processRequest() {
$this->self = $GLOBALS["PHP_SELF"];
$this->article_id = $GLOBALS["article_id"];
$this->title = stripslashes($GLOBALS["title"]);
$this->body = stripslashes($GLOBALS["body"]);
$this->form_action = $GLOBALS["form_action"];
#echo "Action:" . $this->form_action . "<BR>";
#echo "Method:" . $GLOBALS['REQUEST_METHOD'] . "<BR>";
#echo '<HR>';
switch($this->form_action) {
case 'create' :
$this->create();
break;
case 'edit' :
$this->edit();
break;
case 'Preview' :
$this->preview();
break;
case 'Submit' :
$this->submit();
break;
default :
$this->blank();
break;
}
}
...
Sometimes depending on content of posted form Preview and Submit never reached and default action is performed. It happens in rare cases and usually when content of form is not entered directly in browser but rather copied say from MS Word. I do not face such problems personally but users of our web-site do.
If required I can post the whole script.
Sergey