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


PHP registry_update函数代码示例

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


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

示例1: site_config_set

/**
 * Set option to site configuration
 *
 * @param array $config
 *        Partial or full site configuration
 * @return array Site configuration
 */
function site_config_set($config)
{
    global $user_config, $plugin_config;
    registry_remove($user_config['uid'], 'core', 'site_config');
    // save domain owner
    if ($user_config['status'] == 2 || $user_config['status'] == 3) {
        $items['uid'] = $user_config['uid'];
    } else {
        $items['uid'] = 0;
    }
    registry_update($user_config['uid'], 'core', 'site_config', $config);
    return site_config_get();
}
开发者ID:10corp,项目名称:playSMS,代码行数:20,代码来源:fn.php

示例2: firewall_hook_blacklist_checkip

/**
 * Check if IP address deserved to get listed in blacklist, if deserved then blacklist_addip()
 *
 * @param string $label
 *        single label, can be $username or $uid, its up to the implementator
 * @param string $ip
 *        single IP address
 * @return boolean TRUE on checked (not necessarily added)
 */
function firewall_hook_blacklist_checkip($label, $ip)
{
    global $plugin_config;
    $ret = FALSE;
    $hash = md5($label . $ip);
    $data = registry_search(0, 'feature', 'firewall');
    $login_attempt = $data['feature']['firewall'][$hash];
    if ($login_attempt > $plugin_config['firewall']['login_attempt_limit']) {
        blacklist_addip($label, $ip);
    }
    $items[$hash] = $login_attempt ? $login_attempt + 1 : 1;
    if (registry_update(0, 'feature', 'firewall', $items)) {
        $ret = TRUE;
    }
    return $ret;
}
开发者ID:yrahman,项目名称:playSMS,代码行数:25,代码来源:fn.php

示例3: 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');
    $amount = (double) $amount;
    if (abs($amount) <= 0) {
        _log('amount cannot be zero. amount:[' . $amount . ']', 2, 'credit_hook_rate_addusercredit');
        return FALSE;
    }
    // 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, '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)) {
            // set never been notified
            registry_update($uid, 'feature', 'credit', array('lowest_limit_notif' => FALSE));
            _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:kothsada,项目名称:playSMS,代码行数:32,代码来源:fn.php

示例4: defined

 * playSMS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with playSMS. If not, see <http://www.gnu.org/licenses/>.
 */
defined('_SECURE_') or die('Forbidden');
if (!auth_isadmin()) {
    auth_block();
}
include $core_config['apps_path']['plug'] . "/gateway/gammu/config.php";
switch (_OP_) {
    case "manage":
        if ($err = TRUE) {
            $content = _dialog();
        }
        $content .= "\n\t\t\t<h2>" . _('Manage gammu') . "</h2>\n\t\t\t<form action=index.php?app=main&inc=gateway_gammu&op=manage_save 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>\n\t\t\t\t\t<td class=label-sizer>" . _('Gateway name') . "</td><td>gammu</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . _('Spool folder') . "</td><td><input type=text name=up_path value=\"" . $plugin_config['gammu']['path'] . "\"></td>\n\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<p><input type=submit class=button value=\"" . _('Save') . "\">\n\t\t\t</form>";
        $content .= _back('index.php?app=main&inc=core_gateway&op=gateway_list');
        _p($content);
        break;
    case "manage_save":
        $up_path = core_sanitize_path($_POST['up_path']);
        $items = array('path' => $up_path);
        registry_update(0, 'gateway', 'gammu', $items);
        $_SESSION['dialog']['info'][] = _('Changes have been made');
        header("Location: " . _u('index.php?app=main&inc=gateway_gammu&op=manage'));
        exit;
        break;
}
开发者ID:10corp,项目名称:playSMS,代码行数:31,代码来源:gammu.php

示例5: _dialog

    case "manage":
        if ($err = TRUE) {
            $error_content = _dialog();
        }
        $tpl = array('name' => 'jasmin', 'vars' => array('DIALOG_DISPLAY' => $error_content, 'Manage jasmin' => _('Manage jasmin'), 'Gateway name' => _('Gateway name'), 'Jasmin send SMS URL' => _mandatory(_('Jasmin send SMS URL')), 'Callback URL' => _('Callback URL'), 'API username' => _mandatory(_('API username')), 'API password' => _('API password'), 'Module sender ID' => _('Module sender ID'), 'Module timezone' => _('Module timezone'), 'Save' => _('Save'), 'Notes' => _('Notes'), 'HINT_CALLBACK_URL' => _hint(_('Empty callback URL to set default')), 'HINT_FILL_PASSWORD' => _hint(_('Fill to change the API password')), 'HINT_MODULE_SENDER' => _hint(_('Max. 16 numeric or 11 alphanumeric char. empty to disable')), 'HINT_TIMEZONE' => _hint(_('Eg: +0700 for Jakarta/Bangkok timezone')), 'CALLBACK_URL_IS' => _('Your current callback URL is'), 'CALLBACK_URL_ACCESSIBLE' => _('Your callback URL should be accessible from Jasmin'), 'JASMIN_PUSH_DLR' => _('Jasmin will push DLR and incoming SMS to your callback URL'), 'BUTTON_BACK' => _back('index.php?app=main&inc=core_gateway&op=gateway_list'), 'status_active' => $status_active, 'jasmin_param_url' => $plugin_config['jasmin']['url'], 'jasmin_param_callback_url' => $plugin_config['jasmin']['callback_url'], 'jasmin_param_api_username' => $plugin_config['jasmin']['api_username'], 'jasmin_param_module_sender' => $plugin_config['jasmin']['module_sender'], 'jasmin_param_datetime_timezone' => $plugin_config['jasmin']['datetime_timezone']));
        _p(tpl_apply($tpl));
        break;
    case "manage_save":
        $up_url = $_REQUEST['up_url'] ? $_REQUEST['up_url'] : $plugin_config['jasmin']['default_url'];
        $up_callback_url = $_REQUEST['up_callback_url'] ? $_REQUEST['up_callback_url'] : $plugin_config['jasmin']['default_callback_url'];
        $up_api_username = $_REQUEST['up_api_username'];
        $up_api_password = $_REQUEST['up_api_password'];
        $up_module_sender = $_REQUEST['up_module_sender'];
        $up_datetime_timezone = $_REQUEST['up_datetime_timezone'];
        if ($up_url && $up_api_username) {
            $items = array('url' => $up_url, 'callback_url' => $up_callback_url, 'api_username' => $up_api_username, 'module_sender' => $up_module_sender, 'datetime_timezone' => $up_datetime_timezone);
            if ($up_api_password) {
                $items['api_password'] = $up_api_password;
            }
            if (registry_update(0, 'gateway', 'jasmin', $items)) {
                $_SESSION['dialog']['info'][] = _('Gateway module configurations has been saved');
            } else {
                $_SESSION['dialog']['danger'][] = _('Fail to save gateway module configurations');
            }
        } else {
            $_SESSION['dialog']['danger'][] = _('All mandatory fields must be filled');
        }
        header("Location: " . _u('index.php?app=main&inc=gateway_jasmin&op=manage'));
        exit;
        break;
}
开发者ID:10corp,项目名称:playSMS,代码行数:31,代码来源:jasmin.php

示例6: _options

        // credit unicodes messages as single message
        $option_enable_credit_unicode = _options(array(_('yes') => 1, _('no') => 0), $data['core']['user_config']['enable_credit_unicode']);
        if (auth_isadmin()) {
            $option_enable_credit_unicode = "<select name='edit_enable_credit_unicode'>" . $option_enable_credit_unicode . "</select>";
        } else {
            $option_enable_credit_unicode = $user_config['opt']['enable_credit_unicode'] ? _('yes') : _('no');
        }
        // error string
        if ($err = TRUE) {
            $error_content = _dialog();
        }
        $tpl = array('name' => 'user_config', 'vars' => array('Application options' => _('Application options'), 'Username' => _('Username'), 'Access Control List' => _('Access Control List'), 'Effective SMS sender ID' => _('Effective SMS sender ID'), 'Default sender ID' => _('Default sender ID'), 'Default message footer' => _('Default message footer'), 'Webservices username' => _('Webservices username'), 'Webservices token' => _('Webservices token'), 'Renew webservices token' => _('Renew webservices token'), 'Enable webservices' => _('Enable webservices'), 'Webservices IP range' => _('Webservices IP range'), 'Active language' => _('Active language'), 'Timezone' => _('Timezone'), 'Credit' => _('Credit'), 'Enable credit unicode SMS as normal SMS' => _('Enable credit unicode SMS as normal SMS'), 'Forward message to inbox' => _('Forward message to inbox'), 'Forward message to email' => _('Forward message to email'), 'Forward message to mobile' => _('Forward message to mobile'), 'Local number length' => _('Local number length'), 'Prefix or country code' => _('Prefix or country code'), 'Always choose to send as unicode' => _('Always choose to send as unicode'), 'Save' => _('Save'), 'DIALOG_DISPLAY' => $error_content, 'FORM_TITLE' => $form_title, 'BUTTON_DELETE' => $button_delete, 'BUTTON_BACK' => $button_back, 'URL_UNAME' => $url_uname, 'VIEW' => $view, 'HINT_MAX_CHARS' => _hint(_('Max. 16 numeric or 11 alphanumeric characters')), 'HINT_MAX_ALPHANUMERIC' => _hint(_('Max. 30 alphanumeric characters')), 'HINT_COMMA_SEPARATED' => _hint(_('Comma separated')), 'HINT_TIMEZONE' => _hint(_('Eg: +0700 for Jakarta/Bangkok timezone')), 'HINT_LOCAL_LENGTH' => _hint(_('Min length to detect missing country code')), 'HINT_REPLACE_ZERO' => _hint(_('Replace prefix 0 or padding local numbers')), 'HINT_MANAGE_CREDIT' => _hint(_('Add or reduce credit from manage credit menu')), 'HINT_ACL' => _hint(_('ACL DEFAULT will not restrict access to menus')), 'option_new_token' => $option_new_token, 'option_enable_webservices' => $option_enable_webservices, 'option_language_module' => $option_language_module, 'option_fwd_to_inbox' => $option_fwd_to_inbox, 'option_fwd_to_email' => $option_fwd_to_email, 'option_fwd_to_mobile' => $option_fwd_to_mobile, 'option_acl' => $option_acl, 'option_sender_id' => $option_sender_id, 'c_username' => $c_username, 'effective_sender_id' => sendsms_get_sender($c_username), 'sender' => $sender, 'footer' => $footer, 'token' => $token, 'webservices_ip' => $webservices_ip, 'datetime_timezone' => $datetime_timezone, 'local_length' => $local_length, 'replace_zero' => $replace_zero, 'credit' => $credit, 'option_enable_credit_unicode' => $option_enable_credit_unicode));
        _p(tpl_apply($tpl));
        break;
    case "user_config_save":
        $fields = array('footer', 'datetime_timezone', 'language_module', 'fwd_to_inbox', 'fwd_to_email', 'fwd_to_mobile', 'local_length', 'replace_zero', 'new_token', 'enable_webservices', 'webservices_ip', 'sender', 'acl_id');
        $up = array();
        foreach ($fields as $field) {
            if (strlen($_POST['up_' . $field])) {
                $up[$field] = trim($_POST['up_' . $field]);
            }
        }
        $ret = user_edit_conf($c_uid, $up);
        $items['enable_credit_unicode'] = (int) $_POST['edit_enable_credit_unicode'];
        registry_update($c_uid, 'core', 'user_config', $items);
        $_SESSION['dialog']['info'][] = $ret['error_string'];
        _log('saving username:' . $c_username . ' error_string:[' . $ret['error_string'] . ']', 2, 'user_config');
        header("Location: " . _u('index.php?app=main&inc=core_user&route=user_config&op=user_config' . $url_uname . '&view=' . $view));
        exit;
        break;
}
开发者ID:10corp,项目名称:playSMS,代码行数:31,代码来源:user_config.php

示例7: _options

        // option enable fetch
        $option_enable_fetch = _options(array(_('yes') => 1, _('no') => 0), $items_global['features']['mailsms']['enable_fetch']);
        // option check email sender
        $option_check_sender = _options(array(_('yes') => 1, _('no') => 0), $items_global['features']['mailsms']['check_sender']);
        // option protocol
        $option_protocol = _options(array('IMAP' => 'imap', 'POP3' => 'pop3'), $items_global['features']['mailsms']['protocol']);
        // option ssl
        $option_ssl = _options(array(_('yes') => 1, _('no') => 0), $items_global['features']['mailsms']['ssl']);
        // option cert
        $option_novalidate_cert = _options(array(_('yes') => 1, _('no') => 0), $items_global['features']['mailsms']['novalidate_cert']);
        $tpl = array('name' => 'mailsms', 'vars' => array('ERROR' => _err_display(), 'FORM_TITLE' => _('Manage email to SMS'), 'ACTION_URL' => _u('index.php?app=main&inc=feature_mailsms&op=mailsms_save'), 'HTTP_PATH_THEMES' => _HTTP_PATH_THEMES_, 'HINT_PASSWORD' => _hint(_('Fill the password field to change password')), 'Email to SMS address' => _('Email to SMS address'), 'Enable fetch new emails' => _('Enable fetch new emails'), 'Check email sender' => _('Check email sender'), 'Email protocol' => _('Email protocol'), 'Use SSL' => _('Use SSL'), 'No validate cert option' => _('No validate cert option'), 'Mail server address' => _('Mail server address'), 'Mail server port' => _('Mail server port'), 'Mailbox username' => _('Mailbox username'), 'Mailbox password' => _('Mailbox password'), 'PORT_DEFAULT' => '443', 'PORT_DEFAULT_SSL' => '993'), 'injects' => array('option_enable_fetch', 'option_check_sender', 'option_protocol', 'option_ssl', 'option_novalidate_cert', 'items_global'));
        _p(tpl_apply($tpl));
        break;
    case "mailsms_save":
        $items_global = array('email' => $_REQUEST['email'], 'enable_fetch' => $_REQUEST['enable_fetch'], 'check_sender' => $_REQUEST['check_sender'], 'protocol' => $_REQUEST['protocol'], 'ssl' => $_REQUEST['ssl'], 'novalidate_cert' => $_REQUEST['novalidate_cert'], 'port' => $_REQUEST['port'], 'server' => $_REQUEST['server'], 'username' => $_REQUEST['username'], 'hash' => md5($_REQUEST['username'] . $_REQUEST['server'] . $_REQUEST['port']));
        if ($_REQUEST['password']) {
            $items_global['password'] = $_REQUEST['password'];
        }
        registry_update(0, 'features', 'mailsms', $items_global);
        if ($_REQUEST['enable_fetch']) {
            $enabled = 'enabled';
            $_SESSION['error_string'] = _('Email to SMS configuration has been saved and service enabled');
        } else {
            $enabled = 'disabled';
            $_SESSION['error_string'] = _('Email to SMS configuration has been saved and service disabled');
        }
        _log($enabled . ' server:' . $_REQUEST['server'], 2, 'mailsms');
        header("Location: " . _u('index.php?app=main&inc=feature_mailsms&op=mailsms'));
        exit;
        break;
}
开发者ID:yrahman,项目名称:playSMS,代码行数:31,代码来源:mailsms.php

示例8: _

     break;
 case "sender_id_edit_yes":
     if (sender_id_update($uid, $c_sender_id, $c_sender_id_description, $_REQUEST['default'], $_REQUEST['approved'])) {
         $_SESSION['dialog']['info'][] = _('Sender ID description has been updated') . ' (' . _('Sender ID') . ': ' . $c_sender_id . ')';
     } else {
         $_SESSION['dialog']['info'][] = _('Fail to update due to invalid sender ID') . ' (' . _('Sender ID') . ': ' . $c_sender_id . ')';
     }
     header("Location: " . _u('index.php?app=main&inc=core_sender_id&op=sender_id_edit&id=' . $_REQUEST['id']));
     exit;
     break;
 case "toggle_status":
     $search = array('id' => $_REQUEST['id'], 'registry_family' => 'sender_id');
     foreach (registry_search_record($search) as $row) {
         $status = $row['registry_value'] == 0 ? 1 : 0;
         $items[$row['registry_key']] = $status;
         registry_update($row['uid'], 'features', 'sender_id', $items);
     }
     $_SESSION['dialog']['info'][] = ($status == 1 ? _('Sender ID is now approved') : _('Sender ID is now disabled')) . ' (' . _('Sender ID') . ': ' . $row['registry_key'] . ')';
     header("Location: " . _u('index.php?app=main&inc=core_sender_id&op=sender_id_list'));
     exit;
     break;
 case "sender_id_delete":
     $nav = themes_nav_session();
     $search = themes_search_session();
     $ref = $nav['url'] . '&search_keyword=' . $search['keyword'] . '&page=' . $nav['page'] . '&nav=' . $nav['nav'];
     $uid = auth_isadmin() && $data_sender_id[0]['uid'] ? $data_sender_id[0]['uid'] : $user_config['uid'];
     registry_remove($uid, 'features', 'sender_id', $data_sender_id[0]['registry_key']);
     registry_remove($uid, 'features', 'sender_id_description', $data_sender_id[0]['registry_key']);
     $default_sender_id = sender_id_default_get($uid);
     if (strtoupper($data_sender_id[0]['registry_key']) == strtoupper($default_sender_id)) {
         sender_id_default_set($data_sender_id[0]['uid'], '');
开发者ID:10corp,项目名称:playSMS,代码行数:31,代码来源:sender_id.php

示例9: defined

 *
 * You should have received a copy of the GNU General Public License
 * along with playSMS. If not, see <http://www.gnu.org/licenses/>.
 */
defined('_SECURE_') or die('Forbidden');
if (!auth_isadmin()) {
    auth_block();
}
include $core_config['apps_path']['plug'] . "/gateway/openvox/config.php";
$callback_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/plugin/gateway/openvox/callback.php";
$callback_url = str_replace("//", "/", $callback_url);
$callback_url = "http://" . $callback_url;
switch (_OP_) {
    case "manage":
        if ($err = TRUE) {
            $error_content = _dialog();
        }
        $tpl = array('name' => 'openvox', 'vars' => array('DIALOG_DISPLAY' => $error_content, 'Manage OpenVox' => _('Manage OpenVox'), 'Gateway name' => _('Gateway name'), 'Gateway host' => _('Gateway host'), 'Gateway port' => _('Gateway port'), 'Username' => _('Username'), 'Password' => _('Password'), 'Module sender ID' => _('Module sender ID'), 'Module timezone' => _('Module timezone'), 'Save' => _('Save'), 'Notes' => _('Notes'), 'HINT_FILL_SECRET' => _hint(_('Fill to change the password')), 'CALLBACK_URL_IS' => _('Your callback URL is'), 'CALLBACK_URL_ACCESSIBLE' => _('Your callback URL should be accessible from OpenVox'), 'BUTTON_BACK' => _back('index.php?app=main&inc=core_gateway&op=gateway_list'), 'openvox_param_gateway_host' => $plugin_config['openvox']['gateway_host'], 'openvox_param_gateway_port' => $plugin_config['openvox']['gateway_port'], 'openvox_param_username' => $plugin_config['openvox']['username'], 'callback_url' => $callback_url));
        _p(tpl_apply($tpl));
        break;
    case "manage_save":
        $_SESSION['dialog']['info'][] = _('Changes have been made');
        $items = array('gateway_host' => $_POST['up_gateway_host'], 'gateway_port' => $_POST['up_gateway_port'], 'username' => $_POST['up_username'], 'password' => $_POST['up_password']);
        if ($_POST['up_password']) {
            $items['password'] = $_POST['up_password'];
        }
        registry_update(1, 'gateway', 'openvox', $items);
        header("Location: " . _u('index.php?app=main&inc=gateway_openvox&op=manage'));
        exit;
        break;
}
开发者ID:10corp,项目名称:playSMS,代码行数:31,代码来源:openvox.php

示例10: user_banned_add

/**
 * Add account to banned account list
 *
 * @param integer $uid
 *        User ID
 * @return boolean TRUE if user successfully added to banned user list
 */
function user_banned_add($uid)
{
    global $user_config;
    // account admin and currently logged in user/admin cannot be ban
    if ($uid && ($uid == 1 || $uid == $user_config['uid'])) {
        _log('unable to ban uid:' . $uid, 2, 'user_banned_add');
        return FALSE;
    }
    $bantime = core_get_datetime();
    if (user_session_get($uid)) {
        if (!user_session_remove($uid)) {
            return FALSE;
        }
    }
    $item = array($uid => $bantime);
    if (registry_update(1, 'auth', 'banned_users', $item)) {
        _log('banned uid:' . $uid . ' bantime:' . $bantime, 2, 'user_banned_add');
        return TRUE;
    } else {
        return FALSE;
    }
}
开发者ID:10corp,项目名称:playSMS,代码行数:29,代码来源:fn.php

示例11: sender_id_update

/**
 * Update 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 updated
 */
function sender_id_update($uid, $sender_id, $sender_id_description = '', $isdefault = '_', $isapproved = '_')
{
    global $user_config;
    if (sender_id_check($uid, $sender_id)) {
        $default = '_';
        if ($isdefault !== '_') {
            $default = (int) $isdefault ? 1 : 0;
        }
        if ($isapproved !== '_') {
            if (auth_isadmin()) {
                $approved = (int) $isapproved ? 1 : 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) {
            if ($data_sender_id) {
                registry_update($uid, 'features', 'sender_id', $data_sender_id);
            }
            registry_update($uid, 'features', 'sender_id_desc', $data_description);
        } else {
            // unknown error
            return FALSE;
        }
        // set default
        if ($default !== '_') {
            if (auth_isadmin() && $default && $approved) {
                // set default if isadmin, default and approved
                sender_id_default_set($uid, $sender_id);
            } else {
                // set to empty (remove default)
                sender_id_default_set($uid, '');
            }
        }
        return TRUE;
    } else {
        // not found
        return FALSE;
    }
}
开发者ID:10corp,项目名称:playSMS,代码行数:57,代码来源:fn.php

示例12: file_exists

            $default_logo_url = _HTTP_PATH_THEMES_ . '/common/images/logo.png';
            $logo_url = file_exists($themes_logo) ? $themes_logo_url : $default_logo_url;
            // force to disable logo when neither themes_logo or default_logo exists
            if (!file_exists($default_logo)) {
                $logo_url = '';
                $enable_logo = 0;
            }
        }
        // disable logo_replace_title when logo disabled
        if (!$enable_logo) {
            $logo_replace_title = 0;
        }
        // allow default account status 3 and 4 only
        $edit_default_user_status = (int) $_POST['edit_default_user_status'];
        if (!($edit_default_user_status == 3 || $edit_default_user_status == 4)) {
            $edit_default_user_status == 4;
        }
        // save
        foreach ($_POST as $key => $val) {
            if (substr($key, 0, 5) == 'edit_') {
                $post[$key] = str_replace('"', '\'', $val);
            }
        }
        $items = array('web_title' => $post['edit_web_title'], 'email_service' => $post['edit_email_service'], 'email_footer' => $post['edit_email_footer'], 'main_website_name' => $post['edit_main_website_name'], 'main_website_url' => $post['edit_main_website_url'], 'gateway_number' => core_sanitize_sender($post['edit_gateway_number']), 'gateway_timezone' => $post['edit_gateway_timezone'], 'username_length' => (int) $post['edit_username_length'] >= 3 && (int) $post['edit_username_length'] <= 100 ? (int) $post['edit_username_length'] : 30, 'default_rate' => (double) $post['edit_default_rate'], 'gateway_module' => $post['edit_gateway_module'] ? $post['edit_gateway_module'] : 'dev', 'themes_module' => $post['edit_themes_module'] ? $post['edit_themes_module'] : 'default', 'language_module' => $post['edit_language_module'] ? $post['edit_language_module'] : 'en_US', 'sms_max_count' => (int) ($post['edit_sms_max_count'] > 1 ? $post['edit_sms_max_count'] : 1), 'plus_sign_remove' => (int) $post['edit_plus_sign_remove'], 'plus_sign_add' => (int) $post['edit_plus_sign_add'], 'enable_credit_unicode' => (int) $post['edit_enable_credit_unicode'], 'brute_force_detection' => (int) $post['edit_brute_force_detection'], 'keyword_separator' => substr($post['edit_keyword_separator'], 0, 1), 'credit_lowest_limit' => (double) $post['edit_credit_lowest_limit'], 'sms_limit_per_hour' => (int) $post['edit_sms_limit_per_hour'], 'default_replace_zero' => $post['edit_default_replace_zero'], 'default_credit' => (double) $post['edit_default_credit'], 'default_user_status' => $edit_default_user_status, 'default_parent' => (int) $post['edit_default_parent'], 'default_acl' => (int) $post['edit_default_acl'], 'enable_register' => (int) $post['edit_enable_register'], 'enable_forgot' => (int) $post['edit_enable_forgot'], 'disable_login_as' => (int) $post['edit_disable_login_as'], 'enhance_privacy_subuser' => (int) $post['edit_enhance_privacy_subuser'], 'enable_logo' => (int) $enable_logo, 'logo_url' => $logo_url, 'logo_replace_title' => (int) $logo_replace_title, 'layout_footer' => $post['edit_layout_footer'] ? $post['edit_layout_footer'] : _('Application footer here. Go to main configuration or manage site to edit this footer.'), 'information_title' => $post['edit_information_title'] ? $post['edit_information_title'] : _('Information'), 'information_content' => $post['edit_information_content'] ? $post['edit_information_content'] : _('Go to main configuration or manage site to edit this page'));
        $result = registry_update(1, 'core', 'main_config', $items);
        _log('main configuration saved. uid:' . $user_config['uid'], 3, 'main_config');
        $_SESSION['dialog']['info'][] = _('Main configuration changes has been saved');
        header("Location: " . _u('index.php?app=main&inc=core_main_config&op=main_config'));
        exit;
        break;
}
开发者ID:RobinKarlsen,项目名称:playSMS,代码行数:31,代码来源:main_config.php

示例13: defined

 *
 * playSMS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with playSMS. If not, see <http://www.gnu.org/licenses/>.
 */
defined('_SECURE_') or die('Forbidden');
if (!auth_isadmin()) {
    auth_block();
}
include $core_config['apps_path']['plug'] . "/gateway/smstools/config.php";
switch (_OP_) {
    case "manage":
        $content .= _dialog() . "\n\t\t\t<h2>" . _('Manage smstools') . "</h2>\n\t\t\t<form action=index.php?app=main&inc=gateway_smstools&op=manage_save 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\t<tr>\n\t\t\t\t\t\t<td class=label-sizer>" . _('Gateway name') . "</td><td>smstools</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . _('Default default_queue directory') . "</td><td><input type=text name=up_default_queue value=\"" . $plugin_config['smstools']['default_queue'] . "\"></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<p><input type=submit class=button value=\"" . _('Save') . "\">\n\t\t\t</form>\n\t\t\t<p>" . _back('index.php?app=main&inc=core_gateway&op=gateway_list');
        _p($content);
        break;
    case "manage_save":
        $up_default_queue = trim(core_sanitize_path($_POST['up_default_queue']));
        if (!$up_default_queue) {
            $up_default_queue = "/var/spool/sms";
        }
        $items = array('default_queue' => $up_default_queue);
        registry_update(0, 'gateway', 'smstools', $items);
        $_SESSION['dialog']['info'][] = _('Changes have been made');
        header("Location: " . _u('index.php?app=main&inc=gateway_smstools&op=manage'));
        exit;
        break;
}
开发者ID:10corp,项目名称:playSMS,代码行数:31,代码来源:smstools.php

示例14: simplerate_hook_rate_deduct

function simplerate_hook_rate_deduct($smslog_id)
{
    global $core_config;
    logger_print("enter smslog_id:" . $smslog_id, 2, "simplerate deduct");
    $db_query = "SELECT p_dst,p_footer,p_msg,uid,unicode FROM " . _DB_PREF_ . "_tblSMSOutgoing WHERE smslog_id='{$smslog_id}'";
    $db_result = dba_query($db_query);
    if ($db_row = dba_fetch_array($db_result)) {
        $p_dst = $db_row['p_dst'];
        $p_msg = $db_row['p_msg'];
        $p_footer = $db_row['p_footer'];
        $uid = $db_row['uid'];
        $unicode = $db_row['unicode'];
        if ($p_dst && $p_msg && $uid) {
            // get charge
            $p_msg_len = strlen($p_msg) + strlen($p_footer);
            list($count, $rate, $charge) = rate_getcharges($uid, $p_msg_len, $unicode, $p_dst);
            // sender's
            $username = user_uid2username($uid);
            $credit = rate_getusercredit($username);
            $balance = $credit - $charge;
            // parent's when sender is a subuser
            $parent_uid = user_getparentbyuid($uid);
            if ($parent_uid) {
                $username_parent = user_uid2username($parent_uid);
                $credit_parent = rate_getusercredit($username_parent);
                $balance_parent = $credit_parent - $charge;
            }
            // if sender have parent then deduct parent first
            if ($parent_uid) {
                if (!rate_setusercredit($parent_uid, $balance_parent)) {
                    return FALSE;
                }
                logger_print("parent uid:" . $uid . " parent_uid:" . $parent_uid . " smslog_id:" . $smslog_id . " msglen:" . $p_msg_len . " count:" . $count . " rate:" . $rate . " charge:" . $charge . " credit_parent:" . $credit_parent . " balance_parent:" . $balance_parent, 2, "simplerate deduct");
            }
            if (rate_setusercredit($uid, $balance)) {
                logger_print("user uid:" . $uid . " parent_uid:" . $parent_uid . " smslog_id:" . $smslog_id . " msglen:" . $p_msg_len . " count:" . $count . " rate:" . $rate . " charge:" . $charge . " credit:" . $credit . " balance:" . $balance, 2, "simplerate deduct");
                if (billing_post($smslog_id, $rate, $credit, $count, $charge)) {
                    logger_print("deduct successful uid:" . $uid . " parent_uid:" . $parent_uid . " smslog_id:" . $smslog_id, 3, "simplerate deduct");
                    // if balance under credit lowest limit and never been notified then notify admins, parent_uid and uid
                    $credit_lowest_limit = (double) $core_config['main']['credit_lowest_limit'];
                    _log('credit_lowest_limit:' . $credit_lowest_limit . ' balance:' . $balance . ' charge:' . $charge, 3, 'simplerate deduct');
                    $reg = registry_search($uid, 'feature', 'credit', 'lowest_limit_notif');
                    $notified = $reg['feature']['credit']['lowest_limit_notif'] ? TRUE : FALSE;
                    if ($charge && $balance && $credit_lowest_limit && $balance <= $credit_lowest_limit && !$notified) {
                        // set notified
                        registry_update($uid, 'feature', 'credit', array('lowest_limit_notif' => TRUE));
                        // notif admins
                        $admins = user_getallwithstatus(2);
                        foreach ($admins as $admin) {
                            $credit_message_to_admins = sprintf(_('Username %s with account ID %d has reached lowest credit limit of %s'), $username, $uid, $credit_lowest_limit);
                            recvsms_inbox_add(core_get_datetime(), _SYSTEM_SENDER_ID_, $admin['username'], $credit_message_to_admins);
                        }
                        // notif parent_uid if exists
                        if ($parent_uid && $username_parent) {
                            $credit_message_to_parent = sprintf(_('Your subuser with username %s and account ID %d has reached lowest credit limit of %s'), $username, $uid, $credit_lowest_limit);
                            recvsms_inbox_add(core_get_datetime(), _SYSTEM_SENDER_ID_, $username_parent, $credit_message_to_parent);
                        }
                        // notif uid
                        $sender_username = $username_parent ? $username_parent : _SYSTEM_SENDER_ID_;
                        $credit_message_to_self = sprintf(_('You have reached lowest credit limit of %s'), $credit_lowest_limit);
                        recvsms_inbox_add(core_get_datetime(), $sender_username, $username, $credit_message_to_self);
                        _log('sent notification credit_lowest_limit:' . $credit_lowest_limit, 3, 'simplerate deduct');
                    }
                    return TRUE;
                } else {
                    logger_print("deduct failed uid:" . $uid . " parent_uid:" . $parent_uid . " smslog_id:" . $smslog_id, 3, "simplerate deduct");
                    return FALSE;
                }
            } else {
                logger_print("rate deduct failed due to unable to save to db uid:" . $uid . " parent_uid:" . $parent_uid . " smslog_id:" . $smslog_id, 3, "simplerate deduct");
            }
        } else {
            logger_print("rate deduct failed due to empty data uid:" . $uid . " parent_uid:" . $parent_uid . " smslog_id:" . $smslog_id, 3, "simplerate deduct");
        }
    } else {
        logger_print("rate deduct failed due to missing data uid:" . $uid . " parent_uid:" . $parent_uid . " smslog_id:" . $smslog_id, 3, "simplerate deduct");
    }
    return FALSE;
}
开发者ID:10corp,项目名称:playSMS,代码行数:79,代码来源:fn.php

示例15: trim

        $post_rules['match_sender_id'] = (int) $_REQUEST['sandbox_match_sender_id'];
        $items['sandbox_match_sender_id'] = $post_rules['match_sender_id'];
        // sandbox prefix
        $post_rules['insert_prefix'] = trim(strtoupper(core_sanitize_alphanumeric($_REQUEST['sandbox_prefix'])));
        if ($post_rules['insert_prefix'] && keyword_isavail($post_rules['insert_prefix'])) {
            $_SESSION['dialog']['info'][] = _('Fail to insert keyword') . ' (' . _('keyword') . ': ' . $post_rules['insert_prefix'] . ')';
            $post_rules['insert_prefix'] = '';
        }
        $items['sandbox_prefix'] = $post_rules['insert_prefix'];
        // sandbox forward to users
        $post_rules['forward_to'] = serialize(array_unique($_REQUEST['uids']));
        $items['sandbox_forward_to'] = $post_rules['forward_to'];
        // sandbox forward to url
        $post_rules['forward_to_url'] = $_REQUEST['forward_to_url'];
        $items['sandbox_forward_to_url'] = $post_rules['forward_to_url'];
        // form settings
        // settings to leave copy on sandbox
        $items['settings_leave_copy_sandbox'] = (int) $_REQUEST['settings_leave_copy_sandbox'];
        // settings to match with all approved sender ID
        $items['settings_match_all_sender_id'] = (int) $_REQUEST['settings_match_all_sender_id'];
        // save to registry
        if (count($items)) {
            registry_update(1, 'feature', 'incoming', $items);
            $_SESSION['dialog']['info'][] = _('Incoming SMS route changes has been saved');
        } else {
            $_SESSION['dialog']['info'][] = _('No route has been saved');
        }
        header("Location: " . _u('index.php?app=main&inc=feature_incoming&op=incoming'));
        exit;
        break;
}
开发者ID:amoskarugaba,项目名称:playSMS,代码行数:31,代码来源:incoming.php


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