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

Admin -> Userclass cleanup and initial userclass feature on xup signup.

This commit is contained in:
Cameron 2015-02-15 19:56:58 -08:00
parent cb5c621a55
commit 02766efff5
7 changed files with 74 additions and 47 deletions

View File

@ -458,7 +458,7 @@ class adminstyle_infopanel
{
if($val==0)
{
return "Guest";
return LAN_GUEST;
}
return $val;
}
@ -476,7 +476,7 @@ class adminstyle_infopanel
if(!$rows = $sql->retrieve('comments','*','comment_blocked=2 ORDER BY comment_id DESC LIMIT 25',true) )
{
return;
return null;
}
@ -504,6 +504,7 @@ class adminstyle_infopanel
</div>
</li>";
//TODO LAN for 'Posted by [x] ';
$sc->setVars($row);
$text .= $tp->parseTemplate($TEMPLATE,true,$sc);
@ -541,7 +542,7 @@ class adminstyle_infopanel
function render_infopanel_options($render = false)
function render_infopanel_options($render = false) //TODO LAN
{
// $frm = e107::getSingleton('e_form');
$frm = e107::getForm();
@ -574,7 +575,7 @@ class adminstyle_infopanel
// $end = "</div>";
return $mes->render().$text2.$end;
return $mes->render().$text2;
}

View File

@ -589,40 +589,39 @@ unset($title);
$text = "<div style='text-align:center'>
<form method='post' action='".e_SELF."?initial' id='initialForm'>
<table class='table adminform'>
<tr><td>";
$text .= UCSLAN_43;
<table class='table table-bordered adminform'>
<tr><td>".UCSLAN_43."</td><td>";
if (count($icn) > 0)
{
$text .= implode(', ',$icn);
// $text .= implode(', ',$icn);
}
else
{
$text .= UCSLAN_44;
}
$text .= "</td></tr>
<tr></tr><tr><td>";
if ($class_text)
{
$text .= $class_text."</td></tr><tr><td>";
$sel_stage = varset($pref['init_class_stage'],2);
$text .= "<table class='table adminform'>
<tr>
<td>".UCSLAN_45."<br /> </td>
$text .= UCSLAN_45."<br /> </td>
<td>
<select class='tbox' name='init_class_stage'>\n
<option value='1'".($sel_stage==1 ? " selected='selected'" : "").">".UCSLAN_47."</option>
<option value='2'".($sel_stage==2 ? " selected='selected'" : "").">".UCSLAN_48."</option>
</select><span class='field-help'>".UCSLAN_46."</span>";
$text .= "</td></tr></table></td></tr>
<tr><td style='text-align:center'>".
$frm->admin_button('set_initial_classes','no-value','create',LAN_UPDATE);
$text .= "</td></tr></table>
<div class='buttons-bar'>".
$frm->admin_button('set_initial_classes','no-value','create',LAN_UPDATE)
."</div>";
}
else
{
$text .= UCSLAN_39;
}
$text .= "</td></tr></table></form></div>";
$ns->tablerender(ADLAN_38.SEP.UCSLAN_40, $mes->render() . $text);
@ -945,8 +944,16 @@ function e_help()
{
global $e_userclass;
$text = "<div id='userclass-tree-structure'>".$e_userclass->show_graphical_tree()."</div>";
return array('caption'=>'Class Structure', 'text' => $text);
$text2 = "<div id='userclass-tree-structure'>".$e_userclass->show_graphical_tree()."</div>";
$help = e_LANGUAGEDIR.e_LANGUAGE.'/admin/help/userclass2.php';
if(is_readable($help))
{
require_once($help);
}
// require_once(e_LANGUAGEDIR.e_LANGUAGE.'/admin/help/userclass2.php');
return array('caption'=>'Class Structure', 'text' => $text2);
// $text .= $e_userclass->show_graphical_tree();
@ -975,7 +982,7 @@ class uclass_manager
'userclass_parent' => array('title'=> UCSLAN_35, 'type' => 'userclass', 'width' => 'auto', 'thclass' => 'left'),
'userclass_visibility' => array('title'=> UCSLAN_34, 'type' => 'userclass', 'width' => 'auto', 'thclass' => 'left'),
'userclass_type' => array('title'=> UCSLAN_79, 'type' => 'method', 'width' => '10%', 'thclass' => 'left', 'class'=>'left' ),
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'thclass' => 'center last', 'forced'=>TRUE, 'class'=>'center', 'readParms' => array('deleteClass' => e_UC_NOBODY))
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'thclass' => 'center last', 'forced'=>TRUE, 'class'=>'right', 'readParms' => array('deleteClass' => e_UC_NOBODY))
);
}

View File

@ -956,7 +956,7 @@ class e_user_provider
{
e107::getRedirect()->redirect($redirectUrl);
}
return;
return false;
// throw new Exception( "Signup failed! User already signed in. ", 1); // TODO lan
}
@ -972,18 +972,32 @@ class e_user_provider
$plainPwd = $userMethods->generateRandomString('************'); // auto plain passwords
// TODO - auto login name, shouldn't be used if system set to user_email login...
$userdata['user_loginname'] = $this->getProvider().$userMethods->generateUserLogin(e107::getPref('predefinedLoginName', '_..#..#..#'));
$userdata['user_email'] = $sql->escape($profile->emailVerified ? $profile->emailVerified : $profile->email);
$userdata['user_name'] = $sql->escape($profile->displayName);
$userdata['user_login'] = $userdata['user_name'];
$userdata['user_customtitle'] = ''; // not used
$userdata['user_password'] = $userMethods->HashPassword($plainPwd, $userdata['user_loginname']); // pwd
$userdata['user_sess'] = ''; //
$userdata['user_image'] = $profile->photoURL; // avatar
$userdata['user_signature'] = ''; // not used
$userdata['user_hideemail'] = 1; // hide it by default
$userdata['user_xup'] = $sql->escape($this->userId());
$userdata['user_class'] = ''; // TODO - check (with Steve) initial class for new users feature...
$userdata['user_loginname'] = $this->getProvider().$userMethods->generateUserLogin(e107::getPref('predefinedLoginName', '_..#..#..#'));
$userdata['user_email'] = $sql->escape($profile->emailVerified ? $profile->emailVerified : $profile->email);
$userdata['user_name'] = $sql->escape($profile->displayName);
$userdata['user_login'] = $userdata['user_name'];
$userdata['user_customtitle'] = ''; // not used
$userdata['user_password'] = $userMethods->HashPassword($plainPwd, $userdata['user_loginname']); // pwd
$userdata['user_sess'] = ''; //
$userdata['user_image'] = $profile->photoURL; // avatar
$userdata['user_signature'] = ''; // not used
$userdata['user_hideemail'] = 1; // hide it by default
$userdata['user_xup'] = $sql->escape($this->userId());
$pref = e107::pref('core');
if(!empty($pref['initial_user_classes']))
{
$userdata['user_class'] = $pref['initial_user_classes'];
}
elseif(!empty($pref['user_new_period']))
{
$userdata['user_class'] = e_UC_NEWUSER;
}
else
{
$userdata['user_class'] = '';
}
// print_a($userdata);
@ -1000,8 +1014,8 @@ class e_user_provider
e107::getRedirect()->redirect($redirectUrl);
}
return;
// throw new Exception( "Signup failed! User already exists. Please use 'login' instead.", 3); // TODO lan
return false;
// throw new Exception( "Signup failed! User already exists. Please use 'login' instead.", 3);
}
if(empty($userdata['user_email']) && e107::getPref('disable_emailcheck', 0)==0) // Allow it if set-up that way.
@ -1038,8 +1052,6 @@ class e_user_provider
}
### Successful signup!
// FIXME documentation of new signup trigger - usersupprov
//$user->set('provider', $this->getProvider());
$userdata = $user->getData();
$userdata['provider'] = $this->getProvider();
@ -1049,6 +1061,7 @@ class e_user_provider
e107::getEvent()->trigger('user_xup_signup', $userdata);
$ret = e107::getEvent()->trigger('usersupprov', $userdata); // XXX - it's time to pass objects instead of array?
if(true === $ret) return $this;
// send email
@ -1076,6 +1089,8 @@ class e_user_provider
return false;
}
public function login($redirectUrl = true)
{
if(!e107::getPref('social_login_active', false))
@ -1120,6 +1135,8 @@ class e_user_provider
return $check;
}
public function init()
{
if(!e107::getPref('social_login_active', false))

View File

@ -75,6 +75,6 @@ define("LAN_JSCONFIRM","Are you sure?");
define("LAN_IP", "IP Address");
define("LAN_AUTHOR", "Author");
define("LAN_CATEGORY", "Category");
define("LAN_GUEST", "Guest");
?>

View File

@ -12,9 +12,11 @@ if (!defined('e107_INIT')) { exit; }
$caption = "Dashboard";
$text = "This page provides you with an overview of site activity.<br /><br />";
if(e107::getPref('admincss')=='admin_dark.css')
{
$text .= "<small>Theme too dark? <a class='btn btn-mini btn-inverse' href='".e_ADMIN."theme.php?mode=admin'>Change it here</a></small>";
}
$ns -> tablerender($caption, $text);
e107::getRender()->tablerender($caption, $text);

View File

@ -74,4 +74,4 @@ switch ($action)
default :
$text = "You can select classes for editing, and also delete existing classes, from this page.";
}
$ns -> tablerender($caption, $text);
e107::getRender() -> tablerender($caption, $text);

View File

@ -9,7 +9,7 @@
| $Author$
+----------------------------------------------------------------------------+
*/
define("LAN_GUEST", "Guest");
define("LAN_WROTE", "wrote"); // as in John wrote.." ";