本文整理汇总了PHP中remind类的典型用法代码示例。如果您正苦于以下问题:PHP remind类的具体用法?PHP remind怎么用?PHP remind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了remind类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* 编辑页面分类
*/
public function edit()
{
$id = $this->input->get('id');
if (!$id) {
remind::set(Kohana::lang('o_global.bad_request'), 'site/doc_category');
}
$data = Mydoc_category::instance($id)->get();
if ($_POST) {
$category_name = $this->input->post('category_name');
$parent_id = $this->input->post('parent_id');
if (empty($category_name)) {
remind::set(Kohana::lang('o_site.doc_category_cannot_null'));
} else {
if ($parent_id == $id) {
remind::set(Kohana::lang('o_site.doc_parent_category_cannot_self'));
} else {
if (Mydoc_category::instance()->name_exist($category_name, $id)) {
remind::set(Kohana::lang('o_site.doc_category_has_exist'));
} else {
if (Mydoc_category::instance($id)->edit($_POST)) {
remind::set(Kohana::lang('o_global.update_success'), 'site/doc_category', 'success');
} else {
remind::set(Kohana::lang('o_global.update_error') . Mydoc_category::instance($id)->error());
}
}
}
}
$data = array_merge($data, $_POST);
}
$doc_categories = Mydoc_category::instance()->doc_categories(0);
$this->template->content = new View("site/doc_category_edit");
$this->template->content->data = $data;
$this->template->content->doc_categories = $doc_categories;
}
示例2: is_allowed
public static function is_allowed($permission = 'default', $site_id = 0, $type = NULL)
{
$verify = true;
$site_ids = role::get_site_ids($type);
//超级管理员root不需要检查权限 zhu modify
if (role::is_root()) {
$verify = true;
} else {
if ($site_id > 0 && !in_array($site_id, $site_ids)) {
$verify = false;
}
$acl = Session::instance()->get(self::$acl_tag);
if ($acl) {
$acl = unserialize($acl);
} else {
$acl = self::acl_init();
}
$manager = role::get_manager();
$verify = $acl->is_allowed($manager["username"], $permission);
}
//验证操作
if ($verify) {
return $site_ids;
} else {
if (request::is_ajax()) {
$return_struct = array('status' => 0, 'code' => 501, 'msg' => Kohana::lang('o_global.access_denied'), 'content' => array());
die(json_encode($return_struct));
} else {
$referrer = tool::referrer_url();
remind::set('权限不足', $referrer, 'error');
}
}
}
示例3: index
public function index()
{
$route_data = Myroute::instance()->get();
if ($_POST) {
$site_next_flow = site::site_next_flow($this->current_flow);
$submit_target = intval($this->input->post('submit_target'));
if (Myroute::instance()->edit($_POST)) {
//判断添加成功去向
switch ($submit_target) {
case 2:
remind::set(Kohana::lang('o_global.update_success'), $site_next_flow['url'], 'success');
default:
remind::set(Kohana::lang('o_global.update_success'), 'site/route', 'success');
}
} else {
remind::set(Kohana::lang('o_global.update_error'), 'site/route');
}
}
$this->template->content = new View("site/route_edit");
$this->template->content->is_modify = 0;
if ($this->manager_is_admin == 1) {
$this->template->content->is_modify = 1;
}
$this->template->content->data = $route_data;
$this->template->content->site_id = $this->site_id;
}
示例4: index
public function index()
{
$site_id = 1;
$theme_id = 2;
$server = Storage_server::instance();
$filename = $this->input->get('filename');
$theme_views = $server->get_site_themes($site_id, $theme_id, 'views');
$theme_js = $server->get_site_themes($site_id, $theme_id, 'js');
$theme_css = $server->get_site_themes($site_id, $theme_id, 'css');
if (in_array($filename, $theme_views)) {
$type = 'views';
} else {
if (in_array($filename, $theme_js)) {
$type = 'js';
} else {
if (in_array($filename, $theme_css)) {
$type = 'css';
} else {
$type = 'views';
$filename = 'index.php';
}
}
}
if ($_POST) {
$file = $_POST['file'];
$server->cache_site_theme($site_id, $theme_id, $type, $filename, $file);
remind::set('add ' . $_POST['file'], url::current(TRUE));
}
$code = $server->get_site_theme($site_id, $theme_id, $type, $filename);
$this->template->content = new View("site/theme_edit");
$this->template->content->theme_files = array_merge($theme_views, $theme_js, $theme_css);
$this->template->content->data = $code;
$this->template->content->filename = $filename;
}
示例5: index
/**
* 物流对应的地区列表
*/
function index($id)
{
if (!$id) {
remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error');
}
$deliverycn_service = DeliverycnService::get_instance();
$deliverycn_region_service = Deliverycn_regionService::get_instance();
//验证此条物流
$data = $deliverycn_service->get($id);
if (!$data['id']) {
remind::set(Kohana::lang('o_global.access_denied'), request::referrer(), 'error');
}
//初始化请求结构体
$query_struct = array('where' => array('deliverycn_id' => $id), 'like' => array(), 'orderby' => array('position' => 'ASC', 'id' => 'ASC'), 'limit' => array('per_page' => 2000, 'offset' => 0));
// 每页条目数
controller_tool::request_per_page($query_struct, $request_data);
$count = $deliverycn_region_service->query_count($query_struct);
// 模板输出 分页
$this->pagination = new Pagination(array('total_items' => $count, 'items_per_page' => $query_struct['limit']['per_page']));
$query_struct['limit']['offset'] = $this->pagination->sql_offset;
$query_struct['limit']['page'] = $this->pagination->current_page;
//调用列表
$deliverycn_regions = $deliverycn_region_service->get_delivery_regions_by_position($query_struct);
$this->template->content = new View("site/deliverycn/region");
$this->template->content->deliverycn_regions = $deliverycn_regions;
$this->template->content->data = $data;
$this->template->content->regions = $deliverycn_region_service->get_regions();
}
示例6: do_active
/**
* 改变状态
*/
function do_active($id)
{
//权限验证
role::check('user_charge');
if (!$id) {
remind::set(Kohana::lang('o_global.bad_request'), 'user/user_charge');
}
$db = Database::instance();
$data = array_shift($db->query('SELECT * FROM user_charge_order WHERE id=' . $id)->result_array(false));
if ($data['id'] <= 0 || $data['status'] > 0) {
remind::set(Kohana::lang('o_global.bad_request'), 'user/user_charge');
}
$logodata = array();
$logodata['manager_id'] = $this->manager_id;
$logodata['ip'] = tool::get_str_ip();
$logodata['user_log_type'] = 27;
$logodata['method'] = __CLASS__ . '::' . __METHOD__ . '()';
$logodata['memo'] = "充值订单号:" . $data['order_num'] . ", 购买拍点数:" . $data['price'] . ", 充值金额:" . $data['money'];
$sql = "UPDATE user_charge_order SET status=1 WHERE id='" . $id . "' ";
if ($db->query($sql)) {
//充值用户Money
$sql_reward = "UPDATE users \r\n SET user_money = user_money+" . $data['price'] . "\r\n WHERE id='" . $data['user_id'] . "'\r\n ";
$db->query($sql_reward);
//操作log
ulog::add($logodata);
remind::set(Kohana::lang('o_global.update_success'), 'user/user_charge', 'success');
} else {
//操作log
ulog::add($logodata, 1);
remind::set(Kohana::lang('o_global.update_error'), 'user/user_charge', 'error');
}
}
示例7: add
public function add()
{
if ($_POST) {
//标签过滤
tool::filter_strip_tags($_POST, array('content'));
$site_next_flow = site::site_next_flow($this->current_flow);
$submit_target = intval($this->input->post('submit_target'));
$faq = Myfaq::instance();
if ($faq->add($_POST)) {
//判断添加成功去向
switch ($submit_target) {
case 1:
remind::set(Kohana::lang('o_global.add_success'), 'site/faq/add', 'success');
case 2:
remind::set(Kohana::lang('o_global.add_success'), $site_next_flow['url'], 'success');
default:
remind::set(Kohana::lang('o_global.add_success'), 'site/faq', 'success');
}
} else {
remind::set(Kohana::lang('o_global.add_error'), 'site/faq/add');
}
}
$this->template->content = new View("site/faq_add");
$this->template->content->title = "site faq add";
}
示例8: delete
/**
* delete mail_category
*/
public function delete($id)
{
if (Mymail_category::instance($id)->delete()) {
remind::set(Kohana::lang('o_global.delete_success'), 'manage/mail_category', 'success');
} else {
$error = Mymail_category::instance($id)->error();
remind::set(Kohana::lang('o_global.delete_error') . $error, 'manage/mail_category');
}
}
示例9: __construct
/**
* Template loading and setup routine.
*/
public function __construct()
{
parent::__construct();
// checke request is ajax
$this->ajax_request = request::is_ajax();
// Load the template
$this->template = new View($this->template);
if ($this->auto_render == TRUE) {
Event::add('system.post_controller', array($this, '_render'));
}
/**
* 判断用户登录情况
*/
if (isset($_REQUEST['session_id'])) {
$session = Session::instance($_REQUEST['session_id']);
$manager = role::get_manager($_REQUEST['session_id']);
} else {
$session = Session::instance();
$manager = role::get_manager();
}
/* 当前请求的URL */
$current_url = urlencode(url::current(TRUE));
//zhu
if (isset($manager['id'])) {
$active_time = $session->get('Opococ_manager_active_time');
//用户最后操作时间
$session->set('Opococ_manager_active_time', time());
//用户最后操作时间
$login_ip = $session->get('Opococ_manager_login_ip');
//用户登录的IP
//操作超时
if (time() - $active_time > Kohana::config('login.time_out')) {
$session->delete('Opococ_manager');
$session->delete('Opococ_manager_active_time');
$session->delete('Opococ_manager_login_ip');
remind::set(Kohana::lang('o_global.first_login'), 'login?request_url=' . $current_url);
}
//用户IP(登录状态更换IP需要重新登录)
$ip = tool::get_long_ip();
if ($ip != $login_ip) {
remind::set(Kohana::lang('o_global.login_again'), 'login?request_url=' . $current_url);
}
$this->manager = $manager;
$this->manager_id = $manager['id'];
$this->manager_name = $manager['name'];
$this->manager_is_admin = role::is_root($manager['name']) ? 1 : $manager['is_admin'];
$this->template->manager_data = $manager;
} else {
remind::set(Kohana::lang('o_global.first_login'), 'login?request_url=' . $current_url);
}
}
示例10: delete
/**
* author zhubin
* 删除用户地址
* @param int
*/
public function delete()
{
//权限验证
role::check('user_edit');
$address_info = $this->input->get();
if (empty($address_info) || !isset($address_info['address_id']) || !isset($address_info['user_id'])) {
remind::set(Kohana::lang('o_global.bad_request'), 'user/address');
}
if (Myaddress::instance()->delete($address_info['address_id'])) {
remind::set(Kohana::lang('o_user.delete_user_address_success'), 'user/user/edit/' . $address_info['user_id'], 'success');
} else {
remind::set(Kohana::lang('o_user.delete_user_address_failed'), 'user/user/edit/' . $address_info['user_id'], 'error');
}
}
示例11: delete
public function delete($templateId)
{
//权限检查 得到所有可管理站点ID列表
role::check('distribution_system_manage');
$templateDao = Superplaner_Realtime_contract_template::instance();
$template = $templateDao->get_by_id($templateId);
if ($template == null) {
remind::set(Kohana::lang('o_contract.contract_not_exists'), request::referrer(), 'error');
}
if (Superplaner_Realtime_contract_template::instance($templateId)->delete()) {
remind::set(Kohana::lang('o_global.delete_success'), request::referrer(), 'success');
} else {
remind::set(Kohana::lang('o_global.delete_error'), request::referrer(), 'error');
}
}
示例12: delete
public function delete($cardTypeId)
{
//权限检查 得到所有可管理站点ID列表
role::check('card_system_manage');
$cardType = $this->cardTypeDao->get_by_id($cardTypeId);
if ($cardType == null) {
remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error');
return;
}
if ($this->cardTypeDao->delete($cardTypeId)) {
remind::set(Kohana::lang('o_global.delete_success'), 'card/card_type', 'success');
return;
} else {
remind::set(Kohana::lang('o_global.delete_error'), request::referrer(), 'error');
return;
}
}
示例13: add
/**
* 添加新支付类型
*/
function add()
{
//权限验证
role::check('manage_payment_type');
if ($_POST) {
//标签过滤
tool::filter_strip_tags($_POST);
$payment_type = Mypayment_type::instance();
if ($payment_type->add($_POST)) {
remind::set(Kohana::lang('o_global.add_success'), 'manage/payment_type', 'success');
} else {
$errors = $payment_type->errors();
remind::set(Kohana::lang('o_global.add_error'), 'manage/payment_type/add', 'error');
}
}
$this->template->content = new View("manage/payment_type_add");
}
示例14: check
/**
* 判断用户的操作权限
*
* @param <String> $model_flag
* @return <type>
*/
public static function check($model_flag = 'default')
{
//zhu modify
$verify = self::verify($model_flag);
//验证操作
if ($verify) {
return $verify;
} else {
if (request::is_ajax()) {
$return_struct = array('status' => 0, 'code' => 501, 'msg' => Kohana::lang('o_global.access_denied'), 'content' => array());
die(json_encode($return_struct));
} else {
$referrer = tool::referrer_url();
remind::set('权限不足', $referrer, 'error');
}
}
}
示例15: queue_add
public function queue_add($site)
{
if (empty($site)) {
remind::set('域名或者IP出错,请检查下您的输入!', 'site/scan/add');
} else {
if (filter_var($site, FILTER_VALIDATE_IP)) {
$ip = $site;
} else {
if (filter_var(gethostbyname($site), FILTER_VALIDATE_IP)) {
$ip = gethostbyname($site);
} else {
remind::set('域名或者IP出错,请检查下您的输入!', 'site/scan/add');
}
}
}
$sign = $this->generate_code('queue', $ip);
return $this->client->queue_add($ip, $sign, $this->ip);
}