本文整理汇总了PHP中e107::getUserClass方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::getUserClass方法的具体用法?PHP e107::getUserClass怎么用?PHP e107::getUserClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::getUserClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
$mes = e107::getMessage();
$frm = e107::getForm();
$tp = e107::getParser();
// $this->simulation();
$mailoutPlugins = e107::getConfig()->get('e_mailout_list');
if (empty($_GET['id'])) {
return;
}
$tmp = base64_decode($_GET['id']);
parse_str($tmp, $data);
$data['plugin'] = $tp->filter($data['plugin'], 'str');
$data['email'] = $tp->filter($data['email'], 'email');
e107::getMessage()->addDebug(print_a($data, true));
$plugin = vartrue($data['plugin'], false);
if (empty($data) || !e107::isInstalled($plugin) || !in_array($plugin, $mailoutPlugins)) {
$this->invalidURL();
return;
}
$ml = e107::getAddon($plugin, 'e_mailout');
if (!empty($data['userclass'])) {
$data['userclass'] = intval($data['userclass']);
$listName = e107::getUserClass()->getName($data['userclass']);
} else {
$listName = $ml->mailerName;
}
if (vartrue($_POST['remove']) && !empty($data)) {
if ($ml->unsubscribe('process', $data) != false) {
$text = "<p><b>" . $data['email'] . "</b> has been removed from " . $listName . ".</p>";
$mes->addSuccess($text);
} else {
$text = "<p>There was a problem when attempting to remove <b>" . $data['email'] . "</b> from " . $listName . ".</p>";
$mes->addError($text);
}
echo "<div class='container'>" . $mes->render() . "</div>";
return;
}
if ($ml->unsubscribe('check', $data) != false) {
$text = "<p>We are very sorry for the inconvenience. <br />Please click the button below to remove <b>" . $data['email'] . "</b> from <i>" . $listName . "</i>.</p>";
$text .= $frm->open('unsub', 'post', e_REQUEST_URI);
$text .= $frm->button('remove', 'Remove ', 'submit');
$text .= $frm->close();
$mes->setTitle('Unsubscribe', E_MESSAGE_INFO)->addInfo($text);
echo "<div class='container'>" . $mes->render() . "</div>";
return;
} else {
$this->invalidURL();
return;
}
}
示例2: 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;
}
示例3: showSelect
/**
* Called to show current selection criteria, and optionally allow edit
*
* @param $allow_edit is TRUE to allow user to change the selection; FALSE to just display current settings
* @param $selectVals is the current selection information - in the same format as returned by returnSelectors()
*
* @return Returns HTML which is displayed in a table cell. Typically we return a complete table
*/
public function showSelect($allow_edit = FALSE, $selectVals = FALSE)
{
$frm = e107::getForm();
$sql = e107::getDb();
$admin = e107::getRegistry('_mailout_admin');
$var = array();
$var[0]['caption'] = LAN_MAILOUT_03;
// User class select
if ($allow_edit) {
$u_array = array('user_name' => LAN_MAILOUT_43, 'user_login' => LAN_MAILOUT_44, 'user_email' => LAN_MAILOUT_45);
$var[0]['html'] = $admin->userClassesTotals('email_to', varset($selectVals['email_to'], ''));
$var[1]['html'] = $frm->selectbox('user_search_name', $u_array, varset($selectVals['user_search_name'], ''), '', TRUE) . " " . LAN_MAILOUT_47 . " " . $frm->text('user_search_value', varset($selectVals['user_search_value'], ''));
$var[2]['html'] = $admin->comparisonSelect('last_visit_match', varset($selectVals['last_visit_match'], '')) . " " . $frm->text('last_visit_date', varset($selectVals['last_visit_date'], 0));
// FIXME: Should include date selector
$var[3]['html'] = $admin->ret_extended_field_list('extended_1_name', varset($selectVals['extended_1_name'], ''), TRUE) . LAN_MAILOUT_48 . " " . $frm->text('extended_1_value', varset($selectVals['extended_1_value'], ''));
$var[4]['html'] = $admin->ret_extended_field_list('extended_2_name', varset($selectVals['extended_2_name'], ''), TRUE) . LAN_MAILOUT_48 . " " . $frm->text('extended_2_value', varset($selectVals['extended_2_value'], ''));
$var[1]['caption'] = LAN_MAILOUT_46;
// User Search Field.
$var[2]['caption'] = LAN_MAILOUT_56;
// User last visit
$var[3]['caption'] = LAN_MAILOUT_46;
// Extended user field
$var[4]['caption'] = LAN_MAILOUT_46;
// Extended user field
} else {
if (!vartrue($selectVals['email_to'])) {
return;
}
if (is_numeric($selectVals['email_to'])) {
$_to = LAN_MAILOUT_23 . e107::getUserClass()->uc_get_classname(intval($selectVals['email_to']));
} else {
$_to = $selectVals['email_to'];
}
$var_0 = $_to . ' ';
if ($selectVals['email_to'] == 'self') {
$var_0 .= '<' . USEREMAIL . '>';
}
$var[0]['html'] = $var_0;
if (vartrue($selectVals['user_search_name']) && vartrue($selectVals['user_search_value'])) {
$var[1]['html'] = $selectVals['user_search_name'] . ' ' . $selectVals['user_search_value'];
$var[1]['caption'] = LAN_MAILOUT_46;
// User Search Field.
}
if (vartrue($selectVals['last_visit_match']) && vartrue($selectVals['last_visit_date'])) {
$var[2]['html'] = $selectVals['last_visit_match'] . ' ' . gmstrftime("%D-%M-%Y", $selectVals['last_visit_date']);
//FIXME use e107 date function.
$var[2]['caption'] = LAN_MAILOUT_56;
// User last visit
}
if (vartrue($selectVals['extended_1_name']) && vartrue($selectVals['extended_1_value'])) {
$var[3]['html'] = $selectVals['extended_1_name'] . ' ' . $selectVals['extended_1_value'];
$var[3]['caption'] = LAN_MAILOUT_46;
// Extended user field
}
if (vartrue($selectVals['extended_2_name']) && vartrue($selectVals['extended_2_value'])) {
$var[4]['html'] = $selectVals['extended_2_name'] . ' ' . $selectVals['extended_2_value'];
$var[4]['caption'] = LAN_MAILOUT_46;
// Extended user field
}
}
return $var;
}
示例4: _setClassList
protected final function _setClassList()
{
$this->_class_list = array();
if ($this->isUser()) {
if ($this->get('user_class')) {
// list of all 'inherited' user classes, convert elements to integer
$this->_class_list = array_map('intval', e107::getUserClass()->get_all_user_classes($this->get('user_class'), true));
}
$this->_class_list[] = e_UC_MEMBER;
if ($this->isAdmin()) {
$this->_class_list[] = e_UC_ADMIN;
}
if ($this->isMainAdmin()) {
$this->_class_list[] = e_UC_MAINADMIN;
}
} else {
$this->_class_list[] = e_UC_GUEST;
}
$this->_class_list[] = e_UC_READONLY;
$this->_class_list[] = e_UC_PUBLIC;
// unique, rebuild indexes
$this->_class_list = array_merge(array_unique($this->_class_list));
return $this;
}
示例5: header
* @subpackage event_calendar
* @version $Id$;
*/
$eplug_admin = true;
// Make sure we show admin theme
$e_sub_cat = 'event_calendar';
require_once '../../class2.php';
//require_once(e_HANDLER.'userclass_class.php');
if (!getperms('P')) {
header('location:' . e_BASE . 'index.php');
exit;
}
include_lan(e_PLUGIN . 'calendar_menu/languages/' . e_LANGUAGE . '_admin_calendar_menu.php');
require_once e_HANDLER . 'form_handler.php';
$frm = new e_form();
$uc = e107::getUserClass();
// Userclass object pointer
$message = '';
$calendarmenu_text = '';
$calendarmenu_msg = '';
// Given an array of name => format, reads the $_POST variable of each name, applies the specified formatting,
// identifies changes, writes back the changes, makes admin log entry
function logPrefChanges(&$prefList, $logRef)
{
global $pref, $tp, $admin_log;
$prefChanges = array();
foreach ($prefList as $prefName => $process) {
switch ($process) {
case 0:
$temp = varset($_POST[$prefName], '');
break;
示例6: edit_rule
/**
* Display form to add/edit rules
*
* @param array $rule_info - initial data (must be preset if new rule)
*
* @return string - text for display
*/
function edit_rule($rule_info)
{
$is_other_home = TRUE;
$is_other_force = TRUE;
//$force_checked = $rule_info['force'] ? " checked='checked'" : '';
$text_tmp_1 = '';
$text_tmp_2 = '';
foreach ($this->frontPage as $front_key => $front_value) {
//$type_selected = FALSE;
$text_tmp_1 .= "\r\n\t\t\t<tr>\r\n\t\t\t\t" . $this->show_front_val('frontpage', $front_key, $front_value, $is_other_home, $rule_info['page']) . "\r\n\t\t\t</tr>\r\n\t\t \t";
$text_tmp_2 .= "\r\n\t\t\t<tr>\r\n\t\t\t\t" . $this->show_front_val('fp_force_page', $front_key, $front_value, $is_other_force, $rule_info['force']) . "\r\n\t\t\t</tr>\r\n\t\t \t";
}
// <legend class='e-hideme'>".($rule_info['order'] ? FRTLAN_46 : FRTLAN_42)."</legend>
$text = "\r\n\t\t<form method='post' action='" . e_SELF . "'>";
$text .= '<ul class="nav nav-tabs" id="myTabs">
<li class="active"><a data-toggle="tab" href="#home">' . FRTLAN_49 . '</a></li>
<li><a data-toggle="tab" href="#postlogin">' . FRTLAN_35 . '</a></li>
</ul>
';
$text .= "\r\n\t\t\t<div class='tab-content'>\t\r\n\t\t\t\t<div class='tab-pane active' id='home'>\r\n\t\t\t\t\t<table class='table adminform'>\r\n\t\t\t\t\t\t<colgroup>\r\n\t\t\t\t\t\t\t<col style='width: 20%' />\r\n\t\t\t\t\t\t\t<col style='width: 80%' />\r\n\t\t\t\t\t\t</colgroup>\r\n\t\t\t\t\t\t<tbody>\r\n\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td>Selection</td>\r\n\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t<table class='table table-striped table-bordered'>\r\n\t\t\t\t\t\t\t\t\t<colgroup>\r\n\t\t\t\t\t\t\t\t\t\t<col style='width: 20%' />\r\n\t\t\t\t\t\t\t\t\t\t<col style='width: 80%' />\r\n\t\t\t\t\t\t\t\t\t</colgroup>\r\n\t\t\t\t\t\t\t\t\t" . $text_tmp_1 . "\r\n\t\t\t\t\t\t\t\t\t" . $this->add_other('frontpage', $is_other_home, $rule_info['page']) . "\r\n\t\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\r\n\t\t\t\t\t\t</tbody>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</div>\r\n\t\t\t\t\r\n\t\t\t\t<div class='tab-pane' id='postlogin'>\r\n\t\t\t\t\t<table class='table adminform'>\r\n\t\t\t\t\t\t<colgroup>\r\n\t\t\t\t\t\t\t<col style='width: 20%' />\r\n\t\t\t\t\t\t\t<col style='width: 80%' />\r\n\t\t\t\t\t\t</colgroup>\r\n\t\t\t\t\t\t<tbody><tr>\r\n\t\t\t\t\t\t\t<td></td>\r\n\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t<table class='table table-striped table-bordered'>\r\n\t\t\t\t\t\t\t\t<colgroup>\r\n\t\t\t\t\t\t\t\t\t<col style='width: 20%' />\r\n\t\t\t\t\t\t\t\t\t<col style='width: 80%' />\r\n\t\t\t\t\t\t\t\t</colgroup>\r\n\t\t\t\t\t\t\t\t" . $text_tmp_2 . "\r\n\t\t\t\t\t\t\t\t" . $this->add_other('fp_force_page', $is_other_force, $rule_info['force']) . "\r\n\t\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\r\n\t\t\t\t\t\t</tbody>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t<table class='table adminform'>\r\n\t\t\t\t<colgroup>\r\n\t\t\t\t\t<col style='width: 20%' />\r\n\t\t\t\t\t<col style='width: 80%' />\r\n\t\t\t\t</colgroup>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td>" . FRTLAN_43 . "</td>\r\n\t\t\t\t\t<td>" . e107::getUserClass()->uc_dropdown('class', $rule_info['class'], 'public,guest,member,admin,main,classes') . "</td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td>" . LAN_ORDER . "</td>\r\n\t\t\t\t\t<td>" . $this->frm->number('fp_order', $rule_info['order'], 3, 'min=0') . "</td>\r\n\t\t\t\t</tr>\r\n\t\t\t</table>\r\n\t\t\t\r\n\t\t\t\t<div class='buttons-bar center form-inline'>\r\n\r\n\t\t\t\t\t" . $this->frm->admin_button('fp_save_new', LAN_UPDATE, 'update') . "\r\n\t\t\t\t\t" . $this->frm->admin_button('fp_cancel', LAN_CANCEL, 'cancel') . "\r\n\t\t\t\t</div>\r\n\t\t\t\r\n\t\t</form>\r\n\t\t";
return $text;
}
示例7: 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);
}
示例8: edit_rule
/**
* Display form to add/edit rules
*
* @param array $rule_info - initial data (must be preset if new rule)
*
* @return string - text for display
*/
function edit_rule($rule_info)
{
$is_other_home = TRUE;
$is_other_force = TRUE;
//$force_checked = $rule_info['force'] ? " checked='checked'" : '';
$text_tmp_1 = '';
$text_tmp_2 = '';
foreach ($this->frontPage as $front_key => $front_value) {
//$type_selected = FALSE;
$text_tmp_1 .= "\n\t\t\t<tr>\n\t\t\t\t" . $this->show_front_val('frontpage', $front_key, $front_value, $is_other_home, $rule_info['page']) . "\n\t\t\t</tr>\n\t\t \t";
$text_tmp_2 .= "\n\t\t\t<tr>\n\t\t\t\t" . $this->show_front_val('fp_force_page', $front_key, $front_value, $is_other_force, $rule_info['force']) . "\n\t\t\t</tr>\n\t\t \t";
}
$text = "\n\t\t<form method='post' action='" . e_SELF . "'>\n\t\t\t<fieldset id='core-frontpage-edit'>\n\t\t\t\t<legend class='e-hideme'>" . ($rule_info['order'] ? FRTLAN_46 : FRTLAN_42) . "</legend>\n\t\t\t\t<div id='core-frontpage-edit-home'>\n\t\t\t\t\t<table class='table adminlist'>\n\t\t\t\t\t\t<colgroup>\n\t\t\t\t\t\t\t<col style='width: 40%' />\n\t\t\t\t\t\t\t<col style='width: 60%' />\n\t\t\t\t\t\t</colgroup>\n\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<th colspan='2' class='last'>\n\t\t\t\t\t\t\t\t\t" . FRTLAN_49 . "\n\t\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t{$text_tmp_1}\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t" . $this->add_other('frontpage', $is_other_home, $rule_info['page']) . "\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t\t\t<div id='core-frontpage-edit-post-login'>\n\t\t\t\t\t<table class='table adminlist'>\n\t\t\t\t\t\t<colgroup>\n\t\t\t\t\t\t\t<col style='width: 40%' />\n\t\t\t\t\t\t\t<col style='width: 60%' />\n\t\t\t\t\t\t</colgroup>\n\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<th colspan='2' class='last'>\n\t\t\t\t\t\t\t\t\t" . FRTLAN_35 . " " . FRTLAN_50 . "\n\t\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t{$text_tmp_2}\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t" . $this->add_other('fp_force_page', $is_other_force, $rule_info['force']) . "\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t\t\t<div class='buttons-bar center'>\n\t\t\t\t\t" . $this->frm->hidden('fp_order', $rule_info['order']) . "\n\t\t\t\t\t" . FRTLAN_43 . e107::getUserClass()->uc_dropdown('class', $rule_info['class'], 'public,guest,member,admin,main,classes') . "\n\t\t\t\t\t" . $this->frm->admin_button('fp_save_new', FRTLAN_12, 'update') . "\n\t\t\t\t\t" . $this->frm->admin_button('fp_cancel', LAN_CANCEL, 'cancel') . "\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t</form>\n\t\t";
return $text;
}
示例9: renderValue
//.........这里部分代码省略.........
} else {
$src = $tp->replaceConstants(vartrue($parms['pre']) . $value, 'abs');
$alt = $src;
//basename($value);
$ttl = vartrue($parms['title'], 'LAN_PREVIEW');
$value = '<a href="' . $src . '" class="e-image-preview" title="' . $alt . '" rel="external">' . defset($ttl, $ttl) . '</a>';
}
}
break;
case 'files':
$ret = '<ol>';
for ($i = 0; $i < 5; $i++) {
$k = $key . '[' . $i . '][path]';
$ival = $value[$i]['path'];
$ret .= '<li>' . $ival . '</li>';
}
$ret .= '</ol>';
$value = $ret;
break;
case 'datestamp':
$value = $value ? e107::getDate()->convert_date($value, vartrue($parms['mask'], 'short')) : '';
break;
case 'date':
// just show original value
break;
case 'userclass':
$dispvalue = $this->_uc->uc_get_classname($value);
// Inline Editing.
if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
$mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
$uc_options = vartrue($parms['classlist'], 'public,guest,nobody,member,admin,main,classes');
// defaults to 'public,guest,nobody,member,classes' (userclass handler)
unset($parms['classlist']);
$array = e107::getUserClass()->uc_required_class_list($uc_options);
//XXX Ugly looking (non-standard) function naming - TODO discuss name change.
$source = str_replace('"', "'", json_encode($array, JSON_FORCE_OBJECT));
//NOTE Leading ',' required on $value; so it picks up existing value.
$value = "<a class='e-tip e-editable editable-click' data-placement='left' data-value='" . $value . "' data-name='" . $field . "' data-source=\"" . $source . "\" title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='select' data-pk='" . $id . "' data-url='" . e_SELF . "?mode={$mode}&action=inline&id={$id}&ajax_used=1' href='#'>" . $dispvalue . "</a>";
} else {
$value = $dispvalue;
}
break;
case 'userclasses':
// return $value;
$classes = explode(',', $value);
$uv = array();
foreach ($classes as $cid) {
if (!empty($parms['defaultLabel']) && $cid === '') {
$uv[] = $parms['defaultLabel'];
continue;
}
$uv[] = $this->_uc->getName($cid);
}
$dispvalue = implode(vartrue($parms['separator'], "<br />"), $uv);
// Inline Editing.
if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
$uc_options = vartrue($parms['classlist'], 'public,guest, nobody,member,admin,main,classes');
// defaults to 'public,guest,nobody,member,classes' (userclass handler)
$array = e107::getUserClass()->uc_required_class_list($uc_options);
//XXX Ugly looking (non-standard) function naming - TODO discuss name change.
//$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], ''));
$mode = $tp->filter(vartrue($_GET['mode'], ''), 'w');
$source = str_replace('"', "'", json_encode($array, JSON_FORCE_OBJECT));
//NOTE Leading ',' required on $value; so it picks up existing value.
$value = "<a class='e-tip e-editable editable-click' data-placement='bottom' data-value='," . $value . "' data-name='" . $field . "' data-source=\"" . $source . "\" title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='checklist' data-pk='" . $id . "' data-url='" . e_SELF . "?mode={$mode}&action=inline&id={$id}&ajax_used=1' href='#'>" . $dispvalue . "</a>";
} else {
示例10: renderBatchFilter
//.........这里部分代码省略.........
//remove element options if any
foreach ($parms as $k => $name) {
$option[$key . '__' . $k] = $name;
}
break;
case 'language':
// full list of
// full list of
case 'lanlist':
// use the array $parm;
if (!is_array(varset($parms['__options']))) {
parse_str($parms['__options'], $parms['__options']);
}
$opts = $parms['__options'];
if (vartrue($opts['multiple'])) {
// no batch support for multiple, should have some for filters soon
continue;
}
$options = $val['type'] === 'language' ? e107::getLanguage()->getList() : e107::getLanguage()->getLanSelectArray();
foreach ($options as $code => $name) {
$option[$key . '__' . $code] = $name;
}
break;
case 'datestamp':
//TODO today, yesterday, this-month, last-month .
$dateFilters = array('hour' => "Past Hour", "day" => "Past 24 hours", "week" => "Past Week", "month" => "Past Month", "year" => "Past Year");
foreach ($dateFilters as $k => $name) {
$option['datestamp__' . $key . '__' . $k] = $name;
// $option['bool__'.$key.'__0'] = LAN_NO;
// $option[$key.'__'.$k] = $name;
}
break;
case 'userclass':
$classes = e107::getUserClass()->uc_required_class_list(vartrue($parms['classlist'], 'public,nobody,guest,admin,main,classes'));
foreach ($classes as $k => $name) {
$option[$key . '__' . $k] = $name;
}
break;
case 'userclasses':
$classes = e107::getUserClass()->uc_required_class_list(vartrue($parms['classlist'], 'public,nobody,guest,admin,main,classes'));
$_option = array();
if ($type == 'batch') {
// FIXME Lan
foreach ($classes as $k => $v) {
$option['ucadd__' . $key . '__' . $k] = LAN_ADD . ' ' . $v;
$_option['ucremove__' . $key . '__' . $k] = 'Remove ' . $v;
}
$option['ucaddall__' . $key] = '(add all)';
$_option['ucdelall__' . $key] = '(clear all)';
$option = array_merge($option, $_option);
} else {
foreach ($classes as $k => $v) {
$option[$key . '__' . $k] = $v;
}
}
unset($_option);
break;
case 'method':
$method = $key;
$list = call_user_func_array(array($this, $method), array('', $type, $parms));
if (is_array($list)) {
//check for single option
if (isset($list['singleOption'])) {
$textsingle .= $list['singleOption'];
continue;
}
示例11: add_limit
function add_limit($pm_prefs)
{
$sql = e107::getDb();
$frm = e107::getForm();
if ($sql->db_Select('generic', "gen_id as limit_id, gen_datestamp as limit_classnum, gen_user_id as inbox_count, gen_ip as outbox_count, gen_intdata as inbox_size, gen_chardata as outbox_size", "gen_type = 'pm_limit'")) {
while ($row = $sql->db_Fetch()) {
$limitList[$row['limit_classnum']] = $row;
}
}
$txt = "\n\t\t<fieldset id='plugin-pm-addlimit'>\n\t\t<form method='post' action='" . e_SELF . '?' . e_QUERY . "'>\n\t\t<table class='table adminform'>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t<thead>\n\t\t<tr>\n\t\t\t<th>" . ADLAN_PM_36 . "</th>\n\t\t\t<th>" . ADLAN_PM_37 . "</th>\n\t\t\t<th>" . ADLAN_PM_38 . "</th>\n\t\t\t</tr>\n\t\t</thead>\n\t\t<tbody>\n\t";
$txt .= "\n\t<tr>\n\t<td>" . e107::getUserClass()->uc_dropdown('newlimit_class', 0, 'guest,member,admin,classes') . "</td>\n\t<td>\n\t\t" . ADLAN_PM_39 . ": <input type='text' class='tbox' size='5' name='new_inbox_count' value='' /> <br />\n\t\t" . ADLAN_PM_40 . ": <input type='text' class='tbox' size='5' name='new_outbox_count' value='' /> \n\t</td>\n\t<td>\n\t\t" . ADLAN_PM_39 . ": <input type='text' class='tbox' size='5' name='new_inbox_size' value='' /> <br />\n\t\t" . ADLAN_PM_40 . ": <input type='text' class='tbox' size='5' name='new_outbox_size' value='' /> \n\t</td>\n\t</tr>\n\n\t";
$txt .= '
</tbody>
</table>
<div class="buttons-bar center">
' . $frm->admin_button('addlimit', 'no-value', 'update', LAN_ADD) . '
</div>
</form>
</fieldset>';
return $txt;
}
示例12: add
function add($vars)
{
$tp = e107::getParser();
$sql = e107::getDb();
$pmsize = 0;
$attachlist = '';
$pm_options = '';
$ret = '';
$addOutbox = TRUE;
$maxSendNow = varset($this->pmPrefs['pm_max_send'], 100);
// Maximum number of PMs to send without queueing them
if (isset($vars['pm_from'])) {
// Doing bulk send off cron task
$info = array();
foreach ($vars as $k => $v) {
if (strpos($k, 'pm_') === 0) {
$info[$k] = $v;
unset($vars[$k]);
}
}
$addOutbox = FALSE;
// Don't add to outbox - was done earlier
} else {
// Send triggered by user - may be immediate or bulk dependent on number of recipients
$vars['options'] = '';
if (isset($vars['receipt']) && $vars['receipt']) {
$pm_options .= '+rr+';
}
if (isset($vars['uploaded'])) {
foreach ($vars['uploaded'] as $u) {
if (!isset($u['error']) || !$u['error']) {
$pmsize += $u['size'];
$a_list[] = $u['name'];
}
}
$attachlist = implode(chr(0), $a_list);
}
$pmsize += strlen($vars['pm_message']);
$pm_subject = trim($tp->toDB($vars['pm_subject']));
$pm_message = trim($tp->toDB($vars['pm_message']));
if (!$pm_subject && !$pm_message && !$attachlist) {
// Error - no subject, no message body and no uploaded files
return LAN_PM_65;
}
// Most of the pm info is fixed - just need to set the 'to' user on each send
$info = array('pm_from' => $vars['from_id'], 'pm_sent' => time(), 'pm_read' => 0, 'pm_subject' => $pm_subject, 'pm_text' => $pm_message, 'pm_sent_del' => 0, 'pm_read_del' => 0, 'pm_attachments' => $attachlist, 'pm_option' => $pm_options, 'pm_size' => $pmsize);
}
if (isset($vars['to_userclass']) || isset($vars['to_array'])) {
if (isset($vars['to_userclass'])) {
$toclass = e107::getUserClass()->uc_get_classname($vars['pm_userclass']);
$tolist = $this->get_users_inclass($vars['pm_userclass']);
$ret .= LAN_PM_38 . ": {$toclass}<br />";
$class = TRUE;
} else {
$tolist = $vars['to_array'];
$class = FALSE;
}
// Sending multiple PMs here. If more than some number ($maxSendNow), need to split into blocks.
if (count($tolist) > $maxSendNow) {
$totalSend = count($tolist);
$targets = array_chunk($tolist, $maxSendNow);
// Split into a number of lists, each with the maximum number of elements (apart from the last block, of course)
unset($tolist);
$array = new ArrayData();
$pmInfo = $info;
$genInfo = array('gen_type' => 'pm_bulk', 'gen_datestamp' => time(), 'gen_user_id' => USERID, 'gen_ip' => '');
for ($i = 0; $i < count($targets) - 1; $i++) {
// Save the list in the 'generic' table
$pmInfo['to_array'] = $targets[$i];
// Should be in exactly the right format
$genInfo['gen_intdata'] = count($targets[$i]);
$genInfo['gen_chardata'] = $array->WriteArray($pmInfo, TRUE);
$sql->insert('generic', array('data' => $genInfo, '_FIELD_TYPES' => array('gen_chardata' => 'string')));
// Don't want any of the clever sanitising now
}
$toclass .= ' [' . $totalSend . ']';
$tolist = $targets[count($targets) - 1];
// Send the residue now (means user probably isn't kept hanging around too long if sending lots)
unset($targets);
}
foreach ($tolist as $u) {
set_time_limit(30);
$info['pm_to'] = intval($u['user_id']);
// Sending to a single user now
if ($pmid = $sql->insert('private_msg', $info)) {
$info['pm_id'] = $pmid;
e107::getEvent()->trigger('user_pm_sent', $info);
unset($info['pm_id']);
// prevent it from being used on the next record.
if ($class == FALSE) {
$toclass .= $u['user_name'] . ', ';
}
if (check_class($this->pmPrefs['notify_class'], $u['user_class'])) {
$vars['to_info'] = $u;
$this->pm_send_notify($u['user_id'], $vars, $pmid, count($a_list));
}
} else {
$ret .= LAN_PM_39 . ": {$u['user_name']} <br />";
e107::getMessage()->addDebug($sql->getLastErrorText());
}
//.........这里部分代码省略.........
示例13: sc_pm_form_toclass
public function sc_pm_form_toclass()
{
if (vartrue($this->pmInfo['from_name'])) {
return '';
}
if (check_class($this->pmPrefs['opt_userclass']) && check_class($this->pmPrefs['multi_class'])) {
$ret = "<input type='checkbox' name='to_userclass' value='1' />" . LAN_PM_4 . " ";
require_once e_HANDLER . 'userclass_class.php';
$args = ADMIN ? 'admin, classes' : 'classes, matchclass';
if (check_class($this->pmPrefs['sendall_class'])) {
$args = 'member, ' . $args;
}
$ret .= e107::getUserClass()->uc_dropdown('pm_userclass', '', $args);
if (strpos($ret, 'option') === FALSE) {
$ret = '';
}
}
return $ret;
}
示例14: show_signup_class
function show_signup_class($treename, $classnum, $current_value, $nest_level)
{
$tp = e107::getParser();
$uc = e107::getUserClass();
$frm = e107::getForm();
if (deftrue('BOOTSTRAP')) {
$text = "<div class='checkbox'>";
$label = $tp->toHTML($uc->getName($classnum), false, 'defs');
$diz = $tp->toHTML($uc->getDescription($classnum), false, 'defs');
$text .= $frm->checkbox('class[]', $classnum, $current_value, array('label' => $label, 'title' => $diz, 'class' => 'e-tip'));
$text .= "</div>";
return $text;
}
global $USERCLASS_SUBSCRIBE_ROW;
$tmp = explode(',', $current_value);
$shortcodes = array('USERCLASS_ID' => $classnum, 'USERCLASS_NAME' => $tp->toHTML($uc->getName($classnum), false, 'defs'), 'USERCLASS_DESCRIPTION' => $tp->toHTML($uc->getDescription($classnum), false, 'defs'), 'USERCLASS_INDENT' => " style='text-indent:" . 1.2 * $nest_level . "em'", 'USERCLASS_CHECKED' => in_array($classnum, $tmp) ? " checked='checked'" : '');
return $tp->simpleParse($USERCLASS_SUBSCRIBE_ROW, $shortcodes);
}
示例15: ajax_exec_catmanager
function ajax_exec_catmanager()
{
if (!getperms('0|7')) {
exit;
}
//interactive category manage permissions
$check = e107::getDb()->db_Update('news_category', 'category_manager=' . intval($this->getId()) . ' WHERE category_id=' . intval($this->getSubAction()));
if (e107::getDb()->getLastErrorNumber()) {
echo 'mySQL Error #' . e107::getDb()->getLastErrorNumber() . ': ' . e107::getDb()->getLastErrorText();
retrun;
}
if ($check) {
$class_name = e107::getUserClass()->uc_get_classname($this->getId());
e107::getAdminLog()->log_event('NEWS_05', 'category_id=' . intval($this->getSubAction()) . ', category_manager=' . intval($this->getId()) . ' (' . $class_name . ')', E_LOG_INFORMATIVE, '');
}
}