Date: Tue, 21 Mar 2017 12:29:05 -0700
Subject: [PATCH 10/66] Fixes #1984 Disable CHAP when SSL is enabled or
encryption method is not legacy MD5
---
e107_admin/prefs.php | 11 ++++++++++-
e107_themes/bootstrap3/admin_style.css | 2 +-
e107_web/js/core/admin.jquery.js | 4 ++++
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/e107_admin/prefs.php b/e107_admin/prefs.php
index fbee9061d..83ac79286 100644
--- a/e107_admin/prefs.php
+++ b/e107_admin/prefs.php
@@ -96,6 +96,12 @@ if(isset($_POST['updateprefs']))
$mes->addError(PRFLAN_211);
}
+
+ if(!empty($_POST['passwordEncoding']) || !empty($_POST['ssl_enabled']))
+ {
+ $_POST['password_CHAP'] = 0; // disable chap unless using md5 without SSL.
+ }
+
// Table of range checking values - min and max for numerics. Only do the important ones
$pref_limits = array('loginname_maxlength' => array('min' => 10, 'max' => 100, 'default' => 30),
'displayname_maxlength' => array('min' => 5, 'max' => 100, 'default' => 15),
@@ -1427,7 +1433,10 @@ $text .= "
$text .= "
|
- ".$frm->select('password_CHAP',$CHAP_list,$pref['password_CHAP'] );
+ | ";
+
+ $CHAPopt = !empty($pref['ssl_enabled']) || !empty($pref['passwordEncoding']) ? array('disabled'=>1) : null;
+ $text .= $frm->select('password_CHAP',$CHAP_list,$pref['password_CHAP'], $CHAPopt );
//." ".$frm->select_open('password_CHAP');
//TODO - user tracking session name - visible only if Cookie is enabled (JS)
diff --git a/e107_themes/bootstrap3/admin_style.css b/e107_themes/bootstrap3/admin_style.css
index a07af048b..705cdeebc 100644
--- a/e107_themes/bootstrap3/admin_style.css
+++ b/e107_themes/bootstrap3/admin_style.css
@@ -1545,7 +1545,7 @@ body#admin-menus #sc-admin-help .panel-body {
overflow-y:scroll;
}
-
+.form-control[disabled] { opacity: 0.5; }
diff --git a/e107_web/js/core/admin.jquery.js b/e107_web/js/core/admin.jquery.js
index fc3292653..3394700e7 100644
--- a/e107_web/js/core/admin.jquery.js
+++ b/e107_web/js/core/admin.jquery.js
@@ -775,9 +775,13 @@ $(document).ready(function()
$(selector).toggle();
+ // $('.menu-selector input[type="checkbox"]').removeAttr("checked");
+
return false;
});
+
+
$(".e-mm-selector li input").click(function(e){
From 9a8c1d375b9161deffe32898e43214293418fd05 Mon Sep 17 00:00:00 2001
From: Cameron
Date: Tue, 21 Mar 2017 16:03:28 -0700
Subject: [PATCH 11/66] Updated ver.php to v2.1.6 (git)
---
e107_admin/ver.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/e107_admin/ver.php b/e107_admin/ver.php
index 6faf523ba..657d91f38 100644
--- a/e107_admin/ver.php
+++ b/e107_admin/ver.php
@@ -10,6 +10,6 @@
if (!defined('e107_INIT')) { exit; }
-$e107info['e107_version'] = "2.1.5 (git)";
+$e107info['e107_version'] = "2.1.6 (git)";
?>
\ No newline at end of file
From e1ce2f528de73de2681f19c34608973e8356bd51 Mon Sep 17 00:00:00 2001
From: Tijn Kuyper
Date: Wed, 22 Mar 2017 00:40:32 +0100
Subject: [PATCH 12/66] Closes #2513 - Clarify messages to main admins on
/login.php
---
e107_languages/English/lan_login.php | 7 +++--
login.php | 47 ++++++++++++++--------------
2 files changed, 29 insertions(+), 25 deletions(-)
diff --git a/e107_languages/English/lan_login.php b/e107_languages/English/lan_login.php
index d28679461..e7a04b0b7 100644
--- a/e107_languages/English/lan_login.php
+++ b/e107_languages/English/lan_login.php
@@ -12,7 +12,7 @@
define("LAN_LOGIN_1", "User name");
define("LAN_LOGIN_2", "User password");
define("LAN_LOGIN_3", "Protected server");
-define("LAN_LOGIN_4", "Please sign in"); // XXX Modified
+define("LAN_LOGIN_4", "Please sign in"); // XXX Modified
define("LAN_LOGIN_5", "Click here to Sign-Up");
define("LAN_LOGIN_6", "Not accepting new members at this time");
define("LAN_LOGIN_7", "Enter visible code");
@@ -40,5 +40,8 @@ define("LAN_LOGIN_28", "Email");
define("LAN_LOGIN_29", "Username or Email");
define("LAN_LOGIN_30", "Error adding new alt_auth user to DB");
define("LAN_LOGIN_31", "Your credentials could not be added to the system");
-
+define("LAN_LOGIN_32", "You are seeing this message because you are currently logged in as the Main Admin.");
+define("LAN_LOGIN_33", "[Return to the homepage]"); // the [ ] brackets are replaced with a button link
+define("LAN_LOGIN_34", "User registration and/or login is currently disabled.");
+define("LAN_LOGIN_35", "[Enable it]"); // the [ ] brackets are replaced with a button link
?>
\ No newline at end of file
diff --git a/login.php b/login.php
index 75645c0cf..d5f6b6c2b 100644
--- a/login.php
+++ b/login.php
@@ -1,20 +1,13 @@
".$LOGIN_TEMPLATE['page']['body']."";
$LOGIN_TABLE_FOOTER = $LOGIN_TEMPLATE['page']['footer'];
}
-
+
$text = $tp->parseTemplate($LOGIN_TABLE,true, $sc);
if(getperms('0'))
{
- echo " You are currently logged in as the Main Admin. "; //TODO LAN
+ $find = array('[', ']');
+ $replace = array("", "");
+ $return_link = str_replace($find, $replace, LAN_LOGIN_33);
+
+ echo "".LAN_LOGIN_32."
".$return_link." ";
if(empty($pref['user_reg']))
{
- echo ""; //TODO LAN
+ $find = array('[', ']');
+ $replace = array("", "");
+ $pref_link = str_replace($find, $replace, LAN_LOGIN_35);
+
+ echo "".LAN_LOGIN_34."
".$pref_link." ";
}
}
-
+
$login_message = SITENAME; // $login_message = LAN_LOGIN_3." | ".SITENAME;
if(strpos($LOGIN_TABLE_HEADER,'LOGIN_TABLE_LOGINMESSAGE') === false && strpos($LOGIN_TABLE,'LOGIN_TABLE_LOGINMESSAGE') === false)
From 0ec1c74e6bb1918ee527b3e68647767819380b17 Mon Sep 17 00:00:00 2001
From: Cameron
Date: Wed, 22 Mar 2017 13:57:11 -0700
Subject: [PATCH 13/66] Allow for importing of table data from e107 v1.x
"Content Management" plugin into "Pages/Menus" tables.
---
e107_plugins/import/admin_import.php | 5 +-
e107_plugins/import/import_classes.php | 17 +-
e107_plugins/import/import_page_class.php | 12 +-
.../import/import_pagechapter_class.php | 154 ++++++++++++++++++
.../import/providers/e107_import_class.php | 127 ++++++++++++++-
5 files changed, 298 insertions(+), 17 deletions(-)
create mode 100644 e107_plugins/import/import_pagechapter_class.php
diff --git a/e107_plugins/import/admin_import.php b/e107_plugins/import/admin_import.php
index 07865b2ee..abd791d53 100644
--- a/e107_plugins/import/admin_import.php
+++ b/e107_plugins/import/admin_import.php
@@ -96,6 +96,7 @@ class import_main_ui extends e_admin_ui
'users' => array('message' => LAN_CONVERT_25, 'classfile' => 'import_user_class.php', 'classname' => 'user_import'),
'news' => array('message' => LAN_CONVERT_28, 'classfile' => 'import_news_class.php', 'classname' => 'news_import'),
'page' => array('message' => "Pages", 'classfile' => 'import_page_class.php', 'classname' => 'page_import'),
+ 'pagechapter' => array('message' => "Page Chapters", 'classfile' => 'import_pagechapter_class.php', 'classname' => 'pagechapter_import'),
'links' => array('message' => "Links", 'classfile' => 'import_links_class.php', 'classname' => 'links_import'),
'media' => array('message' => "Media", 'classfile' => 'import_media_class.php', 'classname' => 'media_import'),
'forum' => array('message' => "Forum", 'classfile' => 'import_forum_class.php', 'classname' => 'forum_import'),
@@ -547,7 +548,8 @@ class import_main_ui extends e_admin_ui
$text .= "
".LAN_CONVERT_38." |
- ".$frm->checkbox('import_delete_existing_data', 1,$_POST['import_delete_existing_data'], array('label'=>' ','title'=>LAN_CONVERT_39))." |
+ ".$frm->radio_switch('import_delete_existing_data', $_POST['import_delete_existing_data'])."
+ ".LAN_CONVERT_39." |
";
//TODO
@@ -732,6 +734,7 @@ class import_main_ui extends e_admin_ui
if ($this->deleteExisting == true)
{
+ $mes->addDebug("dbImport(): Emptying target table. ");
$exporter->emptyTargetDB(); // Clean output DB - reasonably safe now
}
diff --git a/e107_plugins/import/import_classes.php b/e107_plugins/import/import_classes.php
index 102dd705a..686bd59ca 100644
--- a/e107_plugins/import/import_classes.php
+++ b/e107_plugins/import/import_classes.php
@@ -71,6 +71,10 @@ class base_import_class
return $this->savePageData($dataRecord);
break;
+ case 'pagechapter' :
+ return $this->savePageChapterData($dataRecord);
+ break;
+
case 'links' :
return $this->saveLinksData($dataRecord);
break;
@@ -110,7 +114,7 @@ class base_import_class
{
if($mode == 'db')
{
- $result = $this->ourDB->db_Fetch();
+ $result = $this->ourDB->fetch();
}
else
{
@@ -134,6 +138,10 @@ class base_import_class
return $this->copyPageData($initial, $result);
break;
+ case 'pagechapter' :
+ return $this->copyPageChapterData($initial, $result);
+ break;
+
case 'links' :
return $this->copyLinksData($initial, $result);
break;
@@ -197,7 +205,12 @@ class base_import_class
{
return $target;
}
-
+
+ function copyPageChapterData(&$target, &$source)
+ {
+ return $target;
+ }
+
function copyLinksData(&$target, &$source)
{
return $target;
diff --git a/e107_plugins/import/import_page_class.php b/e107_plugins/import/import_page_class.php
index 8bb3c1411..f932ac0ff 100644
--- a/e107_plugins/import/import_page_class.php
+++ b/e107_plugins/import/import_page_class.php
@@ -41,14 +41,14 @@ class page_import
'page_metakeys' => '',
'page_metadscr' => '',
'page_text' => '',
- 'page_author' => 1,
+ 'page_author' => USERID,
'page_datestamp' => '',
'page_rating_flag' => '0',
'page_comment_flag' => '0',
'page_password' => '',
'page_class' => '0',
'page_ip_restrict' => '',
- 'menu_name' => '',
+ 'menu_name' => '',
'page_template' => 'default'
);
@@ -61,15 +61,14 @@ class page_import
// Constructor
function __construct()
{
- global $sql;
- $this->pageDB = new db; // Have our own database object to write to the table
+ $this->pageDB = e107::getDb('page'); // Have our own database object to write to the table
}
// Empty the DB - not necessary
function emptyTargetDB($inc_admin = FALSE)
{
- // $this->pageDB->db_Delete('page');
+ $this->pageDB->truncate('page');
}
@@ -95,7 +94,7 @@ class page_import
*/
function saveData($row)
{
- if(!$result = $this->pageDB->db_Insert('page',$row))
+ if(!$result = $this->pageDB->insert('page',$row))
{
return 4;
}
@@ -109,6 +108,7 @@ class page_import
function getErrorText($errnum) // these errors are presumptuous and misleading. especially '4' .
{
+ return $this->pageDB->getLastErrorText();
$errorTexts = array(
0 => 'No error',
1 => 'Can\'t change main admin data',
diff --git a/e107_plugins/import/import_pagechapter_class.php b/e107_plugins/import/import_pagechapter_class.php
new file mode 100644
index 000000000..0e2693c38
--- /dev/null
+++ b/e107_plugins/import/import_pagechapter_class.php
@@ -0,0 +1,154 @@
+ '',
+ 'chapter_parent' => 1,
+ 'chapter_name' => '',
+ 'chapter_sef' => '',
+ 'chapter_meta_description' => '',
+ 'chapter_meta_keywords' => '',
+ 'chapter_manager' => e_UC_ADMIN,
+ 'chapter_icon' => '',
+ 'chapter_order' => 0,
+ 'chapter_template' => 'default',
+ 'chapter_visibility' => 0,
+ 'chapter_fields' => null
+
+ );
+
+ // Fields which must be set up by the caller.
+ var $mandatory = array(
+ 'chapter_name'
+ );
+
+ // Constructor
+ function __construct()
+ {
+ $this->pageDB = e107::getDb('pagechapter'); // Have our own database object to write to the table
+ }
+
+
+ // Empty the DB
+ function emptyTargetDB($inc_admin = FALSE)
+ {
+ $this->pageDB->truncate('page_chapters');
+
+ $insert = array(
+ 'chapter_id' => '1',
+ 'chapter_parent' => '0',
+ 'chapter_name' => 'General',
+ 'chapter_sef' => 'general',
+ 'chapter_meta_description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec et tempor odio. Quisque volutpat lorem nec lectus congue suscipit. In hac habitasse platea dictumst. Etiam odio nisi, egestas vitae amet.',
+ 'chapter_meta_keywords' => '',
+ 'chapter_manager' => '0',
+ 'chapter_icon' => '',
+ 'chapter_order' => '0',
+ 'chapter_template' => 'default',
+ 'chapter_visibility' => '0',
+ 'chapter_fields' => null
+ );
+
+
+ $this->pageDB->insert('page_chapters',$insert); // insert a default book.
+ }
+
+
+ // Set a new default for a particular field
+ function overrideDefault($key, $value)
+ {
+// echo "Override: {$key} => {$value} ";
+ if (!isset($this->defaults[$key])) return FALSE;
+ $this->defaults[$key] = $value;
+ }
+
+
+ // Returns an array with all relevant fields set to the current default
+ function getDefaults()
+ {
+ return $this->defaults;
+ }
+
+ /**
+ * Insert data into e107 DB
+ * @param row - array of table data
+ * @return integer, boolean - error code on failure, TRUE on success
+ */
+ function saveData($row)
+ {
+
+ if(empty($row['chapter_name']))
+ {
+ return 3;
+ }
+
+
+ if(!$result = $this->pageDB->insert('page_chapters',$row))
+ {
+ return 4;
+ }
+
+ //if ($result === FALSE) return 6;
+
+ return true;
+ }
+
+
+
+ function getErrorText($errnum) // these errors are presumptuous and misleading. especially '4' .
+ {
+ $errorTexts = array(
+ 0 => 'No error',
+ 1 => 'Can\'t change main admin data',
+ 2 => 'invalid field passed',
+ 3 => 'Mandatory field not set',
+ 4 => 'Entry already exists',
+ 5 => 'Invalid characters in user or login name',
+ 6 => 'Error saving extended user fields'
+ );
+
+ if (isset($errorTexts[$errnum])) return $errorTexts[$errnum];
+
+ return 'Unknown: '.$errnum;
+
+ }
+
+
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/e107_plugins/import/providers/e107_import_class.php b/e107_plugins/import/providers/e107_import_class.php
index 904d77fbb..a4f166c49 100644
--- a/e107_plugins/import/providers/e107_import_class.php
+++ b/e107_plugins/import/providers/e107_import_class.php
@@ -34,11 +34,33 @@ class e107_import extends base_import_class
public $title = 'e107';
public $description = 'Reads 0.7 and 0.8 version files';
- public $supported = array('users');
+ public $supported = array('users', 'page', 'pagechapter');
public $mprefix = 'e107_';
-
-
+ function init()
+ {
+
+ $this->pcontent = intval($_POST['pcontent']);
+
+ }
+
+
+ function config()
+ {
+ $frm = e107::getForm();
+
+ $present = e107::getDb()->isTable('pcontent');
+
+ $var[0]['caption'] = "Use old 'Content Management' tables for Pages";
+ $var[0]['html'] = $frm->radio_switch('pcontent',$present);
+ // $var[0]['help'] = "Change the author of the news items";
+
+ // $var[1]['caption'] = "Include revisions";
+ // $var[1]['html'] = $frm->checkbox('news_revisions',1);
+ // $var[1]['help'] = "Change the author of the news items";
+
+ return $var;
+ }
// Set up a query for the specified task.
// Returns TRUE on success. FALSE on error
@@ -47,13 +69,27 @@ class e107_import extends base_import_class
if ($this->ourDB == NULL) return FALSE;
switch ($task)
{
- case 'users' :
- $query = "SELECT * FROM {$this->DBPrefix}user WHERE `user_id` != 1";
- $result = $this->ourDB->db_Select_gen($query);
+ case 'users' :
+ $query = "SELECT * FROM {$this->DBPrefix}user WHERE `user_id` != 1";
+ $result = $this->ourDB->db_Select_gen($query);
- if ($result === FALSE) return FALSE;
+ if ($result === false) return false;
break;
-
+
+ case 'page' :
+ $query = "SELECT * FROM {$this->DBPrefix}pcontent WHERE `content_parent` > 0";
+ $result = $this->ourDB->gen($query);
+
+ if ($result === false) return false;
+ break;
+
+ case 'pagechapter' :
+ $query = "SELECT * FROM {$this->DBPrefix}pcontent WHERE `content_parent` = '0'";
+ $result = $this->ourDB->gen($query);
+
+ if ($result === false) return false;
+ break;
+
default :
@@ -66,6 +102,81 @@ class e107_import extends base_import_class
}
+ /**
+ * Align source data to e107 Page Table
+ * @param $target array - default e107 target values for e107_page table.
+ * @param $source array - WordPress table data
+ */
+ function copyPageData(&$target, &$source)
+ {
+
+
+
+ // $target['page_id'] = $source['ID']; // auto increment
+ $target['page_title'] = $source['content_heading'];
+ $target['page_sef'] = eHelper::title2sef($source['content_heading'], 'dashl');
+ $target['page_text'] = $this->checkHtml($source['content_text']) ;
+ $target['page_chapter'] = $source['content_parent'];
+ // $target['page_metakeys'] = '';
+ $target['page_metadscr'] = $source['content_summary'];
+ $target['page_datestamp'] = $source['content_datestamp'];
+ $target['page_author'] = (int) $source['content_author'];
+ // $target['page_category'] = '',
+ $target['page_comment_flag'] = (int) $source['content_comment'];
+ $target['page_rating_flag'] = (int) $source['content_rate'];
+ // $target['page_password'] = $source['post_password'];
+ $target['page_order'] = (int) $source['content_order'];
+ $target['page_class'] = (int) $source['content_class'];
+
+
+
+ return $target; // comment out to debug
+
+
+ }
+
+
+ private function checkHtml($text)
+ {
+ $tp = e107::getParser();
+ if($tp->isHtml($text) && strpos($text,'[html]')!==0)
+ {
+ return "[html]".$text."[/html]";
+ }
+
+ return $text;
+
+ }
+
+ /**
+ * Align source data to e107 Page Table
+ * @param $target array - default e107 target values for e107_page table.
+ * @param $source array - WordPress table data
+ */
+ function copyPageChapterData(&$target, &$source)
+ {
+ $target['chapter_id'] = $source['content_id'];
+ $target['chapter_parent'] = empty($source['content_parent']) ? 1 : (int) $source['content_parent'];
+ $target['chapter_name'] = $source['content_heading'];
+ $target['chapter_sef'] = eHelper::title2sef($source['content_heading'], 'dashl');
+ $target['chapter_meta_description'] = $source['content_text'];
+ $target['chapter_meta_keywords'] = '';
+ // $target['chapter_manager'] = '';
+ $target['chapter_icon'] = $source['content_icon'];
+ $target['chapter_order'] = 0;
+ // $target['chapter_template'] = '';
+ // $target['chapter_visibility'] = 0;
+ // $target['chapter_fields'] = '';
+
+ return $target; // comment out to debug
+
+
+ }
+
+
+
+
+
//------------------------------------
// Internal functions below here
//------------------------------------
From 09981a8664fd12722313d2b0c5058b837a3c91bf Mon Sep 17 00:00:00 2001
From: Jimako
Date: Fri, 24 Mar 2017 13:51:45 +0100
Subject: [PATCH 14/66] possibility to format contact name shortcode
---
e107_core/shortcodes/batch/contact_shortcodes.php | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/e107_core/shortcodes/batch/contact_shortcodes.php b/e107_core/shortcodes/batch/contact_shortcodes.php
index fb425bff8..f47f081a0 100644
--- a/e107_core/shortcodes/batch/contact_shortcodes.php
+++ b/e107_core/shortcodes/batch/contact_shortcodes.php
@@ -90,12 +90,16 @@ class contact_shortcodes extends e_shortcode
}
+ /* example {CONTACT_NAME} */
+ /* example {CONTACT_NAME: class=form-control} */
+ /* example {CONTACT_NAME: class=col-md-12&placeholder=".LANCONTACT_03." *} */
+
function sc_contact_name($parm='')
{
$userName = deftrue('USERNAME');
-
- return "";
-
+ $class = (!empty($parm['class'])) ? $parm['class'] : 'tbox form-control';
+ $placeholder = (!empty($parm['placeholder'])) ? " placeholder= '".$parm['placeholder']."'" : '';
+ return "";
}
@@ -145,4 +149,4 @@ class contact_shortcodes extends e_shortcode
}
-?>
\ No newline at end of file
+?>
From 70d1cd63bc632858fba5b827f6bae5d6cc3a184c Mon Sep 17 00:00:00 2001
From: Jimako
Date: Fri, 24 Mar 2017 13:55:03 +0100
Subject: [PATCH 15/66] possibility to format contact email shortcode
---
e107_core/shortcodes/batch/contact_shortcodes.php | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/e107_core/shortcodes/batch/contact_shortcodes.php b/e107_core/shortcodes/batch/contact_shortcodes.php
index fb425bff8..5717b98ac 100644
--- a/e107_core/shortcodes/batch/contact_shortcodes.php
+++ b/e107_core/shortcodes/batch/contact_shortcodes.php
@@ -100,12 +100,18 @@ class contact_shortcodes extends e_shortcode
+ /* example {CONTACT_EMAIL} */
+ /* example {CONTACT_EMAIL: class=form-control} */
+ /* example {CONTACT_EMAIL: class=col-md-12&placeholder=".LANCONTACT_04." *} */
+
function sc_contact_email($parm='')
{
$userEmail = deftrue('USEREMAIL');
$disabled = (!empty($userEmail)) ? 'readonly' : ''; // don't allow change from a verified email address.
- return "";
+ $class = (!empty($parm['class'])) ? $parm['class'] : 'tbox form-control';
+ $placeholder = (!empty($parm['placeholder'])) ? " placeholder= '".$parm['placeholder']."'" : '';
+ return "";
}
@@ -145,4 +151,4 @@ class contact_shortcodes extends e_shortcode
}
-?>
\ No newline at end of file
+?>
From 8ef981ca849db9adb7d9a5ed6b06824c467022f3 Mon Sep 17 00:00:00 2001
From: Jimako
Date: Fri, 24 Mar 2017 14:05:30 +0100
Subject: [PATCH 16/66] possibility to format contact subject shortcode
---
e107_core/shortcodes/batch/contact_shortcodes.php | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/e107_core/shortcodes/batch/contact_shortcodes.php b/e107_core/shortcodes/batch/contact_shortcodes.php
index fb425bff8..c49f96315 100644
--- a/e107_core/shortcodes/batch/contact_shortcodes.php
+++ b/e107_core/shortcodes/batch/contact_shortcodes.php
@@ -110,9 +110,15 @@ class contact_shortcodes extends e_shortcode
+ /* example {CONTACT_SUBJECT} */
+ /* example {CONTACT_SUBJECT: class=form-control} */
+ /* example {CONTACT_SUBJECT: class=col-md-12&placeholder=".LANCONTACT_05." *} */
+
function sc_contact_subject($parm='')
{
- return "";
+ $class = (!empty($parm['class'])) ? $parm['class'] : 'tbox form-control';
+ $placeholder = (!empty($parm['placeholder'])) ? " placeholder= '".$parm['placeholder']."'" : '';
+ return "";
}
@@ -145,4 +151,4 @@ class contact_shortcodes extends e_shortcode
}
-?>
\ No newline at end of file
+?>
From c2e9544ca4f874e6adf1453b81bedd65eb138731 Mon Sep 17 00:00:00 2001
From: Jimako
Date: Fri, 24 Mar 2017 14:21:00 +0100
Subject: [PATCH 17/66] improved param $class in contact subject shordcode
---
e107_core/shortcodes/batch/contact_shortcodes.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/e107_core/shortcodes/batch/contact_shortcodes.php b/e107_core/shortcodes/batch/contact_shortcodes.php
index fb425bff8..d113cd052 100644
--- a/e107_core/shortcodes/batch/contact_shortcodes.php
+++ b/e107_core/shortcodes/batch/contact_shortcodes.php
@@ -131,10 +131,10 @@ class contact_shortcodes extends e_shortcode
{
$size = 'input-xxlarge';
}
-
+ $class = (!empty($parm['class'])) ? $parm['class'] : 'tbox '.$size.' form-control';
- return "";
+ return "";
}
@@ -145,4 +145,4 @@ class contact_shortcodes extends e_shortcode
}
-?>
\ No newline at end of file
+?>
From dab0eea918b9f5b7f31c372317690aa2cb51e74c Mon Sep 17 00:00:00 2001
From: Jimako
Date: Fri, 24 Mar 2017 15:13:38 +0100
Subject: [PATCH 18/66] formatting contact submit button shortcode
---
e107_core/shortcodes/batch/contact_shortcodes.php | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/e107_core/shortcodes/batch/contact_shortcodes.php b/e107_core/shortcodes/batch/contact_shortcodes.php
index fb425bff8..5589571dd 100644
--- a/e107_core/shortcodes/batch/contact_shortcodes.php
+++ b/e107_core/shortcodes/batch/contact_shortcodes.php
@@ -138,11 +138,15 @@ class contact_shortcodes extends e_shortcode
}
+ /* example {CONTACT_SUBMIT_BUTTON} */
+ /* example {CONTACT_SUBMIT_BUTTON: class=contact submit btn btn-minimal} */
function sc_contact_submit_button($parm='')
{
- return "";
+ $class = (!empty($parm['class'])) ? $parm['class'] : 'btn btn-primary button';
+
+ return "";
}
}
-?>
\ No newline at end of file
+?>
From 3005e0bd8f173c8811c97236970666e4f8fccb7d Mon Sep 17 00:00:00 2001
From: Cameron
Date: Sat, 25 Mar 2017 13:01:50 -0700
Subject: [PATCH 19/66] Fixes #2517 - support for the style_custom.css file in
theme folder which is auto-loaded after style.css.
---
e107_core/templates/header_default.php | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/e107_core/templates/header_default.php b/e107_core/templates/header_default.php
index 823e45e65..43bc840f1 100644
--- a/e107_core/templates/header_default.php
+++ b/e107_core/templates/header_default.php
@@ -273,30 +273,21 @@ else
// Theme default
$e_js->themeCSS(THEME_STYLE, $css_default);
-
- /* Moved to class2 and defined as THEME_STYLE
- if($e_pref->get('themecss') && file_exists(THEME.$e_pref->get('themecss')))
+
+ // Support for style.css - override theme default CSS
+ if(file_exists(THEME."style_custom.css"))
{
- //echo "\n";
- $e_js->themeCSS($e_pref->get('themecss'), $css_default);
+ $e_js->themeCSS('style_custom.css',$css_default);
}
- else
- {
- // echo "\n";
- $e_js->themeCSS('style.css', $css_default);
- }
- */
+
// Support for print and handheld media - override theme default CSS
if(file_exists(THEME."style_mobile.css"))
{
- //echo "\n";
- //$css_default = "screen";
$e_js->themeCSS('style_mobile.css', 'handheld');
}
+
if(file_exists(THEME."style_print.css"))
{
- // echo "\n";
- // $css_default = "screen";
$e_js->themeCSS('style_print.css', 'print');
}
}
From 4463de3a373208ac3244b6bf15c3169f7829b5af Mon Sep 17 00:00:00 2001
From: Cameron
Date: Sat, 25 Mar 2017 15:11:42 -0700
Subject: [PATCH 20/66] Pages/Menus Overview list added.
---
e107_admin/cpage.php | 52 ++++++++++++++++++++++----
e107_themes/bootstrap3/admin_style.css | 2 +-
2 files changed, 45 insertions(+), 9 deletions(-)
diff --git a/e107_admin/cpage.php b/e107_admin/cpage.php
index 7c97fe88e..f78e9af1d 100644
--- a/e107_admin/cpage.php
+++ b/e107_admin/cpage.php
@@ -17,6 +17,7 @@ if (!getperms("5|J")) { e107::redirect('admin'); exit; }
e107::css('inline',"
.e-wysiwyg { height: 400px }
+td.menu-field { background-color: rgba(0,0,0,0.07); }
");
e107::coreLan('cpage', true);
@@ -34,6 +35,12 @@ class page_admin extends e_admin_dispatcher
'ui' => 'page_admin_form_ui',
'uipath' => null
),
+ 'overview' => array(
+ 'controller' => 'page_admin_ui',
+ 'path' => null,
+ 'ui' => 'page_admin_form_ui',
+ 'uipath' => null
+ ),
'cat' => array(
'controller' => 'page_chapters_ui',
'path' => null,
@@ -56,8 +63,10 @@ class page_admin extends e_admin_dispatcher
);
protected $adminMenu = array(
+ 'overview/list' => array('caption'=> "Overview", 'perm' => '5|J'), //TODO LAN
'page/list' => array('caption'=> CUSLAN_48, 'perm' => '5'),
- 'menu/list' => array('caption'=> CUSLAN_49, 'perm' => 'J', 'tab' => 2),
+ 'menu/list' => array('caption'=> CUSLAN_49, 'perm' => 'J', 'tab' => 2),
+
'page/create' => array('caption'=> CUSLAN_12, 'perm' => '5'),
'other' => array('divider'=> true),
'cat/list' => array('caption'=> CUSLAN_50, 'perm' => '5'), // Create Category.
@@ -72,6 +81,7 @@ class page_admin extends e_admin_dispatcher
protected $adminMenuAliases = array(
+ 'overview/edit' => 'overview/list',
'page/edit' => 'page/list',
'menu/edit' => 'menu/create',
'cat/edit' => 'cat/list'
@@ -134,9 +144,11 @@ class page_admin_form_ui extends e_admin_form_ui
$text = "
".ADMIN_EDIT_ICON."";
-
- $text .= $this->submit_image('menu_delete['.$id.']', $id, 'delete', LAN_DELETE.' [ ID: '.$id.' ]', array('class' => 'action delete btn btn-default'));
-
+
+ if($this->getController()->getMode() === 'overview')
+ {
+ $text .= $this->submit_image('menu_delete['.$id.']', $id, 'delete', LAN_DELETE.' [ ID: '.$id.' ]', array('class' => 'action delete btn btn-default'));
+ }
return $text;
}
}
@@ -556,7 +568,7 @@ class page_admin_ui extends e_admin_ui
protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'3%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'page_id' => array('title'=> LAN_ID, 'type' => 'text', 'tab' => 0, 'width'=>'5%', 'forced'=> TRUE, 'readParms'=>'link=sef&target=blank'),
- 'page_title' => array('title'=> LAN_TITLE, 'tab' => 0, 'type' => 'text', 'data'=>'str', 'inline'=>true, 'width'=>'25%', 'writeParms'=>'size=block-level'),
+ 'page_title' => array('title'=> "Page Title", 'tab' => 0, 'type' => 'text', 'data'=>'str', 'inline'=>true, 'width'=>'25%', 'writeParms'=>'size=block-level'),
'page_chapter' => array('title'=> CUSLAN_63, 'tab' => 0, 'type' => 'dropdown', 'width' => '20%', 'filter' => true, 'batch'=>true, 'inline'=>true),
'page_template' => array('title'=> LAN_TEMPLATE, 'tab' => 0, 'type' => 'dropdown', 'width' => 'auto','filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>array()),
@@ -597,7 +609,7 @@ class page_admin_ui extends e_admin_ui
// 'page_ip_restrict' => array('title'=> LXXAN_USER_07, 'type' => 'text', 'width' => 'auto'), // Avatar
- 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center','readParms'=>'sort=1')
+ 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last','readParms'=>'sort=1&deleteClass=e_UC_NOBODY')
);
protected $fieldpref = array("page_id","page_title","page_chapter","page_template","page_author","page_class");
@@ -606,7 +618,8 @@ class page_admin_ui extends e_admin_ui
'listPages' => array('title'=> CUSLAN_29, 'type'=>'boolean'),
'listBooks' => array('title'=> CUSLAN_50, 'type'=>'boolean'),
'listBooksTemplate' => array('title'=> CUSLAN_72, 'type'=>'dropdown'),
- 'pageCookieExpire' => array('title'=> CUSLAN_30, 'type'=>'number') //TODO Set default value to 84600
+ 'pageCookieExpire' => array('title'=> CUSLAN_30, 'type'=>'number'), //TODO Set default value to 84600
+ 'admin_page_perpage' => array('title'=> "Items per Page", 'type'=>'number'), //TODO Set default value to 84600
);
protected $books = array();
@@ -617,7 +630,30 @@ class page_admin_ui extends e_admin_ui
function init()
{
+ if($this->getMode() === 'overview')
+ {
+ $this->listQry = "SELECT SQL_CALC_FOUND_ROWS p.*,u.user_id,u.user_name FROM #page AS p LEFT JOIN #user AS u ON p.page_author = u.user_id "; // without any Order or Limit.
+ $this->fieldpref = array("page_id", "page_title", 'page_chapter', 'page_template', "menu_title", 'menu_image', 'menu_template' );
+ $this->sortField = false;
+
+ $this->fields['menu_title']['width'] = 'auto';
+
+ $this->fields['page_title']['width'] = 'auto';
+
+ $this->fields['options']['type'] = 'method';
+
+
+ foreach($this->fields as $k=>$fld)
+ {
+ $this->fields[$k]['nolist'] = false;
+
+ if(strpos($k,'menu_') === 0)
+ {
+ $this->fields[$k]['class'] = 'menu-field '.$fld['class'];
+ }
+ }
+ }
if(vartrue($_POST['menu_delete'])) // Delete a Menu (or rather, remove it's data )
@@ -631,7 +667,7 @@ class page_admin_ui extends e_admin_ui
}
// USED IN Menu LIST/INLINE-EDIT MODE ONLY.
- if($this->getMode() == 'menu' && ($this->getAction() == 'list' || $this->getAction() == 'inline'))
+ if($this->getMode() === 'menu' && ($this->getAction() == 'list' || $this->getAction() == 'inline'))
{
$this->listQry = "SELECT SQL_CALC_FOUND_ROWS p.*,u.user_id,u.user_name FROM #page AS p LEFT JOIN #user AS u ON p.page_author = u.user_id WHERE (p.menu_name != '' OR p.menu_image != '' OR p.menu_icon !='') "; // without any Order or Limit.
diff --git a/e107_themes/bootstrap3/admin_style.css b/e107_themes/bootstrap3/admin_style.css
index 705cdeebc..67d429a19 100644
--- a/e107_themes/bootstrap3/admin_style.css
+++ b/e107_themes/bootstrap3/admin_style.css
@@ -1547,7 +1547,7 @@ body#admin-menus #sc-admin-help .panel-body {
.form-control[disabled] { opacity: 0.5; }
-
+.e-image-preview { display:inline-block }
From 3a85433249392b41783e940c393e3ec7fa5391ce Mon Sep 17 00:00:00 2001
From: Cameron
Date: Sat, 25 Mar 2017 15:32:10 -0700
Subject: [PATCH 21/66] Page/Menu Overview column widths
---
e107_admin/cpage.php | 13 +++++++++++--
e107_themes/bootstrap3/admin_style.css | 2 +-
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/e107_admin/cpage.php b/e107_admin/cpage.php
index f78e9af1d..6723d39bd 100644
--- a/e107_admin/cpage.php
+++ b/e107_admin/cpage.php
@@ -638,20 +638,29 @@ class page_admin_ui extends e_admin_ui
$this->sortField = false;
$this->fields['menu_title']['width'] = 'auto';
+ $this->fields['menu_image']['readParms'] = 'thumb=60x55';
+ $this->fields['menu_image']['width'] = 'auto';
$this->fields['page_title']['width'] = 'auto';
$this->fields['options']['type'] = 'method';
- foreach($this->fields as $k=>$fld)
+ foreach($this->fieldpref as $k)
{
$this->fields[$k]['nolist'] = false;
+ if($k === 'page_id')
+ {
+ continue;
+ }
+
if(strpos($k,'menu_') === 0)
{
- $this->fields[$k]['class'] = 'menu-field '.$fld['class'];
+ $this->fields[$k]['class'] = 'menu-field '.$this->fields[$k]['class'];
}
+
+ $this->fields[$k]['width'] = '13%';
}
}
diff --git a/e107_themes/bootstrap3/admin_style.css b/e107_themes/bootstrap3/admin_style.css
index 67d429a19..ab3893018 100644
--- a/e107_themes/bootstrap3/admin_style.css
+++ b/e107_themes/bootstrap3/admin_style.css
@@ -1549,7 +1549,7 @@ body#admin-menus #sc-admin-help .panel-body {
.e-image-preview { display:inline-block }
-
+td img.thumbnail { margin-bottom:0 }
From 489fb66d650b90d3ca6a8e10ace894ab030121c2 Mon Sep 17 00:00:00 2001
From: Cameron
Date: Sun, 26 Mar 2017 13:03:58 -0700
Subject: [PATCH 22/66] Fixes #2527 - extra line-breaks were being added to
HTML.
---
e107_handlers/e_parse_class.php | 46 ++++++++++++++++++++++-----------
1 file changed, 31 insertions(+), 15 deletions(-)
diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php
index 488f64a17..5ea3eb799 100644
--- a/e107_handlers/e_parse_class.php
+++ b/e107_handlers/e_parse_class.php
@@ -1539,17 +1539,25 @@ class e_parse extends e_parser
}
// Turn off a few things if not enabled in options
- if(!vartrue($pref['smiley_activate']))
+ if(empty($pref['smiley_activate']))
{
- $opts['emotes'] = FALSE;
+ $opts['emotes'] = false;
}
- if(!vartrue($pref['make_clickable']))
+
+ if(empty($pref['make_clickable']))
{
- $opts['link_click'] = FALSE;
+ $opts['link_click'] = false;
}
- if(!vartrue($pref['link_replace']))
+
+ if(empty($pref['link_replace']))
{
- $opts['link_replace'] = FALSE;
+ $opts['link_replace'] = false;
+ }
+
+ if($this->isHtml($text)) //BC FIx for when HTML is saved without [html][/html]
+ {
+ $opts['nobreak'] = true;
+ $text = trim($text);
}
$fromadmin = $opts['fromadmin'];
@@ -1568,7 +1576,7 @@ class e_parse extends e_parser
$text = strip_tags($text);
}
- if (MAGIC_QUOTES_GPC == TRUE) // precaution for badly saved data.
+ if (MAGIC_QUOTES_GPC === true) // precaution for badly saved data.
{
$text = stripslashes($text);
}
@@ -1590,7 +1598,7 @@ class e_parse extends e_parser
- if ($parseBB == FALSE)
+ if ($parseBB == false)
{
$content = array($text);
}
@@ -4077,17 +4085,25 @@ class e_parser
*/
function isBBcode($text)
{
- $bbsearch = array('[/h]','[/b]','[/link]', '[/right]');
-
- if(str_replace($bbsearch,'',$text))
- {
- return true;
- }
- else
+ if(preg_match('#(?<=<)\w+(?=[^<]*?>)#', $text))
{
return false;
}
+ $bbsearch = array('[/h]', '[/b]', '[/link]', '[/right]', '[/center]', '[/flash]', '[/code]', '[/table]');
+
+ foreach($bbsearch as $v)
+ {
+ if(strpos($text,$v)!==false)
+ {
+ return true;
+ }
+
+ }
+
+ return false;
+
+
}
From 0416c97400e677d4b94f12c9c67216c553437606 Mon Sep 17 00:00:00 2001
From: Cameron
Date: Sun, 26 Mar 2017 16:34:27 -0700
Subject: [PATCH 23/66] Downloads: Fixes #1062 legacy icon path
---
e107_plugins/download/download_shortcodes.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/e107_plugins/download/download_shortcodes.php b/e107_plugins/download/download_shortcodes.php
index 0c1c74274..e5f94cb38 100644
--- a/e107_plugins/download/download_shortcodes.php
+++ b/e107_plugins/download/download_shortcodes.php
@@ -996,7 +996,7 @@ class download_shortcodes extends e_shortcode
if (!$source) return " ";
// list($ret[TRUE],$ret[FALSE]) = explode(chr(1), $source.chr(1)); //XXX ???
// if (!$ret[FALSE]) $ret[FALSE] = $ret[TRUE]; //XXX ???
- $parms = array('legacy'=> e_IMAGE."icons/");
+ $parms = array('legacy'=> "{e_IMAGE}icons/");
return e107::getParser()->toIcon($source, $parms);
//return " ";
}
From 0846180664dee5f9c31d998cfb45d30dd72e9618 Mon Sep 17 00:00:00 2001
From: Cameron
Date: Sun, 26 Mar 2017 16:35:06 -0700
Subject: [PATCH 24/66] Dynamic Download URL support (using shortcodes). Quick
View added to downloads admin area.
---
e107_plugins/download/includes/admin.php | 5 ++++-
e107_plugins/download/request.php | 7 +++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/e107_plugins/download/includes/admin.php b/e107_plugins/download/includes/admin.php
index 67c51f7fa..1a10deebe 100644
--- a/e107_plugins/download/includes/admin.php
+++ b/e107_plugins/download/includes/admin.php
@@ -258,10 +258,13 @@ class download_main_admin_ui extends e_admin_ui
// default - true - TODO - move to displaySettings
protected $batchDelete = true;
+ protected $url = array('route'=>'download/view/item', 'vars' => array('id' => 'download_id', 'name' => 'download_sef'), 'name' => 'download_name', 'description' => ''); // 'link' only needed if profile not provided.
+
+
protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'data' => null, 'width'=>'5%', 'thclass' =>'center', 'forced'=> TRUE, 'class'=>'center', 'toggle' => 'e-multiselect'),
- 'download_id' => array('title'=> ID, 'type' => 'number', 'data' => 'int', 'width'=>'5%', 'thclass' => '', 'forced'=> TRUE, 'primary'=>TRUE/*, 'noedit'=>TRUE*/), //Primary ID is not editable
+ 'download_id' => array('title'=> LAN_ID, 'type' => 'text', 'data' => 'int', 'width'=>'5%', 'thclass' => '', 'forced'=> TRUE, 'readParms'=>'link=sef&target=blank', 'primary'=>TRUE/*, 'noedit'=>TRUE*/), //Primary ID is not editable
'download_name' => array('title'=> LAN_TITLE, 'type' => 'text', 'data' => 'str', 'inline'=>true, 'width' => 'auto', 'thclass' => ''),
'download_url' => array('title'=> DOWLAN_13, 'type' => 'url', 'data' => 'str', 'width'=>'auto', 'thclass' => '', 'batch' => TRUE, 'filter'=>TRUE),
'download_sef' => array('title'=> LAN_SEFURL, 'type' => 'text', 'inline'=>true, 'data' => 'str', 'width'=>'auto', 'thclass' => '', 'batch' => TRUE, 'filter'=>TRUE, 'writeParms'=>'sef=download_name'),
diff --git a/e107_plugins/download/request.php b/e107_plugins/download/request.php
index 979731318..11414e549 100644
--- a/e107_plugins/download/request.php
+++ b/e107_plugins/download/request.php
@@ -215,8 +215,11 @@ if ($type == "file")
echo $binary_data;
exit();
}
- if (strstr($download_url, "http://") || strstr($download_url, "ftp://") || strstr($download_url, "https://")) {
- header("Location: {$download_url}");
+ if (strstr($download_url, "http://") || strstr($download_url, "ftp://") || strstr($download_url, "https://"))
+ {
+ $download_url = e107::getParser()->parseTemplate($download_url,true); // support for shortcode-driven dynamic URLS.
+ e107::redirect($download_url);
+ // header("Location: {$download_url}");
exit();
}
else
From c581b89aa12b35759e796a6fd2abde1749e22708 Mon Sep 17 00:00:00 2001
From: Cameron
Date: Mon, 27 Mar 2017 09:43:21 -0700
Subject: [PATCH 25/66] Download breadcrumb fix.
---
e107_handlers/form_handler.php | 7 +-
e107_plugins/download/download_shortcodes.php | 32 ++-
.../download/handlers/download_class.php | 185 ++++++++++++------
.../download/templates/download_template.php | 2 +-
4 files changed, 164 insertions(+), 62 deletions(-)
diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php
index 9e0259750..605052814 100644
--- a/e107_handlers/form_handler.php
+++ b/e107_handlers/form_handler.php
@@ -2995,9 +2995,14 @@ class e_form
$text = ' |