public function testGetThemesNotAllowedAll() { global $_CONF; $_CONF['allow_user_themes'] = 1; $arr = COM_getThemes(); $this->assertEquals('professional', $arr[1]); }
/** * Helper function: Provide themes dropdown * * NOTE: Beautifying code duplicated from usersettings.php * * @return array Array of (filename, displayname) pairs * */ function configmanager_select_theme_helper() { $themes = array(); $themeFiles = COM_getThemes(true); usort($themeFiles, 'strcasecmp'); foreach ($themeFiles as $theme) { $words = explode('_', $theme); $bwords = array(); foreach ($words as $th) { if (strtolower($th[0]) == $th[0] && strtolower($th[1]) == $th[1]) { $bwords[] = ucfirst($th); } else { $bwords[] = $th; } } $themes[implode(' ', $bwords)] = $theme; } return $themes; }
/** * Displays user preferences * */ function editpreferences() { global $_TABLES, $_CONF, $LANG04, $_USER, $_GROUPS; $result = DB_query("SELECT noicons,willing,dfid,tzid,noboxes,maxstories,tids,aids,boxes,emailfromadmin,emailfromuser,showonline FROM {$_TABLES['userprefs']},{$_TABLES['userindex']} WHERE {$_TABLES['userindex']}.uid = {$_USER['uid']} AND {$_TABLES['userprefs']}.uid = {$_USER['uid']}"); $A = DB_fetchArray($result); // 'maxstories' may be 0, in which case it will pick up the default // setting for the current topic or $_CONF['limitnews'] (see index.php) if (empty($A['maxstories'])) { $A['maxstories'] = 0; } else { if ($A['maxstories'] > 0) { if ($A['maxstories'] < $_CONF['minnews']) { $A['maxstories'] = $_CONF['minnews']; } } } $preferences = new Template($_CONF['path_layout'] . 'preferences'); $preferences->set_file(array('prefs' => 'displayprefs.thtml', 'display' => 'displayblock.thtml', 'exclude' => 'excludeblock.thtml', 'digest' => 'digestblock.thtml', 'boxes' => 'boxesblock.thtml', 'comment' => 'commentblock.thtml', 'language' => 'language.thtml', 'theme' => 'theme.thtml', 'privacy' => 'privacyblock.thtml')); $preferences->set_var('xhtml', XHTML); $preferences->set_var('site_url', $_CONF['site_url']); $preferences->set_var('layout_url', $_CONF['layout_url']); $preferences->set_var('user_name', $_USER['username']); $preferences->set_var('lang_language', $LANG04[73]); $preferences->set_var('lang_theme', $LANG04[72]); $preferences->set_var('lang_theme_text', $LANG04[74]); $preferences->set_var('lang_misc_title', $LANG04[138]); $preferences->set_var('lang_misc_help_title', $LANG04[139]); $preferences->set_var('lang_misc_help', $LANG04[140]); $preferences->set_var('lang_noicons', $LANG04[40]); $preferences->set_var('lang_noicons_text', $LANG04[49]); $preferences->set_var('lang_noboxes', $LANG04[44]); $preferences->set_var('lang_noboxes_text', $LANG04[51]); $preferences->set_var('lang_maxstories', $LANG04[43]); if (strpos($LANG04[52], '%d') === false) { $maxtext = $LANG04[52] . ' ' . $_CONF['limitnews']; } else { $maxtext = sprintf($LANG04[52], $_CONF['limitnews']); } $preferences->set_var('lang_maxstories_text', $maxtext); $preferences->set_var('lang_dateformat', $LANG04[42]); $preferences->set_var('lang_excluded_items_title', $LANG04[137]); $preferences->set_var('lang_excluded_items', $LANG04[54]); $preferences->set_var('lang_exclude_title', $LANG04[136]); $preferences->set_var('lang_topics', $LANG04[48]); $preferences->set_var('lang_emailedtopics', $LANG04[76]); $preferences->set_var('lang_digest_top_header', $LANG04[131]); $preferences->set_var('lang_digest_help_header', $LANG04[132]); $preferences->set_var('lang_boxes_title', $LANG04[144]); $preferences->set_var('lang_boxes_help_title', $LANG04[143]); $preferences->set_var('lang_boxes', $LANG04[55]); $preferences->set_var('lang_displaymode', $LANG04[57]); $preferences->set_var('lang_displaymode_text', $LANG04[60]); $preferences->set_var('lang_sortorder', $LANG04[58]); $preferences->set_var('lang_sortorder_text', $LANG04[61]); $preferences->set_var('lang_comment_title', $LANG04[133]); $preferences->set_var('lang_comment_help_title', $LANG04[134]); $preferences->set_var('lang_comment_help', $LANG04[135]); $preferences->set_var('lang_commentlimit', $LANG04[59]); $preferences->set_var('lang_commentlimit_text', $LANG04[62]); $preferences->set_var('lang_privacy_title', $LANG04[141]); $preferences->set_var('lang_privacy_help_title', $LANG04[141]); $preferences->set_var('lang_privacy_help', $LANG04[142]); $preferences->set_var('lang_emailfromadmin', $LANG04[100]); $preferences->set_var('lang_emailfromadmin_text', $LANG04[101]); $preferences->set_var('lang_emailfromuser', $LANG04[102]); $preferences->set_var('lang_emailfromuser_text', $LANG04[103]); $preferences->set_var('lang_showonline', $LANG04[104]); $preferences->set_var('lang_showonline_text', $LANG04[105]); $preferences->set_var('lang_submit', $LANG04[9]); $display_name = COM_getDisplayName($_USER['uid']); $preferences->set_var('lang_authors_exclude', $LANG04[46]); $preferences->set_var('lang_boxes_exclude', $LANG04[47]); $preferences->set_var('start_block_display', COM_startBlock($LANG04[45] . ' ' . $display_name)); $preferences->set_var('start_block_digest', COM_startBlock($LANG04[75] . ' ' . $display_name)); $preferences->set_var('start_block_comment', COM_startBlock($LANG04[64] . ' ' . $display_name)); $preferences->set_var('start_block_privacy', COM_startBlock($LANG04[99] . ' ' . $display_name)); $preferences->set_var('end_block', COM_endBlock()); $preferences->set_var('display_headline', $LANG04[45] . ' ' . $display_name); $preferences->set_var('exclude_headline', $LANG04[46] . ' ' . $display_name); $preferences->set_var('digest_headline', $LANG04[75] . ' ' . $display_name); $preferences->set_var('boxes_headline', $LANG04[47] . ' ' . $display_name); $preferences->set_var('comment_headline', $LANG04[64] . ' ' . $display_name); $preferences->set_var('privacy_headline', $LANG04[99] . ' ' . $display_name); // display preferences block if ($_CONF['allow_user_language'] == 1) { if (empty($_USER['language'])) { $userlang = $_CONF['language']; } else { $userlang = $_USER['language']; } // Get available languages $language = MBYTE_languageList($_CONF['default_charset']); $has_valid_language = count(array_keys($language, $userlang)); if ($has_valid_language == 0) { // The user's preferred language is no longer available. // We have a problem now, since we've overwritten $_CONF['language'] // with the user's preferred language ($_USER['language']) and // therefore don't know what the system's default language is. // So we'll try to find a similar language. If that doesn't help, // the dropdown will default to the first language in the list ... $tmp = explode('_', $userlang); $similarLang = $tmp[0]; } $selection = '<select id="language" name="language">' . LB; foreach ($language as $langFile => $langName) { $selection .= '<option value="' . $langFile . '"'; if ($langFile == $userlang || $has_valid_language == 0 && strpos($langFile, $similarLang) === 0) { $selection .= ' selected="selected"'; $has_valid_language = 1; } else { if ($userlang == $langFile) { $selection .= ' selected="selected"'; } } $selection .= '>' . $langName . '</option>' . LB; } $selection .= '</select>'; $preferences->set_var('language_selector', $selection); $preferences->parse('language_selection', 'language', true); } else { $preferences->set_var('language_selection', ''); } if ($_CONF['allow_user_themes'] == 1) { $selection = '<select id="theme" name="theme">' . LB; if (empty($_USER['theme'])) { $usertheme = $_CONF['theme']; } else { $usertheme = $_USER['theme']; } $themeFiles = COM_getThemes(); usort($themeFiles, 'strcasecmp'); foreach ($themeFiles as $theme) { $selection .= '<option value="' . $theme . '"'; if ($usertheme == $theme) { $selection .= ' selected="selected"'; } $words = explode('_', $theme); $bwords = array(); foreach ($words as $th) { if (strtolower($th[0]) == $th[0] && strtolower($th[1]) == $th[1]) { $bwords[] = ucfirst($th); } else { $bwords[] = $th; } } $selection .= '>' . implode(' ', $bwords) . '</option>' . LB; } $selection .= '</select>'; $preferences->set_var('theme_selector', $selection); $preferences->parse('theme_selection', 'theme', true); } else { $preferences->set_var('theme_selection', ''); } // Timezone require_once $_CONF['path_system'] . 'classes/timezoneconfig.class.php'; $timezone = TimeZoneConfig::getUserTimeZone(); $selection = TimeZoneConfig::getTimeZoneDropDown($timezone, array('id' => 'tzid', 'name' => 'tzid')); $preferences->set_var('timezone_selector', $selection); $preferences->set_var('lang_timezone', $LANG04[158]); if ($A['noicons'] == '1') { $preferences->set_var('noicons_checked', 'checked="checked"'); } else { $preferences->set_var('noicons_checked', ''); } if ($A['noboxes'] == 1) { $preferences->set_var('noboxes_checked', 'checked="checked"'); } else { $preferences->set_var('noboxes_checked', ''); } $preferences->set_var('maxstories_value', $A['maxstories']); $selection = '<select id="dfid" name="dfid">' . LB . COM_optionList($_TABLES['dateformats'], 'dfid,description', $A['dfid']) . '</select>'; $preferences->set_var('dateformat_selector', $selection); $preferences->parse('display_block', 'display', true); // privacy options block if ($A['emailfromadmin'] == 1) { $preferences->set_var('emailfromadmin_checked', 'checked="checked"'); } else { $preferences->set_var('emailfromadmin_checked', ''); } if ($A['emailfromuser'] == 1) { $preferences->set_var('emailfromuser_checked', 'checked="checked"'); } else { $preferences->set_var('emailfromuser_checked', ''); } if ($A['showonline'] == 1) { $preferences->set_var('showonline_checked', 'checked="checked"'); } else { $preferences->set_var('showonline_checked', ''); } PLG_profileVariablesEdit($_USER['uid'], $preferences); $preferences->parse('privacy_block', 'privacy', true); // excluded items block $permissions = COM_getPermSQL(''); $preferences->set_var('exclude_topic_checklist', COM_checkList($_TABLES['topics'], 'tid,topic', $permissions, $A['tids'], 'topics')); if ($_CONF['contributedbyline'] == 1 && $_CONF['hide_author_exclusion'] == 0) { $preferences->set_var('lang_authors', $LANG04[56]); $sql = "SELECT DISTINCT story.uid, users.username,users.fullname FROM {$_TABLES['stories']} story, {$_TABLES['users']} users WHERE story.uid = users.uid"; if ($_CONF['show_fullname'] == 1) { $sql .= ' ORDER BY users.fullname'; } else { $sql .= ' ORDER BY users.username'; } $query = DB_query($sql); $nrows = DB_numRows($query); $authors = explode(' ', $A['aids']); $selauthors = ''; for ($i = 0; $i < $nrows; $i++) { $B = DB_fetchArray($query); $selauthors .= '<option value="' . $B['uid'] . '"'; if (in_array(sprintf('%d', $B['uid']), $authors)) { $selauthors .= ' selected'; } $selauthors .= '>' . COM_getDisplayName($B['uid'], $B['username'], $B['fullname']) . '</option>' . LB; } if (DB_count($_TABLES['topics']) > 10) { $Selboxsize = intval(DB_count($_TABLES['topics']) * 1.5); } else { $Selboxsize = 15; } $preferences->set_var('exclude_author_checklist', '<select name="selauthors[]" multiple="multiple" size="' . $Selboxsize . '">' . $selauthors . '</select>'); } else { $preferences->set_var('lang_authors', ''); $preferences->set_var('exclude_author_checklist', ''); } $preferences->parse('exclude_block', 'exclude', true); // daily digest block if ($_CONF['emailstories'] == 1) { $user_etids = DB_getItem($_TABLES['userindex'], 'etids', "uid = {$_USER['uid']}"); if (empty($user_etids)) { // an empty string now means "all topics" $etids = USER_getAllowedTopics(); $user_etids = implode(' ', $etids); } elseif ($user_etids == '-') { // this means "no topics" $user_etids = ''; } $tmp = COM_checkList($_TABLES['topics'], 'tid,topic', $permissions, $user_etids, 'topics'); $preferences->set_var('email_topic_checklist', str_replace($_TABLES['topics'], 'etids', $tmp)); $preferences->parse('digest_block', 'digest', true); } else { $preferences->set_var('digest_block', ''); } // boxes block $selectedblocks = ''; if (strlen($A['boxes']) > 0) { $blockresult = DB_query("SELECT bid FROM {$_TABLES['blocks']} WHERE bid NOT IN (" . str_replace(' ', ',', $A['boxes']) . ")"); for ($x = 1; $x <= DB_numRows($blockresult); $x++) { $row = DB_fetchArray($blockresult); $selectedblocks .= $row['bid']; if ($x != DB_numRows($blockresult)) { $selectedblocks .= ' '; } } } $whereblock = ''; if (!empty($permissions)) { $whereblock .= $permissions . ' AND '; } $whereblock .= "((type != 'layout' AND type != 'gldefault' AND is_enabled = 1) OR " . "(type = 'gldefault' AND is_enabled = 1 AND name IN ('whats_new_block','older_stories'))) " . "ORDER BY onleft desc,blockorder,title"; $preferences->set_var('boxes_checklist', COM_checkList($_TABLES['blocks'], 'bid,title,type', $whereblock, $selectedblocks)); $preferences->parse('boxes_block', 'boxes', true); // comment preferences block $result = DB_query("SELECT commentmode,commentorder,commentlimit FROM {$_TABLES['usercomment']} WHERE uid = {$_USER['uid']}"); $A = DB_fetchArray($result); if (empty($A['commentmode'])) { $A['commentmode'] = $_CONF['comment_mode']; } if (empty($A['commentorder'])) { $A['commentorder'] = 0; } if (empty($A['commentlimit'])) { $A['commentlimit'] = 100; } $selection = '<select id="commentmode" name="commentmode">'; $selection .= COM_optionList($_TABLES['commentmodes'], 'mode,name', $A['commentmode']); $selection .= '</select>'; $preferences->set_var('displaymode_selector', $selection); $selection = '<select id="commentorder" name="commentorder">'; $selection .= COM_optionList($_TABLES['sortcodes'], 'code,name', $A['commentorder']); $selection .= '</select>'; $preferences->set_var('sortorder_selector', $selection); $preferences->set_var('commentlimit_value', $A['commentlimit']); $preferences->parse('comment_block', 'comment', true); return $preferences->finish($preferences->parse('output', 'prefs')); }
function USER_layoutPanel($U, $newuser = 0) { global $_CONF, $_SYSTEM, $_TABLES, $_USER, $LANG_MYACCOUNT, $LANG04, $LANG_confignames, $LANG_configselects; $uid = $U['uid']; // set template $userform = new Template($_CONF['path_layout'] . 'admin/user/'); $userform->set_file('user', 'layoutpanel.thtml'); $userform->set_var('lang_misc_title', $LANG04[138]); $userform->set_var('lang_misc_help_title', $LANG04[139]); $userform->set_var('lang_misc_help', $LANG04[140]); $userform->set_var('lang_language', $LANG04[73]); $userform->set_var('lang_theme', $LANG04[72]); $userform->set_var('lang_noicons', $LANG04[40]); $userform->set_var('lang_noboxes', $LANG04[44]); $userform->set_var('lang_maxstories', $LANG04[43]); $userform->set_var('lang_timezone', $LANG04[158]); $userform->set_var('lang_dateformat', $LANG04[42]); $userform->set_var('lang_search_format', $LANG_confignames['Core']['search_show_type']); $userform->set_var('lang_comment_title', $LANG04[133]); $userform->set_var('lang_comment_help_title', $LANG04[134]); $userform->set_var('lang_comment_help', $LANG04[135]); $userform->set_var('lang_displaymode', $LANG04[57]); $userform->set_var('lang_sortorder', $LANG04[58]); $userform->set_var('lang_commentlimit', $LANG04[59]); if ($_CONF['allow_user_language'] == 1) { if (empty($U['language'])) { $userlang = $_CONF['language']; } else { $userlang = $U['language']; } // Get available languages $language = MBYTE_languageList($_CONF['default_charset']); $has_valid_language = count(array_keys($language, $userlang)); if ($has_valid_language == 0) { // The user's preferred language is no longer available. // We have a problem now, since we've overwritten $_CONF['language'] // with the user's preferred language ($U['language']) and // therefore don't know what the system's default language is. // So we'll try to find a similar language. If that doesn't help, // the dropdown will default to the first language in the list ... $tmp = explode('_', $userlang); $similarLang = $tmp[0]; } // build language select $selection = '<select id="language" name="language">' . LB; foreach ($language as $langFile => $langName) { $selection .= '<option value="' . $langFile . '"'; if ($langFile == $userlang || $has_valid_language == 0 && strpos($langFile, $similarLang) === 0) { $selection .= ' selected="selected"'; $has_valid_language = 1; } else { if ($userlang == $langFile) { $selection .= ' selected="selected"'; } } $selection .= '>' . $langName . '</option>' . LB; } $selection .= '</select>'; $userform->set_var('language_selector', $selection); } else { $userform->set_var('language_selector', $_CONF['language']); } if ($_CONF['allow_user_themes'] == 1) { $selection = '<select id="theme" name="theme">' . LB; if (empty($U['theme'])) { $usertheme = $_CONF['theme']; } else { $usertheme = $U['theme']; } $themeFiles = COM_getThemes(); usort($themeFiles, create_function('$a,$b', 'return strcasecmp($a,$b);')); foreach ($themeFiles as $theme) { $selection .= '<option value="' . $theme . '"'; if ($usertheme == $theme) { $selection .= ' selected="selected"'; } $words = explode('_', $theme); $bwords = array(); foreach ($words as $th) { if (strtolower($th[0]) == $th[0] && strtolower($th[1]) == $th[1]) { $bwords[] = strtoupper($th[0]) . substr($th, 1); } else { $bwords[] = $th; } } $selection .= '>' . implode(' ', $bwords) . '</option>' . LB; } $selection .= '</select>'; $userform->set_var('theme_selector', $selection); } else { $userform->set_var('theme_selector', $_CONF['theme']); } if ($U['noicons'] == '1') { $userform->set_var('noicons_checked', 'checked="checked"'); } else { $userform->set_var('noicons_checked', ''); } if ($U['noboxes'] == 1) { $userform->set_var('noboxes_checked', 'checked="checked"'); } else { $userform->set_var('noboxes_checked', ''); } $userform->set_var('maxstories_value', $U['maxstories']); // Timezone if (isset($U['tzid'])) { $timezone = $U['tzid']; } else { $timezone = $_CONF['timezone']; } $selection = Date::getTimeZoneDropDown($timezone, array('id' => 'tzid', 'name' => 'tzid')); $userform->set_var('timezone_selector', $selection); $selection = '<select id="dfid" name="dfid">' . LB . COM_optionList($_TABLES['dateformats'], 'dfid,description', $U['dfid']) . '</select>'; $userform->set_var('dateformat_selector', $selection); $search_result_select = '<select name="search_result_format" id="search_result_format">' . LB; foreach ($LANG_configselects['Core'][18] as $name => $type) { $search_result_select .= '<option value="' . $type . '"' . ($U['search_result_format'] == $type ? 'selected="selected"' : '') . '>' . $name . '</option>' . LB; } $search_result_select .= '</select>'; $userform->set_var('search_result_select', $search_result_select); if (!empty($uid) && $uid > 1) { $userform->set_var('plugin_layout_display', PLG_profileEdit($uid, 'layout', 'display')); } // comment preferences block if (!empty($uid) && $uid > 1) { $result = DB_query("SELECT commentmode,commentorder,commentlimit FROM {$_TABLES['usercomment']} WHERE uid = {$uid}"); $C = DB_fetchArray($result); if (empty($C['commentmode'])) { $C['commentmode'] = $_CONF['comment_mode']; } if (empty($C['commentorder'])) { $C['commentorder'] = 0; } if (empty($C['commentlimit'])) { $C['commentlimit'] = 100; } } else { $C['commentmode'] = $_CONF['comment_mode']; $C['commentorder'] = 0; $C['commentlimit'] = 100; } $selection = '<select id="commentmode" name="commentmode">'; $selection .= COM_optionList($_TABLES['commentmodes'], 'mode,name', $C['commentmode']); $selection .= '</select>'; $userform->set_var('displaymode_selector', $selection); $selection = '<select id="commentorder" name="commentorder">'; $selection .= COM_optionList($_TABLES['sortcodes'], 'code,name', $C['commentorder']); $selection .= '</select>'; $userform->set_var('sortorder_selector', $selection); $userform->set_var('commentlimit_value', $U['commentlimit']); if (!empty($uid) && $uid > 1) { $userform->set_var('plugin_layout_comment', PLG_profileEdit($uid, 'layout', 'comment')); $userform->set_var('plugin_layout', PLG_profileEdit($uid, 'layout')); } $retval = $userform->finish($userform->parse('output', 'user')); return $retval; }
function menuConfig() { global $_CONF, $_TABLES, $_USER, $LANG_NEXMENU01, $id, $inactive, $showdisabled; global $menulocation, $CONF_NEXMENU, $LANG_NEXMENU04, $LANG_NEXMENU05; $statusmsg = $_GET['statusmsg']; include $_CONF['path_system'] . 'classes/navbar.class.php'; $tpl = new Template($_CONF['path_layout'] . 'nexmenu/admin'); if ($CONF_NEXMENU['debug']) { $tpl->set_file('page', 'menuconfig-debug.thtml'); } else { $tpl->set_file('page', 'menuconfig.thtml'); } $tpl->set_var('site_url', $_CONF['site_url']); $tpl->set_var('layout_url', $_CONF['layout_url']); $tpl->set_var('imgset', $_CONF['layout_url'] . '/nexmenu/images/admin'); $tpl->set_var('LANG_usecolorpicker', $LANG_NEXMENU05[32]); $theme = COM_applyFilter($_POST['theme']); if (empty($theme)) { $theme = COM_applyFilter($_GET['theme']); } if (empty($theme)) { $theme = $_USER['theme']; } if (!empty($theme)) { // Check if a record already exists for theme - if not create one from the default record if (DB_count($_TABLES['nexmenu_config'], 'theme', $theme) == 1) { $query = DB_query("SELECT * FROM {$_TABLES['nexmenu_config']} WHERE theme='{$theme}'"); $A = DB_fetchArray($query); } else { $query = DB_query("SELECT * FROM {$_TABLES['nexmenu_config']} WHERE theme='default'"); if (DB_numRows($query) == 1) { DB_query("INSERT INTO {$_TABLES['nexmenu_config']} (theme,header_style,block_style) VALUES ('{$theme}','CSS','CSS')"); $D = DB_fetchArray($query); $numfields = DB_numFields($query); // Need to skip the first field - which is an auto-increment primary key for ($i = 1; $i < $numfields; $i++) { $fieldname = DB_fieldName($query, $i); DB_query("UPDATE {$_TABLES['nexmenu_config']} SET {$fieldname}='{$D[$fieldname]}' WHERE theme='{$theme}'"); } $query = DB_query("SELECT * FROM {$_TABLES['nexmenu_config']} WHERE theme='{$theme}'"); $A = DB_fetchArray($query); } else { COM_errorLog("glMenu - tried to create new config record for theme: {$theme}, and default config record not found"); echo "<p>Unexpected plugin Error - check error.log</p>"; die; } } } else { $theme = 'default'; $query = DB_query("SELECT * FROM {$_TABLES['nexmenu_config']} WHERE theme='{$theme}'"); $A = DB_fetchArray($query); } $scripturl = $_CONF['site_admin_url'] . '/plugins/nexmenu/index.php'; $navbar = new navbar(); $navbar->add_menuitem($LANG_NEXMENU04['1'], $scripturl . "?menulocation=header&showdisabled={$showdisabled}"); $navbar->add_menuitem($LANG_NEXMENU04['2'], $scripturl . "?menulocation=block&showdisabled={$showdisabled}"); $navbar->add_menuitem($LANG_NEXMENU04['3'], $scripturl . "?op=addaction&id={$idCurrent}&menulocation={$menulocation}&showdisabled={$showdisabled}"); $navbar->add_menuitem($LANG_NEXMENU04['6'], $scripturl . "?op=config&menulocation=block&showdisabled={$showdisabled}"); $navbar->set_selected($LANG_NEXMENU04['6']); $tpl->set_var('navbar', $navbar->generate()); if ($statusmsg != '') { $tpl->set_var('showalert', ''); } else { $tpl->set_var('showalert', 'none'); } $tpl->set_var('statusmsg', $statusmsg); $tpl->set_var('LANG_title', $LANG_NEXMENU05[6]); $menustyles = array_keys($CONF_NEXMENU['menutypes']); $headerMenuType_options = ''; $blockMenuType_options = ''; foreach ($menustyles as $option) { if ($A['header_style'] == $option) { $headerMenuType_options .= '<option value="' . $option . '" SELECTED=selected>' . $option . '</option>'; } else { $headerMenuType_options .= '<option value="' . $option . '">' . $option . '</option>'; } } foreach ($menustyles as $option) { if ($A['block_style'] == $option) { $blockMenuType_options .= '<option value="' . $option . '" SELECTED=selected>' . $option . '</option>'; } else { $blockMenuType_options .= '<option value="' . $option . '">' . $option . '</option>'; } } if ($A['header_style'] == 'Milonic') { $tpl->set_var('show_headerCssMenuSettings', 'none'); $tpl->set_var('show_headerMilonicMenuSettings', ''); } else { $tpl->set_var('show_headerCssMenuSettings', ''); $tpl->set_var('show_headerMilonicMenuSettings', 'none'); } if ($A['block_style'] == 'Milonic') { $tpl->set_var('show_blockCssMenuSettings', 'none'); $tpl->set_var('show_blockMilonicMenuSettings', ''); } else { $tpl->set_var('show_blockCssMenuSettings', ''); $tpl->set_var('show_blockMilonicMenuSettings', 'none'); } $themes = COM_getThemes(); $themes[0] = 'default'; ksort($themes); foreach ($themes as $option) { if ($A['theme'] == $option) { $theme_options .= '<option value="' . $option . '" SELECTED=selected>' . $option . '</option>'; } else { $theme_options .= '<option value="' . $option . '">' . $option . '</option>'; } } $tpl->set_var('headerMenuType_options', $headerMenuType_options); $tpl->set_var('blockMenuType_options', $blockMenuType_options); $tpl->set_var('theme_options', $theme_options); $tpl->set_var('headerbg', $A['headerbg']); $tpl->set_var('headerfg', $A['headerfg']); $tpl->set_var('blockbg', $A['blockbg']); $tpl->set_var('blockfg', $A['blockfg']); $tpl->set_var('headersubmenubg', $A['headersubmenubg']); $tpl->set_var('headersubmenufg', $A['headersubmenufg']); $tpl->set_var('blocksubmenubg', $A['blocksubmenubg']); $tpl->set_var('blocksubmenufg', $A['blocksubmenufg']); $tpl->set_var('onhover_headerbg', $A['onhover_headerbg']); $tpl->set_var('onhover_headerfg', $A['onhover_headerfg']); $tpl->set_var('onhover_blockbg', $A['onhover_blockbg']); $tpl->set_var('onhover_blockfg', $A['onhover_blockfg']); $tpl->set_var('onhover_headersubmenubg', $A['onhover_headersubmenubg']); $tpl->set_var('onhover_headersubmenufg', $A['onhover_headersubmenufg']); $tpl->set_var('onhover_blocksubmenubg', $A['onhover_blocksubmenubg']); $tpl->set_var('onhover_blocksubmenufg', $A['onhover_blocksubmenufg']); $tpl->set_var('header_properties', $A['headermenu_properties']); $tpl->set_var('block_properties', $A['blockmenu_properties']); $tpl->set_var('LANG_menumode', $LANG_NEXMENU05[0]); $tpl->set_var('LANG_langlabels', $LANG_NEXMENU05[1]); $tpl->set_var('LANG_newwindow', $LANG_NEXMENU05[2]); $tpl->set_var('LANG_reference', $LANG_NEXMENU05[3]); $tpl->set_var('LANG_enabled', $LANG_NEXMENU05[4]); $tpl->set_var('LANG_disabled', $LANG_NEXMENU05[5]); $tpl->set_var('LANG_miloniclabel1', $LANG_NEXMENU05[7]); $tpl->set_var('LANG_miloniclabel2', $LANG_NEXMENU05[8]); $tpl->set_var('LANG_miloniclabel3', $LANG_NEXMENU05[9]); $tpl->set_var('LANG_miloniclabel4', $LANG_NEXMENU05[10]); $tpl->set_var('LANG_miloniclabel5', $LANG_NEXMENU05[12]); $tpl->set_var('LANG_miloniclabel6', $LANG_NEXMENU05[13]); $tpl->set_var('LANG_miloniclabel7', $LANG_NEXMENU05[14]); $tpl->set_var('LANG_milonichelp1', $LANG_NEXMENU05[11]); $tpl->set_var('LANG_csslabel1', $LANG_NEXMENU05[15]); $tpl->set_var('LANG_csslabel2', $LANG_NEXMENU05[16]); $tpl->set_var('LANG_csslabel3', $LANG_NEXMENU05[17]); $tpl->set_var('LANG_csslabel4', $LANG_NEXMENU05[18]); $tpl->set_var('LANG_csslabel5', $LANG_NEXMENU05[19]); $tpl->set_var('LANG_csslabel6', $LANG_NEXMENU05[20]); $tpl->set_var('LANG_csslabel7', $LANG_NEXMENU05[21]); $tpl->set_var('LANG_csslabel8', $LANG_NEXMENU05[22]); $tpl->set_var('LANG_csslabel9', $LANG_NEXMENU05[23]); $tpl->set_var('LANG_csslabel26', $LANG_NEXMENU05[26]); $tpl->set_var('LANG_csslabel27', $LANG_NEXMENU05[27]); $tpl->set_var('LANG_csslabel28', $LANG_NEXMENU05[28]); $tpl->set_var('LANG_csslabel29', $LANG_NEXMENU05[29]); $tpl->set_var('LANG_csslabel30', $LANG_NEXMENU05[30]); $tpl->set_var('LANG_csslabel31', $LANG_NEXMENU05[31]); $tpl->set_var('LANG_yes', $LANG_NEXMENU05[24]); $tpl->set_var('LANG_no', $LANG_NEXMENU05[25]); if ($A['multilanguage'] == 1) { $tpl->set_var('chk_langon', "CHECKED=checked"); } else { $tpl->set_var('chk_langoff', "CHECKED=checked"); } if ($A['targetfeatures'] == '') { $tpl->set_var('targetfeatures', 'width=800,height=600,left=50,top=50,scrollbars=yes;'); } else { $A['targetfeatures'] = str_replace('targetfeatures=', '', $A['targetfeatures']); $tpl->set_var('targetfeatures', $A['targetfeatures']); } if ($_GET['writecss'] == 1) { $tpl->set_var('chk_writecss_yes', 'CHECKED=checked'); } else { $tpl->set_var('chk_writecss_no', 'CHECKED=checked'); } $menustyles = ''; foreach ($CONF_NEXMENU['milonicstyles'] as $menustyle) { if ($A['blockmenu_style'] == $menustyle) { $menustyles .= '<option value="' . $menustyle . '" SELECTED=selected>' . $menustyle . '</option>'; } else { $menustyles .= '<option value="' . $menustyle . '">' . $menustyle . '</option>'; } } $tpl->set_var('style1_options', $menustyles); if ($A['header_style'] == 'Milonic') { $tpl->set_var('show_milonicstyles', ''); $tpl->set_var('show_cssmenucolors', 'none'); } else { $tpl->set_var('show_milonicstyles', 'none'); $tpl->set_var('show_cssmenucolors', ''); } $menustyles = ''; foreach ($CONF_NEXMENU['milonicstyles'] as $menustyle) { if ($A['blocksubmenu_style'] == $menustyle) { $menustyles .= '<option value="' . $menustyle . '" SELECTED=selected>' . $menustyle . '</option>'; } else { $menustyles .= '<option value="' . $menustyle . '">' . $menustyle . '</option>'; } } $tpl->set_var('style2_options', $menustyles); $menustyles = ''; foreach ($CONF_NEXMENU['milonicstyles'] as $menustyle) { if ($A['headermenu_style'] == $menustyle) { $menustyles .= '<option value="' . $menustyle . '" SELECTED=selected>' . $menustyle . '</option>'; } else { $menustyles .= '<option value="' . $menustyle . '">' . $menustyle . '</option>'; } } $tpl->set_var('style3_options', $menustyles); $menustyles = ''; foreach ($CONF_NEXMENU['milonicstyles'] as $menustyle) { if ($A['headersubmenu_style'] == $menustyle) { $menustyles .= '<option value="' . $menustyle . '" SELECTED=selected>' . $menustyle . '</option>'; } else { $menustyles .= '<option value="' . $menustyle . '">' . $menustyle . '</option>'; } } $tpl->set_var('style4_options', $menustyles); $tpl->set_var('LANG_CANCEL', $LANG_NEXMENU01['LANG_CANCEL']); $tpl->set_var('cancel_url', $_CONF['site_admin_url'] . '/plugins/nexmenu/index.php?op=display&id=' . $id . '&showdisabled=' . $inactive . '&menulocation=' . $menulocation); $tpl->set_var('LANG_SUBMIT', $LANG_NEXMENU01['LANG_UPDATE']); $tpl->parse('output', 'page'); return $tpl->finish($tpl->get_var('output')); }
/** * Helper function: Provide themes dropdown * * @return Array Array of (filename, displayname) pairs * * @note Beautifying code duplicated from usersettings.php * */ function configmanager_select_theme_helper() { $themes = array(); $themeFiles = COM_getThemes(true); usort($themeFiles, create_function('$a,$b', 'return strcasecmp($a,$b);')); foreach ($themeFiles as $theme) { $words = explode('_', $theme); $bwords = array(); foreach ($words as $th) { if (strtolower($th[0]) == $th[0] && strtolower($th[1]) == $th[1]) { $bwords[] = strtoupper($th[0]) . substr($th, 1); } else { $bwords[] = $th; } } $themes[implode(' ', $bwords)] = $theme; } return $themes; }
// Pop $T->var('child_categories') return array($num_total_items, $retval); } //===================================== // Main //===================================== // Retrieves vars $_GET = SITEMAP_stripslashes($_GET); $_POST = SITEMAP_stripslashes($_POST); $selected = 'all'; if (isset($_POST['type'])) { $selected = COM_applyFilter($_POST['type']); } // Decides templates to be used $theme = $_CONF['theme']; if (isset($_USER['theme']) and in_array($_USER['theme'], COM_getThemes())) { $theme = $_USER['theme']; } $template = $_CONF['path_themes'] . $theme . '/sitemap'; clearstatcache(); if (!is_file($template . '/index.thtml')) { $template = $_CONF['path'] . 'plugins/sitemap/templates'; } $T = new Template($template); // $T is a global object in this script $T->set_file(array('t_index' => 'index.thtml', 't_data_source' => 'data_source.thtml', 't_category_list' => 'category_list.thtml', 't_category' => 'category.thtml', 't_item_list' => 'item_list.thtml', 't_item' => 'item.thtml')); $T->set_var('xhtml', XHTML); // Collects data sources // $dataproxy is a global object in this script and functions.inc $dataproxy = Dataproxy::getInstance($uid); $disp_orders = array();
function phpblock_themetester() { global $PHP_SELF, $HTTP_USER_AGENT, $HTTP_POST_VARS, $HTTP_GET_VARS, $_TABLES, $_USER, $_CONF, $_THEME_TIMER, $REMOTE_ADDR; $thememode = $HTTP_GET_VARS['thememode']; if ($thememode == 'save') { $usetheme = $HTTP_GET_VARS['usetheme']; } else { $usetheme = $HTTP_POST_VARS['usetheme']; } if (empty($usetheme)) { if (isset($HTTP_COOKIE_VARS[$_CONF['cookie_theme']])) { $usetheme = $HTTP_COOKIE_VARS[$_CONF['cookie_theme']]; } else { if (!empty($_USER['theme'])) { $usetheme = $_USER['theme']; } else { $usetheme = $_CONF['theme']; } } } if ($_USER['uid'] > 1 and $thememode == 'save' and !empty($usetheme)) { $newtheme = addslashes(COM_applyFilter($usetheme)); DB_query("UPDATE {$_TABLES['users']} SET theme='{$newtheme}' WHERE uid = {$_USER['uid']}"); echo COM_refresh($PHP_SELF); } $themes = COM_getThemes(); if (count($themes) == 1) { return 'Sorry, only one theme installed.'; } usort($themes, create_function('$a,$b', 'return strcasecmp($a,$b);')); // Browser & Platform Check if (@eregi("(opera) ([0-9]{1,2}.[0-9]{1,3}){0,1}", $HTTP_USER_AGENT, $match) || @eregi("(opera/)([0-9]{1,2}.[0- 9]{1,3}){0,1}", $HTTP_USER_AGENT, $match)) { $BName = "Opera"; $BVersion = $match[2]; } elseif (eregi("(msie) ([0-9]{1,2}.[0-9]{1,3})", $HTTP_USER_AGENT, $match)) { $BName = "MSIE"; $BVersion = $match[2]; } elseif (eregi("(netscape6)/(6.[0-9]{1,3})", $HTTP_USER_AGENT, $match)) { $BName = "Netscape"; $BVersion = $match[2]; } elseif (eregi("mozilla/5", $HTTP_USER_AGENT)) { $BName = "Mozilla"; $BVersion = "Unknown"; } elseif (eregi("(mozilla)/([0-9]{1,2}.[0-9]{1,3})", $HTTP_USER_AGENT, $match)) { $BName = "Netscape "; $BVersion = $match[2]; } else { $BName = "Unknown"; $BVersion = "Unknown"; } $retval .= "Try out these Geeklog themes:<br>"; if ($BName == 'MSIE' || $BName == 'Opera' || $BName == 'Mozilla' || $BName == 'Safari') { $retval .= '<form action="' . $PHP_SELF . '" method="POST"><select name="usetheme" onchange="this.form.submit()">' . LB; $retval .= '<option value="">--</option>' . LB; for ($i = 1; $i <= count($themes); $i++) { $retval .= '<option value="' . current($themes) . '"'; if ($usetheme == current($themes)) { $retval .= ' selected="selected"'; } $th = str_replace('_', ' ', current($themes)); if (strtolower($th[0]) == $th[0] && strtolower($th[1]) == $th[1]) { $th = strtoupper($th[0]) . substr($th, 1); } $retval .= '>' . $th . '</option>' . LB; next($themes); } if ($_USER['uid'] > 1 && !empty($usetheme) && $usetheme != $_USER['theme']) { $args = 'thememode=save&usetheme=' . $usetheme; for ($i = 1; $i <= count($HTTP_GET_VARS); $i++) { if (key($HTTP_GET_VARS) != 'thememode' and key($HTTP_GET_VARS) != 'usetheme') { $args .= '&' . key($HTTP_GET_VARS) . '=' . urlencode(current($HTTP_GET_VARS)); } next($HTTP_GET_VARS); } $retval .= '</select></form>' . LB; $retval .= '<p>More themes can be found on our <a href="http://demo.geeklog.net/">demo site</a>.</p>'; $retval .= '<a href="' . $PHP_SELF . '?' . $args . '">save current selection</a>'; } else { $retval .= '</select></form>'; $retval .= '<p>More themes can be found on our <a href="http://demo.geeklog.net/">demo site</a>.</p>'; } } else { $retval .= '<form action="' . $PHP_SELF . '" method="POST"><select name="usetheme">' . LB; $retval .= '<option value="">--</option>' . LB; for ($i = 1; $i <= count($themes); $i++) { $retval .= '<option value="' . current($themes) . '"'; if ($usetheme == current($themes)) { $retval .= ' selected="selected"'; } $th = str_replace('_', ' ', current($themes)); if (strtolower($th[0]) == $th[0] && strtolower($th[1]) == $th[1]) { $th = strtoupper($th[0]) . substr($th, 1); } $retval .= '>' . $th . '</option>' . LB; next($themes); } if ($_USER['uid'] > 1 && !empty($usetheme) && $usetheme != $_USER['theme']) { $args = 'thememode=save&usetheme=' . $usetheme; for ($i = 1; $i <= count($HTTP_GET_VARS); $i++) { if (key($HTTP_GET_VARS) != 'thememode' and key($HTTP_GET_VARS) != 'usetheme') { $args .= '&' . key($HTTP_GET_VARS) . '=' . urlencode(current($HTTP_GET_VARS)); } next($HTTP_GET_VARS); } $retval .= '</select><input type="submit" value="go!"></form>' . LB; $retval .= '<p>More themes can be found on our <a href="http://demo.geeklog.net/">demo site</a>.</p>'; $retval .= '<a href="' . $PHP_SELF . '?' . $args . '">save current selection</a>' . LB; } else { $retval .= '</select><input type="submit" value="go!"></form>' . LB; $retval .= '<p>More themes can be found on our <a href="http://demo.geeklog.net/">demo site</a>.</p>'; } } return $retval; }
function editPreferences() { global $_CONF, $_TABLES, $LANG_ADMIN, $LANG04, $LANG28, $LANG_confignames, $LANG_configselects, $_IMAGE_TYPE; $retval = ''; $menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/user.php', 'text' => $LANG_ADMIN['admin_users']), array('url' => $_CONF['site_admin_url'] . '/user.php?edit=x', 'text' => $LANG_ADMIN['create_new']), array('url' => $_CONF['site_admin_url'] . '/user.php?import=x', 'text' => $LANG28[23]), array('url' => $_CONF['site_admin_url'] . '/user.php?batchadmin=x', 'text' => $LANG28[54]), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home'])); $T = new Template($_CONF['path_layout'] . 'admin/user/'); $T->set_file('editor', 'prefeditor.thtml'); $T->set_var(array('lang_save' => $LANG_ADMIN['save'], 'lang_cancel' => $LANG_ADMIN['cancel'], 'lang_language' => $LANG04[73], 'lang_theme' => $LANG04[72], 'lang_cooktime' => $LANG04[68], 'lang_noicons' => $LANG04[40], 'lang_noboxes' => $LANG04[44], 'lang_maxstories' => $LANG04[43], 'lang_timezone' => $LANG04[158], 'lang_dateformat' => $LANG04[42], 'lang_search_format' => $LANG_confignames['Core']['search_show_type'], 'lang_displaymode' => $LANG28[97], 'lang_sortorder' => $LANG28[98], 'lang_commentlimit' => $LANG04[59], 'lang_emailfromadmin' => $LANG04[100], 'lang_emailfromuser' => $LANG04[102], 'lang_showonline' => $LANG04[104], 'lang_confirm' => $LANG28[91], 'lang_attribute' => $LANG28[92], 'lang_value' => $LANG28[93], 'lang_selected' => $LANG28[94])); // Get available languages $language = MBYTE_languageList($_CONF['default_charset']); // build language select $selection = '<select id="language" name="language">' . LB; foreach ($language as $langFile => $langName) { $selection .= '<option value="' . $langFile . '"'; if ($langFile == $_CONF['language']) { $selection .= ' selected="selected"'; } $selection .= '>' . $langName . '</option>' . LB; } $selection .= '</select>'; $T->set_var('language_selector', $selection); if ($_CONF['allow_user_themes'] == 1) { $selection = '<select id="theme" name="theme">' . LB; $usertheme = $_CONF['theme']; $themeFiles = COM_getThemes(); usort($themeFiles, create_function('$a,$b', 'return strcasecmp($a,$b);')); foreach ($themeFiles as $theme) { $selection .= '<option value="' . $theme . '"'; if ($usertheme == $theme) { $selection .= ' selected="selected"'; } $words = explode('_', $theme); $bwords = array(); foreach ($words as $th) { if (strtolower($th[0]) == $th[0] && strtolower($th[1]) == $th[1]) { $bwords[] = strtoupper($th[0]) . substr($th, 1); } else { $bwords[] = $th; } } $selection .= '>' . implode(' ', $bwords) . '</option>' . LB; } $selection .= '</select>'; $T->set_var('theme_selector', $selection); } else { $T->set_var('theme_selector', $_CONF['theme']); } $selection = '<select id="cooktime" name="cooktime">' . LB; $selection .= COM_optionList($_TABLES['cookiecodes'], 'cc_value,cc_descr', 2678400, 0); $selection .= '</select>'; $T->set_var('cooktime_selector', $selection); $selection = Date::getTimeZoneDropDown($_CONF['timezone'], array('id' => 'tzid', 'name' => 'tzid')); $T->set_var('timezone_selector', $selection); $selection = '<select id="dfid" name="dfid">' . LB . COM_optionList($_TABLES['dateformats'], 'dfid,description', 0) . '</select>'; $T->set_var('dateformat_selector', $selection); $search_result_select = '<select name="search_result_format" id="search_result_format">' . LB; foreach ($LANG_configselects['Core'][18] as $name => $type) { $search_result_select .= '<option value="' . $type . '"' . ('google' == $type ? 'selected="selected"' : '') . '>' . $name . '</option>' . LB; } $search_result_select .= '</select>'; $T->set_var('search_result_select', $search_result_select); $selection = '<select id="commentmode" name="commentmode">'; $selection .= COM_optionList($_TABLES['commentmodes'], 'mode,name', $_CONF['comment_mode']); $selection .= '</select>'; $T->set_var('displaymode_selector', $selection); $selection = '<select id="commentorder" name="commentorder">'; $selection .= COM_optionList($_TABLES['sortcodes'], 'code,name', 0); $selection .= '</select>'; $T->set_var('sortorder_selector', $selection); $T->set_var('gltoken_name', CSRF_TOKEN); $T->set_var('gltoken', SEC_createToken()); $retval .= COM_startBlock($LANG28[95], '', COM_getBlockTemplate('_admin_block', 'header')); $retval .= ADMIN_createMenu($menu_arr, $LANG28[96], $_CONF['layout_url'] . '/images/icons/user.' . $_IMAGE_TYPE); $retval .= $T->finish($T->parse('output', 'editor')); $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')); return $retval; }
/** * Returns an array of available themes */ function THEMETESTER_getThemes() { global $_PLUGINS; // Themes created by glfusion (was: gllabs) $gllabs_themes = array('chameleon', 'nouveau'); $retval = array(); $themes = COM_getThemes(); foreach ($themes as $theme) { if (defined('THEMETESTER_IGNORE_GLFUSION') and THEMETESTER_IGNORE_GLFUSION != FALSE) { if (in_array($theme, $gllabs_themes)) { continue; } } else { if ($theme === 'chameleon' and !in_array($theme, $_PLUGINS)) { continue; } } /** * Don't include mobile themes */ if (preg_match("/(mobile|touch2?)/i", $theme)) { continue; } $retval[] = $theme; } return $retval; }