当前位置: 首页>>代码示例>>PHP>>正文


PHP zen_db_input函数代码示例

本文整理汇总了PHP中zen_db_input函数的典型用法代码示例。如果您正苦于以下问题:PHP zen_db_input函数的具体用法?PHP zen_db_input怎么用?PHP zen_db_input使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了zen_db_input函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: send

 function send($newsletter_id)
 {
     global $db;
     $audience_select = get_audience_sql_query($this->query_name, 'newsletters');
     $audience = $db->Execute($audience_select['query_string']);
     $records = $audience->RecordCount();
     if ($records == 0) {
         return 0;
     }
     $i = 0;
     while (!$audience->EOF) {
         $i++;
         $html_msg['EMAIL_FIRST_NAME'] = $audience->fields['customers_firstname'];
         $html_msg['EMAIL_LAST_NAME'] = $audience->fields['customers_lastname'];
         $html_msg['EMAIL_GREET'] = EMAIL_GREET;
         $html_msg['EMAIL_MESSAGE_HTML'] = $this->content_html;
         zen_mail($audience->fields['customers_firstname'] . ' ' . $audience->fields['customers_lastname'], $audience->fields['customers_email_address'], $this->title, $this->content, STORE_NAME, EMAIL_FROM, $html_msg, 'newsletters');
         echo zen_image(DIR_WS_ICONS . 'tick.gif', $audience->fields['customers_email_address']);
         //force output to the screen to show status indicator each time a message is sent...
         if (function_exists('ob_flush')) {
             @ob_flush();
         }
         @flush();
         $audience->MoveNext();
     }
     $newsletter_id = zen_db_prepare_input($newsletter_id);
     $db->Execute("update " . TABLE_NEWSLETTERS . "\r\n                    set date_sent = now(), status = '1'\r\n                    where newsletters_id = '" . zen_db_input($newsletter_id) . "'");
     return $records;
     //return number of records processed whether successful or not
 }
开发者ID:homework-bazaar,项目名称:zencart-sugu,代码行数:30,代码来源:newsletter.php

示例2: zen_update_whos_online

/**
 * @package ZenCart_Functions
*/
function zen_update_whos_online()
{
    global $db;
    if ($_SESSION['customer_id']) {
        $wo_customer_id = $_SESSION['customer_id'];
        $customer_query = "select customers_firstname, customers_lastname\r\n                         from " . TABLE_CUSTOMERS . "\r\n                         where customers_id = '" . (int) $_SESSION['customer_id'] . "'";
        $customer = $db->Execute($customer_query);
        $wo_full_name = $customer->fields['customers_firstname'] . ' ' . $customer->fields['customers_lastname'];
    } else {
        $wo_customer_id = '';
        $wo_full_name = 'Guest';
    }
    $wo_session_id = zen_session_id();
    $wo_ip_address = $_SERVER['REMOTE_ADDR'];
    $wo_last_page_url = $_SERVER['REQUEST_URI'];
    $wo_user_agent = zen_db_prepare_input($_SERVER['HTTP_USER_AGENT']);
    $current_time = time();
    $xx_mins_ago = $current_time - 900;
    // remove entries that have expired
    $sql = "delete from " . TABLE_WHOS_ONLINE . "\r\n            where time_last_click < '" . $xx_mins_ago . "'";
    $db->Execute($sql);
    $stored_customer_query = "select count(*) as count\r\n                              from " . TABLE_WHOS_ONLINE . "\r\n                              where session_id = '" . zen_db_input($wo_session_id) . "'";
    $stored_customer = $db->Execute($stored_customer_query);
    if ($stored_customer->fields['count'] > 0) {
        $sql = "update " . TABLE_WHOS_ONLINE . "\r\n              set customer_id = '" . (int) $wo_customer_id . "',\r\n                  full_name = '" . zen_db_input($wo_full_name) . "',\r\n                  ip_address = '" . zen_db_input($wo_ip_address) . "',\r\n                  time_last_click = '" . zen_db_input($current_time) . "',\r\n                  last_page_url = '" . zen_db_input($wo_last_page_url) . "',\r\n                  host_address = '" . zen_db_input($_SESSION['customers_host_address']) . "',\r\n                  user_agent = '" . zen_db_input($wo_user_agent) . "'\r\n              where session_id = '" . zen_db_input($wo_session_id) . "'";
        $db->Execute($sql);
    } else {
        $sql = "insert into " . TABLE_WHOS_ONLINE . "\r\n                              (customer_id, full_name, session_id, ip_address, time_entry,\r\n                               time_last_click, last_page_url, host_address, user_agent)\r\n              values ('" . (int) $wo_customer_id . "', '" . zen_db_input($wo_full_name) . "', '" . zen_db_input($wo_session_id) . "', '" . zen_db_input($wo_ip_address) . "', '" . zen_db_input($current_time) . "', '" . zen_db_input($current_time) . "', '" . zen_db_input($wo_last_page_url) . "', '" . zen_db_input($_SESSION['customers_host_address']) . "', '" . zen_db_input($wo_user_agent) . "')";
        $db->Execute($sql);
    }
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:34,代码来源:whos_online.php

示例3: authentication

 public function authentication()
 {
     if (!isset($_POST['admin_name']) || empty($_POST['admin_name']) || !isset($_POST['admin_pass']) || empty($_POST['admin_pass'])) {
         $this->authenticed = false;
         $this->addError('"name" and "password" invalid.');
     } else {
         $admin_name = zen_db_prepare_input($_POST['admin_name']);
         $admin_pass = zen_db_prepare_input($_POST['admin_pass']);
         $sql = "select admin_id, admin_name, admin_pass from " . TABLE_ADMIN . " where admin_name = '" . zen_db_input($admin_name) . "'";
         $result = $this->db->Execute($sql);
         if (isset($result->fields) && $admin_name == $result->fields['admin_name'] && zen_validate_password($admin_pass, $result->fields['admin_pass'])) {
             $this->authenticed = true;
         } else {
             if (!isset($result->fields) || !($admin_name == $result->fields['admin_name'])) {
                 $this->authenticed = false;
                 $this->addError('"name" invalid.');
             }
             if (!isset($result->fields) || !zen_validate_password($admin_pass, $result->fields['admin_pass'])) {
                 $this->authenticed = false;
                 $this->addError('"password" invalid.');
             }
         }
     }
     return $this->authenticed;
 }
开发者ID:wwxgitcat,项目名称:zencart_v1.0,代码行数:25,代码来源:super_api.php

示例4: zen_update_whos_online

/**
 * @package ZenCart_Functions
*/
function zen_update_whos_online()
{
    global $gBitDb;
    if (!empty($_SESSION['customer_id'])) {
        $wo_customer_id = $_SESSION['customer_id'];
        $customer_query = "select `customers_firstname`, `customers_lastname`\n                         from " . TABLE_CUSTOMERS . "\n                         where `customers_id` = '" . (int) $_SESSION['customer_id'] . "'";
        $customer = $gBitDb->Execute($customer_query);
        $wo_full_name = $customer->fields['customers_firstname'] . ' ' . $customer->fields['customers_lastname'];
    } else {
        $wo_customer_id = '';
        $wo_full_name = 'Guest';
    }
    $wo_session_id = zen_session_id();
    $wo_ip_address = $_SERVER['REMOTE_ADDR'];
    $wo_last_page_url = $_SERVER['REQUEST_URI'];
    $wo_user_agent = !empty($_SERVER['HTTP_USER_AGENT']) ? zen_db_prepare_input($_SERVER['HTTP_USER_AGENT']) : '-';
    $current_time = time();
    $xx_mins_ago = $current_time - 900;
    // remove entries that have expired
    $sql = "delete from " . TABLE_WHOS_ONLINE . "\n            where `time_last_click` < '" . $xx_mins_ago . "'";
    $gBitDb->Execute($sql);
    $stored_customer_query = 'select count(*) as "count"
                              from ' . TABLE_WHOS_ONLINE . "\n                              where `session_id` = '" . zen_db_input($wo_session_id) . "'";
    $stored_customer = $gBitDb->Execute($stored_customer_query);
    if (empty($wo_customer_id)) {
        $wo_customer_id = NULL;
    }
    if ($stored_customer->fields['count'] > 0) {
        $sql = "update " . TABLE_WHOS_ONLINE . "\n              set `customer_id` = ?, `full_name` = ?, `ip_address` = ?, `time_last_click` = ?, `last_page_url` = ?, `host_address` = ?, `user_agent` = ?\n              where `session_id` = ?";
        $gBitDb->query($sql, array($wo_customer_id, $wo_full_name, $wo_ip_address, $current_time, substr($wo_last_page_url, 0, 255), $_SESSION['customers_host_address'], substr($wo_user_agent, 0, 255), $wo_session_id));
    } else {
        $sql = "insert into " . TABLE_WHOS_ONLINE . "\n                              (`customer_id`, `full_name`, `session_id`, `ip_address`, `time_entry`,\n                               `time_last_click`, `last_page_url`, `host_address`, `user_agent`)\n              values ( ?, ?, ?, ?, ?, ?, ?, ?, ? )";
        $gBitDb->query($sql, array($wo_customer_id, $wo_full_name, $wo_session_id, $wo_ip_address, $current_time, $current_time, $wo_last_page_url, $_SESSION['customers_host_address'], $wo_user_agent));
    }
}
开发者ID:bitweaver,项目名称:commerce,代码行数:38,代码来源:whos_online.php

示例5: _sess_destroy

function _sess_destroy($key)
{
    global $db;
    $sql = "delete from " . TABLE_SESSIONS . " where sesskey = '" . zen_db_input($key) . "'";
    $db->Execute($sql);
    return TRUE;
}
开发者ID:kirkbauer2,项目名称:kirkzc,代码行数:7,代码来源:sessions.php

示例6: splitPageResults

 function splitPageResults($query, $max_rows, $count_key = '*', $page_holder = 'page', $debug = false)
 {
     global $db;
     $max_rows = $max_rows == '' || $max_rows == 0 ? 20 : $max_rows;
     $this->sql_query = preg_replace("/\n\r|\r\n|\n|\r/", " ", $query);
     $this->page_name = $page_holder;
     if ($debug) {
         echo 'original_query=' . $query . '<br /><br />';
     }
     if (isset($_GET[$page_holder])) {
         $page = $_GET[$page_holder];
     } elseif (isset($_POST[$page_holder])) {
         $page = $_POST[$page_holder];
     } else {
         $page = '';
     }
     if (empty($page) || !is_numeric($page)) {
         $page = 1;
     }
     $this->current_page_number = $page;
     $this->number_of_rows_per_page = $max_rows;
     $pos_to = strlen($this->sql_query);
     $query_lower = strtolower($this->sql_query);
     $pos_from = strpos($query_lower, ' from', 0);
     $pos_group_by = strpos($query_lower, ' group by', $pos_from);
     if ($pos_group_by < $pos_to && $pos_group_by != false) {
         $pos_to = $pos_group_by;
     }
     $pos_having = strpos($query_lower, ' having', $pos_from);
     if ($pos_having < $pos_to && $pos_having != false) {
         $pos_to = $pos_having;
     }
     $pos_order_by = strpos($query_lower, ' order by', $pos_from);
     if ($pos_order_by < $pos_to && $pos_order_by != false) {
         $pos_to = $pos_order_by;
     }
     if (strpos($query_lower, 'distinct') || strpos($query_lower, 'group by')) {
         $count_string = 'distinct ' . zen_db_input($count_key);
     } else {
         $count_string = zen_db_input($count_key);
     }
     $count_query = "select count(" . $count_string . ") as total " . substr($this->sql_query, $pos_from, $pos_to - $pos_from);
     if ($debug) {
         echo 'count_query=' . $count_query . '<br /><br />';
     }
     $count = $db->Execute($count_query);
     $this->number_of_rows = $count->fields['total'];
     $this->number_of_pages = ceil($this->number_of_rows / $this->number_of_rows_per_page);
     if ($this->current_page_number > $this->number_of_pages) {
         $this->current_page_number = $this->number_of_pages;
     }
     $offset = $this->number_of_rows_per_page * ($this->current_page_number - 1);
     // fix offset error on some versions
     if ($offset <= 0) {
         $offset = 0;
     }
     $this->sql_query .= " limit " . ($offset > 0 ? $offset . ", " : '') . $this->number_of_rows_per_page;
 }
开发者ID:bobjacobsen,项目名称:EventTools,代码行数:58,代码来源:split_page_results.php

示例7: xsell_get_products_id

function xsell_get_products_id($products_model)
{
    $sql = "SELECT products_id FROM " . TABLE_PRODUCTS . " WHERE products_model='" . zen_db_input($products_model) . "'";
    $result = mysql_query($sql);
    if (mysql_num_rows($result) == 0) {
        return null;
    }
    $row = mysql_fetch_array($result);
    return $row["products_id"];
}
开发者ID:homework-bazaar,项目名称:zencart-sugu,代码行数:10,代码来源:xsell_functions.php

示例8: zen_get_languages_id_by_code

function zen_get_languages_id_by_code($code)
{
    global $db;
    $query = "\n      select languages_id\n      from " . TABLE_LANGUAGES . "\n      where code like '" . zen_db_input($code) . "';";
    $result = $db->Execute($query);
    if ($result->RecordCount() > 0) {
        return $result->fields['languages_id'];
    }
    return false;
}
开发者ID:homework-bazaar,项目名称:zencart-sugu,代码行数:10,代码来源:functions_m17n.php

示例9: query

 function query($order_id)
 {
     global $db;
     $order = $db->Execute("select cc_cvv, customers_name, customers_company, customers_street_address,\n                                    customers_suburb, customers_city, customers_postcode, customers_id,\n                                    customers_state, customers_country, customers_telephone,\n                                    customers_email_address, customers_address_format_id, delivery_name,\n                                    delivery_company, delivery_street_address, delivery_suburb,\n                                    delivery_city, delivery_postcode, delivery_state, delivery_country,\n                                    delivery_address_format_id, billing_name, billing_company,\n                                    billing_street_address, billing_suburb, billing_city, billing_postcode,\n                                    billing_state, billing_country, billing_address_format_id,\n                                    coupon_code, payment_method, payment_module_code, shipping_method, shipping_module_code,\n                                    cc_type, cc_owner, cc_number, cc_expires, currency,\n                                    currency_value, date_purchased, orders_status, last_modified,\n                                    order_total, order_tax, ip_address\n                             from " . TABLE_ORDERS . "\n                             where orders_id = '" . (int) $order_id . "'");
     $totals = $db->Execute("select title, text, class, value\n                              from " . TABLE_ORDERS_TOTAL . "\n                              where orders_id = '" . (int) $order_id . "'\n                              order by sort_order");
     while (!$totals->EOF) {
         if ($totals->fields['class'] == 'ot_coupon') {
             $coupon_link_query = "SELECT coupon_id\n                  from " . TABLE_COUPONS . "\n                  where coupon_code ='" . zen_db_input($order->fields['coupon_code']) . "'";
             $coupon_link = $db->Execute($coupon_link_query);
             $zc_coupon_link = '<a href="javascript:couponpopupWindow(\'' . zen_catalog_href_link(FILENAME_POPUP_COUPON_HELP, 'cID=' . $coupon_link->fields['coupon_id']) . '\')">';
         }
         $this->totals[] = array('title' => $totals->fields['class'] == 'ot_coupon' ? $zc_coupon_link . $totals->fields['title'] . '</a>' : $totals->fields['title'], 'text' => $totals->fields['text'], 'value' => $totals->fields['value'], 'class' => $totals->fields['class']);
         $totals->MoveNext();
     }
     $this->info = array('currency' => $order->fields['currency'], 'currency_value' => $order->fields['currency_value'], 'payment_method' => $order->fields['payment_method'], 'payment_module_code' => $order->fields['payment_module_code'], 'shipping_method' => $order->fields['shipping_method'], 'shipping_module_code' => $order->fields['shipping_module_code'], 'coupon_code' => $order->fields['coupon_code'], 'cc_type' => $order->fields['cc_type'], 'cc_owner' => $order->fields['cc_owner'], 'cc_number' => $order->fields['cc_number'], 'cc_cvv' => $order->fields['cc_cvv'], 'cc_expires' => $order->fields['cc_expires'], 'date_purchased' => $order->fields['date_purchased'], 'orders_status' => $order->fields['orders_status'], 'total' => $order->fields['order_total'], 'tax' => $order->fields['order_tax'], 'last_modified' => $order->fields['last_modified'], 'ip_address' => $order->fields['ip_address']);
     $this->customer = array('name' => $order->fields['customers_name'], 'id' => $order->fields['customers_id'], 'company' => $order->fields['customers_company'], 'street_address' => $order->fields['customers_street_address'], 'suburb' => $order->fields['customers_suburb'], 'city' => $order->fields['customers_city'], 'postcode' => $order->fields['customers_postcode'], 'state' => $order->fields['customers_state'], 'country' => $order->fields['customers_country'], 'format_id' => $order->fields['customers_address_format_id'], 'telephone' => $order->fields['customers_telephone'], 'email_address' => $order->fields['customers_email_address']);
     $this->delivery = array('name' => $order->fields['delivery_name'], 'company' => $order->fields['delivery_company'], 'street_address' => $order->fields['delivery_street_address'], 'suburb' => $order->fields['delivery_suburb'], 'city' => $order->fields['delivery_city'], 'postcode' => $order->fields['delivery_postcode'], 'state' => $order->fields['delivery_state'], 'country' => $order->fields['delivery_country'], 'format_id' => $order->fields['delivery_address_format_id']);
     $this->billing = array('name' => $order->fields['billing_name'], 'company' => $order->fields['billing_company'], 'street_address' => $order->fields['billing_street_address'], 'suburb' => $order->fields['billing_suburb'], 'city' => $order->fields['billing_city'], 'postcode' => $order->fields['billing_postcode'], 'state' => $order->fields['billing_state'], 'country' => $order->fields['billing_country'], 'format_id' => $order->fields['billing_address_format_id']);
     $index = 0;
     $orders_products = $db->Execute("select orders_products_id, products_id, products_name, products_model,\n                                              products_price, products_tax, products_quantity,\n                                              final_price, onetime_charges,\n                                              product_is_free\n                                       from " . TABLE_ORDERS_PRODUCTS . "\n                                       where orders_id = '" . (int) $order_id . "'\n                                       order by orders_products_id");
     while (!$orders_products->EOF) {
         // convert quantity to proper decimals - account history
         if (QUANTITY_DECIMALS != 0) {
             $fix_qty = $orders_products->fields['products_quantity'];
             switch (true) {
                 case !strstr($fix_qty, '.'):
                     $new_qty = $fix_qty;
                     break;
                 default:
                     $new_qty = preg_replace('/[0]+$/', '', $orders_products->fields['products_quantity']);
                     break;
             }
         } else {
             $new_qty = $orders_products->fields['products_quantity'];
         }
         $new_qty = round($new_qty, QUANTITY_DECIMALS);
         if ($new_qty == (int) $new_qty) {
             $new_qty = (int) $new_qty;
         }
         $this->products[$index] = array('qty' => $new_qty, 'id' => $orders_products->fields['products_id'], 'name' => $orders_products->fields['products_name'], 'model' => $orders_products->fields['products_model'], 'tax' => $orders_products->fields['products_tax'], 'price' => $orders_products->fields['products_price'], 'onetime_charges' => $orders_products->fields['onetime_charges'], 'final_price' => $orders_products->fields['final_price'], 'product_is_free' => $orders_products->fields['product_is_free']);
         $subindex = 0;
         // START "Stock by Attributes" added to array products_options_values_id and 'value_id' => $attributes->fields['products_options_values_id'],
         $attributes = $db->Execute("select products_options, products_options_values, options_values_price,\n                                           price_prefix, products_options_values_id,\n                                           product_attribute_is_free\n                                    from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . "\n                                    where orders_id = '" . (int) $order_id . "'\n                                    and orders_products_id = '" . (int) $orders_products->fields['orders_products_id'] . "'");
         if ($attributes->RecordCount() > 0) {
             while (!$attributes->EOF) {
                 $this->products[$index]['attributes'][$subindex] = array('option' => $attributes->fields['products_options'], 'value' => $attributes->fields['products_options_values'], 'value_id' => $attributes->fields['products_options_values_id'], 'prefix' => $attributes->fields['price_prefix'], 'price' => $attributes->fields['options_values_price'], 'product_attribute_is_free' => $attributes->fields['product_attribute_is_free']);
                 // END "Stock by Attributes"
                 $subindex++;
                 $attributes->MoveNext();
             }
         }
         $index++;
         $orders_products->MoveNext();
     }
 }
开发者ID:badarac,项目名称:stock_by_attribute_1.5.4,代码行数:55,代码来源:order.php

示例10: manufacturerExists

 function manufacturerExists($pManufacturersId)
 {
     global $gBitDb;
     $ret = NULL;
     if (is_numeric($pManufacturersId)) {
         $sql = "SELECT COUNT(*) as `total`\n\t\t\t\t\tFROM " . TABLE_MANUFACTURERS . "\n\t\t\t\t\tWHERE `manufacturers_id` = '" . zen_db_input($pManufacturersId) . "'";
         $rs = $gBitDb->Execute($sql);
         $ret = !empty($rs['fields']['total']);
     }
     return $ret;
 }
开发者ID:bitweaver,项目名称:commerce,代码行数:11,代码来源:Bitcart.php

示例11: zen_set_ezpage_status

function zen_set_ezpage_status($pages_id, $status, $status_field)
{
    global $db;
    if ($status == '1') {
        return $db->Execute("update " . TABLE_EZPAGES . " set " . zen_db_input($status_field) . " = '0'  where pages_id = '" . (int) $pages_id . "'");
    } elseif ($status == '0') {
        return $db->Execute("update " . TABLE_EZPAGES . " set " . zen_db_input($status_field) . " = '1'  where pages_id = '" . (int) $pages_id . "'");
    } else {
        return -1;
    }
}
开发者ID:ygeneration666,项目名称:ec,代码行数:11,代码来源:ezpages.php

示例12: zen_visitors_update_visitors_data

function zen_visitors_update_visitors_data($customers_id, $customers_email_address)
{
    global $db;
    $customers_id = zen_db_prepare_input($customers_id);
    $customers_email_address = zen_db_prepare_input($customers_email_address);
    $check_email = $db->Execute("select customers_email_address\r\n                               from " . TABLE_CUSTOMERS . "\r\n                               where customers_email_address = '" . zen_db_input($customers_email_address) . "'\r\n                               and customers_id != '" . (int) $customers_id . "'");
    if (!$check_email->RecordCount()) {
        $sql_data_array = array('visitors_email_address' => $customers_email_address, 'visitors_info_date_account_last_modified' => 'now()');
        zen_db_perform(TABLE_VISITORS, $sql_data_array, 'update', "visitors_id = '" . (int) $customers_id . "'");
    }
}
开发者ID:homework-bazaar,项目名称:zencart-sugu,代码行数:11,代码来源:functions.php

示例13: zen_get_languages_directory

function zen_get_languages_directory($code)
{
    global $db;
    $language = $db->Execute("select languages_id, directory \n                              from " . TABLE_LANGUAGES . " \n                              where code = '" . zen_db_input($code) . "'");
    if ($language->RecordCount() > 0) {
        $_SESSION['languages_id'] = $language->fields['languages_id'];
        return $language->fields['directory'];
    } else {
        return false;
    }
}
开发者ID:andychang88,项目名称:daddy-store.com,代码行数:11,代码来源:languages.php

示例14: splitPageResults

 function splitPageResults($query, $max_rows, $count_key = '*', $page_holder = 'page', $debug = false)
 {
     global $gBitDb;
     $this->sql_query = $query;
     $this->page_name = $page_holder;
     //lower case query to search for string positions
     $searchQuery = strtolower($query);
     if (isset($_GET[$page_holder])) {
         $page = $_GET[$page_holder];
     } elseif (isset($_POST[$page_holder])) {
         $page = $_POST[$page_holder];
     } else {
         $page = '';
     }
     if (empty($page) || !is_numeric($page)) {
         $page = 1;
     }
     $this->current_page_number = $page;
     $this->number_of_rows_per_page = $max_rows;
     $pos_to = strlen($this->sql_query);
     $pos_from = strpos($searchQuery, ' from', 0);
     $pos_group_by = strpos($searchQuery, ' group by', $pos_from);
     if ($pos_group_by < $pos_to && $pos_group_by != false) {
         $pos_to = $pos_group_by;
     }
     $pos_having = strpos($searchQuery, ' having', $pos_from);
     if ($pos_having < $pos_to && $pos_having != false) {
         $pos_to = $pos_having;
     }
     $pos_order_by = strpos($searchQuery, ' order by', $pos_from);
     if ($pos_order_by < $pos_to && $pos_order_by != false) {
         $pos_to = $pos_order_by;
     }
     if (strpos($searchQuery, 'distinct') || strpos($searchQuery, 'group by')) {
         $count_string = 'distinct ' . zen_db_input($count_key);
     } else {
         $count_string = zen_db_input($count_key);
     }
     $count_query = "select count(" . $count_string . ") as `total` " . substr($searchQuery, $pos_from, $pos_to - $pos_from);
     $count = $gBitDb->Execute($count_query);
     $this->number_of_rows = $count->fields['total'];
     $this->number_of_pages = ceil($this->number_of_rows / $this->number_of_rows_per_page);
     if ($this->current_page_number > $this->number_of_pages) {
         $this->current_page_number = $this->number_of_pages;
     }
     $offset = $this->number_of_rows_per_page * ($this->current_page_number - 1);
     // fix offset error on some versions
     if ($offset < 0) {
         $offset = 0;
     }
     $this->offset = $offset;
 }
开发者ID:bitweaver,项目名称:commerce,代码行数:52,代码来源:split_page_results.php

示例15: _install

 function _install()
 {
     global $db;
     // トップメニューの構築
     // 存在しない場合に自動で作成
     $sql = "create table if not exists " . TABLE_EASY_ADMIN_TOP_MENUS . " " . "(easy_admin_top_menu_id         int(11) auto_increment" . ",easy_admin_top_menu_name       varchar(255)" . ",is_dropdown                    int(1)" . ",easy_admin_top_menu_sort_order int(11)" . ",primary key (easy_admin_top_menu_id))";
     $db->execute($sql);
     $sql = "delete from " . TABLE_EASY_ADMIN_TOP_MENUS;
     $db->execute($sql);
     $topmenu = 1;
     for (;;) {
         $key = 'MODULE_EASY_ADMIN_TOP_DEFAULT_MENU_' . $topmenu;
         if (defined($key)) {
             $menu = explode(",", constant($key));
             $sql = "insert into " . TABLE_EASY_ADMIN_TOP_MENUS . " " . "(easy_admin_top_menu_id,easy_admin_top_menu_name,is_dropdown,easy_admin_top_menu_sort_order)" . "values (" . $topmenu . "," . "'" . zen_db_input($menu[0]) . "'," . (int) $menu[1] . "," . (int) topmenu . ")";
             $db->execute($sql);
             $topmenu++;
         } else {
             break;
         }
     }
     // サブメニューの構築
     // 存在しない場合に自動で作成
     $sql = "create table if not exists " . TABLE_EASY_ADMIN_SUB_MENUS . " " . "(easy_admin_sub_menu_id         int(11) auto_increment" . ",easy_admin_top_menu_id         int(11)" . ",easy_admin_sub_menu_name       varchar(255)" . ",easy_admin_sub_menu_url        varchar(255)" . ",easy_admin_sub_menu_sort_order int(11)" . ",primary key (easy_admin_sub_menu_id))";
     $db->execute($sql);
     $sql = "delete from " . TABLE_EASY_ADMIN_SUB_MENUS;
     $db->execute($sql);
     $topmenu = 1;
     for (;;) {
         if (!defined('MODULE_EASY_ADMIN_TOP_DEFAULT_MENU_' . $topmenu)) {
             break;
         }
         $key = 'MODULE_EASY_ADMIN_SUB_DEFAULT_MENU_' . $topmenu;
         if (defined($key . "_1")) {
             $submenu = 1;
             for (;;) {
                 $subkey = $key . "_" . $submenu;
                 if (defined($subkey)) {
                     $menu = explode(",", constant($subkey));
                     $sql = "insert into " . TABLE_EASY_ADMIN_SUB_MENUS . " " . "(easy_admin_top_menu_id,easy_admin_sub_menu_name,easy_admin_sub_menu_url,easy_admin_sub_menu_sort_order)" . "values (" . $topmenu . "," . "'" . zen_db_input($menu[0]) . "'," . "'" . zen_db_input($menu[1]) . "'," . $submenu . ")";
                     $db->execute($sql);
                     $submenu++;
                 } else {
                     break;
                 }
             }
         }
         $topmenu++;
     }
     $sql = "create table if not exists " . TABLE_ADMIN_ACL . " " . "(acl_id int(11) auto_increment," . "admin_id int(11)," . "easy_admin_top_menu_id int(11)," . "easy_admin_sub_menu_id int(11)," . "primary key (acl_id)" . ")";
     $db->execute($sql);
 }
开发者ID:homework-bazaar,项目名称:zencart-sugu,代码行数:52,代码来源:module.php


注:本文中的zen_db_input函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。