From 02766efff5fac9e35d0dcd124296c3ebcf266b86 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 15 Feb 2015 19:56:58 -0800 Subject: [PATCH] Admin -> Userclass cleanup and initial userclass feature on xup signup. --- e107_admin/includes/infopanel.php | 13 ++-- e107_admin/userclass2.php | 39 +++++++----- e107_handlers/user_handler.php | 59 ++++++++++++------- e107_languages/English/English.php | 2 +- e107_languages/English/admin/help/admin.php | 4 +- .../English/admin/help/userclass2.php | 2 +- .../English/lan_parser_functions.php | 2 +- 7 files changed, 74 insertions(+), 47 deletions(-) diff --git a/e107_admin/includes/infopanel.php b/e107_admin/includes/infopanel.php index 4d25bac6a..3531e120a 100644 --- a/e107_admin/includes/infopanel.php +++ b/e107_admin/includes/infopanel.php @@ -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; } @@ -503,7 +503,8 @@ class adminstyle_infopanel

{COMMENT}

"; - + + //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 = ""; - return $mes->render().$text2.$end; + return $mes->render().$text2; } @@ -583,7 +584,7 @@ class adminstyle_infopanel $frm = e107::getForm(); global $user_pref; - + $text = "
"; diff --git a/e107_admin/userclass2.php b/e107_admin/userclass2.php index ad5b0f4f1..cefbdd41c 100644 --- a/e107_admin/userclass2.php +++ b/e107_admin/userclass2.php @@ -589,40 +589,39 @@ unset($title); $text = "
- -
"; - $text .= UCSLAN_43; + + - -
".UCSLAN_43.""; + if (count($icn) > 0) { - $text .= implode(', ',$icn); + // $text .= implode(', ',$icn); } else { $text .= UCSLAN_44; } - $text .= "
"; + if ($class_text) { $text .= $class_text."
"; $sel_stage = varset($pref['init_class_stage'],2); - $text .= " - - + $text .= UCSLAN_45."
".UCSLAN_45."
".UCSLAN_46.""; - $text .= "
". - $frm->admin_button('set_initial_classes','no-value','create',LAN_UPDATE); + $text .= "
+
". + $frm->admin_button('set_initial_classes','no-value','create',LAN_UPDATE) + ."
"; } else { $text .= UCSLAN_39; } + $text .= "
"; $ns->tablerender(ADLAN_38.SEP.UCSLAN_40, $mes->render() . $text); @@ -943,10 +942,18 @@ function userclass2_adminmenu() function e_help() { - + global $e_userclass; - $text = "
".$e_userclass->show_graphical_tree()."
"; - return array('caption'=>'Class Structure', 'text' => $text); + $text2 = "
".$e_userclass->show_graphical_tree()."
"; + + $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)) ); } diff --git a/e107_handlers/user_handler.php b/e107_handlers/user_handler.php index cf6f29a63..55d2e37b2 100644 --- a/e107_handlers/user_handler.php +++ b/e107_handlers/user_handler.php @@ -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,19 +972,33 @@ 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,17 +1052,16 @@ 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(); - // e107::getEvent()->trigger('userveri', $userdata); // Trigger New verified user. + // e107::getEvent()->trigger('userveri', $userdata); // Trigger New verified user. e107::getEvent()->trigger('user_xup_signup', $userdata); - $ret = e107::getEvent()->trigger('usersupprov', $userdata); // XXX - it's time to pass objects instead of array? + $ret = e107::getEvent()->trigger('usersupprov', $userdata); // XXX - it's time to pass objects instead of array? + if(true === $ret) return $this; // send email @@ -1075,7 +1088,9 @@ class e_user_provider return false; } - + + + public function login($redirectUrl = true) { if(!e107::getPref('social_login_active', false)) @@ -1119,6 +1134,8 @@ class e_user_provider return $check; } + + public function init() { diff --git a/e107_languages/English/English.php b/e107_languages/English/English.php index 517af2449..2b3c27f1c 100644 --- a/e107_languages/English/English.php +++ b/e107_languages/English/English.php @@ -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"); ?> \ No newline at end of file diff --git a/e107_languages/English/admin/help/admin.php b/e107_languages/English/admin/help/admin.php index 257f9af65..69d199414 100644 --- a/e107_languages/English/admin/help/admin.php +++ b/e107_languages/English/admin/help/admin.php @@ -12,9 +12,11 @@ if (!defined('e107_INIT')) { exit; } $caption = "Dashboard"; $text = "This page provides you with an overview of site activity.

"; + if(e107::getPref('admincss')=='admin_dark.css') { $text .= "Theme too dark? Change it here"; } -$ns -> tablerender($caption, $text); + +e107::getRender()->tablerender($caption, $text); diff --git a/e107_languages/English/admin/help/userclass2.php b/e107_languages/English/admin/help/userclass2.php index 36d49c54d..17236861a 100644 --- a/e107_languages/English/admin/help/userclass2.php +++ b/e107_languages/English/admin/help/userclass2.php @@ -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); diff --git a/e107_languages/English/lan_parser_functions.php b/e107_languages/English/lan_parser_functions.php index 7a06cbb63..ff140cd74 100644 --- a/e107_languages/English/lan_parser_functions.php +++ b/e107_languages/English/lan_parser_functions.php @@ -9,7 +9,7 @@ | $Author$ +----------------------------------------------------------------------------+ */ -define("LAN_GUEST", "Guest"); + define("LAN_WROTE", "wrote"); // as in John wrote.." ";