Gazelle/sections/collages/index.php

94 lines
3.0 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
enforce_login();
if(empty($_REQUEST['action'])) { $_REQUEST['action']=''; }
switch($_REQUEST['action']) {
case 'new':
if(!check_perms('site_collages_create')) { error(403); }
require(SERVER_ROOT.'/sections/collages/new.php');
break;
case 'new_handle':
if(!check_perms('site_collages_create')) { error(403); }
require(SERVER_ROOT.'/sections/collages/new_handle.php');
break;
case 'add_torrent':
2012-02-07 08:00:20 +00:00
case 'add_torrent_batch':
2011-03-28 14:21:28 +00:00
if(!check_perms('site_collages_manage')) { error(403); }
require(SERVER_ROOT.'/sections/collages/add_torrent.php');
break;
case 'manage':
if(!check_perms('site_collages_manage')) { error(403); }
require(SERVER_ROOT.'/sections/collages/manage.php');
break;
case 'manage_handle':
if(!check_perms('site_collages_manage')) { error(403); }
require(SERVER_ROOT.'/sections/collages/manage_handle.php');
break;
case 'edit':
if(!check_perms('site_edit_wiki')) { error(403); }
require(SERVER_ROOT.'/sections/collages/edit.php');
break;
case 'edit_handle':
if(!check_perms('site_edit_wiki')) { error(403); }
require(SERVER_ROOT.'/sections/collages/edit_handle.php');
break;
case 'delete':
authorize();
require(SERVER_ROOT.'/sections/collages/delete.php');
break;
case 'take_delete':
require(SERVER_ROOT.'/sections/collages/take_delete.php');
break;
case 'add_comment':
require(SERVER_ROOT.'/sections/collages/add_comment.php');
break;
case 'comments':
require(SERVER_ROOT.'/sections/collages/all_comments.php');
break;
case 'takeedit_comment':
require(SERVER_ROOT.'/sections/collages/takeedit_comment.php');
break;
case 'delete_comment':
require(SERVER_ROOT.'/sections/collages/delete_comment.php');
break;
case 'get_post':
require(SERVER_ROOT.'/sections/collages/get_post.php');
break;
case 'download':
require(SERVER_ROOT.'/sections/collages/download.php');
break;
case 'recover':
//if(!check_perms('')) { error(403); }
require(SERVER_ROOT.'/sections/collages/recover.php');
break;
case 'create_personal':
if(!check_perms('site_collages_personal')) {
error(403);
}
2013-02-22 08:00:24 +00:00
$DB->query("SELECT COUNT(ID) FROM collages WHERE UserID='$LoggedUser[ID]' AND CategoryID='0' AND Deleted='0'");
list($CollageCount) = $DB->next_record();
2013-02-22 08:00:24 +00:00
if($CollageCount >= $LoggedUser['Permissions']['MaxCollages']) {
2011-03-28 14:21:28 +00:00
list($CollageID) = $DB->next_record();
header('Location: collage.php?id='.$CollageID);
die();
}
$NameStr = ($CollageCount > 0)?" no. " . ($CollageCount + 1):'';
$DB->query("INSERT INTO collages (Name, Description, CategoryID, UserID) VALUES ('$LoggedUser[Username]\'s personal collage$NameStr', 'Personal collage for $LoggedUser[Username]. The first 5 albums will appear on his or her [url=http:\/\/".NONSSL_SITE_URL."\/user.php?id=$LoggedUser[ID]]profile[\/url].', '0', $LoggedUser[ID])");
2011-03-28 14:21:28 +00:00
$CollageID = $DB->inserted_id();
header('Location: collage.php?id='.$CollageID);
die();
default:
if(!empty($_GET['id'])) {
require(SERVER_ROOT.'/sections/collages/collage.php');
} else {
require(SERVER_ROOT.'/sections/collages/browse.php');
}
break;
}
?>