1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 14:46:56 +02:00

Use function to get IP address

This commit is contained in:
e107steved
2008-06-24 20:28:26 +00:00
parent 8ca2f26932
commit e312bd359a

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/ecal_class.php,v $
| $Revision: 1.5 $
| $Date: 2008-01-26 16:16:59 $
| $Revision: 1.6 $
| $Date: 2008-06-24 20:28:26 $
| $Author: e107steved $
|
| Event calendar class:
@@ -269,7 +269,7 @@ if (!defined("EC_DEFAULT_CATEGORY")) { define('EC_DEFAULT_CATEGORY',"Default");
// 2 - edit event
// 3 - delete event
// 4 - Bulk delete
global $pref, $admin_log, $e_event, $PLUGINS_DIRECTORY;
global $pref, $admin_log, $e_event, $PLUGINS_DIRECTORY, $e107;
$log_titles = array( '1' => 'Event Calendar - add event',
'2' => 'Event Calendar - edit event',
@@ -286,7 +286,7 @@ if (!defined("EC_DEFAULT_CATEGORY")) { define('EC_DEFAULT_CATEGORY',"Default");
}
else
$cmessage .= "Event Start unknown<br />";
$edata_ec = array("cmessage" => $cmessage, "ip" => getip());
$edata_ec = array("cmessage" => $cmessage, "ip" => $e107->getip());
switch ($event_type)
{
case 5 :
@@ -304,11 +304,11 @@ if (!defined("EC_DEFAULT_CATEGORY")) { define('EC_DEFAULT_CATEGORY',"Default");
case 2 : break; // Continue
default : return; // Invalid or undefined option
}
$log_titles = array( '1' => 'Event Calendar - add event'.strftime("%d-%B-%Y",$event_start),
'2' => 'Event Calendar - edit event'.strftime("%d-%B-%Y",$event_start),
'3' => 'Event Calendar - delete event'.strftime("%d-%B-%Y",$event_start),
$log_titles = array( '1' => 'Event Calendar - add event '.strftime("%d-%B-%Y",$event_start),
'2' => 'Event Calendar - edit event '.strftime("%d-%B-%Y",$event_start),
'3' => 'Event Calendar - delete event '.strftime("%d-%B-%Y",$event_start),
'4' => 'Event Calendar - Bulk Delete',
'5' => 'Event Calendar - multiple add'.strftime("%d-%B-%Y",$event_start)
'5' => 'Event Calendar - multiple add '.strftime("%d-%B-%Y",$event_start)
);
$admin_log->log_event($log_titles[$event_type],$event_title."&nbsp;\n".$event_string,4);
}
@@ -495,11 +495,12 @@ if (!defined("EC_DEFAULT_CATEGORY")) { define('EC_DEFAULT_CATEGORY',"Default");
// Read a list of events between start and end dates
// If $start_only is TRUE, only searches based on the start date/time
// Potential option to hook in other routines later
function get_events($start_time, $end_time, $start_only=FALSE, $cat_filter=0, $inc_recur=FALSE, $event_fields='*', $cat_fields='*')
function get_events($start_time, $end_time, $start_only=FALSE, $cat_filter='*', $inc_recur=FALSE, $event_fields='*', $cat_fields='*')
{
global $sql;
$ret = array();
if ($cat_filter === FALSE) return $ret;
$cat_lj = '';
$category_filter = '';
$extra = '';
@@ -554,11 +555,16 @@ if (!defined("EC_DEFAULT_CATEGORY")) { define('EC_DEFAULT_CATEGORY',"Default");
// It always uses the event start date only
// It tries to keep the actual number of events in memory to a minimum by discarding when it can.
// Once there are $num_events read, it pulls in the $end_time to speed up checks
function get_n_events($num_event, $start_time, $end_time, $cat_filter=0, $inc_recur=FALSE, $event_fields='*', $cat_fields='*')
// $cat_filter = FALSE is 'no categories' - returns an empty array.
// $cat_filter = '*' means 'all categories'
// otherwise $cat_filter mst be a comma-separated list of category IDs.
function get_n_events($num_event, $start_time, $end_time, $cat_filter='*', $inc_recur=FALSE, $event_fields='*', $cat_fields='*')
{
global $sql;
$ret = array();
if ($cat_filter === FALSE) return $ret; // Empty category
$cat_lj = '';
$category_filter = '';
$extra = '';
@@ -570,7 +576,7 @@ if (!defined("EC_DEFAULT_CATEGORY")) { define('EC_DEFAULT_CATEGORY',"Default");
$cat_lj = ' LEFT JOIN #event_cat as ec ON e.event_category = ec.event_cat_id ';
}
if ($cat_filter && ($cat_filter != '*')) $category_filter = " AND find_in_set(e.event_category, '".$cat_filter."') ";
if ($cat_filter != '*') $category_filter = " AND find_in_set(e.event_category, '".$cat_filter."') ";
if ($inc_recur) $extra = " OR (e.event_recurring >'0' AND (e.event_start <= ".intval($end_time)." AND e.event_end >= ".intval($start_time).")) ";
$qry = "SELECT {$event_fields}{$cat_fields} FROM #event as e {$cat_lj}