/**
  * Return HTML widget
  *
  * @return string
  */
 protected function getWidget()
 {
     global $_CONF, $LANG_SX00;
     $this->csrfToken = SEC_createToken();
     $display = '<hr' . XHTML . '>' . LB . '<p>' . $LANG_SX00['e1'] . '</p>' . LB . $this->getList() . '<p>' . $LANG_SX00['e2'] . '</p>' . LB . '<form method="post" class="uk-form" action="' . $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=EditHeader">' . LB . '<table border="0" width="100%">' . LB . '<tr><td align="right"><b>Header:</b></td>' . LB . '<td><input type="text" size="40" name="header-name"' . XHTML . '> e.g. <tt>User-Agent</tt></td></tr>' . LB . '<tr><td align="right"><b>Content:</b></td>' . LB . '<td><input type="text" size="40" name="header-value"' . XHTML . '> e.g. <tt>Mozilla</tt></td></tr>' . LB . '</table>' . LB . '<p><button type="submit" name="paction" value="' . $LANG_SX00['addentry'] . '" class="uk-button">' . $LANG_SX00['addentry'] . '</button>' . LB . '<input type="hidden" name="' . CSRF_TOKEN . '" value="' . $this->csrfToken . '"' . XHTML . '></p>' . LB . '</form>' . LB;
     return $display;
 }
Ejemplo n.º 2
0
/**
*   Create the main menu
*
*   @param  string  $explanation    Instruction text
*   @return string  HTML for menu area
*/
function DBADMIN_menu($explanation = '')
{
    global $_CONF, $LANG_ADMIN, $LANG_DB_BACKUP, $LANG_LGLIB, $_IMAGE_TYPE, $token, $pi_title;
    USES_lib_admin();
    $retval = '';
    $token = SEC_createToken();
    $menu_arr = array(array('url' => LGLIB_ADMIN_URL, 'text' => $LANG_LGLIB['list_backups']), array('url' => LGLIB_ADMIN_URL . '/index.php?backup=x&amp;' . CSRF_TOKEN . '=' . $token, 'text' => $LANG_ADMIN['create_new']), array('url' => LGLIB_ADMIN_URL . '/index.php?config=x', 'text' => 'Configure'), array('url' => $_CONF['site_admin_url'] . '/index.php', 'text' => $LANG_ADMIN['admin_home']));
    //$retval .= COM_startBlock($pi_title,
    $retval .= COM_startBlock(LGLIB_getGlobal('pi_title'), COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= ADMIN_createMenu($menu_arr, $explanation, $_CONF['layout_url'] . '/images/icons/database.' . $_IMAGE_TYPE);
    return $retval;
}
Ejemplo n.º 3
0
 /**
  * Constructor
  */
 function display()
 {
     global $_CONF, $_TABLES, $LANG_SX00;
     $action = '';
     if (isset($_GET['action'])) {
         $action = $_GET['action'];
     } elseif (isset($_POST['paction'])) {
         $action = $_POST['paction'];
     }
     if ($action == 'delete' && SEC_checkToken()) {
         $entry = $_GET['entry'];
         if (!empty($entry)) {
             $dbentry = addslashes($entry);
             DB_delete($_TABLES['spamx'], array('name', 'value'), array('HTTPHeader', $dbentry));
         }
     } elseif ($action == $LANG_SX00['addentry'] && SEC_checkToken()) {
         $entry = '';
         $name = COM_applyFilter($_REQUEST['header-name']);
         $n = explode(':', $name);
         $name = $n[0];
         $value = $_REQUEST['header-value'];
         if (!empty($name) && !empty($value)) {
             $entry = $name . ': ' . $value;
         }
         $dbentry = addslashes($entry);
         if (!empty($entry)) {
             $result = DB_query("INSERT INTO {$_TABLES['spamx']} VALUES ('HTTPHeader','{$dbentry}')");
         }
     }
     $token = SEC_createToken();
     $display = '<hr' . XHTML . '>' . LB . '<p><b>';
     $display .= $LANG_SX00['headerblack'];
     $display .= '</b></p>' . LB . '<ul>' . LB;
     $result = DB_query("SELECT value FROM {$_TABLES['spamx']} WHERE name='HTTPHeader' ORDER BY value");
     $nrows = DB_numRows($result);
     for ($i = 0; $i < $nrows; $i++) {
         list($e) = DB_fetchArray($result);
         $display .= '<li>' . COM_createLink(htmlspecialchars($e), $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=EditHeader&amp;action=delete&amp;entry=' . urlencode($e) . '&amp;' . CSRF_TOKEN . '=' . $token) . '</li>' . LB;
     }
     $display .= '</ul>' . LB . '<p>' . $LANG_SX00['e1'] . '</p>' . LB;
     $display .= '<p>' . $LANG_SX00['e2'] . '</p>' . LB;
     $display .= '<form method="post" action="' . $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=EditHeader">' . LB;
     $display .= '<table border="0" width="100%">' . LB;
     $display .= '<tr><td align="right"><b>Header:</b></td>' . LB;
     $display .= '<td><input type="text" size="40" name="header-name"' . XHTML . '> e.g. <tt>User-Agent</tt></td></tr>' . LB;
     $display .= '<tr><td align="right"><b>Content:</b></td>' . LB;
     $display .= '<td><input type="text" size="40" name="header-value"' . XHTML . '> e.g. <tt>Mozilla</tt></td></tr>' . LB;
     $display .= '</table>' . LB;
     $display .= '<p><input type="submit" name="paction" value="' . $LANG_SX00['addentry'] . '"' . XHTML . '>';
     $display .= '<input type="hidden" name="' . CSRF_TOKEN . "\" value=\"{$token}\"" . XHTML . '></p>' . LB;
     $display .= '</form>' . LB;
     return $display;
 }
 /**
  * Constructor
  */
 function display()
 {
     global $_CONF, $_TABLES, $LANG_SX00;
     $action = '';
     if (isset($_GET['action'])) {
         $action = $_GET['action'];
     } elseif (isset($_POST['paction'])) {
         $action = $_POST['paction'];
     }
     $entry = '';
     if (isset($_GET['entry'])) {
         $entry = COM_stripslashes($_GET['entry']);
     } elseif (isset($_POST['pentry'])) {
         $entry = COM_stripslashes($_POST['pentry']);
     }
     if ($action == 'delete' && SEC_checkToken()) {
         $entry = DB_escapeString($entry);
         DB_delete($_TABLES['spamx'], array('name', 'value'), array('Personal', $entry));
     } elseif ($action == $LANG_SX00['addentry'] && SEC_checkToken()) {
         if (!empty($entry)) {
             $entry = DB_escapeString($entry);
             $result = DB_query("INSERT INTO {$_TABLES['spamx']} VALUES ('Personal', '{$entry}')");
         }
     } elseif ($action == $LANG_SX00['addcen'] && SEC_checkToken()) {
         foreach ($_CONF['censorlist'] as $entry) {
             $entry = DB_escapeString($entry);
             $result = DB_query("INSERT INTO {$_TABLES['spamx']} VALUES ('Personal', '{$entry}')");
         }
     }
     $token = SEC_createToken();
     $display = '<hr' . XHTML . '>' . LB . '<p><b>';
     $display .= $LANG_SX00['pblack'];
     $display .= '</b></p>' . LB . '<ul>' . LB;
     $result = DB_query("SELECT value FROM {$_TABLES['spamx']} WHERE name = 'Personal'");
     $nrows = DB_numRows($result);
     for ($i = 0; $i < $nrows; $i++) {
         $A = DB_fetchArray($result);
         $e = $A['value'];
         $display .= '<li>' . COM_createLink(htmlspecialchars($e), $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=EditBlackList&amp;action=delete&amp;entry=' . urlencode($e) . '&amp;' . CSRF_TOKEN . '=' . $token) . '</li>' . LB;
     }
     $display .= '</ul>' . LB . '<p>' . $LANG_SX00['e1'] . '</p>' . LB;
     $display .= '<p>' . $LANG_SX00['e2'] . '</p>' . LB;
     $display .= '<form method="post" action="' . $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=EditBlackList">' . LB;
     $display .= '<div><input type="text" size="30" name="pentry"' . XHTML . '>&nbsp;&nbsp;&nbsp;';
     $display .= '<input type="submit" name="paction" value="' . $LANG_SX00['addentry'] . '"' . XHTML . '>' . LB;
     $display .= '<p>' . $LANG_SX00['e3'] . '</p>&nbsp;&nbsp;&nbsp;';
     $display .= '<input type="submit" name="paction" value="' . $LANG_SX00['addcen'] . '"' . XHTML . '>' . LB;
     $display .= '<input type="hidden" name="' . CSRF_TOKEN . "\" value=\"{$token}\"" . XHTML . '>' . LB;
     $display .= '</div></form>' . LB;
     return $display;
 }
Ejemplo n.º 5
0
function MG_editCategory($cat_id, $mode)
{
    global $album_jumpbox, $_USER, $_CONF, $_TABLES, $_MG_CONF, $LANG_MG00, $LANG_MG01, $LANG_MG03, $LANG_ACCESS;
    $retval = '';
    $T = new Template($_MG_CONF['template_path'] . '/admin');
    $T->set_var('site_url', $_CONF['site_url']);
    $T->set_var('site_admin_url', $_CONF['site_admin_url']);
    if ($cat_id == 0 && $mode == 'create') {
        // set the album_id
        $sql = "SELECT MAX(cat_id) + 1 AS nextcat_id FROM " . $_TABLES['mg_category'];
        $result = DB_query($sql);
        $row = DB_fetchArray($result);
        $A['cat_id'] = $row['nextcat_id'];
        if ($A['cat_id'] < 1) {
            $A['cat_id'] = 1;
        }
        if ($A['cat_id'] == 0) {
            COM_errorLog("Media Gallery Error - Returned 0 as cat_id");
            $A['cat_id'] = 1;
        }
        $A['cat_name'] = '';
        $A['cat_description'] = '';
    } else {
        $A['cat_id'] = $cat_id;
        // pull info from DB
        $sql = "SELECT * FROM {$_TABLES['mg_category']} WHERE cat_id=" . (int) $cat_id;
        $result = DB_query($sql);
        $numRows = DB_numRows($result);
        if ($numRows > 0) {
            $A = DB_fetchArray($result);
        }
    }
    $T->set_var('cat_id', $A['cat_id']);
    // If edit, pull up the existing album information...
    $T->set_file(array('admin' => 'editcategory.thtml'));
    $T->set_var(array('action' => 'category', 'cat_id' => $A['cat_id'], 'cat_name' => $A['cat_name'], 'cat_description' => $A['cat_description'], 'lang_save' => $LANG_MG01['save'], 'lang_edit_category' => $mode == 'create' ? $LANG_MG01['create_category'] : $LANG_MG01['edit_category'], 's_form_action' => $_MG_CONF['admin_url'] . 'category.php', 'lang_cat_edit_help' => $LANG_MG01['cat_edit_help'], 'lang_title' => $LANG_MG01['title'], 'lang_description' => $LANG_MG01['description'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_delete' => $LANG_MG01['delete'], 'lang_delete_confirm' => $LANG_MG01['delete_item_confirm'], 'gltoken_name' => CSRF_TOKEN, 'gltoken' => SEC_createToken()));
    //    if ( $_MG_CONF['htmlallowed'] == 1 ) {
    //        $T->set_var('allowed_html',COM_allowedHTML(SEC_getUserPermissions(),false,'mediagallery','category_title'));
    //    }
    $T->parse('output', 'admin');
    $retval .= $T->finish($T->get_var('output'));
    return $retval;
}
Ejemplo n.º 6
0
function fncDisply($pi_name)
{
    global $_CONF;
    global $LANG_ASSIST_ADMIN;
    $pi_name = "assist";
    $tmplfld = assist_templatePath('admin', 'default', $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file(array('list' => 'backuprestore.thtml'));
    //@@@@@    $templates->set_var('about_thispage', $LANG_ASSIST_ADMIN['about_admin_backuprestore']);
    $templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $token = SEC_createToken();
    $retval .= SEC_getTokenExpiryNotice($token);
    $templates->set_var('gltoken_name', CSRF_TOKEN);
    $templates->set_var('gltoken', $token);
    $templates->set_var('xhtml', XHTML);
    $templates->set_var('config', $LANG_ASSIST_ADMIN['config']);
    $templates->set_var('config_backup', $LANG_ASSIST_ADMIN['config_backup']);
    $templates->set_var('config_init', $LANG_ASSIST_ADMIN['config_init']);
    $templates->set_var('config_restore', $LANG_ASSIST_ADMIN['config_restore']);
    $templates->set_var('config_update', $LANG_ASSIST_ADMIN['config_update']);
    $templates->set_var('config_backup_help', $LANG_ASSIST_ADMIN['config_backup_help']);
    $templates->set_var('config_init_help', $LANG_ASSIST_ADMIN['config_init_help']);
    $templates->set_var('config_restore_help', $LANG_ASSIST_ADMIN['config_restore_help']);
    $templates->set_var('config_update_help', $LANG_ASSIST_ADMIN['config_update_help']);
    $err_backup_file = "";
    if (file_exists($_CONF["path_data"] . "assistconfig_bak.php")) {
        $templates->set_var('restore_disable', "");
        if (is_writable($_CONF["path_data"] . "assistconfig_bak.php")) {
        } else {
            $err_backup_file = $LANG_ASSIST_ADMIN['err_backup_file_non_writable'];
        }
    } else {
        $templates->set_var('restore_disabled', "disabled");
        $err_backup_file = $LANG_ASSIST_ADMIN['err_backup_file_not_exist'];
    }
    $templates->set_var('err_backup_file', $err_backup_file);
    $templates->parse('output', 'list');
    $content = $templates->finish($templates->get_var('output'));
    $retval .= $content;
    return $retval;
}
Ejemplo n.º 7
0
function BB2_ban_list()
{
    global $_CONF, $_USER, $_TABLES, $LANG_BAD_BEHAVIOR, $LANG_BB2_RESPONSE, $LANG_ADMIN;
    $retval = '';
    // writing the menu on top
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/plugins/bad_behavior2/ban.php?mode=add', 'text' => $LANG_BAD_BEHAVIOR['ban_ip']), array('url' => $_CONF['site_admin_url'] . '/plugins/bad_behavior2/index.php', 'text' => $LANG_BAD_BEHAVIOR['log_entries']), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $retval .= COM_startBlock($LANG_BAD_BEHAVIOR['plugin_display_name'] . ' - ' . $LANG_BAD_BEHAVIOR['block_title_list'], '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= ADMIN_createMenu($menu_arr, $LANG_BAD_BEHAVIOR['ban_list_info'], $_CONF['site_url'] . '/bad_behavior2/images/bad_behavior2.png');
    if (!empty($msg)) {
        $retval .= COM_showMessage($msg, 'bad_behavior2');
    }
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    $header_arr = array(array('text' => $LANG_BAD_BEHAVIOR['ip_address'], 'field' => 'ip', 'sort' => false, 'align' => 'left'), array('text' => $LANG_BAD_BEHAVIOR['type'], 'field' => 'type', 'sort' => true, 'align' => 'left'), array('text' => $LANG_BAD_BEHAVIOR['date'], 'field' => 'timestamp', 'sort' => true, 'align' => 'left'), array('text' => $LANG_BAD_BEHAVIOR['reason'], 'field' => 'reason', 'sort' => false, 'align' => 'left'));
    $defsort_arr = array('field' => 'ip', 'direction' => 'asc');
    $text_arr = array('no_data' => '', 'title' => "", 'form_url' => $_CONF['site_admin_url'] . '/plugins/bad_behavior2/ban.php', 'has_search' => true, 'has_limit' => true, 'has_paging' => true);
    $actions = '<input name="deletebutton" type="image" src="' . $_CONF['layout_url'] . '/images/admin/delete.png' . '" style="vertical-align:text-bottom;" title="' . $LANG_BAD_BEHAVIOR['delete_info'] . '" onclick="return doubleconfirm(\'' . $LANG_BAD_BEHAVIOR['delete_confirm_1'] . '\',\'' . $LANG_BAD_BEHAVIOR['delete_confirm_2'] . '\');"' . '/>&nbsp;' . $LANG_BAD_BEHAVIOR['delete'];
    $option_arr = array('chkselect' => true, 'chkall' => true, 'chkfield' => 'id', 'chkname' => 'actionitem', 'chkactions' => $actions);
    $query_arr = array('table' => 'bad_behavior2_ban', 'sql' => "SELECT id,INET_NTOA(ip) AS ip, type, reason, timestamp FROM {$_TABLES['bad_behavior2_ban']} WHERE 1=1", 'query_fields' => array('INET_NTOA(ip)'), 'default_filter' => '');
    $token = SEC_createToken();
    $form_arr = array('top' => '<input type="hidden" name="' . CSRF_TOKEN . '" value="' . $token . '"/>', 'bottom' => '<input type="hidden" name="mode" value="delete"/>');
    $retval .= ADMIN_list('bad_behavior2_ban', 'BB2_getListField', $header_arr, $text_arr, $query_arr, $defsort_arr, '', $token, $option_arr, $form_arr);
    return $retval;
}
Ejemplo n.º 8
0
/**
 * Show topic administration form
 *
 * @param    string  tid     ID of topic to edit
 * @return   string          HTML for the topic editor
 */
function edittopic($tid = '')
{
    global $_CONF, $_GROUPS, $_TABLES, $_USER, $LANG04, $LANG27, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE, $_SCRIPTS;
    $retval = '';
    if (empty($tid)) {
        // new topic - set defaults
        $A = array('tid' => '', 'topic' => '', 'sortnum' => 0, 'parent_id' => TOPIC_ROOT, 'inherit' => 1, 'hidden' => 0, 'limitnews' => '', 'is_default' => 0, 'archive_flag' => 0);
    } else {
        $result = DB_query("SELECT * FROM {$_TABLES['topics']} WHERE tid ='{$tid}'");
        $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 || $access == 2) {
            $retval .= COM_showMessageText($LANG27[13], $LANG27[12]);
            COM_accessLog("User {$_USER['username']} tried to illegally create or edit topic {$tid}.");
            return $retval;
        }
    }
    $token = SEC_createToken();
    $retval .= COM_startBlock($LANG27[1], '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= SEC_getTokenExpiryNotice($token);
    if (!is_array($A) || empty($A['owner_id'])) {
        $A['owner_id'] = $_USER['uid'];
        // this is the one instance where we default the group
        // most topics should belong to the Topic Admin group
        if (isset($_GROUPS['Topic Admin'])) {
            $A['group_id'] = $_GROUPS['Topic Admin'];
        } else {
            $A['group_id'] = SEC_getFeatureGroup('topic.edit');
        }
        SEC_setDefaultPermissions($A, $_CONF['default_permissions_topic']);
        $access = 3;
    }
    $topic_templates = COM_newTemplate($_CONF['path_layout'] . 'admin/topic');
    $topic_templates->set_file('editor', 'topiceditor.thtml');
    if (!empty($tid) && SEC_hasRights('topic.edit')) {
        $delButton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>';
        $jsConfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $topic_templates->set_var('delete_option', sprintf($delButton, $jsConfirm));
        $topic_templates->set_var('delete_option_no_confirmation', sprintf($delButton, ''));
        $topic_templates->set_var('allow_delete', true);
        $topic_templates->set_var('lang_delete', $LANG_ADMIN['delete']);
        $topic_templates->set_var('confirm_message', $MESSAGE[76]);
        $topic_templates->set_var('warning_msg', $LANG27[6]);
    }
    if ($_CONF['titletoid'] && empty($tid)) {
        $_SCRIPTS->setJavaScriptFile('title_2_id', '/javascript/title_2_id.js');
        $topic_templates->set_var('titletoid', true);
    }
    $topic_templates->set_var('lang_topicid', $LANG27[2]);
    $topic_templates->set_var('topic_id', $A['tid']);
    $topic_templates->set_var('lang_parent_id', $LANG27[32]);
    $topic_templates->set_var('parent_id_options', TOPIC_getTopicListSelect($A['parent_id'], 1, false, $A['tid'], true));
    $topic_templates->set_var('lang_inherit', $LANG27[33]);
    $topic_templates->set_var('lang_inherit_info', $LANG27[34]);
    if ($A['inherit'] == 1) {
        $topic_templates->set_var('inherit_checked', 'checked="checked"');
    } else {
        $topic_templates->set_var('inherit_checked', '');
    }
    $topic_templates->set_var('lang_hidden', $LANG27[35]);
    $topic_templates->set_var('lang_hidden_info', $LANG27[36]);
    if ($A['hidden'] == 1) {
        $topic_templates->set_var('hidden_checked', 'checked="checked"');
    } else {
        $topic_templates->set_var('hidden_checked', '');
    }
    $topic_templates->set_var('lang_donotusespaces', $LANG27[5]);
    $topic_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
    $topic_templates->set_var('lang_owner', $LANG_ACCESS['owner']);
    $ownername = COM_getDisplayName($A['owner_id']);
    $topic_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}"));
    $topic_templates->set_var('owner_name', $ownername);
    $topic_templates->set_var('owner', $ownername);
    $topic_templates->set_var('owner_id', $A['owner_id']);
    $topic_templates->set_var('lang_group', $LANG_ACCESS['group']);
    $topic_templates->set_var('lang_save', $LANG_ADMIN['save']);
    $topic_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $topic_templates->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access));
    $topic_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']);
    $topic_templates->set_var('lang_permissions_key', $LANG_ACCESS['permissionskey']);
    $topic_templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
    $topic_templates->set_var('permissions_msg', $LANG_ACCESS['permmsg']);
    $topic_templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']);
    $topic_templates->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']));
    // show sort order only if they specified sortnum as the sort method
    if ($_CONF['sortmethod'] !== 'alpha') {
        $topic_templates->set_var('lang_sortorder', $LANG27[10]);
        if ($A['sortnum'] == 0) {
            $A['sortnum'] = '';
        }
        $topic_templates->set_var('sort_order', '<input type="text" size="5" maxlength="5" name="sortnum" value="' . $A['sortnum'] . '"' . XHTML . '>');
    } else {
        $topic_templates->set_var('lang_sortorder', $LANG27[14]);
        $topic_templates->set_var('sort_order', $LANG27[15] . '<input type="hidden" name="sortnum" value="' . $A['sortnum'] . '"' . XHTML . '>');
    }
    $topic_templates->set_var('lang_storiesperpage', $LANG27[11]);
    if ($A['limitnews'] == 0) {
        $topic_templates->set_var('story_limit', '');
    } else {
        $topic_templates->set_var('story_limit', $A['limitnews']);
    }
    $topic_templates->set_var('default_limit', $_CONF['limitnews']);
    $topic_templates->set_var('lang_defaultis', $LANG27[16]);
    $topic_templates->set_var('lang_topicname', $LANG27[3]);
    $topic_templates->set_var('topic_name', htmlspecialchars(stripslashes($A['topic']), ENT_QUOTES, COM_getEncodingt()));
    if (empty($A['tid'])) {
        $A['imageurl'] = '/images/topics/';
    }
    $topic_templates->set_var('lang_topicimage', $LANG27[4]);
    $topic_templates->set_var('lang_uploadimage', $LANG27[27]);
    $topic_templates->set_var('lang_maxsize', $LANG27[28]);
    $topic_templates->set_var('icon_dimensions', $_CONF['max_topicicon_width'] . ' x ' . $_CONF['max_topicicon_height']);
    $topic_templates->set_var('max_url_length', 255);
    $topic_templates->set_var('image_url', $A['imageurl']);
    if (empty($_CONF['image_lib'])) {
        $scaling = $LANG04[162];
    } else {
        $scaling = $LANG04[161];
    }
    $topic_templates->set_var('icon_max_dimensions', sprintf($LANG04[160], $_CONF['max_topicicon_width'], $_CONF['max_topicicon_height'], $_CONF['max_topicicon_size'], $scaling));
    $topic_templates->set_var('lang_metadescription', $LANG_ADMIN['meta_description']);
    $topic_templates->set_var('lang_metakeywords', $LANG_ADMIN['meta_keywords']);
    if (!empty($A['meta_description'])) {
        $topic_templates->set_var('meta_description', $A['meta_description']);
    }
    if (!empty($A['meta_keywords'])) {
        $topic_templates->set_var('meta_keywords', $A['meta_keywords']);
    }
    if ($_CONF['meta_tags'] > 0) {
        $topic_templates->set_var('hide_meta', '');
    } else {
        $topic_templates->set_var('hide_meta', ' style="display:none;"');
    }
    $topic_templates->set_var('lang_defaulttopic', $LANG27[22]);
    $topic_templates->set_var('lang_defaulttext', $LANG27[23]);
    if ($A['is_default'] == 1) {
        $topic_templates->set_var('default_checked', 'checked="checked"');
    } else {
        $topic_templates->set_var('default_checked', '');
    }
    $topic_templates->set_var('lang_archivetopic', $LANG27[25]);
    $topic_templates->set_var('lang_archivetext', $LANG27[26]);
    $topic_templates->set_var('archive_disabled', '');
    if ($A['archive_flag'] == 1) {
        $topic_templates->set_var('archive_checked', 'checked="checked"');
    } else {
        $topic_templates->set_var('archive_checked', '');
        // Only 1 topic can be the archive topic - so check if there already is one
        if (DB_count($_TABLES['topics'], 'archive_flag', '1') > 0) {
            $topic_templates->set_var('archive_disabled', 'disabled');
        }
    }
    if (empty($tid)) {
        $num_stories = $LANG_ADMIN['na'];
    } else {
        $nResult = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['stories']}, {$_TABLES['topic_assignments']} ta WHERE ta.type = 'article' AND ta.id = sid AND ta.tid = '" . DB_escapeString($tid) . "'" . COM_getPermSql('AND'));
        $N = DB_fetchArray($nResult);
        $num_stories = COM_numberFormat($N['count']);
    }
    $topic_templates->set_var('lang_num_stories', $LANG27[30]);
    $topic_templates->set_var('num_stories', $num_stories);
    $topic_templates->set_var('gltoken_name', CSRF_TOKEN);
    $topic_templates->set_var('gltoken', $token);
    $topic_templates->parse('output', 'editor');
    $retval .= $topic_templates->finish($topic_templates->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
Ejemplo n.º 9
0
/**
* Show main plugin screen: installed and uninstalled plugins, upload form
*
* @param    string  $message    (optional) message to display
* @param    string  $token      an optional csrf token
* @return   string              HTML for the plugin screen
*
*/
function plugin_main($message = '', $token = '')
{
    global $LANG32;
    $retval = '';
    $retval .= COM_siteHeader('menu', $LANG32[5]);
    if (!empty($message)) {
        $retval .= COM_showMessageText($message);
    } else {
        $retval .= COM_showMessageFromParameter();
    }
    if (empty($token)) {
        $token = SEC_createToken();
    }
    $retval .= listplugins($token);
    if (SEC_hasRights('plugin.install')) {
        $retval .= show_newplugins($token);
    }
    // Show the upload form or an error message
    $retval .= plugin_show_uploadform($token);
    $retval .= COM_siteFooter();
    return $retval;
}
Ejemplo n.º 10
0
 * @return   string  HTML redirect or error message
 */
function deleteRoute($rid)
{
    global $_CONF, $_TABLES;
    $rid = intval($rid, 10);
    DB_delete($_TABLES['routes'], 'rid', $rid);
    reorderRoutes();
    return COM_refresh($_CONF['site_admin_url'] . '/router.php?msg=123');
}
// MAIN
$display = '';
$mode = \Geeklog\Input::fGet('mode', \Geeklog\Input::fPost('mode', ''));
$rid = \Geeklog\Input::fGet('rid', \Geeklog\Input::fPost('rid', 0));
$rid = intval($rid, 10);
$securityToken = SEC_createToken();
switch ($mode) {
    case $LANG_ADMIN['delete']:
        if ($rid === 0) {
            COM_errorLog('Attempted to delete route, rid empty or null, value =' . $rid);
            $display = COM_refresh($_CONF['site_admin_url'] . '/router.php');
        } elseif (SEC_checkToken()) {
            $display = deleteRoute($rid);
        } else {
            COM_accessLog("User {$_USER['username']} tried to illegally delete route {$rid} and failed CSRF checks.");
            $display = COM_refresh($_CONF['site_admin_url'] . '/index.php');
        }
        echo $display;
        die;
        break;
    case $LANG_ADMIN['save']:
Ejemplo n.º 11
0
/**
* Shows story editor
*
* Displays the story entry form
*
* @param    string      $sid            ID of story to edit
* @param    string      $mode           'preview', 'edit', 'editsubmission', 'clone'
* @param    string      $errormsg       a message to display on top of the page
* @return   string      HTML for story editor
*
*/
function storyeditor($sid = '', $mode = '', $errormsg = '')
{
    global $_CONF, $_TABLES, $_USER, $LANG24, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE, $_SCRIPTS, $LANG_DIRECTION, $LANG_MONTH, $LANG_WEEK;
    $display = '';
    if (!isset($_CONF['hour_mode'])) {
        $_CONF['hour_mode'] = 12;
    }
    if (!empty($errormsg)) {
        $display .= COM_showMessageText($errormsg, $LANG24[25]);
    }
    $story = new Story();
    if ($mode == 'preview') {
        // Handle Magic GPC Garbage:
        while (list($key, $value) = each($_POST)) {
            if (!is_array($value)) {
                $_POST[$key] = COM_stripslashes($value);
            } else {
                while (list($subkey, $subvalue) = each($value)) {
                    $value[$subkey] = COM_stripslashes($subvalue);
                }
            }
        }
        $result = $story->loadFromArgsArray($_POST);
        if ($_CONF['maximagesperarticle'] > 0) {
            $errors = $story->checkAttachedImages();
            if (count($errors) > 0) {
                $msg = $LANG24[55] . LB . '<ul>' . LB;
                foreach ($errors as $err) {
                    $msg .= '<li>' . $err . '</li>' . LB;
                }
                $msg .= '</ul>' . LB;
                $display .= COM_showMessageText($msg, $LANG24[54]);
            }
        }
    } else {
        $result = $story->loadFromDatabase($sid, $mode);
    }
    if ($result == STORY_PERMISSION_DENIED || $result == STORY_NO_ACCESS_PARAMS) {
        $display .= COM_showMessageText($LANG24[42], $LANG_ACCESS['accessdenied']);
        COM_accessLog("User {$_USER['username']} tried to illegally access story {$sid}.");
        return $display;
    } elseif ($result == STORY_EDIT_DENIED || $result == STORY_EXISTING_NO_EDIT_PERMISSION) {
        $display .= COM_showMessageText($LANG24[41], $LANG_ACCESS['accessdenied']);
        $display .= STORY_renderArticle($story, 'p');
        COM_accessLog("User {$_USER['username']} tried to illegally edit story {$sid}.");
        return $display;
    } elseif ($result == STORY_INVALID_SID) {
        if ($mode == 'editsubmission') {
            // that submission doesn't seem to be there any more (may have been
            // handled by another Admin) - take us back to the moderation page
            return COM_refresh($_CONF['site_admin_url'] . '/moderation.php');
        } else {
            return COM_refresh($_CONF['site_admin_url'] . '/story.php');
        }
    } elseif ($result == STORY_DUPLICATE_SID) {
        $display .= COM_showMessageText($LANG24[24]);
    }
    // Load HTML templates
    $story_templates = COM_newTemplate($_CONF['path_layout'] . 'admin/story');
    if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) {
        $story_templates->set_file(array('editor' => 'storyeditor_advanced.thtml'));
        $advanced_editormode = true;
        $story_templates->set_var('change_editormode', 'onchange="change_editmode(this);"');
        require_once $_CONF['path_system'] . 'classes/navbar.class.php';
        $story_templates->set_var('show_preview', 'none');
        $story_templates->set_var('lang_expandhelp', $LANG24[67]);
        $story_templates->set_var('lang_reducehelp', $LANG24[68]);
        $story_templates->set_var('lang_publishdate', $LANG24[69]);
        $story_templates->set_var('lang_toolbar', $LANG24[70]);
        $story_templates->set_var('toolbar1', $LANG24[71]);
        $story_templates->set_var('toolbar2', $LANG24[72]);
        $story_templates->set_var('toolbar3', $LANG24[73]);
        $story_templates->set_var('toolbar4', $LANG24[74]);
        $story_templates->set_var('toolbar5', $LANG24[75]);
        if ($story->EditElements('advanced_editor_mode') == 1 or $story->EditElements('postmode') == 'adveditor') {
            $story_templates->set_var('show_texteditor', 'none');
            $story_templates->set_var('show_htmleditor', '');
        } else {
            $story_templates->set_var('show_texteditor', '');
            $story_templates->set_var('show_htmleditor', 'none');
        }
    } else {
        $story_templates->set_file(array('editor' => 'storyeditor.thtml'));
        $advanced_editormode = false;
    }
    $story_templates->set_var('hour_mode', $_CONF['hour_mode']);
    if ($story->hasContent()) {
        $previewContent = STORY_renderArticle($story, 'p');
        if ($advanced_editormode and $previewContent != '') {
            $story_templates->set_var('preview_content', $previewContent);
        } elseif ($previewContent != '') {
            $display .= COM_startBlock($LANG24[26], '', COM_getBlockTemplate('_admin_block', 'header'));
            $display .= $previewContent;
            $display .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
        }
    }
    if ($advanced_editormode) {
        $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 ($mode == '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('navbar', $navbar->generate());
    }
    $oldsid = $story->EditElements('originalSid');
    if (!empty($oldsid) && $mode != 'clone') {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>';
        $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, ''));
    }
    if ($mode == 'editsubmission' || $story->type == 'submission') {
        $story_templates->set_var('submission_option', '<input type="hidden" name="type" value="submission"' . XHTML . '>');
    }
    $story_templates->set_var('lang_author', $LANG24[7]);
    $storyauthor = COM_getDisplayName($story->EditElements('uid'));
    $story_templates->set_var('story_author', $storyauthor);
    $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 = ' . $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'));
    $story_templates->set_var('lang_group', $LANG_ACCESS['group']);
    $story_templates->set_var('group_dropdown', SEC_getGroupDropdown($story->EditElements('group_id'), 3));
    $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']);
    $story_templates->set_var('lang_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=""' . XHTML . '>';
    }
    $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'));
    $atopic = DB_getItem($_TABLES['topics'], 'tid', "archive_flag = 1");
    $have_archive_topic = empty($atopic) ? false : true;
    if ($story->EditElements('statuscode') == STORY_ARCHIVE_ON_EXPIRE) {
        $story_templates->set_var('is_checked2', 'checked="checked"');
        $story_templates->set_var('is_checked3', 'checked="checked"');
        $js_showarchivedisabled = 'false';
        $have_archive_topic = true;
        // force display of auto archive option
    } elseif ($story->EditElements('statuscode') == STORY_DELETE_ON_EXPIRE) {
        $story_templates->set_var('is_checked2', 'checked="checked"');
        $story_templates->set_var('is_checked4', 'checked="checked"');
        if (!$have_archive_topic) {
            $story_templates->set_var('is_checked3', 'style="display:none;"');
        }
        $js_showarchivedisabled = 'false';
    } else {
        if (!$have_archive_topic) {
            $story_templates->set_var('is_checked3', 'style="display:none;"');
        }
        $js_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]);
    if ($have_archive_topic) {
        $story_templates->set_var('lang_optionarchive', $LANG24[61]);
    } else {
        $story_templates->set_var('lang_optionarchive', '');
    }
    $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('lang_page_title', $LANG_ADMIN['page_title']);
    $story_templates->set_var('page_title', $story->EditElements('page_title'));
    $story_templates->set_var('lang_metadescription', $LANG_ADMIN['meta_description']);
    $story_templates->set_var('meta_description', $story->EditElements('meta_description'));
    $story_templates->set_var('lang_metakeywords', $LANG_ADMIN['meta_keywords']);
    $story_templates->set_var('meta_keywords', $story->EditElements('meta_keywords'));
    if ($_CONF['meta_tags'] > 0) {
        $story_templates->set_var('hide_meta', '');
    } else {
        $story_templates->set_var('hide_meta', ' style="display:none;"');
    }
    $story_templates->set_var('lang_topic', $LANG_ADMIN['topic']);
    if ($mode == 'preview') {
        $tlist = TOPIC_getTopicSelectionControl('article', '', false, true, true);
    } else {
        $tlist = TOPIC_getTopicSelectionControl('article', $oldsid, false, true, true);
    }
    if (empty($tlist)) {
        $display .= COM_showMessage(101);
        return $display;
    }
    $story_templates->set_var('topic_selection', $tlist);
    $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('lang_cachetime', $LANG24['cache_time']);
    $story_templates->set_var('lang_cachetime_desc', $LANG24['cache_time_desc']);
    $story_templates->set_var('cache_time', $story->EditElements('cache_time'));
    $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('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"');
        $js_showcmtclosedisabled = 'false';
    } else {
        $js_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);
    // ensure that the year dropdown includes the close year
    $endtm = mktime(0, 0, 0, date('m'), date('d') + $_CONF['article_comment_close_days'], date('Y'));
    $yoffset = date('Y', $endtm) - date('Y');
    $close_year = $story->EditElements('cmt_close_year');
    if ($yoffset < -1) {
        $year_options = COM_getYearFormOptions($close_year, $yoffset);
    } elseif ($yoffset > 5) {
        $year_options = COM_getYearFormOptions($close_year, -1, $yoffset);
    } else {
        $year_options = COM_getYearFormOptions($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=""' . XHTML . '>';
    }
    $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;
    } else {
        $featured_options = "<input type=\"hidden\" name=\"featured\" value=\"0\"" . XHTML . ">";
    }
    $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('noscript', COM_getNoScript(false, $LANG24[77], sprintf($LANG24[78], $_CONF['site_admin_url'], $sid)));
    $postmode = $story->EditElements('postmode');
    if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) {
        if ($story->EditElements('advanced_editor_mode') == 1 or $story->EditElements('postmode') == 'adveditor') {
            $postmode = '';
        }
    }
    $post_options = COM_optionList($_TABLES['postmodes'], 'code,name', $postmode);
    $postmode_list = 'plaintext,html';
    // If Advanced Mode - add post option and set default if editing story created with Advanced Editor
    if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) {
        $postmode_list .= ',adveditor';
        if ($story->EditElements('advanced_editor_mode') == 1 or $story->EditElements('postmode') == 'adveditor') {
            $post_options .= '<option value="adveditor" selected="selected">' . $LANG24[86] . '</option>';
        } else {
            $post_options .= '<option value="adveditor">' . $LANG24[86] . '</option>';
        }
    }
    if ($_CONF['wikitext_editor']) {
        $postmode_list .= ',wikitext';
        if ($story->EditElements('postmode') == 'wikitext') {
            $post_options .= '<option value="wikitext" selected="selected">' . $LANG24[88] . '</option>';
        } else {
            $post_options .= '<option value="wikitext">' . $LANG24[88] . '</option>';
        }
    }
    $story_templates->set_var('post_options', $post_options);
    $postmode_array = explode(',', $postmode_list);
    $allowed_html = '';
    foreach ($postmode_array as $pm) {
        $allowed_html .= COM_allowedHTML('story.edit', false, 1, $pm);
    }
    $allowed_tags = array('code', 'raw');
    if ($_CONF['allow_page_breaks'] == 1) {
        $allowed_tags = array_merge($allowed_tags, array('page_break'));
    }
    $allowed_html .= COM_allowedAutotags(false, $allowed_tags);
    $story_templates->set_var('lang_allowed_html', $allowed_html);
    $fileinputs = '';
    $saved_images = '';
    if ($_CONF['maximagesperarticle'] > 0) {
        $story_templates->set_var('lang_images', $LANG24[47]);
        $icount = DB_count($_TABLES['article_images'], 'ai_sid', $story->getSid());
        if ($icount > 0) {
            $result_articles = DB_query("SELECT * FROM {$_TABLES['article_images']} WHERE ai_sid = '" . $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'] . ']"' . XHTML . '><br' . XHTML . '>';
            }
        }
        $newallowed = $_CONF['maximagesperarticle'] - $icount;
        for ($z = $icount + 1; $z <= $_CONF['maximagesperarticle']; $z++) {
            $fileinputs .= $z . ') <input type="file" dir="ltr" name="file' . $z . '"' . XHTML . '>';
            if ($z < $_CONF['maximagesperarticle']) {
                $fileinputs .= '<br' . XHTML . '>';
            }
        }
        $fileinputs .= '<br' . XHTML . '>' . $LANG24[51];
        if ($_CONF['allow_user_scaling'] == 1) {
            $fileinputs .= $LANG24[27];
        }
        $fileinputs .= $LANG24[28] . '<br' . XHTML . '>';
    }
    // Add JavaScript
    $_SCRIPTS->setJavaScriptFile('story_editor', '/javascript/story_editor.js');
    if ($_CONF['titletoid']) {
        $_SCRIPTS->setJavaScriptFile('title_2_id', '/javascript/title_2_id.js');
        $story_templates->set_var('titletoid', true);
    }
    $_SCRIPTS->setJavaScriptFile('postmode_control', '/javascript/postmode_control.js');
    // Loads jQuery UI datepicker and timepicker-addon
    $_SCRIPTS->setJavaScriptLibrary('jquery.ui.slider');
    //    $_SCRIPTS->setJavaScriptLibrary('jquery.ui.button');
    $_SCRIPTS->setJavaScriptLibrary('jquery.ui.datepicker');
    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-i18n');
    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon');
    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon-i18n');
    //    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-slideraccess');
    $_SCRIPTS->setJavaScriptFile('datetimepicker', '/javascript/datetimepicker.js');
    $langCode = COM_getLangIso639Code();
    $toolTip = $MESSAGE[118];
    $imgUrl = $_CONF['site_url'] . '/images/calendar.png';
    $_SCRIPTS->setJavaScript("jQuery(function () {" . "  geeklog.hour_mode = {$_CONF['hour_mode']};" . "  geeklog.datetimepicker.set('publish', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "  geeklog.datetimepicker.set('expire', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "  geeklog.datetimepicker.set('cmt_close', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "});", TRUE, TRUE);
    // Setup Advanced Editor
    COM_setupAdvancedEditor('/javascript/storyeditor_adveditor.js');
    $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 ($mode == 'clone') {
        $story_templates->set_var('story_id', COM_makesid());
    } else {
        $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', $LANG_ADMIN['save']);
    $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('gltoken_name', CSRF_TOKEN);
    $token = SEC_createToken();
    $story_templates->set_var('gltoken', $token);
    $story_templates->parse('output', 'editor');
    $display .= COM_startBlock($LANG24[5], '', COM_getBlockTemplate('_admin_block', 'header'));
    $display .= SEC_getTokenExpiryNotice($token, $LANG24[91]);
    $display .= $story_templates->finish($story_templates->get_var('output'));
    $display .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $display;
}
Ejemplo n.º 12
0
/**
* Check a security token.
*
* Checks the POST and GET data for a security token, if one exists, validates
* that it's for this user and URL. If the token is not valid, it asks the user
* to re-authenticate and resends the request if authentication was successful.
*
* @return   boolean     true if the token is valid; does not return if not!
*
*/
function SEC_checkToken()
{
    global $_CONF, $LANG20, $LANG_ADMIN;
    if (_sec_checkToken()) {
        SEC_createToken(-1);
        return true;
    }
    // determine the destination of this request
    $destination = COM_getCurrentURL();
    // validate the destination is not blank and is part of our site...
    if ($destination == '') {
        $destination = $_CONF['site_url'] . '/index.php';
    }
    if (substr($destination, 0, strlen($_CONF['site_url'])) != $_CONF['site_url']) {
        $destination = $_CONF['site_url'] . '/index.php';
    }
    $method = strtoupper($_SERVER['REQUEST_METHOD']) == 'GET' ? 'GET' : 'POST';
    $postdata = serialize($_POST);
    $getdata = serialize($_GET);
    $filedata = '';
    if (!empty($_FILES)) {
        foreach ($_FILES as $key => $file) {
            if (is_array($file['name'])) {
                foreach ($file['name'] as $offset => $filename) {
                    if (!empty($file['name'][$offset])) {
                        $filename = basename($file['tmp_name'][$offset]);
                        move_uploaded_file($file['tmp_name'][$offset], $_CONF['path_data'] . 'temp/' . $filename);
                        $_FILES[$key]['tmp_name'][$offset] = $filename;
                    }
                }
            } else {
                if (!empty($file['name']) && !empty($file['tmp_name'])) {
                    $filename = basename($file['tmp_name']);
                    move_uploaded_file($file['tmp_name'], $_CONF['path_data'] . 'temp/' . $filename);
                    $_FILES[$key]['tmp_name'] = $filename;
                }
            }
        }
        $filedata = serialize($_FILES);
    }
    SESS_setVar('glfusion.auth.method', $method);
    SESS_setVar('glfusion.auth.dest', $destination);
    SESS_setVar('glfusion.auth.post', $postdata);
    SESS_setVar('glfusion.auth.get', $getdata);
    if (!empty($filedata)) {
        SESS_setVar('glfusion.auth.file', $filedata);
    }
    $display = COM_siteHeader();
    $display .= SEC_tokenreauthForm('', $destination);
    $display .= COM_siteFooter();
    echo $display;
    exit;
}
Ejemplo 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;
}
Ejemplo n.º 14
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 editServiceForm($pid, $msg = '', $new_name = '', $new_site_url = '', $new_ping_url = '', $new_method = '', $new_enabled = -1)
{
    global $_CONF, $_TABLES, $LANG_TRB, $LANG_ADMIN, $MESSAGE;
    $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;
    }
    if (!empty($msg)) {
        $retval .= showTrackbackMessage('Error', $msg);
    }
    $token = SEC_createToken();
    $retval .= COM_startBlock($LANG_TRB['edit_service'], getHelpUrl() . '#ping', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= SEC_getTokenExpiryNotice($token);
    $template = COM_newTemplate($_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' . XHTML . '>';
        $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', $token);
    $template->parse('output', 'editor');
    $retval .= $template->finish($template->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    $retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG_TRB['edit_service']));
    return $retval;
}
Ejemplo n.º 15
0
/**
* Displays the static page editor form
*
* @param    array   $A      Data to display
* @return   string          HTML for the static page editor
*
*/
function staticpageeditor_form($A)
{
    global $_CONF, $_TABLES, $_USER, $_GROUPS, $_SP_CONF, $mode, $sp_id, $LANG21, $LANG_STATIC, $LANG_ACCESS, $LANG_ADMIN, $LANG01, $LANG24, $LANG_postmodes, $MESSAGE, $_IMAGE_TYPE, $_SCRIPTS;
    if (!empty($sp_id) && $mode == 'edit') {
        $access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
    } else {
        if ($mode != 'clone') {
            $A['sp_inblock'] = $_SP_CONF['in_block'];
        }
        $A['owner_id'] = $_USER['uid'];
        if (isset($_GROUPS['Static Page Admin'])) {
            $A['group_id'] = $_GROUPS['Static Page Admin'];
        } else {
            $A['group_id'] = SEC_getFeatureGroup('staticpages.edit');
        }
        SEC_setDefaultPermissions($A, $_SP_CONF['default_permissions']);
        $access = 3;
        if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) {
            $A['advanced_editor_mode'] = 1;
        }
    }
    $retval = '';
    $sp_template = COM_newTemplate(CTL_plugin_templatePath('staticpages', 'admin'));
    if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) {
        $sp_template->set_file('form', 'editor_advanced.thtml');
        // Shouldn't really have to check if anonymous user but who knows...
        if (COM_isAnonUser()) {
            $link_message = "";
        } else {
            $link_message = $LANG01[138];
        }
        $sp_template->set_var('noscript', COM_getNoScript(false, '', $link_message));
        // Setup Advanced Editor
        COM_setupAdvancedEditor('/staticpages/adveditor.js', 'staticpages.edit');
        $sp_template->set_var('lang_expandhelp', $LANG24[67]);
        $sp_template->set_var('lang_reducehelp', $LANG24[68]);
        $sp_template->set_var('lang_toolbar', $LANG24[70]);
        $sp_template->set_var('toolbar1', $LANG24[71]);
        $sp_template->set_var('toolbar2', $LANG24[72]);
        $sp_template->set_var('toolbar3', $LANG24[73]);
        $sp_template->set_var('toolbar4', $LANG24[74]);
        $sp_template->set_var('toolbar5', $LANG24[75]);
        $sp_template->set_var('lang_nojavascript', $LANG24[77]);
        $sp_template->set_var('lang_postmode', $LANG24[4]);
        if (isset($A['postmode']) && $A['postmode'] == 'adveditor') {
            $sp_template->set_var('show_adveditor', '');
            $sp_template->set_var('show_htmleditor', 'none');
        } else {
            $sp_template->set_var('show_adveditor', 'none');
            $sp_template->set_var('show_htmleditor', '');
        }
        $post_options = '<option value="html" selected="selected">' . $LANG_postmodes['html'] . '</option>';
        if (isset($A['postmode']) && $A['postmode'] == 'adveditor') {
            $post_options .= '<option value="adveditor" selected="selected">' . $LANG24[86] . '</option>';
        } else {
            $post_options .= '<option value="adveditor">' . $LANG24[86] . '</option>';
        }
        $sp_template->set_var('post_options', $post_options);
        $sp_template->set_var('change_editormode', 'onchange="change_editmode(this);"');
    } else {
        $sp_template->set_file('form', 'editor.thtml');
    }
    // Add JavaScript
    if ($_CONF['titletoid']) {
        $_SCRIPTS->setJavaScriptFile('title_2_id', '/javascript/title_2_id.js');
        $sp_template->set_var('titletoid', true);
    }
    $sp_template->set_var('lang_mode', $LANG24[3]);
    $sp_template->set_var('comment_options', COM_optionList($_TABLES['commentcodes'], 'code,name', $A['commentcode']));
    $sp_template->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
    $sp_template->set_var('lang_owner', $LANG_ACCESS['owner']);
    $owner_name = COM_getDisplayName($A['owner_id']);
    $owner_username = DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}");
    $sp_template->set_var('owner_id', $A['owner_id']);
    $sp_template->set_var('owner', $owner_name);
    $sp_template->set_var('owner_name', $owner_name);
    $sp_template->set_var('owner_username', $owner_username);
    if ($A['owner_id'] > 1) {
        $profile_link = $_CONF['site_url'] . '/users.php?mode=profile&amp;uid=' . $A['owner_id'];
        $sp_template->set_var('start_owner_anchortag', '<a href="' . $profile_link . '">');
        $sp_template->set_var('end_owner_anchortag', '</a>');
        $sp_template->set_var('owner_link', COM_createLink($owner_name, $profile_link));
        $photo = '';
        if ($_CONF['allow_user_photo']) {
            $photo = DB_getItem($_TABLES['users'], 'photo', "uid = {$A['owner_id']}");
            if (!empty($photo)) {
                $camera_icon = '<img src="' . $_CONF['layout_url'] . '/images/smallcamera.' . $_IMAGE_TYPE . '" alt=""' . XHTML . '>';
                $sp_template->set_var('camera_icon', COM_createLink($camera_icon, $profile_link));
            }
        }
        if (empty($photo)) {
            $sp_template->set_var('camera_icon', '');
        }
    } else {
        $sp_template->set_var('start_owner_anchortag', '');
        $sp_template->set_var('end_owner_anchortag', '');
        $sp_template->set_var('owner_link', $owner_name);
    }
    $sp_template->set_var('lang_group', $LANG_ACCESS['group']);
    $sp_template->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access));
    $sp_template->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']));
    $sp_template->set_var('lang_permissions', $LANG_ACCESS['permissions']);
    $sp_template->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
    $sp_template->set_var('permissions_msg', $LANG_ACCESS['permmsg']);
    $sp_template->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']);
    $token = SEC_createToken();
    $start_block = COM_startBlock($LANG_STATIC['staticpageeditor'], '', COM_getBlockTemplate('_admin_block', 'header'));
    $start_block .= SEC_getTokenExpiryNotice($token);
    $sp_template->set_var('start_block_editor', $start_block);
    $sp_template->set_var('lang_save', $LANG_ADMIN['save']);
    $sp_template->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $sp_template->set_var('lang_preview', $LANG_ADMIN['preview']);
    if (SEC_hasRights('staticpages.delete') && $mode != 'clone' && !empty($A['sp_old_id'])) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $sp_template->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        $sp_template->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
    } else {
        $sp_template->set_var('delete_option', '');
    }
    $sp_template->set_var('lang_writtenby', $LANG_STATIC['writtenby']);
    $sp_template->set_var('username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}"));
    $authorname = COM_getDisplayName($A['owner_id']);
    $sp_template->set_var('name', $authorname);
    $sp_template->set_var('author', $authorname);
    $sp_template->set_var('lang_url', $LANG_STATIC['url']);
    $sp_template->set_var('lang_id', $LANG_STATIC['id']);
    $sp_template->set_var('sp_uid', $A['owner_id']);
    $sp_template->set_var('sp_id', $A['sp_id']);
    $sp_template->set_var('sp_old_id', $A['sp_old_id']);
    $sp_template->set_var('example_url', COM_buildURL($_CONF['site_url'] . '/staticpages/index.php?page=' . $A['sp_id']));
    $sp_template->set_var('lang_centerblock', $LANG_STATIC['centerblock']);
    $sp_template->set_var('lang_centerblock_help', $LANG_ADMIN['help_url']);
    $sp_template->set_var('lang_centerblock_include', $LANG21[51]);
    $sp_template->set_var('lang_centerblock_desc', $LANG21[52]);
    $sp_template->set_var('centerblock_help', $A['sp_help']);
    $sp_template->set_var('lang_centerblock_msg', $LANG_STATIC['centerblock_msg']);
    if (isset($A['sp_centerblock']) && $A['sp_centerblock'] == 1) {
        $sp_template->set_var('centerblock_checked', 'checked="checked"');
    } else {
        $sp_template->set_var('centerblock_checked', '');
    }
    $sp_template->set_var('lang_position', $LANG_STATIC['position']);
    $position = '<select name="sp_where">';
    $position .= '<option value="1"';
    if ($A['sp_where'] == 1) {
        $position .= ' selected="selected"';
    }
    $position .= '>' . $LANG_STATIC['position_top'] . '</option>';
    $position .= '<option value="2"';
    if ($A['sp_where'] == 2) {
        $position .= ' selected="selected"';
    }
    $position .= '>' . $LANG_STATIC['position_feat'] . '</option>';
    $position .= '<option value="3"';
    if ($A['sp_where'] == 3) {
        $position .= ' selected="selected"';
    }
    $position .= '>' . $LANG_STATIC['position_bottom'] . '</option>';
    $position .= '<option value="0"';
    if ($A['sp_where'] == 0) {
        $position .= ' selected="selected"';
    }
    $position .= '>' . $LANG_STATIC['position_entire'] . '</option>';
    $position .= '</select>';
    $sp_template->set_var('pos_selection', $position);
    if ($_SP_CONF['allow_php'] == 1 && SEC_hasRights('staticpages.PHP')) {
        if (!isset($A['sp_php'])) {
            $A['sp_php'] = 0;
        }
        $selection = '<select name="sp_php">' . LB;
        $selection .= '<option value="0"';
        if ($A['sp_php'] <= 0 || $A['sp_php'] > 2) {
            $selection .= ' selected="selected"';
        }
        $selection .= '>' . $LANG_STATIC['select_php_none'] . '</option>' . LB;
        $selection .= '<option value="1"';
        if ($A['sp_php'] == 1) {
            $selection .= ' selected="selected"';
        }
        $selection .= '>' . $LANG_STATIC['select_php_return'] . '</option>' . LB;
        $selection .= '<option value="2"';
        if ($A['sp_php'] == 2) {
            $selection .= ' selected="selected"';
        }
        $selection .= '>' . $LANG_STATIC['select_php_free'] . '</option>' . LB;
        $selection .= '</select>';
        $sp_template->set_var('php_selector', $selection);
        $sp_template->set_var('php_warn', $LANG_STATIC['php_warn']);
    } else {
        $sp_template->set_var('php_selector', '');
        $sp_template->set_var('php_warn', $LANG_STATIC['php_not_activated']);
    }
    $sp_template->set_var('php_msg', $LANG_STATIC['php_msg']);
    // old variables (for the 1.3-type checkbox)
    $sp_template->set_var('php_checked', '');
    $sp_template->set_var('php_type', 'hidden');
    if (isset($A['sp_nf']) && $A['sp_nf'] == 1) {
        $sp_template->set_var('exit_checked', 'checked="checked"');
    } else {
        $sp_template->set_var('exit_checked', '');
    }
    $sp_template->set_var('exit_msg', $LANG_STATIC['exit_msg']);
    $sp_template->set_var('exit_info', $LANG_STATIC['exit_info']);
    if ($A['sp_inblock'] == 1) {
        $sp_template->set_var('inblock_checked', 'checked="checked"');
    } else {
        $sp_template->set_var('inblock_checked', '');
    }
    $sp_template->set_var('inblock_msg', $LANG_STATIC['inblock_msg']);
    $sp_template->set_var('inblock_info', $LANG_STATIC['inblock_info']);
    if ($A['draft_flag'] == 1) {
        $sp_template->set_var('draft_flag_checked', 'checked="checked"');
    } else {
        $sp_template->set_var('draft_flag_checked', '');
    }
    $sp_template->set_var('lang_draft', $LANG_STATIC['draft']);
    $sp_template->set_var('lang_cache_time', $LANG_STATIC['cache_time']);
    $sp_template->set_var('lang_cache_time_desc', $LANG_STATIC['cache_time_desc']);
    $sp_template->set_var('cache_time', $A['cache_time']);
    $curtime = COM_getUserDateTimeFormat($A['unixdate']);
    $sp_template->set_var('lang_lastupdated', $LANG_STATIC['date']);
    $sp_template->set_var('sp_formateddate', $curtime[0]);
    $sp_template->set_var('sp_date', $curtime[1]);
    $sp_template->set_var('lang_title', $LANG_STATIC['title']);
    $sp_template->set_var('lang_page_title', $LANG_STATIC['page_title']);
    $title = '';
    $page_title = '';
    if (isset($A['sp_title'])) {
        $title = htmlspecialchars(stripslashes($A['sp_title']));
    }
    if (isset($A['sp_page_title'])) {
        $page_title = htmlspecialchars(stripslashes($A['sp_page_title']));
    }
    $sp_template->set_var('sp_title', $title);
    $sp_template->set_var('sp_page_title', $page_title);
    $sp_template->set_var('lang_topic', $LANG_STATIC['topic']);
    if ($mode != 'clone') {
        // want to use default topic selection if new staticpage so pass in blank id
        $topic_sp_id = $A['sp_id'];
        if (empty($sp_id) && $mode == 'edit') {
            // means new
            $topic_sp_id = '';
        }
        $sp_template->set_var('topic_selection', TOPIC_getTopicSelectionControl('staticpages', $topic_sp_id, true, false, true));
    } else {
        $sp_template->set_var('topic_selection', TOPIC_getTopicSelectionControl('staticpages', $A['clone_sp_id'], true, false, true));
    }
    $sp_template->set_var('lang_metadescription', $LANG_ADMIN['meta_description']);
    $sp_template->set_var('lang_metakeywords', $LANG_ADMIN['meta_keywords']);
    if (!empty($A['meta_description'])) {
        $sp_template->set_var('meta_description', $A['meta_description']);
    }
    if (!empty($A['meta_keywords'])) {
        $sp_template->set_var('meta_keywords', $A['meta_keywords']);
    }
    if ($_CONF['meta_tags'] > 0 && $_SP_CONF['meta_tags'] > 0) {
        $sp_template->set_var('hide_meta', '');
    } else {
        $sp_template->set_var('hide_meta', ' style="display:none;"');
    }
    if ($A['template_flag'] == 1) {
        $sp_template->set_var('template_flag_checked', 'checked="checked"');
    } else {
        $sp_template->set_var('template_flag_checked', '');
    }
    $sp_template->set_var('lang_template', $LANG_STATIC['template']);
    $sp_template->set_var('lang_template_flag_msg', $LANG_STATIC['template_msg']);
    $template_list = templatelist($A['template_id']);
    $template_none = '<option value=""';
    if ($A['template_id'] == "") {
        $template_none .= ' selected="selected"';
    }
    $template_none .= '>' . $LANG_STATIC['none'] . '</option>';
    $sp_template->set_var('use_template_selection', '<select name="template_id">' . $template_none . $template_list . '</select>');
    $sp_template->set_var('lang_use_template', $LANG_STATIC['use_template']);
    $sp_template->set_var('lang_use_template_msg', $LANG_STATIC['use_template_msg']);
    $sp_template->set_var('lang_addtomenu', $LANG_STATIC['addtomenu']);
    if (isset($A['sp_onmenu']) && $A['sp_onmenu'] == 1) {
        $sp_template->set_var('onmenu_checked', 'checked="checked"');
    } else {
        $sp_template->set_var('onmenu_checked', '');
    }
    $sp_template->set_var('lang_label', $LANG_STATIC['label']);
    if (isset($A['sp_label'])) {
        $sp_template->set_var('sp_label', $A['sp_label']);
    } else {
        $sp_template->set_var('sp_label', '');
    }
    $sp_template->set_var('lang_pageformat', $LANG_STATIC['pageformat']);
    $sp_template->set_var('lang_blankpage', $LANG_STATIC['blankpage']);
    $sp_template->set_var('lang_noblocks', $LANG_STATIC['noblocks']);
    $sp_template->set_var('lang_leftblocks', $LANG_STATIC['leftblocks']);
    $sp_template->set_var('lang_leftrightblocks', $LANG_STATIC['leftrightblocks']);
    if (!isset($A['sp_format'])) {
        $A['sp_format'] = '';
    }
    if ($A['sp_format'] == 'noblocks') {
        $sp_template->set_var('noblock_selected', 'selected="selected"');
    } else {
        $sp_template->set_var('noblock_selected', '');
    }
    if ($A['sp_format'] == 'leftblocks') {
        $sp_template->set_var('leftblocks_selected', 'selected="selected"');
    } else {
        $sp_template->set_var('leftblocks_selected', '');
    }
    if ($A['sp_format'] == 'blankpage') {
        $sp_template->set_var('blankpage_selected', 'selected="selected"');
    } else {
        $sp_template->set_var('blankpage_selected', '');
    }
    if ($A['sp_format'] == 'allblocks' or empty($A['sp_format'])) {
        $sp_template->set_var('allblocks_selected', 'selected="selected"');
    } else {
        $sp_template->set_var('allblocks_selected', '');
    }
    $sp_template->set_var('lang_content', $LANG_STATIC['content']);
    $content = '';
    if (isset($A['sp_content'])) {
        $content = htmlspecialchars(stripslashes($A['sp_content']));
        $content = str_replace(array('{', '}'), array('&#123;', '&#125;'), $content);
    }
    $sp_template->set_var('sp_content', $content);
    $allowed = COM_allowedHTML('staticpages.edit', false, $_SP_CONF['filter_html']) . COM_allowedAutotags();
    $sp_template->set_var('lang_allowedhtml', $allowed);
    $sp_template->set_var('lang_allowed_html', $allowed);
    $sp_template->set_var('lang_hits', $LANG_STATIC['hits']);
    if (empty($A['sp_hits'])) {
        $sp_template->set_var('sp_hits', '0');
        $sp_template->set_var('sp_hits_formatted', '0');
    } else {
        $sp_template->set_var('sp_hits', $A['sp_hits']);
        $sp_template->set_var('sp_hits_formatted', COM_numberFormat($A['sp_hits']));
    }
    $sp_template->set_var('lang_comments', $LANG_STATIC['comments']);
    if ($A['commentcode'] == -1) {
        $sp_template->set_var('sp_comments', $LANG_ADMIN['na']);
    } else {
        $num_comments = DB_count($_TABLES['comments'], array('sid', 'type'), array(DB_escapeString($A['sp_id']), 'staticpages'));
        $sp_template->set_var('sp_comments', COM_numberFormat($num_comments));
    }
    $sp_template->set_var('end_block', COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')));
    $sp_template->set_var('gltoken_name', CSRF_TOKEN);
    $sp_template->set_var('gltoken', $token);
    $sp_template->parse('output', 'form');
    $retval .= $sp_template->finish($sp_template->get_var('output'));
    return $retval;
}
Ejemplo n.º 16
0
function SFS_adminList()
{
    global $_CONF, $_USER, $_TABLES, $LANG_SFS, $LANG_ADMIN;
    // force the query limit to 10 if user has not set a limit.
    if (!isset($_GET['query_limit']) && !isset($_POST['query_limit'])) {
        $_GET['query_limit'] = 10;
    }
    if (defined('DVLP_VERSION')) {
        $block_title = '<strong>DEVELOPMENT TOGGLE ENABLED</strong> - ' . $LANG_SFS['title'];
    } else {
        $block_title = $LANG_SFS['title'];
    }
    $retval = COM_startBlock($block_title, '', COM_getBlockTemplate('_admin_block', 'header'));
    $menu_arr = array(array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $retval .= ADMIN_createMenu($menu_arr, $LANG_SFS['instructions'], $_CONF['layout_url'] . '/images/icons/sfs.png');
    $header_arr = array(array('text' => $LANG_SFS['uid'], 'field' => 'uid', 'align' => 'center'), array('text' => $LANG_SFS['username'], 'field' => 'username', 'align' => 'left'), array('text' => $LANG_SFS['email'], 'field' => 'email', 'align' => 'left'), array('text' => $LANG_SFS['remote_ip'], 'field' => 'remote_ip', 'align' => 'left'), array('text' => $LANG_SFS['sfs_status'], 'field' => 'status'));
    $text_arr = array('no_data' => $LANG_SFS['no_data'], 'form_url' => $_CONF['site_admin_url'] . '/sfs.php', 'help_url' => '', 'has_limit' => true, 'has_search' => false, 'has_paging' => true);
    $actions = '<input name="banbutton" type="image" src="' . $_CONF['layout_url'] . '/images/admin/delete.png' . '" style="vertical-align:text-bottom;" title="' . $LANG_SFS['action_text'] . '" onclick="return doubleconfirm(\'' . $LANG_SFS['confirm_one'] . '\',\'' . $LANG_SFS['confirm_two'] . '\');"' . '/>&nbsp;' . $LANG_SFS['action_text'];
    $actions .= '&nbsp;&nbsp;&nbsp;&nbsp;<input name="delbutton" type="image" src="' . $_CONF['layout_url'] . '/images/admin/delete.png' . '" style="vertical-align:text-bottom;" title="' . $LANG_SFS['action_text_del'] . '" onclick="return doubleconfirm(\'' . $LANG_SFS['confirm_one_del'] . '\',\'' . $LANG_SFS['confirm_two_del'] . '\');"' . '/>&nbsp;' . $LANG_SFS['action_text_del'];
    $actions .= '<br /><br />';
    $option_arr = array('chkselect' => true, 'chkall' => true, 'chkfield' => 'uid', 'chkname' => 'actionitem', 'chkactions' => $actions);
    $query_arr = array('table' => 'users', 'sql' => "SELECT uid,username,email,status,remote_ip FROM {$_TABLES['users']} WHERE status <> 0 ", 'query_fields' => array('status'), 'default_filter' => "");
    $token = SEC_createToken();
    $form_arr = array('top' => '<input type="hidden" name="' . CSRF_TOKEN . '" value="' . $token . '"/>', 'bottom' => '<input type="hidden" name="userban" value="true"/>');
    $defsort_arr = array('field' => 'regdate', 'direction' => 'DESC');
    $retval .= ADMIN_list("sfs", "SFS_getListField", $header_arr, $text_arr, $query_arr, $defsort_arr, '', $token, $option_arr, $form_arr);
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
Ejemplo n.º 17
0
            if ($M['mod_stick'] == "1") {
                $chk_stick = "checked";
            } else {
                $chk_stick = "";
            }
            $moderators->set_var('id', $M['mod_id']);
            if ($filtermode == 'group') {
                $moderators->set_var('name', DB_getItem($_TABLES['groups'], 'grp_name', "grp_id='{$M['mod_groupid']}'"));
            } else {
                $moderators->set_var('name', $M['mod_username']);
            }
            $moderators->set_var('forum', DB_getItem($_TABLES['forum_forums'], "forum_name", "forum_id={$M['mod_forum']}"));
            $moderators->set_var('delete_yes', $chk_delete);
            $moderators->set_var('ban_yes', $chk_ban);
            $moderators->set_var('edit_yes', $chk_edit);
            $moderators->set_var('move_yes', $chk_move);
            $moderators->set_var('stick_yes', $chk_stick);
            $moderators->set_var('cssid', $i % 2 + 1);
            $moderators->parse('moderator_records', 'mod_record', true);
            $i++;
        }
        $moderators->set_var('gltoken_name', CSRF_TOKEN);
        $moderators->set_var('gltoken', SEC_createToken());
        $moderators->parse('output', 'moderators');
        $display .= $moderators->finish($moderators->get_var('output'));
    }
}
$display .= COM_endBlock();
$display .= adminfooter();
$display = COM_createHTMLDocument($display);
COM_output($display);
Ejemplo n.º 18
0
/**
* Render all the trackback comments for a specific entry
*
* @param    string  $sid            entry id
* @param    string  $type           type of entry ('article' = story, etc.)
* @param    string  $title          the entry's title
* @param    string  $permalink      link to the entry
* @param    string  trackback_url   trackback URL for this entry
* @return   string                  HTML (formatted list of trackback comments)
*
*/
function TRB_renderTrackbackComments($sid, $type, $title, $permalink, $trackback_url = '')
{
    global $_CONF, $_TABLES, $LANG_TRB;
    $link_and_title = COM_createLink($title, $permalink);
    if (empty($trackback_url)) {
        $trackback_url = TRB_makeTrackbackUrl($sid, $type);
    }
    $template = COM_newTemplate($_CONF['path_layout'] . 'trackback');
    $template->set_file(array('trackback' => 'trackback.thtml', 'comment' => 'trackbackcomment.thtml'));
    $template->set_var('lang_trackback', $LANG_TRB['trackback']);
    $template->set_var('lang_trackback_url', $LANG_TRB['this_trackback_url']);
    $template->set_var('permalink', $permalink);
    $template->set_var('permalink_and_title', $link_and_title);
    $template->set_var('trackback_url', $trackback_url);
    $result = DB_query("SELECT cid,url,title,blog,excerpt,ipaddress,UNIX_TIMESTAMP(date) AS day " . "FROM {$_TABLES['trackback']} WHERE sid = '{$sid}' AND type = '{$type}' ORDER BY date");
    $numrows = DB_numRows($result);
    $template->set_var('trackback_comment_count', $numrows);
    $num_comments = sprintf($LANG_TRB['num_comments'], $numrows);
    $template->set_var('trackback_comment_text', $num_comments);
    if ($numrows == 0) {
        $template->set_var('lang_trackback_comments', $LANG_TRB['no_comments']);
        $template->set_var('lang_trackback_comments_no_link', $LANG_TRB['no_comments']);
    } else {
        $template->set_var('lang_trackback_comments', sprintf($LANG_TRB['intro_text'], $link_and_title));
        $template->set_var('lang_trackback_comments_no_link', sprintf($LANG_TRB['intro_text'], $title));
    }
    $delete_option = TRB_allowDelete($sid, $type);
    $token = '';
    if ($delete_option && $numrows > 0) {
        $token = SEC_createToken();
    }
    for ($i = 0; $i < $numrows; $i++) {
        $A = DB_fetchArray($result);
        $comment = TRB_formatComment($A['url'], $A['title'], $A['blog'], $A['excerpt'], $A['day'], $delete_option, $A['cid'], $A['ipaddress'], $token);
        $template->set_var('formatted_comment', $comment);
        $template->parse('trackback_comments', 'comment', true);
    }
    $template->parse('output', 'trackback');
    return $template->finish($template->get_var('output'));
}
Ejemplo n.º 19
0
function links_edit_category($cid, $pid)
{
    global $_CONF, $_TABLES, $_USER, $MESSAGE, $LANG_LINKS_ADMIN, $LANG_ADMIN, $LANG_ACCESS, $_LI_CONF;
    $retval = '';
    $cid = addslashes($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='" . addslashes($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['category_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');
    }
    $token = SEC_createToken();
    $retval .= COM_startBlock($LANG_LINKS_ADMIN[56], '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= SEC_getTokenExpiryNotice($token);
    $T = new Template($_CONF['path'] . 'plugins/links/templates/admin');
    $T->set_file(array('page' => 'categoryeditor.thtml'));
    $T->set_var('xhtml', XHTML);
    $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="mode"%s' . XHTML . '>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $T->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        $T->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
    } 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>');
    if (empty($cid)) {
        $num_links = $LANG_ADMIN['na'];
    } else {
        $nresult = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['links']} WHERE cid='{$cid}'" . COM_getPermSQL('AND'));
        $N = DB_fetchArray($nresult);
        $num_links = COM_numberFormat($N['count']);
    }
    $T->set_var('lang_num_links', $LANG_LINKS_ADMIN[61]);
    $T->set_var('num_links', $num_links);
    // 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('lang_perm_key', $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_permissions_msg', $LANG_ACCESS['permmsg']);
    $T->set_var('lang_lockmsg', $LANG_ACCESS['permmsg']);
    $T->set_var('gltoken_name', CSRF_TOKEN);
    $T->set_var('gltoken', $token);
    $T->parse('output', 'page');
    $retval .= $T->finish($T->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
Ejemplo n.º 20
0
/**
 * This function creates an Ad Form
 *
 * Creates an Form for an Ad using the supplied defaults (if specified).
 *
 * @param array $ad array of values describing an Ad
 * @return string HTML string of Ad form
 */
function CLASSIFIEDS_getAdForm($ad = array(), $copy = false)
{
    global $_CONF, $_CLASSIFIEDS_CONF, $LANG_CLASSIFIEDS_2, $LANG_CLASSIFIEDS_ADMIN, $_TABLES, $LANG24, $LANG_ADMIN, $_USER;
    if ($_USER['uid'] < 2) {
        return CLASSIFIEDS_loginRequiredForm();
    }
    if (!SEC_hasRights('classifieds.publish')) {
        //Give publish rights to logged-in users if there is no group with this feature
        $ft_id = DB_getItem($_TABLES['features'], 'ft_id', "ft_name = 'classifieds.publish'");
        $grp_id = DB_getItem($_TABLES['access'], 'acc_grp_id', "acc_ft_id = {$ft_id}");
        //COM_errorLog('Classifieds feature: ' . $ft_id . ' | Group: ' . $grp_id );
        if ($grp_id == '') {
            // Give access
        } else {
            // Display message
            return $LANG_CLASSIFIEDS_2['access_reserved'] . ' <strong>"' . DB_getItem($_TABLES['groups'], 'grp_name', "grp_id = {$grp_id}") . '"</strong>';
        }
    }
    $active = true;
    if ($ad != '') {
        $created = COM_getUserDateTimeFormat($A['created']);
        $active_days = (time() - $created['1']) / (24 * 3600);
        if ($active_days > $_CLASSIFIEDS_CONF['active_days']) {
            $active = false;
        }
        if ((SEC_hasAccess2($ad) != 3 || $ad['deleted'] == 1 || $active == false) && !SEC_hasRights('classifieds.admin')) {
            echo COM_refresh($_CLASSIFIEDS_CONF['site_url'] . "/index.php?error=0");
            exit;
        }
    }
    //Display form
    $ad['clid'] == '' ? $retval = COM_startBlock($LANG_CLASSIFIEDS_2['insert_new_ad']) : ($retval = COM_startBlock($LANG_CLASSIFIEDS_2['edit_label'] . ' ' . $ad['title']));
    $template = new Template($_CONF['path'] . 'plugins/classifieds/templates');
    $template->set_file(array('ad' => 'ad_form.thtml'));
    $template->set_var('site_url', $_CLASSIFIEDS_CONF['site_url']);
    $template->set_var('xhtml', XHTML);
    $template->set_var('gltoken_name', CSRF_TOKEN);
    $template->set_var('gltoken', SEC_createToken());
    if (is_numeric($ad['clid'])) {
        $template->set_var('clid', '<input type="hidden" name="clid" value="' . $ad['clid'] . '" />');
    } else {
        $template->set_var('clid', '');
    }
    //Your Ad
    $template->set_var('your_ad', $LANG_CLASSIFIEDS_2['your_ad']);
    //category
    $categories = '';
    $template->set_var('category_label', $LANG_CLASSIFIEDS_2['category']);
    $categories .= '<option value="0">' . $LANG_CLASSIFIEDS_2['choose_category'] . '</option>';
    $categories .= CLASSIFIEDS_adOptionList($_TABLES['cl_cat'], 'cid,category,pid', $ad['catid'], 'catorder', "catdeleted=0");
    $template->set_var('categories', $categories);
    //type
    $template->set_var('type_label', $LANG_CLASSIFIEDS_2['type']);
    if ($ad['type'] == '1') {
        $template->set_var('type_d', ' selected');
        $template->set_var('type_o', '');
    } elseif ($ad['type'] == '0') {
        $template->set_var('type_d', '');
        $template->set_var('type_o', ' selected');
    } else {
        $template->set_var('type_d', '');
        $template->set_var('type_o', '');
    }
    $choosetype = '<option value="-1">' . $LANG_CLASSIFIEDS_2['choose_type'] . '</option>';
    $template->set_var('choose_type', $choosetype);
    $template->set_var('offer', $LANG_CLASSIFIEDS_2['offer']);
    $template->set_var('demand', $LANG_CLASSIFIEDS_2['demand']);
    //title
    $template->set_var('title_label', $LANG_CLASSIFIEDS_2['title']);
    $template->set_var('title', $ad['title']);
    $template->set_var('currency', $_CLASSIFIEDS_CONF['currency']);
    //text
    $template->set_var('text_label', $LANG_CLASSIFIEDS_2['text']);
    $template->set_var('text', $ad['text']);
    //Price
    $template->set_var('price_label', $LANG_CLASSIFIEDS_2['price']);
    $template->set_var('price', number_format(floatval($ad['price']), $_CONF['decimal_count']));
    //images
    $template->set_var('images', $LANG_CLASSIFIEDS_2['images']);
    $fileinputs = '';
    $saved_images = '';
    if ($_CLASSIFIEDS_CONF['max_images_per_ad'] > 0) {
        if ($ad['clid'] != '') {
            $icount = DB_count($_TABLES['cl_pic'], 'pi_pid', $ad['clid']);
            if ($icount > 0) {
                $result_pics = DB_query("SELECT * FROM {$_TABLES['cl_pic']} WHERE pi_pid = '" . $ad['clid'] . "'");
                for ($z = 1; $z <= $icount; $z++) {
                    $I = DB_fetchArray($result_pics);
                    $saved_images .= '<div><p>' . $z . ') ' . '<a class="lightbox" href="' . $_CLASSIFIEDS_CONF['site_url'] . '/timthumb.php?src=' . $_CLASSIFIEDS_CONF['url_images'] . $I['pi_filename'] . '&amp;w=640"><img src="' . $_CLASSIFIEDS_CONF['site_url'] . '/timthumb.php?src=' . $_CLASSIFIEDS_CONF['url_images'] . $I['pi_filename'] . '&amp;w=' . $size . '&amp;h=' . $size . '" align="top" alt="' . $A['title'] . '" /></a>' . '&nbsp;&nbsp;&nbsp;' . $LANG_ADMIN['delete'] . ': <input type="checkbox" name="delete[' . $I['pi_img_num'] . ']"' . XHTML . '><br' . XHTML . '></p></div>';
                }
            }
        }
        $newallowed = $_CLASSIFIEDS_CONF['max_images_per_ad'] - $icount;
        for ($z = $icount + 1; $z <= $_CLASSIFIEDS_CONF['max_images_per_ad']; $z++) {
            $fileinputs .= $z . ') <input type="file" dir="ltr" name="file' . $z . '"' . XHTML . '> ';
            if ($z < $_CLASSIFIEDS_CONF['max_images_per_ad']) {
                $fileinputs .= '<br' . XHTML . '>';
            }
        }
    }
    $template->set_var('saved_images', $saved_images);
    $template->set_var('image_form_elements', $fileinputs);
    //your details
    if (!is_numeric($ad['clid'])) {
        $data = DB_query("SELECT *\n            FROM {$_TABLES['cl_users']} \n\t\t\tWHERE user_id = {$_USER['uid']}\n\t\t");
        $user_data = DB_fetchArray($data, true);
        $ad['status'] = $user_data['status'];
        $ad['tel'] = $user_data['tel'];
        $ad['postcode'] = $user_data['postcode'];
        $ad['city'] = $user_data['city'];
        $ad['siren'] = $user_data['siren'];
    }
    $template->set_var('your_details', $LANG_CLASSIFIEDS_2['your_details']);
    $template->set_var('status_label', $LANG_CLASSIFIEDS_2['status']);
    $template->set_var('private', $LANG_CLASSIFIEDS_2['private']);
    $template->set_var('professional', $LANG_CLASSIFIEDS_2['professional']);
    if ($ad['status'] == '1') {
        $template->set_var('pro_yes', ' selected');
        $template->set_var('pro_no', '');
    } elseif ($ad['status'] == '0') {
        $template->set_var('pro_yes', '');
        $template->set_var('pro_no', ' selected');
    } else {
        $template->set_var('pro_no', '');
        $template->set_var('pro_yes', '');
    }
    $choose_status = '<option value="-1">' . $LANG_CLASSIFIEDS_2['choose_status'] . '</option>';
    $template->set_var('choose_status', $choose_status);
    $template->set_var('siren_label', $LANG_CLASSIFIEDS_2['siren']);
    $template->set_var('siren', $ad['siren']);
    $template->set_var('tel_label', $LANG_CLASSIFIEDS_2['tel']);
    $template->set_var('tel', $ad['tel']);
    $template->set_var('hide_tel_label', $LANG_CLASSIFIEDS_2['hide_tel']);
    $template->set_var('hide_tel', $ad['hide_tel']);
    if ($ad['hide_tel'] == '1') {
        $template->set_var('tel_ckecked', ' checked="checked"');
    } else {
        $template->set_var('tel_ckecked', '');
    }
    $template->set_var('postcode_label', $LANG_CLASSIFIEDS_2['postcode']);
    $template->set_var('postcode', $ad['postcode']);
    $template->set_var('city_label', $LANG_CLASSIFIEDS_2['city']);
    $template->set_var('city', $ad['city']);
    //submit
    $template->set_var('save_button', $LANG_CLASSIFIEDS_2['save_button']);
    $template->set_var('delete_button', $LANG_CLASSIFIEDS_2['delete_button']);
    $template->set_var('validate_button', $LANG_CLASSIFIEDS_2['validate_button']);
    $template->set_var('required_field', $LANG_CLASSIFIEDS_2['required_field']);
    //Admin options
    if (SEC_hasRights('classifieds.admin')) {
        $admin_select = LB . '<select name="op">' . LB;
        if (!$copy) {
            $admin_select .= '<option value="save" selected="selected">' . $LANG_CLASSIFIEDS_2['save_button'] . '</option>' . LB;
            if ($ad['clid'] != '') {
                $admin_select .= '<option value="delete">' . $LANG_CLASSIFIEDS_2['delete_button'] . '</option>' . LB;
            }
        }
        if (function_exists('CLASSIFIEDS_getBonusAdminButton') && $ad['clid'] != '') {
            $admin_select .= CLASSIFIEDS_getBonusAdminButton();
        }
        $admin_select .= LB . '</select>' . LB;
        $template->set_var('admin_options', $admin_select);
        $datecreated = COM_getUserDateTimeFormat($ad['created']);
        $datemodified = COM_getUserDateTimeFormat($ad['modified']);
        $template->set_var('created', '<p>' . $LANG_CLASSIFIEDS_ADMIN['created'] . $LANG_CLASSIFIEDS_1['double_point'] . ' ' . $datecreated[0] . '</p>');
        $template->set_var('modified', '<p>' . $LANG_CLASSIFIEDS_ADMIN['modified'] . $LANG_CLASSIFIEDS_1['double_point'] . ' ' . $datemodified[0] . '</p>');
    } else {
        $template->set_var('admin_options', '');
        $template->set_var('created', '');
        $template->set_var('modified', '');
    }
    $retval .= $template->parse('output', 'ad');
    $retval .= COM_endBlock();
    return $retval;
}
Ejemplo n.º 21
0
/**
 * Helper function: Display loginform and ask user to authenticate again
 *
 * @param    string $returnurl URL to return to after authentication
 * @param    string $method    original request method: POST or GET
 * @param    string $postdata  serialized POST data
 * @param    string $getdata   serialized GET data
 * @return   string              HTML for the authentication form
 * @access   private
 */
function SECINT_authform($returnurl, $method, $postdata = '', $getdata = '', $files = '')
{
    global $LANG20, $LANG_ADMIN;
    // stick postdata etc. into hidden input fields
    $hidden = '<input type="hidden" name="mode" value="tokenexpired"' . XHTML . '>' . LB;
    $hidden .= '<input type="hidden" name="token_returnurl" value="' . urlencode($returnurl) . '"' . XHTML . '>' . LB;
    $hidden .= '<input type="hidden" name="token_postdata" value="' . urlencode($postdata) . '"' . XHTML . '>' . LB;
    $hidden .= '<input type="hidden" name="token_getdata" value="' . urlencode($getdata) . '"' . XHTML . '>' . LB;
    $hidden .= '<input type="hidden" name="token_files" value="' . urlencode($files) . '"' . XHTML . '>' . LB;
    $hidden .= '<input type="hidden" name="token_requestmethod" value="' . $method . '"' . XHTML . '>' . LB;
    $hidden .= '<input type="hidden" name="' . CSRF_TOKEN . '" value="' . SEC_createToken() . '"' . XHTML . '>' . LB;
    $cfg = array('hide_forgotpw_link' => true, 'no_newreg_link' => true, 'no_openid_login' => true, 'no_plugin_vars' => true, 'title' => $LANG20[1], 'message' => $LANG_ADMIN['reauth_msg'], 'button_text' => $LANG_ADMIN['authenticate'], 'hidden_fields' => $hidden);
    return SEC_loginForm($cfg);
}
Ejemplo n.º 22
0
/**
* Show topic administration form
*
* @param    string  tid     ID of topic to edit
* @return   string          HTML for the topic editor
*
*/
function edittopic($tid = '')
{
    global $_CONF, $_GROUPS, $_TABLES, $_USER, $LANG27, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE;
    $retval = '';
    if (empty($tid)) {
        // new topic - set defaults
        $A = array();
        $A['tid'] = '';
        $A['topic'] = '';
        $A['sortnum'] = 0;
        $A['limitnews'] = '';
        // leave empty!
        $A['is_default'] = 0;
        $A['archive_flag'] = 0;
    } else {
        $result = DB_query("SELECT * FROM {$_TABLES['topics']} WHERE tid ='{$tid}'");
        $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($LANG27[12], '', COM_getBlockTemplate('_msg_block', 'header'));
            $retval .= $LANG27[13];
            $retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
            COM_accessLog("User {$_USER['username']} tried to illegally create or edit topic {$tid}.");
            return $retval;
        }
    }
    $token = SEC_createToken();
    $retval .= COM_startBlock($LANG27[1], '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= SEC_getTokenExpiryNotice($token);
    if (!is_array($A) || empty($A['owner_id'])) {
        $A['owner_id'] = $_USER['uid'];
        // this is the one instance where we default the group
        // most topics should belong to the Topic Admin group
        if (isset($_GROUPS['Topic Admin'])) {
            $A['group_id'] = $_GROUPS['Topic Admin'];
        } else {
            $A['group_id'] = SEC_getFeatureGroup('topic.edit');
        }
        SEC_setDefaultPermissions($A, $_CONF['default_permissions_topic']);
        $access = 3;
    }
    $topic_templates = new Template($_CONF['path_layout'] . 'admin/topic');
    $topic_templates->set_file('editor', 'topiceditor.thtml');
    $topic_templates->set_var('xhtml', XHTML);
    $topic_templates->set_var('site_url', $_CONF['site_url']);
    $topic_templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $topic_templates->set_var('layout_url', $_CONF['layout_url']);
    if (!empty($tid) && SEC_hasRights('topic.edit')) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $topic_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        $topic_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
        $topic_templates->set_var('warning_msg', $LANG27[6]);
    }
    $topic_templates->set_var('lang_topicid', $LANG27[2]);
    $topic_templates->set_var('topic_id', $A['tid']);
    $topic_templates->set_var('lang_donotusespaces', $LANG27[5]);
    $topic_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
    $topic_templates->set_var('lang_owner', $LANG_ACCESS['owner']);
    $ownername = COM_getDisplayName($A['owner_id']);
    $topic_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}"));
    $topic_templates->set_var('owner_name', $ownername);
    $topic_templates->set_var('owner', $ownername);
    $topic_templates->set_var('owner_id', $A['owner_id']);
    $topic_templates->set_var('lang_group', $LANG_ACCESS['group']);
    $topic_templates->set_var('lang_save', $LANG_ADMIN['save']);
    $topic_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $topic_templates->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access));
    $topic_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']);
    $topic_templates->set_var('lang_permissions_key', $LANG_ACCESS['permissionskey']);
    $topic_templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
    $topic_templates->set_var('permissions_msg', $LANG_ACCESS['permmsg']);
    $topic_templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']);
    $topic_templates->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']));
    // show sort order only if they specified sortnum as the sort method
    if ($_CONF['sortmethod'] != 'alpha') {
        $topic_templates->set_var('lang_sortorder', $LANG27[10]);
        if ($A['sortnum'] == 0) {
            $A['sortnum'] = '';
        }
        $topic_templates->set_var('sort_order', '<input type="text" size="3" maxlength="3" name="sortnum" value="' . $A['sortnum'] . '"' . XHTML . '>');
    } else {
        $topic_templates->set_var('lang_sortorder', $LANG27[14]);
        $topic_templates->set_var('sort_order', $LANG27[15]);
    }
    $topic_templates->set_var('lang_storiesperpage', $LANG27[11]);
    if ($A['limitnews'] == 0) {
        $topic_templates->set_var('story_limit', '');
    } else {
        $topic_templates->set_var('story_limit', $A['limitnews']);
    }
    $topic_templates->set_var('default_limit', $_CONF['limitnews']);
    $topic_templates->set_var('lang_defaultis', $LANG27[16]);
    $topic_templates->set_var('lang_topicname', $LANG27[3]);
    $topic_templates->set_var('topic_name', stripslashes($A['topic']));
    if (empty($A['tid'])) {
        $A['imageurl'] = '/images/topics/';
    }
    $topic_templates->set_var('lang_topicimage', $LANG27[4]);
    $topic_templates->set_var('lang_uploadimage', $LANG27[27]);
    $topic_templates->set_var('icon_dimensions', $_CONF['max_topicicon_width'] . ' x ' . $_CONF['max_topicicon_height']);
    $topic_templates->set_var('lang_maxsize', $LANG27[28]);
    $topic_templates->set_var('max_url_length', 255);
    $topic_templates->set_var('image_url', $A['imageurl']);
    $topic_templates->set_var('lang_metadescription', $LANG_ADMIN['meta_description']);
    $topic_templates->set_var('lang_metakeywords', $LANG_ADMIN['meta_keywords']);
    if (!empty($A['meta_description'])) {
        $topic_templates->set_var('meta_description', $A['meta_description']);
    }
    if (!empty($A['meta_keywords'])) {
        $topic_templates->set_var('meta_keywords', $A['meta_keywords']);
    }
    $topic_templates->set_var('lang_defaulttopic', $LANG27[22]);
    $topic_templates->set_var('lang_defaulttext', $LANG27[23]);
    if ($A['is_default'] == 1) {
        $topic_templates->set_var('default_checked', 'checked="checked"');
    } else {
        $topic_templates->set_var('default_checked', '');
    }
    $topic_templates->set_var('lang_archivetopic', $LANG27[25]);
    $topic_templates->set_var('lang_archivetext', $LANG27[26]);
    $topic_templates->set_var('archive_disabled', '');
    if ($A['archive_flag'] == 1) {
        $topic_templates->set_var('archive_checked', 'checked="checked"');
    } else {
        $topic_templates->set_var('archive_checked', '');
        // Only 1 topic can be the archive topic - so check if there already is one
        if (DB_count($_TABLES['topics'], 'archive_flag', '1') > 0) {
            $topic_templates->set_var('archive_disabled', 'disabled');
        }
    }
    if (empty($tid)) {
        $num_stories = $LANG_ADMIN['na'];
    } else {
        $nresult = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['stories']} WHERE tid = '" . addslashes($tid) . "'" . COM_getPermSql('AND'));
        $N = DB_fetchArray($nresult);
        $num_stories = COM_numberFormat($N['count']);
    }
    $topic_templates->set_var('lang_num_stories', $LANG27[30]);
    $topic_templates->set_var('num_stories', $num_stories);
    $topic_templates->set_var('gltoken_name', CSRF_TOKEN);
    $topic_templates->set_var('gltoken', $token);
    $topic_templates->parse('output', 'editor');
    $retval .= $topic_templates->finish($topic_templates->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
Ejemplo n.º 23
0
/**
* Display "batch add" (import) form
*
* @return   string      HTML for import form
*
*/
function display_batchAddform()
{
    global $_CONF, $LANG28, $LANG_ADMIN, $_IMAGE_TYPE;
    require_once $_CONF['path_system'] . 'lib-admin.php';
    $retval = '';
    $token = SEC_createToken();
    $retval .= COM_startBlock($LANG28[24], '', COM_getBlockTemplate('_admin_block', 'header'));
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/user.php', 'text' => $LANG28[11]), array('url' => $_CONF['site_admin_url'] . '/user.php?mode=batchdelete', 'text' => $LANG28[54]), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $desc = '<p>' . $LANG28[25] . '</p>';
    $icon = $_CONF['layout_url'] . '/images/icons/user.' . $_IMAGE_TYPE;
    $retval .= ADMIN_createMenu($menu_arr, $desc, $icon);
    $retval .= '<form action="' . $_CONF['site_admin_url'] . '/user.php" method="post" enctype="multipart/form-data"><div>' . $LANG28[29] . ': <input type="file" dir="ltr" name="importfile" size="40"' . XHTML . '>' . '<input type="hidden" name="mode" value="import"' . XHTML . '>' . '<input type="submit" name="submit" value="' . $LANG28[30] . '"' . XHTML . '><input type="hidden" name="' . CSRF_TOKEN . "\" value=\"{$token}\"" . XHTML . '></div></form>' . LB;
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    $retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG28[24]));
    return $retval;
}
Ejemplo n.º 24
0
/**
* Shows poll editor
*
* Diplays the poll editor form
*
* @param    string  $pid    ID of poll to edit
* @return   string          HTML for poll editor form
*
*/
function editpoll($pid = '')
{
    global $_CONF, $_PO_CONF, $_GROUPS, $_TABLES, $_USER, $LANG25, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE, $LANG_POLLS;
    $retval = '';
    if (!empty($pid)) {
        $topic = DB_query("SELECT * FROM {$_TABLES['polltopics']} WHERE pid='{$pid}'");
        $T = DB_fetchArray($topic);
        // Get permissions for poll
        $access = SEC_hasAccess($T['owner_id'], $T['group_id'], $T['perm_owner'], $T['perm_group'], $T['perm_members'], $T['perm_anon']);
        if ($access == 0 or $access == 2) {
            // User doesn't have access...bail
            $retval .= COM_startBlock($LANG25[21], '', COM_getBlockTemplate('_msg_block', 'header'));
            $retval .= $LANG25[22];
            $retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
            COM_accessLog("User {$_USER['username']} tried to illegally submit or edit poll {$pid}.");
            return $retval;
        }
    }
    // writing the menu on top
    require_once $_CONF['path_system'] . 'lib-admin.php';
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/plugins/polls/index.php', 'text' => $LANG_ADMIN['list_all']), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $token = SEC_createToken();
    $retval .= COM_startBlock($LANG25[5], '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= ADMIN_createMenu($menu_arr, $LANG_POLLS['editinstructions'], plugin_geticon_polls());
    $retval .= SEC_getTokenExpiryNotice($token);
    $poll_templates = new Template($_CONF['path'] . 'plugins/polls/templates/admin/');
    $poll_templates->set_file(array('editor' => 'polleditor.thtml', 'question' => 'pollquestions.thtml', 'answer' => 'pollansweroption.thtml'));
    $poll_templates->set_var('xhtml', XHTML);
    $poll_templates->set_var('site_url', $_CONF['site_url']);
    $poll_templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $poll_templates->set_var('layout_url', $_CONF['layout_url']);
    if (!empty($pid) and $access == 3 and !empty($T['owner_id'])) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $poll_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        $poll_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
    } else {
        $T['pid'] = COM_makeSid();
        $T['topic'] = '';
        $T['meta_description'] = '';
        $T['meta_keywords'] = '';
        $T['voters'] = 0;
        $T['display'] = 1;
        $T['is_open'] = 1;
        $T['hideresults'] = 0;
        $T['owner_id'] = $_USER['uid'];
        if (isset($_GROUPS['Polls Admin'])) {
            $T['group_id'] = $_GROUPS['Polls Admin'];
        } else {
            $T['group_id'] = SEC_getFeatureGroup('polls.edit');
        }
        SEC_setDefaultPermissions($T, $_PO_CONF['default_permissions']);
        $T['statuscode'] = 0;
        $T['commentcode'] = $_CONF['comment_code'];
        $access = 3;
    }
    $poll_templates->set_var('lang_pollid', $LANG25[6]);
    $poll_templates->set_var('poll_id', $T['pid']);
    $poll_templates->set_var('lang_donotusespaces', $LANG25[7]);
    $poll_templates->set_var('lang_topic', $LANG25[9]);
    $poll_templates->set_var('poll_topic', htmlspecialchars($T['topic']));
    $poll_templates->set_var('lang_mode', $LANG25[1]);
    $poll_templates->set_var('lang_metadescription', $LANG_ADMIN['meta_description']);
    $poll_templates->set_var('lang_metakeywords', $LANG_ADMIN['meta_keywords']);
    if (!empty($T['meta_description'])) {
        $poll_templates->set_var('meta_description', $T['meta_description']);
    }
    if (!empty($T['meta_keywords'])) {
        $poll_templates->set_var('meta_keywords', $T['meta_keywords']);
    }
    $poll_templates->set_var('status_options', COM_optionList($_TABLES['statuscodes'], 'code,name', $T['statuscode']));
    $poll_templates->set_var('comment_options', COM_optionList($_TABLES['commentcodes'], 'code,name', $T['commentcode']));
    $poll_templates->set_var('lang_appearsonhomepage', $LANG25[8]);
    $poll_templates->set_var('lang_openforvoting', $LANG25[33]);
    $poll_templates->set_var('lang_hideresults', $LANG25[37]);
    $poll_templates->set_var('poll_hideresults_explain', $LANG25[38]);
    $poll_templates->set_var('poll_topic_info', $LANG25[39]);
    if ($T['display'] == 1) {
        $poll_templates->set_var('poll_display', 'checked="checked"');
    }
    if ($T['is_open'] == 1) {
        $poll_templates->set_var('poll_open', 'checked="checked"');
    }
    if ($T['hideresults'] == 1) {
        $poll_templates->set_var('poll_hideresults', 'checked="checked"');
    }
    // user access info
    $poll_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
    $poll_templates->set_var('lang_owner', $LANG_ACCESS['owner']);
    $ownername = COM_getDisplayName($T['owner_id']);
    $poll_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$T['owner_id']}"));
    $poll_templates->set_var('owner_name', $ownername);
    $poll_templates->set_var('owner', $ownername);
    $poll_templates->set_var('owner_id', $T['owner_id']);
    $poll_templates->set_var('lang_group', $LANG_ACCESS['group']);
    $poll_templates->set_var('group_dropdown', SEC_getGroupDropdown($T['group_id'], $access));
    $poll_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']);
    $poll_templates->set_var('lang_permissionskey', $LANG_ACCESS['permissionskey']);
    $poll_templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
    $poll_templates->set_var('permissions_editor', SEC_getPermissionsHTML($T['perm_owner'], $T['perm_group'], $T['perm_members'], $T['perm_anon']));
    $poll_templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']);
    $poll_templates->set_var('lang_answersvotes', $LANG25[10]);
    $poll_templates->set_var('lang_save', $LANG_ADMIN['save']);
    $poll_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    // repeat for several questions
    $question_sql = "SELECT question,qid " . "FROM {$_TABLES['pollquestions']} WHERE pid='{$pid}' ORDER BY qid;";
    $questions = DB_query($question_sql);
    include $_CONF['path_system'] . 'classes/navbar.class.php';
    $navbar = new navbar();
    for ($j = 0; $j < $_PO_CONF['maxquestions']; $j++) {
        $display_id = $j + 1;
        if ($j > 0) {
            $poll_templates->set_var('style', 'style="display:none;"');
        } else {
            $poll_templates->set_var('style', '');
        }
        $navbar->add_menuitem($LANG25[31] . " {$display_id}", "showhidePollsEditorDiv(\"{$j}\",{$j},{$_PO_CONF['maxquestions']});return false;", true);
        $Q = DB_fetchArray($questions);
        $poll_templates->set_var('question_text', $Q['question']);
        $poll_templates->set_var('question_id', $j);
        $poll_templates->set_var('lang_question', $LANG25[31] . " {$display_id}");
        $poll_templates->set_var('lang_saveaddnew', $LANG25[32]);
        // answers
        $answer_sql = "SELECT answer,aid,votes,remark " . "FROM {$_TABLES['pollanswers']} WHERE qid='{$j}' AND pid='{$pid}' ORDER BY aid";
        $answers = DB_query($answer_sql);
        for ($i = 0; $i < $_PO_CONF['maxanswers']; $i++) {
            if (isset($answers)) {
                $A = DB_fetchArray($answers);
                $poll_templates->set_var('answer_text', htmlspecialchars($A['answer']));
                $poll_templates->set_var('answer_votes', $A['votes']);
                $poll_templates->set_var('remark_text', $A['remark']);
            } else {
                $poll_templates->set_var('answer_text', '');
                $poll_templates->set_var('answer_votes', '');
                $poll_templates->set_var('remark_text', '');
            }
            $poll_templates->parse('answer_option', 'answer', true);
        }
        $poll_templates->parse('question_list', 'question', true);
        $poll_templates->clear_var('answer_option');
    }
    $navbar->set_selected($LANG25[31] . " 1");
    $poll_templates->set_var('navbar', $navbar->generate());
    $poll_templates->set_var('gltoken_name', CSRF_TOKEN);
    $poll_templates->set_var('gltoken', $token);
    $poll_templates->parse('output', 'editor');
    $retval .= $poll_templates->finish($poll_templates->get_var('output'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
Ejemplo n.º 25
0
 if (!COM_isAnonUser() && $skipForum == false) {
     // Check for user subscription status
     $sub_check = PLG_isSubscribed('forum', $forum, 0, $uid);
     if ($sub_check == false) {
         $subscribelinkimg = '<img src="' . _ff_getImage('forumnotify_on') . '" style="vertical-align:middle;" alt="' . $LANG_GF01['FORUMSUBSCRIBE'] . '" title="' . $LANG_GF01['FORUMSUBSCRIBE'] . '"/>';
         $subscribelink = $_CONF['site_url'] . '/forum/index.php?op=subscribe&amp;forum=' . $forum;
         $subcribelanguage = $LANG_GF01['FORUMSUBSCRIBE'];
         $sub_option = 'subscribe_forum';
     } else {
         $subscribelinkimg = '<img src="' . _ff_getImage('forumnotify_off') . '" alt="' . $LANG_GF01['FORUMUNSUBSCRIBE'] . '" title="' . $LANG_GF01['FORUMUNSUBSCRIBE'] . '" style="vertical-align:middle;"/>';
         $subscribelink = $_CONF['site_url'] . '/forum/notify.php?filter=2';
         $subcribelanguage = $LANG_GF01['FORUMUNSUBSCRIBE'];
         $sub_option = 'unsubscribe_forum';
         $formsubscribed = TRUE;
     }
     $token = SEC_createToken();
     $topiclisting->set_var(array('subscribelink' => $subscribelink, 'subscribelinkimg' => $subscribelinkimg, 'forumsubscribed' => $forumsubscribed, 'LANG_subscribe' => $subcribelanguage, 'forum' => $forum, 'suboption' => $sub_option, 'token' => $token, 'token_name' => CSRF_TOKEN));
 }
 if (!COM_isAnonUser()) {
     $link = '<a href="' . $_CONF['site_url'] . '/forum/index.php?op=markallread&amp;cat_id=' . $category['id'] . '&amp;forum_id=' . (int) $forum . '">';
     $topiclisting->set_var(array('markreadurl' => $_CONF['site_url'] . '/forum/index.php?op=markallread&amp;cat_id=' . $category['id'] . '&amp;forum_id=' . (int) $forum, 'markreadlink' => $link, 'LANG_markread' => $LANG_GF02['msg84']));
 }
 $rssFeed = DB_getItem($_TABLES['syndication'], 'filename', 'type="forum" AND topic=' . (int) $forum . ' AND is_enabled=1');
 if (($rssFeed != '' || $rssFeed != NULL) && $skipForum == false) {
     $baseurl = SYND_getFeedUrl();
     $imgurl = '<img src="' . _ff_getImage('rss_feed') . '" alt="' . $LANG_GF01['rss_link'] . '" title="' . $LANG_GF01['rss_link'] . '" style="vertical-align:middle;"/>';
     $topiclisting->set_var('rssfeed', '<a href="' . $baseurl . $rssFeed . '">' . $imgurl . '</a>');
     $topiclisting->set_var('rssfeed_url', $baseurl . $rssFeed);
 } else {
     $topiclisting->set_var('rssfeed', '');
 }
Ejemplo n.º 26
0
/**
* Prepare for optimizing tables
*
* @return   string  HTML form
*
*/
function DBADMIN_optimize()
{
    global $_CONF, $_TABLES, $LANG01, $LANG_ADMIN, $LANG_DB_BACKUP, $_IMAGE_TYPE;
    $retval = '';
    $lastrun = DB_getItem($_TABLES['vars'], 'UNIX_TIMESTAMP(value)', "name = 'lastoptimizeddb'");
    $T = COM_newTemplate($_CONF['path_layout'] . 'admin/dbadmin');
    $T->set_file('page', 'dbconvert.thtml');
    $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/database.php', 'text' => $LANG_DB_BACKUP['database_admin']), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
    $T->set_var('start_block', COM_startBlock($LANG_DB_BACKUP['database_admin'], '', COM_getBlockTemplate('_admin_block', 'header')));
    $T->set_var('admin_menu', ADMIN_createMenu($menu_arr, "", $_CONF['layout_url'] . '/images/icons/database.' . $_IMAGE_TYPE));
    $T->set_var('lang_title', $LANG_DB_BACKUP['optimize_title']);
    $T->set_var('lang_conversion_instructions', $LANG_DB_BACKUP['optimize_explain']);
    $T->set_var('lang_conversion_status', $LANG_DB_BACKUP['optimization_message']);
    if (!empty($lastrun)) {
        $last = COM_getUserDateTimeFormat($lastrun);
        $T->set_var('lang_last_optimization', $LANG_DB_BACKUP['last_optimization']);
        $T->set_var('last_optimization', $last[0]);
    }
    $T->set_var('security_token', SEC_createToken());
    $T->set_var('security_token_name', CSRF_TOKEN);
    $T->set_var(array('lang_convert' => $LANG_DB_BACKUP['optimize_button'], 'lang_cancel' => $LANG_ADMIN['cancel'], 'lang_ok' => $LANG01['ok'], 'lang_converting' => $LANG_DB_BACKUP['optimizing'], 'lang_success' => $LANG_DB_BACKUP['optimize_success'], 'lang_ajax_status' => $LANG_DB_BACKUP['optimization_status'], 'to_engine' => 'all', 'action' => "dooptimize", 'mode' => "optimize"));
    $T->set_var('end_block', COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')));
    $T->parse('output', 'page');
    $retval .= $T->finish($T->get_var('output'));
    return $retval;
}
Ejemplo n.º 27
0
function MG_editConfig($msgString = '')
{
    global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01, $LANG_DIRECTION, $LANG04;
    $retval = '';
    $T = new Template($_MG_CONF['template_path'] . '/admin');
    $T->set_file('admin', 'cfgedit.thtml');
    $T->set_var('site_url', $_MG_CONF['site_url']);
    if ($msgString != '') {
        $T->set_var('feedback', $msgString);
    }
    if (!isset($_MG_CONF['rating_max'])) {
        $_MG_CONF['rating_max'] = 5;
    }
    if (!isset($_MG_CONF['moderation'])) {
        $_MG_CONF['moderation'] = 0;
    }
    // build our graphics package select...
    $gp_select = "<select name='graphicspackage'>";
    $gp_select .= "<option value='0'" . ($_MG_CONF['graphicspackage'] == 0 ? ' selected="selected"' : "") . ">ImageMagick</option>";
    $gp_select .= "<option value='1'" . ($_MG_CONF['graphicspackage'] == 1 ? ' selected="selected"' : "") . ">NetPBM</option>";
    $gp_select .= "<option value='2'" . ($_MG_CONF['graphicspackage'] == 2 ? ' selected="selected"' : "") . ">GD Libraries</option>";
    $gp_select .= "</select>";
    $block_select = '<select name="displayblocks">';
    $block_select .= '<option value="0"' . ($_MG_CONF['displayblocks'] == 0 ? ' selected="selected"' : "") . '>' . $LANG_MG01['left_blocks_only'] . '</option>';
    $block_select .= '<option value="1"' . ($_MG_CONF['displayblocks'] == 1 ? ' selected="selected"' : "") . '>' . $LANG_MG01['right_blocks_only'] . '</option>';
    $block_select .= '<option value="2"' . ($_MG_CONF['displayblocks'] == 2 ? ' selected="selected"' : "") . '>' . $LANG_MG01['left_right_blocks'] . '</option>';
    $block_select .= '<option value="3"' . ($_MG_CONF['displayblocks'] == 3 ? ' selected="selected"' : "") . '>' . $LANG_MG01['none'] . '</option>';
    $block_select .= '</select>';
    $dfid_select = '<select name="dfid"><option value="99">' . $LANG_MG00['no_date'] . '</option>' . COM_optionList($_TABLES['dateformats'], 'dfid,description', $_MG_CONF['dfid'], 0) . '</select>';
    if (isset($_MG_CONF['index_all']) && $_MG_CONF['index_all'] == 1) {
        $T->set_var('index_all_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('index_all_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['loginrequired'] == 1) {
        $T->set_var('lr_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('lr_no_checked', ' checked="checked"');
    }
    if (isset($_MG_CONF['moderation']) && $_MG_CONF['moderation'] == 1) {
        $T->set_var('au_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('au_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['htmlallowed'] == 1) {
        $T->set_var('ha_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('ha_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['whatsnew'] == 1) {
        $T->set_var('wn_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('wn_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['usage_tracking'] == 1) {
        $T->set_var('ut_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('ut_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['preserve_filename'] == 1) {
        $T->set_var('pf_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('pf_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['discard_original'] == 1) {
        $T->set_var('do_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('do_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['verbose'] == 1) {
        $T->set_var('verbose_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('verbose_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['disable_whatsnew_comments'] == 1) {
        $T->set_var('dwnc_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('dwnc_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['enable_media_id'] == 1) {
        $T->set_var('emid_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('emid_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['full_in_popup'] == 1) {
        $T->set_var('fip_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('fip_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['commentbar'] == 1) {
        $T->set_var('cmtbar_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('cmtbar_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['profile_hook'] == 1) {
        $T->set_var('ph_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('ph_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['subalbum_select'] == 1) {
        $T->set_var('sa_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('sa_no_checked', ' checked="checked"');
    }
    $T->set_var('wn_length', $_MG_CONF['title_length']);
    // -- auto tag defaults
    if ($_MG_CONF['at_border'] == 1) {
        $T->set_var('at_border_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('at_border_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['at_autoplay'] == 1) {
        $T->set_var('at_autoplay_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('at_autoplay_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['at_enable_link'] == 2) {
        $T->set_var('at_enable_link_lb_checked', ' checked="checked"');
    } elseif ($_MG_CONF['at_enable_link'] == 1) {
        $T->set_var('at_enable_link_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('at_enable_link_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['at_showtitle'] == 1) {
        $T->set_var('at_showtitle_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('at_showtitle_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['search_enable_views'] == 1) {
        $T->set_var('search_enable_views_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('search_enable_views_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['search_enable_rating'] == 1) {
        $T->set_var('search_enable_rating_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('search_enable_rating_no_checked', ' checked="checked"');
    }
    if ($_MG_CONF['gallery_only'] == 1) {
        $T->set_var('gallery_only_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('gallery_only_no_checked', ' checked="checked"');
    }
    $search_playback_type = '<select name="search_playback_type">';
    $search_playback_type .= '<option value="0"' . ($_MG_CONF['search_playback_type'] == 0 ? 'selected="selected"' : '') . '>' . $LANG_MG01['play_in_popup'] . '</option>';
    $search_playback_type .= '<option value="1"' . ($_MG_CONF['search_playback_type'] == 1 ? 'selected="selected"' : '') . '>' . $LANG_MG01['download_to_local'] . '</option>';
    $search_playback_type .= '<option value="2"' . ($_MG_CONF['search_playback_type'] == 2 ? 'selected="selected"' : '') . '>' . $LANG_MG01['play_inline'] . '</option>';
    $search_playback_type .= '<option value="3"' . ($_MG_CONF['search_playback_type'] == 3 ? 'selected="selected"' : '') . '>' . $LANG_MG01['use_mms'] . '</option>';
    $search_playback_type .= '</select>';
    $at_align_select = '<select name="at_align">';
    $at_align_select .= '<option value="none"' . ($_MG_CONF['at_align'] == 'none' ? ' selected="selected"' : "") . '>' . $LANG_MG01['none'] . '</option>';
    $at_align_select .= '<option value="auto"' . ($_MG_CONF['at_align'] == 'auto' ? ' selected="selected"' : "") . '>' . $LANG_MG01['auto'] . '</option>';
    $at_align_select .= '<option value="left"' . ($_MG_CONF['at_align'] == 'left' ? ' selected="selected"' : "") . '>' . $LANG_MG01['left'] . '</option>';
    $at_align_select .= '<option value="right"' . ($_MG_CONF['at_align'] == 'right' ? ' selected="selected"' : "") . '>' . $LANG_MG01['right'] . '</option>';
    $at_align_select .= '<option value="center"' . ($_MG_CONF['at_align'] == 'center' ? ' selected="selected"' : "") . '>' . $LANG_MG01['center'] . '</option>';
    $at_align_select .= '</select>';
    $at_src_select = '<select name="at_src">';
    $at_src_select .= '<option value="tn"' . ($_MG_CONF['at_src'] == 'tn' ? ' selected="selected"' : "") . '>' . $LANG_MG01['thumbnail'] . '</option>';
    $at_src_select .= '<option value="disp"' . ($_MG_CONF['at_src'] == 'disp' ? ' selected="selected"' : "") . '>' . $LANG_MG01['display_image'] . '</option>';
    $at_src_select .= '<option value="orig"' . ($_MG_CONF['at_src'] == 'orig' ? ' selected="selected"' : "") . '>' . $LANG_MG01['original_image'] . '</option>';
    $at_src_select .= '</select>';
    $wn_time_select = '<select name="whatsnew_time">';
    $wn_time_select .= '<option value="1"' . ($_MG_CONF['whatsnew_time'] == 1 ? ' selected="selected"' : "") . '>1 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="2"' . ($_MG_CONF['whatsnew_time'] == 2 ? ' selected="selected"' : "") . '>2 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="3"' . ($_MG_CONF['whatsnew_time'] == 3 ? ' selected="selected"' : "") . '>3 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="4"' . ($_MG_CONF['whatsnew_time'] == 4 ? ' selected="selected"' : "") . '>4 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="5"' . ($_MG_CONF['whatsnew_time'] == 5 ? ' selected="selected"' : "") . '>5 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="6"' . ($_MG_CONF['whatsnew_time'] == 6 ? ' selected="selected"' : "") . '>6 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="7"' . ($_MG_CONF['whatsnew_time'] == 7 ? ' selected="selected"' : "") . '>7 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="8"' . ($_MG_CONF['whatsnew_time'] == 8 ? ' selected="selected"' : "") . '>8 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="9"' . ($_MG_CONF['whatsnew_time'] == 9 ? ' selected="selected"' : "") . '>9 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="10"' . ($_MG_CONF['whatsnew_time'] == 10 ? ' selected="selected"' : "") . '>10 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="11"' . ($_MG_CONF['whatsnew_time'] == 11 ? ' selected="selected"' : "") . '>11 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="12"' . ($_MG_CONF['whatsnew_time'] == 12 ? ' selected="selected"' : "") . '>12 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="13"' . ($_MG_CONF['whatsnew_time'] == 13 ? ' selected="selected"' : "") . '>13 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="14"' . ($_MG_CONF['whatsnew_time'] == 14 ? ' selected="selected"' : "") . '>14 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="15"' . ($_MG_CONF['whatsnew_time'] == 15 ? ' selected="selected"' : "") . '>15 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="16"' . ($_MG_CONF['whatsnew_time'] == 16 ? ' selected="selected"' : "") . '>16 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="17"' . ($_MG_CONF['whatsnew_time'] == 17 ? ' selected="selected"' : "") . '>17 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="18"' . ($_MG_CONF['whatsnew_time'] == 18 ? ' selected="selected"' : "") . '>18 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="19"' . ($_MG_CONF['whatsnew_time'] == 19 ? ' selected="selected"' : "") . '>19 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="20"' . ($_MG_CONF['whatsnew_time'] == 20 ? ' selected="selected"' : "") . '>20 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="21"' . ($_MG_CONF['whatsnew_time'] == 21 ? ' selected="selected"' : "") . '>21 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="22"' . ($_MG_CONF['whatsnew_time'] == 22 ? ' selected="selected"' : "") . '>22 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="23"' . ($_MG_CONF['whatsnew_time'] == 23 ? ' selected="selected"' : "") . '>23 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="24"' . ($_MG_CONF['whatsnew_time'] == 24 ? ' selected="selected"' : "") . '>24 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="25"' . ($_MG_CONF['whatsnew_time'] == 25 ? ' selected="selected"' : "") . '>25 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="26"' . ($_MG_CONF['whatsnew_time'] == 26 ? ' selected="selected"' : "") . '>26 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="27"' . ($_MG_CONF['whatsnew_time'] == 27 ? ' selected="selected"' : "") . '>27 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="28"' . ($_MG_CONF['whatsnew_time'] == 28 ? ' selected="selected"' : "") . '>28 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="29"' . ($_MG_CONF['whatsnew_time'] == 29 ? ' selected="selected"' : "") . '>29 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '<option value="30"' . ($_MG_CONF['whatsnew_time'] == 30 ? ' selected="selected"' : "") . '>30 ' . $LANG_MG01['days'] . '</option>';
    $wn_time_select .= '</select>';
    $rating_select = '<select name="rating_max">';
    $rating_select .= '<option value="5"' . ($_MG_CONF['rating_max'] == 5 ? ' selected="selected"' : "") . '>5</option>';
    $rating_select .= '<option value="10"' . ($_MG_CONF['rating_max'] == 10 ? ' selected="selected"' : "") . '>10</option>';
    $rating_select .= '<option value="15"' . ($_MG_CONF['rating_max'] == 15 ? ' selected="selected"' : "") . '>15</option>';
    $rating_select .= '<option value="20"' . ($_MG_CONF['rating_max'] == 20 ? ' selected="selected"' : "") . '>20</option>';
    $rating_select .= '</select>';
    $gallery_tn_size_select = '<select name="gallery_tn_size">';
    $gallery_tn_size_select .= '<option value="0"' . ($_MG_CONF['gallery_tn_size'] == 0 ? 'selected="selected"' : '') . '>' . $LANG_MG01['small'] . '</option>';
    $gallery_tn_size_select .= '<option value="1"' . ($_MG_CONF['gallery_tn_size'] == 1 ? 'selected="selected"' : '') . '>' . $LANG_MG01['medium'] . '</option>';
    $gallery_tn_size_select .= '<option value="2"' . ($_MG_CONF['gallery_tn_size'] == 2 ? 'selected="selected"' : '') . '>' . $LANG_MG01['large'] . '</option>';
    $gallery_tn_size_select .= '<option value="3"' . ($_MG_CONF['gallery_tn_size'] == 3 ? 'selected="selected"' : '') . '>' . $LANG_MG01['custom'] . '</option>';
    $gallery_tn_size_select .= '<option value="4"' . ($_MG_CONF['gallery_tn_size'] == 4 ? 'selected="selected"' : '') . '>' . $LANG_MG01['square'] . '</option>';
    $gallery_tn_size_select .= '</select>';
    $gallery_tnheight_input = '<input type="text" size="3" name="tnheight" value="' . $_MG_CONF['gallery_tn_height'] . '" />';
    $gallery_tnwidth_input = '<input type="text" size="3" name="tnwidth" value="' . $_MG_CONF['gallery_tn_width'] . '" />';
    $mp3_select = '<select name="mp3_player">';
    $mp3_select .= '<option value="0"' . ($_MG_CONF['mp3_player'] == 0 ? 'selected="selected"' : '') . '>' . $LANG_MG01['windows_media_player'] . '</option>';
    $mp3_select .= '<option value="1"' . ($_MG_CONF['mp3_player'] == 1 ? 'selected="selected"' : '') . '>' . $LANG_MG01['quicktime'] . '</option>';
    $mp3_select .= '<option value="2"' . ($_MG_CONF['mp3_player'] == 2 ? 'selected="selected"' : '') . '>' . $LANG_MG01['flashplayer'] . '</option>';
    $mp3_select .= '</select>';
    $flv_select = '<select name="use_flowplayer">';
    $flv_select .= '<option value="0"' . ($_MG_CONF['use_flowplayer'] == 0 ? 'selected="selected"' : '') . '>' . $LANG_MG01['mgflv'] . '</option>';
    $flv_select .= '<option value="1"' . ($_MG_CONF['use_flowplayer'] == 1 ? 'selected="selected"' : '') . '>' . $LANG_MG01['flowplayer'] . '</option>';
    $flv_select .= '</select>';
    $T->set_var(array('popupfromalbum_selected' => $_MG_CONF['popup_from_album'] ? ' checked="checked"' : '', 'autotag_caption_selected' => $_MG_CONF['autotag_caption'] ? ' checked="checked"' : '', 'up_dr_selected' => $_MG_CONF['up_display_rows_enabled'] ? ' checked="checked"' : '', 'up_dc_selected' => $_MG_CONF['up_display_columns_enabled'] ? ' checked="checked"' : '', 'up_mp3_selected' => $_MG_CONF['up_mp3_player_enabled'] ? ' checked="checked"' : '', 'up_playback_selected' => $_MG_CONF['up_av_playback_enabled'] ? ' checked="checked"' : '', 'up_tn_size_selected' => $_MG_CONF['up_thumbnail_size_enabled'] ? ' checked="checked"' : '', 'jh_selected' => $_MG_CONF['jhead_enabled'] ? ' checked="checked"' : '', 'jt_selected' => $_MG_CONF['jpegtran_enabled'] ? ' checked="checked"' : '', 'zip_selected' => $_MG_CONF['zip_enabled'] ? ' checked="checked"' : '', 'ffmpeg_selected' => $_MG_CONF['ffmpeg_enabled'] ? ' checked="checked"' : '', 'at_align_select' => $at_align_select, 'at_width' => $_MG_CONF['at_width'], 'at_height' => $_MG_CONF['at_height'], 'at_src_select' => $at_src_select, 'at_delay' => $_MG_CONF['at_delay'], 'flv_select' => $flv_select, 'search_playback_type' => $search_playback_type, 'search_columns' => $_MG_CONF['search_columns'], 'search_rows' => $_MG_CONF['search_rows']));
    if ($_MG_CONF['up_display_rows_enabled'] == 1) {
        $T->set_var('up_dr_yes_checked', ' checked="checked"');
    } else {
        $T->set_var('up_dr_no_checked', ' checked="checked"');
    }
    if (ini_get('safe_mode') != 1 && $_MG_CONF['skip_file_find'] == 0) {
        // don't check in safe mode, the file_exists() will fail
        if (PHP_OS == "WINNT") {
            $binary = "/unzip.exe";
        } else {
            $binary = "/unzip";
        }
        clearstatcache();
        if (file_exists($_MG_CONF['zip_path'] . $binary)) {
            // do nothing..
        } else {
            clearstatcache();
            $_MG_CONF['zip_path'] = '/usr/bin';
            if (file_exists($_MG_CONF['zip_path'] . $binary)) {
                // do nothing..
            } else {
                clearstatcache();
                $_MG_CONF['zip_path'] = '/usr/local/bin';
                if (file_exists($_MG_CONF['zip_path'] . $binary)) {
                    // do nothing..
                } else {
                    clearstatcache();
                    $_MG_CONF['zip_path'] = '/usr/X11R6/bin';
                    if (file_exists($_MG_CONF['zip_path'] . $binary)) {
                        // do nothing..
                    }
                }
            }
        }
        if (PHP_OS == "WINNT") {
            $binary = "/ffmpeg.exe";
        } else {
            $binary = "/ffmpeg";
        }
        clearstatcache();
        if (file_exists($_MG_CONF['ffmpeg_path'] . $binary)) {
            // do nothing..
        } else {
            clearstatcache();
            $_MG_CONF['ffmpeg_path'] = '/usr/bin';
            if (file_exists($_MG_CONF['ffmpeg_path'] . $binary)) {
                // do nothing..
            } else {
                clearstatcache();
                $_MG_CONF['ffmpeg_path'] = '/usr/local/bin';
                if (file_exists($_MG_CONF['ffmpeg_path'] . $binary)) {
                    // do nothing..
                } else {
                    clearstatcache();
                    $_MG_CONF['ffmpeg_path'] = '/usr/X11R6/bin';
                    if (file_exists($_MG_CONF['ffmpeg_path'] . $binary)) {
                        // do nothing..
                    }
                }
            }
        }
    }
    $frames = new mgFrame();
    $skins = array();
    $skins = $frames->getFrames();
    if (!isset($_MG_CONF['random_skin']) || $_MG_CONF['random_skin'] == '') {
        $_MG_CONF['random_skin'] = 'mgShadow';
    }
    $skin_select = '<select name="skin">';
    $rskin_select = '<select name="rskin">';
    for ($i = 0; $i < count($skins); $i++) {
        $skin_select .= '<option value="' . $skins[$i]['dir'] . '"' . ($_MG_CONF['indexskin'] == $skins[$i]['dir'] ? ' selected="selected" ' : '') . '>' . $skins[$i]['name'] . '</option>';
        $rskin_select .= '<option value="' . $skins[$i]['dir'] . '"' . ($_MG_CONF['random_skin'] == $skins[$i]['dir'] ? ' selected="selected" ' : '') . '>' . $skins[$i]['name'] . '</option>';
    }
    $skin_select .= '</select>';
    $rskin_select .= '</select>';
    $themes = array();
    $themes = MG_getThemes();
    $theme_select = '<select name="theme">';
    for ($i = 0; $i < count($themes); $i++) {
        $theme_select .= '<option value="' . $themes[$i] . '"' . ($_MG_CONF['indextheme'] == $themes[$i] ? ' selected="selected" ' : '') . '>' . $themes[$i] . '</option>';
    }
    $theme_select .= '</select>';
    require_once $_CONF['path_system'] . 'classes/navbar.class.php';
    $navbar = new navbar();
    $navbar->add_menuitem($LANG_MG01['general_options'], 'showhideMGAdminEditorDiv("general",0);return false;', true);
    $navbar->add_menuitem($LANG_MG01['display_options'], 'showhideMGAdminEditorDiv("display",1);return false;', true);
    $navbar->add_menuitem($LANG_MG01['batch_options'], 'showhideMGAdminEditorDiv("batch",2);return false;', true);
    $navbar->add_menuitem($LANG_MG01['up_overrides'], 'showhideMGAdminEditorDiv("userprefs",3);return false;', true);
    $navbar->add_menuitem($LANG_MG01['graphicspackage_prompt'], 'showhideMGAdminEditorDiv("graphics",4);return false;', true);
    $navbar->set_selected($LANG_MG01['general_options']);
    $T->set_var('navbar', $navbar->generate());
    $T->set_var(array('no_javascript_warning' => $LANG04[150], 'lang_config_title' => $LANG_MG01['configuration_title'], 'lang_config_help' => $LANG_MG01['configuration_help'], 'lang_config_header' => $LANG_MG01['configuration_header'], 'lang_yes' => $LANG_MG01['yes'], 'lang_no' => $LANG_MG01['no'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_reset' => $LANG_MG01['reset'], 'lang_album_columns' => $LANG_MG01['album_display_columns_prompt'], 'lang_album_colums_help' => $LANG_MG01['album_display_columns_help'], 'lang_album_rows' => $LANG_MG01['album_display_rows'], 'lang_subalbum_select' => $LANG_MG01['subalbum_select'], 'lang_loginrequired' => $LANG_MG01['loginrequired_prompt'], 'lang_loginrequired_help' => $LANG_MG01['loginrequired_help'], 'lang_anonymous_uploads' => $LANG_MG01['anonymous_uploads_prompt'], 'lang_anonymous_uploads_help' => $LANG_MG01['anonymous_uploads_help'], 'lang_comments' => $LANG_MG01['comments_prompt'], 'lang_comments_help' => $LANG_MG01['comments_help'], 'lang_graphicspackage' => $LANG_MG01['graphicspackage_prompt'], 'lang_graphicspackage_help' => $LANG_MG01['graphicspackage_help'], 'lang_gp_path' => $LANG_MG01['graphicspackage_path_prompt'], 'lang_gp_path_help' => $LANG_MG01['graphicspackage_path_help'], 'lang_userpref_options' => $LANG_MG01['up_overrides'], 'lang_display_rows_enabled' => $LANG_MG01['up_rows_override'], 'lang_display_columns_enabled' => $LANG_MG01['up_columns_override'], 'lang_mp3_player_enabled' => $LANG_MG01['up_mp3_override'], 'lang_av_playback_enabled' => $LANG_MG01['up_av_override'], 'lang_thumbnail_size_enabled' => $LANG_MG01['up_tn_override'], 'lang_album_skin' => $LANG_MG01['index_album_skin'], 'lang_display_rows' => $LANG_MG01['album_display_rows'], 'album_display_columns' => $_MG_CONF['album_display_columns'], 'album_display_rows' => $_MG_CONF['album_display_rows'], 'loginrequired' => $_MG_CONF['loginrequired'], 'anonymous_uploads' => $_MG_CONF['moderation'], 'graphicspackage' => $gp_select, 'graphicspackage_path' => $_MG_CONF['graphicspackage_path'], 'lang_displayblock' => $LANG_MG01['displayblock_prompt'], 'lang_displayblock_help' => $LANG_MG01['displayblock_help'], 'lang_jhead_enable' => $LANG_MG01['jhead_enable'], 'lang_jh_path' => $LANG_MG01['jhead_path'], 'lang_jpegtran_enable' => $LANG_MG01['jpegtran_enable'], 'lang_ffmpeg_enable' => $LANG_MG01['ffmpeg_enable'], 'lang_jt_path' => $LANG_MG01['jpegtran_path'], 'lang_zip_enable' => $LANG_MG01['zip_enable'], 'lang_zip_path' => $LANG_MG01['zip_path'], 'lang_tmp_path' => $LANG_MG01['tmp_path'], 'lang_ffmpeg_path' => $LANG_MG01['ffmpeg_path'], 'jhead_path' => $_MG_CONF['jhead_path'], 'jpegtran_path' => $_MG_CONF['jpegtran_path'], 'zip_path' => $_MG_CONF['zip_path'], 'tmp_path' => $_MG_CONF['tmp_path'], 'ftp_path' => $_MG_CONF['ftp_path'], 'ffmpeg_path' => $_MG_CONF['ffmpeg_path'], 'displayblock' => $block_select, 'dfidselect' => $dfid_select, 'rating_select' => $rating_select, 'wn_time_select' => $wn_time_select, 'custom_image_height' => $_MG_CONF['custom_image_height'], 'random_width' => $_MG_CONF['random_width'], 'random_skin' => $_MG_CONF['random_skin'], 'custom_image_width' => $_MG_CONF['custom_image_width'], 'refresh_rate' => $_MG_CONF['def_refresh_rate'], 'item_limit' => $_MG_CONF['def_item_limit'], 'time_limit' => $_MG_CONF['def_time_limit'], 'gallery_tn_size_select' => $gallery_tn_size_select, 'gallery_tnheight_input' => $gallery_tnheight_input, 'gallery_tnwidth_input' => $gallery_tnwidth_input, 'jpg_quality' => $_MG_CONF['jpg_quality'], 'tn_jpg_quality' => $_MG_CONF['tn_jpg_quality'], 'orig_jpg_quality' => $_MG_CONF['jpg_orig_quality'], 'truncate_breadcrumb' => $_MG_CONF['truncate_breadcrumb'], 'seperator' => $_MG_CONF['seperator'], 'mp3_select' => $mp3_select, 'skin_select' => $skin_select, 'rskin_select' => $rskin_select, 'theme_select' => $theme_select, 'postcard_retention' => $_MG_CONF['postcard_retention'], 'lang_wn_time' => $LANG_MG01['whatsnew_time'], 'lang_theme_select' => $LANG_MG01['index_theme'], 'lang_gallery_tn_size' => $LANG_MG01['gallery_tn_size'], 'lang_jpg_quality' => $LANG_MG01['jpg_quality'], 'lang_tn_jpg_quality' => $LANG_MG01['tn_jpg_quality'], 'lang_orig_jpg_quality' => $LANG_MG01['orig_jpg_quality'], 'lang_truncate_breadcrumb' => $LANG_MG01['truncate_breadcrumb'], 'lang_seperator' => $LANG_MG01['seperator'], 'lang_mp3_player' => $LANG_MG01['mp3_player'], 'lang_htmlallowed' => $LANG_MG01['htmlallowed'], 'lang_whatsnew' => $LANG_MG01['whatsnew'], 'lang_dfid' => $LANG_MG01['dfid'], 'lang_general_options' => $LANG_MG01['general_options'], 'lang_display_options' => $LANG_MG01['display_options'], 'lang_graphics_options' => $LANG_MG01['graphics_options'], 'lang_usage_tracking' => $LANG_MG01['usage_tracking'], 'lang_gallery_import' => $LANG_MG01['gallery_import'], 'lang_4images_import' => $LANG_MG01['fourimages_import'], 'lang_xppubwiz_install' => $LANG_MG01['xppubwizard_install'], 'lang_logviewer' => $LANG_MG01['log_viewer'], 'lang_preserve_filename' => $LANG_MG01['preserve_filename'], 'lang_discard_originals' => $LANG_MG01['discard_originals'], 'lang_custom_image_height' => $LANG_MG01['custom_image_height'], 'lang_custom_image_width' => $LANG_MG01['custom_image_width'], 'lang_verbose' => $LANG_MG01['verbose'], 'lang_dwnc' => $LANG_MG01['disable_wn_comments'], 'lang_emid' => $LANG_MG01['enable_mid'], 'lang_fip' => $LANG_MG01['full_in_popup'], 'lang_cmtbar' => $LANG_MG01['cmtbar'], 'lang_wn_length' => $LANG_MG01['wn_title_length'], 'lang_batch_options' => $LANG_MG01['batch_options'], 'lang_refresh_rate' => $LANG_MG01['refresh_rate'], 'lang_time_limit' => $LANG_MG01['time_limit'], 'lang_item_limit' => $LANG_MG01['item_limit'], 'lang_ftp_path' => $LANG_MG01['ftp_path'], 'lang_characters' => $LANG_MG01['characters'], 'lang_postcard_retention' => $LANG_MG01['postcard_retention'], 'lang_profile_hook' => $LANG_MG01['profile_hook'], 's_form_action' => $_MG_CONF['admin_url'] . 'cfgedit.php', 'rtl' => $LANG_DIRECTION == "rtl" ? "rtl" : "", 'lang_autotag_caption' => $LANG_MG01['autotag_caption'], 'lang_popup_from_album' => $LANG_MG01['popup_from_album'], 'lang_random_size' => $LANG_MG01['random_size'], 'lang_random_skin' => $LANG_MG01['random_skin'], 'lang_auto_tag_defaults' => $LANG_MG01['auto_tag_defaults'], 'lang_alignment' => $LANG_MG01['alignment'], 'lang_border' => $LANG_MG01['border'], 'lang_width' => $LANG_MG01['width'], 'lang_height' => $LANG_MG01['height'], 'lang_source' => $LANG_MG01['source'], 'lang_autoplay' => $LANG_MG01['autoplay'], 'lang_link_to_media' => $LANG_MG01['link_to_media'], 'lang_ss_delay' => $LANG_MG01['ss_delay'], 'lang_show_titles' => $LANG_MG01['show_titles'], 'lang_flv' => $LANG_MG01['flash_video_player'], 'lang_search_result_options' => $LANG_MG01['search_result_options'], 'lang_search_columns' => $LANG_MG01['search_columns'], 'lang_search_rows' => $LANG_MG01['search_rows'], 'lang_search_av_playback' => $LANG_MG01['search_av_playback'], 'lang_search_views' => $LANG_MG01['search_views'], 'lang_search_rating' => $LANG_MG01['search_rating'], 'lang_gallery_only' => $LANG_MG01['gallery_only'], 'lang_tnheight' => $LANG_MG01['tn_height'], 'lang_tnwidth' => $LANG_MG01['tn_width'], 'lang_index_all' => $LANG_MG01['index_all'], 'gltoken_name' => CSRF_TOKEN, 'gltoken' => SEC_createToken()));
    $T->parse('output', 'admin');
    $retval .= $T->finish($T->get_var('output'));
    return $retval;
}
Ejemplo n.º 28
0
 /**
  * Show the category editor
  */
 function showEditor($cid, $mode = 'edit')
 {
     global $_CONF, $_TABLES, $_USER, $LANG_ACCESS, $_DLM_CONF, $LANG_DLM, $mytree;
     $retval = '';
     if (!empty($this->_editor_mode)) {
         $mode = $this->_editor_mode;
     } else {
         $this->_editor_mode = $mode;
     }
     if ($mode == 'edit' || $mode == 'clone') {
         if ($this->_retry == true) {
             $this->_loadFromArgs($_POST);
         } else {
             $this->_loadFromDatabase($cid);
         }
     }
     if ($mode == 'clone') {
         $this->_cid = $this->_createID($this->_cid . '_');
         $this->_old_cid = $this->_cid;
     }
     if ($mode == 'create') {
         if ($this->_retry == true) {
             $this->_loadFromArgs($_POST);
         } else {
             $this->_initVars();
         }
     }
     $this->_checkHasAccess();
     $blocktitle = $mode == 'edit' ? $LANG_DLM['modcat'] : $LANG_DLM['addcat'];
     $retval .= $this->_showMessage();
     $retval .= COM_startBlock($blocktitle, '', COM_getBlockTemplate('_admin_block', 'header'));
     $T = new Template($_DLM_CONF['path_layout']);
     $T->set_file(array('t_modcategory' => 'admin_modcategory.thtml', 't_admin_access' => 'admin_access.thtml', 't_admin_submit_delete' => 'admin_submit_delete.thtml'));
     DLM_setDefaultTemplateVars($T);
     $lang = array('title', 'imgurlmain', 'parent', 'save', 'delete', 'cancel', 'confirm_delete', 'topic', 'catid', 'is_enabled', 'corder', 'upload');
     foreach ($lang as $v) {
         $T->set_var('lang_' . $v, $LANG_DLM[$v]);
     }
     $T->set_var('preview', $this->_makeForm_category_image());
     $T->set_var('imgurl', $this->_imgurl);
     $T->set_var('imgurlold', $this->_imgurl);
     $T->set_var('cid', $this->_cid);
     $T->set_var('old_cid', $this->_old_cid);
     $T->set_var('corder', $this->_corder);
     $T->set_var('title', $this->_title);
     $T->set_var('op', $mode == 'edit' ? 'saveCategory' : 'addCategory');
     $T->set_var('delete_disabled', $mode == 'edit' ? '' : UC_DISABLED);
     $T->set_var('val_is_enabled', $this->_is_enabled == 1 ? UC_CHECKED : '');
     $T->set_var('selparents', $mytree->makeSelBox('title', 'corder', $this->_pid, 1, 'pid', '', $this->_cid));
     // user access info
     $lang = array('accessrights', 'owner', 'group', 'permissions', 'permissionskey', 'permmsg');
     foreach ($lang as $v) {
         $T->set_var('lang_' . $v, $LANG_ACCESS[$v]);
     }
     $this->_owner_id = (int) $this->_owner_id;
     $T->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$this->_owner_id}"));
     $ownername = COM_getDisplayName($this->_owner_id);
     $T->set_var('owner_name', $ownername);
     $T->set_var('owner', $ownername);
     $T->set_var('ownerid', $this->_owner_id);
     $T->set_var('group_dropdown', SEC_getGroupDropdown($this->_group_id, 3));
     $T->set_var('permissions_editor', SEC_getPermissionsHTML($this->_perm_owner, $this->_perm_group, $this->_perm_members, $this->_perm_anon));
     $hidden_values = $this->_makeForm_hidden('editor_mode', $this->_editor_mode);
     $T->set_var('hidden_values', $hidden_values);
     $T->parse('admin_access', 't_admin_access');
     if ($mode == 'edit') {
         $T->parse('admin_submit_delete', 't_admin_submit_delete');
     }
     $T->set_var('gltoken_name', CSRF_TOKEN);
     $T->set_var('gltoken', SEC_createToken());
     $T->parse('output', 't_modcategory');
     $retval .= $T->finish($T->get_var('output'));
     $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
     $retval = DLM_createHTMLDocument($retval, array('pagetitle' => $blocktitle));
     return $retval;
 }
Ejemplo n.º 29
0
function LIB_import($pi_name)
{
    global $_CONF;
    $lang_box_admin = "LANG_" . strtoupper($pi_name) . "_ADMIN";
    global ${$lang_box_admin};
    $lang_box_admin = ${$lang_box_admin};
    $tmpl = new Template($_CONF['path'] . "plugins/" . THIS_PLUGIN . "/templates/admin/");
    $tmpl->set_file(array('import' => 'import.thtml'));
    $tmpl->set_var('site_admin_url', $_CONF['site_admin_url']);
    $tmpl->set_var('gltoken_name', CSRF_TOKEN);
    $tmpl->set_var('gltoken', SEC_createToken());
    $tmpl->set_var('xhtml', XHTML);
    $tmpl->set_var('script', THIS_SCRIPT);
    $tmpl->set_var('importmsg', $lang_box_admin['importmsg']);
    $tmpl->set_var('importfile', $lang_box_admin['importfile']);
    $tmpl->set_var('submit', $lang_box_admin['submit']);
    $tmpl->parse('output', 'import');
    $import = $tmpl->finish($tmpl->get_var('output'));
    $retval = "";
    $retval .= COM_startBlock($lang_box_admin['import'], '', COM_getBlockTemplate('_admin_block', 'header'));
    $retval .= $import;
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    return $retval;
}
Ejemplo n.º 30
0
/**
* Allows user to edit a personal calendar event
*
* @param    array   $A  Record to display
* @return   string      HTML for event editor
*
*/
function editpersonalevent($A)
{
    global $_CONF, $_CAJP_CONF, $LANG_CALJP_1;
    $ja = $_CONF['language'] == 'japanese_utf-8';
    $cal_templates = COM_newTemplate($_CONF['path'] . 'plugins/calendarjp/templates/');
    $cal_templates->set_file('form', 'editpersonalevent' . ($ja ? '_ja' : '') . '.thtml');
    $cal_templates->set_var('lang_title', $LANG_CALJP_1[28]);
    $title = stripslashes($A['title']);
    $title = str_replace('{', '&#123;', $title);
    $title = str_replace('}', '&#125;', $title);
    $title = str_replace('"', '&quot;', $title);
    $cal_templates->set_var('event_title', $title);
    $cal_templates->set_var('lang_eventtype', $LANG_CALJP_1[37]);
    $type_options = CALENDARJP_eventTypeList($A['event_type']);
    $cal_templates->set_var('type_options', $type_options);
    // Handle start date/time
    $cal_templates->set_var('lang_startdate', $LANG_CALJP_1[21]);
    $cal_templates->set_var('lang_starttime', $LANG_CALJP_1[30]);
    $A['startdate'] = $A['datestart'] . ' ' . $A['timestart'];
    $start_month = date('n', strtotime($A['startdate']));
    $month_options = CALENDARJP_getMonthFormOptions($start_month);
    $cal_templates->set_var('startmonth_options', $month_options);
    $start_day = date('j', strtotime($A['startdate']));
    $day_options = COM_getDayFormOptions($start_day);
    $cal_templates->set_var('startday_options', $day_options);
    $start_year = date('Y', strtotime($A['startdate']));
    $year_options = COM_getYearFormOptions($start_year);
    $cal_templates->set_var('startyear_options', $year_options);
    if (isset($_CAJP_CONF['hour_mode']) && $_CAJP_CONF['hour_mode'] == 24) {
        $start_hour = date('H', strtotime($A['startdate']));
        $hour_options = COM_getHourFormOptions($start_hour, 24);
        $cal_templates->set_var('starthour_options', $hour_options);
    } else {
        $start_hour = date('g', strtotime($A['startdate']));
        $hour_options = COM_getHourFormOptions($start_hour);
        $cal_templates->set_var('starthour_options', $hour_options);
    }
    $startmin = intval(date('i', strtotime($A['startdate'])) / 15) * 15;
    $cal_templates->set_var('startminute_options', COM_getMinuteFormOptions($startmin, 15));
    $ampm = date('a', strtotime($A['startdate']));
    $cal_templates->set_var('startampm_selection', CALENDARJP_getAmPmFormSelection('startampm_selection', $ampm));
    // Handle end date/time
    $cal_templates->set_var('lang_enddate', $LANG_CALJP_1[18]);
    $cal_templates->set_var('lang_endtime', $LANG_CALJP_1[29]);
    $A['enddate'] = $A['dateend'] . ' ' . $A['timeend'];
    $end_month = date('n', strtotime($A['enddate']));
    $month_options = CALENDARJP_getMonthFormOptions($end_month);
    $cal_templates->set_var('endmonth_options', $month_options);
    $end_day = date('j', strtotime($A['enddate']));
    $day_options = COM_getDayFormOptions($end_day);
    $cal_templates->set_var('endday_options', $day_options);
    $end_year = date('Y', strtotime($A['enddate']));
    $year_options = COM_getYearFormOptions($end_year);
    $cal_templates->set_var('endyear_options', $year_options);
    if (isset($_CAJP_CONF['hour_mode']) && $_CAJP_CONF['hour_mode'] == 24) {
        $end_hour = date('H', strtotime($A['enddate']));
        $hour_options = COM_getHourFormOptions($end_hour, 24);
        $cal_templates->set_var('endhour_options', $hour_options);
    } else {
        $end_hour = date('g', strtotime($A['enddate']));
        $hour_options = COM_getHourFormOptions($end_hour);
        $cal_templates->set_var('endhour_options', $hour_options);
    }
    $endmin = intval(date('i', strtotime($A['enddate'])) / 15) * 15;
    $cal_templates->set_var('endminute_options', COM_getMinuteFormOptions($endmin, 15));
    $ampm = date('a', strtotime($A['enddate']));
    $cal_templates->set_var('endampm_selection', CALENDARJP_getAmPmFormSelection('endampm_selection', $ampm));
    $cal_templates->set_var('lang_alldayevent', $LANG_CALJP_1[31]);
    if ($A['allday'] == 1) {
        $cal_templates->set_var('allday_checked', 'checked="checked"');
    } else {
        $cal_templates->set_var('allday_checked', '');
    }
    $cal_templates->set_var('lang_tail_year', $LANG_CALJP_1['tail_year']);
    $cal_templates->set_var('lang_tail_month', $LANG_CALJP_1['tail_month']);
    $cal_templates->set_var('lang_tail_day', $LANG_CALJP_1['tail_day']);
    $cal_templates->set_var('lang_location', $LANG_CALJP_1[39]);
    $cal_templates->set_var('event_location', stripslashes($A['location']));
    $cal_templates->set_var('lang_addressline1', $LANG_CALJP_1[32]);
    $cal_templates->set_var('event_address1', stripslashes($A['address1']));
    $cal_templates->set_var('lang_addressline2', $LANG_CALJP_1[33]);
    $cal_templates->set_var('event_address2', stripslashes($A['address2']));
    $cal_templates->set_var('lang_city', $LANG_CALJP_1[34]);
    $cal_templates->set_var('event_city', stripslashes($A['city']));
    $cal_templates->set_var('lang_state', $LANG_CALJP_1[35]);
    $cal_templates->set_var('state_options', '');
    $cal_templates->set_var('event_state', stripslashes($A['state']));
    $cal_templates->set_var('lang_zipcode', $LANG_CALJP_1[36]);
    $cal_templates->set_var('event_zipcode', $A['zipcode']);
    $cal_templates->set_var('lang_link', $LANG_CALJP_1[43]);
    $cal_templates->set_var('event_url', $A['url']);
    $cal_templates->set_var('lang_description', $LANG_CALJP_1[5]);
    $cal_templates->set_var('event_description', COM_nl2br(stripslashes($A['description'])));
    $cal_templates->set_var('lang_htmlnotallowed', $LANG_CALJP_1[44]);
    $cal_templates->set_var('lang_submit', $LANG_CALJP_1[45]);
    $cal_templates->set_var('lang_delete', $LANG_CALJP_1[51]);
    $cal_templates->set_var('eid', $A['eid']);
    $cal_templates->set_var('uid', $A['uid']);
    if (isset($_CAJP_CONF['hour_mode']) && $_CAJP_CONF['hour_mode'] == 24) {
        $cal_templates->set_var('hour_mode', 24);
    } else {
        $cal_templates->set_var('hour_mode', 12);
    }
    $cal_templates->set_var('gltoken_name', CSRF_TOKEN);
    $cal_templates->set_var('gltoken', SEC_createToken());
    return $cal_templates->parse('output', 'form');
}