Ejemplo n.º 1
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();
}
Ejemplo n.º 2
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();
}