Exemple #1
0
function MG_rebuildQuota()
{
    global $_TABLES, $_MG_CONF, $_CONF;
    $result = DB_query("SELECT album_id FROM {$_TABLES['mg_albums']}");
    while ($row = DB_fetchArray($result)) {
        MG_updateQuotaUsage($row['album_id']);
    }
    echo COM_refresh($_MG_CONF['admin_url'] . 'index.php?msg=16');
    exit;
}
Exemple #2
0
function MG_batchDeleteMedia($album_id, $media_id_array, $actionURL = '')
{
    global $_USER, $_CONF, $_TABLES, $LANG_MG00;
    require_once $_CONF['path'] . 'plugins/mediagallery/include/classMedia.php';
    // check permissions...
    $sql = "SELECT * FROM {$_TABLES['mg_albums']} WHERE album_id=" . intval($album_id);
    $result = DB_query($sql);
    $A = DB_fetchArray($result);
    $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
    if ($access != 3 && !SEC_hasRights('mediagallery.admin')) {
        COM_errorLog("Someone has tried to illegally delete items from album in Media Gallery. " . "User id: {$_USER['uid']}, Username: {$_USER['username']}, IP: {$REMOTE_ADDR}", 1);
        return COM_showMessageText($LANG_MG00['access_denied_msg']);
    }
    $mediaCount = $A['media_count'];
    $numItems = count($media_id_array);
    for ($i = 0; $i < $numItems; $i++) {
        MG_deleteMedia($media_id_array[$i]);
        $mediaCount--;
    }
    DB_change($_TABLES['mg_albums'], 'media_count', $mediaCount, 'album_id', $album_id);
    MG_resetAlbumCover($album_id);
    // reset the last_update field...
    MG_updateAlbumLastUpdate($album_id);
    // update the disk usage after delete...
    MG_updateQuotaUsage($album_id);
    MG_SortMedia($album_id);
    require_once $_CONF['path'] . 'plugins/mediagallery/include/rssfeed.php';
    MG_buildFullRSS();
    MG_buildAlbumRSS($album_id);
    echo COM_refresh($actionURL);
    exit;
}