本文整理汇总了PHP中CORE_database::add方法的典型用法代码示例。如果您正苦于以下问题:PHP CORE_database::add方法的具体用法?PHP CORE_database::add怎么用?PHP CORE_database::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CORE_database
的用法示例。
在下文中一共展示了CORE_database::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
function add($VAR)
{
$type = "add";
$this->method["{$type}"] = explode(",", $this->method["{$type}"]);
$db = new CORE_database();
$db->add($VAR, $this, $type);
}
示例2: add
function add($VAR)
{
$this->newsletter_construct();
$type = "add";
$this->method["{$type}"] = split(",", $this->method["{$type}"]);
$db = new CORE_database();
$db->add($VAR, $this, $type);
}
示例3: add
function add($VAR)
{
$type = "add";
$this->method["{$type}"] = split(",", $this->method["{$type}"]);
$db = new CORE_database();
$id = $db->add($VAR, $this, $type);
### Set the static vars:
if ($id) {
global $smarty;
require_once PATH_CORE . 'static_var.inc.php';
$static_var = new CORE_static_var();
$static_var->add($VAR, $this->module, $id);
}
}
示例4: add
function add($VAR)
{
// check this is not a duplicate for the selected product/voip_rate record combo
$product_id = $VAR['voip_rate_prod_product_id'];
$voip_rate_id = $VAR['voip_rate_prod_voip_rate_id'];
$db =& DB();
$rs = $db->Execute(sqlSelect($db, 'voip_rate_prod', 'id', "product_id = ::{$product_id}:: AND voip_rate_id = ::{$voip_rate_id}::"));
if ($rs && $rs->RecordCount() > 0) {
echo "<script>alert('Specified product/voip_rate combo already exists, cannot create record'); history.back();</script>";
return false;
}
$type = "add";
$this->method["{$type}"] = explode(",", $this->method["{$type}"]);
$db = new CORE_database();
$db->add($VAR, $this, $type);
}
示例5: add
function add($VAR)
{
$type = "add";
$this->method["{$type}"] = explode(",", $this->method["{$type}"]);
$db = new CORE_database();
$group_id = $db->add($VAR, $this, $type);
# add the new group to the account_group table:
$db =& DB();
$record_id = $db->GenID(AGILE_DB_PREFIX . 'account_group_id');
$sql = "INSERT INTO " . AGILE_DB_PREFIX . "account_group SET\n\t\t\t\tid\t\t\t= " . $db->qstr($record_id) . ",\n\t\t\t\tsite_id \t= " . $db->qstr(DEFAULT_SITE) . ", \n\t\t\t\tdate_orig\t= " . $db->qstr(time()) . ",\n\t\t\t\tdate_expire = " . $db->qstr('0') . ",\n\t\t\t\tgroup_id\t= " . $db->qstr($group_id) . ",\n\t\t\t\taccount_id\t= " . $db->qstr(SESS_ACCOUNT) . ",\n\t\t\t\tactive\t\t= " . $db->qstr(1);
$result = $db->Execute($sql);
if ($result === false) {
global $C_debug;
$C_debug->error('list.inc.php', 'select_groups', $db->ErrorMsg());
return;
}
# update the current user's authentication so the newly added group appears
# as available to them
global $C_auth;
$C_auth->auth_update();
return;
}
示例6: add
function add($VAR)
{
global $_FILES, $C_translate, $C_debug;
$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 (preg_match('@' . $imgarr[$i] . '$@i', $_FILES['upload_file1']['name'])) {
$filename = $imgarr[$i];
$i = 10;
}
}
if (empty($filename)) {
echo 'You must upload a image file (jpg,gif,bmp,tiff,png)';
return;
} else {
$VAR["product_img_name"] = $_FILES['upload_file1']['name'];
$VAR["product_img_url"] = $filename;
$VAR["product_img_type"] = "0";
}
} else {
if (empty($VAR["img_url"])) {
echo 'You must either upload a image or specify an image URL!';
return;
} else {
$VAR["product_img_name"] = $VAR["img_url"];
$VAR["product_img_url"] = $VAR["img_url"];
$VAR["product_img_type"] = "1";
}
}
$type = "add";
$this->method["{$type}"] = explode(",", $this->method["{$type}"]);
$db = new CORE_database();
$result = $db->add($VAR, $this, $type);
# copy the image
if ($result && !empty($filename)) {
$file = 'prod_img_' . $result . '.' . $filename;
copy($_FILES['upload_file1']['tmp_name'], PATH_IMAGES . "" . $file);
}
}
示例7: add
function add($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'];
}
### Validate the image upoad:
if (isset($_FILES['upload_file2']) && $_FILES['upload_file2']['size'] > 0) {
$VAR['product_cat_image'] = "cat_img_" . $_FILES['upload_file2']['name'];
}
####################################################################
## Attempt to add the record:
$type = "add";
$this->method["{$type}"] = explode(",", $this->method["{$type}"]);
$db = new CORE_database();
$result = $db->add($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']);
}
}
}
示例8: add
function add($VAR)
{
# defaults for 'recurring' product
if ($VAR["product_price_type"] == "1") {
$VAR['product_price_recurr_default'] = "1";
$VAR['product_price_recurr_type'] = "0";
$VAR['product_price_recurr_week'] = "1";
$VAR['product_price_recurr_weekday'] = "1";
# Set default recurring prices: (monthly only)
$db =& DB();
$sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'group WHERE
site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND
pricing = ' . $db->qstr('1');
$rs = $db->Execute($sql);
while (!$rs->EOF) {
$i = $rs->fields['id'];
$recur_price[0][$i]['price_base'] = '';
$recur_price[0][$i]['price_setup'] = '';
@($recur_price[1][$i]['price_base'] = $VAR['product_price_base']);
@($recur_price[1][$i]['price_setup'] = $VAR['product_price_setup']);
$recur_price[2][$i]['price_base'] = '';
$recur_price[2][$i]['price_setup'] = '';
$recur_price[3][$i]['price_base'] = '';
$recur_price[3][$i]['price_setup'] = '';
$recur_price[4][$i]['price_base'] = '';
$recur_price[4][$i]['price_setup'] = '';
$recur_price[5][$i]['price_base'] = '';
$recur_price[5][$i]['price_setup'] = '';
$rs->MoveNext();
}
$recur_price[0]['show'] = "0";
$recur_price[1]['show'] = "1";
$recur_price[2]['show'] = "0";
$recur_price[3]['show'] = "0";
$recur_price[4]['show'] = "0";
$recur_price[5]['show'] = "0";
@($VAR['product_price_group'] = $recur_price);
}
# Defaults for product groups:
$VAR['product_group_avail'] = array('0');
$this->product_construct();
$type = "add";
$this->method["{$type}"] = explode(",", $this->method["{$type}"]);
$db = new CORE_database();
$result = $db->add($VAR, $this, $type);
# Create a translate record for this product:
if ($result) {
$db =& DB();
$id = $db->GenID(AGILE_DB_PREFIX . 'product_translate_id');
$sql = 'INSERT INTO ' . AGILE_DB_PREFIX . 'product_translate SET
site_id = ' . $db->qstr(DEFAULT_SITE) . ',
id = ' . $db->qstr($id) . ',
product_id = ' . $db->qstr($result) . ',
language_id = ' . $db->qstr(DEFAULT_LANGUAGE) . ',
name = ' . $db->qstr(@$VAR["translate_name"]) . ',
description_short = ' . $db->qstr(@$VAR["translate_description_short"]) . ',
description_full = ' . $db->qstr(@$VAR["translate_description_full"]);
$db->Execute($sql);
}
}
示例9: add
function add($VAR)
{
$type = "add";
$this->method["{$type}"] = split(",", $this->method["{$type}"]);
$db = new CORE_database();
$id = $db->add($VAR, $this, $type);
if (isset($id) && $id > 0) {
# Create 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 = $dir . 'index.php';
$fp = fopen($file, "w+");
fputs($fp, $data);
fclose($fp);
*/
}
}
示例10: add
function add($VAR)
{
global $C_translate, $C_debug;
$VAR['htaccess_dir_htaccess'] = '# Error!';
$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'] . '/';
}
}
if (isset($VAR['htaccess_dir_path']) && $VAR['htaccess_dir_path'] != '') {
################################################################
### VERIFY LOCAL PATH & WRITABILITY!
@($filename = $VAR['htaccess_dir_path'] . '.htaccess');
@($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)) {
## 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_current']);
}
return;
}
####################################################################
### Create the record/verify fields
$type = "add";
$this->method["{$type}"] = explode(",", $this->method["{$type}"]);
$db = new CORE_database();
$dir_id = $db->add($VAR, $this, $type);
####################################################################
### Create the .htaccess file
if (isset($dir_id) && $dir_id > 0) {
### GENERATE THE EXCLUDE LIST
$exclude_list = $this->exclude_list();
### GENERATE THE .HTACCESS FILE
$nl = "\n";
$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=' . $dir_id;
### Update the db record
$db =& DB();
$sql = "UPDATE " . AGILE_DB_PREFIX . "htaccess_dir SET\n\t\t\t\t htaccess = " . $db->qstr($data) . " WHERE\n\t\t\t\t id = " . $db->qstr($dir_id) . " AND\n\t\t\t\t site_id = " . $db->qstr(DEFAULT_SITE);
$result = $db->Execute($sql);
### WRITE THE LOCAL .HTACCESS FILE
$fp = fopen($filename, "w+");
fwrite($fp, $data);
fclose($fp);
### WRITE THE htaccess_index.php FILE
$php_filename = $VAR['htaccess_dir_path'] . 'htaccess_index.php';
$data = $this->create_php();
$fp = fopen($php_filename, "w+");
fwrite($fp, $data);
fclose($fp);
}
}
示例11: add
function add($VAR)
{
$this->static_page_category_construct();
$type = "add";
$this->method["{$type}"] = explode(",", $this->method["{$type}"]);
$db = new CORE_database();
$db->add($VAR, $this, $type);
}
示例12: add
function add($VAR)
{
$this->construct();
global $C_vars, $C_list, $C_debug;
### Strip Slashes:
global $C_vars;
$C_vars->strip_slashes_all();
### Get the current staff id:
$dbs =& DB();
$sql = 'SELECT id FROM ' . AGILE_DB_PREFIX . 'staff WHERE
site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND
account_id = ' . $dbs->qstr(SESS_ACCOUNT);
$result = $dbs->Execute($sql);
if ($result->RecordCount() == 0) {
### ERROR: this account does not have a staff id
global $C_debug, $C_translate;
$C_debug->alert($C_translate->translate('staff_no_account', 'ticket', ''));
$C_vars->strip_slashes_all();
return;
} else {
$staff_id = $result->fields['id'];
$VAR['ticket_staff_id'] = $staff_id;
}
### Validate either the user account_id or email has been provided.
include_once PATH_CORE . 'validate.inc.php';
$C_validate = new CORE_validate();
$validate = false;
if (empty($VAR['ticket_account_id']) && empty($VAR['ticket_email'])) {
$validate = false;
} elseif ($C_validate->validate_email(@$VAR['ticket_email'], false)) {
$validate = true;
}
### Set the e-mail from the account for this ticket if none provided:
if (!empty($VAR['ticket_account_id']) && empty($VAR['ticket_email'])) {
$sql = 'SELECT id,email FROM ' . AGILE_DB_PREFIX . 'account WHERE
site_id = ' . $dbs->qstr(DEFAULT_SITE) . ' AND
id = ' . $dbs->qstr(@$VAR['ticket_account_id']);
$account = $dbs->Execute($sql);
if ($account->RecordCount() == 0) {
$validate = false;
} else {
$this->email = trim($account->fields['email']);
$VAR['ticket_email'] = trim($account->fields['email']);
$validate = true;
}
}
### Everything pass inspection?
if (!$validate) {
$C_debug->alert("A valid user account or e-mail address must be provided!");
define('FORCE_PAGE', "ticket:add");
return;
}
### Set times:
$VAR['ticket_date_orig'] = $C_list->date_time(time());
$VAR['ticket_date_last'] = $C_list->date_time(time());
$VAR['ticket_last_reply'] = "0";
$VAR['ticket_status'] = "0";
$type = "add";
$this->method["{$type}"] = split(",", $this->method["{$type}"]);
$db = new CORE_database();
$this->record_id = $db->add($VAR, $this, $type);
if ($this->record_id) {
###################################################################
### Insert the static vars...
require_once PATH_CORE . 'static_var.inc.php';
$static_var = new CORE_static_var();
$static_var->add($VAR, 'ticket', $this->record_id);
###################################################################
### Mail the user the new_ticket email template
require_once PATH_MODULES . 'email_template/email_template.inc.php';
$my = new email_template();
if (empty($this->email)) {
global $VAR;
$VAR['key'] = $this->key($VAR['ticket_email']);
$VAR['email'] = trim($VAR['ticket_email']);
$my->send('ticket_staff_add_user', $VAR['ticket_email'], $this->record_id, '', '');
} else {
global $VAR;
$VAR['key'] = $this->key($this->email);
$VAR['email'] = trim($this->email);
$my->send('ticket_staff_add_user', $VAR['ticket_account_id'], $this->record_id, '', '');
}
###################################################################
### Get any staff members who should be mailed
$dba =& DB();
$sql = 'SELECT id,account_id,department_avail FROM ' . AGILE_DB_PREFIX . 'staff
WHERE
site_id = ' . $dba->qstr(DEFAULT_SITE) . ' AND
notify_new = ' . $dba->qstr("1");
$result = $dba->Execute($sql);
if ($result->RecordCount() > 0) {
while (!$result->EOF) {
@($avail = unserialize($result->fields['department_avail']));
for ($i = 0; $i < count($avail); $i++) {
if ($avail[$i] == $VAR['ticket_department_id']) {
###################################################################
### Mail staff members the new_ticket email template
$my = new email_template();
$my->send('ticket_staff_add', $result->fields['account_id'], $this->record_id, $avail[$i], '');
$i = count($avail);
//.........这里部分代码省略.........
示例13: add
function add($VAR)
{
global $_FILES, $smarty, $C_debug, $C_translate;
if ($VAR['file_location_type'] == '') {
return false;
}
$lt = $VAR['file_location_type'];
// UPLOADED FILE FROM LOCAL PC
if ($lt == 0) {
### Validate the file upoad:
if (!isset($_FILES['upload_file']) || $_FILES['upload_file']['size'] <= 0) {
global $C_debug;
$C_debug->alert('You must go back and enter a file for upload!');
return;
}
$VAR['file_size'] = $_FILES['upload_file']['size'];
$VAR['file_type'] = $_FILES['upload_file']['type'];
$VAR['file_name'] = $_FILES['upload_file']['name'];
} elseif ($lt == 1) {
### Validate the remote file can be opened and is greater than 0K
$file = $VAR['url_file'];
if (empty($file) || !($fp = fopen($file, "r"))) {
# error
$C_debug->alert($C_translate->translate('remote_file_err', 'file', ''));
return;
} else {
$VAR['file_location'] = $file;
$fn = explode("/", $file);
$count = count($fn) - 1;
$VAR['file_name'] = $fn[$count];
$headers = stream_get_meta_data($fp);
$headers = $headers['wrapper_data'];
for ($i = 0; $i < count($headers); $i++) {
if (preg_match('/^Content-Type:/i', $headers[$i])) {
$VAR['file_type'] = preg_replace('/Content-Type: /i', '', $headers[$i]);
} elseif (preg_match('/^Content-Length:/i', $headers[$i])) {
$VAR['file_size'] = preg_replace('/Content-Length: /i', '', $headers[$i]);
}
}
}
} elseif ($lt == 2) {
@($file = $VAR['local_file']);
if (is_file($file) && is_readable($file)) {
if (preg_match("@/@", $file)) {
$fn = explode("/", $file);
} else {
if (preg_match("@\\@", $file)) {
$fn = explode("\\", $file);
} else {
$fn[0] = $file;
}
}
$count = count($fn) - 1;
$VAR['file_name'] = $fn[$count];
$VAR['file_size'] = filesize($file);
$VAR['file_location'] = $file;
include_once PATH_CORE . 'file_extensions.inc.php';
$ext = new file_extensions();
$VAR['file_type'] = $ext->content_type($file);
} else {
$C_debug->alert($C_translate->translate('local_file_err', 'file', ''));
return;
}
} else {
return false;
}
### Create the record
$type = "add";
$this->method["{$type}"] = explode(",", $this->method["{$type}"]);
$db = new CORE_database();
$id = $db->add($VAR, $this, $type);
### Copy the uploaded file, or exit if fail:
if ($lt == 0) {
if (isset($id) && $id > 0) {
if (!copy($_FILES['upload_file']['tmp_name'], PATH_FILES . 'file_' . $id . '.dat')) {
$C_debug->alert($C_translate->translate('copy_file_err', 'file', ''));
}
}
unlink($_FILES['upload_file']['tmp_name']);
}
}
示例14: add
function add($VAR)
{
$VAR['host_server_keycode'] = md5(rand(99, 999) . microtime());
$type = "add";
$this->method["{$type}"] = explode(",", $this->method["{$type}"]);
$db = new CORE_database();
$db->add($VAR, $this, $type);
}
示例15: add
function add($VAR)
{
global $_FILES;
# 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'];
}
}
## Attempt to add the record:
$type = "add";
$this->method["{$type}"] = explode(",", $this->method["{$type}"]);
$db = new CORE_database();
$campaign_id = $db->add($VAR, $this, $type);
### Copy the files & delete temp files
if ($campaign_id > 0) {
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_' . $campaign_id . '_' . $i . '.dat')) {
### ERROR:
}
#unlink any temp files
unlink($_FILES['upload_file' . $i]['tmp_name']);
}
}
}
}