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

PHP str_dbparams函数代码示例

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

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



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

示例1: getSpeedDial

function getSpeedDial($card, &$dialnum)
{
    global $a2b;
    global $agi;
    // SPEED DIAL HANDLER
    if (($sp_prefix = getAGIconfig('speeddial_prefix', NULL)) != NULL) {
        if (strncmp($dialnum, $sp_prefix, strlen($sp_prefix)) == 0) {
            // translate the speed dial.
            $QRY = str_dbparams($a2b->DBHandle(), "SELECT phone, name FROM speeddials WHERE card_id = %#1 AND speeddial = %2", array($card['id'], substr($dialnum, strlen($sp_prefix))));
            $agi->conlog($QRY, 3);
            $res = $a2b->DBHandle()->Execute($QRY);
            // If the rate engine has anything to Notice/Warn, display that..
            if ($notice = $a2b->DBHandle()->NoticeMsg()) {
                $agi->verbose('DB:' . $notice, 2);
            }
            if (!$res) {
                $agi->verbose('Speed Dial: query error!', 2);
                $agi->conlog($a2b->DBHandle()->ErrorMsg(), 2);
                if (getAGIconfig('say_errors', true)) {
                    $agi->stream_file('allison2', '#');
                }
                break;
            } elseif ($res->EOF) {
                $agi->verbose('Speed Dial: no result.', 2);
            }
            $arr_speeddial = $res->fetchRow();
            $agi->conlog('Speed Dial : found ' . $arr_speeddial['phone'], 4);
            $dialnum = $arr_speeddial['phone'];
        }
    }
}
开发者ID:sayemk,项目名称:a2billing,代码行数:31,代码来源:dialfns.inc.php


示例2: Save

 /** Just saves the params and timestamp as an alarm_run row */
 public function Save($status = null)
 {
     $dbhandle = A2Billing::DBHandle();
     global $verbose;
     if ($status) {
         $this->ar_status = $status;
     }
     if (empty($this->ar_status)) {
         $this->ar_status = 1;
     }
     if ($this->ar_id) {
         // update a previous alarm_run record
         $qry = sql_dbparams($dbhandle, "UPDATE cc_alarm_run\n\t\t\t\tSET tmodify = now(), status = %#2, params = %!3\n\t\t\t\tWHERE id = %1;", array($this->ar_id, $this->ar_status, arr2url($this->ar_params)));
     } else {
         //no run record, insert
         $qry = str_dbparams($dbhandle, "INSERT INTO cc_alarm_run(alid,status,params)\n\t\t\t\tVALUES(%#1,%#2,%!3);", array($this->id, $this->ar_status, arr2url($this->ar_params)));
     }
     $res = $dbhandle->Execute($qry);
     if (!$res) {
         echo "Cannot mark alarm-run: ";
         echo $dbhandle->ErrorMsg() . "\n";
     } elseif ($dbhandle->Affected_Rows() < 1) {
         echo "Cannot update alarm run.\n";
     }
     if ($verbose > 1) {
         $str = $dbhandle->NoticeMsg();
         if ($str) {
             echo $str . "\n";
         }
     }
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:32,代码来源:Class.Alarm.inc.php


示例3: getGroup2

 /** Inserts some provisioning group 
 	   \return the id of the inserted record
 	  */
 protected function getGroup2($confname, $name, $subname = NULL, $opts)
 {
     $qry = str_dbparams($this->dbhandle, 'INSERT INTO provision_group(categ,model,name, sub_name, options) ' . 'VALUES(%1,%2,%3,%!4,%#5) RETURNING id; ', array('spa-conf', $confname, $name, $subname, $opts));
     $res = $this->dbhandle->Execute($qry);
     if (!$res) {
         $this->out(LOG_ERR, $this->dbhandle->ErrorMsg());
         throw new Exception('Cannot insert into database.');
     } elseif ($res->EOF) {
         $this->out(LOG_ERR, "No rows inserted!");
     }
     $row = $res->fetchRow();
     return $row['id'];
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:16,代码来源:Class.XmlImport.inc.php


示例4: buildSearchClause

 public function buildSearchClause(&$dbhandle, &$form, $search_exprs)
 {
     $val = $this->buildValue($form->getpost_dirty($this->fieldname), $form);
     $mo_val = $form->getpost_dirty('use_' . $this->fieldname);
     if (empty($mo_val)) {
         $mo_val = 'no';
     }
     if (empty($this->fieldexpr)) {
         $fldex = $this->fieldname;
     } else {
         $fldex = $this->fieldexpr;
     }
     if ($this->case_sensitive) {
         $like = 'LIKE';
     } else {
         $like = 'ILIKE';
     }
     if ($val == null) {
         switch ($mo_val) {
             case 'no':
             default:
                 return null;
             case 'eq':
                 return "{$fldex} IS NULL";
             case 'st':
             case 'en':
                 return null;
         }
     } else {
         switch ($mo_val) {
             case 'eq':
                 if ($this->case_sensitive) {
                     return str_dbparams($dbhandle, "{$fldex} = %1", array($val));
                 } else {
                     return str_dbparams($dbhandle, "lower({$fldex}) = lower(%1)", array($val));
                 }
             case 'st':
                 return str_dbparams($dbhandle, "{$fldex} {$like} %1 || '%%'", array($val));
             case 'en':
                 return str_dbparams($dbhandle, "{$fldex} {$like} '%%' || %1", array($val));
             case 'ct':
                 return str_dbparams($dbhandle, "{$fldex} {$like} '%%' || %1 || '%%'", array($val));
             case 'no':
             default:
                 return null;
         }
     }
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:48,代码来源:Class.TextSearchField.inc.php


示例5: update_mailing

function update_mailing(&$dbhandle, $id, $is_sent, $dbg)
{
    if ($is_sent) {
        $state = 3;
    } else {
        $state = 4;
    }
    $qry = str_dbparams($dbhandle, "UPDATE cc_mailings SET state = %#2 WHERE id = %1 ;", array($id, $state));
    $res = $dbhandle->Execute($qry);
    if ($dbg > 2) {
        echo "Update query: " . $qry . "\n";
    }
    if (!$res) {
        if ($dbg > 0) {
            echo "Query Failed: " . $dbhandle->ErrorMsg() . "\n";
        }
        return false;
    }
    return true;
}
开发者ID:sayemk,项目名称:a2billing,代码行数:20,代码来源:Send_Mail.inc.php


示例6: ProcessAlarm

 function ProcessAlarm(AlmInstance $inst)
 {
     $dbhandle = A2Billing::DBHandle();
     global $verbose;
     if ($inst->ar_id) {
         // we cannot handle previous instances
         return;
     }
     $margin = $inst->alm_params['margin'];
     if (!isset($margin)) {
         $margin = 0.0;
     }
     $qry = str_dbparams($dbhandle, "SELECT cc_agent.id, credit, name, locale, email, climit, cc_alarm_run.id AS ar_id,\n\t\t\t\tcc_alarm_run.status AS ar_status\n\t\t\tFROM cc_agent LEFT JOIN cc_alarm_run ON ( cc_alarm_run.dataid = cc_agent.id\n\t\t\t\tAND cc_alarm_run.alid = %#1) \n\t\t\tWHERE (climit + credit ) < %#2 ;", array($inst->id, $margin));
     if ($verbose > 2) {
         echo "Query: " . $qry . "\n";
     }
     $res = $dbhandle->Execute($qry);
     if (!$res) {
         echo $dbhandle->ErrorMsg() . "\n";
     } else {
         if ($res->EOF) {
             if ($verbose > 2) {
                 echo "All agents have credit.\n";
             }
             $inst->Save(1);
             return;
         }
     }
     $neg_agents = array();
     while ($row = $res->fetchRow()) {
         if ($verbose > 2) {
             echo "Agent " . $row['name'] . " is low on credit.\n";
         }
         if (!empty($row['email'])) {
             $this->sendMail('agent-low-credit', $row['email'], $row['locale'], array(credit => $row['credit'], climit => $row['climit']));
         }
         $neg_agents[] = $row['name'] . ": " . $row['credit'] . "/" . $row['climit'];
     }
     $this->sendSysMail('sys-agent-low-credit', $inst, array(low_agents => implode("\n", $neg_agents)));
     $inst->Save();
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:41,代码来源:agent-credit.inc.php


示例7: genContent

 public function genContent(&$outstream)
 {
     fwrite($outstream, "; Generated content\n\n");
     while ($crd = $this->itemres->fetchRow()) {
         foreach ($this->grprows as $grp) {
             $line = '';
             $qry = str_dbparams($this->dbhandle, "SELECT * FROM provisions " . "WHERE grp_id = %#1 ORDER BY metric;", array($grp['id']));
             $this->out(LOG_DEBUG, "Query: {$qry}");
             $pres = $this->dbhandle->Execute($qry);
             if (!$pres) {
                 $this->out(LOG_ERR, $this->dbhandle->ErrorMsg());
                 throw new Exception("Cannot locate provision");
             } elseif ($itemres->EOF) {
                 $this->out(LOG_WARNING, 'No rows for cc_card');
                 continue;
             }
             // Write a header like [name] ..
             $line = '[';
             if (!empty($grp['sub_name'])) {
                 $line .= str_alparams($grp['sub_name'], $crd);
             } else {
                 $line .= $grp['name'];
             }
             $line .= "]\n";
             fwrite($outstream, $line);
             while ($row = $pres->fetchRow()) {
                 $line = '';
                 if (!empty($row['sub_name'])) {
                     $line = str_alparams($row['sub_name'], $crd);
                 } else {
                     $line = $row['name'];
                 }
                 $line .= '=';
                 $line .= str_alparams($row['valuef'], $crd);
                 $line .= "\n";
                 fwrite($outstream, $line);
             }
             fwrite($outstream, "\n");
         }
     }
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:41,代码来源:AsteriskIni.inc.php


示例8: login

function login($user, $pass)
{
    global $FG_DEBUG;
    $DBHandle = A2Billing::DBHandle();
    $user = trim($user);
    $pass = trim($pass);
    if (strlen($user) == 0 || strlen($user) >= 50 || strlen($pass) == 0 || strlen($pass) >= 50) {
        return false;
    }
    $nameclause = "";
    if (DynConf::GetCfg(CUSTOMER_CFG, 'username_login', true)) {
        $nameclause = "username = %1";
    }
    if (DynConf::GetCfg(CUSTOMER_CFG, 'useralias_login', false)) {
        if (!empty($nameclause)) {
            $nameclause .= ' OR ';
        }
        $nameclause .= "useralias = %1";
    }
    if (DynConf::GetCfg(CUSTOMER_CFG, 'email_login', false)) {
        if (!empty($nameclause)) {
            $nameclause .= ' OR ';
        }
        $nameclause .= "email = %1";
    }
    if (($cgrp = DynConf::GetCfg(CUSTOMER_CFG, 'cardgroup_only', null)) != null) {
        $group_clause = ' AND grp = %#3';
    }
    $QUERY = str_dbparams($DBHandle, "SELECT id, username, status, currency, grp, language\n\t\t FROM cc_card WHERE ({$nameclause}) AND userpass = %2 {$group_clause} ;", array($user, $pass, $cgrp));
    $res = $DBHandle->Execute($QUERY);
    if (!$res) {
        $errstr = $DBHandle->ErrorMsg();
        if ($FG_DEBUG) {
            echo $errstr . "<br>\n";
        }
        return 4;
    }
    if ($res->EOF) {
        // no such user!
        if ($FG_DEBUG > 1) {
            echo "Query: {$QUERY} <br>";
        }
        return 1;
    }
    $row = $res->fetchRow();
    if ($row['status'] != 1) {
        return 0 - intval($row['status']);
    }
    //     if( ACTIVATEDBYUSER==1 && $row [0][7] != "t" && $row [0][7] != "1" ) {
    // 		return -2;
    // 	}
    return $row;
}
开发者ID:sayemk,项目名称:a2billing,代码行数:53,代码来源:login.php


示例9: iam_csvdump

#  Set the parameters: SQL Query, hostname, databasename, dbuser and password                                       #
#####################################################################################################################
$dumpfile = new iam_csvdump();
#  Call the CSV Dumping function and THAT'S IT!!!!  A file named dump.csv is sent to the user for download          #
#####################################################################################################################
if (strlen($id_tp) < 1) {
    echo gettext("ERROR CSV EXPORT");
} else {
    $log = new Logger();
    $DBHandle = DbConnect();
    $export_fields = array('dialprefix', 'destination', 'rateinitial');
    $sql_str = "ABORT;";
    switch ($export_style) {
        case 'peer-full-csv':
            array_push($export_fields, 'buyrate', 'buyrateinitblock', 'buyrateincrement', 'rateinitial', 'initblock', 'billingblock', 'connectcharge', 'disconnectcharge', 'stepchargea', 'chargea', 'timechargea', 'billingblocka', 'stepchargeb', 'chargeb', 'timechargeb', 'billingblockb', 'stepchargec', 'chargec', 'timechargec', 'billingblockc');
            $sql_str = str_dbparams($DBHandle, 'SELECT ' . implode(', ', $export_fields) . ' FROM cc_ratecard WHERE idtariffplan = %1;', array($id_tp));
            $log_str = "Ratecard #%0 exported in csv format, all fields in peer format";
            $myfileName = "Ratecard_" . $tp_id;
            $prolog = "# Export of tp #{$id_tp}\n";
            $prolog .= "#fields: " . implode(';', $export_fields) . "\n";
            break;
        default:
            echo "Wrong export style:" . $export_style . "\n<br>\n";
            die;
    }
    $myfileName .= date("Y-m-d");
    $log->insertLog($_SESSION["admin_id"], 2, "FILE EXPORTED", str_params($log_str, array($id_tp, $export_style)), '', $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI'], '');
    $dumpfile->sep = ';';
    $dumpfile->prolog = $prolog;
    $dumpfile->dump($sql_str, $myfileName, "csv", DBNAME, USER, PASS, HOST, DB_TYPE);
    DBDisconnect($DBHandle);
开发者ID:sayemk,项目名称:a2billing,代码行数:31,代码来源:tariffplan_export.php


示例10: gen_all_agents

function gen_all_agents($dbh, $do_sip, $do_iax, &$err_msg)
{
    global $FG_DEBUG;
    global $A2B;
    $ita = new Table('cc_agent', 'id, login,name');
    if ($FG_DEBUG > 1) {
        $ita->debug_st = 1;
    }
    $list_agent = $ita->Get_list($dbh, 'active = true', null, null, null, null);
    if (!is_array($list_agent) || count($list_agent) == 0) {
        $err_msg .= str_params(_("<p style='color: red'>No active agents found!<br>%1</p>"), array($dbh->ErrorMsg()), 1);
        return false;
    }
    // These are put by default on a non-existing directory!
    // This is intentional, since those files contain SIP/IAX passwords.
    // they shouldn't be carelessly left in a world-readable dir.
    if (isset($A2B->config['webui']['buddy_sip_agent'])) {
        $buddy_sip = $A2B->config['webui']['buddy_sip_agent'];
    } else {
        $buddy_sip = "/tmp/a2billing/additional_sip.%1.conf";
    }
    if (isset($A2B->config['webui']['buddy_iax_agent'])) {
        $buddy_iax = $A2B->config['webui']['buddy_iax_agent'];
    } else {
        $buddy_iax = "/tmp/a2billing/additional_iax.%1.conf";
    }
    $succ = 0;
    foreach ($list_agent as $ag) {
        $hdr_lines = "; Configuration for " . $ag[2] . "\n";
        if ($do_sip) {
            $fname = str_params($buddy_sip, $ag);
            $qclause = str_dbparams($dbh, "name IN (SELECT callerid FROM cc_booth WHERE agentid = %1)", array($ag[0]));
            if (gen_userdata($dbh, $fname, 'cc_sip_buddies', $qclause, $err_msg, $hdr_lines)) {
                $succ++;
            }
        }
        if ($do_iax) {
            $fname = str_params($buddy_iax, $ag);
            $qclause = str_dbparams($dbh, "name IN (SELECT callerid FROM cc_booth WHERE agentid = %1)", array($ag[0]));
            if (gen_userdata($dbh, $fname, 'cc_iax_buddies', $qclause, $err_msg, $hdr_lines)) {
                $succ++;
            }
        }
    }
    $co = 0;
    if ($do_sip) {
        $co += count($list_agent);
    }
    if ($do_iax) {
        $co += count($list_agent);
    }
    $err_msg .= str_params(_("<p style='color: blue'>Agent config files: %#1 of %#2 files created.</p>"), array($succ, $co), 1);
    return true;
}
开发者ID:sayemk,项目名称:a2billing,代码行数:54,代码来源:CC_generate_friend_file.php


示例11: db_fetchone

 function db_fetchone($qry, $parms = NULL)
 {
     if ($parms) {
         $res = $this->dbh->Execute(str_dbparams($this->dbh, $qry, $parms));
     } else {
         $res = $this->dbh->Execute($qry);
     }
     if (!$res) {
         $this->out(LOG_ERR, "Qry failed: {$qry} (" . implode(', ', $parms) . ')');
         $this->out(LOG_ERR, $this->dbh->ErrorMsg());
         throw new Exception("Query failed: {$qry}");
     }
     $row = $res->FetchRow();
     if (!$row) {
         throw new NoDataException("Query: \"{$qry}\": No results");
     }
     return $row;
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:18,代码来源:Class.SysLogImport.inc.php


示例12: formatDialstring_peer

function formatDialstring_peer($dialn, &$route, &$card, $do_param = true)
{
    global $a2b;
    global $agi;
    $dbhandle = $a2b->DBHandle();
    if ($route['stripdigits'] > 0) {
        $dialnum = substr($route['dialstring'], $route['stripdigits']);
    } else {
        $dialnum = $route['dialstring'];
    }
    $bind_str = '%dialtech/%dialname';
    switch ($route['trunkfmt']) {
        case 4:
            $qry = str_dbparams($dbhandle, 'SELECT dialtech, dialname FROM cc_dialpeer_local_v ' . 'WHERE useralias = %1', array($dialnum));
            $bind_str = '%dialtech/%dialname';
            if (strlen($route['providertech'])) {
                $qry .= str_dbparams($dbhandle, ' AND dialtech = %1', array($route['providertech']));
            }
            // If the trunk specifies an "ip", aliases among the corresponding numplan will be queried
            // else, the numplan *must* be the same with that of the card.
            // It would be wrong not to specify a numplan, since aliases accross them are not unique!
            if (strlen($route['providerip'])) {
                $qry .= str_dbparams($dbhandle, ' AND numplan_name = %1', array($route['providerip']));
            } else {
                $qry .= str_dbparams($dbhandle, ' AND numplan = %#1', array($card['numplan']));
            }
            break;
        case 6:
            // hardcode search into same numplan!
            $qry = str_dbparams($dbhandle, 'SELECT * FROM cc_dialpeer_remote_v ' . 'WHERE useralias = %1 AND numplan = %#2', array($dialnum, $card['numplan']));
            $bind_str = $route['providertech'] . '/' . $route['providerip'];
            break;
        case 7:
        case 15:
            $dnum = explode('-', $dialnum);
            if ($dnum[0] == 'L') {
                $dnum[0] = $card['numplan'];
            }
            $qry = str_dbparams($dbhandle, 'SELECT dialtech, dialname FROM cc_dialpeer_local_v ' . 'WHERE useralias = %2 AND numplan = %#1 ', $dnum);
            if (strlen($route['providertech'])) {
                $qry .= str_dbparams($dbhandle, ' AND dialtech = %1', array($route['providertech']));
            }
            $bind_str = '%dialtech/%dialname';
            $agi->conlog("Query: {$qry}", 3);
            break;
        case 8:
            $dnum = explode('-', $dialnum);
            if ($dnum[0] == 'L') {
                $dnum[0] = $card['numplan'];
            }
            $qry = str_dbparams($dbhandle, 'SELECT * FROM cc_dialpeer_remote_v ' . 'WHERE useralias = %2 AND numplan = %#1', $dnum);
            $agi->conlog("Query: {$qry}", 3);
            $bind_str = $route['providertech'] . '/' . $route['providerip'];
            break;
    }
    $qry .= ';';
    //$agi->conlog("Find peer from ". $qry,4);
    if (!$bind_str) {
        return false;
    }
    $res = $dbhandle->Execute($qry);
    if (!$res) {
        $agi->verbose('Cannot dial peer: ' . $dbhandle->ErrorMsg());
        if (getAGIconfig('say_errors', true)) {
            $agi->stream_file('allison2', '#');
        }
        return false;
    }
    if ($res->EOF) {
        $agi->verbose("Peer dial: cannot find peer " . $dialnum, 2);
        //$agi-> stream_file("prepaid-dest-unreachable",'#');
        return null;
    }
    // Feature! If more than one registrations exist, call all of them in
    // parallel!
    $peer_rows = array();
    while ($row = $res->fetchRow()) {
        $peer_rows[] = str_alparams($bind_str, $row);
    }
    $str = '';
    if ($do_param) {
        if ($agi->astmajor == "1.6") {
            $str .= getAGIconfig('dialcommand_param', ',60,iL(%timeout)%param');
        } else {
            $str .= getAGIconfig('dialcommand_param', '|60|iL(%timeout)%param');
        }
        $str = str_alparams($str, array('dialnum' => $dialnum, 'dialnumber' => $dialn, 'dialstring' => $route['dialstring'], 'destination' => $route['destination'], 'trunkprefix' => $route['trunkprefix'], 'tech' => $route['providertech'], 'providerip' => $route['providerip'], 'prefix' => $route['prefix'], 'param' => $route['trunkparm'], 'cardnum' => $card['username'], 'stimeout' => $route['tmout'], 'timeout' => 1000 * $route['tmout']));
    }
    return implode('&', $peer_rows) . $str;
}
开发者ID:sayemk,项目名称:a2billing,代码行数:90,代码来源:dialstring.inc.php


示例13: buildSearchClause

 public function buildSearchClause(&$dbhandle, $form, $search_exprs)
 {
     $val = $this->buildValue($form->getpost_dirty($this->fieldname), $form);
     if (empty($this->fieldexpr)) {
         $fldex = $this->fieldname;
     } else {
         $fldex = $this->fieldexpr;
     }
     if (is_array($search_exprs) && isset($search_exprs[$this->fieldname])) {
         $sex = $search_exprs[$this->fieldname];
     } else {
         $sex = '=';
     }
     //what's on *your* mind?
     if ($val == null) {
         switch ($sex) {
             // Assume NULL -> 0 ..
             case '<>':
             case '!=':
             case '>':
                 return $fldex . ' IS NOT NULL';
             case '<':
                 return 'false';
             case '>=':
                 return 'true';
             case '=':
             case '<=':
             default:
                 return $fldex . ' IS NULL';
         }
     } else {
         return str_dbparams($dbhandle, "{$fldex} {$sex} %1", array($val));
     }
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:34,代码来源:Class.BaseField.inc.php


示例14: ReleaseCard

     }
     $played_nec = true;
     ReleaseCard($card);
     $card = null;
     continue;
 }
 $played_nec = false;
 $dialnum = getDialNumber($card, $num_try == 0);
 if ($dialnum === false) {
     $agi->stream_file('prepaid-invalid-digits', '#');
     continue;
 }
 $agi->conlog("Dial number: " . $dialnum, 4);
 // CHECK SPEEDDIAL
 getSpeedDial($card, $dialnum);
 $QRY = str_dbparams($a2b->DBHandle(), 'SELECT * FROM RateEngine3(%#1, %2, %#3, now(), %4);', array($card['tgid'], $dialnum, $card['numplan'], $card_money['base']));
 $agi->conlog($QRY, 3);
 $res = $a2b->DBHandle()->Execute($QRY);
 // If the rate engine has anything to Notice/Warn, display that..
 if ($notice = $a2b->DBHandle()->NoticeMsg()) {
     $agi->verbose('DB:' . $notice, 2);
 }
 if (!$res) {
     $agi->verbose('Rate engine: query error!', 2);
     $agi->conlog($a2b->DBHandle()->ErrorMsg(), 2);
     if (getAGIconfig('say_errors', true)) {
         $agi->stream_file('allison2', '#');
     }
     ReleaseCard($card);
     $card = null;
     break;
开发者ID:sayemk,项目名称:a2billing,代码行数:31,代码来源:mode-standard.inc.php


示例15: buildUpdate

 public function buildUpdate(&$ins_arr, &$form)
 {
     if (!$this->does_edit) {
         return;
     }
     $ins_arr[] = str_dbparams($form->a2billing->DBHandle(), $this->fieldname . " = conv_currency_to( %1, %2)", array($this->buildValue($form->getpost_dirty($this->fieldname), $form), $form->a2billing->currency));
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:7,代码来源:Class.NumField.inc.php


示例16: reg_special2

 /** Allow special handling of other lines */
 protected function reg_special2($line2)
 {
     $tokens = array();
     if (preg_match('/\\[auto (.+)\\s*\\]/', $line2, $tokens) > 0) {
         $this->out(LOG_DEBUG, "Found auto header:" . $tokens[1]);
         $qry = str_dbparams($this->dbhandle, 'SELECT DISTINCT grp FROM cc_sysconf WHERE grp LIKE %1 ;', array($tokens[1] . '%'));
         $this->out(LOG_DEBUG, $qry);
         $rows = $this->dbhandle->GetAll($qry);
         if ($rows === false) {
             $this->out(LOG_ERR, $this->dbhandle->ErrorMsg());
             throw new Exception('Cannot query database');
         }
         for ($i = 1; $i < 100; $i++) {
             if (!in_array(array(grp => $tokens[1] . $i), $rows)) {
                 $this->cur_header = $tokens[1] . $i;
                 $this->out(LOG_DEBUG, "Will use " . $this->cur_header);
                 return true;
             }
         }
         $this->out(LOG_WARNING, "Cannot find useful group for " . $tokens[1] . "%x");
         $this->cur_header = false;
         //set it so that we skip the section!
         return true;
     }
     return false;
 }
开发者ID:sayemk,项目名称:a2billing,代码行数:27,代码来源:Class.IniImport.inc.php


示例17: _

    echo _("Pay back");
}
?>
 </p>
	<br><br><br>
<?php 
if (!isset($carry)) {
    $carry = 'f';
}
if (isset($sid)) {
    if ($pback == 0) {
        $sql_cmd = "SELECT format_currency(0 - pay_session( %1, %2, true, %3), %4, %5);";
    } else {
        $sql_cmd = "SELECT format_currency(pay_session( %1, %2, true, %3), %4, %5);";
    }
    $QUERY = str_dbparams($DBHandle, $sql_cmd, array($sid, $_SESSION['agent_id'], $carry, strtoupper(BASE_CURRENCY), $_SESSION['currency']));
    //echo htmlspecialchars($QUERY);
    $res = $DBHandle->query($QUERY);
} else {
    $res = false;
}
if ($res) {
    //echo gettype($res) . "<br>";
    $row = $res->fetchRow();
    //print_r($row);
    $sum = $row[0];
    ?>
	
	<p class="pay-message">
		<?php 
    if ($pback == 0) {
开发者ID:sayemk,项目名称:a2billing,代码行数:31,代码来源:pay.php


示例18: list

list($myyear, $mymonth) = split("-", $fromstatsmonth_sday);
$mymonth = $mymonth + 1;
if ($current_mymonth == 13) {
    $mymonth = 1;
    $myyear = $myyear + 1;
}
if (isset($choose_agent) && $choose_agent != '') {
    switch ($choose_agent) {
        case 'all':
            $tmp_agent_clause = 't1.username IN (SELECT cc_card.username FROM cc_card, cc_agent_cards WHERE cc_card.id = cc_agent_cards.card_id)';
            break;
        case 'no':
            $tmp_agent_clause = 't1.username NOT IN (SELECT cc_card.username FROM cc_card, cc_agent_cards WHERE cc_card.id = cc_agent_cards.card_id)';
            break;
        default:
            $tmp_agent_clause = str_dbparams($DBHandle, 't1.username IN (SELECT cc_card.username FROM cc_card, cc_agent_cards WHERE cc_card.id = cc_agent_cards.card_id AND cc_agent_cards.agentid = %1)', array((int) $choose_agent));
            break;
    }
}
for ($i = 0; $i < $months_compare + 1; $i++) {
    // creer un table legende
    $current_mymonth = $mymonth - $i;
    if ($current_mymonth <= 0) {
        $current_mymonth = $current_mymonth + 12;
        $minus_oneyar = 1;
    }
    $current_myyear = $myyear - $minus_oneyar;
    $current_mymonth2 = $mymonth - $i - 1;
    if ($current_mymonth2 <= 0) {
        $current_mymonth2 = $current_mymonth2 + 12;
        $minus_oneyar = 1;
开发者ID:sayemk,项目名称:a2billing,代码行数:31,代码来源:graph_pie.php


示例19: getVoucher

/**
 *	Function refill_card_with_voucher
 **/
function getVoucher($card)
{
    global $a2b;
    global $agi;
    $dbhandle = $a2b->DBHandle();
    $agi->conlog('Voucher refill with card', 4);
    $vtimeout = getAGIconfig('voucher-timeoute', 8000);
    $vmaxlen = getAGIconfig('voucher-maxlen', 15);
    $vminlen = getAGIconfig('voucher-minlen', 5);
    $vprompt = getAGIconfig('voucher-prompt', 'prepaid-voucher_enter_number');
    $vprompt_nexist = getAGIconfig('voucher-prompt-nexist', 'prepaid-voucher_does_not_exist');
    $vprompt_refill = getAGIconfig('voucher-prompt-refill', 'prepaid-account_refill');
    $vprompt_no_entered = getAGIconfig('voucher-prompt-no-entered', 'prepaid-no-voucher-entered');
    $vprompt_invalid = getAGIconfig('voucher-prompt-invalid', 'prepaid-invalid-voucher');
    $agi->conlog('Voucher-ivr: asking for Voucher', 4);
    $res_dtmf = $agi->get_data($vprompt, $vtimeout, $vmaxlen);
    $agi->conlog('Voucher-ivr: result ' . print_r($res_dtmf, true), 3);
    if (!isset($res_dtmf['result'])) {
        $agi->conlog('No Voucher entered', 2);
        $agi->stream_file($vprompt_no_entered, '#');
        return null;
    }
    $vouchernum = $res_dtmf['result'];
    if (strlen($vouchernum) < $vminlen || strlen($vouchernum) > $vmaxlen) {
        $agi->conlog('Invalid Voucher', 2);
        $agi->stream_file($vprompt_invalid, '#');
        return null;
    }
    // CALL STORED PROCEDURE FOR VOUCHER
    $QRY = str_dbparams($a2b->DBHandle(), 'SELECT * FROM  card_use_voucher (%1, %2);', array($card['id'], $vouchernum));
    $agi->conlog($QRY, 3);
    $res = $a2b->DBHandle()->Execute($QRY);
    // If the rate engine has anything to Notice/Warn, display that..
    if ($notice = $a2b->DBHandle()->NoticeMsg()) {
        $agi->verbose('DB:' . $notice, 2);
    }
    if (!$res) {
        $emsg = $dbhandle->ErrorMsg();
        if (substr($emsg, 0, 23) == 'ERROR:  card_use_voucher') {
            $msga = explode('|', $emsg);
            $agi->verbose('Could not use voucher: ' . $msga[3]);
            //$agi->conlog("Message: " . print_r($msga,true),4);
            switch ($msga[1]) {
                case 'voucher-no-find':
                    //$agi->stream_file('prepaid-card-in-use','#');
                    break;
                case 'voucher-zero':
                case 'conv_currency-failed':
                case 'conv_currency-failed-zero':
                    //TODO
                    break;
                default:
                    $agi->conlog('Unknown result from card_use_voucher: ' . $msga[1], 3);
            }
        } else {
            $agi->verbose('Could not use voucher : ' . $emsg);
        }
        $agi->stream_file($vprompt_invalid, '#');
        return null;
    }
    if ($res->EOF) {
        $agi->verbose('No used voucher in card_use_voucher(), why?');
        return null;
    }
    $agi->conlog('Unknown result from card_use_voucher: ' . $msga[1], 3);
    $row = $res->fetchRow();
    if (empty($row['card_use_voucher'])) {
        $agi->verbose('Fail to fetch on voucher ! ');
        return false;
    }
    $agi->conlog('Voucher used. Amount of credit added : ' . $row['card_use_voucher'], 3);
    $agi->stream_file($vprompt_refill, '#');
    // TODO : play the Amount of credit added
    return true;
}
开发者ID:sayemk,项目名称:a2billing,代码行数:78,代码来源:voucher.inc.php


示例20: genContent

    public function genContent(&$outstream)
    {
        fwrite($outstream, "<flat-profile>\n");
        fwrite($outstream, "\t<!-- Generated content -->\n\n");
        $dbhandle = $this->dbhandle;
        $passed_gen = false;
        if ($this->args['firsttime']) {
            $ftc = '';
        } else {
            $ftc = ' AND (options & 02 = 0 )';
        }
        $unquery = "SELECT DISTINCT * FROM provision_group " . " WHERE categ = %2 " . " AND model = %1 AND options = 0";
        $numquery = "SELECT DISTINCT * FROM provision_group " . " WHERE categ = %2 " . " AND model = %1 AND options = 1";
        if (!$this->args['firsttime']) {
            $unquery .= ' AND ( mtime IS NULL OR %!3 IS NULL OR mtime > %!3 )';
            $numquery .= ' AND ( mtime IS NULL OR %!3 IS NULL OR mtime > %!3 )';
        }
        $unquery .= ';';
        $numquery .= ';';
        while ($cardrow = $this->cardres->fetchRow()) {
            // find the unnumbered parameters:
            if (!$passed_gen) {
                $qry = str_dbparams($dbhandle, $unquery, array($cardrow['devmodel'], $this->confname, $cardrow['provi_date']));
                $this->out(LOG_DEBUG, "Query: {$qry}");
                $gres = $dbhandle->Execute($qry);
                if (!$gres) {
                    $this->out(LOG_ERR, $this->dbhandle->ErrorMsg());
                    throw new Exception("Cannot locate provision");
                } elseif ($gres->EOF) {
                    $this->out(LOG_DEBUG, 'No rows for provision groups');
                } else {
                    while ($grprow = $gres->fetchRow()) {
                        $qry = str_dbparams($this->dbhandle, "SELECT * FROM provisions " . "WHERE grp_id = %#1 AND (options & 16 = 0) {$ftc} ORDER BY metric;", array($grprow['id']));
                        $this->out(LOG_DEBUG, "Query: {$qry}");
                        $pres = $this->dbhandle->Execute($qry);
                        if (!$pres) {
                            $this->out(LOG_ERR, $this->dbhandle->ErrorMsg());
                            throw new Exception("Cannot locate provision");
                        } elseif (!$itemres->EOF) {
                            if (!$grphead) {
                                fwrite($outstream, "\t<!-- " . $grprow['sub_name'] . " -->\n");
                            }
                            $this->genContentElems($outstream, $pres, $cardrow);
                            $passed_gen = true;
                            $grphead = true;
                        }
                    }
                }
            }
            // Query again for numbered groups:
            $qry = str_dbparams($dbhandle, $numquery, array($cardrow['devmodel'], $this->confname, $cardrow['provi_date']));
            $this->out(LOG_DEBUG, "Query: {$qry}");
            $gres = $dbhandle->Execute($qry);
            if (!$gres) {
                $this->out(LOG_ERR, $this->dbhandle->ErrorMsg());
                throw new Exception("Cannot locate provision");
            } elseif ($gres->EOF) {
                $this->out(LOG_DEBUG, 'No rows for provision groups');
            } else {
                while ($grprow = $gres->fetchRow()) {
                    $grphead = false;
                    if (empty($cardrow['provi_num'])) {
                        continue;
                    }
                    // And one for the numbered params
                    $qry = str_dbparams($this->dbhandle, "SELECT * FROM provisions " . "WHERE grp_id = %#1 {$ftc} ORDER BY metric;", array($grprow['id']));
                    $this->out(LOG_DEBUG, "Query: {$qry}");
                    $pres = $this->dbhandle->Execute($qry);
                    if (!$pres) {
                        $this->out(LOG_ERR, $this->dbhandle->ErrorMsg());
                        throw new Exception("Cannot locate provision");
                    } elseif (!$itemres->EOF) {
                        if (!$grphead) {
                            fwrite($outstream, "\t<!-- " . $grprow['sub_name'] . " -->\n");
                        }
                        $this->genContentElems($outstream, $pres, $cardrow, $cardrow['provi_num']);
                        $grphead = true;
                    }
                }
            }
        }
        fwrite($outstream, "\n</flat-profile>\n");
        $qry = str_dbparams($dbhandle, 'UPDATE cc_ast_users SET provi_date = now() ' . ' WHERE cc_ast_users.macaddr = %1
			  AND cc_ast_users.devsecret = %2
			  AND EXISTS (SELECT 1 FROM provision_group WHERE categ = %3 
			  		AND model = cc_ast_users.devmodel) ;', array($this->args['mac'], $this->args['sec'], $this->confname));
        $this->out(LOG_DEBUG, "Query: {$qry}");
        $res = $this->dbhandle->Execute($qry);
        if (!$res) {
            $this->out(LOG_ERR, $this->dbhandle->ErrorMsg());
            $this->out(LOG_ERR, "Cannot Update provisioned device.");
        }
    }
开发者ID:sayemk,项目名称:a2billing,代码行数:93,代码来源:SpaXml_Provi.inc.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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