mirror of
https://github.com/e107inc/e107.git
synced 2025-08-20 21:32:09 +02:00
Renamed plugin 'user_menu' to 'user'
This commit is contained in:
31
e107_plugins/user/languages/English.php
Normal file
31
e107_plugins/user/languages/English.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/user_menu/languages/English.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
define('UTHEME_MENU_L1', 'Set');
|
||||
define('UTHEME_MENU_L2', 'Select Language');
|
||||
define('UTHEME_MENU_L3', 'tables');
|
||||
|
||||
define('LAN_UMENU_THEME_1', 'Set Theme');
|
||||
define('LAN_UMENU_THEME_2', 'Select Theme');
|
||||
define('LAN_UMENU_THEME_3', 'users:');
|
||||
define('LAN_UMENU_THEME_4', 'Enable those themes which users may select');
|
||||
define('LAN_UMENU_THEME_5', 'Update');
|
||||
define('LAN_UMENU_THEME_6', 'Themes available to users');
|
||||
define('LAN_UMENU_THEME_7', 'Class which can select themes');
|
||||
define('LAN_UMENU_THEME_8', 'Allowed themes: ');
|
||||
define('LAN_UMENU_THEME_9', 'Class which can select themes: ');
|
||||
|
||||
?>
|
68
e107_plugins/user/userlanguage_menu.php
Normal file
68
e107_plugins/user/userlanguage_menu.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/user_menu/userlanguage_menu.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
//TODO homogenisation with languagelinks + do not force www + unobtrusive redirect
|
||||
if ( ! defined('e107_INIT')) { exit(); }
|
||||
|
||||
require_once(e_HANDLER.'language_class.php');
|
||||
$slng = new language;
|
||||
|
||||
$languageList = explode(',', e_LANLIST);
|
||||
sort($languageList);
|
||||
|
||||
if(varset($pref['multilanguage_subdomain']))
|
||||
{
|
||||
$action = (e_QUERY) ? e_SELF.'?'.e_QUERY : e_SELF;
|
||||
$text = '
|
||||
<div style="text-align:center">
|
||||
<select class="tbox" name="lang_select" style="width:95%" onchange="location.href=this.options[selectedIndex].value">';
|
||||
foreach($languageList as $languageFolder)
|
||||
{
|
||||
$selected = ($languageFolder == e_LANGUAGE) ? ' selected="selected"' : '';
|
||||
$urlval = $slng->subdomainUrl($languageFolder);
|
||||
$text .= '
|
||||
<option value="'.$urlval.'"'.$selected.'>'.$languageFolder.'</option>';
|
||||
}
|
||||
$text .= '
|
||||
</select>
|
||||
</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
//FIXME may not work with session
|
||||
$action = (e_QUERY && ! $_GET['elan']) ? e_SELF.'?'.e_QUERY : e_SELF;
|
||||
$text = '
|
||||
<form method="post" action="'.$action.'">
|
||||
<div class="center">
|
||||
<select name="sitelanguage" class="tbox">';
|
||||
foreach($languageList as $languageFolder)
|
||||
{
|
||||
$selected = ($languageFolder == e_LANGUAGE) ? ' selected="selected"' : '';
|
||||
$text .= '
|
||||
<option value="'.$languageFolder.'"'.$selected.'>'.$languageFolder.'</option>';
|
||||
}
|
||||
|
||||
$text .= '
|
||||
</select>
|
||||
<br />
|
||||
<br />
|
||||
<button class="btn button" type="submit" name="setlanguage" value="no-value"><span>'.UTHEME_MENU_L1.'</span></button>';
|
||||
$text .= '
|
||||
</div>
|
||||
</form>';
|
||||
}
|
||||
|
||||
$ns->tablerender(UTHEME_MENU_L2, $text, 'user_lan');
|
||||
|
77
e107_plugins/user/usertheme_menu.php
Normal file
77
e107_plugins/user/usertheme_menu.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
global $pref, $eArrayStorage;
|
||||
|
||||
if ((USER == TRUE) && check_class(varset($pref['allow_theme_select'],FALSE)))
|
||||
{
|
||||
|
||||
$allThemes = TRUE;
|
||||
if (isset($pref['allowed_themes']))
|
||||
{
|
||||
$allThemes = FALSE;
|
||||
$themeList = explode(',',$pref['allowed_themes']);
|
||||
}
|
||||
$handle = opendir(e_THEME);
|
||||
while ($file = readdir($handle))
|
||||
{
|
||||
if ($file != "." && $file != ".." && $file != "templates" && $file != "" && $file != "CVS")
|
||||
{
|
||||
if (is_readable(e_THEME.$file."/theme.php") /*&& is_readable(e_THEME.$file."/style.css")*/ && ($allThemes || in_Array($file, $themeList)))
|
||||
{
|
||||
$themelist[] = $file;
|
||||
$themecount[$file] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
if (count($themelist))
|
||||
{
|
||||
$defaulttheme = $pref['sitetheme'];
|
||||
$count = 0;
|
||||
|
||||
$totalct = $sql->select("user", "user_prefs", "user_prefs REGEXP('sitetheme') ");
|
||||
|
||||
while ($row = $sql->fetch())
|
||||
{
|
||||
$up = (substr($row['user_prefs'],0,5) == "array") ? $eArrayStorage->ReadArray($row['user_prefs']) : unserialize($row['user_prefs']);
|
||||
|
||||
if (isset($themecount[$up['sitetheme']])) { $themecount[$up['sitetheme']]++; }
|
||||
}
|
||||
|
||||
$defaultusers = $sql->count("user") - $totalct;
|
||||
$themecount[$defaulttheme] += $defaultusers;
|
||||
|
||||
$text = "<form method='post' action='".e_SELF."'>
|
||||
<div style='text-align:center'>
|
||||
<select name='sitetheme' class='tbox' style='width: 95%;'>";
|
||||
$counter = 0;
|
||||
|
||||
while (isset($themelist[$counter]) && $themelist[$counter])
|
||||
{
|
||||
$text .= "<option value='".$themelist[$counter]."' ";
|
||||
if (($themelist[$counter] == USERTHEME) || (USERTHEME == FALSE && $themelist[$counter] == $defaulttheme))
|
||||
{
|
||||
$text .= "selected='selected'";
|
||||
}
|
||||
$text .= ">".($themelist[$counter] == $defaulttheme ? "[ ".$themelist[$counter]." ]" : $themelist[$counter]).' ('.LAN_UMENU_THEME_3.' '.$themecount[$themelist[$counter]].")</option>\n";
|
||||
$counter++;
|
||||
}
|
||||
$text .= "</select>
|
||||
<br /><br />
|
||||
<input class='btn button' type='submit' name='settheme' value='".LAN_UMENU_THEME_1."' />
|
||||
</div></form>";
|
||||
|
||||
$ns->tablerender(LAN_UMENU_THEME_2, $text, 'usertheme');
|
||||
}
|
||||
}
|
||||
?>
|
129
e107_plugins/user/usertheme_menu_config.php
Normal file
129
e107_plugins/user/usertheme_menu_config.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
$eplug_admin = TRUE;
|
||||
require_once("../../class2.php");
|
||||
include_lan(e_PLUGIN."user_menu/languages/".e_LANGUAGE.".php");
|
||||
|
||||
require_once(e_HANDLER.'userclass_class.php');
|
||||
global $e_userclass;
|
||||
if (!is_object($e_userclass)) $e_userclass = new user_class;
|
||||
|
||||
if (!getperms("2")) // Same permissions as menu configuration
|
||||
{
|
||||
header("location:".e_BASE."index.php");
|
||||
exit ;
|
||||
}
|
||||
|
||||
require_once(e_ADMIN."auth.php");
|
||||
|
||||
$frm = e107::getForm();
|
||||
|
||||
// Get the list of available themes
|
||||
$handle = opendir(e_THEME);
|
||||
while ($file = readdir($handle))
|
||||
{
|
||||
if ($file != "." && $file != ".." && $file != "templates" && $file != "" && $file != "CVS")
|
||||
{
|
||||
if (is_readable(e_THEME.$file."/theme.php") /*&& is_readable(e_THEME.$file."/style.css")*/)
|
||||
{
|
||||
$themeOptions[] = $file;
|
||||
$themeCount[$file] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
|
||||
if (isset($_POST['update_theme']))
|
||||
{
|
||||
$tmp = array();
|
||||
foreach($_POST as $key => $value)
|
||||
{
|
||||
if (substr($key,0,6) == 'theme_')
|
||||
{
|
||||
$tmp[] = $value;
|
||||
}
|
||||
}
|
||||
$newThemes = implode(',',$tmp);
|
||||
$themeeditclass = intval($_POST['themeeditclass']);
|
||||
if (($newThemes != $pref['allowed_themes']) || ($themeeditclass != $pref['allow_theme_select']))
|
||||
{
|
||||
$pref['allowed_themes'] = $newThemes;
|
||||
$pref['allow_theme_select'] = $themeeditclass;
|
||||
save_prefs();
|
||||
$woffle = LAN_UMENU_THEME_8.$pref['allowed_themes'].'[!br!]'.LAN_UMENU_THEME_9.$pref['allow_theme_select'];
|
||||
$admin_log->log_event('UTHEME_01',$woffle,E_LOG_INFORMATIVE,'');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($pref['allowed_themes']))
|
||||
{
|
||||
$allThemes = FALSE;
|
||||
$themeList = explode(',',$pref['allowed_themes']);
|
||||
}
|
||||
|
||||
$themeeditclass = varset($pref['allow_theme_select'],e_UC_NOBODY);
|
||||
|
||||
$text = "
|
||||
<form method='post' action='".e_SELF."' id='menu_conf_form'>
|
||||
<fieldset id='core-user_menu-usertheme'>
|
||||
<legend class='e-hideme'>".LAN_UMENU_THEME_6."</legend>
|
||||
<table class='table adminlist'>
|
||||
<colgroup span='2'>
|
||||
<col style='width: 50%' />
|
||||
<col style='width: 50%' />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan='2'>".LAN_UMENU_THEME_4."</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>";
|
||||
|
||||
foreach ($themeOptions as $th)
|
||||
{
|
||||
$ch = (in_array($th, $themeList) ? " checked='checked'" : '');
|
||||
$text .= "
|
||||
<tr>
|
||||
<td>{$th}</td>
|
||||
<td><input class='tbox' type='checkbox' name='theme_{$th}' value='{$th}' {$ch} /></td>
|
||||
</tr>";
|
||||
}
|
||||
$text .= "
|
||||
<tr>
|
||||
<td>".LAN_UMENU_THEME_7."</td>
|
||||
<td>".$e_userclass->uc_dropdown("themeeditclass", $themeeditclass, "main,member,admin,classes,matchclass,nobody")."</td>
|
||||
</tr>";
|
||||
|
||||
$text .= "
|
||||
</tbody>
|
||||
</table>
|
||||
<div class='buttons-bar center'>
|
||||
".$frm->admin_button('update_theme', LAN_UPDATE, 'update')."
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
";
|
||||
$mes = e107::getMessage();
|
||||
|
||||
$ns->tablerender(LAN_UMENU_THEME_6,$mes->render().$text);
|
||||
|
||||
require_once(e_ADMIN."footer.php");
|
||||
|
||||
/*
|
||||
function headerjs()
|
||||
{
|
||||
return "<script type='text/javascript' src='".e_FILE_ABS."jslib/core/admin.js'></script>";
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
?>
|
Reference in New Issue
Block a user