Ejemplo n.º 1
0
function MG_navbar($selected = '', $album_id)
{
    global $_CONF, $_MG_CONF, $LANG_MG01, $LANG_MG03, $glversion;
    USES_class_navbar();
    $T = new Template(MG_getTemplatePath($album_id));
    $T->set_file(array('upload' => 'upload.thtml'));
    $T->set_var(array('lang_upload_media' => $LANG_MG03['upload_media']));
    $T->parse('output', 'upload');
    $retval = $T->finish($T->get_var('output'));
    $navbar = new navbar();
    $navbar->add_menuitem($LANG_MG01['html5upload_media'], $_MG_CONF['site_url'] . '/admin.php?mode=upload&album_id=' . $album_id);
    $navbar->add_menuitem($LANG_MG01['browser_upload'], $_MG_CONF['site_url'] . '/admin.php?mode=browser&album_id=' . $album_id);
    if (SEC_hasRights('mediagallery.admin')) {
        $navbar->add_menuitem($LANG_MG01['ftp_media'], $_MG_CONF['site_url'] . '/admin.php?mode=import&album_id=' . $album_id);
    }
    $navbar->add_menuitem($LANG_MG01['remote_media'], $_MG_CONF['site_url'] . '/admin.php?mode=remote&album_id=' . $album_id);
    $navbar->set_selected($selected);
    $retval .= $navbar->generate();
    $retval .= '<br />';
    return $retval;
}
Ejemplo n.º 2
0
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            |
// | GNU General Public License for more details.                             |
// |                                                                          |
// | You should have received a copy of the GNU General Public License        |
// | along with this program; if not, write to the Free Software Foundation,  |
// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.          |
// |                                                                          |
// +--------------------------------------------------------------------------+
require_once '../../../lib-common.php';
require_once '../../auth.inc.php';
include_once $_CONF['path'] . 'plugins/filemgmt/include/header.php';
include_once $_CONF['path'] . 'plugins/filemgmt/include/functions.php';
include_once $_CONF['path'] . 'plugins/filemgmt/include/xoopstree.php';
include_once $_CONF['path'] . 'plugins/filemgmt/include/textsanitizer.php';
include_once $_CONF['path'] . 'plugins/filemgmt/include/errorhandler.php';
USES_class_navbar();
USES_lib_admin();
$op = isset($_REQUEST['op']) ? COM_applyFilter($_REQUEST['op']) : '';
$display = '';
if (!SEC_hasRights('filemgmt.edit')) {
    if ($op != 'comment') {
        $display .= COM_siteHeader('menu');
        $display .= COM_startBlock(_GL_ERRORNOACCESS);
        $display .= _MD_USER . " " . $_USER['username'] . " " . _GL_NOUSERACCESS;
        $display .= COM_endBlock();
        $display .= COM_siteFooter();
        echo $display;
        exit;
    }
}
function filemgmt_navbar($selected = '')
Ejemplo n.º 3
0
 /**
  *  Creates the edit form
  *  @param integer $id Optional ID, current record used if zero
  *  @return string HTML for edit form
  */
 public function Edit($eid = '', $rp_id = 0, $saveaction = '')
 {
     global $_CONF, $_EV_CONF, $_TABLES, $_USER, $LANG_EVLIST, $LANG_ADMIN, $_GROUPS, $LANG_ACCESS, $_SYSTEM;
     // If an eid is specified and this is an object, then read the
     // event data- UNLESS a repeat ID is given in which case we're
     // editing a repeat and already have the info we need.
     // This probably needs to change, since we should always read event
     // data during construction.
     if (!$this->isSubmitter) {
         // At least submit privilege required
         COM_404();
     } elseif ($eid != '' && $rp_id == 0 && is_object($this)) {
         // If an id is passed in, then read that record
         if (!$this->Read($eid)) {
             return 'Invalid object ID';
         }
     } elseif (isset($_POST['eid']) && !empty($_POST['eid'])) {
         // Returning to an existing form, probably due to errors
         $this->SetVars($_POST);
         // Make sure the current user has access to this event.
         if (!$this->hasAccess(3)) {
             COM_404();
         }
     }
     $T = new Template($_CONF['path'] . 'plugins/evlist/templates/');
     if ($_SYSTEM['disable_jquery_slimbox']) {
         $T->set_file('editor', 'editor.uikit.thtml');
     } else {
         $T->set_file('editor', 'editor.thtml');
     }
     // Basic tabs for editing both events and instances, show up on
     // all edit forms
     //$tabs = array('ev_info', 'ev_schedule', 'ev_location', 'ev_contact',);
     $tabs = array('ev_info', 'ev_location', 'ev_contact');
     $rp_id = (int) $rp_id;
     if ($rp_id > 0) {
         // Make sure the current user has access to this event.
         if (!$this->hasAccess(3)) {
             COM_404();
         }
         if ($saveaction == 'savefuturerepeat') {
             $alert_msg = EVLIST_alertMessage($LANG_EVLIST['editing_future'], 'warning');
         } else {
             $alert_msg = EVLIST_alertMessage($LANG_EVLIST['editing_instance'], 'info');
         }
         //$T->clear_var('contact_section');
         $T->clear_var('category_section');
         $T->clear_var('permissions_editor');
         // Set the static calendar name for the edit form.  Can't
         // change it for a single instance.
         $cal_name = DB_getItem($_TABLES['evlist_calendars'], 'cal_name', "cal_id='" . (int) $this->cal_id . "'");
         $T->set_var(array('contact_section' => 'true', 'is_repeat' => 'true', 'cal_name' => $cal_name));
         // Override our dates & times with those from the repeat.
         // $rp_id is passed when this is called from class evRepeat.
         // Maybe that should pass in the repeat's data instead to avoid
         // another DB lookup.  An array of values could be used.
         $Rep = DB_fetchArray(DB_query("SELECT * \n                    FROM {$_TABLES['evlist_repeat']}\n                    WHERE rp_id='{$rp_id}'"), false);
         if ($Rep) {
             $this->date_start1 = $Rep['rp_date_start'];
             $this->date_end1 = $Rep['rp_date_end'];
             $this->time_start1 = $Rep['rp_time_start1'];
             $this->time_end1 = $Rep['rp_time_end1'];
             $this->time_start2 = $Rep['rp_time_start2'];
             $this->time_end2 = $Rep['rp_time_end2'];
         }
     } else {
         // Editing the main event record
         if ($this->id != '' && $this->recurring == 1) {
             $alert_msg = EVLIST_alertMessage($LANG_EVLIST['editing_series'], 'error');
         }
         if ($this->isAdmin) {
             $tabs[] = 'ev_perms';
             // Add permissions tab, event edit only
             $T->set_var('permissions_editor', 'true');
         }
         $T->set_var(array('contact_section' => 'true', 'category_section' => 'true', 'upcoming_chk' => $this->show_upcoming ? EVCHECKED : ''));
     }
     $action_url = EVLIST_URL . '/event.php';
     $delaction = 'delevent';
     if (isset($_GET['from']) && $_GET['from'] == 'admin') {
         $cancel_url = EVLIST_ADMIN_URL . '/index.php';
     } else {
         $cancel_url = EVLIST_URL . '/index.php';
     }
     switch ($saveaction) {
         case 'saverepeat':
         case 'savefuturerepeat':
         case 'saveevent':
             break;
         case 'moderate':
             // Approving a submission
             $saveaction = 'approve';
             $delaction = 'disapprove';
             $action_url = EVLIST_ADMIN_URL . '/index.php';
             $cancel_url = $_CONF['site_admin_url'] . '/moderation.php';
             break;
         default:
             $saveaction = 'saveevent';
             break;
     }
     $retval = '';
     //$recinterval = '';
     $recweekday = '';
     $ownerusername = DB_getItem($_TABLES['users'], 'username', "uid='{$this->owner_id}'");
     $retval .= COM_startBlock($LANG_EVLIST['event_editor']);
     $summary = $this->Detail->summary;
     $full_description = $this->Detail->full_description;
     $location = $this->Detail->location;
     if (($this->isAdmin || $_EV_CONF['allow_html'] == '1' && $_USER['uid'] > 1) && $A['postmode'] == 'html') {
         $postmode = '2';
         //html
     } else {
         $postmode = '1';
         //plaintext
         $summary = htmlspecialchars(COM_undoClickableLinks(COM_undoSpecialChars($this->Detail->summary)));
         $full_description = htmlspecialchars(COM_undoClickableLinks(COM_undoSpecialChars($this->Detail->full_description)));
         $location = htmlspecialchars(COM_undoClickableLinks(COM_undoSpecialChars($this->Detail->location)));
     }
     $starthour2 = '';
     $startminute2 = '';
     $endhour2 = '';
     $endminute2 = '';
     if ($this->date_end1 == '' || $this->date_end1 == '0000-00-00') {
         $this->date_end1 = $this->date_start1;
     }
     if ($this->date_start1 != '' && $this->date_start1 != '0000-00-00') {
         list($startmonth1, $startday1, $startyear1, $starthour1, $startminute1) = $this->DateParts($this->date_start1, $this->time_start1);
     } else {
         list($startmonth1, $startday1, $startyear1, $starthour1, $startminute1) = $this->DateParts(date('Y-m-d', time()), date('H:i:s', time()));
     }
     // The end date can't be before the start date
     if ($this->date_end1 >= $this->date_start1) {
         list($endmonth1, $endday1, $endyear1, $endhour1, $endminute1) = $this->DateParts($this->date_end1, $this->time_end1);
         $days_interval = Date_Calc::dateDiff($endday1, $endmonth1, $endyear1, $startday1, $startmonth1, $startyear1);
     } else {
         $days_interval = 0;
         $endmonth1 = $startmonth1;
         $endday1 = $startday1;
         $endyear1 = $startyear1;
         $endhour1 = $starthour1;
         $endminute1 = $startminute1;
     }
     if ($this->recurring != '1') {
         $T->set_var(array('recurring_show' => ' style="display:none;"', 'format_opt' => '0'));
         //for ($i = 1; $i <= 6; $i++) {
         //    $T->set_var('format' . $i . 'show', ' style="display:none;"');
         //}
     } else {
         $option = empty($this->rec_data['type']) ? '0' : (int) $this->rec_data['type'];
         $T->set_var(array('recurring_show' => '', 'recurring_checked' => EVCHECKED, 'format_opt' => $option));
     }
     if (isset($this->rec_data['stop']) && !empty($this->rec_data['stop'])) {
         $T->set_var(array('stopdate' => $this->rec_data['stop'], 'd_stopdate' => EVLIST_formattedDate($this->rec_data['stop'])));
     }
     if (!empty($this->rec_data['skip'])) {
         $T->set_var("skipnext{$this->rec_data['skip']}_checked", EVCHECKED);
     }
     if (!empty($this->rec_data['freq'])) {
         $freq = (int) $this->rec_data['freq'];
         if ($freq < 1) {
             $freq = 1;
         }
     } else {
         $freq = 1;
     }
     $T->set_var(array('freq_text' => $LANG_EVLIST['rec_periods'][$this->rec_data['type']] . '(s)', 'rec_freq' => $freq));
     foreach ($LANG_EVLIST['rec_intervals'] as $key => $str) {
         $T->set_var('dom_int_txt_' . $key, $str);
         if (is_array($this->rec_data['interval'])) {
             if (in_array($key, $this->rec_data['interval'])) {
                 $T->set_var('dom_int_chk_' . $key, EVCHECKED);
             }
         }
     }
     // Set up the recurring options needed for the current event
     switch ($option) {
         case 0:
             break;
         case EV_RECUR_MONTHLY:
             if (is_array($this->rec_data['listdays'])) {
                 foreach ($this->rec_data['listdays'] as $mday) {
                     $T->set_var('mdchk' . $mday, EVCHECKED);
                 }
             }
             break;
         case EV_RECUR_WEEKLY:
             $T->set_var('listdays_val', COM_stripslashes($rec_data[0]));
             if (is_array($this->rec_data['listdays']) && !empty($this->rec_data['listdays'])) {
                 foreach ($this->rec_data['listdays'] as $day) {
                     $day = (int) $day;
                     if ($day > 0 && $day < 8) {
                         $T->set_var('daychk' . $day, EVCHECKED);
                     }
                 }
             }
             break;
         case EV_RECUR_DOM:
             $recweekday = $this->rec_data['weekday'];
             break;
         case EV_RECUR_DATES:
             $T->set_var(array('stopshow' => 'style="display:none;"', 'custom_val' => implode(',', $this->rec_data['custom'])));
             break;
     }
     $start1 = EVLIST_TimeSelect('start1', $this->time_start1);
     $start2 = EVLIST_TimeSelect('start2', $this->time_start2);
     $end1 = EVLIST_TimeSelect('end1', $this->time_end1);
     $end2 = EVLIST_TimeSelect('end2', $this->time_end2);
     $cal_select = COM_optionList($_TABLES['evlist_calendars'], 'cal_id,cal_name', $this->cal_id, 1, 'cal_status = 1 ' . COM_getPermSQL('AND', 0, 2));
     USES_class_navbar();
     $navbar = new navbar();
     $cnt = 0;
     foreach ($tabs as $id) {
         $navbar->add_menuitem($LANG_EVLIST[$id], 'showhideEventDiv("' . $id . '",' . $cnt . ');return false;', true);
         $cnt++;
     }
     $navbar->set_selected($LANG_EVLIST['ev_info']);
     if ($this->AdminMode) {
         $action_url .= '?admin=true';
     }
     $T->set_var(array('action_url' => $action_url, 'navbar' => $navbar->generate(), 'alert_msg' => $alert_msg, 'cancel_url' => $cancel_url, 'eid' => $this->id, 'rp_id' => $rp_id, 'title' => $this->Detail->title, 'summary' => $summary, 'description' => $full_description, 'location' => $location, 'status_checked' => $this->status == 1 ? EVCHECKED : '', 'url' => $this->Detail->url, 'street' => $this->Detail->street, 'city' => $this->Detail->city, 'province' => $this->Detail->province, 'country' => $this->Detail->country, 'postal' => $this->Detail->postal, 'contact' => $this->Detail->contact, 'email' => $this->Detail->email, 'phone' => $this->Detail->phone, 'startdate1' => $this->date_start1, 'enddate1' => $this->date_end1, 'd_startdate1' => EVLIST_formattedDate($this->date_start1), 'd_enddate1' => EVLIST_formattedDate($this->date_end1), 'start_hour_options1' => $start1['hour'], 'start_minute_options1' => $start1['minute'], 'startdate1_ampm' => $start1['ampm'], 'end_hour_options1' => $end1['hour'], 'end_minute_options1' => $end1['minute'], 'enddate1_ampm' => $end1['ampm'], 'start_hour_options2' => $start2['hour'], 'start_minute_options2' => $start2['minute'], 'startdate2_ampm' => $start2['ampm'], 'end_hour_options2' => $end2['hour'], 'end_minute_options2' => $end2['minute'], 'enddate2_ampm' => $end2['ampm'], 'recurring_format_options' => EVLIST_GetOptions($LANG_EVLIST['rec_formats'], $option), 'recurring_weekday_options' => EVLIST_GetOptions(Date_Calc::getWeekDays(), $recweekday, 1), 'dailystop_label' => sprintf($LANG_EVLIST['stop_label'], $LANG_EVLIST['day_by_date'], ''), 'monthlystop_label' => sprintf($LANG_EVLIST['stop_label'], $LANG_EVLIST['year_and_month'], $LANG_EVLIST['if_any']), 'yearlystop_label' => sprintf($LANG_EVLIST['stop_label'], $LANG_EVLIST['year'], $LANG_EVLIST['if_any']), 'listdays_label' => sprintf($LANG_EVLIST['custom_label'], $LANG_EVLIST['days_of_week'], ''), 'listdaystop_label' => sprintf($LANG_EVLIST['stop_label'], $LANG_EVLIST['date_l'], $LANG_EVLIST['if_any']), 'intervalstop_label' => sprintf($LANG_EVLIST['stop_label'], $LANG_EVLIST['year_and_month'], $LANG_EVLIST['if_any']), 'custom_label' => sprintf($LANG_EVLIST['custom_label'], $LANG_EVLIST['dates'], ''), 'datestart_note' => $LANG_EVLIST['datestart_note'], 'src' => isset($_GET['src']) && $_GET['src'] == 'a' ? '1' : '0', 'rem_status_checked' => $this->enable_reminders == 1 ? EVCHECKED : '', 'del_button' => $this->id == '' ? '' : 'true', 'saveaction' => $saveaction, 'delaction' => $delaction, 'owner_id' => $this->owner_id, 'enable_reminders' => $_EV_CONF['enable_reminders'], 'iso_lang' => EVLIST_getIsoLang(), 'hour_mode' => $_CONF['hour_mode'], 'days_interval' => $days_interval, 'display_format' => $_CONF['shortdate'], 'ts_start' => strtotime($this->date_start1), 'ts_end' => strtotime($this->date_end1), 'cal_select' => $cal_select, 'contactlink_chk' => $this->options['contactlink'] == 1 ? EVCHECKED : '', 'lat' => $this->Detail->lat, 'lng' => $this->Detail->lng, 'perm_msg' => $LANG_ACCESS['permmsg'], 'last' => $LANG_EVLIST['rec_intervals'][5], 'doc_url' => EVLIST_getDocURL('event.html'), 'mootools' => $_SYSTEM['disable_mootools'] ? '' : 'true'));
     if ($_EV_CONF['enable_rsvp']) {
         USES_evlist_class_tickettype();
         $TickTypes = evTicketType::GetTicketTypes();
         //$T->set_block('editor', 'Tickets', 'tTypes');
         $tick_opts = '';
         foreach ($TickTypes as $tick_id => $tick_obj) {
             // Check enabled tickets. Ticket type 1 enabled by default
             if (isset($this->options['tickets'][$tick_id]) || $tick_id == 1) {
                 $checked = 'checked="checked"';
                 $fee = (double) $this->options['tickets'][$tick_id]['fee'];
             } else {
                 $checked = '';
                 $fee = 0;
             }
             $tick_opts .= '<tr><td><input name="tickets[' . $tick_id . ']" type="checkbox" ' . $checked . ' value="' . $tick_id . '" /></td>' . '<td>' . $tick_obj->description . '</td>' . '<td><input type="text" name="tick_fees[' . $tick_id . ']" value="' . $fee . '" size="8" /></td></tr>' . LB;
             /*$T->set_var(array(
                   'tick_id' => $tic['id'],
                   'tick_desc' => $tic['description'],
                   'tick_fee' => $fee,
                   'tick_enabled' => $enabled ? 'checked="checked"' : '',
               ) ) ;
               //$T->parse('tTypes', 'Tickets', true);*/
         }
         if ($_EV_CONF['rsvp_print'] > 0) {
             $rsvp_print_chk = 'rsvp_print_chk' . $this->options['rsvp_print'];
             $rsvp_print = 'true';
         } else {
             $rsvp_print = '';
             $rsvp_print_chk = 'no_rsvp_print';
         }
         $T->set_var(array('enable_rsvp' => 'true', 'reg_chk' . $this->options['use_rsvp'] => EVCHECKED, 'rsvp_wait_chk' => $this->options['rsvp_waitlist'] == 1 ? EVCHECKED : '', 'max_rsvp' => $this->options['max_rsvp'], 'max_user_rsvp' => $this->options['max_user_rsvp'], 'rsvp_cutoff' => $this->options['rsvp_cutoff'], 'use_rsvp' => $this->options['use_rsvp'], 'rsvp_waitlist' => $this->options['rsvp_waitlist'], 'tick_opts' => $tick_opts, 'rsvp_print' => $rsvp_print, $rsvp_print_chk => 'checked="checked"'));
     }
     // if rsvp_enabled
     // Split & All-Day settings
     if ($this->allday == 1) {
         // allday, can't be split, no times
         $T->set_var(array('starttime1_show' => 'style="display:none;"', 'endtime1_show' => 'style="display:none;"', 'datetime2_show' => 'style="display:none;"', 'allday_checked' => EVCHECKED, 'split_checked' => '', 'split_show' => 'style="display:none;"'));
     } elseif ($this->split == '1') {
         $T->set_var(array('split_checked' => EVCHECKED, 'allday_checked' => '', 'allday_show' => 'style="display:none"'));
     } else {
         $T->set_var(array('datetime2_show' => 'style="display:none;"'));
     }
     // Category fields. If $_POST['categories'] is set, then this is a
     // form re-entry due to an error saving. Populate checkboxes from the
     // submitted form. Include the user-added category, if any.
     // If not from a form re-entry, get the checked categories from the
     // evlist_lookup table.
     if ($_EV_CONF['enable_categories'] == '1') {
         $cresult = DB_query("SELECT tc.id, tc.name\n                FROM {$_TABLES['evlist_categories']} tc \n                WHERE tc.status='1' ORDER BY tc.name");
         while ($A = DB_fetchArray($cresult, false)) {
             if (isset($_POST['categories']) && is_array($_POST['categories'])) {
                 // Coming from a form re-entry
                 $chk = in_array($A['id'], $_POST['categories']) ? EVCHECKED : '';
             } else {
                 $chk = in_array($A['id'], $this->categories) ? EVCHECKED : '';
             }
             $catlist .= '<input type="checkbox" name="categories[]" ' . 'value="' . $A['id'] . '" ' . $chk . ' />' . '&nbsp;' . $A['name'] . '&nbsp;&nbsp;';
         }
         $T->set_var('catlist', $catlist);
         if (isset($_POST['newcat'])) {
             $T->set_var('newcat', $_POST['newcat']);
         }
         if ($_USER['uid'] > 1 && $rp_id == 0) {
             $T->set_var('category_section', 'true');
             $T->set_var('add_cat_input', 'true');
         }
     }
     // Enable the post mode selector if we allow HTML and the user is
     // logged in, or if this user is an authorized editor
     if ($this->isAdmin || $_EV_CONF['allow_html'] == '1' && $_USER['uid'] > 1) {
         $T->set_var(array('postmode_options' => EVLIST_GetOptions($LANG_EVLIST['postmodes'], $postmode), 'allowed_html' => COM_allowedHTML('evlist.submit')));
         if ($postmode == 'plaintext') {
             // plaintext, hide postmode selector
             $T->set_var('postmode_show', ' style="display:none"');
         }
         $T->parse('event_postmode', 'edit_postmode');
     }
     if ($this->isAdmin) {
         $T->set_var(array('owner_username' => COM_stripslashes($ownerusername), 'owner_dropdown' => COM_optionList($_TABLES['users'], 'uid,username', $this->owner_id, 1, "uid <> 1"), 'group_dropdown' => SEC_getGroupDropdown($this->group_id, 3)));
         if ($rp_id == 0) {
             // can only change permissions on main event
             $T->set_var('permissions_editor', SEC_getPermissionsHTML($this->perm_owner, $this->perm_group, $this->perm_members, $this->perm_anon));
         }
     } else {
         $T->set_var('group_id', $this->group_id);
     }
     // Latitude & Longitude part of location, if Location plugin is used
     if ($_EV_CONF['use_locator']) {
         $T->set_var(array('use_locator' => 'true', 'loc_selection' => GEO_optionList()));
     }
     $T->parse('output', 'editor');
     $retval .= $T->finish($T->get_var('output'));
     $retval .= COM_endBlock();
     return $retval;
 }
Ejemplo n.º 4
0
/**
* Shows the user edit form
*
* @param    int     $uid    User to edit
* @param    int     $msg    Error message to display
* @return   string          HTML for user edit form
*
*/
function USER_edit($uid = '', $msg = '')
{
    global $_CONF, $_SYSTEM, $_TABLES, $_USER, $LANG_MYACCOUNT, $LANG01, $LANG04, $LANG28, $LANG_ADMIN, $LANG_configselects, $LANG_confignames, $LANG_ACCESS, $MESSAGE, $_IMAGE_TYPE;
    $retval = '';
    $newuser = 0;
    // override $LANG_MYACCOUNT so we remove any plugins if creating an account....
    if ($uid == '' || $uid < 2) {
        $LANG_MYACCOUNT = array('pe_namepass' => $LANG_ACCESS['pe_namepass'], 'pe_userinfo' => $LANG_ACCESS['pe_userinfo'], 'pe_layout' => $LANG_ACCESS['pe_layout'], 'pe_content' => $LANG_ACCESS['pe_content'], 'pe_privacy' => $LANG_ACCESS['pe_privacy']);
    }
    // language overrides
    $LANG_MYACCOUNT['pe_namepass'] = $LANG_ACCESS['pe_namepass'];
    $LANG_MYACCOUNT['pe_userinfo'] = $LANG_ACCESS['pe_userinfo'];
    USES_class_navbar();
    USES_lib_admin();
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/user.php', 'text' => $LANG28[11]), array('url' => $_CONF['site_admin_url'] . '/user.php?import=x', 'text' => $LANG28[23]), array('url' => $_CONF['site_admin_url'] . '/user.php?batchadmin=x', 'text' => $LANG28[54]), array('url' => $_CONF['site_admin_url'] . '/prefeditor.php', 'text' => $LANG28[95]), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $userform = new Template($_CONF['path_layout'] . 'admin/user/');
    $userform->set_file('user', 'adminuseredit.thtml');
    $userform->set_var('enctype', ' enctype="multipart/form-data"');
    $userform->set_var('lang_save', $LANG_ADMIN['save']);
    $userform->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    // build navigation bar
    $navbar = new navbar();
    $cnt = 0;
    if (is_array($LANG_MYACCOUNT)) {
        foreach ($LANG_MYACCOUNT as $id => $label) {
            if ($id == 'pe_preview') {
                continue;
            }
            if ($id == 'pe_content' && $_CONF['hide_exclude_content'] == 1 && $_CONF['emailstories'] == 0) {
                continue;
            } else {
                $navbar->add_menuitem($label, 'showhideProfileEditorDiv("' . $id . '",' . $cnt . ');return false;', true);
                $cnt++;
                if ($id == 'pe_namepass') {
                    $navbar->add_menuitem($LANG01[96], 'showhideProfileEditorDiv("' . 'pe_usergroup' . '",' . $cnt . ');return false;', true);
                    $cnt++;
                }
            }
        }
        $navbar->set_selected($LANG_MYACCOUNT['pe_namepass']);
    }
    $userform->set_var('navbar', $navbar->generate());
    $userform->set_var('no_javascript_warning', $LANG04[150]);
    if (!empty($msg) && !empty($uid) && $uid > 1) {
        // an error occured while editing a user - if it was a new account,
        // don't bother trying to read the user's data from the database ...
        $cnt = DB_count($_TABLES['users'], 'uid', $uid);
        if ($cnt == 0) {
            $uid = '';
        }
    }
    if (!empty($uid) && $uid > 1) {
        $result = DB_query("SELECT * FROM {$_TABLES['users']},{$_TABLES['userprefs']},{$_TABLES['userinfo']},{$_TABLES['usercomment']},{$_TABLES['userindex']} WHERE {$_TABLES['users']}.uid = {$uid} AND {$_TABLES['userprefs']}.uid = {$uid} AND {$_TABLES['userinfo']}.uid = {$uid} AND {$_TABLES['usercomment']}.uid = {$uid} AND {$_TABLES['userindex']}.uid = {$uid}");
        $U = DB_fetchArray($result);
        if (empty($U['uid'])) {
            echo COM_refresh($_CONF['site_admin_url'] . '/user.php');
            exit;
        }
        if (SEC_inGroup('Root', $uid) and !SEC_inGroup('Root')) {
            // the current admin user isn't Root but is trying to change
            // a root account.  Deny them and log it.
            $retval .= COM_showMessageText($LANG_ACCESS['editrootmsg'], $LANG28[1], true);
            COM_accessLog("User {$_USER['username']} tried to edit a Root account with insufficient privileges.");
            return $retval;
        }
        $curtime = COM_getUserDateTimeFormat($U['regdate']);
        $lastlogin = DB_getItem($_TABLES['userinfo'], 'lastlogin', "uid = {$uid}");
        $lasttime = COM_getUserDateTimeFormat($lastlogin);
        $display_name = COM_getDisplayName($uid);
        $menuText = $LANG_ACCESS['editinguser'] . $U['username'];
        if ($U['fullname'] != '') {
            $menuText .= ' - ' . $U['fullname'];
        }
    } else {
        $U['uid'] = '';
        $U['username'] = '';
        $U['fullname'] = '';
        $U['email'] = '';
        $U['remoteuser'] = 0;
        $U['remoteusername'] = '';
        $U['remoteservice'] = '';
        $U['homepage'] = '';
        $U['location'] = '';
        $U['sig'] = '';
        $U['about'] = '';
        $U['pgpkey'] = '';
        $U['noicons'] = 0;
        $U['noboxes'] = 0;
        $U['tids'] = '';
        $U['etids'] = '-';
        $U['aids'] = '';
        $U['boxes'] = '';
        $uid = '';
        $U['cookietimeout'] = $_CONF['session_cookie_timeout'];
        // 2678400;
        $U['etids'] = '-';
        $U['status'] = USER_ACCOUNT_AWAITING_ACTIVATION;
        $U['account_type'] = LOCAL_USER;
        $U['emailfromadmin'] = 1;
        $U['emailfromuser'] = 1;
        $U['showonline'] = 1;
        $U['maxstories'] = 0;
        $U['dfid'] = 0;
        $U['search_result_format'] = $_CONF['search_style'];
        $U['commentmode'] = $_CONF['comment_mode'];
        $U['commentorder'] = 'ASC';
        $U['commentlimit'] = 100;
        $curtime = COM_getUserDateTimeFormat();
        $lastlogin = '';
        $lasttime = '';
        $U['status'] = USER_ACCOUNT_ACTIVE;
        $newuser = 1;
        $userform->set_var('newuser', 1);
        $menuText = $LANG_ACCESS['createnewuser'];
    }
    // now let's check to see if any post vars are set in the event we are returning from an error...
    if (isset($_POST['new_username'])) {
        $U['username'] = trim($_POST['new_username']);
    }
    if (isset($_POST['fullname'])) {
        $U['fullname'] = COM_truncate(trim(USER_sanitizeName($_POST['fullname'])), 80);
    }
    if (isset($_POST['remoteuser'])) {
        $U['remoteuser'] = $_POST['remoteuser'] == 'on' ? 1 : 0;
    }
    if (isset($_POST['remoteusername'])) {
        $U['remoteusername'] = COM_truncate(trim($_POST['remoteusername']), 60);
    }
    if (isset($_POST['remoteservice'])) {
        $U['remoteservice'] = COM_applyFilter($_POST['remoteservice']);
    }
    if (isset($_POST['userstatus'])) {
        $U['status'] = COM_applyFilter($_POST['userstatus'], true);
    }
    if (isset($_POST['cooktime'])) {
        $U['cookietimeout'] = COM_applyFilter($_POST['cooktime'], true);
    }
    if (isset($_POST['email'])) {
        $U['email'] = trim($_POST['email']);
    }
    if (isset($_POST['homepage'])) {
        $U['homepage'] = trim($_POST['homepage']);
    }
    if (isset($_POST['location'])) {
        $U['location'] = trim($_POST['location']);
    }
    if (isset($_POST['sig'])) {
        $U['sig'] = trim($_POST['sig']);
    }
    if (isset($_POST['about'])) {
        $U['about'] = trim($_POST['about']);
    }
    if (isset($_POST['pgpkey'])) {
        $U['pgpkey'] = trim($_POST['pgpkey']);
    }
    if (isset($_POST['language'])) {
        $U['language'] = trim(COM_applyFilter($_POST['language']));
    }
    if (isset($_POST['theme'])) {
        $U['theme'] = trim(COM_applyFilter($_POST['theme']));
    }
    if (isset($_POST['maxstories'])) {
        $U['maxstories'] = COM_applyFilter($_POST['maxstories'], true);
    }
    if (isset($_POST['tzid'])) {
        $U['tzid'] = COM_applyFilter($_POST['tzid']);
    }
    if (isset($_POST['dfid'])) {
        $U['dfid'] = COM_applyFilter($_POST['dfid'], true);
    }
    if (isset($_POST['search_result_format'])) {
        $U['search_result_format'] = COM_applyFilter($_POST['search_result_format']);
    }
    if (isset($_POST['commentmode'])) {
        $U['commentmode'] = COM_applyFilter($_POST['commentmode']);
    }
    if (isset($_POST['commentorder'])) {
        $U['commentorder'] = $_POST['commentorder'] == 'DESC' ? 'DESC' : 'ASC';
    }
    if (isset($_POST['commentlimit'])) {
        $U['commentlimit'] = COM_applyFilter($_POST['commentlimit'], true);
    }
    if (isset($_POST['emailfromuser'])) {
        $U['emailfromuser'] = $_POST['emailfromuser'] == 'on' ? 1 : 0;
    }
    if (isset($_POST['emailfromadmin'])) {
        $U['emailfromadmin'] = $_POST['emailfromadmin'] == 'on' ? 1 : 0;
    }
    if (isset($_POST['noicons'])) {
        $U['noicons'] = $_POST['noicons'] == 'on' ? 1 : 0;
    }
    if (isset($_POST['noboxes'])) {
        $U['noboxes'] = $_POST['noboxes'] == 'on' ? 1 : 0;
    }
    if (isset($_POST['showonline'])) {
        $U['showonline'] = $_POST['showonline'] == 'on' ? 1 : 0;
    }
    if (isset($_POST['topic_order'])) {
        $U['topic_order'] = $_POST['topic_order'] == 'ASC' ? 'ASC' : 'DESC';
    }
    $retval .= COM_startBlock($LANG28[1] . ' :: ' . $menuText, '', COM_getBlockTemplate('_admin_block', 'header'));
    if (!empty($msg)) {
        $retval .= COM_showMessageText($MESSAGE[$msg], $LANG28[22], false);
    }
    $retval .= ADMIN_createMenu($menu_arr, '', $_CONF['layout_url'] . '/images/icons/user.' . $_IMAGE_TYPE);
    $userform->set_var('account_panel', USER_accountPanel($U));
    $userform->set_var('group_panel', USER_groupPanel($U));
    $userform->set_var('userinfo_panel', USER_userinfoPanel($U));
    $userform->set_var('layout_panel', USER_layoutPanel($U));
    if ($_CONF['hide_exclude_content'] == 0 || $_CONF['emailstories'] == 1) {
        $userform->set_var('content_panel', USER_contentPanel($U));
    }
    $userform->set_var('privacy_panel', USER_privacyPanel($U));
    if (!empty($uid) && $uid > 1) {
        $userform->set_var('plugin_panel', PLG_profileEdit($uid));
    }
    if (isset($LANG_MYACCOUNT['pe_subscriptions'])) {
        $userform->set_var('subscription_panel', USER_subscriptionPanel($U));
    }
    if (!empty($uid) && $uid != $_USER['uid'] && SEC_hasRights('user.delete')) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="delete"%s />';
        $jsconfirm = ' onclick="return doubleconfirm(\'' . $LANG28[104] . '\',\'' . $LANG28[109] . '\');"';
        $userform->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        $userform->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
    }
    $userform->set_var('gltoken_name', CSRF_TOKEN);
    $userform->set_var('gltoken', SEC_createToken());
    $retval .= $userform->finish($userform->parse('output', 'user'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
Ejemplo n.º 5
0
/**
*   Create the tabbed user menu.
*   Provides a common menu creation for user-facing files such as index.php
*   and detail.php
*
*   @param  string  $selected   Currently-select menu option text
*   @return string              HTML for tabbed menu
*/
function PAYPAL_userMenu($selected = '')
{
    global $LANG_PP, $ppGCart;
    USES_class_navbar();
    $menu = new navbar();
    $menu->add_menuitem($LANG_PP['product_list'], PAYPAL_URL . '/index.php');
    if (!COM_isAnonUser()) {
        $menu->add_menuitem($LANG_PP['purchase_history'], PAYPAL_URL . '/index.php?view=history');
    }
    if ($ppGCart->hasItems()) {
        $menu->add_menuitem($LANG_PP['viewcart'], PAYPAL_URL . '/index.php?view=cart');
    }
    if (SEC_hasRights('paypal.admin')) {
        $menu->add_menuitem($LANG_PP['mnu_admin'], PAYPAL_ADMIN_URL . '/index.php');
    }
    if ($selected != '') {
        $menu->set_selected($selected);
    }
    return $menu->generate();
}
Ejemplo n.º 6
0
function FF_NavbarMenu($current = '')
{
    global $_FF_CONF, $_CONF, $_USER, $LANG_GF01, $LANG_GF02;
    USES_class_navbar();
    $navmenu = new navbar();
    $navmenu->add_menuitem($LANG_GF01['INDEXPAGE'], "{$_CONF['site_url']}/forum/index.php");
    if (!COM_isAnonUser()) {
        $navmenu->add_menuitem($LANG_GF01['SUBSCRIPTIONS'], "{$_CONF['site_url']}/forum/notify.php");
        $navmenu->add_menuitem($LANG_GF01['BOOKMARKS'], "{$_CONF['site_url']}/forum/list.php?op=bookmarks");
        $navmenu->add_menuitem($LANG_GF02['new_posts'], "{$_CONF['site_url']}/forum/list.php?op=newposts");
    }
    if ($_FF_CONF['allow_memberlist'] && !COM_isAnonUser()) {
        $navmenu->add_menuitem($LANG_GF02['msg88'], "{$_CONF['site_url']}/forum/memberlist.php");
    }
    $navmenu->add_menuitem($LANG_GF01['LASTX'], "{$_CONF['site_url']}/forum/list.php?op=lastx");
    $navmenu->add_menuitem($LANG_GF02['msg201'], "{$_CONF['site_url']}/forum/list.php?op=popular");
    if ($current != '') {
        $navmenu->set_selected($current);
    }
    return $navmenu->generate();
}