コード例 #1
0
ファイル: fn.php プロジェクト: yrahman/playSMS
function sendsms_process($smslog_id, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid, $gpid = 0, $sms_type = 'text', $unicode = 0, $queue_code = '', $smsc = '')
{
    global $user_config;
    $ok = false;
    $user = $user_config;
    if ($uid && $user['uid'] != $uid) {
        $user = user_getdatabyuid($uid);
    }
    $username = $user['username'];
    $sms_to = sendsms_getvalidnumber($sms_to);
    // now on sendsms()
    // $sms_to = sendsms_manipulate_prefix($sms_to, $user);
    $sms_datetime = core_get_datetime();
    // sent sms will be handled by plugins first
    $ret_intercept = sendsms_intercept($sms_sender, $sms_footer, $sms_to, $sms_msg, $uid, $gpid, $sms_type, $unicode, $smsc);
    if ($ret_intercept['modified']) {
        $sms_sender = $ret_intercept['param']['sms_sender'] ? $ret_intercept['param']['sms_sender'] : $sms_sender;
        $sms_footer = $ret_intercept['param']['sms_footer'] ? $ret_intercept['param']['sms_footer'] : $sms_footer;
        $sms_to = $ret_intercept['param']['sms_to'] ? $ret_intercept['param']['sms_to'] : $sms_to;
        $sms_msg = $ret_intercept['param']['sms_msg'] ? $ret_intercept['param']['sms_msg'] : $sms_msg;
        $uid = $ret_intercept['param']['uid'] ? $ret_intercept['param']['uid'] : $uid;
        $gpid = $ret_intercept['param']['gpid'] ? $ret_intercept['param']['gpid'] : $gpid;
        $sms_type = $ret_intercept['param']['sms_type'] ? $ret_intercept['param']['sms_type'] : $sms_type;
        $unicode = $ret_intercept['param']['unicode'] ? $ret_intercept['param']['unicode'] : $unicode;
        $smsc = $ret_intercept['param']['smsc'] ? $ret_intercept['param']['smsc'] : $smsc;
    }
    // if hooked function returns cancel=true then stop the sending, return false
    if ($ret_intercept['cancel']) {
        logger_print("end with cancelled smslog_id:" . $smslog_id . " uid:" . $uid . " gpid:" . $gpid . " smsc:" . $smsc . " s:" . $sms_sender . " to:" . $sms_to . " type:" . $sms_type . " unicode:" . $unicode, 2, "sendsms_process");
        $ret['status'] = false;
        return $ret;
    }
    // get active gateway module as default gateway
    if (!$smsc) {
        $smsc = core_smsc_get();
    }
    // set no gateway if no default gateway selected
    if (!$smsc) {
        $smsc = 'blocked';
    }
    // a hack to remove \r from \r\n
    // the issue begins with ENTER being \r\n and detected as 2 chars
    // and since the javascript message counter can't detect it as 2 chars
    // thus the message length counts is inaccurate
    $sms_msg = str_replace("\r\n", "\n", $sms_msg);
    // just to make sure its length, we need to stripslashes message before enter other procedures
    $sms_sender = stripslashes($sms_sender);
    $sms_msg = stripslashes($sms_msg);
    $sms_footer = stripslashes($sms_footer);
    // fixme anton - mobile number can be anything, screened by gateway
    // $sms_sender = sendsms_getvalidnumber($sms_sender);
    // fixme anton - add a space in front of $sms_footer
    if (trim($sms_footer)) {
        $sms_footer = ' ' . trim($sms_footer);
    }
    logger_print("start", 2, "sendsms_process");
    if (rate_cansend($username, strlen($sms_msg . $sms_footer), $unicode, $sms_to)) {
        $p_status = 0;
    } else {
        logger_print("end with fail not enough credit smslog_id:" . $smslog_id, 2, "sendsms_process");
        $ret['status'] = true;
        // set TRUE to stop queue
        $ret['to'] = $sms_to;
        $ret['smslog_id'] = $smslog_id;
        $ret['p_status'] = 2;
        // set failed
        return $ret;
    }
    // message entering this proc already stripslashed, we need to addslashes it before saving to db
    $sms_sender = addslashes($sms_sender);
    $sms_msg = addslashes($sms_msg);
    $sms_footer = addslashes($sms_footer);
    // we save all info first and then process with gateway module
    // the thing about this is that message saved may not be the same since gateway may not be able to process
    // message with that length or certain characters in the message are not supported by the gateway
    $db_query = "\n\t\tINSERT INTO " . _DB_PREF_ . "_tblSMSOutgoing \n\t\t(smslog_id,uid,p_gpid,p_gateway,p_src,p_dst,p_footer,p_msg,p_datetime,p_status,p_sms_type,unicode,queue_code) \n\t\tVALUES ('{$smslog_id}','{$uid}','{$gpid}','{$smsc}','{$sms_sender}','{$sms_to}','{$sms_footer}','{$sms_msg}','{$sms_datetime}','{$p_status}','{$sms_type}','{$unicode}','{$queue_code}')";
    logger_print("saving smslog_id:" . $smslog_id . " u:" . $uid . " g:" . $gpid . " smsc:" . $smsc . " s:" . $sms_sender . " d:" . $sms_to . " type:" . $sms_type . " unicode:" . $unicode . " status:" . $p_status, 2, "sendsms");
    // continue to gateway only when save to db is true
    if ($id = @dba_insert_id($db_query)) {
        logger_print("saved smslog_id:" . $smslog_id . " id:" . $id, 2, "sendsms_process");
        if ($p_status == 0) {
            $smsc = gateway_get_smscbyname($smsc);
            logger_print("final smslog_id:" . $smslog_id . " gw:" . $smsc['gateway'] . " smsc:" . $smsc['name'] . " message:" . $sms_msg . $sms_footer . " len:" . strlen($sms_msg . $sms_footer), 3, "sendsms");
            if (core_hook($smsc['gateway'], 'sendsms', array($smsc['name'], $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid, $gpid, $smslog_id, $sms_type, $unicode))) {
                // fixme anton - deduct user's credit as soon as gateway returns true
                rate_deduct($smslog_id);
                $ok = true;
            } else {
                logger_print("fail no hook for sendsms", 2, "sendsms_process");
            }
        }
    } else {
        logger_print("fail to save in db table smslog_id:" . $smslog_id, 2, "sendsms_process");
    }
    logger_print("end", 2, "sendsms_process");
    $ret['status'] = $ok;
    $ret['to'] = $sms_to;
    $ret['smslog_id'] = $smslog_id;
    $ret['p_status'] = $p_status;
    return $ret;
}
コード例 #2
0
ファイル: catchall.php プロジェクト: yrahman/playSMS
     $c_members = "<a href='" . _u('index.php?app=main&inc=feature_inboxgroup&route=members&op=members&rid=' . $rid) . "'>" . $c_members . "</a>";
     $c_catchall = count(inboxgroup_getcatchall($rid));
     $c_catchall = "<a href='" . _u('index.php?app=main&inc=feature_inboxgroup&route=catchall&op=catchall&rid=' . $rid) . "'>" . $c_catchall . "</a>";
     $c_status = $data['status'] ? "<span class=status_enabled />" : "<span class=status_disabled />";
     if ($error_content) {
         $content .= $error_content;
     }
     $content .= "<h2>" . _('Group inbox') . "</h2>";
     $content .= "<h3>" . _('Delete catch-all') . "</h3>";
     $content .= "\n\t\t\t<table width='100%>\n\t\t\t<tr><td class=label-sizer>" . _('Receiver number') . "</td><td>" . $in_receiver . "</td></tr>\n\t\t\t<tr><td>" . _('Keywords') . "</td><td>" . $keywords . "</td></tr>\n\t\t\t<tr><td>" . _('Description') . "</td><td>" . $description . "</td></tr>\n\t\t\t<tr><td>" . _('Members') . "</td><td>" . $c_members . "</td></tr>\n\t\t\t<tr><td>" . _('Catch-all') . "</td><td>" . $c_catchall . "</td></tr>\n\t\t\t<tr><td>" . _('Status') . "</td><td>" . $c_status . "</td></tr>\n\t\t\t</table>";
     $list_of_catchall = '';
     // get catchall
     $users = inboxgroup_getcatchall($rid);
     for ($i = 0; $i < count($users); $i++) {
         $c_uid = $users[$i]['uid'];
         $c_user = user_getdatabyuid($c_uid);
         if ($c_username = $c_user['username']) {
             $c_name = $c_user['name'];
             $c_mobile = $c_user['mobile'];
             $list_of_users .= "<option value='" . $c_uid . "'>" . $c_name . " " . $c_mobile . "</option>";
         }
     }
     $content .= "\n\t\t\t<form action=\"index.php?app=main&inc=feature_inboxgroup&route=catchall&op=catchall_delete_submit\" method=\"post\">\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<input type=hidden name='rid' value='" . $rid . "'>\n\t\t\t<table>\n\t\t\t\t<tbody>\n\t\t\t\t<tr>\n\t\t\t\t\t<td nowrap>\n\t\t\t\t\t\t" . _('Current catchall') . ":<br />\n\t\t\t\t\t\t<select name=\"uids_dump[]\" id=\"msg_combo_sendto\" size=\"10\" multiple=\"multiple\" onDblClick=\"moveSelectedOptions(this.form['uids_dump[]'],this.form['uids[]'])\">{$list_of_users}</select>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t<p><input type=\"button\" class=\"button\" value=\"&gt;\" onclick=\"moveSelectedOptions(this.form['uids_dump[]'],this.form['uids[]'])\"></p>\n\t\t\t\t\t\t<p><input type=\"button\" class=\"button\" value=\"&lt;\" onclick=\"moveSelectedOptions(this.form['uids[]'],this.form['uids_dump[]'])\"></p>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td nowrap>\n\t\t\t\t\t    " . _('Selected catchall') . ":<br>\n\t\t\t\t\t    <select name=\"uids[]\" id=\"msg_combo_sendto\" size=\"10\" multiple=\"multiple\" onDblClick=\"moveSelectedOptions(this.form['uids[]'],this.form['uids_dump[]'])\"></select>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<p>" . _('Press submit button to remove selected catchall from catch-all list') . "</p>\n\t\t\t<p><input class='button' type='submit' value='Submit' onClick=\"selectAllOptions(this.form['uids[]'])\"></p>\n\t\t\t</form>\n\t\t" . _back('index.php?app=main&inc=feature_inboxgroup&route=catchall&op=catchall&rid=' . $rid);
     _p($content);
     break;
 case 'catchall_delete_submit':
     $rid = $_REQUEST['rid'];
     $rid = $_REQUEST['rid'];
     $data = inboxgroup_getdatabyid($rid);
     $in_receiver = $data['in_receiver'];
     if ($rid && $in_receiver) {
コード例 #3
0
ファイル: fn.php プロジェクト: kothsada/playSMS
function credit_hook_rate_setusercredit($uid, $balance = 0)
{
    $balance = (double) $balance;
    $user = user_getdatabyuid($uid);
    if ($user['uid']) {
        if ($user['credit'] != $balance) {
            _log("saving uid:" . $uid . " balance:" . $balance, 2, "credit_hook_rate_setusercredit");
            $db_query = "UPDATE " . _DB_PREF_ . "_tblUser SET c_timestamp='" . mktime() . "',credit='{$balance}' WHERE flag_deleted='0' AND uid='{$uid}'";
            if ($db_result = @dba_affected_rows($db_query)) {
                _log("saved uid:" . $uid . " balance:" . $balance, 2, "credit_hook_rate_setusercredit");
                return TRUE;
            } else {
                _log("unable to save uid:" . $uid . " balance:" . $balance, 2, "credit_hook_rate_setusercredit");
                return FALSE;
            }
        } else {
            _log("no changes uid:" . $uid . " balance:" . $balance, 2, "credit_hook_rate_setusercredit");
            return TRUE;
        }
    } else {
        _log("user does not exists uid:" . $uid . " balance:" . $balance, 2, "credit_hook_rate_setusercredit");
        return FALSE;
    }
}
コード例 #4
0
ファイル: fn_user.php プロジェクト: rohith222/playSMS
function user_getdatabyusername($username)
{
    $uid = username2uid($username);
    return user_getdatabyuid($uid);
}
コード例 #5
0
ファイル: fn.php プロジェクト: 10corp/playSMS
/**
 * Setup user session
 *
 * @param string $username
 *        Username
 */
function auth_session_setup($uid)
{
    global $core_config;
    $c_user = user_getdatabyuid($uid);
    if ($c_user['username']) {
        // set session
        $_SESSION['sid'] = session_id();
        $_SESSION['username'] = $c_user['username'];
        $_SESSION['uid'] = $c_user['uid'];
        $_SESSION['status'] = $c_user['status'];
        $_SESSION['valid'] = TRUE;
        if (!is_array($_SESSION['tmp']['login_as'])) {
            $_SESSION['tmp']['login_as'] = array();
        }
        // save session in registry
        if (!$core_config['daemon_process']) {
            user_session_set($c_user['uid']);
        }
    }
}
コード例 #6
0
ファイル: fn.php プロジェクト: 10corp/playSMS
function user_edit($uid, $data = array())
{
    $up = array();
    $ret = array();
    $ret['status'] = FALSE;
    $user_edited = user_getdatabyuid($uid);
    if ($user_edited['status'] != 4) {
        unset($data['parent_uid']);
    }
    $data['username'] = $user_edited['username'];
    $fields = array('username', 'parent_uid', 'name', 'email', 'mobile', 'address', 'city', 'state', 'country', 'password', 'zipcode');
    foreach ($fields as $field) {
        if ($c_data = trim($data[$field])) {
            $up[$field] = $c_data;
        }
    }
    $up['lastupdate_datetime'] = core_adjust_datetime(core_get_datetime());
    if ($up['name']) {
        $v = user_edit_validate($up);
        if ($v['status']) {
            $continue = true;
            if ($up['password']) {
                $up['password'] = md5($up['password']);
            } else {
                unset($up['password']);
            }
            if ($continue) {
                if (dba_update(_DB_PREF_ . '_tblUser', $up, array('flag_deleted' => 0, 'uid' => $uid))) {
                    $ret['status'] = TRUE;
                    if ($up['password']) {
                        $ret['error_string'] = _('Preferences have been saved and password updated');
                    } else {
                        if ($up['token']) {
                            $ret['error_string'] = _('Preferences have been saved and webservices token updated');
                        } else {
                            $ret['error_string'] = _('Preferences have been saved');
                        }
                    }
                } else {
                    $ret['error_string'] = _('Fail to save preferences');
                }
            }
        } else {
            $ret['error_string'] = $v['error_string'];
        }
    } else {
        $ret['error_string'] = _('You must fill all mandatory fields');
    }
    return $ret;
}
コード例 #7
0
ファイル: fn_core.php プロジェクト: ranakhurram/playSMS
function insertsmstoinbox($sms_datetime, $sms_sender, $target_user, $message, $sms_receiver = "")
{
    global $core_config, $web_title, $email_service, $email_footer;
    // sms to inbox will be handled by plugin/tools/* first
    $ret_intercept = interceptsmstoinbox($sms_datetime, $sms_sender, $target_user, $message, $sms_receiver);
    if ($ret_intercept['param_modified']) {
        $sms_datetime = $ret_intercept['param']['sms_datetime'] ? $ret_intercept['param']['sms_datetime'] : $sms_datetime;
        $sms_sender = $ret_intercept['param']['sms_sender'] ? $ret_intercept['param']['sms_sender'] : $sms_sender;
        $target_user = $ret_intercept['param']['target_user'] ? $ret_intercept['param']['target_user'] : $target_user;
        $message = $ret_intercept['param']['message'] ? $ret_intercept['param']['message'] : $message;
        $sms_receiver = $ret_intercept['param']['sms_receiver'] ? $ret_intercept['param']['sms_receiver'] : $sms_receiver;
    }
    $ok = false;
    if ($sms_sender && $target_user && $message) {
        $user = user_getdatabyusername($target_user);
        if ($uid = $user['uid']) {
            // forward to Inbox
            if ($fwd_to_inbox = $user['fwd_to_inbox']) {
                $db_query = "\n\t\t    INSERT INTO " . _DB_PREF_ . "_tblUserInbox\n\t\t    (in_sender,in_receiver,in_uid,in_msg,in_datetime) \n\t\t    VALUES ('{$sms_sender}','{$sms_receiver}','{$uid}','{$message}','{$sms_datetime}')\n\t\t";
                logger_print("saving sender:" . $sms_sender . " receiver:" . $sms_receiver . " target:" . $target_user, 3, "insertsmstoinbox");
                if ($cek_ok = @dba_insert_id($db_query)) {
                    logger_print("saved sender:" . $sms_sender . " receiver:" . $sms_receiver . " target:" . $target_user, 3, "insertsmstoinbox");
                }
            }
            // forward to email
            if ($fwd_to_email = $user['fwd_to_email']) {
                if ($email = $user['email']) {
                    // make sure sms_datetime is in supported format and in user's timezone
                    $sms_datetime = core_display_datetime($sms_datetime);
                    // get name from target_user's phonebook
                    $c_name = phonebook_number2name($sms_sender, $target_user);
                    $sender = $c_name ? $c_name . ' <' . $sms_sender . '>' : $sms_sender;
                    $subject = "[SMSGW-PV] " . _('from') . " {$sms_sender}";
                    $body = _('Forward Private WebSMS') . " ({$web_title})\n\n";
                    $body .= _('Date time') . ": {$sms_datetime}\n";
                    $body .= _('Sender') . ": {$sender}\n";
                    $body .= _('Receiver') . ": {$sms_receiver}\n\n";
                    $body .= _('Message') . ":\n{$message}\n\n";
                    $body .= $email_footer . "\n\n";
                    logger_print("send email from:" . $email_service . " to:" . $email, 3, "insertsmstoinbox");
                    sendmail($email_service, $email, $subject, $body);
                    logger_print("sent email from:" . $email_service . " to:" . $email, 3, "insertsmstoinbox");
                }
                $ok = true;
            }
            // forward to mobile
            if ($fwd_to_mobile = $user['fwd_to_mobile']) {
                if ($mobile = $user['mobile']) {
                    $unicode = 0;
                    if (function_exists('mb_detect_encoding')) {
                        $encoding = mb_detect_encoding($message, 'auto');
                        if ($encoding != 'ASCII') {
                            $unicode = 1;
                        }
                    }
                    $c_uid = mobile2uid($sms_sender);
                    $c_user = user_getdatabyuid($c_uid);
                    $c_username = $c_user['username'];
                    $c_sender = $c_username ? $c_username : $sms_sender;
                    $message = '@' . $c_sender . ' ' . $message;
                    // list($ok,$to,$smslog_id) = sendsms_pv($target_user,$mobile,$message,'text',$unicode);
                    $ret = sendsms($core_config['main']['cfg_gateway_number'], '', $mobile, $message, $c_uid, 0, 'text', $unicode);
                    logger_print("send to sender:" . $c_sender . " receiver:" . $sms_receiver . " target:" . $target_user, 3, "insertsmstoinbox");
                    if ($cek_ok = $ok[0]) {
                        logger_print("sent to sender:" . $c_sender . " receiver:" . $sms_receiver . " target:" . $target_user, 3, "insertsmstoinbox");
                    }
                }
            }
        }
    }
    return $ok;
}
コード例 #8
0
ファイル: fn_sendsms.php プロジェクト: rohith222/playSMS
function sendsms($sms_sender, $sms_footer, $sms_to, $sms_msg, $uid, $gpid = 0, $sms_type = 'text', $unicode = 0)
{
    global $core_config, $gateway_module;
    $user = user_getdatabyuid($uid);
    $username = $user['username'];
    $sms_to = sendsms_getvalidnumber($sms_to);
    $sms_to = sendsms_manipulate_prefix($sms_to, $user);
    // make sure sms_datetime is in supported format and in GMT+0
    // timezone used for outgoing message is not module timezone, but default timezone
    // module gateway may have set already to +0000 (such kannel and clickatell)
    $sms_datetime = core_adjust_datetime($core_config['datetime']['now'], $core_config['main']['cfg_datetime_timezone']);
    // sent sms will be handled by plugin/tools/* first
    $ret_intercept = interceptsendsms($sms_sender, $sms_footer, $sms_to, $sms_msg, $uid, $gpid, $sms_type, $unicode);
    if ($ret_intercept['modified']) {
        $sms_sender = $ret_intercept['param']['sms_sender'] ? $ret_intercept['param']['sms_sender'] : $sms_sender;
        $sms_footer = $ret_intercept['param']['sms_footer'] ? $ret_intercept['param']['sms_footer'] : $sms_footer;
        $sms_to = $ret_intercept['param']['sms_to'] ? $ret_intercept['param']['sms_to'] : $sms_to;
        $sms_msg = $ret_intercept['param']['sms_msg'] ? $ret_intercept['param']['sms_msg'] : $sms_msg;
        $uid = $ret_intercept['param']['uid'] ? $ret_intercept['param']['uid'] : $uid;
        $gpid = $ret_intercept['param']['gpid'] ? $ret_intercept['param']['gpid'] : $gpid;
        $sms_type = $ret_intercept['param']['sms_type'] ? $ret_intercept['param']['sms_type'] : $sms_type;
        $unicode = $ret_intercept['param']['unicode'] ? $ret_intercept['param']['unicode'] : $unicode;
    }
    // if hooked function returns cancel=true then stop the sending, return false
    if ($ret_intercept['cancel']) {
        logger_print("cancelled:{$uid},{$gpid},{$gateway_module},{$sms_sender},{$sms_to},{$sms_type},{$unicode}", 3, "sendsms");
        $ret['status'] = false;
        return $ret;
    }
    // fixme anton - mobile number can be anything, screened by gateway
    // $sms_sender = sendsms_getvalidnumber($sms_sender);
    $ok = false;
    logger_print("start", 3, "sendsms");
    if (rate_cansend($username, $sms_to)) {
        // fixme anton - its a total mess ! need another DBA - we dont need this anymore
        //$sms_footer = addslashes(trim($sms_footer));
        //$sms_msg = addslashes($sms_msg);
        // we save all info first and then process with gateway module
        // the thing about this is that message saved may not be the same since gateway may not be able to process
        // message with that length or certain characters in the message are not supported by the gateway
        $db_query = "\n\t\t\tINSERT INTO " . _DB_PREF_ . "_tblSMSOutgoing \n\t\t\t(uid,p_gpid,p_gateway,p_src,p_dst,p_footer,p_msg,p_datetime,p_sms_type,unicode) \n\t\t\tVALUES ('{$uid}','{$gpid}','{$gateway_module}','{$sms_sender}','{$sms_to}','{$sms_footer}','{$sms_msg}','{$sms_datetime}','{$sms_type}','{$unicode}')\n\t\t";
        logger_print("saving:{$uid},{$gpid},{$gateway_module},{$sms_sender},{$sms_to},{$sms_type},{$unicode}", 3, "sendsms");
        // continue to gateway only when save to db is true
        if ($smslog_id = @dba_insert_id($db_query)) {
            logger_print("smslog_id:" . $smslog_id . " saved", 3, "sendsms");
            // fixme anton - another mess with slashes! also trim $sms_footer and prefix it with a space
            $sms_footer = ' ' . stripslashes(trim($sms_footer));
            $sms_msg = stripslashes($sms_msg);
            if (x_hook($gateway_module, 'sendsms', array($sms_sender, $sms_footer, $sms_to, $sms_msg, $uid, $gpid, $smslog_id, $sms_type, $unicode))) {
                // fixme anton - deduct user's credit as soon as gateway returns true
                rate_deduct($smslog_id);
                $ok = true;
            }
        }
    }
    logger_print("end", 3, "sendsms");
    $ret['status'] = $ok;
    $ret['smslog_id'] = $smslog_id;
    return $ret;
}
コード例 #9
0
ファイル: fn.php プロジェクト: ranakhurram/playSMS
function inboxgroup_getcatchall($id)
{
    $ret = array();
    $db_query = "SELECT uid FROM " . _DB_PREF_ . "_featureInboxgroup_catchall WHERE rid='{$id}'";
    $db_result = dba_query($db_query);
    $i = 0;
    while ($db_row = dba_fetch_array($db_result)) {
        $data = user_getdatabyuid($db_row['uid']);
        $ret[$i]['uid'] = $db_row['uid'];
        $ret[$i]['mobile'] = $data['mobile'];
        $i++;
    }
    return $ret;
}
コード例 #10
0
ファイル: fn.php プロジェクト: yrahman/playSMS
/**
 * Get banned users list
 *
 * @param integer $status
 *        	Account status
 * @return array Banned users
 */
function report_banned_list($status = 0)
{
    global $icon_config;
    $ret = array();
    $users = user_banned_list();
    foreach ($users as $user) {
        $c_user = user_getdatabyuid($user['uid']);
        $c_username = $c_user['username'];
        $c_email = $c_user['email'];
        $c_status = $c_user['status'];
        if ($status && $c_status != $status) {
            continue;
        }
        $c_isadmin = '';
        if ($c_status == '2') {
            $c_isadmin = $icon_config['admin'];
        }
        $ret[] = array('username' => $c_username, 'icon_isadmin' => $c_isadmin, 'email' => $c_email, 'bantime' => core_display_datetime($user['bantime']), 'action_link' => _a('index.php?app=main&inc=feature_report&route=banned&op=unban&uid=' . $user['uid'], $icon_config['unban']));
    }
    return $ret;
}
コード例 #11
0
ファイル: fn.php プロジェクト: RobinKarlsen/playSMS
function outgoing_hook_sendsms_intercept($sms_sender, $sms_footer, $sms_to, $sms_msg, $uid, $gpid, $sms_type, $unicode, $queue_code, $smsc)
{
    $ret = array();
    $next = TRUE;
    // supplied smsc will be priority
    if ($smsc && !($smsc == '_smsc_routed_' || $smsc == '_smsc_supplied_')) {
        _log('using supplied smsc smsc:[' . $smsc . '] uid:' . $uid . ' from:' . $sms_sender . ' to:' . $sms_to, 3, 'outgoing_hook_sendsms_intercept');
        $next = FALSE;
    }
    if ($next) {
        // if subuser then use parent_uid
        $the_uid = $uid;
        $parent_uid = 0;
        $user = user_getdatabyuid($uid);
        if ($user['status'] == 4) {
            $parent_uid = $user['parent_uid'];
            $the_uid = $parent_uid;
        }
        $smsc_list = outgoing_mobile2smsc($sms_to, $the_uid);
        $found = FALSE;
        $smsc_all = '';
        $smsc_found = array();
        foreach ($smsc_list as $item_smsc) {
            $smsc_all .= '[' . $item_smsc . '] ';
            $smsc_found[] = $item_smsc;
        }
        if (count($smsc_found) > 0) {
            $smsc_all = trim($smsc_all);
            shuffle($smsc_found);
            _log('found SMSCs:' . $smsc_all, 3, 'outgoing_hook_sendsms_intercept');
            _log('using prefix based smsc smsc:[' . $smsc_found[0] . '] uid:' . $uid . ' parent_uid:' . $parent_uid . ' from:' . $sms_sender . ' to:' . $sms_to, 3, 'outgoing_hook_sendsms_intercept');
            $smsc = $smsc_found[0];
            $next = FALSE;
        }
    }
    if ($next) {
        _log('no SMSC found uid:' . $uid . ' parent_uid:' . $parent_uid . ' from:' . $sms_sender . ' to:' . $sms_to, 3, 'outgoing_hook_sendsms_intercept');
    }
    if ($smsc) {
        $ret['modified'] = TRUE;
        $ret['param']['smsc'] = $smsc;
    }
    return $ret;
}
コード例 #12
0
ファイル: fn.php プロジェクト: 10corp/playSMS
function simplerate_hook_rate_getcharges($uid, $sms_len, $unicode, $sms_to)
{
    global $user_config;
    // default length per SMS
    $length = $unicode ? 70 : 160;
    // connector pdu length
    $minus = $unicode ? 3 : 7;
    // count unicodes as normal SMS
    $user = user_getdatabyuid($uid);
    if ($unicode && $user['opt']['enable_credit_unicode']) {
        $length = 140;
    }
    // get sms count
    $count = 1;
    if ($sms_len > $length) {
        $count = ceil($sms_len / ($length - $minus));
    }
    // calculate charges
    $rate = rate_getbyprefix($sms_to);
    $charge = $count * $rate;
    _log('uid:' . $uid . ' u:' . $user['username'] . ' len:' . $sms_len . ' unicode:' . $unicode . ' to:' . $sms_to . ' enable_credit_unicode:' . (int) $user['opt']['enable_credit_unicode'] . ' count:' . $count . ' rate:' . $rate . ' charge:' . $charge, 3, 'simplerate_hook_rate_getcharges');
    return array($count, $rate, $charge);
}