Example #1
0
 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;
     }
 }
Example #2
0
/**
 * @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;
}
Example #3
0
 /**
  * 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 . '&nbsp;';
         if ($selectVals['email_to'] == 'self') {
             $var_0 .= '&lt;' . USEREMAIL . '&gt;';
         }
         $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;
 }
Example #4
0
 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;
 }
Example #5
0
 *	@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;
Example #6
0
    /**
     *	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;
    }
Example #7
0
/**
 *
 */
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);
}
Example #8
0
 /**
  *	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;
 }
Example #9
0
 /**
  * Render Field Value
  * @param string $field field name
  * @param mixed $value field value
  * @param array $attributes field attributes including render parameters, element options - see e_admin_ui::$fields for required format
  * @return string
  */
 function renderValue($field, $value, $attributes, $id = 0)
 {
     if (!empty($attributes['multilan']) && is_array($value)) {
         $value = varset($value[e_LANGUAGE], '');
     }
     $parms = array();
     if (isset($attributes['readParms'])) {
         if (!is_array($attributes['readParms'])) {
             parse_str($attributes['readParms'], $attributes['readParms']);
         }
         $parms = $attributes['readParms'];
     }
     if (vartrue($attributes['inline'])) {
         $parms['editable'] = true;
     }
     // attribute alias
     if (vartrue($attributes['sort'])) {
         $parms['sort'] = true;
     }
     // attribute alias
     if (!empty($parms['type'])) {
         $attributes['type'] = $parms['type'];
     }
     $this->renderValueTrigger($field, $value, $parms, $id);
     $tp = e107::getParser();
     switch ($field) {
         case 'options':
             if (varset($attributes['type']) == "method") {
                 $attributes['mode'] = "read";
                 if (isset($attributes['method']) && $attributes['method'] && method_exists($this, $attributes['method'])) {
                     $method = $attributes['method'];
                     return $this->{$method}($parms, $value, $id, $attributes);
                 } elseif (method_exists($this, 'options')) {
                     //return  $this->options($field, $value, $attributes, $id);
                     // consistent method arguments, fixed in admin cron administration
                     return $this->options($parms, $value, $id, $attributes);
                     // OLD breaks admin->cron 'options' column
                 }
             }
             if (!$value) {
                 parse_str(str_replace('&amp;', '&', e_QUERY), $query);
                 //FIXME - FIX THIS
                 // keep other vars in tact
                 $query['action'] = 'edit';
                 $query['id'] = $id;
                 //$edit_query = array('mode' => varset($query['mode']), 'action' => varset($query['action']), 'id' => $id);
                 $query = http_build_query($query);
                 $value = "<div class='btn-group'>";
                 if (vartrue($parms['sort'])) {
                     $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
                     $from = intval(vartrue($_GET['from'], 0));
                     $value .= "<a class='e-sort sort-trigger btn btn-default' style='cursor:move' data-target='" . e_SELF . "?mode={$mode}&action=sort&ajax_used=1&from={$from}' title='" . LAN_RE_ORDER . "'>" . ADMIN_SORT_ICON . "</a> ";
                 }
                 $cls = false;
                 if (varset($parms['editClass'])) {
                     $cls = deftrue($parms['editClass']) ? constant($parms['editClass']) : $parms['editClass'];
                 }
                 if ((false === $cls || check_class($cls)) && varset($parms['edit'], 1) == 1) {
                     /*
                     						$value .= "<a href='".e_SELF."?{$query}' class='e-tip btn btn-large' title='".LAN_EDIT."' data-placement='left'>
                     <img class='icon action edit list' src='".ADMIN_EDIT_ICON_PATH."' alt='".LAN_EDIT."' /></a>";
                     */
                     $value .= "<a href='" . e_SELF . "?{$query}' class='btn btn-default' title='" . LAN_EDIT . "' data-toggle='tooltip' data-placement='left'>\r\n\t\t\t\t\t\t" . ADMIN_EDIT_ICON . "</a>";
                 }
                 $delcls = vartrue($attributes['noConfirm']) ? ' no-confirm' : '';
                 if (varset($parms['deleteClass']) && varset($parms['delete'], 1) == 1) {
                     $cls = deftrue($parms['deleteClass']) ? constant($parms['deleteClass']) : $parms['deleteClass'];
                     if (check_class($cls)) {
                         $value .= $this->submit_image('etrigger_delete[' . $id . ']', $id, 'delete', LAN_DELETE . ' [ ID: ' . $id . ' ]', array('class' => 'action delete btn btn-default' . $delcls));
                     }
                 } else {
                     $value .= $this->submit_image('etrigger_delete[' . $id . ']', $id, 'delete', LAN_DELETE . ' [ ID: ' . $id . ' ]', array('class' => 'action delete btn btn-default' . $delcls));
                 }
             }
             //$attributes['type'] = 'text';
             $value .= "</div>";
             return $value;
             break;
         case 'checkboxes':
             $value = $this->checkbox(vartrue($attributes['toggle'], 'multiselect') . '[' . $id . ']', $id);
             //$attributes['type'] = 'text';
             return $value;
             break;
     }
     switch ($attributes['type']) {
         case 'number':
             if (!$value) {
                 $value = '0';
             }
             if ($parms) {
                 if (!isset($parms['sep'])) {
                     $value = number_format($value, $parms['decimals']);
                 } else {
                     $value = number_format($value, $parms['decimals'], vartrue($parms['point'], '.'), vartrue($parms['sep'], ' '));
                 }
             }
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
                 $value = "<a class='e-tip e-editable editable-click' data-name='" . $field . "' title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='text' data-pk='" . $id . "' data-url='" . e_SELF . "?mode={$mode}&action=inline&id={$id}&ajax_used=1' href='#'>" . $value . "</a>";
             }
             $value = vartrue($parms['pre']) . $value . vartrue($parms['post']);
             // else same
             break;
         case 'ip':
             //$e107 = e107::getInstance();
             $value = e107::getIPHandler()->ipDecode($value);
             // else same
             break;
         case 'templates':
         case 'layouts':
             $pre = vartrue($parms['pre']);
             $post = vartrue($parms['post']);
             unset($parms['pre'], $parms['post']);
             if ($parms) {
                 $attributes['writeParms'] = $parms;
             } elseif (isset($attributes['writeParms'])) {
                 if (is_string($attributes['writeParms'])) {
                     parse_str($attributes['writeParms'], $attributes['writeParms']);
                 }
             }
             $attributes['writeParms']['raw'] = true;
             $tmp = $this->renderElement($field, '', $attributes);
             // Inline Editing.  //@SecretR - please FIXME!
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
                 $source = str_replace('"', "'", json_encode($wparms));
                 $value = "<a class='e-tip e-editable editable-click' data-name='" . $field . "' data-source=\"" . $source . "\" title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='select' data-pk='" . $id . "' data-url='" . e_SELF . "?mode=&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>" . $value . "</a>";
             }
             //	$value = $pre.vartrue($tmp[$value]).$post; // FIXME "Fatal error: Only variables can be passed by reference" featurebox list page.
             break;
         case 'checkboxes':
         case 'comma':
         case 'dropdown':
             // XXX - should we use readParams at all here? see writeParms check below
             if ($parms && is_array($parms)) {
                 //FIXME return no value at all when 'editable=1' is a readParm. See FAQs templates.
                 //	$value = vartrue($parms['pre']).vartrue($parms[$value]).vartrue($parms['post']);
                 //	break;
             }
             // NEW - multiple (array values) support
             // FIXME - add support for multi-level arrays (option groups)
             if (!is_array($attributes['writeParms'])) {
                 parse_str($attributes['writeParms'], $attributes['writeParms']);
             }
             $wparms = $attributes['writeParms'];
             if (!is_array(varset($wparms['__options']))) {
                 parse_str($wparms['__options'], $wparms['__options']);
             }
             if (!empty($wparms['optArray'])) {
                 $fopts = $wparms;
                 $wparms = $fopts['optArray'];
                 unset($fopts['optArray']);
                 $wparms['__options'] = $fopts;
             }
             $opts = $wparms['__options'];
             unset($wparms['__options']);
             $_value = $value;
             if ($attributes['type'] == 'checkboxes' || $attributes['type'] == 'comma') {
                 $opts['multiple'] = true;
             }
             if (vartrue($opts['multiple'])) {
                 $ret = array();
                 $value = is_array($value) ? $value : explode(',', $value);
                 foreach ($value as $v) {
                     if (isset($wparms[$v])) {
                         $ret[] = $wparms[$v];
                     }
                 }
                 $value = implode(', ', $ret);
             } else {
                 $ret = '';
                 if (isset($wparms[$value])) {
                     $ret = $wparms[$value];
                 }
                 $value = $ret;
             }
             $value = $value ? vartrue($parms['pre']) . defset($value, $value) . vartrue($parms['post']) : '';
             // Inline Editing.
             // Inline Editing with 'comma' @SecretR - please FIXME - empty values added. @see news 'render type' or 'media-manager' category for test examples.
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 $xtype = $attributes['type'] == 'dropdown' ? 'select' : 'checklist';
                 //	$value = "<a class='e-tip e-editable editable-click' data-name='".$field."' data-value='{$_value}' data-source=\"".$source."\" title=\"".LAN_EDIT." ".$attributes['title']."\" data-type='".$xtype."' data-pk='".$id."' data-url='".e_SELF."?mode=&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>".$value."</a>";
                 $value = $this->renderInline($field, $id, $attributes['title'], $_value, $value, $xtype, $wparms);
             }
             // return ;
             break;
         case 'radio':
             if ($parms && is_array($parms)) {
                 $value = vartrue($parms['pre']) . vartrue($parms[$value]) . vartrue($parms['post']);
                 break;
             }
             if (!is_array($attributes['writeParms'])) {
                 parse_str($attributes['writeParms'], $attributes['writeParms']);
             }
             $value = vartrue($attributes['writeParms']['__options']['pre']) . vartrue($attributes['writeParms'][$value]) . vartrue($attributes['writeParms']['__options']['post']);
             break;
         case 'tags':
             if (!empty($parms['constant'])) {
                 $value = defset($value, $value);
             }
             if (vartrue($parms['truncate'])) {
                 $value = $tp->text_truncate($value, $parms['truncate'], '...');
             } elseif (vartrue($parms['htmltruncate'])) {
                 $value = $tp->html_truncate($value, $parms['htmltruncate'], '...');
             }
             if (vartrue($parms['wrap'])) {
                 $value = $tp->htmlwrap($value, (int) $parms['wrap'], varset($parms['wrapChar'], ' '));
             }
             if (vartrue($parms['link']) && $id) {
                 $link = str_replace('[id]', $id, $parms['link']);
                 $link = $tp->replaceConstants($link);
                 // SEF URL is not important since we're in admin.
                 $dialog = vartrue($parms['target']) == 'dialog' ? " e-dialog" : "";
                 // iframe
                 $ext = vartrue($parms['target']) == 'blank' ? " rel='external' " : "";
                 // new window
                 $modal = vartrue($parms['target']) == 'modal' ? " data-toggle='modal' data-cache='false' data-target='#uiModal' " : "";
                 if ($parms['link'] == 'sef' && $this->getController()->getListModel()) {
                     $model = $this->getController()->getListModel();
                     // copy url config
                     if (!$model->getUrl()) {
                         $model->setUrl($this->getController()->getUrl());
                     }
                     // assemble the url
                     $link = $model->url();
                 } elseif (vartrue($data[$parms['link']])) {
                     $link = $tp->replaceConstants(vartrue($data[$parms['link']]));
                 }
                 // in case something goes wrong...
                 if ($link) {
                     $value = "<a class='e-tip{$dialog}' {$ext} href='" . $link . "' {$modal} title='Quick View' >" . $value . "</a>";
                 }
             }
             if (empty($value)) {
                 $value = '-';
                 $setValue = "data-value=''";
             } else {
                 $setValue = "";
                 if ($attributes['type'] == 'tags' && !empty($value)) {
                     $setValue = "data-value='" . $value . "'";
                     $value = str_replace(",", ", ", $value);
                     // add spaces so it wraps, but don't change the actual values.
                 }
             }
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 $options['selectize'] = array('create' => true, 'maxItems' => 7, 'mode' => 'multi', 'e_editable' => $field . '_' . $id);
                 $tpl = $this->text($field, $value, 80, $options);
                 $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
                 $value = "<a id='" . $field . '_' . $id . "' class='e-tip e-editable editable-click editable-tags' data-emptytext='-' data-tpl='" . str_replace("'", '"', $tpl) . "' data-name='" . $field . "' title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='text' data-pk='" . $id . "' " . $setValue . " data-url='" . e_SELF . "?mode={$mode}&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>" . $value . "</a>";
             }
             $value = vartrue($parms['pre']) . $value . vartrue($parms['post']);
             break;
         case 'text':
             if (!empty($parms['constant'])) {
                 $value = defset($value, $value);
             }
             if (vartrue($parms['truncate'])) {
                 $value = $tp->text_truncate($value, $parms['truncate'], '...');
             } elseif (vartrue($parms['htmltruncate'])) {
                 $value = $tp->html_truncate($value, $parms['htmltruncate'], '...');
             }
             if (vartrue($parms['wrap'])) {
                 $value = $tp->htmlwrap($value, (int) $parms['wrap'], varset($parms['wrapChar'], ' '));
             }
             if (vartrue($parms['link']) && $id) {
                 $link = str_replace('[id]', $id, $parms['link']);
                 $link = $tp->replaceConstants($link);
                 // SEF URL is not important since we're in admin.
                 $dialog = vartrue($parms['target']) == 'dialog' ? " e-dialog" : "";
                 // iframe
                 $ext = vartrue($parms['target']) == 'blank' ? " rel='external' " : "";
                 // new window
                 $modal = vartrue($parms['target']) == 'modal' ? " data-toggle='modal' data-cache='false' data-target='#uiModal' " : "";
                 if ($parms['link'] == 'sef' && $this->getController()->getListModel()) {
                     $model = $this->getController()->getListModel();
                     // copy url config
                     if (!$model->getUrl()) {
                         $model->setUrl($this->getController()->getUrl());
                     }
                     // assemble the url
                     $link = $model->url();
                 } elseif (vartrue($data[$parms['link']])) {
                     $link = $tp->replaceConstants(vartrue($data[$parms['link']]));
                 }
                 // in case something goes wrong...
                 if ($link) {
                     $value = "<a class='e-tip{$dialog}' {$ext} href='" . $link . "' {$modal} title='Quick View' >" . $value . "</a>";
                 }
             }
             if (empty($value)) {
                 $value = '-';
                 $setValue = "data-value=''";
             } else {
                 $setValue = "";
                 if ($attributes['type'] == 'tags' && !empty($value)) {
                     $setValue = "data-value='" . $value . "'";
                     $value = str_replace(",", ", ", $value);
                     // add spaces so it wraps, but don't change the actual values.
                 }
             }
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
                 $value = "<a class='e-tip e-editable editable-click' data-emptytext='-' data-name='" . $field . "' title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='text' data-pk='" . $id . "' " . $setValue . " data-url='" . e_SELF . "?mode={$mode}&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>" . $value . "</a>";
             }
             $value = vartrue($parms['pre']) . $value . vartrue($parms['post']);
             break;
         case 'bbarea':
         case 'textarea':
             if ($attributes['type'] == 'textarea' && !vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 return $this->renderInline($field, $id, $attributes['title'], $value, substr($value, 0, 50) . "...", 'textarea');
                 //FIXME.
             }
             $expand = '...';
             $toexpand = false;
             if ($attributes['type'] == 'bbarea' && !isset($parms['bb'])) {
                 $parms['bb'] = true;
             }
             //force bb parsing for bbareas
             $elid = trim(str_replace('_', '-', $field)) . '-' . $id;
             if (!vartrue($parms['noparse'])) {
                 $value = $tp->toHTML($value, vartrue($parms['bb']) ? true : false, vartrue($parms['parse']));
             }
             if (vartrue($parms['expand']) || vartrue($parms['truncate']) || vartrue($parms['htmltruncate'])) {
                 $ttl = vartrue($parms['expand']);
                 if ($ttl == 1) {
                     $ttl = $expand . "<button class='btn btn-default btn-xs btn-mini pull-right'>More..</button>";
                     $ttl1 = "<button class='btn btn-default btn-xs btn-mini pull-right'>..Less</button>";
                 } else {
                     $ttl1 = null;
                 }
                 $expands = '<a href="#' . $elid . '-expand" class="e-show-if-js e-expandit">' . defset($ttl, $ttl) . "</a>";
                 $contracts = '<a href="#' . $elid . '-expand" class="e-show-if-js e-expandit">' . defset($ttl1, $ttl1) . "</a>";
             }
             $oldval = $value;
             if (vartrue($parms['truncate'])) {
                 $value = $oldval = strip_tags($value);
                 $value = $tp->text_truncate($value, $parms['truncate'], '');
                 $toexpand = $value != $oldval;
             } elseif (vartrue($parms['htmltruncate'])) {
                 $value = $tp->html_truncate($value, $parms['htmltruncate'], '');
                 $toexpand = $value != $oldval;
             }
             if ($toexpand) {
                 // force hide! TODO - core style .expand-c (expand container)
                 // TODO: Hide 'More..' button when text fully displayed.
                 $value .= '<span class="expand-c" style="display: none" id="' . $elid . '-expand"><span>' . str_replace($value, '', $oldval) . $contracts . '</span></span>';
                 $value .= $expands;
                 // 'More..' button. Keep it at the bottom so it does't cut the sentence.
             }
             break;
         case 'icon':
             $value = $tp->toIcon($value, array('size' => '2x'));
             break;
         case 'file':
             if (vartrue($parms['base'])) {
                 $url = $parms['base'] . $value;
             } else {
                 $url = e107::getParser()->replaceConstants($value, 'full');
             }
             $name = basename($value);
             $value = '<a href="' . $url . '" title="Direct link to ' . $name . '" rel="external">' . $name . '</a>';
             break;
         case 'image':
             //TODO - thumb, js tooltip...
             if ($value) {
                 if (strpos($value, ",") !== false) {
                     $tmp = explode(",", $value);
                     $value = $tmp[0];
                     unset($tmp);
                 }
                 $vparm = array('thumb' => 'tag', 'w' => vartrue($parms['thumb_aw'], '80'));
                 if ($video = e107::getParser()->toVideo($value, $vparm)) {
                     return $video;
                 }
                 $fileOnly = basename($value);
                 // Not an image but a file.  (media manager)
                 if (!preg_match("/\\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF)\$/", $fileOnly) && false !== strpos($fileOnly, '.')) {
                     $icon = "{e_IMAGE}filemanager/zip_32.png";
                     $src = $tp->replaceConstants(vartrue($parms['pre']) . $icon, 'abs');
                     //	return $value;
                     return e107::getParser()->toGlyph('fa-file', 'size=2x');
                     //		return '<img src="'.$src.'" alt="'.$value.'" class="e-thumb" title="'.$value.'" />';
                 }
                 if (vartrue($parms['thumb'])) {
                     $thparms = array();
                     // Support readParms example: thumb=1&w=200&h=300
                     // Support readParms example: thumb=1&aw=80&ah=30
                     if (isset($parms['h'])) {
                         $thparms['h'] = intval($parms['h']);
                     }
                     if (isset($parms['ah'])) {
                         $thparms['ah'] = intval($parms['ah']);
                     }
                     if (isset($parms['w'])) {
                         $thparms['w'] = intval($parms['w']);
                     }
                     if (isset($parms['aw'])) {
                         $thparms['aw'] = intval($parms['aw']);
                     }
                     // Support readParms example: thumb=200x300 (wxh)
                     if (strpos($parms['thumb'], 'x') !== false) {
                         list($thparms['w'], $thparms['h']) = explode('x', $parms['thumb']);
                     }
                     // Support readParms example: thumb={width}
                     if (!isset($parms['w']) && is_numeric($parms['thumb']) && '1' != $parms['thumb']) {
                         $thparms['w'] = intval($parms['thumb']);
                     } elseif (vartrue($parms['thumb_aw'])) {
                         $thparms['aw'] = intval($parms['thumb_aw']);
                     }
                     //	return print_a($thparms,true);
                     $src = $tp->replaceConstants(vartrue($parms['pre']) . $value, 'abs');
                     $thsrc = $tp->thumbUrl(vartrue($parms['pre']) . $value, $thparms, varset($parms['thumb_urlraw']));
                     $alt = basename($src);
                     $ttl = '<img src="' . $thsrc . '" alt="' . $alt . '" class="thumbnail e-thumb" />';
                     $value = '<a href="' . $src . '" data-modal-caption="' . $alt . '" data-target="#uiModal" class="e-modal e-image-preview" title="' . $alt . '" rel="external">' . $ttl . '</a>';
                 } 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}&amp;action=inline&amp;id={$id}&amp;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}&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>" . $dispvalue . "</a>";
             } else {
                 $value = $dispvalue;
             }
             unset($parms['classlist']);
             break;
             /*case 'user_name':
             		case 'user_loginname':
             		case 'user_login':
             		case 'user_customtitle':
             		case 'user_email':*/
         /*case 'user_name':
         		case 'user_loginname':
         		case 'user_login':
         		case 'user_customtitle':
         		case 'user_email':*/
         case 'user':
             /*if(is_numeric($value))
             		{
             			$value = e107::user($value);
             			if($value)
             			{
             				$value = $value[$attributes['type']] ? $value[$attributes['type']] : $value['user_name'];
             			}
             			else
             			{
             				$value = 'not found';
             			}
             		}*/
             $row_id = $id;
             // Dirty, but the only way for now
             $id = 0;
             $ttl = LAN_ANONYMOUS;
             //Defaults to user_id and user_name (when present) and when idField and nameField are not present.
             // previously set - real parameters are idField && nameField
             $id = vartrue($parms['__idval']);
             if ($value && !is_numeric($value)) {
                 $id = vartrue($parms['__idval']);
                 $ttl = $value;
             } elseif ($value && is_numeric($value)) {
                 $id = $value;
                 if (vartrue($parms['__nameval'])) {
                     $ttl = $parms['__nameval'];
                 } else {
                     $user = e107::user($value);
                     if (vartrue($user['user_name'])) {
                         $ttl = $user['user_name'];
                     }
                 }
             }
             if (!empty($parms['link']) && $id && $ttl && is_numeric($id)) {
                 // Stay in admin area.
                 $link = e_ADMIN . "users.php?mode=main&action=edit&id=" . $id . "&readonly=1&iframe=1";
                 // e107::getUrl()->create('user/profile/view', array('id' => $id, 'name' => $ttl))
                 $value = '<a class="e-modal" data-modal-caption="User #' . $id . ' : ' . $ttl . '" href="' . $link . '" title="Go to user profile">' . $ttl . '</a>';
             } else {
                 $value = $ttl;
             }
             // Inline Editing.
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 // Need a Unique Field ID to store field settings using e107::js('settings').
                 $fieldID = $this->name2id($field . '_' . microtime(true));
                 // Unique ID for each rows.
                 $eEditableID = $this->name2id($fieldID . '_' . $row_id);
                 $tpl = $this->userpicker($field, '', $ttl, $id, array('id' => $fieldID, 'selectize' => array('e_editable' => $eEditableID)));
                 $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
                 $value = "<a id='" . $eEditableID . "' class='e-tip e-editable editable-click editable-userpicker' data-clear='false' data-tpl='" . str_replace("'", '"', $tpl) . "' data-name='" . $field . "' title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='text' data-pk='" . $row_id . "' data-value='" . $id . "' data-url='" . e_SELF . "?mode={$mode}&amp;action=inline&amp;id={$row_id}&amp;ajax_used=1' href='#'>" . $ttl . "</a>";
             }
             break;
         case 'bool':
         case 'boolean':
             $false = vartrue($parms['trueonly']) ? "" : ADMIN_FALSE_ICON;
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 if (isset($parms['false'])) {
                     $false = $parms['false'];
                 } else {
                     $false = $value === '' ? "&square;" : "&cross;";
                 }
                 $true = varset($parms['true'], '&check;');
                 // custom representation for 'true'. (supports font-awesome when set by css)
                 $value = intval($value);
                 $wparms = vartrue($parms['reverse']) ? array(0 => $true, 1 => $false) : array(0 => $false, 1 => $true);
                 $dispValue = $wparms[$value];
                 return $this->renderInline($field, $id, $attributes['title'], $value, $dispValue, 'select', $wparms);
             }
             if (vartrue($parms['reverse'])) {
                 $value = $value ? $false : ADMIN_TRUE_ICON;
             } else {
                 $value = $value ? ADMIN_TRUE_ICON : $false;
             }
             break;
         case 'url':
             if (!$value) {
                 break;
             }
             $ttl = $value;
             if (vartrue($parms['href'])) {
                 return $tp->replaceConstants(vartrue($parms['pre']) . $value, varset($parms['replace_mod'], 'abs'));
             }
             if (vartrue($parms['truncate'])) {
                 $ttl = $tp->text_truncate($value, $parms['truncate'], '...');
             }
             $value = "<a href='" . $tp->replaceConstants(vartrue($parms['pre']) . $value, 'abs') . "' title='{$value}'>" . $ttl . "</a>";
             break;
         case 'email':
             if (!$value) {
                 break;
             }
             $ttl = $value;
             if (vartrue($parms['truncate'])) {
                 $ttl = $tp->text_truncate($value, $parms['truncate'], '...');
             }
             $value = "<a href='mailto:" . $value . "' title='{$value}'>" . $ttl . "</a>";
             break;
         case 'method':
             // Custom Function
             $method = $attributes['field'];
             // prevents table alias in method names. ie. u.my_method.
             $_value = $value;
             if ($attributes['data'] == 'array') {
                 $value = e107::unserialize($value);
                 // (saved as array, return it as an array)
             }
             $meth = !empty($attributes['method']) ? $attributes['method'] : $method;
             if (method_exists($this, $meth)) {
                 $parms['field'] = $field;
                 $value = call_user_func_array(array($this, $meth), array($value, 'read', $parms));
             } else {
                 return "<span class='label label-important label-danger'>Missing: " . $method . "()</span>";
             }
             //	 print_a($attributes);
             // Inline Editing.
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable'])) {
                 $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
                 $methodParms = call_user_func_array(array($this, $method), array($value, 'inline', $parms));
                 if (!empty($methodParms['inlineType'])) {
                     $attributes['inline'] = $methodParms['inlineType'];
                     $methodParms = !empty($methodParms['inlineData']) ? $methodParms['inlineData'] : null;
                 }
                 if (is_string($attributes['inline'])) {
                     switch ($attributes['inline']) {
                         case 'checklist':
                             $xtype = 'checklist';
                             break;
                         case 'select':
                         case 'dropdown':
                             $xtype = 'select';
                             break;
                         case 'textarea':
                             $xtype = 'textarea';
                             break;
                         default:
                             $xtype = 'text';
                             $methodParms = null;
                             break;
                     }
                 }
                 if (!empty($xtype)) {
                     $value = $this->renderInline($field, $id, $attributes['title'], $_value, $value, $xtype, $methodParms);
                 }
             }
             break;
         case 'hidden':
             return vartrue($parms['show']) ? $value ? $value : vartrue($parms['empty']) : '';
             break;
         case 'language':
             // All Known Languages.
             if (!empty($value)) {
                 $_value = $value;
                 if (strlen($value) === 2) {
                     $value = e107::getLanguage()->convert($value);
                 }
             }
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable'])) {
                 $wparms = e107::getLanguage()->getList();
                 return $this->renderInline($field, $id, $attributes['title'], $_value, $value, 'select', $wparms);
             }
             return $value;
             break;
         case 'lanlist':
             // installed languages.
             $options = e107::getLanguage()->getLanSelectArray();
             if ($options) {
                 if (!is_array($attributes['writeParms'])) {
                     parse_str($attributes['writeParms'], $attributes['writeParms']);
                 }
                 $wparms = $attributes['writeParms'];
                 if (!is_array(varset($wparms['__options']))) {
                     parse_str($wparms['__options'], $wparms['__options']);
                 }
                 $opts = $wparms['__options'];
                 if ($opts['multiple']) {
                     $ret = array();
                     $value = is_array($value) ? $value : explode(',', $value);
                     foreach ($value as $v) {
                         if (isset($options[$v])) {
                             $ret[] = $options[$v];
                         }
                     }
                     $value = implode(', ', $ret);
                 } else {
                     $ret = '';
                     if (isset($options[$value])) {
                         $ret = $options[$value];
                     }
                     $value = $ret;
                 }
                 $value = $value ? vartrue($parms['pre']) . $value . vartrue($parms['post']) : '';
             } else {
                 $value = '';
             }
             break;
             //TODO - order
         //TODO - order
         default:
             //unknown type
             break;
     }
     return $value;
 }
Example #10
0
 function renderBatchFilter($type = 'batch', $selected = '')
 {
     $optdiz = array('batch' => LAN_BATCH_LABEL_PREFIX . '&nbsp;', 'filter' => LAN_FILTER_LABEL_PREFIX . '&nbsp;');
     $table = $this->getController()->getTableName();
     $text = '';
     $textsingle = '';
     foreach ($this->getController()->getFields() as $key => $val) {
         if (!varset($val[$type])) {
             continue;
         }
         $option = array();
         $parms = vartrue($val['writeParms'], array());
         if (is_string($parms)) {
             parse_str($parms, $parms);
         }
         switch ($val['type']) {
             case 'bool':
             case 'boolean':
                 //TODO modify description based on $val['parm]
                 if (vartrue($parms['reverse'])) {
                     $option['bool__' . $key . '__0'] = LAN_YES;
                     // see newspost.php : news_allow_comments for an example.
                     $option['bool__' . $key . '__1'] = LAN_NO;
                 } else {
                     $option['bool__' . $key . '__1'] = LAN_YES;
                     $option['bool__' . $key . '__0'] = LAN_NO;
                 }
                 if ($type == 'batch') {
                     $option['boolreverse__' . $key] = LAN_BOOL_REVERSE;
                 }
                 break;
             case 'checkboxes':
             case 'comma':
                 // TODO lan
                 if (!isset($parms['__options'])) {
                     $parms['__options'] = array();
                 }
                 if (!is_array($parms['__options'])) {
                     parse_str($parms['__options'], $parms['__options']);
                 }
                 $opts = $parms['__options'];
                 unset($parms['__options']);
                 //remove element options if any
                 $options = $parms ? $parms : array();
                 if (empty($options)) {
                     continue;
                 }
                 if ($type == 'batch') {
                     $_option = array();
                     if (isset($options['addAll'])) {
                         $option['attach_all__' . $key] = vartrue($options['addAll'], '(add all)');
                         unset($options['addAll']);
                     }
                     if (isset($options['clearAll'])) {
                         $_option['deattach_all__' . $key] = vartrue($options['clearAll'], '(clear all)');
                         unset($options['clearAll']);
                     }
                     if (vartrue($opts['simple'])) {
                         foreach ($options as $value) {
                             $option['attach__' . $key . '__' . $value] = 'Add ' . $value;
                             $_option['deattach__' . $key . '__' . $value] = 'Remove ' . $value;
                         }
                     } else {
                         foreach ($options as $value => $label) {
                             $option['attach__' . $key . '__' . $value] = 'Add ' . $label;
                             $_option['deattach__' . $key . '__' . $value] = 'Remove ' . $label;
                         }
                     }
                     $option = array_merge($option, $_option);
                     unset($_option);
                 } else {
                     unset($options['addAll'], $options['clearAll']);
                     if (vartrue($opts['simple'])) {
                         foreach ($options as $k) {
                             $option[$key . '__' . $k] = $k;
                         }
                     } else {
                         foreach ($options as $k => $name) {
                             $option[$key . '__' . $k] = $name;
                         }
                     }
                 }
                 break;
             case 'templates':
             case 'layouts':
                 $parms['raw'] = true;
                 $val['writeParms'] = $parms;
                 $tmp = $this->renderElement($key, '', $val);
                 if (is_array($tmp)) {
                     foreach ($tmp as $k => $name) {
                         $option[$key . '__' . $k] = $name;
                     }
                 }
                 break;
             case 'dropdown':
                 // use the array $parm;
                 if (!empty($parms['optArray'])) {
                     $fopts = $parms;
                     $parms = $fopts['optArray'];
                     unset($fopts['optArray']);
                     $parms['__options'] = $fopts;
                 }
                 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;
                 }
                 unset($parms['__options']);
                 //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;
                     }
                     // non rendered options array
                     foreach ($list as $k => $name) {
                         $option[$key . '__' . $k] = $name;
                     }
                 } elseif (!empty($list)) {
                     $text .= $list;
                     continue;
                 }
                 break;
             case 'user':
                 // TODO - User Filter
                 $sql = e107::getDb();
                 $field = $val['field'];
                 $query = "SELECT d." . $field . ", u.user_name FROM #" . $val['table'] . " AS d LEFT JOIN #user AS u ON d." . $field . " = u.user_id  GROUP BY d." . $field . " ORDER BY u.user_name";
                 $row = $sql->retrieve($query, true);
                 foreach ($row as $data) {
                     $k = $data[$field];
                     if ($k == 0) {
                         $option[$key . '__' . $k] = "(" . LAN_ANONYMOUS . ")";
                     } else {
                         $option[$key . '__' . $k] = vartrue($data['user_name'], 'Unknown');
                     }
                 }
                 break;
         }
         if (count($option) > 0) {
             $text .= "\t" . $this->optgroup_open($optdiz[$type] . defset($val['title'], $val['title']), varset($disabled)) . "\n";
             foreach ($option as $okey => $oval) {
                 $text .= $this->option($oval, $okey, $selected == $okey) . "\n";
             }
             $text .= "\t" . $this->optgroup_close() . "\n";
         }
     }
     return $textsingle . $text;
 }
Example #11
0
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;
}
Example #12
0
 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());
             }
         }
         if ($addOutbox) {
             $info['pm_to'] = $toclass;
             // Class info to put into outbox
             $info['pm_sent_del'] = 0;
             $info['pm_read_del'] = 1;
             if (!($pmid = $sql->insert('private_msg', $info))) {
                 $ret .= LAN_PM_41 . '<br />';
             }
         }
     } else {
         // Sending to a single person
         $info['pm_to'] = intval($vars['to_info']['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);
             if (check_class($this->pmPrefs['notify_class'], $vars['to_info']['user_class'])) {
                 set_time_limit(30);
                 $this->pm_send_notify($vars['to_info']['user_id'], $vars, $pmid, count($a_list));
             }
             $ret .= LAN_PM_40 . ": {$vars['to_info']['user_name']}<br />";
         }
     }
     return $ret;
 }
Example #13
0
 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;
 }
Example #14
0
 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);
 }
Example #15
0
 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, '');
     }
 }
Example #16
0
 function __construct($enable_tabindex = false)
 {
     $this->_tabindex_enabled = $enable_tabindex;
     $this->_uc = e107::getUserClass();
     $this->setRequiredString('<span class="required">*&nbsp;</span>');
 }
Example #17
0
 public function sc_pm_form_toclass()
 {
     if (vartrue($this->var['from_name'])) {
         return '';
     }
     $ret = "";
     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." ";
         $ret = "<div class='input-group'><span class='input-group-addon'>" . e107::getForm()->checkbox('to_userclass', 1, false, LAN_PM_4) . "</span>";
         $args = ADMIN ? 'admin, classes' : 'classes, matchclass';
         if (check_class($this->pmPrefs['sendall_class'])) {
             $args = 'member, ' . $args;
         }
         $ret .= e107::getUserClass()->uc_dropdown('pm_userclass', '', $args) . "</div>";
         if (strpos($ret, 'option') === FALSE) {
             $ret = '';
         }
     }
     return $ret;
 }
Example #18
0
 }
 // Validate Extended User Fields.
 $changedEUFData = array();
 if (isset($_POST['ue'])) {
     $eufVals = $ue->userExtendedValidateAll($_POST['ue'], varset($_POST['hide'], TRUE));
     // Validate the extended user fields
     $changedEUFData['data'] = validatorClass::findChanges($eufVals['data'], $udata, FALSE);
 }
 // Determine whether we have an error
 $error = isset($allData['errors']) && count($allData['errors']) || isset($eufVals['errors']) && count($eufVals['errors']) || count($extraErrors);
 // Update Userclass - only if its the user changing their own data (admins can do it another way)
 if (isset($allData['data']['user_class'])) {
     unset($changedUserData['user_class']);
     // We always recalculate this
     if (FALSE === $adminEdit) {
         $e_userclass = e107::getUserClass();
         $ucList = $e_userclass->get_editable_classes(USERCLASS_LIST, TRUE);
         // List of classes which this user can edit
         if (count($ucList)) {
             $nid = $e_userclass->mergeClassLists($udata['user_class'], $ucList, $allData['data']['user_class'], TRUE);
             $nid = $e_userclass->stripFixedClasses($nid);
             $nid = implode(',', $nid);
             //	echo "Userclass data - new: {$nid}, old: {$udata['user_baseclasslist']}, editable: ".implode(',',$ucList).", entered: {$allData['data']['user_class']}<br />";
             if ($nid != $udata['user_baseclasslist']) {
                 if (US_DEBUG) {
                     $admin_log->e_log_event(10, debug_backtrace(), "DEBUG", "Usersettings test", "Write back classes; old list: {$udata['user_class']}; new list: " . $nid, false, LOG_TO_ROLLING);
                 }
                 $changedUserData['user_class'] = $nid;
             }
         }
     }
Example #19
0
 function renderBatchFilter($type = 'batch', $selected = '')
 {
     $optdiz = array('batch' => LAN_BATCH_LABEL_PREFIX . '&nbsp;', 'filter' => LAN_FILTER_LABEL_PREFIX . '&nbsp;');
     $table = $this->getController()->getTableName();
     $text = '';
     $textsingle = '';
     foreach ($this->getController()->getFields() as $key => $val) {
         if (!varset($val[$type])) {
             continue;
         }
         $option = array();
         $parms = vartrue($val['writeParms'], array());
         if (is_string($parms)) {
             parse_str($parms, $parms);
         }
         switch ($val['type']) {
             case 'bool':
             case 'boolean':
                 //TODO modify description based on $val['parm]
                 if (vartrue($parms['reverse'])) {
                     $option['bool__' . $key . '__0'] = LAN_YES;
                     // see newspost.php : news_allow_comments for an example.
                     $option['bool__' . $key . '__1'] = LAN_NO;
                 } else {
                     $option['bool__' . $key . '__1'] = LAN_YES;
                     $option['bool__' . $key . '__0'] = LAN_NO;
                 }
                 if ($type == 'batch') {
                     $option['boolreverse__' . $key] = LAN_BOOL_REVERSE;
                 }
                 break;
             case 'templates':
             case 'layouts':
                 $parms['raw'] = true;
                 $val['writeParms'] = $parms;
                 $tmp = $this->renderElement($key, '', $val);
                 foreach ($tmp as $k => $name) {
                     $option[$key . '__' . $k] = $name;
                 }
                 break;
             case 'dropdown':
                 // 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;
                 }
                 unset($parms['__options']);
                 //remove element options if any
                 foreach ($parms as $k => $name) {
                     $option[$key . '__' . $k] = $name;
                 }
                 break;
             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 = e107::getLanguage()->getLanSelectArray();
                 foreach ($options as $code => $name) {
                     $option[$key . '__' . $code] = $name;
                 }
                 break;
             case 'datestamp':
                 // use $parm to determine unix-style or YYYY-MM-DD
                 //TODO last hour, today, yesterday, this-month, last-month etc.
                 /*	foreach($val['parm'] as $k=>$name)
                 			{
                 				$text .= $frm->option($name, $type.'__'.$key."__".$k);
                 			}*/
                 break;
             case 'userclass':
             case 'userclasses':
                 $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 '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;
                     }
                     // non rendered options array
                     foreach ($list as $k => $name) {
                         $option[$key . '__' . $k] = $name;
                     }
                 } elseif (!empty($list)) {
                     $text .= $list;
                     continue;
                 }
                 break;
             case 'user':
                 // TODO - User Filter
                 //$option[$key.'__'.$k] = $name;
                 break;
         }
         if (count($option) > 0) {
             $text .= "\t" . $this->optgroup_open($optdiz[$type] . defset($val['title'], $val['title']), varset($disabled)) . "\n";
             foreach ($option as $okey => $oval) {
                 $text .= $this->option($oval, $okey, $selected == $okey) . "\n";
             }
             $text .= "\t" . $this->optgroup_close() . "\n";
         }
     }
     return $textsingle . $text;
 }
Example #20
0
 function show_mods()
 {
     global $for;
     $ns = e107::getRender();
     $sql = e107::getDB();
     //$e107 = e107::getInstance();
     $forumList = $for->forum_getforums('all');
     $parentList = $for->forum_getparents('list');
     $subList = $for->forumGetSubs('bysub');
     $frm = e107::getForm();
     $tp = e107::getParser();
     $txt = "<form method='post' action='" . e_SELF . "?" . e_QUERY . "'>\n\t\t<table class='table adminlist'>\n\t\t<colgroup span='2'>\n    \t\t<col class='col-label' />\n    \t\t<col class='col-control' />\n    \t</colgroup>";
     foreach ($parentList as $p) {
         $txt .= "\n\t\t\t<tr>\n\t\t\t\t<td colspan='2' ><strong>" . $tp->toHTML($p['forum_name']) . "</strong></td>\n\t\t\t</tr>\n\t\t\t";
         foreach ($forumList[$p['forum_id']] as $f) {
             $txt .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td>{$f['forum_name']}</td>\n\t\t\t\t\t<td>" . e107::getUserClass()->uc_dropdown("mods[{$f['forum_id']}]", $f['forum_moderators'], 'admin,classes') . "</td>\n\t\t\t\t</tr>\n\t\t\t\t";
             foreach ($subList[$f['forum_id']] as $s) {
                 $txt .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>&nbsp;&nbsp;&nbsp;&nbsp;{$s['forum_name']}</td>\n\t\t\t\t\t\t<td>" . e107::getUserClass()->uc_dropdown("mods[{$s['forum_id']}]", $s['forum_moderators'], 'admin,classes') . "</td>\t\n\t\t\t\t\t</tr>\n\t\t\t\t\t";
             }
         }
     }
     $txt .= "\n\t\t\t</table>\n\t\t\t<div class='buttons-bar center'>\n\t\t\t\t" . $frm->admin_button('setMods', LAN_UPDATE, 'update') . "\n\t\t\t</div>\n\t\t\t</form>";
     $ns->tablerender(LAN_FORUM_2003, $txt);
 }
Example #21
0
 public function __get($name)
 {
     switch ($name) {
         case 'tp':
             $ret = e107::getParser();
             break;
         case 'sql':
             $ret = e107::getDb();
             break;
         case 'ecache':
             $ret = e107::getCache();
             break;
         case 'arrayStorage':
             $ret = e107::getArrayStorage();
             break;
         case 'e_event':
             $ret = e107::getEvent();
             break;
         case 'ns':
             $ret = e107::getRender();
             break;
         case 'url':
             $ret = e107::getUrl();
             break;
         case 'admin_log':
             $ret = e107::getAdminLog();
             break;
         case 'override':
             $ret = e107::getSingleton('override', e_HANDLER . 'override_class.php');
             break;
         case 'notify':
             $ret = e107::getNotify();
             break;
         case 'e_online':
             $ret = e107::getOnline();
             break;
         case 'eIPHandler':
             $ret = e107::getIPHandler();
             break;
         case 'user_class':
             $ret = e107::getUserClass();
             break;
         default:
             trigger_error('$e107->$' . $name . ' not defined', E_USER_WARNING);
             return null;
             break;
     }
     $this->{$name} = $ret;
     return $ret;
 }
Example #22
0
 /**
  *	Generate an array of all the basic classes a user belongs to
  *
  *	Note that the passed data may relate to the currently logged in user, or if an admin is logged in, to a different user
  *
  *	@param array $userData - user's data record - must include the 'user_class' element
  *	@param boolean $asArray if TRUE, returns results in an array; else as a comma-separated string
  *	@param boolean $incInherited if TRUE, includes inherited classes
  *	@param boolean $fromAdmin - if TRUE, adds e_UC_ADMIN and e_UC_MAINADMIN in if current user's entitlement permits
  *
  *	@return array|string of userclass information according to $asArray
  */
 public function addCommonClasses($userData, $asArray = FALSE, $incInherited = FALSE, $fromAdmin = FALSE)
 {
     if ($incInherited) {
         $classList = e107::getUserClass()->get_all_user_classes($userData['user_class']);
     } else {
         if ($userData['user_class'] != '') {
             $classList = explode(',', $userData['user_class']);
         }
     }
     foreach (array(e_UC_MEMBER, e_UC_READONLY, e_UC_PUBLIC) as $c) {
         if (!in_array($c, vartrue($classList))) {
             $classList[] = $c;
         }
     }
     if (varset($userData['user_admin'], 0) == 1 && strlen($userData['user_perms']) || $fromAdmin && ADMIN) {
         $classList[] = e_UC_ADMIN;
         if (strpos($userData['user_perms'], '0') === 0 || getperms('0')) {
             $classList[] = e_UC_MAINADMIN;
         }
     }
     if ($asArray) {
         return $classList;
     }
     return implode(',', $classList);
 }
Example #23
0
 function render_event($id, $description, $include = '', $legacy = 0)
 {
     $tp = e107::getParser();
     $frm = e107::getForm();
     $uc = e107::getUserClass();
     $uc->fixed_classes['email'] = 'Email Address =>';
     $uc->text_class_link['email'] = 'email';
     if (defined($description)) {
         $description = constant($description);
     }
     $highlight = varset($_GET['type']) == $id ? " class='text-warning'" : '';
     $text = "\n\t\t\t<tr>\n\t\t\t\t<td title='" . $id . "'><span{$highlight}>" . $description . ":</span></td>\n\t\t\t\t<td  class='form-inline nowrap'>\n\t\t\t\t" . $uc->uc_dropdown('event[' . $id . '][class]', varset($this->notify_prefs['event'][$id]['class'], e_UC_NOBODY), "nobody,main,admin,member,classes,email", "onchange=\"mail_field(this.value,'event_" . $id . "');\" ");
     if ($this->notify_prefs['event'][$id]['class'] == 'email') {
         $disp = 'display:visible';
         $value = $tp->toForm($this->notify_prefs['event'][$id]['email']);
     } else {
         $disp = "display:none";
         $value = "";
     }
     $text .= "<input type='text' style='width:200px;{$disp}' class='tbox' id='event_" . $id . "' name='event[" . $id . "][email]' value=\"" . $value . "\" />\n";
     $text .= $frm->hidden("event[" . $id . "][include]", $include);
     $text .= $frm->hidden("event[" . $id . "][legacy]", $legacy);
     // function or method
     if (isset($this->notify_prefs['event'][$id]['class']) && $this->notify_prefs['event'][$id]['class'] != e_UC_NOBODY) {
         $text .= $frm->button('test[' . $id . ']', $id, 'confirm', 'Test');
     }
     $text .= "</td>\n\t\t</tr>";
     return $text;
 }
Example #24
0
 public function initialPage()
 {
     $pref = e107::pref('core');
     $mes = e107::getMessage();
     $ns = e107::getRender();
     $frm = e107::getForm();
     //		$e_userclass    = $this->getUserClassAdmin();
     $text = "";
     $initial_classes = varset($pref['initial_user_classes'], '');
     $irc = explode(',', $initial_classes);
     $icn = array();
     foreach ($irc as $i) {
         if (trim($i)) {
             $icn[] = e107::getUserClass()->getName($i);
         }
     }
     $class_text = $frm->userclass('init_classes', $initial_classes, 'checkbox', array('options' => 'classes,force'));
     //	$class_text = e107::getUserClass()->uc_checkboxes('init_classes', $initial_classes, 'classes, force', TRUE);
     //	$class_text = e107::getUserClass()->vetted_tree('init_classes',array($e_userclass,'checkbox_desc'), $initial_classes, 'classes, force, no-excludes');
     $mes->addInfo(UCSLAN_49);
     $text = "<div>\n\t\t\t<form method='post' action='" . e_SELF . "?mode=main&action=initial' id='initialForm'>\n\t\t\t<table class='table table-bordered adminform'>\n\t\t\t<tr><td>" . UCSLAN_43 . "</td><td>";
     if (count($icn) > 0) {
         //  $text .= implode(', ',$icn);
     } else {
         $text .= UCSLAN_44;
     }
     if ($class_text) {
         $text .= $class_text . "</td></tr><tr><td>";
         $sel_stage = varset($pref['init_class_stage'], 2);
         $initClassStages = array(1 => UCSLAN_47, 2 => UCSLAN_48);
         $text .= UCSLAN_45 . "<br />\t</td>\n\t\t\t\t    <td>" . $frm->select('init_class_stage', $initClassStages, $sel_stage) . "<span class='field-help'>" . UCSLAN_46 . "</span>\n\n\t\t\t\t    </td></tr></table>\n\t\t\t\t    <div class='buttons-bar'>" . $frm->admin_button('set_initial_classes', 'no-value', 'create', LAN_UPDATE) . "</div>";
     } else {
         $text .= UCSLAN_39;
     }
     $text .= "</td></tr></table></form></div>";
     return $mes->render() . $text;
     //	$ns->tablerender(ADLAN_38.SEP.UCSLAN_40, $mes->render() . $text);
 }
Example #25
0
 /**
  * Quick add user page
  */
 function AddPage()
 {
     $prm = e107::getUserPerms();
     //$list = $prm->getPermList();
     $frm = e107::getForm();
     $e_userclass = e107::getUserClass();
     $pref = e107::getPref();
     $user_data = $this->getParam('user_data');
     // 	$this->addTitle(LAN_USER_QUICKADD);
     $text = "<div>" . $frm->open("core-user-adduser-form", null, null, 'autocomplete=0') . "\r\n\t\t<fieldset id='core-user-adduser'>\r\n        <table class='table adminform'>\r\n\t\t<colgroup>\r\n\t\t<col class='col-label' />\r\n\t\t<col class='col-control' />\r\n\t\t</colgroup>\r\n\t\t<tr>\r\n\t\t\t<td>" . USRLAN_61 . "</td>\r\n\t\t\t<td>\r\n\t\t\t" . $frm->text('username', varset($user_data['user_name']), varset($pref['displayname_maxlength'], 15)) . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\r\n\t\t<tr>\r\n\t\t\t<td>" . USRLAN_128 . "</td>\r\n\t\t\t<td ><div class='form-inline'>\r\n\t\t\t" . $frm->text('loginname', varset($user_data['user_loginname']), varset($pref['loginname_maxlength'], 30)) . "&nbsp;&nbsp;\r\n\t\t\t" . $frm->checkbox_label(USRLAN_170, 'generateloginname', 1, varset($pref['predefinedLoginName'], false)) . "\r\n\t\t\t</div></td>\r\n\t\t</tr>\r\n\r\n\t\t<tr>\r\n\t\t\t<td>" . USRLAN_129 . "</td>\r\n\t\t\t<td>\r\n\t\t\t" . $frm->text('realname', varset($user_data['user_login']), 30) . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\r\n\t\t<tr>\r\n\t\t\t<td>" . LAN_PASSWORD . "</td>\r\n\t\t\t<td>" . $frm->password('password', '', 20, array('size' => 40, 'class' => 'tbox e-password', 'generate' => 1, 'strength' => 1)) . "\r\n\t\t\t</td>\r\n\t\t</tr>";
     $text .= "\r\n\t\t\t<tr>\r\n\t\t\t\t<td>" . USRLAN_64 . "</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t" . $frm->text('email', varset($user_data['user_email']), 100) . "\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\r\n\t\t\t<tr>\r\n\t\t\t\t<td>" . USRLAN_239 . "</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t" . $frm->select('sendconfemail', array('0' => USRLAN_240, '1' => USRLAN_241, '2' => USRLAN_242), (int) varset($_POST['sendconfemail'], 0)) . "\r\n\t\t\t\t\t<div class='field-help'>" . USRLAN_181 . "</div>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>";
     if (!isset($user_data['user_class'])) {
         $user_data['user_class'] = varset($pref['initial_user_classes']);
     }
     $temp = $e_userclass->vetted_tree('class', array($e_userclass, 'checkbox_desc'), $user_data['user_class'], 'classes, no-excludes');
     if ($temp) {
         $text .= "<tr style='vertical-align:top'>\r\n\t\t\t<td>\r\n\t\t\t\t" . USRLAN_120 . "\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='#set_class' class='btn btn-default e-expandit'>" . USRLAN_120 . "</a>\r\n\t\t\t\t<div class='e-hideme' id='set_class'>\r\n\t\t\t\t{$temp}\r\n\t\t\t\t</div>\r\n\t\t\t</td>\r\n\t\t\t</tr>\n";
     }
     // Make Admin.
     $text .= "\r\n\t\t<tr>\r\n\t\t\t<td>" . USRLAN_35 . "</td>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='#set_perms' class='btn btn-default e-expandit'>" . USRLAN_243 . "</a>\r\n\t\t\t\t<div class='e-hideme' id='set_perms'>\r\n\t\t";
     $text .= $prm->renderPermTable('grouped');
     $text .= "\r\n\t\t\t\t</div>\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t";
     $text .= "\r\n\r\n\t\t</table>\r\n\t\t<div class='buttons-bar center'>\r\n\t\t\t" . $frm->admin_trigger('submit', USRLAN_60, 'create') . "\r\n\t\t\t" . $frm->token() . "\r\n\t\t\t<input type='hidden' name='ac' value='" . md5(ADMINPWCHANGE) . "' />\r\n\t\t</div>\r\n\t\t</fieldset>\r\n\t\t</form>\r\n\t\t</div>\r\n\t\t";
     return $text;
     //$ns->tablerender(USRLAN_59,$mes->render().$text);
 }