рдпрд╣ рд╡рд░реНрдЧ рд╣реА рд╣реИ:
<?php
include_once('mysql.php');
/**
*
* @author Borro <borro@bk.ru>
* @version 0.1a
*
*/
class Article{
/**
* , MySQL
*
* @var MySQL
*/
private $mysql;
/**
*
*
* @param MySQL $mysql
*/
public function __construct($mysql)
{
$this->mysql = $mysql;
}
/**
*
*
* @param string $title
* @param string $text
* @param string $author
* @param string $description
* @param string $keywords
* @param string $notitle
* @return int
*/
public function AddArticle($title, $text, $author, $description, $keywords, $notitle)
{
if ($title != '') {
$title = mysql_escape_string(htmlspecialchars($title));
}
else {
throw new Exception(" ", 201);
}
if ($text != '') {
$text = mysql_escape_string(trim($text));
}
else {
throw new Exception(" ", 202);
}
if ($author != '') {
$author = mysql_escape_string(trim($author));
}
else {
throw new Exception(" ", 203);
}
$description = mysql_escape_string(strip_tags(trim($description)));
$keywords = mysql_escape_string(strip_tags(trim($keywords)));
$notitle = mysql_escape_string($notitle);
$t = $this->mysql->query("INSERT INTO `articles` (title, text, author, description, keywords, make_date, notitle) VALUE('$title', '$text', '$author', '$description', '$keywords', NOW(), '$notitle')");
if ($t == false) {
throw new Exception(mysql_error(), mysql_errno());
}
return $this->mysql->insert_id();
}
/**
*
*
* @param int $id
* @return array
*/
public function ViewArticle($id)
{
$id = intval($id);
$this->mysql->query("SELECT * FROM `articles` WHERE id = $id");
return $this->mysql->fetch_array();
}
/**
*
*
* @return array
*/
public function ViewAllArticles()
{
$this->mysql->query("SELECT * FROM `articles` ORDER BY `edit_date` DESC");
return $this->mysql->result2assoc_array();
}
/**
*
*
* @param int $id
* @param string $title
* @param string $text
* @param string $author
* @param string $description
* @param string $keywords
* @param string $notitle
* @return int
*/
public function EditArticles($id, $title, $text, $author, $description, $keywords, $notitle)
{
if ($id != '') {
$id = intval($id);
}
else {
throw new Exception(" ID", 200);
}
if ($title != '') {
$title = mysql_escape_string(htmlspecialchars($title));
}
else {
throw new Exception(" ", 201);
}
if ($text != '') {
$text = mysql_escape_string(trim($text));
}
else {
throw new Exception(" ", 202);
}
if ($author != '') {
$author = mysql_escape_string(trim($author));
}
else {
throw new Exception(" ", 203);
}
$description = mysql_escape_string(strip_tags(trim($description)));
$keywords = mysql_escape_string(strip_tags(trim($keywords)));
$notitle = mysql_escape_string($notitle);
$this->mysql->query("UPDATE `articles` SET title ='$title', text ='$text', author ='$author', description = '$description', keywords ='$keywords', notitle = '$notitle' WHERE id = $id");
return $id;
}
/**
*
*
* @param int $id
* @return bool
*/
public function DeleteArticle($id)
{
$id = intval($id);
$t = $this->mysql->query("DELETE FROM `articles` WHERE id=$id");
return true;
}
}
?>
рдЙрдкрдпреЛрдЧрдХрд░реНрддрд╛рдУрдВ рдХреЗ рд▓рд┐рдП рдХрд╛рд░реНрдпрд╛рдиреНрд╡рдпрди:
<?php
include_once('config.php');
include_once('class/article.php');
$article = new Article($mysql);
include_once('sbl_top.php');
switch (@$_GET['action']) {
case 'view':
$art = $article->ViewArticle($_GET['id']);
if ($art['notitle']=='yes') {
echo $art['text'];
}
else {
echo " {$art['title']} ".$art['text']." : {$art['author']} : {$art['make_date']} : {$art['edit_date']} ";
}
break;
default:
$array = $article->ViewAllArticles();
echo " : <a href='{$_SERVER['SCRIPT_NAME']}?action=view&id={$art['id']}' style='color:black'>{$art['title']} "
." : ".trim($text[0])."... ";
}
}
echo "
include_once('config.php'); include_once('class/article.php'); $article = new Article($mysql); include_once('sbl_top.php'); switch (@$_GET['action']) { case 'view': $art = $article->ViewArticle($_GET['id']); if ($art['notitle']=='yes') { echo $art['text']; } else { echo " {$art['title']} ".$art['text']." : {$art['author']} : {$art['make_date']} : {$art['edit_date']} "; } break; default: $array = $article->ViewAllArticles(); echo " : <a href='{$_SERVER['SCRIPT_NAME']}?action=view&id={$art['id']}' style='color:black'>{$art['title']} " ." : ".trim($text[0])."... "; } } echo " |
<?php
|
<?php
|
<?php
|
<?php
include_once('config.php');
include_once('class/article.php');
$article = new Article($mysql);
include_once('sbl_top.php');
switch (@$_GET['action']) {
case 'view':
$art = $article->ViewArticle($_GET['id']);
if ($art['notitle']=='yes') {
echo $art['text'];
}
else {
echo " {$art['title']} ".$art['text']." : {$art['author']} : {$art['make_date']} : {$art['edit_date']} ";
}
break;
default:
$array = $article->ViewAllArticles();
echo " : <a href='{$_SERVER['SCRIPT_NAME']}?action=view&id={$art['id']}' style='color:black'>{$art['title']} "
." : ".trim($text[0])."... ";
}
}
echo "
<?php
| <?php
|
<?php
include_once('config.php');
include_once('class/article.php');
$article = new Article($mysql);
include_once('sbl_top.php');
switch (@$_GET['action']) {
case 'view':
$art = $article->ViewArticle($_GET['id']);
if ($art['notitle']=='yes') {
echo $art['text'];
}
else {
echo " {$art['title']} ".$art['text']." : {$art['author']} : {$art['make_date']} : {$art['edit_date']} ";
}
break;
default:
$array = $article->ViewAllArticles();
echo " : <a href='{$_SERVER['SCRIPT_NAME']}?action=view&id={$art['id']}' style='color:black'>{$art['title']} "
." : ".trim($text[0])."... ";
}
}
echo "
<?php
include_once('config.php');
include_once('class/article.php');
$article = new Article($mysql);
include_once('sbl_top.php');
switch (@$_GET['action']) {
case 'view':
$art = $article->ViewArticle($_GET['id']);
if ($art['notitle']=='yes') {
echo $art['text'];
}
else {
echo " {$art['title']} ".$art['text']." : {$art['author']} : {$art['make_date']} : {$art['edit_date']} ";
}
break;
default:
$array = $article->ViewAllArticles();
echo " : <a href='{$_SERVER['SCRIPT_NAME']}?action=view&id={$art['id']}' style='color:black'>{$art['title']} "
." : ".trim($text[0])."... ";
}
}
echo "
<?php
include_once('config.php');
include_once('class/article.php');
$article = new Article($mysql);
include_once('sbl_top.php');
switch (@$_GET['action']) {
case 'view':
$art = $article->ViewArticle($_GET['id']);
if ($art['notitle']=='yes') {
echo $art['text'];
}
else {
echo " {$art['title']} ".$art['text']." : {$art['author']} : {$art['make_date']} : {$art['edit_date']} ";
}
break;
default:
$array = $article->ViewAllArticles();
echo " : <a href='{$_SERVER['SCRIPT_NAME']}?action=view&id={$art['id']}' style='color:black'>{$art['title']} "
." : ".trim($text[0])."... ";
}
}
echo "
<?php
include_once('config.php');
include_once('class/article.php');
$article = new Article($mysql);
include_once('sbl_top.php');
switch (@$_GET['action']) {
case 'view':
$art = $article->ViewArticle($_GET['id']);
if ($art['notitle']=='yes') {
echo $art['text'];
}
else {
echo " {$art['title']} ".$art['text']." : {$art['author']} : {$art['make_date']} : {$art['edit_date']} ";
}
break;
default:
$array = $article->ViewAllArticles();
echo " : <a href='{$_SERVER['SCRIPT_NAME']}?action=view&id={$art['id']}' style='color:black'>{$art['title']} "
." : ".trim($text[0])."... ";
}
}
echo "
<?php
include_once('config.php');
include_once('class/article.php');
$article = new Article($mysql);
include_once('sbl_top.php');
switch (@$_GET['action']) {
case 'view':
$art = $article->ViewArticle($_GET['id']);
if ($art['notitle']=='yes') {
echo $art['text'];
}
else {
echo " {$art['title']} ".$art['text']." : {$art['author']} : {$art['make_date']} : {$art['edit_date']} ";
}
break;
default:
$array = $article->ViewAllArticles();
echo " : <a href='{$_SERVER['SCRIPT_NAME']}?action=view&id={$art['id']}' style='color:black'>{$art['title']} "
." : ".trim($text[0])."... ";
}
}
echo "
";
рддреЛрдбрд╝;
}
рд╢рд╛рдорд┐рд▓ рдХрд░реЗрдВ_рдСрдирд╕ ('sbl_bottom.php');
?>
рд╡реНрдпрд╡рд╕реНрдерд╛рдкрдХ рдХреЗ рд▓рд┐рдП рдХрд╛рд░реНрдпрд╛рдиреНрд╡рдпрди:
<?php
include_once('sbl_top.php');
include_once('../class/article.php');
$article = new Article($mysql);
include_once('../fckeditor/fckeditor.php');
switch (@$_GET['action']) {
case 'view':
$art = $article->ViewArticle($_GET['id']);
if ($art['notitle']=='yes') {
echo $art['text'];
}
else {
echo " {$art['title']} ".$art['text']." : {$art['author']} : {$art['make_date']} : {$art['edit_date']} ";
}
echo "<a href='{$_SERVER['SCRIPT_NAME']}?action=delete&id[]={$art['id']}' style='color:red'>
include_once('sbl_top.php'); include_once('../class/article.php'); $article = new Article($mysql); include_once('../fckeditor/fckeditor.php'); switch (@$_GET['action']) { case 'view': $art = $article->ViewArticle($_GET['id']); if ($art['notitle']=='yes') { echo $art['text']; } else { echo " {$art['title']} ".$art['text']." : {$art['author']} : {$art['make_date']} : {$art['edit_date']} "; } echo "<a href='{$_SERVER['SCRIPT_NAME']}?action=delete&id[]={$art['id']}' style='color:red'> |
<?php
|
<?php
|
<?php
|
<?php
include_once('sbl_top.php');
include_once('../class/article.php');
$article = new Article($mysql);
include_once('../fckeditor/fckeditor.php');
switch (@$_GET['action']) {
case 'view':
$art = $article->ViewArticle($_GET['id']);
if ($art['notitle']=='yes') {
echo $art['text'];
}
else {
echo " {$art['title']} ".$art['text']." : {$art['author']} : {$art['make_date']} : {$art['edit_date']} ";
}
echo "<a href='{$_SERVER['SCRIPT_NAME']}?action=delete&id[]={$art['id']}' style='color:red'>
<?php
include_once('sbl_top.php');
include_once('../class/article.php');
$article = new Article($mysql);
include_once('../fckeditor/fckeditor.php');
switch (@$_GET['action']) {
case 'view':
$art = $article->ViewArticle($_GET['id']);
if ($art['notitle']=='yes') {
echo $art['text'];
}
else {
echo " {$art['title']} ".$art['text']." : {$art['author']} : {$art['make_date']} : {$art['edit_date']} ";
}
echo "<a href='{$_SERVER['SCRIPT_NAME']}?action=delete&id[]={$art['id']}' style='color:red'>
ред "<a href='elling>_SERVER Is'SCRIPT_NAME'-03 h?action=vedit&id=elines$art ['id'-03> рд╢реИрд▓реА = 'рд░рдВрдЧ: рдирд╛рд░рдВрдЧреА'> рд▓реЗрдЦ рд╕рдВрдкрд╛рджрд┐рдд рдХрд░реЗрдВ";
рддреЛрдбрд╝;
рдорд╛рдорд▓рд╛ 'рдирдпрд╛':
$ oFCKeditor = рдирдпрд╛ FCKeditor ('рдкрд╛рда');
$ oFCKeditor-> рдмреЗрд╕рдкрд╛рда = "../fededitor/";
$ oFCKeditor-> рдореВрд▓реНрдп = "рдЯреЗрдХреНрд╕реНрдЯ рджрд░реНрдЬ рдХрд░реЗрдВ";
рдЗрдХреЛ "<form action = '{$ _ SERVER [' SCRIPT_NAME ']}; рдХреНрд░рд┐рдпрд╛ =' рд╡рд┐рдзрд┐ = 'POST'> рдЬреЛрдбрд╝реЗрдВ"
"
рд╢реАрд░реНрд╖рдХ: рдкреЗрдЬ рдХреЗ рд░реВрдк рдореЗрдВ рд╕рд╣реЗрдЬреЗрдВ |