Файл: adultscript-2.0.3-pro/files/admin/modules/photo/components/photo.php
Строк: 43
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_Admin_photo_photo extends VModule_Admin_photo
{
public function __construct()
{
parent::__construct();
}
public function render()
{
$photo_id = (isset($_GET['id'])) ? (int) $_GET['id'] : 0;
$photo = array();
$errors = array();
$messages = array();
$warnings = array();
$this->db->query("SELECT p.photo_id, p.caption, p.ext, p.total_views, p.total_favorites,
p.total_comments, p.rating, p.rated_by, p.status, p.add_date,
p.flagged, p.size, a.album_id, a.title
FROM #__photo AS p
INNER JOIN #__photo_albums AS a ON (a.album_id = p.album_id)
WHERE p.photo_id = ".$photo_id."
LIMIT 1");
if ($this->db->affected_rows()) {
$photo = $this->db->fetch_assoc();
if (isset($_POST['action']) AND isset($_POST['photo_id'])) {
$action = trim($_POST['action']);
if ($action == 'activate' OR $action == 'suspend') {
$status = ($action == 'activate') ? 1 : 0;
$msg = ($action == 'activate') ? 'published' : 'suspended';
$this->db->query("UPDATE #__photo SET status = '".$status."' WHERE photo_id = ".$photo_id." LIMIT 1");
$photo['status'] = $status;
$messages[] = 'Photo '.$msg.'!';
} elseif ($action == 'delete') {
$this->delete_photo($photo_id, (int) $photo['album_id']);
$photo = array();
$messages[] = 'Photo deleted!';
} else {
$errors[] = 'Invalid photo action! What exactly did you click!?';
}
}
}
$tpl = VF::factory('template');
$tpl->menu = 'photo';
$tpl->submenu = 'photo_manage';
$tpl->amenu = 'photo_view';
$tpl->meta_title = 'Admin::Photo::View';
$tpl->errors = $errors;
$tpl->messages = $messages;
$tpl->warnings = $warnings;
$tpl->photo = $photo;
$tpl->photo_id = $photo_id;
$tpl->load(array('header', 'photo_view', 'footer'));
$tpl->display();
}
}