Beispiel #1
0
/**
 * Get filesize limits
 *
 * @param int $userid User ID
 * @return array
 */
function cot_pfs_limits($userid)
{
    global $db, $db_groups, $db_groups_users;
    $maxfile = 0;
    $maxtotal = 0;
    $sql = $db->query("SELECT MAX(grp_pfs_maxfile) AS maxfile, MAX(grp_pfs_maxtotal) AS maxtotal\n\tFROM {$db_groups}\tWHERE grp_id IN (SELECT gru_groupid FROM {$db_groups_users} WHERE gru_userid=" . (int) $userid . ") LIMIT 1");
    if ($row = $sql->fetch()) {
        $maxfile = min($row['maxfile'], cot_get_uploadmax());
        $maxtotal = $row['maxtotal'];
    }
    return array($maxfile, $maxtotal);
}
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=admin.users.add.first
[END_COT_EXT]
==================== */
/**
 * Users admin edit tags
 *
 * @package PFS
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL.');
$rgroups['grp_pfs_maxfile'] = (int) min(cot_import('rmaxfile', 'P', 'INT'), cot_get_uploadmax());
$rgroups['grp_pfs_maxtotal'] = (int) cot_import('rmaxtotal', 'P', 'INT');
Beispiel #3
0
if (!$usr['isadmin'] || $userid === null) {
    $userid = $usr['id'];
} else {
    $more = 'userid=' . $userid;
}
$files_count = 0;
$folders_count = 0;
$standalone = FALSE;
$uid = $userid > 0 ? $userid : $usr['id'];
$user_info = cot_userinfo($uid);
$pfs_base_href = $sys['abs_url'];
$pfs_dir_user = cot_pfs_path($userid);
$thumbs_dir_user = cot_pfs_thumbpath($userid);
$rel_dir_user = cot_pfs_relpath($userid);
$sql_pfs_max = $db->query("\n\tSELECT\n\t\tMAX(grp_pfs_maxfile) AS maxfile,\n\t\tSUM(grp_pfs_maxtotal) AS maxtotal\n\tFROM {$db_groups}\n\tWHERE grp_id IN (\n\t\tSELECT gru_groupid\n\t\tFROM {$db_groups_users}\n\t\tWHERE gru_userid = {$user_info['user_id']}\n\t)\n")->fetch();
$maxfile = min((int) $sql_pfs_max['maxfile'], cot_get_uploadmax()) * 1024;
// KiB -> Bytes
$maxtotal = (int) $sql_pfs_max['maxtotal'] * 1024;
// KiB -> Bytes
cot_block($maxfile > 0 && $maxtotal > 0 || $usr['isadmin']);
if (!empty($c1) || !empty($c2)) {
    $more .= empty($more) ? 'c1=' . $c1 . '&c2=' . $c2 : '&c1=' . $c1 . '&c2=' . $c2;
    if (!empty($parser)) {
        $more .= '&parser=' . $parser;
    }
    $standalone = TRUE;
}
foreach ($cot_extensions as $k => $line) {
    $icon[$line[0]] = cot_rc('pfs_icon_type', array('type' => $line[2], 'name' => $line[1]));
    $filedesc[$line[0]] = $line[1];
}