mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
Support backticks in db checking, comments in db definition files, other minor tweaks
This commit is contained in:
@@ -9,9 +9,9 @@
|
|||||||
* Administration - DB Verify
|
* Administration - DB Verify
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_admin/db_verify.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_admin/db_verify.php,v $
|
||||||
* $Revision: 1.9 $
|
* $Revision: 1.10 $
|
||||||
* $Date: 2009-11-18 01:04:25 $
|
* $Date: 2009-11-20 22:23:02 $
|
||||||
* $Author: e107coders $
|
* $Author: e107steved $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
require_once("../class2.php");
|
require_once("../class2.php");
|
||||||
@@ -40,7 +40,7 @@ if (!$sql_data)
|
|||||||
exit(DBLAN_1);
|
exit(DBLAN_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tables["core"] = $sql_data;
|
$tables['core'] = preg_replace("#\/\*.*?\*\/#mis", '', $sql_data); // Strip any comments as we copy
|
||||||
|
|
||||||
if (!getperms("0"))
|
if (!getperms("0"))
|
||||||
{
|
{
|
||||||
@@ -51,11 +51,13 @@ if (!getperms("0"))
|
|||||||
//Get any plugin _sql.php files
|
//Get any plugin _sql.php files
|
||||||
foreach($pref['e_sql_list'] as $path => $file)
|
foreach($pref['e_sql_list'] as $path => $file)
|
||||||
{
|
{
|
||||||
$filename = e_PLUGIN.$path."/".$file.".php";
|
$filename = e_PLUGIN.$path.'/'.$file.'.php';
|
||||||
if(is_readable($filename))
|
if(is_readable($filename))
|
||||||
{
|
{
|
||||||
$id = str_replace("_sql","",$file);
|
$id = str_replace('_sql','',$file);
|
||||||
$tables[$id] = file_get_contents($filename);
|
$temp = file_get_contents($filename);
|
||||||
|
$tables[$id] = preg_replace("#\/\*.*?\*\/#mis", '', $temp); // Strip comments as we copy
|
||||||
|
unset($temp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -183,29 +185,36 @@ function check_tables($what)
|
|||||||
|
|
||||||
if ($current_tab)
|
if ($current_tab)
|
||||||
{
|
{
|
||||||
$lines = split("\n", $current_tab); // Create one element of $lines per field or other line of info
|
$lines = split("\n", $current_tab); // Actual table - create one element of $lines per field or other line of info
|
||||||
$fieldnum = 0;
|
$fieldnum = 0;
|
||||||
foreach($tablines[$k] as $x)
|
foreach($tablines[$k] as $x)
|
||||||
{ // $x is a line of the DB definition from the *_sql.php file
|
{ // $x is a line of the DB definition from the *_sql.php file
|
||||||
$x = str_replace(' ',' ',$x); // Remove double spaces
|
$x = str_replace(' ',' ',$x); // Remove double spaces
|
||||||
$fieldnum++;
|
$fieldnum++;
|
||||||
$ffound = 0;
|
$ffound = 0;
|
||||||
list($fname, $fparams) = explode(" ", $x, 2);
|
list($fname, $fparams) = explode(' ', $x, 2); // Pull out first word of definition
|
||||||
if ($fname == "UNIQUE" || $fname == 'FULLTEXT')
|
if ($fname == 'UNIQUE' || $fname == 'FULLTEXT')
|
||||||
{
|
{
|
||||||
list($key, $key1, $keyname, $keyparms) = split(" ", $x, 4);
|
list($key, $key1, $keyname, $keyparms) = split(' ', $x, 4);
|
||||||
$fname = $key." ".$key1." ".$keyname;
|
$fname = $key." ".$key1." ".$keyname;
|
||||||
$fparams = $keyparms;
|
$fparams = $keyparms;
|
||||||
}
|
}
|
||||||
elseif ($fname == "KEY")
|
elseif ($fname == 'KEY')
|
||||||
{
|
{
|
||||||
list($key, $keyname, $keyparms) = split(" ", $x, 3);
|
list($key, $keyname, $keyparms) = split(' ', $x, 3);
|
||||||
$fname = $key." ".$keyname;
|
$fname = $key." ".$keyname;
|
||||||
$fparams = $keyparms;
|
$fparams = $keyparms;
|
||||||
}
|
}
|
||||||
|
elseif ($fname == 'PRIMARY')
|
||||||
|
{ // Nothing to do ATM
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // Must be a field name
|
||||||
|
$fname = str_replace('`','',$fname); // Just remove back ticks if present
|
||||||
|
}
|
||||||
$fields[$fname] = 1;
|
$fields[$fname] = 1;
|
||||||
$fparams = ltrim(rtrim($fparams));
|
$fparams = ltrim(rtrim($fparams));
|
||||||
$fparams = preg_replace("/\r?\n$|\r[^\n]$|,$/", "", $fparams);
|
$fparams = preg_replace("/\r?\n$|\r[^\n]$|,$/", '', $fparams);
|
||||||
|
|
||||||
|
|
||||||
if(stristr($k, "lan_") !== FALSE && $cur != 1)
|
if(stristr($k, "lan_") !== FALSE && $cur != 1)
|
||||||
@@ -219,13 +228,12 @@ function check_tables($what)
|
|||||||
<td>{$fname}
|
<td>{$fname}
|
||||||
";
|
";
|
||||||
|
|
||||||
if (strpos($fparams, "KEY") !== FALSE)
|
if (strpos($fparams, 'KEY') !== FALSE)
|
||||||
{
|
{
|
||||||
$head_txt .= " $fparams aa";
|
$head_txt .= " {$fparams} aa";
|
||||||
}
|
}
|
||||||
|
|
||||||
$head_txt .= "
|
$head_txt .= "</td>
|
||||||
</td>
|
|
||||||
";
|
";
|
||||||
|
|
||||||
$xfieldnum = -1;
|
$xfieldnum = -1;
|
||||||
|
@@ -11,9 +11,9 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
|
||||||
| $Revision: 1.63 $
|
| $Revision: 1.64 $
|
||||||
| $Date: 2009-11-20 05:01:30 $
|
| $Date: 2009-11-20 22:23:02 $
|
||||||
| $Author: e107coders $
|
| $Author: e107steved $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -321,7 +321,7 @@ function update_706_to_800($type='')
|
|||||||
|
|
||||||
$db_parser = new db_table_admin; // Class to read table defs and process them
|
$db_parser = new db_table_admin; // Class to read table defs and process them
|
||||||
$do_save = FALSE; // Set TRUE to update prefs when update complete
|
$do_save = FALSE; // Set TRUE to update prefs when update complete
|
||||||
$updateMessages = array();
|
$updateMessages = array(); // Used to log actions for the admin log
|
||||||
|
|
||||||
$just_check = $type == 'do' ? FALSE : TRUE; // TRUE if we're just seeing whether an update is needed
|
$just_check = $type == 'do' ? FALSE : TRUE; // TRUE if we're just seeing whether an update is needed
|
||||||
|
|
||||||
@@ -707,7 +707,7 @@ function update_706_to_800($type='')
|
|||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
foreach ($ttc as $ct)
|
foreach ($ttc as $ct)
|
||||||
{
|
{
|
||||||
$sqlDefs = e_PLUGIN.$plugName.'/'.$plugName.'_sql.php'; // Filename containing definitions
|
$sqlDefs = e_PLUGIN.$plugName.'/'.str_replace('_menu','',$plugName).'_sql.php'; // Filename containing definitions
|
||||||
// echo "Looking at file: {$sqlDefs}, table {$ct}<br />";
|
// echo "Looking at file: {$sqlDefs}, table {$ct}<br />";
|
||||||
$req_defs = $db_parser->get_table_def($ct,$sqlDefs);
|
$req_defs = $db_parser->get_table_def($ct,$sqlDefs);
|
||||||
if (!is_array($req_defs))
|
if (!is_array($req_defs))
|
||||||
@@ -764,10 +764,10 @@ function update_706_to_800($type='')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This has to be done after the table is upgraded
|
// This has to be done after the table is upgraded
|
||||||
if($sql->db_Select("plugin", "plugin_category", "plugin_category = ''"))
|
if($sql->db_Select('plugin', 'plugin_category', "plugin_category = ''"))
|
||||||
{
|
{
|
||||||
if ($just_check) return update_needed();
|
if ($just_check) return update_needed('Update plugin table');
|
||||||
require_once(e_HANDLER."plugin_class.php");
|
require_once(e_HANDLER.'plugin_class.php');
|
||||||
$ep = new e107plugin;
|
$ep = new e107plugin;
|
||||||
$ep -> update_plugins_table();
|
$ep -> update_plugins_table();
|
||||||
// $_pdateMessages[] = LAN_UPDATE_XX24;
|
// $_pdateMessages[] = LAN_UPDATE_XX24;
|
||||||
@@ -828,7 +828,8 @@ function update_706_to_800($type='')
|
|||||||
if ($do_save)
|
if ($do_save)
|
||||||
{
|
{
|
||||||
save_prefs();
|
save_prefs();
|
||||||
$updateMessages[] = LAN_UPDATE_50.implode(', ',$accum); // FIXME
|
$mes->add(LAN_UPDATE_50);
|
||||||
|
$updateMessages[] = LAN_UPDATE_50.implode(', ',$accum); // Note for admin log
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME grab message-stack from $mes for the log.
|
//FIXME grab message-stack from $mes for the log.
|
||||||
|
@@ -9,9 +9,9 @@
|
|||||||
* Database utilities
|
* Database utilities
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/db_table_admin_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/db_table_admin_class.php,v $
|
||||||
* $Revision: 1.12 $
|
* $Revision: 1.13 $
|
||||||
* $Date: 2009-11-18 01:04:43 $
|
* $Date: 2009-11-20 22:23:02 $
|
||||||
* $Author: e107coders $
|
* $Author: e107steved $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -61,19 +61,23 @@ class db_table_admin
|
|||||||
return $matches;
|
return $matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Routine to do first-level parse of table structure
|
/**
|
||||||
//---------------------------------------------------
|
* Routine to do first-level parse of table structure
|
||||||
// Given the name of a file, returns an array, with each element being a table creation definition.
|
*---------------------------------------------------
|
||||||
// Tracks the last file read - only reads it once
|
* Given the name of a file, returns an array, with each element being a table creation definition.
|
||||||
// If the file name is an empty string, uses a previously read/set buffer
|
* Tracks the last file read - only reads it once
|
||||||
// If a table name is given, returns only that table's info; otherwise returns a list of all tables
|
* If the file name is an empty string, uses a previously read/set buffer
|
||||||
// The table name must include a prefix where appropriate (although not required with standard E107 table definition files)
|
*
|
||||||
// Each element is itself an array:
|
* @param string $table_name - If specified, returns only that table's info; otherwise returns a list of all tables
|
||||||
// [0] - The complete string which creates a table (unless a prefix needs adding to the table name), including terminating ';'
|
* The table name must include a prefix where appropriate (although not required with standard E107 table definition files)
|
||||||
// [1] - The table name. Any backticks are stripped
|
* @return string|array
|
||||||
// [2] - Field definitions, with the surrounding (...) stripped
|
* - if error, returns a brief text message
|
||||||
// [3] - The 'TYPE' field ('TYPE=' is stripped) and any AUTO-INCREMENT definition or other text.
|
* - if successful, returns an array of table definitions, each of which is itself an array:
|
||||||
// function get_table_def($table_name='',$file_name = e_ADMIN."sql/core_sql.php")
|
* [0] - The complete string which creates a table (unless a prefix needs adding to the table name), including terminating ';'
|
||||||
|
* [1] - The table name. Any backticks are stripped
|
||||||
|
* [2] - Field definitions, with the surrounding (...) stripped
|
||||||
|
* [3] - The 'TYPE' field ('TYPE=' is stripped) and any AUTO-INCREMENT definition or other text.
|
||||||
|
*/
|
||||||
function get_table_def($table_name = '', $file_name = "")
|
function get_table_def($table_name = '', $file_name = "")
|
||||||
{
|
{
|
||||||
if ($file_name != '')
|
if ($file_name != '')
|
||||||
@@ -86,7 +90,9 @@ class db_table_admin
|
|||||||
}
|
}
|
||||||
$temp = file_get_contents($file_name);
|
$temp = file_get_contents($file_name);
|
||||||
// Strip any php header
|
// Strip any php header
|
||||||
$this->file_buffer = preg_replace("#\<\?php.*?\?\>#mis", '', $temp);
|
$temp = preg_replace("#\<\?php.*?\?\>#mis", '', $temp);
|
||||||
|
// Strip any comments (only /*...*/ supported
|
||||||
|
$this->file_buffer = preg_replace("#\/\*.*?\*\/#mis", '', $temp);
|
||||||
$this->last_file = $file_name;
|
$this->last_file = $file_name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,31 +9,19 @@
|
|||||||
* e107 Main
|
* e107 Main
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/mail.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/mail.php,v $
|
||||||
* $Revision: 1.19 $
|
* $Revision: 1.20 $
|
||||||
* $Date: 2009-11-19 20:24:21 $
|
* $Date: 2009-11-20 22:23:02 $
|
||||||
* $Author: e107steved $
|
* $Author: e107steved $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is a work in progress, upgrading the mailout routines to use the PHP5-compatible PHPMailer classes in a class-based structure
|
|
||||||
|
|
||||||
A further class extension will add features for mass-mailouts
|
|
||||||
|
|
||||||
|
|
||||||
Three main scenarios to handle:
|
|
||||||
- Individual email to a number of recipients (analagous to 'manual' email sending). May be called multiple times in a run
|
|
||||||
- One email send individually to a number of recipients (probably based on array of senders)
|
|
||||||
- Personalised mailshots - template email modified to personalise for each recipient (based on DB list)
|
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
2. Bulk mailing - look at using the batching constants with SMTPKeepAlive to reset the connection every so often
|
|
||||||
3. mail (PHP method) - note that it has parameters for additional headers and other parameters
|
3. mail (PHP method) - note that it has parameters for additional headers and other parameters
|
||||||
4. Check that language support works - PHPMailer defaults to English if other files not available
|
4. Check that language support works - PHPMailer defaults to English if other files not available
|
||||||
- PHPMailer expects a 2-letter code - $this->SetLanguage(CORE_LC) - e.g. 'en', 'br'
|
- PHPMailer expects a 2-letter code - $this->SetLanguage(CORE_LC) - e.g. 'en', 'br'
|
||||||
5. Logging:
|
5. Logging:
|
||||||
- Use rolling log for errors - error string(s) available - sort out entry
|
- Use rolling log for errors - error string(s) available - sort out entry
|
||||||
- Look at support of some other logging options
|
- Look at support of some other logging options
|
||||||
- Debug option to just log, not send emails (variables in place, and supported by current bulk mailer)
|
|
||||||
9. Make sure SMTPDebug can be set (TRUE/FALSE)
|
9. Make sure SMTPDebug can be set (TRUE/FALSE)
|
||||||
12. Check support for port number - ATM we just override for SSL. Looks as if phpmailer can take it from end of server link.
|
12. Check support for port number - ATM we just override for SSL. Looks as if phpmailer can take it from end of server link.
|
||||||
13. Possibly strip bbcode from plain text mailings - best done by caller?
|
13. Possibly strip bbcode from plain text mailings - best done by caller?
|
||||||
|
@@ -9,9 +9,9 @@
|
|||||||
* e107 Shortcode handler
|
* e107 Shortcode handler
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $
|
||||||
* $Revision: 1.36 $
|
* $Revision: 1.37 $
|
||||||
* $Date: 2009-11-18 01:04:43 $
|
* $Date: 2009-11-20 22:23:02 $
|
||||||
* $Author: e107coders $
|
* $Author: e107steved $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
@@ -101,6 +101,29 @@ function setScVar($className, $scVarName, $value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call function on an already registered SC object
|
||||||
|
*
|
||||||
|
* @param string $className
|
||||||
|
* @param string $scFuncName
|
||||||
|
* @param mixed $param - passed to function
|
||||||
|
*
|
||||||
|
* @return mixed|boolean - FALSE if class doesn't exist; otherwise whatever the function returns.
|
||||||
|
*/
|
||||||
|
function callScFunc($className, $scFuncName, $param= '')
|
||||||
|
{
|
||||||
|
$sc = e107::getScParser();
|
||||||
|
if(isset($sc->scClasses[$className]))
|
||||||
|
{
|
||||||
|
return call_user_func(array($sc->scClasses[$className],$scFuncName), $param);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create shortcode object
|
* Create shortcode object
|
||||||
*
|
*
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
// e107 Language File.
|
// e107 Language File.
|
||||||
// $Id: lan_log_messages.php,v 1.38 2009-09-25 20:20:23 secretr Exp $
|
// $Id: lan_log_messages.php,v 1.39 2009-11-20 22:23:02 e107steved Exp $
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The definitions in this file are for standard 'explanatory' messages which might be entered
|
The definitions in this file are for standard 'explanatory' messages which might be entered
|
||||||
@@ -339,7 +339,7 @@ define('LAN_AL_MAIL_01', 'Test email sent');
|
|||||||
define('LAN_AL_MAIL_02', 'Mailshot created');
|
define('LAN_AL_MAIL_02', 'Mailshot created');
|
||||||
define('LAN_AL_MAIL_03', 'Mail settings updated');
|
define('LAN_AL_MAIL_03', 'Mail settings updated');
|
||||||
define('LAN_AL_MAIL_04', 'Mailshot details deleted');
|
define('LAN_AL_MAIL_04', 'Mailshot details deleted');
|
||||||
define('LAN_AL_MAIL_05', 'Delete orphaned emails');
|
define('LAN_AL_MAIL_05', 'Mail Database tidy');
|
||||||
define('LAN_AL_MAIL_06', '');
|
define('LAN_AL_MAIL_06', '');
|
||||||
define('LAN_AL_MAIL_07', '');
|
define('LAN_AL_MAIL_07', '');
|
||||||
|
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
* Administration - Site Maintenance
|
* Administration - Site Maintenance
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_mailout.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_mailout.php,v $
|
||||||
* $Revision: 1.10 $
|
* $Revision: 1.11 $
|
||||||
* $Date: 2009-11-19 20:24:21 $
|
* $Date: 2009-11-20 22:23:02 $
|
||||||
* $Author: e107steved $
|
* $Author: e107steved $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -244,9 +244,9 @@ define('LAN_MAILOUT_222', 'Default email format');
|
|||||||
define('LAN_MAILOUT_223', '(Used for some non-bulk emails)');
|
define('LAN_MAILOUT_223', '(Used for some non-bulk emails)');
|
||||||
define('LAN_MAILOUT_224', 'Inc. Images');
|
define('LAN_MAILOUT_224', 'Inc. Images');
|
||||||
define('LAN_MAILOUT_225', 'Include images in email');
|
define('LAN_MAILOUT_225', 'Include images in email');
|
||||||
define('LAN_MAILOUT_226', '');
|
define('LAN_MAILOUT_226', '--COUNT-- orphaned recipient records removed');
|
||||||
define('LAN_MAILOUT_227', '');
|
define('LAN_MAILOUT_227', 'Deleted --COUNT-- records from --TABLE--');
|
||||||
define('LAN_MAILOUT_228', '');
|
define('LAN_MAILOUT_228', '--COUNT-- anomalies in mail_content corrected; records: --RECORDS--');
|
||||||
define('LAN_MAILOUT_229', '');
|
define('LAN_MAILOUT_229', '');
|
||||||
define('LAN_MAILOUT_230', '');
|
define('LAN_MAILOUT_230', '');
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user