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


PHP CORE_database类代码示例

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


在下文中一共展示了CORE_database类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 <tony@agileco.com> 
 * @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


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