Beispiel #1
0
function tlxCategoryDelete()
{
    global $DB, $json, $C;
    VerifyPrivileges(P_CATEGORY_REMOVE, TRUE);
    if (!is_array($_REQUEST['category_id'])) {
        $_REQUEST['category_id'] = array($_REQUEST['category_id']);
    }
    foreach ($_REQUEST['category_id'] as $category_id) {
        $accounts =& $DB->FetchAll('SELECT * FROM `tlx_accounts` WHERE `category_id`=?', array($category_id));
        foreach ($accounts as $account) {
            DeleteAccount($username);
        }
        $DB->Update('DELETE FROM `tlx_categories` WHERE `category_id`=?', array($category_id));
    }
    echo $json->encode(array('status' => JSON_SUCCESS, 'message' => 'The selected categories have been deleted'));
}
Beispiel #2
0
function txCategoryDelete()
{
    global $DB, $json, $C;
    VerifyPrivileges(P_CATEGORY_REMOVE, TRUE);
    if (!is_array($_REQUEST['category_id'])) {
        $_REQUEST['category_id'] = array($_REQUEST['category_id']);
    }
    foreach ($_REQUEST['category_id'] as $category_id) {
        $category = $DB->Row('SELECT * FROM `tx_categories` WHERE `category_id`=?', array($category_id));
        // Find all of the galleries in this category
        $result = $DB->Query('SELECT * FROM `tx_galleries` WHERE MATCH(`categories`) AGAINST (? IN BOOLEAN MODE)', array($category['tag']));
        while ($gallery = $DB->NextRow($result)) {
            $gallery['categories'] = RemoveCategoryTag($category['tag'], $gallery['categories']);
            // Delete the gallery if it is not also located in another category
            if ($gallery['categories'] == MIXED_CATEGORY) {
                DeleteGallery($gallery['gallery_id'], $gallery);
            } else {
                $DB->Update('UPDATE `tx_galleries` SET `categories`=? WHERE `gallery_id`=?', array($gallery['categories'], $gallery['gallery_id']));
            }
        }
        $DB->Free($result);
        // Remove the category
        $DB->Update('DELETE FROM `tx_categories` WHERE `category_id`=?', array($category_id));
        // Remove pages associated with this category
        $DB->Update('DELETE FROM `tx_pages` WHERE `category_id`=?', array($category['category_id']));
    }
    echo $json->encode(array('status' => JSON_SUCCESS, 'message' => 'The selected categories have been deleted'));
}
Beispiel #3
0
function txShGalleryReview()
{
    global $DB, $C;
    VerifyPrivileges(P_GALLERY);
    include_once 'includes/review-galleries.php';
}
Beispiel #4
0
/**
* Change the status of a user account
*/
function lxStatusUser()
{
    global $json, $DB;
    VerifyPrivileges(P_USER_MODIFY, TRUE);
    if (!is_array($_REQUEST['username'])) {
        $_REQUEST['username'] = array($_REQUEST['username']);
    }
    foreach ($_REQUEST['username'] as $username) {
        $DB->Update('UPDATE lx_users SET status=? WHERE username=?', array($_REQUEST['w'], $username));
        if ($_REQUEST['w'] == 'suspended') {
            $DB->Update('UPDATE lx_links SET status=? WHERE username=?', array('disabled', $username));
        } else {
            $DB->Update('UPDATE lx_links SET status=? WHERE username=?', array('active', $username));
        }
    }
    echo $json->encode(array('status' => JSON_SUCCESS));
}
Beispiel #5
0
function lxShUsers()
{
    global $DB, $C;
    VerifyPrivileges(P_USER);
    include_once 'includes/users.php';
}
Beispiel #6
0
function txCategoryEdit()
{
    global $C, $DB;
    VerifyPrivileges(P_CATEGORY_MODIFY);
    $v =& ValidateCategoryInput();
    if (!$v->Validate()) {
        return $v->ValidationError('txShCategoryEdit');
    }
    UpdateThumbSizes();
    // Bulk update
    if (isset($_REQUEST['apply_all']) || isset($_REQUEST['apply_matched'])) {
        $GLOBALS['message'] = 'All categories have been successfully updated';
        $select = new SelectBuilder('*', 'tx_categories');
        if (isset($_REQUEST['apply_matched'])) {
            $search = array();
            parse_str($_REQUEST['apply_matched'], $search);
            $select->AddWhere($search['field'], $search['search_type'], $search['search'], $search['search_type'] != ST_EMPTY);
            $GLOBALS['message'] = 'Matched categories have been successfully updated';
        }
        $result = $DB->Query($select->Generate(), $select->binds);
        while ($category = $DB->NextRow($result)) {
            $DB->Update('UPDATE `tx_categories` SET ' . '`pics_allowed`=?, ' . '`pics_extensions`=?, ' . '`pics_minimum`=?, ' . '`pics_maximum`=?, ' . '`pics_file_size`=?, ' . '`pics_preview_size`=?, ' . '`pics_preview_allowed`=?, ' . '`pics_annotation`=?, ' . '`movies_allowed`=?, ' . '`movies_extensions`=?, ' . '`movies_minimum`=?, ' . '`movies_maximum`=?, ' . '`movies_file_size`=?, ' . '`movies_preview_size`=?, ' . '`movies_preview_allowed`=?, ' . '`movies_annotation`=?, ' . '`per_day`=?, ' . '`hidden`=?, ' . '`meta_description`=?, ' . '`meta_keywords`=? ' . 'WHERE `category_id`=?', array(intval($_REQUEST['pics_allowed']), $_REQUEST['pics_extensions'], $_REQUEST['pics_minimum'], $_REQUEST['pics_maximum'], $_REQUEST['pics_file_size'], $_REQUEST['pics_preview_size'], intval($_REQUEST['pics_preview_allowed']), $_REQUEST['pics_annotation'], intval($_REQUEST['movies_allowed']), $_REQUEST['movies_extensions'], $_REQUEST['movies_minimum'], $_REQUEST['movies_maximum'], $_REQUEST['movies_file_size'], $_REQUEST['movies_preview_size'], intval($_REQUEST['movies_preview_allowed']), $_REQUEST['movies_annotation'], $_REQUEST['per_day'], intval($_REQUEST['hidden']), $_REQUEST['meta_description'], $_REQUEST['meta_keywords'], $category['category_id']));
        }
        $DB->Free($result);
    } else {
        $_REQUEST['name'] = trim($_REQUEST['name']);
        $DB->Update('UPDATE `tx_categories` SET ' . '`name`=?, ' . '`pics_allowed`=?, ' . '`pics_extensions`=?, ' . '`pics_minimum`=?, ' . '`pics_maximum`=?, ' . '`pics_file_size`=?, ' . '`pics_preview_size`=?, ' . '`pics_preview_allowed`=?, ' . '`pics_annotation`=?, ' . '`movies_allowed`=?, ' . '`movies_extensions`=?, ' . '`movies_minimum`=?, ' . '`movies_maximum`=?, ' . '`movies_file_size`=?, ' . '`movies_preview_size`=?, ' . '`movies_preview_allowed`=?, ' . '`movies_annotation`=?, ' . '`per_day`=?, ' . '`hidden`=?, ' . '`meta_description`=?, ' . '`meta_keywords`=? ' . 'WHERE `category_id`=?', array($_REQUEST['name'], intval($_REQUEST['pics_allowed']), $_REQUEST['pics_extensions'], $_REQUEST['pics_minimum'], $_REQUEST['pics_maximum'], $_REQUEST['pics_file_size'], $_REQUEST['pics_preview_size'], intval($_REQUEST['pics_preview_allowed']), $_REQUEST['pics_annotation'], intval($_REQUEST['movies_allowed']), $_REQUEST['movies_extensions'], $_REQUEST['movies_minimum'], $_REQUEST['movies_maximum'], $_REQUEST['movies_file_size'], $_REQUEST['movies_preview_size'], intval($_REQUEST['movies_preview_allowed']), $_REQUEST['movies_annotation'], $_REQUEST['per_day'], intval($_REQUEST['hidden']), $_REQUEST['meta_description'], $_REQUEST['meta_keywords'], $_REQUEST['category_id']));
        $GLOBALS['message'] = 'Category has been successfully updated';
    }
    $GLOBALS['added'] = true;
    txShCategoryEdit();
}
Beispiel #7
0
function tlxCategoryEdit()
{
    global $C, $DB;
    VerifyPrivileges(P_CATEGORY_MODIFY);
    $v =& ValidateCategoryInput();
    if (!$v->Validate()) {
        return $v->ValidationError('tlxShCategoryEdit');
    }
    // Bulk update
    if (isset($_REQUEST['apply_all']) || isset($_REQUEST['apply_matched'])) {
        $GLOBALS['message'] = 'All categories have been successfully updated';
        $select = new SelectBuilder('*', 'tlx_categories');
        if (isset($_REQUEST['apply_matched'])) {
            $search = array();
            parse_str($_REQUEST['apply_matched'], $search);
            $select->AddWhere($search['field'], $search['search_type'], $search['search'], $search['search_type'] != ST_EMPTY);
            $GLOBALS['message'] = 'Matched categories have been successfully updated';
        }
        $result = $DB->Query($select->Generate(), $select->binds);
        while ($category = $DB->NextRow($result)) {
            $DB->Update('UPDATE `tlx_categories` SET ' . '`hidden`=?, ' . '`forward_url`=?, ' . '`page_url`=?, ' . '`banner_max_width`=?, ' . '`banner_max_height`=?, ' . '`banner_max_bytes`=?, ' . '`banner_force_size`=?, ' . '`download_banners`=?, ' . '`host_banners`=?, ' . '`allow_redirect`=?, ' . '`title_min_length`=?, ' . '`title_max_length`=?, ' . '`desc_min_length`=?, ' . '`desc_max_length`=?, ' . '`recip_required`=? ' . 'WHERE `category_id`=?', array(intval($_REQUEST['hidden']), $_REQUEST['forward_url'], $_REQUEST['page_url'], $_REQUEST['banner_max_width'], $_REQUEST['banner_max_height'], $_REQUEST['banner_max_bytes'], intval($_REQUEST['banner_force_size']), intval($_REQUEST['download_banners']), intval($_REQUEST['host_banners']), intval($_REQUEST['allow_redirect']), $_REQUEST['title_min_length'], $_REQUEST['title_max_length'], $_REQUEST['desc_min_length'], $_REQUEST['desc_max_length'], intval($_REQUEST['recip_required']), $category['category_id']));
        }
        $DB->Free($result);
    } else {
        $_REQUEST['name'] = trim($_REQUEST['name']);
        $DB->Update('UPDATE `tlx_categories` SET ' . '`name`=?, ' . '`hidden`=?, ' . '`forward_url`=?, ' . '`page_url`=?, ' . '`banner_max_width`=?, ' . '`banner_max_height`=?, ' . '`banner_max_bytes`=?, ' . '`banner_force_size`=?, ' . '`download_banners`=?, ' . '`host_banners`=?, ' . '`allow_redirect`=?, ' . '`title_min_length`=?, ' . '`title_max_length`=?, ' . '`desc_min_length`=?, ' . '`desc_max_length`=?, ' . '`recip_required`=? ' . 'WHERE `category_id`=?', array($_REQUEST['name'], intval($_REQUEST['hidden']), $_REQUEST['forward_url'], $_REQUEST['page_url'], $_REQUEST['banner_max_width'], $_REQUEST['banner_max_height'], $_REQUEST['banner_max_bytes'], intval($_REQUEST['banner_force_size']), intval($_REQUEST['download_banners']), intval($_REQUEST['host_banners']), intval($_REQUEST['allow_redirect']), $_REQUEST['title_min_length'], $_REQUEST['title_max_length'], $_REQUEST['desc_min_length'], $_REQUEST['desc_max_length'], intval($_REQUEST['recip_required']), $_REQUEST['category_id']));
        $GLOBALS['message'] = 'Category has been successfully updated';
    }
    $GLOBALS['added'] = true;
    tlxShCategoryEdit();
}