本文整理汇总了PHP中ms函数的典型用法代码示例。如果您正苦于以下问题:PHP ms函数的具体用法?PHP ms怎么用?PHP ms使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ms函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _group_auto_cancel
function _group_auto_cancel()
{
/* 自动取消团购的天数 */
$interval = GROUP_CANCEL_INTERVAL * 3600 * 24;
$groupbuy_mod =& m('groupbuy');
$groups = $groupbuy_mod->findAll(array('conditions' => "gb.state = '" . GROUP_END . "' AND gb.end_time > 0 AND gb.end_time + {$interval} < '" . gmtime() . "'", 'join' => 'belong_store', 'include' => array('be_join')));
// 短信通知
$ms =& ms();
$userpriv_mod =& m('userpriv');
foreach ($groups as $group) {
// 管理员
$admin_id = $userpriv_mod->get_admin_id();
$to_id = array_keys($admin_id);
$group_ids[] = $group['group_id'];
// 参与团购的用户
if (!empty($group['member'])) {
foreach ($group['member'] as $join_user) {
$to_id[] = $join_user['user_id'];
}
$to_id = array_unique($to_id);
}
$content = get_msg('tobuyer_group_auto_cancel_notify', array('cancel_days' => GROUP_CANCEL_INTERVAL, 'url' => SITE_URL . '/' . url("app=groupbuy&id=" . $group['group_id'])));
$ms->pm->send(MSG_SYSTEM, $to_id, '', $content);
}
// 取消团购活动
empty($group_ids) || $groupbuy_mod->edit($group_ids, array('state' => GROUP_CANCELED));
}
示例2: authenticate
public function authenticate($password)
{
$auth = DB::execute("SELECT userID FROM users WHERE userID='" . ms($this->userID) . "' AND password='" . ms($password) . "'");
if (count($auth) > 0) {
$_SESSION['userID'] = $this->userID;
}
}
示例3: login
function login()
{
if ($this->visitor->has_login) {
$this->show_warning('has_login');
return;
}
if (!IS_POST) {
if (Conf::get('captcha_status.backend')) {
$this->assign('captcha', 1);
}
$this->display('login.html');
} else {
if (Conf::get('captcha_status.backend') && base64_decode($_SESSION['captcha']) != strtolower($_POST['captcha'])) {
$this->show_warning('captcha_faild');
return;
}
$user_name = trim($_POST['user_name']);
$password = $_POST['password'];
$ms =& ms();
$user_id = $ms->user->auth($user_name, $password);
if (!$user_id) {
/* 未通过验证,提示错误信息 */
$this->show_warning($ms->user->get_error());
return;
}
/* 通过验证,执行登陆操作 */
if (!$this->_do_login($user_id)) {
return;
}
$this->show_message('login_successed', 'go_to_admin', 'index.php');
}
}
示例4: fac
function fac($n)
{
$x = 1;
for ($i = $n; $i > 1; $i--) {
$x = ms((string) $x, $i);
}
echo $x;
}
示例5: test_inhabitant_delete
/**
* delete an inhabitant
*
* @depends test_save_updates_to_inhabitant
*/
public function test_inhabitant_delete()
{
// get an inhabitantID to test with
$inhabitant = ms('inhabitant', 'name', 'bob_has_a_new_name');
$params = array('inhabitantID' => $inhabitant->getID());
dispatch_controller('inhabitant/delete_inhabitant', $params);
// assert we got the correct URI
$this->assertViewURI('json/success');
}
示例6: MemberApp
function MemberApp()
{
parent::__construct();
$this->ms =& ms();
//连接用户中心
//$this->_feed_enabled = $this->ms->feed->feed_enabled();
//$this->assign('feed_enabled', $this->_feed_enabled);
$this->model_member =& m('member');
}
示例7: getWineAction
public function getWineAction()
{
$wid = $_POST['wineID'];
$sql = 'Select * from `product` where `id`=' . ms($wid);
$wine = DB::execute($sql);
$res = new ResultObj(true, $wine, '');
echo $res->toJson();
exit;
}
示例8: base_setting
/**
* 系统设置
*
* @author Hyber
* @return void
*/
function base_setting()
{
$model_setting =& af('settings');
$setting = $model_setting->getAll();
//载入系统设置数据
$ms =& ms();
$feed_enabled = $ms->feed->feed_enabled();
if ($feed_enabled) {
$_feed_list = array('store_created' => Lang::get('feed_store_created.name'), 'order_created' => Lang::get('feed_order_created.name'), 'goods_collected' => Lang::get('feed_goods_collected.name'), 'store_collected' => Lang::get('feed_store_collected.name'), 'goods_evaluated' => Lang::get('feed_goods_evaluated.name'), 'groupbuy_joined' => Lang::get('feed_groupbuy_joined.name'), 'goods_created' => Lang::get('feed_goods_created.name'), 'groupbuy_created' => Lang::get('feed_groupbuy_created.name'));
}
if (!IS_POST) {
$time_zone = $model_setting->_get_time_zone();
$this->assign('time_zone', $time_zone);
$this->assign('setting', $setting);
if ($feed_enabled) {
$this->assign('default_feed_config', Conf::get('default_feed_config'));
$this->assign('feed_items', $_feed_list);
}
$this->assign('feed_enabled', $feed_enabled);
$this->display('setting.base_setting.html');
} else {
$images = array('default_goods_image', 'default_store_logo', 'default_user_portrait');
$image_urls = $this->_upload_images($images);
foreach ($images as $image) {
isset($image_urls[$image]) && ($data[$image] = $image_urls[$image]);
}
// $data['auto_allow'] = $_POST['auto_allow'];
$data['time_zone'] = $_POST['time_zone'];
$data['time_format_simple'] = $_POST['time_format_simple'];
$data['time_format_complete'] = $_POST['time_format_complete'];
$data['price_format'] = $_POST['price_format'];
$data['statistics_code'] = $_POST['statistics_code'];
// $data['url_rewrite'] = $_POST['url_rewrite'];
// $data['max_addr'] = $_POST['max_addr'];
// $data['max_file'] = $_POST['max_file'];
// $data['cache_life'] = $_POST['cache_life'];
// $data['thumb_quality'] = $_POST['thumb_quality'];
// $data['allow_guest_buy'] = $_POST['allow_guest_buy'];
// $data['allow_comment'] = $_POST['allow_comment'];
// $data['disaplay_sales_volume'] = $_POST['disaplay_sales_volume'];
$data['sitemap_enabled'] = $_POST['sitemap_enabled'] == '1';
$data['sitemap_frequency'] = $_POST['sitemap_frequency'] > 0 ? intval($_POST['sitemap_frequency']) : 1;
$data['rewrite_enabled'] = $_POST['rewrite_enabled'] == '1';
$data['guest_comment'] = $_POST['guest_comment'] == '1';
if ($feed_enabled) {
$_default_feed_list = array();
foreach ($_feed_list as $key => $_v) {
$_default_feed_list[$key] = 0;
}
$data['default_feed_config'] = array_merge($_default_feed_list, (array) $_POST['default_feed_config']);
}
$model_setting->setAll($data);
$this->show_message('edit_base_setting_successed');
}
}
示例9: createRule
public static function createRule($userID, $ruleName, $type = 3)
{
$rule = new Rule($userID);
$entryID = $type;
if ($type == 3) {
$max_res = DB::execute("SELECT MAX(entryID) AS max FROM rules WHERE userID='" . ms($userID) . "'");
if (count($max_res) > 0 && $max_res["max"] > 3) {
$entryID = $max_res["max"] + 1;
}
}
$rule->setEntryID($entryID);
$rule->setRuleName($ruleName);
return $rule;
}
示例10: merge_sort
function merge_sort($array_to_sort = '')
{
if (count($array_to_sort) == 1) {
return $array_to_sort;
} else {
$sp = count($array_to_sort) / 2;
$sp = floor($sp);
$left = array_slice($array_to_sort, 0, $sp);
$right = array_slice($array_to_sort, $sp);
$left = ms($left);
$right = ms($right);
$result = merge($left, $right);
return $result;
}
}
示例11: index
function index()
{
if (!IS_POST) {
$this->display('index.html');
} else {
$seller_name = empty($_POST['seller']) ? '' : trim($_POST['seller']);
$buyer_name = empty($_POST['buyer']) ? '' : trim($_POST['buyer']);
if (!$seller_name || !$buyer_name) {
$this->show_message('请填写卖家用户名和买家用户名');
return;
}
/* 检查用户名 */
$ms =& ms();
if (!$ms->user->check_username($seller_name)) {
$error_msg = array('user_exists' => '卖家用户名已存在,请您换一个', 'invalid_user_name' => '卖家用户名不符合要求,请您换一个', 'blocked_user_name' => '卖家用户名不符合要求,请您换一个', 'unknow_error' => '卖家用户名不符合要求,请您换一个');
$error = $ms->user->get_error();
$this->show_message($error_msg[$error[0]['msg']]);
return;
}
if (!$ms->user->check_username($buyer_name)) {
$error_msg = array('user_exists' => '买家用户名已存在,请您换一个', 'invalid_user_name' => '买家用户名不符合要求,请您换一个', 'blocked_user_name' => '买家用户名不符合要求,请您换一个', 'unknow_error' => '买家用户名不符合要求,请您换一个');
$error = $ms->user->get_error();
$this->show_message($error_msg[$error[0]['msg']]);
return;
}
/* 注册用户 */
$this->_seller_id = $ms->user->register($seller_name, '123456', 'seller@ecmall.com', array('real_name' => '超级卖家'));
$this->_buyer_id = $ms->user->register($buyer_name, '123456', 'buyer@ecmall.com', array('real_name' => '超级买家'));
/* 复制文件 */
copy_files(APP_ROOT . '/data', ROOT_PATH . '/data');
/* 运行sql */
$mod =& m('privilege');
$sqls = get_sql(APP_ROOT . '/initdata.sql');
foreach ($sqls as $sql) {
$sql = str_replace('{seller_id}', $this->_seller_id, $sql);
$sql = str_replace('{buyer_id}', $this->_buyer_id, $sql);
$mod->db->query($sql);
}
/* 清除缓存 */
$cache_server =& cache_server();
$cache_server->clear();
/* 锁定文件 */
touch(LOCK_FILE);
/* 运行成功 */
$this->show_message('恭喜!测试数据安装成功!');
}
}
示例12: msg
/**
* 编辑消息模板
*
* @author Hyber
* @return void
*/
function msg()
{
$code = isset($_GET['code']) ? trim($_GET['code']) : '';
if (!$code) {
$this->show_warning('no_such_noticetemplate');
}
if (!IS_POST) {
$ms =& ms();
$msgtemplate = $this->_m->getOne($code);
$this->assign('msgtemplate', $msgtemplate);
$this->display('noticetemplate.msg.html');
} else {
$this->_m->_filename = $this->_m->_msg_user_file;
$this->_m->setAll(stripslashes_deep(array($code => $_POST['msgtemplate'])));
$this->show_message('update_noticetemplate_successed', 'back_list', 'index.php?app=mailtemplate' . '&type=' . $this->_type, 'edit_again', 'index.php?app=mailtemplate&act=msg&code=' . $code . '&type=' . $this->_type);
}
}
示例13: delete
function delete()
{
$ques_id = empty($_GET['id']) ? 0 : trim($_GET['id']);
$ids = explode(',', $ques_id);
$conditions = "1 = 1 AND ques_id " . db_create_in($ids);
$ms =& ms();
foreach ($ids as $key => $val) {
$title = Lang::get('drop_goodsqa_notice');
$store = $this->goodsqa_mod->get(array('conditions' => 'ques_id =' . $val, 'join' => 'belongs_to_goods', 'fields' => 'goods_qa.store_id,goods_name,question_content'));
$content = sprintf(Lang::get('admin_drop_your_goodsqa'), LANG::get('goods'), addslashes($store['goods_name']), Lang::get('content_is'), addslashes($store['question_content']));
$ms->pm->send(MSG_SYSTEM, $store['store_id'], $title, $content);
}
if (!($res = $this->goodsqa_mod->drop($conditions))) {
$this->show_warning('drop_failed');
return;
} else {
$this->show_warning('drop_successful', 'to_qa_list', 'index.php?app=goodsqa');
return;
}
}
示例14: loginAction
public function loginAction()
{
$login_name = $_POST['username'];
$password = $_POST['password'];
if (trim($login_name)) {
$sql = "select * from user where `username` = '" . ms($login_name) . "'";
$user = DB::execute($sql);
if ($user['id']) {
$login_user = new User($user);
if ($login_user->authenticate($password)) {
header('Location:index.php');
} else {
header('Location:login.php');
}
//$this->indexAction();
} else {
$_SESSION['msg'] = "未知用户";
header('Location:login.php');
}
}
}
示例15: _message_to_user
function _message_to_user($users, $coupon)
{
$ms =& ms();
foreach ($users as $key => $val) {
$content = get_msg('touser_send_coupon', array('price' => $coupon['coupon_value'], 'start_time' => local_date('Y-m-d', $coupon['start_time']), 'end_time' => local_date("Y-m-d", $coupon['end_time']), 'coupon_sn' => $val['coupon']['coupon_sn'], 'min_amount' => $coupon['min_amount'], 'url' => SITE_URL . '/' . url('app=store&id=' . $coupon['store_id']), 'store_name' => $coupon['store_name']));
$msg_id = $ms->pm->send(MSG_SYSTEM, $val['user_id'], '', $content);
}
}