本文整理汇总了PHP中site::id方法的典型用法代码示例。如果您正苦于以下问题:PHP site::id方法的具体用法?PHP site::id怎么用?PHP site::id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类site
的用法示例。
在下文中一共展示了site::id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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));
//当前用户管理的站点的ID
$this->site_id = site::id();
}
示例2: __construct
/**
* 构造方法
*/
public function __construct()
{
parent::__construct();
if ($this->is_ajax_request()) {
$this->template = new View('layout/default_json');
}
$this->site_id = site::id();
}
示例3: __construct
public function __construct()
{
parent::__construct();
$this->site_id = site::id();
if ($this->site_id <= 0) {
die(Kohana::lang('o_global.access_denied'));
}
}
示例4: __construct
/**
* 构造方法
*/
public function __construct()
{
$package_name = substr(dirname(__FILE__), strlen(APPPATH . 'controllers/'));
empty($package_name) && ($package_name = 'default');
$this->package_name = $package_name;
$this->class_name = strtolower(substr(__CLASS__, 0, strpos(__CLASS__, '_')));
$this->phprpc_server = Kohana::config('phprpc.remote.statking.host');
$this->site_ids = role::get_site_ids();
$this->site_id = site::id();
parent::__construct();
if ($this->is_ajax_request() == TRUE) {
$this->template = new View('layout/default_json');
}
}
示例5:
?>
js/jquery.validate.js"></script>
<script type="text/javascript" src="<?php
echo url::base();
?>
js/jq/plugins/tinymce/tiny_mce.js"></script>
<script type="text/javascript" src="<?php
echo url::base();
?>
js/init_tiny_mce.js"></script>
<script type="text/javascript">
var global_site_id = <?php
if (isset($messages['site_id'])) {
echo $messages['site_id'];
} else {
echo site::id();
}
?>
;
$(document).ready(function(){
$("#edit_form").validate({
errorPlacement:function(error, element){
if(element.attr("name") == "content"){
//alert(error);
error.appendTo( element.parent());
}else{
error.insertAfter(element)
}
}
});
tinyMCE.execCommand('mceAddControl', true, 'content');
示例6: set_order
/**
* 设定菜单的排序
*/
public function set_order()
{
//初始化返回数组
$return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
$request_data = $this->input->get();
$id = isset($request_data['id']) ? $request_data['id'] : '';
$order = isset($request_data['order']) ? $request_data['order'] : '';
/* 验证是否可以操作 */
if (!role::verify('product_filter', site::id(), 0)) {
$return_struct['msg'] = Kohana::lang('o_global.permission_enough');
exit(json_encode($return_struct));
}
if (empty($id) || empty($order) && $order != 0) {
$return_struct['msg'] = Kohana::lang('o_global.bad_request');
exit(json_encode($return_struct));
}
if (!is_numeric($order) || $order < 0) {
$return_struct['msg'] = Kohana::lang('o_global.position_rule');
exit(json_encode($return_struct));
}
$aliasfilter_service = Alias_filterService::get_instance();
$aliasfilter_service->set($id, array('order' => $order));
$return_struct = array('status' => 1, 'code' => 200, 'msg' => Kohana::lang('o_global.position_success'), 'content' => array('order' => $order));
exit(json_encode($return_struct));
}
示例7: set_order
/**
* 设定菜单的排序
*/
public function set_order()
{
//初始化返回数组
$return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
$request_data = $this->input->get();
$id = isset($request_data['id']) ? $request_data['id'] : '';
$order = isset($request_data['order']) ? $request_data['order'] : '';
/* 验证是否可以操作 */
if (!role::verify('inquiry_subject', site::id(), 0)) {
$return_struct['msg'] = Kohana::lang('o_global.permission_enough');
exit(json_encode($return_struct));
}
$validation = Validation::factory($request_data)->pre_filter('trim')->add_rules('id', 'required', 'digit')->add_rules('order', 'required', 'digit');
if (!$validation->validate()) {
$return_struct['msg'] = Kohana::lang('o_global.position_rule');
exit(json_encode($return_struct));
}
if (empty($id) || empty($order) && $order != 0) {
$return_struct['msg'] = Kohana::lang('o_global.bad_request');
exit(json_encode($return_struct));
}
if (!is_numeric($order) || $order < 0) {
$return_struct['msg'] = Kohana::lang('o_global.position_rule');
exit(json_encode($return_struct));
}
$inquieysubject_service = InquirysubjectService::get_instance();
$inquieysubject_service->set($id, array('position' => $order));
$return_struct = array('status' => 1, 'code' => 200, 'msg' => Kohana::lang('o_global.position_success'), 'content' => array('order' => $order));
exit(json_encode($return_struct));
}
示例8: __construct
public function __construct()
{
parent::__construct();
$this->site_id = site::id();
}
示例9: delete
public function delete()
{
$return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
try {
//* 初始化返回数据 */
$return_data = array('assoc' => NULL, 'count' => 0);
//* 收集请求数据 ==根据业务逻辑定制== */
$request_data = $this->input->get();
$site_ids = role::get_site_ids();
if (empty($site_ids)) {
throw new MyRuntimeException(Kohana::lang('o_global.access_denied'), 403);
}
$in_site_id = site::id();
if (isset($request_data['site_id']) and $request_data['site_id'] === '0') {
unset($request_data['site_id']);
}
if (isset($request_data['site_id']) and !in_array($request_data['site_id'], $site_ids)) {
throw new MyRuntimeException(Kohana::lang('o_global.access_denied'), 403);
}
if ($in_site_id > 0) {
$query_site_id = $in_site_id;
} else {
throw new MyRuntimeException(Kohana::lang('o_global.select_site'), 400);
}
$template_id = intval($request_data['template_id']);
$template = Product_templateService::get_instance()->index(array('where' => array('id' => $template_id)));
if (!empty($template)) {
if ($template[0]['site_id'] == $query_site_id) {
ORM::factory('product_template')->where('id', $template_id)->delete_all();
} else {
throw new MyRuntimeException('没有权限删除该商品模板!', 403);
}
} else {
throw new MyRuntimeException('该模板不存在,或者已被删除!', 403);
}
//* 补充&修改返回结构体 */
//* 补充&修改返回结构体 ==根据业务逻辑定制== */
$return_struct['status'] = 1;
$return_struct['code'] = 200;
$return_struct['msg'] = '商品模板已经成功删除!';
$return_struct['content'] = $return_data;
$return_struct['action'] = array('type' => 'location', 'url' => !empty($request_data['listurl']) ? url::base() . $request_data['listurl'] : url::base() . $this->package_name . '/' . $this->class_name . '/' . 'index');
//* 请求类型 */
if ($this->is_ajax_request()) {
// ajax 请求
// json 输出
$this->template->content = $return_struct;
} else {
// html 输出
//* 模板输出 */
$this->template->return_struct = $return_struct;
$content = new View('info');
//* 变量绑定 */
$this->template->title = Kohana::config('site.name');
$this->template->content = $content;
//* 请求结构数据绑定 */
$this->template->content->request_data = $request_data;
//* 返回结构体绑定 */
$this->template->content->return_struct = $return_struct;
//:: 当前应用专用数据
$this->template->content->title = Kohana::config('site.name');
}
// end of request type determine
} catch (MyRuntimeException $ex) {
$return_struct['status'] = 0;
$return_struct['code'] = $ex->getCode();
$return_struct['msg'] = $ex->getMessage();
//TODO 异常处理
//throw $ex;
if ($this->is_ajax_request()) {
$this->template->content = $return_struct;
} else {
$this->template->return_struct = $return_struct;
$content = new View('info');
$this->template->content = $content;
//* 请求结构数据绑定 */
$this->template->content->request_data = $request_data;
//* 返回结构体绑定 */
$this->template->content->return_struct = $return_struct;
}
}
}
示例10: select
/**
* 对网站联盟订单的查询处理
*
*/
public function select()
{
$site_id_list = role::check('affiliate');
$return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
try {
//* 初始化返回数据 */
$return_data = array('assoc' => NULL, 'count' => 0);
//* 收集请求数据 ==根据业务逻辑定制== */
$request_data = $this->input->get();
$site_ids = role::get_site_ids();
if (empty($site_ids)) {
throw new MyRuntimeException(Kohana::lang('o_global.access_denied'), 403);
}
$in_site_id = site::id();
if (isset($request_data['site_id']) and $request_data['site_id'] === '0') {
unset($request_data['site_id']);
}
if (isset($request_data['site_id']) and !in_array($request_data['site_id'], $site_ids)) {
throw new MyRuntimeException(Kohana::lang('o_global.access_denied'), 403);
}
if ($in_site_id > 0) {
$query_site_id = $in_site_id;
} else {
$query_site_id = $site_ids;
//throw new MyRuntimeException(Kohana::lang('o_global.select_site'), 400);
}
$site_name = Mysite::instance($this->site_id)->get('domain');
//页数
$page = isset($request_data['page']) && intval($request_data['page']) >= 1 ? intval($request_data['page']) : 1;
//联盟id
$affiliate_id = isset($request_data['affiliate_id']) && intval($request_data['affiliate_id']) >= 1 ? intval($request_data['affiliate_id']) : 0;
//起始时间
$time_f = isset($request_data['time_f']) ? $request_data['time_f'] : date('Y-m-d', time() - 86400 * 365 * 5);
$time_f = $time_f == '' ? date('Y-m-d', time() - 86400 * 365 * 5) : $time_f;
//结束时间
$time_t = isset($request_data['time_t']) ? $request_data['time_t'] : date('Y-m-d');
$time_t = $time_t == '' ? date('Y-m-d') : $time_t;
//获取联盟的订单
$where = array('site_id' => $query_site_id, 'order_time >' => date('Y-m-d H:i:s', strtotime($time_f . ' 00:00:00')), 'order_time <' => date('Y-m-d H:i:s', strtotime($time_t . ' 23:59:59')));
if ($affiliate_id > 0) {
$where['affiliate_id'] = $affiliate_id;
}
$query_struct = array('where' => $where, 'limit' => array('page' => $page, 'per_page' => 20));
$orders = Affiliate_orderService::get_instance()->index($query_struct);
$orders_count = Affiliate_orderService::get_instance()->count($query_struct);
$this->pagination = new Pagination(array('total_items' => $orders_count, 'items_per_page' => 20));
$affiliates = AffiliateService::get_instance()->index(array('where' => array('mark' => 1)));
for ($i = 0; $i < count($affiliates); $i++) {
if ($affiliates[$i]['id'] == $affiliate_id) {
$affiliates[$i]['selected'] = 1;
} else {
$affiliates[$i]['selected'] = 0;
}
}
$content = new View($this->package_name . '/' . $this->class_name . '/' . __FUNCTION__);
$this->template->content = $content;
$this->template->content->site_name = $site_name;
$this->template->content->orders = $orders;
$this->template->content->pagination = $this->pagination;
$this->template->content->time_f = $time_f;
$this->template->content->time_t = $time_t;
$this->template->content->affiliates = $affiliates;
} catch (MyRuntimeException $ex) {
$return_struct['status'] = 0;
$return_struct['code'] = $ex->getCode();
$return_struct['msg'] = $ex->getMessage();
//TODO 异常处理
//throw $ex;
if ($this->is_ajax_request()) {
$this->template->content = $return_struct;
} else {
$this->template->return_struct = $return_struct;
$content = new View('info');
$this->template->content = $content;
//* 请求结构数据绑定 */
$this->template->content->request_data = $request_data;
//* 返回结构体绑定 */
$this->template->content->return_struct = $return_struct;
}
}
}
示例11: __construct
public function __construct()
{
parent::__construct();
$this->site_id = site::id();
role::check('site_scan', $this->site_id);
}
示例12: check_exist_uri_name
public function check_exist_uri_name()
{
$return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
try {
//$profiler = new Profiler;
//* 初始化返回数据 */
$return_data = array();
//* 收集请求数据 ==根据业务逻辑定制== */
$request_data = $this->input->get();
//* 实现功能后屏蔽此异常抛出 */
//throw new MyRuntimeException('Not Implemented',501);
//必须为ajax请求
if (!$this->is_ajax_request()) {
throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 404);
}
//* 权限验证 */
$site_id = site::id();
if ($site_id == 0) {
throw new MyRuntimeException(Kohana::lang('o_global.select_site'), 400);
}
if (!isset($request_data['uri_name']) || empty($request_data['uri_name'])) {
throw new MyRuntimeException(Kohana::lang('o_global.input_error'), 404);
}
$category_service = CategoryService::get_instance();
if (isset($request_data['category_id']) && is_numeric($request_data['category_id'])) {
$category = $category_service->get($request_data['category_id']);
//判断站点
if ($site_id != $category['site_id']) {
throw new MyRuntimeException(Kohana::lang('o_global.access_denied'), 404);
}
if (strtolower($category['uri_name']) == strtolower($request_data['uri_name'])) {
exit(Kohana::lang('o_global.true'));
}
}
// 调用底层服务
if ($category_service->check_exist_uri_name($site_id, $request_data['uri_name'])) {
exit(Kohana::lang('o_global.false'));
} else {
exit(Kohana::lang('o_global.true'));
}
} catch (MyRuntimeException $ex) {
$this->_ex($ex, $return_struct, $request_data);
}
}
示例13: delete
/**
* SEO信息删除
*/
public function delete($id)
{
//收集请求
$seo_manages = Myseo_manage::instance($id)->get();
$site_id = site::id();
if ($site_id == 0) {
remind::set('请首先进入所要操作的站点', request::referrer(), 'error');
}
if (!$seo_manages['id']) {
remind::set('无效SEO信息,请重试', request::referrer(), 'error');
}
$site_id_list = role::check('seo_manage', 0, 0);
// 权限验证
if (!in_array($seo_manages['site_id'], $site_id_list)) {
remind::set('access denied', request::referrer(), 'error');
}
if (Myseo_manage::instance()->delete($id)) {
Myseo_manage::instance()->update_seo_manage_by_site_id($site_id);
remind::set('删除 信息成功', request::referrer(), 'success');
} else {
remind::set('删除 信息失败', request::referrer(), 'error');
}
}
示例14: request_site
/**
* 请求站点处理
*
* 2010-04-21
*/
public static function request_site(&$request_struct_current, &$request_data, $site_id_list)
{
if (isset($request_data['site_id']) && intval($request_data['site_id']) > 0) {
$request_struct_current['where']['site_id'] = intval($request_data['site_id']);
$request_data['site_id'] = $request_struct_current['where']['site_id'];
} else {
$site_id = site::id();
if ($site_id > 0) {
$request_struct_current['where']['site_id'] = $site_id;
$request_data['site_id'] = $site_id;
} else {
$request_struct_current['where']['site_id'] = $site_id_list;
$request_data['site_id'] = -1;
}
}
}
示例15: __construct
public function __construct()
{
parent::__construct();
// DISABLE MAGIC QUOTES
if (function_exists('set_magic_quotes_runtime')) {
@set_magic_quotes_runtime(false);
}
// Charset
$this->charset = Kohana::config('kc.charset');
// INPUT INIT
$this->get = $this->input->get();
$this->post = $this->input->post();
$this->cookie = $this->input->cookie();
// LINKING UPLOADED FILE
if (count($_FILES)) {
$this->file =& $_FILES[key($_FILES)];
}
// SETTING UP SESSION
$session_life_time = Kohana::config('kc._sessionLifetime');
$session_dir = Kohana::config('kc._sessionDir');
$session_domain = Kohana::config('kc._sessionDomain');
if ($session_life_time) {
ini_set('session.gc_maxlifetime', $session_life_time * 60);
}
if ($session_dir) {
ini_set('session.save_path', $session_dir);
}
if ($session_domain) {
ini_set('session.cookie_domain', $session_domain);
}
// RELOAD DEFAULT CONFIGURATION
$this->config = Kohana::config('kc');
// LOAD SESSION CONFIGURATION IF EXISTS
if (isset($this->config['_sessionVar']) && is_array($this->config['_sessionVar'])) {
foreach ($this->config['_sessionVar'] as $key => $val) {
if (substr($key, 0, 1) != "_" && isset($this->config[$key])) {
$this->config[$key] = $val;
}
}
if (!isset($this->config['_sessionVar']['self'])) {
$this->config['_sessionVar']['self'] = array();
}
$this->session =& $this->config['_sessionVar']['self'];
} else {
$this->session =& $_SESSION;
}
// GET TYPE DIRECTORY
$this->types =& $this->config['types'];
$firstType = array_keys($this->types);
$firstType = $firstType[0];
$this->type = isset($this->get['type']) && isset($this->types[$this->get['type']]) ? $this->get['type'] : $firstType;
// LOAD DIRECTORY TYPE SPECIFIC CONFIGURATION IF EXISTS
if (is_array($this->types[$this->type])) {
foreach ($this->types[$this->type] as $key => $val) {
if (in_array($key, $this->typeSettings)) {
$this->config[$key] = $val;
}
}
$this->types[$this->type] = isset($this->types[$this->type]['type']) ? $this->types[$this->type]['type'] : "";
}
// COOKIES INIT
if (isset($this->config['cookieDomain']) and !strlen($this->config['cookieDomain'])) {
$this->config['cookieDomain'] = $_SERVER['HTTP_HOST'];
}
if (isset($this->config['cookiePath']) and !strlen($this->config['cookiePath'])) {
$this->config['cookiePath'] = "/";
}
// HOST APPLICATIONS INIT
if (isset($this->get['CKEditorFuncNum'])) {
$this->opener['CKEditor']['funcNum'] = $this->get['CKEditorFuncNum'];
}
if (isset($this->get['opener']) && strtolower($this->get['opener']) == "tinymce" && isset($this->config['_tinyMCEPath']) && strlen($this->config['_tinyMCEPath'])) {
$this->opener['TinyMCE'] = true;
}
// 通过参数传递过来的site_id 优先级高
$site_id = isset($this->get['site_id']) ? $this->get['site_id'] : 0;
// 通过全局方法获得的site_id
$site_id2 = site::id();
$this->site_id = $site_id > 0 ? $site_id : $site_id2;
if ($this->site_id == 0) {
$this->back_msg(Kohana::lang('o_global.select_site'));
}
}