1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-16 20:28:28 +01:00

PHP8 Plugin code cleanup

This commit is contained in:
Cameron 2021-01-21 09:38:38 -08:00
parent 9e0d014e39
commit f055b49d91
83 changed files with 753 additions and 675 deletions

View File

@ -206,7 +206,7 @@ if(THEME_LEGACY === true || !deftrue('BOOTSTRAP'))
// re-initalize in case globals are destroyed from $e_headers includes
$e_js = e107::getJs();
$e_pref = e107::getConfig();
$pref = e107::getPref();
// --- Load plugin Meta files - now possible to add to all zones! --------
$e_meta_content = '';

View File

@ -1496,7 +1496,12 @@ class comment
return null;
}
global $pref,$sql,$sql2,$tp;
$sql = e107::getDb();
$tp = e107::getParser();
$sql2 = e107::getDb('sql2');
$pref = e107::getPref();
$from1 = ($from ? $from : '0');
$amount1 = ($amount ? $amount : '10');
$valid = ($cdvalid ? $cdvalid : '0');

View File

@ -85,7 +85,7 @@ class e_plugin
"chatbox_menu", "clock_menu","comment_menu",
"contact", "download", "featurebox", "forum","gallery",
"gsitemap", "hero", "import", "linkwords", "list_new", "log", "login_menu",
"metaweblog", "newforumposts_main", "news", "newsfeed",
"newforumposts_main", "news", "newsfeed",
"newsletter","online", "page", "pm","poll",
"rss_menu","search_menu","siteinfo", "social", "tagcloud", "tinymce4",
"user"

View File

@ -11,7 +11,7 @@
*/
if (!defined('e107_INIT'))
{
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
}
@ -47,7 +47,7 @@ class _blank_front
// $template = e107::getTemplate('_blank','_blank','default');
// $text = $tp->parseTemplate($template['start'],true, $sc);
if($rows = $sql->retrieve('blank','*',false,'',true)) // combined select and fetch function - returns an array.
if($rows = $sql->retrieve('blank','*',false,true)) // combined select and fetch function - returns an array.
{
// print_a($rows);
foreach($rows as $key=>$value) // loop throug
@ -56,7 +56,7 @@ class _blank_front
// $sc->setVars($value); // if shortcodes are enabled.
// $text .= $tp->parseTemplate($template['item'],true, $sc);
$text .= $tp->toHTML($value['blank_type'])."<br />";
$text .= $tp->toHTML(varset($value['blank_type']))."<br />";
}
// $text .= $tp->parseTemplate($template['end'],true, $sc);
@ -128,7 +128,7 @@ $_blankFront = new _blank_front;
require_once(HEADERF); // render the header (everything before the main content area)
$_blankFront->run();
require_once(FOOTERF); // render the footer (everything after the main content area)
exit;
// For a more elaborate plugin - please see e107_plugins/gallery

View File

@ -10,7 +10,7 @@
*
*/
require_once("../../class2.php");
require_once(__DIR__."/../../class2.php");
if (!getperms("P"))
{
e107::redirect('admin');

View File

@ -10,7 +10,7 @@
*
* if (!defined('e107_INIT'))
* {
* require_once("../../class2.php");
* require_once(__DIR__.'/../../class2.php');
* }
*
*/

View File

@ -28,7 +28,7 @@
2. Change admin log references
*/
$eplug_admin = true;
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
if(!getperms('P') || !e107::isInstalled('alt_auth'))
{
e107::redirect('admin');

View File

@ -20,7 +20,7 @@
* @version $Id$;
*/
$eplug_admin = true;
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
require_once(e_ADMIN.'auth.php');
require_once(e_HANDLER.'form_handler.php');
e107::includeLan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_e107db_conf.php');

View File

@ -22,7 +22,7 @@
*/
$eplug_admin = true;
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
require_once(e_ADMIN.'auth.php');
require_once(e_HANDLER.'form_handler.php');
e107::includeLan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_importdb_conf.php');

View File

@ -21,7 +21,7 @@
*/
$eplug_admin = true;
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
require_once(e_ADMIN.'auth.php');
require_once(e_HANDLER.'form_handler.php');
e107::includeLan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_ldap_conf.php');

View File

@ -21,7 +21,7 @@
* @version $Id$;
*/
$eplug_admin = true;
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
require_once(e_ADMIN.'auth.php');
require_once(e_HANDLER.'form_handler.php');
e107::includeLan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_otherdb_conf.php');

View File

@ -17,7 +17,7 @@
+----------------------------------------------------------------------------+
*/
$eplug_admin = true;
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
require_once(e_ADMIN."auth.php");
require_once(e_HANDLER."form_handler.php");
e107::includeLan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_radius_conf.php');

View File

@ -10,7 +10,7 @@
*
*/
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
if (!getperms('D') && !getperms('P'))
{
e107::redirect('admin');
@ -644,7 +644,7 @@ require_once(e_ADMIN."auth.php");
e107::getAdminUI()->runPage();
require_once(e_ADMIN."footer.php");
exit;
//TODO - Put client/password in a separate table?

View File

@ -11,7 +11,7 @@
if (!defined('e107_INIT'))
{
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
}
if (!e107::isInstalled('banner'))

View File

@ -17,7 +17,7 @@
| Based on code by: Thomas Bouve (crahan@gmx.net)
*/
require_once("../../class2.php");
require_once(__DIR__."/../../class2.php");
require_once(e_HANDLER."userclass_class.php");
e107::includeLan(e_PLUGIN."blogcalendar_menu/languages/".e_LANGUAGE.".php");
@ -74,6 +74,8 @@ $end_year = $cur_year;
$year_selector = "<div class='forumheader' style='text-align: center; margin-bottom: 2px;'>";
$year_selector .= "".BLOGCAL_ARCHIV1.": <select name='activate' onchange='urljump(this.options[selectedIndex].value)' class='tbox'>\n";
$day_links = array();
for($i = $start_year; $i <= $end_year; $i++)
{
$start = mktime(0, 0, 0, 1, 1, intval($req_year));
@ -148,7 +150,7 @@ for($i = 1; $i <= 12; $i++)
{
$req_day = "";
}
$archive .= "<div>".calendar($req_day, $i, $req_year, $day_links[$i], $pref['blogcal_ws'])."</div></td>\n";
$archive .= "<div>".calendar($req_day, $i, $req_year, varset($day_links[$i]), $pref['blogcal_ws'])."</div></td>\n";
}
$archive .= "</tr></table></div>";

View File

@ -10,7 +10,7 @@
*
*/
$eplug_admin = TRUE;
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
require_once(e_HANDLER."userclass_class.php");
e107::includeLan(e_PLUGIN."blogcalendar_menu/languages/".e_LANGUAGE.".php");
@ -49,8 +49,7 @@ $text = "
<select class='tbox' name='blogcal_mpr'>";
// if the nr of months per row is undefined, default to 3
$months_per_row = $pref['blogcal_mpr']?$pref['blogcal_mpr']:
"3";
$months_per_row = isset($pref['blogcal_mpr']) ? $pref['blogcal_mpr']: 3;
for($i = 1; $i <= 12; $i++) {
$text .= "<option value='$i'";
$text .= $months_per_row == $i?"selected":
@ -66,8 +65,7 @@ $text = "
<td>".BLOGCAL_CONF2.": </td>
<td><input class='tbox' type='text' name='blogcal_padding' size='20' value='";
// if the cellpadding isn't defined
$padding = $pref['blogcal_padding']?$pref['blogcal_padding']:
"2";
$padding = isset($pref['blogcal_padding']) ? $pref['blogcal_padding'] : 2;
$text .= $padding;
$text .= "' maxlength='100' />
</td>

View File

@ -10,7 +10,7 @@
*
*/
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
if (!e107::isInstalled('chatbox_menu') || !getperms("P"))
{

View File

@ -9,7 +9,7 @@
* e107 chatbox_menu Plugin
*
*/
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
if ( ! e107::isInstalled('chatbox_menu')) {
e107::redirect();
exit;
@ -19,14 +19,17 @@ e107::lan('chatbox_menu', e_LANGUAGE);
require_once(HEADERF);
$mes = e107::getMessage();
$sql->select('menus', "*", "menu_name='chatbox_menu'");
$row = $sql->fetch();
if($sql->select('menus', "*", "menu_name='chatbox_menu'"))
{
$row = $sql->fetch();
if ( ! check_class((int)$row['menu_class'])) {
$mes->addError(CHATBOX_L24);
$ns->tablerender(LAN_ERROR, $mes->render());
require_once(FOOTERF);
exit;
if(!check_class((int) $row['menu_class']))
{
$mes->addError(CHATBOX_L24);
$ns->tablerender(LAN_ERROR, $mes->render());
require_once(FOOTERF);
exit;
}
}
if ( ! isset($pref['cb_mod'])) {
@ -102,7 +105,7 @@ $chat_total = $sql->count('chatbox');
$qry_where = (CB_MOD ? "1" : "cb_blocked=0");
$from = 0;
// when coming from search.php calculate page number
if ($fs) {

View File

@ -15,7 +15,7 @@ if(isset($_POST['chatbox_ajax']))
define('e_MINIMAL', true);
if(!defined('e107_INIT'))
{
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
}
}
@ -232,7 +232,7 @@ if($emessage !== '')
}
if(!$text = $e107cache->retrieve('nq_chatbox'))
if(!$text = e107::getCache()->retrieve('nq_chatbox'))
{
global $pref, $tp;
@ -317,7 +317,7 @@ if(!$text = $e107cache->retrieve('nq_chatbox'))
: CHATBOX_L12) . '</a> (' . $total_chats . ')</div>';
}
$e107cache->set('nq_chatbox', $text);
e107::getCache()->set('nq_chatbox', $text);
}

View File

@ -12,7 +12,7 @@
$eplug_admin = TRUE;
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
if (!getperms('1'))
{
e107::redirect('admin');
@ -62,7 +62,7 @@ $text = "
</colgroup>
<tr>
<td>".CLOCK_AD_L2.": </td>
<td><input class='tbox' type='text' name='clock_caption' size='20' value='".$menu_pref['clock_caption']."' maxlength='100' /> </td>
<td><input class='tbox' type='text' name='clock_caption' size='20' value='".varset($menu_pref['clock_caption'])."' maxlength='100' /> </td>
</tr>
<tr>
@ -72,27 +72,27 @@ $text = "
<tr>
<td>".CLOCK_AD_L7.": </td>
<td><input class='tbox' type='text' name='clock_dateprefix' size='10' value='".$menu_pref['clock_dateprefix']."' maxlength='50' /><span class='field-help'>".CLOCK_AD_L8."</span></td>
<td><input class='tbox' type='text' name='clock_dateprefix' size='10' value='".varset($menu_pref['clock_dateprefix'])."' maxlength='50' /><span class='field-help'>".CLOCK_AD_L8."</span></td>
</tr>
<tr>
<td>".CLOCK_AD_L9.": </td>
<td><input class='tbox' type='text' name='clock_datesuffix1' size='10' value='".$menu_pref['clock_datesuffix1']."' maxlength='50' /><span class='field-help'>".CLOCK_AD_L13."</span></td>
<td><input class='tbox' type='text' name='clock_datesuffix1' size='10' value='".varset($menu_pref['clock_datesuffix1'])."' maxlength='50' /><span class='field-help'>".CLOCK_AD_L13."</span></td>
</tr>
<tr>
<td>".CLOCK_AD_L10.": </td>
<td><input class='tbox' type='text' name='clock_datesuffix2' size='10' value='".$menu_pref['clock_datesuffix2']."' maxlength='50' /><span class='field-help'>".CLOCK_AD_L13."</span></td>
<td><input class='tbox' type='text' name='clock_datesuffix2' size='10' value='".varset($menu_pref['clock_datesuffix2'])."' maxlength='50' /><span class='field-help'>".CLOCK_AD_L13."</span></td>
</tr>
<tr>
<td>".CLOCK_AD_L11.": </td>
<td><input class='tbox' type='text' name='clock_datesuffix3' size='10' value='".$menu_pref['clock_datesuffix3']."' maxlength='50' /><span class='field-help'>".CLOCK_AD_L13."</span></td>
<td><input class='tbox' type='text' name='clock_datesuffix3' size='10' value='".varset($menu_pref['clock_datesuffix3'])."' maxlength='50' /><span class='field-help'>".CLOCK_AD_L13."</span></td>
</tr>
<tr>
<td>".CLOCK_AD_L12.": </td>
<td><input class='tbox' type='text' name='clock_datesuffix4' size='10' value='".$menu_pref['clock_datesuffix4']."' maxlength='50' /><span class='field-help'>".CLOCK_AD_L13."</span></td>
<td><input class='tbox' type='text' name='clock_datesuffix4' size='10' value='".varset($menu_pref['clock_datesuffix4'])."' maxlength='50' /><span class='field-help'>".CLOCK_AD_L13."</span></td>
</tr>
</table>

View File

@ -38,7 +38,7 @@ if (!defined('e107_INIT'))
// $cobj = e107::getObject('comment');
e107::lan('comment_menu', null);
$cobj = e107::getComment();
$menu_pref = e107::getConfig('menu')->getPref();
@ -83,6 +83,8 @@ require_once (e_PLUGIN."comment_menu/comment_menu_shortcodes.php");
$sc = e107::getScBatch('comment_menu', true);
$sc->wrapper('comment_menu');
$tp = e107::getParser();
$text .= $tp->parseTemplate($TEMPLATE['start'], true, $sc);
foreach ($data as $row)

View File

@ -11,7 +11,7 @@
*/
$eplug_admin = TRUE;
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
require_once(e_HANDLER."userclass_class.php");
e107::includeLan(e_PLUGIN."comment_menu/languages/".e_LANGUAGE.".php");

View File

@ -10,7 +10,7 @@
*
* if (!defined('e107_INIT'))
* {
* require_once("../../class2.php");
* require_once(__DIR__.'/../../class2.php');
* }
*
*/

View File

@ -17,7 +17,7 @@
$eplug_admin = true;
define('DOWNLOAD_DEBUG',FALSE);
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
if (!getperms("P") || !e107::isInstalled('download'))
{
e107::redirect('admin');
@ -246,6 +246,6 @@ require_once(e_ADMIN."auth.php");
//download/includes/admin.php is auto-loaded.
e107::getAdminUI()->runPage();
require_once(e_ADMIN."footer.php");
exit;

View File

@ -8,108 +8,113 @@
*
*/
if (!defined('e107_INIT'))
if(!defined('e107_INIT'))
{
require_once("../../class2.php");
require_once(__DIR__ . '/../../class2.php');
}
if (!e107::isInstalled('download'))
if(!e107::isInstalled('download'))
{
e107::redirect();
}
e107::lan('download',false, true); // Loads e_PLUGIN.'download/languages/'.e_LANGUAGE.'/English_front.php'
e107::lan('download', false, true); // Loads e_PLUGIN.'download/languages/'.e_LANGUAGE.'/English_front.php'
$bcList = array(
'LAN_dl_7' => 'LAN_DESCRIPTION',
'LAN_dl_10' => 'LAN_SIZE',
'LAN_dl_11' => 'LAN_IMAGE',
'LAN_dl_17' => 'LAN_FILES',
'LAN_dl_18' => 'LAN_PLUGIN_DOWNLOAD_NAME',
'LAN_dl_19' => 'LAN_CATEGORY',
"LAN_dl_20" => "LAN_FILES",
"LAN_dl_21" => "LAN_SIZE",
"LAN_dl_22" => "LAN_DATE",
"LAN_dl_23" => "LAN_FILE",
"LAN_dl_24" => "LAN_AUTHOR",
"LAN_dl_25" => "LAN_ASCENDING",
"LAN_dl_26" => "LAN_DESCENDING",
"LAN_dl_27" => "LAN_GO",
"LAN_dl_28" => "LAN_NAME",
'LAN_dl_32' => "LAN_DOWNLOAD",
'LAN_dl_35' => "LAN_BACK",
);
$bcList = array(
'LAN_dl_7' => 'LAN_DESCRIPTION',
'LAN_dl_10' => 'LAN_SIZE',
'LAN_dl_11' => 'LAN_IMAGE',
'LAN_dl_17' => 'LAN_FILES',
'LAN_dl_18' => 'LAN_PLUGIN_DOWNLOAD_NAME',
'LAN_dl_19' => 'LAN_CATEGORY',
"LAN_dl_20" => "LAN_FILES",
"LAN_dl_21" => "LAN_SIZE",
"LAN_dl_22" => "LAN_DATE",
"LAN_dl_23" => "LAN_FILE",
"LAN_dl_24" => "LAN_AUTHOR",
"LAN_dl_25" => "LAN_ASCENDING",
"LAN_dl_26" => "LAN_DESCENDING",
"LAN_dl_27" => "LAN_GO",
"LAN_dl_28" => "LAN_NAME",
'LAN_dl_32' => "LAN_DOWNLOAD",
'LAN_dl_35' => "LAN_BACK",
);
e107::getLanguage()->bcDefs($bcList);
e107::getLanguage()->bcDefs($bcList);
require_once(e_PLUGIN.'download/handlers/download_class.php');
require_once(e_PLUGIN.'download/handlers/category_class.php');
require_once(e_PLUGIN . 'download/handlers/download_class.php');
require_once(e_PLUGIN . 'download/handlers/category_class.php');
$dl = new download();
$dl = new download();
if(!defined("USER_WIDTH") && !deftrue('BOOTSTRAP')) { define("USER_WIDTH","width:100%"); }
if(!defined("USER_WIDTH") && !deftrue('BOOTSTRAP'))
{
define("USER_WIDTH", "width:100%");
}
/* define images */
if(deftrue('BOOTSTRAP') && BOOTSTRAP === 3)
/* define images */
if(deftrue('BOOTSTRAP') && BOOTSTRAP === 3)
{
define("IMAGE_DOWNLOAD", (file_exists(THEME . "images/download.png") ? THEME . "images/download.png" : 'icon-download.glyph'));
define("IMAGE_NEW", (file_exists(THEME . "images/new.png") ? THEME . "images/new.png" : 'icon-star.glyph'));
}
elseif(deftrue('BOOTSTRAP') && BOOTSTRAP === 4)
{
define("IMAGE_DOWNLOAD", (file_exists(THEME . "images/download.png") ? THEME . "images/download.png" : 'fa-download.glyph'));
define("IMAGE_NEW", (file_exists(THEME . "images/new.png") ? THEME . "images/new.png" : 'fa-star.glyph'));
}
else
{
define("IMAGE_DOWNLOAD", (file_exists(THEME . "images/download.png") ? THEME . "images/download.png" : e_IMAGE . "generic/download.png"));
define("IMAGE_NEW", (file_exists(THEME . "images/new.png") ? THEME . "images/new.png" : e_IMAGE . "generic/new.png"));
}
$dl->init();
// Legacy Comment Save.
if(isset($_POST['commentsubmit']))
{
if(!$sql->select("download", "download_comment", "download_id = '{$id}' "))
{
define("IMAGE_DOWNLOAD", (file_exists(THEME."images/download.png") ? THEME."images/download.png" : 'icon-download.glyph'));
define("IMAGE_NEW", (file_exists(THEME."images/new.png") ? THEME."images/new.png" : 'icon-star.glyph'));
e107::redirect();
exit;
}
elseif(deftrue('BOOTSTRAP') && BOOTSTRAP === 4)
else
{
define("IMAGE_DOWNLOAD", (file_exists(THEME."images/download.png") ? THEME."images/download.png" : 'fa-download.glyph'));
define("IMAGE_NEW", (file_exists(THEME."images/new.png") ? THEME."images/new.png" : 'fa-star.glyph'));
}
else
{
define("IMAGE_DOWNLOAD", (file_exists(THEME."images/download.png") ? THEME."images/download.png" : e_IMAGE."generic/download.png"));
define("IMAGE_NEW", (file_exists(THEME."images/new.png") ? THEME."images/new.png" : e_IMAGE."generic/new.png"));
}
$dl->init();
// Legacy Comment Save.
if (isset($_POST['commentsubmit']))
{
if (!$sql->select("download", "download_comment", "download_id = '{$id}' "))
$dlrow = $sql->fetch();
if($dlrow['download_comment'] && (ANON === true || USER === true))
{
e107::redirect();
exit;
}
else
{
$dlrow = $sql->fetch();
if ($dlrow['download_comment'] && (ANON === TRUE || USER === TRUE))
{
$clean_authorname = $_POST['author_name'];
$clean_comment = $_POST['comment'];
$clean_subject = $_POST['subject'];
e107::getComment()->enter_comment($clean_authorname, $clean_comment, "download", $id, $pid, $clean_subject);
// $e107cache->clear("comment.download.{$sub_action}"); $sub_action not used here
e107::getCache()->clear("comment.download");
}
$clean_authorname = $_POST['author_name'];
$clean_comment = $_POST['comment'];
$clean_subject = $_POST['subject'];
e107::getComment()->enter_comment($clean_authorname, $clean_comment, "download", $id, $pid, $clean_subject);
// $e107cache->clear("comment.download.{$sub_action}"); $sub_action not used here
e107::getCache()->clear("comment.download");
}
}
}
$dl->load();
$dl->load();
if(!defined("e_PAGETITLE")) {define("e_PAGETITLE", LAN_PLUGIN_DOWNLOAD_NAME);}
if(!defined("e_PAGETITLE"))
{
define("e_PAGETITLE", LAN_PLUGIN_DOWNLOAD_NAME);
}
require_once (HEADERF);
require_once(HEADERF);
// echo "<div style='background-color: yellow; font-size:1.5em; font-weight:bold;color:black; padding:5px'>".e_PAGETITLE."</div>";
echo $dl->render();
require_once (FOOTERF);
exit ;
echo $dl->render();
require_once(FOOTERF);

View File

@ -23,7 +23,7 @@ e107::plugLan('download', 'front', true);
*/
class download_shortcodes extends e_shortcode
{
public $qry;
public $qry = array();
public $dlsubrow;
public $dlsubsubrow;
public $mirror;
@ -45,7 +45,9 @@ class download_shortcodes extends e_shortcode
{
$breadcrumb = array();
switch ($this->qry['action'])
$action = varset($this->qry['action']);
switch ($action)
{
case 'mirror':
$breadcrumb[] = array('text' => LAN_PLUGIN_DOWNLOAD_NAME, 'url' => e107::url('download', 'index'));
@ -71,7 +73,11 @@ class download_shortcodes extends e_shortcode
$breadcrumb[] = array('text' => $this->parent['download_category_name'], 'url' => ($this->parent['download_category_id']) ? e107::url('download', 'category', $this->parent) : null);
}
$breadcrumb[] = array('text' => $this->var['download_category_name'], 'url' => ($this->var['download_category_id']) ? e107::url('download', 'category', $this->var) : null);
if(isset($this->var['download_category_name']))
{
$breadcrumb[] = array('text' => $this->var['download_category_name'], 'url' => ($this->var['download_category_id']) ? e107::url('download', 'category', $this->var) : null);
}
$breadcrumb[] = array('text' => varset($this->var['download_name']), 'url' => null);
break;
}

View File

@ -10,7 +10,7 @@
*
* if (!defined('e107_INIT'))
* {
* require_once("../../class2.php");
* require_once(__DIR__.'/../../class2.php');
* }
*
*/

View File

@ -50,7 +50,7 @@ class downloadCategory
*/
function down_cat_tree($nest_level = 1, $load_cat_class = USERCLASS_LIST, $main_cat_load = '', $accum = FALSE)
{
global $sql2;
$sql2 = e107::getDb('sql2');
$catlist = array();
$this->cat_count = 0;

View File

@ -99,7 +99,7 @@ class download
$tmp = explode('.', e_QUERY);
$order = str_replace("download_","",$pref['download_order']);
$order = str_replace("download_","", varset($pref['download_order'], 'id'));
// Set Defaults
$this->qry['action'] = 'maincats';
@ -134,7 +134,7 @@ class download
$this->qry['order'] = preg_replace("#\W#", "", $tp->toDB($tmp[4]));
$this->qry['sort'] = preg_replace("#\W#", "", $tp->toDB($tmp[5]));
}
elseif($tmp[1])
elseif(!empty($tmp[1]))
{
$this->qry['action'] = preg_replace("#\W#", "", $tp->toDB($tmp[0]));
$this->qry['id'] = intval($tmp[1]);
@ -310,7 +310,7 @@ class download
if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:1px solid blue");}
// Read in tree of categories which this user is allowed to see
$dlcat = new downloadCategory(varset($pref['download_subsub'],1),USERCLASS_LIST,$maincatval,varset($pref['download_incinfo'],FALSE));
$dlcat = new downloadCategory(varset($pref['download_subsub'],1),USERCLASS_LIST, null ,varset($pref['download_incinfo'],FALSE));
if ($dlcat->down_count == 0)
{

View File

@ -1,449 +1,457 @@
<?php
if (!defined('e107_INIT'))
{
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
}
e107::lan('download','download');
$log = e107::getLog();
$id = FALSE;
$sql = e107::getDb();
$tp = e107::getParser();
$pref = e107::pref('core');
if (!is_numeric(e_QUERY) && empty($_GET['id']))
class download_request
{
if ($sql->select('download', 'download_id', "download_url='".$tp->toDB(e_QUERY)."'"))
static function request()
{
$row = $sql->fetch();
$type = 'file';
$id = $row['download_id'];
}
elseif((strpos(e_QUERY, "http://") === 0) || (strpos(e_QUERY, "ftp://") === 0) || (strpos(e_QUERY, "https://") === 0))
{
header("location: ".e_QUERY);
exit();
}
elseif(file_exists(e_DOWNLOAD.e_QUERY)) // 1 - should we allow this?
{
e107::getFile()->send(e_DOWNLOAD.e_QUERY);
exit();
}
}
$log = e107::getLog();
$id = false;
$sql = e107::getDb();
$tp = e107::getParser();
$pref = e107::pref('core');
if(!is_numeric(e_QUERY) && empty($_GET['id']))
{
if($sql->select('download', 'download_id', "download_url='" . $tp->toDB(e_QUERY) . "'"))
{
$row = $sql->fetch();
$type = 'file';
$id = $row['download_id'];
}
elseif((strpos(e_QUERY, "http://") === 0) || (strpos(e_QUERY, "ftp://") === 0) || (strpos(e_QUERY, "https://") === 0))
{
header("location: " . e_QUERY);
exit();
}
elseif(file_exists(e_DOWNLOAD . e_QUERY)) // 1 - should we allow this?
{
e107::getFile()->send(e_DOWNLOAD . e_QUERY);
exit();
}
}
if(strpos(e_QUERY, "mirror") !== false)
{ // Download from mirror
list($action, $download_id, $mirror_id) = explode(".", e_QUERY);
$download_id = intval($download_id);
$mirror_id = intval($mirror_id);
$qry = "SELECT d.*, dc.download_category_class FROM #download as d LEFT JOIN #download_category AS dc ON dc.download_category_id = d.download_category WHERE d.download_id = {$download_id}";
if($sql->gen($qry))
{
$row = $sql->fetch();
extract($row);
if(check_class($row['download_category_class']) && check_class($row['download_class']))
{
if($pref['download_limits'] && $row['download_active'] == 1)
{
check_download_limits();
}
$mirrorList = explode(chr(1), $row['download_mirror']);
$mstr = "";
foreach($mirrorList as $mirror)
{
if($mirror)
{
$tmp = explode(",", $mirror);
$mid = intval($tmp[0]);
$address = $tmp[1];
$requests = $tmp[2];
if($tmp[0] == $mirror_id)
{
$gaddress = trim($address);
$requests++;
}
$mstr .= $mid . "," . $address . "," . $requests . chr(1);
}
}
$sql->update("download", "download_requested = download_requested + 1, download_mirror = '{$mstr}' WHERE download_id = '" . intval($download_id) . "'");
$sql->update("download_mirror", "mirror_count = mirror_count + 1 WHERE mirror_id = '" . intval($mirror_id) . "'");
header("Location: " . decorate_download_location($gaddress));
exit();
}
$goUrl = e107::url('download', 'index', null, array('query' => array('action' => 'error', 'id' => 1))); // ."?action=error&id=1";
e107::redirect($goUrl);
//header("Location: ".e_BASE."download.php?error.{$download_id}.1");
exit;
}
}
$tmp = explode(".", e_QUERY);
if(empty($tmp[1]) || strpos(e_QUERY, "pub_") !== false)
{
$id = intval($tmp[0]);
$type = "file";
}
else
{
$table = preg_replace("#\W#", "", $tp->toDB($tmp[0], true));
$id = intval($tmp[1]);
$type = "image";
}
if(vartrue($_GET['id'])) // SEF URL
{
$id = intval($_GET['id']);
$type = 'file';
}
if(strpos(e_QUERY, "mirror") !== false)
{ // Download from mirror
list($action, $download_id, $mirror_id) = explode(".", e_QUERY);
$download_id = intval($download_id);
$mirror_id = intval($mirror_id);
$qry = "SELECT d.*, dc.download_category_class FROM #download as d LEFT JOIN #download_category AS dc ON dc.download_category_id = d.download_category WHERE d.download_id = {$download_id}";
if ($sql->gen($qry))
{
if(preg_match("#.*\.[a-z,A-Z]{3,4}#", e_QUERY))
{
if(strpos(e_QUERY, "pub_") !== false)
{
$bid = str_replace("pub_", "", e_QUERY);
if(file_exists(e_UPLOAD . $bid))
{
e107::getFile()->send(e_UPLOAD . $bid);
exit();
}
$log->addError("Line" . __LINE__ . ": Couldn't find " . e_UPLOAD . $bid . "");
}
if(file_exists(e_DOWNLOAD . e_QUERY))
{
e107::getFile()->send(e_DOWNLOAD . e_QUERY);
exit();
}
$log->addError("Line" . __LINE__ . ": Couldn't find " . e_DOWNLOAD . e_QUERY);
$log->toFile('download_requests', 'Download Requests', true); // Create a log file and add the log messages
require_once(HEADERF);
e107::getRender()->tablerender(LAN_ERROR, "<div style='text-align:center'>" . LAN_FILE_NOT_FOUND . "\n<br /><br />\n<a href='javascript:history.back(1)'>" . LAN_BACK . "</a></div>");
require_once(FOOTERF);
exit();
}
if($type == "file")
{
$qry = "SELECT d.*, dc.download_category_class FROM #download as d LEFT JOIN #download_category AS dc ON dc.download_category_id = d.download_category WHERE d.download_id = {$id}";
if($sql->gen($qry))
{
$row = $sql->fetch();
$row['download_url'] = $tp->replaceConstants($row['download_url']); // must be relative file-path.
if(check_class($row['download_category_class']) && check_class($row['download_class']))
{
if($row['download_active'] == 0) // Inactive download - don't allow
{
require_once(HEADERF);
$search = array("[", "]");
$replace = array("<a href='" . e_HTTP . "download.php'>", "</a>");
e107::getRender()->tablerender(LAN_ERROR, "<div class='alert alert-warning' style='text-align:center'>" . str_replace($search, $replace, LAN_dl_78) . '</div>');
require_once(FOOTERF);
exit();
}
if($pref['download_limits'] && $row['download_active'] == 1)
{
check_download_limits();
}
extract($row);
if($row['download_mirror'])
{
$array = explode(chr(1), $row['download_mirror']);
$c = (count($array) - 1);
for($i = 1; $i < $c; $i++)
{
$d = mt_rand(0, $i);
$tmp = $array[$i];
$array[$i] = $array[$d];
$array[$d] = $tmp;
}
$tmp = explode(",", $array[0]);
$mirror_id = $tmp[0];
$mstr = "";
foreach($array as $mirror)
{
if($mirror)
{
$tmp = explode(",", $mirror);
$mid = $tmp[0];
$address = $tmp[1];
$requests = $tmp[2];
if($tmp[0] == $mirror_id)
{
$gaddress = trim($address);
$requests++;
}
$mstr .= $mid . "," . $address . "," . $requests . chr(1);
}
}
$sql->update("download", "download_requested = download_requested + 1, download_mirror = '{$mstr}' WHERE download_id = '" . intval($download_id) . "'");
$sql->update("download_mirror", "mirror_count = mirror_count + 1 WHERE mirror_id = '" . intval($mirror_id) . "'");
header("Location: " . decorate_download_location($gaddress));
exit();
}
// increment download count
$sql->update("download", "download_requested = download_requested + 1 WHERE download_id = '{$id}'");
$user_id = USER ? USERID : 0;
$ip = e107::getIPHandler()->getIP(false);
$request_data = "'0', '{$user_id}', '{$ip}', '{$id}', '" . time() . "'";
//add request info to db
$sql->insert("download_requests", $request_data, false);
// if (preg_match("/Binary\s(.*?)\/.*/", $download_url, $result))
// {
// $bid = $result[1];
/// $result = @mysql_query("SELECT * FROM ".MPREFIX."rbinary WHERE binary_id = '{$bid}'");
// $binary_data = @mysql_result($result, 0, "binary_data");
// $binary_filetype = @mysql_result($result, 0, "binary_filetype");
// $binary_name = @mysql_result($result, 0, "binary_name");
// header("Content-type: {$binary_filetype}");
// header("Content-length: {$download_filesize}");
// header("Content-Disposition: attachment; filename={$binary_name}");
// header("Content-Description: PHP Generated Data");
// echo $binary_data;
// exit();
// }
if(strpos($row['download_url'], "http://") !== false || strpos($row['download_url'], "ftp://") !== false || strpos($row['download_url'], "https://") !== false)
{
$download_url = e107::getParser()->parseTemplate($row['download_url'], true); // support for shortcode-driven dynamic URLS.
e107::redirect(decorate_download_location($download_url));
// header("Location: {$download_url}");
exit();
}
else
{
if(file_exists(e_DOWNLOAD . $row['download_url']))
{
e107::getFile()->send(e_DOWNLOAD . $row['download_url']);
exit();
}
elseif(file_exists($row['download_url']))
{
e107::getFile()->send($row['download_url']);
exit();
}
elseif(file_exists(e_UPLOAD . $row['download_url']))
{
e107::getFile()->send(e_UPLOAD . $row['download_url']);
exit();
}
$log->addError("Couldn't find " . e_DOWNLOAD . $row['download_url'] . " or " . $row['download_url'] . " or " . e_UPLOAD . $row['download_url']);
$log->toFile('download_requests', 'Download Requests', true); // Create a log file and add the log messages
}
}
else
{ // Download Access Denied.
if((!strpos($pref['download_denied'], ".php") &&
!strpos($pref['download_denied'], ".htm") &&
!strpos($pref['download_denied'], ".html") &&
!strpos($pref['download_denied'], ".shtml") ||
(strpos($pref['download_denied'], "signup.php") && USER == true)
))
{
// $goUrl = e107::getUrl()->create('download/index')."?action=error&id=1";
$goUrl = e107::url('download', 'index', null, array('query' => array('action' => 'error', 'id' => 1)));
e107::redirect($goUrl);
return;
}
else
{
e107::redirect(trim($pref['download_denied']));
return;
}
}
}
//else if(strstr(e_QUERY, "pub_"))
// {
/* check to see if public upload and not in download table ... */
/*$bid = str_replace("pub_", "", e_QUERY);
if($result = @mysql_query("SELECT * FROM ".MPREFIX."rbinary WHERE binary_id = '$bid' "))
{
$binary_data = @mysql_result($result, 0, "binary_data");
$binary_filetype = @mysql_result($result, 0, "binary_filetype");
$binary_name = @mysql_result($result, 0, "binary_name");
header("Content-type: {$binary_filetype}");
header("Content-length: {$download_filesize}");
header("Content-Disposition: attachment; filename={$binary_name}");
header("Content-Description: PHP Generated Data");
echo $binary_data;
exit();
}*/
// }
$log->addError("Line" . __LINE__ . ": Couldn't find " . e_DOWNLOAD . e_QUERY);
$log->toFile('download_requests', 'Download Requests', true); // Create a log file and add the log messages
require_once(HEADERF);
e107::getRender()->tablerender(LAN_ERROR, "<div style='text-align:center'>" . LAN_FILE_NOT_FOUND . "<br /><br /><a href='javascript:history.back(1)'>" . LAN_BACK . "</a></div>");
require_once(FOOTERF);
return;
}
$sql->select($table, "*", "{$table}_id = '{$id}'");
$row = $sql->fetch();
extract($row);
if (check_class($row['download_category_class']) && check_class($row['download_class']))
{
if($pref['download_limits'] && $row['download_active'] == 1)
{
check_download_limits();
}
$mirrorList = explode(chr(1), $row['download_mirror']);
$mstr = "";
foreach($mirrorList as $mirror)
{
if($mirror)
{
$tmp = explode(",", $mirror);
$mid = intval($tmp[0]);
$address = $tmp[1];
$requests = $tmp[2];
if($tmp[0] == $mirror_id)
{
$gaddress = trim($address);
$requests ++;
}
$mstr .= $mid.",".$address.",".$requests.chr(1);
}
}
$sql->update("download", "download_requested = download_requested + 1, download_mirror = '{$mstr}' WHERE download_id = '".intval($download_id)."'");
$sql->update("download_mirror", "mirror_count = mirror_count + 1 WHERE mirror_id = '".intval($mirror_id)."'");
header("Location: ".decorate_download_location($gaddress));
exit();
}
$goUrl = e107::url('download', 'index', null, array('query'=>array('action'=>'error','id'=>1))); // ."?action=error&id=1";
e107::redirect($goUrl);
//header("Location: ".e_BASE."download.php?error.{$download_id}.1");
exit;
}
}
$tmp = explode(".", e_QUERY);
if (!$tmp[1] || strpos(e_QUERY, "pub_") !== false)
{
$id = intval($tmp[0]);
$type = "file";
}
else
{
$table = preg_replace("#\W#", "", $tp->toDB($tmp[0], true));
$id = intval($tmp[1]);
$type = "image";
}
if(vartrue($_GET['id'])) // SEF URL
{
$id = intval($_GET['id']);
$type = 'file';
}
if (preg_match("#.*\.[a-z,A-Z]{3,4}#", e_QUERY))
{
if(strpos(e_QUERY, "pub_") !== false)
{
$bid = str_replace("pub_", "", e_QUERY);
if (file_exists(e_UPLOAD.$bid))
{
e107::getFile()->send(e_UPLOAD.$bid);
exit();
}
$log->addError("Line".__LINE__.": Couldn't find ".e_UPLOAD.$bid."");
}
if (file_exists(e_DOWNLOAD.e_QUERY))
{
e107::getFile()->send(e_DOWNLOAD.e_QUERY);
exit();
}
$log->addError("Line".__LINE__.": Couldn't find ".e_DOWNLOAD.e_QUERY);
$log->toFile('download_requests','Download Requests', true); // Create a log file and add the log messages
require_once(HEADERF);
e107::getRender()->tablerender(LAN_ERROR, "<div style='text-align:center'>".LAN_FILE_NOT_FOUND."\n<br /><br />\n<a href='javascript:history.back(1)'>".LAN_BACK."</a></div>");
require_once(FOOTERF);
exit();
}
if ($type == "file")
{
$qry = "SELECT d.*, dc.download_category_class FROM #download as d LEFT JOIN #download_category AS dc ON dc.download_category_id = d.download_category WHERE d.download_id = {$id}";
if ($sql->gen($qry))
{
$row = $sql->fetch();
$row['download_url'] = $tp->replaceConstants($row['download_url']); // must be relative file-path.
if (check_class($row['download_category_class']) && check_class($row['download_class']))
{
if ($row['download_active'] == 0) // Inactive download - don't allow
{
require_once(HEADERF);
$search = array("[","]");
$replace = array("<a href='".e_HTTP."download.php'>", "</a>");
e107::getRender()->tablerender(LAN_ERROR, "<div class='alert alert-warning' style='text-align:center'>".str_replace($search, $replace, LAN_dl_78).'</div>');
require_once(FOOTERF);
exit();
}
if($pref['download_limits'] && $row['download_active'] == 1)
{
check_download_limits();
}
extract($row);
if($row['download_mirror'])
{
$array = explode(chr(1), $row['download_mirror']);
$c = (count($array)-1);
for ($i=1; $i < $c; $i++)
{
$d = mt_rand(0, $i);
$tmp = $array[$i];
$array[$i] = $array[$d];
$array[$d] = $tmp;
}
$tmp = explode(",", $array[0]);
$mirror_id = $tmp[0];
$mstr = "";
foreach($array as $mirror)
{
if($mirror)
{
$tmp = explode(",", $mirror);
$mid = $tmp[0];
$address = $tmp[1];
$requests = $tmp[2];
if($tmp[0] == $mirror_id)
{
$gaddress = trim($address);
$requests ++;
}
$mstr .= $mid.",".$address.",".$requests.chr(1);
}
}
$sql->update("download", "download_requested = download_requested + 1, download_mirror = '{$mstr}' WHERE download_id = '".intval($download_id)."'");
$sql->update("download_mirror", "mirror_count = mirror_count + 1 WHERE mirror_id = '".intval($mirror_id)."'");
header("Location: ".decorate_download_location($gaddress));
exit();
}
// increment download count
$sql->update("download", "download_requested = download_requested + 1 WHERE download_id = '{$id}'");
$user_id = USER ? USERID : 0;
$ip = e107::getIPHandler()->getIP(FALSE);
$request_data = "'0', '{$user_id}', '{$ip}', '{$id}', '".time()."'";
//add request info to db
$sql->insert("download_requests", $request_data, FALSE);
// if (preg_match("/Binary\s(.*?)\/.*/", $download_url, $result))
// {
// $bid = $result[1];
/// $result = @mysql_query("SELECT * FROM ".MPREFIX."rbinary WHERE binary_id = '{$bid}'");
// $binary_data = @mysql_result($result, 0, "binary_data");
// $binary_filetype = @mysql_result($result, 0, "binary_filetype");
// $binary_name = @mysql_result($result, 0, "binary_name");
// header("Content-type: {$binary_filetype}");
// header("Content-length: {$download_filesize}");
// header("Content-Disposition: attachment; filename={$binary_name}");
// header("Content-Description: PHP Generated Data");
// echo $binary_data;
// exit();
// }
if (strpos($row['download_url'], "http://") !== false || strpos($row['download_url'], "ftp://") !== false || strpos($row['download_url'], "https://") !== false)
{
$download_url = e107::getParser()->parseTemplate($row['download_url'],true); // support for shortcode-driven dynamic URLS.
e107::redirect(decorate_download_location($download_url));
// header("Location: {$download_url}");
exit();
}
else
{
if (file_exists(e_DOWNLOAD.$row['download_url']))
{
e107::getFile()->send(e_DOWNLOAD.$row['download_url']);
exit();
}
elseif(file_exists($row['download_url']))
{
e107::getFile()->send($row['download_url']);
exit();
}
elseif(file_exists(e_UPLOAD.$row['download_url']))
{
e107::getFile()->send(e_UPLOAD.$row['download_url']);
exit();
}
$log->addError("Couldn't find ".e_DOWNLOAD.$row['download_url']." or ".$row['download_url']." or ".e_UPLOAD.$row['download_url']);
$log->toFile('download_requests','Download Requests', true); // Create a log file and add the log messages
}
}
else
{ // Download Access Denied.
if((!strpos($pref['download_denied'],".php") &&
!strpos($pref['download_denied'],".htm") &&
!strpos($pref['download_denied'],".html") &&
!strpos($pref['download_denied'],".shtml") ||
(strpos($pref['download_denied'],"signup.php") && USER == TRUE)
))
{
// $goUrl = e107::getUrl()->create('download/index')."?action=error&id=1";
$goUrl = e107::url('download', 'index', null, array('query'=>array('action'=>'error','id'=>1)));
e107::redirect($goUrl);
exit();
}
else
{
e107::redirect(trim($pref['download_denied']));
exit();
}
}
}
//else if(strstr(e_QUERY, "pub_"))
// {
/* check to see if public upload and not in download table ... */
/*$bid = str_replace("pub_", "", e_QUERY);
if($result = @mysql_query("SELECT * FROM ".MPREFIX."rbinary WHERE binary_id = '$bid' "))
{
$image = ($table == "upload" ? $row['upload_ss'] : $row['download_image']);
//if (preg_match("/Binary\s(.*?)\/.*/", $image, $result))
//{
/* $bid = $result[1];
$result = @mysql_query("SELECT * FROM ".MPREFIX."rbinary WHERE binary_id = '{$bid}'");
$binary_data = @mysql_result($result, 0, "binary_data");
$binary_filetype = @mysql_result($result, 0, "binary_filetype");
$binary_name = @mysql_result($result, 0, "binary_name");
header("Content-type: {$binary_filetype}");
header("Content-length: {$download_filesize}");
header("Content-Disposition: attachment; filename={$binary_name}");
header("Content-Description: PHP Generated Data");
header("Content-Disposition: inline; filename={$binary_name}");
echo $binary_data;
exit();
}*/
// }
$log->addError("Line".__LINE__.": Couldn't find ".e_DOWNLOAD.e_QUERY);
$log->toFile('download_requests','Download Requests', true); // Create a log file and add the log messages
require_once(HEADERF);
e107::getRender()->tablerender(LAN_ERROR, "<div style='text-align:center'>".LAN_FILE_NOT_FOUND."<br /><br /><a href='javascript:history.back(1)'>".LAN_BACK."</a></div>");
require_once(FOOTERF);
exit();
}
exit();*/
$sql->select($table, "*", "{$table}_id = '{$id}'");
$row = $sql->fetch();
extract($row);
$image = ($table == "upload" ? $row['upload_ss'] : $row['download_image']);
//if (preg_match("/Binary\s(.*?)\/.*/", $image, $result))
//{
/* $bid = $result[1];
$result = @mysql_query("SELECT * FROM ".MPREFIX."rbinary WHERE binary_id = '{$bid}'");
$binary_data = @mysql_result($result, 0, "binary_data");
$binary_filetype = @mysql_result($result, 0, "binary_filetype");
$binary_name = @mysql_result($result, 0, "binary_name");
header("Content-type: {$binary_filetype}");
header("Content-Disposition: inline; filename={$binary_name}");
echo $binary_data;
exit();*/
//}
//}
// $image = ($table == "upload" ? $upload_ss : $download_image);
// $image = ($table == "upload" ? $upload_ss : $download_image);
if (strpos($image, "http") !== FALSE)
{
e107::redirect($image);
exit();
}
else
{
if ($table == "download")
{
require_once(HEADERF);
$imagecaption = ''; // TODO ?name or text Screenshot
if (file_exists(e_FILE."download/{$image}"))
if(strpos($image, "http") !== false)
{
$disp = "<div style='text-align:center'><img class='img-responsive img-fluid' src='".e_FILE_ABS."download/{$image}' alt='' /></div>";
e107::redirect($image);
return;
}
else if(file_exists(e_FILE."downloadimages/{$image}"))
else
{
$disp = "<div style='text-align:center'><img class='img-responsive img-fluid' src='".e_FILE_ABS."downloadimages/{$image}' alt='' /></div>";
}
else
{
$image = $tp->replaceConstants($image,'abs');
$disp = "<div style='text-align:center'><img class='img-responsive img-fluid' src='".$image."' alt='' /></div>";
}
$disp .= "<br /><div style='text-align:center'><a href='javascript:history.back(1)'>".LAN_BACK."</a></div>";
e107::getRender()->tablerender($imagecaption, $disp);
require_once(FOOTERF);
} else
{
if (is_file(e_UPLOAD.$image))
{
echo "<img src='".e_UPLOAD.$image."' alt='' />";
}
elseif(is_file(e_FILE."downloadimages/{$image}"))
{
echo "<img src='".e_FILE_ABS."downloadimages/{$image}' alt='' />";
}
else
{
require_once(HEADERF);
e107::getRender()->tablerender(LAN_ERROR, "<div style='text-align:center'>".LAN_FILE_NOT_FOUND."<br /><br /><a href='javascript:history.back(1)'>".LAN_BACK."</a></div>");
require_once(FOOTERF);
exit;
}
exit();
}
}
function check_download_limits()
{
global $pref, $sql, $HEADER;
// Check download count limits
$qry = "SELECT gen_intdata, gen_chardata, (gen_intdata/gen_chardata) as count_perday FROM #generic WHERE gen_type = 'download_limit' AND gen_datestamp IN (".USERCLASS_LIST.") AND (gen_chardata >= 0 AND gen_intdata >= 0) ORDER BY count_perday DESC";
if($sql->gen($qry))
{
$limits = $sql->fetch();
$cutoff = time() - (86400 * $limits['gen_chardata']);
if(USER)
{
$where = "dr.download_request_datestamp > {$cutoff} AND dr.download_request_userid = ".USERID;
}
else
{
$ip = e107::getIPHandler()->getIP(FALSE);
$where = "dr.download_request_datestamp > {$cutoff} AND dr.download_request_ip = '{$ip}'";
}
$qry = "SELECT COUNT(d.download_id) as count FROM #download_requests as dr LEFT JOIN #download as d ON dr.download_request_download_id = d.download_id AND d.download_active = 1 WHERE {$where} GROUP by dr.download_request_userid";
if($sql->gen($qry))
{
$row = $sql->fetch();
if($row['count'] >= $limits['gen_intdata'])
if($table == "download")
{
// Exceeded download count limit
// $goUrl = e107::getUrl()->create('download/index')."?action=error&id=2";
$goUrl = e107::url('download', 'index', null, array('query'=>array('action'=>'error','id'=>2)));
e107::redirect($goUrl);
// e107::redirect(e_BASE."download.php?error.{$cutoff}.2");
/* require_once(HEADERF);
$ns->tablerender(LAN_ERROR, LAN_dl_62);
require(FOOTERF); */
exit();
require_once(HEADERF);
$imagecaption = ''; // TODO ?name or text Screenshot
if(file_exists(e_FILE . "download/{$image}"))
{
$disp = "<div style='text-align:center'><img class='img-responsive img-fluid' src='" . e_FILE_ABS . "download/{$image}' alt='' /></div>";
}
elseif(file_exists(e_FILE . "downloadimages/{$image}"))
{
$disp = "<div style='text-align:center'><img class='img-responsive img-fluid' src='" . e_FILE_ABS . "downloadimages/{$image}' alt='' /></div>";
}
else
{
$image = $tp->replaceConstants($image, 'abs');
$disp = "<div style='text-align:center'><img class='img-responsive img-fluid' src='" . $image . "' alt='' /></div>";
}
$disp .= "<br /><div style='text-align:center'><a href='javascript:history.back(1)'>" . LAN_BACK . "</a></div>";
e107::getRender()->tablerender($imagecaption, $disp);
require_once(FOOTERF);
}
else
{
if(is_file(e_UPLOAD . $image))
{
echo "<img src='" . e_UPLOAD . $image . "' alt='' />";
}
elseif(is_file(e_FILE . "downloadimages/{$image}"))
{
echo "<img src='" . e_FILE_ABS . "downloadimages/{$image}' alt='' />";
}
else
{
require_once(HEADERF);
e107::getRender()->tablerender(LAN_ERROR, "<div style='text-align:center'>" . LAN_FILE_NOT_FOUND . "<br /><br /><a href='javascript:history.back(1)'>" . LAN_BACK . "</a></div>");
require_once(FOOTERF);
}
return;
}
}
}
// Check download bandwidth limits
$qry = "SELECT gen_user_id, gen_ip, (gen_user_id/gen_ip) as bw_perday FROM #generic WHERE gen_type='download_limit' AND gen_datestamp IN (".USERCLASS_LIST.") AND (gen_user_id >= 0 AND gen_ip >= 0) ORDER BY bw_perday DESC";
if($sql->gen($qry))
function check_download_limits()
{
$limit = $sql->fetch();
$cutoff = time() - (86400*$limit['gen_ip']);
if(USER)
global $pref, $sql, $HEADER;
// Check download count limits
$qry = "SELECT gen_intdata, gen_chardata, (gen_intdata/gen_chardata) as count_perday FROM #generic WHERE gen_type = 'download_limit' AND gen_datestamp IN (".USERCLASS_LIST.") AND (gen_chardata >= 0 AND gen_intdata >= 0) ORDER BY count_perday DESC";
if($sql->gen($qry))
{
$where = "dr.download_request_datestamp > {$cutoff} AND dr.download_request_userid = ".USERID;
}
else
{
$ip = e107::getIPHandler()->getIP(FALSE);
$where = "dr.download_request_datestamp > {$cutoff} AND dr.download_request_ip = '{$ip}'";
$limits = $sql->fetch();
$cutoff = time() - (86400 * $limits['gen_chardata']);
if(USER)
{
$where = "dr.download_request_datestamp > {$cutoff} AND dr.download_request_userid = ".USERID;
}
else
{
$ip = e107::getIPHandler()->getIP(FALSE);
$where = "dr.download_request_datestamp > {$cutoff} AND dr.download_request_ip = '{$ip}'";
}
$qry = "SELECT COUNT(d.download_id) as count FROM #download_requests as dr LEFT JOIN #download as d ON dr.download_request_download_id = d.download_id AND d.download_active = 1 WHERE {$where} GROUP by dr.download_request_userid";
if($sql->gen($qry))
{
$row = $sql->fetch();
if($row['count'] >= $limits['gen_intdata'])
{
// Exceeded download count limit
// $goUrl = e107::getUrl()->create('download/index')."?action=error&id=2";
$goUrl = e107::url('download', 'index', null, array('query'=>array('action'=>'error','id'=>2)));
e107::redirect($goUrl);
// e107::redirect(e_BASE."download.php?error.{$cutoff}.2");
/* require_once(HEADERF);
$ns->tablerender(LAN_ERROR, LAN_dl_62);
require(FOOTERF); */
exit();
}
}
}
$qry = "SELECT SUM(d.download_filesize) as total_bw FROM #download_requests as dr LEFT JOIN #download as d ON dr.download_request_download_id = d.download_id AND d.download_active = 1 WHERE {$where} GROUP by dr.download_request_userid";
if($sql->gen($qry))
// Check download bandwidth limits
$qry = "SELECT gen_user_id, gen_ip, (gen_user_id/gen_ip) as bw_perday FROM #generic WHERE gen_type='download_limit' AND gen_datestamp IN (".USERCLASS_LIST.") AND (gen_user_id >= 0 AND gen_ip >= 0) ORDER BY bw_perday DESC";
if($sql->gen($qry))
{
$row = $sql->fetch();
if($row['total_bw'] / 1024 > $limit['gen_user_id'])
{ //Exceed bandwith limit
// $goUrl = e107::getUrl()->create('download/index')."?action=error&id=2";
$goUrl = e107::url('download', 'index', null, array('query'=>array('action'=>'error','id'=>2)));
e107::redirect($goUrl);
// e107::redirect(e_BASE."download.php?error.{$cutoff}.2");
/* require(HEADERF);
$ns->tablerender(LAN_ERROR, LAN_dl_62);
require(FOOTERF); */
exit();
$limit = $sql->fetch();
$cutoff = time() - (86400*$limit['gen_ip']);
if(USER)
{
$where = "dr.download_request_datestamp > {$cutoff} AND dr.download_request_userid = ".USERID;
}
else
{
$ip = e107::getIPHandler()->getIP(FALSE);
$where = "dr.download_request_datestamp > {$cutoff} AND dr.download_request_ip = '{$ip}'";
}
$qry = "SELECT SUM(d.download_filesize) as total_bw FROM #download_requests as dr LEFT JOIN #download as d ON dr.download_request_download_id = d.download_id AND d.download_active = 1 WHERE {$where} GROUP by dr.download_request_userid";
if($sql->gen($qry))
{
$row = $sql->fetch();
if($row['total_bw'] / 1024 > $limit['gen_user_id'])
{ //Exceed bandwith limit
// $goUrl = e107::getUrl()->create('download/index')."?action=error&id=2";
$goUrl = e107::url('download', 'index', null, array('query'=>array('action'=>'error','id'=>2)));
e107::redirect($goUrl);
// e107::redirect(e_BASE."download.php?error.{$cutoff}.2");
/* require(HEADERF);
$ns->tablerender(LAN_ERROR, LAN_dl_62);
require(FOOTERF); */
exit();
}
}
}
}
function decorate_download_location($url)
{
$pref = e107::getPref();
if ($pref['download_security_mode'] !== 'nginx-secure_link_md5')
return $url;
require_once(__DIR__."/handlers/NginxSecureLinkMd5Decorator.php");
$decorator = new NginxSecureLinkMd5Decorator($url, $pref);
return $decorator->decorate();
}
}
function decorate_download_location($url)
{
$pref = e107::getPref();
if ($pref['download_security_mode'] !== 'nginx-secure_link_md5')
return $url;
require_once(__DIR__."/handlers/NginxSecureLinkMd5Decorator.php");
$decorator = new NginxSecureLinkMd5Decorator($url, $pref);
return $decorator->decorate();
}
download_request::request();

View File

@ -8,7 +8,7 @@
*
*/
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
e107::lan('faqs', 'admin',true);
//TODO LANS

View File

@ -10,7 +10,7 @@
*
* if (!defined('e107_INIT'))
* {
* require_once("../../class2.php");
* require_once(__DIR__.'/../../class2.php');
* }
*
*/

View File

@ -12,7 +12,7 @@
if (!defined('e107_INIT'))
{
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
}
if(file_exists(e_PLUGIN."faqs/controllers/list.php")) // bc for old controller.

View File

@ -9,7 +9,7 @@
* Featurebox administration
*
*/
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
if (!getperms("P") || !e107::isInstalled('featurebox'))
{
e107::redirect('admin');
@ -290,5 +290,5 @@ require_once(e_ADMIN."auth.php");
e107::getAdminUI()->runPage();
require_once(e_ADMIN."footer.php");
exit;

View File

@ -10,7 +10,7 @@
*
* if (!defined('e107_INIT'))
* {
* require_once("../../class2.php");
* require_once(__DIR__.'/../../class2.php');
* }
*
*/

View File

@ -11,7 +11,7 @@
*/
if(!defined('e107_INIT'))
{
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
}
$e107 = e107::getInstance();
$tp = e107::getParser();
@ -214,82 +214,6 @@ foreach ($forumList['parents'] as $parent)
}
function parse_forum($f, $restricted_string = '')
{
global $FORUM_MAIN_FORUM, $forumList, $sc;
$tp = e107::getParser();
if(!empty($forumList['subs']) && is_array($forumList['subs'][$f['forum_id']]))
{
$lastPost = explode('.', $f['forum_lastpost_info']);
$lastpost_datestamp = reset($lastPost);
$ret = parse_subs($forumList, $f['forum_id'], $lastpost_datestamp);
$f['forum_threads'] += $ret['threads'];
$f['forum_replies'] += $ret['replies'];
if(isset($ret['lastpost_info']))
{
$f['forum_lastpost_info'] = $ret['lastpost_info'];
$f['forum_lastpost_user'] = $ret['lastpost_user'];
$f['forum_lastpost_user_anon'] = $ret['lastpost_user_anon'];
$f['user_name'] = $ret['user_name'];
}
$f['text'] = $ret['text'];
}
$sc->setVars($f);
$sc->wrapper('forum/main/forum');
return $tp->parseTemplate($FORUM_MAIN_FORUM, true, $sc);
}
function parse_subs($forumList, $id, $lastpost_datestamp)
{
$tp = e107::getParser();
$ret = array();
$subList = $forumList['subs'][$id];
$ret['text'] = '';
$ret['threads'] = 0;
$ret['replies'] = 0;
foreach($subList as $sub)
{
// print_a($sub);
$ret['text'] .= ($ret['text'] ? ', ' : '');
$urlData = $sub;
$urlData['parent_sef'] = $forumList['all'][$sub['forum_sub']]['forum_sef']; // = array('parent_sef'=>
$suburl = e107::url('forum','forum', $urlData);
$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']);
if($tmp[0] > $lastpost_datestamp)
{
$ret['lastpost_info'] = $sub['forum_lastpost_info'];
$ret['lastpost_user'] = $sub['forum_lastpost_user'];
$ret['lastpost_user_anon'] = $sub['forum_lastpost_user_anon'];
$ret['user_name'] = $sub['user_name'];
$lastpost_datestamp = $tmp[0];
}
}
return $ret;
}
//if (e_QUERY == 'track')
//{
@ -468,7 +392,7 @@ function forum_track()
$row['thread_sef'] = eHelper::title2sef($row['thread_name'],'dashl');
$data['NEWIMAGE'] = $IMAGE_nonew_small;
if ($row['thread_datestamp'] > USERLV && !in_array($row['thread_id'], $viewed))
{
$data['NEWIMAGE'] = $IMAGE_new_small;
@ -476,7 +400,7 @@ function forum_track()
$data['LASTPOSTUSER'] = !empty($row['user_name']) ? "<a href='".e107::url('user/profile/view', array('name' => $row['user_name'], 'id' => $row['thread_lastuser']))."'>".$row['user_name']."</a>" : LAN_ANONYMOUS;
$data['LASTPOSTDATE'] = $tp->toDate($row['thread_lastpost'],'relative');
$buttonId = "forum-track-button-".intval($row['thread_id']);
$forumUrl = e107::url('forum','forum',$row);
@ -538,3 +462,82 @@ function forum_track()
}
function parse_forum($f, $restricted_string = '')
{
global $FORUM_MAIN_FORUM, $forumList, $sc;
$tp = e107::getParser();
if(!empty($forumList['subs']) && is_array($forumList['subs'][$f['forum_id']]))
{
$lastPost = explode('.', $f['forum_lastpost_info']);
$lastpost_datestamp = reset($lastPost);
$ret = parse_subs($forumList, $f['forum_id'], $lastpost_datestamp);
$f['forum_threads'] += $ret['threads'];
$f['forum_replies'] += $ret['replies'];
if(isset($ret['lastpost_info']))
{
$f['forum_lastpost_info'] = $ret['lastpost_info'];
$f['forum_lastpost_user'] = $ret['lastpost_user'];
$f['forum_lastpost_user_anon'] = $ret['lastpost_user_anon'];
$f['user_name'] = $ret['user_name'];
}
$f['text'] = $ret['text'];
}
$sc->setVars($f);
$sc->wrapper('forum/main/forum');
return $tp->parseTemplate($FORUM_MAIN_FORUM, true, $sc);
}
function parse_subs($forumList, $id, $lastpost_datestamp)
{
$tp = e107::getParser();
$ret = array();
$subList = $forumList['subs'][$id];
$ret['text'] = '';
$ret['threads'] = 0;
$ret['replies'] = 0;
foreach($subList as $sub)
{
// print_a($sub);
$ret['text'] .= ($ret['text'] ? ', ' : '');
$urlData = $sub;
$urlData['parent_sef'] = $forumList['all'][$sub['forum_sub']]['forum_sef']; // = array('parent_sef'=>
$suburl = e107::url('forum','forum', $urlData);
$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']);
if($tmp[0] > $lastpost_datestamp)
{
$ret['lastpost_info'] = $sub['forum_lastpost_info'];
$ret['lastpost_user'] = $sub['forum_lastpost_user'];
$ret['lastpost_user_anon'] = $sub['forum_lastpost_user_anon'];
$ret['user_name'] = $sub['user_name'];
$lastpost_datestamp = $tmp[0];
}
}
return $ret;
}

View File

@ -9,7 +9,7 @@
*/
$eplug_admin = true;
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
if (!getperms('P'))
{
e107::redirect('admin');

View File

@ -1756,15 +1756,17 @@ class e107forum
$sql = e107::getDb();
$viewed = '';
if($e107->currentUser['user_plugin_forum_viewed'])
$forumViewed = e107::getUserExt()->get(USERID, 'user_plugin_forum_viewed' );
if($forumViewed)
{
$viewed = " AND thread_id NOT IN (".$e107->currentUser['user_plugin_forum_viewed'].")";
$viewed = " AND thread_id NOT IN (".$forumViewed.")";
}
$_newqry = '
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;
WHERE ft.thread_lastpost > '.defset('USERLV', strtotime('1 month ago') ).' '.$viewed;
$ret = array();

View File

@ -8,7 +8,7 @@
*
*/
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
$e107 = e107::getInstance();
if (!$e107->isInstalled('forum'))
{

View File

@ -13,7 +13,7 @@
if(!defined('e107_INIT'))
{
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
}
// Now defined in shortcodes that handle the editors

View File

@ -10,7 +10,7 @@
if(!defined('e107_INIT'))
{
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
}
if (!e107::isInstalled('forum'))

View File

@ -1,5 +1,5 @@
<?php
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
require_once(e_PLUGIN.'forum/forum_class.php');
$timestart = microtime();

View File

@ -8,7 +8,7 @@
*
*/
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
$e107 = e107::getInstance();
if (!$e107->isInstalled('forum'))
{

View File

@ -12,7 +12,7 @@
if(!defined('e107_INIT'))
{
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
}
$e107 = e107::getInstance();
if(!e107::isInstalled('forum'))

View File

@ -12,7 +12,7 @@
if(!defined('e107_INIT'))
{
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
}
e107::lan('forum', "front", true);

View File

@ -12,7 +12,7 @@
$eplug_admin = true;
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
if(!getperms("P") || !e107::isInstalled('gallery'))
{

View File

@ -10,7 +10,7 @@
*
* if (!defined('e107_INIT'))
* {
* require_once("../../class2.php");
* require_once(__DIR__.'/../../class2.php');
* }
*
*/

View File

@ -11,7 +11,7 @@
* Render gallery pages.
*/
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
if(!e107::isInstalled('gallery'))
{

View File

@ -9,7 +9,7 @@
* Plugin Administration - gsitemap
*
*/
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
if(!getperms("P") || !e107::isInstalled('gsitemap'))
{
e107::redirect('admin');

View File

@ -10,7 +10,7 @@
*
* if (!defined('e107_INIT'))
* {
* require_once("../../class2.php");
* require_once(__DIR__.'/../../class2.php');
* }
*
*/

View File

@ -2,7 +2,7 @@
// Generated e107 Plugin Admin Area
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
if (!getperms('P'))
{
e107::redirect('admin');

View File

@ -33,7 +33,7 @@ Options supported:
define('IMPORT_DEBUG',TRUE);
// define('IMPORT_DEBUG',TRUE);
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
// define("USE_PERSISTANT_DB",TRUE);

View File

@ -10,7 +10,7 @@
*
*/
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
if (!getperms('P') || !e107::isInstalled('linkwords'))
{

View File

@ -23,7 +23,7 @@
*/
//include and require several classes
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
if(!getperms("1") || !e107::isInstalled('list_new'))
{
e107::redirect('admin');

View File

@ -22,7 +22,7 @@
* @subpackage list_new
*/
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
if (!e107::isInstalled('list_new'))
{

View File

@ -10,7 +10,7 @@
*
*/
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
if (!getperms('P') || !e107::isInstalled('log'))
{

View File

@ -10,7 +10,7 @@
*
* if (!defined('e107_INIT'))
* {
* require_once("../../class2.php");
* require_once(__DIR__.'/../../class2.php');
* }
*
*/

View File

@ -25,7 +25,7 @@
//error_reporting(0);
// error_reporting(E_ALL);
define('e_MINIMAL',true);
require_once("../../class2.php"); // More secure to include it.
require_once(__DIR__.'/../../class2.php'); // More secure to include it.
header('Cache-Control: no-cache, must-revalidate'); // See if this discourages browser caching
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past

View File

@ -11,7 +11,7 @@
if (!defined('e107_INIT'))
{
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
}
if (!e107::isInstalled('log'))

View File

@ -17,7 +17,7 @@
//define('CSV_DEBUG', TRUE);
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
if (!getperms('P'))
{
e107::redirect();

View File

@ -25,7 +25,7 @@
$eplug_admin = TRUE;
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
if (!getperms('4'))
{
e107::redirect('admin');

View File

@ -10,7 +10,7 @@
*
* if (!defined('e107_INIT'))
* {
* require_once("../../class2.php");
* require_once(__DIR__.'/../../class2.php');
* }
*
*/

View File

@ -15,7 +15,7 @@
if (!defined('e107_INIT'))
{
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
}

View File

@ -10,7 +10,7 @@
// Generated e107 Plugin Admin Area
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
if (!getperms('P') || !e107::isInstalled('newsfeed'))
{
e107::redirect('admin');

View File

@ -10,7 +10,7 @@
*
* if (!defined('e107_INIT'))
* {
* require_once("../../class2.php");
* require_once(__DIR__.'/../../class2.php');
* }
*
*/

View File

@ -16,7 +16,7 @@
*/
if(!defined('e107_INIT'))
{
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
}
if (!e107::isInstalled('newsfeed'))

View File

@ -11,7 +11,7 @@
*/
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
if (!getperms('P'))
{
e107::redirect('admin');

View File

@ -10,7 +10,7 @@
*
*/
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
if (!e107::isInstalled('newsletter') || !ADMIN)
{
e107::redirect();

View File

@ -11,7 +11,7 @@
*/
$eplug_admin = TRUE;
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
e107::includeLan(e_PLUGIN.'online/languages/'.e_LANGUAGE.'.php');
if (!getperms('1'))

View File

@ -2,7 +2,7 @@
// Generated e107 Plugin Admin Area
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
if (!getperms('P'))
{
e107::redirect('admin');

View File

@ -10,7 +10,7 @@
*
* if (!defined('e107_INIT'))
* {
* require_once("../../class2.php");
* require_once(__DIR__.'/../../class2.php');
* }
*
*/

View File

@ -22,7 +22,7 @@
$retrieve_prefs[] = 'pm_prefs';
if(!defined('e107_INIT'))
{
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
}

View File

@ -33,7 +33,7 @@ TODO:
$retrieve_prefs[] = 'pm_prefs';
$eplug_admin = TRUE;
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
if (!e107::isInstalled('pm') || !getperms('P'))
{

View File

@ -8,7 +8,7 @@
*
*/
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
if (!is_object($tp)) $tp = new e_parse;
if (!getperms("P") || !e107::isInstalled('poll'))
{

View File

@ -8,7 +8,7 @@
*
*/
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
if (!e107::isInstalled('poll'))
{
e107::redirect();

View File

@ -12,7 +12,7 @@
* $Id$
*/
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
if (!e107::isInstalled('poll'))
{
e107::redirect();

View File

@ -18,7 +18,7 @@ Notes:
- using $caption = "whatever", is unneccessary.
*/
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
if(!getperms("P") || !e107::isInstalled('rss_menu'))
{

View File

@ -26,7 +26,7 @@ if (!defined('e107_INIT'))
$_E107['minimal'] = true;
}
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
}
$e107 = e107::getInstance();

View File

@ -2,7 +2,7 @@
// Generated e107 Plugin Admin Area
require_once('../../class2.php');
require_once(__DIR__.'/../../class2.php');
if (!getperms('P'))
{
e107::redirect('admin');

View File

@ -8,7 +8,7 @@
*
*
*/
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
if( !e107::isInstalled('tinymce4'))
{
e107::redirect('admin');

View File

@ -11,7 +11,7 @@ $_E107['no_online'] = true;
$_E107['no_forceuserupdate'] = true;
$_E107['no_menus'] = true;
$_E107['no_maintenance'] = true;
require_once("../../class2.php"); //TODO Prevent Theme loading.
require_once(__DIR__.'/../../class2.php'); //TODO Prevent Theme loading.
/*
echo '

View File

@ -9,7 +9,7 @@
*/
$eplug_admin = TRUE;
require_once("../../class2.php");
require_once(__DIR__.'/../../class2.php');
e107::includeLan(e_PLUGIN."user_menu/languages/".e_LANGUAGE.".php");
require_once(e_HANDLER.'userclass_class.php');

View File

@ -133,6 +133,50 @@
}
public function testPluginScripts()
{
$core = e107::getPlug()->getCorePluginList();
foreach($core as $plug)
{
$parm = null; //
e107::plugLan($plug, 'global'); // load global language (usually done in class2.php)
e107::getConfig()->setPref('plug_installed/'.$plug, 1); // simulate installed.
$path = e_PLUGIN.$plug;
$files = scandir($path);
unset($files[0], $files[1]); // . and ..
foreach($files as $f)
{
$filePath = $path.'/'.$f;
if(is_dir($filePath) || (strpos($f, '_sql.php') !== false) || strpos($f, '.php') === false)
{
continue;
}
echo " --- ".$filePath." --- \n";
ob_start();
require_once( $filePath);
ob_end_clean();
// echo $plug.'/'.$f."\n";
}
}
}
/**
* @see https://github.com/e107inc/e107/issues/3547