mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
Code clean-up (globals, $e107->, headers, $sql)
This commit is contained in:
parent
c4197a76c0
commit
afe4b27cf2
@ -1,16 +1,13 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2011 e107 Inc (e107.org)
|
||||
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* e107 Main
|
||||
* Login handler
|
||||
*
|
||||
* $Id$
|
||||
* $URL$
|
||||
*/
|
||||
|
||||
|
||||
@ -557,9 +554,9 @@ class userlogin
|
||||
*/
|
||||
protected function logNote($title, $text)
|
||||
{
|
||||
$e107 = &e107::getInstance();
|
||||
$title = $e107->tp->toDB($title);
|
||||
$text = $e107->tp->toDB($text);
|
||||
$e107 = e107::getInstance();
|
||||
$title = e107::getParser()->toDB($title);
|
||||
$text = e107::getParser()->toDB($text);
|
||||
$e107->admin_log->e_log_event(4, __FILE__."|".__FUNCTION__."@".__LINE__, "LOGIN", $title, $text, FALSE, LOG_TO_ROLLING);
|
||||
}
|
||||
|
||||
@ -572,9 +569,9 @@ class userlogin
|
||||
*/
|
||||
protected function genNote($username, $msg1)
|
||||
{
|
||||
$e107 = &e107::getInstance();
|
||||
$message = $e107->tp->toDB($msg1." ::: ".LAN_LOGIN_1.": ".$username);
|
||||
$e107->sql->db_Insert("generic", "0, 'failed_login', '".time()."', 0, '{$this->userIP}', 0, '{$message}'");
|
||||
$e107 = e107::getInstance();
|
||||
$message = e107::getParser()->toDB($msg1." ::: ".LAN_LOGIN_1.": ".$username);
|
||||
e107::getDb()->insert("generic", "0, 'failed_login', '".time()."', 0, '{$this->userIP}', 0, '{$message}'");
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,20 +5,14 @@
|
||||
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* e107 Main
|
||||
*
|
||||
* $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.8/e107_handlers/redirection_class.php $
|
||||
* $Id: redirection_class.php 11922 2010-10-27 11:31:18Z secretr $
|
||||
* $Revision: 11315 $
|
||||
*
|
||||
* Mail handler
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package e107
|
||||
* @subpackage e107_handlers
|
||||
* @version $Revision: 12078 $
|
||||
* @author $Author: e107coders $
|
||||
*
|
||||
* Mailout handler - concerned with processing and sending a single email
|
||||
* Extends the PHPMailer class
|
||||
@ -174,6 +168,7 @@ class e107Email extends PHPMailer
|
||||
|
||||
$e107 = e107::getInstance();
|
||||
$pref = e107::pref('core');
|
||||
$tp = e107::getParser();
|
||||
|
||||
$this->CharSet = 'utf-8';
|
||||
$this->SetLanguage(CORE_LC);
|
||||
@ -273,8 +268,8 @@ class e107Email extends PHPMailer
|
||||
}
|
||||
if (varsettrue($pref['mail_bounce_email'])) $this->Sender = $pref['mail_bounce_email'];
|
||||
|
||||
$this->FromName = $e107->tp->toHTML(varsettrue($pref['replyto_name'],$overrides['siteadmin']),'','RAWTEXT');
|
||||
$this->From = $e107->tp->toHTML(varsettrue($pref['replyto_email'],$overrides['siteadminemail']),'','RAWTEXT');
|
||||
$this->FromName = $tp->toHTML(varsettrue($pref['replyto_name'],$overrides['siteadmin']),'','RAWTEXT');
|
||||
$this->From = $tp->toHTML(varsettrue($pref['replyto_email'],$overrides['siteadminemail']),'','RAWTEXT');
|
||||
$this->WordWrap = 76; // Set a sensible default
|
||||
|
||||
// Now look for any overrides - slightly cumbersome way of doing it, but does give control over what can be set from here
|
||||
|
@ -2,14 +2,12 @@
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2012 e107 Inc (e107.org)
|
||||
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* e107 Menu Class
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
if(!defined('e107_INIT'))
|
||||
@ -251,14 +249,11 @@ class e_menu
|
||||
{
|
||||
// global $sql; // required at the moment.
|
||||
global $sc_style, $e107_debug;
|
||||
|
||||
|
||||
$e107 = e107::getInstance();
|
||||
|
||||
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
$ns = e107::getRender();
|
||||
$tp = e107::getParser();
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
if($return)
|
||||
{
|
||||
@ -292,7 +287,7 @@ class e_menu
|
||||
|
||||
if($template['noTableRender'] !==true)
|
||||
{
|
||||
e107::getRender()->tablerender($caption, $text);
|
||||
$ns->tablerender($caption, $text);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -301,10 +296,9 @@ class e_menu
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$text = $e107->tp->toHTML($page['menu_text'], true, 'parse_sc, constants');
|
||||
e107::getRender()->tablerender($caption, $text);
|
||||
{
|
||||
$text = $tp->toHTML($page['menu_text'], true, 'parse_sc, constants');
|
||||
$ns->tablerender($caption, $text);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,17 +8,12 @@
|
||||
*
|
||||
* Forum plugin notify configuration
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/notify_class.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @package e107
|
||||
* @subpackage e107_handlers
|
||||
* @version $Id$;
|
||||
*
|
||||
* Handler for 'notify' events - sends email notifications to the appropriate user groups
|
||||
*/
|
||||
@ -67,9 +62,11 @@ class notify
|
||||
function send($id, $subject, $message)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$tp = e107::getParser();
|
||||
$sql = e107::getDb();
|
||||
|
||||
$subject = $e107->tp->toEmail(SITENAME.': '.$subject);
|
||||
$message = $e107->tp->toEmail($message);
|
||||
$subject = $tp->toEmail(SITENAME.': '.$subject);
|
||||
$message = $tp->toEmail($message);
|
||||
$emailFilter = '';
|
||||
$notifyTarget = $this->notify_prefs['event'][$id]['class'];
|
||||
if ($notifyTarget == '-email')
|
||||
@ -110,10 +107,10 @@ class notify
|
||||
{
|
||||
$qry .= ' AND `user_id` != '.USERID;
|
||||
}
|
||||
if (FALSE !== ($count = $e107->sql->db_Select_gen($qry)))
|
||||
if (FALSE !== ($count = $sql->gen($qry)))
|
||||
{
|
||||
// Now add email addresses to the list
|
||||
while ($row = $e107->sql->db_Fetch(MYSQL_ASSOC))
|
||||
while ($row = $sql->fetch(MYSQL_ASSOC))
|
||||
{
|
||||
if ($row['user_email'] != $emailFilter)
|
||||
{
|
||||
|
@ -6,17 +6,14 @@
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* e107 Main
|
||||
* Online handler
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @package e107
|
||||
* @subpackage e107_handlers
|
||||
* @version $Id$;
|
||||
*
|
||||
* Handler to keep track of online users
|
||||
*/
|
||||
@ -106,7 +103,7 @@ class e_online
|
||||
// $page = (strpos(e_SELF, 'content') !== FALSE) ? e_SELF.'.'.e_QUERY : $page;
|
||||
$page = e_REQUEST_URI; // mod rewrite & single entry support
|
||||
// FIXME parse url, trigger registered e_online callbacks
|
||||
$page = $e107->tp->toDB($page, true); /// @todo - try not to use toDB() - triggers prefilter
|
||||
$page = e107::getParser()->toDB($page, true); /// @todo - try not to use toDB() - triggers prefilter
|
||||
$ip = e107::getIPHandler()->getIP(FALSE);
|
||||
$udata = ($user->isUser() ? $user->getId().'.'.$user->getName() : '0');
|
||||
$agent = $_SERVER['HTTP_USER_AGENT'];
|
||||
@ -132,9 +129,9 @@ class e_online
|
||||
if ($user->isUser() && !$user->getParentId())
|
||||
{
|
||||
// Find record that matches IP or visitor, or matches user info
|
||||
if ($sql->db_Select('online', '*', "(`online_ip` = '{$ip}' AND `online_user_id` = '0') OR `online_user_id` = '{$udata}'"))
|
||||
if ($sql->select('online', '*', "(`online_ip` = '{$ip}' AND `online_user_id` = '0') OR `online_user_id` = '{$udata}'"))
|
||||
{
|
||||
$row = $sql->db_Fetch();
|
||||
$row = $sql->fetch();
|
||||
|
||||
if ($row['online_user_id'] == $udata)
|
||||
{
|
||||
@ -174,11 +171,11 @@ class e_online
|
||||
$query = "`online_user_id` = '{$udata}'{$update_page}, `online_pagecount` = ".intval($row['online_pagecount'])." WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0' LIMIT 1";
|
||||
}
|
||||
}
|
||||
$sql->db_Update('online', $query);
|
||||
$sql->update('online', $query);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql->db_Insert('online',$insert_query);
|
||||
$sql->insert('online',$insert_query);
|
||||
}
|
||||
}
|
||||
// don't do anything if main admin logged in as another user
|
||||
@ -187,7 +184,7 @@ class e_online
|
||||
//Current page request is from a guest
|
||||
if ($sql->db_Select('online', '*', "`online_ip` = '{$ip}' AND `online_user_id` = '0'"))
|
||||
{ // Recent visitor
|
||||
$row = $sql->db_Fetch();
|
||||
$row = $sql->fetch();
|
||||
|
||||
if ($row['online_timestamp'] < (time() - $online_timeout)) //It has been at least 'timeout' seconds since this ip has connected
|
||||
{
|
||||
@ -201,11 +198,11 @@ class e_online
|
||||
// echo "here {$online_pagecount}";
|
||||
$query="`online_pagecount` = {$row['online_pagecount']}{$update_page} WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0' LIMIT 1";
|
||||
}
|
||||
$sql->db_Update('online', $query);
|
||||
$sql->update('online', $query);
|
||||
}
|
||||
else
|
||||
{ // New visitor
|
||||
$sql->db_Insert('online',$insert_query);
|
||||
$sql->insert('online',$insert_query);
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,16 +237,16 @@ class e_online
|
||||
// Speed up ajax requests
|
||||
if(!deftrue('e_AJAX_REQUEST'))
|
||||
{
|
||||
$sql->db_Delete('online', '`online_timestamp` < '.(time() - $online_timeout));
|
||||
$sql->delete('online', '`online_timestamp` < '.(time() - $online_timeout));
|
||||
|
||||
// FIXME - don't use constants below, save data in class vars, call e_online signleton - e107::getOnline()
|
||||
// $total_online = $sql->db_Count('online'); // 1 less query! :-)
|
||||
if ($total_online = $sql->db_Select_gen('SELECT * FROM #online WHERE online_pagecount > 0 ORDER BY online_timestamp DESC'))
|
||||
if ($total_online = $sql->gen('SELECT * FROM #online WHERE online_pagecount > 0 ORDER BY online_timestamp DESC'))
|
||||
{
|
||||
$member_list = '';
|
||||
$members_online = 0;
|
||||
$listuserson = array();
|
||||
while ($row = $sql->db_Fetch())
|
||||
while ($row = $sql->fetch())
|
||||
{
|
||||
$row['online_bot'] = $this->isBot($row['online_agent']);
|
||||
|
||||
@ -349,9 +346,6 @@ class e_online
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -8,15 +8,12 @@
|
||||
*
|
||||
* User class functions
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package e107
|
||||
* @subpackage e107_handlers
|
||||
* @version $Id$;
|
||||
*
|
||||
* This class handles all user-related user class functions. Admin functions inherit from it.
|
||||
*/
|
||||
@ -1660,7 +1657,7 @@ class user_class_admin extends user_class
|
||||
{
|
||||
$new_userclass = $cid;
|
||||
}
|
||||
$uc_sql->db_Update('user', "user_class='".$e107->tp->toDB($new_userclass, true)."' WHERE user_id=".intval($uid));
|
||||
$uc_sql->db_Update('user', "user_class='".e107::getParser()->toDB($new_userclass, true)."' WHERE user_id=".intval($uid));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1832,6 +1829,4 @@ class user_class_admin extends user_class
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
@ -2,23 +2,17 @@
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/help/mailout.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
|
||||
$e107 = e107::getInstance();
|
||||
$action = $e107->tp->toDB(varset($_GET['mode'],'makemail'));
|
||||
|
||||
$action = e107::getParser()->toDB(varset($_GET['mode'],'makemail'));
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
@ -82,4 +76,4 @@ $action = $e107->tp->toDB(varset($_GET['mode'],'makemail'));
|
||||
$text = 'Undocumented option';
|
||||
}
|
||||
|
||||
$ns -> tablerender('Mail Help', $text);
|
||||
$ns->tablerender('Mail Help', $text);
|
||||
|
@ -25,6 +25,7 @@ class banner_shortcodes
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
$tp = e107::getParser();
|
||||
|
||||
$ret = '';
|
||||
|
||||
@ -33,7 +34,7 @@ class banner_shortcodes
|
||||
$seed = mt_rand(1,2000000000);
|
||||
$time = time();
|
||||
|
||||
$query = " (banner_startdate=0 OR banner_startdate <= {$time}) AND (banner_enddate=0 OR banner_enddate > {$time}) AND (banner_impurchased=0 OR banner_impressions<=banner_impurchased)".($parm ? " AND banner_campaign='".$e107->tp->toDB($parm)."'" : '')."
|
||||
$query = " (banner_startdate=0 OR banner_startdate <= {$time}) AND (banner_enddate=0 OR banner_enddate > {$time}) AND (banner_impurchased=0 OR banner_impressions<=banner_impurchased)".($parm ? " AND banner_campaign='".$tp->toDB($parm)."'" : '')."
|
||||
AND banner_active IN (".USERCLASS_LIST.")
|
||||
ORDER BY RAND($seed) LIMIT 1";
|
||||
|
||||
|
@ -8,10 +8,6 @@
|
||||
*
|
||||
* Event calendar plugin - large calendar display
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/calendar.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -21,34 +17,36 @@
|
||||
*
|
||||
* @package e107_plugins
|
||||
* @subpackage event_calendar
|
||||
* @version $Id$;
|
||||
*/
|
||||
|
||||
if (!defined('e_SINGLE_ENTRY'))
|
||||
{
|
||||
require_once('../../class2.php');
|
||||
}
|
||||
|
||||
$e107 = e107::getInstance();
|
||||
$tp = e107::getParser();
|
||||
|
||||
if (!$e107->isInstalled('calendar_menu')) header('Location: '.e_BASE.'index.php');
|
||||
|
||||
if (isset($_POST['viewallevents']))
|
||||
{
|
||||
Header('Location: '.e_PLUGIN_ABS.'calendar_menu/event.php?' . $_POST['enter_new_val']);
|
||||
exit();
|
||||
Header('Location: '.e_PLUGIN_ABS.'calendar_menu/event.php?' . $_POST['enter_new_val']);
|
||||
exit();
|
||||
}
|
||||
if (isset($_POST['doit']))
|
||||
{
|
||||
Header('Location: '.e_PLUGIN_ABS.'calendar_menu/event.php?ne.' . $_POST['enter_new_val']);
|
||||
exit();
|
||||
Header('Location: '.e_PLUGIN_ABS.'calendar_menu/event.php?ne.' . $_POST['enter_new_val']);
|
||||
exit();
|
||||
}
|
||||
if (isset($_POST['subs']))
|
||||
{
|
||||
Header('Location: '.e_PLUGIN_ABS.'calendar_menu/subscribe.php');
|
||||
exit();
|
||||
Header('Location: '.e_PLUGIN_ABS.'calendar_menu/subscribe.php');
|
||||
exit();
|
||||
}
|
||||
if (isset($_POST['printlists']))
|
||||
{
|
||||
Header('Location: '.e_PLUGIN_ABS.'calendar_menu/ec_pf_page.php');
|
||||
Header('Location: '.e_PLUGIN_ABS.'calendar_menu/ec_pf_page.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
@ -113,10 +111,10 @@ $calSc->catFilter = $cat_filter;
|
||||
//-------------------------------------------------
|
||||
|
||||
// time switch buttons
|
||||
$cal_text = $e107->tp->parseTemplate($CALENDAR_TIME_TABLE, FALSE, $calSc);
|
||||
$cal_text = $tp->parseTemplate($CALENDAR_TIME_TABLE, FALSE, $calSc);
|
||||
|
||||
// navigation buttons
|
||||
$nav_text = $e107->tp->parseTemplate($CALENDAR_NAVIGATION_TABLE, FALSE, $calSc);
|
||||
$nav_text = $tp->parseTemplate($CALENDAR_NAVIGATION_TABLE, FALSE, $calSc);
|
||||
|
||||
// We'll need virtually all of the event-related fields, so get them regardless. Just cut back on category fields
|
||||
$ev_list = $ecal_class->get_events($monthstart, $monthend, FALSE, $cat_filter, TRUE, '*', 'event_cat_name,event_cat_icon');
|
||||
@ -128,7 +126,7 @@ $events = array();
|
||||
foreach ($ev_list as $row)
|
||||
{
|
||||
$row['startofevent'] = TRUE; // This sets 'large print' and so on for the first day of an event
|
||||
|
||||
|
||||
// check for recurring events in this month (could also use is_array($row['event_start']) as a test)
|
||||
if($row['event_recurring'] != '0')
|
||||
{ // There could be several dates for the same event, if its a daily/weekly event
|
||||
@ -136,43 +134,43 @@ foreach ($ev_list as $row)
|
||||
foreach ($t_start as $ev_start)
|
||||
{
|
||||
// Need to save event, copy marker for date
|
||||
$row['event_start'] = $ev_start;
|
||||
$events[gmdate('j',$ev_start)][] = $row;
|
||||
$row['event_start'] = $ev_start;
|
||||
$events[gmdate('j',$ev_start)][] = $row;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Its a 'normal' event
|
||||
$tmp = gmdate('j',$row['event_start']); // Day of month for start
|
||||
if ($row['event_allday'])
|
||||
{
|
||||
$tmp2 = $tmp; // Same day for start and end
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmp2 = gmdate('j',$row['event_end']-1); // Day of month for end - knock off a second to allow for BST and suchlike
|
||||
if ($row['event_allday'])
|
||||
{
|
||||
$tmp2 = $tmp; // Same day for start and end
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmp2 = gmdate('j',$row['event_end']-1); // Day of month for end - knock off a second to allow for BST and suchlike
|
||||
}
|
||||
if(($row['event_start']>=$monthstart) && ($row['event_start']<=$monthend))
|
||||
{ // Start within month
|
||||
$events[$tmp][] = $row;
|
||||
$tmp++;
|
||||
if ($row['event_end']>$monthend)
|
||||
{ // End outside month
|
||||
$tmp2 = gmdate("t", $monthstart); // number of days in this month
|
||||
}
|
||||
$events[$tmp][] = $row;
|
||||
$tmp++;
|
||||
if ($row['event_end']>$monthend)
|
||||
{ // End outside month
|
||||
$tmp2 = gmdate("t", $monthstart); // number of days in this month
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Start before month
|
||||
$tmp = 1;
|
||||
if ($row['event_end']>$monthend)
|
||||
{ // End outside month
|
||||
$tmp2 = gmdate("t", $monthstart); // number of days in this month
|
||||
}
|
||||
$tmp = 1;
|
||||
if ($row['event_end']>$monthend)
|
||||
{ // End outside month
|
||||
$tmp2 = gmdate("t", $monthstart); // number of days in this month
|
||||
}
|
||||
}
|
||||
// Now put in markers for all 'non-start' days within current month
|
||||
$row['startofevent'] = FALSE;
|
||||
for ($c= $tmp; $c<=$tmp2; $c++)
|
||||
{
|
||||
$events[$c][] = $row;
|
||||
$events[$c][] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -182,28 +180,28 @@ foreach ($ev_list as $row)
|
||||
// ****** CAUTION - the category dropdown also used $sql object - take care to avoid interference!
|
||||
|
||||
$start = $monthstart;
|
||||
$numberdays = gmdate("t", $start); // number of days in this month
|
||||
$numberdays = gmdate("t", $start); // number of days in this month
|
||||
|
||||
$text = "";
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_START, FALSE, $calSc);
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_HEADER_START, FALSE, $calSc);
|
||||
$text .= $tp->parseTemplate($CALENDAR_CALENDAR_START, FALSE, $calSc);
|
||||
$text .= $tp->parseTemplate($CALENDAR_CALENDAR_HEADER_START, FALSE, $calSc);
|
||||
|
||||
// Display the column headers
|
||||
for ($i = 0; $i < 7; $i++)
|
||||
{
|
||||
$calSc->headerDay = $ecal_class->day_offset_string($i);
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_HEADER, FALSE, $calSc);
|
||||
$text .= $tp->parseTemplate($CALENDAR_CALENDAR_HEADER, FALSE, $calSc);
|
||||
}
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_HEADER_END, FALSE, $calSc);
|
||||
$text .= $tp->parseTemplate($CALENDAR_CALENDAR_HEADER_END, FALSE, $calSc);
|
||||
|
||||
|
||||
// Calculate number of days to skip before 'real' days on first line of calendar
|
||||
$firstdayoffset = gmdate('w',$start) - $ecal_class->ec_first_day_of_week;
|
||||
$firstdayoffset = gmdate('w',$start) - $ecal_class->ec_first_day_of_week;
|
||||
if ($firstdayoffset < 0) $firstdayoffset+= 7;
|
||||
|
||||
for ($i=0; $i<$firstdayoffset; $i++)
|
||||
{
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_NON, FALSE, $calSc);
|
||||
$text .= $tp->parseTemplate($CALENDAR_CALENDAR_DAY_NON, FALSE, $calSc);
|
||||
}
|
||||
|
||||
$loop = $firstdayoffset;
|
||||
@ -218,15 +216,15 @@ for ($c = 1; $c <= $numberdays; $c++)
|
||||
// Highlight the current day.
|
||||
if ($nowday == $c && $month == $nowmonth && $year == $nowyear)
|
||||
{ //today
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_TODAY, FALSE, $calSc);
|
||||
$text .= $tp->parseTemplate($CALENDAR_CALENDAR_DAY_TODAY, FALSE, $calSc);
|
||||
}
|
||||
elseif ($got_ev)
|
||||
{ //day has events
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_EVENT, FALSE, $calSc);
|
||||
$text .= $tp->parseTemplate($CALENDAR_CALENDAR_DAY_EVENT, FALSE, $calSc);
|
||||
}
|
||||
else
|
||||
{ // no events and not today
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_EMPTY, FALSE, $calSc);
|
||||
$text .= $tp->parseTemplate($CALENDAR_CALENDAR_DAY_EMPTY, FALSE, $calSc);
|
||||
}
|
||||
if ($got_ev)
|
||||
{
|
||||
@ -246,10 +244,10 @@ for ($c = 1; $c <= $numberdays; $c++)
|
||||
}
|
||||
//setScVar('event_calendar_shortcodes', 'event', $ev); // Give shortcodes the event data
|
||||
$calSc->event = $ev;
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_SHOWEVENT, FALSE, $calSc);
|
||||
$text .= $tp->parseTemplate($CALENDAR_SHOWEVENT, FALSE, $calSc);
|
||||
}
|
||||
}
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_END, FALSE, $calSc);
|
||||
$text .= $tp->parseTemplate($CALENDAR_CALENDAR_DAY_END, FALSE, $calSc);
|
||||
|
||||
$loop++;
|
||||
if ($loop == 7)
|
||||
@ -257,7 +255,7 @@ for ($c = 1; $c <= $numberdays; $c++)
|
||||
$loop = 0;
|
||||
if($c != $numberdays)
|
||||
{
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_WEEKSWITCH, FALSE, $calSc);
|
||||
$text .= $tp->parseTemplate($CALENDAR_CALENDAR_WEEKSWITCH, FALSE, $calSc);
|
||||
}
|
||||
}
|
||||
$start += 86400;
|
||||
@ -268,12 +266,12 @@ if($loop!=0)
|
||||
{
|
||||
for ($c=$loop; $c<7; $c++)
|
||||
{
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_NON, FALSE, $calSc);
|
||||
$text .= $tp->parseTemplate($CALENDAR_CALENDAR_DAY_NON, FALSE, $calSc);
|
||||
}
|
||||
}
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_END, FALSE, $calSc);
|
||||
$text .= $tp->parseTemplate($CALENDAR_CALENDAR_END, FALSE, $calSc);
|
||||
|
||||
$e107->ns->tablerender(EC_LAN_79, $cal_text . $nav_text . $text);
|
||||
$ns->tablerender(EC_LAN_79, $cal_text . $nav_text . $text);
|
||||
|
||||
// Claim back memory from key variables
|
||||
unset($ev_list);
|
||||
|
@ -8,9 +8,6 @@
|
||||
*
|
||||
* Event calendar plugin - calendar menu display
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -20,12 +17,13 @@
|
||||
*
|
||||
* @package e107_plugins
|
||||
* @subpackage event_calendar
|
||||
* @version $Id$;
|
||||
*/
|
||||
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
$e107 = e107::getInstance();
|
||||
$tp = e107::getParser();
|
||||
|
||||
if (!$e107->isInstalled('calendar_menu')) return '';
|
||||
|
||||
if (!isset($ecal_class))
|
||||
@ -133,7 +131,7 @@ for ($i = 0; $i < 7; $i++)
|
||||
{
|
||||
$cal_day = $ecal_class->day_offset_string($i);
|
||||
$cal_text .= $CALENDAR_MENU_HEADER_FRONT;
|
||||
$cal_text .= $e107->tp->text_truncate($cal_day, 1, ''); // Unlikely to have room for more than 1 letter
|
||||
$cal_text .= $tp->text_truncate($cal_day, 1, ''); // Unlikely to have room for more than 1 letter
|
||||
$cal_text .= $CALENDAR_MENU_HEADER_BACK;
|
||||
}
|
||||
$cal_text .= $CALENDAR_MENU_HEADER_END; // Close off header row, open first date row
|
||||
|
@ -7,11 +7,6 @@
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* RSS news feed shim
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/e_rss.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -21,7 +16,6 @@
|
||||
*
|
||||
* @package e107_plugins
|
||||
* @subpackage event_calendar
|
||||
* @version $Id$;
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@ -31,7 +25,6 @@ if (!e107::isInstalled('calendar_menu')) return;
|
||||
include_lan(e_PLUGIN.'calendar_menu/languages/'.e_LANGUAGE.'_admin_calendar_menu.php'); // RSS messages are in admin language file
|
||||
|
||||
|
||||
|
||||
//##### create feed for admin, return array $eplug_rss_feed --------------------------------
|
||||
$feed['name'] = EC_ADLAN_A12;
|
||||
$feed['url'] = 'calendar'; //the identifier for the rss feed url
|
||||
|
@ -8,10 +8,6 @@
|
||||
*
|
||||
* Event calendar - generate lists
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/ec_pf_page.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -21,7 +17,6 @@
|
||||
*
|
||||
* @package e107_plugins
|
||||
* @subpackage event_calendar
|
||||
* @version $Id$;
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -44,6 +39,8 @@ if (!defined('e_SINGLE_ENTRY'))
|
||||
require_once('../../class2.php');
|
||||
}
|
||||
$e107 = e107::getInstance();
|
||||
$tp = e107::getParser();
|
||||
|
||||
if (!$e107->isInstalled('calendar_menu')) header('Location: '.e_BASE.'index.php');
|
||||
include_lan(e_PLUGIN.'calendar_menu/languages/'.e_LANGUAGE.'.php');
|
||||
define('PAGE_NAME', EC_LAN_80);
|
||||
@ -130,7 +127,7 @@ if (!isset($ec_qs[0]) || !isset($ec_qs[1]))
|
||||
</tr><tr>
|
||||
<td class='forumheader3'>".EC_LAN_155."</td>
|
||||
<td class='forumheader3' style='text_align:center'>";
|
||||
$cal_text .= $e107->tp->parseTemplate('{EC_NAV_CATEGORIES=nosubmit}', FALSE, $calSc);
|
||||
$cal_text .= $tp->parseTemplate('{EC_NAV_CATEGORIES=nosubmit}', FALSE, $calSc);
|
||||
$cal_text .= "</td>
|
||||
</tr>";
|
||||
if (isset($EVENT_CAL_PDF_NAMES) && is_array($EVENT_CAL_PDF_NAMES) && (count($EVENT_CAL_PDF_NAMES) > 1))
|
||||
@ -290,7 +287,7 @@ if ($cal_totev > 0)
|
||||
// If printing, wrap in a form so the button works
|
||||
if ($ec_output_type == 'print') $cal_text .= "<form action=''>\n";
|
||||
// Add header
|
||||
$cal_text .= $e107->tp->parseTemplate($EVENT_CAL_PDF_HEADER[$ec_pdf_template], FALSE, $calSc);
|
||||
$cal_text .= $tp->parseTemplate($EVENT_CAL_PDF_HEADER[$ec_pdf_template], FALSE, $calSc);
|
||||
// Debug code
|
||||
// echo "Start date: ".strftime("%d-%m-%Y %H:%M:%S",$ec_start_date)."<br />";
|
||||
// echo "End date: ".strftime("%d-%m-%Y %H:%M:%S",$ec_end_date)."<br />";
|
||||
@ -315,7 +312,7 @@ if ($cal_totev > 0)
|
||||
$calSc->numEvents = $cal_totev; // Number of events to display
|
||||
$calSc->event = $thisevent; // Give shortcodes the event data
|
||||
$calSc->changeFlags = array('yc' => $ec_year_change, 'mc' => $ec_month_change, 'dc' => $ec_day_change); // Give shortcodes the event data
|
||||
$cal_text .= $e107->tp->parseTemplate($EVENT_CAL_PDF_BODY[$ec_pdf_template], FALSE, $calSc);
|
||||
$cal_text .= $tp->parseTemplate($EVENT_CAL_PDF_BODY[$ec_pdf_template], FALSE, $calSc);
|
||||
|
||||
$ec_last_year = $thisevent_start_date['year'];
|
||||
$ec_last_month = $thisevent_start_date['mon'];
|
||||
@ -323,7 +320,7 @@ if ($cal_totev > 0)
|
||||
}
|
||||
|
||||
// Add footer
|
||||
$cal_text .= $e107->tp->parseTemplate($EVENT_CAL_PDF_FOOTER[$ec_pdf_template], FALSE, $calSc);
|
||||
$cal_text .= $tp->parseTemplate($EVENT_CAL_PDF_FOOTER[$ec_pdf_template], FALSE, $calSc);
|
||||
if ($ec_output_type == 'print') $cal_text .= "</form>\n";
|
||||
}
|
||||
else
|
||||
@ -334,7 +331,7 @@ else
|
||||
switch($ec_output_type)
|
||||
{
|
||||
case 'display':
|
||||
$e107->ns->tablerender(EC_LAN_80, $cal_text, 'ec_pf_page');
|
||||
$ns->tablerender(EC_LAN_80, $cal_text, 'ec_pf_page');
|
||||
require_once (FOOTERF);
|
||||
break;
|
||||
|
||||
|
@ -8,10 +8,6 @@
|
||||
*
|
||||
* Calender plugin - event listing and event entry
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/event.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -21,7 +17,6 @@
|
||||
*
|
||||
* @package e107_plugins
|
||||
* @subpackage event_calendar
|
||||
* @version $Id$;
|
||||
*/
|
||||
|
||||
if (!defined('e_SINGLE_ENTRY'))
|
||||
@ -30,6 +25,7 @@ if (!defined('e_SINGLE_ENTRY'))
|
||||
}
|
||||
$e107 = e107::getInstance();
|
||||
$frm = e107::getForm();
|
||||
$tp = e107::getParser();
|
||||
|
||||
if (!$e107->isInstalled('calendar_menu'))
|
||||
{
|
||||
@ -130,11 +126,11 @@ if ((isset($_POST['ne_insert']) || isset($_POST['ne_update'])) && ($cal_super |
|
||||
}
|
||||
|
||||
$ev_end = $ecal_class->make_date($_POST['end_hour'], $_POST['end_minute'],$_POST['end_date']);
|
||||
$ev_title = $e107->tp->toDB($_POST['ne_title']);
|
||||
$ev_location = $e107->tp->toDB($_POST['ne_location']);
|
||||
$ev_event = $e107->tp->toDB($_POST['ne_event']);
|
||||
$ev_email = $e107->tp -> toDB($_POST['ne_email']);
|
||||
$ev_thread = $e107->tp->toDB($_POST['ne_thread']);
|
||||
$ev_title = $tp->toDB($_POST['ne_title']);
|
||||
$ev_location = $tp->toDB($_POST['ne_location']);
|
||||
$ev_event = $tp->toDB($_POST['ne_event']);
|
||||
$ev_email = $tp >toDB($_POST['ne_email']);
|
||||
$ev_thread = $tp->toDB($_POST['ne_thread']);
|
||||
$temp_date = $ecal_class->gmgetdate($ecal_class->make_date(0,0,$_POST['start_date']));
|
||||
$ev_allday = intval($_POST['allday']);
|
||||
$recurring = intval($_POST['ec_recur_type']);
|
||||
@ -301,7 +297,7 @@ if ($cal_super || check_class($ecal_class->pref['eventpost_admin']))
|
||||
$wr_record = array();
|
||||
foreach ($ev_fields as $k => $v)
|
||||
{
|
||||
$wr_record[$k] = $e107->tp->toDB($_POST['ev_'.$k]);
|
||||
$wr_record[$k] = $tp->toDB($_POST['ev_'.$k]);
|
||||
}
|
||||
$wr_record['event_author'] = USERID.".".USERNAME;
|
||||
$wr_record['event_datestamp'] = time();
|
||||
@ -712,10 +708,10 @@ $nowyear = $ecal_class->cal_date['year'];
|
||||
|
||||
$text2 = "";
|
||||
// time switch buttons
|
||||
$text2 .= $e107->tp->parseTemplate($CALENDAR_TIME_TABLE, FALSE, $calSc);
|
||||
$text2 .= $tp->parseTemplate($CALENDAR_TIME_TABLE, FALSE, $calSc);
|
||||
|
||||
// navigation buttons
|
||||
$text2 .= $e107->tp->parseTemplate($CALENDAR_NAVIGATION_TABLE, FALSE, $calSc);
|
||||
$text2 .= $tp->parseTemplate($CALENDAR_NAVIGATION_TABLE, FALSE, $calSc);
|
||||
|
||||
|
||||
// ****** CAUTION - the category dropdown also used $sql object - take care to avoid interference!
|
||||
@ -751,9 +747,9 @@ if ($ds == 'event')
|
||||
}
|
||||
$next10_start = $thisEvent['event_start'] +1;
|
||||
$calSc->event = $thisEvent; // Give shortcodes the event data
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_EVENT_TABLE_START, FALSE, $calSc);
|
||||
if ($ec_err) $text2.= "Software Error<br />"; else $text2 .= $e107->tp->parseTemplate($EVENT_EVENT_TABLE, FALSE, $calSc);
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_EVENT_TABLE_END, FALSE, $calSc);
|
||||
$text2 .= $tp->parseTemplate($EVENT_EVENT_TABLE_START, FALSE, $calSc);
|
||||
if ($ec_err) $text2.= "Software Error<br />"; else $text2 .= $tp->parseTemplate($EVENT_EVENT_TABLE, FALSE, $calSc);
|
||||
$text2 .= $tp->parseTemplate($EVENT_EVENT_TABLE_END, FALSE, $calSc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -801,14 +797,14 @@ else
|
||||
// display event list for current month
|
||||
if(count($tim_arr))
|
||||
{
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_EVENTLIST_TABLE_START, FALSE, $calSc);
|
||||
$text2 .= $tp->parseTemplate($EVENT_EVENTLIST_TABLE_START, FALSE, $calSc);
|
||||
foreach ($tim_arr as $tim => $ptr)
|
||||
{
|
||||
$ev_list[$ptr]['event_start'] = $tim;
|
||||
$calSc->event = $ev_list[$ptr]; // Give shortcodes the event data
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_EVENT_TABLE, FALSE, $calSc);
|
||||
$text2 .= $tp->parseTemplate($EVENT_EVENT_TABLE, FALSE, $calSc);
|
||||
}
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_EVENTLIST_TABLE_END, FALSE, $calSc);
|
||||
$text2 .= $tp->parseTemplate($EVENT_EVENTLIST_TABLE_END, FALSE, $calSc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -827,20 +823,20 @@ if ($num != 0)
|
||||
foreach ($ev_list as $thisEvent)
|
||||
{
|
||||
$calSc->event = $thisEvent; // Give shortcodes the event data
|
||||
$archive_events .= $e107->tp->parseTemplate($EVENT_ARCHIVE_TABLE, FALSE, $calSc);
|
||||
$archive_events .= $tp->parseTemplate($EVENT_ARCHIVE_TABLE, FALSE, $calSc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$archive_events = $e107->tp->parseTemplate($EVENT_ARCHIVE_TABLE_EMPTY, FALSE, $calSc);
|
||||
$archive_events = $tp->parseTemplate($EVENT_ARCHIVE_TABLE_EMPTY, FALSE, $calSc);
|
||||
}
|
||||
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_ARCHIVE_TABLE_START, FALSE, $calSc);
|
||||
$text2 .= $tp->parseTemplate($EVENT_ARCHIVE_TABLE_START, FALSE, $calSc);
|
||||
$text2 .= $archive_events;
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_ARCHIVE_TABLE_END, FALSE, $calSc);
|
||||
$text2 .= $tp->parseTemplate($EVENT_ARCHIVE_TABLE_END, FALSE, $calSc);
|
||||
|
||||
|
||||
$e107->ns->tablerender($e107->tp->ParseTemplate('{EC_EVENT_PAGE_TITLE}', FALSE, $calSc), $text2);
|
||||
$ns->tablerender($tp->ParseTemplate('{EC_EVENT_PAGE_TITLE}', FALSE, $calSc), $text2);
|
||||
|
||||
// Claim back memory no longer required
|
||||
unset($ev_list);
|
||||
|
@ -96,7 +96,7 @@ else
|
||||
$cal_text.= EC_LAN_141;
|
||||
}
|
||||
|
||||
$calendar_title = $e107->tp->toHTML($menu_title,FALSE,'TITLE'); // Allows multi-language title, shortcodes
|
||||
$calendar_title = e107::getParser()->toHTML($menu_title,FALSE,'TITLE'); // Allows multi-language title, shortcodes
|
||||
if ($link_in_heading == 1)
|
||||
{
|
||||
$calendar_title = "<a class='forumlink' href='".e_PLUGIN_ABS."calendar_menu/event.php' >".$calendar_title."</a>";
|
||||
@ -104,7 +104,7 @@ if ($link_in_heading == 1)
|
||||
|
||||
// Now handle the data, cache as well
|
||||
ob_start(); // Set up a new output buffer
|
||||
$e107->ns->tablerender($calendar_title, $cal_text, 'next_event_menu');
|
||||
e107::getRender()->tablerender($calendar_title, $cal_text, 'next_event_menu');
|
||||
$cache_data = ob_get_flush(); // Get the page content, and display it
|
||||
$e107->ecache->set($cache_tag, $cache_data); // Save to cache
|
||||
|
||||
|
@ -8,10 +8,6 @@
|
||||
*
|
||||
* Event calendar plugin - mail subscription to events notification
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/subscribe.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -21,7 +17,6 @@
|
||||
*
|
||||
* @package e107_plugins
|
||||
* @subpackage event_calendar
|
||||
* @version $Id$;
|
||||
*/
|
||||
|
||||
if (!defined('e_SINGLE_ENTRY'))
|
||||
@ -51,8 +46,8 @@ if ((USER) && (isset($ecal_class->pref['eventpost_asubs']) && ($ecal_class->pref
|
||||
|
||||
if (isset($_POST['upsubs']))
|
||||
{
|
||||
$cal_cats = $e107->tp->toDB($_POST['event_list']); // IDs of allowed categories
|
||||
$cal_subs = $e107->tp->toDB($_POST['event_subd']); // Checkbox results
|
||||
$cal_cats = e107::getParser()->toDB($_POST['event_list']); // IDs of allowed categories
|
||||
$cal_subs = e107::getParser()->toDB($_POST['event_subd']); // Checkbox results
|
||||
$cal_db->db_Delete('event_subs', "event_userid='" . USERID . "'"); // Delete all for this user to start
|
||||
foreach($cal_cats as $cal_row)
|
||||
{ // Now add in a subscription for each allowed category
|
||||
@ -120,7 +115,7 @@ else
|
||||
else
|
||||
$caltext = EC_LAN_143; // No facility
|
||||
}
|
||||
$e107->ns->tablerender(EC_LAN_124, $caltext);
|
||||
e107::getRender()->tablerender(EC_LAN_124, $caltext);
|
||||
require_once(FOOTERF);
|
||||
|
||||
?>
|
@ -2,21 +2,20 @@
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2011 e107 Inc (e107.org)
|
||||
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* Forum main page
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
if(!defined('e107_INIT'))
|
||||
{
|
||||
require_once('../../class2.php');
|
||||
}
|
||||
$e107 = e107::getInstance();
|
||||
$tp = e107::getParser();
|
||||
|
||||
if (!$e107->isInstalled('forum'))
|
||||
{
|
||||
// FIXME GLOBAL - get rid of all e_BASE|e_HTTP|Whatever/index.php - just point to SITEURL
|
||||
@ -87,15 +86,15 @@ if($rules_text != '')
|
||||
{
|
||||
$fVars->USERINFO .= " | <a href='".$e107->url->create('forum/forum/rules')."'>".LAN_433.'</a>';
|
||||
}
|
||||
$total_topics = $sql->db_Count("forum_thread", "(*)");
|
||||
$total_replies = $sql->db_Count("forum_post", "(*)");
|
||||
$total_members = $sql->db_Count("user");
|
||||
$newest_member = $sql->db_Select("user", "*", "user_ban='0' ORDER BY user_join DESC LIMIT 0,1");
|
||||
$total_topics = $sql->count("forum_thread", "(*)");
|
||||
$total_replies = $sql->count("forum_post", "(*)");
|
||||
$total_members = $sql->count("user");
|
||||
$newest_member = $sql->select("user", "*", "user_ban='0' ORDER BY user_join DESC LIMIT 0,1");
|
||||
list($nuser_id, $nuser_name) = $sql->db_Fetch();
|
||||
if(!defined('e_TRACKING_DISABLED'))
|
||||
{
|
||||
$member_users = $sql->db_Select("online", "*", "online_location REGEXP('forum.php') AND online_user_id!='0' ");
|
||||
$guest_users = $sql->db_Select("online", "*", "online_location REGEXP('forum.php') AND online_user_id='0' ");
|
||||
$member_users = $sql->select("online", "*", "online_location REGEXP('forum.php') AND online_user_id!='0' ");
|
||||
$guest_users = $sql->select("online", "*", "online_location REGEXP('forum.php') AND online_user_id='0' ");
|
||||
$users = $member_users+$guest_users;
|
||||
$fVars->USERLIST = LAN_426;
|
||||
global $listuserson;
|
||||
@ -137,7 +136,7 @@ $fVars->PERMS = (USER == TRUE || ANON == TRUE ? LAN_204." - ".LAN_206." - ".LAN_
|
||||
$fVars->INFO = "";
|
||||
if (USER == TRUE)
|
||||
{
|
||||
$total_new_threads = $sql->db_Count('forum_thread', '(*)', "WHERE thread_datestamp>'".USERLV."' ");
|
||||
$total_new_threads = $sql->count('forum_thread', '(*)', "WHERE thread_datestamp>'".USERLV."' ");
|
||||
if (USERVIEWED != "")
|
||||
{
|
||||
$tmp = explode(".", USERVIEWED); // List of numbers, separated by single period
|
||||
@ -305,6 +304,7 @@ function parse_forum($f, $restricted_string = '')
|
||||
global $FORUM_MAIN_FORUM, $gen, $forum, $newflag_list, $forumList;
|
||||
$fVars = new e_vars;
|
||||
$e107 = e107::getInstance();
|
||||
$tp = e107::getParser();
|
||||
|
||||
if(USER && is_array($newflag_list) && in_array($f['forum_id'], $newflag_list))
|
||||
{
|
||||
@ -320,8 +320,8 @@ function parse_forum($f, $restricted_string = '')
|
||||
{
|
||||
$f['forum_name'] = substr($f['forum_name'], 1);
|
||||
}
|
||||
$f['forum_name'] = $e107->tp->toHTML($f['forum_name'], true, 'no_hook');
|
||||
$f['forum_description'] = $e107->tp->toHTML($f['forum_description'], true, 'no_hook');
|
||||
$f['forum_name'] = $tp->toHTML($f['forum_name'], true, 'no_hook');
|
||||
$f['forum_description'] = $tp->toHTML($f['forum_description'], true, 'no_hook');
|
||||
|
||||
$fVars->FORUMNAME = "<a href='".$e107->url->create('forum/forum/view', $f)."'>{$f['forum_name']}</a>";
|
||||
$fVars->FORUMDESCRIPTION = $f['forum_description'].($restricted_string ? "<br /><span class='smalltext'><i>$restricted_string</i></span>" : "");
|
||||
@ -364,7 +364,7 @@ function parse_forum($f, $restricted_string = '')
|
||||
}
|
||||
else
|
||||
{
|
||||
$lastpost_name = $e107->tp->toHTML($f['forum_lastpost_user_anon']);
|
||||
$lastpost_name = $tp->toHTML($f['forum_lastpost_user_anon']);
|
||||
}
|
||||
$fVars->LASTPOSTUSER = $lastpost_name;
|
||||
$fVars->LASTPOSTDATE .= $gen->computeLapse($lastpost_datestamp, time(), false, false, 'short');
|
||||
@ -378,19 +378,20 @@ function parse_forum($f, $restricted_string = '')
|
||||
$fVars->LASTPOSTDATE = "-";
|
||||
$fVars->LASTPOST = '-';
|
||||
}
|
||||
return $e107->tp->simpleParse($FORUM_MAIN_FORUM, $fVars);
|
||||
return $tp->simpleParse($FORUM_MAIN_FORUM, $fVars);
|
||||
}
|
||||
|
||||
function parse_subs($subList, $lastpost_datestamp)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$tp = e107::getParser();
|
||||
$ret = array();
|
||||
$ret['text'] = '';
|
||||
foreach($subList as $sub)
|
||||
{
|
||||
$ret['text'] .= ($ret['text'] ? ', ' : '');
|
||||
$suburl = $e107->url->create('forum/forum/view', $sub);
|
||||
$ret['text'] .= "<a href='{$suburl}'>".$e107->tp->toHTML($sub['forum_name']).'</a>';
|
||||
$ret['text'] .= "<a href='{$suburl}'>".$tp->toHTML($sub['forum_name']).'</a>';
|
||||
$ret['threads'] += $sub['forum_threads'];
|
||||
$ret['replies'] += $sub['forum_replies'];
|
||||
$tmp = explode('.', $sub['forum_lastpost_info']);
|
||||
@ -429,13 +430,13 @@ if (e_QUERY == 'track')
|
||||
}
|
||||
|
||||
$url = $e107->url->create('forum/thread/view', $row); // configs will be able to map thread_* vars to the url
|
||||
$trackVars->TRACKPOSTNAME = "<a href='{$url}'>".$e107->tp->toHTML($row['thread_name']).'</a>';
|
||||
$trackVars->TRACKPOSTNAME = "<a href='{$url}'>".$tp->toHTML($row['thread_name']).'</a>';
|
||||
$trackVars->UNTRACK = "<a href='".e_SELF."?untrack.".$row['thread_id']."'>".LAN_392."</a>";
|
||||
$forum_trackstring .= $e107->tp->simpleParse($FORUM_TRACK_MAIN, $trackVars);
|
||||
$forum_trackstring .= $tp->simpleParse($FORUM_TRACK_MAIN, $trackVars);
|
||||
}
|
||||
}
|
||||
$forum_track_start = $e107->tp->simpleParse($FORUM_TRACK_START, $trackVars);
|
||||
$forum_track_end = $e107->tp->simpleParse($FORUM_TRACK_END, $trackVars);
|
||||
$forum_track_start = $tp->simpleParse($FORUM_TRACK_START, $trackVars);
|
||||
$forum_track_end = $tp->simpleParse($FORUM_TRACK_END, $trackVars);
|
||||
if ($forum->prefs->get('enclose'))
|
||||
{
|
||||
$ns->tablerender($forum->prefs->get('title'), $forum_track_start.$forum_trackstring.$forum_track_end, array('forum', 'main1'));
|
||||
@ -464,19 +465,19 @@ if (e_QUERY == 'new')
|
||||
{
|
||||
$nVars->STARTERTITLE = "<a href='".$e107->url->create('user/profile/view', array('id' => $thread['thread_lastuser'], 'name' => $author_name))."'>{$author_name}</a><br />".$datestamp;
|
||||
}
|
||||
$nVars->NEWSPOSTNAME = "<a href='".$e107->url->create('forum/thread/last', $thread)."'>".$e107->tp->toHTML($thread['thread_name'], TRUE, 'no_make_clickable, no_hook').'</a>';
|
||||
$nVars->NEWSPOSTNAME = "<a href='".$e107->url->create('forum/thread/last', $thread)."'>".$tp->toHTML($thread['thread_name'], TRUE, 'no_make_clickable, no_hook').'</a>';
|
||||
|
||||
$forum_newstring .= $e107->tp->simpleParse($FORUM_NEWPOSTS_MAIN, $nVars);
|
||||
$forum_newstring .= $tp->simpleParse($FORUM_NEWPOSTS_MAIN, $nVars);
|
||||
}
|
||||
|
||||
if (!$newThreadList)
|
||||
{
|
||||
$nVars->NEWSPOSTNAME = LAN_198;
|
||||
$forum_newstring = $e107->tp->simpleParse($FORUM_NEWPOSTS_MAIN, $nVars);
|
||||
$forum_newstring = $tp->simpleParse($FORUM_NEWPOSTS_MAIN, $nVars);
|
||||
|
||||
}
|
||||
$forum_new_start = $e107->tp->simpleParse($FORUM_NEWPOSTS_START, $nVars);
|
||||
$forum_new_end = $e107->tp->simpleParse($FORUM_NEWPOSTS_END, $nVars);
|
||||
$forum_new_start = $tp->simpleParse($FORUM_NEWPOSTS_START, $nVars);
|
||||
$forum_new_end = $tp->simpleParse($FORUM_NEWPOSTS_END, $nVars);
|
||||
|
||||
if ($forum->prefs->get('enclose'))
|
||||
{
|
||||
@ -488,8 +489,8 @@ if (e_QUERY == 'new')
|
||||
}
|
||||
}
|
||||
|
||||
$forum_main_start = $e107->tp->simpleParse($FORUM_MAIN_START, $fVars);
|
||||
$forum_main_end = $e107->tp->simpleParse($FORUM_MAIN_END, $fVars);
|
||||
$forum_main_start = $tp->simpleParse($FORUM_MAIN_START, $fVars);
|
||||
$forum_main_end = $tp->simpleParse($FORUM_MAIN_END, $fVars);
|
||||
|
||||
if ($forum->prefs->get('enclose'))
|
||||
{
|
||||
@ -503,7 +504,6 @@ require_once(FOOTERF);
|
||||
|
||||
function forum_rules($action = 'check')
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
if (ADMIN == true)
|
||||
{
|
||||
$type = 'forum_rules_admin';
|
||||
@ -516,18 +516,19 @@ function forum_rules($action = 'check')
|
||||
{
|
||||
$type = 'forum_rules_guest';
|
||||
}
|
||||
$result = $e107->sql->db_Select('generic', 'gen_chardata', "gen_type = '$type' AND gen_intdata = 1");
|
||||
$result = e107::getDb()->select('generic', 'gen_chardata', "gen_type = '$type' AND gen_intdata = 1");
|
||||
if ($action == 'check') { return $result; }
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$row = $e107->sql->db_Fetch();
|
||||
$rules_text = $e107->tp->toHTML($row['gen_chardata'], true);
|
||||
$row = e107::getDb()->fetch();
|
||||
$rules_text = e107::getParser()->toHTML($row['gen_chardata'], true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$rules_text = FORLAN_441;
|
||||
}
|
||||
$e107->ns->tablerender(LAN_433, "<div style='text-align:center'>{$rules_text}</div>", array('forum', 'forum_rules'));
|
||||
e107::getRender()->tablerender(LAN_433, "<div style='text-align:center'>{$rules_text}</div>", array('forum', 'forum_rules'));
|
||||
}
|
||||
|
||||
?>
|
@ -27,10 +27,10 @@ require_once(e_PLUGIN.'forum/forum_class.php');
|
||||
require_once(e_PLUGIN.'forum/forum_admin_class.php');
|
||||
|
||||
$mes = e107::getMessage();
|
||||
//$rs = new form; // FIX TODO needs $frm
|
||||
$for = new e107forum;
|
||||
$forum = new forumAdmin;
|
||||
$sql = e107::getDb();
|
||||
$tp = e107::GetParser();
|
||||
|
||||
$fPref = e107::getPlugConfig('forum', '', false);
|
||||
|
||||
@ -59,7 +59,7 @@ if(isset($_POST['setMods']))
|
||||
{
|
||||
foreach($_POST['mods'] as $fid => $modid)
|
||||
{
|
||||
$sql->db_Update('forum',"forum_moderators = '{$modid}' WHERE forum_id = {$fid}");
|
||||
$sql->update('forum',"forum_moderators = '{$modid}' WHERE forum_id = {$fid}");
|
||||
}
|
||||
//$forum->show_message(FORLAN_144);
|
||||
$mes->addSuccess(FORLAN_144);
|
||||
@ -117,19 +117,19 @@ if(isset($_POST['create_sub']))
|
||||
{
|
||||
$fid = (int)($sub_action);
|
||||
$tmp = array();
|
||||
$tmp['forum_name'] = $e107->tp->toDB($_POST['subname_new']);
|
||||
$tmp['forum_description'] = $e107->tp->toDB($_POST['subdesc_new']);
|
||||
$tmp['forum_name'] = $tp->toDB($_POST['subname_new']);
|
||||
$tmp['forum_description'] = $tp->toDB($_POST['subdesc_new']);
|
||||
$tmp['forum_order'] = (int)$_POST['suborder_new'];
|
||||
|
||||
if($tmp['forum_name'] != '' && $sql->db_Select('forum', '*', "forum_id = {$fid}"))
|
||||
if($tmp['forum_name'] != '' && $sql->select('forum', '*', "forum_id = {$fid}"))
|
||||
{
|
||||
$row = $sql->db_Fetch();
|
||||
$row = $sql->fetch();
|
||||
$tmp['forum_parent'] = $row['forum_parent'];
|
||||
$tmp['forum_moderators'] = $row['forum_moderators'];
|
||||
$tmp['forum_class'] = $row['forum_class'];
|
||||
$tmp['forum_postclass'] = $row['forum_postclass'];
|
||||
$tmp['forum_sub'] = $fid;
|
||||
if($sql->db_Insert('forum', $tmp))
|
||||
if($sql->insert('forum', $tmp))
|
||||
{
|
||||
//$forum->show_message(FORLAN_150.' - '.LAN_CREATED);
|
||||
$mes->addSuccess(LAN_CREATED);
|
||||
@ -151,19 +151,19 @@ if(isset($_POST['update_subs']))
|
||||
{
|
||||
if($_POST['subname'][$id] == "")
|
||||
{
|
||||
if ($sql->db_Delete("forum", "forum_id='$id' "))
|
||||
if ($sql->delete("forum", "forum_id='$id' "))
|
||||
{
|
||||
$msg .= FORLAN_150." ". LAN_ID.":"." ".$id." ".LAN_DELETED."<br />";
|
||||
$cnt = $sql->db_Delete("forum_t", "thread_forum_id = {$id}");
|
||||
$cnt = $sql->delete("forum_t", "thread_forum_id = {$id}");
|
||||
$msg .= $cnt." ".FORLAN_152." ".LAN_DELETED."<br />";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$_name = $e107->tp->toDB($_POST['subname'][$id]);
|
||||
$_desc = $e107->tp->toDB($_POST['subdesc'][$id]);
|
||||
$_name = $tp->toDB($_POST['subname'][$id]);
|
||||
$_desc = $tp->toDB($_POST['subdesc'][$id]);
|
||||
$_order = (int)$_POST['suborder'][$id];
|
||||
if($sql->db_Update('forum', "forum_name='{$_name}', forum_description='{$_desc}', forum_order='{$_order}' WHERE forum_id = {$id}"))
|
||||
if($sql->update('forum', "forum_name='{$_name}', forum_description='{$_desc}', forum_order='{$_order}' WHERE forum_id = {$id}"))
|
||||
{
|
||||
$msg .= FORLAN_150 ." ". LAN_ID.":"." ".$id." ".LAN_UPDATED."<br />";
|
||||
}
|
||||
@ -171,7 +171,6 @@ if(isset($_POST['update_subs']))
|
||||
}
|
||||
if($msg)
|
||||
{
|
||||
//$forum->show_message($msg);
|
||||
$mes->addSuccess($msg);
|
||||
$ns->tablerender($caption, $mes->render() . $text);
|
||||
}
|
||||
@ -180,19 +179,17 @@ if(isset($_POST['update_subs']))
|
||||
if(isset($_POST['submit_parent']))
|
||||
{
|
||||
$tmp = array();
|
||||
$tmp['forum_name'] = $e107->tp->toDB($_POST['forum_name']);
|
||||
$tmp['forum_name'] = $tp->toDB($_POST['forum_name']);
|
||||
$tmp['forum_datestamp'] = time();
|
||||
$tmp['forum_class'] = (int)$_POST['forum_class'];
|
||||
$tmp['forum_postclass'] = (int)$_POST['forum_postclass'];
|
||||
$tmp['forum_threadclass'] = (int)$_POST['forum_threadclass'];
|
||||
if($sql->db_Insert('forum',$tmp))
|
||||
if($sql->insert('forum',$tmp))
|
||||
{
|
||||
//$forum->show_message(FORLAN_22.' - '.LAN_CREATED);
|
||||
$mes->addSuccess(LAN_CREATED);
|
||||
}
|
||||
else
|
||||
{
|
||||
//$forum->show_message(FORLAN_22.' - '.LAN_CREATED_FAILED);
|
||||
$mes->addError(LAN_CREATED_FAILED);
|
||||
}
|
||||
}
|
||||
@ -213,7 +210,7 @@ if(isset($_POST['update_parent']))
|
||||
$tmp['data']['forum_class'] = $_POST['forum_class'];
|
||||
$tmp['data']['forum_postclass'] = $_POST['forum_postclass'];
|
||||
$tmp['data']['forum_threadclass'] = $_POST['forum_threadclass'];
|
||||
$sql->db_Update('forum', $tmp);
|
||||
$sql->update('forum', $tmp);
|
||||
|
||||
$mes->addSuccess(LAN_UPDATED);
|
||||
$action = 'main';
|
||||
@ -225,14 +222,14 @@ if(isset($_POST['submit_forum']))
|
||||
{
|
||||
$tmp = array();
|
||||
$tmp['forum_moderators'] = (int)$_POST['forum_moderators'];
|
||||
$tmp['forum_name'] = $e107->tp->toDB($_POST['forum_name']);
|
||||
$tmp['forum_description'] = $e107->tp->toDB($_POST['forum_description']);
|
||||
$tmp['forum_name'] = $tp->toDB($_POST['forum_name']);
|
||||
$tmp['forum_description'] = $tp->toDB($_POST['forum_description']);
|
||||
$tmp['forum_datestamp'] = time();
|
||||
$tmp['forum_class'] = (int)$_POST['forum_class'];
|
||||
$tmp['forum_postclass'] = (int)$_POST['forum_postclass'];
|
||||
$tmp['forum_threadclass'] = (int)$_POST['forum_threadclass'];
|
||||
$tmp['forum_parent'] = (int)$_POST['forum_parent'];
|
||||
if($sql->db_Insert('forum', $tmp))
|
||||
if($sql->insert('forum', $tmp))
|
||||
{
|
||||
$mes->addSuccess(LAN_CREATED);
|
||||
}
|
||||
@ -256,8 +253,8 @@ if(isset($_POST['update_forum']))
|
||||
$tmp2['forum_threadclass'] = $tmp['forum_threadclass'];
|
||||
$tmp2['WHERE'] = 'forum_sub = '.(int)$id;
|
||||
|
||||
$sql->db_Update('forum', $tmp);
|
||||
$sql->db_Update('forum', $tmp2);
|
||||
$sql->update('forum', $tmp);
|
||||
$sql->update('forum', $tmp2);
|
||||
|
||||
$mes->addSuccess(LAN_UPDATED);
|
||||
$action = 'main';
|
||||
@ -270,7 +267,7 @@ if (isset($_POST['update_order']))
|
||||
while (list($key, $id) = each($_POST['forum_order']))
|
||||
{
|
||||
$tmp = explode('.', $id);
|
||||
$sql->db_Update('forum', "forum_order=".$tmp[1]." WHERE forum_id=".$tmp[0]);
|
||||
$sql->update('forum', "forum_order=".$tmp[1]." WHERE forum_id=".$tmp[0]);
|
||||
}
|
||||
$mes->addSuccess(LAN_UPDATED);
|
||||
}
|
||||
@ -316,27 +313,28 @@ $ns->tablerender($caption, $mes->render() . $text);
|
||||
|
||||
if (isset($_POST['frsubmit']))
|
||||
{
|
||||
$guestrules = $e107->tp->toDB($_POST['guestrules']);
|
||||
$memberrules = $e107->tp->toDB($_POST['memberrules']);
|
||||
$adminrules = $e107->tp->toDB($_POST['adminrules']);
|
||||
if(!$sql->db_Update("generic", "gen_chardata ='$guestrules', gen_intdata='".$_POST['guest_active']."' WHERE gen_type='forum_rules_guest' "))
|
||||
$guestrules = $tp->toDB($_POST['guestrules']);
|
||||
$memberrules = $tp->toDB($_POST['memberrules']);
|
||||
$adminrules = $tp->toDB($_POST['adminrules']);
|
||||
if(!$sql->update("generic", "gen_chardata ='$guestrules', gen_intdata='".$_POST['guest_active']."' WHERE gen_type='forum_rules_guest' "))
|
||||
{
|
||||
$sql->db_Insert("generic", "0, 'forum_rules_guest', '".time()."', 0, '', '".$_POST['guest_active']."', '$guestrules' ");
|
||||
$sql->insert("generic", "0, 'forum_rules_guest', '".time()."', 0, '', '".$_POST['guest_active']."', '$guestrules' ");
|
||||
}
|
||||
if(!$sql->db_Update("generic", "gen_chardata ='$memberrules', gen_intdata='".$_POST['member_active']."' WHERE gen_type='forum_rules_member' "))
|
||||
if(!$sql->update("generic", "gen_chardata ='$memberrules', gen_intdata='".$_POST['member_active']."' WHERE gen_type='forum_rules_member' "))
|
||||
{
|
||||
$sql->db_Insert("generic", "0, 'forum_rules_member', '".time()."', 0, '', '".$_POST['member_active']."', '$memberrules' ");
|
||||
$sql->insert("generic", "0, 'forum_rules_member', '".time()."', 0, '', '".$_POST['member_active']."', '$memberrules' ");
|
||||
}
|
||||
if(!$sql->db_Update("generic", "gen_chardata ='$adminrules', gen_intdata='".$_POST['admin_active']."' WHERE gen_type='forum_rules_admin' "))
|
||||
if(!$sql->update("generic", "gen_chardata ='$adminrules', gen_intdata='".$_POST['admin_active']."' WHERE gen_type='forum_rules_admin' "))
|
||||
{
|
||||
$sql->db_Insert("generic", "0, 'forum_rules_admin', '".time()."', 0, '', '".$_POST['admin_active']."', '$adminrules' ");
|
||||
$sql->insert("generic", "0, 'forum_rules_admin', '".time()."', 0, '', '".$_POST['admin_active']."', '$adminrules' ");
|
||||
}
|
||||
}
|
||||
|
||||
$ns->tablerender($caption, $mes->render() . $text);
|
||||
|
||||
if (vartrue($delete) == 'main') {
|
||||
if ($sql->db_Delete('forum', "forum_id='$del_id' ")) {
|
||||
if ($sql->delete('forum', "forum_id='$del_id' "))
|
||||
{
|
||||
$mes->addSuccess(LAN_DELETED);
|
||||
}
|
||||
else
|
||||
@ -349,7 +347,7 @@ $ns->tablerender($caption, $mes->render() . $text);
|
||||
|
||||
if (vartrue($action) == 'create')
|
||||
{
|
||||
if ($sql->db_Select('forum', '*', "forum_parent='0' "))
|
||||
if ($sql->select('forum', '*', "forum_parent='0' "))
|
||||
{
|
||||
$forum->create_forums($sub_action, $id);
|
||||
}
|
||||
@ -362,9 +360,9 @@ if (vartrue($action) == 'create')
|
||||
|
||||
if ($delete == 'cat')
|
||||
{
|
||||
if ($sql->db_Delete('forum', "forum_id='$del_id' "))
|
||||
if ($sql->delete('forum', "forum_id='$del_id' "))
|
||||
{
|
||||
$sql->db_Delete('forum', "forum_parent='$del_id' ");
|
||||
$sql->delete('forum', "forum_parent='$del_id' ");
|
||||
$mes->addSuccess(LAN_DELETED);
|
||||
$action = 'main';
|
||||
}
|
||||
@ -422,8 +420,7 @@ switch($action)
|
||||
|
||||
if ($delete == 'reported')
|
||||
{
|
||||
$sql->db_Delete("generic", "gen_id='$del_id' ");
|
||||
//$forum->show_message(FORLAN_118);
|
||||
$sql->delete("generic", "gen_id='$del_id' ");
|
||||
$mes->addSuccess(LAN_DELETED);
|
||||
}
|
||||
|
||||
@ -440,15 +437,17 @@ require_once(e_ADMIN.'footer.php');
|
||||
function headerjs()
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$tp = e107::getParser();
|
||||
|
||||
// These functions need to be removed and replaced with the generic jsconfirm() function.
|
||||
$headerjs = "<script type=\"text/javascript\">
|
||||
function confirm_(mode, forum_id, forum_name) {
|
||||
if (mode == 'sr') {
|
||||
return confirm(\"".$e107->tp->toJS(FORLAN_117)."\");
|
||||
return confirm(\"".$tp->toJS(FORLAN_117)."\");
|
||||
} else if(mode == 'parent') {
|
||||
return confirm(\"".$e107->tp->toJS(FORLAN_81)." [ID: \" + forum_name + \"]\");
|
||||
return confirm(\"".$tp->toJS(FORLAN_81)." [ID: \" + forum_name + \"]\");
|
||||
} else {
|
||||
return confirm(\"".$e107->tp->toJS(FORLAN_82)." [ID: \" + forum_name + \"]\");
|
||||
return confirm(\"".$tp->toJS(FORLAN_82)." [ID: \" + forum_name + \"]\");
|
||||
}
|
||||
}
|
||||
</script>";
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (c) 2008-2011 e107 Inc (e107.org)
|
||||
* Copyright (c) 2008-2013 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
@ -254,7 +254,7 @@ class e107forum
|
||||
break;
|
||||
|
||||
case 'lock':
|
||||
if(e107::getDB()->update('forum_thread', 'thread_active=0 WHERE thread_id='.$id))
|
||||
if(e107::getDb()->update('forum_thread', 'thread_active=0 WHERE thread_id='.$id))
|
||||
{
|
||||
$ret['msg'] = FORLAN_CLOSE;
|
||||
$ret['status'] = 'ok';
|
||||
@ -267,7 +267,7 @@ class e107forum
|
||||
break;
|
||||
|
||||
case 'unlock':
|
||||
if(e107::getDB()->update('forum_thread', 'thread_active=1 WHERE thread_id='.$id))
|
||||
if(e107::getDb()->update('forum_thread', 'thread_active=1 WHERE thread_id='.$id))
|
||||
{
|
||||
$ret['msg'] = FORLAN_OPEN;
|
||||
$ret['status'] = 'ok';
|
||||
@ -280,7 +280,7 @@ class e107forum
|
||||
break;
|
||||
|
||||
case 'stick':
|
||||
if(e107::getDB()->update('forum_thread', 'thread_sticky=1 WHERE thread_id='.$id))
|
||||
if(e107::getDb()->update('forum_thread', 'thread_sticky=1 WHERE thread_id='.$id))
|
||||
{
|
||||
$ret['msg'] = FORLAN_STICK;
|
||||
$ret['status'] = 'ok';
|
||||
@ -293,7 +293,7 @@ class e107forum
|
||||
break;
|
||||
|
||||
case 'unstick':
|
||||
if(e107::getDB()->update('forum_thread', 'thread_sticky=0 WHERE thread_id='.$id))
|
||||
if(e107::getDb()->update('forum_thread', 'thread_sticky=0 WHERE thread_id='.$id))
|
||||
{
|
||||
$ret['msg'] = FORLAN_UNSTICK;
|
||||
$ret['status'] = 'ok';
|
||||
@ -374,6 +374,7 @@ class e107forum
|
||||
private function _getForumPermList()
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
|
||||
$this->permList = array();
|
||||
$qryList = array();
|
||||
@ -401,10 +402,10 @@ class e107forum
|
||||
|
||||
foreach($qryList as $key => $qry)
|
||||
{
|
||||
if($e107->sql->gen($qry))
|
||||
if($sql->gen($qry))
|
||||
{
|
||||
$tmp = array();
|
||||
while($row = $e107->sql->fetch())
|
||||
while($row = $sql->fetch())
|
||||
{
|
||||
$tmp[$row['forum_id']] = 1;
|
||||
$tmp[$row['forum_parent']] = 1;
|
||||
@ -443,10 +444,12 @@ class e107forum
|
||||
function getTrackedThreadList($id, $retType = 'array')
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
|
||||
$id = (int)$id;
|
||||
if($e107->sql->db_Select('forum_track', 'track_thread', 'track_userid = '.$id))
|
||||
if($sql->select('forum_track', 'track_thread', 'track_userid = '.$id))
|
||||
{
|
||||
while($row = $e107->sql->fetch(MYSQL_ASSOC))
|
||||
while($row = $sql->fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$ret[] = $row['track_thread'];
|
||||
}
|
||||
@ -469,10 +472,11 @@ class e107forum
|
||||
$result = false;
|
||||
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
$info = array();
|
||||
// $info['_FIELD_TYPES'] = $this->fieldTypes['forum_post'];
|
||||
$info['data'] = $postInfo;
|
||||
$postId = $e107->sql->db_Insert('forum_post', $info);
|
||||
$postId = $sql->insert('forum_post', $info);
|
||||
$forumInfo = array();
|
||||
|
||||
if($postId && $updateThread)
|
||||
@ -501,7 +505,7 @@ class e107forum
|
||||
// $info['_FIELD_TYPES'] = $this->fieldTypes['forum_thread'];
|
||||
$info['_FIELD_TYPES']['thread_total_replies'] = 'cmd';
|
||||
|
||||
$result = $e107->sql->update('forum_thread', $info);
|
||||
$result = $sql->update('forum_thread', $info);
|
||||
|
||||
}
|
||||
|
||||
@ -534,7 +538,7 @@ class e107forum
|
||||
$info['data'] = $forumInfo;
|
||||
$info['data']['forum_lastpost_info'] = $postInfo['post_datestamp'].'.'.$postInfo['post_thread'];
|
||||
$info['WHERE'] = 'forum_id = '.$postInfo['post_forum'];
|
||||
$result = $e107->sql->update('forum', $info);
|
||||
$result = $sql->update('forum', $info);
|
||||
}
|
||||
|
||||
if($result && USER && $addUserPostCount)
|
||||
@ -544,7 +548,7 @@ class e107forum
|
||||
VALUES ('.USERID.', 1)
|
||||
ON DUPLICATE KEY UPDATE user_plugin_forum_posts = user_plugin_forum_posts + 1
|
||||
';
|
||||
$result = $e107->sql->gen($qry);
|
||||
$result = $sql->gen($qry);
|
||||
}
|
||||
return $postId;
|
||||
}
|
||||
@ -557,7 +561,7 @@ class e107forum
|
||||
$info = array();
|
||||
// $info['_FIELD_TYPES'] = $this->fieldTypes['forum_thread'];
|
||||
$info['data'] = $threadInfo;
|
||||
if($newThreadId = $e107->sql->db_Insert('forum_thread', $info))
|
||||
if($newThreadId = e107::getDb()->insert('forum_thread', $info))
|
||||
{
|
||||
$postInfo['post_thread'] = $newThreadId;
|
||||
$newPostId = $this->postAdd($postInfo, false);
|
||||
@ -608,36 +612,33 @@ class e107forum
|
||||
}
|
||||
|
||||
|
||||
|
||||
function threadUpdate($threadId, $threadInfo)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$info = array();
|
||||
$info['data'] = $threadInfo;
|
||||
// $info['_FIELD_TYPES'] = $this->fieldTypes['forum_thread'];
|
||||
$info['WHERE'] = 'thread_id = '.(int)$threadId;
|
||||
$e107->sql->update('forum_thread', $info);
|
||||
e107::getDb()->update('forum_thread', $info);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function postUpdate($postId, $postInfo)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$info = array();
|
||||
$info['data'] = $postInfo;
|
||||
// $info['_FIELD_TYPES'] = $this->fieldTypes['forum_post'];
|
||||
$info['WHERE'] = 'post_id = '.(int)$postId;
|
||||
$e107->sql->update('forum_post', $info);
|
||||
e107::getDb()->update('forum_post', $info);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function threadGet($id, $joinForum = true, $uid = USERID)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$id = (int)$id;
|
||||
$uid = (int)$uid;
|
||||
$sql = e107::getDb();
|
||||
|
||||
if($joinForum)
|
||||
{
|
||||
@ -661,9 +662,9 @@ class e107forum
|
||||
FROM `#forum_thread`
|
||||
WHERE thread_id = '.$id;
|
||||
}
|
||||
if($e107->sql->gen($qry))
|
||||
if($sql->gen($qry))
|
||||
{
|
||||
$tmp = $e107->sql->fetch(MYSQL_ASSOC);
|
||||
$tmp = $sql->fetch(MYSQL_ASSOC);
|
||||
if($tmp)
|
||||
{
|
||||
if(trim($tmp['thread_options']) != '')
|
||||
@ -677,12 +678,12 @@ class e107forum
|
||||
}
|
||||
|
||||
|
||||
|
||||
function postGet($id, $start, $num = NULL)
|
||||
{
|
||||
$id = (int)$id;
|
||||
$ret = false;
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
|
||||
if('post' === $start)
|
||||
{
|
||||
$qry = '
|
||||
@ -709,10 +710,10 @@ class e107forum
|
||||
LIMIT {$start}, {$num}
|
||||
";
|
||||
}
|
||||
if($e107->sql->gen($qry))
|
||||
if($sql->gen($qry))
|
||||
{
|
||||
$ret = array();
|
||||
while($row = $e107->sql->fetch(MYSQL_ASSOC))
|
||||
while($row = $sql->fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$ret[] = $row;
|
||||
}
|
||||
@ -722,21 +723,20 @@ class e107forum
|
||||
}
|
||||
|
||||
|
||||
|
||||
function threadGetUserPostcount($threadId)
|
||||
{
|
||||
$threadId = (int)$threadId;
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
$ret = false;
|
||||
$qry = "
|
||||
SELECT post_user, count(post_user) AS post_count FROM `#forum_post`
|
||||
WHERE post_thread = {$threadId} AND post_user IS NOT NULL
|
||||
GROUP BY post_user
|
||||
";
|
||||
if($e107->sql->gen($qry))
|
||||
if($sql->gen($qry))
|
||||
{
|
||||
$ret = array();
|
||||
while($row = $e107->sql->fetch(MYSQL_ASSOC))
|
||||
while($row = $sql->fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$ret[$row['post_user']] = $row['post_count'];
|
||||
}
|
||||
@ -745,7 +745,6 @@ class e107forum
|
||||
}
|
||||
|
||||
|
||||
|
||||
function threadGetUserViewed($uid = USERID)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
@ -763,20 +762,21 @@ class e107forum
|
||||
}
|
||||
|
||||
|
||||
|
||||
function postDeleteAttachments($type = 'post', $id='', $f='')
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$sql = $e107::getDb();
|
||||
|
||||
$id = (int)$id;
|
||||
if(!$id) { return; }
|
||||
if($type == 'thread')
|
||||
{
|
||||
if(!$e107->sql->db_Select('forum_post', 'post_id', 'post_attachments IS NOT NULL'))
|
||||
if(!$sql->select('forum_post', 'post_id', 'post_attachments IS NOT NULL'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
$postList = array();
|
||||
while($row = $e107->sql->dbFetch(MYSQL_ASSOC))
|
||||
while($row = $sql->Fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$postList[] = $row['post_id'];
|
||||
}
|
||||
@ -787,11 +787,11 @@ class e107forum
|
||||
}
|
||||
if($type == 'post')
|
||||
{
|
||||
if(!$e107->sql->db_Select('forum_post', 'post_attachments', 'post_id = '.$id))
|
||||
if(!$sql->select('forum_post', 'post_attachments', 'post_id = '.$id))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
$tmp = $e107->sql->fetch(MYSQL_ASSOC);
|
||||
$tmp = $sql->fetch(MYSQL_ASSOC);
|
||||
$attachments = explode(',', $tmp['post_attachments']);
|
||||
foreach($attachments as $k => $a)
|
||||
{
|
||||
@ -823,12 +823,11 @@ class e107forum
|
||||
$info['data'] = $tmp;
|
||||
$info['_FILE_TYPES']['post_attachments'] = 'escape';
|
||||
$info['WHERE'] = 'post_id = '.$id;
|
||||
$e107->sql->update('forum_post', $info);
|
||||
$sql->update('forum_post', $info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Given threadId and postId, determine which number of post in thread the postid is
|
||||
*
|
||||
@ -837,15 +836,15 @@ class e107forum
|
||||
{
|
||||
$threadId = (int)$threadId;
|
||||
$postId = (int)$postId;
|
||||
$e107 = e107::getInstance();
|
||||
return $e107->sql->db_Count('forum_post', '(*)', "WHERE post_id <= {$postId} AND post_thread = {$threadId} ORDER BY post_id ASC");
|
||||
return e107::getDb()->count('forum_post', '(*)', "WHERE post_id <= {$postId} AND post_thread = {$threadId} ORDER BY post_id ASC");
|
||||
}
|
||||
|
||||
|
||||
|
||||
function forumUpdateLastpost($type, $id, $updateThreads = false)
|
||||
{
|
||||
global $sql, $tp;
|
||||
$sql = e107::getDb();
|
||||
$tp = e107::getParser();
|
||||
|
||||
$sql2 = new db;
|
||||
if ($type == 'thread')
|
||||
{
|
||||
@ -875,7 +874,7 @@ class e107forum
|
||||
{
|
||||
if ($id == 'all')
|
||||
{
|
||||
if ($sql->db_Select('forum', 'forum_id', 'forum_parent != 0'))
|
||||
if ($sql->select('forum', 'forum_id', 'forum_parent != 0'))
|
||||
{
|
||||
while ($row = $sql->fetch(MYSQL_ASSOC))
|
||||
{
|
||||
@ -895,7 +894,7 @@ class e107forum
|
||||
$lp_user = 'NULL';
|
||||
if($updateThreads == true)
|
||||
{
|
||||
if ($sql2->db_Select('forum_t', 'thread_id', "thread_forum_id = $id AND thread_parent = 0"))
|
||||
if ($sql2->select('forum_t', 'thread_id', "thread_forum_id = $id AND thread_parent = 0"))
|
||||
{
|
||||
while ($row = $sql2->fetch(MYSQL_ASSOC))
|
||||
{
|
||||
@ -904,7 +903,7 @@ class e107forum
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($sql->db_Select('forum_thread', 'thread_id, thread_lastuser, thread_lastuser_anon, thread_datestamp', 'thread_forum_id='.$id.' ORDER BY thread_datestamp DESC LIMIT 1'))
|
||||
if ($sql->select('forum_thread', 'thread_id, thread_lastuser, thread_lastuser_anon, thread_datestamp', 'thread_forum_id='.$id.' ORDER BY thread_datestamp DESC LIMIT 1'))
|
||||
{
|
||||
$row = $sql->fetch(MYSQL_ASSOC);
|
||||
$lp_info = $row['thread_datestamp'].'.'.$row['thread_id'];
|
||||
@ -926,7 +925,7 @@ class e107forum
|
||||
|
||||
function forumMarkAsRead($forum_id)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
$extra = '';
|
||||
$newIdList = array();
|
||||
if ($forum_id !== 0)
|
||||
@ -946,9 +945,9 @@ class e107forum
|
||||
}
|
||||
$qry = 'thread_lastpost > '.USERLV.$extra;
|
||||
|
||||
if ($e107->sql->db_Select('forum_thread', 'thread_id', $qry))
|
||||
if ($sql->select('forum_thread', 'thread_id', $qry))
|
||||
{
|
||||
while ($row = $e107->sql->fetch(MYSQL_ASSOC))
|
||||
while ($row = $sql->fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$newIdList[] = $row['thread_id'];
|
||||
}
|
||||
@ -966,7 +965,7 @@ class e107forum
|
||||
function threadMarkAsRead($threadId)
|
||||
{
|
||||
global $currentUser;
|
||||
$e107 = e107::getInstance();
|
||||
|
||||
$_tmp = preg_split('#\,+#', $currentUser['user_plugin_forum_viewed']);
|
||||
if(!is_array($threadId)) { $threadId = array($threadId); }
|
||||
foreach($threadId as $tid)
|
||||
@ -975,17 +974,16 @@ class e107forum
|
||||
}
|
||||
$tmp = array_unique($tmp);
|
||||
$viewed = trim(implode(',', $_tmp), ',');
|
||||
return $e107->sql->update('user_extended', "user_plugin_forum_viewed = '{$viewed}' WHERE user_extended_id = ".USERID);
|
||||
return e107::getDb()->update('user_extended', "user_plugin_forum_viewed = '{$viewed}' WHERE user_extended_id = ".USERID);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function forum_getparents()
|
||||
{
|
||||
global $sql;
|
||||
if ($sql->db_Select('forum', '*', 'forum_parent=0 ORDER BY forum_order ASC'))
|
||||
if (e107::getDb()->select('forum', '*', 'forum_parent=0 ORDER BY forum_order ASC'))
|
||||
{
|
||||
while ($row = $sql->fetch(MYSQL_ASSOC)) {
|
||||
while ($row = e107::getDb()->fetch(MYSQL_ASSOC)) {
|
||||
$ret[] = $row;
|
||||
}
|
||||
return $ret;
|
||||
@ -997,14 +995,15 @@ class e107forum
|
||||
|
||||
function forumGetMods($uclass = e_UC_ADMIN, $force=false)
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
if(count($this->modArray) && !$force)
|
||||
{
|
||||
return $this->modArray;
|
||||
}
|
||||
if($uclass == e_UC_ADMIN || trim($uclass) == '')
|
||||
{
|
||||
$this->e107->sql->db_Select('user', 'user_id, user_name','user_admin = 1 ORDER BY user_name ASC');
|
||||
while($row = $this->e107->sql->fetch(MYSQL_ASSOC))
|
||||
$sql->select('user', 'user_id, user_name','user_admin = 1 ORDER BY user_name ASC');
|
||||
while($row = $sql->fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$this->modArray[$row['user_id']] = $row['user_name'];
|
||||
}
|
||||
@ -1027,7 +1026,7 @@ class e107forum
|
||||
|
||||
function forumGetForumList($all=false)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
$where = ($all ? '' : " WHERE forum_id IN ({$this->permList['view_list']}) ");
|
||||
|
||||
$qry = '
|
||||
@ -1035,10 +1034,10 @@ class e107forum
|
||||
LEFT JOIN `#user` AS u ON f.forum_lastpost_user IS NOT NULL AND u.user_id = f.forum_lastpost_user
|
||||
'.$where.
|
||||
'ORDER BY f.forum_order ASC';
|
||||
if ($e107->sql->gen($qry))
|
||||
if ($sql->gen($qry))
|
||||
{
|
||||
$ret = array();
|
||||
while ($row = $e107->sql->fetch())
|
||||
while ($row = $sql->fetch())
|
||||
{
|
||||
if(!$row['forum_parent'])
|
||||
{
|
||||
@ -1059,10 +1058,9 @@ class e107forum
|
||||
}
|
||||
|
||||
|
||||
|
||||
function forum_getforums($type = 'all')
|
||||
{
|
||||
global $sql;
|
||||
$e107::getDb();
|
||||
$qry = "
|
||||
SELECT f.*, u.user_name FROM #forum AS f
|
||||
LEFT JOIN #user AS u ON SUBSTRING_INDEX(f.forum_lastpost_user,'.',1) = u.user_id
|
||||
@ -1088,10 +1086,9 @@ class e107forum
|
||||
}
|
||||
|
||||
|
||||
|
||||
function forumGetSubs($forum_id = '')
|
||||
{
|
||||
global $sql;
|
||||
$sql = e107::getDb();
|
||||
$where = ($forum_id != '' && $forum_id != 'bysub' ? 'AND forum_sub = '.(int)$forum_id : '');
|
||||
$qry = "
|
||||
SELECT f.*, u.user_name FROM `#forum` AS f
|
||||
@ -1122,7 +1119,6 @@ class e107forum
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* List of forums with unread threads
|
||||
*
|
||||
@ -1136,6 +1132,7 @@ class e107forum
|
||||
{
|
||||
if (!USER) {return false; } // Can't determine new threads for non-logged in users
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
$viewed = '';
|
||||
|
||||
if($e107->currentUser['user_plugin_forum_viewed'])
|
||||
@ -1147,9 +1144,9 @@ class e107forum
|
||||
SELECT DISTINCT f.forum_sub, ft.thread_forum_id FROM `#forum_thread` AS ft
|
||||
LEFT JOIN `#forum` AS f ON f.forum_id = ft.thread_forum_id
|
||||
WHERE ft.thread_lastpost > '.USERLV.' '.$viewed;
|
||||
if($e107->sql->gen($_newqry))
|
||||
if($sql->gen($_newqry))
|
||||
{
|
||||
while($row = $e107->sql->fetch(MYSQL_ASSOC))
|
||||
while($row = $sql->fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$ret[] = $row['thread_forum_id'];
|
||||
if($row['forum_sub'])
|
||||
@ -1166,7 +1163,6 @@ class e107forum
|
||||
}
|
||||
|
||||
|
||||
|
||||
function thread_user($post_info)
|
||||
{
|
||||
if($post_info['user_name'])
|
||||
@ -1181,10 +1177,10 @@ class e107forum
|
||||
}
|
||||
|
||||
|
||||
|
||||
function track($which, $uid, $threadId, $force=false)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
|
||||
if ($this->prefs->get('track') != 1 && !$force) { return false; }
|
||||
|
||||
@ -1197,17 +1193,17 @@ class e107forum
|
||||
$tmp = array();
|
||||
$tmp['data']['track_userid'] = $uid;
|
||||
$tmp['data']['track_thread'] = $threadId;
|
||||
$result = $e107->sql->db_Insert('forum_track', $tmp);
|
||||
$result = $sql->insert('forum_track', $tmp);
|
||||
unset($tmp);
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
case 'del':
|
||||
$result = $e107->sql->delete('forum_track', "`track_userid` = {$uid} AND `track_thread` = {$threadId}");
|
||||
$result = $sql->delete('forum_track', "`track_userid` = {$uid} AND `track_thread` = {$threadId}");
|
||||
break;
|
||||
|
||||
case 'check':
|
||||
$result = $e107->sql->db_Count('forum_track', '(*)', "WHERE `track_userid` = {$uid} AND `track_thread` = {$threadId}");
|
||||
$result = $sql->count('forum_track', '(*)', "WHERE `track_userid` = {$uid} AND `track_thread` = {$threadId}");
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
@ -1233,10 +1229,9 @@ class e107forum
|
||||
}
|
||||
|
||||
|
||||
|
||||
function forumGetAllowed($type='view')
|
||||
{
|
||||
global $sql;
|
||||
$sql = e107::getDb();
|
||||
$forumList = implode(',', $this->permList[$type]);
|
||||
$qry = "
|
||||
SELECT forum_id, forum_name FROM `#forum`
|
||||
@ -1252,12 +1247,12 @@ class e107forum
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function forumGetThreads($forumId, $from, $view)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
$forumId = (int)$forumId;
|
||||
$qry = "
|
||||
SELECT t.*, u.user_name, lpu.user_name AS lastpost_username from `#forum_thread` as t
|
||||
@ -1270,9 +1265,9 @@ class e107forum
|
||||
LIMIT ".(int)$from.','.(int)$view;
|
||||
|
||||
$ret = array();
|
||||
if ($e107->sql->gen($qry))
|
||||
if ($sql->gen($qry))
|
||||
{
|
||||
while ($row = $e107->sql->fetch(MYSQL_ASSOC))
|
||||
while ($row = $sql->fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$ret[] = $row;
|
||||
}
|
||||
@ -1281,10 +1276,10 @@ class e107forum
|
||||
}
|
||||
|
||||
|
||||
|
||||
function threadGetLastpost($id)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
$id = (int)$id;
|
||||
$qry = "
|
||||
SELECT p.post_user, p.post_user_anon, p.post_datestamp, p.post_thread, u.user_name FROM `#forum_post` AS p
|
||||
@ -1292,9 +1287,9 @@ class e107forum
|
||||
WHERE p.post_thread = {$id}
|
||||
ORDER BY p.post_datestamp DESC LIMIT 0,1
|
||||
";
|
||||
if ($e107->sql->gen($qry))
|
||||
if ($sql->gen($qry))
|
||||
{
|
||||
return $e107->sql->fetch(MYSQL_ASSOC);
|
||||
return $sql->fetch(MYSQL_ASSOC);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1302,11 +1297,10 @@ class e107forum
|
||||
// function forum_get_topic_count($forum_id)
|
||||
// {
|
||||
// $e107 = e107::getInstance();
|
||||
// return $e107->sql->db_Count('forum_thread', '(*)', 'WHERE thread_forum_id='.(int)$forum_id);
|
||||
// return $sql->count('forum_thread', '(*)', 'WHERE thread_forum_id='.(int)$forum_id);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
function threadGetNextPrev($which, $threadId, $forumId, $lastpost)
|
||||
{
|
||||
// echo "threadid = $threadId <br />forum id = $forumId <br />";
|
||||
@ -1335,9 +1329,9 @@ class e107forum
|
||||
thread_sticky DESC,
|
||||
thread_lastpost {$sort}
|
||||
LIMIT 1";
|
||||
if ($e107->sql->gen($qry))
|
||||
if ($sql->gen($qry))
|
||||
{
|
||||
$row = $e107->sql->fetch();
|
||||
$row = $sql->fetch();
|
||||
return $row['thread_id'];
|
||||
|
||||
}
|
||||
@ -1345,7 +1339,6 @@ class e107forum
|
||||
}
|
||||
|
||||
|
||||
|
||||
function threadIncView($id)
|
||||
{
|
||||
$id = (int)$id;
|
||||
@ -1369,7 +1362,7 @@ class e107forum
|
||||
|
||||
function threadGetNew($count = 50, $unread = true, $uid = USERID)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
$viewed = '';
|
||||
if($unread)
|
||||
{
|
||||
@ -1399,27 +1392,27 @@ class e107forum
|
||||
ORDER BY t.thread_lastpost DESC LIMIT 0, ".(int)$count;
|
||||
|
||||
|
||||
if($e107->sql->gen($qry))
|
||||
if($sql->gen($qry))
|
||||
{
|
||||
$ret = $e107->sql->db_getList();
|
||||
$ret = $sql->db_getList();
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function forumPrune($type, $days, $forumArray)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
$prunedate = time() - (int)$days * 86400;
|
||||
$forumList = implode(',', $forumArray);
|
||||
|
||||
if($type == 'delete')
|
||||
{
|
||||
//Get list of threads to prune
|
||||
if ($e107->sql->db_Select('forum_thread', 'thread_id', "thread_lastpost < {$prunedate} AND thread_sticky != 1 AND thread_forum_id IN ({$forumList})"))
|
||||
if ($sql->select('forum_thread', 'thread_id', "thread_lastpost < {$prunedate} AND thread_sticky != 1 AND thread_forum_id IN ({$forumList})"))
|
||||
{
|
||||
$threadList = $e107->sql->db_getList();
|
||||
$threadList = $sql->db_getList();
|
||||
foreach($threadList as $thread)
|
||||
{
|
||||
$this->threadDelete($thread['thread_id'], false);
|
||||
@ -1438,20 +1431,20 @@ class e107forum
|
||||
}
|
||||
if($type == 'make_inactive')
|
||||
{
|
||||
$pruned = $e107->sql->update('forum_thread', "thread_active=0 WHERE thread_lastpost < {$prunedate} thread_forum_id IN ({$forumList})");
|
||||
$pruned = $sql->update('forum_thread', "thread_active=0 WHERE thread_lastpost < {$prunedate} thread_forum_id IN ({$forumList})");
|
||||
return FORLAN_8.' '.$pruned.' '.FORLAN_91;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function forumUpdateCounts($forumId, $recalcThreads = false)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
if($forumId == 'all')
|
||||
{
|
||||
$e107->sql->db_Select('forum', 'forum_id', 'forum_parent != 0');
|
||||
$flist = $e107->sql->db_getList();
|
||||
$sql->select('forum', 'forum_id', 'forum_parent != 0');
|
||||
$flist = $sql->db_getList();
|
||||
foreach($flist as $f)
|
||||
{
|
||||
set_time_limit(60);
|
||||
@ -1460,19 +1453,19 @@ class e107forum
|
||||
return;
|
||||
}
|
||||
$forumId = (int)$forumId;
|
||||
$threads = $e107->sql->db_Count('forum_thread', '(*)', 'WHERE thread_forum_id='.$forumId);
|
||||
$replies = $e107->sql->db_Count('forum_post', '(*)', 'WHERE post_forum='.$forumId);
|
||||
$e107->sql->update('forum', "forum_threads={$threads}, forum_replies={$replies} WHERE forum_id={$forumId}");
|
||||
$threads = $sql->count('forum_thread', '(*)', 'WHERE thread_forum_id='.$forumId);
|
||||
$replies = $sql->count('forum_post', '(*)', 'WHERE post_forum='.$forumId);
|
||||
$sql->update('forum', "forum_threads={$threads}, forum_replies={$replies} WHERE forum_id={$forumId}");
|
||||
if($recalcThreads == true)
|
||||
{
|
||||
set_time_limit(60);
|
||||
$e107->sql->db_Select('forum_post', 'post_thread, count(post_thread) AS replies', "post_forum={$forumId} GROUP BY post_thread");
|
||||
$tlist = $e107->sql->db_getList();
|
||||
$sql->select('forum_post', 'post_thread, count(post_thread) AS replies', "post_forum={$forumId} GROUP BY post_thread");
|
||||
$tlist = $sql->db_getList();
|
||||
foreach($tlist as $t)
|
||||
{
|
||||
$tid = $t['post_thread'];
|
||||
$replies = (int)$t['replies'];
|
||||
$e107->sql->update('forum_thread', "thread_total_replies={$replies} WHERE thread_id={$tid}");
|
||||
$sql->update('forum_thread', "thread_total_replies={$replies} WHERE thread_id={$tid}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1481,7 +1474,7 @@ class e107forum
|
||||
|
||||
function getUserCounts()
|
||||
{
|
||||
global $sql;
|
||||
$sql = e107::getDb();
|
||||
$qry = "
|
||||
SELECT post_user, count(post_user) AS cnt FROM `#forum_post`
|
||||
WHERE post_user > 0
|
||||
@ -1586,7 +1579,6 @@ class e107forum
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Delete a Thread
|
||||
* @param $threadId integer
|
||||
@ -1595,8 +1587,7 @@ class e107forum
|
||||
*/
|
||||
function threadDelete($threadId, $updateForumLastpost = true)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
$status = false;
|
||||
|
||||
@ -1651,7 +1642,6 @@ class e107forum
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Delete a Post
|
||||
* @param $postId integer
|
||||
@ -1661,12 +1651,11 @@ class e107forum
|
||||
function postDelete($postId, $updateCounts = true)
|
||||
{
|
||||
$postId = (int)$postId;
|
||||
$e107 = e107::getInstance();
|
||||
|
||||
$e107 = e107::getInstance();
|
||||
$sql = e107::getDb();
|
||||
$deleted = false;
|
||||
|
||||
if(!$sql->db_Select('forum_post', '*', 'post_id = '.$postId))
|
||||
if(!$sql->select('forum_post', '*', 'post_id = '.$postId))
|
||||
{
|
||||
echo 'NOT FOUND!'; return;
|
||||
}
|
||||
@ -1690,14 +1679,14 @@ class e107forum
|
||||
//decrement user post counts
|
||||
if ($row['post_user'])
|
||||
{
|
||||
$e107->sql->update('user_extended', 'user_plugin_forum_posts=GREATEST(user_plugin_forum_posts-1,0) WHERE user_extended_id='.$row['post_user']);
|
||||
$sql->update('user_extended', 'user_plugin_forum_posts=GREATEST(user_plugin_forum_posts-1,0) WHERE user_extended_id='.$row['post_user']);
|
||||
}
|
||||
|
||||
// update thread with correct reply counts
|
||||
$e107->sql->update('forum_thread', "thread_total_replies=GREATEST(thread_total_replies-1,0) WHERE thread_id=".$row['post_thread']);
|
||||
$sql->update('forum_thread', "thread_total_replies=GREATEST(thread_total_replies-1,0) WHERE thread_id=".$row['post_thread']);
|
||||
|
||||
// update forum with correct thread/reply counts
|
||||
$e107->sql->update('forum', "forum_replies=GREATEST(forum_replies-1,0) WHERE forum_id=".$row['post_forum']);
|
||||
$sql->update('forum', "forum_replies=GREATEST(forum_replies-1,0) WHERE forum_id=".$row['post_forum']);
|
||||
|
||||
// update thread lastpost info
|
||||
$this->forumUpdateLastpost('thread', $row['post_thread']);
|
||||
@ -1770,7 +1759,6 @@ function img_path($filename)
|
||||
|
||||
|
||||
|
||||
|
||||
if (file_exists(THEME.'forum/forum_icons_template.php'))
|
||||
{
|
||||
require_once(THEME.'forum/forum_icons_template.php');
|
||||
|
Loading…
x
Reference in New Issue
Block a user