From f4bb971696ba659f69410861264257e902ea9e2a Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 17 Aug 2014 20:53:44 -0700 Subject: [PATCH 01/38] More email templates cleanup. /signup.php?preview working again. --- e107_core/templates/email_template.php | 27 ++++-- e107_handlers/e_parse_class.php | 40 +++++++- e107_handlers/mail.php | 41 +++++--- e107_handlers/shortcode_handler.php | 8 +- e107_handlers/user_model.php | 124 +++++++++++++------------ signup.php | 24 +++-- 6 files changed, 171 insertions(+), 93 deletions(-) diff --git a/e107_core/templates/email_template.php b/e107_core/templates/email_template.php index e6397da8b..69700a81a 100644 --- a/e107_core/templates/email_template.php +++ b/e107_core/templates/email_template.php @@ -321,7 +321,7 @@ $QUICKADDUSER_TEMPLATE = array( - +// ----------------------- Everything above this line is deprecated but may continue to work for a while ------------------------------- // /** Standardized v2 template rewrite @@ -334,6 +334,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'] = " @@ -357,8 +358,13 @@ $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']; @@ -404,15 +410,16 @@ $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. +$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. ?> \ No newline at end of file diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index f0ab5df24..6aa08cff7 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -781,12 +781,50 @@ 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 * diff --git a/e107_handlers/mail.php b/e107_handlers/mail.php index ba5b7a62b..d4ee98a49 100644 --- a/e107_handlers/mail.php +++ b/e107_handlers/mail.php @@ -599,31 +599,47 @@ class e107Email extends PHPMailer public function arraySet($eml) { - if($this->debug) - { - print_a($eml); - } + 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'] + 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']); + // $filter = array("\n", "\t"); + // $tmpl['header'] = str_replace($filter,'', $tmpl['header']); + // $tmpl['footer'] = str_replace($filter,'', $tmpl['footer']); + + $eml['shortcodes']['BODY'] = $eml['email_body']; + $eml['shortcodes']['SUBJECT'] = $eml['email_subject']; + + $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) + { + 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 (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,7 +656,10 @@ class e107Email extends PHPMailer $this->save_bouncepath = $eml['bouncepath']; // Bounce path } - + if($this->debug) + { + print_a($eml); + } diff --git a/e107_handlers/shortcode_handler.php b/e107_handlers/shortcode_handler.php index 6a9bf369c..2a62d25de 100644 --- a/e107_handlers/shortcode_handler.php +++ b/e107_handlers/shortcode_handler.php @@ -764,15 +764,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 +783,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; 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/signup.php b/signup.php index 8d1d7d360..6faef4e10 100644 --- a/signup.php +++ b/signup.php @@ -787,17 +787,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 +802,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 +886,10 @@ function headerjs() $ret['preview'] = $ret['mail_body']; // Non-standard field return $ret; + + */ } -*/ + function render_after_signup($error_message) From 3ca4734a1829742503e22a113119963196ec9a11 Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 18 Aug 2014 05:22:51 -0700 Subject: [PATCH 02/38] Support for admin-ui multiple images in a single field. Usage: 'type' => 'images', 'data' => 'array' --- e107_handlers/admin_ui.php | 19 ++++++++++++++++++- e107_handlers/form_handler.php | 14 ++++++++------ e107_handlers/model_class.php | 7 +++++++ 3 files changed, 33 insertions(+), 7 deletions(-) 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/form_handler.php b/e107_handlers/form_handler.php index baba387e8..5f487075c 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -3358,18 +3358,20 @@ 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; + //TODO 'files' + case 'file': //TODO - thumb, image list shortcode, js tooltip... $label = varset($parms['label'], 'LAN_EDIT'); unset($parms['label']); 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) { From ceb0fff60da5bbc613d86350cae82264dcde7774 Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 18 Aug 2014 22:57:18 -0700 Subject: [PATCH 03/38] Fixes problem where {e_PLUGIN}, {THEME} etc. are replaced with empty values when using parseTemplate(). Now retains theme for use by replaceConstants() etc. --- e107_handlers/e_parse_class.php | 6 +++++- e107_handlers/shortcode_handler.php | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 6aa08cff7..ab5d0966b 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -794,6 +794,8 @@ class e_parse extends e_parser $text = $this->simpleParse($text, $extraCodes, false); } + + return e107::getScParser()->parseCodes($text, $parseSCFiles, $extraCodes, $eVars); } @@ -2091,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/shortcode_handler.php b/e107_handlers/shortcode_handler.php index 2a62d25de..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(); @@ -795,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; @@ -1020,6 +1028,11 @@ class e_parse_shortcode $scCode = file_get_contents($scFile); $this->scList[$code] = $scCode; $_path = $scFile; + } + else + { + // $ret = 'Missing!'; + $_path .= " MISSING!"; } } From 9acc933deaa87ae937b400c021c85005a173c871 Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 18 Aug 2014 23:16:10 -0700 Subject: [PATCH 04/38] Fixed - mail handler now embedding images with the {THEME} constant correctly. --- e107_core/templates/email_template.php | 26 +++++++++++++++++--- e107_handlers/mail.php | 33 +++++++++++++++++++++++--- 2 files changed, 53 insertions(+), 6 deletions(-) diff --git a/e107_core/templates/email_template.php b/e107_core/templates/email_template.php index 69700a81a..54f853a38 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 = "
@@ -357,6 +356,8 @@ $EMAIL_TEMPLATE['default']['footer'] = "

"; +// ------------------------------- + /** * Signup Template. @@ -392,7 +393,7 @@ $EMAIL_TEMPLATE['signup']['body'] = " {SITENAME=link}
{SITEURL} -

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

".($includeSiteButton ? "{SITEBUTTON}" : '')."
"; @@ -402,6 +403,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. @@ -415,6 +421,9 @@ $EMAIL_TEMPLATE['quickadduser']['header'] = $EMAIL_TEMPLATE['default']['header' $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']['subject'] = '{SITENAME}: {SUBJECT} '; @@ -422,4 +431,15 @@ $EMAIL_TEMPLATE['notify']['header'] = $EMAIL_TEMPLATE['default']['header']; / $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_handlers/mail.php b/e107_handlers/mail.php index d4ee98a49..ed792d9d2 100644 --- a/e107_handlers/mail.php +++ b/e107_handlers/mail.php @@ -825,20 +825,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); @@ -848,7 +856,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); @@ -858,15 +871,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); From bf2fa42da7122e6f45ea8518c09886adedf04c66 Mon Sep 17 00:00:00 2001 From: Moc Date: Wed, 20 Aug 2014 00:32:57 +0200 Subject: [PATCH 05/38] Forum plugin - fixed error message incorrectly displaying when creating topic/reply with no attachments --- e107_plugins/forum/forum_post.php | 3 +++ 1 file changed, 3 insertions(+) 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) From 8aa40f3ce1852bd8dda238b691459bc1ae0fbd1a Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 20 Aug 2014 02:00:32 -0700 Subject: [PATCH 06/38] Fixes $frm->password() styling when used with bootstrap on the frontend. --- e107_handlers/form_handler.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 5f487075c..b639ea5c4 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -1037,7 +1037,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); + } } From 8c995fbbc81a15cd862c96ce282428de1e3612d0 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 20 Aug 2014 02:00:50 -0700 Subject: [PATCH 07/38] global error fix. --- e107_handlers/mail.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e107_handlers/mail.php b/e107_handlers/mail.php index ed792d9d2..5eb2b21bb 100644 --- a/e107_handlers/mail.php +++ b/e107_handlers/mail.php @@ -600,11 +600,11 @@ class e107Email extends PHPMailer { - + $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'] { From 33e3ef5b3c33ebb918f4f717a51da3d072dc683d Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 20 Aug 2014 02:02:01 -0700 Subject: [PATCH 08/38] Added option for 'registered members' while in maintenance mode. --- e107_admin/ugflag.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 .= " From 0408658901286e3594665e4fd78137d0e1641fd9 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 20 Aug 2014 04:23:42 -0700 Subject: [PATCH 09/38] Fixes #543 - extra 'OR' on avatar selection. Also correct radio button alignment in bootstrap. --- .../batch/usersettings_shortcodes.php | 22 ++++++++++++++----- e107_core/shortcodes/single/user_avatar.php | 5 ++++- e107_handlers/form_handler.php | 8 +++++-- 3 files changed, 27 insertions(+), 8 deletions(-) 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_handlers/form_handler.php b/e107_handlers/form_handler.php index b639ea5c4..df0f8564c 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -602,8 +602,12 @@ class e_form $text .= "
".LAN_USET_26." -
-
OR
"; + "; + + if(count($avFiles) > 0) + { + $text .= "
OR
"; + } } From 082f26c2b9a304f483cb80ad8bf249c367b1a7d6 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 20 Aug 2014 05:02:00 -0700 Subject: [PATCH 10/38] Fixes #590 - completely broken user -> edit admin area on fresh install. Upgraded to use admin-ui. Funtional for basic changes such as password, signature, admin perms etc. --- e107_admin/users.php | 131 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 107 insertions(+), 24 deletions(-) diff --git a/e107_admin/users.php b/e107_admin/users.php index 30b6c65a2..047f316b7 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; } @@ -189,7 +197,7 @@ 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'); //TODO - finish 'user' type, set 'data' to all editable fields, set 'noedit' for all non-editable fields @@ -200,28 +208,28 @@ class users_admin_ui extends e_admin_ui // '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_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, 'type' => 'text', 'data'=>'str', 'width' => 'auto','thclass' => 'left first'), // Display name + 'user_loginname' => array('title' => LAN_USER_02, 'type' => 'text', 'data'=>'str', 'width' => 'auto'), // User name + 'user_login' => array('title' => LAN_USER_03, 'type' => 'text', 'data'=>'str', 'width' => 'auto'), // Real name (no real vetting) + 'user_customtitle' => array('title' => LAN_USER_04, 'type' => 'text', 'data'=>'str', 'width' => 'auto'), // No real vetting + 'user_password' => array('title' => LAN_USER_05, 'type' => 'method', 'data'=>'str', 'width' => 'auto'), //TODO add md5 option to form handler? + 'user_sess' => array('title' => 'Session', 'noedit'=>true, 'type' => 'text', 'width' => 'auto'), // Photo + 'user_image' => array('title' => LAN_USER_07, 'type' => 'dropdown', 'data'=>'str', 'width' => 'auto'), // Avatar + 'user_email' => array('title' => LAN_EMAIL, 'type' => 'text', 'inline'=>true, 'data'=>'str', 'width' => 'auto'), + 'user_hideemail' => array('title' => LAN_USER_10, 'type' => 'boolean', 'data'=>'int', 'width' => 'auto', 'thclass'=>'center', 'class'=>'center', 'filter'=>true, 'batch'=>true, 'readParms'=>'trueonly=1'), + 'user_xup' => array('title' => 'Xup', 'noedit'=>true, 'type' => 'text', 'width' => 'auto'), + 'user_class' => array('title' => LAN_USER_12, 'type' => 'userclasses' , 'inline'=>true, 'writeParms' => 'classlist=classes', 'inline'=>true, 'filter'=>true, 'batch'=>true), + 'user_join' => array('title' => LAN_USER_14, 'noedit'=>true, 'type' => 'datestamp', 'width' => 'auto', 'writeParms'=>'readonly=1'), + 'user_lastvisit' => array('title' => LAN_USER_15, 'noedit'=>true, 'type' => 'datestamp', 'width' => 'auto'), + 'user_currentvisit' => array('title' => LAN_USER_16, 'noedit'=>true, 'type' => 'datestamp', 'width' => 'auto'), + 'user_comments' => array('title' => LAN_USER_17, 'noedit'=>true, 'type' => 'int', 'width' => 'auto','thclass'=>'right','class'=>'right'), + 'user_lastpost' => array('title' => 'Last Post', 'noedit'=>true, 'type' => 'datestamp', 'width' => 'auto'), + 'user_ip' => array('title' => LAN_USER_18, '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_visits' => array('title' => LAN_USER_21, 'noedit'=>true, '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_perms' => array('title' => LAN_USER_23, 'type' => 'method', 'data'=>'str', 'width' => 'auto'), + 'user_pwchange' => array('title' => LAN_USER_24, 'noedit'=>true, 'type'=>'datestamp' , 'width' => 'auto'), ); @@ -249,6 +257,13 @@ class users_admin_ui extends e_admin_ui $sql = e107::getDb(); $tp = e107::getParser(); + if($this->getAction() == 'edit') + { + $this->fields['user_class']['noedit'] = true; + } + + + // 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")) { @@ -265,7 +280,7 @@ class users_admin_ui extends e_admin_ui } $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'); @@ -275,6 +290,31 @@ class users_admin_ui extends e_admin_ui unset($this->fields['options']); } + $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; + + // $avs = array_merge($uploaded,$system); + // print_a($uploaded); + // print_a($avs); + + $this->fields['user_image']['writeParms'] = $avs; + //FIXME - handle user extended search... //$this->_alias_parsed = false; //$this->parseAliases(); @@ -286,6 +326,26 @@ class users_admin_ui extends e_admin_ui } + + public function beforeUpdate($new_data, $old_data, $id) + { + 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']); + } + + return $new_data; + } + /** * Unban user trigger * @param int $userid @@ -1879,6 +1939,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( From 3bd404b17fc98c46c35551e338eea742572b09ed Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 20 Aug 2014 22:21:00 -0700 Subject: [PATCH 11/38] Fix for maintenance flag check. --- e107_handlers/redirection_class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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); From 5bf9d9bc7d5b0b6353c2e688c6c9e8a03c4b24b7 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 20 Aug 2014 22:23:48 -0700 Subject: [PATCH 12/38] Fix for custom shortcode use in usersettings template. --- usersettings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usersettings.php b/usersettings.php index 6a3ed7531..5200b2bb3 100644 --- a/usersettings.php +++ b/usersettings.php @@ -885,7 +885,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 .= "
From 8f4162ac5c5a2dc8c0ca17b5ba21bf84e53b88d0 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 20 Aug 2014 22:27:03 -0700 Subject: [PATCH 13/38] Added option for default starting slide in carousel. --- e107_handlers/form_handler.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index df0f8564c..74620dca4 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']; From 339bd115d0b2e2048234e0f32593af97963ec85c Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 20 Aug 2014 22:27:36 -0700 Subject: [PATCH 14/38] Removed pointless heading from usersettings template. --- e107_core/templates/usersettings_template.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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."

    - +
    From d6dc4aa7164068c68d676bb17661e7c88f3702af Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 21 Aug 2014 13:15:47 -0700 Subject: [PATCH 15/38] Fixes #698 - uploaded avatar was being removed unintentionally. --- e107_handlers/form_handler.php | 4 ++-- usersettings.php | 23 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 74620dca4..85786ffdf 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -573,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) { diff --git a/usersettings.php b/usersettings.php index 5200b2bb3..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) From 361c471bc727e48596c9c52fd2d361cab5f4766e Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 21 Aug 2014 14:21:49 -0700 Subject: [PATCH 16/38] Admin -> users area now has a tab for extended fields. TODO: field-type detection for extended fields. --- e107_admin/users.php | 142 +++++++++++++++++++++++++++++-------------- 1 file changed, 97 insertions(+), 45 deletions(-) diff --git a/e107_admin/users.php b/e107_admin/users.php index 047f316b7..88259fcdc 100644 --- a/e107_admin/users.php +++ b/e107_admin/users.php @@ -176,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; @@ -199,37 +199,38 @@ class users_admin_ui extends e_admin_ui */ 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', 'data'=>'str', 'width' => 'auto','thclass' => 'left first'), // Display name - 'user_loginname' => array('title' => LAN_USER_02, 'type' => 'text', 'data'=>'str', 'width' => 'auto'), // User name - 'user_login' => array('title' => LAN_USER_03, 'type' => 'text', 'data'=>'str', 'width' => 'auto'), // Real name (no real vetting) - 'user_customtitle' => array('title' => LAN_USER_04, 'type' => 'text', 'data'=>'str', 'width' => 'auto'), // No real vetting - 'user_password' => array('title' => LAN_USER_05, 'type' => 'method', 'data'=>'str', 'width' => 'auto'), //TODO add md5 option to form handler? - 'user_sess' => array('title' => 'Session', 'noedit'=>true, 'type' => 'text', 'width' => 'auto'), // Photo - 'user_image' => array('title' => LAN_USER_07, 'type' => 'dropdown', 'data'=>'str', 'width' => 'auto'), // Avatar - 'user_email' => array('title' => LAN_EMAIL, 'type' => 'text', 'inline'=>true, 'data'=>'str', 'width' => 'auto'), - 'user_hideemail' => array('title' => LAN_USER_10, 'type' => 'boolean', 'data'=>'int', 'width' => 'auto', 'thclass'=>'center', 'class'=>'center', 'filter'=>true, 'batch'=>true, 'readParms'=>'trueonly=1'), - 'user_xup' => array('title' => 'Xup', 'noedit'=>true, 'type' => 'text', 'width' => 'auto'), - 'user_class' => array('title' => LAN_USER_12, 'type' => 'userclasses' , 'inline'=>true, 'writeParms' => 'classlist=classes', 'inline'=>true, 'filter'=>true, 'batch'=>true), - 'user_join' => array('title' => LAN_USER_14, 'noedit'=>true, 'type' => 'datestamp', 'width' => 'auto', 'writeParms'=>'readonly=1'), - 'user_lastvisit' => array('title' => LAN_USER_15, 'noedit'=>true, 'type' => 'datestamp', 'width' => 'auto'), - 'user_currentvisit' => array('title' => LAN_USER_16, 'noedit'=>true, 'type' => 'datestamp', 'width' => 'auto'), - 'user_comments' => array('title' => LAN_USER_17, 'noedit'=>true, 'type' => 'int', 'width' => 'auto','thclass'=>'right','class'=>'right'), - 'user_lastpost' => array('title' => 'Last Post', 'noedit'=>true, 'type' => 'datestamp', 'width' => 'auto'), - 'user_ip' => array('title' => LAN_USER_18, 'noedit'=>true, '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, 'noedit'=>true, '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', 'data'=>'str', 'width' => 'auto'), - 'user_pwchange' => array('title' => LAN_USER_24, 'noedit'=>true, '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'), ); @@ -251,6 +252,8 @@ 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() { @@ -262,12 +265,11 @@ class users_admin_ui extends e_admin_ui $this->fields['user_class']['noedit'] = true; } - - // 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($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")) { - // FIXME use the handler to build fields and field attributes + // 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()) @@ -275,7 +277,9 @@ 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"); @@ -289,7 +293,24 @@ 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; + //$this->parseAliases(); + + // if(isset ($_POST['adduser'])) + // { + // addUser(); + // } + + + + } + + protected function getAvatarList() + { $avs = array(''=>LAN_NONE); $upload = array(); $sys = array(); @@ -307,28 +328,16 @@ class users_admin_ui extends e_admin_ui } $avs['uploaded'] = $upload; - $avs['system'] = $sys; + $avs['system'] = $sys; - // $avs = array_merge($uploaded,$system); - // print_a($uploaded); - // print_a($avs); - - $this->fields['user_image']['writeParms'] = $avs; - - //FIXME - handle user extended search... - //$this->_alias_parsed = false; - //$this->parseAliases(); - - // if(isset ($_POST['adduser'])) - // { - // addUser(); - // } - + 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']; @@ -343,8 +352,51 @@ class users_admin_ui extends e_admin_ui $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 From 4265dc5171be8edd0b2a7eb8d808777a1fcc1dbd Mon Sep 17 00:00:00 2001 From: Moc Date: Sun, 24 Aug 2014 13:34:00 +0200 Subject: [PATCH 17/38] #740 - IP address in contact email now displays in IPv4 format if possible --- contact.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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"; From 63ebe9d25191cb88eaac6dd45d43eac61017d72f Mon Sep 17 00:00:00 2001 From: Jimako Date: Tue, 26 Aug 2014 09:11:17 +0200 Subject: [PATCH 18/38] corrent month in calendar title This fixes #741 --- e107_plugins/blogcalendar_menu/calendar.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 +?> From 94dc5ab7f06099759464e02bf69255a4df6cc6d8 Mon Sep 17 00:00:00 2001 From: Moc Date: Tue, 26 Aug 2014 18:45:13 +0200 Subject: [PATCH 19/38] #743 - Temporary fix for LAN file loading --- e107_plugins/news/news_months_menu.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/e107_plugins/news/news_months_menu.php b/e107_plugins/news/news_months_menu.php index 4092d8594..9a626be1d 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(); From 6b305e6ada655ea89cd1b62bccd7d80876087181 Mon Sep 17 00:00:00 2001 From: Moc Date: Tue, 26 Aug 2014 18:47:36 +0200 Subject: [PATCH 20/38] #743 - Space fix between LAN and year --- e107_plugins/news/news_months_menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e107_plugins/news/news_months_menu.php b/e107_plugins/news/news_months_menu.php index 9a626be1d..cc6f51f3b 100644 --- a/e107_plugins/news/news_months_menu.php +++ b/e107_plugins/news/news_months_menu.php @@ -105,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); } From 7cc591a1805b9922d858760b66230b929459393e Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 26 Aug 2014 15:42:36 -0700 Subject: [PATCH 21/38] Fix for featurebox bootstrap image-only template. --- e107_plugins/featurebox/templates/featurebox_template.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/e107_plugins/featurebox/templates/featurebox_template.php b/e107_plugins/featurebox/templates/featurebox_template.php index ef662deeb..fbd4358b8 100644 --- a/e107_plugins/featurebox/templates/featurebox_template.php +++ b/e107_plugins/featurebox/templates/featurebox_template.php @@ -11,7 +11,7 @@ global $sc_style; // e107 v2.x Defaults. -$FEATUREBOX_TEMPLATE['bootstrap_carousel_default'] = '{SETIMAGE: w=1900&h=450&crop=1} +$FEATUREBOX_TEMPLATE['bootstrap_carousel_default'] = '{SETIMAGE: w=1905&h=450&crop=1}
    {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}
    '; From 2f9dae5eedb79f6d7da2435f07353c875c5d54fe Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 26 Aug 2014 15:49:24 -0700 Subject: [PATCH 22/38] Email admin->notify template working with new template standard. --- e107_core/templates/email_template.php | 38 ++++++-------------------- e107_handlers/mail.php | 15 ++++++++-- e107_handlers/mail_manager_class.php | 34 ++++++++++++++++++++++- e107_handlers/notify_class.php | 20 ++++++++------ 4 files changed, 65 insertions(+), 42 deletions(-) diff --git a/e107_core/templates/email_template.php b/e107_core/templates/email_template.php index 54f853a38..aecc3d9a9 100644 --- a/e107_core/templates/email_template.php +++ b/e107_core/templates/email_template.php @@ -228,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' => '' - ); + //------------------------------------------------------------- @@ -308,14 +289,6 @@ $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' - ); @@ -421,16 +394,23 @@ $EMAIL_TEMPLATE['quickadduser']['header'] = $EMAIL_TEMPLATE['default']['header' $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 +// 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. diff --git a/e107_handlers/mail.php b/e107_handlers/mail.php index 5eb2b21bb..1be3ac1dc 100644 --- a/e107_handlers/mail.php +++ b/e107_handlers/mail.php @@ -606,7 +606,7 @@ class e107Email extends PHPMailer { - if($tmpl = e107::getCoreTemplate('email', $eml['template'], true, true)) // $EMAIL_TEMPLATE['default'] + if($tmpl = e107::getCoreTemplate('email', $eml['template'], true, true)) //FIXME - Core template is failing with template 'notify'. Works with theme template. Issue with core template registry? { // $filter = array("\n", "\t"); // $tmpl['header'] = str_replace($filter,'', $tmpl['header']); @@ -623,6 +623,7 @@ class e107Email extends PHPMailer if($this->debug) { + echo "

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

    "; print_a($tmpl); } @@ -630,6 +631,15 @@ class e107Email extends PHPMailer $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 @@ -658,12 +668,11 @@ class e107Email extends PHPMailer if($this->debug) { + echo "

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

    "; print_a($eml); } - - if (vartrue($eml['returnreceipt'])) $this->ConfirmReadingTo = $eml['returnreceipt']; if (vartrue($eml['email_inline_images'])) $this->addInlineImages($eml['email_inline_images']); if (vartrue($eml['email_priority'])) $this->Priority = $eml['email_priority']; 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/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); } From 8f0f9027a571209fb8f831c715bcb084bfe4c1e6 Mon Sep 17 00:00:00 2001 From: Moc Date: Fri, 29 Aug 2014 14:17:37 +0200 Subject: [PATCH 23/38] signup.php code clean-up --- signup.php | 127 ++++++++++++++++++++++++++--------------------------- 1 file changed, 63 insertions(+), 64 deletions(-) diff --git a/signup.php b/signup.php index 6faef4e10..d4c03f964 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->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."' ) ")) { // 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,27 @@ 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')) { $dbData['data']['user_class'] = $row['user_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 +346,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 +367,8 @@ if (e_QUERY) } } else - { // Invalid activation code + { + // Invalid activation code header("location: ".e_BASE."index.php"); exit; } @@ -386,7 +382,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 +394,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 +429,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 +446,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 +487,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 +536,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 +555,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 +626,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 +662,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); @@ -680,15 +678,16 @@ if (isset($_POST['register']) && $pref['user_reg'] == 1) { // 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->db_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. + 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)) { From f912c88a80efac0e425a2992df892b2a88082a87 Mon Sep 17 00:00:00 2001 From: Moc Date: Fri, 29 Aug 2014 14:56:16 +0200 Subject: [PATCH 24/38] #580 - Initial userclasses are now set after signing up (and after email activation) --- e107_handlers/user_handler.php | 18 +++++++++++------- signup.php | 28 +++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 12 deletions(-) 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/signup.php b/signup.php index d4c03f964..97291d362 100644 --- a/signup.php +++ b/signup.php @@ -326,11 +326,12 @@ if (e_QUERY) $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); @@ -674,11 +675,12 @@ 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']."'")) + 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); @@ -686,6 +688,22 @@ if (isset($_POST['register']) && $pref['user_reg'] == 1) exit; } + // 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. From d9cce6e21a0cea2fbbf23f0b5a2ac379210e9435 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 30 Aug 2014 21:00:17 -0700 Subject: [PATCH 25/38] 'files' option added to admin-ui. requires data='array'. --- e107_handlers/form_handler.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 85786ffdf..cfca25ca7 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -3045,7 +3045,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; @@ -3383,7 +3395,16 @@ class e_form break; - //TODO 'files' + case 'files': + $ret = '
      '; + for ($i=0; $i < 5; $i++) + { + $k = $key.'['.$i.'][path]'; + $ival = $value[$i]['path']; + $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'); From bb6ebd1732ba7fbce3d04d3e235924999f15dbf8 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 31 Aug 2014 14:54:47 -0700 Subject: [PATCH 26/38] Filepicker now saves media-manager id and name of file when array is used. --- e107_handlers/form_handler.php | 54 +++++++++++++++++++++++++------- e107_web/js/core/mediaManager.js | 36 ++++++++++++++++++--- 2 files changed, 74 insertions(+), 16 deletions(-) diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index cfca25ca7..854db518f 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -776,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; @@ -3396,11 +3420,19 @@ class e_form 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.'][path]'; + // $ival = $value[$i]['path']; + $k = $key.'['.$i.']'; + $ival = $value[$i]; $ret .= '
    1. '.$this->filepicker($k, $ival, defset($label, $label), $parms).'
    2. '; } $ret .= '
    '; 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 + } + } From ce539d82c49c7e739d8c8dd179cb503ce994c4ef Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 3 Sep 2014 14:09:10 -0700 Subject: [PATCH 27/38] Mailing now considered to be 'frontend' when loading templates. Fixes consistency issues. (eg. login notifications etc.) --- e107_handlers/e107_class.php | 2 +- e107_handlers/e_parse_class.php | 2 +- e107_handlers/mail.php | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) 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 ab5d0966b..66253db74 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -2093,7 +2093,7 @@ class e_parse extends e_parser 'e_HANDLER/' => '{e_HANDLER}', // BC 'e_MEDIA/' => '{e_MEDIA}', 'e_WEB/' => '{e_ADMIN}', - 'THEME/' => '{THEME}', + // 'THEME/' => '{THEME}', ); diff --git a/e107_handlers/mail.php b/e107_handlers/mail.php index 1be3ac1dc..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); @@ -606,14 +609,11 @@ class e107Email extends PHPMailer { - if($tmpl = e107::getCoreTemplate('email', $eml['template'], true, true)) //FIXME - Core template is failing with template 'notify'. Works with theme template. Issue with core template registry? - { - // $filter = array("\n", "\t"); - // $tmpl['header'] = str_replace($filter,'', $tmpl['header']); - // $tmpl['footer'] = str_replace($filter,'', $tmpl['footer']); - - $eml['shortcodes']['BODY'] = $eml['email_body']; - $eml['shortcodes']['SUBJECT'] = $eml['email_subject']; + 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']; From 673fa912ffedb2ab76ce3d9721a280b11e12a5dc Mon Sep 17 00:00:00 2001 From: Tijn Kuyper Date: Thu, 4 Sep 2014 15:15:36 +0200 Subject: [PATCH 28/38] Fix typo in signup.php (may help #755) --- signup.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/signup.php b/signup.php index 97291d362..3a7e4e000 100644 --- a/signup.php +++ b/signup.php @@ -75,7 +75,7 @@ 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->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."
    "); require_once(FOOTERF); @@ -946,4 +946,4 @@ function render_after_signup($error_message) } -?> \ No newline at end of file +?> From 1096302c3519788b12e8873dad9b92f831960ace Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 5 Sep 2014 13:13:50 -0700 Subject: [PATCH 29/38] Fixed: missing maxlength attribute added to form handler. --- e107_handlers/form_handler.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 854db518f..0b55bbb71 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -1127,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) : ''); } @@ -2052,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; @@ -2191,7 +2197,8 @@ class e_form 'placeholder' => '', 'pattern' => '', 'other' => '', - 'autocomplete' => '' + 'autocomplete' => '', + 'maxlength' => '' // 'multiple' => false, - see case 'select' ); From 7d5fa8ca7055ab93116e4e64174dde1e51a28ab1 Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 5 Sep 2014 13:22:47 -0700 Subject: [PATCH 30/38] Removed debug info from last commit. --- e107_handlers/form_handler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 0b55bbb71..0146f4623 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -1128,7 +1128,7 @@ class e_form $options = $this->format_options('textarea', $name, $options); - print_a($options); +// print_a($options); //never allow id in format name-value for text fields return "".(false !== $counter ? $this->hidden('__'.$name.'autoheight_opt', $counter) : ''); } From c77876955668d5ad154189f38c33d4e577656fd7 Mon Sep 17 00:00:00 2001 From: Moc Date: Sun, 7 Sep 2014 16:34:17 +0200 Subject: [PATCH 31/38] Issue #195 - Incompatible plugin list updated --- e107_admin/admin.php | 1 + 1 file changed, 1 insertion(+) 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 ); From 542fe9252deb0a67bf9f509c571cc5d03fb9a624 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 9 Sep 2014 04:37:23 -0700 Subject: [PATCH 32/38] Raw option added for {FAQ_CATEGORY} for name without link. --- e107_plugins/faqs/faqs.php | 55 ++++++++++++++++++--------- e107_plugins/faqs/faqs_shortcodes.php | 6 +++ 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/e107_plugins/faqs/faqs.php b/e107_plugins/faqs/faqs.php index a60bd6b1d..ab9241728 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"); } } @@ -126,12 +132,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']); } @@ -184,19 +190,32 @@ class faq $tp = e107::getParser(); $ret = array(); + $template = e107::getTemplate('faqs'); + + // 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); + $sql->gen($query); + $prevcat = ""; $sc = e107::getScBatch('faqs',TRUE); + $text = $tp->parseTemplate($template['start'], true, $sc); + // var_dump($sc); - while ($rw = $sql->db_Fetch()) + while ($rw = $sql->fetch()) { $sc->setVars($rw); @@ -204,23 +223,25 @@ class faq { if($prevcat !='') { - $text .= $tp->parseTemplate($FAQ_LISTALL_END, true, $sc); + $text .= $tp->parseTemplate($template['all']['end'], true, $sc); } $text .= "\n\n\n\n"; - $text .= $tp->parseTemplate($FAQ_LISTALL_START, true, $sc); + $text .= $tp->parseTemplate($template['all']['start'], true, $sc); $start = TRUE; } - $text .= $tp->parseTemplate($FAQ_LISTALL_LOOP, true, $sc); + $text .= $tp->parseTemplate($template['all']['item'], true, $sc); $prevcat = $rw['faq_info_order']; } - $text .= $tp->parseTemplate($FAQ_LISTALL_END, true, $sc); - $text .= $tp->parseTemplate($FAQ_END, true, $sc); + $text .= $tp->parseTemplate($template['all']['end'], true, $sc); + $text .= $tp->parseTemplate($template['end'], true, $sc); $ret['title'] = FAQLAN_FAQ; $ret['text'] = $text; - $ret['caption'] = vartrue($caption); + $ret['caption'] = varset($template['all']['caption']) ? $tp->parseTemplate($template['all']['caption'], true, $sc) : LAN_PLUGIN_FAQS_FRONT_NAME; + + return $ret; } diff --git a/e107_plugins/faqs/faqs_shortcodes.php b/e107_plugins/faqs/faqs_shortcodes.php index 98c78c354..f384f89e7 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']).""; } From 58d18da1774eb2a360ffbbc118b198d28b9c6341 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 9 Sep 2014 20:22:59 -0700 Subject: [PATCH 33/38] Added basic FAQ breadcrumb. More work to do. --- e107_plugins/faqs/faqs.php | 113 +++++++++++++++++++------- e107_plugins/faqs/faqs_shortcodes.php | 28 ++++++- 2 files changed, 111 insertions(+), 30 deletions(-) diff --git a/e107_plugins/faqs/faqs.php b/e107_plugins/faqs/faqs.php index ab9241728..800b6cbda 100644 --- a/e107_plugins/faqs/faqs.php +++ b/e107_plugins/faqs/faqs.php @@ -55,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; @@ -122,7 +132,8 @@ if (isset($_POST['commentsubmit'])) } else { - $ftmp = $faq->view_all(); + $srch = vartrue($_GET['srch']); + $ftmp = $faq->view_all($srch); $caption = FAQLAN_FAQ; } @@ -175,6 +186,8 @@ exit; class faq { var $pref = array(); + protected $sc = null; + protected $template = null; function __construct() { @@ -184,13 +197,14 @@ 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); @@ -205,41 +219,27 @@ class faq //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->gen($query); + $prevcat = ""; - $sc = e107::getScBatch('faqs',TRUE); + + $this->sc = e107::getScBatch('faqs',TRUE); - $text = $tp->parseTemplate($template['start'], true, $sc); + $text = $tp->parseTemplate($template['start'], true, $this->sc); // var_dump($sc); - while ($rw = $sql->fetch()) - { - $sc->setVars($rw); - - if($rw['faq_info_order'] != $prevcat) - { - if($prevcat !='') - { - $text .= $tp->parseTemplate($template['all']['end'], true, $sc); - } - $text .= "\n\n\n\n"; - $text .= $tp->parseTemplate($template['all']['start'], true, $sc); - $start = TRUE; - } - - $text .= $tp->parseTemplate($template['all']['item'], true, $sc); - $prevcat = $rw['faq_info_order']; - - } - $text .= $tp->parseTemplate($template['all']['end'], true, $sc); - $text .= $tp->parseTemplate($template['end'], true, $sc); + $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['all']['caption']) ? $tp->parseTemplate($template['all']['caption'], true, $sc) : LAN_PLUGIN_FAQS_FRONT_NAME; + $ret['caption'] = varset($template['caption']) ? $tp->parseTemplate($template['caption'], true, $this->sc) : LAN_PLUGIN_FAQS_FRONT_NAME; @@ -247,6 +247,61 @@ class faq } + + function view_all_query($srch='') + { + $sql = e107::getDb(); + $tp = e107::getParser(); + + if(!empty($srch)) + { + $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; + } + + $text = ''; + + while ($rw = $sql->fetch()) + { + $this->sc->setVars($rw); + + if($rw['faq_info_order'] != $prevcat) + { + if($prevcat !='') + { + $text .= $tp->parseTemplate($template['all']['end'], true, $this->sc); + } + + $text .= "\n\n\n\n"; + $text .= $tp->parseTemplate($this->template['all']['start'], true, $this->sc); + $start = TRUE; + } + + $text .= $tp->parseTemplate($this->template['all']['item'], true, $this->sc); + $prevcat = $rw['faq_info_order']; + + } + $text .= $tp->parseTemplate($this->template['all']['end'], true, $this->sc); + + + return $text; + + } + + + + // ------------- 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 f384f89e7..bb522dd1f 100644 --- a/e107_plugins/faqs/faqs_shortcodes.php +++ b/e107_plugins/faqs/faqs_shortcodes.php @@ -185,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); + + } + } From bbc47da906b1d8f64e27f1e556b6d2eee06d5f77 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 9 Sep 2014 20:51:55 -0700 Subject: [PATCH 34/38] Fix for empty search results. --- e107_plugins/faqs/faqs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e107_plugins/faqs/faqs.php b/e107_plugins/faqs/faqs.php index 800b6cbda..8b14731bd 100644 --- a/e107_plugins/faqs/faqs.php +++ b/e107_plugins/faqs/faqs.php @@ -267,7 +267,7 @@ class faq if(!$sql->gen($query)) { - return; + return "
    ".$srch." was not found in search results.
    " ; //TODO LAN } $text = ''; From 6648dcb10b643bf469b0255979b66140f48cf519 Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 11 Sep 2014 03:43:46 -0700 Subject: [PATCH 35/38] Fixed path to request.php (when using SEF Urls). --- e107_core/bbcodes/file.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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.""; } From 7987a15ec7018f9676b785809c0548f0e15ea591 Mon Sep 17 00:00:00 2001 From: Moc Date: Thu, 11 Sep 2014 18:30:52 +0200 Subject: [PATCH 36/38] Apply USE_IMAGECODE check in fpw shortcodes. Fixes fatal error when fpwcode pref is 0. Removed unnecessary file require. --- fpw.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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='') From 096f4d08dbfdcc15dfd9f0fe58980762460b0ece Mon Sep 17 00:00:00 2001 From: Moc Date: Thu, 11 Sep 2014 20:57:52 +0200 Subject: [PATCH 37/38] Featurebox plugin - Code cleanup --- e107_plugins/featurebox/admin_config.php | 6 ++---- e107_plugins/featurebox/e_rss.php | 4 ++-- e107_plugins/featurebox/e_shortcode.php | 1 - e107_plugins/featurebox/featurebox.php | 22 +++++++++++---------- e107_plugins/featurebox/featurebox_menu.php | 4 ++-- 5 files changed, 18 insertions(+), 19 deletions(-) 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 @@ Date: Sun, 14 Sep 2014 17:40:02 -0700 Subject: [PATCH 38/38] Fix for backup cron not working. --- e107_handlers/mysql_class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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";