function __destruct(){ loadIntClass('sql_query'); $Aut = new Sql_query('authors'); $aut_arr = $Aut->selectAll(); for($i=0; $i < count($aut_arr); ++$i){ if($this->_author === $aut_arr[$i]['Author']['author']){ die('This author already exists. If they are not showing up in your slection menu check the documentation for add_new_author.'); } } $Aut->simpleQuery('INSERT INTO `authors` (author) VALUES(\''.$this->_author.'\')'); die('yes'); }
function __destruct(){ loadIntClass('sql_query'); $Cat = new Sql_query('categories'); $cat_arr = $Cat->selectAll(); for($i=0; $i < count($cat_arr); ++$i){ if($this->_category === $cat_arr[$i]['Categorie']['category']){ die('This category already exists. If it is not showing up in your slection menu check the documentation for add_new_category.'); } } if(is_dir(ROOT.DS.MAIN.DS.'reflex'.DS.'documents'.DS.'_categories_'.DS.$this->_category)){ die('This category already exists. If it is not showing up in your slection menu check the documentation for add_new_category.'); } $Cat->simpleQuery('INSERT INTO `categories` (category) VALUES(\''.$this->_category.'\')'); $Cat->disconnect(); if(!mkdir(ROOT.DS.MAIN.DS.'reflex'.DS.'documents'.DS.'_categories_'.DS.$this->_category)){ die('The server failed to write the folder. Check the documentation for add_new_category.'); } die('yes'); }
function session_check() { if(array_key_exists('username', $_COOKIE)){ loadIntClass('sql_query'); $pName = hash("sha512",$_COOKIE['username']); $sql = new Sql_query('users'); $thisDB = $sql->selectAll(); $userexists = false; $int = 0; for($i = 0; $i<count($thisDB); ++$i){ if($pName === $thisDB[$i]['User']['user']) $userexists = true; $int = $i; } if($userexists) { if(intval($thisDB[$int]['User']['loggedin'])===1) { if(intval($thisDB[$int]['User']['logtime'])>time()){ return true; } else{ $sql->simpleQuery("UPDATE `users` SET `loggedin`='0', `logtime`='0'' WHERE `user`='".$pName."'"); $sql->disconnect(); return false; } } else{ $sql->simpleQuery("UPDATE `users` SET `logtime`='0' WHERE `user`='".$pName."'"); $sql->disconnect(); return false; } } else{ setcookie('username',$_COOKIE['username'], time()-60*60*24); return false; } } else{ return false; } }
function session_create(){ if(array_key_exists('username', $_POST) && array_key_exists('password', $_POST)){ $pName = hash("sha512",$_POST['username']); $pPass = hash("sha512",$_POST['password']); loadIntClass('sql_query'); $sql = new Sql_query('users'); $thisDB = $sql->selectAll(); $userexists = false; $int = 0; for($i = 0; $i<count($thisDB); ++$i){ if($pName === $thisDB[$i]['User']['user']) $userexists = true; $int = $i; } if($userexists){ if($thisDB[$int]['User']['password'] === $pPass){ if(!array_key_exists('username', $_COOKIE)){ //One year setcookie('username',$_POST['username'],time()+60*60*24*365,'/'); } $time = time()+60*60; $sql->simpleQuery("UPDATE `users` SET `loggedin`='1', `logtime`='".$time."' WHERE `user`='".$pName."'"); $sql->disconnect(); return true; } else{ return false; } } else{ return false; } } else{ return false; } }
<?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'); require(ROOT.DS.MAIN.DS.'config'.DS.'comments.php'); require(ROOT.DS.MAIN.DS.'config'.DS.'rss.php'); loadIntClass('sql_query'); $sql1 = new Sql_query('templates'); $templates = $sql1->selectAll(); $sql2 = new Sql_query('categories'); $categories = $sql2->selectAll(); $sql3 = new Sql_query('authors'); $authors = $sql3->selectAll(); $moderationStr = ''; for($i = 0; $i < count($moderate); ++$i){ if($i !== 0 ) $moderationStr .= ', '; $moderationStr .= $moderate[$i]; } $spamStr = ''; for($i = 0; $i < count($spam); ++$i){ if($i !== 0 ) $spamStr .= ', '; $spamStr .= $spam[$i]; } $opt_temp = ' <option value="'.DEFAULT_TEMPLATE.'">'.DEFAULT_TEMPLATE.'</option> '; $opt_cat = ' <option value="'.DEFAULT_CATEGORY.'">'.DEFAULT_CATEGORY.'</option> '; $opt_aut = ' <option value="'.DEFAULT_AUTHOR.'">'.DEFAULT_AUTHOR.'</option> '; for($i = 0; $i < count($templates); ++$i){
<?php require(ROOT.DS.MAIN.DS.'reflex'.DS.'admin'.DS.'documents'.DS.'headnavfoot'.DS.'header.php'); $sql_temp = new Sql_query('templates'); $template_arr = $sql_temp->selectAll(); $temp_table = ''; for($i=0; $i < count($template_arr); ++$i){ $value = $template_arr[$i]['Template']; $temp_table .= ' <tr id="'.$value['name'].'"> <td>'.$value['name'].'</td> <td class="date">'.date('m/d/Y',intval($value['date'])).'</td> </tr>'; } ?> <p class="in_main">All you need to do, in order to add a new template, is to upload the file from your computer, and add the relevant media files later. When you upload a new template the file name will be the name of the template. If you would like to replace a template, simply upload a file of the same name.</p><br /> <form id="add_temp"> <div id="swfupload-control"></div> <input type="button" class="button" id="new_temp" /> </form> <table id="templates_table" class="tablesorter"> <thead> <tr> <th>Name</th> <th>Date Last Modified</th> </tr> </thead> <tbody id="table_body"> <? echo $temp_table;?> </tbody> </table> <? require(ROOT.DS.MAIN.DS.'reflex'.DS.'admin'.DS.'documents'.DS.'headnavfoot'.DS.'footer.php');?> <script type="text/javascript" src="scripts/admin/swfupload.js"></script>
<?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> ';