<?php
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2007                                            */
/* http://www.php-maximus.org                                           */
/* dev@php-maximus.org                                                  */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
/* Portage Coppermine Photo Gallery                                     */
/************************************************************************/
defined('MAXIMUS') or require_once("mainfile.php");

if ( !defined('ADMIN_ALLOW') ) {
	redirect_url('modules.php?name=Coppermine');
}

define('IN_COPPERMINE', true);
define('EDITPICS_PHP', true);
include("modules/Coppermine/include/load.inc.php");
new_cache();
if (!(GALLERY_ADMIN_MODE || USER_ADMIN_MODE)) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);


if (isset($_GET['id'])) {
    $pid = secure( $_GET['id'], 'num', 1, 'sec' );
} elseif (isset($_GET['id'])) {
    $pid = secure( $_POST['id'], 'num', 1, 'sec' );
} else {
    $pid = -1;
}
$id = secure( $id, 'num', 1, 'sec' );
$sql = "SELECT `aid` FROM `".TABLE_CPG_PICTURES."` WHERE `pid` = '$id' ";
$result = $GLOBALS['db']->sql_query($sql);
$nbEnr  = $GLOBALS['db']->sql_fetchrow($result);
$meta_link = "&album=".$nbEnr[0];//
define('META_LNK',$meta_link);
$title = $lang_editpics_php['edit_pics'];
incoh();
pageheader($title);
// Code after this is Specific to the individual actions - it would be preferable to have each actions in their own inc file
// Crop picture
// include("$CPG_M_DIR/include/crop.inc.php");
// Edit description of the picture
include("modules/Coppermine/include/editDesc.inc.php");
// Upload new thumbnail
// Rotate Image
// Just imagine
pagefooter();
incof();
