Exemple #1
0
            $is_allowedToCreate = $is_editor || WikiAccessControl::isAllowedToCreatePage($accessControlList, 'course');
        } else {
            $is_allowedToRead = $is_editor || WikiAccessControl::isAllowedToReadPage($accessControlList, 'other');
            $is_allowedToEdit = $is_editor || WikiAccessControl::isAllowedToEditPage($accessControlList, 'other');
            $is_allowedToCreate = $is_editor || WikiAccessControl::isAllowedToCreatePage($accessControlList, 'other');
        }
    }
}
// --------------- End of  access rights management ----------------
// filter action
if ($is_allowedToEdit || $is_allowedToCreate) {
    $valid_actions = array("edit", "preview", "save", "delete", "show", "recent", "diff", "all", "history", "rqSearch", "exSearch");
} else {
    $valid_actions = array("show", "recent", "diff", "all", "history", "rqSearch", "exSearch");
}
$_CLEAN = filter_by_key('action', $valid_actions, "R", false);
$action = isset($_CLEAN['action']) ? $_CLEAN['action'] : 'show';
// get request variables
$creatorId = $uid;
$versionId = isset($_REQUEST['versionId']) ? intval($_REQUEST['versionId']) : 0;
$wiki_title = isset($_REQUEST['title']) ? strip_tags(rawurldecode($_REQUEST['title'])) : '';
$changelog = isset($_POST['changelog']) ? strip_tags($_POST['changelog']) : '';
if ($action == "diff") {
    $old = isset($_REQUEST['old']) ? intval($_REQUEST['old']) : 0;
    $new = isset($_REQUEST['new']) ? intval($_REQUEST['new']) : 0;
}
// get content
if ($action == "edit") {
    if (isset($_REQUEST['wiki_content'])) {
        if (!get_magic_quotes_gpc()) {
            $content = $_REQUEST['wiki_content'] == '' ? "__CONTENT__EMPTY__" : $_REQUEST['wiki_content'];
Exemple #2
0
<?php

authorize();
require SERVER_ROOT . '/sections/torrents/functions.php';
$GroupAllowed = array('WikiBody', 'WikiImage', 'ID', 'Name', 'Year', 'RecordLabel', 'CatalogueNumber', 'ReleaseType', 'CategoryID', 'Time', 'VanityHouse');
$TorrentAllowed = array('ID', 'Media', 'Format', 'Encoding', 'Remastered', 'RemasterYear', 'RemasterTitle', 'RemasterRecordLabel', 'RemasterCatalogueNumber', 'Scene', 'HasLog', 'HasCue', 'LogScore', 'FileCount', 'Size', 'Seeders', 'Leechers', 'Snatched', 'FreeTorrent', 'Time', 'Description', 'FileList', 'FilePath', 'UserID', 'Username');
$GroupID = (int) $_GET['id'];
if ($GroupID == 0) {
    error('bad id parameter', true);
}
$TorrentCache = get_group_info($GroupID, true, 0);
// http://stackoverflow.com/questions/4260086/php-how-to-use-array-filter-to-filter-array-keys
function filter_by_key($input, $keys)
{
    return array_intersect_key($input, array_flip($keys));
}
$TorrentDetails = filter_by_key($TorrentCache[0][0], $GroupAllowed);
$TorrentList = array();
foreach ($TorrentCache[1] as $Torrent) {
    $TorrentList[] = filter_by_key($Torrent, $TorrentAllowed);
}
header('Content-Type: text/plain; charset=utf-8');
print json_encode(array('status' => 'success', 'response' => array('group' => $TorrentDetails, 'torrents' => $TorrentList)));