Файл: adultscript-2.0.3-pro/files/admin/modules/photo/components/server.php
Строк: 34
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_Admin_photo_server extends VModule_Admin_photo
{
public function __construct()
{
parent::__construct();
}
public function render()
{
$errors = array();
$messages = array();
if (isset($_POST['action'])) {
$action = trim($_POST['action']);
$server_id = (isset($_POST['server_id'])) ? (int) trim($_POST['server_id']) : 0;
if ($server_id) {
if ($action == 'suspend' OR $action == 'activate') {
$status = ($action == 'activate') ? 1 : 0;
$message = ($action == 'activate') ? 'activated' : 'suspended';
$this->db->query("UPDATE #__photo_servers
SET status = ".$status."
WHERE server_id = ".$server_id."
LIMIT 1");
$messages[] = 'Server '.$message.'!';
} elseif ($action == 'delete') {
$this->db->query("DELETE FROM #__photo_servers
WHERE server_id = ".$server_id."
LIMIT 1");
$this->db->query("UPDATE #__photo
SET status = '0'
WHERE server = ".$server_id);
$messages[] = 'Server deleted!';
} else {
$errors[] = 'Invalid action!';
}
} else {
$errors[] = 'Invalid server id or not set!';
}
}
$servers = $this->db->get_rows("SELECT * FROM #__photo_servers ORDER BY last_used DESC");
$tpl = VF::factory('template');
$tpl->menu = 'photo';
$tpl->submenu = 'photo_server';
$tpl->meta_title = 'Admin::Photo::Server::Manage';
$tpl->errors = $errors;
$tpl->messages = $messages;
$tpl->servers = $servers;
$tpl->load(array('header', 'photo_server', 'footer'));
$tpl->display();
}
}