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


PHP core_get_datetime函数代码示例

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


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

示例1: sms_quiz_handle

function sms_quiz_handle($list, $sms_datetime, $sms_sender, $quiz_keyword, $quiz_param = '', $sms_receiver = '', $smsc = '', $raw_message = '')
{
    global $core_config;
    $ok = false;
    $sms_to = $sms_sender;
    // we are replying to this sender
    $quiz_keyword = strtoupper(trim($quiz_keyword));
    $quiz_param = strtoupper(trim($quiz_param));
    if (($quiz_enable = $list['quiz_enable']) && $quiz_param) {
        if (strtoupper($list['quiz_answer']) == $quiz_param) {
            $message = $list['quiz_msg_correct'];
        } else {
            $message = $list['quiz_msg_incorrect'];
        }
        $quiz_id = $list['quiz_id'];
        $answer = strtoupper($quiz_param);
        $db_query = "INSERT INTO " . _DB_PREF_ . "_featureQuiz_log (quiz_id,quiz_answer,quiz_sender,in_datetime) VALUES ('{$quiz_id}','{$answer}','{$sms_to}','" . core_get_datetime() . "')";
        if ($logged = @dba_insert_id($db_query)) {
            if ($message && ($username = user_uid2username($list['uid']))) {
                $unicode = core_detect_unicode($message);
                $message = addslashes($message);
                list($ok, $to, $smslog_id, $queue) = sendsms_helper($username, $sms_to, $message, 'text', $unicode, $smsc);
            }
            $ok = true;
        }
    }
    return $ok;
}
开发者ID:10corp,项目名称:playSMS,代码行数:28,代码来源:fn.php

示例2: simplebilling_hook_billing_post

function simplebilling_hook_billing_post($smslog_id, $rate, $credit, $count, $charge)
{
    $ok = false;
    logger_print("saving smslog_id:" . $smslog_id . " rate:" . $rate . " credit:" . $credit . " count:" . $count . " charge:" . $charge, 2, "simplebilling post");
    $db_query = "INSERT INTO " . _DB_PREF_ . "_tblBilling (post_datetime,smslog_id,rate,credit,count,charge,status) VALUES ('" . core_get_datetime() . "','{$smslog_id}','{$rate}','{$credit}','{$count}','{$charge}','0')";
    if ($id = @dba_insert_id($db_query)) {
        logger_print("saved smslog_id:" . $smslog_id . " id:" . $id, 2, "simplebilling post");
        $ok = true;
    }
    return $ok;
}
开发者ID:10corp,项目名称:playSMS,代码行数:11,代码来源:fn.php

示例3: 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;
}
开发者ID:yrahman,项目名称:playSMS,代码行数:20,代码来源:fn.php

示例4: 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;
}
开发者ID:10corp,项目名称:playSMS,代码行数:32,代码来源:fn.php

示例5: 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;
}
开发者ID:10corp,项目名称:playSMS,代码行数:19,代码来源:fn.php

示例6: setsmsdeliverystatus

function setsmsdeliverystatus($smslog_id, $uid, $p_status)
{
    global $core_config;
    // $p_status = 0 --> pending
    // $p_status = 1 --> sent
    // $p_status = 2 --> failed
    // $p_status = 3 --> delivered
    // logger_print("smslog_id:".$smslog_id." uid:".$uid." p_status:".$p_status, 2, "setsmsdeliverystatus");
    $ok = false;
    $db_query = "UPDATE " . _DB_PREF_ . "_tblSMSOutgoing SET c_timestamp='" . mktime() . "',p_update='" . core_get_datetime() . "',p_status='{$p_status}' WHERE smslog_id='{$smslog_id}' AND uid='{$uid}'";
    if ($aff_id = @dba_affected_rows($db_query)) {
        // logger_print("saved smslog_id:".$smslog_id, 2, "setsmsdeliverystatus");
        $ok = true;
        if ($p_status > 0) {
            for ($c = 0; $c < count($core_config['featurelist']); $c++) {
                core_hook($core_config['featurelist'][$c], 'setsmsdeliverystatus', array($smslog_id, $uid, $p_status));
            }
        }
    }
    return $ok;
}
开发者ID:RobinKarlsen,项目名称:playSMS,代码行数:21,代码来源:fn_dlr.php

示例7: sms_board_handle

function sms_board_handle($c_uid, $sms_datetime, $sms_sender, $sms_receiver, $board_keyword, $board_param = '', $smsc = '', $raw_message = '')
{
    global $core_config;
    $ok = false;
    $board_keyword = strtoupper(trim($board_keyword));
    $board_param = trim($board_param);
    if ($sms_sender && $board_keyword && $board_param) {
        // masked sender sets here
        $masked_sender = substr_replace($sms_sender, 'xxxx', -4);
        $db_query = "\n\t\t\tINSERT INTO " . _DB_PREF_ . "_featureBoard_log\n\t\t\t(in_gateway,in_sender,in_masked,in_keyword,in_msg,in_datetime)\n\t\t\tVALUES ('{$smsc}','{$sms_sender}','{$masked_sender}','{$board_keyword}','{$board_param}','" . core_get_datetime() . "')";
        if ($cek_ok = @dba_insert_id($db_query)) {
            $db_query1 = "SELECT board_forward_email FROM " . _DB_PREF_ . "_featureBoard WHERE board_keyword='{$board_keyword}'";
            $db_result1 = dba_query($db_query1);
            $db_row1 = dba_fetch_array($db_result1);
            $email = $db_row1['board_forward_email'];
            if ($email) {
                // get name from c_uid's phonebook
                $c_name = phonebook_number2name($c_uid, $sms_sender);
                $sms_sender = $c_name ? $c_name . ' <' . $sms_sender . '>' : $sms_sender;
                $sms_datetime = core_display_datetime($sms_datetime);
                $subject = "[" . $board_keyword . "] " . _('SMS board from') . " {$sms_sender}";
                $body = $core_config['main']['web_title'] . "\n";
                // fixme anton - ran by playsmsd, no http address, disabled for now looking for solution
                // $body.= $core_config['http_path']['base'] . "\n\n";
                $body .= _('Date and time') . ": {$sms_datetime}\n";
                $body .= _('Sender') . ": {$sms_sender}\n";
                $body .= _('Receiver') . ": {$sms_receiver}\n";
                $body .= _('SMS board keyword') . ": {$board_keyword}\n\n";
                $body .= _('Message') . ":\n{$board_param}\n\n";
                $body .= $core_config['main']['email_footer'] . "\n\n";
                $body = stripslashes($body);
                $email_data = array('mail_from_name' => $core_config['main']['web_title'], 'mail_from' => $core_config['main']['email_service'], 'mail_to' => $email, 'mail_subject' => $subject, 'mail_body' => $body);
                sendmail($email_data);
            }
            $ok = true;
        }
    }
    return $ok;
}
开发者ID:10corp,项目名称:playSMS,代码行数:39,代码来源:fn.php

示例8: 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;
}
开发者ID:playsms,项目名称:plugin-playnet,代码行数:62,代码来源:fn.php

示例9: gateway_get_smscbyid

 case 'edit_smsc_save':
     $c_id = (int) $_REQUEST['id'];
     $smsc = gateway_get_smscbyid($c_id);
     // do not edit dev and blocked
     $continue = FALSE;
     if (!($smsc['gateway'] == 'dev' || $smsc['gateway'] == 'blocked')) {
         $continue = TRUE;
     }
     $c_gateway = gateway_valid_name($_REQUEST['gateway']);
     if ($continue && $c_id && $c_gateway && $c_gateway == $smsc['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('last_update' => core_get_datetime(), 'data' => json_encode($dynamic_variables));
         $condition = array('id' => $c_id);
         $db_table = _DB_PREF_ . '_tblGateway';
         if ($new_id = dba_update($db_table, $items, $condition)) {
             $_SESSION['error_string'] = _('SMSC has been edited');
         } else {
             $_SESSION['error_string'] = _('Fail to edit 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=edit_smsc&id=' . $c_id));
     exit;
     break;
开发者ID:yrahman,项目名称:playSMS,代码行数:31,代码来源:gateway.php

示例10: defined

defined('_SECURE_') or die('Forbidden');
if (!auth_isadmin()) {
    auth_block();
}
switch (_OP_) {
    case "simulate":
        $sender = '629876543210';
        $receiver = '1234';
        $datetime = core_get_datetime();
        $content .= _dialog() . "\n\t\t\t<h2>" . _('Simulate incoming SMS') . "</h2>\n\t\t\t<form action=\"index.php?app=main&inc=gateway_dev&route=simulate&op=simulate_yes\" method=post>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<table class=playsms-table>\n\t\t\t\t<tbody>\n\t\t\t\t<tr><td class=label-sizer>" . _('Message') . "</td><td><input type=text name=message value=\"{$message}\" maxlength=250></td></tr>\n\t\t\t\t<tr><td>" . _('Sender') . "</td><td><input type=text name=sender value=\"{$sender}\" maxlength=20></td></tr>\n\t\t\t\t<tr><td>" . _('Receiver') . "</td><td><input type=text name=receiver value=\"{$receiver}\" maxlength=20></td></tr>\n\t\t\t\t<tr><td>" . _('Date/Time') . "</td><td><input type=text name=datetime value=\"" . core_display_datetime($datetime) . "\" maxlength=20></td></tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<p><input type=submit class=button value=\"" . _('Submit') . "\">\n\t\t\t</form>";
        _p($content);
        break;
    case "simulate_yes":
        $sms_sender = $_REQUEST['sender'] ? $_REQUEST['sender'] : '629876543210';
        $sms_receiver = $_REQUEST['receiver'] ? $_REQUEST['receiver'] : '1234';
        $sms_datetime = $_REQUEST['datetime'] ? $_REQUEST['datetime'] : core_get_datetime();
        $message = $_REQUEST['message'] ? $_REQUEST['message'] : _('This is a test incoming SMS message');
        $message = htmlspecialchars_decode($message);
        if (trim($sms_sender) && trim($sms_receiver) && trim($sms_datetime) && trim($message)) {
            recvsms($sms_datetime, $sms_sender, $message, $sms_receiver, 'dev');
            $err[] = "Sender ID: " . $sms_sender;
            $err[] = "Receiver number: " . $sms_receiver;
            $err[] = "Sent: " . $sms_datetime;
            $err[] = "Message: " . stripslashes($message);
            _log(print_r($err, TRUE), 3, "dev incoming");
            $_SESSION['dialog']['info'][] = $err;
        } else {
            $_SESSION['dialog']['info'][] = _('Fail to simulate incoming SMS');
        }
        header("Location: " . _u('index.php?app=main&inc=gateway_dev&route=simulate&op=simulate'));
        exit;
开发者ID:10corp,项目名称:playSMS,代码行数:31,代码来源:simulate.php

示例11: sender_id_add

/**
 * Add sender ID
 *
 * @param integer $uid
 *        User ID
 * @param string $sender_id
 *        Sender ID
 * @param string $sender_id_description
 *        Sender ID description
 * @param integer $isdefault
 *        Flag 1 for default sender ID
 * @param integer $isapproved
 *        Flag 1 for approved sender ID
 * @return boolean TRUE when new sender ID has been added
 */
function sender_id_add($uid, $sender_id, $sender_id_description = '', $isdefault = 1, $isapproved = 1)
{
    global $user_config;
    if (sender_id_check($uid, $sender_id)) {
        // not available
        return FALSE;
    } else {
        $default = auth_isadmin() ? (int) $isdefault : 0;
        $approved = auth_isadmin() ? (int) $isapproved : 0;
        $data_sender_id = array($sender_id => $approved);
        $sender_id_description = trim($sender_id_description) ? trim($sender_id_description) : $sender_id;
        $data_description = array($sender_id => $sender_id_description);
        $uid = auth_isadmin() && $uid ? $uid : $user_config['uid'];
        if ($uid) {
            registry_update($uid, 'features', 'sender_id', $data_sender_id);
            $ret = registry_update($uid, 'features', 'sender_id_desc', $data_description);
        } else {
            // unknown error
            return FALSE;
        }
        if ($ret[$sender_id]) {
            _log('sender ID has been added id:' . $sender_id . ' uid:' . $uid, 2, 'sender_id_add');
        } else {
            _log('fail to add sender ID id:' . $sender_id . ' uid:' . $uid, 2, 'sender_id_add');
            return FALSE;
        }
        // if default and approved
        if (auth_isadmin() && $default && $approved) {
            sender_id_default_set($uid, $sender_id);
        }
        // notify admins if user or subuser
        if ($user_config['status'] == 3 || $user_config['status'] == 4) {
            $admins = user_getallwithstatus(2);
            foreach ($admins as $admin) {
                $message_to_admins = sprintf(_('Username %s with account ID %d has requested approval for sender ID %s'), user_uid2username($uid), $uid, $sender_id);
                recvsms_inbox_add(core_get_datetime(), _SYSTEM_SENDER_ID_, $admin['username'], $message_to_admins);
            }
        }
        // added
        return TRUE;
    }
}
开发者ID:10corp,项目名称:playSMS,代码行数:57,代码来源:fn.php

示例12: report_hook_playsmsd

/**
 * Remove login sessions older than 1 hour idle
 */
function report_hook_playsmsd()
{
    global $plugin_config;
    $plugin_config['report']['current_tick'] = (int) strtotime(core_get_datetime());
    $period = $plugin_config['report']['current_tick'] - $plugin_config['report']['last_tick'];
    // login session older than 1 hour will be removed
    if ($period >= 60 * 60) {
        $users = report_whoseonline(0, FALSE, TRUE);
        foreach ($users as $user) {
            foreach ($user as $hash) {
                user_session_remove('', '', $hash['hash']);
                _log('login session removed uid:' . $hash['uid'] . ' hash:' . $hash['hash'], 3, 'report_hook_playsmsd');
            }
        }
        $plugin_config['report']['last_tick'] = $plugin_config['report']['current_tick'];
    }
}
开发者ID:yrahman,项目名称:playSMS,代码行数:20,代码来源:fn.php

示例13: dba_search

     $list = dba_search($db_table, '*', $conditions, $search['dba_keywords']);
     $data[0] = array(_('User'), _('Transaction datetime'), _('Amount'));
     for ($i = 0; $i < count($list); $i++) {
         $j = $i + 1;
         $data[$j] = array($list[$i]['username'], core_display_datetime($list[$i]['create_datetime']), $list[$i]['amount']);
     }
     $content = core_csv_format($data);
     $fn = 'credit-' . $core_config['datetime']['now_stamp'] . '.csv';
     core_download($content, $fn, 'text/csv');
     break;
 case 'delete':
     for ($i = 0; $i < $nav['limit']; $i++) {
         $checkid = $_POST['checkid' . $i];
         $itemid = $_POST['itemid' . $i];
         if ($checkid == "on" && $itemid) {
             $up = array('c_timestamp' => mktime(), 'delete_datetime' => core_get_datetime(), 'flag_deleted' => '1');
             // only if users
             if ($user_config['status'] == 3) {
                 $up['parent_uid'] = $user_config['uid'];
                 $up['status'] = 4;
             }
             dba_update($db_table, $up, array('id' => $itemid));
         }
     }
     $ref = $nav['url'] . '&search_keyword=' . $search['keyword'] . '&page=' . $nav['page'] . '&nav=' . $nav['nav'];
     $_SESSION['dialog']['info'][] = _('Selected transactions has been deleted');
     header("Location: " . _u($ref));
     exit;
     break;
 case "add":
     $continue = FALSE;
开发者ID:kothsada,项目名称:playSMS,代码行数:31,代码来源:credit.php

示例14: sms_subscribe_hook_playsmsd

function sms_subscribe_hook_playsmsd()
{
    global $core_config;
    // fetch hourly
    if (!core_playsmsd_timer(3600)) {
        return;
    }
    $db_table = _DB_PREF_ . "_featureSubscribe";
    $conditions = array('subscribe_enable' => 1);
    $extras = array('AND duration' => '>0');
    $list_subscribe = dba_search($db_table, '*', $conditions, '', $extras);
    foreach ($list_subscribe as $subscribe) {
        $c_id = $subscribe['subscribe_id'];
        $c_duration = $subscribe['duration'];
        $date_now = new DateTime(core_get_datetime());
        $list_member = dba_search(_DB_PREF_ . '_featureSubscribe_member', '*', array('subscribe_id' => $c_id));
        foreach ($list_member as $member) {
            $is_expired = FALSE;
            $date_since = new DateTime($member['member_since']);
            $diff = $date_since->diff($date_now);
            $d = (int) $diff->format('%R%a');
            // _log('check duration:' . $d . ' day set duration:' . $c_duration . ' date_now:' . core_get_datetime() . ' date_since:' . $member['member_since'] . ' k:' . $subscribe['subscribe_keyword'] . ' member_id:' . $member['member_id'] . ' number:' . $member['member_number'], 3, 'sms_subscribe_hook_playsmsd');
            if ($c_duration > 1000) {
                // days
                $c_interval = $c_duration - 1000;
                if ($c_interval && $d && $d >= $c_interval) {
                    _log('expired duration:' . $d . ' day k:' . $subscribe['subscribe_keyword'] . ' member_id:' . $member['member_id'] . ' number:' . $member['member_number'], 3, 'sms_subscribe_hook_playsmsd');
                    $is_expired = TRUE;
                }
            } else {
                if ($c_duration > 100) {
                    // weeks
                    $c_interval = $c_duration - 100;
                    $w = floor($d / 7);
                    // _log('interval:' . $c_interval . ' d:' . $d . ' w:' . $w, 3, 'sms_subscribe_hook_playsmsd');
                    if ($c_interval && $w && $w >= $c_interval) {
                        _log('expired duration:' . $w . ' week k:' . $subscribe['subscribe_keyword'] . ' member_id:' . $member['member_id'] . ' number:' . $member['member_number'], 3, 'sms_subscribe_hook_playsmsd');
                        $is_expired = TRUE;
                    }
                } else {
                    if ($c_duration > 0) {
                        // months
                        $c_interval = $c_duration;
                        $m = floor($d / 30);
                        // _log('interval:' . $c_interval . ' d:' . $d . ' m:' . $m, 3, 'sms_subscribe_hook_playsmsd');
                        if ($c_interval && $m && $m >= $c_interval) {
                            _log('expired duration:' . $m . ' month k:' . $subscribe['subscribe_keyword'] . ' member_id:' . $member['member_id'] . ' number:' . $member['member_number'], 3, 'sms_subscribe_hook_playsmsd');
                            $is_expired = TRUE;
                        }
                    }
                }
            }
            if ($is_expired) {
                _sms_subscribe_member_expired($subscribe, $member);
            }
        }
    }
}
开发者ID:10corp,项目名称:playSMS,代码行数:58,代码来源:fn.php

示例15: 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;
    }
}
开发者ID:yrahman,项目名称:playSMS,代码行数:33,代码来源:fn.php


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