| Server IP : 23.111.136.34 / Your IP : 216.73.216.136 Web Server : Apache System : Linux servidor.eurohost.com.br 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : meusitei ( 1072) PHP Version : 5.6.40 Disable Function : show_source, system, shell_exec, passthru, proc_open MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/meusitei/public_html/central/ajuda/ |
Upload File : |
<?php
/******************************************************************************
* Administration Article Move <administration_article_move.php>
*
* Author: Michael McMullen <michael.mcmullen@tutelagesystems.com>
******************************************************************************/
require_once '../System/configuration.php';
$master_template = new MasterTemplate;
$articles = array();
$article_id = intval($_GET['article_id']);
$article_index = 0;
$direction = trim($_GET['direction']);
// Must be logged in
if(! isset($_SESSION['administration']))
{
$this->redirect('login.php');
}
// Load Article
$article_db = DB_DataObject::factory('articles');
$article_db->article_id = $article_id;
if($article_db->find(true))
{
// Load Articles in that Category
$articles_db = DB_DataObject::factory('articles');
$articles_db->article_category_id = $article_db->article_category_id;
$articles_db->orderBy('article_rank');
$articles_db->find();
while($articles_db->fetch())
{
$articles[] = $articles_db->article_id;
if($articles_db->article_id == $article_id)
{
// Save this Index
$article_index = count($articles) - 1;
}
}
}
// Ensure we have some articles to sort
if(! empty($articles))
{
switch(strtolower($direction))
{
case 'down':
$articles = $master_template->MoveArrayDown($articles, $article_index);
break;
case 'up':
$articles = $master_template->MoveArrayUp($articles, $article_index);
break;
default:
$articles = null;
break;
}
}
// Ensure some sorting happened
if(! empty($articles))
{
foreach($articles as $key => $article_id)
{
$article_db = DB_DataObject::factory('articles');
$article_db->article_id = $article_id;
if($article_db->find(true))
{
$article_db->article_rank = $key;
$article_db->update();
}
}
}
// Redirect to Listing
header('location:administration_article.php');
die;