本文整理汇总了PHP中sqlSelect函数的典型用法代码示例。如果您正苦于以下问题:PHP sqlSelect函数的具体用法?PHP sqlSelect怎么用?PHP sqlSelect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sqlSelect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_html_menu
function smarty_function_html_menu($params, &$smarty)
{
$conditions = '';
extract($params);
if (empty($field)) {
$field = $name;
}
if (empty($id)) {
$id = $field;
}
$db =& DB();
$rs =& $db->Execute($sql = sqlSelect($db, $assoc_table, "id," . $assoc_field, $conditions, $assoc_field));
#echo $sql;
$return = '<select id="' . $id . '" name="' . $field . '">';
if ($default == "all" || $blank) {
$return .= '<option value="" selected></option>';
}
if ($rs && $rs->RecordCount() > 0) {
while (!$rs->EOF) {
$return .= '<option value="' . $rs->fields['id'] . '"';
if ($default == $rs->fields['id']) {
$return .= "selected";
}
$return .= '>' . $rs->fields["{$assoc_field}"] . '</option>';
$rs->MoveNext();
}
} else {
if ($default != "all") {
$return .= '<option value=""></option>';
}
}
$return .= '</select>';
echo $return;
}
示例2: config
/** Get the plugin settings from the database */
function config()
{
$db =& DB();
$rs =& $db->Execute(sqlSelect($db, "voip_did_plugin", "*", "id = {$this->id}"));
$this->release_minutes = $rs->fields['release_minutes'];
$this->avail_countries = $rs->fields['avail_countries'];
}
示例3: smarty_function_voip_did_id
function smarty_function_voip_did_id($params, &$smarty)
{
extract($params);
if (empty($service_id)) {
$smarty->trigger_error("voip_did_id: attribute 'service_id' required");
return false;
}
$db =& DB();
$rs = $db->Execute(sqlSelect($db, "service", "prod_attr_cart", "id=::" . $service_id . "::"));
$prod_attr_cart = unserialize($rs->fields['prod_attr_cart']);
$did = "";
if (!empty($prod_attr_cart['station'])) {
$did = $prod_attr_cart['station'];
}
if (!empty($prod_attr_cart['ported'])) {
$did = $prod_attr_cart['ported'];
}
if (substr($did, 0, 1) == "1") {
$did = "(did=::" . $did . ":: OR did=::" . substr($did, 1) . "::)";
} else {
$did = "did=::" . $did . "::";
}
$rs = $db->Execute($sql = sqlSelect($db, "voip_did", "id", $did));
return $rs->fields[0];
}
示例4: download
function download($VAR)
{
if (empty($VAR['id'])) {
return false;
}
$id = $VAR['id'];
// get ticket id
$db =& DB();
$rs = $db->Execute(sqlSelect($db, array("ticket_attachment", "ticket"), "A.ticket_id,B.department_id,B.account_id", "A.id=::{$id}:: AND A.ticket_id=B.id"));
if (!$rs || $rs->RecordCount() == 0) {
return false;
}
// is this an admin?
global $C_auth;
if ($C_auth->auth_method_by_name("ticket", "view")) {
// get the data & type
$rs = $db->Execute(sqlSelect($db, "ticket_attachment", "*", "id=::{$id}::"));
// set the header
require_once PATH_CORE . 'file_extensions.inc.php';
$ft = new file_extensions();
$type = $ft->set_headers_ext($rs->fields['type'], $rs->fields['name']);
if (empty($type)) {
echo imap_qprint($rs->fields['content']);
} elseif (preg_match("/^text/i", $type)) {
echo imap_base64($rs->fields['content']);
} else {
echo imap_base64($rs->fields['content']);
}
exit;
}
}
示例5: product_rates
/** Output avial/assigned rate tables for configuration
*/
function product_rates($VAR)
{
@($product = $VAR['product']);
$avail = false;
$assigned = false;
$db =& DB();
$as = $db->Execute($sql = sqlSelect($db, "voip_rate_prod", "voip_rate_id", "product_id = ::{$product}::"));
if ($as && $as->RecordCount() > 0) {
while (!$as->EOF) {
$av["{$as->fields['voip_rate_id']}"] = true;
$as->MoveNext();
}
}
$rs = $db->Execute($sql = sqlSelect($db, "voip_rate", "id,name,pattern,amount", ""));
if ($rs && $rs->RecordCount() > 0) {
while (!$rs->EOF) {
if (is_array($av) && array_key_exists($rs->fields['id'], $av)) {
$assigned[] = array('id' => $rs->fields['id'], 'name' => $rs->fields['name'] . ' - ' . substr($rs->fields['pattern'], 0, 20) . ' - ' . $rs->fields['amount']);
} else {
$avail[] = array('id' => $rs->fields['id'], 'name' => $rs->fields['name'] . ' - ' . substr($rs->fields['pattern'], 0, 20) . ' - ' . $rs->fields['amount']);
}
$rs->MoveNext();
}
}
global $smarty;
$smarty->assign('avail', $avail);
$smarty->assign('assigned', $assigned);
}
示例6: task
function task()
{
$db =& DB();
/* get the max invoice days from the setup_invoice table */
if (!$this->advance_days) {
$setup = $db->Execute(sqlSelect($db, "setup_invoice", "advance_notice", "advance_notice>0 and advance_notice != '' and advance_notice is not null"));
if (!$setup->RecordCount()) {
return false;
}
$this->advance_days = $setup->fields['advance_notice'];
}
/* pre-billing days global setting */
if (MAX_INV_GEN_PERIOD <= 0) {
$max_days = $max_date = 1;
} else {
$max_days = MAX_INV_GEN_PERIOD;
}
/* pre-notification date for service */
$this->advance_days_service = $this->advance_days + $max_days;
$max_date = time() + $this->advance_days_service * 86400;
date("Y-m-d", $max_date);
$p = AGILE_DB_PREFIX;
$s = DEFAULT_SITE;
$ids = false;
$account = false;
$date = false;
$invoice = false;
$sql = "SELECT DISTINCT service.id as serviceId, account.id as accountId, invoice.id as invoiceId, from_unixtime(service.date_next_invoice,'%Y-%m-%d') as dayGroup\n\t\t\t\t\tFROM {$p}service as service \n\t\t\t\t\tJOIN {$p}account as account ON ( service.account_id=account.id and account.site_id={$s} )\n\t\t\t\t\tLEFT JOIN {$p}invoice as invoice ON ( service.invoice_id=invoice.id and invoice.site_id={$s} )\n\t\t\t\t\tWHERE service.site_id={$s} \n\t\t\t\t\tAND service.active = 1 \n\t\t\t\t\tAND ( service.invoice_advance_notified IS NULL OR service.invoice_advance_notified = 0 )\n\t\t\t\t\tAND ( service.suspend_billing IS NULL OR service.suspend_billing = 0 ) \n\t\t\t\t\tAND ( service.date_next_invoice > 0 AND service.date_next_invoice IS NOT NULL )\n\t\t\t\t\tAND \n\t\t\t\t\t((\n\t\t\t\t\t ( account.invoice_advance_gen!='' OR account.invoice_advance_gen is not null ) AND service.date_next_invoice <= ((86400*(account.invoice_advance_gen+{$this->advance_days})) + (UNIX_TIMESTAMP(CURDATE())))\n\t\t\t\t\t ) OR (\n\t\t\t\t\t ( account.invoice_advance_gen='' OR account.invoice_advance_gen is null ) AND service.date_next_invoice <= {$max_date}\n\t\t\t\t\t))\n\t\t\t\t\tORDER BY accountId, dayGroup, serviceId";
$rs = $db->Execute($sql);
if ($rs === false) {
global $C_debug;
$C_debug->error('advance_notice.inc.php', 'task()', $sql . " \r\n\r\n " . @$db->ErrorMsg());
}
if ($rs && $rs->RecordCount()) {
while (!$rs->EOF) {
if ($ids && $rs->fields['accountId'] != $account || $rs->fields['dayGroup'] != $date) {
$this->sendEmail($ids, $account, $date);
$ids = false;
}
// set the current account and date
$account = $rs->fields['accountId'];
$invoice = $rs->fields['invoiceId'];
$date = $rs->fields['dayGroup'];
// add to id list
if ($ids) {
$ids .= ",";
}
$ids .= $rs->fields['serviceId'];
$rs->MoveNext();
}
if ($ids) {
$this->sendEmail($ids, $account, $date);
}
}
}
示例7: smarty_function_html_menu_multi
function smarty_function_html_menu_multi($params, &$smarty)
{
$conditions = '';
extract($params);
if (empty($field)) {
$field = $name;
}
if (empty($id)) {
$id = $field;
}
if (empty($size)) {
$size = '4';
}
$db =& DB();
$rs =& $db->Execute($sql = sqlSelect($db, $assoc_table, "id," . $assoc_field, $conditions, $assoc_field));
if (empty($default)) {
$default = array('');
} elseif (is_array($default)) {
$default = $default;
} elseif (is_numeric($default)) {
$default[] = $default;
} elseif (is_string($default)) {
$default = unserialize($default);
} else {
$default = array('');
}
if ($default == "all") {
$return .= '<option value="" selected></option>';
}
$i = 0;
if ($rs && $rs->RecordCount() > 0) {
while (!$rs->EOF) {
$return .= '<option value="' . $rs->fields['id'] . '"';
foreach ($default as $def) {
if ($def == $rs->fields["id"]) {
$return .= " selected";
}
break;
}
$return .= '>' . $rs->fields["{$assoc_field}"] . '</option>';
$i++;
$rs->MoveNext();
}
} else {
if ($default != "all") {
$return .= '<option value=""></option>';
}
}
$return .= '</select>';
if ($i < $size) {
$size = $i++;
}
echo '<select id="' . $id . '" name="' . $field . '[]" size="' . $size . '" value="" multiple>' . $return;
}
示例8: p_one
function p_one($id)
{
global $C_debug;
/* Get the service details */
$db =& DB();
$rs = $db->Execute(sqlSelect($db, "service", "*", "id=::{$id}::"));
if (!$rs || !$rs->RecordCount()) {
return false;
}
$this->service = $rs->fields;
@($this->plugin_data = unserialize($this->service['prod_plugin_data']));
@($this->prod_attr_cart = unserialize($this->service['prod_attr_cart']));
/* Get the account details */
$acct = $db->Execute(sqlSelect($db, "account", "*", "id=::{$this->service['account_id']}::"));
if ($acct && $acct->RecordCount()) {
$this->account = $acct->fields;
}
/* Get the product details */
if (!empty($this->service['product_id'])) {
$product = $db->Execute(sqlSelect($db, "product", "*", "id = ::{$this->service['product_id']}::"));
$this->product = $product->fields;
@($this->product_attr = unserialize($product->fields['prod_plugin_data']));
}
/* determine the correct action */
switch ($this->service['queue']) {
case 'new':
$result = $this->p_new();
break;
case 'active':
$result = $this->p_active();
break;
case 'inactive':
$result = $this->p_inactive();
break;
case 'edit':
if ($this->service['active'] == 1) {
$this->p_active();
} else {
$this->p_inactive();
}
$result = $this->p_edit();
break;
case 'delete':
$result = $this->p_delete();
break;
}
if (@$result !== false) {
$sql = 'UPDATE ' . AGILE_DB_PREFIX . 'service SET queue=' . $db->qstr('none') . ', date_last=' . $db->qstr(time()) . ' WHERE id =' . $db->qstr($rs->fields['id']) . ' AND site_id=' . $db->qstr(DEFAULT_SITE);
$upd = $db->Execute($sql);
} else {
$C_debug->error($this->name . 'php', $this->service['queue'], @$result);
}
}
示例9: view
/** view system message */
function view($VAR)
{
if (!SESS_LOGGED) {
return false;
}
$db =& DB();
$rs = $db->Execute(sqlSelect($db, "account_message", "date_orig,message", "id=1"));
if ($rs && $rs->RecordCount()) {
global $smarty;
$smarty->assign('message', $rs->fields['message']);
$smarty->assign('date', date("m-d-Y", $rs->fields['date_orig']));
}
}
示例10: getIsPasswordOk
function getIsPasswordOk($account_id, $password, $hashed = true)
{
if (!$hashed) {
$this->hashPassword($password);
}
$db =& DB();
/* currently used or used in duplicatePeriod? */
$date = time() - 86400 * $this->duplicateAfter;
$rs = $db->Execute(sqlSelect($db, "account_password_history", "id", "account_id={$account_id} and password=::{$password}:: and (date_last=0 OR (date_last > {$date} OR date_orig > {$date}))"));
if ($rs && $rs->RecordCount()) {
return false;
}
return true;
}
示例11: assign
function assign($serviceId, $assetPoolId)
{
// check if any available
$db =& DB();
$rs = $db->Execute(sqlSelect($db, "asset", "id,asset", "(status=0 or status is null) and pool_id=::{$assetPoolId}::", "", 1));
if ($rs && $rs->RecordCount()) {
$id = $rs->fields['id'];
$asset = $rs->fields['asset'];
$fields = array('service_id' => $serviceId, 'status' => 1, 'date_last' => time());
$db->Execute($sql = sqlUpdate($db, "asset", $fields, "id = {$id}"));
return $asset;
}
return false;
}
示例12: 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);
}
示例13: smarty_function_voip_did
function smarty_function_voip_did($params, &$smarty)
{
extract($params);
if (empty($service_id)) {
$smarty->trigger_error("voip_did: attribute 'service_id' required");
return false;
}
$db =& DB();
$rs = $db->Execute(sqlSelect($db, "service", "prod_attr_cart", "id=::" . $service_id . "::"));
$prod_attr_cart = unserialize($rs->fields['prod_attr_cart']);
if (!empty($prod_attr_cart['station'])) {
return $prod_attr_cart['station'];
}
if (!empty($prod_attr_cart['ported'])) {
return $prod_attr_cart['ported'];
}
}
示例14: p_new
function p_new()
{
# generate a password
$pass_len = 8;
$password = substr(md5(md5(time()) . $this->domain_name), 0, $pass_len);
$this->login['password'] = $password;
// connect to api
$rserver = new RRADServer($this->server_cfg['user'], $this->server_cfg['pass']);
if (!$rserver->authenticate()) {
if ($this->server['debug']) {
print "Couldn't authenticate against server b/c: " . $rserver->getMessage();
}
return false;
}
if ($this->server['debug']) {
print "RServer Msg: " . $rserver->getMessage() . "<br>";
}
$con_svc = $rserver->getConvenienceService();
// set properties
$properties = array("FirstName" => $this->account['first_name'], "LastName" => $this->account['last_name'], "Email" => $this->account['email'], "Company" => $this->account['company']);
// send command
$result = $con_svc->newDomain($this->domain_name, $this->login['password'], $this->plugin_data['package'], $properties);
if ($this->server['debug']) {
print "RServer Msg: " . $rserver->getMessage() . "<br>";
}
// return results
if ($result) {
// add service
$con_svc->addService($this->domain_name, $this->plugin_data['service']);
// update service record
$db =& DB();
$rs =& $db->Execute(sqlSelect($db, "service", "*", "id={$this->service_id}"));
$plugin_data = unserialize($rs->fields['host_provision_plugin_data']);
$insert = array('host_provision_plugin_data' => serialize($plugin_data), 'host_username' => $this->domain_name, 'host_password' => $this->login['password']);
$sql = $db->GetUpdateSQL($rs, $insert);
$result = $db->Execute($sql);
# send the user the details
include_once PATH_MODULES . 'email_template/email_template.inc.php';
$email = new email_template();
$email->send('host_new_user', $this->account['id'], $this->service_id, '', '');
return true;
}
return false;
}
示例15: user_view
function user_view($VAR)
{
/* validate, update to read, and view() */
if (!SESS_LOGGED || empty($VAR['id'])) {
return false;
}
/* select id for this user */
$db =& DB();
$rs = $db->Execute(sqlSelect($db, "email_log", "*", "id=::{$VAR['id']}:: and account_id=" . SESS_ACCOUNT));
if ($rs && $rs->RecordCount()) {
global $smarty;
$smarty->assign('email_log', $rs->fields);
if ($rs->fields['userread'] != 1) {
/* update to read */
$fields = array('userread' => 1);
$db->Execute(sqlUpdate($db, "email_log", $fields, "id = {$rs->fields['id']}"));
}
}
}