1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Moving user rank configuration to admin->users, away from forum. Just started, not finished.

This commit is contained in:
mcfly 2008-12-22 03:15:04 +00:00
parent 8a029059fa
commit 7e2f8dca18
5 changed files with 797 additions and 702 deletions

View File

@ -1,20 +1,18 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/class2.php,v $
| $Revision: 1.89 $
| $Date: 2008-12-21 22:29:38 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* General purpose file
*
* $Source: /cvs_backup/e107_0.8/class2.php,v $
* $Revision: 1.90 $
* $Date: 2008-12-22 03:15:04 $
* $Author: mcfly_e107 $
*
*/
//
// *** Code sequence for startup ***
@ -1232,8 +1230,8 @@ function get_user_data($uid, $extra = '')
}
$qry = "
SELECT u.*, ue.* FROM #user AS u
LEFT JOIN #user_extended AS ue ON ue.user_extended_id = u.user_id
SELECT u.*, ue.* FROM `#user` AS u
LEFT JOIN `#user_extended` AS ue ON ue.user_extended_id = u.user_id
WHERE u.user_id = {$uid} {$extra}
";
if (!$e107->sql->db_Select_gen($qry))
@ -1246,38 +1244,35 @@ function get_user_data($uid, $extra = '')
}
$var = $e107->sql->db_Fetch(MYSQL_ASSOC);
if(!$extended_struct = getcachedvars('extended_struct'))
if(!$e107->extended_struct = getcachedvars('extended_struct'))
{
if($tmp = $e107->ecache->retrieve_sys('nomd5_extended_struct'))
{
$extended_struct = $e107->arrayStorage->ReadArray($tmp);
$e107->extended_struct = $e107->arrayStorage->ReadArray($tmp);
}
else
{
$qry = 'SHOW COLUMNS FROM #user_extended ';
$qry = 'SHOW COLUMNS FROM `#user_extended` ';
if($e107->sql->db_Select_gen($qry))
{
while($row = $e107->sql->db_Fetch())
{
if($row['Default'] != '')
{
$extended_struct[] = $row;
$e107->extended_struct[] = $row;
}
}
}
$tmp = $e107->arrayStorage->WriteArray($extended_struct, false);
$tmp = $e107->arrayStorage->WriteArray($e107->extended_struct, false);
$e107->ecache->set_sys('nomd5_extended_struct', $tmp);
unset($tmp);
}
if(isset($extended_struct))
if(isset($e107->extended_struct))
{
cachevars('extended_struct', $extended_struct);
cachevars('extended_struct', $e107->extended_struct);
}
}
if(isset($extended_struct) && is_array($extended_struct))
if(isset($e107->extended_struct) && is_array($e107->extended_struct))
{
foreach($extended_struct as $row)
foreach($e107->extended_struct as $row)
{
if($row['Default'] != '' && ($var[$row['Field']] == NULL || $var[$row['Field']] == '' ))
{
@ -1292,7 +1287,7 @@ function get_user_data($uid, $extra = '')
//===========================================================
cachevars('userdata_{$uid}', $var);
cachevars("userdata_{$uid}", $var);
return $var;
}
@ -1326,7 +1321,7 @@ function save_prefs($table = 'core', $uid = USERID, $row_val = '')
{
$_user_pref = $tp -> toDB($user_pref);
$tmp=addslashes(serialize($_user_pref));
$sql->db_Update("user", "user_prefs='$tmp' WHERE user_id=".intval($uid));
$sql->db_Update('user', "user_prefs='$tmp' WHERE user_id=".intval($uid));
return $tmp;
}
}
@ -1419,7 +1414,7 @@ function init_session()
}
else
{
list($uid, $upw)= explode(".", $cli_log);
list($uid, $upw)= explode('.', $cli_log);
}
if (empty($uid) || empty($upw))
@ -1536,7 +1531,7 @@ function cookie($name, $value, $expire=0, $path = '/', $domain = '', $secure = 0
function session_set($name, $value, $expire='', $path = '/', $domain = '', $secure = 0)
{
global $pref;
if ($pref['user_tracking'] == "session")
if ($pref['user_tracking'] == 'session')
{
$_SESSION[$name] = $value;
}
@ -1586,7 +1581,7 @@ function defsettrue($str,$default='')
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
function message_handler($mode, $message, $line = 0, $file = "")
function message_handler($mode, $message, $line = 0, $file = '')
{
e107_require_once(e_HANDLER.'message_handler.php');
show_emessage($mode, $message, $line, $file);
@ -1824,7 +1819,7 @@ function force_userupdate()
{
global $sql,$pref,$currentUser;
if (e_PAGE == "usersettings.php" || strpos(e_SELF, ADMINDIR) == TRUE || (defined("FORCE_USERUPDATE") && (FORCE_USERUPDATE == FALSE)))
if (e_PAGE == 'usersettings.php' || strpos(e_SELF, ADMINDIR) == TRUE || (defined("FORCE_USERUPDATE") && (FORCE_USERUPDATE == FALSE)))
{
return FALSE;
}
@ -1841,7 +1836,7 @@ function force_userupdate()
if (!varset($pref['disable_emailcheck'],TRUE) && !trim($currentUser['user_email'])) return TRUE;
if($sql -> db_Select("user_extended_struct", "user_extended_struct_name, user_extended_struct_type", "user_extended_struct_required = '1'"))
if($sql -> db_Select('user_extended_struct', 'user_extended_struct_name, user_extended_struct_type', 'user_extended_struct_required = 1'))
{
while($row = $sql -> db_Fetch())
{
@ -1873,7 +1868,6 @@ class error_handler
error_reporting(E_ALL);
return;
}
if(isset($_E107['cli']))
{
error_reporting(E_ALL ^ E_NOTICE);

View File

@ -9,37 +9,37 @@
* Administration Area - Users
*
* $Source: /cvs_backup/e107_0.8/e107_admin/users.php,v $
* $Revision: 1.20 $
* $Date: 2008-12-21 22:17:05 $
* $Author: e107steved $
* $Revision: 1.21 $
* $Date: 2008-12-22 03:15:04 $
* $Author: mcfly_e107 $
*
*/
require_once("../class2.php");
require_once('../class2.php');
if (!getperms("4"))
if (!getperms('4'))
{
header("location:".e_BASE."index.php");
header('location:'.$e107->url->getUrl('core:core', 'main', 'action=index'));
exit;
}
if (isset($_POST['useraction']) && $_POST['useraction'] == 'userinfo')
{
header('location:'.e_ADMIN."userinfo.php?".$tp -> toDB($_POST['userip']));
header('location:'.e_ADMIN."userinfo.php?".$e107->tp->toDB($_POST['userip']));
exit;
}
if (isset($_POST['useraction']) && $_POST['useraction'] == 'usersettings')
{
header('location:'.e_BASE."usersettings.php?".$tp -> toDB($_POST['userid']));
header('location:'. $e107->url->getUrl('core:user', 'main', 'func=settings&id='.(int)$_POST['userid']));
exit;
}
if (isset($_POST['useraction']) && $_POST['useraction'] == 'userclass')
{
header('location:'.e_ADMIN."userclass.php?".$tp -> toDB($_POST['userid'].".".e_QUERY));
header('location:'.e_ADMIN.'userclass.php?'.$e107->tp->toDB($_POST['userid'].'.'.e_QUERY));
exit;
}
@ -60,7 +60,7 @@ $rs = new form;
if (e_QUERY)
{
$tmp = explode(".", e_QUERY);
$tmp = explode('.', e_QUERY);
$action = $tmp[0];
$sub_action = varset($tmp[1],'');
$id = varset($tmp[2],0);
@ -71,6 +71,10 @@ if (e_QUERY)
$from = varset($from, 0);
$amount = 30;
if($action == 'ranks')
{
show_ranks();
}
// ------- Check for Bounces --------------
$bounce_act = '';
@ -168,9 +172,9 @@ if (isset($_POST['update_options']))
// ------- Prune Users. --------------
if (isset($_POST['prune']))
{
$e107cache->clear("online_menu_member_total");
$e107cache->clear("online_menu_member_newest");
$text = USRLAN_56." ";
$e107cache->clear('online_menu_member_total');
$e107cache->clear('online_menu_member_newest');
$text = USRLAN_56.' ';
$bantype = $_POST['prune_type'];
if ($sql->db_Select("user", "user_id, user_name", "user_ban= {$bantype}"))
{
@ -592,7 +596,8 @@ class users
function show_existing_users($action, $sub_action, $id, $from, $amount)
{
global $sql, $rs, $ns, $tp, $mySQLdefaultdb,$pref,$unverified, $userMethods, $e107;
global $sql, $rs, $ns, $tp, $mySQLdefaultdb,$pref,$unverified, $userMethods;
$e107 = e107::getInstance();
// save the display choices.
if(isset($_POST['searchdisp']))
{
@ -602,11 +607,11 @@ class users
if(!$pref['admin_user_disp'])
{
$search_display = array("user_name","user_class");
$search_display = array('user_name', 'user_class');
}
else
{
$search_display = explode("|",$pref['admin_user_disp']);
$search_display = explode('|', $pref['admin_user_disp']);
}
$text = "<div style='text-align:center'>";
@ -614,7 +619,7 @@ class users
if (isset($_POST['searchquery']) && $_POST['searchquery'] != "")
{
$_POST['searchquery'] = $tp->toDB(trim($_POST['searchquery']));
$query = "WHERE ".
$query = 'WHERE '.
$query .= (strpos($_POST['searchquery'], "@") !== FALSE) ? "user_email REGEXP('".$_POST['searchquery']."') OR ": "";
$query .= (strpos($_POST['searchquery'], ".") !== FALSE) ? "user_ip REGEXP('".$_POST['searchquery']."') OR ": "";
foreach($search_display as $disp)
@ -625,22 +630,22 @@ class users
$query .= "user_name REGEXP('".$_POST['searchquery']."') ";
if($action == 'unverified')
{
$query .= " AND user_ban = 2 ";
$query .= ' AND user_ban = 2 ';
}
$query .= " ORDER BY user_id";
$query .= ' ORDER BY user_id';
}
else
{
$query = "";
$query = '';
if($action == 'unverified')
{
$query = "WHERE user_ban = 2 ";
$query = 'WHERE user_ban = 2 ';
}
$query .= "ORDER BY ".($sub_action ? $sub_action : "user_id")." ".($id ? $id : "DESC")." LIMIT $from, $amount";
$query .= 'ORDER BY '.($sub_action ? $sub_action : 'user_id').' '.($id ? $id : 'DESC')." LIMIT $from, $amount";
}
// $user_total = db_Count($table, $fields = '(*)',
$qry_insert = "SELECT u.*, ue.* FROM #user AS u LEFT JOIN #user_extended AS ue ON ue.user_extended_id = u.user_id ";
$qry_insert = 'SELECT u.*, ue.* FROM `#user` AS u LEFT JOIN `#user_extended` AS ue ON ue.user_extended_id = u.user_id ';
if ($user_total = $sql->db_Select_gen($qry_insert. $query))
{
@ -727,19 +732,19 @@ class users
}
elseif (in_array($disp,$boleanfields))
{
$text .= ($row[$disp]) ? ADMIN_TRUE_ICON : "";
$text .= ($row[$disp]) ? ADMIN_TRUE_ICON : '';
}
elseif(in_array($disp,$datefields))
{
$text .= ($row[$disp]) ? strftime($pref['shortdate'],$row[$disp])."&nbsp;" : "&nbsp";
$text .= ($row[$disp]) ? strftime($pref['shortdate'],$row[$disp]).'&nbsp;' : '&nbsp';
}
elseif($disp == "user_name")
elseif($disp == 'user_name')
{
$text .= "<a href='".e_BASE."user.php?id.{$row['user_id']}'>{$row['user_name']}</a>";
$text .= "<a href='".$e107->url->getUrl('core:user', 'main', 'func=profile&id='$row['user_id'])."'>{$row['user_name']}</a>";
}
else
{
$text .= $row[$disp]."&nbsp;";
$text .= $row[$disp].'&nbsp;';
}
if(!in_array($disp,$boleanfields) && isset($prev[$disp]) && $row[$disp] == $prev[$disp] && $prev[$disp] != "")
{ // show matches
@ -900,29 +905,32 @@ class users
{
global $unverified;
// ##### Display options
if ($action == "")
if ($action == '')
{
$action = "main";
$action = 'main';
}
// ##### Display options
$var['main']['text'] = USRLAN_71;
$var['main']['link'] = e_SELF;
$var['create']['text'] = USRLAN_72;
$var['create']['link'] = e_SELF."?create";
$var['create']['link'] = e_SELF.'?create';
$var['prune']['text'] = USRLAN_73;
$var['prune']['link'] = e_SELF."?prune";
$var['prune']['link'] = e_SELF.'?prune';
$var['options']['text'] = LAN_OPTIONS;
$var['options']['link'] = e_SELF."?options";
$var['options']['link'] = e_SELF.'?options';
if($unverified)
{
$var['unveri']['text'] = USRLAN_138." ($unverified)";
$var['unveri']['link'] = e_SELF."?unverified";
$var['unveri']['link'] = e_SELF.'?unverified';
}
$var['rank']['text'] = USRLAN_196;
$var['rank']['link'] = e_SELF.'?ranks';
// $var['mailing']['text']= USRLAN_121;
// $var['mailing']['link']="mailout.php";
show_admin_menu(USRLAN_76, $action, $var);
@ -1153,15 +1161,15 @@ class users
function resend($id, $key, $name, $email, $lfile='')
{
global $sql,$mailheader_e107id, $admin_log;
$id = (int)$id;
// Check for a Language field, and if present, send the email in the user's language.
if($lfile == "")
{
if($sql -> db_Select("user_extended", "user_language", "user_extended_id = '$id'"))
if($sql -> db_Select('user_extended', 'user_language', 'user_extended_id = '.$id))
{
$row = $sql -> db_Fetch();
$lfile = e_LANGUAGEDIR.$row['user_language']."/lan_signup.php";
$lfile = e_LANGUAGEDIR.$row['user_language'].'/lan_signup.php';
}
}
if(is_readable($lfile))
@ -1204,13 +1212,13 @@ class users
$pause_amount = ($pref['mail_pause']) ? $pref['mail_pause'] : 10;
$pause_time = ($pref['mail_pausetime']) ? $pref['mail_pausetime'] : 1;
if($sql -> db_Select_gen("SELECT user_language FROM #user_extended LIMIT 1"))
if($sql -> db_Select_gen('SELECT user_language FROM `#user_extended` LIMIT 1'))
{
$query = "SELECT u.*, ue.* FROM #user AS u LEFT JOIN #user_extended AS ue ON ue.user_extended_id = u.user_id WHERE u.user_ban = 2 ORDER BY u.user_id DESC";
$query = "SELECT u.*, ue.* FROM `#user` AS u LEFT JOIN `#user_extended` AS ue ON ue.user_extended_id = u.user_id WHERE u.user_ban = 2 ORDER BY u.user_id DESC";
}
else
{
$query = "SELECT * FROM #user WHERE user_ban='2'";
$query = 'SELECT * FROM `#user` WHERE user_ban=2';
}
if(!is_object($sql3))
@ -1253,9 +1261,9 @@ class users
function check_bounces($bounce_act='first_check', $bounce_arr = '')
{
global $sql,$pref;
include(e_HANDLER."pop3_class.php");
include(e_HANDLER.'pop3_class.php');
if (!trim($bounce_act)) $bounce_act='first_check';
if (!trim($bounce_act)) { $bounce_act='first_check'; }
// echo "Check bounces. Action: {$bounce_act}; Entries: {$bounce_arr}<br />";
@ -1280,7 +1288,7 @@ class users
$head=$obj->getHeaders($i);
if($head['bounce'])
{
if (preg_match("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $obj->getBody($i), $result)) $usr_email = trim($result[0]);
if (preg_match("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $obj->getBody($i), $result)) { $usr_email = trim($result[0]); }
if ($sql->db_Select('user','user_id, user_name, user_email',"user_email='".$usr_email."' "))
{
$row = $sql->db_Fetch();
@ -1393,8 +1401,8 @@ class users
array_unique($id);
array_unique($emails);
$all_ids = implode(",",$id);
$all_emails = implode(",",$emails);
$all_ids = implode(',',$id);
$all_emails = implode(',',$emails);
$obj->close_mailbox(); // This will actually delete emails
@ -1404,7 +1412,7 @@ class users
// Update bounce status for users
$ed = $sql -> db_Update("user", "user_ban=3 WHERE (`user_id` IN (".$all_ids.") OR `user_email` IN (".$all_emails.")) AND user_sess !='' ");
$ed = $sql -> db_Update('user', "user_ban=3 WHERE (`user_id` IN (".$all_ids.") OR `user_email` IN (".$all_emails.")) AND user_sess !='' ");
if (!$ed) $ed = '0';
$this->show_message(str_replace(array('{TOTAL}','{DELCOUNT}','{DELUSER}','{FOUND}'),
array($tot,$del_count,$ed,$found),USRLAN_155).$text);
@ -1419,4 +1427,84 @@ function users_adminmenu()
global $action;
$user->show_options($action);
}
function show_ranks()
{
$e107 = e107::getInstance();
$fieldList = array('core' => array(), 'extended' => array());
foreach($e107->extended_struct as $field)
{
if(strpos($field['Type'], 'int') !== false && $field['Field'] != 'user_extended_id')
{
$fieldList['extended'][] = substr($field['Field'], 5);
}
}
$text .= "
<table style='".ADMIN_WIDTH."'>
<tr>
<td class='label' colspan='3' style='text-align:center'>Core fields</td>
</tr>
<tr>
<td class='label'>Field Name</td>
<td class='control'>Operation</td>
<td class='control'>Value</td>
</tr>
";
foreach($fieldList['core'] as $f)
{
$text .= "
<tr>
<td class='label'>{$f}</td>
<td class='control'><input type='text' class='tbox' name='op_{$f}' size='3' maxlength='3'></td>
<td class='control'><input type='text' class='tbox' name='val_{$f}' size='3' maxlength='3'></td>
</tr>
";
}
if(count($fieldList['extended']))
{
$text .= "
<table style='".ADMIN_WIDTH."'>
<tr>
<td class='label' colspan='3' style='text-align:center'>Extended fields</td>
</tr>
<tr>
<td class='label'>Field Name</td>
<td class='control'>Operation</td>
<td class='control'>Value</td>
</tr>
";
foreach($fieldList['extended'] as $f)
{
$text .= "
<tr>
<td class='label'>{$f}</td>
<td class='control'><input type='text' class='tbox' name='op_{$f}' size='3' maxlength='3'></td>
<td class='control'><input type='text' class='tbox' name='val_{$f}' size='3' maxlength='3'></td>
</tr>
";
}
}
$text .= '</table>';
$e107->ns->tablerender('Rank Calculation fields', $text);
$text = "
<table style='".ADMIN_WIDTH."'>
<tr>
<td class='label'>Rank Name</td>
<td class='control'>Lower Threshold</td>
<td class='control'>Rank Image</td>
</tr>
</table>
";
$e107->ns->tablerender('Ranks', $text);
// var_dump($fieldList);
include(e_ADMIN.'footer.php');
exit;
}
?>

View File

@ -1,11 +1,11 @@
<?php
/*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: main.php,v 1.1 2008-12-15 00:29:20 mcfly_e107 Exp $
* $Id: main.php,v 1.2 2008-12-22 03:15:04 mcfly_e107 Exp $
*
* eURL configuration script
*/
function url_core_main($parms)
{
switch ($parms['action'])

View File

@ -1,4 +1,10 @@
<?php
/*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: main.php,v 1.3 2008-12-22 03:15:04 mcfly_e107 Exp $
*
* eURL configuration script
*/
function url_user_main($parms)
{
@ -7,6 +13,11 @@ function url_user_main($parms)
case 'profile':
return e_HTTP.'user.php?id.'.$parms['id'];
break;
case 'settings':
return e_HTTP.'usersettings.php?id.'.$parms['id'];
break;
}
}

View File

@ -9,9 +9,9 @@
* Language file - user admin
*
* $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_users.php,v $
* $Revision: 1.12 $
* $Date: 2008-12-21 11:07:58 $
* $Author: e107steved $
* $Revision: 1.13 $
* $Date: 2008-12-22 03:15:04 $
* $Author: mcfly_e107 $
*
*/
define("USRLAN_1", "Options Saved.");
@ -199,6 +199,8 @@ define('USRLAN_193', 'Nothing changed - not saved');
define('USRLAN_194', '');
define('USRLAN_195', '');
define('USRLAN_196', 'User ranks');
define('LAN_MAINADMIN','Main Admin');
define('LAN_ADMIN','Admin');