本文整理汇总了PHP中dba_add函数的典型用法代码示例。如果您正苦于以下问题:PHP dba_add函数的具体用法?PHP dba_add怎么用?PHP dba_add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dba_add函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: teltree_handle
function teltree_handle($c_uid, $sms_datetime, $sms_sender, $sms_receiver, $teltree_keyword, $teltree_param = '', $smsc = '', $raw_message = '')
{
$ps = explode(" ", $raw_message, 2);
$kk = strtoupper($ps[0]);
$username = "admin";
if ($teltree_keyword == 'DAFTAR') {
$pecah = preg_split("/#/", $ps[1], null, PREG_SPLIT_NO_EMPTY);
$data = array();
$data['name'] = trim($pecah[0]);
$data['username'] = trim($pecah[0]);
$data['mobile'] = $sms_sender;
$data['email'] = str_replace(' ', '', $data['name']) . "@noreply.org";
$data['parent_uid'] = 1;
//----- ini parentnya admin
$data['status'] = 4;
//---ini artinya ditambahkan ke sub user
$ret = user_add($data);
$ok = $ret['status'] ? TRUE : FALSE;
if ($ok) {
echo "okee";
$items = array('uid' => 1, 'name' => $data['name'], 'mobile' => $data['mobile'], 'email' => $data['email'], 'tags' => $tags);
if ($c_pid = dba_add(_DB_PREF_ . '_featurePhonebook', $items)) {
$save_to_group = TRUE;
_log('Success to add contact pid:' . $c_pid . ' m:' . $data['mobile'] . ' n:' . $data['name'] . ' e:' . $data['email'] . ' tags:[' . $data['tags'] . ']', 2, 'teltree');
} else {
_log('Fail to add contact pid:' . $c_pid . ' m:' . $data['mobile'] . ' n:' . $data['name'] . ' e:' . $data['email'] . ' tags:[' . $data['tags'] . ']', 2, 'teltree');
}
$balasan = "Selamat anda telah terdaftar di Telephone Tree";
$gagal = "Maaf Sistem sedang mengalami gangguan, silahkan coba beberapa saat lagi";
if ($save_to_group) {
$unicode = core_detect_unicode($balasan);
$balasan = addslashes($balasan);
// $username = "admin";
//$smsc = "dev";
_log("returns:" . $balasan, 2, "teltree");
sendsms_helper($username, $sms_sender, $balasan, 'text', $unicode, $smsc);
} else {
$unicode = core_detect_unicode($gagal);
$balasan = addslashes($gagal);
_log("returns:" . $gagal, 2, "teltree");
sendsms_helper($username, $sms_sender, $balasan, 'text', $unicode, $smsc);
_log_print("returns empty", 2, "teltree");
}
} else {
echo "gagal";
}
return $ret;
//$ok = true;
} elseif ($kk == 'GABUNG') {
/*$gpids = dba_search(_DB_PREF_ . '_featurePhonebook_group','code',array(
));*/
$uid = user_mobile2uid($sms_sender);
$group_code = strtoupper($ps[1]);
$list = dba_search(_DB_PREF_ . '_featurePhonebook', 'id', array('uid' => 1, 'mobile' => $sms_sender));
if ($group_code && $sms_sender) {
/*--dummy code--*/
$c_pid = dba_search(_DB_PREF_ . '_featurePhonebook', 'id', array('uid' => 1, 'mobile' => $sms_sender));
$gpids = dba_search(_DB_PREF_ . '_featurePhonebook_group', 'id', array('uid' => 1, 'code' => $group_code));
foreach ($gpids as $gpid) {
foreach ($gpid as $key => $val) {
$items = array('gpid' => $val, 'pid' => $c_pid[0]['id']);
if (dba_isavail(_DB_PREF_ . '_featurePhonebook_group_contacts', $items, 'AND')) {
if (dba_add(_DB_PREF_ . '_featurePhonebook_group_contacts', $items)) {
$list = dba_search(_DB_PREF_ . '_featurePhonebook_group', 'code', array('uid' => 1));
_log('contact added to group gpid:' . $gpid . ' pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email, 2, 'phonebook_edit');
if ($iid = $c_pid[0]['id']) {
$bal_grup = "selamat anda telah tergabung di grup" . $list[$iid]['code'];
$unicode = core_detect_unicode($bal_grup);
$bal_grup = addslashes($bal_grup);
_log("returns:" . $bal_grup, 2, "telek");
sendsms_helper($username, $sms_sender, $bal_grup, 'text', $unicode, $smsc);
_log("returns empty", 2, "sms custom");
}
} else {
_log('contact edited but fail to save in group gpid:' . $gpid . ' pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email, 2, 'phonebook_edit');
}
}
}
}
}
//$ok = true;
} elseif ($kk == 'KELUAR') {
$uid = user_mobile2uid($sms_sender);
$group_code = strtoupper($ps[1]);
//_log($sms_sender . ' '. $group_code, 2 , 'test');
if ($group_code && $sms_sender) {
// _log($sms_sender . ' '. $group_code, 2 , 'test');
$c_pid = dba_search(_DB_PREF_ . '_featurePhonebook', 'id', array('uid' => 1, 'mobile' => $sms_sender));
$gpids = dba_search(_DB_PREF_ . '_featurePhonebook_group', 'id', array('uid' => 1, 'code' => $group_code));
foreach ($gpids as $gpid) {
foreach ($gpid as $key => $val) {
$items = array('gpid' => $val, 'pid' => $c_pid[0]['id']);
// _log($sms_sender . ' '. $group_code, 2 , 'test');
if (!dba_isavail(_DB_PREF_ . '_featurePhonebook_group_contacts', $items, 'AND')) {
if (dba_remove(_DB_PREF_ . '_featurePhonebook_group_contacts', $items)) {
if ($iid = $c_pid[0]['id']) {
$bal_grup = "anda telah keluar dari grup" . $list[$iid]['code'];
$unicode = core_detect_unicode($bal_grup);
$bal_grup = addslashes($bal_grup);
//.........这里部分代码省略.........
示例2: notif_add
/**
* Add notification
* @param integer $uid User ID
* @param string $label Notification label
* @param string $subject Notification subject
* @param string $body Notification body
* @param array $data Additional data, json encoded
* @return boolean
*/
function notif_add($uid, $label, $subject, $body, $data = array())
{
$ret = FALSE;
$db_table = _DB_PREF_ . '_tblNotif';
$items = array('uid' => $uid, 'last_update' => core_get_datetime(), 'label' => $label, 'subject' => $subject, 'body' => $body, 'flag_unread' => 1, 'data' => json_encode($data));
if ($result = dba_add($db_table, $items)) {
logger_print('uid:' . $uid . ' id:' . $result . ' label:' . $label . ' subject:' . $subject, 2, 'notif_add');
$ret = TRUE;
}
return $ret;
}
示例3: dlr
function dlr($smslog_id, $uid, $p_status)
{
global $core_config;
if ($core_config['isdlrd']) {
$c_isdlrd = 1;
$ret = dba_add(_DB_PREF_ . '_tblDLR', array('flag_processed' => 1, 'smslog_id' => $smslog_id, 'p_status' => $p_status, 'uid' => $uid));
} else {
$c_isdlrd = 0;
$ret = dba_add(_DB_PREF_ . '_tblDLR', array('flag_processed' => 2, 'smslog_id' => $smslog_id, 'p_status' => $p_status, 'uid' => $uid));
setsmsdeliverystatus($smslog_id, $uid, $p_status);
}
logger_print("isdlrd:" . $c_isdlrd . " smslog_id:" . $smslog_id . " p_status:" . $p_status . " uid:" . $uid, 3, "dlr");
return $ret;
}
示例4: recvsms
function recvsms($sms_datetime, $sms_sender, $message, $sms_receiver = "", $smsc = '')
{
global $core_config;
if ($core_config['isrecvsmsd']) {
$c_isrecvsmsd = 1;
// save to db and mark as queued (flag_processed = 1)
$ret = dba_add(_DB_PREF_ . '_tblRecvSMS', array('flag_processed' => 1, 'sms_datetime' => core_adjust_datetime($sms_datetime), 'sms_sender' => $sms_sender, 'message' => $message, 'sms_receiver' => $sms_receiver, 'smsc' => $smsc));
} else {
$c_isrecvsmsd = 0;
// save to db but mark as processed (flag_processed = 2) and then directly call recvsms_process()
$ret = dba_add(_DB_PREF_ . '_tblRecvSMS', array('flag_processed' => 2, 'sms_datetime' => core_adjust_datetime($sms_datetime), 'sms_sender' => $sms_sender, 'message' => $message, 'sms_receiver' => $sms_receiver, 'smsc' => $smsc));
recvsms_process(core_display_datetime($sms_datetime), $sms_sender, $message, $sms_receiver, $smsc);
}
logger_print("isrecvsmsd:" . $c_isrecvsmsd . " dt:" . $sms_datetime . " sender:" . $sms_sender . " m:" . $message . " receiver:" . $sms_receiver . " smsc:" . $smsc, 3, "recvsms");
return $ret;
}
示例5: notif_add
/**
* Add notification
*
* @param integer $uid
* User ID
* @param string $label
* Notification label
* @param string $subject
* Notification subject
* @param string $body
* Notification body
* @param array $data
* Additional data, json encoded
* @return boolean
*/
function notif_add($uid, $label, $subject, $body, $data = array())
{
$ret = FALSE;
if (!is_array($data)) {
$data = array($data);
}
$db_table = _DB_PREF_ . '_tblNotif';
$items = array('uid' => $uid, 'last_update' => core_get_datetime(), 'label' => $label, 'subject' => $subject, 'body' => $body, 'flag_unread' => 1, 'data' => json_encode($data));
if ($result = dba_add($db_table, $items)) {
foreach ($data as $key => $val) {
$show_data .= $key . ':' . $val . ' ';
}
_log('uid:' . $uid . ' id:' . $result . ' label:' . $label . ' subject:' . $subject . ' data:[' . trim($show_data) . ']', 2, 'notif_add');
$ret = TRUE;
}
return $ret;
}
示例6: stoplist_hook_blacklist_mobile_add
/**
* Add a mobile number to stoplist
*
* @param integer $uid
* User ID
* @param string $mobile
* single mobile number
* @return boolean TRUE on added
*/
function stoplist_hook_blacklist_mobile_add($uid, $mobile)
{
$ret = FALSE;
// if account exists
$uid = user_uid2username((int) $uid) ? (int) $uid : 1;
$items = array('uid' => $uid, 'mobile' => $mobile);
if (!blacklist_mobile_isexists(0, $mobile)) {
if ($new_id = dba_add(_DB_PREF_ . '_featureStoplist', $items)) {
_log('added mobile number to stoplist id:' . $new_id . ' mobile:' . $mobile . ' uid:' . $uid, 2, 'stoplist_hook_blacklist_mobile_add');
$ret = TRUE;
}
} else {
_log('mobile number is already in stoplist mobile:' . $mobile . ' uid:' . $uid, 2, 'stoplist_hook_blacklist_mobile_remove');
$ret = TRUE;
}
return $ret;
}
示例7: registry_update
function registry_update($uid, $registry_group, $registry_family, $items)
{
$ret = false;
$db_table = _DB_PREF_ . '_tblRegistry';
if (is_array($items)) {
foreach ($items as $key => $val) {
$conditions = array('uid' => $uid, 'registry_group' => $registry_group, 'registry_family' => $registry_family, 'registry_key' => $key);
$values = array('c_timestamp' => strtotime(core_get_datetime()), 'registry_value' => $val);
if (dba_count($db_table, $conditions)) {
$ret[$key] = dba_update($db_table, $values, $conditions);
} else {
$ret[$key] = dba_add($db_table, array_merge($conditions, $values));
}
unset($conditions);
unset($values);
}
}
return $ret;
}
示例8: country_add
/**
* Add country
* @param string $name Country name
* @param string $code Country code
* @param string $prefix Country prefix
* @return boolean
*/
function country_add($name, $code, $prefix = '')
{
$ret = FALSE;
if (!$name) {
return FALSE;
}
$code = substr(0, 2, core_sanitize_alpha(strtolower(trim($code))));
if (!$code) {
return FALSE;
}
$prefix = trim($prefix) ? core_sanitize_numeric($prefix) : '';
$db_table = _DB_PREF_ . '_tblCountry';
if (dba_isavail($db_table, array('country_name' => $name, 'country_code' => $code))) {
$items = array('name' => $name, 'code' => $code, 'prefix' => $prefix);
if ($result = dba_add($db_table, $items)) {
logger_print('id:' . $result . ' name:' . $name . ' code:' . $code . ' prefix:' . $prefix, 3, 'country_add');
$ret = TRUE;
}
}
return $ret;
}
示例9: playnet_hook_sendsms
/**
* hook_sendsms called by sendsms_process()
*
* @param string $smsc
* SMSC name
* @param unknown $sms_sender
* Sender ID
* @param string $sms_footer
* Message footer
* @param string $sms_to
* Destination number
* @param string $sms_msg
* Message
* @param integer $uid
* User ID
* @param integer $gpid
* Group ID
* @param integer $smslog_id
* SMS Log ID
* @param integer $sms_type
* Type of SMS
* @param integer $unicode
* Unicode flag
* @return boolean
*/
function playnet_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
global $plugin_config;
$ok = FALSE;
_log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 3, "playnet_hook_sendsms");
// override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
$sms_sender = stripslashes($sms_sender);
if ($plugin_config['playnet']['module_sender']) {
$sms_sender = $plugin_config['playnet']['module_sender'];
}
$sms_footer = stripslashes(htmlspecialchars_decode($sms_footer));
$sms_msg = stripslashes(htmlspecialchars_decode($sms_msg));
if ($sms_footer) {
$sms_msg = $sms_msg . $sms_footer;
}
$unicode = trim($unicode) ? 1 : 0;
if (!$unicode) {
$unicode = core_detect_unicode($sms_msg);
}
if ($sms_to && $sms_msg) {
$now = core_get_datetime();
$items = array('created' => $now, 'last_update' => $now, 'flag' => 1, 'uid' => $uid, 'smsc' => $smsc, 'smslog_id' => $smslog_id, 'sender_id' => $sms_sender, 'sms_to' => $sms_to, 'message' => $sms_msg, 'sms_type' => $sms_type, 'unicode' => $unicode);
if ($id = dba_add(_DB_PREF_ . '_gatewayPlaynet_outgoing', $items)) {
$ok = TRUE;
}
}
if ($ok) {
$p_status = 0;
// pending
} else {
$p_status = 2;
// failed
}
dlr($smslog_id, $uid, $p_status);
return $ok;
}
示例10: _log
if ($gpid) {
$save_to_group = TRUE;
} else {
_log('contact added pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email, 3, 'phonebook_add');
}
} else {
_log('fail to add contact pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email . ' tags:[' . $tags . ']', 3, 'phonebook_add');
}
}
if ($save_to_group && $gpid) {
$db_query = "SELECT id FROM " . _DB_PREF_ . "_featurePhonebook_group_contacts WHERE gpid='" . $gpid . "' AND pid='" . $c_pid . "' LIMIT 1";
if (dba_num_rows($db_query) > 0) {
_log('contact already in the group gpid:' . $gpid . ' pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email, 3, 'phonebook_add');
} else {
$items = array('gpid' => $gpid, 'pid' => $c_pid);
if (dba_add(_DB_PREF_ . '_featurePhonebook_group_contacts', $items)) {
_log('contact added to group gpid:' . $gpid . ' pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email, 3, 'phonebook_add');
} else {
_log('contact added but fail to save in group gpid:' . $gpid . ' pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email, 3, 'phonebook_add');
}
}
}
// $i++;
// _log("no:".$i." gpid:".$gpid." uid:".$uid." name:".$name." mobile:".$mobile." email:".$email, 3, "phonebook import");
}
unset($gpid);
}
$_SESSION['dialog']['info'][] = _('Contacts have been imported');
header("Location: " . _u('index.php?app=main&inc=feature_phonebook&route=import&op=list'));
exit;
break;
示例11: array
$db_table = _DB_PREF_ . '_featureSmssysnc';
$conditions = array('uid' => $c_uid, 'message_id' => $message_id);
if (dba_isavail($db_table, $conditions, 'AND')) {
_log("saving uid:" . $c_uid . " dt:" . $sms_datetime . " ts:" . $r['sent_timestamp'] . " message_id:" . $message_id . " s:" . $sms_sender . " m:" . $message . " r:" . $sms_receiver, 3, "sms_sync sync");
// if keyword does not exists (checkavailablekeyword == TRUE)
// then prefix the message with an @username so that it will be routed to $c_uid's inbox
$m = explode(' ', $message);
$c_m = str_replace('#', '', $m[0]);
if (checkavailablekeyword($c_m)) {
_log("forwarded to inbox uid:" . $c_uid . " message_id:" . $message_id, 3, "sms_sync sync");
$message = "@" . user_uid2username($c_uid) . " " . $message;
}
// route it
if ($recvsms_id = recvsms($sms_datetime, $sms_sender, $message, $sms_receiver)) {
$items = array('uid' => $c_uid, 'message_id' => $message_id, 'recvsms_id' => $recvsms_id);
dba_add($db_table, $items);
_log("saved uid:" . $c_uid . " message_id:" . $message_id . " recvsms_id:" . $recvsms_id, 3, "sms_sync sync");
$ret = array('payload' => array('success' => "true", 'error' => NULL));
$ok = TRUE;
} else {
$error_string = "fail to save uid:" . $c_uid . " message_id:" . $message_id;
_log($error_string, 3, "sms_sync sync");
}
} else {
$error_string = "duplicate message uid:" . $c_uid . " message_id:" . $message_id;
_log($error_string, 3, "sms_sync sync");
}
if (!$ok) {
$ret = array('payload' => array('success' => "false", 'error' => $error_string));
}
_p(json_encode($ret));
示例12: credit_hook_rate_addusercredit
function credit_hook_rate_addusercredit($uid, $amount)
{
global $plugin_config;
$db_table = $plugin_config['credit']['db_table'];
$parent_uid = user_getparentbyuid($uid);
$username = user_uid2username($uid);
$status = user_getfieldbyuid($uid, 'status');
$balance = (double) rate_getusercredit($username);
$amount = (double) $amount;
if (abs($amount) <= 0) {
_log('amount cannot be zero. amount:[' . $amount . ']', 2, 'credit_hook_rate_addusercredit');
return FALSE;
}
// add to balance
$balance = $balance + $amount;
// record it
$id = dba_add($db_table, array('parent_uid' => $parent_uid, 'uid' => $uid, 'username' => $username, 'status' => $status, 'create_datetime' => core_get_datetime(), 'amount' => $amount, 'balance' => $balance, 'flag_deleted' => 0));
// update user's credit
if ($id) {
_log('saved id:' . $id . ' parent_uid:' . $parent_uid . ' uid:' . $uid . ' username:' . $username . ' amount:' . $amount . ' balance:' . $balance, 3, 'credit_add');
if (rate_setusercredit($uid, $balance)) {
_log('updated uid:' . $uid . ' credit:' . $balance, 3, 'credit_add');
return TRUE;
} else {
_log('fail to update uid:' . $uid . ' credit:' . $balance, 3, 'credit_add');
dba_remove($db_table, array('id' => $id));
return FALSE;
}
} else {
_log('fail to save parent_uid:' . $parent_uid . ' uid:' . $uid . ' username:' . $username . ' amount:' . $amount . ' balance:' . $balance, 3, 'credit_add');
return FALSE;
}
}
示例13: foreach
}
break;
case "import_yes":
@set_time_limit(0);
$num = $_POST['number_of_row'];
$session_import = $_POST['session_import'];
$data = $_SESSION['tmp'][$session_import];
foreach ($data as $d) {
$name = trim($d[0]);
$destination = trim($d[1]);
$schedule = trim($d[2]);
if ($name && $destination && $schedule) {
$schedule = core_adjust_datetime($schedule);
// add destiantions, replace existing entry with the same name
if (dba_isexists(_DB_PREF_ . '_featureSchedule_dst', array('schedule_id' => $schedule_id, 'name' => $name), 'AND')) {
// update
$items = array('c_timestamp' => mktime(), 'schedule' => $schedule, 'scheduled' => '0000-00-00 00:00:00');
$conditions = array('schedule_id' => $schedule_id, 'name' => $name, 'destination' => $destination);
dba_update(_DB_PREF_ . '_featureSchedule_dst', $items, $conditions);
} else {
// insert
$items = array('schedule_id' => $schedule_id, 'schedule' => $schedule, 'scheduled' => '0000-00-00 00:00:00', 'name' => $name, 'destination' => $destination);
dba_add(_DB_PREF_ . '_featureSchedule_dst', $items);
}
}
}
$_SESSION['dialog']['info'][] = _('Entries in CSV file have been imported');
header("Location: " . _u('index.php?app=main&inc=feature_schedule&route=import&op=list&schedule_id=' . $schedule_id));
exit;
break;
}
示例14: user_add
/**
* Add new user
*
* @param array $data
* User data
* @param boolean $forced
* Forced addition
* @return array $ret('error_string', 'status', 'uid')
*/
function user_add($data = array(), $forced = FALSE)
{
global $core_config, $user_config;
$ret['error_string'] = _('Unknown error has occurred');
$ret['status'] = FALSE;
$ret['uid'] = 0;
$data = trim($data['username']) ? $data : $_REQUEST;
if ($forced || auth_isadmin() || $user_config['status'] == 3 || !auth_isvalid() && $core_config['main']['enable_register']) {
foreach ($data as $key => $val) {
$data[$key] = trim($val);
}
// set valid status
$data['status'] = (int) $data['status'];
if (!($data['status'] == 2 || $data['status'] == 3)) {
$data['status'] = 4;
}
// logic for parent_uid, parent uid by default is 0
if ($data['status'] == 4) {
$parent_status = user_getfieldbyuid($data['parent_uid'], 'status');
if (!($parent_status == 2 || $parent_status == 3)) {
$data['parent_uid'] = 0;
}
} else {
$data['parent_uid'] = 0;
}
$data['username'] = core_sanitize_username($data['username']);
$data['password'] = $data['password'] ? $data['password'] : core_get_random_string(10);
$new_password = $data['password'];
$data['password'] = md5($new_password);
$data['token'] = md5(uniqid($data['username'] . $data['password'], true));
// credit set to 0 by default
// $data['credit'] = ( $data['credit'] ? $data['credit'] : $core_config['main']['default_credit'] );
$data['credit'] = 0;
// sender set to empty by default
// $data['sender'] = ($data['sender'] ? core_sanitize_sender($data['sender']) : '');
$data['sender'] = '';
$dt = core_get_datetime();
$data['register_datetime'] = $dt;
$data['lastupdate_datetime'] = $dt;
$data['webservices_ip'] = trim($data['webservices_ip']) ? trim($data['webservices_ip']) : '127.0.0.1, 192.168.*.*';
$v = user_add_validate($data);
if ($v['status']) {
_log('attempt to register status:' . $data['status'] . ' u:' . $data['username'] . ' email:' . $data['email'], 3, 'user_add');
if ($data['username'] && $data['email'] && $data['name']) {
if ($new_uid = dba_add(_DB_PREF_ . '_tblUser', $data)) {
$ret['status'] = TRUE;
$ret['uid'] = $new_uid;
} else {
$ret['error_string'] = _('Fail to register an account');
}
if ($ret['status']) {
_log('registered status:' . $data['status'] . ' u:' . $data['username'] . ' uid:' . $ret['uid'] . ' email:' . $data['email'] . ' ip:' . $_SERVER['REMOTE_ADDR'] . ' mobile:' . $data['mobile'] . ' credit:' . $data['credit'], 2, 'user_add');
$subject = _('New account registration');
$body = $core_config['main']['web_title'] . "\n";
$body .= $core_config['http_path']['base'] . "\n\n";
$body .= _('Username') . ": " . $data['username'] . "\n";
$body .= _('Password') . ": " . $new_password . "\n";
$body .= _('Mobile') . ": " . $data['mobile'] . "\n";
$body .= _('Credit') . ": " . $data['credit'] . "\n\n";
$body .= $core_config['main']['email_footer'] . "\n\n";
$ret['error_string'] = _('Account has been added and password has been emailed') . " (" . _('username') . ": " . $data['username'] . ")";
$mail_data = array('mail_from_name' => $core_config['main']['web_title'], 'mail_from' => $core_config['main']['email_service'], 'mail_to' => $data['email'], 'mail_subject' => $subject, 'mail_body' => $body);
if (!sendmail($mail_data)) {
$ret['error_string'] = _('Account has been added but failed to send email') . " (" . _('username') . ": " . $data['username'] . ")";
}
}
} else {
$ret['error_string'] = _('You must fill all required fields');
}
} else {
$ret['error_string'] = $v['error_string'];
}
} else {
$ret['error_string'] = _('Account registration is not available');
}
return $ret;
}
示例15: mktime
if (!$c_name) {
$c_name = mktime();
}
$smsc = gateway_get_smscbyname($c_name);
if ($smsc['name']) {
$_SESSION['error_string'] = _('SMSC already exists');
} else {
if ($c_name && $c_gateway) {
$dv = $plugin_config[$c_gateway]['_smsc_config_'] ? $plugin_config[$c_gateway]['_smsc_config_'] : array();
$dynamic_variables = array();
foreach ($dv as $key => $val) {
$dynamic_variables[$key] = $_REQUEST[$key];
}
$items = array('created' => core_get_datetime(), 'name' => $c_name, 'gateway' => $c_gateway, 'data' => json_encode($dynamic_variables));
$db_table = _DB_PREF_ . '_tblGateway';
if ($new_id = dba_add($db_table, $items)) {
$_SESSION['error_string'] = _('New SMSC has been added');
} else {
$_SESSION['error_string'] = _('Fail to add new SMSC');
}
} else {
$_SESSION['error_string'] = _('Unknown error');
header('Location: ' . _u('index.php?app=main&inc=core_gateway&op=gateway_list'));
exit;
}
}
header('Location: ' . _u('index.php?app=main&inc=core_gateway&op=add_smsc&gateway=' . $c_gateway));
exit;
break;
case 'edit_smsc':
$c_id = $_REQUEST['id'];