Esempio n. 1
0
/**
*   Purchase History View.
*   Displays the purchase history for the current user.  Admins
*   can view any user's histor, or all users
*
*   @param  boolean $admin  True if called for admin access, False otherwise
*   @param  integer $uid    User ID to view, current user by default
*   @return string          HTML for order list
*/
function PAYPAL_history($admin = false, $uid = '')
{
    global $_CONF, $_PP_CONF, $_TABLES, $LANG_PP, $_USER;
    // Not available to anonymous users
    if (COM_isAnonUser()) {
        return '';
    }
    USES_lib_admin();
    $isAdmin = $admin == true ? 1 : 0;
    $sql = "SELECT \n            p.*, UNIX_TIMESTAMP(p.expiration) AS exptime, \n            d.name, d.short_description, d.file, d.prod_type,\n            {$isAdmin} as isAdmin, \n            u.uid, u.username\n        FROM {$_TABLES['paypal.purchases']} AS p \n        LEFT JOIN {$_TABLES['paypal.products']} AS d \n            ON d.id = p.product_id \n        LEFT JOIN {$_TABLES['users']} AS u \n            ON p.user_id = u.uid ";
    $base_url = PAYPAL_ADMIN_URL;
    if (!$isAdmin) {
        $where = " WHERE p.user_id = '" . (int) $_USER['uid'] . "'";
        $base_url = PAYPAL_URL;
    } elseif (!empty($uid)) {
        $where = " WHERE p.user_id = '" . (int) $uid . "'";
    }
    $header_arr = array(array('text' => $LANG_PP['product_id'], 'field' => 'name', 'sort' => true), array('text' => $LANG_PP['qty'], 'field' => 'quantity', 'sort' => true), array('text' => $LANG_PP['description'], 'field' => 'short_description', 'sort' => true), array('text' => $LANG_PP['purch_date'], 'field' => 'purchase_date', 'sort' => true), array('text' => $LANG_PP['txn_id'], 'field' => 'txn_id', 'sort' => true), array('text' => $LANG_PP['expiration'], 'field' => 'expiration', 'sort' => true), array('text' => $LANG_PP['prod_type'], 'field' => 'prod_type', 'sort' => true));
    if ($isAdmin) {
        $header_arr[] = array('text' => $LANG_PP['username'], 'field' => 'username', 'sort' => true);
    }
    $defsort_arr = array('field' => 'p.purchase_date', 'direction' => 'DESC');
    $display = COM_startBlock('', '', COM_getBlockTemplate('_admin_block', 'header'));
    $query_arr = array('table' => 'paypal.purchases', 'sql' => $sql, 'query_fields' => array('d.name', 'd.short_description', 'p.txn_id'), 'default_filter' => $where);
    $text_arr = array('has_extras' => true, 'form_url' => $base_url . '/index.php?history=x');
    if (!isset($_REQUEST['query_limit'])) {
        $_GET['query_limit'] = 20;
    }
    $display .= ADMIN_list('paypal', 'PAYPAL_getPurchaseHistoryField', $header_arr, $text_arr, $query_arr, $defsort_arr);
    $display .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $display;
}
Esempio n. 2
0
function forum_admin_list()
{
    global $_TABLES, $LANG_ADMIN, $LANG_GF00, $LANG_GF91, $LANG_GF06, $_CONF, $_FF_CONF;
    USES_lib_admin();
    $retval = '';
    $selected = '';
    $menu_arr = array();
    $admin_list = new Template($_CONF['path'] . 'plugins/forum/templates/admin/');
    $admin_list->set_file('admin-list', 'index.thtml');
    $admin_list->set_var('block_start', COM_startBlock($LANG_GF91['gfstats']));
    $menu_arr = FF_adminNav($LANG_GF06['1']);
    $admin_list->set_var('admin_menu', ADMIN_createMenu($menu_arr, $LANG_GF00['instructions'], $_CONF['site_url'] . '/forum/images/forum.png'));
    // CATEGORIES
    $numcats = DB_query("SELECT id FROM {$_TABLES['ff_categories']}");
    $totalcats = DB_numRows($numcats);
    // FORUMS
    $numforums = DB_query("SELECT forum_id FROM {$_TABLES['ff_forums']}");
    $totalforums = DB_numRows($numforums);
    // TOPICS
    $numtopics = DB_query("SELECT id FROM {$_TABLES['ff_topic']} WHERE pid = 0");
    $totaltopics = DB_numRows($numtopics);
    // POSTS
    $numposts = DB_query("SELECT id FROM {$_TABLES['ff_topic']}");
    $totalposts = DB_numRows($numposts);
    // VIEWS
    $numviews = DB_query("SELECT SUM(views) AS TOTAL FROM {$_TABLES['ff_topic']}");
    $totalviews = DB_fetchArray($numviews);
    // AVERAGE POSTS
    if ($totalposts != 0) {
        $avgcposts = $totalposts / $totalcats;
        $avgcposts = round($avgcposts);
        $avgfposts = $totalposts / $totalforums;
        $avgfposts = round($avgfposts);
        $avgtposts = $totalposts / $totaltopics;
        $avgtposts = round($avgtposts);
    } else {
        $avgcposts = 0;
        $avgfposts = 0;
        $avgtposts = 0;
    }
    // AVERAGE VIEWS
    if ($totalviews['TOTAL'] != 0) {
        $avgcviews = $totalviews['TOTAL'] / $totalcats;
        $avgcviews = round($avgcviews);
        $avgfviews = $totalviews['TOTAL'] / $totalforums;
        $avgfviews = round($avgfviews);
        $avgtviews = $totalviews['TOTAL'] / $totaltopics;
        $avgtviews = round($avgtviews);
    } else {
        $avgcviews = 0;
        $avgfviews = 0;
        $avgtviews = 0;
    }
    $admin_list->set_var(array('statsmsg' => $LANG_GF91['statsmsg'], 'totalcatsmsg' => $LANG_GF91['totalcats'], 'totalcats' => $totalcats, 'totalforumsmsg' => $LANG_GF91['totalforums'], 'totalforums' => $totalforums, 'totaltopicsmsg' => $LANG_GF91['totaltopics'], 'totaltopics' => $totaltopics, 'totalpostsmsg' => $LANG_GF91['totalposts'], 'totalposts' => $totalposts, 'totalviewsmsg' => $LANG_GF91['totalviews'], 'totalviews' => $totalviews['TOTAL'], 'category' => $LANG_GF91['category'], 'forum' => $LANG_GF91['forum'], 'topic' => $LANG_GF91['topic'], 'avgpmsg' => $LANG_GF91['avgpmsg'], 'avgcposts' => $avgcposts, 'avgfposts' => $avgfposts, 'avgtposts' => $avgtposts, 'avgvmsg' => $LANG_GF91['avgvmsg'], 'avgcviews' => $avgcviews, 'avgfviews' => $avgfviews, 'avgtviews' => $avgtviews));
    $admin_list->set_var('block_end', COM_endBlock());
    $admin_list->parse('output', 'admin-list');
    $retval .= $admin_list->finish($admin_list->get_var('output'));
    return $retval;
}
Esempio n. 3
0
/**
* List all backups, i.e. all files ending in .sql
*
* @return   string      HTML for the list of files or an error when not writable
*
*/
function DBADMIN_list()
{
    global $_CONF, $_TABLES, $_IMAGE_TYPE, $LANG08, $LANG_ADMIN, $LANG_DB_BACKUP;
    USES_lib_admin();
    $retval = '';
    if (is_writable($_CONF['backup_path'])) {
        $backups = array();
        $fd = opendir($_CONF['backup_path']);
        $index = 0;
        while (false !== ($file = @readdir($fd))) {
            if ($file != '.' && $file != '..' && $file != 'CVS' && preg_match('/\\.sql$/i', $file)) {
                $index++;
                clearstatcache();
                $backups[] = $file;
            }
        }
        // AS, 2004-03-29 - Sort backup files by date, newest first.
        // Order given by 'readdir' might not be correct.
        usort($backups, 'DBADMIN_compareBackupFiles');
        $data_arr = array();
        $thisUrl = $_CONF['site_admin_url'] . '/database.php';
        $diskIconUrl = $_CONF['layout_url'] . '/images/admin/disk.' . $_IMAGE_TYPE;
        $attr['title'] = $LANG_DB_BACKUP['download'];
        $alt = $LANG_DB_BACKUP['download'];
        $num_backups = count($backups);
        for ($i = 0; $i < $num_backups; $i++) {
            $downloadUrl = $thisUrl . '?download=x&amp;file=' . urlencode($backups[$i]);
            $downloadLink = COM_createLink(COM_createImage($diskIconUrl, $alt, $attr), $downloadUrl, $attr);
            $downloadLink .= '&nbsp;&nbsp;';
            $attr['style'] = 'vertical-align:top;';
            $downloadLink .= COM_createLink($backups[$i], $downloadUrl, $attr);
            $backupfile = $_CONF['backup_path'] . $backups[$i];
            $backupfilesize = COM_numberFormat(filesize($backupfile)) . ' <b>' . $LANG_DB_BACKUP['bytes'] . '</b>';
            $data_arr[$i] = array('file' => $downloadLink, 'size' => $backupfilesize, 'filename' => $backups[$i]);
        }
        $token = SEC_createToken();
        $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/database.php?backup=x&amp;' . CSRF_TOKEN . '=' . $token, 'text' => $LANG_ADMIN['create_new']), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
        $retval .= COM_startBlock($LANG_DB_BACKUP['last_ten_backups'], '', COM_getBlockTemplate('_admin_block', 'header'));
        $retval .= ADMIN_createMenu($menu_arr, "<p>{$LANG_DB_BACKUP['db_explanation']}</p>" . '<p>' . sprintf($LANG_DB_BACKUP['total_number'], $index) . '</p>', $_CONF['layout_url'] . '/images/icons/database.' . $_IMAGE_TYPE);
        $header_arr = array(array('text' => $LANG_DB_BACKUP['backup_file'], 'field' => 'file'), array('text' => $LANG_DB_BACKUP['size'], 'field' => 'size'));
        $text_arr = array('form_url' => $thisUrl);
        $form_arr = array('bottom' => '', 'top' => '');
        if ($num_backups > 0) {
            $form_arr['bottom'] = '<input type="hidden" name="delete" value="x"' . XHTML . '>' . '<input type="hidden" name="' . CSRF_TOKEN . '" value="' . $token . '"' . XHTML . '>' . LB;
        }
        $options = array('chkselect' => true, 'chkminimum' => 0, 'chkfield' => 'filename');
        $retval .= ADMIN_simpleList('', $header_arr, $text_arr, $data_arr, $options, $form_arr);
        $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    } else {
        $retval .= COM_startBlock($LANG08[06], '', COM_getBlockTemplate('_msg_block', 'header'));
        $retval .= $LANG_DB_BACKUP['no_access'];
        COM_errorLog($_CONF['backup_path'] . ' is not writable.', 1);
        $retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
    }
    return $retval;
}
Esempio n. 4
0
function _listUsers()
{
    global $LANG28, $_CONF, $_TABLES, $LANG_ADMIN, $LANG_GF98;
    USES_lib_admin();
    $retval = '';
    $header_arr = array(array('text' => $LANG_GF98['uid'], 'field' => 'uid', 'sort' => true), array('text' => $LANG28[3], 'field' => 'username', 'sort' => true), array('text' => $LANG28[4], 'field' => 'fullname', 'sort' => true), array('text' => $LANG28[7], 'field' => 'email', 'sort' => true), array('text' => $LANG_GF98['rating'], 'field' => 'rating', 'sort' => true));
    $defsort_arr = array('field' => $_TABLES['users'] . '.uid', 'direction' => 'ASC');
    $text_arr = array('has_extras' => true, 'form_url' => $_CONF['site_admin_url'] . '/plugins/forum/userrating.php', 'help_url' => '');
    $sql = "SELECT {$_TABLES['users']}.uid, username,fullname,email,status,rating FROM {$_TABLES['users']} LEFT JOIN {$_TABLES['ff_userinfo']} on {$_TABLES['users']}.uid={$_TABLES['ff_userinfo']}.uid";
    $query_arr = array('table' => 'users', 'sql' => $sql, 'query_fields' => array($_TABLES['users'] . '.username', $_TABLES['users'] . '.email', $_TABLES['users'] . '.fullname'), 'default_filter' => " WHERE {$_TABLES['users']}.uid > 1");
    $form_arr = array('bottom' => '<div style="text-align:center;padding:5px;"><input type="submit" value="submit" name="submit" /></div>');
    $retval .= ADMIN_list('user', 'ADMIN_getListField_ratings', $header_arr, $text_arr, $query_arr, $defsort_arr, '', '', '', $form_arr);
    return $retval;
}
Esempio n. 5
0
/**
* Shows all polls in system
*
* List all the polls on the system if no $pid is provided
*
* @return   string          HTML for poll listing
*
*/
function POLLS_pollList()
{
    global $_CONF, $_TABLES, $_USER, $_PO_CONF, $LANG25, $LANG_LOGIN, $LANG_POLLS;
    $retval = '';
    if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_PO_CONF['pollsloginrequired'] == 1)) {
        $retval .= SEC_loginRequiredForm();
    } else {
        USES_lib_admin();
        $header_arr = array(array('text' => $LANG25[9], 'field' => 'topic', 'sort' => true), array('text' => $LANG25[20], 'field' => 'voters', 'sort' => true, 'align' => 'center'), array('text' => $LANG25[3], 'field' => 'unixdate', 'sort' => true, 'align' => 'center'), array('text' => $LANG_POLLS['open_poll'], 'field' => 'is_open', 'sort' => true, 'align' => 'center'));
        $defsort_arr = array('field' => 'unixdate', 'direction' => 'desc');
        $text_arr = array('has_menu' => false, 'title' => $LANG_POLLS['pollstitle'], 'instructions' => "", 'icon' => '', 'form_url' => '');
        $query_arr = array('table' => 'polltopics', 'sql' => $sql = "SELECT *,UNIX_TIMESTAMP(date) AS unixdate, display " . "FROM {$_TABLES['polltopics']} WHERE 1=1", 'query_fields' => array('topic'), 'default_filter' => COM_getPermSQL(), 'query' => '', 'query_limit' => 0);
        $retval .= ADMIN_list('polls', 'POLLS_getListField', $header_arr, $text_arr, $query_arr, $defsort_arr, '', $token = 'dummy');
    }
    return $retval;
}
Esempio n. 6
0
/**
*   Build the admin list of pages
*   @return string      HTML content
*/
function EXP_adminList()
{
    global $_CONF, $_TABLES, $LANG_ADMIN, $LANG_ACCESS, $_CONF_EXP, $LANG_EX00;
    USES_lib_admin();
    $retval = '';
    $header_arr = array(array('text' => $LANG_ADMIN['edit'], 'field' => 'edit', 'sort' => false), array('text' => 'Page ID', 'field' => 'exid', 'sort' => true), array('text' => 'Title', 'field' => 'title', 'sort' => true), array('text' => 'URL', 'field' => 'url', 'sort' => true), array('text' => 'Hits', 'field' => 'hits', 'sort' => true));
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/plugins/' . $_CONF_EXP['pi_name'] . '/edit.php?exid=0', 'text' => 'Add New'), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $defsort_arr = array('field' => 'exid', 'direction' => 'asc');
    $header_str = $LANG_EX00['header'] . ' ' . $LANG_EX00['version'] . ' ' . $_CONF_EXP['pi_version'];
    $retval .= COM_startBlock($header_str, '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= ADMIN_createMenu($menu_arr, 'Administer External Pages', plugin_geticon_external());
    $text_arr = array('has_extras' => true, 'form_url' => "{$_CONF['site_admin_url']}/plugins/{$_CONF_EXP['pi_name']}/index.php");
    $query_arr = array('table' => 'external', 'sql' => "SELECT * FROM {$_TABLES['external']} ", 'query_fields' => array('title', 'url'), 'default_filter' => COM_getPermSql());
    $retval .= ADMIN_list('external', 'EXP_getAdminListField', $header_arr, $text_arr, $query_arr, $defsort_arr, '', '', '', $form_arr);
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
Esempio n. 7
0
function _listUserVotes($uid)
{
    global $LANG28, $_CONF, $_TABLES, $LANG_ADMIN, $LANG_GF98;
    USES_lib_admin();
    $retval = '';
    $header_arr = array(array('text' => 'User Rated', 'field' => 'user_id', 'sort' => false), array('text' => 'Grade', 'field' => 'grade', 'sort' => false), array('text' => 'Topic', 'field' => 'topic_id', 'sort' => false));
    $defsort_arr = array('field' => 'user_id', 'direction' => 'ASC');
    $text_arr = array('has_extras' => false, 'form_url' => $_CONF['site_admin_url'] . '/plugins/forum/userrating_detail.php', 'help_url' => '');
    $sql = "SELECT * FROM {$_TABLES['ff_rating_assoc']} WHERE voter_id = " . $uid;
    $query_arr = array('table' => 'ff_rating_assoc', 'sql' => $sql, 'query_fields' => array('uid'), 'default_filter' => " WHERE voter_id = " . $uid);
    $retval .= ADMIN_list('user', 'ADMIN_getListField_ratings', $header_arr, $text_arr, $query_arr, $defsort_arr);
    return $retval;
}
Esempio n. 8
0
/**
* Shows the form the admin uses to send glFusion members a message. Now you
* can email a user or an entire group depending upon whether uid or grp_id is
* set.  if both arguments are >0, the group send function takes precedence
*
* @return   string      HTML for the email form
*
*/
function MAIL_displayForm($uid = 0, $grp_id = 0, $from = '', $replyto = '', $subject = '', $message = '')
{
    global $_CONF, $_TABLES, $_USER, $LANG31, $LANG03, $LANG_ADMIN;
    USES_lib_admin();
    $retval = '';
    if (isset($_POST['postmode'])) {
        $postmode = COM_applyFilter($_POST['postmode']);
        if ($postmode != 'html' || $postmode != 'plaintext') {
            $postmode = $_CONF['postmode'];
        }
    } else {
        $postmode = $_CONF['postmode'];
    }
    $mail_templates = new Template($_CONF['path_layout'] . 'admin/mail');
    $mail_templates->set_file('form', 'mailform.thtml');
    if ($postmode == 'html') {
        $mail_templates->set_var('show_htmleditor', true);
    } else {
        $mail_templates->unset_var('show_htmleditor');
    }
    $mail_templates->set_var('postmode', $postmode);
    $mail_templates->set_var('lang_postmode', $LANG03[2]);
    $mail_templates->set_var('postmode_options', COM_optionList($_TABLES['postmodes'], 'code,name', $postmode));
    $mail_templates->set_var('startblock_email', COM_startBlock($LANG31[1], '', COM_getBlockTemplate('_admin_block', 'header')));
    $mail_templates->set_var('php_self', $_CONF['site_admin_url'] . '/mail.php');
    $usermode = $uid > 0 && $grp_id == 0 ? true : false;
    $send_to_group = $usermode ? '' : '1';
    $mail_templates->set_var('send_to_group', $send_to_group);
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/user.php', 'text' => $LANG_ADMIN['admin_users']), array('url' => $_CONF['site_admin_url'] . '/group.php', 'text' => $LANG_ADMIN['admin_groups']), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $instructions = $usermode ? $LANG31[28] : $LANG31[19];
    $icon = $_CONF['layout_url'] . '/images/icons/mail.png';
    $admin_menu = ADMIN_createMenu($menu_arr, $instructions, $icon);
    $mail_templates->set_var('admin_menu', $admin_menu);
    if ($usermode) {
        // we're sending e-Mail to a specific user
        $mail_templates->set_var('lang_instructions', $LANG31[28]);
        $mail_templates->set_var('lang_to', $LANG31[18]);
        $to_user = '';
        $lang_warning = $LANG31[29];
        $warning = '';
        // get the user data, and check the privacy settings
        $result = DB_query("SELECT username,fullname,email FROM {$_TABLES['users']} WHERE uid = " . (int) $uid);
        $nrows = DB_numRows($result);
        if ($nrows > 0) {
            $A = DB_fetchArray($result);
            $username = $_CONF['show_fullname'] ? $A['fullname'] : $A['username'];
            $to_user = $username . ' (' . $A['email'] . ')';
            $emailfromadmin = DB_getItem($_TABLES['userprefs'], 'emailfromadmin', "uid = " . (int) $uid);
            $warning = $emailfromadmin == 1 ? '' : $LANG31[30];
        }
        $mail_templates->set_var('to_user', $to_user);
        $mail_templates->set_var('to_uid', $uid);
        $mail_templates->set_var('lang_warning', $lang_warning);
        $mail_templates->set_var('warning', $warning);
    } else {
        // we're sending e-Mail to a group of users
        $mail_templates->set_var('lang_instructions', $LANG31[19]);
        $mail_templates->set_var('lang_to', $LANG31[27]);
        $mail_templates->set_var('lang_selectgroup', $LANG31[25]);
        // build group options select, allow for possibility grp_id has been supplied
        $group_options = '';
        $result = DB_query("SELECT grp_id, grp_name FROM {$_TABLES['groups']} WHERE grp_name <> 'All Users'");
        $nrows = DB_numRows($result);
        $groups = array();
        for ($i = 0; $i < $nrows; $i++) {
            $A = DB_fetchArray($result);
            $groups[$A['grp_id']] = ucwords($A['grp_name']);
        }
        asort($groups);
        foreach ($groups as $groupID => $groupName) {
            if (SEC_inGroup('Root') || SEC_inGroup($groupName) && $groupName != 'Logged-in Users' && $groupName != 'Mail Admin') {
                $group_options .= '<option value="' . $groupID . '"';
                $group_options .= $groupID == $grp_id ? ' selected="selected"' : '';
                $group_options .= '>' . $groupName . '</option>';
            }
        }
        $mail_templates->set_var('group_options', $group_options);
    }
    $mail_templates->set_var('lang_from', $LANG31[2]);
    $frm = empty($from) ? $_CONF['site_name'] : $from;
    $mail_templates->set_var('site_name', $frm);
    $mail_templates->set_var('lang_replyto', $LANG31[3]);
    $rto = empty($replyto) ? $_CONF['site_mail'] : $replyto;
    $mail_templates->set_var('site_mail', $rto);
    $mail_templates->set_var('lang_subject', $LANG31[4]);
    $mail_templates->set_var('subject', $subject);
    $mail_templates->set_var('lang_body', $LANG31[5]);
    $mail_templates->set_var('message_text', $message);
    $mail_templates->set_var('message_html', $message);
    $mail_templates->set_var('lang_sendto', $LANG31[6]);
    $mail_templates->set_var('lang_allusers', $LANG31[7]);
    $mail_templates->set_var('lang_admin', $LANG31[8]);
    $mail_templates->set_var('lang_options', $LANG31[9]);
    $mail_templates->set_var('lang_HTML', $LANG31[10]);
    $mail_templates->set_var('lang_urgent', $LANG31[11]);
    $mail_templates->set_var('lang_ignoreusersettings', $LANG31[14]);
    $mail_templates->set_var('lang_send', $LANG31[12]);
    $mail_templates->set_var('end_block', COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')));
    $mail_templates->set_var('gltoken_name', CSRF_TOKEN);
    $mail_templates->set_var('gltoken', SEC_createToken());
    PLG_templateSetVars('contact', $mail_templates);
    $mail_templates->parse('output', 'form');
    $retval = $mail_templates->finish($mail_templates->get_var('output'));
    SEC_setCookie($_CONF['cookie_name'] . 'adveditor', SEC_createTokenGeneral('advancededitor'), time() + 1200, $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure'], false);
    return $retval;
}
Esempio n. 9
0
/**
* Create a new feed. This is an extra step to take once you have a plugin
* installed that supports the new Feed functions in the Plugin API. This
* will let you select for which plugin (or glFusion) you're creating the feed.
*
* @return   string   HTML for the complete page (selection or feed editor)
*
*/
function FEED_newFeed()
{
    global $_CONF, $LANG33, $LANG_ADMIN, $_IMAGE_TYPE;
    USES_lib_admin();
    $retval = '';
    $plugins = PLG_supportingFeeds();
    if (sizeof($plugins) == 0) {
        // none of the installed plugins are supporting feeds
        // - go directly to the feed editor
        $retval = COM_siteHeader('menu', $LANG33[11]) . FEED_edit(0, 'article') . COM_siteFooter();
    } else {
        $selection = '<select name="type">' . LB;
        $selection .= '<option value="article">' . $LANG33[55] . '</option>' . LB;
        foreach ($plugins as $p) {
            $selection .= '<option value="' . $p . '">' . ucwords($p) . '</option>' . LB;
        }
        $selection .= '</select>' . LB;
        $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/syndication.php', 'text' => $LANG33[57]), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
        $feed_template = new Template($_CONF['path_layout'] . 'admin/syndication');
        $feed_template->set_file('type', 'selecttype.thtml');
        $feed_template->set_var('type_selection', $selection);
        $feed_template->set_var('lang_explain', $LANG33[54]);
        $feed_template->set_var('lang_go', $LANG33[1]);
        $retval .= COM_siteHeader('menu', $LANG33[11]);
        $retval .= COM_startBlock($LANG33[36], '', COM_getBlockTemplate('_admin_block', 'header'));
        $retval .= ADMIN_createMenu($menu_arr, $LANG33[54], $_CONF['layout_url'] . '/images/icons/syndication.' . $_IMAGE_TYPE);
        $retval .= $feed_template->finish($feed_template->parse('output', 'type'));
        $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
        $retval .= COM_siteFooter();
    }
    return $retval;
}
Esempio n. 10
0
function X_EVLIST_adminRSVP($rp_id)
{
    global $LANG_EVLIST, $LANG_ADMIN, $_TABLES;
    USES_lib_admin();
    USES_evlist_class_repeat();
    $Ev = new evRepeat($rp_id);
    if ($Ev->rp_id == 0) {
        return '';
    }
    $sql = "SELECT rsvp_id, uid, rp_id, FROM_UNIXTIME(dt_reg) as dt\n            FROM {$_TABLES['evlist_rsvp']}\n            WHERE ev_id = '{$Ev->Event->id}' ";
    $title = $LANG_EVLIST['pi_title'] . ': ' . $LANG_EVLIST['admin_rsvp'] . ' -- ' . COM_createLink($Ev->Event->Detail->title . ' (' . $Ev->date_start . ')', EVLIST_URL . '/event.php?eid=' . $rp_id);
    if ($Ev->Event->options['use_rsvp'] == EV_RSVP_REPEAT) {
        $sql .= " rp_id = '{$Ev->rp_id}' ";
    }
    $defsort_arr = array('field' => 'dt_reg', 'direction' => 'ASC');
    $text_arr = array('has_menu' => false, 'has_extras' => false, 'title' => $title, 'form_url' => EVLIST_ADMIN_URL . '/index.php?rp_id=' . $rp_id, 'help_url' => '');
    $query_arr = array('table' => 'evlist_calendars', 'sql' => $sql);
    $header_arr = array(array('text' => $LANG_EVLIST['date'], 'field' => 'dt', 'sort' => true), array('text' => 'Name', 'field' => 'uid', 'sort' => false));
    $options_arr = array('chkdelete' => true, 'chkfield' => 'rsvp_id', 'chkname' => 'delrsvp');
    $retval .= ADMIN_list('evlist', 'EVLIST_getField_rsvp', $header_arr, $text_arr, $query_arr, $defsort_arr, '', '', $options_arr);
    return $retval;
}
Esempio n. 11
0
/**
* Main driver to handle the uploaded plugin
*
* Determines if a new style (supports automated installer) or
* an old style.
*
* @return   string              Formatted HTML containing the page body
*
*/
function processPluginUpload()
{
    global $_CONF, $_PLUGINS, $_PLUGIN_INFO, $_TABLES, $pluginData, $LANG_ADMIN, $LANG32, $_DB_dbms, $_DB_table_prefix, $_IMAGE_TYPE;
    $retval = '';
    $upgrade = false;
    if (count($_FILES) > 0 && $_FILES['pluginfile']['error'] != UPLOAD_ERR_NO_FILE) {
        require_once $_CONF['path_system'] . 'classes/upload.class.php';
        $upload = new upload();
        if (isset($_CONF['debug_image_upload']) && $_CONF['debug_image_upload']) {
            $upload->setLogFile($_CONF['path'] . 'logs/error.log');
            $upload->setDebug(true);
        }
        $upload->setMaxFileUploads(1);
        $upload->setMaxFileSize(25165824);
        $upload->setAllowedMimeTypes(array('application/x-gzip' => '.gz,.gzip,tgz', 'application/zip' => '.zip', 'application/x-tar' => '.tar,.tar.gz,.gz', 'application/x-gzip-compressed' => '.tar.gz,.tgz,.gz'));
        $upload->setFieldName('pluginfile');
        if (!$upload->setPath($_CONF['path_data'] . 'temp')) {
            return _pi_errorBox($upload->printErrors(false));
            exit;
        }
        $filename = $_FILES['pluginfile']['name'];
        $upload->setFileNames($filename);
        $upload->uploadFiles();
        if ($upload->areErrors()) {
            return _pi_errorBox($upload->printErrors(false));
            exit;
        }
        $Finalfilename = $_CONF['path_data'] . 'temp/' . $filename;
    } else {
        return _pi_errorBox($LANG32[46]);
    }
    // decompress into temp directory
    if (function_exists('set_time_limit')) {
        @set_time_limit(60);
    }
    if (!($tmp = _io_mktmpdir())) {
        return _pi_errorBox($LANG32[47]);
    }
    if (!COM_decompress($Finalfilename, $_CONF['path_data'] . $tmp)) {
        _pi_deleteDir($_CONF['path_data'] . $tmp);
        return _pi_errorBox($LANG32[48]);
    }
    @unlink($Finalfilename);
    // read XML data file, places in $pluginData;
    $pluginData = array();
    $rc = _pi_parseXML($_CONF['path_data'] . $tmp);
    if ($rc == -1) {
        // no xml file found
        return processOldPlugin($tmp);
    }
    if (!isset($pluginData['id']) || !isset($pluginData['version'])) {
        return processOldPlugin($tmp);
    }
    // proper glfusion version
    if (!COM_checkVersion(GVERSION, $pluginData['glfusionversion'])) {
        _pi_deleteDir($_CONF['path_data'] . $tmp);
        return _pi_errorBox(sprintf($LANG32[49], $pluginData['glfusionversion']));
    }
    if (!COM_checkVersion(phpversion(), $pluginData['phpversion'])) {
        $retval .= sprintf($LANG32[50], $pluginData['phpversion']);
        _pi_deleteDir($_CONF['path_data'] . $tmp);
        return _pi_errorBox(sprintf($LANG32[50], $pluginData['phpversion']));
    }
    // check prerequisites
    $errors = '';
    if (isset($pluginData['requires']) && is_array($pluginData['requires'])) {
        foreach ($pluginData['requires'] as $reqPlugin) {
            list($reqPlugin, $required_ver) = explode(',', $reqPlugin);
            if (!isset($_PLUGIN_INFO[$reqPlugin])) {
                // required plugin not installed
                $errors .= sprintf($LANG32[51], $pluginData['id'], $reqPlugin, $reqPlugin);
            } elseif (!empty($required_ver)) {
                $installed_ver = $_PLUGIN_INFO[$reqPlugin];
                if (!COM_checkVersion($installed_ver, $required_ver)) {
                    // required plugin installed, but wrong version
                    $errors .= sprintf($LANG32[90], $required_ver, $reqPlugin, $installed_ver, $reqPlugin);
                }
            }
        }
    }
    if ($errors != '') {
        _pi_deleteDir($_CONF['path_data'] . $tmp);
        return _pi_errorBox($errors);
    }
    // check if plugin already exists
    // if it does, check that this is an upgrade
    // if not, error
    // else validate we really want to upgrade
    $result = DB_query("SELECT * FROM {$_TABLES['plugins']} WHERE pi_name='" . DB_escapeString($pluginData['id']) . "'");
    if (DB_numRows($result) > 0) {
        $P = DB_fetchArray($result);
        if ($P['pi_version'] == $pluginData['version']) {
            _pi_deleteDir($_CONF['path_data'] . $tmp);
            return _pi_errorBox(sprintf($LANG32[52], $pluginData['id']));
        }
        // if we are here, it must be an upgrade or disabled plugin....
        $rc = COM_checkVersion($pluginData['version'], $P['pi_version']);
        if ($rc < 1) {
            _pi_deleteDir($_CONF['path_data'] . $tmp);
            return _pi_errorBox(sprintf($LANG32[53], $pluginData['id'], $pluginData['version'], $P['pi_version']));
        }
        if ($P['pi_enabled'] != 1) {
            _pi_deleteDir($_CONF['path_data'] . $tmp);
            return _pi_errorBox($LANG32[72]);
        }
        $upgrade = true;
    }
    $permError = 0;
    $permErrorList = '';
    if (function_exists('set_time_limit')) {
        @set_time_limit(30);
    }
    // test copy to proper directories
    list($rc, $failed) = _pi_test_copy($_CONF['path_data'] . $tmp . '/' . $pluginData['id'] . '/', $_CONF['path'] . 'plugins/' . $pluginData['id']);
    if ($rc > 0) {
        $permError = 1;
        foreach ($failed as $filename) {
            $permErrorList .= sprintf($LANG32[41], $filename);
        }
    }
    list($rc, $failed) = _pi_test_copy($_CONF['path_data'] . $tmp . '/' . $pluginData['id'] . '/admin/', $_CONF['path_html'] . 'admin/plugins/' . $pluginData['id']);
    if ($rc > 0) {
        $permError = 1;
        foreach ($failed as $filename) {
            $permErrorList .= sprintf($LANG32[41], $filename);
        }
    }
    list($rc, $failed) = _pi_test_copy($_CONF['path_data'] . $tmp . '/' . $pluginData['id'] . '/public_html/', $_CONF['path_html'] . $pluginData['id']);
    if ($rc > 0) {
        $permError = 1;
        foreach ($failed as $filename) {
            $permErrorList .= sprintf($LANG32[41], $filename);
        }
    }
    if ($permError != 0) {
        $errorMessage = '<h2>' . $LANG32[42] . '</h2>' . $LANG32[43] . $permErrorList . '<br />' . $LANG32[44];
        _pi_deleteDir($_CONF['path_data'] . $tmp);
        return _pi_errorBox($errorMessage);
    }
    USES_lib_admin();
    $menu_arr = array(array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $T = new Template($_CONF['path_layout'] . 'admin/plugins');
    $T->set_file('form', 'plugin_upload_confirm.thtml');
    $T->set_var('admin_menu', ADMIN_createMenu($menu_arr, $pluginData['id'] . ' ' . $LANG32[62], $_CONF['layout_url'] . '/images/icons/plugins.' . $_IMAGE_TYPE));
    $T->set_var(array('form_action_url' => $_CONF['site_admin_url'] . '/plugin_upload.php', 'action' => 'processupload', 'pi_name' => $pluginData['id'], 'pi_version' => $pluginData['version'], 'pi_url' => $pluginData['url'], 'pi_gl_version' => $pluginData['glfusionversion'], 'pi_desc' => $pluginData['description'], 'pi_author' => $pluginData['author'], 'plugin_old_version' => $P['pi_version'], 'upgrade' => $upgrade, 'temp_dir' => $tmp));
    $retval .= $T->parse('output', 'form');
    return $retval;
}
Esempio n. 12
0
/**
* This function allows the batch deletion of users that are inactive
* It shows the form that will filter user that will be deleted
*
* @return   string          HTML Form
*/
function USER_batchAdmin()
{
    global $_CONF, $_TABLES, $LANG_ADMIN, $LANG01, $LANG28, $_IMAGE_TYPE;
    $display = '';
    USES_lib_admin();
    $usr_type = '';
    if (isset($_REQUEST['usr_type'])) {
        $usr_type = COM_applyFilter($_REQUEST['usr_type']);
    } else {
        $usr_type = 'phantom';
    }
    if (!in_array($usr_type, array('phantom', 'old', 'recent', 'short'))) {
        $usr_type = 'phantom';
    }
    $usr_time_arr = array();
    $usr_time = '';
    $usr_time_arr['phantom'] = 2;
    $usr_time_arr['short'] = 6;
    $usr_time_arr['old'] = 24;
    $usr_time_arr['recent'] = 1;
    if (isset($_POST['usr_time'])) {
        $usr_time_arr = $_POST['usr_time'];
    } elseif (isset($_GET['usr_time'])) {
        $usr_time_arr[$usr_type] = $_GET['usr_time'];
    } else {
        $usr_time_arr['phantom'] = 2;
        $usr_time_arr['short'] = 6;
        $usr_time_arr['old'] = 24;
        $usr_time_arr['recent'] = 1;
    }
    $usr_time = $usr_time_arr[$usr_type];
    // list of options for user display
    // sel => form-id
    // desc => title
    // txt1 => text before input-field
    // txt2 => text after input field
    $opt_arr = array(array('sel' => 'phantom', 'desc' => $LANG28[57], 'txt1' => $LANG28[60], 'txt2' => $LANG28[61]), array('sel' => 'short', 'desc' => $LANG28[58], 'txt1' => $LANG28[62], 'txt2' => $LANG28[63]), array('sel' => 'old', 'desc' => $LANG28[59], 'txt1' => $LANG28[64], 'txt2' => $LANG28[65]), array('sel' => 'recent', 'desc' => $LANG28[74], 'txt1' => $LANG28[75], 'txt2' => $LANG28[76]));
    $user_templates = new Template($_CONF['path_layout'] . 'admin/user');
    $user_templates->set_file(array('form' => 'batchadmin.thtml', 'options' => 'batchadmin_options.thtml'));
    $user_templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $user_templates->set_var('layout_url', $_CONF['layout_url']);
    $user_templates->set_var('usr_type', $usr_type);
    $user_templates->set_var('usr_time', $usr_time);
    $user_templates->set_var('lang_instruction', $LANG28[56]);
    $user_templates->set_var('lang_updatelist', $LANG28[66]);
    $num_opts = count($opt_arr);
    for ($i = 0; $i < $num_opts; $i++) {
        $selector = '';
        if ($usr_type == $opt_arr[$i]['sel']) {
            $selector = ' checked="checked"';
        }
        $user_templates->set_var('sel_id', $opt_arr[$i]['sel']);
        $user_templates->set_var('selector', $selector);
        $user_templates->set_var('lang_description', $opt_arr[$i]['desc']);
        $user_templates->set_var('lang_text_start', $opt_arr[$i]['txt1']);
        $user_templates->set_var('lang_text_end', $opt_arr[$i]['txt2']);
        $user_templates->set_var('id_value', $usr_time_arr[$opt_arr[$i]['sel']]);
        $user_templates->parse('options_list', 'options', true);
    }
    $user_templates->parse('form', 'form');
    $desc = $user_templates->finish($user_templates->get_var('form'));
    $header_arr = array(array('text' => $LANG28[3], 'field' => 'username', 'sort' => true), array('text' => $LANG28[4], 'field' => 'fullname', 'sort' => true));
    switch ($usr_type) {
        case 'phantom':
            $header_arr[] = array('text' => $LANG28[14], 'field' => 'regdate', 'sort' => true, 'align' => 'center');
            $header_arr[] = array('text' => $LANG28[41], 'field' => 'lastlogin_short', 'sort' => true, 'align' => 'center');
            $header_arr[] = array('text' => $LANG28[67], 'field' => 'phantom_date', 'sort' => true, 'align' => 'center');
            $list_sql = ", UNIX_TIMESTAMP()- UNIX_TIMESTAMP(regdate) as phantom_date";
            $filter_sql = "lastlogin = 0 AND UNIX_TIMESTAMP()- UNIX_TIMESTAMP(regdate) > " . $usr_time * 2592000 . " AND";
            $sort = 'regdate';
            break;
        case 'short':
            $header_arr[] = array('text' => $LANG28[14], 'field' => 'regdate', 'sort' => true, 'align' => 'center');
            $header_arr[] = array('text' => $LANG28[41], 'field' => 'lastlogin_short', 'sort' => true, 'align' => 'center');
            $header_arr[] = array('text' => $LANG28[68], 'field' => 'online_hours', 'sort' => true, 'align' => 'center');
            $header_arr[] = array('text' => $LANG28[69], 'field' => 'offline_months', 'sort' => true, 'align' => 'center');
            $list_sql = ", (lastlogin - UNIX_TIMESTAMP(regdate)) AS online_hours, (UNIX_TIMESTAMP() - lastlogin) AS offline_months";
            $filter_sql = "lastlogin > 0 AND lastlogin - UNIX_TIMESTAMP(regdate) < 86400 " . "AND UNIX_TIMESTAMP() - lastlogin > " . $usr_time * 2592000 . " AND";
            $sort = 'lastlogin';
            break;
        case 'old':
            $header_arr[] = array('text' => $LANG28[41], 'field' => 'lastlogin_short', 'sort' => true, 'align' => 'center');
            $header_arr[] = array('text' => $LANG28[69], 'field' => 'offline_months', 'sort' => true, 'align' => 'center');
            $list_sql = ", (UNIX_TIMESTAMP() - lastlogin) AS offline_months";
            $filter_sql = "lastlogin > 0 AND (UNIX_TIMESTAMP() - lastlogin) > " . $usr_time * 2592000 . " AND";
            $sort = 'lastlogin';
            break;
        case 'recent':
            $header_arr[] = array('text' => $LANG28[14], 'field' => 'regdate', 'sort' => true, 'align' => 'center');
            $header_arr[] = array('text' => $LANG28[41], 'field' => 'lastlogin_short', 'sort' => true, 'align' => 'center');
            $list_sql = "";
            $filter_sql = "(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(regdate)) < " . $usr_time * 2592000 . " AND";
            $sort = 'regdate';
            break;
    }
    $header_arr[] = array('text' => $LANG28[7], 'field' => 'email', 'sort' => true);
    $header_arr[] = array('text' => $LANG28[87], 'field' => 'num_reminders', 'sort' => true, 'align' => 'center', 'width' => '40px');
    $text_arr = array('has_menu' => true, 'title' => '', 'instructions' => "{$desc}", 'icon' => $_CONF['layout_url'] . '/images/icons/user.' . $_IMAGE_TYPE, 'form_url' => $_CONF['site_admin_url'] . "/user.php?batchadmin=x&amp;usr_type={$usr_type}&amp;usr_time={$usr_time}", 'help_url' => '', 'has_search' => true, 'has_limit' => true, 'has_paging' => true);
    $defsort_arr = array('field' => $sort, 'direction' => 'ASC');
    $join_userinfo = "LEFT JOIN {$_TABLES['userinfo']} ON {$_TABLES['users']}.uid={$_TABLES['userinfo']}.uid ";
    $select_userinfo = ", lastlogin as lastlogin_short {$list_sql} ";
    $sql = "SELECT {$_TABLES['users']}.uid,username,fullname,email,photo,status,regdate,num_reminders{$select_userinfo} " . "FROM {$_TABLES['users']} {$join_userinfo} WHERE 1=1";
    $query_arr = array('table' => 'users', 'sql' => $sql, 'query_fields' => array('username', 'email', 'fullname'), 'default_filter' => "AND {$filter_sql} {$_TABLES['users']}.uid > 1");
    $actions = '<input name="delbutton" type="image" src="' . $_CONF['layout_url'] . '/images/admin/delete.' . $_IMAGE_TYPE . '" style="vertical-align:text-bottom;" title="' . $LANG01[124] . '" onclick="return doubleconfirm(\'' . $LANG28[73] . '\',\'' . $LANG28[110] . '\');"' . '/>&nbsp;' . $LANG_ADMIN['delete'];
    $actions .= '&nbsp;&nbsp;&nbsp;&nbsp;';
    $actions .= '<input name="reminder" type="image" src="' . $_CONF['layout_url'] . '/images/admin/mail.' . $_IMAGE_TYPE . '" style="vertical-align:bottom;" title="' . $LANG28[78] . '" onclick="return confirm(\'' . $LANG28[100] . '\');"' . '/>&nbsp;' . $LANG28[77];
    $options = array('chkselect' => true, 'chkfield' => 'uid', 'chkactions' => $actions);
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/user.php', 'text' => $LANG28[11]), array('url' => $_CONF['site_admin_url'] . '/user.php?edit=x', 'text' => $LANG_ADMIN['create_new']), array('url' => $_CONF['site_admin_url'] . '/user.php?import=x', 'text' => $LANG28[23]), array('url' => $_CONF['site_admin_url'] . '/prefeditor.php', 'text' => $LANG28[95]), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $display .= COM_startBlock($LANG28[103], '', COM_getBlockTemplate('_admin_block', 'header'));
    $display .= ADMIN_createMenu($menu_arr, $desc, $_CONF['layout_url'] . '/images/icons/user.' . $_IMAGE_TYPE);
    $token = SEC_createToken();
    $form_arr['bottom'] = "<input type=\"hidden\" name=\"" . CSRF_TOKEN . "\" value=\"{$token}\"" . "/>";
    $display .= ADMIN_list('user', 'USER_getListField', $header_arr, $text_arr, $query_arr, $defsort_arr, '', $token, $options, $form_arr);
    $display .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $display;
}
Esempio n. 13
0
function PAGE_list()
{
    global $_CONF, $_TABLES, $_IMAGE_TYPE, $LANG_ADMIN, $LANG_ACCESS, $LANG_STATIC;
    USES_lib_admin();
    $retval = '';
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/plugins/staticpages/index.php?edit=x', 'text' => $LANG_ADMIN['create_new']), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $retval .= COM_startBlock($LANG_STATIC['staticpagelist'], '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= ADMIN_createMenu($menu_arr, $LANG_STATIC['instructions'], plugin_geticon_staticpages());
    $header_arr = array(array('text' => $LANG_ADMIN['edit'], 'field' => 'edit', 'sort' => false, 'align' => 'center'), array('text' => $LANG_ADMIN['copy'], 'field' => 'copy', 'sort' => false, 'align' => 'center'), array('text' => $LANG_STATIC['id'], 'field' => 'sp_id', 'sort' => true), array('text' => $LANG_ADMIN['title'], 'field' => 'sp_title', 'sort' => true), array('text' => $LANG_STATIC['head_centerblock'], 'field' => 'sp_centerblock', 'sort' => true, 'align' => 'center'), array('text' => $LANG_STATIC['writtenby'], 'field' => 'sp_uid', 'sort' => true), array('text' => $LANG_ACCESS['access'], 'field' => 'access', 'sort' => false, 'align' => 'center'), array('text' => $LANG_STATIC['date'], 'field' => 'unixdate', 'sort' => true, 'align' => 'center'), array('text' => $LANG_ADMIN['delete'], 'field' => 'delete', 'sort' => false, 'align' => 'center'), array('text' => $LANG_ADMIN['enabled'], 'field' => 'sp_status', 'sort' => true, 'align' => 'center'));
    $defsort_arr = array('field' => 'sp_title', 'direction' => 'asc');
    $text_arr = array('has_extras' => true, 'form_url' => $_CONF['site_admin_url'] . '/plugins/staticpages/index.php');
    // sql query which drives the list
    $sql = "SELECT *,UNIX_TIMESTAMP(sp_date) AS unixdate " . "FROM {$_TABLES['staticpage']} WHERE 1=1 ";
    $query_arr = array('table' => 'staticpage', 'sql' => $sql, 'query_fields' => array('sp_title', 'sp_id'), 'default_filter' => COM_getPermSQL('AND'));
    // create the security token, and embed it in the list form
    // also set the hidden var which signifies that this list allows for pages
    // to be enabled/disabled via checkbox
    $token = SEC_createToken();
    $form_arr = array('top' => '<input type="hidden" name="' . CSRF_TOKEN . '" value="' . $token . '"/>', 'bottom' => '<input type="hidden" name="staticpageenabler" value="true"/>');
    $retval .= ADMIN_list('static_pages', 'PAGE_getListField', $header_arr, $text_arr, $query_arr, $defsort_arr, '', $token, '', $form_arr);
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    $outputHandle = outputHandler::getInstance();
    $outputHandle->addLinkScript($_CONF['site_url'] . '/javascript/admin.js', HEADER_PRIO_NORMAL, 'text/javascript');
    return $retval;
}
Esempio n. 14
0
/**
* Displays a list of topics
*
* Lists all the topics and their icons.
*
* @return   string      HTML for the topic list
*
*/
function TOPIC_list()
{
    global $_CONF, $_TABLES, $LANG27, $LANG_ACCESS, $LANG_ADMIN, $_IMAGE_TYPE;
    USES_lib_admin();
    $retval = '';
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/topic.php?edit=x', 'text' => $LANG_ADMIN['create_new']), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $retval .= COM_startBlock($LANG27[8], '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= ADMIN_createMenu($menu_arr, $LANG27[9], $_CONF['layout_url'] . '/images/icons/topic.' . $_IMAGE_TYPE);
    $header_arr = array(array('text' => $LANG_ADMIN['edit'], 'field' => 'edit', 'sort' => false, 'align' => 'center', 'width' => '35px'), array('text' => $LANG27[10], 'field' => 'sortnum', 'sort' => true, 'align' => 'center'), array('text' => $LANG27[2], 'field' => 'tid', 'sort' => true), array('text' => $LANG27[3], 'field' => 'topic', 'sort' => true), array('text' => $LANG27[38], 'field' => 'is_default', 'sort' => false, 'align' => 'center'), array('text' => $LANG27[39], 'field' => 'archive_flag', 'sort' => false, 'align' => 'center'), array('text' => $LANG27[11], 'field' => 'limitnews', 'sort' => false, 'align' => 'center'), array('text' => $LANG27[35], 'field' => 'sort_by', 'sort' => false, 'align' => 'center', 'nowrap' => 'true'), array('text' => $LANG27[37], 'field' => 'sort_dir', 'sort' => false, 'align' => 'center'), array('text' => $LANG_ADMIN['delete'], 'field' => 'delete', 'sort' => false, 'align' => 'center', 'width' => '35px'));
    $defsort_arr = array('field' => 'sortnum', 'direction' => 'asc');
    $text_arr = array('has_extras' => true, 'form_url' => $_CONF['site_admin_url'] . '/topic.php');
    $query_arr = array('table' => 'topics', 'sql' => "SELECT * FROM {$_TABLES['topics']} WHERE 1=1", 'query_fields' => array('tid', 'topic'), 'default_filter' => COM_getPermSql('AND'));
    $token = SEC_createToken();
    $form_arr = array('bottom' => '<input type="hidden" name="' . CSRF_TOKEN . '" value="' . $token . '"/>');
    $retval .= ADMIN_list('topics', 'TOPIC_getListField', $header_arr, $text_arr, $query_arr, $defsort_arr, '', $token, '', $form_arr);
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
Esempio n. 15
0
/**
* Display admin list of site memberships for social follow for the site
*
* Displays all available social services for the site
*
* @return   string              HTML to display
*
*/
function SI_get_site()
{
    global $_CONF, $_TABLES, $LANG_ADMIN, $LANG_SOCIAL;
    USES_lib_admin();
    $retval = '';
    // if an social admin is using this page, offer navigation to the admin page(s)
    if (SEC_hasRights('social.admin')) {
        $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/social.php', 'text' => $LANG_SOCIAL['social_share']), array('url' => $_CONF['site_admin_url'] . '/social.php?list=f', 'text' => $LANG_SOCIAL['social_follow']), array('url' => $_CONF['site_admin_url'] . '/index.php', 'text' => $LANG_ADMIN['admin_home']));
    } else {
        $menu_arr = array();
    }
    $cfg =& config::get_instance();
    $_SOCIAL = $cfg->get_config('social_internal');
    $extra = '';
    if (isset($_SOCIAL['social_site_extra'])) {
        $extra = $_SOCIAL['social_site_extra'];
    }
    $T = new Template($_CONF['path_layout'] . 'admin/social');
    $T->set_file('page', 'site_social.thtml');
    $T->set_var('start_block', COM_startBlock($LANG_SOCIAL['site_memberships'], '', COM_getBlockTemplate('_admin_block', 'header')));
    $T->set_var('admin_menu', ADMIN_createMenu($menu_arr, $LANG_SOCIAL['membership_instructions'], $_CONF['layout_url'] . '/images/icons/share.png'));
    $T->set_var('end_block', COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')));
    $T->set_block('page', 'social_links', 'sl');
    $follow_me = SOC_followMeProfile(-1);
    if (is_array($follow_me) && count($follow_me) > 0) {
        foreach ($follow_me as $service) {
            $T->set_var(array('service_display_name' => $service['service_display_name'], 'service' => $service['service'], 'service_username' => $service['service_username'], 'service_url' => $service['service_url']));
            $T->parse('sl', 'social_links', true);
        }
    }
    $T->set_var(array('security_token_name' => CSRF_TOKEN, 'security_token' => SEC_createToken(), 'extra' => $extra, 'lang_service_name' => $LANG_SOCIAL['service_name'], 'lang_service_url' => $LANG_SOCIAL['service_url'], 'lang_site_username' => $LANG_SOCIAL['site_username'], 'lang_additional_html' => $LANG_SOCIAL['additional_html'], 'lang_save' => $LANG_ADMIN['save'], 'lang_cancel' => $LANG_ADMIN['cancel'], 'form_action' => $_CONF['site_admin_url'] . '/social.php'));
    $retval = $T->finish($T->parse('output', 'page'));
    return $retval;
}
Esempio n. 16
0
function LINK_CAT_edit($cid, $pid)
{
    global $_CONF, $_TABLES, $_USER, $MESSAGE, $LANG_LINKS_ADMIN, $LANG_ADMIN, $LANG_ACCESS, $_LI_CONF;
    USES_lib_admin();
    $retval = '';
    $cid = DB_escapeString($cid);
    if (!empty($pid)) {
        // have parent id, so making a new subcategory
        // get parent access rights
        $result = DB_query("SELECT group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['linkcategories']} WHERE cid='" . DB_escapeString($pid) . "'");
        $A = DB_fetchArray($result);
        $A['owner_id'] = $_USER['uid'];
        $A['pid'] = $pid;
    } elseif (!empty($cid)) {
        // have category id, so editing a category
        $sql = "SELECT * FROM {$_TABLES['linkcategories']} WHERE cid='{$cid}'" . COM_getPermSQL('AND');
        $result = DB_query($sql);
        $A = DB_fetchArray($result);
    } else {
        // nothing, so making a new top-level category
        // get default access rights
        $A['group_id'] = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name='Links Admin'");
        SEC_setDefaultPermissions($A, $_LI_CONF['default_permissions']);
        $A['owner_id'] = $_USER['uid'];
        $A['pid'] = $_LI_CONF['root'];
    }
    $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
    if ($access < 3) {
        return COM_showMessage(6, 'links');
    }
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/plugins/links/category.php', 'text' => $LANG_LINKS_ADMIN[50]), array('url' => $_CONF['site_admin_url'] . '/plugins/links/index.php', 'text' => $LANG_LINKS_ADMIN[53]), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $retval .= COM_startBlock($LANG_LINKS_ADMIN[56], '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= ADMIN_createMenu($menu_arr, $LANG_LINKS_ADMIN[67], plugin_geticon_links());
    $T = new Template($_CONF['path'] . 'plugins/links/templates/admin');
    $T->set_file(array('page' => 'categoryeditor.thtml'));
    $T->set_var('site_url', $_CONF['site_url']);
    $T->set_var('site_admin_url', $_CONF['site_admin_url']);
    $T->set_var('layout_url', $_CONF['layout_url']);
    $T->set_var('lang_pagetitle', $LANG_LINKS_ADMIN[28]);
    $T->set_var('lang_link_list', $LANG_LINKS_ADMIN[53]);
    $T->set_var('lang_new_link', $LANG_LINKS_ADMIN[51]);
    $T->set_var('lang_validate_links', $LANG_LINKS_ADMIN[26]);
    $T->set_var('lang_list_categories', $LANG_LINKS_ADMIN[50]);
    $T->set_var('lang_new_category', $LANG_LINKS_ADMIN[52]);
    $T->set_var('lang_admin_home', $LANG_ADMIN['admin_home']);
    $T->set_var('instructions', $LANG_LINKS_ADMIN[29]);
    $T->set_var('lang_category', $LANG_LINKS_ADMIN[30]);
    $T->set_var('lang_cid', $LANG_LINKS_ADMIN[32]);
    $T->set_var('lang_description', $LANG_LINKS_ADMIN[31]);
    $T->set_var('lang_topic', $LANG_LINKS_ADMIN[33]);
    $T->set_var('lang_parent', $LANG_LINKS_ADMIN[34]);
    $T->set_var('lang_save', $LANG_ADMIN['save']);
    if (!empty($cid)) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="delete"%s>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $T->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        $T->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
        $T->set_var('delete_confirm_msg', $MESSAGE[76]);
    } else {
        $T->set_var('delete_option', '');
    }
    $T->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    if (!empty($cid)) {
        $T->set_var('cid_value', $A['cid']);
        $T->set_var('old_cid_value', $A['cid']);
        $T->set_var('category_options', links_select_box(3, $A['pid']));
        $T->set_var('category_value', $A['category']);
        $T->set_var('description_value', $A['description']);
    } else {
        $A['cid'] = COM_makeSid();
        $T->set_var('cid_value', $A['cid']);
        $T->set_var('old_cid_value', '');
        $T->set_var('category_options', links_select_box(3, $A['pid']));
        $T->set_var('category_value', '');
        $T->set_var('description_value', '');
    }
    if (!isset($A['tid'])) {
        $A['tid'] = 'all';
    }
    $topics = COM_topicList('tid,topic', $A['tid'], 1, true);
    $T->set_var('topic_list', $topics);
    $alltopics = '<option value="all"';
    if ($A['tid'] == 'all') {
        $alltopics .= ' selected="selected"';
    }
    $alltopics .= '>' . $LANG_LINKS_ADMIN[35] . '</option>' . LB;
    $T->set_var('topic_selection', '<select name="tid">' . $alltopics . $topics . '</select>');
    // user access info
    $T->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
    $T->set_var('lang_owner', $LANG_ACCESS['owner']);
    $T->set_var('owner_name', COM_getDisplayName($A['owner_id']));
    $T->set_var('cat_ownerid', $A['owner_id']);
    $T->set_var('lang_group', $LANG_ACCESS['group']);
    $T->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access));
    $T->set_var('lang_permissions', $LANG_ACCESS['permissions']);
    $T->set_var('lang_permissionskey', $LANG_ACCESS['permissionskey']);
    $T->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']));
    $T->set_var('lang_lockmsg', $LANG_ACCESS['permmsg']);
    $T->set_var('gltoken_name', CSRF_TOKEN);
    $T->set_var('gltoken', SEC_createToken());
    $T->parse('output', 'page');
    $retval .= $T->finish($T->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
Esempio n. 17
0
/**
* Shows story editor
*
* Displays the story entry form
*
* @param    string      $sid            ID of story to edit
* @param    string      $action         'preview', 'edit', 'moderate', 'draft'
* @param    string      $errormsg       a message to display on top of the page
* @param    string      $currenttopic   topic selection for drop-down menu
* @return   string      HTML for story editor
*
*/
function STORY_edit($sid = '', $action = '', $errormsg = '', $currenttopic = '')
{
    global $_CONF, $_GROUPS, $_TABLES, $_USER, $LANG24, $LANG33, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE, $_IMAGE_TYPE;
    USES_lib_admin();
    $display = '';
    switch ($action) {
        case 'clone':
        case 'edit':
        case 'preview':
        case 'error':
            $title = $LANG24[5];
            $saveoption = $LANG_ADMIN['save'];
            $submission = false;
            break;
        case 'moderate':
            $title = $LANG24[90];
            $saveoption = $LANG_ADMIN['moderate'];
            $submission = true;
            break;
        case 'draft':
            $title = $LANG24[91];
            $saveoption = $LANG_ADMIN['save'];
            $submission = true;
            $action = 'edit';
            break;
        default:
            $title = $LANG24[5];
            $saveoption = $LANG_ADMIN['save'];
            $submission = false;
            $action = 'edit';
            break;
    }
    // Load HTML templates
    $story_templates = new Template($_CONF['path_layout'] . 'admin/story');
    $story_templates->set_file(array('editor' => 'storyeditor.thtml'));
    if (!isset($_CONF['hour_mode'])) {
        $_CONF['hour_mode'] = 12;
    }
    if (!empty($errormsg)) {
        $display .= COM_showMessageText($errormsg, $LANG24[25], true);
    }
    if (!empty($currenttopic)) {
        $allowed = DB_getItem($_TABLES['topics'], 'tid', "tid = '" . DB_escapeString($currenttopic) . "'" . COM_getTopicSql('AND'));
        if ($allowed != $currenttopic) {
            $currenttopic = '';
        }
    }
    $story = new Story();
    if ($action == 'preview' || $action == 'error') {
        while (list($key, $value) = each($_POST)) {
            if (!is_array($value)) {
                $_POST[$key] = $value;
            } else {
                while (list($subkey, $subvalue) = each($value)) {
                    $value[$subkey] = $subvalue;
                }
            }
        }
        $result = $story->loadFromArgsArray($_POST);
    } else {
        $result = $story->loadFromDatabase($sid, $action);
    }
    if ($result == STORY_PERMISSION_DENIED || $result == STORY_NO_ACCESS_PARAMS) {
        $display .= COM_showMessageText($LANG24[42], $LANG_ACCESS['accessdenied'], true);
        COM_accessLog("User {$_USER['username']} tried to access story {$sid}. - STORY_PERMISSION_DENIED or STORY_NO_ACCESS_PARAMS - " . $result);
        return $display;
    } elseif ($result == STORY_EDIT_DENIED || $result == STORY_EXISTING_NO_EDIT_PERMISSION) {
        $display .= COM_showMessageText($LANG24[41], $LANG_ACCESS['accessdenied'], true);
        $display .= STORY_renderArticle($story, 'p');
        COM_accessLog("User {$_USER['username']} tried to illegally edit story {$sid}. - STORY_EDIT_DENIED or STORY_EXISTING_NO_EDIT_PERMISSION");
        return $display;
    } elseif ($result == STORY_INVALID_SID) {
        if ($action == 'moderate') {
            // that submission doesn't seem to be there any more (may have been
            // handled by another Admin) - take us back to the moderation page
            echo COM_refresh($_CONF['site_admin_url'] . '/moderation.php');
        } else {
            echo COM_refresh($_CONF['site_admin_url'] . '/story.php');
        }
    } elseif ($result == STORY_DUPLICATE_SID) {
        $story_templates->set_var('error_message', $LANG24[24]);
    } elseif ($result == STORY_EMPTY_REQUIRED_FIELDS) {
        $story_templates->set_var('error_message', $LANG24[31]);
    }
    if (empty($currenttopic) && $story->EditElements('tid') == '') {
        $story->setTid(DB_getItem($_TABLES['topics'], 'tid', 'is_default = 1' . COM_getPermSQL('AND')));
    } else {
        if ($story->EditElements('tid') == '') {
            $story->setTid($currenttopic);
        }
    }
    if (SEC_hasRights('story.edit')) {
        $allowedTopicList = COM_topicList('tid,topic', $story->EditElements('tid'), 1, true, 0);
        $allowedAltTopicList = '<option value="">' . $LANG33[44] . '</option>' . COM_topicList('tid,topic', $story->EditElements('alternate_tid'), 1, true, 0);
    } else {
        $allowedTopicList = COM_topicList('tid,topic', $story->EditElements('tid'), 1, true, 3);
        $allowedAltTopicList = '<option value="">' . $LANG33[44] . '</option>' . COM_topicList('tid,topic', $story->EditElements('alternate_tid'), 1, true, 3);
    }
    if ($allowedTopicList == '') {
        $display .= COM_showMessageText($LANG24[42], $LANG_ACCESS['accessdenied'], true);
        COM_accessLog("User {$_USER['username']} tried to illegally access story {$sid}. No allowed topics.");
        return $display;
    }
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/story.php', 'text' => $LANG_ADMIN['story_list']), array('url' => $_CONF['site_admin_url'] . '/moderation.php', 'text' => $LANG_ADMIN['submissions']));
    if (SEC_inGroup('Root')) {
        $menu_arr[] = array('url' => $_CONF['site_admin_url'] . '/story.php?global=x', 'text' => 'Global Settings');
    }
    $menu_arr[] = array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']);
    require_once $_CONF['path_system'] . 'classes/navbar.class.php';
    $story_templates->set_var('hour_mode', $_CONF['hour_mode']);
    if ($story->hasContent()) {
        $previewContent = STORY_renderArticle($story, 'p');
        if ($previewContent != '') {
            $story_templates->set_var('preview_content', $previewContent);
        }
    }
    $navbar = new navbar();
    if (!empty($previewContent)) {
        $navbar->add_menuitem($LANG24[79], 'showhideEditorDiv("preview",0);return false;', true);
        $navbar->add_menuitem($LANG24[80], 'showhideEditorDiv("editor",1);return false;', true);
        $navbar->add_menuitem($LANG24[81], 'showhideEditorDiv("publish",2);return false;', true);
        $navbar->add_menuitem($LANG24[82], 'showhideEditorDiv("images",3);return false;', true);
        $navbar->add_menuitem($LANG24[83], 'showhideEditorDiv("archive",4);return false;', true);
        $navbar->add_menuitem($LANG24[84], 'showhideEditorDiv("perms",5);return false;', true);
        $navbar->add_menuitem($LANG24[85], 'showhideEditorDiv("all",6);return false;', true);
    } else {
        $navbar->add_menuitem($LANG24[80], 'showhideEditorDiv("editor",0);return false;', true);
        $navbar->add_menuitem($LANG24[81], 'showhideEditorDiv("publish",1);return false;', true);
        $navbar->add_menuitem($LANG24[82], 'showhideEditorDiv("images",2);return false;', true);
        $navbar->add_menuitem($LANG24[83], 'showhideEditorDiv("archive",3);return false;', true);
        $navbar->add_menuitem($LANG24[84], 'showhideEditorDiv("perms",4);return false;', true);
        $navbar->add_menuitem($LANG24[85], 'showhideEditorDiv("all",5);return false;', true);
    }
    if ($action == 'preview') {
        $story_templates->set_var('show_preview', '');
        $story_templates->set_var('show_htmleditor', 'none');
        $story_templates->set_var('show_texteditor', 'none');
        $story_templates->set_var('show_submitoptions', 'none');
        $navbar->set_selected($LANG24[79]);
    } else {
        $navbar->set_selected($LANG24[80]);
        $story_templates->set_var('show_preview', 'none');
    }
    $story_templates->set_var('navbar', $navbar->generate());
    $story_templates->set_var('start_block', COM_startBlock($title, '', COM_getBlockTemplate('_admin_block', 'header')));
    // start generating the story editor block
    $story_templates->set_var('block_start', COM_startBlock($title, '', COM_getBlockTemplate('_admin_block', 'header')));
    $oldsid = $story->EditElements('originalSid');
    if (!empty($oldsid)) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="deletestory"%s/>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $story_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        $story_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
        $story_templates->set_var('lang_delete_confirm', $MESSAGE[76]);
    }
    if ($submission || $story->type == 'submission') {
        $story_templates->set_var('submission_option', '<input type="hidden" name="type" value="submission"/>');
    }
    $story_templates->set_var('admin_menu', ADMIN_createMenu($menu_arr, $LANG24[92], $_CONF['layout_url'] . '/images/icons/story.' . $_IMAGE_TYPE));
    $story_templates->set_var('lang_author', $LANG24[7]);
    $storyauthor = COM_getDisplayName($story->EditElements('uid'));
    $storyauthor_select = COM_optionList($_TABLES['users'], 'uid,username', $story->EditElements('uid'));
    $story_templates->set_var('story_author', $storyauthor);
    $story_templates->set_var('story_author_select', $storyauthor_select);
    $story_templates->set_var('author', $storyauthor);
    $story_templates->set_var('story_uid', $story->EditElements('uid'));
    // user access info
    $story_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
    $story_templates->set_var('lang_owner', $LANG_ACCESS['owner']);
    $ownername = COM_getDisplayName($story->EditElements('owner_id'));
    $story_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', 'uid = ' . (int) $story->EditElements('owner_id')));
    $story_templates->set_var('owner_name', $ownername);
    $story_templates->set_var('owner', $ownername);
    $story_templates->set_var('owner_id', $story->EditElements('owner_id'));
    if (SEC_hasRights('story.edit')) {
        $story_templates->set_var('owner_dropdown', COM_buildOwnerList('owner_id', $story->EditElements('owner_id')));
    } else {
        $ownerInfo = '<input type="hidden" name="owner_id" value="' . $story->editElements('owner_id') . '" />' . $ownername;
        $story_templates->set_var('owner_dropdown', $ownerInfo);
    }
    $story_templates->set_var('lang_group', $LANG_ACCESS['group']);
    if (SEC_inGroup($story->EditElements('group_id'))) {
        $story_templates->set_var('group_dropdown', SEC_getGroupDropdown($story->EditElements('group_id'), 3));
    } else {
        $gdrpdown = '<input type="hidden" name="group_id" value="' . $story->EditElements('group_id') . '"/>';
        $grpddown .= DB_getItem($_TABLES['groups'], 'grp_name', 'grp_id=' . (int) $story->EditElements('group_id'));
        $story_templates->set_var('group_dropdown', $grpddown);
    }
    $story_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']);
    $story_templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
    $story_templates->set_var('permissions_editor', SEC_getPermissionsHTML($story->EditElements('perm_owner'), $story->EditElements('perm_group'), $story->EditElements('perm_members'), $story->EditElements('perm_anon')));
    $story_templates->set_var('permissions_msg', $LANG_ACCESS['permmsg']);
    $curtime = COM_getUserDateTimeFormat($story->EditElements('date'));
    $story_templates->set_var('lang_date', $LANG24[15]);
    $story_templates->set_var('publish_second', $story->EditElements('publish_second'));
    $publish_ampm = '';
    $publish_hour = $story->EditElements('publish_hour');
    if ($publish_hour >= 12) {
        if ($publish_hour > 12) {
            $publish_hour = $publish_hour - 12;
        }
        $ampm = 'pm';
    } else {
        $ampm = 'am';
    }
    $ampm_select = COM_getAmPmFormSelection('publish_ampm', $ampm);
    $story_templates->set_var('publishampm_selection', $ampm_select);
    $month_options = COM_getMonthFormOptions($story->EditElements('publish_month'));
    $story_templates->set_var('publish_month_options', $month_options);
    $day_options = COM_getDayFormOptions($story->EditElements('publish_day'));
    $story_templates->set_var('publish_day_options', $day_options);
    $year_options = COM_getYearFormOptions($story->EditElements('publish_year'));
    $story_templates->set_var('publish_year_options', $year_options);
    if ($_CONF['hour_mode'] == 24) {
        $hour_options = COM_getHourFormOptions($story->EditElements('publish_hour'), 24);
    } else {
        $hour_options = COM_getHourFormOptions($publish_hour);
    }
    $story_templates->set_var('publish_hour_options', $hour_options);
    $minute_options = COM_getMinuteFormOptions($story->EditElements('publish_minute'));
    $story_templates->set_var('publish_minute_options', $minute_options);
    $story_templates->set_var('publish_date_explanation', $LANG24[46]);
    $story_templates->set_var('story_unixstamp', $story->EditElements('unixdate'));
    $story_templates->set_var('expire_second', $story->EditElements('expire_second'));
    $expire_ampm = '';
    $expire_hour = $story->EditElements('expire_hour');
    if ($expire_hour >= 12) {
        if ($expire_hour > 12) {
            $expire_hour = $expire_hour - 12;
        }
        $ampm = 'pm';
    } else {
        $ampm = 'am';
    }
    $ampm_select = COM_getAmPmFormSelection('expire_ampm', $ampm);
    if (empty($ampm_select)) {
        // have a hidden field to 24 hour mode to prevent JavaScript errors
        $ampm_select = '<input type="hidden" name="expire_ampm" value=""/>';
    }
    $story_templates->set_var('expireampm_selection', $ampm_select);
    $month_options = COM_getMonthFormOptions($story->EditElements('expire_month'));
    $story_templates->set_var('expire_month_options', $month_options);
    $day_options = COM_getDayFormOptions($story->EditElements('expire_day'));
    $story_templates->set_var('expire_day_options', $day_options);
    $year_options = COM_getYearFormOptions($story->EditElements('expire_year'));
    $story_templates->set_var('expire_year_options', $year_options);
    if ($_CONF['hour_mode'] == 24) {
        $hour_options = COM_getHourFormOptions($story->EditElements('expire_hour'), 24);
    } else {
        $hour_options = COM_getHourFormOptions($expire_hour);
    }
    $story_templates->set_var('expire_hour_options', $hour_options);
    $minute_options = COM_getMinuteFormOptions($story->EditElements('expire_minute'));
    $story_templates->set_var('expire_minute_options', $minute_options);
    $story_templates->set_var('expire_date_explanation', $LANG24[46]);
    $story_templates->set_var('story_unixstamp', $story->EditElements('expirestamp'));
    if ($story->EditElements('statuscode') == STORY_ARCHIVE_ON_EXPIRE) {
        $story_templates->set_var('is_checked2', 'checked="checked"');
        $story_templates->set_var('is_checked3', 'checked="checked"');
        $story_templates->set_var('showarchivedisabled', 'false');
    } elseif ($story->EditElements('statuscode') == STORY_DELETE_ON_EXPIRE) {
        $story_templates->set_var('is_checked2', 'checked="checked"');
        $story_templates->set_var('is_checked4', 'checked="checked"');
        $story_templates->set_var('showarchivedisabled', 'false');
    } else {
        $story_templates->set_var('showarchivedisabled', 'true');
    }
    $story_templates->set_var('lang_archivetitle', $LANG24[58]);
    $story_templates->set_var('lang_option', $LANG24[59]);
    $story_templates->set_var('lang_enabled', $LANG_ADMIN['enabled']);
    $story_templates->set_var('lang_story_stats', $LANG24[87]);
    $story_templates->set_var('lang_optionarchive', $LANG24[61]);
    $story_templates->set_var('lang_optiondelete', $LANG24[62]);
    $story_templates->set_var('lang_title', $LANG_ADMIN['title']);
    $story_templates->set_var('story_title', $story->EditElements('title'));
    $story_templates->set_var('story_subtitle', $story->EditElements('subtitle'));
    $story_templates->set_var('lang_topic', $LANG_ADMIN['topic']);
    $story_templates->set_var('lang_alt_topic', $LANG_ADMIN['alt_topic']);
    $story_templates->set_var('topic_options', $allowedTopicList);
    $story_templates->set_var('alt_topic_options', $allowedAltTopicList);
    $story_templates->set_var('lang_show_topic_icon', $LANG24[56]);
    if ($story->EditElements('show_topic_icon') == 1) {
        $story_templates->set_var('show_topic_icon_checked', 'checked="checked"');
    } else {
        $story_templates->set_var('show_topic_icon_checked', '');
    }
    $story_templates->set_var('story_image_url', $story->EditElements('story_image'));
    $story_templates->set_var('lang_draft', $LANG24[34]);
    if ($story->EditElements('draft_flag')) {
        $story_templates->set_var('is_checked', 'checked="checked"');
        $story_templates->set_var('unpublished_selected', 'selected="selected"');
    } else {
        $story_templates->set_var('published_selected', 'selected="selected"');
    }
    $story_templates->set_var('lang_mode', $LANG24[3]);
    $story_templates->set_var('status_options', COM_optionList($_TABLES['statuscodes'], 'code,name', $story->EditElements('statuscode')));
    $story_templates->set_var('comment_options', COM_optionList($_TABLES['commentcodes'], 'code,name', $story->EditElements('commentcode')));
    $story_templates->set_var('trackback_options', COM_optionList($_TABLES['trackbackcodes'], 'code,name', $story->EditElements('trackbackcode')));
    // comment expire
    $story_templates->set_var('lang_cmt_disable', $LANG24[63]);
    if ($story->EditElements('cmt_close')) {
        $story_templates->set_var('is_checked5', 'checked="checked"');
        //check box if enabled
        $story_templates->set_var('showcmtclosedisabled', 'false');
    } else {
        $story_templates->set_var('showcmtclosedisabled', 'true');
    }
    $month_options = COM_getMonthFormOptions($story->EditElements('cmt_close_month'));
    $story_templates->set_var('cmt_close_month_options', $month_options);
    $day_options = COM_getDayFormOptions($story->EditElements('cmt_close_day'));
    $story_templates->set_var('cmt_close_day_options', $day_options);
    $year_options = COM_getYearFormOptions($story->EditElements('cmt_close_year'));
    $story_templates->set_var('cmt_close_year_options', $year_options);
    $cmt_close_ampm = '';
    $cmt_close_hour = $story->EditElements('cmt_close_hour');
    //correct hour
    if ($cmt_close_hour >= 12) {
        if ($cmt_close_hour > 12) {
            $cmt_close_hour = $cmt_close_hour - 12;
        }
        $ampm = 'pm';
    } else {
        $ampm = 'am';
    }
    $ampm_select = COM_getAmPmFormSelection('cmt_close_ampm', $ampm);
    if (empty($ampm_select)) {
        // have a hidden field to 24 hour mode to prevent JavaScript errors
        $ampm_select = '<input type="hidden" name="cmt_close_ampm" value="" />';
    }
    $story_templates->set_var('cmt_close_ampm_selection', $ampm_select);
    if ($_CONF['hour_mode'] == 24) {
        $hour_options = COM_getHourFormOptions($story->EditElements('cmt_close_hour'), 24);
    } else {
        $hour_options = COM_getHourFormOptions($cmt_close_hour);
    }
    $story_templates->set_var('cmt_close_hour_options', $hour_options);
    $minute_options = COM_getMinuteFormOptions($story->EditElements('cmt_close_minute'));
    $story_templates->set_var('cmt_close_minute_options', $minute_options);
    $story_templates->set_var('cmt_close_second', $story->EditElements('cmt_close_second'));
    if ($_CONF['onlyrootfeatures'] == 1 && SEC_inGroup('Root') or $_CONF['onlyrootfeatures'] !== 1) {
        $featured_options = "<select name=\"featured\">" . LB . COM_optionList($_TABLES['featurecodes'], 'code,name', $story->EditElements('featured')) . "</select>" . LB;
        $featured_options_data = COM_optionList($_TABLES['featurecodes'], 'code,name', $story->EditElements('featured'));
        $story_templates->set_var('featured_options_data', $featured_options_data);
    } else {
        $featured_options = "<input type=\"hidden\" name=\"featured\" value=\"0\"/>";
        $story_templates->unset_var('featured_options_data');
    }
    $story_templates->set_var('featured_options', $featured_options);
    $story_templates->set_var('frontpage_options', COM_optionList($_TABLES['frontpagecodes'], 'code,name', $story->EditElements('frontpage')));
    $story_templates->set_var('story_introtext', $story->EditElements('introtext'));
    $story_templates->set_var('story_bodytext', $story->EditElements('bodytext'));
    $story_templates->set_var('lang_introtext', $LANG24[16]);
    $story_templates->set_var('lang_bodytext', $LANG24[17]);
    $story_templates->set_var('lang_postmode', $LANG24[4]);
    $story_templates->set_var('lang_publishoptions', $LANG24[76]);
    $story_templates->set_var('lang_publishdate', $LANG24[69]);
    $story_templates->set_var('lang_nojavascript', $LANG24[77]);
    $story_templates->set_var('postmode', $story->EditElements('postmode'));
    if ($story->EditElements('postmode') == 'plaintext' || $story->EditElements('postmode') == 'text') {
        $allowedHTML = '';
    } else {
        $allowedHTML = COM_allowedHTML(SEC_getUserPermissions(), false, 'glfusion', 'story') . '<br/>';
    }
    $allowedHTML .= COM_allowedAutotags(SEC_getUserPermissions(), false, 'glfusion', 'story');
    $story_templates->set_var('lang_allowed_html', $allowedHTML);
    $fileinputs = '';
    $saved_images = '';
    if ($_CONF['maximagesperarticle'] > 0) {
        $story_templates->set_var('lang_images', $LANG24[47]);
        $icount = DB_count($_TABLES['article_images'], 'ai_sid', DB_escapeString($story->getSid()));
        if ($icount > 0) {
            $result_articles = DB_query("SELECT * FROM {$_TABLES['article_images']} WHERE ai_sid = '" . DB_escapeString($story->getSid()) . "'");
            for ($z = 1; $z <= $icount; $z++) {
                $I = DB_fetchArray($result_articles);
                $saved_images .= $z . ') ' . COM_createLink($I['ai_filename'], $_CONF['site_url'] . '/images/articles/' . $I['ai_filename']) . '&nbsp;&nbsp;&nbsp;' . $LANG_ADMIN['delete'] . ': <input type="checkbox" name="delete[' . $I['ai_img_num'] . ']" /><br />';
            }
        }
        $newallowed = $_CONF['maximagesperarticle'] - $icount;
        for ($z = $icount + 1; $z <= $_CONF['maximagesperarticle']; $z++) {
            $fileinputs .= $z . ') <input type="file" dir="ltr" name="file[]' . '" />';
            if ($z < $_CONF['maximagesperarticle']) {
                $fileinputs .= '<br />';
            }
        }
        $fileinputs .= '<br />' . $LANG24[51];
        if ($_CONF['allow_user_scaling'] == 1) {
            $fileinputs .= $LANG24[27];
        }
        $fileinputs .= $LANG24[28] . '<br />';
    }
    $story_templates->set_var('saved_images', $saved_images);
    $story_templates->set_var('image_form_elements', $fileinputs);
    $story_templates->set_var('lang_hits', $LANG24[18]);
    $story_templates->set_var('story_hits', $story->EditElements('hits'));
    $story_templates->set_var('lang_comments', $LANG24[19]);
    $story_templates->set_var('story_comments', $story->EditElements('comments'));
    $story_templates->set_var('lang_trackbacks', $LANG24[29]);
    $story_templates->set_var('story_trackbacks', $story->EditElements('trackbacks'));
    $story_templates->set_var('lang_emails', $LANG24[39]);
    $story_templates->set_var('story_emails', $story->EditElements('numemails'));
    if ($_CONF['rating_enabled']) {
        $rating = @number_format($story->EditElements('rating'), 2);
        $votes = $story->EditElements('votes');
        $story_templates->set_var('rating', $rating);
        $story_templates->set_var('votes', $votes);
    }
    $story_templates->set_var('attribution_url', $story->EditElements('attribution_url'));
    $story_templates->set_var('attribution_name', $story->EditElements('attribution_name'));
    $story_templates->set_var('attribution_author', $story->EditElements('attribution_author'));
    $story_templates->set_var('lang_attribution_url', $LANG24[105]);
    $story_templates->set_var('lang_attribution_name', $LANG24[106]);
    $story_templates->set_var('lang_attribution_author', $LANG24[107]);
    $story_templates->set_var('lang_attribution', $LANG24[108]);
    $sec_token_name = CSRF_TOKEN;
    $sec_token = SEC_createToken();
    $story_templates->set_var('story_id', $story->getSid());
    $story_templates->set_var('old_story_id', $story->EditElements('originalSid'));
    $story_templates->set_var('lang_sid', $LANG24[12]);
    $story_templates->set_var('lang_save', $saveoption);
    $story_templates->set_var('lang_preview', $LANG_ADMIN['preview']);
    $story_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $story_templates->set_var('lang_delete', $LANG_ADMIN['delete']);
    $story_templates->set_var('lang_timeout', $LANG_ADMIN['timeout_msg']);
    $story_templates->set_var('gltoken_name', CSRF_TOKEN);
    $story_templates->set_var('gltoken', $sec_token);
    $story_templates->set_var('security_token', $sec_token);
    $story_templates->set_var('security_token_name', $sec_token_name);
    $story_templates->set_var('end_block', COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')));
    PLG_templateSetVars('storyeditor', $story_templates);
    if ($story->EditElements('postmode') != 'html') {
        $story_templates->unset_var('wysiwyg');
    }
    SEC_setCookie($_CONF['cookie_name'] . 'adveditor', SEC_createTokenGeneral('advancededitor'), time() + 1200, $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure'], false);
    $story_templates->parse('output', 'editor');
    $display .= $story_templates->finish($story_templates->get_var('output'));
    return $display;
}
Esempio n. 18
0
/**
* Shows the links editor
*
* @param  string  $action   'edit' or 'moderate'
* @param  string  $lid    ID of link to edit
* @global array core config vars
* @global array core group data
* @global array core table data
* @global array core user data
* @global array links plugin config vars
* @global array links plugin lang vars
* @global array core lang access vars
* @return string HTML for the link editor form
*
*/
function LINK_edit($action, $lid = '')
{
    global $_CONF, $_GROUPS, $_TABLES, $_USER, $_LI_CONF, $LANG_LINKS_ADMIN, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE;
    USES_lib_admin();
    $retval = '';
    switch ($action) {
        case 'edit':
            $blocktitle = $LANG_LINKS_ADMIN[1];
            // Link Editor
            $saveoption = $LANG_ADMIN['save'];
            // Save
            break;
        case 'moderate':
            $blocktitle = $LANG_LINKS_ADMIN[65];
            // Moderate Link
            $saveoption = $LANG_ADMIN['moderate'];
            // Save & Approve
            break;
    }
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/plugins/links/index.php', 'text' => $LANG_LINKS_ADMIN[53]), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $link_templates = new Template($_CONF['path'] . 'plugins/links/templates/admin/');
    $link_templates->set_file('editor', 'linkeditor.thtml');
    $link_templates->set_var('lang_pagetitle', $LANG_LINKS_ADMIN[28]);
    $link_templates->set_var('lang_link_list', $LANG_LINKS_ADMIN[53]);
    $link_templates->set_var('lang_new_link', $LANG_LINKS_ADMIN[51]);
    $link_templates->set_var('lang_validate_links', $LANG_LINKS_ADMIN[26]);
    $link_templates->set_var('lang_list_categories', $LANG_LINKS_ADMIN[50]);
    $link_templates->set_var('lang_new_category', $LANG_LINKS_ADMIN[52]);
    $link_templates->set_var('lang_admin_home', $LANG_ADMIN['admin_home']);
    $link_templates->set_var('instructions', $LANG_LINKS_ADMIN[29]);
    if ($action != 'moderate' and !empty($lid)) {
        $result = DB_query("SELECT * FROM {$_TABLES['links']} WHERE lid ='{$lid}'");
        if (DB_numRows($result) !== 1) {
            $msg = COM_startBlock($LANG_LINKS_ADMIN[24], '', COM_getBlockTemplate('_msg_block', 'header'));
            $msg .= $LANG_LINKS_ADMIN[25];
            $msg .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
            return $msg;
        }
        $A = DB_fetchArray($result);
        $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
        if ($access == 0 or $access == 2) {
            $retval .= COM_startBlock($LANG_LINKS_ADMIN[16], '', COM_getBlockTemplate('_msg_block', 'header'));
            $retval .= $LANG_LINKS_ADMIN[17];
            $retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
            COM_accessLog("User {$_USER['username']} tried to illegally submit or edit link {$lid}.");
            return $retval;
        }
    } else {
        if ($action == 'moderate') {
            $result = DB_query("SELECT * FROM {$_TABLES['linksubmission']} WHERE lid = '{$lid}'");
            $A = DB_fetchArray($result);
        } else {
            $A['lid'] = COM_makesid();
            $A['cid'] = '';
            $A['url'] = '';
            $A['description'] = '';
            $A['title'] = '';
            $A['owner_id'] = $_USER['uid'];
        }
        $A['hits'] = 0;
        if (isset($_GROUPS['Links Admin'])) {
            $A['group_id'] = $_GROUPS['Links Admin'];
        } else {
            $A['group_id'] = SEC_getFeatureGroup('links.edit');
        }
        SEC_setDefaultPermissions($A, $_LI_CONF['default_permissions']);
        $access = 3;
    }
    $retval .= COM_startBlock($blocktitle, '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= ADMIN_createMenu($menu_arr, $LANG_LINKS_ADMIN[66], plugin_geticon_links());
    $link_templates->set_var('link_id', $A['lid']);
    if (!empty($lid) && SEC_hasRights('links.edit')) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="delete"%s>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $link_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        $link_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
        $link_templates->set_var('delete_confirm_msg', $MESSAGE[76]);
        if ($action == 'moderate') {
            $link_templates->set_var('submission_option', '<input type="hidden" name="type" value="submission">');
        }
    }
    $link_templates->set_var('lang_linktitle', $LANG_LINKS_ADMIN[3]);
    $link_templates->set_var('link_title', htmlspecialchars($A['title']));
    $link_templates->set_var('lang_linkid', $LANG_LINKS_ADMIN[2]);
    $link_templates->set_var('lang_linkurl', $LANG_LINKS_ADMIN[4]);
    $link_templates->set_var('max_url_length', 255);
    $link_templates->set_var('link_url', $A['url']);
    $link_templates->set_var('lang_includehttp', $LANG_LINKS_ADMIN[6]);
    $link_templates->set_var('lang_category', $LANG_LINKS_ADMIN[5]);
    $othercategory = links_select_box(3, $A['cid']);
    $link_templates->set_var('category_options', $othercategory);
    $link_templates->set_var('lang_ifotherspecify', $LANG_LINKS_ADMIN[20]);
    $link_templates->set_var('category', $othercategory);
    $link_templates->set_var('lang_linkhits', $LANG_LINKS_ADMIN[8]);
    $link_templates->set_var('link_hits', $A['hits']);
    $link_templates->set_var('lang_linkdescription', $LANG_LINKS_ADMIN[9]);
    $link_templates->set_var('link_description', $A['description']);
    $link_templates->set_var('lang_save', $saveoption);
    $link_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    // user access info
    $link_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
    $link_templates->set_var('lang_owner', $LANG_ACCESS['owner']);
    $ownername = COM_getDisplayName($A['owner_id']);
    $link_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}"));
    $link_templates->set_var('owner_name', $ownername);
    $link_templates->set_var('owner', $ownername);
    $link_templates->set_var('link_ownerid', $A['owner_id']);
    $link_templates->set_var('lang_group', $LANG_ACCESS['group']);
    $link_templates->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access));
    $link_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']);
    $link_templates->set_var('lang_permissionskey', $LANG_ACCESS['permissionskey']);
    $link_templates->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']));
    $link_templates->set_var('lang_lockmsg', $LANG_ACCESS['permmsg']);
    $link_templates->set_var('gltoken_name', CSRF_TOKEN);
    $link_templates->set_var('gltoken', SEC_createToken());
    $link_templates->parse('output', 'editor');
    $retval .= $link_templates->finish($link_templates->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
Esempio n. 19
0
/**
*   Administer user registrations.
*   This will appear in the admin area for administrators, and as part of
*   the event detail for event owners.  Owners can delete registrations.
*
*   @param  integer $rp_id      Repeat ID being viewed or checked
*   @return string              HTML for admin list
*/
function EVLIST_adminRSVP($rp_id)
{
    global $LANG_EVLIST, $LANG_ADMIN, $_TABLES, $_CONF, $_IMAGE_TYPE;
    /*
    +-------------------+----------+-------------------+-------+-------+-------+-----+------+------+
    | tic_id            | tic_type | ev_id             | rp_id | fee   | paid  | uid | used | dt   |
    +-------------------+----------+-------------------+-------+-------+-------+-----+------+------+
    | 20150209083155975 |        1 | 20150209081055236 |  7552 | 15.00 | 15.00 |   3 |    0 |    0 |
    +-------------------+----------+-------------------+-------+-------+-------+-----+------+------+
    1 row in set (0.00 sec)
    */
    USES_lib_admin();
    USES_evlist_class_repeat();
    $Ev = new evRepeat($rp_id);
    if ($Ev->rp_id == 0) {
        return '';
    }
    DB_query("SET @tk_count = 0;");
    $sql = "SELECT @tk_count := @tk_count +1 as tic_count,\n                    tk.dt, tk.tic_id, tk.tic_type, tk.rp_id, tk.fee, tk.paid,\n                    tk.uid, tk.used, tt.description, u.fullname,\n                    {$Ev->Event->options['max_rsvp']} as max_rsvp\n            FROM {$_TABLES['evlist_tickets']} tk\n            LEFT JOIN {$_TABLES['evlist_tickettypes']} tt\n                ON tt.id = tk.tic_type\n            LEFT JOIN {$_TABLES['users']} u\n                ON u.uid = tk.uid\n            WHERE tk.ev_id = '{$Ev->Event->id}' ";
    $title = $LANG_EVLIST['pi_title'] . ': ' . $LANG_EVLIST['admin_rsvp'] . ' -- ' . COM_createLink($Ev->Event->Detail->title . ' (' . $Ev->date_start . ')', EVLIST_URL . '/event.php?eid=' . $rp_id);
    $title .= '&nbsp;&nbsp;&nbsp;<a href="' . $_CONF['site_admin_url'] . '/plugins/evlist/index.php?printtickets&eid=' . $Ev->ev_id . '" class="lgButton blue" target="_new">' . $LANG_EVLIST['print_tickets'] . '</a>';
    $title .= '&nbsp;&nbsp;&nbsp;<a href="' . $_CONF['site_admin_url'] . '/plugins/evlist/index.php?exporttickets&eid=' . $Ev->rp_id . '" class="lgButton blue">' . $LANG_EVLIST['export_list'] . '</a>';
    if ($Ev->Event->options['use_reg'] == EV_RSVP_REPEAT) {
        $sql .= " AND rp_id = '{$Ev->rp_id}' ";
    }
    $defsort_arr = array('field' => 'dt', 'direction' => 'ASC');
    $text_arr = array('has_menu' => false, 'has_extras' => false, 'title' => $title, 'form_url' => EVLIST_URL . '/event.php?rp_id=' . $rp_id, 'help_url' => '');
    $header_arr = array(array('text' => $LANG_EVLIST['rsvp_date'], 'field' => 'dt', 'sort' => true), array('text' => $LANG_EVLIST['name'], 'field' => 'fullname', 'sort' => false), array('text' => $LANG_EVLIST['fee'], 'field' => 'fee', 'sort' => false), array('text' => $LANG_EVLIST['paid'], 'field' => 'paid', 'sort' => false), array('text' => $LANG_EVLIST['ticket_num'], 'field' => 'tic_id', 'sort' => false), array('text' => $LANG_EVLIST['date_used'], 'field' => 'used', 'sort' => false), array('text' => $LANG_EVLIST['waitlisted'], 'field' => 'tic_count', 'sort' => false));
    $options_arr = array('chkdelete' => true, 'chkfield' => 'tic_id', 'chkname' => 'delrsvp', 'chkactions' => '<input data-uk-tooltip name="tickdelete" type="image" src="' . $_CONF['layout_url'] . '/images/admin/delete.' . $_IMAGE_TYPE . '" style="vertical-align:text-bottom;" title="' . $LANG_ADMIN['delete'] . '" class="gl_mootip"' . ' onclick="return confirm(\'' . $LANG_EVLIST['conf_del_item'] . '\');" />&nbsp;' . $LANG_ADMIN['delete'] . '&nbsp;&nbsp;' . '<input data-uk-tooltip name="tickreset" type="image" src="' . $_CONF['site_url'] . '/evlist/images/reset.png' . '" style="vertical-align:text-bottom;" title="' . $LANG_EVLIST['reset_usage'] . '" class="gl_mootip"' . ' onclick="return confirm(\'' . $LANG_EVLIST['conf_reset'] . '\');" />&nbsp;' . $LANG_EVLIST['reset_usage'] . '<input type="hidden" name="ev_id" value="' . $rp_id . '"/>');
    $query_arr = array('sql' => $sql);
    $retval .= ADMIN_list('evlist', 'EVLIST_getField_rsvp', $header_arr, $text_arr, $query_arr, $defsort_arr, '', '', $options_arr);
    return $retval;
}
Esempio n. 20
0
function FF_lastx()
{
    global $_CONF, $_TABLES, $_USER, $_FF_CONF, $LANG_GF01, $LANG_GF02, $LANG_GF92;
    $retval = '';
    $pageTitle = $LANG_GF01['LASTX'];
    USES_lib_admin();
    USES_lib_html2text();
    $T = new Template($_CONF['path'] . 'plugins/forum/templates/');
    $T->set_file('list', 'lists.thtml');
    $dt = new Date('now', $_USER['tzid']);
    $header_arr = array(array('text' => $LANG_GF01['FORUM'], 'field' => 'forum'), array('text' => $LANG_GF01['TOPIC'], 'field' => 'subject'), array('text' => $LANG_GF92['sb_latestposts'], 'field' => 'date', 'nowrap' => true));
    $data_arr = array();
    $text_arr = array();
    if ($_FF_CONF['usermenu'] == 'navbar') {
        $T->set_var('navbar', FF_NavbarMenu($LANG_GF01['LASTX']));
    }
    $T->set_var('block_start', COM_startBlock($LANG_GF01['LASTX'], '', COM_getBlockTemplate('_admin_block', 'header')));
    $groups = array();
    $usergroups = SEC_getUserGroups();
    foreach ($usergroups as $group) {
        $groups[] = $group;
    }
    $grouplist = implode(',', $groups);
    if (!COM_isAnonUser() && $_FF_CONF['enable_user_rating_system']) {
        $grade = (int) _ff_getUserRating((int) $_USER['uid']);
        $ratingSQL = ' AND b.rating_view <= ' . $grade . ' ';
    } else {
        $ratingSQL = '';
    }
    $sql = "SELECT * ";
    $sql .= "FROM {$_TABLES['ff_topic']} a ";
    $sql .= "LEFT JOIN {$_TABLES['ff_forums']} b ON a.forum=b.forum_id ";
    $sql .= "WHERE pid=0 AND b.grp_id IN ({$grouplist}) AND b.no_newposts = 0 " . $ratingSQL;
    $sql .= "ORDER BY lastupdated DESC LIMIT {$_FF_CONF['show_last_post_count']}";
    $result = DB_query($sql);
    $nrows = DB_numRows($result);
    $displayrecs = 0;
    for ($i = 1; $i <= $nrows; $i++) {
        $P = DB_fetchArray($result);
        if ($_FF_CONF['use_censor']) {
            $P['subject'] = COM_checkWords($P['subject']);
            $P['comment'] = COM_checkWords($P['comment']);
        }
        $topic_id = $P['id'];
        $displayrecs++;
        $dt->setTimestamp($P['date']);
        $firstdate = $dt->format($_FF_CONF['default_Datetime_format'], true);
        $dt->setTimestamp($P['lastupdated']);
        $lastdate = $dt->format($_FF_CONF['default_Datetime_format'], true);
        if ($P['uid'] > 1) {
            $topicinfo = "{$LANG_GF01['STARTEDBY']} " . COM_getDisplayName($P['uid']) . ', ';
        } else {
            $topicinfo = "{$LANG_GF01['STARTEDBY']} {$P['name']},";
        }
        $topicinfo .= "{$firstdate}<br/>{$LANG_GF01['VIEWS']}:{$P['views']}, {$LANG_GF01['REPLIES']}:{$P['replies']}<br/>";
        if (empty($P['last_reply_rec']) || $P['last_reply_rec'] < 1) {
            $lastid = $P['id'];
            $testText = FF_formatTextBlock($P['comment'], 'text', 'text', $P['status']);
            $testText = strip_tags($testText);
            $html2txt = new html2text($testText, false);
            $testText = trim($html2txt->get_text());
            $lastpostinfogll = @htmlspecialchars(preg_replace('#\\r?\\n#', '<br>', strip_tags(substr($testText, 0, $_FF_CONF['contentinfo_numchars']) . '...')), ENT_QUOTES, COM_getEncodingt());
        } else {
            $qlreply = DB_query("SELECT id,uid,name,comment,date,status FROM {$_TABLES['ff_topic']} WHERE id={$P['last_reply_rec']}");
            $B = DB_fetchArray($qlreply);
            $lastid = $B['id'];
            $lastcomment = $B['comment'];
            $P['date'] = $B['date'];
            if ($B['uid'] > 1) {
                $topicinfo .= sprintf($LANG_GF01['LASTREPLYBY'], COM_getDisplayName($B['uid']));
            } else {
                $topicinfo .= sprintf($LANG_GF01['LASTREPLYBY'], $B['name']);
            }
            $testText = FF_formatTextBlock($B['comment'], 'text', 'text', $B['status']);
            $testText = strip_tags($testText);
            $html2txt = new html2text($testText, false);
            $testText = trim($html2txt->get_text());
            $lastpostinfogll = @htmlspecialchars(preg_replace('#\\r?\\n#', '<br>', strip_tags(substr($testText, 0, $_FF_CONF['contentinfo_numchars']) . '...')), ENT_QUOTES, COM_getEncodingt());
        }
        $link = '<a class="' . COM_getTooltipStyle() . '" style="text-decoration:none; white-space:nowrap;" href="' . $_CONF['site_url'] . '/forum/viewtopic.php?showtopic=' . $topic_id . '&amp;lastpost=true#' . $lastid . '" title="' . @htmlspecialchars($P['subject'], ENT_QUOTES, COM_getEncodingt()) . '::' . $lastpostinfogll . '" rel="nofollow">';
        $topiclink = '<a class="' . COM_getTooltipStyle() . '" style="text-decoration:none;" href="' . $_CONF['site_url'] . '/forum/viewtopic.php?showtopic=' . $topic_id . '" title="' . @htmlspecialchars($P['subject'], ENT_QUOTES, COM_getEncodingt()) . '::' . $topicinfo . '">' . $P['subject'] . '</a>';
        $dt->setTimestamp($P['date']);
        $tdate = $dt->format($_FF_CONF['default_Datetime_format'], true);
        $data_arr[] = array('forum' => $P['forum_name'], 'subject' => $topiclink, 'date' => $link . $tdate . '</a>');
        if ($displayrecs >= $_FF_CONF['show_last_post_count']) {
            break;
        }
    }
    $T->set_var('list_data', ADMIN_simpleList("", $header_arr, $text_arr, $data_arr));
    $T->set_var('block_end', COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')));
    $T->parse('output', 'list');
    $retval = $T->finish($T->get_var('output'));
    return array($pageTitle, $retval);
}
Esempio n. 21
0
/**
* Display weblog directory service editor
*
* @param    int     $pid            ID of the service or 0 for new service
* @param    string  $msg            an error message to display
* @param    string  $new_name       name of the service
* @param    string  $new_site_url   URL of the service's site
* @param    string  $new_ping_url   URL to ping at the service
* @param    string  $new_method     ping method to use
* @param    int     $new_enabled    service is enabled (1) / disabled (0)
* @return   string                  HTML for the editor
*
*/
function TRACKBACK_editService($pid, $msg = '', $new_name = '', $new_site_url = '', $new_ping_url = '', $new_method = '', $new_enabled = -1)
{
    global $_CONF, $_TABLES, $LANG_TRB, $LANG_ADMIN, $MESSAGE, $_IMAGE_TYPE;
    USES_lib_admin();
    $retval = '';
    if ($pid > 0) {
        $result = DB_query("SELECT * FROM {$_TABLES['pingservice']} WHERE pid = '{$pid}'");
        $A = DB_fetchArray($result);
    } else {
        $A['is_enabled'] = 1;
        $A['method'] = 'weblogUpdates.ping';
    }
    if (!empty($new_name)) {
        $A['name'] = $new_name;
    }
    if (!empty($new_site_url)) {
        $A['site_url'] = $new_site_url;
    }
    if (!empty($new_ping_url)) {
        $A['ping_url'] = $new_ping_url;
    }
    if (!empty($new_method)) {
        $A['method'] = $new_method;
    }
    if ($new_enabled >= 0) {
        $A['is_enabled'] = $new_enabled;
    }
    $retval .= COM_siteHeader('menu', $LANG_TRB['edit_service']);
    if (!empty($msg)) {
        $retval .= TRACKBACK_showMessage('Error', $msg);
    }
    $retval .= COM_startBlock($LANG_TRB['edit_service'], $_CONF['site_url'] . '/docs/trackback.html#ping', COM_getBlockTemplate('_admin_block', 'header'));
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/trackback.php', 'text' => $LANG_ADMIN['tb_list']), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $retval .= ADMIN_createMenu($menu_arr, $LANG_TRB['edit_explain'], $_CONF['layout_url'] . '/images/icons/trackback.' . $_IMAGE_TYPE);
    $template = new Template($_CONF['path_layout'] . 'admin/trackback');
    $template->set_file(array('editor' => 'serviceeditor.thtml'));
    $template->set_var('max_url_length', 255);
    $template->set_var('method_ping', 'weblogUpdates.ping');
    $template->set_var('method_ping_extended', 'weblogUpdates.extendedPing');
    $template->set_var('lang_name', $LANG_TRB['service']);
    $template->set_var('lang_site_url', $LANG_TRB['service_website']);
    $template->set_var('lang_ping_url', $LANG_TRB['service_ping_url']);
    $template->set_var('lang_enabled', $LANG_ADMIN['enabled']);
    $template->set_var('lang_method', $LANG_TRB['ping_method']);
    $template->set_var('lang_method_standard', $LANG_TRB['ping_standard']);
    $template->set_var('lang_method_extended', $LANG_TRB['ping_extended']);
    $template->set_var('lang_save', $LANG_ADMIN['save']);
    $template->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    if ($pid > 0) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="servicemode[2]"%s' . '/>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $template->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        $template->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
    } else {
        $template->set_var('delete_option', '');
    }
    if (isset($A['pid'])) {
        $template->set_var('service_id', $A['pid']);
    } else {
        $template->set_var('service_id', '');
    }
    if (isset($A['name'])) {
        $template->set_var('service_name', $A['name']);
    } else {
        $template->set_var('service_name', '');
    }
    if (isset($A['site_url'])) {
        $template->set_var('service_site_url', $A['site_url']);
    } else {
        $template->set_var('service_site_url', '');
    }
    if (isset($A['ping_url'])) {
        $template->set_var('service_ping_url', $A['ping_url']);
    } else {
        $template->set_var('service_ping_url', '');
    }
    if ($A['is_enabled'] == 1) {
        $template->set_var('is_enabled', 'checked="checked"');
    } else {
        $template->set_var('is_enabled', '');
    }
    if ($A['method'] == 'weblogUpdates.ping') {
        $template->set_var('standard_is_checked', 'checked="checked"');
        $template->set_var('extended_is_checked', '');
    } else {
        $template->set_var('standard_is_checked', '');
        $template->set_var('extended_is_checked', 'checked="checked"');
    }
    $template->set_var('gltoken_name', CSRF_TOKEN);
    $template->set_var('gltoken', SEC_createToken());
    $template->parse('output', 'editor');
    $retval .= $template->finish($template->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    $retval .= COM_siteFooter();
    return $retval;
}
Esempio n. 22
0
/**
* Allow easy addition/removal of users to/from a group
*
* @param    int     $grp_id  Group ID
* @return   string          HTML form
*
*/
function GROUP_editUsers($grp_id)
{
    global $_CONF, $_TABLES, $_USER, $LANG_ACCESS, $LANG_ADMIN, $LANG28, $_IMAGE_TYPE;
    USES_lib_admin();
    $retval = '';
    $thisUsersGroups = SEC_getUserGroups();
    $grp_name = DB_getItem($_TABLES['groups'], 'grp_name', "grp_id = '{$grp_id}'");
    if (!empty($grp_id) && $grp_id > 0 && !in_array($grp_id, $thisUsersGroups) && !SEC_groupIsRemoteUserAndHaveAccess($grp_id, $thisUsersGroups) || ($grp_name == 'All Users' || $grp_name == 'Logged-in Users')) {
        if (!SEC_inGroup('Root') && $grp_name == 'Root') {
            $eMsg = $LANG_ACCESS['canteditroot'];
            COM_accessLog("User {$_USER['username']} tried to edit the Root group with insufficient privileges.");
        } else {
            $eMsg = $LANG_ACCESS['canteditgroup'];
        }
        $retval .= COM_showMessageText($eMsg, $LANG_ACCESS['usergroupadmin'], true);
        return $retval;
    }
    $showall = isset($_REQUEST['chk_showall']) && $_REQUEST['chk_showall'] == 1 ? true : false;
    $form_url = $_CONF['site_admin_url'] . '/group.php';
    $form_url .= $showall ? '?chk_showall=1' : '';
    $menu_arr = array(array('url' => $form_url, 'text' => $LANG28[38]), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $retval .= COM_startBlock($LANG_ACCESS['usergroupadmin'] . ' - ' . ucwords($grp_name), '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= ADMIN_createMenu($menu_arr, $LANG_ACCESS['editgroupmsg'], $_CONF['layout_url'] . '/images/icons/group.' . $_IMAGE_TYPE) . '<br />';
    $groupmembers = new Template($_CONF['path_layout'] . 'admin/group');
    $groupmembers->set_file(array('groupmembers' => 'groupmembers.thtml'));
    $groupmembers->set_var('site_url', $_CONF['site_url']);
    $groupmembers->set_var('site_admin_url', $_CONF['site_admin_url']);
    $groupmembers->set_var('group_listing_url', $form_url);
    $groupmembers->set_var('layout_url', $_CONF['layout_url']);
    $groupmembers->set_var('phpself', $form_url);
    $groupmembers->set_var('lang_adminhome', $LANG_ACCESS['adminhome']);
    $groupmembers->set_var('lang_instructions', $LANG_ACCESS['editgroupmsg']);
    $groupmembers->set_var('LANG_sitemembers', $LANG_ACCESS['availmembers']);
    $groupmembers->set_var('LANG_grpmembers', $LANG_ACCESS['groupmembers']);
    $groupmembers->set_var('sitemembers', GROUP_selectUsers($grp_id, true));
    $groupmembers->set_var('group_list', GROUP_selectUsers($grp_id));
    $groupmembers->set_var('LANG_add', $LANG_ACCESS['add']);
    $groupmembers->set_var('LANG_remove', $LANG_ACCESS['remove']);
    $groupmembers->set_var('lang_save', $LANG_ADMIN['save']);
    $groupmembers->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $groupmembers->set_var('lang_grouplist', $LANG28[38]);
    $groupmembers->set_var('show_all', $showall);
    $groupmembers->set_var('group_id', $grp_id);
    $groupmembers->set_var('gltoken_name', CSRF_TOKEN);
    $groupmembers->set_var('gltoken', SEC_createToken());
    $groupmembers->parse('output', 'groupmembers');
    $retval .= $groupmembers->finish($groupmembers->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
Esempio n. 23
0
/**
 * display the block administration list
 *
 */
function BLOCK_list()
{
    global $_CONF, $_TABLES, $LANG_ADMIN, $LANG21, $_IMAGE_TYPE, $blockInterface;
    USES_lib_admin();
    $retval = '';
    // writing the menu on top
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/block.php?edit=x', 'text' => $LANG_ADMIN['create_new']), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $retval .= COM_startBlock($LANG21[19], '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= ADMIN_createMenu($menu_arr, $LANG21[25], $_CONF['layout_url'] . '/images/icons/block.' . $_IMAGE_TYPE);
    BLOCK_reorder();
    // writing the list
    $header_arr = array(array('text' => $LANG_ADMIN['edit'], 'field' => 'edit', 'sort' => false, 'align' => 'center', 'width' => '5%'), array('text' => $LANG21[65], 'field' => 'blockorder', 'sort' => true, 'align' => 'center', 'width' => '8%'), array('text' => $LANG21[46], 'field' => 'move', 'sort' => false, 'align' => 'center', 'width' => '8%'), array('text' => $LANG_ADMIN['name'], 'field' => 'name', 'sort' => true, 'width' => '18%', 'align' => 'center'), array('text' => $LANG_ADMIN['title'], 'field' => 'title', 'sort' => true, 'width' => '18%', 'align' => 'center'), array('text' => $LANG_ADMIN['topic'], 'field' => 'tid', 'sort' => true, 'align' => 'center', 'width' => '18%'), array('text' => $LANG_ADMIN['type'], 'field' => 'type', 'sort' => true, 'align' => 'center', 'width' => '9%'), array('text' => $LANG_ADMIN['delete'], 'field' => 'delete', 'sort' => false, 'align' => 'center', 'width' => '7%'), array('text' => $LANG_ADMIN['enabled'], 'field' => 'is_enabled', 'sort' => true, 'align' => 'center', 'width' => '9%'));
    $defsort_arr = array('field' => 'blockorder', 'direction' => 'asc');
    if (isset($blockInterface['left']['title'])) {
        $label = $blockInterface['left']['title'];
    } else {
        $label = $LANG21[40];
    }
    $text_arr = array('title' => $label, 'form_url' => $_CONF['site_admin_url'] . '/block.php');
    $query_arr = array('table' => 'blocks', 'sql' => "SELECT * FROM {$_TABLES['blocks']} WHERE onleft = 1", 'query_fields' => array('title', 'content'), 'default_filter' => COM_getPermSql('AND'));
    // embed a CSRF token as a hidden var at the top of each of the lists
    // this is used to validate block enable/disable
    $token = SEC_createToken();
    // blockenabler is a hidden field which if set, indicates that one of the
    // blocks has been enabled or disabled - the value is the onleft var
    $form_arr = array('top' => '<input type="hidden" name="' . CSRF_TOKEN . '" value="' . $token . '"/>', 'bottom' => '<input type="hidden" name="blockenabler" value="1">');
    $retval .= ADMIN_list('blocks', 'BLOCK_getListField', $header_arr, $text_arr, $query_arr, $defsort_arr, '', $token, '', $form_arr);
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    $query_arr = array('table' => 'blocks', 'sql' => "SELECT * FROM {$_TABLES['blocks']} WHERE onleft = 0", 'query_fields' => array('title', 'content'), 'default_filter' => COM_getPermSql('AND'));
    if (isset($blockInterface['right']['title'])) {
        $label = $blockInterface['right']['title'];
    } else {
        $label = $LANG21[41];
    }
    $text_arr = array('title' => $label, 'form_url' => $_CONF['site_admin_url'] . '/block.php');
    // blockenabler is a hidden field which if set, indicates that one of the
    // blocks has been enabled or disabled - the value is the onleft var
    $form_arr = array('top' => '<input type="hidden" name="' . CSRF_TOKEN . '" value="' . $token . '"/>', 'bottom' => '<input type="hidden" name="blockenabler" value="0"/>');
    $retval .= ADMIN_list('blocks', 'BLOCK_getListField', $header_arr, $text_arr, $query_arr, $defsort_arr, '', $token, '', $form_arr);
    $outputHandle = outputHandler::getInstance();
    $outputHandle->addLinkScript($_CONF['site_url'] . '/javascript/admin.js', HEADER_PRIO_NORMAL, 'text/javascript');
    return $retval;
}
Esempio n. 24
0
/**
* List available plugins
*
* @return   string                  formatted list of plugins
*
*/
function PLUGINS_list($token)
{
    global $_CONF, $_TABLES, $LANG32, $LANG_ADMIN, $_IMAGE_TYPE, $data_arr;
    USES_lib_admin();
    $T = new Template($_CONF['path_layout'] . 'admin/plugins/');
    $T->set_file('admin-list', 'plugin_list.thtml');
    $T->set_var('block_start', COM_startBlock($LANG32[5], '', COM_getBlockTemplate('_admin_block', 'header')));
    $menu_arr = array(array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $T->set_var('admin_menu', ADMIN_createMenu($menu_arr, $LANG32[11], $_CONF['layout_url'] . '/images/icons/plugins.' . $_IMAGE_TYPE));
    $T->set_var('upload_form', PLUGINS_showUploadForm($token));
    // show the plugin upload form
    $data_arr = array();
    PLUGINS_loadPlugins($data_arr);
    // installed plugins
    PLUGINS_loadNewPlugins($data_arr);
    // uninstalled/new plugins
    $defsort_arr = array('field' => 'pi_name', 'direction' => 'asc');
    $header_arr = array(array('text' => $LANG32[78], 'field' => 'control', 'align' => 'center', 'width' => '40px'), array('text' => $LANG32[16], 'field' => 'pi_name', 'sort' => true), array('text' => $LANG32[36], 'field' => 'version', 'align' => 'center', 'nowrap' => true, 'width' => '75px'), array('text' => $LANG32[83], 'field' => 'info', 'align' => 'center', 'width' => '40px'), array('text' => $LANG32[84], 'field' => 'bundled', 'align' => 'center', 'width' => '40px', 'sort' => true), array('text' => $LANG32[27], 'field' => 'pi_homepage', 'nowrap' => true, 'width' => '150px', 'sort' => true), array('text' => $LANG32[18], 'field' => 'pi_gl_version', 'align' => 'center', 'width' => '75px', 'sort' => true), array('text' => $LANG32[79], 'field' => 'unplug', 'align' => 'center', 'width' => '40px'));
    $text_arr = array('form_url' => $_CONF['site_admin_url'] . '/plugins.php');
    $options_arr = array();
    // set security token and plugin enable/disable indicator
    $form_arr = array('top' => '<input type="hidden" name="' . CSRF_TOKEN . '" value="' . $token . '"/>', 'bottom' => '<input type="hidden" name="pluginenabler" value="true"/>');
    $T->set_var('plugin_list', ADMIN_listArray('plugins', 'PLUGINS_getListField', $header_arr, $text_arr, $data_arr, $defsort_arr, '', $token, $options_arr, $form_arr));
    $T->set_var('block_end', COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')));
    $retval = $T->parse('output', 'admin-list');
    return $retval;
}
Esempio n. 25
0
/**
* Shows the autotag permission form
*
* @param    string      $autotag_id     ID of group to edit
* @return   string      HTML for group editor
*
*/
function ATP_edit($autotag_id = '')
{
    global $_TABLES, $_CONF, $_USER, $LANG01, $LANG_ACCESS, $LANG_ADMIN, $LANG_AM, $MESSAGE, $LANG28, $VERBOSE;
    USES_lib_admin();
    $retval = '';
    $form_url = '';
    $token = SEC_createToken();
    $admin_list = new Template($_CONF['path_layout'] . 'admin/autotag/');
    $admin_list->set_file('admin', 'autotag_perm.thtml');
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/autotag.php', 'text' => 'Autotag List'), array('url' => $_CONF['site_admin_url'] . '/index.php', 'text' => $LANG_ADMIN['admin_home']));
    $retval .= COM_startBlock($LANG01['autotag_perms'], '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= ADMIN_createMenu($menu_arr, $LANG_AM['autotagpermmsg'], $_CONF['layout_url'] . '/images/icons/autotag.png');
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    $header_arr = array(array('text' => $LANG_AM['allowed'], 'field' => 'usage_allowed', 'sort' => false, 'align' => 'left'), array('text' => $LANG_AM['namespace'], 'field' => 'usage_namespace', 'sort' => true, 'align' => 'left'), array('text' => $LANG_AM['operation'], 'field' => 'usage_operation', 'sort' => true, 'align' => 'left'));
    $text_arr = array('has_menu' => false, 'title' => $LANG_AM['autotag'] . ':&nbsp;' . $autotag_id, 'help_url' => '', 'no_data' => 'No data to display', 'form_url' => '');
    $defsort_arr = array('field' => 'usage_namespace', 'direction' => 'asc');
    $form_arr = array();
    $options = array();
    $extra = array();
    $tagUsage = PLG_collectAutotagUsage();
    $sql = "SELECT * FROM {$_TABLES['autotag_perm']} JOIN {$_TABLES['autotag_usage']} ON ";
    $sql .= "{$_TABLES['autotag_perm']}.autotag_id = {$_TABLES['autotag_usage']}.autotag_id ";
    $sql .= "WHERE {$_TABLES['autotag_perm']}.autotag_id = '" . DB_escapeString($autotag_id) . "' ORDER BY usage_namespace ASC";
    $result = DB_query($sql);
    $autoTagPerms = array();
    while ($row = DB_fetchArray($result)) {
        $autoTagPerms[] = $row['autotag_name'] . '.' . $row['usage_namespace'] . '.' . $row['usage_operation'];
        $autotagPermissions[] = $row;
    }
    $autoTags = PLG_collectTags();
    foreach ($autoTags as $autotag_name => $namespace) {
        if ($autotag_name != $autotag_id) {
            continue;
        }
        foreach ($tagUsage as $usage) {
            $allowed = 1;
            // default is to allow
            $needle = $autotag_name . '.' . $usage['namespace'] . '.' . $usage['usage'];
            $pointer = array_search($needle, $autoTagPerms);
            if ($pointer !== FALSE) {
                $allowed = $autotagPermissions[$pointer]['autotag_allowed'];
            }
            $final[$needle] = array('usage_id' => $needle, 'autotag_name' => $autotag_name, 'usage_namespace' => $usage['namespace'], 'usage_operation' => $usage['usage'], 'usage_allowed' => $allowed);
        }
    }
    $FinalList = ADMIN_listArray('autotag-list', 'AT_getListField', $header_arr, $text_arr, $final, $defsort_arr, '', $extra, $options, $form_arr);
    $admin_list->set_var('admin_list', $FinalList);
    $admin_list->set_var('input_csrf_token', CSRF_TOKEN);
    $admin_list->set_var('var_token', $token);
    $admin_list->set_var('var_autotag_id', $autotag_id);
    $retval .= $admin_list->parse('output', 'admin');
    return $retval;
}
Esempio n. 26
0
// |                                                                          |
// | This program is distributed in the hope that it will be useful,          |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of           |
// | 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';
require_once $_CONF['path_system'] . 'classes/menu.class.php';
require_once $_CONF['path_system'] . 'lib-menu.php';
USES_lib_admin();
$display = '';
$content = '';
$MenuElementAllowedHTML = "i[class|style],div[class|style],span[class|style],img[src|class|style],em,strong,del,ins,q,abbr,dfn,small";
// Only let admin users access this page
if (!SEC_hasRights('menu.admin')) {
    $display .= COM_siteHeader('menu', $MESSAGE[30]);
    $display .= COM_showMessageText($MESSAGE[37], $MESSAGE[30], true);
    $display .= COM_siteFooter();
    COM_accessLog("User {$_USER['username']} unauthorized user tried to access the menu editor screen.");
    echo $display;
    exit;
}
function MB_displayMenuList()
{
    global $_CONF, $_USER, $_TABLES, $LANG_MB01, $LANG_MB_ADMIN, $LANG_ADMIN, $LANG_MB_MENU_TYPES;
Esempio n. 27
0
function CALENDAR_listBatch()
{
    global $_CONF, $_TABLES, $LANG_ADMIN, $LANG_CAL_ADMIN, $LANG_CAL_2, $LANG_ACCESS, $LANG01, $_IMAGE_TYPE;
    USES_lib_admin();
    $display = COM_startBlock($LANG_CAL_ADMIN[26], '', COM_getBlockTemplate('_admin_block', 'header'));
    if (isset($_REQUEST['usr_time'])) {
        $usr_time = $_REQUEST['usr_time'];
    } else {
        $usr_time = 12;
    }
    // create the menu at the top
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/plugins/calendar/index.php', 'text' => $LANG_CAL_ADMIN[39]), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $cal_templates = new Template($_CONF['path'] . 'plugins/calendar/templates/admin');
    $cal_templates->set_file(array('form' => 'batchadmin.thtml'));
    $cal_templates->set_var('usr_time', $usr_time);
    $cal_templates->set_var('lang_text_start', $LANG_CAL_ADMIN[27]);
    $cal_templates->set_var('lang_text_end', $LANG_CAL_ADMIN[28]);
    $cal_templates->set_var('lang_updatelist', $LANG_CAL_ADMIN[30]);
    $cal_templates->set_var('lang_delete_sel', $LANG_ADMIN['delete_sel']);
    $cal_templates->set_var('lang_delconfirm', $LANG_CAL_ADMIN[31]);
    $cal_templates->parse('form', 'form');
    $desc = $cal_templates->finish($cal_templates->get_var('form'));
    $display .= ADMIN_createMenu($menu_arr, $desc, plugin_geticon_calendar());
    $header_arr = array(array('text' => $LANG_ADMIN['title'], 'field' => 'title', 'sort' => true), array('text' => $LANG_CAL_ADMIN[13], 'field' => 'username', 'sort' => true), array('text' => $LANG_ACCESS['access'], 'field' => 'access', 'sort' => false, 'align' => 'center'), array('text' => $LANG_CAL_ADMIN[14], 'field' => 'datestart', 'sort' => true, 'align' => 'center'), array('text' => $LANG_CAL_ADMIN[15], 'field' => 'dateend', 'sort' => true, 'align' => 'center'), array('text' => $LANG_CAL_2[26], 'field' => 'allday', 'sort' => true, 'align' => 'center', 'width' => '40px'), array('text' => $LANG_ADMIN['enabled'], 'field' => 'rostatus', 'sort' => true, 'align' => 'center', 'width' => '40px'));
    $text_arr = array('has_extras' => true, 'form_url' => $_CONF['site_admin_url'] . "/plugins/calendar/index.php?batchadmin=x");
    $sql = "SELECT {$_TABLES['events']}.*, {$_TABLES['users']}.username, {$_TABLES['users']}.fullname " . "FROM {$_TABLES['events']} " . "LEFT JOIN {$_TABLES['users']} " . "ON {$_TABLES['events']}.owner_id={$_TABLES['users']}.uid " . "WHERE 1=1 ";
    $filterstr = " AND UNIX_TIMESTAMP() - UNIX_TIMESTAMP(dateend) > " . $usr_time * 2592000 . " ";
    $query_arr = array('table' => 'events', 'sql' => $sql, 'query_fields' => array('title', 'datestart', 'dateend'), 'default_filter' => $filterstr . COM_getPermSQL('AND'));
    $defsort_arr = array('field' => 'datestart', 'direction' => 'desc');
    $options = array('chkselect' => true, 'chkfield' => 'eid');
    // create the security token, and embed it in the list form
    $token = SEC_createToken();
    $form_arr['bottom'] = "<input type=\"hidden\" name=\"" . CSRF_TOKEN . "\" value=\"{$token}\"/>";
    $display .= ADMIN_list('calendar', 'CALENDAR_getListField', $header_arr, $text_arr, $query_arr, $defsort_arr, '', $token, $options, $form_arr);
    $display .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $display;
}