本文整理汇总了PHP中getperms函数的典型用法代码示例。如果您正苦于以下问题:PHP getperms函数的具体用法?PHP getperms怎么用?PHP getperms使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getperms函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
$pref = e107::pref('core');
if (getperms('0')) {
$this->testMode = true;
}
if (substr(e_QUERY, 0, 9) == 'activate.') {
$this->processActivationLink();
}
if (e_QUERY == 'resend' && (!USER || $this->testMode) && $pref['user_reg_veri'] == 1) {
if (empty($_POST['submit_resend'])) {
$this->renderResendForm();
} else {
$this->resendEmail();
}
}
if ($this->testMode == true) {
if (e_QUERY == 'preview') {
$this->renderEmailPreview();
}
if (e_QUERY == "preview.aftersignup") {
$this->renderAfterSignupPreview();
}
if (e_QUERY == 'test') {
$this->sendEmailPreview();
}
}
}
开发者ID:gitye,项目名称:e107,代码行数:28,代码来源:signup.php
示例2: __construct
/**
*
*/
function __construct()
{
$html = '';
if (!empty($_GET['debug']) && getperms('0')) {
$debug = true;
// For future use.
$text = <<<TEMPL
\t[html][code]Something goes here [b]bold print[/b][/code][/html]
TEMPL;
$_POST['content'] = $text;
$_POST['mode'] = 'tohtml';
} else {
$debug = false;
}
if ($_POST['mode'] == 'tohtml') {
$html = $this->toHtml($_POST['content']);
}
if ($_POST['mode'] == 'tobbcode') {
$html = $this->toBBcode($_POST['content']);
}
if ($debug == true) {
print_a($html);
echo "<hr />";
echo $html;
} elseif ($this->gzipCompression == true) {
header('Content-Encoding: gzip');
$gzipoutput = gzencode($html, 6);
header('Content-Length: ' . strlen($gzipoutput));
echo $gzipoutput;
} else {
echo $html;
}
}
开发者ID:armpit,项目名称:e107,代码行数:38,代码来源:parser.php
示例3: check_allowed
function check_allowed($class_id)
{
global $sql;
if (!$sql->db_Select('userclass_classes', '*', "userclass_id = {$class_id}")) {
header("location:" . SITEURL);
exit;
}
$row = $sql->db_Fetch();
if (!getperms('0') && !check_class($row['userclass_editclass'])) {
header("location:" . SITEURL);
exit;
}
}
开发者ID:CAJT-UKCoder,项目名称:e107-Plugins,代码行数:13,代码来源:userclass2.php
示例4: sc_loginname
function sc_loginname($parm)
{
$pref = e107::getPref();
if ($pref['allowEmailLogin'] == 1) {
return;
// hide login name when email-login is being used. (may contain social login info)
}
if (ADMIN && getperms("4")) {
$log_name_length = varset($pref['loginname_maxlength'], 30);
$options = array('title' => $pref['allowEmailLogin'] == 1 ? LAN_USER_82 : LAN_USER_80, 'size' => 40);
return e107::getForm()->text('loginname', $this->var['user_loginname'], $log_name_length, $options);
} else {
return $this->var['user_loginname'];
}
}
开发者ID:notzen,项目名称:e107,代码行数:15,代码来源:usersettings_shortcodes.php
示例5: actionTest
public function actionTest()
{
echo '<h3>Social Login Tester</h3>';
if (getperms('0')) {
echo e107::getMessage()->addError("Please logout of e107 before testing the new-user login/signup procedure.")->render();
return;
}
if (isset($_GET['lgt'])) {
e107::getUser()->logout();
}
$profileData = null;
$provider = e107::getUser()->getProvider();
if ($provider) {
$profileData = $provider->getUserProfile();
if (!empty($profileData)) {
print_a($profileData);
}
}
echo 'Logged in: ' . (e107::getUser()->isUser() && !empty($profileData) ? '<span class="label label-success">true</span>' : '<span class="label label-danger">false</span>');
$testUrl = SITEURL . "?route=system/xup/test";
$providers = e107::getPref('social_login', array());
foreach ($providers as $key => $var) {
if ($var['enabled'] == 1) {
echo '<h3>' . $key . '</h3><ul>';
echo '<li><a class="btn btn-default" href="' . e107::getUrl()->create('system/xup/login?provider=' . $key . '&back=' . base64_encode($testUrl)) . '">Test login only with ' . $key . '</a></li>';
echo '<li><a class="btn btn-default" href="' . e107::getUrl()->create('system/xup/signup?provider=' . $key . '&back=' . base64_encode($testUrl)) . '">Test signup/login with ' . $key . '</a></li>';
echo "</ul>";
}
// print_a($var);
}
echo '<br /><br /><a class="btn btn-default" href="' . e107::getUrl()->create('system/xup/test?lgt') . '">Test logout</a>';
/*
echo '<h3>Facebook</h3>';
echo '<br /><a href="'.e107::getUrl()->create('system/xup/login?provider=Facebook').'">Test login with Facebook</a>';
echo '<br /><a href="'.e107::getUrl()->create('system/xup/signup?provider=Facebook').'">Test signup with Facebook</a>';
echo '<h3>Twitter</h3>';
echo '<br /><a href="'.e107::getUrl()->create('system/xup/login?provider=Twitter').'">Test login with Twitter</a>';
echo '<br /><a href="'.e107::getUrl()->create('system/xup/signup?provider=Twitter').'">Test signup with Twitter</a>';
*/
}
开发者ID:armpit,项目名称:e107,代码行数:41,代码来源:xup.php
示例6: check_allowed
/**
* @todo user_class::isEditableClass() thinks public (0) is editable?!
* @param integer $class_id
* @param boolean $redirect
* @return boolean
*/
function check_allowed($class_id, $redirect = true)
{
$uc = e107::getUserClass();
if (!isset($uc->class_tree[$class_id]) || !getperms('0') && !check_class($uc->class_tree[$class_id]['userclass_editclass'])) {
if (!$redirect) {
return false;
}
header('location:' . SITEURL);
exit;
}
// fix public (0) case here for now
if (!$class_id || !$uc->isEditableClass($class_id)) {
if (!$redirect) {
return false;
}
e107::getMessage()->addSession('You can\'t edit system user classes!', E_MESSAGE_ERROR);
header('location:' . e_SELF);
exit;
}
return true;
}
开发者ID:notzen,项目名称:e107,代码行数:27,代码来源:userclass2.php
示例7:
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*
*
* $Source: /cvs_backup/e107_0.8/e107_admin/phpinfo.php,v $
* $Revision$
* $Date$
* $Author$
*/
require_once "../class2.php";
if (!getperms("0")) {
e107::redirect('admin');
exit;
}
$e_sub_cat = 'phpinfo';
require_once "auth.php";
ob_start();
phpinfo();
$phpinfo .= ob_get_contents();
$phpinfo = preg_replace("#^.*<body>#is", "", $phpinfo);
$phpinfo = str_replace("font", "span", $phpinfo);
$phpinfo = str_replace("</body></html>", "", $phpinfo);
$phpinfo = str_replace('border="0"', '', $phpinfo);
//$phpinfo = str_replace('<table ','<table class="table table-striped adminlist" ',$phpinfo);
$phpinfo = str_replace('name=', 'id=', $phpinfo);
$phpinfo = str_replace('class="e"', 'class="forumheader2 text-left"', $phpinfo);
开发者ID:gitter-badger,项目名称:e107,代码行数:31,代码来源:phpinfo.php
示例8: header
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
require_once '../../class2.php';
if (!getperms('1')) {
header('location:' . e_BASE . 'index.php');
exit;
}
require_once e_HANDLER . 'userclass_class.php';
include_lan(e_PLUGIN . 'newforumposts_main/languages/' . e_LANGUAGE . '.php');
require_once e_ADMIN . 'auth.php';
$frm = e107::getForm();
$mes = e107::getMessage();
if (isset($_POST['updatesettings'])) {
$pref['nfp_display'] = intval($_POST['nfp_display']);
$pref['nfp_caption'] = $tp->toDB($_POST['nfp_caption']);
$pref['nfp_amount'] = intval($_POST['nfp_amount']);
$pref['nfp_layer'] = intval(vartrue($_POST['nfp_layer']));
$pref['nfp_posts'] = intval(vartrue($_POST['nfp_posts']));
$pref['nfp_layer_height'] = intval($_POST['nfp_layer_height'] ? $_POST['nfp_layer_height'] : 200);
save_prefs();
}
$ns->tablerender($caption, $mes->render() . $text);
$text = "\n\t<form method='post' action='" . e_SELF . "?" . e_QUERY . "' id='menu_conf_form'>\n\t<table class='table adminform'>\t \n\t<colgroup span='2'>\n\t\t<col class='col-label' />\n\t\t<col class='col-control' />\n\t</colgroup>\n\t<tr>\n\t\t<td>" . NFPM_L4 . "</td>\n\t\t<td>" . $frm->select('nfp_display', array(0 => NFPM_L5, 1 => NFPM_L6, 2 => NFPM_L7), $pref['nfp_display']) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . NFPM_L8 . ":</td>\n\t\t<td>" . $frm->text('nfp_caption', $pref['nfp_caption'], '100', array('class' => 'tbox input-text span3')) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . NFPM_L9 . ": </td>\n\t\t<td>" . $frm->text('nfp_amount', $pref['nfp_amount'], '3') . "</td>\n\t</tr>\t \n\t<tr>\n\t\t<td>" . NFPM_L14 . "</td>\n\t\t<td>" . $frm->radio_switch('nfp_posts', $pref['nfp_posts'], LAN_YES, LAN_NO) . "<span class='field-help'>" . NFPM_L15 . "</span></td>\n\t</tr>\t \n\t<tr>\n\t\t<td>" . NFPM_L10 . "</td>\n\t\t<td>" . $frm->radio_switch('nfp_layer', $pref['nfp_layer'], LAN_YES, LAN_NO) . "<br />\n\t\t" . NFPM_L11 . ": " . $frm->text('nfp_layer_height', $pref['nfp_layer_height'], '3') . "</td>\n\t</tr>\n\t</table>\n\t<div class='buttons-bar center'>\n\t\t" . $frm->admin_button('updatesettings', LAN_UPDATE, 'update') . "\n\t</div>\n\t</form>";
开发者ID:armpit,项目名称:e107,代码行数:31,代码来源:admin_config.php
示例9: createemPage
function createemPage()
{
if (!getperms("J")) {
return;
}
$this->createPage('menu');
}
开发者ID:notzen,项目名称:e107,代码行数:7,代码来源:cpage.php
示例10: array
* Copyright (C) 2008-2015 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Administration Area - User classes
*
*/
/**
* e107 Userclass handling - Admin
*
* @package e107
* @subpackage admin
* @version $Id$;
*/
require_once '../class2.php';
if (!getperms('4')) {
e107::redirect('admin');
exit;
}
include_lan(e_LANGUAGEDIR . e_LANGUAGE . '/admin/lan_' . e_PAGE);
class uclass_admin extends e_admin_dispatcher
{
protected $modes = array('main' => array('controller' => 'uclass_ui', 'path' => null, 'ui' => 'uclass_ui_form', 'uipath' => null));
protected $adminMenu = array('main/list' => array('caption' => LAN_MANAGE, 'perm' => '4'), 'main/create' => array('caption' => LAN_CREATE, 'perm' => '4'), 'main/initial' => array('caption' => UCSLAN_38, 'perm' => '4'), 'main/options' => array('caption' => LAN_OPTIONS, 'perm' => '4'));
protected $adminMenuAliases = array('main/edit' => 'main/list');
protected $menuTitle = ADLAN_38;
}
class uclass_ui extends e_admin_ui
{
protected $pluginTitle = ADLAN_38;
protected $pluginName = 'core';
开发者ID:gitter-badger,项目名称:e107,代码行数:31,代码来源:userclass2.php
示例11: render_infopanel_menu_options
function render_infopanel_menu_options()
{
if (!getperms('0')) {
return;
}
$frm = e107::getForm();
$pref = e107::getPref();
$text = "<div style='padding-left:20px'>";
$menu_qry = 'SELECT * FROM #menus WHERE menu_id!= 0 GROUP BY menu_name ORDER BY menu_name';
$settings = varset($pref['core-infopanel-menus'], array());
if (e107::getDb()->db_Select_gen($menu_qry)) {
while ($row = e107::getDb()->db_Fetch()) {
$label = str_replace("_menu", "", $row['menu_name']);
$path_to_menu = $row['menu_path'] . $row['menu_name'];
$checked = $settings && in_array($path_to_menu, $settings) ? true : false;
$text .= "\n<div class='left f-left list field-spacer' style='display:block;height:24px;width:200px;'>";
$text .= $frm->checkbox_label($label, "e-mymenus[]", $path_to_menu, $checked);
$text .= "</div>";
}
}
$text .= "</div><div class='clear'> </div>";
return $text;
}
开发者ID:gitye,项目名称:e107,代码行数:23,代码来源:infopanel.php
示例12: admin_info
function admin_info()
{
global $tp;
$width = getperms('0') ? "33%" : "50%";
$ADMIN_INFO_TEMPLATE = "\n\t<div style='text-align:center'>\n\t\t<table style='width: 100%; border-collapse:collapse; border-spacing:0px;'>\n\t\t<tr>\n\t\t\t<td style='width: " . $width . "; vertical-align: top'>\n\t\t\t{ADMIN_STATUS}\n\t\t\t</td>\n\t\t\t<td style='width:" . $width . "; vertical-align: top'>\n\t\t\t{ADMIN_LATEST}\n\t\t\t</td>";
if (getperms('0')) {
$ADMIN_INFO_TEMPLATE .= "\n\t\t\t<td style='width:" . $width . "; vertical-align: top'>{ADMIN_LOG}</td>";
}
$ADMIN_INFO_TEMPLATE .= "\n\t\t</tr></table></div>";
return $tp->parseTemplate($ADMIN_INFO_TEMPLATE);
}
开发者ID:gitye,项目名称:e107,代码行数:11,代码来源:admin.php
示例13: saveMailPrefs
function saveMailPrefs(&$mes)
{
if (!getperms('0')) {
return;
}
//$pref = e107::getPref();
$e107 = e107::getInstance();
$tp = e107::getParser();
$mes = e107::getMessage();
$bounceOpts = array('none' => LAN_MAILOUT_232, 'auto' => LAN_MAILOUT_233, 'mail' => LAN_MAILOUT_234);
unset($temp);
if (!in_array($_POST['mailer'], array('smtp', 'sendmail', 'php'))) {
$_POST['mailer'] = 'php';
}
$temp['mailer'] = $_POST['mailer'];
// Allow qmail as an option as well - works much as sendmail
if (strpos($_POST['sendmail'], 'sendmail') !== FALSE || strpos($_POST['sendmail'], 'qmail') !== FALSE) {
$temp['sendmail'] = $tp->toDB($_POST['sendmail']);
} else {
$temp['sendmail'] = '';
}
$temp['smtp_server'] = $tp->toDB($_POST['smtp_server']);
$temp['smtp_username'] = $tp->toDB($_POST['smtp_username']);
$temp['smtp_password'] = $tp->toDB($_POST['smtp_password']);
$smtp_opts = array();
switch (trim($_POST['smtp_options'])) {
case 'smtp_ssl':
$smtp_opts[] = 'secure=SSL';
break;
case 'smtp_tls':
$smtp_opts[] = 'secure=TLS';
break;
case 'smtp_pop3auth':
$smtp_opts[] = 'pop3auth';
break;
}
if (vartrue($_POST['smtp_keepalive'])) {
$smtp_opts[] = 'keepalive';
}
if (vartrue($_POST['smtp_useVERP'])) {
$smtp_opts[] = 'useVERP';
}
$temp['smtp_options'] = implode(',', $smtp_opts);
$temp['mail_sendstyle'] = $tp->toDB($_POST['mail_sendstyle']);
$temp['mail_pause'] = intval($_POST['mail_pause']);
$temp['mail_pausetime'] = intval($_POST['mail_pausetime']);
$temp['mail_workpertick'] = intval($_POST['mail_workpertick']);
$temp['mail_workpertick'] = min($temp['mail_workpertick'], 1000);
$temp['mail_bounce'] = isset($bounceOpts[$_POST['mail_bounce']]) ? $_POST['mail_bounce'] : 'none';
$temp['mail_bounce_auto'] = 0;
// Make sure this is always defined
switch ($temp['mail_bounce']) {
case 'none':
$temp['mail_bounce_email'] = '';
break;
case 'auto':
$temp['mail_bounce_email'] = $tp->toDB($_POST['mail_bounce_email2']);
break;
case 'mail':
$temp['mail_bounce_email'] = $tp->toDB($_POST['mail_bounce_email']);
$temp['mail_bounce_auto'] = intval($_POST['mail_bounce_auto']);
break;
}
$temp['mail_bounce_pop3'] = $tp->toDB($_POST['mail_bounce_pop3']);
$temp['mail_bounce_user'] = $tp->toDB($_POST['mail_bounce_user']);
$temp['mail_bounce_pass'] = $tp->toDB($_POST['mail_bounce_pass']);
$temp['mail_bounce_type'] = $tp->toDB($_POST['mail_bounce_type']);
$temp['mail_bounce_delete'] = intval(varset($_POST['mail_bounce_delete'], 0));
$temp['mailout_enabled'] = implode(',', varset($_POST['mail_mailer_enabled'], ''));
$temp['mail_log_options'] = intval($_POST['mail_log_option']) . ',' . intval($_POST['mail_log_email']);
foreach ($temp as &$t) {
if ($t === NULL) {
$t = '';
}
}
$pref = e107::pref('core');
// Core Prefs Array.
if (e107::getAdminLog()->logArrayDiffs($temp, $pref, 'MAIL_03')) {
e107::getConfig()->updatePref($temp);
e107::getConfig()->save(false);
// Only save if changes - generates its own message
} else {
$mes->addInfo(LAN_NO_CHANGE);
}
}
开发者ID:armpit,项目名称:e107,代码行数:85,代码来源:mailout.php
示例14: header
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/download/admin_download.php,v $
* $Revision: 12639 $
* $Date: 2012-04-20 00:28:53 -0700 (Fri, 20 Apr 2012) $
* $Author: e107coders $
*/
$eplug_admin = true;
require_once "../../class2.php";
if (!getperms("P") || !e107::isInstalled('gallery')) {
header("location:" . e_BASE . "index.php");
exit;
}
$e_sub_cat = 'gallery';
class plugin_gallery_admin extends e_admin_dispatcher
{
/**
* Format: 'MODE' => array('controller' =>'CONTROLLER_CLASS'[, 'index' => 'list', 'path' => 'CONTROLLER SCRIPT PATH', 'ui' => 'UI CLASS NAME child of e_admin_ui', 'uipath' => 'UI SCRIPT PATH']);
* Note - default mode/action is autodetected in this order:
* - $defaultMode/$defaultAction (owned by dispatcher - see below)
* - $adminMenu (first key if admin menu array is not empty)
* - $modes (first key == mode, corresponding 'index' key == action)
* @var array
*/
protected $modes = array('main' => array('controller' => 'gallery_cat_admin_ui', 'path' => null, 'ui' => 'gallery_cat_admin_form_ui', 'uipath' => null), 'cat' => array('controller' => 'gallery_cat_ui', 'path' => null, 'ui' => 'gallery_cat_form_ui', 'uipath' => null));
开发者ID:armpit,项目名称:e107,代码行数:31,代码来源:admin_gallery.php
示例15: array
<?php
/*
* e107 website system
*
* Copyright (C) e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* URL and front controller Management
*
* $URL$
* $Id$
*/
require_once '../class2.php';
if (!ADMIN || !getperms('L')) {
e107::redirect('admin');
exit;
}
e107::coreLan('eurl', true);
// TODO - admin interface support, remove it from globals
$e_sub_cat = 'eurl';
e107::css('inline', " span.e-help { cursor: help } ");
class eurl_admin extends e_admin_dispatcher
{
protected $modes = array('main' => array('controller' => 'eurl_admin_ui', 'path' => null, 'ui' => 'eurl_admin_form_ui', 'uipath' => null));
protected $adminMenu = array('main/config' => array('caption' => LAN_EURL_MENU_CONFIG, 'perm' => 'L'), 'main/alias' => array('caption' => LAN_EURL_MENU_ALIASES, 'perm' => 'L'), 'main/settings' => array('caption' => LAN_EURL_MENU_SETTINGS, 'perm' => 'L'), 'main/simple' => array('caption' => LAN_EURL_MENU_REDIRECTS, 'perm' => 'L'));
protected $adminMenuAliases = array();
protected $defaultAction = 'config';
protected $menuTitle = LAN_EURL_MENU;
}
开发者ID:KonzolozZ,项目名称:e107,代码行数:31,代码来源:eurl.php
示例16: die
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*
*
* $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/help/menus.php,v $
* $Revision$
* $Date$
* $Author$
*/
if (!defined('e107_INIT')) {
die("Unauthorised Access");
}
if (!getperms("2")) {
header("location:" . e_BASE . "index.php");
exit;
}
$sql = e107::getDb();
$tp = e107::getParser();
if (isset($_POST['reset'])) {
for ($mc = 1; $mc <= 5; $mc++) {
$sql->db_Select("menus", "*", "menu_location='" . $mc . "' ORDER BY menu_order");
$count = 1;
$sql2 = new db();
while (list($menu_id, $menu_name, $menu_location, $menu_order) = $sql->db_Fetch()) {
$sql2->db_Update("menus", "menu_order='{$count}' WHERE menu_id='{$menu_id}' ");
$count++;
}
$text = "<b>Menus reset in database</b><br /><br />";
开发者ID:dmitripot,项目名称:e107-v2.x-Language-Packs,代码行数:31,代码来源:menus.php
示例17: language_adminmenu
function language_adminmenu()
{
$pref = e107::getPref();
$action = e_QUERY;
if ($action == "") {
$action = getperms('0') ? "main" : "tools";
}
if ($action == "modify") {
$action = "db";
}
if (getperms('0')) {
$var['main']['text'] = LAN_PREFS;
$var['main']['link'] = e_SELF;
if (isset($pref['multilanguage']) && $pref['multilanguage']) {
$var['db']['text'] = LANG_LAN_03;
$var['db']['link'] = e_SELF . "?db";
}
}
// $lcnt = explode(",", e_LANLIST);
// if (count($lcnt) > 1)
// {
$var['tools']['text'] = LANG_LAN_21;
$var['tools']['link'] = e_SELF . "?tools";
// }
e107::getNav()->admin(ADLAN_132, $action, $var);
}
开发者ID:gitye,项目名称:e107,代码行数:26,代码来源:language.php
示例18: renderMenu
/**
* Generic Admin Menu Generator
* @return string
*/
function renderMenu()
{
$tp = e107::getParser();
$var = array();
$selected = false;
foreach ($this->adminMenu as $key => $val) {
if (isset($val['perm']) && $val['perm'] !== '' && !getperms($val['perm'])) {
continue;
}
$tmp = explode('/', trim($key, '/'), 3);
// sync with mode/route access
if (!$this->checkModeAccess($tmp[0]) || !$this->checkRouteAccess($tmp[0] . '/' . $tmp[1])) {
continue;
}
// custom 'selected' check
if (isset($val['selected']) && $val['selected']) {
$selected = $val['selected'] === true ? $key : $val['selected'];
}
foreach ($val as $k => $v) {
switch ($k) {
case 'caption':
$k2 = 'text';
$v = defset($v, $v);
break;
case 'url':
$k2 = 'link';
$v = $tp->replaceConstants($v, 'abs') . '?mode=' . $tmp[0] . '&action=' . $tmp[1];
break;
case 'uri':
$k2 = 'link';
$v = $tp->replaceConstants($v, 'abs');
break;
default:
$k2 = $k;
break;
}
$var[$key][$k2] = $v;
}
// TODO slide down menu options?
if (!vartrue($var[$key]['link'])) {
$var[$key]['link'] = e_SELF . '?mode=' . $tmp[0] . '&action=' . $tmp[1];
// FIXME - URL based on $modes, remove url key
}
if (varset($val['tab'])) {
$var[$key]['link'] .= "&tab=" . $val['tab'];
}
/*$var[$key]['text'] = $val['caption'];
$var[$key]['link'] = (vartrue($val['url']) ? $tp->replaceConstants($val['url'], 'abs') : e_SELF).'?mode='.$tmp[0].'&action='.$tmp[1];
$var[$key]['perm'] = $val['perm']; */
if (!empty($val['modal'])) {
$var[$key]['link_class'] = ' e-modal';
if (!empty($val['modal-caption'])) {
$var[$key]['link_data'] = array('data-modal-caption' => $val['modal-caption']);
}
}
}
if (empty($var)) {
return '';
}
$request = $this->getRequest();
if (!$selected) {
$selected = $request->getMode() . '/' . $request->getAction();
}
$selected = vartrue($this->adminMenuAliases[$selected], $selected);
return e107::getNav()->admin($this->menuTitle, $selected, $var);
}
开发者ID:KonzolozZ,项目名称:e107,代码行数:70,代码来源:admin_ui.php
示例19: show_upload_filetypes
/**
*
*/
function show_upload_filetypes()
{
$ns = e107::getRender();
$e_userclass = e107::getUserClass();
if (!getperms("0")) {
exit;
}
//TODO still needed?
$definition_source = DOWLAN_71;
$source_file = '';
$edit_upload_list = varset($_POST['upload_do_edit'], false);
if (isset($_POST['generate_filetypes_xml'])) {
// Write back edited data to filetypes_.xml
$file_text = "<e107Filetypes>\n";
foreach ($_POST['file_class_select'] as $k => $c) {
if (!isset($_POST['file_line_delete_' . $c]) && vartrue($_POST['file_type_list'][$k])) {
$file_text .= " <class name='{$c}' type='{$_POST['file_type_list'][$k]}' maxupload='" . vartrue($_POST['file_maxupload'][$k], ini_get('upload_max_filesize')) . "'/>\n";
}
}
$file_text .= "</e107Filetypes>";
if (($handle = fopen(e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES, 'wt')) == FALSE || fwrite($handle, $file_text) == FALSE || fclose($handle) == FALSE) {
$text = DOWLAN_88 . e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES;
} else {
$text = DOWLAN_86 . e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES . '<br/>' . DOWLAN_87 . e_ADMIN . e_READ_FILETYPES . '<br/>';
}
$ns->tablerender(DOWLAN_49, $text);
}
$current_perms = array();
if ($edit_upload_list && is_readable(e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES) || !$edit_upload_list && is_readable(e_ADMIN . e_READ_FILETYPES)) {
require_once e_HANDLER . 'xml_class.php';
$xml = new xmlClass();
$xml->setOptArrayTags('class');
$source_file = $edit_upload_list ? e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES : e_ADMIN . e_READ_FILETYPES;
$temp_vars = $xml->loadXMLfile($source_file, true, false);
if ($temp_vars === FALSE) {
echo "Error parsing XML file!";
} else {
foreach ($temp_vars['class'] as $v1) {
$v = $v1['@attributes'];
$current_perms[$v['name']] = array('type' => $v['type'], 'maxupload' => $v['maxupload']);
}
}
} elseif (is_readable(e_ADMIN . 'filetypes.php')) {
$source_file = 'filetypes.php';
$current_perms[e_UC_MEMBER] = array('type' => implode(',', array_keys(get_allowed_filetypes('filetypes.php', ''))), 'maxupload' => '2M');
if (is_readable(e_ADMIN . 'admin_filetypes.php')) {
$current_perms[e_UC_ADMIN] = array('type' => implode(',', array_keys(get_allowed_filetypes('admin_filetypes.php', ''))), 'maxupload' => '2M');
$source_file .= ' + admin_filetypes.php';
}
} else {
// Set a default
$current_perms[e_UC_MEMBER] = array('type' => 'zip,tar,gz,jpg,png', 'maxupload' => '2M');
}
$frm = new e_form(true);
//enable inner tabindex counter
$columnInfo = array("ftypes_userclass" => array("title" => DOWLAN_73, "type" => "", "width" => "auto", "thclass" => "", "forced" => true), "ftypes_extension" => array("title" => DOWLAN_74, "type" => "", "width" => "auto", "thclass" => ""), "ftypes_max_size" => array("title" => DOWLAN_75, "type" => "", "width" => "auto", "thclass" => ""), "ftypes_confirm_del" => array("title" => DOWLAN_76, "type" => "", "width" => "auto", "thclass" => "last"));
$filterColumns = array("ftypes_userclass", "ftypes_extension", "ftypes_max_size", "ftypes_confirm_del");
$text = "\n <form method='post' action='" . e_SELF . "?filetypes'>\n <fieldset id='core-download-upload1'>\n <div>\n <div>\n <input type='hidden' name='upload_do_edit' value='1'/><p>" . str_replace(array('--SOURCE--', '--DEST--'), array(e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES, e_ADMIN . e_READ_FILETYPES), DOWLAN_85) . "</p><p>" . DOWLAN_72 . $source_file . "\n </p></div>\n <table class='table adminform'>" . $frm->colGroup($columnInfo) . $frm->thead($columnInfo, $filterColumns) . "\n <tbody>\n ";
foreach ($current_perms as $uclass => $uinfo) {
$text .= "\n <tr>\n <td>\n <select name='file_class_select[]' class='tbox'>\n " . $e_userclass->vetted_tree('file_class_select', array($e_userclass, 'select'), $uclass, 'member,main,classes,admin, no-excludes') . "\n </select>\n </td>\n <td><input type='text' name='file_type_list[]' value='{$uinfo['type']}' class='tbox' size='40'/></td>\n <td><input type='text' name='file_maxupload[]' value='{$uinfo['maxupload']}' class='tbox' size='10'/></td>\n <td><input type='checkbox' value='1' name='file_line_delete_{$uclass}'/></td>\n </tr>\n ";
}
// Now put up a box to add a new setting
$text .= "\n <tr>\n <td colspan='" . count($columnInfo) . "'>" . DOWLAN_90 . "</td>\n </tr>\n <tr>\n <td><select name='file_class_select[]' class='tbox'>\n " . $e_userclass->vetted_tree('file_class_select', array($e_userclass, 'select'), '', 'member,main,classes,admin,blank, no-excludes') . "\n </select></td>\n <td><input type='text' name='file_type_list[]' value='' class='tbox' size='40'/></td>\n <td colspan='2'><input type='text' name='file_maxupload[]' value='" . ini_get('upload_max_filesize') . "' class='tbox' size='10'/></td>\n </tr>\n </tbody>\n </table>\n </div>\n </fieldset>\n <div class='buttons-bar center'>\n <input class='btn btn-default button' type='submit' name='generate_filetypes_xml' value='" . DOWLAN_77 . "'/>\n </div>\n \t\t</form>\n ";
$ns->tablerender(DOWLAN_23, $text);
}
开发者ID:gitye,项目名称:e107,代码行数:68,代码来源:admin_download.php
示例20: header
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
require_once "../class2.php";
if (!getperms("M")) {
header("location:" . e_BASE . "index.php");
exit;
}
e107::lan('core', 'wmessage', true);
class wmessage_admin extends e_admin_dispatcher
{
protected $modes = array('main' => array('controller' => 'generic_ui', 'path' => null, 'ui' => 'generic_form_ui', 'uipath' => null));
protected $adminMenu = array('main/list' => array('caption' => LAN_MANAGE, 'perm' => 'P'), 'main/create' => array('caption' => LAN_CREATE, 'perm' => 'P'), 'main/prefs' => array('caption' => LAN_PREFS, 'perm' => 'P'));
protected $adminMenuAliases = array('main/edit' => 'main/list');
protected $menuTitle = WMLAN_00;
}
class generic_ui extends e_admin_ui
{
protected $pluginTitle = WMLAN_00;
protected $pluginName = 'core';
protected $eventName = 'wmessage';
protected $table = 'generic';
protected $pid = 'gen_id';
protected $perPage = 10;
开发者ID:armpit,项目名称:e107,代码行数:31,代码来源:wmessage.php
注:本文中的getperms函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论