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


PHP CORE_database::update方法代码示例

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


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

示例1: update

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

示例2: update

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

示例3: update

 function update($VAR)
 {
     $this->construct();
     # provisioning data;
     if (!empty($VAR['product_host_provision_plugin_data'])) {
         $VAR['service_host_provision_plugin_data'] = $VAR['product_host_provision_plugin_data'];
         $s = serialize($VAR['service_host_provision_plugin_data']);
     }
     # product plugin data;
     if (!empty($VAR['product_prod_plugin_data'])) {
         $VAR['service_prod_plugin_data'] = $VAR['product_prod_plugin_data'];
     }
     # check if any changes were made that calls for edit queue status
     $queue = true;
     # get the previous data
     $db =& DB();
     $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'service WHERE
                    id           =  ' . $db->qstr($VAR['service_id']) . ' AND
                    site_id      =  ' . $db->qstr(DEFAULT_SITE);
     $rs = $db->Execute($sql);
     if (!empty($VAR['queue_force'])) {
         $queue = false;
     } elseif (!empty($VAR['service_host_provision_plugin_data'])) {
         # compare username
         if ($rs->fields['host_username'] != $VAR['service_host_username']) {
             $VAR['service_queue'] = 'edit';
             # compare password
         } elseif ($rs->fields['host_password'] != $VAR['service_host_password']) {
             $VAR['service_queue'] = 'edit';
             # compare ip
         } elseif (!empty($VAR['service_host_ip']) && $rs->fields['host_ip'] != $VAR['service_host_ip']) {
             $VAR['service_queue'] = 'edit';
             # compare plugin data
         } elseif ($rs->fields['host_provision_plugin_data'] != $s) {
             $VAR['service_queue'] = 'edit';
         } else {
             # suspend/unsuspend
             if ($VAR['service_active'] == 0 && $VAR['service_active'] != $rs->fields['active']) {
                 $VAR['service_queue'] = 'inactive';
             } elseif ($VAR['service_active'] == 1 && $VAR['service_active'] != $rs->fields['active']) {
                 $VAR['service_queue'] = 'active';
             } else {
                 $VAR['service_queue'] = $rs->fields['queue'];
                 $queue = false;
             }
         }
     } else {
         # suspend/unsuspend
         if ($VAR['service_active'] == 0 && $VAR['service_active'] != $rs->fields['active']) {
             $VAR['service_queue'] = 'inactive';
         } elseif ($VAR['service_active'] == 1 && $VAR['service_active'] != $rs->fields['active']) {
             $VAR['service_queue'] = 'active';
         } else {
             $VAR['service_queue'] = $rs->fields['queue'];
             $queue = false;
         }
     }
     # update record
     $type = "update";
     $this->method["{$type}"] = explode(",", $this->method["{$type}"]);
     $db = new CORE_database();
     $db->update($VAR, $this, $type);
     # Run queue now
     if ($queue) {
         $this->queue_one($VAR['service_id'], false);
         return true;
     }
 }
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:68,代码来源:service.inc.php

示例4: update

    function update($VAR)
    {
        global $C_list, $C_debug;
        if (!$this->checkLimits()) {
            return false;
        }
        // check account limits
        // validate the tax_id
        global $VAR;
        require_once PATH_MODULES . 'tax/tax.inc.php';
        $taxObj = new tax();
        $tax_arr = @$VAR['account_admin_tax_id'];
        if (is_array($tax_arr)) {
            foreach ($tax_arr as $country_id => $tax_id) {
                if ($country_id == $VAR['account_admin_country_id']) {
                    $exempt = @$VAR["account_tax_id_exempt"][$country_id];
                    if (!($txRs = $taxObj->TaxIdsValidate($country_id, $tax_id, $exempt))) {
                        $this->validated = false;
                        global $C_translate;
                        $this->val_error[] = array('field' => 'account_admin_tax_id', 'field_trans' => $taxObj->errField, 'error' => $C_translate->translate('validate_general', "", ""));
                    }
                    if ($exempt) {
                        $VAR['account_admin_tax_id'] = false;
                    } else {
                        $VAR['account_admin_tax_id'] = $tax_id;
                    }
                }
            }
        }
        ####################################################################
        ### Get required static_Vars and validate them... return an array
        ### w/ ALL errors...
        ####################################################################
        require_once PATH_CORE . 'static_var.inc.php';
        $static_var = new CORE_static_var();
        if (!isset($this->val_error)) {
            $this->val_error = false;
        }
        $all_error = $static_var->validate_form('account', $this->val_error);
        if ($all_error != false && gettype($all_error) == 'array') {
            $this->validated = false;
        } else {
            $this->validated = true;
        }
        ####################################################################
        # If validation was failed, skip the db insert &
        # set the errors & origonal fields as Smarty objects,
        # and change the page to be loaded.
        ####################################################################
        if (!$this->validated) {
            global $smarty;
            # set the errors as a Smarty Object
            $smarty->assign('form_validation', $all_error);
            # set the page to be loaded
            if (!defined("FORCE_PAGE")) {
                define('FORCE_PAGE', $VAR['_page_current']);
            }
            return;
        }
        ### 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($VAR['account_admin_id']);
        $result = $db->Execute($sql);
        if ($result->RecordCount() > 0) {
            $old_username = $result->fields['username'];
        }
        ### Update the password:
        $update_password = false;
        if (!empty($VAR['_password'])) {
            $VAR['account_admin_password'] = $VAR['_password'];
            /* check if new password is ok */
            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($VAR['account_admin_id'], $VAR['account_admin_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_admin_password']);
                } else {
                    $update_password = true;
                }
            }
        }
        ### Update the record
        $type = "update";
        $this->method["{$type}"] = explode(",", $this->method["{$type}"]);
        $db = new CORE_database();
        $ok = $db->update($VAR, $this, $type);
        if ($ok) {
            /* password logging class */
            if ($update_password && is_object($accountHistory)) {
                $accountHistory->setNewPassword($VAR['account_admin_id'], $VAR["account_admin_password"], false);
            }
            ### Update the static vars:
            $static_var->update($VAR, 'account', $VAR['account_admin_id']);
            ### Do any db_mapping
            if ($C_list->is_installed('db_mapping')) {
                include_once PATH_MODULES . 'db_mapping/db_mapping.inc.php';
                $db_map = new db_mapping();
//.........这里部分代码省略.........
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:101,代码来源:account_admin.inc.php

示例5: update

 function update($VAR)
 {
     global $_FILES;
     ####################################################################
     ### Validate the thumbnail upoad:
     if (isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0) {
         $VAR['product_cat_thumbnail'] = "cat_thmb_" . $_FILES['upload_file1']['name'];
     } elseif ($VAR['delthumb'] == 1) {
         $VAR['product_cat_thumbnail'] = "";
     }
     ### Validate the image upoad:
     if (isset($_FILES['upload_file2']) && $_FILES['upload_file2']['size'] > 0) {
         $VAR['product_cat_image'] = "cat_img_" . $_FILES['upload_file2']['name'];
     } elseif ($VAR['delimg'] == 1) {
         $VAR['product_cat_image'] = "";
     }
     $type = "update";
     $this->method["{$type}"] = explode(",", $this->method["{$type}"]);
     $db = new CORE_database();
     $result = $db->update($VAR, $this, $type);
     ####################################################################
     ### Copy the image(s)
     if ($result) {
         ### Copy 1ST file upoad:
         if (isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0) {
             copy($_FILES['upload_file1']['tmp_name'], PATH_IMAGES . "cat_thmb_" . $_FILES['upload_file1']['name']);
         }
         ### Copy the 2ND file upoad:
         if (isset($_FILES['upload_file2']) && $_FILES['upload_file2']['size'] > 0) {
             copy($_FILES['upload_file2']['tmp_name'], PATH_IMAGES . "cat_img_" . $_FILES['upload_file2']['name']);
         }
     }
 }
开发者ID:sluther,项目名称:agilebill,代码行数:33,代码来源:product_cat.inc.php

示例6: update

 function update($VAR)
 {
     global $_FILES;
     $imgarr = array('jpeg', 'jpg', 'gif', 'bmp', 'tif', 'tiff', 'png');
     if (isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0) {
         for ($i = 0; $i < count($imgarr); $i++) {
             if (eregi($imgarr[$i] . '$', $_FILES['upload_file1']['name'])) {
                 $filename = eregi_replace(',', '', 'prod_thmb_' . @$VAR["id"] . "." . $imgarr[$i]);
                 $i = 10;
             }
         }
     } elseif (@$VAR['delimg'] == 1) {
         $filename = "";
     }
     ### Validate the thumbnail upoad:
     if (isset($filename)) {
         $VAR['product_thumbnail'] = $filename;
     }
     $this->product_construct();
     $type = "update";
     $this->method["{$type}"] = explode(",", $this->method["{$type}"]);
     $db = new CORE_database();
     $result = $db->update($VAR, $this, $type);
     ### Copy the thumbnail
     if ($result && isset($filename)) {
         ### Copy 1ST file upoad:
         copy($_FILES['upload_file1']['tmp_name'], PATH_IMAGES . "" . $filename);
     }
 }
开发者ID:nicsopon,项目名称:agilebill,代码行数:29,代码来源:product.inc.php

示例7: update

 function update($VAR)
 {
     ####################################################################
     ### Get required static_Vars and validate them... return an array
     ### w/ ALL errors...
     ####################################################################
     require_once PATH_CORE . 'static_var.inc.php';
     $static_var = new CORE_static_var();
     if (!isset($this->val_error)) {
         $this->val_error = false;
     }
     $all_error = $static_var->validate_form('affiliate', $this->val_error);
     if ($all_error != false && gettype($all_error) == 'array') {
         $this->validated = false;
     } else {
         $this->validated = true;
     }
     ####################################################################
     # If validation was failed, skip the db insert &
     # set the errors & origonal fields as Smarty objects,
     # and change the page to be loaded.
     ####################################################################
     if (!$this->validated) {
         global $smarty;
         # set the errors as a Smarty Object
         $smarty->assign('form_validation', $all_error);
         # set the page to be loaded
         if (!defined("FORCE_PAGE")) {
             define('FORCE_PAGE', $VAR['_page_current']);
         }
         return;
     }
     # special handling for the affiliate data array
     if (isset($VAR['affiliate_plugin_data']) && is_array($VAR['affiliate_plugin_data'])) {
         while (list($key, $val) = each($VAR['affiliate_plugin_data'])) {
             if (get_magic_quotes_gpc()) {
                 $VAR['affiliate_plugin_data']["{$key}"] = htmlentities(stripcslashes($val), ENT_QUOTES);
             }
         }
     }
     $type = "update";
     $this->method["{$type}"] = explode(",", $this->method["{$type}"]);
     $db = new CORE_database();
     $db->update($VAR, $this, $type);
     ### Update the static vars:
     $static_var->update($VAR, 'affiliate', $VAR['affiliate_id']);
 }
开发者ID:sluther,项目名称:agilebill,代码行数:47,代码来源:affiliate.inc.php

示例8: 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

示例9: update

 function update($VAR)
 {
     // delete assoc faxdata records
     $this->associated_DELETE[] = array('table' => 'voip_fax_data', 'field' => 'fax_id');
     $type = "update";
     $this->method["{$type}"] = split(",", $this->method["{$type}"]);
     $db = new CORE_database();
     $db->update($VAR, $this, $type);
 }
开发者ID:hbustun,项目名称:agilebill,代码行数:9,代码来源:voip_fax.inc.php

示例10: update

 function update($VAR)
 {
     $this->construct();
     $db =& DB();
     # get current department
     $rs = $db->Execute(sqlSelect($db, "ticket", "ticket_department_id", "id=::" . $VAR['ticket_id'] . "::"));
     @($old_ticket_department_id = $rs->fields[0]);
     $type = "update";
     $this->method["{$type}"] = split(",", $this->method["{$type}"]);
     $db = new CORE_database();
     $db->update($VAR, $this, $type);
     # if the ticket was moved to a new department, send email notice to staff members
     if ($old_ticket_department_id != $VAR['ticket_department_id']) {
         $this->send_staff_emails($VAR['ticket_id'], SESS_ACCOUNT, $old_ticket_department_id, 'change');
     }
 }
开发者ID:hbustun,项目名称:agilebill,代码行数:16,代码来源:ticket.inc.php

示例11: update

    function update($VAR)
    {
        global $VAR;
        ### Check that user is logged in:
        if (SESS_LOGGED != '1') {
            echo "Sorry, you must be logged in!";
        }
        /* check for sub account */
        $issubaccount = false;
        if (!empty($VAR['account_id']) && $VAR['account_id'] != SESS_ACCOUNT) {
            if ($this->isParentAccount($VAR['account_id'])) {
                $VAR['id'] = $VAR['account_id'];
                global $smarty;
                $issubaccount = true;
            } else {
                return false;
            }
        } else {
            $VAR['id'] = SESS_ACCOUNT;
            $VAR['account_id'] = SESS_ACCOUNT;
        }
        $VAR['account_date_last'] = time();
        // validate the tax_id
        require_once PATH_MODULES . 'tax/tax.inc.php';
        $taxObj = new tax();
        $tax_arr = @$VAR['account_tax_id'];
        if (is_array($tax_arr)) {
            foreach ($tax_arr as $country_id => $tax_id) {
                if ($country_id == $VAR['cid']) {
                    $exempt = @$VAR["account_tax_id_exempt"][$country_id];
                    if (!($txRs = $taxObj->TaxIdsValidate($country_id, $tax_id, $exempt))) {
                        $this->validated = false;
                        global $C_translate;
                        $this->val_error[] = array('field' => 'account_tax_id', 'field_trans' => $taxObj->errField, 'error' => $C_translate->translate('validate_general', "", ""));
                    }
                    if ($exempt) {
                        $VAR['account_tax_id'] = false;
                    } else {
                        $VAR['account_tax_id'] = $tax_id;
                    }
                }
            }
        }
        ####################################################################
        ### Get required static_Vars and validate them... return an array
        ### w/ ALL errors...
        ####################################################################
        require_once PATH_CORE . 'static_var.inc.php';
        $static_var = new CORE_static_var();
        if (!isset($this->val_error)) {
            $this->val_error = false;
        }
        $all_error = $static_var->validate_form('account', $this->val_error);
        if ($all_error != false && gettype($all_error) == 'array') {
            $this->validated = false;
        } else {
            $this->validated = true;
        }
        ####################################################################
        # If validation was failed, skip the db insert &
        # set the errors & origonal fields as Smarty objects,
        # and change the page to be loaded.
        ####################################################################
        if (!$this->validated) {
            global $smarty;
            # set the errors as a Smarty Object
            $smarty->assign('form_validation', $all_error);
            # set the page to be loaded
            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"]);
//.........这里部分代码省略.........
开发者ID:hbustun,项目名称:agilebill,代码行数:101,代码来源:account.inc.php

示例12: update

 function update($VAR)
 {
     $type = "update";
     $this->method["{$type}"] = split(",", $this->method["{$type}"]);
     $db = new CORE_database();
     if ($db->update($VAR, $this, $type)) {
         ### Update the static vars:
         require_once PATH_CORE . 'static_var.inc.php';
         $static_var = new CORE_static_var();
         $static_var->update($VAR, 'newsletter_subscriber', $VAR['id']);
     }
 }
开发者ID:hbustun,项目名称:agilebill,代码行数:12,代码来源:newsletter_subscriber.inc.php

示例13: update

 function update($VAR)
 {
     # Validate the files
     for ($i = 1; $i <= 12; $i++) {
         if (isset($_FILES['upload_file' . $i]) && $_FILES['upload_file' . $i]['size'] > 0) {
             $VAR['campaign_type' . $i] = $_FILES['upload_file' . $i]['type'];
             $VAR['campaign_file' . $i] = $_FILES['upload_file' . $i]['name'];
         }
     }
     # Store the record
     $type = "update";
     $this->method["{$type}"] = explode(",", $this->method["{$type}"]);
     $db = new CORE_database();
     $rs = $db->update($VAR, $this, $type);
     ### Copy the files
     if ($rs) {
         for ($i = 1; $i <= 12; $i++) {
             if (isset($_FILES['upload_file' . $i]) && $_FILES['upload_file' . $i]['size'] > 0) {
                 if (!copy($_FILES['upload_file' . $i]['tmp_name'], PATH_FILES . 'campaign_' . $VAR['campaign_id'] . '_' . $i . '.dat')) {
                     ### ERROR:
                 }
             }
         }
     }
 }
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:25,代码来源:campaign.inc.php

示例14: update

    function update($VAR)
    {
        global $C_translate, $C_debug;
        $this->validated = true;
        ### Change the path...
        if (isset($VAR['htaccess_dir_path']) && $VAR['htaccess_dir_path'] != '') {
            # trim whitspaces
            $VAR['htaccess_dir_path'] = trim($VAR['htaccess_dir_path']);
            # replace all forward slashes with back slashes
            $VAR['htaccess_dir_path'] = ereg_replace('\\\\', '/', $VAR['htaccess_dir_path']);
            # add the final trailing slash if missing
            if (!ereg('[/]$', $VAR['htaccess_dir_path'])) {
                $VAR['htaccess_dir_path'] = $VAR['htaccess_dir_path'] . '/';
            }
        }
        ### Change the .htaccess data
        if (isset($VAR['htaccess_dir_path']) && $VAR['htaccess_dir_path'] != '') {
            ################################################################
            ### VERIFY LOCAL PATH & WRITABILITY!
            @($filename = $VAR['htaccess_dir_path'] . '.htaccess');
            @($php_filename = $VAR['htaccess_dir_path'] . 'htaccess_index.php');
            @($id = $VAR['htaccess_dir_htaccess_id']);
            $db =& DB();
            $sql = 'SELECT name FROM ' . AGILE_DB_PREFIX . 'htaccess WHERE
							site_id     = ' . $db->qstr(DEFAULT_SITE) . ' AND
							id          = ' . $db->qstr($id);
            $result = $db->Execute($sql);
            @($name = $result->fields['name']);
            ### Check path
            $path = $VAR['htaccess_dir_path'];
            if (is_dir($path)) {
                ### Check if is writable!
                if (is_writable($path)) {
                    ### GENERATE THE EXCLUDE LIST
                    $exclude_list = $this->exclude_list();
                    $nl = "\n";
                    /*
                    $data = $this->htaccess_extra .
                    		'RewriteEngine on'                          . $nl .
                    		'RewriteRule   ^(.*)/.*$      -                  [L]' . $nl .
                    		'RewriteRule '                              .
                    		'' . $exclude_list . '$ '           .
                    		'htaccess_index.php'                              .
                    		'?_HTACCESS_ID='.$id.'&_HTACCESS_DIR_ID='.$VAR["htaccess_dir_id"];
                    */
                    $data = $this->htaccess_extra . 'RewriteEngine on' . $nl;
                    if (empty($VAR['htaccess_dir_recursive'])) {
                        $data .= 'RewriteRule   ^(.*)/.*$      -                  [L]' . $nl;
                    }
                    $data .= 'RewriteRule ' . $exclude_list . '$ htaccess_index.php?_HTACCESS_ID=' . $id . '&_HTACCESS_DIR_ID=' . $VAR["htaccess_dir_id"];
                    ### Set the .htaccess var for the db
                    $VAR['htaccess_dir_htaccess'] = $data;
                } else {
                    ## Path not writable!
                    $this->validated = false;
                    $this->val_error[] = array('field' => 'none', 'field_trans' => $C_translate->translate('error', 'core', ""), 'error' => $C_translate->translate('path_auth', 'htaccess_dir', ""));
                }
            } else {
                ### Path broken!
                $this->validated = false;
                $this->val_error[] = array('field' => 'none', 'field_trans' => $C_translate->translate('error', 'core', ""), 'error' => $C_translate->translate('path_broke', 'htaccess_dir', ""));
            }
        }
        ####################################################################
        ### If validation was failed, skip the db insert &
        ### set the errors & origonal fields as Smarty objects,
        ### and change the page to be loaded.
        ####################################################################
        if (!$this->validated) {
            global $smarty;
            # set the errors as a Smarty Object
            $smarty->assign('form_validation', $this->val_error);
            # set the page to be loaded
            if (!defined("FORCE_PAGE")) {
                define('FORCE_PAGE', $VAR['_page']);
            }
            return;
        }
        ### Update the db record
        $type = "update";
        $this->method["{$type}"] = explode(",", $this->method["{$type}"]);
        $db = new CORE_database();
        $dir = $db->update($VAR, $this, $type);
        if ($dir != false) {
            ### UPDATE THE LOCAL .HTACCESS FILE
            $fp = fopen($filename, "w+");
            fwrite($fp, $data);
            fclose($fp);
            ### UPDATE THE LOCAL htaccess_index.php
            $data = $this->create_php();
            $fp = fopen($php_filename, "w+");
            fwrite($fp, $data);
            fclose($fp);
        }
    }
开发者ID:sluther,项目名称:agilebill,代码行数:95,代码来源:htaccess_dir.inc.php

示例15: update

    function update($VAR)
    {
        $type = "update";
        $this->method["{$type}"] = split(",", $this->method["{$type}"]);
        $db = new CORE_database();
        $result = $db->update($VAR, $this, $type);
        if ($result) {
            $id = $VAR['htaccess_id'];
            # Update the php index file for the Apache mod_auth_remote module:
            $GroupArray = '';
            for ($i = 0; $i < count($VAR['htaccess_group_avail']); $i++) {
                if ($i > 0) {
                    $GroupArray .= ',';
                }
                $GroupArray .= $VAR['htaccess_group_avail'][$i];
            }
            $data = '<?php
$Status = ' . @$VAR['htaccess_status'] . ';
$GroupArray = Array(' . $GroupArray . ');
if($Status != "1") { header(\'WWW-Authenticate: Basic realm="Failed"\'); header("HTTP/1.0 401 Unauthorized"); exit; }
include_once("../../../config.inc.php");
require_once(PATH_ADODB  . "adodb.inc.php");
require_once(PATH_CORE   . "database.inc.php");
require_once(PATH_MODULES. "htaccess/mod_auth_remote.inc.php"); 
?>';
            # add dir:
            $dir = PATH_FILES . 'htaccess_' . $id;
            if (!is_dir($dir)) {
                mkdir($dir, '755');
            }
            $file = PATH_FILES . 'htaccess_' . $id . '/index.php';
            $fp = fopen($file, "w+");
            fputs($fp, $data);
            fclose($fp);
        }
    }
开发者ID:hbustun,项目名称:agilebill,代码行数:36,代码来源:htaccess.inc.php


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