本文整理汇总了PHP中template::register_permissions方法的典型用法代码示例。如果您正苦于以下问题:PHP template::register_permissions方法的具体用法?PHP template::register_permissions怎么用?PHP template::register_permissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类template
的用法示例。
在下文中一共展示了template::register_permissions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
function show($view, $loc = null, $title = '')
{
$template = new template('searchmodule', $view, $loc);
$template->assign('loc', $loc);
$template->register_permissions(array('administrate', 'configure'), $loc);
$template->output();
}
示例2: show
function show($view, $loc = null, $title = '')
{
if (exponent_permissions_check('administrate', $loc) || exponent_permissions_check('create', $loc) || exponent_permissions_check('edit', $loc) || exponent_permissions_check('delete', $loc)) {
$template = new template('HTMLTemplateModule', $view, $loc);
$template->assign('noupload', 0);
$template->assign('uploadError', '');
if (!defined('SYS_FILES')) {
include_once BASE . 'subsystems/files.php';
}
$directory = 'files/HTMLTemplateModule/' . $loc->src;
if (!file_exists(BASE . $directory)) {
$err = exponent_files_makeDirectory($directory);
if ($err != SYS_FILES_SUCCESS) {
$template->assign('noupload', 1);
$template->assign('uploadError', $err);
}
}
global $db;
$templates = $db->selectObjects('htmltemplate');
for ($i = 0; $i < count($templates); $i++) {
$assocs = $db->selectObjects('htmltemplateassociation', 'template_id=' . $templates[$i]->id);
if (count($assocs) == 1 && $assocs[0]->global == 1) {
$templates[$i]->global_assoc = 1;
} else {
$templates[$i]->global_assoc = 0;
$templates[$i]->associations = $assocs;
}
}
$template->assign('moduletitle', $title);
$template->assign('templates', $templates);
$template->register_permissions(array('administrate', 'create', 'edit', 'delete'), exponent_core_makeLocation('HTMLTemplateModule'));
$template->output();
}
}
示例3: show
function show($view, $loc = null, $title = '')
{
global $db;
$contacts = $db->selectObjects('contact_contact', "location_data='" . serialize($loc) . "'");
$t = new template('ContactModule', '_standard', $loc);
$t->register_permissions(array('administrate', 'configure'), $loc);
$t->output();
$template = new template('ContactModule', $view, $loc);
$template->assign('contacts', $contacts);
$template->assign('loc', $loc);
$template->assign('numContacts', count($contacts));
$template->assign('moduletitle', $title);
$template->register_permissions(array('administrate', 'configure'), $loc);
$template->output();
}
示例4: show
function show($view, $loc, $title)
{
global $db, $user;
if ($user) {
$template = new template('InboxModule', $view, $loc);
$read = $db->countObjects('privatemessage', 'recipient=' . $user->id . ' AND unread=0');
$unread = $db->countObjects('privatemessage', 'recipient=' . $user->id . ' AND unread=1');
$template->assign('readMessages', $read);
$template->assign('unreadMessages', $unread);
$template->assign('totalMessages', $unread + $read);
$template->assign('user', $user);
$template->assign('moduletitle', $title);
$template->register_permissions('administrate', $loc);
$template->output();
}
}
示例5: show
function show($view, $loc = null, $title = '')
{
global $db;
$question = $db->selectObject('poll_question', "is_active = 1 AND location_data='" . serialize($loc) . "'");
$answers = array();
if ($question) {
$answers = $db->selectObjects('poll_answer', 'question_id=' . $question->id);
}
$answers = expSorter::sort(array('array' => $answers, 'sortby' => 'rank', 'order' => 'ASC'));
$template = new template('simplepollmodule', $view, $loc);
$template->assign('moduletitle', $title);
$template->assign('question', $question);
$template->assign('answers', $answers);
$template->assign('have_answers', count($answers));
$template->register_permissions(array('administrate', 'configure', 'manage_question', 'manage_answer'), $loc);
$template->output();
}
示例6: show
function show($view, $loc = null, $title = '')
{
$template = new template('SharedCoreModule', $view);
global $db;
$cores = array();
foreach ($db->selectObjects('sharedcore_core') as $c) {
if (file_exists($c->path . 'exponent_version.php')) {
$c->version = (include $c->path . 'exponent_version.php');
$c->linked = $db->selectObjects('sharedcore_site', 'core_id=' . $c->id);
$cores[] = $c;
}
}
$template->assign('cores', $cores);
$template->assign('moduletitle', $title);
$template->register_permissions(array('administrate', 'manage'), $loc);
$template->output();
}
示例7: show
function show($view, $loc = null, $title = "")
{
global $db;
$milestones = $db->selectObjects("codemap_milestone", "location_data='" . serialize($loc) . "'");
if (!defined("SYS_SORTING")) {
require_once BASE . "subsystems/sorting.php";
}
uasort($milestones, "pathos_sorting_byRankAscending");
$stepstones = array();
foreach ($milestones as $m) {
$tmp = $db->selectObjects("codemap_stepstone", "milestone_id=" . $m->id . " AND location_data='" . serialize($loc) . "'");
usort($tmp, "pathos_sorting_byNameAscending");
$stepstones = array_merge($stepstones, $tmp);
}
#$stepstones = $db->selectObjects("codemap_stepstone","location_data='".serialize($loc)."'");
$template = new template("codemapmodule", $view, $loc);
$template->assign("milestones", $milestones);
$template->assign("stepstones", $stepstones);
$template->assign("moduletitle", $title);
$template->register_permissions(array("administrate", "manage_steps", "manage_miles"), $loc);
$template->output();
}
示例8: show
function show($view, $loc, $title = '')
{
if (!defined('SYS_FILES')) {
require_once BASE . 'subsystems/files.php';
}
$template = new template('ResourceModule', $view, $loc);
$directory = 'files/ResourceModule/' . $loc->src;
if (!file_exists(BASE . $directory)) {
$err = exponent_files_makeDirectory($directory);
if ($err != SYS_FILES_SUCCESS) {
$template->assign('noupload', 1);
$template->assign('uploadError', $err);
}
}
global $db;
$location = serialize($loc);
if (!isset($_SESSION['resource_cache'][$location])) {
$resources = $db->selectObjects('resourceitem', "location_data='" . serialize($loc) . "'");
$_SESSION['resource_cache'][$location] = $resources;
} else {
$resources = $_SESSION['resource_cache'][$location];
}
$iloc = exponent_core_makeLocation($loc->mod, $loc->src);
for ($i = 0; $i < count($resources); $i++) {
$iloc->int = $resources[$i]->id;
$resources[$i]->permissions = array('administrate' => exponent_permissions_check('administrate', $iloc), 'edit' => exponent_permissions_check('edit', $iloc), 'delete' => exponent_permissions_check('delete', $iloc));
}
if (!defined('SYS_SORTING')) {
require_once BASE . 'subsystems/sorting.php';
}
usort($resources, 'exponent_sorting_byRankAscending');
$rfiles = array();
foreach ($db->selectObjects('file', "directory='{$directory}'") as $file) {
$file->mimetype = $db->selectObject('mimetype', "mimetype='" . $file->mimetype . "'");
$rfiles[$file->id] = $file;
}
$template->assign('moduletitle', $title);
$template->assign('resources', $resources);
$template->assign('files', $rfiles);
$template->register_permissions(array('administrate', 'configure', 'post', 'edit', 'delete'), $loc);
$template->output($view);
}
示例9: serialize
if ($config == null) {
$config->allow_comments = 1;
$config->items_per_page = 10;
}
if (isset($_GET['single'])) {
$config->items_per_page = 1;
}
$where = "location_data='" . serialize($loc) . "' AND (is_draft = 0 OR poster = " . ($user ? $user->id : -1) . ")";
if (!exponent_permissions_check('view_private', $loc)) {
$where .= ' AND is_private = 0';
}
$total = $db->countObjects('weblog_post', $where);
$posts = $db->selectObjects('weblog_post', $where . ' ORDER BY posted DESC ' . $db->limit($config->items_per_page, $_GET['page'] * $config->items_per_page));
if (!defined('SYS_SORTING')) {
require_once BASE . 'subsystems/sorting.php';
}
for ($i = 0; $i < count($posts); $i++) {
$ploc = exponent_core_makeLocation($loc->mod, $loc->src, $posts[$i]->id);
$posts[$i]->permissions = array('administrate' => exponent_permissions_check('administrate', $ploc), 'edit' => exponent_permissions_check('edit', $ploc), 'delete' => exponent_permissions_check('delete', $ploc), 'comment' => exponent_permissions_check('comment', $ploc), 'edit_comments' => exponent_permissions_check('edit_comments', $ploc), 'delete_comments' => exponent_permissions_check('delete_comments', $ploc), 'view_private' => exponent_permissions_check('view_private', $ploc));
$comments = $db->selectObjects('weblog_comment', 'parent_id=' . $posts[$i]->id);
usort($comments, 'exponent_sorting_byPostedDescending');
$posts[$i]->comments = $comments;
}
usort($posts, 'exponent_sorting_byPostedDescending');
$template->assign('posts', $posts);
$template->assign('total_posts', $total);
$template->assign('shownext', ($_GET['page'] + 1) * $config->items_per_page < $total);
$template->assign('page', $_GET['page']);
$template->register_permissions(array('administrate', 'configure', 'post', 'edit', 'delete', 'comment', 'edit_comments', 'delete_comments', 'view_private'), $loc);
$template->assign('config', $config);
$template->output();
示例10: exit
# for more details.
#
# You should have received a copy of the GNU
# General Public License along with Exponent; if
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
#
# $Id: view.php,v 1.4 2005/02/19 00:32:32 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
exit("");
}
// PERM CHECK
$t = null;
if (isset($_GET['id'])) {
$t = $db->selectObject("htmltemplate", "id=" . $_GET['id']);
}
if ($t) {
pathos_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);
$template = new template("htmltemplatemodule", "_view", $loc);
$template->assign("template", $t);
$template->register_permissions(array("administrate", "edit", "delete"), $loc);
$template->output();
} else {
echo SITE_404_HTML;
}
// END PERM CHECK
示例11: show
function show($view, $loc = null, $title = '')
{
$template = new template('WeblogModule', $view, $loc);
global $db;
global $user;
$user_id = $user ? $user->id : -1;
$config = $db->selectObject('WeblogModule_config', "location_data='" . serialize($loc) . "'");
if ($config == null) {
$config->allow_comments = 1;
$config->items_per_page = 10;
}
$viewconfig = array('type' => 'default');
if (is_readable($template->viewdir . "/{$view}.config")) {
$viewconfig = (include $template->viewdir . "/{$view}.config");
}
$where = '(is_draft = 0 OR poster = ' . $user_id . ") AND location_data='" . serialize($loc) . "'";
if (!exponent_permissions_check('view_private', $loc)) {
$where .= ' AND is_private = 0';
}
if ($viewconfig['type'] == 'monthlist') {
$months = array();
$min_date = $db->min('weblog_post', 'posted', 'location_data', $where);
$max_date = $db->max('weblog_post', 'posted', 'location_data', $where);
$months = array();
if (!defined('SYS_DATETIME')) {
require_once BASE . 'subsystems/datetime.php';
}
$start_month = exponent_datetime_startOfMonthTimestamp($min_date);
$end_month = exponent_datetime_endOfMonthTimestamp($min_date) + 86399;
do {
$count = $db->countObjects('weblog_post', $where . ' AND posted >= ' . $start_month . ' AND posted <= ' . $end_month);
if ($count) {
$months[$start_month] = $count;
}
$start_month = $end_month + 1;
$end_month = exponent_datetime_endOfMonthTimestamp($start_month) + 86399;
} while ($start_month < $max_date);
$template->assign('months', array_reverse($months, true));
} else {
if ($viewconfig['type'] == 'calendar') {
if (!defined('SYS_DATETIME')) {
require_once BASE . 'subsystems/datetime.php';
}
$month_days = exponent_datetime_monthlyDaysTimestamp(time());
for ($i = 0; $i < count($month_days); $i++) {
foreach ($month_days[$i] as $mday => $timestamp) {
if ($mday > 0) {
// Got a valid one. Go with it.
$month_days[$i][$mday] = array('number' => $db->countObjects('weblog_post', $where . ' AND posted >= ' . $timestamp . ' AND posted < ' . strtotime('+1 day', $timestamp)), 'ts' => $timestamp);
}
}
}
$template->assign('days', $month_days);
$template->assign('now', time());
} else {
$total = $db->countObjects('weblog_post', $where);
$posts = $db->selectObjects('weblog_post', $where . ' ORDER BY posted DESC ' . $db->limit($config->items_per_page, 0));
if (!defined('SYS_SORTING')) {
require_once BASE . 'subsystems/sorting.php';
}
for ($i = 0; $i < count($posts); $i++) {
$ploc = exponent_core_makeLocation($loc->mod, $loc->src, $posts[$i]->id);
$posts[$i]->permissions = array('administrate' => exponent_permissions_check('administrate', $ploc), 'edit' => exponent_permissions_check('edit', $ploc), 'delete' => exponent_permissions_check('delete', $ploc), 'comment' => exponent_permissions_check('comment', $ploc), 'edit_comments' => exponent_permissions_check('edit_comments', $ploc), 'delete_comments' => exponent_permissions_check('delete_comments', $ploc), 'view_private' => exponent_permissions_check('view_private', $ploc));
$comments = $db->selectObjects('weblog_comment', 'parent_id=' . $posts[$i]->id);
usort($comments, 'exponent_sorting_byPostedDescending');
$posts[$i]->comments = $comments;
}
usort($posts, 'exponent_sorting_byPostedDescending');
$template->assign('posts', $posts);
$template->assign('total_posts', $total);
}
}
$template->register_permissions(array('administrate', 'configure', 'post', 'edit', 'delete', 'comment', 'edit_comments', 'delete_comments', 'view_private'), $loc);
$template->assign('config', $config);
$template->assign('moduletitle', $title);
$template->output();
}
示例12: show
function show($view, $location = null, $title = '')
{
global $user;
global $db;
$template = new template('SWFModule', $view, $location);
$template->assign('moduletitle', $title);
if (defined('PREVIEW_READONLY') && !defined('SELECTOR')) {
return;
}
if (!defined('SYS_FILES')) {
require_once BASE . 'subsystems/files.php';
}
$directory = 'files/SWFModule';
if (!file_exists(BASE . $directory)) {
$err = exponent_files_makeDirectory($directory);
if ($err != SYS_FILES_SUCCESS) {
$template->assign('noupload', 1);
$template->assign('uploadError', $err);
}
}
$data = $db->selectObject('swfitem', "location_data='" . serialize($location) . "'");
if ($data == null) {
$data->_noflash = 1;
$data->_align = 'center';
} else {
$data->_noflash = 0;
switch ($data->alignment) {
case 1:
$data->_align = 'left';
break;
case 2:
$data->_align = 'right';
break;
default:
$data->_align = 'center';
break;
}
$file = $db->selectObject('file', 'id=' . $data->swf_id);
if ($file && is_readable(BASE . $file->directory . '/' . $file->filename)) {
$data->_flashurl = $file->directory . '/' . $file->filename;
} else {
$data->_flashurl = '';
}
$file = $db->selectObject('file', 'id=' . $data->alt_image_id);
if ($file && is_readable(BASE . $file->directory . '/' . $file->filename)) {
$data->_noflashurl = $file->directory . '/' . $file->filename;
} else {
$data->_noflashurl = '';
}
}
$template->assign('data', $data);
$template->register_permissions(array('administrate', 'configure'), $location);
$template->output();
}
示例13: exit
# PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU
# General Public License along with Exponent; if
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
#
# $Id: stepstone_view.php,v 1.3 2005/02/19 16:53:34 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
exit("");
}
$stepstone = null;
if (isset($_GET['id'])) {
$stepstone = $db->selectObject("codemap_stepstone", "id=" . $_GET['id']);
}
if ($stepstone) {
$loc = unserialize($stepstone->location_data);
$stepstone->milestone = $db->selectObject("codemap_milestone", "id=" . $stepstone->milestone_id);
$template = new template("codemapmodule", "_view_stepstone", $loc);
$template->assign("stepstone", $stepstone);
$template->register_permissions("manage_steps", $loc);
$template->output();
} else {
echo SITE_404_HTML;
}
示例14: exit
# 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 Exponent; if
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
#
# $Id: view_article.php,v 1.3 2005/03/13 18:57:28 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
exit("");
}
$article = null;
if (isset($_GET['id'])) {
$article = $db->selectObject("article", "id=" . $_GET['id']);
if ($article != null) {
$loc = unserialize($article->location_data);
} else {
echo SITE_404_HTML;
}
}
$template = new template("articlemodule", "_viewarticle", $loc);
$template->assign('article', $article);
$template->register_permissions(array('manage'), $loc);
$template->output();
示例15: Copyright
<?php
##################################################
#
# Copyright (c) 2004-2006 OIC Group, Inc.
# Written and Designed by James Hunt
#
# This file is part of Exponent
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
if (!defined('EXPONENT')) {
exit('');
}
if (exponent_permissions_check('manage', $loc)) {
exponent_flow_set(SYS_FLOW_ACTION, SYS_FLOW_PROTECTED);
$objects = $db->selectObjects('rotator_item', "location_data='" . serialize($loc) . "'");
$template = new template('RotatorModule', '_manage', $loc);
$template->assign('items', $objects);
$template->register_permissions(array('administrate', 'manage'), $loc);
$template->output();
} else {
echo SITE_403_HTML;
}