function delete(){
		loadIntClass('sql_query');
		$sql = new Sql_query('comments');
		$array = $sql->query('SELECT * FROM `comments` WHERE `id`=\''.$this->_id.'\'');
		$sql->simpleQuery('DELETE FROM `comments` WHERE `id`=\''.$this->_id.'\'');
		$this->republish($array[0]['Comment']['post_slug']);
		die('SUCCESS');
	}
	function cron_set(){
		loadIntClass('cron_job');
		if(!$this->_publish && $this->_postdate > time()){
			$arr1 = array('time'=>$this->_postdate,'command'=>'republish_post','parameters'=>array($this->_slug));
			$cron1 = new Cron_job($arr1);
		}
		$cache = new Sql_query('posts');
		$cacheNum = $cache->query('SELECT * FROM `posts` WHERE `cachepub`=\'1\'');
		for($i = 0; $i < count($cacheNum); ++$i){
			$arr2 = array('time'=>time(),'command'=>'republish_post','parameters'=>array($cacheNum[$i]['Post']['slug']));
			$cron2 = new Cron_job($arr2);
		}
	}
Exemplo n.º 3
0
	function writeRSS(){
		$rsshead = '<?xml version="1.0" encoding="UTF-8" ?>
					<rss version="2.0">
					<channel>
					<title>'.RSS_TITLE.'</title>
					<description>'.RSS_DESCRIPTION.'</description>
					<language>en-us</language>
					<copyright>Copyright (C) '.date('Y').' '.THIS_DOMAIN.'</copyright>
					<link>http://'.THIS_DOMAIN.'/'.RSS_URI.'</link>
					<lastBuildDate>'.date('D, d M Y H:i:s T').'</lastBuildDate>';
		loadIntClass('sql_query');
		$sql = new Sql_query('posts');
		$postArr = $sql->query('SELECT * FROM `posts` WHERE `publish`=\'1\'');
		$count = count($postArr);
		if($count === 0){
			die('There are no posts');
		}
		reset($postArr);
		$latest =$postArr[0]['Post']['publishdate'];
		$rssbody='';
		for($i = 0; $i < $count;++$i){
			$p = $postArr[$i]['Post'];
			if($p['slug'] === '_index_') $p['slug'] ='';
			$link = 'http://'.THIS_DOMAIN.'/'.($p['category'] !=='none'?$p['category'].'/':'').$p['slug'];
			$rssbody .= '
			<item>
			<title>'.$p['title'].'</title>
			<description>'.$p['description'].'</description>
			<link>'.$link.'</link>
			<guid isPermaLink="true">'.$link.'</guid>
			<pubDate>'.date('D, d M Y H:i:s T',intval($p['publishdate'])).'</pubDate>
			</item>
			';
			if(intval($latest)<intval($p['publishdate'])){
				$latest = $p['publishdate'];
			}
		}
		$rsshead.='
		<pubDate>'.date('D, d M Y H:i:s T',intval($latest)).'</pubDate>';
		$rssbody.='</channel>
			</rss>';
		header("Content-Type: application/rss+xml");
		echo $rsshead,$rssbody;
		exit;
	}
Exemplo n.º 4
0
					';
			switch($comments[$i]['approved']){
				case 'approved':
					$approved+=1;
					break;
				case 'pending':
					$pending+=1;
					break;
				case 'spam':
					$spam+=1;
					break;
			}
		}
$all = $pending + $approved + $spam;
$sql2 = new Sql_query('posts');
$posts = $sql2->query('SELECT * FROM `posts` WHERE `commentbool`=\'1\' OR `pingbool`=\'1\'');
?>
            <p id="para" class="in_main">You may not view all comments. You may view all the comments for a particular posts, or all pending, or spam comments from your entire site.</p>
            <form class="in_main">
            	<select id="posts_select">
                <?
					if(array_key_exists('post',$_GET)){
						echo '<option value="',$_GET['post'],'">',$_GET['post'],'</option>
						<option value="AP">All Pending and Spam</option>';
						for($i = 0; $i < count($posts); ++$i){
							if($posts[$i]['Post']['slug'] !== $_GET['post']){
								echo '<option value="',str_replace('/','_',$posts[$i]['Post']['slug']),'">',$posts[$i]['Post']['slug'],'</option>
								';
							}
						}
					}