diff --git a/contact.php b/contact.php index 4b149e9d0..ca9b0f862 100644 --- a/contact.php +++ b/contact.php @@ -95,10 +95,10 @@ if(isset($_POST['send-contactus'])) } -// No errors - so proceed to email the admin and the user (if selected). + // No errors - so proceed to email the admin and the user (if selected). if(!$error) { - $body .= "\n\nIP:\t".USERIP."\n"; + $body .= "\n\nIP:\t".e107::getIPHandler()->getIP(TRUE)."\n"; if (USER) { $body .= "User:\t#".USERID." ".USERNAME."\n"; diff --git a/e107_admin/admin.php b/e107_admin/admin.php index dfbbcc103..9cda74092 100644 --- a/e107_admin/admin.php +++ b/e107_admin/admin.php @@ -71,6 +71,7 @@ class admin_start 'aa_jquery' => 1.2, 'who' => 1.0, 'ratings' => 4.2, + 'lightbox' => 1.5, 'e107slider' => 0.1 ); diff --git a/e107_admin/ugflag.php b/e107_admin/ugflag.php index fdf571dd6..069697b82 100644 --- a/e107_admin/ugflag.php +++ b/e107_admin/ugflag.php @@ -78,9 +78,12 @@ $text = " "; -$elements = array(e_UC_PUBLIC=>LAN_DISABLED, - e_UC_ADMIN=>UGFLAN_8, - e_UC_MAINADMIN=>UGFLAN_9); +$elements = array( + e_UC_PUBLIC => LAN_DISABLED, + e_UC_MEMBER => ADLAN_110, + e_UC_ADMIN => UGFLAN_8, + e_UC_MAINADMIN => UGFLAN_9 +); $text .= " diff --git a/e107_admin/users.php b/e107_admin/users.php index 30b6c65a2..88259fcdc 100644 --- a/e107_admin/users.php +++ b/e107_admin/users.php @@ -146,8 +146,16 @@ class users_admin extends e_admin_dispatcher // redirect to TestObserver/TestPage case 'usersettings': - header('location:'.e107::getUrl()->create('user/profile/edit', 'id='.(int) $_POST['userid'], 'full=1&encode=0')); - exit; + $this->getRequest() + ->setQuery(array()) + ->setMode('main') + ->setAction('edit') + ->setId($_POST['userid']); + $this->getController()->redirect(); + + + //XXX Broken to the point of being unusable. //header('location:'.e107::getUrl()->create('user/profile/edit', 'id='.(int) $_POST['userid'], 'full=1&encode=0')); + // exit; break; } @@ -168,7 +176,7 @@ class users_admin_ui extends e_admin_ui // protected $listQry = "SELECT SQL_CALC_FOUND_ROWS * FROM #users"; // without any Order or Limit. protected $listQry = "SELECT SQL_CALC_FOUND_ROWS u.*,ue.* from #user AS u left join #user_extended AS ue ON u.user_id = ue.user_extended_id "; // without any Order or Limit. - //protected $editQry = "SELECT * FROM #users WHERE comment_id = {ID}"; + protected $editQry = "SELECT u.*,ue.* FROM #user AS u left join #user_extended AS ue ON u.user_id = ue.user_extended_id WHERE user_id = {ID}"; protected $pid = "user_id"; protected $perPage = 10; @@ -189,39 +197,40 @@ class users_admin_ui extends e_admin_ui /** * List (numerical array) of only disallowed for this controller actions */ - protected $disallow = array('edit', 'create'); + protected $disallow = array('create'); + protected $tabs = array('Basic', 'Extended'); //TODO - finish 'user' type, set 'data' to all editable fields, set 'noedit' for all non-editable fields protected $fields = array( 'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), - 'user_id' => array('title' => LAN_ID, 'type' =>'integer', 'width' => '5%','forced' => true), + 'user_id' => array('title' => LAN_ID, 'tab'=>0, 'type' =>'integer', 'width' => '5%','forced' => true), // 'user_status' => array('title' => LAN_STATUS, 'type' => 'method', 'alias'=>'user_status', 'width' => 'auto','forced' => true, 'nosort'=>TRUE), - 'user_ban' => array('title' => LAN_STATUS, 'type' => 'method', 'width' => 'auto', 'filter'=>true, 'batch'=>true,'thclass'=>'center', 'class'=>'center'), + 'user_ban' => array('title' => LAN_STATUS, 'tab'=>0, 'type' => 'method', 'width' => 'auto', 'filter'=>true, 'batch'=>true,'thclass'=>'center', 'class'=>'center'), - 'user_name' => array('title' => LAN_USER_01, 'type' => 'text', 'width' => 'auto','thclass' => 'left first'), // Display name - 'user_loginname' => array('title' => LAN_USER_02, 'type' => 'text', 'width' => 'auto'), // User name - 'user_login' => array('title' => LAN_USER_03, 'type' => 'text', 'width' => 'auto'), // Real name (no real vetting) - 'user_customtitle' => array('title' => LAN_USER_04, 'type' => 'text', 'width' => 'auto'), // No real vetting - 'user_password' => array('title' => LAN_USER_05, 'type' => 'password', 'width' => 'auto'), //TODO add md5 option to form handler? - 'user_sess' => array('title' => 'Session', 'type' => 'text', 'width' => 'auto'), // Photo - 'user_image' => array('title' => LAN_USER_07, 'type' => 'text', 'width' => 'auto'), // Avatar - 'user_email' => array('title' => LAN_EMAIL, 'type' => 'text', 'width' => 'auto'), - 'user_hideemail' => array('title' => LAN_USER_10, 'type' => 'boolean', 'width' => 'auto', 'thclass'=>'center', 'class'=>'center', 'filter'=>true, 'batch'=>true, 'readParms'=>'trueonly=1'), - 'user_xup' => array('title' => 'Xup', 'type' => 'text', 'width' => 'auto'), - 'user_class' => array('title' => LAN_USER_12, 'type' => 'userclasses' , 'writeParms' => 'classlist=classes', 'inline'=>true, 'filter'=>true, 'batch'=>true), - 'user_join' => array('title' => LAN_USER_14, 'type' => 'datestamp', 'width' => 'auto', 'writeParms'=>'readonly=1'), - 'user_lastvisit' => array('title' => LAN_USER_15, 'type' => 'datestamp', 'width' => 'auto'), - 'user_currentvisit' => array('title' => LAN_USER_16, 'type' => 'datestamp', 'width' => 'auto'), - 'user_comments' => array('title' => LAN_USER_17, 'type' => 'int', 'width' => 'auto','thclass'=>'right','class'=>'right'), - 'user_lastpost' => array('title' => 'Last Post', 'type' => 'datestamp', 'width' => 'auto'), - 'user_ip' => array('title' => LAN_USER_18, 'type' => 'ip', 'width' => 'auto'), + 'user_name' => array('title' => LAN_USER_01, 'tab'=>0, 'type' => 'text', 'data'=>'str', 'width' => 'auto','thclass' => 'left first'), // Display name + 'user_loginname' => array('title' => LAN_USER_02, 'tab'=>0, 'type' => 'text', 'data'=>'str', 'width' => 'auto'), // User name + 'user_login' => array('title' => LAN_USER_03, 'tab'=>0, 'type' => 'text', 'data'=>'str', 'width' => 'auto'), // Real name (no real vetting) + 'user_customtitle' => array('title' => LAN_USER_04, 'tab'=>0, 'type' => 'text', 'data'=>'str', 'width' => 'auto'), // No real vetting + 'user_password' => array('title' => LAN_USER_05, 'tab'=>0, 'type' => 'method', 'data'=>'str', 'width' => 'auto'), //TODO add md5 option to form handler? + 'user_sess' => array('title' => 'Session', 'tab'=>0, 'noedit'=>true, 'type' => 'text', 'width' => 'auto'), // Photo + 'user_image' => array('title' => LAN_USER_07, 'tab'=>0, 'type' => 'dropdown', 'data'=>'str', 'width' => 'auto'), // Avatar + 'user_email' => array('title' => LAN_EMAIL, 'tab'=>0, 'type' => 'text', 'inline'=>true, 'data'=>'str', 'width' => 'auto'), + 'user_hideemail' => array('title' => LAN_USER_10, 'tab'=>0, 'type' => 'boolean', 'data'=>'int', 'width' => 'auto', 'thclass'=>'center', 'class'=>'center', 'filter'=>true, 'batch'=>true, 'readParms'=>'trueonly=1'), + 'user_xup' => array('title' => 'Xup', 'tab'=>0, 'noedit'=>true, 'type' => 'text', 'width' => 'auto'), + 'user_class' => array('title' => LAN_USER_12, 'tab'=>0, 'type' => 'userclasses' , 'inline'=>true, 'writeParms' => 'classlist=classes', 'inline'=>true, 'filter'=>true, 'batch'=>true), + 'user_join' => array('title' => LAN_USER_14, 'tab'=>0, 'noedit'=>true, 'type' => 'datestamp', 'width' => 'auto', 'writeParms'=>'readonly=1'), + 'user_lastvisit' => array('title' => LAN_USER_15, 'tab'=>0, 'noedit'=>true, 'type' => 'datestamp', 'width' => 'auto'), + 'user_currentvisit' => array('title' => LAN_USER_16, 'tab'=>0, 'noedit'=>true, 'type' => 'datestamp', 'width' => 'auto'), + 'user_comments' => array('title' => LAN_USER_17, 'tab'=>0, 'noedit'=>true, 'type' => 'int', 'width' => 'auto','thclass'=>'right','class'=>'right'), + 'user_lastpost' => array('title' => 'Last Post', 'tab'=>0, 'noedit'=>true, 'type' => 'datestamp', 'width' => 'auto'), + 'user_ip' => array('title' => LAN_USER_18, 'tab'=>0, 'noedit'=>true, 'type' => 'ip', 'width' => 'auto'), // 'user_prefs' => array('title' => LAN_USER_20, 'type' => 'text', 'width' => 'auto'), - 'user_visits' => array('title' => LAN_USER_21, 'type' => 'int', 'width' => 'auto','thclass'=>'right','class'=>'right'), - 'user_admin' => array('title' => LAN_USER_22, 'type' => 'boolean', 'width' => 'auto', 'thclass'=>'center', 'class'=>'center', 'filter'=>true, 'batch'=>true, 'readParms'=>'trueonly=1'), - 'user_perms' => array('title' => LAN_USER_23, 'type' => 'method', 'width' => 'auto'), - 'user_pwchange' => array('title' => LAN_USER_24, 'type'=>'datestamp' , 'width' => 'auto'), + 'user_visits' => array('title' => LAN_USER_21, 'tab'=>0, 'noedit'=>true, 'type' => 'int', 'width' => 'auto','thclass'=>'right','class'=>'right'), + 'user_admin' => array('title' => LAN_USER_22, 'tab'=>0, 'type' => 'boolean', 'width' => 'auto', 'thclass'=>'center', 'class'=>'center', 'filter'=>true, 'batch'=>true, 'readParms'=>'trueonly=1'), + 'user_perms' => array('title' => LAN_USER_23, 'tab'=>0, 'type' => 'method', 'data'=>'str', 'width' => 'auto'), + 'user_pwchange' => array('title' => LAN_USER_24, 'tab'=>0, 'noedit'=>true, 'type'=>'datestamp' , 'width' => 'auto'), ); @@ -243,16 +252,24 @@ class users_admin_ui extends e_admin_ui 'user_new_period' => array('title' => USRLAN_190, 'type' => 'number', 'writeParms' => array('maxlength' => 3, 'post' => LANDT_04s), 'help' => USRLAN_191, 'data' => 'int',), ); + protected $extended = array(); + function init() { $sql = e107::getDb(); $tp = e107::getParser(); - // Extended fields - FIXME - better field types - if($sql->db_Select('user_extended_struct', 'user_extended_struct_name,user_extended_struct_text', "user_extended_struct_type > 0 AND user_extended_struct_text != '_system_' ORDER BY user_extended_struct_parent ASC")) + if($this->getAction() == 'edit') { - // FIXME use the handler to build fields and field attributes + $this->fields['user_class']['noedit'] = true; + } + + // Extended fields - FIXME - better field types + + if($sql->select('user_extended_struct', 'user_extended_struct_name,user_extended_struct_text', "user_extended_struct_type > 0 AND user_extended_struct_text != '_system_' ORDER BY user_extended_struct_parent ASC")) + { + // TODO FIXME use the handler to build fields and field attributes // FIXME a way to load 3rd party language files for extended user fields e107::coreLan('user_extended'); while ($row = $sql->fetch()) @@ -260,12 +277,14 @@ class users_admin_ui extends e_admin_ui $field = "user_".$row['user_extended_struct_name']; $title = ucfirst(str_replace("user_","",$field)); $label = $tp->toHtml($row['user_extended_struct_text'],false,'defs'); - $this->fields[$field] = array('title' => $label,'width' => 'auto','type'=>'text', 'noedit'=>true); + $this->fields[$field] = array('title' => $label,'width' => 'auto', 'data'=>false,'type'=>'text', 'tab'=>1, 'noedit'=>false); + + $this->extended[] = $field; } } $this->fields['user_signature']['writeParms']['data'] = e107::getUserClass()->uc_required_class_list("classes"); - $this->fields['user_signature'] = array('title' => LAN_USER_09, 'type' => 'bbarea', 'width' => 'auto'); + $this->fields['user_signature'] = array('title' => LAN_USER_09, 'type' => 'textarea', 'data'=>'str', 'width' => 'auto'); $this->fields['options'] = array('title'=> LAN_OPTIONS, 'type' => 'method', 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'left'); @@ -274,6 +293,8 @@ class users_admin_ui extends e_admin_ui unset($this->fields['checkboxes']); unset($this->fields['options']); } + + $this->fields['user_image']['writeParms'] = $this->getAvatarList(); //FIXME - handle user extended search... //$this->_alias_parsed = false; @@ -283,9 +304,100 @@ class users_admin_ui extends e_admin_ui // { // addUser(); // } + + } + protected function getAvatarList() + { + $avs = array(''=>LAN_NONE); + $upload = array(); + $sys = array(); + $uploaded = e107::getFile()->get_files(e_AVATAR_UPLOAD); + foreach($uploaded as $f) + { + $id = '-upload-'.$f['fname']; + $upload[$id] = $f['fname']; + } + $system = e107::getFile()->get_files(e_AVATAR_DEFAULT); + foreach($system as $f) + { + $id = $f['fname']; + $sys[$id] = $f['fname']; + } + + $avs['uploaded'] = $upload; + $avs['system'] = $sys; + + return $avs; + } + + + public function beforeUpdate($new_data, $old_data, $id) + { + $tp = e107::getParser(); + + if(empty($new_data['user_password'])) + { + $new_data['user_password'] = $old_data['user_password']; + } + else + { + $new_data['user_password'] = md5($new_data['user_password']); //TODO add support for salted passwords etc. + } + + if(!empty($new_data['perms'])) + { + $new_data['user_perms'] = implode(".",$new_data['perms']); + } + + // Handle the Extended Fields. + + $update = array(); + foreach($this->extended as $key) // Grab Extended field data. + { + $update[$key] = ($new_data[$key]); + } + + if(!empty($update)) + { + if(!e107::getDb()->count('user_extended', '(user_extended_id)', "user_extended_id=".intval($new_data['submit_value']))) + { + $update['user_extended_id'] = intval($new_data['submit_value']); + if(e107::getDb()->insert('user_extended', $update)) + { + e107::getMessage()->addSuccess('Extended Fields Updated'); //TODO Replace with Generic or existing LAN. + } + else + { + e107::getMessage()->addError('Extended Fields Update Failed'); //TODO Replace with Generic or existing LAN. + e107::getMessage()->addDebug(print_a($update,true)); + } + } + else + { + $update['WHERE'] = 'user_extended_id='. intval($new_data['submit_value']); + + if(e107::getDb()->update('user_extended',$update)) + { + e107::getMessage()->addSuccess('Extended Fields Updated'); //TODO Replace with Generic or existing LAN. + } + else + { + e107::getMessage()->addError('Extended Fields Update Failed'); //TODO Replace with Generic or existing LAN. + e107::getMessage()->addDebug(print_a($update,true)); + } + } + } + + + + return $new_data; + } + + + /** * Unban user trigger * @param int $userid @@ -1879,6 +1991,29 @@ class users_admin_form_ui extends e_admin_form_ui } + function user_password($curval,$mode) + { + if($mode == 'read') + { + if(empty($curVal)) + { + return "No password!"; + } + } + if($mode == 'write') + { + return $this->password('user_password', '', 20, array('size' => 50, 'class' => 'tbox e-password', 'placeholder' => 'Leave blank for no change', 'generate' => 1, 'strength' => 1, 'required'=>0))." + "; + } + + + } + + + + + + function user_ban($curval,$mode) { $bo = array( diff --git a/e107_core/bbcodes/file.bb b/e107_core/bbcodes/file.bb index 9fc82bc90..2cfaa6ca6 100644 --- a/e107_core/bbcodes/file.bb +++ b/e107_core/bbcodes/file.bb @@ -8,7 +8,7 @@ $class = e107::getBB()->getClass('file'); if(is_numeric($parm)) // Media-Manager file. { - return "".$code_text.""; + return "".$code_text.""; } diff --git a/e107_core/shortcodes/batch/usersettings_shortcodes.php b/e107_core/shortcodes/batch/usersettings_shortcodes.php index 5be90697e..d1864e105 100755 --- a/e107_core/shortcodes/batch/usersettings_shortcodes.php +++ b/e107_core/shortcodes/batch/usersettings_shortcodes.php @@ -141,7 +141,7 @@ class usersettings_shortcodes extends e_shortcode if($parm == 'radio') { $options['enabled'] = array('title' => LAN_USER_84); - return e107::getForm()->radio_switch("hideemail", $this->var['user_hideemail'],LAN_YES,LAN_NO,$options); + return "
".e107::getForm()->radio_switch("hideemail", $this->var['user_hideemail'],LAN_YES,LAN_NO,$options)."
"; } } @@ -238,14 +238,26 @@ class usersettings_shortcodes extends e_shortcode function sc_photo_upload($parm) { - $diz = LAN_USET_27."
".LAN_USET_28; + $diz = LAN_USET_27.". ".LAN_USET_28."."; + + if(USERPHOTO) + { + $text .= e107::getParser()->parseTemplate("{PICTURE}",true); + } if (e107::getPref('photo_upload') && FILE_UPLOADS) { - return "".LAN_USET_16."
\n - -
{$diz}
"; + $text .= "
"; + $text .= e107::getForm()->checkbox('user_delete_photo', 1, false, LAN_USET_16); + $text .= "
"; + + + // $text .= "".LAN_USET_16."
\n"; + $text .= "

\n"; + } + + return $text; } diff --git a/e107_core/shortcodes/single/user_avatar.php b/e107_core/shortcodes/single/user_avatar.php index d3e2ce0ea..d96e40110 100644 --- a/e107_core/shortcodes/single/user_avatar.php +++ b/e107_core/shortcodes/single/user_avatar.php @@ -27,7 +27,7 @@ function user_avatar_shortcode($parm=null) $image=$row['user_image']; } } - elseif(!is_null($parm)) + elseif(!empty($parm)) { $image=$parm; } @@ -56,6 +56,7 @@ function user_avatar_shortcode($parm=null) } elseif(substr($image,0,8) == "-upload-") { + $image = substr($image,8); // strip the -upload- from the beginning. if(file_exists(e_AVATAR_UPLOAD.$image)) // Local Default Image { @@ -63,6 +64,7 @@ function user_avatar_shortcode($parm=null) } else { + $img = $genericImg; } } @@ -72,6 +74,7 @@ function user_avatar_shortcode($parm=null) } else // Image Missing. { + $img = $genericImg; } } diff --git a/e107_core/templates/email_template.php b/e107_core/templates/email_template.php index e6397da8b..aecc3d9a9 100644 --- a/e107_core/templates/email_template.php +++ b/e107_core/templates/email_template.php @@ -191,12 +191,11 @@ $MAILOUT_FOOTER = " */ -// FIXME clean up the whole email template/render tempalte mess //------------------------------------------------------------- // 'SIGNUP' TEMPLATE //------------------------------------------------------------- - +//@Deprecated $SIGNUPEMAIL_TEMPLATE = "
@@ -229,26 +228,7 @@ LAN_SIGNUP_97." {SITENAME}
//------------------------------------------------------------- // 'NOTIFY' TEMPLATE //------------------------------------------------------------- -$NOTIFY_TEMPLATE = array( - 'template_name' => 'Notify', - 'template_type' => 'system', - 'email_overrides' => '', - 'email_header' => " - - - - - -
- ", - 'email_body' => '{BODY}', - 'email_footer' => "

- {SITENAME=link} -
- - ", - 'email_plainText' => '' - ); + //------------------------------------------------------------- @@ -309,19 +289,11 @@ $MONTHLYUPDATE_TEMPLATE = array( -$QUICKADDUSER_TEMPLATE = array( - 'template_name' => 'Quick-Add-User', - 'template_type' => 'quickadd', - 'email_overrides' => '', -// 'email_header' - any header information (usually loaded from the default) - 'email_body' => USRLAN_185.USRLAN_186, -// 'email_footer' => 'footer' - ); - +// ----------------------- Everything above this line is deprecated but may continue to work for a while ------------------------------- // /** Standardized v2 template rewrite @@ -334,6 +306,7 @@ $QUICKADDUSER_TEMPLATE = array( // Default - test email and when no template specified. $EMAIL_TEMPLATE['default']['name'] = 'Default'; +$EMAIL_TEMPLATE['default']['subject'] = '{SUBJECT} {SITENAME}'; $EMAIL_TEMPLATE['default']['header'] = " @@ -356,9 +329,16 @@ $EMAIL_TEMPLATE['default']['footer'] = "

"; +// ------------------------------- -// Signup Template. +/** + * Signup Template. + * @example developer tests + * signup.php?preview + * signup.php?test + * signup.php?preview.aftersignup + */ $EMAIL_TEMPLATE['signup']['subject'] = LAN_SIGNUP_96.' {SITENAME}'; $EMAIL_TEMPLATE['signup']['header'] = $EMAIL_TEMPLATE['default']['header']; @@ -386,7 +366,7 @@ $EMAIL_TEMPLATE['signup']['body'] = " {SITENAME=link}
{SITEURL} -

".($includeSiteButton ? "" : '')." +

".($includeSiteButton ? "{SITEBUTTON}" : '')."
"; @@ -396,6 +376,11 @@ $EMAIL_TEMPLATE['signup']['footer'] = "
$EMAIL_TEMPLATE['signup']['cc'] = ""; $EMAIL_TEMPLATE['signup']['bcc'] = ""; $EMAIL_TEMPLATE['signup']['attachments'] = ""; + +//TODO FIXME {SITEBUTTON} not working at the moment. (broken path) + +// ----------------------------- + /* * QUICK ADD USER EMAIL TEMPLATE - BODY. @@ -404,15 +389,37 @@ $EMAIL_TEMPLATE['signup']['attachments'] = ""; USRLAN_186 = Please go to the site as soon as possible and log in, then change your password using the \'Settings\' option.

You can also change other settings at the same time.

Note that your password cannot be recovered if you lose it. */ -$EMAIL_TEMPLATE['quickadd']['header'] = $EMAIL_TEMPLATE['default']['header']; // will use default header above. -$EMAIL_TEMPLATE['quickadd']['body'] = USRLAN_185.USRLAN_186; -$EMAIL_TEMPLATE['quickadd']['footer'] = $EMAIL_TEMPLATE['default']['footer']; // will use default footer above. +$EMAIL_TEMPLATE['quickadduser']['subject'] = '{SITENAME}: {SUBJECT} '; +$EMAIL_TEMPLATE['quickadduser']['header'] = $EMAIL_TEMPLATE['default']['header']; // will use default header above. +$EMAIL_TEMPLATE['quickadduser']['body'] = USRLAN_185.USRLAN_186; +$EMAIL_TEMPLATE['quickadduser']['footer'] = $EMAIL_TEMPLATE['default']['footer']; // will use default footer above. -// Notify (@see admin-> notify) // TODO -$EMAIL_TEMPLATE['notify']['header'] = $EMAIL_TEMPLATE['default']['header']; // will use default header above. -$EMAIL_TEMPLATE['notify']['body'] = $EMAIL_TEMPLATE['default']['body']; // will use default header above. -$EMAIL_TEMPLATE['notify']['footer'] = $EMAIL_TEMPLATE['default']['footer']; // will use default header above. +// --------------------------------- + + + +// Notify (@see admin-> notify) +$EMAIL_TEMPLATE['notify']['subject'] = '{SITENAME}: {SUBJECT} '; +$EMAIL_TEMPLATE['notify']['header'] = $EMAIL_TEMPLATE['default']['header']; // will use default header above. +$EMAIL_TEMPLATE['notify']['body'] = $EMAIL_TEMPLATE['default']['body']; // will use default header above. +$EMAIL_TEMPLATE['notify']['footer'] = $EMAIL_TEMPLATE['default']['footer']; // will use default header above. + + +// --------------------------------- + + + +// A Dummy Example for theme developers. +$EMAIL_TEMPLATE['example']['subject'] = '{SITENAME}: {SUBJECT} '; +$EMAIL_TEMPLATE['example']['header'] = $EMAIL_TEMPLATE['default']['header']; // will use default header above. +$EMAIL_TEMPLATE['example']['body'] = $EMAIL_TEMPLATE['default']['body']; // will use default header above. +$EMAIL_TEMPLATE['example']['footer'] = "

+ + {SITENAME} + + + "; ?> \ No newline at end of file diff --git a/e107_core/templates/usersettings_template.php b/e107_core/templates/usersettings_template.php index 8daa1ae53..14fe71a8f 100755 --- a/e107_core/templates/usersettings_template.php +++ b/e107_core/templates/usersettings_template.php @@ -255,8 +255,7 @@ $USERSETTINGS_TEMPLATE['edit'] = " {USERNAME} {LOGINNAME} -

".LAN_USET_31."

- +
diff --git a/e107_handlers/admin_ui.php b/e107_handlers/admin_ui.php index 82afb826d..2ff2c34d4 100644 --- a/e107_handlers/admin_ui.php +++ b/e107_handlers/admin_ui.php @@ -3198,11 +3198,28 @@ class e_admin_controller_ui extends e_admin_controller break; case 'images': - //XXX FIXME - entities in stored result. + case 'files': + + // XXX Cam @ SecretR: didn't work here. See model_class.php line 2046. + // if(!is_array($value)) + // { + // $value = e107::unserialize($value); + // } break; } +/* + if($attributes['serialize'] == true) + { + $attributes['data'] = 'array'; + } + + if($attributes['data'] != 'array') + { + $value = e107::unserialize($value); + } +*/ if(vartrue($attributes['dataPath'])) { diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index 33e370bba..ca9d3c1e4 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -1996,7 +1996,7 @@ class e107 * * @param string $id - file prefix, e.g. user for user_template.php * @param string|null $key - * @param boolean $override see {@link getThemeInfo()} + * @param mixed $override see {@link getThemeInfo()} true/false, front or admin. * @param boolean $merge merge theme with core templates, default is false * @param boolean $info retrieve template info only * @return string|array diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index f0ab5df24..66253db74 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -781,12 +781,52 @@ class e_parse extends e_parser return $this->toHTML($text, TRUE, $extra); } - + /** + * @param $text - template to parse. + * @param boolean $parseSCFiles - parse core 'single' shortcodes + * @param array $extraCodes - support legacy shortcode content (eg. content within .sc) as well as simpleParse array format. + * @param object $eVars - XXX more info needed. + */ function parseTemplate($text, $parseSCFiles = TRUE, $extraCodes = null, $eVars = null) { + if(!empty($extraCodes) && $this->isSimpleParse($extraCodes)) // support for a combined simple and standard template parse. - (eg. used by signup email template.) + { + $text = $this->simpleParse($text, $extraCodes, false); + } + + + return e107::getScParser()->parseCodes($text, $parseSCFiles, $extraCodes, $eVars); } + + /** + * Check if we are using the simple-Parse array format, or a legacy .sc format which contains 'return ' + * @param array $extraCodes + */ + private function isSimpleParse($extraCodes) + { + + if(!is_array($extraCodes)) + { + return false; + } + + foreach ($extraCodes as $sc => $code) + { + if(!strpos($code, 'return ')) + { + return true; + } + else + { + return false; + } + } + } + + + /** * Simple parser * @@ -2053,8 +2093,10 @@ class e_parse extends e_parser 'e_HANDLER/' => '{e_HANDLER}', // BC 'e_MEDIA/' => '{e_MEDIA}', 'e_WEB/' => '{e_ADMIN}', + // 'THEME/' => '{THEME}', ); - + + switch ($type) { case 'sc': diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index baba387e8..0146f4623 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -239,9 +239,9 @@ class e_form /** * Render Bootstrap Carousel - * @param $name : A unique name - * @param $array - * @param $options : placeholder for any future options. (currently not in use) + * @param string $name : A unique name + * @param array $array + * @param array $options : default, interval, pause, wrap * @example * $array = array( * 'slide1' => array('caption' => 'Slide 1', 'text' => 'first slide content' ), @@ -254,6 +254,8 @@ class e_form $interval = null; $wrap = null; $pause = null; + + $act = varset($options['default'], 0); if(isset($options['wrap'])) { @@ -281,7 +283,7 @@ class e_form $c = 0; foreach($array as $key=>$tab) { - $active = ($c == 0) ? ' class="active"' : ''; + $active = ($c == $act) ? ' class="active"' : ''; $text .= '
  • '; $c++; } @@ -296,7 +298,7 @@ class e_form $c=0; foreach($array as $key=>$tab) { - $active = ($c == 0) ? ' active' : ''; + $active = ($c == $act) ? ' active' : ''; $text .= '
    '; $text .= $tab['text']; @@ -571,9 +573,9 @@ class e_form $path = (substr($curVal,0,8) == '-upload-') ? '{e_AVATAR}upload/' : '{e_AVATAR}default/'; - $curVal = str_replace('-upload-','',$curVal); + $newVal = str_replace('-upload-','',$curVal); - $img = (strpos($curVal,"://")!==false) ? $curVal : $tp->thumbUrl($path.$curVal); + $img = (strpos($curVal,"://")!==false) ? $curVal : $tp->thumbUrl($path.$newVal); if(!$curVal) { @@ -602,8 +604,12 @@ class e_form $text .= "
    ".LAN_USET_26." -
    -
    OR
    "; +
    "; + + if(count($avFiles) > 0) + { + $text .= "
    OR
    "; + } } @@ -770,30 +776,54 @@ class e_form - + /** + * File Picker + * @param string name eg. 'myfield' or 'myfield[]' + * @param mixed default + * @param string label + * @param mixed sc_parameters + */ function filepicker($name, $default, $label = '', $sc_parameters = '') { $tp = e107::getParser(); $name_id = $this->name2id($name); + if(is_string($sc_parameters)) { if(strpos($sc_parameters, '=') === false) $sc_parameters = 'media='.$sc_parameters; parse_str($sc_parameters, $sc_parameters); } - $cat = vartrue($sc_parameters['media']) ? $tp->toDB($sc_parameters['media']) : "_common_file"; + $cat = vartrue($sc_parameters['media']) ? $tp->toDB($sc_parameters['media']) : "_common_file"; - $default_label = ($default) ? $default : "Choose a file"; - $label = "".basename($default_label).""; + if($sc_parameters['data'] === 'array') + { + // Do not use $this->hidden() method - as it will break 'id' value. + $ret .= ""; + $ret .= ""; + $ret .= ""; + + $default = $default['path']; + } + else + { + $ret .= ""; + } + + + $default_label = ($default) ? $default : "Choose a file"; + $label = "".basename($default_label).""; - $sc_parameters['mode'] = 'main'; - $sc_parameters['action'] = 'dialog'; + $sc_parameters['mode'] = 'main'; + $sc_parameters['action'] = 'dialog'; // $ret .= $this->mediaUrl($cat, $label,$name_id,"mode=dialog&action=list"); - $ret .= $this->mediaUrl($cat, $label,$name_id,$sc_parameters); - $ret .= ""; - + $ret .= $this->mediaUrl($cat, $label,$name_id,$sc_parameters); + + + + return $ret; @@ -1037,7 +1067,14 @@ class e_form //never allow id in format name-value for text fields $text = "get_attributes($options, $name)." />"; - return "".$text.$gen."".vartrue($addon); + if(empty($gen) && empty($addon)) + { + return $text; + } + else + { + return "".$text.$gen."".vartrue($addon); + } } @@ -1090,6 +1127,8 @@ class e_form } $options = $this->format_options('textarea', $name, $options); + +// print_a($options); //never allow id in format name-value for text fields return "".(false !== $counter ? $this->hidden('__'.$name.'autoheight_opt', $counter) : ''); } @@ -2015,6 +2054,10 @@ class e_form if($optval) $ret .= " selected='selected'"; break; + case 'maxlength': + if($optval) $ret .= " maxlength='{$optval}'"; + break; + case 'checked': if($optval) $ret .= " checked='checked'"; break; @@ -2154,7 +2197,8 @@ class e_form 'placeholder' => '', 'pattern' => '', 'other' => '', - 'autocomplete' => '' + 'autocomplete' => '', + 'maxlength' => '' // 'multiple' => false, - see case 'select' ); @@ -3032,7 +3076,19 @@ class e_form } } break; - + + case 'files': + $ret = '
      '; + for ($i=0; $i < 5; $i++) + { + $k = $key.'['.$i.'][path]'; + $ival = $value[$i]['path']; + $ret .= '
    1. '.$ival.'
    2. '; + } + $ret .= '
    '; + $value = $ret; + break; + case 'datestamp': $value = $value ? e107::getDate()->convert_date($value, vartrue($parms['mask'], 'short')) : ''; break; @@ -3358,18 +3414,37 @@ class e_form break; case 'images': - - $value = str_replace(''',"'",html_entity_decode($value)); //FIXME @SecretR Horrible workaround to Line 3203 of admin_ui.php - $ival = e107::unserialize($value); + // return print_a($value, true); for ($i=0; $i < 5; $i++) - { - $k = $key.'[path]['.$i.']'; - $ret .= $this->imagepicker($k, $ival['path'][$i], defset($label, $label), $parms); + { + $k = $key.'['.$i.'][path]'; + $ival = $value[$i]['path']; + + $ret .= $this->imagepicker($k, $ival, defset($label, $label), $parms); } break; + case 'files': + + if($attributes['data'] == 'array') + { + $parms['data'] = 'array'; + } + + $ret = '
      '; + for ($i=0; $i < 5; $i++) + { + // $k = $key.'['.$i.'][path]'; + // $ival = $value[$i]['path']; + $k = $key.'['.$i.']'; + $ival = $value[$i]; + $ret .= '
    1. '.$this->filepicker($k, $ival, defset($label, $label), $parms).'
    2. '; + } + $ret .= '
    '; + break; + case 'file': //TODO - thumb, image list shortcode, js tooltip... $label = varset($parms['label'], 'LAN_EDIT'); unset($parms['label']); diff --git a/e107_handlers/mail.php b/e107_handlers/mail.php index ba5b7a62b..4e76e6900 100644 --- a/e107_handlers/mail.php +++ b/e107_handlers/mail.php @@ -155,6 +155,7 @@ class e107Email extends PHPMailer public $legacyBody = false; // TRUE enables legacy conversion of plain text body to HTML in HTML emails private $debug = false; // echos various debug info when set to true. + private $pref = array(); // Store code prefs. /** * Constructor sets up all the global options, and sensible defaults - it should be the only place the prefs are accessed @@ -175,6 +176,8 @@ class e107Email extends PHPMailer { $this->debug = true; } + + $this->pref = $pref; $this->CharSet = 'utf-8'; $this->SetLanguage(CORE_LC); @@ -599,31 +602,54 @@ class e107Email extends PHPMailer public function arraySet($eml) { - if($this->debug) - { - print_a($eml); - } - + + $tp = e107::getParser(); if(vartrue($eml['template'])) // @see e107_core/templates/email_template.php { - $tp = e107::getParser(); - if($tmpl = e107::getCoreTemplate('email',$eml['template'], true, true)) // $EMAIL_TEMPLATE['default'] - { - $filter = array("\n", "\t"); - $tmpl['header'] = str_replace($filter,'', $tmpl['header']); - $tmpl['footer'] = str_replace($filter,'', $tmpl['footer']); + + if($tmpl = e107::getCoreTemplate('email', $eml['template'], 'front', true)) //FIXME - Core template is failing with template 'notify'. Works with theme template. Issue with core template registry? + { + $eml['shortcodes']['BODY'] = $eml['email_body']; + $eml['shortcodes']['SUBJECT'] = $eml['email_subject']; + $eml['shortcodes']['THEME'] = e_THEME.$this->pref['sitetheme'].'/'; // Always use front-end theme path. + + $emailBody = $tmpl['header']. $tmpl['body'] . $tmpl['footer']; + + $eml['email_body'] = $tp->parseTemplate($emailBody, true, varset($eml['shortcodes'],null)); + + // $eml['email_body'] = ($tp->toEmail($tmpl['header']). str_replace('{BODY}', $eml['email_body'], $tmpl['body']). $tp->toEmail($tmpl['footer'])); + + if($this->debug) + { + echo "

    e107Email::arraySet() - line ".__LINE__."

    "; + print_a($tmpl); + } - $eml['email_body'] = ($tp->toEmail($tmpl['header']). str_replace('{BODY}', $eml['email_body'], $tmpl['body']). $tp->toEmail($tmpl['footer'])); unset($eml['add_html_header']); // disable other headers when template is used. + + $this->Subject = $tp->parseTemplate($tmpl['subject'], true, varset($eml['shortcodes'],null)); + } + else + { + if($this->debug) + { + echo "

    Couldn't find email template: ".$eml['template']."

    "; + } + if (vartrue($eml['email_subject'])) $this->Subject = $tp->parseTemplate($eml['email_subject'], true, varset($eml['shortcodes'],null)); + e107::getMessage()->addDebug("Couldn't find email template: ".$eml['template']); } } + else + { + if (vartrue($eml['email_subject'])) $this->Subject = $tp->parseTemplate($eml['email_subject'], true, varset($eml['shortcodes'],null)); + } if (isset($eml['SMTPDebug'])) $this->SMTPDebug = $eml['SMTPDebug']; // 'FALSE' is a valid value! - if (vartrue($eml['email_subject'])) $this->Subject = $eml['email_subject']; + if (vartrue($eml['email_sender_email'])) $this->From = $eml['email_sender_email']; if (vartrue($eml['email_sender_name'])) $this->FromName = $eml['email_sender_name']; if (vartrue($eml['email_replyto'])) $this->AddAddressList('replyto',$eml['email_replyto'],vartrue($eml['email_replytonames'],'')); @@ -640,9 +666,11 @@ class e107Email extends PHPMailer $this->save_bouncepath = $eml['bouncepath']; // Bounce path } - - - + if($this->debug) + { + echo "

    e107Email::arraySet() - line ".__LINE__."

    "; + print_a($eml); + } if (vartrue($eml['returnreceipt'])) $this->ConfirmReadingTo = $eml['returnreceipt']; @@ -806,20 +834,28 @@ class e107Email extends PHPMailer */ public function MsgHTML($message, $basedir = '') { + + preg_match_all("/(src|background)=([\"\'])(.*)\\2/Ui", $message, $images); // Modified to accept single quotes as well if(isset($images[3])) { if($this->debug) { + echo "

    Detected Image Paths

    "; print_a($images[3]); } + $tp = e107::getParser(); + foreach($images[3] as $i => $url) { // do not change urls for absolute images (thanks to corvuscorax) if (!preg_match('#^[A-z]+://#',$url)) { + $url = $tp->replaceConstants($url); + + $delim = $images[2][$i]; // Will be single or double quote $filename = basename($url); $directory = dirname($url); @@ -829,7 +865,12 @@ class e107Email extends PHPMailer $directory = substr(SERVERBASE, 0, -1).$directory; // Convert to absolute server reference $basedir = ''; } - //echo "CID file {$filename} in {$directory}. Base = ".SERVERBASE."< BaseDir = {$basedir}
    "; + + if ($this->debug) + { + echo "
    CID file {$filename} in {$directory}. Base = ".SERVERBASE."< BaseDir = {$basedir}
    "; + } + $cid = 'cid:' . md5($filename); $ext = pathinfo($filename, PATHINFO_EXTENSION); $mimeType = self::_mime_types($ext); @@ -839,15 +880,29 @@ class e107Email extends PHPMailer if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) { // $images[1][$i] contains 'src' or 'background' - $message = preg_replace("/".$images[1][$i]."=".$delim.preg_quote($url, '/').$delim."/Ui", $images[1][$i]."=".$delim.$cid.$delim, $message); + $message = preg_replace("/".$images[1][$i]."=".$delim.preg_quote($images[3][$i], '/').$delim."/Ui", $images[1][$i]."=".$delim.$cid.$delim, $message); } else { - if ($this->debug) echo "Add embedded image {$url} failed
    "; + if ($this->debug) + { + echo "Add embedded image {$url} failed
    "; + echo "
    basedir=".$basedir; + echo "
    dir=".$directory; + echo "
    file=".$filename; + echo "
    "; + } } } + elseif($this->debug) + { + echo "
    Absolute Image: ".$url; + + } } } + + $this->IsHTML(true); $this->Body = $message; //print_a($message); diff --git a/e107_handlers/mail_manager_class.php b/e107_handlers/mail_manager_class.php index 843762c33..55ba7b277 100644 --- a/e107_handlers/mail_manager_class.php +++ b/e107_handlers/mail_manager_class.php @@ -799,6 +799,8 @@ class e107MailManager //'extra_header' - additional headers (format is name: value //'wordwrap' - Set wordwrap value //'split' - If true, sends an individual email to each recipient + 'template' => 'template', // required + 'shortcodes' => 'shortcodes' // required ); $result = array(); if (!isset($email['mail_source_id'])) $email['mail_source_id'] = 0; @@ -828,6 +830,8 @@ class e107MailManager $result['send_html'] = ($email['mail_send_style'] != 'textonly'); $result['add_html_header'] = FALSE; // We look after our own headers + + // Set up any extra mailer parameters that need it if (!vartrue($email['e107_header'])) { @@ -1497,7 +1501,7 @@ class e107MailManager // Get template data, override email settings as appropriate require_once(e_HANDLER.'mail_template_class.php'); $ourTemplate = new e107MailTemplate(); - if (!$ourTemplate->setNewTemplate($templateName)) return FALSE; // Probably template not found if error + if (!$ourTemplate->setNewTemplate($templateName) && empty($emailData['template'])) return FALSE; // Probably template not found if error if (!$ourTemplate->makeEmailBody($emailData['mail_body'], varset($emailData['mail_include_images'], TRUE))) return FALSE; // Create body text $emailData['mail_body_templated'] = $ourTemplate->mainBodyText; $this->currentMailBody = $emailData['mail_body_templated']; // In case we send immediately @@ -1507,6 +1511,17 @@ class e107MailManager { $emailData['mail_overrides'] = $ourTemplate->lastTemplateData['email_overrides']; } + + if(!empty($emailData['template'])) // Quick Fix for new email template standards. + { + $this->currentMailBody = $emailData['mail_body']; + unset($emailData['mail_body_templated']); + + if($this->debugMode) + { + echo "

    ".$emailData['template']." Template detected

    "; + } + } $forceQueue = FALSE; @@ -1516,6 +1531,13 @@ class e107MailManager unset($extra['mail_force_queue']); } + if($this->debugMode) + { + print_a($emailData); + print_a($recipientData); + + } + if ((count($recipientData) <= 5) && !$forceQueue) // Arbitrary upper limit for sending multiple emails immediately { if ($this->mailer == NULL) @@ -1537,9 +1559,19 @@ class e107MailManager if (FALSE == $this->mailer->sendEmail($recip['mail_recipient_email'], $recip['mail_recipient_name'], $mailToSend, TRUE)) { $tempResult = FALSE; + if($this->debugMode) + { + echo "

    Failed to send to: ".$recip['mail_recipient_email']." [". $recip['mail_recipient_name'] ."]

    "; + print_a($mailToSend); + } } else { // Success here + if($this->debugMode) + { + echo "

    Mail Sent successfully to: ".$recip['mail_recipient_email']." [". $recip['mail_recipient_name'] ."]

    "; + print_a($mailToSend); + } if ($eCount == 0) { // Only send these on first email - otherwise someone could get inundated! unset($emailData['mail_copy_to']); diff --git a/e107_handlers/model_class.php b/e107_handlers/model_class.php index 9152cde75..fc7334437 100644 --- a/e107_handlers/model_class.php +++ b/e107_handlers/model_class.php @@ -2041,6 +2041,13 @@ class e_front_model extends e_model */ public function getIfPosted($key, $default = '', $index = null) { + $d = $this->getDataFields(); + + if($d[$key] == 'array') + { + return e107::unserialize($this->getData((string) $key, $default, $index)); + } + $posted = $this->getPostedData((string) $key, null, $index); if(null !== $posted) { diff --git a/e107_handlers/mysql_class.php b/e107_handlers/mysql_class.php index 7409ce519..03921e2e2 100644 --- a/e107_handlers/mysql_class.php +++ b/e107_handlers/mysql_class.php @@ -1969,18 +1969,19 @@ class e_db_mysql $fileName = ($table =='*') ? str_replace(" ","_",SITENAME) : $table; $fileName = preg_replace('/[^\w]/i',"",$fileName); - $backupFile = ($file) ? e_BACKUP.$file : e_BACKUP.$fileName."_".$this->mySQLPrefix.date("Y-m-d-H-i-s").".sql"; + $backupFile = ($file) ? e_BACKUP.$file : e_BACKUP.strtolower($fileName)."_".$this->mySQLPrefix.date("Y-m-d-H-i-s").".sql"; if($table=='*') { - $nolog = vartrue($options['nologs']) ? 'nologs' : ''; + $nolog = vartrue($options['nologs']) ? 'nologs' : 'all'; $tableList = $this->db_TableList($nolog); } else { $tableList = explode(",",$table); } - + + $header = "-- e107 Database Backup File \n"; $header .= "-- Host: ".$_SERVER['SERVER_NAME']."\n"; $header .= "-- Generation Time: ".date('r')."\n"; diff --git a/e107_handlers/notify_class.php b/e107_handlers/notify_class.php index 1fbe517d6..7a43dd106 100644 --- a/e107_handlers/notify_class.php +++ b/e107_handlers/notify_class.php @@ -147,16 +147,18 @@ class notify // Create the mail body $mailData = array( - 'mail_content_status' => MAIL_STATUS_TEMP, - 'mail_create_app' => 'notify', - 'mail_title' => 'NOTIFY', - 'mail_subject' => $subject, - 'mail_sender_email' => e107::getPref('siteadminemail'), - 'mail_sender_name' => e107::getPref('siteadmin'), - 'mail_send_style' => 'textonly', - 'mail_notify_complete' => 0, // NEVER notify when this email sent!!!!! - 'mail_body' => $message + 'mail_content_status' => MAIL_STATUS_TEMP, + 'mail_create_app' => 'notify', + 'mail_title' => 'NOTIFY', + 'mail_subject' => $subject, + 'mail_sender_email' => e107::getPref('siteadminemail'), + 'mail_sender_name' => e107::getPref('siteadmin'), + // 'mail_send_style' => 'textonly', + 'mail_notify_complete' => 0, // NEVER notify when this email sent!!!!! + 'mail_body' => $message, + 'template' => 'notify' ); + $result = $mailer->sendEmails('NOTIFY_TEMPLATE', $mailData, $recipients); $e107->admin_log->e_log_event(10,-1,'NOTIFY',$subject,$message,FALSE,LOG_TO_ROLLING); } diff --git a/e107_handlers/redirection_class.php b/e107_handlers/redirection_class.php index a6bdbc920..79499ed6b 100644 --- a/e107_handlers/redirection_class.php +++ b/e107_handlers/redirection_class.php @@ -209,9 +209,14 @@ class redirection if(e107::getPref('maintainance_flag') && defset('e_PAGE') != 'secure_img_render.php') { // if not admin - if(!ADMIN + + $allowed = e107::getPref('maintainance_flag'); + + // if(!ADMIN // or if not mainadmin - ie e_UC_MAINADMIN - || (e_UC_MAINADMIN == e107::getPref('maintainance_flag') && !getperms('0'))) + // || (e_UC_MAINADMIN == e107::getPref('maintainance_flag') && !getperms('0'))) + + if(!check_class($allowed) && !getperms('0')) { // 307 Temporary Redirect $this->redirect(SITEURL.'sitedown.php', TRUE, 307); diff --git a/e107_handlers/shortcode_handler.php b/e107_handlers/shortcode_handler.php index 6a9bf369c..4c4e173f5 100644 --- a/e107_handlers/shortcode_handler.php +++ b/e107_handlers/shortcode_handler.php @@ -69,6 +69,7 @@ class e_parse_shortcode protected $scClasses = array(); // Batch shortcode classes - TODO make it private protected $scOverride = array(); // Array of codes found in override/shortcodes dir protected $scBatchOverride = array(); // Array of codes found in override/shortcodes/batch dir + protected $ignoreCodes = array(); // Shortcodes to be ignored and remain unchanged. (ie. {THEME}, {e_PLUGIN} etc. ) /** * @var e_vars */ @@ -89,7 +90,7 @@ class e_parse_shortcode function __construct() { $this->parseSCFiles = true; // Default probably never used, but make sure its defined. - + $this->ignoreCodes = e107::getParser()->getUrlConstants(); // ignore all URL shortcodes. ie. {e_PLUGIN} $this->loadOverrideShortcodes(); $this->loadThemeShortcodes(); $this->loadPluginShortcodes(); @@ -764,15 +765,17 @@ class e_parse_shortcode // auto-register eVars if possible - call it manually? // $this->callScFunc($classname, 'setParserVars', $this->eVars); } - elseif (is_array($extraCodes)) + elseif (is_array($extraCodes)) // Array value contains the contents of a .sc file which is then parsed. ie. return " whatever "; { - $this->addedCodes = &$extraCodes; + $this->addedCodes = &$extraCodes; /* foreach ($extraCodes as $sc => $code) { $this->scList[$sc] = $code; } */ + + // print_a($this); } $ret = preg_replace_callback('#\{(\S[^\x02]*?\S)\}#', array(&$this, 'doCode'), $text); $this->parseSCFiles = $saveParseSCFiles; // Restore previous value @@ -781,7 +784,7 @@ class e_parse_shortcode $this->debug_legacy = null; - // $this->sc_style = array(); //XXX Adding this will also fix #2 above. + // $this->sc_style = array(); //XXX Adding this will also fix #2 above. return $ret; @@ -793,6 +796,13 @@ class e_parse_shortcode */ function doCode($matches) { + // print_a($matches); + + if(in_array($matches[0],$this->ignoreCodes)) // Ignore all {e_PLUGIN}, {THEME} etc. otherwise it will just return blank for these items. + { + return $matches[0]; + } + // XXX remove all globals, $sc_style removed global $pref, $e107cache, $menu_pref, $parm, $sql; @@ -1018,6 +1028,11 @@ class e_parse_shortcode $scCode = file_get_contents($scFile); $this->scList[$code] = $scCode; $_path = $scFile; + } + else + { + // $ret = 'Missing!'; + $_path .= " MISSING!"; } } diff --git a/e107_handlers/user_handler.php b/e107_handlers/user_handler.php index 784a0846d..52de07594 100644 --- a/e107_handlers/user_handler.php +++ b/e107_handlers/user_handler.php @@ -708,7 +708,7 @@ Following fields auto-filled in code as required: * * @return boolean - true if $user['user_class'] updated, false otherwise */ - public function userClassUpdate(&$user, $event='userveri') + public function userClassUpdate($user, $event='userfull') { $pref = e107::getPref(); $tp = e107::getParser(); @@ -717,34 +717,37 @@ Following fields auto-filled in code as required: $doClasses = FALSE; $doProbation = FALSE; $ret = FALSE; + switch ($event) { - case 'userall' : + case 'userall': $doClasses = TRUE; $doProbation = TRUE; break; - case 'userfull' : // A 'fully fledged' user + case 'userfull': if (!$pref['user_reg_veri'] || ($pref['init_class_stage'] == '2')) { - $doClasses = TRUE; + $doClasses = TRUE; } $doProbation = TRUE; break; case 'userpartial' : if ($pref['init_class_stage'] == '1') - { // Set initial classes if to be done on partial signup, or if selected to add them now + { + // Set initial classes if to be done on partial signup, or if selected to add them now $doClasses = TRUE; } $doProbation = TRUE; break; } - if ($doClasses) + if($doClasses) { if (isset($pref['initial_user_classes'])) { $initClasses = explode(',',$pref['initial_user_classes']); } // Any initial user classes to be set at some stage if ($doProbation && (varset($pref['user_new_period'], 0) > 0)) { $initClasses[] = e_UC_NEWUSER; // Probationary user class } + if (count($initClasses)) { // Update the user classes if ($user['user_class']) @@ -752,7 +755,8 @@ Following fields auto-filled in code as required: $initClasses = array_unique(array_merge($initClasses, explode(',',$user['user_class']))); } $user['user_class'] = $tp->toDB(implode(',',$initClasses)); - $ret = TRUE; + //$ret = TRUE; + $ret = $user['user_class']; } } return $ret; diff --git a/e107_handlers/user_model.php b/e107_handlers/user_model.php index af786c111..570c2ce1c 100644 --- a/e107_handlers/user_model.php +++ b/e107_handlers/user_model.php @@ -1114,8 +1114,6 @@ class e_system_user extends e_user_model // required for signup and quickadd email type e107::coreLan('signup'); - - $EMAIL_TEMPLATE = e107::getCoreTemplate('email'); if(!is_array($EMAIL_TEMPLATE)) //BC Fixes. pre v2 alpha3. @@ -1132,15 +1130,14 @@ class e_system_user extends e_user_model } // BC Fixes. - $EMAIL_TEMPLATE['signup']['subject'] = $SIGNUPEMAIL_SUBJECT; - $EMAIL_TEMPLATE['signup']['cc'] = $SIGNUPEMAIL_CC; - $EMAIL_TEMPLATE['signup']['bcc'] = $SIGNUPEMAIL_BCC; - $EMAIL_TEMPLATE['signup']['attachments']= $SIGNUPEMAIL_ATTACHMENTS; + $EMAIL_TEMPLATE['signup']['subject'] = $SIGNUPEMAIL_SUBJECT; + $EMAIL_TEMPLATE['signup']['cc'] = $SIGNUPEMAIL_CC; + $EMAIL_TEMPLATE['signup']['bcc'] = $SIGNUPEMAIL_BCC; + $EMAIL_TEMPLATE['signup']['attachments'] = $SIGNUPEMAIL_ATTACHMENTS; + $EMAIL_TEMPLATE['signup']['body'] = $SIGNUPEMAIL_TEMPLATE; - $EMAIL_TEMPLATE['signup']['body'] = $SIGNUPEMAIL_TEMPLATE; - - $EMAIL_TEMPLATE['quickadd']['body'] = $QUICKADDUSER_TEMPLATE['email_body']; - $EMAIL_TEMPLATE['notify']['body'] = $NOTIFY_TEMPLATE['email_body']; + $EMAIL_TEMPLATE['quickadduser']['body'] = $QUICKADDUSER_TEMPLATE['email_body']; + $EMAIL_TEMPLATE['notify']['body'] = $NOTIFY_TEMPLATE['email_body']; } @@ -1149,12 +1146,12 @@ class e_system_user extends e_user_model { case 'signup': $template = (vartrue($SIGNUPPROVIDEREMAIL_TEMPLATE)) ? $SIGNUPPROVIDEREMAIL_TEMPLATE : $EMAIL_TEMPLATE['signup']['body']; - $ret['template'] = false;// 'signup'; // false; // Don't allow additional headers (mailer) ?? + $ret['template'] = 'signup'; // // false Don't allow additional headers (mailer) ?? break; case 'quickadd': - $template = $EMAIL_TEMPLATE['quickadd']['body']; - $ret['template'] = 'quickadd'; // Don't allow additional headers (mailer) + $template = $EMAIL_TEMPLATE['quickadduser']['body']; + $ret['template'] = 'quickadduser'; // Don't allow additional headers (mailer) break; case 'notify': @@ -1181,47 +1178,31 @@ class e_system_user extends e_user_model $ret['e107_header'] = $userInfo['user_id']; + if (vartrue($EMAIL_TEMPLATE['signup']['cc'])) { $ret['email_copy_to'] = $EMAIL_TEMPLATE['signup']['cc']; } if (vartrue($EMAIL_TEMPLATE['signup']['bcc'])) { $ret['email_bcopy_to'] = $EMAIL_TEMPLATE['signup']['bcc']; } if (vartrue($userInfo['email_attach'])) { $ret['email_attach'] = $userInfo['mail_attach']; } elseif (vartrue($EMAIL_TEMPLATE['signup']['attachments'])) { $ret['email_attach'] = $EMAIL_TEMPLATE['signup']['attachments']; } $style = vartrue($SIGNUPEMAIL_LINKSTYLE) ? "style='{$SIGNUPEMAIL_LINKSTYLE}'" : ""; - - $search[0] = '{LOGINNAME}'; - $replace[0] = intval($pref['allowEmailLogin']) === 0 ? $userInfo['user_loginname'] : $userInfo['user_email']; - - $search[1] = '{PASSWORD}'; - $replace[1] = $pass_show ? $pass_show : '******'; - - $search[2] = '{ACTIVATION_LINK}'; - $replace[2] = strpos($userInfo['activation_url'], 'http') === 0 ? ''.$userInfo['activation_url'].'' : $userInfo['activation_url']; - - $search[3] = '{SITENAME}'; - $replace[3] = SITENAME; - - $search[4] = '{SITEURL}'; - $replace[4] = "".SITEURL.""; - - $search[5] = '{USERNAME}'; - $replace[5] = $userInfo['user_name']; - - $search[6] = '{USERURL}'; - $replace[6] = vartrue($userInfo['user_website']) ? $userInfo['user_website'] : ""; - $search[7] = '{DISPLAYNAME}'; - $replace[7] = $userInfo['user_login'] ? $userInfo['user_login'] : $userInfo['user_name']; - $search[8] = '{EMAIL}'; - $replace[8] = $userInfo['user_email']; + $sc = array(); - $search[9] = '{ACTIVATION_URL}'; - $replace[9] = $userInfo['activation_url']; - - $subject = str_replace($search, $replace, $EMAIL_TEMPLATE['signup']['subject']); + $sc['LOGINNAME'] = intval($pref['allowEmailLogin']) === 0 ? $userInfo['user_loginname'] : $userInfo['user_email']; + $sc['PASSWORD'] = $pass_show ? $pass_show : '******'; + $sc['ACTIVATION_LINK'] = strpos($userInfo['activation_url'], 'http') === 0 ? ''.$userInfo['activation_url'].'' : $userInfo['activation_url']; + // $sc['SITENAME'] = SITENAME; + $sc['SITEURL'] = "".SITEURL.""; + $sc['USERNAME'] = $userInfo['user_name']; + $sc['USERURL'] = vartrue($userInfo['user_website']) ? $userInfo['user_website'] : ""; + $sc['DISPLAYNAME'] = $userInfo['user_login'] ? $userInfo['user_login'] : $userInfo['user_name']; + $sc['EMAIL'] = $userInfo['user_email']; + $sc['ACTIVATION_URL'] = $userInfo['activation_url']; - $ret['email_subject'] = $subject; + $ret['email_subject'] = $EMAIL_TEMPLATE['signup']['subject']; // $subject; $ret['send_html'] = TRUE; + $ret['shortcodes'] = $sc; if(!varset($EMAIL_TEMPLATE['signup']['header'])) { @@ -1251,7 +1232,7 @@ class e_system_user extends e_user_model } else { - $HEAD = $tp->parseTemplate($EMAIL_TEMPLATE['signup']['header'], true); + $HEAD = ""; // $tp->parseTemplate($EMAIL_TEMPLATE['signup']['header'], true); } if(!varset($EMAIL_TEMPLATE['signup']['footer'])) @@ -1260,25 +1241,42 @@ class e_system_user extends e_user_model } else { - $FOOT = $tp->parseTemplate($EMAIL_TEMPLATE['signup']['footer'], true); + $FOOT = ""; // $tp->parseTemplate($EMAIL_TEMPLATE['signup']['footer'], true); } - $ret['send_html'] = TRUE; - $ret['email_body'] = e107::getParser()->parseTemplate(str_replace($search,$replace,$HEAD.$template.$FOOT), true); - $ret['preview'] = $ret['email_body'];// Non-standard field + $ret['send_html'] = TRUE; + $ret['email_body'] = $HEAD.$template.$FOOT; // e107::getParser()->parseTemplate(str_replace($search,$replace,$HEAD.$template.$FOOT), true); + $ret['preview'] = $tp->parseTemplate($ret['email_body'],true, $sc);// Non-standard field + $ret['shortcodes'] = $sc; + + return $ret; } - // all other email types - $subject = $userInfo['email_subject']; + // all other email types + if(!$userInfo['email_subject']) + { + return array(); + } - if(!$subject) return array(); + $ret['email_subject'] = $userInfo['email_subject']; // $EMAIL_TEMPLATE['signup']['subject']; + $ret['e107_header'] = $userInfo['user_id']; - $ret['e107_header'] = $userInfo['user_id']; - if (vartrue($userInfo['email_copy_to'])) { $ret['email_copy_to'] = $userInfo['email_copy_to']; } - if (vartrue($userInfo['email_bcopy_to'])) { $ret['email_bcopy_to'] = $userInfo['email_bcopy_to']; } - if (vartrue($userInfo['email_attach'])) { $ret['email_attach'] = $userInfo['email_attach']; } + if (vartrue($userInfo['email_copy_to'])) { $ret['email_copy_to'] = $userInfo['email_copy_to']; } + if (vartrue($userInfo['email_bcopy_to'])) { $ret['email_bcopy_to'] = $userInfo['email_bcopy_to']; } + if (vartrue($userInfo['email_attach'])) { $ret['email_attach'] = $userInfo['email_attach']; } + $sc = array(); + + $sc['LOGINNAME'] = intval($pref['allowEmailLogin']) === 0 ? $userInfo['user_loginname'] : $userInfo['user_email']; + $sc['DISPLAYNAME'] = $userInfo['user_login'] ? $userInfo['user_login'] : $userInfo['user_name']; + $sc['SITEURL'] = "".SITEURL.""; + $sc['USERNAME'] = $userInfo['user_name']; + $sc['USERURL'] = vartrue($userInfo['user_website']) ? $userInfo['user_website'] : ""; + $sc['PASSWORD'] = $pass_show ? $pass_show : '******'; + + + /* $search[0] = '{LOGINNAME}'; $replace[0] = intval($pref['allowEmailLogin']) === 0 ? $userInfo['user_loginname'] : $userInfo['user_email']; @@ -1300,23 +1298,31 @@ class e_system_user extends e_user_model $search[6] = '{USERURL}'; $replace[6] = vartrue($userInfo['user_website']) ? $userInfo['user_website'] : ""; - $ret['email_subject'] = str_replace($search, $replace, $subject); + $ret['email_subject'] = $subject; // str_replace($search, $replace, $subject); - performed in mail handler. $search[7] = '{PASSWORD}'; $replace[7] = $pass_show ? $pass_show : '******'; + */ + if(isset($userInfo['activation_url'])) { + $sc['ACTIVATION_URL'] = $userInfo['activation_url']; + $sc['ACTIVATION_LINK'] = strpos($userInfo['activation_url'], 'http') === 0 ? ''.$userInfo['activation_url'].'' : $userInfo['activation_url']; + + /* $search[8] = '{ACTIVATION_URL}'; $replace[8] = $userInfo['activation_url']; $search[9] = '{ACTIVATION_LINK}'; $replace[9] = strpos($userInfo['activation_url'], 'http') === 0 ? ''.$userInfo['activation_url'].'' : $userInfo['activation_url']; + */ } - $ret['send_html'] = TRUE; - $ret['email_body'] = e107::getParser()->parseTemplate(str_replace($search, $replace, $template)); - $ret['preview'] = $ret['mail_body']; // Non-standard field + $ret['send_html'] = TRUE; + $ret['email_body'] = $template; // e107::getParser()->parseTemplate(str_replace($search, $replace, $template)); - performed in mail handler. + $ret['preview'] = $ret['mail_body']; // Non-standard field + $ret['shortcodes'] = $sc; return $ret; } diff --git a/e107_plugins/blogcalendar_menu/calendar.php b/e107_plugins/blogcalendar_menu/calendar.php index 34041a7e5..a1d81ae9c 100644 --- a/e107_plugins/blogcalendar_menu/calendar.php +++ b/e107_plugins/blogcalendar_menu/calendar.php @@ -142,7 +142,7 @@ function calendar($req_day, $req_month, $req_year, $links = NULL, $ws = "sunday" { $active = date("n-Y") == ($req_month."-".$req_year) ? 'active' : ''; $text = "
    "; - $text .= "
    ".$marray[$req_month]." ".$req_year."
    "; + $text .= "
    ".$marray[$req_month - 1]." ".$req_year."
    "; $text .= $calendar; $text .= "
    "; } @@ -153,4 +153,4 @@ function calendar($req_day, $req_month, $req_year, $links = NULL, $ws = "sunday" return $text; } -?> \ No newline at end of file +?> diff --git a/e107_plugins/faqs/faqs.php b/e107_plugins/faqs/faqs.php index a60bd6b1d..8b14731bd 100644 --- a/e107_plugins/faqs/faqs.php +++ b/e107_plugins/faqs/faqs.php @@ -18,11 +18,17 @@ require_once ("../../class2.php"); -$url = e107::getUrl()->create('faqs/list/all', false, 'full=1&noencode=1'); -header('Location: '.$url); -exit; +if(file_exists(e_PLUGIN."faqs/controllers/list.php")) +{ + $url = e107::getUrl()->create('faqs/list/all', false, 'full=1&noencode=1'); + header('Location: '.$url); + exit; +} +else +{ + include_lan(e_PLUGIN."faqs/languages/".e_LANGUAGE."/".e_LANGUAGE."_global.php"); +} -incluXXXde_lan(e_PLUGIN."faqs/languages/".e_LANGUAGE."/".e_LANGUAGE."_front.php"); require_once (e_HANDLER."form_handler.php"); @@ -34,11 +40,11 @@ if (!vartrue($FAQ_VIEW_TEMPLATE)) { if (file_exists(THEME."faqs_template.php")) { - require_once (THEME."faqs_template.php"); + // require_once (THEME."faqs_template.php"); } else { - require_once (e_PLUGIN."faqs/faqs_template.php"); + // require_once (e_PLUGIN."faqs/templates/faqs_template.php"); } } @@ -49,13 +55,23 @@ if (!vartrue($FAQ_VIEW_TEMPLATE)) $rs = new form; $cobj = new comment; -if (!vartrue($_GET['elan'])) +if (!vartrue($_GET['elan']) && empty($_GET)) { $qs = explode(".", e_QUERY); $action = $qs[0]; $id = $qs[1]; $idx = $qs[2]; } +else +{ + +} + + + + + + $from = (vartrue($from) ? $from : 0); $amount = 50; @@ -116,7 +132,8 @@ if (isset($_POST['commentsubmit'])) } else { - $ftmp = $faq->view_all(); + $srch = vartrue($_GET['srch']); + $ftmp = $faq->view_all($srch); $caption = FAQLAN_FAQ; } @@ -126,12 +143,12 @@ if (isset($_POST['commentsubmit'])) } else { - define("e_PAGETITLE", FAQLAN_23); + define("e_PAGETITLE", $ftmp['caption']); } require_once (HEADERF); - $ns->tablerender($caption, $ftmp['text']); + $ns->tablerender($ftmp['caption'], $ftmp['text']); } @@ -169,6 +186,8 @@ exit; class faq { var $pref = array(); + protected $sc = null; + protected $template = null; function __construct() { @@ -178,54 +197,111 @@ class faq // setScVar('faqs_shortcodes', 'pref', $this->pref); } - function view_all() // new funtion to render all FAQs + function view_all($srch) // new funtion to render all FAQs { $sql = e107::getDb(); $tp = e107::getParser(); $ret = array(); + $template = e107::getTemplate('faqs'); + $this->template = $template; + + // print_a($template); + + + global $FAQ_START, $FAQ_END, $FAQ_LISTALL_START,$FAQ_LISTALL_LOOP,$FAQ_LISTALL_END; + if($FAQ_START) + { + + } + //require_once (e_PLUGIN."faqs/faqs_shortcodes.php"); - $query = "SELECT f.*,cat.* FROM #faqs AS f LEFT JOIN #faqs_info AS cat ON f.faq_parent = cat.faq_info_id WHERE cat.faq_info_class IN (".USERCLASS_LIST.") ORDER BY cat.faq_info_order,f.faq_order "; - $sql->db_Select_gen($query); - $text = $tp->parseTemplate($FAQ_START, true); + + $prevcat = ""; - $sc = e107::getScBatch('faqs',TRUE); + + $this->sc = e107::getScBatch('faqs',TRUE); + + $text = $tp->parseTemplate($template['start'], true, $this->sc); // var_dump($sc); - while ($rw = $sql->db_Fetch()) + $text .= "
    "; + + $text .= $this->view_all_query($srch); + + $text .= "
    "; + + $text .= $tp->parseTemplate($template['end'], true, $this->sc); + + $ret['title'] = FAQLAN_FAQ; + $ret['text'] = $text; + $ret['caption'] = varset($template['caption']) ? $tp->parseTemplate($template['caption'], true, $this->sc) : LAN_PLUGIN_FAQS_FRONT_NAME; + + + + return $ret; + } + + + + function view_all_query($srch='') + { + $sql = e107::getDb(); + $tp = e107::getParser(); + + if(!empty($srch)) { - $sc->setVars($rw); + $srch = $tp->toDB($srch); + $insert = " AND (f.faq_question LIKE '%".$srch."%' OR FIND_IN_SET ('".$srch."', f.faq_tags) ) "; + } + else + { + $insert = ""; + } + + $query = "SELECT f.*,cat.* FROM #faqs AS f LEFT JOIN #faqs_info AS cat ON f.faq_parent = cat.faq_info_id WHERE cat.faq_info_class IN (".USERCLASS_LIST.") ".$insert." ORDER BY cat.faq_info_order,f.faq_order "; + + if(!$sql->gen($query)) + { + return "
    ".$srch." was not found in search results.
    " ; //TODO LAN + } + + $text = ''; + + while ($rw = $sql->fetch()) + { + $this->sc->setVars($rw); if($rw['faq_info_order'] != $prevcat) { if($prevcat !='') { - $text .= $tp->parseTemplate($FAQ_LISTALL_END, true, $sc); + $text .= $tp->parseTemplate($template['all']['end'], true, $this->sc); } + $text .= "\n\n\n\n"; - $text .= $tp->parseTemplate($FAQ_LISTALL_START, true, $sc); + $text .= $tp->parseTemplate($this->template['all']['start'], true, $this->sc); $start = TRUE; } - $text .= $tp->parseTemplate($FAQ_LISTALL_LOOP, true, $sc); + $text .= $tp->parseTemplate($this->template['all']['item'], true, $this->sc); $prevcat = $rw['faq_info_order']; } - $text .= $tp->parseTemplate($FAQ_LISTALL_END, true, $sc); - $text .= $tp->parseTemplate($FAQ_END, true, $sc); - - $ret['title'] = FAQLAN_FAQ; - $ret['text'] = $text; - $ret['caption'] = vartrue($caption); + $text .= $tp->parseTemplate($this->template['all']['end'], true, $this->sc); + + + return $text; - return $ret; } + + // ------------- Everything below here is kept for backwards-compatability 'Classic Look' ------------ diff --git a/e107_plugins/faqs/faqs_shortcodes.php b/e107_plugins/faqs/faqs_shortcodes.php index 98c78c354..bb522dd1f 100644 --- a/e107_plugins/faqs/faqs_shortcodes.php +++ b/e107_plugins/faqs/faqs_shortcodes.php @@ -126,6 +126,12 @@ class faqs_shortcodes extends e_shortcode { return "".$tp->toHTML($this->var['faq_info_title'])." » ".$this->sc_faq_current_tag('raw').""; } + + if($parm == 'raw') + { + return $tp->toHTML($this->var['faq_info_title']); + } + return " $this->var['faq_info_id']))."'>".$tp->toHTML($this->var['faq_info_title']).""; } @@ -179,11 +185,37 @@ class faqs_shortcodes extends e_shortcode } } - function sc_faq_search() + function sc_faq_search($parm='') { + + if($parm == 'ajax') //TODo Ajax JS. + { + $frm = e107::getForm(); + $tp = e107::getParser(); + + $text = $frm->open('faq-search-form','get', e_REQUEST_SELF); + $text .= ''; + $text .= $frm->text('srch', $_GET['srch'], 20,'class=search-query&placeholder='.LAN_SEARCH).' + '; + $text .= ''; + $text .= $frm->close(); + return $text; + } + + return ''; // UNDER CONSTRUCTION $tp = e107::getParser(); return "

    ".$tp->parseTemplate("{SEARCH=faqs}")."
    "; } + + function sc_faq_breadcrumb() //TODO Category Detection. and proper SEF Urls with category names. + { + $array = array(); + $array[0] = array('url'=> e_REQUEST_SELF, 'text'=>LAN_PLUGIN_FAQS_NAME); + + return e107::getForm()->breadcrumb($array); + + } + } diff --git a/e107_plugins/featurebox/admin_config.php b/e107_plugins/featurebox/admin_config.php index 2f9096238..d461ab8e7 100644 --- a/e107_plugins/featurebox/admin_config.php +++ b/e107_plugins/featurebox/admin_config.php @@ -2,14 +2,12 @@ /* * e107 website system * -* Copyright (c) 2008-2009 e107 Inc (e107.org) +* Copyright (c) 2008-2014 e107 Inc (e107.org) * Released under the terms and conditions of the * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * * Featurebox administration * -* $URL$ -* $Id$ */ require_once("../../class2.php"); if (!getperms("P") || !plugInstalled('featurebox')) @@ -238,7 +236,7 @@ class fb_main_ui extends e_admin_ui if(e107::getDb()->db_Select('featurebox_category')) { //$categories[0] = LAN_SELECT; - while ($row = e107::getDb()->db_Fetch()) + while ($row = e107::getDb()->fetch()) { $id = $row['fb_category_id']; $tmpl = $row['fb_category_template']; diff --git a/e107_plugins/featurebox/e_rss.php b/e107_plugins/featurebox/e_rss.php index 5aa50ca21..3f33aa5bb 100644 --- a/e107_plugins/featurebox/e_rss.php +++ b/e107_plugins/featurebox/e_rss.php @@ -19,9 +19,9 @@ $eplug_rss_feed[] = $feed; //##### create rss data, return as array $eplug_rss_data ----------------------------------- $rss = array(); $sqlrss = new db; -if($items = $sqlrss -> db_Select('featurebox', "*", "fb_class = 0 DESC LIMIT 0,".$this->limit )){ +if($items = $sqlrss->select('featurebox', "*", "fb_class = 0 DESC LIMIT 0,".$this->limit )){ $i=0; - while($rowrss = $sqlrss -> db_Fetch()){ + while($rowrss = $sqlrss->fetch()){ $rss[$i]['author'] = ''; $rss[$i]['author_email'] = ''; $rss[$i]['link'] = ''; diff --git a/e107_plugins/featurebox/e_shortcode.php b/e107_plugins/featurebox/e_shortcode.php index 0b985cf7c..1f501a3c2 100644 --- a/e107_plugins/featurebox/e_shortcode.php +++ b/e107_plugins/featurebox/e_shortcode.php @@ -1,7 +1,6 @@ db_Select("featurebox", "*", "fb_mode=1 AND fb_class IN (".USERCLASS_LIST.") ORDER BY fb_class ASC")) + +if($sql->select("featurebox", "*", "fb_mode=1 AND fb_class IN (".USERCLASS_LIST.") ORDER BY fb_class ASC")) { - while($row = $sql->db_Fetch()) + while($row = $sql->fetch()) { if($row['fb_class'] > 0 && $row['fb_class'] < 251) { @@ -33,9 +35,9 @@ if($sql -> db_Select("featurebox", "*", "fb_mode=1 AND fb_class IN (".USERCLASS_ extract($xentry); } } -else if($sql -> db_Select("featurebox", "*", "fb_mode!=1 AND fb_class IN (".USERCLASS_LIST.")")) +else if($sql->select("featurebox", "*", "fb_mode!=1 AND fb_class IN (".USERCLASS_LIST.")")) { - $nfArray = $sql -> db_getList(); + $nfArray = $sql->db_getList(); $entry = $nfArray[array_rand($nfArray)]; extract($entry); } @@ -45,11 +47,11 @@ else } $fbcc = $fb_title; -$fb_title = $tp -> toHTML($fb_title, TRUE,'title'); -$fb_text = $tp -> toHTML($fb_text, TRUE,'body'); +$fb_title = $tp->toHTML($fb_title, TRUE,'title'); +$fb_text = $tp->toHTML($fb_text, TRUE,'body'); if(!$fb_rendertype) { - $ns -> tablerender($fb_title, $fb_text, 'featurebox'); + $ns->tablerender($fb_title, $fb_text, 'featurebox'); } else { diff --git a/e107_plugins/featurebox/featurebox_menu.php b/e107_plugins/featurebox/featurebox_menu.php index 15534dead..5eb6fcd24 100644 --- a/e107_plugins/featurebox/featurebox_menu.php +++ b/e107_plugins/featurebox/featurebox_menu.php @@ -1,10 +1,10 @@ {FEATUREBOX_IMAGE}
    @@ -64,9 +64,9 @@ $FEATUREBOX_TEMPLATE['bootstrap_carousel_right'] = ' '; -$FEATUREBOX_TEMPLATE['bootstrap_carousel_image'] = '{SETIMAGE: w=1900&h=500&crop=1} +$FEATUREBOX_TEMPLATE['bootstrap_carousel_image'] = '{SETIMAGE: w=1905&h=500&crop=1} -
    +
    {FEATUREBOX_IMAGE=placeholder}
    '; diff --git a/e107_plugins/forum/forum_post.php b/e107_plugins/forum/forum_post.php index 53aa584a7..33eb4d25c 100644 --- a/e107_plugins/forum/forum_post.php +++ b/e107_plugins/forum/forum_post.php @@ -661,10 +661,13 @@ function process_upload() return $ret; } } + /* no file uploaded at all, proceed with creating the topic or reply + // TODO don't call process_upload() when no attachments are uploaded.. (check user input first, then call if needed) else { e107::getMessage()->addError('Something went wrong during the attachment uploading process.'); } + */ } function image_getsize($fname) diff --git a/e107_plugins/news/news_months_menu.php b/e107_plugins/news/news_months_menu.php index 4092d8594..cc6f51f3b 100644 --- a/e107_plugins/news/news_months_menu.php +++ b/e107_plugins/news/news_months_menu.php @@ -29,7 +29,8 @@ if(false === $cached) //parse_str($parm, $parms); // FIXME - menu settings... $parms['showarchive'] = 0; - e107::plugLan('blogcalendar_menu'); + //e107::plugLan('blogcalendar_menu'); + e107::lan('blogcalendar_menu', e_LANGUAGE); // FIXME decide on language file structure (#743) $tp = e107::getParser(); $sql = e107::getDb(); @@ -104,7 +105,7 @@ if(false === $cached) if($cached) { if(!$parms['showarchive']) $cached .= ''; - $cached = $ns->tablerender(BLOGCAL_L1.$req_year, $cached, 'news_months_menu', true); + $cached = $ns->tablerender(BLOGCAL_L1." ".$req_year, $cached, 'news_months_menu', true); } e107::getCache()->set($cString, $cached); } diff --git a/e107_web/js/core/mediaManager.js b/e107_web/js/core/mediaManager.js index 7ce11d523..acbaefb5f 100644 --- a/e107_web/js/core/mediaManager.js +++ b/e107_web/js/core/mediaManager.js @@ -119,13 +119,13 @@ $(document).ready(function() // console.log(this); - var id = $(this).attr('data-id'); + var id = $(this).attr('data-id'); // id of the mm item var target = $(this).attr('data-target'); - var path = $(this).attr('data-path'); + var path = $(this).attr('data-path'); // path of the mm item var preview = $(this).attr('data-preview'); var src = $(this).attr('data-src'); var bbcode = $(this).attr('data-bbcode'); // TinyMce/Textarea insert mode - var name = $(this).attr('data-name'); + var name = $(this).attr('data-name'); // title of the mm item var width = $(this).attr('data-width'); var height = ''; // disable for now - will be updated by bb parser. // $(this).attr('data-height'); var type = $(this).attr('data-type'); @@ -198,10 +198,36 @@ $(document).ready(function() $('div#' + target + "_prev", window.top.document).html(preview); // set new value $('span#' + target + "_prev", window.top.document).html(preview); // set new value - // see $frm->filepicker() + // @see $frm->filepicker() if(target !='') { - $('input#' + target , window.top.document).attr('value',path); // set new value + if($('input#' + target)!== undefined) + { + $('input#' + target , window.top.document).attr('value',path); // set new value + } + + + // array mode : + var pathTarget = target + '-path'; + var nameTarget = target + '-name'; + var idTarget = target + '-id'; + + + if($('input#' + pathTarget)!== undefined) + { + $('input#' + pathTarget , window.top.document).attr('value',path); // set new value + } + + if($('input#' + nameTarget)!== undefined) + { + $('input#' + nameTarget , window.top.document).attr('value',name); // set new value + } + + if($('input#' + idTarget)!== undefined) + { + $('input#' + idTarget , window.top.document).attr('value',id); // set new value + } + } diff --git a/fpw.php b/fpw.php index 429bb639c..d81ccb142 100644 --- a/fpw.php +++ b/fpw.php @@ -25,8 +25,7 @@ if (USER && !getperms('0')) if($pref['fpwcode'] && extension_loaded('gd')) { define('USE_IMAGECODE', TRUE); - require_once(e_HANDLER.'secure_img_handler.php'); - $sec_img = new secure_image; + $sec_img = e107::getSecureImg(); } else { @@ -72,17 +71,17 @@ class fpw_shortcodes extends e_shortcode function sc_fpw_captcha_hidden($parm='') { - return; // no longer required - included in renderInput(); + return; // no longer required - included in renderInput(); } function sc_fpw_captcha_img($parm='') { - return $this->secImg->renderImage(); + if(USE_IMAGECODE){ return $this->secImg->renderImage(); } } function sc_fpw_captcha_input($parm='') { - return $this->secImg->renderInput(); + if(USE_IMAGECODE){ return $this->secImg->renderInput(); } } function sc_fpw_logo($parm='') diff --git a/signup.php b/signup.php index 8d1d7d360..3a7e4e000 100644 --- a/signup.php +++ b/signup.php @@ -2,7 +2,7 @@ /* * e107 website system * - * Copyright (C) 2008-2013 e107 Inc (e107.org) + * Copyright (C) 2008-2014 e107 Inc (e107.org) * Released under the terms and conditions of the * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * @@ -10,13 +10,13 @@ * */ - require_once("class2.php"); if(vartrue($_POST['email2'])) // spam-trap. { exit; } + $qs = explode(".", e_QUERY); if($qs[0] != 'activate') @@ -34,8 +34,7 @@ e107::js('core', 'jquery.mailcheck.min.js','jquery',2); include_once(e_HANDLER.'user_extended_class.php'); $usere = new e107_user_extended; -// require_once(e_HANDLER.'calendar/calendar_class.ph_'); -// $cal = new DHTML_Calendar(true); + require_once(e_HANDLER.'validator_class.php'); // require_once(e_HANDLER.'user_handler.php'); $userMethods = e107::getUserSession(); @@ -43,8 +42,6 @@ $userMethods->deleteExpired(); // Delete time-expired partial registrations require_once(e107::coreTemplatePath('signup')); //correct way to load a core template. -//include_once(e_CORE.'shortcodes/batch/signup_shortcodes.php'); - $signup_shortcodes = e107::getScBatch('signup'); // $facebook_shortcodes = e107::getScBatch('facebook',TRUE); @@ -53,7 +50,6 @@ $text = ''; $extraErrors = array(); $error = FALSE; - //------------------------------- // Resend Activation Email //------------------------------- @@ -61,13 +57,13 @@ if((e_QUERY == 'resend') && !USER && ($pref['user_reg_veri'] == 1)) { require_once(HEADERF); - $clean_email = $tp -> toDB($_POST['resend_email']); + $clean_email = $tp->toDB($_POST['resend_email']); if(!check_email($clean_email)) { $clean_email = "xxx"; } - $new_email = $tp -> toDB(varset($_POST['resend_newemail'], '')); + $new_email = $tp->toDB(varset($_POST['resend_newemail'], '')); if(!check_email($new_email )) { $new_email = FALSE; @@ -79,35 +75,35 @@ if((e_QUERY == 'resend') && !USER && ($pref['user_reg_veri'] == 1)) // 'resend_newemail' - corrected email address // 'resend_password' - password (required if changing email address) - if($_POST['resend_email'] && !$new_email && $clean_email && $sql->db_Select_gen("SELECT * FROM #user WHERE user_ban=0 AND user_sess='' AND (`user_loginname`= '".$clean_email."' OR `user_name` = '".$clean_email."' OR `user_email` = '".$clean_email."' ) ")) + if($_POST['resend_email'] && !$new_email && $clean_email && $sql->gen("SELECT * FROM #user WHERE user_ban=0 AND user_sess='' AND (`user_loginname`= '".$clean_email."' OR `user_name` = '".$clean_email."' OR `user_email` = '".$clean_email."' ) ")) { // Account already activated - $ns -> tablerender(LAN_SIGNUP_40,LAN_SIGNUP_41."
    "); + $ns->tablerender(LAN_SIGNUP_40,LAN_SIGNUP_41."
    "); require_once(FOOTERF); exit(); } // Start by looking up the user - if(!$sql->db_Select("user", "*", "(`user_loginname` = '".$clean_email."' OR `user_name` = '".$clean_email."' OR `user_email` = '".$clean_email."' ) AND `user_ban`=".USER_REGISTERED_NOT_VALIDATED." AND `user_sess` !='' LIMIT 1")) + if(!$sql->select("user", "*", "(`user_loginname` = '".$clean_email."' OR `user_name` = '".$clean_email."' OR `user_email` = '".$clean_email."' ) AND `user_ban`=".USER_REGISTERED_NOT_VALIDATED." AND `user_sess` !='' LIMIT 1")) { message_handler("ALERT",LAN_SIGNUP_64.': '.$clean_email); // email (or other info) not valid. require_once(FOOTERF); exit(); } - $row = $sql -> db_Fetch(); + $row = $sql -> fetch(); // We should have a user record here if(trim($_POST['resend_password']) !="" && $new_email) { // Need to change the email address - check password to make sure if ($userMethods->CheckPassword($_POST['resend_password'], $row['user_loginname'], $row['user_password']) === TRUE) { - if ($sql->db_select('user', 'user_id, user_email', "user_email='".$new_email."'")) + if ($sql->select('user', 'user_id, user_email', "user_email='".$new_email."'")) { // Email address already used by someone message_handler("ALERT",LAN_SIGNUP_106); // Duplicate email require_once(FOOTERF); exit(); } - if($sql->db_Update("user", "user_email='".$new_email."' WHERE user_id = '".$row['user_id']."' LIMIT 1 ")) + if($sql->update("user", "user_email='".$new_email."' WHERE user_id = '".$row['user_id']."' LIMIT 1 ")) { $row['user_email'] = $new_email; } @@ -133,12 +129,12 @@ if((e_QUERY == 'resend') && !USER && ($pref['user_reg_veri'] == 1)) if(!sendemail($row['user_email'], $eml['subject'], $eml['message'], $row['user_name'], "", "", $eml['attachments'], $eml['cc'], $eml['bcc'], $returnpath, $returnreceipt,$eml['inline-images'])) { - $ns -> tablerender(LAN_ERROR,LAN_SIGNUP_42); + $ns->tablerender(LAN_ERROR,LAN_SIGNUP_42); $do_log['signup_result'] = LAN_SIGNUP_62; } else { - $ns -> tablerender(LAN_SIGNUP_43,LAN_SIGNUP_44." ".$row['user_email']." - ".LAN_SIGNUP_45."

    "); + $ns->tablerender(LAN_SIGNUP_43,LAN_SIGNUP_44." ".$row['user_email']." - ".LAN_SIGNUP_45."

    "); $do_log['signup_result'] = LAN_SIGNUP_61; } // Now log this (log will ignore if its disabled) @@ -147,7 +143,8 @@ if((e_QUERY == 'resend') && !USER && ($pref['user_reg_veri'] == 1)) exit; } elseif(!$_POST['submit_resend']) - { // Display form to get info from user + { + // Display form to get info from user $text .= "
    @@ -181,7 +178,7 @@ if((e_QUERY == 'resend') && !USER && ($pref['user_reg_veri'] == 1)) "; - $ns -> tablerender(LAN_SIGNUP_47, $text); + $ns->tablerender(LAN_SIGNUP_47, $text); require_once(FOOTERF); exit; } @@ -207,15 +204,6 @@ if(!$_POST) } - - - - - - - - - if(ADMIN && (e_QUERY == 'preview' || e_QUERY == 'test' || e_QUERY == 'preview.aftersignup')) { if(e_QUERY == "preview.aftersignup") @@ -233,7 +221,7 @@ if(ADMIN && (e_QUERY == 'preview' || e_QUERY == 'test' || e_QUERY == 'preview.a } $temp = array(); - $eml = render_email($temp,TRUE); // It ignores the data, anyway + $eml = render_email($temp, TRUE); // It ignores the data, anyway echo $eml['preview']; if(e_QUERY == 'test') @@ -253,6 +241,7 @@ if(ADMIN && (e_QUERY == 'preview' || e_QUERY == 'test' || e_QUERY == 'preview.a exit; } +// FIXME - strange HTML output in browser if ($pref['membersonly_enabled']) { $HEADER = "

    "; @@ -268,12 +257,13 @@ if ($pref['membersonly_enabled']) $FOOTER = '
    '; } +/* if($signup_imagecode) { // require_once(e_HANDLER."secure_img_handler.php"); // $sec_img = new secure_image; } - +*/ if ((USER || ($pref['user_reg'] != 1) || (vartrue($pref['auth_method'],'e107') != 'e107')) && !getperms('0')) { @@ -305,7 +295,7 @@ if (e_QUERY) $qs = explode('.', e_QUERY); if ($qs[0] == 'activate' && (count($qs) == 3 || count($qs) == 4) && $qs[2]) { - //TODO use generic multilanguage selection + // FIXME TODO use generic multilanguage selection => e107::coreLan(); // return the message in the correct language. if(isset($qs[3]) && strlen($qs[3]) == 2 ) { @@ -327,23 +317,28 @@ if (e_QUERY) } - $e107cache->clear("online_menu_totals"); - if ($sql->db_Select("user", "*", "user_sess='".$tp -> toDB($qs[2], true)."' ")) + e107::getCache()->clear("online_menu_totals"); + if ($sql->select("user", "*", "user_sess='".$tp->toDB($qs[2], true)."' ")) { - if ($row = $sql->db_Fetch()) + if ($row = $sql->fetch()) { $dbData = array(); - $dbData['WHERE'] = " user_sess='".$tp -> toDB($qs[2], true)."' "; + $dbData['WHERE'] = " user_sess='".$tp->toDB($qs[2], true)."' "; $dbData['data'] = array('user_ban'=>'0', 'user_sess'=>''); + + // Set initial classes, and any which the user can opt to join - if ($userMethods->userClassUpdate($row, 'userveri')) + if ($init_class = $userMethods->userClassUpdate($row, 'userfull')) { - $dbData['data']['user_class'] = $row['user_class']; + //print_a($init_class); exit; + $dbData['data']['user_class'] = $init_class; } + $userMethods->addNonDefaulted($dbData); validatorClass::addFieldTypes($userMethods->userVettingInfo,$dbData); - $newID = $sql->db_Update('user',$dbData); - if ($newID === FALSE) + $newID = $sql->update('user',$dbData); + + if($newID === FALSE) { $admin_log->e_log_event(10,debug_backtrace(),'USER','Verification Fail',print_r($row,TRUE),FALSE,LOG_TO_ROLLING); require_once(HEADERF); @@ -352,18 +347,19 @@ if (e_QUERY) exit; } - // Log to user audit log if enabled $admin_log->user_audit(USER_AUDIT_EMAILACK,$row); - $e_event->trigger('userveri', $row); // Legacy event - $e_event->trigger('userfull', $row); // 'New' event + e107::getEvent()->trigger('userveri', $row); // Legacy event + e107::getEvent()->trigger('userfull', $row); // 'New' event + if (varset($pref['autologinpostsignup'])) { require_once(e_HANDLER.'login.php'); $usr = new userlogin(); $usr->login($row['user_loginname'], md5($row['user_name'].$row['user_password'].$row['user_join']), 'signup', ''); } + require_once(HEADERF); $text = LAN_SIGNUP_74." ".LAN_SIGNUP_22." ".LAN_SIGNUP_23."
    ".LAN_SIGNUP_24." ".SITENAME; $ns->tablerender(LAN_SIGNUP_75, $text); @@ -372,7 +368,8 @@ if (e_QUERY) } } else - { // Invalid activation code + { + // Invalid activation code header("location: ".e_BASE."index.php"); exit; } @@ -386,7 +383,8 @@ if (e_QUERY) if (isset($_POST['register']) && $pref['user_reg'] == 1) { - $e107cache->clear("online_menu_totals"); + e107::getCache()->clear("online_menu_totals"); + if (isset($_POST['rand_num']) && $signup_imagecode) { if ($badCodeMsg = e107::getSecureImg()->invalidCode($_POST['rand_num'], $_POST['code_verify'])) // better: allows class to return the error. @@ -397,7 +395,7 @@ if (isset($_POST['register']) && $pref['user_reg'] == 1) } } - if($invalid = $e_event->trigger("usersup_veri", $_POST)) + if($invalid = e107::getEvent()->trigger("usersup_veri", $_POST)) { $extraErrors[] = $invalid."\\n"; $error = TRUE; @@ -432,12 +430,15 @@ if (isset($_POST['register']) && $pref['user_reg'] == 1) validatorClass::checkMandatory('user_name,user_loginname', $allData); // Check for missing fields (email done in userValidation() ) validatorClass::dbValidateArray($allData, $userMethods->userVettingInfo, 'user', 0); // Do basic DB-related checks $userMethods->userValidation($allData); // Do user-specific DB checks + if (!isset($allData['errors']['user_password'])) - { // No errors in password - keep it outside the main data array + { + // No errors in password - keep it outside the main data array $savePassword = $allData['data']['user_password']; - unset($allData['data']['user_password']); // Delete the password value in the output array + unset($allData['data']['user_password']); // Delete the password value in the output array } - unset($_POST['password1']); // Restrict the scope of this + + unset($_POST['password1']); // Restrict the scope of this unset($_POST['password2']); $allData['user_ip'] = e107::getIPHandler()->getIP(FALSE); @@ -446,13 +447,13 @@ if (isset($_POST['register']) && $pref['user_reg'] == 1) // check for multiple signups from the same IP address. But ignore localhost if ($allData['user_ip'] != e107::LOCALHOST_IP) { - if($ipcount = $sql->db_Select('user', '*', "user_ip='".$allData['user_ip']."' and user_ban !='2' ")) + if($ipcount = $sql->select('user', '*', "user_ip='".$allData['user_ip']."' and user_ban !='2' ")) { if($ipcount >= $pref['signup_maxip'] && trim($pref['signup_maxip']) != "") { $allData['errors']['user_email'] = ERR_GENERIC; $allData['errortext']['user_email'] = LAN_SIGNUP_71; - $admin_log->log_event('USET_15',LAN_SIGNUP_103.e107::getIPHandler()->getIP(FALSE),4); + $admin_log->log_event('USET_15',LAN_SIGNUP_103.e107::getIPHandler()->getIP(FALSE), 4); } } } @@ -487,7 +488,7 @@ if (isset($_POST['register']) && $pref['user_reg'] == 1) $eufVals = array(); //if (isset($_POST['ue'])) { - $eufVals = $usere->userExtendedValidateAll(varset($_POST['ue'], array()), varset($_POST['hide'],array()), TRUE); // Validate the extended user fields + $eufVals = $usere->userExtendedValidateAll(varset($_POST['ue'], array()), varset($_POST['hide'],array()), TRUE); // Validate the extended user fields } @@ -536,14 +537,14 @@ if (isset($_POST['register']) && $pref['user_reg'] == 1) exit; } - if ($_POST['email'] && $sql->db_Select("user", "*", "user_email='".$_POST['email']."' AND user_ban='".USER_BANNED."'")) + if ($_POST['email'] && $sql->select("user", "*", "user_email='".$_POST['email']."' AND user_ban='".USER_BANNED."'")) { exit; } - $u_key = e_user_model::randomKey(); // Key for signup completion - $allData['data']['user_sess'] = $u_key; // Validation key + $u_key = e_user_model::randomKey(); // Key for signup completion + $allData['data']['user_sess'] = $u_key; // Validation key $userMethods->userClassUpdate($allData['data'], 'usersup'); @@ -555,16 +556,15 @@ if (isset($_POST['register']) && $pref['user_reg'] == 1) { $allData['data']['user_ban'] = USER_VALIDATED; } + // Work out data to be written to user audit trail $signup_data = array('user_name', 'user_loginname', 'user_email', 'user_ip'); // foreach (array() as $f) foreach ($signup_data as $f) { - $signup_data[$f] = $allData['data'][$f]; // Just copy across selected fields + $signup_data[$f] = $allData['data'][$f]; // Just copy across selected fields } - - $allData['data']['user_password'] = $userMethods->HashPassword($savePassword,$allData['data']['user_loginname']); if (vartrue($pref['allowEmailLogin'])) @@ -627,10 +627,9 @@ if (isset($_POST['register']) && $pref['user_reg'] == 1) $adviseLoginName = LAN_SIGNUP_65.': '.$allData['data']['user_loginname'].'
    '.LAN_SIGNUP_66.'
    '; } - + // Verification required (may be by email or by admin) if ($pref['user_reg_veri']) - { // Verification required (may be by email or by admin) - + { // ========== Send Email =========> if (($pref['user_reg_veri'] != 2) && $allData['data']['user_email']) // Don't send if email address blank - means that its not compulsory { @@ -664,9 +663,9 @@ if (isset($_POST['register']) && $pref['user_reg'] == 1) unset($allData['data']['user_password']); } - $e_event->trigger('usersup', $_POST); // Old trigger - send everything in the template, including extended fields. + e107::getEvent()->trigger('usersup', $_POST); // Old trigger - send everything in the template, including extended fields. // FIXME - undocummented feature - userpartial trigger (better trigger name?) - $e_event->trigger('userpartial', array_merge($allData['data'],$eufVals['data'])); // New trigger - send everything in the template, including extended fields. + e107::getEvent()->trigger('userpartial', array_merge($allData['data'],$eufVals['data'])); // New trigger - send everything in the template, including extended fields. require_once(HEADERF); @@ -676,19 +675,37 @@ if (isset($_POST['register']) && $pref['user_reg'] == 1) require_once(FOOTERF); exit; } + // User can be signed up immediately else - { // User can be signed up immediately + { require_once(HEADERF); - if(!$sql -> db_Select("user", "user_id", "user_loginname='".$allData['data']['user_loginname']."' AND user_password='".$allData['data']['user_password']."'")) - { // Error looking up newly created user + if(!$sql->select("user", "user_id", "user_loginname='".$allData['data']['user_loginname']."' AND user_password='".$allData['data']['user_password']."'")) + { + // Error looking up newly created user $ns->tablerender("", LAN_SIGNUP_36); require_once(FOOTERF); exit; } - $e_event->trigger('usersup', $_POST); // send everything in the template, including extended fields. - $e_event->trigger('userfull', array_merge($allData['data'],$eufVals['data'])); // New trigger - send everything in the template, including extended fields. + // Set initial classes, and any which the user can opt to join + if ($init_class = $userMethods->userClassUpdate($row, 'userpartial')) + { + $allData['data']['user_class'] = $init_class; + $user_class_update = $sql->update("user", "user_class = '{$allData['data']['user_class']}' WHERE user_name='{$allData['data']['user_name']}'"); + + if($user_class_update === FALSE) + { + //$admin_log->e_log_event(10,debug_backtrace(),'USER','Userclass update fail',print_r($row,TRUE),FALSE,LOG_TO_ROLLING); + require_once(HEADERF); + $ns->tablerender(LAN_SIGNUP_75, LAN_SIGNUP_101); + require_once(FOOTERF); + exit; + } + } + + e107::getEvent()->trigger('usersup', $_POST); // send everything in the template, including extended fields. + e107::getEvent()->trigger('userfull', array_merge($allData['data'],$eufVals['data'])); // New trigger - send everything in the template, including extended fields. if (isset($pref['signup_text_after']) && (strlen($pref['signup_text_after']) > 2)) { @@ -787,17 +804,11 @@ function headerjs() /** * Create email to send to user who just registered. - * DEPRECATED use $user->email() * @param array $userInfo is the array of user-related DB variables - * * @return array of data for mailer - field names directly compatible */ -/*function render_email($userInfo, $preview = FALSE) +function render_email($userInfo, $preview = FALSE) { - // 1 = Body - // 2 = Subject - - global $pref,$SIGNUPEMAIL_LINKSTYLE,$SIGNUPEMAIL_SUBJECT,$SIGNUPEMAIL_TEMPLATE; if($preview == TRUE) { @@ -808,8 +819,18 @@ function headerjs() $userInfo['user_website'] = "www.test-site.com"; // This may not be defined $userInfo['user_id'] = 0; $userInfo['user_sess'] = "1234567890ABCDEFGHIJKLMNOP"; + $userInfo['user_email'] = 'cameron@teslapower.solar'; + $userInfo['activation_url'] = 'http://whereever.to.activate.com/'; } - + + return e107::getSystemUser($userInfo['user_id'], false)->renderEmail('signup', $userInfo); + + + + /* + + global $pref,$SIGNUPEMAIL_LINKSTYLE,$SIGNUPEMAIL_SUBJECT,$SIGNUPEMAIL_TEMPLATE; + * define('RETURNADDRESS', (substr(SITEURL, -1) == "/" ? SITEURL."signup.php?activate.".$userInfo['user_id'].".".$userInfo['user_sess'] : SITEURL."/signup.php?activate.".$userInfo['user_id'].".".$userInfo['user_sess'].".".e_LAN)); $pass_show = ($pref['user_reg_secureveri'])? '*******' : $userInfo['user_password']; @@ -882,8 +903,10 @@ function headerjs() $ret['preview'] = $ret['mail_body']; // Non-standard field return $ret; + + */ } -*/ + function render_after_signup($error_message) @@ -923,4 +946,4 @@ function render_after_signup($error_message) } -?> \ No newline at end of file +?> diff --git a/usersettings.php b/usersettings.php index 6a3ed7531..bdbd12f10 100644 --- a/usersettings.php +++ b/usersettings.php @@ -21,14 +21,18 @@ Admin log events: USET_01 - admin changed user data */ +/* if(preg_match('/^\/(.*?)\/(usersettings\.php|\/edit)(\?|\/)(\d+)$/i', $_SERVER['REQUEST_URI'], $_usersettings_matches)) { $eplug_admin = TRUE; } +*/ require_once ('class2.php'); +// TODO - Remove all the adminEdit stuff. +/* class usersetting_admin extends e_admin_dispatcher { @@ -85,6 +89,7 @@ class usersettings_admin_ui extends e_admin_ui } } +*/ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE); @@ -204,6 +209,9 @@ if(!is_array($info) || ($info['user_admin'] == 1 && (!defined('ADMINPERMS') || A } } +// TODO - Remove all the adminEdit stuff. +/* + if($adminEdit) // try to stay in Admin when admin is editing. { $mes = e107::getMessage(); @@ -277,7 +285,8 @@ new usersetting_admin(); require_once (e_ADMIN."auth.php"); //e107::getAdminUI()->runPage(); } -else +*/ +// else { require_once (HEADERF); } @@ -288,7 +297,9 @@ else if (isset($_POST['updatesettings']) || isset($_POST['SaveValidatedInfo'])) { - $udata = get_user_data($inp); // Get all the existing user data, including any extended fields +// $udata = get_user_data($inp); //@deprecated // Get all the existing user data, including any extended fields + + $udata = e107::user($inp); // Get all the existing user data, including any extended fields $udata['user_classlist'] = $userMethods->addCommonClasses($udata, FALSE); } @@ -366,6 +377,11 @@ if (isset($_POST['updatesettings'])) $changedUserData = validatorClass::findChanges($allData['data'], $udata,FALSE); +e107::getMessage()->addDebug("
    Existing User Info
    ".print_a($udata,true)); +e107::getMessage()->addDebug('
    $allData
    '.print_a($allData['data'],true)); + +e107::getMessage()->addDebug("
    Posted Changes
    ".print_a($changedUserData,true)); + // Login Name checks - only admin can change login name if (isset($changedUserData['user_loginname'])) { @@ -443,6 +459,9 @@ if (isset($_POST['updatesettings'])) } + + e107::getMessage()->addDebug("

    Processed Posted Changes

    ".print_a($changedUserData,true)); + // All key fields validated here // ----------------------------- // $inp - UID of user whose data is being changed (may not be the currently logged in user) @@ -885,7 +904,7 @@ if (e_QUERY == "update") // e107::scStyle($sc_style); e107::getScBatch('usersettings')->setVars($curVal); -$text .= $tp->parseTemplate($USERSETTINGS_EDIT, false, $usersettings_shortcodes); +$text .= $tp->parseTemplate($USERSETTINGS_EDIT, true, $usersettings_shortcodes); //ParseSC must be set to true so that custom plugin -shortcodes can be utilized. $text .= "