All pastes #164976 Raw Edit

Someone

public php v1 · immutable
·published 2006-09-09 09:20 UTC
rendered paste body
<?php/***	CMS Faethon 2.0	  	This program is free software; you can redistribute it and/or	modify it under the terms of the GNU General Public License	as published by the Free Software Foundation; either version 2	of the License, or (at your option) any later version.	See http://support.cmsfaethon.com/license.txt for more info.		$File: admin/articles/action.php	$Author: Jakub Slová&#269;ek	$Version: 1.1	$Date: 2006/09/07***/if(!isset($_GET['cmd'])) {include('../../lib/functions_SQL.php');include('../../lib/functions_CreatePASSWD.php');include('../../config.php');include('../../lib/admin.ItemMaker.php');}/* ARTICLES */if($_GET['op'] == 'save') {		$item = $_POST['article_title'];	ItemMaker($item);			if ($_GET['subop'] == 'new') {				$result = sql_query("SELECT article FROM ".$SQL_PREFIX."_articles WHERE article = '" . $_POST['article_id'] . "' AND part = '" . $_POST['article_part'] . "';");		$row_array = sql_fetch_row($result);  		  	if(empty($row_array[0])) {			$article_part_next = $_POST['article_part'] + 1;			$article_date = $_POST['article_date_year'].'-'.$_POST['article_date_month'].'-'.$_POST['article_date_day'];						if($_POST['article_comments'] == 'N') {				$comments = N;			} else {				$comments = Y;			}			sql_query("INSERT INTO ".$SQL_PREFIX."_articles (article,img,title,text,type,author,date,annotation,part,column_,sub_column,item,serial,redir,published,comments) VALUES ('" . $_POST['article_id'] . "','" . $_POST['article_img'] . "','" . $_POST['article_title'] . "','" . $_POST['article_text'] . "','" . $_POST['article_type'] . "','" . $_POST['article_author'] . "','" . $article_date . "','" . $_POST['article_annotation'] . "','" . $_POST['article_part'] . "','" . $_POST['article_column'] . "','" . $_POST['article_subcolumn'] . "','" . $item . "','" . $_POST['article_serial'] . "','" . $_POST['article_url'] . "','saved','" . $comments . "');");						if(!empty($_POST['article_url'])) {				header('Location: ../?cmd=articles.index&r=1');				} else {		  	header('Location: ../?cmd=articles.index&r=2&article_id='. $_POST['article_id'] .'&article_next_part='. $article_part_next);				}					} else {			header('Location: ../?cmd=articles.index&r=3');			}	}	if ($_GET['subop'] == 'edit') {				if($_POST['article_comments'] == 'N') {			$comments = N;		} else {			$comments = Y;		}				sql_query("UPDATE ".$SQL_PREFIX."_articles SET text='" . $_POST['article_text'] . "' WHERE article='" . $_GET[article_id] . "' AND part='".$_GET['part']."';");		sql_query("UPDATE ".$SQL_PREFIX."_articles SET title='" . $_POST['article_title'] . "' WHERE article='" . $_GET[article_id] . "' AND part='".$_GET['part']."'  ;");		sql_query("UPDATE ".$SQL_PREFIX."_articles SET annotation='" . $_POST['article_annotation'] . "' WHERE article='" . $_GET[article_id] . "' AND part='".$_GET['part']."';");		sql_query("UPDATE ".$SQL_PREFIX."_articles SET img='" . $_POST['article_img'] . "' WHERE article='" . $_GET[article_id] . "' AND part='".$_GET['part']."';");		sql_query("UPDATE ".$SQL_PREFIX."_articles SET part='" . $_POST['article_part'] . "' WHERE article='" . $_GET[article_id] . "' AND part='".$_GET['part']."';");		sql_query("UPDATE ".$SQL_PREFIX."_articles SET author='" . $_POST['article_author'] . "' WHERE article='" . $_GET[article_id] . "' AND part='".$_GET['part']."';");		sql_query("UPDATE ".$SQL_PREFIX."_articles SET column_='" . $_POST['article_column'] . "' WHERE article='" . $_GET[article_id] . "' AND part='".$_GET['part']."';");		sql_query("UPDATE ".$SQL_PREFIX."_articles SET sub_column='" . $_POST['article_subcolumn'] . "' WHERE article='" . $_GET[article_id] . "' AND part='".$_GET['part']."';");		sql_query("UPDATE ".$SQL_PREFIX."_articles SET date='" . $_POST['article_date'] . "' WHERE article='" . $_GET[article_id] . "' AND part='".$_GET['part']."';");		sql_query("UPDATE ".$SQL_PREFIX."_articles SET item='" . $item . "' WHERE article='" . $_GET[article_id] . "' AND part='".$_GET['part']."';");		sql_query("UPDATE ".$SQL_PREFIX."_articles SET serial='" . $_POST['article_serial'] . "' WHERE article='" . $_GET[article_id] . "' AND part='".$_GET['part']."';");		sql_query("UPDATE ".$SQL_PREFIX."_articles SET type='" . $_POST['article_type'] . "' WHERE article='" . $_GET[article_id] . "' AND part='".$_GET['part']."';");		sql_query("UPDATE ".$SQL_PREFIX."_articles SET redir='" . $_POST['article_url'] . "' WHERE article='" . $_GET[article_id] . "' AND part='".$_GET['part']."';");		sql_query("UPDATE ".$SQL_PREFIX."_articles SET comments='" . $comments . "' WHERE article='" . $_GET[article_id] . "' AND part='".$_GET['part']."';");		header('Location: ../?cmd=articles.index&r=4');					}}elseif($_GET['op'] == 'delete') {		if($_GET['conf'] == 0) {		$result=sql_query("SELECT title FROM ".$SQL_PREFIX."_articles WHERE article = '".$_GET['article']."'");		$article = sql_fetch_object($result);				if($_GET['part'] == 1) {	  	echo('<div class="query">'. $lang['query_delete_article'] .' <strong>#id '.$_GET['article'].': '. $article->title .'</strong>?');		} else {			$result=sql_query("SELECT title FROM ".$SQL_PREFIX."_articles WHERE article = '".$_GET['article']."' AND part = '".$_GET['part']."'");			$article_part = sql_fetch_object($result);						echo('<div class="query">'. $lang['query_delete_article_part'] .' <strong>#id '.$_GET['article'].': '. $article->title .'</strong>?');				}	  echo('<br /><button onclick="window.location.href=\'articles/action.php?op=delete&amp;conf=1&amp;article='.$_GET['article'].'&part='.$_GET['part'].'\'">'. $lang['yes'] .'</button><button onclick="history.go(-1)">'. $lang['no'] .'</button></div>');	  	}	elseif($_GET['conf'] == 1) {		sql_query("DELETE FROM ".$SQL_PREFIX."_articles WHERE article = '" . $_GET['article']  . "' AND part = '".$_GET['part']."' ");		header('Location: ../?cmd=articles.index&r=5');		}}elseif($_GET['op'] == 'get-to-publish') {		$datetime_now = date(Y.'-'.m.'-'.d.' '.H.':'.i.':'.s);	$result=sql_query("SELECT article, part FROM ".$SQL_PREFIX."_articles WHERE article = '".$_GET['id']."'");	$total_result=sql_num_rows($result);	    	for($i=0;$i<0;$i++) { $main_row_array = sql_fetch_row($result); }	    	for($i=0;($i<(2147)) && ($i<$total_result);$i++) {		$main_row_array = sql_fetch_row($result);	    		$pub_article[article]	  	= $main_row_array[0];		$pub_article[part]     		= $main_row_array[1];	      		sql_query("UPDATE ".$SQL_PREFIX."_articles SET published = 'no' WHERE article='" . $_GET['id'] . "' and part='".$pub_article[part]."';");		}	header('Location: ../?cmd=articles.index&r=9');		}elseif($_GET['op'] == 'publish') {		$datetime_now = date(Y.'-'.m.'-'.d.' '.H.':'.i.':'.s);	$result=sql_query("SELECT article, part FROM ".$SQL_PREFIX."_articles WHERE article = '".$_GET['id']."'");	$total_result=sql_num_rows($result);	    	for($i=0;$i<0;$i++) { $main_row_array = sql_fetch_row($result); }	    	for($i=0;($i<(2147)) && ($i<$total_result);$i++) {		$main_row_array = sql_fetch_row($result);	    		$pub_article[article]	  	= $main_row_array[0];		$pub_article[part]     		= $main_row_array[1];	      		sql_query("UPDATE ".$SQL_PREFIX."_articles SET published = 'yes' WHERE article='" . $_GET['id'] . "' and part='".$pub_article[part]."';");		sql_query("UPDATE ".$SQL_PREFIX."_articles SET date = '". $datetime_now ."' WHERE article='" . $_GET['id'] . "' and part='".$pub_article[part]."';");		}	header('Location: ../?cmd=articles.index&r=6');		}elseif($_GET['op'] == 'pull:back') {	$result=sql_query("SELECT article, part FROM ".$SQL_PREFIX."_articles WHERE article = '".$_GET['id']."'");	$total_result=sql_num_rows($result);	    		for($i=0;$i<0;$i++) { $main_row_array = sql_fetch_row($result); }	    		for($i=0;($i<(2147)) && ($i<$total_result);$i++) {			$main_row_array = sql_fetch_row($result);	    			$pub_article[article]	  	= $main_row_array[0];			$pub_article[part]     		= $main_row_array[1];	      			sql_query("UPDATE ".$SQL_PREFIX."_articles SET published = 'no' WHERE article='" . $_GET['id'] . "' and part='".$pub_article[part]."';");		}	header('Location: ../?cmd=articles.index&r=7');		}elseif($_GET['op'] == 'cron') {		$result=sql_query("SELECT article, part FROM ".$SQL_PREFIX."_articles WHERE article = '".$_GET['id']."'");	$total_result=sql_num_rows($result);	    	for($i=0;$i<0;$i++) { $main_row_array = sql_fetch_row($result); }	    	for($i=0;$i<$total_result;$i++) {		$main_row_array = sql_fetch_row($result);	    		$pub_article[article]	  	= $main_row_array[0];		$pub_article[part]     		= $main_row_array[1];	      		sql_query("UPDATE ".$SQL_PREFIX."_articles SET published = 'cron' WHERE article='" . $_GET['id'] . "' and part='".$pub_article[part]."';");	}	header('Location: ../?cmd=articles.index&r=8');		}/* ARTICLES COLUMNS */if($_GET['op'] == 'save_column') {	$item = $_POST['column_title'];	ItemMaker($item);		if($_GET['subop'] == "new") {		$result = sql_query("INSERT INTO ".$SQL_PREFIX."_articles_column (id,title,address) VALUES ('" . $_POST['column_id'] . "','" . $_POST['column_title'] . "','" . $item . "');");			if($result) {				header('Location: ../?cmd=articles.columns.index&r=1');				}	}		if($_GET['subop'] == "edit") {				sql_query("update ".$SQL_PREFIX."_articles_column set title='" . $_POST['column_title'] . "' where id='" . $_POST['column_id'] . "';");		sql_query("update ".$SQL_PREFIX."_articles_column set address='" . $column_item . "' where id='" . $_POST['column_id'] . "';");			header('Location: ../?cmd=articles.columns.index&r=2');		}	}elseif($_GET['op'] == 'delete_column') {	if($_GET['conf'] == 0) {			$result=sql_query("SELECT title FROM ".$SQL_PREFIX."_articles_column WHERE id = '".$_GET['id']."'");		$column = sql_fetch_object($result);				echo('<div class="query">'. $lang['query_delete_column'] .' <strong>#id '.$_GET['id'].': '. $column->title .'</strong>?');		echo('<br /><button onclick="window.location.href=\'articles/action.php?op=delete_column&amp;conf=1&amp;id='.$_GET['id'].'\'">'. $lang['yes'] .'</button><button onclick="history.go(-1)">'. $lang['no'] .'</button></div>');			} 	elseif($_GET['conf'] == 1) {		$result = sql_query("DELETE FROM ".$SQL_PREFIX."_articles_column WHERE id = '" . $_GET['id']  . "'");		if($result) {			header('Location: ../?cmd=articles.columns.index&r=3');			} 	}}/* ARTICLES SERIALS */if($_GET['op'] == 'save_serial') {		$item = $_POST['serial_title'];	ItemMaker($item);	if ($_GET['subop'] == "new") {		$result = sql_query("INSERT INTO ".$SQL_PREFIX."_articles_serials (id,title,item) VALUES ('" . $_POST['serial_id'] . "','" . $_POST['serial_title'] . "','" . $item . "');");		if($result) {			header('Location: ../?cmd=articles.serials.index&r=1');			} else {			echo('error');		}	}		if ($_GET['subop'] == "edit") {				sql_query("update ".$SQL_PREFIX."_articles_serials  set title='" . $_POST['serial_title'] . "' where id='" . $_POST['serial_id'] . "';");		sql_query("update ".$SQL_PREFIX."_articles_serials  set item='" . $serial_item . "' where id='" . $_POST['serial_id'] . "';");		header('Location: ../?cmd=articles.serials.index&r=2');		}	}elseif($_GET['op'] == 'delete_serial') {		if($_GET['conf'] == 0) {				$result=sql_query("SELECT title FROM ".$SQL_PREFIX."_articles_serials WHERE id = '".$_GET['id']."'");		$serial = sql_fetch_object($result);				echo('<div class="query">'. $lang['query_delete_serial'] .' <strong>#id '.$_GET['id'].': '. $serial->title .'</strong>?');		echo('<br /><button onclick="window.location.href=\'articles/action.php?op=delete_serial&amp;conf=1&amp;id='.$_GET['id'].'\'">'. $lang['yes'] .'</button><button onclick="history.go(-1)">'. $lang['no'] .'</button></div>');			} 	elseif($_GET['conf'] == 1) {		$result = sql_query("DELETE FROM ".$SQL_PREFIX."_articles_serials WHERE id = '" . $_GET['id']  . "'");		if($result) {			header('Location: ../?cmd=articles.serials.index&r=3');			} else {			echo('error');		}	}	}/* ARTICLES SUBCOLUMNS */if($_GET['op'] == 'save_subcolumn') {		$item = $_POST['subcolumn_title'];	ItemMaker($item);		if ($_GET['subop'] == "new") {		$result = sql_query("INSERT INTO ".$SQL_PREFIX."_articles_subcolumn (id,title,over_column,address) VALUES ('" . $_POST['subcolumn_id'] . "','" . $_POST['subcolumn_title'] . "','" . $_POST['subcolumn_over'] . "','" . $item . "');");			if($result) {				header('Location: ../?cmd=articles.subcolumns.index&r=1');				} else {				echo('error');			}		}		if ($_GET['subop'] == "edit") {				sql_query("update ".$SQL_PREFIX."_articles_subcolumn set title='" . $_POST['subcolumn_title'] . "' where id='" . $_POST['subcolumn_id'] . "';");		sql_query("update ".$SQL_PREFIX."_articles_subcolumn set over_column='" . $_POST['subcolumn_over'] . "' where id='" . $_POST['subcolumn_id'] . "';");		sql_query("update ".$SQL_PREFIX."_articles_subcolumn set address='" . $subcolumn_address . "' where id='" . $_POST['subcolumn_id'] . "';");			header('Location: ../?cmd=articles.subcolumns.index&r=2');		}	}elseif($_GET['op'] == 'delete_subcolumn') {		if($_GET['conf'] == 0) {				$result=sql_query("SELECT title FROM ".$SQL_PREFIX."_articles_subcolumn WHERE id = '".$_GET['id']."'");		$subcolumn = sql_fetch_object($result);				echo('<div class="query">'. $lang['query_delete_subcolumn'] .' <strong>#id '.$_GET['id'].': '. $subcolumn->title .'</strong>?');		echo('<br /><button onclick="window.location.href=\'articles/action.php?op=delete_subcolumn&amp;conf=1&amp;id='.$_GET['id'].'\'">'. $lang['yes'] .'</button><button onclick="history.go(-1)">'. $lang['no'] .'</button></div>');			} 	elseif($_GET['conf'] == 1) {		$result = sql_query("DELETE FROM ".$SQL_PREFIX."_articles_subcolumn WHERE id = '" . $_GET['id']  . "'");		if($result) {			header('Location: ../?cmd=articles.subcolumns.index&r=3');			} else {			echo('error');		}	}	}/* ARTICLES TYPES */if($_GET['op'] == 'save_types') {		if ($_GET['subop'] == "new") {				$result = sql_query("INSERT INTO ".$SQL_PREFIX."_articles_types (id,type) VALUES ('" . $_POST['type_id'] . "','" . $_POST['type_title'] . "');");			if($result) {				header('Location: ../?cmd=articles.types.index&r=1');				} else {				echo('error');			}	}		if ($_GET['subop'] == "edit") {				sql_query("UPDATE ".$SQL_PREFIX."_articles_types SET type='" . $_POST['type_title'] . "' WHERE id='" . $_POST['type_id'] . "';");		header('Location: ../?cmd=articles.types.index&r=2');	}}elseif($_GET['op'] == 'delete_types') {		if($_GET['conf'] == 0) {						$result=sql_query("SELECT type FROM ".$SQL_PREFIX."_articles_types WHERE id = '".$_GET['id']."'");		$type = sql_fetch_object($result);				echo('<div class="query">'. $lang['query_delete_article_type'] .' <strong>#id '.$_GET['id'].': '. $type->type .'</strong>?');		echo('<br /><button onclick="window.location.href=\'articles/action.php?op=delete_types&amp;conf=1&amp;id='.$_GET['id'].'\'">'. $lang['yes'] .'</button><button onclick="history.go(-1)">'. $lang['no'] .'</button></div>');			} 	elseif($_GET['conf'] == 1) {		$result = sql_query("DELETE FROM ".$SQL_PREFIX."_articles_types WHERE id = '" . $_GET['id']  . "'");			if($result) {				header('Location: ../?cmd=articles.types.index&r=3');				} else {				echo('error');			}	}	}?>