1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

Another batch of fixes and tweaks; mostly mailout-related

This commit is contained in:
e107steved
2009-12-01 20:05:54 +00:00
parent ddc0383efa
commit c88a7fd6ed
11 changed files with 489 additions and 441 deletions

View File

@@ -9,17 +9,12 @@
* Administration - Site Maintenance * Administration - Site Maintenance
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/mailout.php,v $ * $Source: /cvs_backup/e107_0.8/e107_admin/mailout.php,v $
* $Revision: 1.31 $ * $Revision: 1.32 $
* $Date: 2009-11-30 20:40:02 $ * $Date: 2009-12-01 20:05:51 $
* $Author: e107steved $ * $Author: e107steved $
* *
*/ */
/*
TODO:
1. Improve maintenance page
*/
/* /*
Features: Features:
1. Additional sources of email addresses for mailouts can be provided via plugins, and can be enabled via the mailout preferences page 1. Additional sources of email addresses for mailouts can be provided via plugins, and can be enabled via the mailout preferences page
@@ -98,22 +93,22 @@ require_once(e_HANDLER.'mail_manager_class.php'); // Mail DB API
require_once (e_HANDLER.'message_handler.php'); require_once (e_HANDLER.'message_handler.php');
$emessage = &eMessage :: getInstance(); $emessage = &eMessage :: getInstance();
$action = $e107->tp->toDB(varset($_GET['mode'],'makemail'));
$pageMode = varset($_GET['savepage'], $action); // Sometimes we need to know what brought us here - $action gets changed
$mailId = intval(varset($_GET['m'],0));
$targetId = intval(varset($_GET['t'],0));
// Create mail admin object, load all mail handlers // Create mail admin object, load all mail handlers
$mailAdmin = new mailoutAdminClass($action); // This decodes parts of the query using $_GET syntax $mailAdmin = new mailoutAdminClass($action); // This decodes parts of the query using $_GET syntax
e107::setRegistry('_mailout_admin', $mailAdmin);
if ($mailAdmin->loadMailHandlers() == 0) if ($mailAdmin->loadMailHandlers() == 0)
{ // No mail handlers loaded { // No mail handlers loaded
echo 'No mail handlers loaded!!'; echo 'No mail handlers loaded!!';
exit; exit;
} }
e107::setRegistry('_mailout_admin', $mailAdmin);
require_once(e_ADMIN.'auth.php'); require_once(e_ADMIN.'auth.php');
$action = $e107->tp->toDB(varset($_GET['mode'],'makemail'));
$pageMode = varset($_GET['savepage'], $action); // Sometimes we need to know what brought us here - $action gets changed
$mailId = intval(varset($_GET['m'],0));
$targetId = intval(varset($_GET['t'],0));
@@ -442,11 +437,11 @@ switch ($midAction)
// TODO: Save these fields // TODO: Save these fields
if (isset($_POST['mail_earliest_time'])) if (isset($_POST['mail_earliest_time']))
{ {
$first = e107::getDateConvert()->decodeDateTime($_POST['mail_earliest_time'], 'datetime', 'dmy', FALSE); $first = e107::getDateConvert()->decodeDateTime($_POST['mail_earliest_time'], 'datetime', CORE_DATE_ORDER, FALSE);
} }
if (isset($_POST['mail_latest_time'])) if (isset($_POST['mail_latest_time']))
{ {
$last = e107::getDateConvert()->decodeDateTime($_POST['mail_earliest_time'], 'datetime', 'dmy', TRUE); $last = e107::getDateConvert()->decodeDateTime($_POST['mail_earliest_time'], 'datetime', CORE_DATE_ORDER, TRUE);
} }
if ($mailAdmin->activateEmail($mailId, FALSE, $notify, $first, $last)) if ($mailAdmin->activateEmail($mailId, FALSE, $notify, $first, $last))
{ {
@@ -906,8 +901,8 @@ function show_maint($debug = FALSE)
<tbody>"; <tbody>";
$text .= "<tr><td colspan='2'>".LAN_MAILOUT_182." <input class='button' type='submit' name='email_dross' value=\"".LAN_SUBMIT."\" /></td></tr>"; $text .= "<tr><td>".LAN_MAILOUT_182."</td><td><input class='button' type='submit' name='email_dross' value=\"".LAN_SUBMIT."\" /> <br /><span class='field-help'>".LAN_MAILOUT_252."</span></td></tr>";
$text .= "</tbody></table>\n</fieldset>"; $text .= "</tbody></table>\n</fieldset></form></div>";
$e107->ns->tablerender("<div style='text-align:center'>".ADLAN_136." :: ".ADLAN_40."</div>", $text); $e107->ns->tablerender("<div style='text-align:center'>".ADLAN_136." :: ".ADLAN_40."</div>", $text);

View File

@@ -11,25 +11,23 @@
| 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.64 $ | $Revision: 1.65 $
| $Date: 2009-11-20 22:23:02 $ | $Date: 2009-12-01 20:05:52 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
// [debug=8] shows the operations on major table update // [debug=8] shows the operations on major table update
require_once("../class2.php"); require_once('../class2.php');
require_once(e_HANDLER.'db_table_admin_class.php'); require_once(e_HANDLER.'db_table_admin_class.php');
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_e107_update.php"); include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_e107_update.php');
//include_lan(e_LANGUAGE.'admin/lan_e107_update.php');
// Modified update routine - combines checking and update code into one block per function // Modified update routine - combines checking and update code into one block per function
// - reduces code size typically 30%. // - reduces code size typically 30%.
// - keeping check and update code together should improve clarity/reduce mis-types etc // - keeping check and update code together should improve clarity/reduce mis-types etc
// To do - how do we handle multi-language tables? // TODO: how do we handle update of multi-language tables?
// If following line uncommented, enables a test routine // If following line uncommented, enables a test routine
// define('TEST_UPDATE',TRUE); // define('TEST_UPDATE',TRUE);
@@ -38,20 +36,20 @@ $update_debug = FALSE; // TRUE gives extra messages in places
if (defined('TEST_UPDATE')) $update_debug = TRUE; if (defined('TEST_UPDATE')) $update_debug = TRUE;
if (!defined("LAN_UPDATE_8")) { define("LAN_UPDATE_8", ""); } if (!defined('LAN_UPDATE_8')) { define('LAN_UPDATE_8', ''); }
if (!defined("LAN_UPDATE_9")) { define("LAN_UPDATE_9", ""); } if (!defined('LAN_UPDATE_9')) { define('LAN_UPDATE_9', ''); }
// Determine which installed plugins have an update file - save the path and the installed version in an array // Determine which installed plugins have an update file - save the path and the installed version in an array
$dbupdateplugs = array(); // Array of paths to installed plugins which have a checking routine $dbupdateplugs = array(); // Array of paths to installed plugins which have a checking routine
$dbupdatep = array(); // Array of plugin upgrade actions (similar to $dbupdate) $dbupdatep = array(); // Array of plugin upgrade actions (similar to $dbupdate)
$dbupdate = array(); $dbupdate = array(); // Array of core upgrade actions
global $e107cache; global $e107cache;
if (is_readable(e_ADMIN."ver.php")) if (is_readable(e_ADMIN.'ver.php'))
{ {
include(e_ADMIN."ver.php"); include(e_ADMIN.'ver.php');
} }
@@ -61,123 +59,124 @@ $dont_check_update = varset($dont_check_update, FALSE);
if ($dont_check_update === TRUE) if ($dont_check_update === TRUE)
{ {
$dont_check_update = FALSE; $dont_check_update = FALSE;
if ($tempData = $e107cache->retrieve_sys("nq_admin_updatecheck",3600, TRUE)) if ($tempData = $e107cache->retrieve_sys('nq_admin_updatecheck',3600, TRUE))
{ // See when we last checked for an admin update { // See when we last checked for an admin update
list($last_time, $dont_check_update,$last_ver) = explode(',',$tempData); list($last_time, $dont_check_update, $last_ver) = explode(',',$tempData);
if ($last_ver != $e107info['e107_version']) if ($last_ver != $e107info['e107_version'])
{ {
$dont_check_update = FALSE; // Do proper check on version change $dont_check_update = FALSE; // Do proper check on version change
}
} }
}
} }
if (!$dont_check_update) if (!$dont_check_update)
{ {
if ($sql->db_Select("plugin", "plugin_version, plugin_path", "plugin_installflag='1' ")) if ($sql->db_Select('plugin', 'plugin_version, plugin_path', 'plugin_installflag=1'))
{
while ($row = $sql->db_Fetch())
{ // Mark plugins for update which have a specific update file, or a plugin.php file to check
if(is_readable(e_PLUGIN.$row['plugin_path'].'/'.$row['plugin_path'].'_update_check.php') || is_readable(e_PLUGIN.$row['plugin_path'].'/plugin.php'))
{ {
$dbupdateplugs[$row['plugin_path']] = $row['plugin_version']; while ($row = $sql->db_Fetch())
{ // Mark plugins for update which have a specific update file, or a plugin.php file to check
if(is_readable(e_PLUGIN.$row['plugin_path'].'/'.$row['plugin_path'].'_update_check.php') || is_readable(e_PLUGIN.$row['plugin_path'].'/plugin.php'))
{
$dbupdateplugs[$row['plugin_path']] = $row['plugin_version'];
}
}
} }
}
}
// Read in each update file - this will add an entry to the $dbupdatep array if a potential update exists // Read in each update file - this will add an entry to the $dbupdatep array if a potential update exists
foreach ($dbupdateplugs as $path => $ver) foreach ($dbupdateplugs as $path => $ver)
{ {
$fname = e_PLUGIN.$path.'/'.$path.'_update_check.php'; $fname = e_PLUGIN.$path.'/'.$path.'_update_check.php';
if (is_readable($fname)) include_once($fname); if (is_readable($fname)) include_once($fname);
} }
// List of potential updates // List of potential updates
if (defined('TEST_UPDATE')) if (defined('TEST_UPDATE'))
{ {
$dbupdate["test_code"] = "Test update routine"; $dbupdate['test_code'] = 'Test update routine';
} }
$dbupdate["core_prefs"] = LAN_UPDATE_13; // Prefs check $dbupdate['core_prefs'] = LAN_UPDATE_13; // Prefs check
$dbupdate["706_to_800"] = LAN_UPDATE_8." .706 ".LAN_UPDATE_9." .8"; $dbupdate['706_to_800'] = LAN_UPDATE_8.' .706 '.LAN_UPDATE_9.' .8';
$dbupdate["70x_to_706"] = LAN_UPDATE_8." .70x ".LAN_UPDATE_9." .706"; $dbupdate['70x_to_706'] = LAN_UPDATE_8.' .70x '.LAN_UPDATE_9.' .706';
} // End if (!$dont_check_update) } // End if (!$dont_check_update)
/**
* Master routine to call to check for updates
*/
function update_check() function update_check()
{ {
global $ns, $dont_check_update, $e107info; global $ns, $dont_check_update, $e107info;
$update_needed = FALSE;
$update_needed = FALSE; if ($dont_check_update === FALSE)
if ($dont_check_update === FALSE)
{
global $dbupdate, $dbupdatep, $e107cache;
// See which core functions need update
foreach($dbupdate as $func => $rmks)
{ {
// echo "Core Check {$func}=>{$rmks}<br />"; global $dbupdate, $dbupdatep, $e107cache;
if (function_exists("update_".$func))
{ // See which core functions need update
if (!call_user_func("update_".$func, FALSE)) foreach($dbupdate as $func => $rmks)
{ {
$update_needed = TRUE; if (function_exists('update_'.$func))
continue; {
if (!call_user_func('update_'.$func, FALSE))
{
$update_needed = TRUE;
continue;
}
}
} }
}
// Now check plugins
foreach($dbupdatep as $func => $rmks)
{
if (function_exists('update_'.$func))
{
if (!call_user_func('update_'.$func, FALSE))
{
$update_needed = TRUE;
continue;
}
}
}
$e107cache->set_sys('nq_admin_updatecheck', time().','.($update_needed ? '2,' : '1,').$e107info['e107_version'], TRUE);
}
else
{
$update_needed = ($dont_check_update == '2');
} }
if ($update_needed === TRUE)
// Now check plugins
foreach($dbupdatep as $func => $rmks)
{ {
// echo "Plugin Check {$func}=>{$rmks}<br />"; require_once (e_HANDLER.'form_handler.php');
if (function_exists("update_".$func)) $frm = new e_form();
{ $txt = "
if (!call_user_func("update_".$func, FALSE)) <form method='post' action='".e_ADMIN_ABS."e107_update.php'>
{ <div>
$update_needed = TRUE; ".ADLAN_120."
continue; ".$frm->admin_button('e107_system_update', LAN_UPDATE, 'update')."
} </div>
} </form>
";
require_once (e_HANDLER.'message_handler.php');
$emessage = &eMessage::getInstance();
$emessage->add($txt);
} }
$e107cache->set_sys("nq_admin_updatecheck", time().','.($update_needed ? '2,' : '1,').$e107info['e107_version'], TRUE);
}
else
{
$update_needed = ($dont_check_update == '2');
}
if ($update_needed === TRUE)
{
require_once (e_HANDLER."form_handler.php");
$frm = new e_form();
$txt = "
<form method='post' action='".e_ADMIN_ABS."e107_update.php'>
<div>
".ADLAN_120."
".$frm->admin_button('e107_system_update', LAN_UPDATE, 'update')."
</div>
</form>
";
require_once (e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
$emessage->add($txt);
}
} }
require_once(e_HANDLER."e_upgrade_class.php"); require_once(e_HANDLER.'e_upgrade_class.php');
// $upg = new e_upgrade; // $upg = new e_upgrade;
//TODO Enable this before release!! //TODO Enable this before release!!
// $upg->checkSiteTheme(); // $upg->checkSiteTheme();
@@ -189,52 +188,56 @@ function update_check()
//-------------------------------------------- //--------------------------------------------
function update_core_prefs($type='') function update_core_prefs($type='')
{ {
global $pref, $admin_log, $e107info; global $pref, $admin_log, $e107info;
$do_save = FALSE; $do_save = FALSE;
$should = get_default_prefs(); $should = get_default_prefs();
$accum = array(); $accum = array();
$just_check = $type == 'do' ? FALSE : TRUE; // TRUE if we're just seeing if an update is needed $just_check = $type == 'do' ? FALSE : TRUE; // TRUE if we're just seeing if an update is needed
foreach ($should as $k => $v) foreach ($should as $k => $v)
{
if ($k && !array_key_exists($k,$pref))
{ {
if ($just_check) return update_needed('Missing pref: '.$k); if ($k && !array_key_exists($k,$pref))
$pref[$k] = $v; {
$accum[] = $k; if ($just_check) return update_needed('Missing pref: '.$k);
$do_save = TRUE; $pref[$k] = $v;
$accum[] = $k;
$do_save = TRUE;
}
} }
} if ($do_save)
if ($do_save) {
{ save_prefs();
save_prefs(); $admin_log->log_event('UPDATE_03',LAN_UPDATE_14.$e107info['e107_version'].'[!br!]'.implode(', ',$accum),E_LOG_INFORMATIVE,''); // Log result of actual update
$admin_log->log_event('UPDATE_03',LAN_UPDATE_14.$e107info['e107_version'].'[!br!]'.implode(', ',$accum),E_LOG_INFORMATIVE,''); // Log result of actual update }
} return $just_check;
return $just_check;
} }
if (defined('TEST_UPDATE')) if (defined('TEST_UPDATE'))
{ {
//-------------------------------------------- //--------------------------------------------
// Test routine - to activate, define TEST_UPDATE // Test routine - to activate, define TEST_UPDATE
//-------------------------------------------- //--------------------------------------------
function update_test_code($type='') function update_test_code($type='')
{ {
global $sql,$ns, $pref; global $sql,$ns, $pref;
$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
//--------------**************--------------- //--------------**************---------------
// Add your test code in here // Add your test code in here
//--------------**************--------------- //--------------**************---------------
//--------------**************--------------- //--------------**************---------------
// End of test code // End of test code
//--------------**************--------------- //--------------**************---------------
return $just_check; return $just_check;
} }
} // End of test routine } // End of test routine
//-------------------------------------------- //--------------------------------------------
// Upgrade later versions of 0.7.x to 0.8 // Upgrade later versions of 0.7.x to 0.8
//-------------------------------------------- //--------------------------------------------
@@ -415,48 +418,49 @@ function update_706_to_800($type='')
{ {
foreach($changeMenuPaths as $val) foreach($changeMenuPaths as $val)
{ {
$qry = "SELECT menu_path FROM #menus WHERE menu_name = '".$val['menu']."' AND (menu_path='".$val['oldpath']."' || menu_path='".$val['oldpath']."/' ) LIMIT 1"; $qry = "SELECT menu_path FROM `#menus` WHERE menu_name = '".$val['menu']."' AND (menu_path='".$val['oldpath']."' || menu_path='".$val['oldpath']."/' ) LIMIT 1";
if($sql->db_Select_gen($qry)) if($sql->db_Select_gen($qry))
{ {
if ($just_check) return update_needed('Menu path changed required: '.$val['menu'].' '); if ($just_check) return update_needed('Menu path changed required: '.$val['menu'].' ');
$updqry = "menu_path='".$val['newpath']."/' WHERE menu_name = '".$val['menu']."' AND (menu_path='".$val['oldpath']."' || menu_path='".$val['oldpath']."/' ) "; $updqry = "menu_path='".$val['newpath']."/' WHERE menu_name = '".$val['menu']."' AND (menu_path='".$val['oldpath']."' || menu_path='".$val['oldpath']."/' ) ";
$status = $sql->db_Update("menus", $updqry) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $status = $sql->db_Update('menus', $updqry) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add(LAN_UPDATE_23.'<b>'.$val['menu'].'</b> : '.$val['oldpath'].' => '.$val['newpath'], $status); // LAN_UPDATE_25; $mes->add(LAN_UPDATE_23.'<b>'.$val['menu'].'</b> : '.$val['oldpath'].' => '.$val['newpath'], $status); // LAN_UPDATE_25;
// catch_error(); // catch_error($sql);
} }
} }
} }
// Leave this one here.. just in case.. // Leave this one here.. just in case..
//delete record for online_extended_menu (now only using one online menu) //delete record for online_extended_menu (now only using one online menu)
if($sql->db_Select("menus", "*", "menu_path='online_extended_menu' || menu_path='online_extended_menu/'")) if($sql->db_Select('menus', '*', "menu_path='online_extended_menu' || menu_path='online_extended_menu/'"))
{ {
if ($just_check) return update_needed(); if ($just_check) return update_needed();
$row=$sql->db_Fetch(); $row=$sql->db_Fetch();
//if online_extended is activated, we need to activate the new 'online' menu, and delete this record //if online_extended is activated, we need to activate the new 'online' menu, and delete this record
if($row['menu_location']!=0) if($row['menu_location']!=0)
{ {
$status = $sql->db_Update("menus", "menu_name='online_menu', menu_path='online/' WHERE menu_path='online_extended_menu' || menu_path='online_extended_menu/' ") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $status = $sql->db_Update("menus", "menu_name='online_menu', menu_path='online/' WHERE menu_path='online_extended_menu' || menu_path='online_extended_menu/' ") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add(LAN_UPDATE_23."<b>online_menu</b> : online/", $status); $mes->add(LAN_UPDATE_23."<b>online_menu</b> : online/", $status);
} }
else else
{ //else if the menu is not active { //else if the menu is not active
//we need to delete the online_extended menu row, and change the online_menu to online //we need to delete the online_extended menu row, and change the online_menu to online
$sql->db_Delete("menus", " menu_path='online_extended_menu' || menu_path='online_extended_menu/' "); $sql->db_Delete('menus', " menu_path='online_extended_menu' || menu_path='online_extended_menu/' ");
// $updateMessages[] = LAN_UPXXDATE_31; // $updateMessages[] = LAN_UPXXDATE_31;
} }
catch_error(); catch_error($sql);
} }
//change menu_path for online_menu (if it still exists) //change menu_path for online_menu (if it still exists)
if($sql->db_Select("menus", "menu_path", "menu_path='online_menu' || menu_path='online_menu/'")) if($sql->db_Select('menus', 'menu_path', "menu_path='online_menu' || menu_path='online_menu/'"))
{ {
if ($just_check) return update_needed(); if ($just_check) return update_needed();
$status = $sql->db_Update("menus", "menu_path='online/' WHERE menu_path='online_menu' || menu_path='online_menu/' ") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $status = $sql->db_Update("menus", "menu_path='online/' WHERE menu_path='online_menu' || menu_path='online_menu/' ") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add(LAN_UPDATE_23."<b>online_menu</b> : online/", $status); $mes->add(LAN_UPDATE_23."<b>online_menu</b> : online/", $status);
catch_error(); catch_error($sql);
} }
@@ -465,36 +469,35 @@ function update_706_to_800($type='')
//--------------------------------------------------------- //---------------------------------------------------------
if($sql->db_Field('comments','comment_author')) if($sql->db_Field('comments','comment_author'))
{ {
if ($just_check) return update_needed('Comment table author field update'); if ($just_check) return update_needed('Comment table author field update');
if ((!$sql->db_Field("comments","comment_author_id")) // Check to see whether new fields already added - maybe data copy failed part way through if ((!$sql->db_Field('comments','comment_author_id')) // Check to see whether new fields already added - maybe data copy failed part way through
&& (!$sql->db_Select_gen("ALTER TABLE `#comments` && (!$sql->db_Select_gen("ALTER TABLE `#comments`
ADD COLUMN comment_author_id int(10) unsigned NOT NULL default '0' AFTER `comment_author`, ADD COLUMN comment_author_id int(10) unsigned NOT NULL default '0' AFTER `comment_author`,
ADD COLUMN comment_author_name varchar(100) NOT NULL default '' AFTER `comment_author_id`"))) ADD COLUMN comment_author_name varchar(100) NOT NULL default '' AFTER `comment_author_id`")))
{
// Flag error
// $commentMessage = LAN_UPDAXXTE_34;
$mes->add(LAN_UPDATE_21."comments", E_MESSAGE_ERROR);
}
else
{
if (FALSE ===$sql->db_Update('comments',"comment_author_id=SUBSTRING_INDEX(`comment_author`,'.',1), comment_author_name=SUBSTRING(`comment_author` FROM POSITION('.' IN `comment_author`)+1)"))
{ {
// Flag error // Flag error
$mes->add(LAN_UPDATE_21.'comments', E_MESSAGE_ERROR); // $commentMessage = LAN_UPDAXXTE_34;
$mes->add(LAN_UPDATE_21."comments", E_MESSAGE_ERROR);
} }
else else
{ // Delete superceded field - comment_author {
if (!$sql->db_Select_gen("ALTER TABLE `#comments` DROP COLUMN `comment_author`")) if (FALSE ===$sql->db_Update('comments',"comment_author_id=SUBSTRING_INDEX(`comment_author`,'.',1), comment_author_name=SUBSTRING(`comment_author` FROM POSITION('.' IN `comment_author`)+1)"))
{ {
// Flag error // Flag error
$mes->add(LAN_UPDATE_24."comments - comment_author", E_MESSAGE_ERROR); $mes->add(LAN_UPDATE_21.'comments', E_MESSAGE_ERROR);
} }
else
{ // Delete superceded field - comment_author
if (!$sql->db_Select_gen("ALTER TABLE `#comments` DROP COLUMN `comment_author`"))
{
// Flag error
$mes->add(LAN_UPDATE_24.'comments - comment_author', E_MESSAGE_ERROR);
}
}
} }
}
$mes->add(LAN_UPDATE_21."comments", E_MESSAGE_SUCCESS);
$mes->add(LAN_UPDATE_21.'comments', E_MESSAGE_SUCCESS);
} }
@@ -529,77 +532,78 @@ function update_706_to_800($type='')
// Front page prefs (logic has changed) // Front page prefs (logic has changed)
if (!isset($pref['frontpage_force'])) if (!isset($pref['frontpage_force']))
{ // Just set basic options; no real method of converting the existing { // Just set basic options; no real method of converting the existing
if ($just_check) return update_needed('Change front page prefs'); if ($just_check) return update_needed('Change front page prefs');
$pref['frontpage_force'] = array(e_UC_PUBLIC => ''); $pref['frontpage_force'] = array(e_UC_PUBLIC => '');
$pref['frontpage'] = array(e_UC_PUBLIC => 'news.php'); $pref['frontpage'] = array(e_UC_PUBLIC => 'news.php');
// $_pdateMessages[] = LAN_UPDATE_38; //FIXME // $_pdateMessages[] = LAN_UPDATE_38; //FIXME
$mes->add(LAN_UPDATE_20."frontpage",E_MESSAGE_SUCCESS); $mes->add(LAN_UPDATE_20."frontpage",E_MESSAGE_SUCCESS);
$do_save = TRUE; $do_save = TRUE;
} }
if ($sql->db_Table_exists('newsfeed')) if ($sql->db_Table_exists('newsfeed'))
{ // Need to extend field newsfeed_url varchar(250) NOT NULL default '' { // Need to extend field newsfeed_url varchar(250) NOT NULL default ''
if ($sql -> db_Query("SHOW FIELDS FROM ".MPREFIX."newsfeed LIKE 'newsfeed_url'")) if ($sql->db_Query("SHOW FIELDS FROM ".MPREFIX."newsfeed LIKE 'newsfeed_url'"))
{
$row = $sql -> db_Fetch();
if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(250)')
{ {
if ($just_check) return update_needed('Update newsfeed field definition'); $row = $sql -> db_Fetch();
$status = $sql->db_Select_gen("ALTER TABLE `".MPREFIX."newsfeed` MODIFY `newsfeed_url` VARCHAR(250) NOT NULL DEFAULT '' ") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(250)')
$updateMessages[] = LAN_UPDATE_40; //FIXME {
$mes->add(LAN_UPDATE_21."newsfeed",$status); if ($just_check) return update_needed('Update newsfeed field definition');
// catch_error(); $status = $sql->db_Select_gen("ALTER TABLE `".MPREFIX."newsfeed` MODIFY `newsfeed_url` VARCHAR(250) NOT NULL DEFAULT '' ") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$updateMessages[] = LAN_UPDATE_40; //FIXME
$mes->add(LAN_UPDATE_21."newsfeed",$status);
// catch_error($sql);
}
} }
}
} }
//TODO use generic function for this update. //TODO use generic function for this update.
if ($sql->db_Table_exists('download')) if ($sql->db_Table_exists('download'))
{ // Need to extend field download_url varchar(255) NOT NULL default '' { // Need to extend field download_url varchar(255) NOT NULL default ''
if ($sql -> db_Query("SHOW FIELDS FROM ".MPREFIX."download LIKE 'download_url'")) if ($sql->db_Query("SHOW FIELDS FROM ".MPREFIX."download LIKE 'download_url'"))
{
$row = $sql -> db_Fetch();
if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(255)')
{ {
if ($just_check) return update_needed('Update download table field definition'); $row = $sql -> db_Fetch();
$sql->db_Select_gen("ALTER TABLE `".MPREFIX."download` MODIFY `download_url` VARCHAR(255) NOT NULL DEFAULT '' "); if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(255)')
$updateMessages[] = LAN_UPDATE_52; //FIXME {
catch_error(); if ($just_check) return update_needed('Update download table field definition');
$sql->db_Select_gen("ALTER TABLE `#download` MODIFY `download_url` VARCHAR(255) NOT NULL DEFAULT '' ");
$updateMessages[] = LAN_UPDATE_52; //FIXME
catch_error($sql);
}
} }
}
} }
//TODO use generic function for this update. //TODO use generic function for this update.
if ($sql->db_Table_exists('download_mirror')) if ($sql->db_Table_exists('download_mirror'))
{ // Need to extend field download_url varchar(255) NOT NULL default '' { // Need to extend field download_url varchar(255) NOT NULL default ''
if ($sql->db_Select_gen("SHOW FIELDS FROM ".MPREFIX."download_mirror LIKE 'mirror_url'")) if ($sql->db_Select_gen("SHOW FIELDS FROM ".MPREFIX."download_mirror LIKE 'mirror_url'"))
{
$row = $sql -> db_Fetch();
if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(255)')
{ {
if ($just_check) return update_needed('Update download mirror table field definition'); $row = $sql -> db_Fetch();
$sql->db_Select_gen("ALTER TABLE `".MPREFIX."download_mirror` MODIFY `mirror_url` VARCHAR(255) NOT NULL DEFAULT '' "); if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(255)')
$updateMessages[] = LAN_UPDATE_53; //FIXME {
catch_error(); if ($just_check) return update_needed('Update download mirror table field definition');
$sql->db_Select_gen("ALTER TABLE `".MPREFIX."download_mirror` MODIFY `mirror_url` VARCHAR(255) NOT NULL DEFAULT '' ");
$updateMessages[] = LAN_UPDATE_53; //FIXME
catch_error($sql);
}
} }
}
} }
// Check need for user timezone before we delete the field // Check need for user timezone before we delete the field
if (varsettrue($pref['signup_option_timezone'])) if (varsettrue($pref['signup_option_timezone']))
{ {
if ($sql->db_Field('user', 'user_timezone', '', TRUE) && !$sql->db_Field('user_extended','user_timezone','',TRUE)) if ($sql->db_Field('user', 'user_timezone', '', TRUE) && !$sql->db_Field('user_extended','user_timezone','',TRUE))
{ {
if ($just_check) return update_needed('Move user timezone info'); if ($just_check) return update_needed('Move user timezone info');
if (!copy_user_timezone()) if (!copy_user_timezone())
{ // Error doing the transfer { // Error doing the transfer
$updateMessages[] = LAN_UPDATE_42; //FIXME $updateMessages[] = LAN_UPDATE_42; //FIXME
return FALSE; return FALSE;
}
$updateMessages[] = LAN_UPDATE_41;
} }
$updateMessages[] = LAN_UPDATE_41;
}
} }
@@ -609,7 +613,7 @@ function update_706_to_800($type='')
{ {
if ($just_check) return update_needed('Rename dblog to admin_log'); if ($just_check) return update_needed('Rename dblog to admin_log');
$sql->db_Select_gen('ALTER TABLE `'.MPREFIX.'dblog` RENAME `'.MPREFIX.'admin_log`'); $sql->db_Select_gen('ALTER TABLE `'.MPREFIX.'dblog` RENAME `'.MPREFIX.'admin_log`');
catch_error(); catch_error($sql);
$updateMessages[] = LAN_UPDATE_43; //FIXME $updateMessages[] = LAN_UPDATE_43; //FIXME
} }
@@ -620,30 +624,30 @@ function update_706_to_800($type='')
if ($just_check) return update_needed('Rename rl_history to dblog'); if ($just_check) return update_needed('Rename rl_history to dblog');
$sql->db_Select_gen('ALTER TABLE `'.MPREFIX.'rl_history` RENAME `'.MPREFIX.'dblog`'); $sql->db_Select_gen('ALTER TABLE `'.MPREFIX.'rl_history` RENAME `'.MPREFIX.'dblog`');
$updateMessages[] = LAN_UPDATE_44; //FIXME $updateMessages[] = LAN_UPDATE_44; //FIXME
catch_error(); catch_error($sql);
} }
// New tables required (list at top. Definitions in core_sql.php) // New tables required (list at top. Definitions in core_sql.php)
foreach ($new_tables as $nt) foreach ($new_tables as $nt)
{ {
if (!$sql->db_Table_exists($nt)) if (!$sql->db_Table_exists($nt))
{ {
if ($just_check) return update_needed("Add table: ".$nt); if ($just_check) return update_needed('Add table: '.$nt);
// Get the definition // Get the definition
$defs = $db_parser->get_table_def($nt,e_ADMIN."sql/core_sql.php"); $defs = $db_parser->get_table_def($nt,e_ADMIN.'sql/core_sql.php');
if (count($defs)) // **** Add in table here if (count($defs)) // **** Add in table here
{ {
$status = $sql->db_Select_gen('CREATE TABLE `'.MPREFIX.$defs[0][1].'` ('.$defs[0][2].') TYPE='.$defs[0][3]) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $status = $sql->db_Select_gen('CREATE TABLE `'.MPREFIX.$defs[0][1].'` ('.$defs[0][2].') TYPE='.$defs[0][3]) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
// $updateMessages[] = LAN_UPDATE_45.$defs[0][1]; // $updateMessages[] = LAN_UPDATE_45.$defs[0][1];
$mes->add(LAN_UPDATE_27.$defs[0][1], $status); //TODO - all update messages should work like this. $mes->add(LAN_UPDATE_27.$defs[0][1], $status); //TODO - all update messages should work like this. But also need $updateMessages[] for admin log
// catch_error(); // catch_error($sql);
}
else
{ // error parsing defs file
$mes->add(LAN_UPDATE_46.$defs[0][1], E_MESSAGE_ERROR);
}
unset($defs);
} }
else
{ // error parsing defs file
$mes->add(LAN_UPDATE_46.$defs[0][1], E_MESSAGE_ERROR);
}
unset($defs);
}
} }
@@ -692,7 +696,7 @@ function update_706_to_800($type='')
$status = $sql->db_Select_gen($qry) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $status = $sql->db_Select_gen($qry) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add(LAN_UPDATE_21.$ct, $status); $mes->add(LAN_UPDATE_21.$ct, $status);
catch_error(); catch_error($sql);
} }
} }
} }
@@ -756,7 +760,7 @@ function update_706_to_800($type='')
} }
$sql->db_Select_gen($qry); $sql->db_Select_gen($qry);
$updateMessages[] = LAN_UPDATE_51.$ct; //FIXME $updateMessages[] = LAN_UPDATE_51.$ct; //FIXME
catch_error(); catch_error($sql);
} }
} }
} }
@@ -771,7 +775,7 @@ function update_706_to_800($type='')
$ep = new e107plugin; $ep = new e107plugin;
$ep -> update_plugins_table(); $ep -> update_plugins_table();
// $_pdateMessages[] = LAN_UPDATE_XX24; // $_pdateMessages[] = LAN_UPDATE_XX24;
// catch_error(); // catch_error($sql);
} }
@@ -800,7 +804,7 @@ function update_706_to_800($type='')
if ($just_check) return update_needed('Update IP address field '.$f.' in table '.$t); if ($just_check) return update_needed('Update IP address field '.$f.' in table '.$t);
$status = $sql->db_Select_gen("ALTER TABLE `".MPREFIX.$t."` MODIFY `{$f}` VARCHAR(45) NOT NULL DEFAULT '';") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $status = $sql->db_Select_gen("ALTER TABLE `".MPREFIX.$t."` MODIFY `{$f}` VARCHAR(45) NOT NULL DEFAULT '';") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add(LAN_UPDATE_26.$t.' - '.$f, $status); $mes->add(LAN_UPDATE_26.$t.' - '.$f, $status);
// catch_error(); // catch_error($sql);
} }
} }
else else
@@ -850,7 +854,7 @@ function update_70x_to_706($type='')
{ {
if ($just_check) return update_needed(); if ($just_check) return update_needed();
$sql->db_Select_gen("ALTER TABLE `".MPREFIX."plugin` ADD `plugin_addons` TEXT NOT NULL ;"); $sql->db_Select_gen("ALTER TABLE `".MPREFIX."plugin` ADD `plugin_addons` TEXT NOT NULL ;");
catch_error(); catch_error($sql);
} }
//rename plugin_rss field //rename plugin_rss field
@@ -858,7 +862,7 @@ function update_70x_to_706($type='')
{ {
if ($just_check) return update_needed(); if ($just_check) return update_needed();
$sql->db_Select_gen("ALTER TABLE `".MPREFIX."plugin` CHANGE `plugin_rss` `plugin_addons` TEXT NOT NULL;"); $sql->db_Select_gen("ALTER TABLE `".MPREFIX."plugin` CHANGE `plugin_rss` `plugin_addons` TEXT NOT NULL;");
catch_error(); catch_error($sql);
} }
@@ -879,7 +883,7 @@ function update_70x_to_706($type='')
$mes = LAN_UPDATE_12." : <a href='".e_ADMIN."db.php?plugin'>".ADLAN_145."</a>."; $mes = LAN_UPDATE_12." : <a href='".e_ADMIN."db.php?plugin'>".ADLAN_145."</a>.";
//$ns -> tablerender(LAN_ERROR,$mes); //$ns -> tablerender(LAN_ERROR,$mes);
$emessage->add($mes, E_MESSAGE_ERROR); $emessage->add($mes, E_MESSAGE_ERROR);
catch_error(); catch_error($sql);
} }
} }
@@ -887,7 +891,7 @@ function update_70x_to_706($type='')
{ {
if ($just_check) return update_needed(); if ($just_check) return update_needed();
$sql->db_Select_gen("ALTER TABLE ".MPREFIX."online ADD online_active INT(10) UNSIGNED NOT NULL DEFAULT '0'"); $sql->db_Select_gen("ALTER TABLE ".MPREFIX."online ADD online_active INT(10) UNSIGNED NOT NULL DEFAULT '0'");
catch_error(); catch_error($sql);
} }
if ($sql -> db_Query("SHOW INDEX FROM ".MPREFIX."tmp")) if ($sql -> db_Query("SHOW INDEX FROM ".MPREFIX."tmp"))
@@ -1015,6 +1019,10 @@ function addIndexToTable($target, $indexSpec, $just_check, &$updateMessages, $op
} }
/** Check for database access errors
* @param reference $target - pointer to db object
* @return none
*/
function catch_error(&$target) function catch_error(&$target)
{ {
if (vartrue($target->mySQLlastErrText) && E107_DEBUG_LEVEL != 0) if (vartrue($target->mySQLlastErrText) && E107_DEBUG_LEVEL != 0)

View File

@@ -1,7 +1,7 @@
<?php <?php
/* /*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt) * Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: admin_shortcodes_class.php,v 1.32 2009-11-17 13:12:43 e107coders Exp $ * $Id: admin_shortcodes_class.php,v 1.33 2009-12-01 20:05:53 e107steved Exp $
* *
* Admin shortcode batch - class * Admin shortcode batch - class
*/ */
@@ -1086,8 +1086,8 @@ class admin_shortcodes
$i++; $i++;
} }
} }
closedir($handle);
} }
closedir($handle);
$text .= '</div>'; $text .= '</div>';

View File

@@ -7,8 +7,8 @@
* GNU General Public License (http://gnu.org). * GNU General Public License (http://gnu.org).
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/date_handler.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/date_handler.php,v $
* $Revision: 1.13 $ * $Revision: 1.14 $
* $Date: 2009-11-27 21:42:46 $ * $Date: 2009-12-01 20:05:53 $
* $Author: e107steved $ * $Author: e107steved $
* *
*/ */
@@ -126,7 +126,7 @@ class convert
* @param string $input - usually date/time string with numeric values for relevant fields, and almost any separator. e.g. dd-mm-yy hh:mm * @param string $input - usually date/time string with numeric values for relevant fields, and almost any separator. e.g. dd-mm-yy hh:mm
* Date and time must be separated by one or more spaces. In times, minutes and seconds are optional, and default to zero * Date and time must be separated by one or more spaces. In times, minutes and seconds are optional, and default to zero
* One special value is allowed - 'now' * One special value is allowed - 'now'
* @param string $decode - one of 'date', 'time', 'datetime' * @param string $decode - one of 'date', 'time', 'datetime', 'timedate'
* @param string $format - sets field order for dates. Valid strings are dmy, mdy, ymd. Add suffix 'z' to return UTC/GMT * @param string $format - sets field order for dates. Valid strings are dmy, mdy, ymd. Add suffix 'z' to return UTC/GMT
* @param boolean $endDay - if TRUE, and no time entered, includes a time of 23:59:59 in the entered date * @param boolean $endDay - if TRUE, and no time entered, includes a time of 23:59:59 in the entered date
* *
@@ -134,7 +134,7 @@ class convert
*/ */
public function decodeDateTime($input, $decode = 'date', $format = 'dmy', $endDay = FALSE) public function decodeDateTime($input, $decode = 'date', $format = 'dmy', $endDay = FALSE)
{ {
if ($input == 'now') return time(); if ($input == 'now') return time(); // Current time TODO: option to return UTC or local time here
$useLocale = TRUE; $useLocale = TRUE;
if (substr($format,-1,1) == 'z') if (substr($format,-1,1) == 'z')
{ {
@@ -145,21 +145,25 @@ class convert
{ {
case 'date' : case 'date' :
$timeString = ''; $timeString = '';
$dateString = trim($input); $dateString = $input;
break; break;
case 'time' : case 'time' :
$timeString = trim($input); $timeString = $input;
$dateString = ''; $dateString = '';
break; break;
case 'datetime' : case 'datetime' : // Date then time, separated by space
$input = str_replace(' ',' ', $input); $input = str_replace(' ',' ', $input);
list($dateString, $timeString) = explode(' ',$input,2); list($dateString, $timeString) = explode(' ',$input,2);
$timeString = trim($timeString); break;
$dateString = trim($dateString); case 'timedate' : // Time then date, separated by space
$input = str_replace(' ',' ', $input);
list($timeString, $dateString) = explode(' ',$input,2);
break; break;
default : default :
return 0; return 0;
} }
$timeString = trim($timeString);
$dateString = trim($dateString);
$dateVals = array (1 => 0, 2 => 0, 3 => 0); // Preset date in case $dateVals = array (1 => 0, 2 => 0, 3 => 0); // Preset date in case
$timeVals = array (1 => 0, 2 => 0, 3 => 0); // Preset time in case $timeVals = array (1 => 0, 2 => 0, 3 => 0); // Preset time in case
if ($dateString) if ($dateString)
@@ -214,7 +218,6 @@ class convert
{ {
preg_match('#(\d{1,2})(?:\D(\d{1,2})){0,1}(?:\D(\d{1,2})){0,1}#', $timeString, $timeVals); preg_match('#(\d{1,2})(?:\D(\d{1,2})){0,1}(?:\D(\d{1,2})){0,1}#', $timeString, $timeVals);
} }
//print_a($timeVals);
} }
elseif ($endDay) elseif ($endDay)
{ {

View File

@@ -9,8 +9,8 @@
* 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.13 $ * $Revision: 1.14 $
* $Date: 2009-11-20 22:23:02 $ * $Date: 2009-12-01 20:05:53 $
* $Author: e107steved $ * $Author: e107steved $
*/ */
@@ -125,6 +125,7 @@ class db_table_admin
{ {
unset($defs); unset($defs);
$fv = trim(str_replace(' ', ' ', $fv)); $fv = trim(str_replace(' ', ' ', $fv));
$fv = str_replace('`', '', $fv);
if (substr($fv, -1) == ',') if (substr($fv, -1) == ',')
{ {
$fv = trim(substr($fv, 0, -1)); $fv = trim(substr($fv, 0, -1));

View File

@@ -9,8 +9,8 @@
* Administration - Site Maintenance * Administration - Site Maintenance
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/mailout_admin_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/mailout_admin_class.php,v $
* $Revision: 1.8 $ * $Revision: 1.9 $
* $Date: 2009-11-30 20:40:03 $ * $Date: 2009-12-01 20:05:53 $
* $Author: e107steved $ * $Author: e107steved $
* *
*/ */
@@ -216,18 +216,21 @@ class mailoutAdminClass extends e107MailManager
global $user_pref; global $user_pref;
$this->mode = $mode; $this->mode = $mode;
$curTable = $this->tasks[$this->mode]['defaultTable']; $curTable = $this->tasks[$this->mode]['defaultTable'];
if (is_array($user_pref['admin_mailout_columns'][$mode])) if ($curTable)
{ // Use saved list of fields to view if it exists {
$this->fieldPref = $user_pref['admin_mailout_columns'][$mode]; if (is_array($user_pref['admin_mailout_columns'][$mode]))
} { // Use saved list of fields to view if it exists
else $this->fieldPref = $user_pref['admin_mailout_columns'][$mode];
{ // Default list is minimal fields only }
$this->fieldPref = array(); else
foreach ($this->fields[$curTable] as $f => $v) { // Default list is minimal fields only
{ $this->fieldPref = array();
if (vartrue($v['forced'])) foreach ($this->fields[$curTable] as $f => $v)
{ {
$this->fieldPref[] = $f; if (vartrue($v['forced']))
{
$this->fieldPref[] = $f;
}
} }
} }
} }
@@ -468,7 +471,7 @@ class mailoutAdminClass extends e107MailManager
{ {
if ($m->mailerEnabled) if ($m->mailerEnabled)
{ {
$ret .= "<tr><td>".$m->mailerName."</td><td>".$m->showSelect(TRUE, varset($selectorInfo[$m->mailerSource], FALSE))."</td></tr>"; $ret .= "<tr><td style='vertical-align: middle'>".$m->mailerName."</td><td>".$m->showSelect(TRUE, varset($selectorInfo[$m->mailerSource], FALSE))."</td></tr>";
} }
} }
return $ret; return $ret;
@@ -1187,7 +1190,7 @@ class mailoutAdminClass extends e107MailManager
// Add in core and any plugin selectors here // Add in core and any plugin selectors here
foreach ($mail_handlers as $m) foreach ($this->mailHandlers as $m)
{ {
if ($m->mailer_enabled) if ($m->mailer_enabled)
{ {
@@ -1232,11 +1235,11 @@ class mailoutAdminClass extends e107MailManager
</colgroup> </colgroup>
<tbody>"; <tbody>";
$text .= "<tr><td>".LAN_MAILOUT_238."</td><td>".$this->makeCalendar('mail_earliest_time')."</td></tr>"; $text .= "<tr><td>".LAN_MAILOUT_238."</td><td>".$this->makeCalendar('mail_earliest_time', '', CORE_DATE_ORDER)."</td></tr>";
$text .= "<tr><td>".LAN_MAILOUT_239."</td><td>".$this->makeCalendar('mail_latest_time')."</td></tr>"; $text .= "<tr><td>".LAN_MAILOUT_239."</td><td>".$this->makeCalendar('mail_latest_time', '', CORE_DATE_ORDER)."</td></tr>";
// Can comment the two lines above, uncomment two lines below, and default time/date is shown. May or may not be preferable // Can comment the two lines above, uncomment two lines below, and default time/date is shown. May or may not be preferable
// $text .= "<tr><td>".LAN_MAILOUT_238."</td><td>".$this->makeCalendar('mail_earliest_time', time())."</td></tr>"; // $text .= "<tr><td>".LAN_MAILOUT_238."</td><td>".$this->makeCalendar('mail_earliest_time', time(), CORE_DATE_ORDER)."</td></tr>";
// $text .= "<tr><td>".LAN_MAILOUT_239."</td><td>".$this->makeCalendar('mail_latest_time', time()+86400)."</td></tr>"; // $text .= "<tr><td>".LAN_MAILOUT_239."</td><td>".$this->makeCalendar('mail_latest_time', time()+86400, CORE_DATE_ORDER)."</td></tr>";
$text .= "<tr><td>".LAN_MAILOUT_240."</td><td><input type='checkbox' value='1' name='mail_notify_complete' />".LAN_MAILOUT_241."</td></tr>"; $text .= "<tr><td>".LAN_MAILOUT_240."</td><td><input type='checkbox' value='1' name='mail_notify_complete' />".LAN_MAILOUT_241."</td></tr>";
$text .= "</tbody></table>\n</fieldset>"; $text .= "</tbody></table>\n</fieldset>";
return $text; return $text;
@@ -1244,19 +1247,35 @@ class mailoutAdminClass extends e107MailManager
public function makeCalendar($calName, $calVal = '') public function makeCalendar($calName, $calVal = '', $dateOrder = 'dmy')
{ {
// Determine formatting strings this way, to give sensible default
switch ($dateOrder)
{
case 'mdy' :
$dateString = '%m/%d/%Y %H:%I';
$dispString = 'm/d/Y H:I';
break;
case 'ymd' :
$dateString = '%Y/%m/%d %H:%I';
$dispString = 'Y/m/d H:I';
break;
case 'dmy' :
default :
$dateString = '%d/%m/%Y %H:%I';
$dispString = 'd/m/Y H:I';
}
$calOptions = array( $calOptions = array(
'showsTime' => TRUE, 'showsTime' => TRUE,
'showOthers' => false, 'showOthers' => false,
'weekNumbers' => false, 'weekNumbers' => false,
'ifFormat' => '%d/%m/%Y %H:%I' 'ifFormat' => $dateString
); );
$calAttrib = array( $calAttrib = array(
'class' => 'tbox', 'class' => 'tbox',
'size' => 15, // Number of characters 'size' => 15, // Number of characters
'name' => $calName, 'name' => $calName,
'value' => (($calVal == '') ? '' : date('d/m/Y H:I',$calVal)) 'value' => (($calVal == '') ? '' : date($dispString,$calVal))
); );
return $this->_cal->make_input_field($calOptions, $calAttrib); return $this->_cal->make_input_field($calOptions, $calAttrib);
} }
@@ -1311,84 +1330,91 @@ class mailoutAdminClass extends e107MailManager
$count = $this->selectTargetStatus($mailID, $this->showFrom, $this->showCount, '*', FALSE, $this->sortField, $this->sortOrder); $count = $this->selectTargetStatus($mailID, $this->showFrom, $this->showCount, '*', FALSE, $this->sortField, $this->sortOrder);
$totalCount = $this->getTargetCount(); $totalCount = $this->getTargetCount();
$text .= " if ($count == 0)
<form action='".e_SELF."?mode=recipients&amp;m={$mailID}&amp;count={$count}&amp;frm={$this->showFrom}&amp;fld={$this->sortField}&amp;asc={$this->sortOrder}&amp;savepage={$nextPage}' id='email_recip_body' method='post'>
<fieldset id='email-recip_body'>
<table cellpadding='0' cellspacing='0' class='adminlist'>";
$fieldPrefs = $this->calcFieldSpec('recipients', TRUE); // Get columns to display
// Must use '&' rather than '&amp;' in query pattern
$text .= $frm->colGroup($this->fields['mail_recipients'],$this->fieldPref).$frm->thead($this->fields['mail_recipients'],$this->fieldPref,'mode='.'recipients&amp;m='.$mailID."&fld=[FIELD]&asc=[ASC]&frm=[FROM]")."<tbody>";
while ($row = $this->getNextTargetStatus(FALSE))
{ {
// print_a($row); $text .= "<span class='required'>".LAN_MAILOUT_253.'</span>';
$text .= '<tr>'; }
foreach ($fieldPrefs as $fieldName) else
{ // Output column data value {
$text .= '<td>'; $text .= "
if (isset($row[$fieldName])) <form action='".e_SELF."?mode=recipients&amp;m={$mailID}&amp;count={$count}&amp;frm={$this->showFrom}&amp;fld={$this->sortField}&amp;asc={$this->sortOrder}&amp;savepage={$nextPage}' id='email_recip_body' method='post'>
{ <fieldset id='email-recip_body'>
$proctype = varset($this->fields['mail_recipients'][$fieldName]['proc'], 'default'); <table cellpadding='0' cellspacing='0' class='adminlist'>";
switch ($proctype)
$fieldPrefs = $this->calcFieldSpec('recipients', TRUE); // Get columns to display
// Must use '&' rather than '&amp;' in query pattern
$text .= $frm->colGroup($this->fields['mail_recipients'],$this->fieldPref).$frm->thead($this->fields['mail_recipients'],$this->fieldPref,'mode='.'recipients&amp;m='.$mailID."&fld=[FIELD]&asc=[ASC]&frm=[FROM]")."<tbody>";
while ($row = $this->getNextTargetStatus(FALSE))
{
// print_a($row);
$text .= '<tr>';
foreach ($fieldPrefs as $fieldName)
{ // Output column data value
$text .= '<td>';
if (isset($row[$fieldName]))
{ {
case 'username' : $proctype = varset($this->fields['mail_recipients'][$fieldName]['proc'], 'default');
$text .= $this->getUserName($row[$fieldName]); switch ($proctype)
break; {
case 'sdatetime' : case 'username' :
$text .= $gen->convert_date($row[$fieldName], 'short'); $text .= $this->getUserName($row[$fieldName]);
break; break;
case 'trunc200' : case 'sdatetime' :
$text .= $this->e107->tp->text_truncate($row[$fieldName], 200, '...'); $text .= $gen->convert_date($row[$fieldName], 'short');
break; break;
case 'contentstatus' : case 'trunc200' :
$text .= $this->statusToText($row[$fieldName]); $text .= $this->e107->tp->text_truncate($row[$fieldName], 200, '...');
break; break;
case 'selectors' : case 'contentstatus' :
$text .= 'cannot display'; $text .= $this->statusToText($row[$fieldName]);
break; break;
case 'array' : case 'selectors' :
if (is_array($row[$fieldName])) $text .= 'cannot display';
{ break;
$nl = ''; case 'array' :
foreach ($row[$fieldName] as $k => $v) if (is_array($row[$fieldName]))
{ {
if ($v) $nl = '';
foreach ($row[$fieldName] as $k => $v)
{ {
$text .= $nl.$k.' => '.$v; if ($v)
$nl = '<br />'; {
$text .= $nl.$k.' => '.$v;
$nl = '<br />';
}
} }
} }
} else
else {
{ $text .= 'bad data: ';
$text .= 'bad data: '; }
} break;
break; case 'default' :
case 'default' : default :
default : $text .= $row[$fieldName];
$text .= $row[$fieldName]; }
} }
else
{ // Special stuff
$text .= 'special';
}
$text .= '</td>';
} }
else // Add in options here
{ // Special stuff $text .= '<td>'.$this->makeTargetOptions('recipients',$row).'</td>';
$text .= 'special'; $text .= '</tr>';
}
$text .= '</td>';
} }
// Add in options here
$text .= '<td>'.$this->makeTargetOptions('recipients',$row).'</td>';
$text .= '</tr>';
}
$text .= "</tbody></table>\n</fieldset></form><br /><br />"; $text .= "</tbody></table>\n</fieldset></form><br /><br />";
if ($totalCount > $count) if ($totalCount > $count)
{ {
$parms = "{$totalCount},{$this->showCount},{$this->showFrom},".e_SELF."?mode=recipients&amp;m={$mailID}&amp;count={$this->showCount}&amp;frm=[FROM]&amp;fld={$this->sortField}&amp;asc={$this->sortOrder}&amp;savepage={$nextPage}"; $parms = "{$totalCount},{$this->showCount},{$this->showFrom},".e_SELF."?mode=recipients&amp;m={$mailID}&amp;count={$this->showCount}&amp;frm=[FROM]&amp;fld={$this->sortField}&amp;asc={$this->sortOrder}&amp;savepage={$nextPage}";
$text .= $this->e107->tp->parseTemplate("{NEXTPREV={$parms}}"); $text .= $this->e107->tp->parseTemplate("{NEXTPREV={$parms}}");
}
} }
$text .= "</div>"; $text .= "</div>";

View File

@@ -9,9 +9,9 @@
* Administration - Site Maintenance * Administration - Site Maintenance
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/mailout_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/mailout_class.php,v $
* $Revision: 1.5 $ * $Revision: 1.6 $
* $Date: 2009-11-18 01:04:43 $ * $Date: 2009-12-01 20:05:53 $
* $Author: e107coders $ * $Author: e107steved $
* *
*/ */
@@ -62,15 +62,10 @@ class core_mailout
); );
// Constructor // Constructor
public function __construct(&$mailerAdminHandler = NULL) public function __construct()
{ {
$this->e107 = e107::getInstance(); $this->e107 = e107::getInstance();
if ($mailerAdminHandler == NULL) $this->adminHandler = e107::getRegistry('_mailout_admin'); // Get the mailer admin object - we want to use some of its functions
{
global $mailAdmin;
$mailerAdminHandler = $mailAdmin;
}
$this->adminHandler = $mailerAdminHandler;
} }
@@ -257,12 +252,20 @@ class core_mailout
{ {
$ret = "<table style='width:95%'>"; $ret = "<table style='width:95%'>";
$ret = "<fieldset id='core-mail-recipients'>
<table cellpadding='0' cellspacing='0' class='adminedit'>
<colgroup span='2'>
<col class='col-label' />
<col class='col-control' />
</colgroup>
<tbody>";
if ($allow_edit) if ($allow_edit)
{ {
// User class select // User class select
$ret .= "<tr> $ret .= "<tr>
<td class='forumheader3'>".LAN_MAILOUT_03.": </td> <td>".LAN_MAILOUT_03.": </td>
<td class='forumheader3'> <td>
".$this->adminHandler->userClassesTotals('email_to', varset($selectVals['email_to'], ''))."</td> ".$this->adminHandler->userClassesTotals('email_to', varset($selectVals['email_to'], ''))."</td>
</tr>"; </tr>";
@@ -270,7 +273,7 @@ class core_mailout
$u_array = array('user_name'=>LAN_MAILOUT_43,'user_login'=>LAN_MAILOUT_44,'user_email'=>LAN_MAILOUT_45); $u_array = array('user_name'=>LAN_MAILOUT_43,'user_login'=>LAN_MAILOUT_44,'user_email'=>LAN_MAILOUT_45);
$ret .= " $ret .= "
<tr> <tr>
<td style='width:35%' class='forumheader3'>".LAN_MAILOUT_46." <td style='width:35%'>".LAN_MAILOUT_46."
<select name='user_search_name' class='tbox'> <select name='user_search_name' class='tbox'>
<option value=''>&nbsp;</option>"; <option value=''>&nbsp;</option>";
@@ -282,27 +285,27 @@ class core_mailout
} }
$ret .= " $ret .= "
</select> ".LAN_MAILOUT_47." </td> </select> ".LAN_MAILOUT_47." </td>
<td style='width:65%' class='forumheader3'> <td style='width:65%'>
<input type='text' name='user_search_value' class='tbox' style='width:80%' value='".varset($selectVals['user_search_value'])."' /> <input type='text' name='user_search_value' class='tbox' style='width:80%' value='".varset($selectVals['user_search_value'])."' />
</td></tr> </td></tr>
"; ";
// User last visit // User last visit
$ret .= " $ret .= "
<tr><td class='forumheader3'>".LAN_MAILOUT_56.' '.$this->adminHandler->comparisonSelect('last_visit_match', $selectVals['last_visit_match'])." </td> <tr><td>".LAN_MAILOUT_56.' '.$this->adminHandler->comparisonSelect('last_visit_match', $selectVals['last_visit_match'])." </td>
<td class='forumheader3'> <td>
<input type='text' name='last_visit_date' class='tbox' style='width:30%' value='".varset($selectVals['last_visit_date'], '')."' /> <input type='text' name='last_visit_date' class='tbox' style='width:30%' value='".varset($selectVals['last_visit_date'], '')."' />
</td></tr>"; </td></tr>";
// Extended user fields // Extended user fields
$ret .= " $ret .= "
<tr><td class='forumheader3'>".LAN_MAILOUT_46.$this->adminHandler->ret_extended_field_list('extended_1_name', varset($selectVals['extended_1_name'], ''), TRUE).LAN_MAILOUT_48." </td> <tr><td>".LAN_MAILOUT_46.$this->adminHandler->ret_extended_field_list('extended_1_name', varset($selectVals['extended_1_name'], ''), TRUE).LAN_MAILOUT_48." </td>
<td class='forumheader3'> <td>
<input type='text' name='extended_1_value' class='tbox' style='width:80%' value='".varset($selectVals['extended_1_value'], '')."' /> <input type='text' name='extended_1_value' class='tbox' style='width:80%' value='".varset($selectVals['extended_1_value'], '')."' />
</td></tr> </td></tr>
<tr><td class='forumheader3'>".LAN_MAILOUT_46.$this->adminHandler->ret_extended_field_list('extended_2_name', varset($selectVals['extended_2_name'], ''), TRUE).LAN_MAILOUT_48." </td> <tr><td>".LAN_MAILOUT_46.$this->adminHandler->ret_extended_field_list('extended_2_name', varset($selectVals['extended_2_name'], ''), TRUE).LAN_MAILOUT_48." </td>
<td class='forumheader3'> <td>
<input type='text' name='extended_2_value' class='tbox' style='width:80%' value='".varset($selectVals['extended_2_value'], '')."' /> <input type='text' name='extended_2_value' class='tbox' style='width:80%' value='".varset($selectVals['extended_2_value'], '')."' />
</td></tr> </td></tr>
"; ";
@@ -320,8 +323,8 @@ class core_mailout
$_to = $selectVals['email_to']; $_to = $selectVals['email_to'];
} }
$ret .= "<tr> $ret .= "<tr>
<td class='forumheader3'>".LAN_MAILOUT_03."</td> <td>".LAN_MAILOUT_03."</td>
<td class='forumheader3'>".$_to."&nbsp;"; <td>".$_to."&nbsp;";
if($selectVals['email_to'] == "self") if($selectVals['email_to'] == "self")
{ {
$text .= "&lt;".USEREMAIL."&gt;"; $text .= "&lt;".USEREMAIL."&gt;";
@@ -333,8 +336,8 @@ class core_mailout
{ {
$ret .= " $ret .= "
<tr> <tr>
<td class='forumheader3'>".$selectVals['user_search_name']."</td> <td>".$selectVals['user_search_name']."</td>
<td class='forumheader3'>".varset($selectVals['user_search_value'])."&nbsp;</td> <td>".varset($selectVals['user_search_value'])."&nbsp;</td>
</tr>"; </tr>";
} }
@@ -342,8 +345,8 @@ class core_mailout
{ {
$ret .= " $ret .= "
<tr> <tr>
<td class='forumheader3'>".LAN_MAILOUT_56."</td> <td>".LAN_MAILOUT_56."</td>
<td class='forumheader3'>".$selectVals['last_visit_match'].' '.gmstrtotime("%D-%M-%Y",$selectVals['last_visit_date'])."&nbsp;</td> <td>".$selectVals['last_visit_match'].' '.gmstrtotime("%D-%M-%Y",$selectVals['last_visit_date'])."&nbsp;</td>
</tr>"; </tr>";
} }
@@ -351,21 +354,21 @@ class core_mailout
{ {
$ret .= " $ret .= "
<tr> <tr>
<td class='forumheader3'>".$selectVals['extended_1_name']."</td> <td>".$selectVals['extended_1_name']."</td>
<td class='forumheader3'>".$selectVals['extended_1_value']."&nbsp;</td> <td>".$selectVals['extended_1_value']."&nbsp;</td>
</tr>"; </tr>";
} }
if (vartrue($selectVals['extended_2_name']) && vartrue($selectVals['extended_2_value'])) if (vartrue($selectVals['extended_2_name']) && vartrue($selectVals['extended_2_value']))
{ {
$ret .= " $ret .= "
<tr> <tr>
<td class='forumheader3'>".$selectVals['extended_2_name']."</td> <td>".$selectVals['extended_2_name']."</td>
<td class='forumheader3'>".$selectVals['extended_2_value']."&nbsp;</td> <td>".$selectVals['extended_2_value']."&nbsp;</td>
</tr>"; </tr>";
} }
} }
return $ret.'</table>'; return $ret.'</tbody></table></fieldset>';
} }
} }

View File

@@ -9,9 +9,9 @@
* mySQL Handler * mySQL Handler
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/mysql_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/mysql_class.php,v $
* $Revision: 1.66 $ * $Revision: 1.67 $
* $Date: 2009-11-26 17:14:07 $ * $Date: 2009-12-01 20:05:54 $
* $Author: secretr $ * $Author: e107steved $
*/ */
if(defined('MYSQL_LIGHT')) if(defined('MYSQL_LIGHT'))
@@ -49,8 +49,8 @@ $db_ConnectionID = NULL; // Stores ID for the first DB connection used - which s
* *
* @package e107 * @package e107
* @category e107_handlers * @category e107_handlers
* @version $Revision: 1.66 $ * @version $Revision: 1.67 $
* @author $Author: secretr $ * @author $Author: e107steved $
* *
*/ */
class e_db_mysql { class e_db_mysql {
@@ -219,12 +219,15 @@ class e_db_mysql {
/** /**
* @desc Enter description here...
* This is the 'core' routine which handles much of the interface between other functions and the DB * This is the 'core' routine which handles much of the interface between other functions and the DB
* *
* @param unknown $query * If a SELECT query includes SQL_CALC_FOUND_ROWS, the value of FOUND_ROWS() is retrieved and stored in $this->total_results
* @param string $query
* @param unknown $rli * @param unknown $rli
* @return unknown * @return boolean | resource - as mysql_query() function.
* FALSE indicates an error
* For SELECT, SHOW, DESCRIBE, EXPLAIN and others returning a result set, returns a resource
* TRUE indicates success in other cases
*/ */
public function db_Query($query, $rli = NULL, $qry_from = '', $debug = FALSE, $log_type = '', $log_remark = '') public function db_Query($query, $rli = NULL, $qry_from = '', $debug = FALSE, $log_type = '', $log_remark = '')
{ {
@@ -262,7 +265,7 @@ class e_db_mysql {
if ((strpos($query,'SQL_CALC_FOUND_ROWS') !== FALSE) && (strpos($query,'SELECT') !== FALSE)) if ((strpos($query,'SQL_CALC_FOUND_ROWS') !== FALSE) && (strpos($query,'SELECT') !== FALSE))
{ // Need to get the total record count as well. Return code is a resource identifier { // Need to get the total record count as well. Return code is a resource identifier
// Have to do this before any debug action, otherwise this bit gets messed up // Have to do this before any debug action, otherwise this bit gets messed up
$fr = mysql_query("SELECT FOUND_ROWS()", $this->mySQLaccess); $fr = mysql_query('SELECT FOUND_ROWS()', $this->mySQLaccess);
$rc = mysql_fetch_array($fr); $rc = mysql_fetch_array($fr);
$this->total_results = $rc['FOUND_ROWS()']; $this->total_results = $rc['FOUND_ROWS()'];
} }
@@ -843,12 +846,15 @@ class e_db_mysql {
/** /**
* @return unknown * Function to handle any MySQL query
* @param unknown $arg * @param string $query - the MySQL query string, where '#' represents the database prefix in front of table names.
* @desc Enter description here... * Recommended to enclose all table names in backticks, to minimise the possibility of erroneous substitutions
* @access private * @return boolean | integer
* Returns FALSE if there is an error in the query
* Returns TRUE if the query is successful, and it does not return a row count
* Returns the number of rows added/updated/deleted for DELETE, INSERT, REPLACE, or UPDATE
*/ */
function db_Select_gen($query, $debug = FALSE, $log_type = '', $log_remark = '') public function db_Select_gen($query, $debug = FALSE, $log_type = '', $log_remark = '')
{ {
$this->tabset = FALSE; $this->tabset = FALSE;
@@ -869,16 +875,22 @@ class e_db_mysql {
//FIXME - this is a quick Fix for REGEXP queries, as used in admin_ui. //FIXME - this is a quick Fix for REGEXP queries, as used in admin_ui.
$query = str_replace("`#","`".$this->mySQLPrefix,$query); $query = str_replace("`#","`".$this->mySQLPrefix,$query);
if (($this->mySQLresult = $this->db_Query($query, NULL, 'db_Select_gen', $debug, $log_type, $log_remark)) === TRUE) if ($this->mySQLresult === FALSE)
{ // Successful query which doesn't return a row count
$this->dbError('db_Select_gen');
return TRUE;
}
elseif ($this->mySQLresult === FALSE)
{ // Failed query { // Failed query
$this->dbError('db_Select_gen('.$query.')'); $this->dbError('db_Select_gen('.$query.')');
return FALSE; return FALSE;
} }
elseif (($this->mySQLresult = $this->db_Query($query, NULL, 'db_Select_gen', $debug, $log_type, $log_remark)) === TRUE)
{ // Successful query which may return a row count (because it operated on a number of rows without returning a result set)
if(preg_match('#^(DELETE|INSERT|REPLACE|UPDATE)#',$query, $matches))
{ // Need to check mysql_affected_rows() - to return number of rows actually updated
$tmp = mysql_affected_rows($this->mySQLaccess);
$this->dbError('db_Select_gen');
return $tmp;
}
$this->dbError('db_Select_gen'); // No row count here
return TRUE;
}
else else
{ // Successful query which does return a row count - get the count and return it { // Successful query which does return a row count - get the count and return it
$this->dbError('db_Select_gen'); $this->dbError('db_Select_gen');

View File

@@ -9,11 +9,15 @@
* 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.14 $ * $Revision: 1.15 $
* $Date: 2009-11-30 20:40:03 $ * $Date: 2009-12-01 20:05:54 $
* $Author: e107steved $ * $Author: e107steved $
* *
*/ */
define('CORE_DATE_ORDER', 'dmy'); // Temporary until we find somewhere better to put it.
// Defines order of field entry/display in date boxes
// Acceptable values: dmy, mdy, ymd
define('LAN_MAILOUT_01','From Name'); define('LAN_MAILOUT_01','From Name');
define('LAN_MAILOUT_02','From Email'); define('LAN_MAILOUT_02','From Email');
define('LAN_MAILOUT_03','To'); define('LAN_MAILOUT_03','To');
@@ -270,8 +274,8 @@ define('LAN_MAILOUT_248', 'Completion status: ');
define('LAN_MAILOUT_249', 'Send results:'); define('LAN_MAILOUT_249', 'Send results:');
define('LAN_MAILOUT_250', '--- End of notification ---'); define('LAN_MAILOUT_250', '--- End of notification ---');
define('LAN_MAILOUT_251', 'Copy and edit'); define('LAN_MAILOUT_251', 'Copy and edit');
define('LAN_MAILOUT_252', ''); define('LAN_MAILOUT_252', 'Does various consistency checks on the data, corrects counts, deletes temporary data');
define('LAN_MAILOUT_253', ''); define('LAN_MAILOUT_253', 'No recipients found - check for database corruption');
define('LAN_MAILOUT_254', ''); define('LAN_MAILOUT_254', '');

View File

@@ -9,9 +9,9 @@
* Administration - Site Maintenance * Administration - Site Maintenance
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/e_mailout.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/e_mailout.php,v $
* $Revision: 1.6 $ * $Revision: 1.7 $
* $Date: 2009-11-19 10:09:12 $ * $Date: 2009-12-01 20:05:54 $
* $Author: marj_nl_fr $ * $Author: e107steved $
* *
*/ */
@@ -43,15 +43,10 @@ class calendar_menu_mailout
// Constructor // Constructor
public function __construct(&$mailerAdminHandler = NULL) public function __construct()
{ {
$this->e107 = e107::getInstance(); $this->e107 = e107::getInstance();
if ($mailerAdminHandler == NULL) $this->adminHandler = e107::getRegistry('_mailout_admin'); // Get the mailer admin object - we want to use some of its functions
{
global $mailAdmin;
$mailerAdminHandler = $mailAdmin;
}
$this->adminHandler = $mailerAdminHandler;
} }
@@ -66,9 +61,12 @@ class calendar_menu_mailout
public function returnSelectors() public function returnSelectors()
{ {
$res = array(); $res = array();
foreach ($_POST['ec_category_sel'] as $k => $v) if (is_array($_POST['ec_category_sel']))
{ {
$res[] = intval($v); foreach ($_POST['ec_category_sel'] as $k => $v)
{
$res[] = intval($v);
}
} }
return implode(',',$res); return implode(',',$res);
} }

View File

@@ -9,8 +9,8 @@
* Administration - Site Maintenance * Administration - Site Maintenance
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/newsletter/e_mailout.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/newsletter/e_mailout.php,v $
* $Revision: 1.1 $ * $Revision: 1.2 $
* $Date: 2009-11-19 20:24:21 $ * $Date: 2009-12-01 20:05:54 $
* $Author: e107steved $ * $Author: e107steved $
* *
*/ */
@@ -45,15 +45,10 @@ class newsletter_mailout
// Constructor // Constructor
public function __construct(&$mailerAdminHandler = NULL) public function __construct()
{ {
$this->e107 = e107::getInstance(); $this->e107 = e107::getInstance();
if ($mailerAdminHandler == NULL) $this->adminHandler = e107::getRegistry('_mailout_admin'); // Get the mailer admin object - we want to use some of its functions
{
global $mailAdmin;
$mailerAdminHandler = $mailAdmin;
}
$this->adminHandler = $mailerAdminHandler;
} }
@@ -68,9 +63,12 @@ class newsletter_mailout
public function returnSelectors() public function returnSelectors()
{ {
$res = array(); $res = array();
foreach ($_POST['nl_category_sel'] as $k => $v) if (is_array($_POST['nl_category_sel']))
{ {
$res[] = intval($v); foreach ($_POST['nl_category_sel'] as $k => $v)
{
$res[] = intval($v);
}
} }
return implode(',',$res); return implode(',',$res);
} }