• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CORE_database类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: check

 function check($domain, $tld, $tld_array)
 {
     // check the domain validity:
     if (!preg_match('/^[a-zA-Z0-9\\-]{1,}$/i', $domain)) {
         return false;
     }
     if (preg_match('/[-]{2,}/', $domain)) {
         return false;
     }
     if (preg_match('/^[-]{1,}/', $domain)) {
         return false;
     }
     if (preg_match('/[-]{1,}$/', $domain)) {
         return false;
     }
     $db =& DB();
     $dbm = new CORE_database();
     $sql = $dbm->sql_select('service', 'id', "domain_name = ::{$domain}:: AND domain_tld = ::{$tld}::", "", $db);
     $rs = $db->Execute($sql);
     if ($rs == false || $rs->RecordCount() > 0) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:25,代码来源:SUBDOMAIN.php


示例2: update

 function update($VAR)
 {
     $type = "update";
     $this->method["{$type}"] = explode(",", $this->method["{$type}"]);
     $db = new CORE_database();
     $rs = $db->update($VAR, $this, $type);
 }
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:7,代码来源:setup_invoice.inc.php


示例3: search_show

 function search_show($VAR)
 {
     $this->construct();
     $type = "search";
     $this->method["{$type}"] = explode(",", $this->method["{$type}"]);
     $db = new CORE_database();
     $db->search_show($VAR, $this, $type);
 }
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:8,代码来源:asset_pool.inc.php


示例4: search_form

 function search_form($VAR)
 {
     $type = "search";
     $this->method["{$type}"] = split(",", $this->method["{$type}"]);
     $db = new CORE_database();
     $db->search_form($VAR, $this, $type);
 }
开发者ID:hbustun,项目名称:agilebill,代码行数:7,代码来源:host_registrar_plugin.inc.php


示例5: check

    function check($domain,$tld,$tld_array)
    {   
        // check the domain validity:
        if(!eregi('^[a-zA-Z0-9\-]{1,}$', $domain))  return false;
        if(eregi('[-]{2,}', $domain))               return false;
        if(eregi('^[-]{1,}', $domain))              return false;
        if(eregi('[-]{1,}$', $domain))              return false;
  
        $db = &DB();
        $dbm = new CORE_database;
        $sql = $dbm->sql_select('service', 'id', "domain_name = ::$domain:: AND domain_tld = ::$tld::","", $db);
        $rs = $db->Execute($sql); 
        if($rs == false || $rs->RecordCount() > 0) 
            return false;
        else
			return true;
    }
开发者ID:hbustun,项目名称:agilebill,代码行数:17,代码来源:SUBDOMAIN.php


示例6: user_search_show

 function user_search_show($VAR)
 {
     # Lock the user only for his billing_records:
     if (!SESS_LOGGED) {
         return false;
     }
     $this->construct();
     $type = "search";
     $this->method["{$type}"] = explode(",", $this->method["{$type}"]);
     $db = new CORE_database();
     $db->search_show($VAR, $this, $type);
 }
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:12,代码来源:service.inc.php


示例7: search_show

 function search_show($VAR)
 {
     $this->newsletter_construct();
     $type = "search";
     $this->method["{$type}"] = split(",", $this->method["{$type}"]);
     $db = new CORE_database();
     $db->search_show($VAR, $this, $type);
 }
开发者ID:hbustun,项目名称:agilebill,代码行数:8,代码来源:newsletter.inc.php


示例8: search_show

 function search_show($VAR)
 {
     $this->static_page_category_construct();
     $type = "search";
     $this->method["{$type}"] = split(",", $this->method["{$type}"]);
     $db = new CORE_database();
     $db->search_show($VAR, $this, $type);
 }
开发者ID:hbustun,项目名称:agilebill,代码行数:8,代码来源:static_page_category.inc.php


示例9: accounts

 function accounts()
 {
     global $VAR, $C_debug;
     $p = AGILE_DB_PREFIX;
     $s = DEFAULT_SITE;
     ### Connect to the remote Db;
     $dbr =& NewADOConnection($this->type);
     $dbr->Connect($this->host, $this->user, $this->pass, $this->db);
     ### Determine the offset for the account
     if (empty($VAR['offset'])) {
         $VAR['offset'] = 0;
     }
     @($offset = $VAR['offset'] . "," . $this->select_limit);
     # select each account from remote db
     $sql = "SELECT * FROM client_info  ";
     $rs = $dbr->SelectLimit($sql, $offset);
     if ($rs === false) {
         $C_debug->alert("Query to the table 'client_info' failed!");
         return false;
     }
     if ($rs->RecordCount() == 0) {
         $C_debug->alert("No more records to process!");
         echo "<script language=javascript>setTimeout('document.location=\\'?_page=import:import&plugin={$VAR['plugin']}\\'', 1500); </script>";
         return;
     }
     ### Get the default checkout plugin id:
     $db =& DB();
     $sql = "SELECT id FROM {$p}checkout WHERE\n\t\t\t\tsite_id = {$s} AND\n\t\t\t\tcheckout_plugin = '{$this->gateway}'";
     $ch = $db->Execute($sql);
     $checkout_plugin_id = $ch->fields['id'];
     $msg = "Processing " . $rs->RecordCount() . " Records...<BR>";
     # loop through each remote account
     while (!$rs->EOF) {
         $msg .= "<BR>Processing account: {$rs->fields['client_fname']} {$rs->fields['client_lname']}";
         # start a new transaction for the insert:
         $db =& DB();
         $db->StartTrans();
         # Get a local account id
         $id = $db->GenID($p . 'account_id');
         ## Get the country:
         $country = $rs->fields['client_country'];
         $db =& DB();
         $dbm = new CORE_database();
         $rscountry = $db->Execute($dbm->sql_select('country', 'id', "two_code = {$country}", '', &$db));
         if ($rscountry && $rscountry->RecordCount() == 1) {
             $country = $rscountry->fields['id'];
         } else {
             $country = DEFAULT_COUNTRY;
         }
         if (empty($rs->fields['client_username'])) {
             $username = $rs->fields['client_email'];
         } else {
             $username = $rs->fields['client_username'];
         }
         # Insert the account
         $sql = "INSERT INTO {$p}account SET\n\t\t\t\t\tid \t\t\t= {$id},\n\t\t\t\t\tsite_id\t\t= {$s},\n\t\t\t\t\tdate_orig\t= " . $db->qstr($rs->fields['client_stamp']) . ",\n\t\t\t\t\tdate_last\t= " . time() . ",\n\t\t\t\t\tlanguage_id\t= " . $db->qstr(DEFAULT_LANGUAGE) . ",\n\t\t\t\t\tcurrency_id\t= " . DEFAULT_CURRENCY . ",\n\t\t\t\t\ttheme_id\t= " . $db->qstr(DEFAULT_THEME) . ",\n\t\t\t\t\tusername\t= " . $db->qstr($username) . ",\n\t\t\t\t\tpassword\t= " . $db->qstr($rs->fields['client_password']) . ",\n\t\t\t\t\tmisc\t\t= " . $db->qstr("Phone: " . $rs->fields['client_phone1'] . "\r\nPhone #2: " . $rs->fields['client_phone2'] . "\r\n" . $rs->fields['client_comments']) . ",\n\t\t\t\t\tstatus\t\t= 1,\n\t\t\t\t\tcountry_id\t= {$country},\n\t\t\t\t\tfirst_name\t= " . $db->qstr($rs->fields['client_fname']) . ",\n\t\t\t\t\tlast_name\t= " . $db->qstr($rs->fields['client_lname']) . ",\n\t\t\t\t\tcompany\t\t= " . $db->qstr($rs->fields['client_company']) . ",\n\t\t\t\t\taddress1\t= " . $db->qstr($rs->fields['client_address']) . ",\n\t\t\t\t\taddress2\t= " . $db->qstr($rs->fields['client_address_2']) . ",\n\t\t\t\t\tcity\t\t= " . $db->qstr($rs->fields['client_city']) . ",\n\t\t\t\t\tstate\t\t= " . $db->qstr($rs->fields['client_state']) . ",\n\t\t\t\t\tzip\t\t\t= " . $db->qstr($rs->fields['client_zip']) . ",\n\t\t\t\t\temail\t\t= " . $db->qstr($rs->fields['client_email']) . ",\n\t\t\t\t\temail_type\t= 0";
         $db->Execute($sql);
         # Insert the import record
         $this->import_transaction($this->plugin, $VAR['action'], 'account', $id, 'client_info', $rs->fields['client_id'], &$db);
         # If cc details exist, import an account_billing record:
         if (!empty($rs->fields['billing_cc_type']) && !empty($rs->fields['billing_cc_exp'])) {
             # Get a local account_billing id
             $bill_id = $db->GenID($p . 'account_billing_id');
             $type = split("-", $rs->fields['billing_cc_type']);
             $exp = split("/", $rs->fields['billing_cc_exp']);
             # the modernbill encryption method is unknown, so we have no way to decrypt the cc details
             # we will create a blank CC record that the user or admin can manually update...
             $sql = "INSERT INTO {$p}account_billing SET\n\t\t\t\t\t\tid \t\t\t\t\t= {$bill_id},\n\t\t\t\t\t\tsite_id\t\t\t\t= {$s},  \n\t\t\t\t\t\taccount_id\t\t\t= {$id},\n\t\t\t\t\t\tcheckout_plugin_id \t= {$checkout_plugin_id},\n\t\t\t\t\t\tcard_type\t\t\t= " . $db->qstr(strtolower($type[0])) . ", \n\t\t\t\t\t\tcard_num4\t\t\t= " . $db->qstr($type[1]) . ", \n\t\t\t\t\t\tcard_exp_month\t\t= " . $db->qstr($exp[0]) . ", \n\t\t\t\t\t\tcard_exp_year\t\t= " . $db->qstr($exp[1]);
             $db->Execute($sql);
             # Insert the import record
             $this->import_transaction($this->plugin, $VAR['action'], 'account_billing', $bill_id, 'client_info', $rs->fields['client_id'], &$db);
         }
         # Complete the transaction
         $db->CompleteTrans();
         $rs->MoveNext();
     }
     $C_debug->alert($msg);
     $offset = $VAR['offset'] + $this->select_limit;
     echo "<script language=javascript> \n\t\t\t  setTimeout('document.location=\\'?_page=core:blank&offset={$offset}&action={$VAR['action']}&plugin={$VAR['plugin']}&do[]=import:do_action\\'', 1200);\n\t\t\t </script>";
 }
开发者ID:hbustun,项目名称:agilebill,代码行数:80,代码来源:ModernBill.php


示例10: CORE_database_search_show

/**
 * AgileBill - Open Billing Software
 *
 * This body of work is free software; you can redistribute it and/or
 * modify it under the terms of the Open AgileBill License
 * License as published at http://www.agileco.com/agilebill/license1-4.txt
 * 
 * For questions, help, comments, discussion, etc., please join the
 * Agileco community forums at http://forum.agileco.com/ 
 *
 * @link http://www.agileco.com/
 * @copyright 2004-2008 Agileco, LLC.
 * @license http://www.agileco.com/agilebill/license1-4.txt
 * @author Tony Landis <[email protected]> 
 * @package AgileBill
 * @version 1.4.93
 */
function CORE_database_search_show($VAR, &$construct, $type)
{
    # set the field list for this method:
    $arr = $construct->method[$type];
    $field_list = '';
    $i = 0;
    while (list($key, $value) = each($arr)) {
        if ($i == 0) {
            $field_var = $construct->table . '_' . $value;
            $field_list .= AGILE_DB_PREFIX . $construct->table . "." . $value;
            // determine if this record is linked to another table/field
            if ($construct->field[$value]["asso_table"] != "") {
                $construct->linked[] = array('field' => $value, 'link_table' => $construct->field[$value]["asso_table"], 'link_field' => $construct->field[$value]["asso_field"]);
            }
        } else {
            $field_var = $construct->table . '_' . $value;
            $field_list .= "," . AGILE_DB_PREFIX . $construct->table . "." . $value;
            // determine if this record is linked to another table/field
            if ($construct->field[$value]["asso_table"] != "") {
                $construct->linked[] = array('field' => $value, 'link_table' => $construct->field[$value]["asso_table"], 'link_field' => $construct->field[$value]["asso_field"]);
            }
        }
        $i++;
    }
    # get the search details:
    if (isset($VAR['search_id'])) {
        include_once PATH_CORE . 'search.inc.php';
        $search = new CORE_search();
        $search->get($VAR['search_id']);
    } else {
        # invalid search!
        echo '<BR> The search terms submitted were invalid!<BR>';
        # translate... # alert
        if (isset($construct->trigger["{$type}"])) {
            include_once PATH_CORE . 'trigger.inc.php';
            $trigger = new CORE_trigger();
            $trigger->trigger($construct->trigger["{$type}"], 0, $VAR);
        }
    }
    # Check that this search has not been taken over by another account
    if ($search->session != SESS && $search->account != SESS_ACCOUNT) {
        global $C_debug;
        $C_debug->alert('You are not authorized to view this search!');
        return false;
    }
    # get the sort order details:
    if (isset($VAR['order_by']) && $VAR['order_by'] != "") {
        $order_by = ' ORDER BY ' . $VAR['order_by'];
        $smarty_order = $VAR['order_by'];
    } else {
        $order_by = ' ORDER BY ' . $construct->order_by;
        $smarty_order = $search->order_by;
    }
    # determine the sort order
    if (isset($VAR['desc'])) {
        $order_by .= ' DESC';
        $smarty_sort = 'desc=';
    } else {
        if (isset($VAR['asc'])) {
            $order_by .= ' ASC';
            $smarty_sort = 'asc=';
        } else {
            if (!preg_match('/date/i', $smarty_order)) {
                $order_by .= ' ASC';
                $smarty_sort = 'asc=';
            } else {
                $order_by .= ' DESC';
                $smarty_sort = 'desc=';
            }
        }
    }
    # generate the full query
    $db =& DB();
    $q = preg_replace("/%%fieldList%%/i", $field_list, $search->sql);
    $q = preg_replace("/%%tableList%%/i", AGILE_DB_PREFIX . $construct->table, $q);
    $q = preg_replace("/%%whereList%%/i", "", $q);
    $q .= " site_id = '" . DEFAULT_SITE . "'";
    $q .= $order_by;
    ///////////////////////
    # determine the offset & limit
    $current_page = 1;
    $offset = -1;
    if (!empty($VAR['page'])) {
//.........这里部分代码省略.........
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:101,代码来源:database_search_show.inc.php


示例11: delete

 function delete($VAR)
 {
     $this->construct();
     $db = new CORE_database();
     $db->mass_delete($VAR, $this, "");
 }
开发者ID:hbustun,项目名称:agilebill,代码行数:6,代码来源:db_mapping.inc.php


示例12: update

 function update($VAR)
 {
     if ($VAR['setup_currency_id'] != DEFAULT_CURRENCY) {
         $curr = true;
     } else {
         $curr = false;
     }
     # make sure the index.php file is not included at the end:
     if (!empty($VAR['setup_ssl_url'])) {
         $VAR['setup_ssl_url'] = eregi_replace('index.php', '', $VAR['setup_ssl_url']);
     }
     if (!empty($VAR['setup_nonssl_url'])) {
         $VAR['setup_nonssl_url'] = eregi_replace('index.php', '', $VAR['setup_nonssl_url']);
     }
     # Validate trailing slash is on the end of the URL:
     if (!empty($VAR['setup_ssl_url']) && !ereg('/$', $VAR['setup_ssl_url'])) {
         $VAR['setup_ssl_url'] .= '/';
     }
     # Validate trailing slash is on the end of the URL:
     if (!empty($VAR['setup_nonssl_url']) && !ereg('/$', $VAR['setup_nonssl_url'])) {
         $VAR['setup_nonssl_url'] .= '/';
     }
     $type = "update";
     $this->method["{$type}"] = explode(",", $this->method["{$type}"]);
     $db = new CORE_database();
     $rs = $db->update($VAR, $this, $type);
     if ($rs && $curr) {
         /* Start: Update all sessions & accounts */
         $db =& DB();
         $sql = "UPDATE " . AGILE_DB_PREFIX . "session \n\t\t\t\t\tSET\n\t\t\t\t\tcurrency_id = " . $db->qstr($VAR['setup_currency_id']) . "\n\t\t\t\t\tWHERE\n\t\t\t\t\tsite_id \t= " . $db->qstr(DEFAULT_SITE) . " AND\n\t\t\t\t\tcurrency_id != " . $db->qstr($VAR['setup_currency_id']);
         $rs = $db->Execute($sql);
         $sql = "UPDATE " . AGILE_DB_PREFIX . "account \n\t\t\t\t\tSET\n\t\t\t\t\tcurrency_id = " . $db->qstr($VAR['setup_currency_id']) . "\n\t\t\t\t\tWHERE\n\t\t\t\t\tsite_id \t= " . $db->qstr(DEFAULT_SITE) . " AND\n\t\t\t\t\tcurrency_id != " . $db->qstr($VAR['setup_currency_id']);
         $rs = $db->Execute($sql);
         /* End: SQL Insert Statement */
     }
     # Clear out the cache entry
     if (defined("AGILE_CORE_CACHE_DIR") && AGILE_CORE_CACHE_DIR != '') {
         $tfile = AGILE_CORE_CACHE_DIR . "core-setup";
         if (file_exists($tfile)) {
             unlink(AGILE_CORE_CACHE_DIR . "core-setup");
         }
     }
 }
开发者ID:sluther,项目名称:agilebill,代码行数:43,代码来源:setup.inc.php


示例13: update


//.........这里部分代码省略.........
            if (!defined("FORCE_PAGE")) {
                define('FORCE_PAGE', $VAR['_page_current']);
            }
            return;
        }
        ### Change password
        $password_changed = false;
        if (isset($VAR['account_password']) && $VAR['account_password'] != "") {
            if (isset($VAR['confirm_password']) && $VAR['account_password'] == $VAR['confirm_password']) {
                $password = $VAR['account_password'];
                unset($VAR['account_password']);
                @($VAR["account_password"] = $password);
                ### Alert: the password has been changed!
                global $C_debug, $C_translate;
                $C_debug->alert($C_translate->translate('password_changed', 'account', ''));
                $password_changed = true;
                /* check if new password is ok */
                global $C_list;
                if ($C_list->is_installed('account_password_history')) {
                    include_once PATH_MODULES . 'account_password_history/account_password_history.inc.php';
                    $accountHistory = new account_password_history();
                    if (!$accountHistory->getIsPasswordOk(SESS_ACCOUNT, $VAR['account_password'], false)) {
                        $C_debug->alert("The password you have selected has been used recently and cannot be used again at this time for security purposes.");
                        unset($VAR["account_password"]);
                        $password_changed = false;
                    }
                }
            } else {
                ### ERROR: The passwords provided do not match!
                global $C_debug, $C_translate;
                $C_debug->alert($C_translate->translate('password_change_match', 'account', ''));
                unset($VAR["account_password"]);
            }
        } else {
            unset($VAR["account_password"]);
        }
        ### Change theme
        if (isset($VAR['tid']) && $VAR['tid'] != "") {
            @($VAR["account_theme_id"] = $VAR['tid']);
        }
        ### Change Language
        if (isset($VAR['lid']) && $VAR['lid'] != "") {
            @($VAR["account_language_id"] = $VAR['lid']);
        }
        ### Change country
        if (isset($VAR['cid']) && $VAR['cid'] != "") {
            @($VAR["account_country_id"] = $VAR['cid']);
        }
        ### Change currency
        if (isset($VAR['cyid']) && $VAR['cyid'] != "") {
            @($VAR["account_currency_id"] = $VAR['cyid']);
        }
        ### Get the old username ( for db mapping )
        $db =& DB();
        $sql = 'SELECT username FROM ' . AGILE_DB_PREFIX . 'account WHERE
					site_id     = ' . $db->qstr(DEFAULT_SITE) . ' AND
					id          = ' . $db->qstr(SESS_ACCOUNT);
        $result = $db->Execute($sql);
        if ($result->RecordCount() > 0) {
            $old_username = $result->fields['username'];
        }
        ### Update the record
        $this->account_construct();
        $type = "update";
        $this->method["{$type}"] = split(",", $this->method["{$type}"]);
        $db = new CORE_database();
        $db->update($VAR, $this, $type);
        /* password logging class */
        if ($password_changed && is_object($accountHistory)) {
            $accountHistory->setNewPassword(SESS_ACCOUNT, $VAR['account_password'], false);
        }
        ### Update the static vars:
        $static_var->update($VAR, 'account', SESS_ACCOUNT);
        ### Do any db_mapping
        global $C_list;
        if ($C_list->is_installed('db_mapping')) {
            include_once PATH_MODULES . 'db_mapping/db_mapping.inc.php';
            $db_map = new db_mapping();
            if (!empty($password)) {
                $db_map->plaintext_password = $password;
            } else {
                $db_map->plaintext_password = false;
            }
            $db_map->account_edit(SESS_ACCOUNT, $old_username);
        }
        /* update groups for subaccount */
        if ($issubaccount) {
            $db =& DB();
            $db->Execute(sqlDelete($db, "account_group", "group_id>2 and \n\t\t\t\t(service_id is null or service_id=0 or service_id='') \n\t\t\t\tand account_id=" . $db->qstr($VAR['account_id'])));
            if (!empty($VAR['groups'])) {
                global $C_auth;
                foreach ($VAR['groups'] as $gid => $val) {
                    if ($gid == $val && $C_auth->auth_group_by_id($gid)) {
                        $fields = array('account_id' => $VAR['account_id'], 'group_id' => $gid, 'active' => 1, 'date_orig' => time());
                        $db->Execute(sqlInsert($db, "account_group", $fields));
                    }
                }
            }
        }
    }
开发者ID:hbustun,项目名称:agilebill,代码行数:101,代码来源:account.inc.php


示例14: this_search_show

    function this_search_show($VAR, $construct, $type)
    {
        global $VAR;
        # Get the list of parents for this group
        $this->group_parent_list($VAR['module_method_group_id']);
        # generate the full query
        $q = "SELECT * FROM\n\t\t\t  " . AGILE_DB_PREFIX . "module_method\n\t\t\t  WHERE\n\t\t\t  module_id = " . $VAR['module_method_module_id'];
        $db =& DB();
        $result = $db->Execute($q);
        # put the results into a smarty accessable array
        $i = 0;
        $class_name = TRUE;
        while (!$result->EOF) {
            $smart[$i] = $result->fields;
            $method_id = $smart[$i]['id'];
            ## Get the auth status for this method & group
            $q1 = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'group_method WHERE
				method_id = ' . $smart[$i]['id'] . ' AND
				group_id  = ' . $VAR['module_method_group_id'];
            $db1 =& DB();
            $resulta = $db1->Execute($q1);
            #echo "<BR> $q1";
            ## authorized by current group
            if ($resulta->RecordCount() >= 1) {
                #echo "<BR>1 - This group matches!";
                $smart[$i]['checked'] = '1';
            } else {
                # get the parent group id(s) for this group
                $match = false;
                for ($ii = 0; $ii < count($this->group); $ii++) {
                    if ($match == false && $this->group[$ii] != $VAR['module_method_group_id']) {
                        $q2 = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'group_method
								WHERE method_id = ' . $method_id . '
								AND group_id = ' . $this->group[$ii];
                        $db2 =& DB();
                        $resultb = $db2->Execute($q2);
                        #echo "<BR> $q2";
                        if ($resultb->RecordCount() >= 1) {
                            $match = true;
                        }
                    }
                }
                ## authorized by parent
                if ($match) {
                    #echo "<BR>2 - This Parent Matches!";
                    $smart[$i]['checked'] = '2';
                } else {
                    ## not authorized
                    #echo "<BR>3 - NO matches";
                    $smart[$i]['checked'] = '3';
                }
            }
            if ($class_name) {
                $smart[$i]['_C'] = 'row2';
                $class_name = FALSE;
            } else {
                $smart[$i]['_C'] = 'row1';
                $class_name = TRUE;
            }
            $result->MoveNext();
            $i++;
        }
        # get any linked fields
        if ($i > 0) {
            $db_join = new CORE_database();
            $this->result = $db_join->join_fields($smart, $this->linked);
        } else {
            $this->result = $smart;
        }
        # get the result count:
        $results = $result->RecordCount();
        # define the DB vars as a Smarty accessible block
        global $smarty;
        # define the results
        $smarty->assign($construct->table, $this->result);
        $smarty->assign('page', $VAR['page']);
        $smarty->assign('order', 1111);
        $smarty->assign('sort', 1111);
        $smarty->assign('limit', 1111);
        $smarty->assign('search_id', 1111);
        $smarty->assign('results', $results);
        # get the total pages for this search:
        $this->pages = 1;
        if ($search->results % $search->limit) {
            $this->pages++;
        }
        # total pages
        $smarty->assign('pages', $this->pages);
        # current page
        $smarty->assign('page', $current_page);
        $page_arr = '';
        for ($i = 0; $i <= $this->pages; $i++) {
            if ($this->page != $i) {
                $page_arr[] = $i;
            }
        }
        # page array for menu
        $smarty->assign('page_arr', $page_arr);
    }
开发者ID:hbustun,项目名称:agilebill,代码行数:99,代码来源:module_method.inc.php


示例15: search_xml

 function search_xml($VAR, $construct, $type)
 {
     /************** BEGIN STANDARD EXPORT SEARCH CODE *********************/
     # set the field list for this method:
     $arr = $construct->method["{$type}"];
     # loop through the field list to create the sql queries
     $arr = $construct->method[$type];
     $field_list = '';
     $i = 0;
     while (list($key, $value) = each($arr)) {
         if ($i == 0) {
             $field_var = $construct->table . '_' . $value;
             $field_list .= AGILE_DB_PREFIX . $construct->table . '.' . $value;
             // determine if this record is linked to another table/field
             if ($construct->field[$value]["asso_table"] != "") {
                 $this->linked[] = array('field' => $value, 'link_table' => $construct->field[$value]["asso_table"], 'link_field' => $construct->field[$value]["asso_field"]);
             }
         } else {
             $field_var = $construct->table . '_' . $value;
             $field_list .= "," . AGILE_DB_PREFIX . $construct->table . "." . $value;
             // determine if this record is linked to another table/field
             if ($construct->field[$value]["asso_table"] != "") {
                 $this->linked[] = array('field' => $value, 'link_table' => $construct->field[$value]["asso_table"], 'link_field' => $construct->field[$value]["asso_field"]);
             }
         }
         $i++;
     }
     # get the search details:
     if (isset($VAR['search_id'])) {
         include_once PATH_CORE . 'search.inc.php';
         $search = new CORE_search();
         $search->get($VAR['search_id']);
     } else {
         echo '<BR> The search terms submitted were invalid!';
     }
     # get the sort order details:
     if (isset($VAR['order_by']) && $VAR['order_by'] != "") {
         $order_by = ' ORDER BY ' . AGILE_DB_PREFIX . $construct->table . '.' . $VAR['order_by'];
         $smarty_order = $VAR['order_by'];
     } else {
         $order_by = ' ORDER BY ' . AGILE_DB_PREFIX . $construct->table . '.' . $construct->order_by;
         $smarty_order = $search->order_by;
     }
     # format saved search string
     $sql = explode(" WHERE ", $search->sql);
     # generate the full query
     $q = preg_replace("/%%fieldList%%/i", $field_list, $search->sql);
     $q = preg_replace("/%%tableList%%/i", AGILE_DB_PREFIX . $construct->table, $q);
     $q = preg_replace("/%%whereList%%/i", "", $q);
     $q .= " " . AGILE_DB_PREFIX . $construct->table . ".site_id = '" . DEFAULT_SITE . "'";
     $q .= $order_by;
     $db =& DB();
     $result = $db->Execute($q);
     # error reporting
     if ($result === false) {
         global $C_debug;
         $C_debug->error('core:export.inc.php', 'search_xml', $db->ErrorMsg() . '<br><br>' . $q);
         echo "An SQL error has occured!";
         return;
     }
     # put the results into an array
     $i = 0;
     $class_name = TRUE;
     $results = '';
     while (!$result->EOF) {
         $results[$i] = $result->fields;
         $result->MoveNext();
         $i++;
     }
     # get any linked fields
     if ($i > 0) {
         $this->result = $results;
         $db_join = new CORE_database();
         $this->result = $db_join->join_fields($results, $this->linked);
     } else {
         $this->result = $results;
     }
     /************** END STANDARD EXPORT SEARCH CODE *********************/
     # create the xml processing instruction
     # header("Content-type: text/xml");
     $filename = 'XML_Export.xml';
     # determine what action to take:
     if ($VAR["type"] == "display") {
         header('Content-type: application/x-xml');
         header("Content-Disposition: inline; filename={$filename}");
     } else {
         if ($VAR["type"] == "download") {
             header("Content-Disposition: attachment; filename={$filename}");
         }
     }
     $_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n";
     $_xml .= "<results>\r\n";
     # loop through the resulsts and display as PDF
     $row = 0;
     for ($ii = 0; $ii < count($this->result); $ii++) {
         $_xml .= "\t<" . $construct->table . ">\r\n";
         # get the data for each cell:
         reset($arr);
         $column = 0;
         while (list($key, $value) = each($arr)) {
//.........这里部分代码省略.........
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:101,代码来源:export.inc.php


示例16: validate_product


//.........这里部分代码省略.........
         				# ONE is required
         				$assoc = false;
         				for($i=0; $i<count($reqarr); $i++) {
         					if($this->assoc_prod($reqarr[$i])) {
         						$assoc = true;
         						$i = count( $reqarr );
         					} else {
         						# add the required product:
         						$this->product_req_add($reqarr[$i]);
         					}
         				}
         			}*/
         if (!SESS_LOGGED) {
             $C_debug->alert($C_translate->translate('err_assoc_login', 'cart', ''));
             return false;
         }
         $items = '<br>';
         foreach ($reqarr as $prod_id) {
             $prodrs = $db->Execute(sqlSelect($db, "product_translate", "*", "product_id={$prod_id} AND language_id = ::" . SESS_LANGUAGE . "::"));
             if ($prodrs && $prodrs->RecordCount()) {
                 $items .= "- <b><a href=\"?_page=product:details&id={$prod_id}\">{$prodrs->fields['name']}</a></b><br>";
             }
         }
         $C_translate->value("cart", "items", $items);
         $msg = $C_translate->translate('err_assoc_req', 'cart', '');
         if ($reqtype == 0) {
             $C_debug->alert($msg . " " . $C_translate->translate('assoc_all', 'cart', ''));
         } else {
             $C_debug->alert($msg . " " . $C_translate->translate('assoc_one', 'cart', ''));
         }
         return false;
     }
     # Product Plugin Level Validation
     $product = $result;
     if (!empty($product->fields['prod_plugin']) && !empty($product->fields['prod_plugin_data'])) {
         $prodplgfile = PATH_PLUGINS . 'product/' . $product->fields['prod_plugin_file'] . '.php';
         if (is_file($prodplgfile)) {
             include_once PATH_PLUGINS . 'product/' . $product->fields['prod_plugin_file'] . '.php';
             eval('$prodplg = new plgn_prov_' . $product->fields['prod_plugin_file'] . ';');
             if (is_object($prodplg)) {
                 if (is_callable(array($prodplg, 'validate_cart'))) {
                     $result = $prodplg->validate_cart($VAR, $product);
                     if ($result === true) {
                     } else {
                         $C_debug->alert($result);
                         return false;
                     }
                 }
             }
         }
     }
     # Service upgrade
     if (!empty($VAR['service_id'])) {
         # validate account logged in
         if (SESS_LOGGED == false) {
             return false;
         }
         $dbm = new CORE_database();
         # validate account owns service, service is modifyable, active, not canceled, and exists
         $rs = $db->Execute($sql = $dbm->sql_select("service", "*", "recur_modify = 1 AND active = 1 AND ( suspend_billing IS NULL OR suspend_billing = 0 ) AND account_id = " . SESS_ACCOUNT . " AND id = {$VAR['service_id']}", "", $db));
         if ($rs === false || $rs->RecordCount() == 0) {
             return false;
         }
         # validate selected product_id is in allowed modify array for selected service
         if (empty($rs->fields['product_id'])) {
             return false;
         }
         $product_id = $rs->fields['product_id'];
         $prod = $db->Execute($dbm->sql_select("product", "*", "id = {$product_id}", "", $db));
         if ($prod === false || $prod->RecordCount() == 0) {
             return false;
         }
         $arr = unserialize($prod->fields['modify_product_arr']);
         if (!is_array($arr) || count($arr) == 0 || empty($arr[0])) {
             return false;
         }
         $do = false;
         foreach ($arr as $pid) {
             if ($pid == $VAR['product_id']) {
                 $do = true;
                 break;
             }
         }
         if (!$do) {
             return false;
         }
         # make sure this service is not in the cart
         $sql = 'DELETE FROM ' . AGILE_DB_PREFIX . 'cart WHERE site_id     = ' . $db->qstr(DEFAULT_SITE) . ' AND service_id  = ' . $db->qstr($VAR['service_id']);
         $rs = $db->Execute($sql);
         # make sure this service has no outstanding invoices:
         $p = AGILE_DB_PREFIX;
         $sql = "SELECT DISTINCT {$p}invoice.id, {$p}invoice_item.id\n\t            \t\tFROM {$p}invoice,{$p}invoice_item\n\t            \t\tWHERE {$p}invoice.site_id = " . DEFAULT_SITE . " AND {$p}invoice_item.site_id = " . DEFAULT_SITE . " \n\t            \t\tAND {$p}invoice_item.service_id = " . $db->qstr($VAR['service_id']) . " \n\t            \t\tAND {$p}invoice_item.invoice_id = {$p}invoice.id  AND {$p}invoice.billing_status != 1";
         $rs = $db->Execute($sql);
         if ($rs->RecordCount() > 0) {
             echo "Invoice(s) in unpaid status for selected service ID {$VAR['service_id']}, cannot upgrade";
             return false;
         }
     }
     return true;
 }
开发者ID:hbustun,项目名称:agilebill,代码行数:101,代码来源:cart.inc.php


示例17: search_show

 function search_show($VAR)
 {
     $type = "search";
     $this->method["{$type}"] = explode(",", $this->method["{$type}"]);
     $db = new CORE_database();
     $smart = $db->search_show($VAR, $this, $type);
     for ($i = 0; $i < count($smart); $i++) {
         # Get the stats for each advertisement:
         $budget = $smart[$i]['budget'];
         # Invoices referred
         $inv = $this->referred_invoices($smart[$i]['id']);
         $smart[$i]['invoices_referred'] = $inv[0];
         $smart[$i]['invoices_revenue'] = $inv[1];
         @($smart[$i]['invoice_avg'] = $inv[1] / $inv[0]);
         # total impressions & clicks:
         $impressions_total = 0;
         $clicks_total = 0;
         for ($ii = 1; $ii <= 12; $ii++) {
             $impressions_total += $smart[$i]["served" . $ii];
             $clicks_total += $smart[$i]["clicked" . $ii];
             if (empty($smart[$i]["served" . $ii]) && empty($smart[$i]["served" . $ii]) && empty($smart[$i]["served" . $ii])) {
                 $smart[$i]["show" . $ii] = false;
             } else {
                 $smart[$i]["show" . $ii] = true;
             }
         }
         $smart[$i]['impressions_total'] = $impressions_total;
         $smart[$i]['clicks_total'] = $clicks_total;
         # Impr. percentage, Clicks percentage, CTR
         $ctr_count = 0;
         $ctr_amt = 0;
         for ($ii = 1; $ii <= 12; $ii++) {
             # CTR
             if ($smart[$i]["show" . $ii]) {
                 $ctr = $smart[$i]["clicked" . $ii] / $smart[$i]["served" . $ii] * 100;
                 if ($ctr < 0) {
                     $smart[$i]['ctr' . $ii] = round($ctr) . '%';
                 } else {
                     $smart[$i]['ctr' . $ii] = round($ctr, 1) . '%';
                 }
                 $ctr_count++;
                 $ctr_amt += $ctr;
             } else {
                 $smart[$i]['ctr' . $ii] = "0%";
                 $ctr_count++;
             }
         }
         # CTR Avg:
         if ($ctr_count > 0) {
             $smart[$i]['ctr_avg'] = round($ctr_amt / $ctr_count, 2) . '%';
         } else {
             $smart[$i]['ctr_avg'] = "0%";
         }
         # CPC Avg:
         if ($clicks_total > 0) {
             $cpc_avg = $budget / $clicks_total;
             if ($cpc_avg < 0.1) {
                 $smart[$i]['cpc_avg'] = round($cpc_avg, 3);
             } else {
                 $smart[$i]['cpc_avg'] = round($cpc_avg, 2);
             }
         } else {
             $smart[$i]['cpc_avg'] = 0;
         }
         # CPI Avg:
         if ($impressions_total > 0) {
             $cpi_avg = $budget / $impressions_total;
             if ($cpi_avg < 0.1) {
                 $smart[$i]['cpi_avg'] = round($cpi_avg, 3);
             } else {
                 $smart[$i]['cpi_avg'] = round($cpi_avg, 2);
             }
         } else {
             $smart[$i]['cpi_avg'] = 0;
         }
         # Cost per Conversion:
         if ($inv[0] > 0 && $budget > 0) {
             $smart[$i]['conversion_cost'] = round($budget / $inv[0], 2);
         } else {
             $smart[$i]['conversion_cost'] = 0;
         }
         # ROI
         if ($inv[0] > 0 && $budget > 0) {
             $smart[$i]['roi'] = round($inv[1] / $budget * 100) . '%';
         } else {
             $smart[$i]['roi'] = '---';
         }
     }
     global $smarty;
     $smarty->assign('campaign', $smart);
 }
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:91,代码来源:campaign.inc.php


示例18: accounts

 function accounts()
 {
     global $VAR, $C_debug;
     $p = AGILE_DB_PREFIX;
     $s = DEFAULT_SITE;
     ### Connect to the remote Db;
     $dbr =& NewADOConnect 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CORE_xml类代码示例发布时间:2022-05-23
下一篇:
PHP COMMONFUNC类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap