Jack 写道:categories.php 第 168 行的问题
categories.php文件168行附近的代码内容如下,第168行是print_r($sql_allow); jack老大帮忙看看啥问题呢
- 代码: 全选
$action = "edit";
zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'action=edit_category&cPath=' . $_GET['cPath'] . '&cID=' . zen_db_prepare_input($_GET['cID'])));
break;
case 'setflag':
if ( ($_GET['flag'] == '0') || ($_GET['flag'] == '1') ) {
if (isset($_GET['pID'])) {
zen_set_product_status($_GET['pID'], $_GET['flag']);
}
}
zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $_GET['cPath'] . '&pID=' . $_GET['pID'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')));
break;
case 'insert_category':
case 'update_category':
if ( isset($_POST['add_type']) or isset($_POST['add_type_all']) ) {
// check if it is already restricted
$sql = "select * from " . TABLE_PRODUCT_TYPES_TO_CATEGORY . "
where category_id = '" . zen_db_prepare_input($_POST['categories_id']) . "'
and product_type_id = '" . zen_db_prepare_input($_POST['restrict_type']) . "'";
$type_to_cat = $db->Execute($sql);
if ($type_to_cat->RecordCount() < 1) {
//@@TODO find all sub-categories and restrict them as well.
$insert_sql_data = array('category_id' => zen_db_prepare_input($_POST['categories_id']),
'product_type_id' => zen_db_prepare_input($_POST['restrict_type']));
zen_db_perform(TABLE_PRODUCT_TYPES_TO_CATEGORY, $insert_sql_data);
/*
// moved below so evaluated separately from current category
if (isset($_POST['add_type_all'])) {
zen_restrict_sub_categories($_POST['categories_id'], $_POST['restrict_type']);
}
*/
}
// add product type restrictions to subcategories if not already set
if (isset($_POST['add_type_all'])) {
zen_restrict_sub_categories($_POST['categories_id'], $_POST['restrict_type']);
}
$action = "edit";
zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'action=edit_category&cPath=' . $cPath . '&cID=' . zen_db_prepare_input($_POST['categories_id'])));
}
if (isset($_POST['categories_id'])) $categories_id = zen_db_prepare_input($_POST['categories_id']);
$sort_order = zen_db_prepare_input($_POST['sort_order']);
$sql_data_array = array('sort_order' => (int)$sort_order);
if ($action == 'insert_category') {
$insert_sql_data = array('parent_id' => $current_category_id,
'date_added' => 'now()');
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
zen_db_perform(TABLE_CATEGORIES, $sql_data_array);
$categories_id = zen_db_insert_id();
// BOF - Admin Profile's Categories
// automatically add permission for current user on category he has just created
$sql_allow = array('categories_id' => $categories_id,
'admin_id' => $_SESSION['admin_id']);
print_r($sql_allow);
zen_db_perform(TABLE_ADMIN_ALLOWED_CATEGORIES, $sql_allow);
// EOF - Admin Profile's Categories
// check if [arent is restricted
$sql = "select parent_id from " . TABLE_CATEGORIES . "
where categories_id = '" . $categories_id . "'";
$parent_cat = $db->Execute($sql);
if ($parent_cat->fields['parent_id'] != '0') {
$sql = "select * from " . TABLE_PRODUCT_TYPES_TO_CATEGORY . "
where category_id = '" . $parent_cat->fields['parent_id'] . "'";
$has_type = $db->Execute($sql);
if ($has_type->RecordCount() > 0 ) {
while (!$has_type->EOF) {
$insert_sql_data = array('category_id' => $categories_id,
'product_type_id' => $has_type->fields['product_type_id']);
zen_db_perform(TABLE_PRODUCT_TYPES_TO_CATEGORY, $insert_sql_data);
$has_type->moveNext();
}
}
}
} elseif ($action == 'update_category') {
$update_sql_data = array('last_modified' => 'now()');
$sql_data_array = array_merge($sql_data_array, $update_sql_data);
zen_db_perform(TABLE_CATEGORIES, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "'");
}
$languages = zen_get_languages();