function unpublish(){
		loadIntClass('sql_query');
		$posts = new Sql_query('posts');
		$num =  $posts->numRows('slug',$this->_uri);
		if($num != 0){
			if(file_exists(ROOT.DS.MAIN.DS.'reflex'.DS.'documents'.DS.$this->_loc.'.php') || file_exists(ROOT.DS.MAIN.DS.'reflex'.DS.'documents'.DS.'_categories_'.DS.$this->_loc.'.php')){
				$post_arr = $posts->selectWhere('slug',$this->_uri);
				$post_arr = $post_arr['Post'];
				if($post_arr['category'] == 'none'){
					if(unlink(ROOT.DS.MAIN.DS.'reflex'.DS.'documents'.DS.$this->_loc.'.php')){
						$posts->simpleQuery('UPDATE `posts` SET `publish`=\'0\' WHERE `slug`=\''.$this->_uri.'\'');
						die('yes');
					}
					else{
						die('The server failed to delete the post you selected.');	
					}
				}
				else{
					if(unlink(ROOT.DS.MAIN.DS.'reflex'.DS.'documents'.DS.'_categories_'.DS.$this->_loc.'.php')){
						$posts->simpleQuery('UPDATE `posts` SET `publish`=\'0\' WHERE `slug`=\''.$this->_uri.'\'');
						die('yes');
					}
					else{
						die('The server failed to delete the post you selected.');	
					}
				}
			}
			else{
				$post_arr = $posts->selectWhere('slug',$this->_uri);
				$post_arr = $post_arr['Post'];
				if($post_arr['publish'] == 0){
					die('yes');	
				}
				else{
					$posts->simpleQuery('UPDATE `posts` SET `publish`=\'0\' WHERE `slug`=\''.$this->_uri.'\'');
					die('yes');
				}
				
			}
		}
		else{
			die('The server could not find the post that you selected.');	
		}
	}
Beispiel #2
0
function logout(){
	$pName = hash("sha512",$_COOKIE['username']);
	loadIntClass('sql_query');
	$class = new Sql_query('users');
	$userDb = $class->selectWhere('user',$pName);
	$userDb = $userDb['User'];
	if($pName === $userDb['user']) {
		$class->simpleQuery("UPDATE `users` SET `loggedin`='0', `logtime`='0'' WHERE `user`='".$pName."'");
		$class->disconnect();
		return true;
	}
	else{
		return false;
	}
}
	function template(){
		loadIntClass('sql_query');
		$posts = new Sql_query('posts');
		$num =  $posts->selectWhere('slug',$this->_uri);
		if($num != 0){
			if(file_exists(ROOT.DS.MAIN.DS.'reflex'.DS.'templates'.DS.$this->_template.'.php')){
				$posts->simpleQuery('UPDATE `posts` SET `template`=\''.$this->_template.'\' WHERE `slug`=\''.$this->_uri.'\'');
				die('yes');
			}
			else{
				die('It seems that the template does not exist anymore.');
			}
		}
		else{
			die('The server could not find the post that you selected.');
		}
	}
	function republish() {
		loadIntClass('sql_query');
		$posts = new Sql_query('posts');
		$num =  $posts->numRows('slug',$this->_uri);
		if($num !== 0){
			$post_arr = $posts->selectWhere('slug',$this->_uri);
			$post_arr = $post_arr['Post'];
			$this->_post = $post_arr['post'];
			$this->_title = $post_arr['title'];
			$this->_slug = $post_arr['slug'];
			$this->_description = $post_arr['description'];
			$this->_template = $post_arr['template'];
			$this->_category = $post_arr['category'];
			$this->_author = $post_arr['author'];
			$this->_commentbool = $post_arr['commentbool'];
			$this->_pingbacks = $post_arr['pingbacks'];
			$this->_pingbool = $post_arr['pingbool'];
			$this->_publish = $post_arr['publish'];
			$this->_cachepub = $post_arr['cachepub'];
				
			ob_start();
			require(ROOT.DS.MAIN.DS.'reflex'.DS.'templates'.DS.$this->_template.'.php');
			$html_string = ob_get_clean();
			$html_string = str_replace('<php>','<?php ',$html_string);
			$html_string = str_replace('</php>',' ?>',$html_string);
			
			if($this->_category == 'none'){
				$fileloc = fopen(ROOT.DS.MAIN.DS.'reflex'.DS.'documents'.DS.$this->_slug.'.php', 'w');
				fwrite($fileloc,$html_string);
				fclose($fileloc);
			}
			else{
				$fileloc = fopen(ROOT.DS.MAIN.DS.'reflex'.DS.'documents'.DS.'_categories_'.$this->_category.DS.$this->_slug.'.php', 'w');
				fwrite($fileloc,$html_string);
				fclose($fileloc);	
			}
			$posts->simpleQuery('UPDATE `posts` SET `publish`=\'1\' WHERE `slug`=\''.$this->_slug.'\'');
			die('yes');	
		}
		else{
			die('The server could not find the post that you selected.');
		}
	}
	function delete(){
		loadIntClass('sql_query');
		$posts = new Sql_query('posts');
		$num =  $posts->numRows('slug',$this->_uri);
		if($num !== 0){
			$post_arr = $posts->selectWhere('slug',$this->_uri);
			$post_arr = $post_arr['Post'];
			if($post_arr['category'] == 'none'){
				@unlink(ROOT.DS.MAIN.DS.'reflex'.DS.'documents'.DS.$this->_uri.'.php');
				$posts->simpleQuery('DELETE FROM `posts` WHERE `slug`=\''.$this->_uri.'\'');
				die('yes');
			}
			else{
				@unlink(ROOT.DS.MAIN.DS.'reflex'.DS.'documents'.DS.'_categories_'.DS.$this->_uri.'.php');
				$posts->simpleQuery('DELETE FROM `posts` WHERE `slug`=\''.$this->_uri.'\'');
				die('yes');
			}
		}
		else{
			die('The server could not find the post that you selected.');
		}
	}
Beispiel #6
0
<?php require(ROOT.DS.MAIN.DS.'reflex'.DS.'admin'.DS.'documents'.DS.'headnavfoot'.DS.'header.php');
require(ROOT.DS.MAIN.DS.'config'.DS.'posts.php');
$sql1 = new Sql_query('templates');
$template_arr = $sql1->selectAll();
$sql2 = new Sql_query('categories');
$cat_arr = $sql2->selectAll();
$sql3 = new Sql_query('authors');
$aut_arr = $sql3->selectAll();
if(array_key_exists('edit',$_GET)){
	$slug = $_GET['edit'] !== '_index_' ? str_replace('_','/',$_GET['edit']) : $_GET['edit'];
	if($slug !== ''){
		$sql4 = new Sql_query('posts');
		$post_arr = $sql4->selectWhere('slug',$slug);
		$post_arr = $post_arr['Post'];
	}
}
$post = isset($post_arr) ? true : false;
$cat = '';
if(isset($post_arr) && $post_arr['category'] !== 'none'){
	$slug = explode('/',$slug);
	$cat = $slug[0];
	array_shift($slug);
	$slug = $slug[0];
}
$template_table = '';
$category_table = '';
$author_table = '';
if($post){
	$template_table = '
				<option value="'.$post_arr['template'].'">'.$post_arr['template'].'</option>
				';