mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 01:19:44 +01:00
Shortcode path fixes
This commit is contained in:
parent
2d835f43d0
commit
caa79b6454
92
class2.php
92
class2.php
@ -93,7 +93,7 @@ if($register_globals == true)
|
||||
// MOVED TO $e107->prepare_request()
|
||||
// TODO - better ajax detection method (headers when possible)
|
||||
//define('e_AJAX_REQUEST', isset($_REQUEST['ajax_used']));
|
||||
//unset($_REQUEST['ajax_used']); // removed because it's auto-appended from JS (AJAX), could break something...
|
||||
//unset($_REQUEST['ajax_used']); // removed because it's auto-appended from JS (AJAX), could break something...
|
||||
//
|
||||
//if(isset($_E107['minimal']) || e_AJAX_REQUEST)
|
||||
//{
|
||||
@ -331,7 +331,7 @@ if (!$ADMIN_DIRECTORY && !$DOWNLOADS_DIRECTORY)
|
||||
// J: MYSQL INITIALIZATION
|
||||
//
|
||||
e107::getSingleton('e107_traffic'); // We start traffic counting ASAP
|
||||
//$eTraffic->Calibrate($eTraffic);
|
||||
//$eTraffic->Calibrate($eTraffic);
|
||||
|
||||
e107_require_once(e_HANDLER.'mysql_class.php');
|
||||
|
||||
@ -437,7 +437,7 @@ $pref = e107::getPref();
|
||||
|
||||
//this could be part of e107->init() method now, prefs will be auto-initialized
|
||||
//when proper called (e107::getPref())
|
||||
// $e107->set_base_path(); moved to init().
|
||||
// $e107->set_base_path(); moved to init().
|
||||
|
||||
//DEPRECATED, BC, call e107::getConfig('menu')->get('pref_name') only when needed
|
||||
$menu_pref = e107::getConfig('menu')->getPref(); //extract menu prefs
|
||||
@ -736,8 +736,8 @@ if(isset($pref['notify']) && $pref['notify'] == true)
|
||||
$sql -> db_Mark_Time('Start: Init session');
|
||||
init_session();
|
||||
|
||||
//DEPRECATED but necessary. BC Fix.
|
||||
function getip()
|
||||
//DEPRECATED but necessary. BC Fix.
|
||||
function getip()
|
||||
{
|
||||
return e107::ipDecode(USERIP);
|
||||
}
|
||||
@ -1019,14 +1019,14 @@ define('TIMEOFFSET', $e_deltaTime);
|
||||
$sql->db_Mark_Time('(Start: Find/Load Theme)');
|
||||
|
||||
if(e_ADMIN_AREA) // Load admin phrases ASAP
|
||||
{
|
||||
{
|
||||
e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_admin.php');
|
||||
}
|
||||
|
||||
|
||||
if(!defined('THEME'))
|
||||
{
|
||||
|
||||
|
||||
if (e_ADMIN_AREA && varsettrue($pref['admintheme']))
|
||||
{
|
||||
//We have now e_IFRAME mod and USER_AREA force
|
||||
@ -1315,8 +1315,8 @@ function getperms($arg, $ap = ADMINPERMS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($ap === '0' || $ap === '0.') // BC fix.
|
||||
|
||||
if ($ap === '0' || $ap === '0.') // BC fix.
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -1324,14 +1324,14 @@ function getperms($arg, $ap = ADMINPERMS)
|
||||
if ($arg == 'P' && preg_match("#(.*?)/".e107::getInstance()->getFolder('plugins')."(.*?)/(.*?)#", e_SELF, $matches))
|
||||
{
|
||||
$sql = e107::getDb('psql');
|
||||
|
||||
|
||||
if ($sql->db_Select('plugin', 'plugin_id', "plugin_path = '".$matches[2]."' LIMIT 1 "))
|
||||
{
|
||||
$row = $sql->db_Fetch();
|
||||
$arg = 'P'.$row['plugin_id'];
|
||||
$arg = 'P'.$row['plugin_id'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$ap_array = explode('.',$ap);
|
||||
|
||||
if(in_array($arg,$ap_array))
|
||||
@ -1574,17 +1574,17 @@ function init_session()
|
||||
# - return boolean
|
||||
# - scope public
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
global $pref, $user_pref, $currentUser, $e107, $_E107;
|
||||
|
||||
|
||||
$sql = e107::getDb();
|
||||
$tp = e107::getParser();
|
||||
$eArrayStorage = e107::getArrayStorage();
|
||||
|
||||
|
||||
|
||||
define('USERIP', $e107->getip());
|
||||
|
||||
|
||||
if(varset($_E107['cli']))
|
||||
{
|
||||
define('USER', true);
|
||||
@ -1596,7 +1596,7 @@ function init_session()
|
||||
define('USERCLASS', '');
|
||||
define('USEREMAIL', '');
|
||||
define('USERCLASS_LIST', '');
|
||||
define('USERCLASS', '');
|
||||
define('USERCLASS', '');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1624,7 +1624,7 @@ function init_session()
|
||||
if (empty($uid) || empty($upw))
|
||||
{
|
||||
//$_SESSION[] = e_SELF."?".e_QUERY;
|
||||
|
||||
|
||||
cookie(e_COOKIE, '', (time() - 2592000));
|
||||
$_SESSION[e_COOKIE] = "";
|
||||
session_destroy();
|
||||
@ -1688,7 +1688,7 @@ function init_session()
|
||||
define('ADMINEMAIL', $result['user_email']);
|
||||
define('ADMINPWCHANGE', $result['user_pwchange']);
|
||||
e107::getRedirect()->setPreviousUrl();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2096,54 +2096,54 @@ function plugInstalled($plugname)
|
||||
|
||||
/**
|
||||
* Magic class autoload.
|
||||
* We are raising plugin structure standard here - plugin auto-loading works ONLY if
|
||||
* We are raising plugin structure standard here - plugin auto-loading works ONLY if
|
||||
* classes live inside 'includes' folder.
|
||||
* Example: plugin_myplug_admin_ui ->
|
||||
* Example: plugin_myplug_admin_ui ->
|
||||
* <code>
|
||||
* <?php
|
||||
* // __autoload() will look in e_PLUGIN.'myplug/includes/admin/ui.php for this class
|
||||
* // e_admin_ui is core handler, so it'll be autoloaded as well
|
||||
* class plugin_myplug_admin_ui extends e_admin_ui
|
||||
* {
|
||||
*
|
||||
*
|
||||
* }
|
||||
*
|
||||
*
|
||||
* // __autoload() will look in e_PLUGIN.'myplug/shortcodes/my_shortcodes.php for this class
|
||||
* // e_admin_ui is core handler, so it'll be autoloaded as well
|
||||
* class plugin_myplug_my_shortcodes extends e_admin_ui
|
||||
* {
|
||||
*
|
||||
*
|
||||
* }
|
||||
* </code>
|
||||
* TODO - use spl_autoload[_*] for core autoloading some day (PHP5 > 5.1.2)
|
||||
* TODO - at this time we could create e107 version of spl_autoload_register - e_event->register/trigger('autoload')
|
||||
*
|
||||
* @todo plugname/e_shortcode.php auto-detection (hard, near impossible at this time) - we need 'plugin_' prefix to
|
||||
* distinguish them from the core batches
|
||||
*
|
||||
*
|
||||
* @todo plugname/e_shortcode.php auto-detection (hard, near impossible at this time) - we need 'plugin_' prefix to
|
||||
* distinguish them from the core batches
|
||||
*
|
||||
* @param string $className
|
||||
* @return void
|
||||
*/
|
||||
function __autoload($className)
|
||||
function __autoload($className)
|
||||
{
|
||||
//Security...
|
||||
if (strpos($className, '/') !== false)
|
||||
if (strpos($className, '/') !== false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
$tmp = explode('_', $className);
|
||||
$filename = '';
|
||||
|
||||
|
||||
switch($tmp[0])
|
||||
{
|
||||
case 'plugin': // plugin handlers/shortcode batches
|
||||
array_shift($tmp); // remove 'plugin'
|
||||
$end = array_pop($tmp); // check for 'shortcodes' end phrase
|
||||
|
||||
|
||||
if (!isset($tmp[0]) || !$tmp[0]) return; // In case we get an empty class part
|
||||
|
||||
// Currently only batches inside shortcodes/ folder are auto-detected,
|
||||
// read the todo for e_shortcode.php related problems
|
||||
|
||||
// Currently only batches inside shortcodes/ folder are auto-detected,
|
||||
// read the todo for e_shortcode.php related problems
|
||||
if('shortcodes' == $end)
|
||||
{
|
||||
$filename = e_PLUGIN.$tmp[0].'/shortcodes/'; // plugname/shortcodes/
|
||||
@ -2155,35 +2155,35 @@ function __autoload($className)
|
||||
{
|
||||
$tmp[] = $end; // not a shortcode batch - append the end phrase again
|
||||
}
|
||||
|
||||
// Handler check
|
||||
$tmp[0] .= '/includes'; //folder 'includes' is not part of the class name
|
||||
|
||||
// Handler check
|
||||
$tmp[0] .= '/includes'; //folder 'includes' is not part of the class name
|
||||
$filename = e_PLUGIN.implode('/', $tmp).'.php';
|
||||
//TODO add debug screen Auto-loaded classes - ['plugin: '.$filename.' - '.$className];
|
||||
break;
|
||||
|
||||
|
||||
default: //core libraries, core shortcode batches
|
||||
// core SC batch check
|
||||
$end = array_pop($tmp);
|
||||
if('shortcodes' == $end)
|
||||
if('shortcodes' == $end)
|
||||
{
|
||||
$filename = e_FILE.'shortcode/batch/'.$className.'.php'; // core shortcode batch
|
||||
$filename = e_CORE.'shortcodes/batch/'.$className.'.php'; // core shortcode batch
|
||||
break;
|
||||
}
|
||||
|
||||
$filename = e107::getHandlerPath($className, true);
|
||||
$filename = e107::getHandlerPath($className, true);
|
||||
//TODO add debug screen Auto-loaded classes - ['core: '.$filename.' - '.$className];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if($filename)
|
||||
{
|
||||
// autoload doesn't REQUIRE files, because this will break things like call_user_func()
|
||||
include($filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// register __autoload if possible to prevent its override by
|
||||
// register __autoload if possible to prevent its override by
|
||||
// 3rd party spl_autoload_register calls
|
||||
if(function_exists('spl_autoload_register'))
|
||||
{
|
||||
|
@ -154,7 +154,7 @@ if(SITECONTACTINFO && $CONTACT_INFO)
|
||||
|
||||
if(isset($pref['sitecontacts']) && $pref['sitecontacts'] != 255)
|
||||
{
|
||||
require_once(e_FILE."shortcode/batch/contact_shortcodes.php");
|
||||
require_once(e_CORE."shortcodes/batch/contact_shortcodes.php");
|
||||
$text = $tp->parseTemplate($CONTACT_FORM, TRUE, $contact_shortcodes);
|
||||
|
||||
if(trim($text) != "")
|
||||
|
@ -77,7 +77,7 @@ if(isset($_POST['exportXmlFile']))
|
||||
$emessage = eMessage::getInstance();
|
||||
$emessage->add(LAN_SUCCESS, E_MESSAGE_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
require_once ("auth.php");
|
||||
@ -86,7 +86,7 @@ $frm = new e_form();
|
||||
$st = new system_tools;
|
||||
|
||||
|
||||
/* No longer needed after XML feature added.
|
||||
/* No longer needed after XML feature added.
|
||||
|
||||
if(isset($_POST['backup_core']) || $_GET['mode']=='backup_core')
|
||||
{
|
||||
@ -111,14 +111,14 @@ require_once ("footer.php");
|
||||
|
||||
class system_tools
|
||||
{
|
||||
|
||||
|
||||
public $_options = array();
|
||||
|
||||
|
||||
|
||||
|
||||
function __construct()
|
||||
{
|
||||
global $mySQLdefaultdb;
|
||||
|
||||
|
||||
$this->_options = array(
|
||||
"db_update" => array('diz'=>DBLAN_15, 'label'=>DBLAN_16),
|
||||
"verify_sql" => array('diz'=>DBLAN_4, 'label'=>DBLAN_5),
|
||||
@ -132,90 +132,90 @@ class system_tools
|
||||
'sc_override_scan' => array('diz'=>DBLAN_55, 'label'=> DBLAN_56),
|
||||
'convert_to_utf8' => array('diz'=>'Convert Database to UTF-8','label'=>'Convert DB to UTF-8')
|
||||
);
|
||||
|
||||
//TODO Merge db_verify.php into db.php
|
||||
|
||||
|
||||
|
||||
//TODO Merge db_verify.php into db.php
|
||||
|
||||
|
||||
|
||||
if(isset($_POST['delplug']))
|
||||
{
|
||||
$this->delete_plugin_entry($_POST['pref_type']);
|
||||
$this->delete_plugin_entry($_POST['pref_type']);
|
||||
}
|
||||
|
||||
|
||||
if(isset($_POST['upload']))
|
||||
{
|
||||
$this->importXmlFile();
|
||||
{
|
||||
$this->importXmlFile();
|
||||
}
|
||||
|
||||
|
||||
if(isset($_POST['delpref']) || (isset($_POST['delpref_checked']) && isset($_POST['delpref2'])))
|
||||
{
|
||||
$this->del_pref_val($_POST['pref_type']);
|
||||
}
|
||||
|
||||
|
||||
if(isset($_POST['verify_sql_record']) || varset($_GET['mode'])=='verify_sql_record' || isset($_POST['check_verify_sql_record']) || isset($_POST['delete_verify_sql_record']))
|
||||
{
|
||||
// $this->verify_sql_record(); - currently performed in db_verify.php
|
||||
}
|
||||
|
||||
|
||||
if(isset($_POST['importForm']) || $_GET['mode']=='importForm')
|
||||
{
|
||||
$this->importForm();
|
||||
$this->importForm();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(isset($_POST['convert_to_utf8']) || $_GET['mode']=='convert_to_utf8')
|
||||
{
|
||||
$this->convertUTF8Form();
|
||||
$this->convertUTF8Form();
|
||||
}
|
||||
|
||||
|
||||
if(isset($_POST['exportForm']) || $_GET['mode']=='exportForm')
|
||||
{
|
||||
$this->exportXmlForm();
|
||||
$this->exportXmlForm();
|
||||
}
|
||||
|
||||
if(isset($_POST['optimize_sql']) || $_GET['mode']=='optimize_sql')
|
||||
{
|
||||
$this->optimizesql($mySQLdefaultdb);
|
||||
}
|
||||
|
||||
|
||||
if(isset($_POST['pref_editor']) || $_GET['mode']=='pref_editor' || isset($_POST['delpref']) || isset($_POST['delpref_checked']))
|
||||
{
|
||||
$type = isset($_GET['type']) ? $_GET['type'] : "core";
|
||||
$this->pref_editor($type);
|
||||
}
|
||||
|
||||
|
||||
if(isset($_POST['sc_override_scan']) || $_GET['mode']=='sc_override_scan')
|
||||
{
|
||||
$this->scan_override();
|
||||
}
|
||||
|
||||
|
||||
if(isset($_POST['plugin_scan']) || e_QUERY == "plugin" || isset($_POST['delplug']) || $_GET['mode']=='plugin_scan')
|
||||
{
|
||||
$this->plugin_viewscan();
|
||||
}
|
||||
|
||||
|
||||
if(vartrue($_POST['perform_utf8_convert']))
|
||||
{
|
||||
$this->perform_utf8_convert();
|
||||
}
|
||||
|
||||
|
||||
if(!vartrue($_GET['mode']))
|
||||
{
|
||||
{
|
||||
$this->render_options();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function convertUTF8Form()
|
||||
{
|
||||
$emessage = e107::getMessage();
|
||||
$frm = e107::getForm();
|
||||
//TODO a function to call the e107_config information in e107_class.php.
|
||||
require(e_BASE."e107_config.php");
|
||||
//TODO a function to call the e107_config information in e107_class.php.
|
||||
require(e_BASE."e107_config.php");
|
||||
$dbtable = $mySQLdefaultdb;
|
||||
|
||||
|
||||
//TODO LAN
|
||||
$message = '
|
||||
This function will permanently modify all tables in your database. ('.$mySQLdefaultdb.')<br />
|
||||
@ -234,7 +234,7 @@ class system_tools
|
||||
<strong>Be sure</strong> you followed all steps of the upgrade process first.</li>
|
||||
<li>It should work without troubles for databases of sites using only UTF-8 charset. Probably not with other charsets.</li>
|
||||
<li>The function uses the information_schema database for now.</li>
|
||||
</ul>
|
||||
</ul>
|
||||
';
|
||||
|
||||
$emessage->add($message, E_MESSAGE_WARNING);
|
||||
@ -248,70 +248,70 @@ class system_tools
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>";
|
||||
|
||||
e107::getRender()->tablerender("Convert Database to UTF-8", $emessage->render().$text);
|
||||
|
||||
|
||||
e107::getRender()->tablerender("Convert Database to UTF-8", $emessage->render().$text);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function perform_utf8_convert()
|
||||
{
|
||||
require(e_BASE."e107_config.php");
|
||||
|
||||
|
||||
$dbtable = $mySQLdefaultdb;
|
||||
|
||||
//TODO Add a check to be sure the database is not already utf-8.
|
||||
|
||||
//TODO Add a check to be sure the database is not already utf-8.
|
||||
// yep, needs more methods - possibly a class in e107_handler
|
||||
|
||||
$sql = e107::getDb();
|
||||
|
||||
$sql = e107::getDb();
|
||||
$mes = e107::getMessage();
|
||||
|
||||
|
||||
$ERROR = FALSE;
|
||||
|
||||
|
||||
if(!mysql_query("USE information_schema;"))
|
||||
{
|
||||
$mes->add("Couldn't read information_schema", E_MESSAGE_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
$queries = array();
|
||||
|
||||
$queries = array();
|
||||
$queries[] = $this->getQueries("SELECT CONCAT('ALTER TABLE ', table_name, ' MODIFY ', column_name, ' ', REPLACE(column_type, 'char', 'binary'), ';') FROM columns WHERE table_schema = '".$dbtable."' and data_type LIKE '%char%';");
|
||||
$queries[] = $this->getQueries("SELECT CONCAT('ALTER TABLE ', table_name, ' MODIFY ', column_name, ' ', REPLACE(column_type, 'text', 'blob'), ';') FROM columns WHERE table_schema = '".$dbtable."' and data_type LIKE '%text%';");
|
||||
|
||||
$queries2 = array();
|
||||
|
||||
$queries2 = array();
|
||||
$queries2[] = $this->getQueries("SELECT CONCAT('ALTER TABLE ', table_name, ' MODIFY ', column_name, ' ', column_type, ' CHARACTER SET utf8;') FROM columns WHERE table_schema = '".$dbtable."' and data_type LIKE '%char%';");
|
||||
$queries2[] = $this->getQueries("SELECT CONCAT('ALTER TABLE ', table_name, ' MODIFY ', column_name, ' ', column_type, ' CHARACTER SET utf8;') FROM columns WHERE table_schema = '".$dbtable."' and data_type LIKE '%text%';");
|
||||
|
||||
|
||||
|
||||
|
||||
mysql_query("USE ".$dbtable);
|
||||
|
||||
|
||||
foreach($queries as $qry)
|
||||
{
|
||||
foreach($qry as $q)
|
||||
{
|
||||
if(!$sql->db_Query($q))
|
||||
{
|
||||
$mes->add($q, E_MESSAGE_ERROR);
|
||||
$mes->add($q, E_MESSAGE_ERROR);
|
||||
$ERROR = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------
|
||||
|
||||
|
||||
$result = mysql_list_tables($dbtable);
|
||||
while ($row = mysql_fetch_array($result, MYSQL_NUM))
|
||||
{
|
||||
$table = $row[0];
|
||||
$table = $row[0];
|
||||
$tab_query = "ALTER TABLE ".$table." charset=utf8; ";
|
||||
if(!$sql->db_Query($tab_query))
|
||||
{
|
||||
$mes->add($tab_query, E_MESSAGE_ERROR);
|
||||
$ERROR = TRUE;
|
||||
$mes->add($tab_query, E_MESSAGE_ERROR);
|
||||
$ERROR = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ---------------
|
||||
|
||||
|
||||
foreach($queries2 as $qry)
|
||||
{
|
||||
foreach($qry as $q)
|
||||
@ -319,32 +319,32 @@ class system_tools
|
||||
if(!$sql->db_Query($q))
|
||||
{
|
||||
$mes->add($q, E_MESSAGE_ERROR);
|
||||
$ERROR = TRUE;
|
||||
$ERROR = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------
|
||||
|
||||
|
||||
$lastQry = "ALTER DATABASE `".$dbtable."` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;";
|
||||
|
||||
|
||||
if(!$sql->db_Query($lastQry))
|
||||
{
|
||||
$mes->add($lastQry, E_MESSAGE_ERROR);
|
||||
$mes->add($lastQry, E_MESSAGE_ERROR);
|
||||
}
|
||||
elseif($ERROR != TRUE)
|
||||
{
|
||||
$message = "Database Converted successfully to UTF-8. <br />
|
||||
Please now add the following line to your e107_config.php file:<br />
|
||||
Please now add the following line to your e107_config.php file:<br />
|
||||
<b>\$mySQLcharset = 'utf8';</b>
|
||||
";
|
||||
|
||||
$mes->add($message, E_MESSAGE_SUCCESS);
|
||||
|
||||
$mes->add($message, E_MESSAGE_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getQueries($query)
|
||||
{
|
||||
if(!$result = mysql_query($query))
|
||||
@ -354,49 +354,49 @@ class system_tools
|
||||
}
|
||||
while ($row = mysql_fetch_array($result, MYSQL_NUM))
|
||||
{
|
||||
$qry[] = $row[0];
|
||||
$qry[] = $row[0];
|
||||
}
|
||||
|
||||
return $qry;
|
||||
|
||||
return $qry;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete selected preferences.
|
||||
* Delete selected preferences.
|
||||
* @return none
|
||||
*/
|
||||
*/
|
||||
private function del_pref_val($mode='core')
|
||||
{
|
||||
global $emessage;
|
||||
|
||||
|
||||
$deleted_list = "";
|
||||
|
||||
|
||||
$config = ($mode == 'core' || $mode='') ? e107::getConfig('core') : e107::getPlugConfig($mode);
|
||||
|
||||
|
||||
// Single Pref Deletion using button
|
||||
if(varset($_POST['delpref']))
|
||||
{
|
||||
$delpref = key($_POST['delpref']);
|
||||
if($config->remove($delpref))
|
||||
{
|
||||
$deleted_list .= "<li>".$delpref."</li>";
|
||||
}
|
||||
$deleted_list .= "<li>".$delpref."</li>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Multiple Pref deletion using checkboxes
|
||||
if(varset($_POST['delpref2']))
|
||||
{
|
||||
{
|
||||
foreach($_POST['delpref2'] as $k => $v)
|
||||
{
|
||||
if($config->remove($k))
|
||||
{
|
||||
$deleted_list .= "<li>".$k."</li>";
|
||||
}
|
||||
$deleted_list .= "<li>".$k."</li>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($deleted_list && $config->save())
|
||||
{
|
||||
{
|
||||
$emessage->add(LAN_DELETED."<ul>".$deleted_list."</ul>");
|
||||
e107::getCache()->clear();
|
||||
}
|
||||
@ -406,7 +406,7 @@ class system_tools
|
||||
private function delete_plugin_entry()
|
||||
{
|
||||
global $sql, $emessage;
|
||||
|
||||
|
||||
$del = array_keys($_POST['delplug']);
|
||||
if($sql->db_Delete("plugin", "plugin_id='".intval($del[0])."' LIMIT 1"))
|
||||
{
|
||||
@ -416,7 +416,7 @@ class system_tools
|
||||
{
|
||||
$emessage->add(LAN_DELETED_FAILED, E_MESSAGE_WARNING);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -424,11 +424,11 @@ class system_tools
|
||||
/**
|
||||
* Render Options
|
||||
* @return none
|
||||
*/
|
||||
*/
|
||||
private function render_options()
|
||||
{
|
||||
$frm = e107::getSingleton('e_form');
|
||||
|
||||
|
||||
$text = "
|
||||
<form method='post' action='".e_SELF."' id='core-db-main-form'>
|
||||
<fieldset id='core-db-plugin-scan'>
|
||||
@ -439,7 +439,7 @@ class system_tools
|
||||
<col style='width: 40%'></col>
|
||||
</colgroup>
|
||||
<tbody>";
|
||||
|
||||
|
||||
foreach($this->_options as $key=>$val)
|
||||
{
|
||||
$text .= "<tr>
|
||||
@ -447,12 +447,12 @@ class system_tools
|
||||
<td>
|
||||
".$frm->radio('db_execute', $key).$frm->label($val['label'], 'db_execute', $key)."
|
||||
</td>
|
||||
</tr>\n";
|
||||
|
||||
}
|
||||
|
||||
</tr>\n";
|
||||
|
||||
}
|
||||
|
||||
$text .= "
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<div class='buttons-bar center'>
|
||||
@ -461,36 +461,36 @@ class system_tools
|
||||
</fieldset>
|
||||
</form>
|
||||
";
|
||||
|
||||
|
||||
$emessage = eMessage::getInstance();
|
||||
e107::getRender()->tablerender(DBLAN_10, $emessage->render().$text);
|
||||
e107::getRender()->tablerender(DBLAN_10, $emessage->render().$text);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Import XML Form
|
||||
* @return none
|
||||
*/
|
||||
*/
|
||||
private function importForm()
|
||||
{
|
||||
// Get largest allowable file upload
|
||||
|
||||
|
||||
$frm = e107::getSingleton('e_form');
|
||||
|
||||
|
||||
|
||||
|
||||
require_once(e_HANDLER.'upload_handler.php');
|
||||
$max_file_size = get_user_max_upload();
|
||||
|
||||
|
||||
$text = "
|
||||
<form enctype='multipart/form-data' method='post' action='".e_SELF."?mode=".$_GET['mode']."'>
|
||||
<table cellpadding='0' cellspacing='0' class='adminform'>
|
||||
|
||||
|
||||
<colgroup span='2'>
|
||||
<col class='col-label' />
|
||||
<col class='col-control' />
|
||||
</colgroup>
|
||||
|
||||
|
||||
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>".LAN_UPLOAD."</td>
|
||||
@ -502,138 +502,138 @@ class system_tools
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<div class='center buttons-bar'>";
|
||||
$text .= $frm->admin_button('upload', LAN_UPLOAD, 'submit', LAN_UPLOAD);
|
||||
|
||||
|
||||
$text .= "
|
||||
</div>
|
||||
|
||||
|
||||
</form>\n";
|
||||
|
||||
|
||||
$emessage = eMessage::getInstance();
|
||||
e107::getRender()->tablerender(DBLAN_59, $emessage->render().$text);
|
||||
|
||||
e107::getRender()->tablerender(DBLAN_59, $emessage->render().$text);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Export XML Dump
|
||||
* @return none
|
||||
*/
|
||||
*/
|
||||
private function exportXmlForm()
|
||||
{
|
||||
$emessage = eMessage::getInstance();
|
||||
$frm = e107::getSingleton('e_form');
|
||||
|
||||
|
||||
|
||||
|
||||
//TODO LANs
|
||||
|
||||
|
||||
$text = "<form method='post' action='".e_SELF."?".e_QUERY."' id='core-db-export-form'>
|
||||
<fieldset id='core-db-export'>
|
||||
<legend class='e-hideme'>Export Options</legend>
|
||||
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
||||
<colgroup span='2'>
|
||||
|
||||
|
||||
<col style='width: 80%'></col>
|
||||
<col style='width: 20%'></col>
|
||||
</colgroup>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>".$frm->checkbox_toggle('check-all-verify', 'xml_prefs')." Preferences</th>
|
||||
<th class='right'>Rows</th>
|
||||
|
||||
</tr>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
|
||||
";
|
||||
|
||||
|
||||
$pref_types = e107::getConfig()->aliases;
|
||||
unset($pref_types['core_old'],$pref_types['core_backup']);
|
||||
unset($pref_types['core_old'],$pref_types['core_backup']);
|
||||
// $exclusions = array('core_old'=>1,'core_backup'=>1);
|
||||
// $filteredprefs = array_diff($pref_types,$exclusions);
|
||||
|
||||
|
||||
foreach($pref_types as $key=>$description)
|
||||
{
|
||||
$checked = ($_POST['xml_prefs'][$key] == $key) ? 1: 0;
|
||||
$checked = ($_POST['xml_prefs'][$key] == $key) ? 1: 0;
|
||||
|
||||
$text .= "<tr>
|
||||
<td>
|
||||
".$frm->checkbox("xml_prefs[".$key."]", $key, $checked)."
|
||||
".LAN_PREFS.": ".$key."</td>
|
||||
<td> </td>
|
||||
|
||||
|
||||
</tr>";
|
||||
|
||||
|
||||
}
|
||||
$text .= "</tbody>
|
||||
</table>
|
||||
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
||||
|
||||
|
||||
<colgroup span='2'>
|
||||
|
||||
|
||||
<col style='width: 80%'></col>
|
||||
<col style='width: 20%'></col>
|
||||
</colgroup>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>".$frm->checkbox_toggle('check-all-verify', 'xml_tables')."Tables</th>
|
||||
<th class='right'>Rows</th>
|
||||
|
||||
</tr>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>\n";
|
||||
|
||||
|
||||
$tables = table_list();
|
||||
|
||||
|
||||
foreach($tables as $name=>$count)
|
||||
{
|
||||
$checked = ($_POST['xml_tables'][$name] == $name) ? 1: 0;
|
||||
$text .= "<tr>
|
||||
{
|
||||
$checked = ($_POST['xml_tables'][$name] == $name) ? 1: 0;
|
||||
$text .= "<tr>
|
||||
<td>
|
||||
".$frm->checkbox("xml_tables[".$name."]", $name, $checked)." Table Data: ".$name."
|
||||
".$frm->checkbox("xml_tables[".$name."]", $name, $checked)." Table Data: ".$name."
|
||||
</td>
|
||||
<td class='right'>$count</td>
|
||||
</tr>";
|
||||
}
|
||||
|
||||
|
||||
$text .="
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
||||
<colgroup span='2'>
|
||||
|
||||
|
||||
<col style='width: 80%'></col>
|
||||
<col style='width: 20%'></col>
|
||||
</colgroup>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan='2'>".LAN_OPTIONS."</th>
|
||||
</tr>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan='2'>";
|
||||
$checked = (vartrue($_POST['package_images'])) ? 1: 0;
|
||||
$text .= $frm->checkbox("package_images",'package_images', $checked)." Convert paths and package images and xml into: <i>".e107::getParser()->replaceConstants(EXPORT_PATH)."</i>
|
||||
|
||||
$checked = (vartrue($_POST['package_images'])) ? 1: 0;
|
||||
$text .= $frm->checkbox("package_images",'package_images', $checked)." Convert paths and package images and xml into: <i>".e107::getParser()->replaceConstants(EXPORT_PATH)."</i>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<div class='buttons-bar center'>
|
||||
".$frm->admin_button('exportXmlFile', "Export File", 'exportXmlFile')."
|
||||
</div>
|
||||
</fieldset>
|
||||
</form> ";
|
||||
|
||||
|
||||
e107::getRender()->tablerender("Export Options",$emessage->render(). $text);
|
||||
|
||||
|
||||
|
||||
|
||||
e107::getRender()->tablerender("Export Options",$emessage->render(). $text);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -646,15 +646,15 @@ class system_tools
|
||||
|
||||
foreach($ret['success'] as $table)
|
||||
{
|
||||
eMessage::getInstance()->add("Inserted $table", E_MESSAGE_SUCCESS);
|
||||
eMessage::getInstance()->add("Inserted $table", E_MESSAGE_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
foreach($ret['failed'] as $table)
|
||||
{
|
||||
eMessage::getInstance()->add("Failed to Insert $table", E_MESSAGE_ERROR);
|
||||
}
|
||||
eMessage::getInstance()->add("Failed to Insert $table", E_MESSAGE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Optimize SQL
|
||||
* @return none
|
||||
@ -667,11 +667,11 @@ class system_tools
|
||||
{
|
||||
mysql_query("OPTIMIZE TABLE ".$row[0]);
|
||||
}
|
||||
|
||||
|
||||
// $emessage->add(DBLAN_11." $mySQLdefaultdb ".DBLAN_12, E_MESSAGE_SUCCESS);
|
||||
e107::getRender()->tablerender(DBLAN_7, DBLAN_11." $mySQLdefaultdb ".DBLAN_12);
|
||||
e107::getRender()->tablerender(DBLAN_7, DBLAN_11." $mySQLdefaultdb ".DBLAN_12);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Preferences Editor
|
||||
* @return string text for display
|
||||
@ -679,36 +679,36 @@ class system_tools
|
||||
private function pref_editor($type='core')
|
||||
{
|
||||
//TODO Add drop-down for editing personal perfs also. ie. user pref of self. (admin)
|
||||
|
||||
global $pref, $e107, $emessage, $frm;
|
||||
|
||||
|
||||
|
||||
global $pref, $e107, $emessage, $frm;
|
||||
|
||||
|
||||
|
||||
$config = ($type == 'core') ? e107::getConfig('core') : e107::getPlugConfig($type);
|
||||
|
||||
$spref = $config->getPref();
|
||||
|
||||
ksort($spref);
|
||||
|
||||
|
||||
ksort($spref);
|
||||
|
||||
$text = "
|
||||
<form method='post' action='".e_ADMIN."db.php?mode=".$_GET['mode']."&type=".$type."' id='pref_edit'>
|
||||
<fieldset id='core-db-pref-edit'>
|
||||
<legend class='e-hideme'>".DBLAN_20."</legend>";
|
||||
|
||||
|
||||
$text .= "<select class='tbox' name='type_select' onchange='urljump(this.options[selectedIndex].value)' >
|
||||
<option value='".e_ADMIN."db.php?mode=".$_GET['mode']."&type=core'>Core</option>\n";
|
||||
|
||||
|
||||
// e107::getConfig($type)->aliases
|
||||
|
||||
|
||||
e107::getDb()->db_Select_gen("SELECT e107_name FROM #core WHERE e107_name LIKE ('plugin_%') ORDER BY e107_name");
|
||||
while ($row = e107::getDb()->db_Fetch())
|
||||
{
|
||||
$key = str_replace("plugin_","",$row['e107_name']);
|
||||
$selected = (varset($_GET['type'])==$key) ? "selected='selected'" : "";
|
||||
$text .= "<option value='".e_ADMIN."db.php?mode=".$_GET['mode']."&type=".$key."' {$selected}>".ucwords($key)."</option>\n";
|
||||
}
|
||||
|
||||
|
||||
$text .= "<option value='".e_ADMIN."db.php?mode=".$_GET['mode']."&type=".$key."' {$selected}>".ucwords($key)."</option>\n";
|
||||
}
|
||||
|
||||
|
||||
$text .= "</select></div>
|
||||
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
||||
<colgroup span='4'>
|
||||
@ -727,12 +727,12 @@ class system_tools
|
||||
</thead>
|
||||
<tbody>
|
||||
";
|
||||
|
||||
|
||||
foreach($spref as $key => $val)
|
||||
{
|
||||
$ptext = (is_array($val)) ? "<pre>".print_r($val, TRUE)."</pre>" : htmlspecialchars($val, ENT_QUOTES, 'utf-8');
|
||||
$ptext = $e107->tp->textclean($ptext, 80);
|
||||
|
||||
|
||||
$text .= "
|
||||
<tr>
|
||||
<td class='center autocheck e-pointer'>".$frm->checkbox("delpref2[$key]", 1)."</td>
|
||||
@ -742,7 +742,7 @@ class system_tools
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
$text .= "
|
||||
</tbody>
|
||||
</table>
|
||||
@ -753,25 +753,26 @@ class system_tools
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>\n\n";
|
||||
|
||||
|
||||
e107::getRender()->tablerender(DBLAN_10.' :: '.DBLAN_20." :: ".ucwords($type), $emessage->render().$text);
|
||||
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Preferences Editor
|
||||
* @return none
|
||||
*/
|
||||
*/
|
||||
private function scan_override()
|
||||
{
|
||||
global $pref, $emessage;
|
||||
|
||||
|
||||
require_once(e_HANDLER.'file_class.php');
|
||||
$f = new e_file;
|
||||
|
||||
|
||||
$scList = '';
|
||||
$fList = $f->get_files(e_FILE.'shortcode/override', '\.sc$');
|
||||
|
||||
$fList = $f->get_files(e_SYSTEM.'override/shortcodes', '\.sc$');
|
||||
if(count($fList))
|
||||
{
|
||||
$tmp = array();
|
||||
@ -791,38 +792,38 @@ class system_tools
|
||||
/**
|
||||
* Plugin Folder Scanner
|
||||
* @return none
|
||||
*/
|
||||
*/
|
||||
private function plugin_viewscan()
|
||||
{
|
||||
$error_messages = array(0 => DBLAN_31, 1 => DBLAN_32, 2 => DBLAN_33, 3 => DBLAN_34);
|
||||
$error_image = array("integrity_pass.png", "integrity_fail.png", "warning.png", "blank.png");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
global $e107;
|
||||
$sql = e107::getDb();
|
||||
$tp = e107::getParser();
|
||||
$frm = e107::getForm();
|
||||
$emessage = e107::getMessage();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
require_once (e_HANDLER."plugin_class.php");
|
||||
$ep = new e107plugin();
|
||||
$ep->update_plugins_table(); // scan for e_xxx changes and save to plugin table.
|
||||
$ep->save_addon_prefs(); // generate global e_xxx_list prefs from plugin table.
|
||||
|
||||
|
||||
/* we all are awaiting for PHP5 only support - method chaining...
|
||||
$emessage->add(DBLAN_22.' - '.DBLAN_23, E_MESSAGE_SUCCESS)
|
||||
->add("<a href='".e_SELF."'>".LAN_BACK."</a>", E_MESSAGE_SUCCESS)
|
||||
->add(DBLAN_30);
|
||||
*/
|
||||
|
||||
|
||||
$emessage->add(DBLAN_23, E_MESSAGE_SUCCESS);
|
||||
$emessage->add("<a href='".e_SELF."'>".LAN_BACK."</a>", E_MESSAGE_SUCCESS);
|
||||
$emessage->add(DBLAN_30);
|
||||
|
||||
|
||||
$text = "
|
||||
<form method='post' action='".e_ADMIN."db.php?mode=".$_GET['mode']."' id='plug_edit'>
|
||||
<fieldset id='core-db-plugin-scan'>
|
||||
@ -844,19 +845,19 @@ class system_tools
|
||||
</thead>
|
||||
<tbody>
|
||||
";
|
||||
|
||||
|
||||
$sql->db_Select("plugin", "*", "plugin_id !='' order by plugin_path ASC"); // Must order by path to pick up duplicates. (plugin names may change).
|
||||
$previous = '';
|
||||
while($row = $sql->db_Fetch())
|
||||
{
|
||||
e107::loadLanFiles($row['plugin_path'],'admin');
|
||||
|
||||
|
||||
$text .= "
|
||||
<tr>
|
||||
<td>".$e107->tp->toHtml($row['plugin_name'], FALSE, "defs,emotes_off")."</td>
|
||||
<td>".$row['plugin_path']."</td>
|
||||
<td>";
|
||||
|
||||
|
||||
if(trim($row['plugin_addons']))
|
||||
{
|
||||
//XXX - $nl_code = ''; - OLD VAR?
|
||||
@ -873,12 +874,12 @@ class system_tools
|
||||
$text .= "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$text .= "
|
||||
</td>
|
||||
<td class='center'>
|
||||
";
|
||||
|
||||
|
||||
if($previous == $row['plugin_path'])
|
||||
{
|
||||
$delid = $row['plugin_id'];
|
||||
@ -898,14 +899,14 @@ class system_tools
|
||||
";
|
||||
$previous = $row['plugin_path'];
|
||||
}
|
||||
|
||||
|
||||
$text .= "
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
</form>
|
||||
";
|
||||
|
||||
|
||||
e107::getRender()->tablerender(DBLAN_10.' - '.DBLAN_22, $emessage->render().$text);
|
||||
}
|
||||
}
|
||||
@ -915,14 +916,14 @@ class system_tools
|
||||
function db_adminmenu()
|
||||
{
|
||||
global $st;
|
||||
|
||||
|
||||
foreach($st->_options as $key=>$val)
|
||||
{
|
||||
$var[$key]['text'] = $val['label'];
|
||||
$var[$key]['link'] = e_SELF."?mode=".$key;
|
||||
}
|
||||
|
||||
e_admin_menu(DBLAN_10, $_GET['mode'], $var);
|
||||
|
||||
e_admin_menu(DBLAN_10, $_GET['mode'], $var);
|
||||
}
|
||||
|
||||
|
||||
@ -938,28 +939,28 @@ function exportXmlFile($prefs,$tables,$package=FALSE,$debug=FALSE)
|
||||
$xml = e107::getSingleton('xmlClass');
|
||||
$tp = e107::getParser();
|
||||
$emessage = eMessage::getInstance();
|
||||
|
||||
|
||||
//TODO LANs
|
||||
|
||||
|
||||
if(vartrue($package))
|
||||
{
|
||||
|
||||
|
||||
$xml->convertFilePaths = TRUE;
|
||||
$xml->filePathDestination = EXPORT_PATH;
|
||||
$xml->filePathPrepend = array(
|
||||
'news_thumbnail' => "{e_IMAGE}newspost_images/"
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
$desinationFolder = $tp->replaceConstants($xml->filePathDestination);
|
||||
|
||||
|
||||
if(!is_writable($desinationFolder))
|
||||
{
|
||||
{
|
||||
$emessage->add($desinationFolder." is not writable", E_MESSAGE_ERROR);
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($xml->e107Export($prefs,$tables,$debug))
|
||||
{
|
||||
@ -976,8 +977,8 @@ function exportXmlFile($prefs,$tables,$package=FALSE,$debug=FALSE)
|
||||
}
|
||||
else
|
||||
{
|
||||
$emessage->add("Couldn't copy: ".$newfile, E_MESSAGE_ERROR);
|
||||
}
|
||||
$emessage->add("Couldn't copy: ".$newfile, E_MESSAGE_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -989,8 +990,8 @@ function exportXmlFile($prefs,$tables,$package=FALSE,$debug=FALSE)
|
||||
function table_list()
|
||||
{
|
||||
// grab default language lists.
|
||||
//TODO - a similar function is in db_verify.php. Should probably all be moved to mysql_class.php.
|
||||
|
||||
//TODO - a similar function is in db_verify.php. Should probably all be moved to mysql_class.php.
|
||||
|
||||
$exclude = array();
|
||||
$exclude[] = "core";
|
||||
$exclude[] = "rbinary";
|
||||
@ -1000,19 +1001,19 @@ function table_list()
|
||||
$exclude[] = "upload";
|
||||
$exclude[] = "user_extended_country";
|
||||
$exclude[] = "plugin";
|
||||
|
||||
|
||||
$coreTables = e107::getDb()->db_TableList('nolan');
|
||||
|
||||
$tables = array_diff($coreTables,$exclude);
|
||||
|
||||
|
||||
foreach($tables as $e107tab)
|
||||
{
|
||||
{
|
||||
$count = e107::getDb()->db_Select_gen("SELECT * FROM #".$e107tab);
|
||||
|
||||
|
||||
if($count)
|
||||
{
|
||||
$tabs[$e107tab] = $count;
|
||||
}
|
||||
$tabs[$e107tab] = $count;
|
||||
}
|
||||
}
|
||||
|
||||
return $tabs;
|
||||
@ -1035,7 +1036,7 @@ function backup_core()
|
||||
*/
|
||||
|
||||
|
||||
function verify_sql_record() // deprecated by db_verify.php ( i think).
|
||||
function verify_sql_record() // deprecated by db_verify.php ( i think).
|
||||
{
|
||||
global $emessage, $sql, $sql2, $sql3, $frm, $e107, $tp;
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
define('DOWNLOAD_DEBUG',FALSE);
|
||||
|
||||
require_once("../class2.php");
|
||||
if (!getperms("R"))
|
||||
if (!getperms("R"))
|
||||
{
|
||||
header("location:".e_BASE."index.php");
|
||||
exit;
|
||||
@ -68,7 +68,7 @@ $pst->save_preset("admin_downloads"); // unique name for the preset
|
||||
|
||||
|
||||
$sub_action = '';
|
||||
if (e_QUERY)
|
||||
if (e_QUERY)
|
||||
{
|
||||
$tmp = explode(".", e_QUERY);
|
||||
$action = $tmp[0];
|
||||
@ -109,7 +109,7 @@ if($public_array = $fl->get_files(e_UPLOAD))
|
||||
|
||||
if ($sql->db_Select("rbinary"))
|
||||
{
|
||||
while ($row = $sql->db_Fetch())
|
||||
while ($row = $sql->db_Fetch())
|
||||
{
|
||||
extract($row);
|
||||
$file_array[] = "Binary ".$binary_id."/".$binary_name;
|
||||
@ -135,13 +135,13 @@ if(isset($_POST))
|
||||
$e107cache->clear("download_cat");
|
||||
}
|
||||
|
||||
if (isset($_POST['add_category']))
|
||||
if (isset($_POST['add_category']))
|
||||
{
|
||||
$download->create_category($sub_action, $id);
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST['submit_download']))
|
||||
if (isset($_POST['submit_download']))
|
||||
{
|
||||
$download->submit_download($sub_action, $id);
|
||||
$action = "main";
|
||||
@ -281,15 +281,15 @@ if ($action == "dlm")
|
||||
}
|
||||
|
||||
|
||||
if ($action == "create")
|
||||
if ($action == "create")
|
||||
{
|
||||
$download->create_download($sub_action, $id);
|
||||
}
|
||||
|
||||
|
||||
if ($delete == 'category')
|
||||
if ($delete == 'category')
|
||||
{
|
||||
if (admin_update($sql->db_Delete('download_category', 'download_category_id='.$del_id), 'delete', DOWLAN_49." #".$del_id." ".DOWLAN_36))
|
||||
if (admin_update($sql->db_Delete('download_category', 'download_category_id='.$del_id), 'delete', DOWLAN_49." #".$del_id." ".DOWLAN_36))
|
||||
{
|
||||
$sql->db_Delete('download_category', 'download_category_parent='.$del_id);
|
||||
$admin_log->log_event('DOWNL_04',$del_id,E_LOG_INFORMATIVE,'');
|
||||
@ -297,13 +297,13 @@ if ($delete == 'category')
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'cat')
|
||||
if ($action == 'cat')
|
||||
{
|
||||
$download->show_categories($sub_action, $id);
|
||||
}
|
||||
|
||||
|
||||
if ($delete == 'main')
|
||||
if ($delete == 'main')
|
||||
{
|
||||
$result = admin_update($sql->db_Delete('download', 'download_id='.$del_id), 'delete', DOWLAN_27." #".$del_id." ".DOWLAN_36);
|
||||
if($result)
|
||||
@ -316,14 +316,14 @@ if ($delete == 'main')
|
||||
}
|
||||
|
||||
|
||||
if (isset($message))
|
||||
if (isset($message))
|
||||
{
|
||||
$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!e_QUERY || $action == "main")
|
||||
if (!e_QUERY || $action == "main")
|
||||
{
|
||||
$download->show_existing_items($action, $sub_action, $id, $from, $amount);
|
||||
}
|
||||
@ -331,7 +331,7 @@ if (!e_QUERY || $action == "main")
|
||||
|
||||
|
||||
|
||||
if ($action == "opt")
|
||||
if ($action == "opt")
|
||||
{
|
||||
global $pref, $ns;
|
||||
$agree_flag = $pref['agree_flag'];
|
||||
@ -545,7 +545,7 @@ exit;
|
||||
|
||||
class download
|
||||
{
|
||||
function show_existing_items($action, $sub_action, $id, $from, $amount)
|
||||
function show_existing_items($action, $sub_action, $id, $from, $amount)
|
||||
{
|
||||
global $sql, $rs, $ns, $tp, $mySQLdefaultdb, $pref;
|
||||
$text = "<div style='text-align:center'><div style='padding : 1px; ".ADMIN_WIDTH."; margin-left: auto; margin-right: auto;'>";
|
||||
@ -569,7 +569,7 @@ class download
|
||||
|
||||
$query = "SELECT d.*, dc.* FROM `#download` AS d LEFT JOIN `#download_category` AS dc ON dc. download_category_id = d.download_category";
|
||||
|
||||
if (isset($_POST['searchquery']) && $_POST['searchquery'] != "")
|
||||
if (isset($_POST['searchquery']) && $_POST['searchquery'] != "")
|
||||
{
|
||||
$query .= " WHERE download_url REGEXP('".$_POST['searchquery']."') OR download_author REGEXP('".$_POST['searchquery']."') OR download_description REGEXP('".$_POST['searchquery']."') ";
|
||||
foreach($search_display as $disp)
|
||||
@ -577,13 +577,13 @@ class download
|
||||
$query .= " OR $disp REGEXP('".$_POST['searchquery']."') ";
|
||||
}
|
||||
$query .= " ORDER BY {$sortorder} {$sortdirection}";
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= " ORDER BY ".($sub_action ? $sub_action : $sortorder)." ".($id ? $id : $sortdirection)." LIMIT $from, $amount";
|
||||
}
|
||||
|
||||
if ($dl_count = $sql->db_Select_gen($query))
|
||||
if ($dl_count = $sql->db_Select_gen($query))
|
||||
{
|
||||
$text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform")."
|
||||
<table class='fborder' style='width:99%'>
|
||||
@ -608,11 +608,11 @@ class download
|
||||
|
||||
$text .="<td style='width:10%' class='fcaption'>".LAN_OPTIONS."</td></tr>";
|
||||
|
||||
while ($row = $sql->db_Fetch())
|
||||
while ($row = $sql->db_Fetch())
|
||||
{
|
||||
$text .= "<tr><td style='width:5%;vertical-align:top' class='forumheader3'>".$row['download_id']."</td>";
|
||||
|
||||
// Display Chosen options
|
||||
// Display Chosen options
|
||||
foreach($search_display as $disp)
|
||||
{
|
||||
$text .= "<td class='forumheader3' style='vertical-align:top'>";
|
||||
@ -645,16 +645,16 @@ class download
|
||||
break;
|
||||
case "download_active" :
|
||||
if($row[$disp]== 1)
|
||||
{
|
||||
$text .= "<img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_123."' alt='' style='cursor:help' />\n";
|
||||
{
|
||||
$text .= "<img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_123."' alt='' style='cursor:help' />\n";
|
||||
}
|
||||
elseif($row[$disp]== 2)
|
||||
{
|
||||
$text .= "<img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_124."' alt='' style='cursor:help' /><img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_124."' alt='' style='cursor:help' />\n";
|
||||
{
|
||||
$text .= "<img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_124."' alt='' style='cursor:help' /><img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_124."' alt='' style='cursor:help' />\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= "<img src='".ADMIN_FALSE_ICON_PATH."' title='".DOWLAN_122."' alt='' style='cursor:help' />\n";
|
||||
{
|
||||
$text .= "<img src='".ADMIN_FALSE_ICON_PATH."' title='".DOWLAN_122."' alt='' style='cursor:help' />\n";
|
||||
}
|
||||
break;
|
||||
case "download_comment" :
|
||||
@ -675,8 +675,8 @@ class download
|
||||
</tr>";
|
||||
}
|
||||
$text .= "</table></form>";
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{ // 'No downloads yet'
|
||||
$text .= "<div style='text-align:center'>".DOWLAN_6."</div>";
|
||||
}
|
||||
@ -684,7 +684,7 @@ class download
|
||||
|
||||
// Next-Previous.
|
||||
$downloads = $sql->db_Count("download");
|
||||
if ($downloads > $amount && !$_POST['searchquery'])
|
||||
if ($downloads > $amount && !$_POST['searchquery'])
|
||||
{
|
||||
$parms = "{$downloads},{$amount},{$from},".e_SELF."?".(e_QUERY ? "$action.$sub_action.$id." : "main.{$sortorder}.{$sortdirection}.")."[FROM]";
|
||||
$text .= "<br />".$tp->parseTemplate("{NEXTPREV={$parms}}");
|
||||
@ -795,10 +795,10 @@ class download
|
||||
|
||||
|
||||
|
||||
function create_download($sub_action, $id)
|
||||
function create_download($sub_action, $id)
|
||||
{
|
||||
global $cal,$tp, $sql, $fl, $rs, $ns, $file_array, $image_array, $thumb_array,$pst;
|
||||
require_once(e_FILE."shortcode/batch/download_shortcodes.php");
|
||||
require_once(e_CORE."shortcodes/batch/download_shortcodes.php");
|
||||
|
||||
$mirrorArray = array();
|
||||
|
||||
@ -808,15 +808,15 @@ class download
|
||||
$preset = $pst->read_preset("admin_downloads"); // read preset values into array
|
||||
extract($preset);
|
||||
|
||||
if (!$sql->db_Select("download_category"))
|
||||
if (!$sql->db_Select("download_category"))
|
||||
{
|
||||
$ns->tablerender(ADLAN_24, "<div style='text-align:center'>".DOWLAN_5."</div>");
|
||||
return;
|
||||
}
|
||||
$download_active = 1;
|
||||
if ($sub_action == "edit" && !$_POST['submit'])
|
||||
if ($sub_action == "edit" && !$_POST['submit'])
|
||||
{
|
||||
if ($sql->db_Select("download", "*", "download_id=".$id))
|
||||
if ($sql->db_Select("download", "*", "download_id=".$id))
|
||||
{
|
||||
$row = $sql->db_Fetch();
|
||||
extract($row);
|
||||
@ -825,9 +825,9 @@ class download
|
||||
}
|
||||
}
|
||||
|
||||
if ($sub_action == "dlm" && !$_POST['submit'])
|
||||
if ($sub_action == "dlm" && !$_POST['submit'])
|
||||
{
|
||||
if ($sql->db_Select("upload", "*", "upload_id=".$id))
|
||||
if ($sql->db_Select("upload", "*", "upload_id=".$id))
|
||||
{
|
||||
$row = $sql->db_Fetch();
|
||||
|
||||
@ -874,11 +874,11 @@ class download
|
||||
";
|
||||
|
||||
$counter = 0;
|
||||
while (isset($file_array[$counter]))
|
||||
while (isset($file_array[$counter]))
|
||||
{
|
||||
$fpath = str_replace(e_DOWNLOAD,"",$file_array[$counter]['path']).$file_array[$counter]['fname'];
|
||||
$selected = '';
|
||||
if (stristr($fpath, $download_url) !== FALSE)
|
||||
if (stristr($fpath, $download_url) !== FALSE)
|
||||
{
|
||||
$selected = " selected='selected'";
|
||||
$found = 1;
|
||||
@ -889,7 +889,7 @@ class download
|
||||
}
|
||||
|
||||
$dt = 'display:none';
|
||||
if (preg_match("/http:|ftp:/", $download_url))
|
||||
if (preg_match("/http:|ftp:/", $download_url))
|
||||
{
|
||||
$download_url_external = $download_url;
|
||||
$download_url = '';
|
||||
@ -897,12 +897,12 @@ class download
|
||||
}
|
||||
|
||||
$etext = " - (".DOWLAN_68.")";
|
||||
if (file_exists(e_UPLOAD.$download_url))
|
||||
if (file_exists(e_UPLOAD.$download_url))
|
||||
{
|
||||
$etext = "";
|
||||
}
|
||||
|
||||
if (!$found && $download_url)
|
||||
if (!$found && $download_url)
|
||||
{
|
||||
$text .= "<option value='".$download_url."' selected='selected'>".$download_url.$etext."</option>\n";
|
||||
}
|
||||
@ -947,7 +947,7 @@ class download
|
||||
<select name='download_mirror_name[]' class='tbox'>
|
||||
<option value=''> </option>";
|
||||
|
||||
foreach ($mirrorList as $mirror)
|
||||
foreach ($mirrorList as $mirror)
|
||||
{
|
||||
extract($mirror);
|
||||
$text .= "<option value='{$mirror_id}'".($mirror_id == $mirrorArray[($count-1)]['id'] ? " selected='selected'" : "").">{$mirror_name}</option>\n";
|
||||
@ -1199,7 +1199,7 @@ class download
|
||||
|
||||
|
||||
// Actually save a new or edited download to the DB
|
||||
function submit_download($sub_action, $id)
|
||||
function submit_download($sub_action, $id)
|
||||
{
|
||||
global $tp, $sql, $DOWNLOADS_DIRECTORY, $e_event;
|
||||
|
||||
@ -1300,7 +1300,7 @@ class download
|
||||
$dlInfo['download_comment'] = $tp->toDB($_POST['download_comment']);
|
||||
$dlInfo['download_class'] = intval($_POST['download_class']);
|
||||
$dlInfo['download_visible'] =intval($_POST['download_visible']);
|
||||
|
||||
|
||||
if (preg_match("#(.*?)/(.*?)/(.*?) (.*?):(.*?):(.*?)$#", $_POST['download_datestamp'], $matches))
|
||||
{
|
||||
$dlInfo['download_datestamp'] = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]);
|
||||
@ -1311,8 +1311,8 @@ class download
|
||||
}
|
||||
|
||||
if($_POST['update_datestamp'])
|
||||
{
|
||||
$dlInfo['download_datestamp'] = time();
|
||||
{
|
||||
$dlInfo['download_datestamp'] = time();
|
||||
}
|
||||
|
||||
$mirrorStr = "";
|
||||
@ -1375,10 +1375,10 @@ class download
|
||||
$dlInfo['download_datestamp'] = $time; // This is what 0.7 did, regardless of settings
|
||||
unset($dlInfo['download_class']); // Also replicating 0.7
|
||||
$e_event->trigger('dlupdate', $dlInfo);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (admin_update($download_id = $sql->db_Insert('download',array_merge($dlInfo,$dlMirrors)), 'insert', DOWLAN_1." (<a href='".e_BASE."download.php?view.".$download_id."'>".$_POST['download_name']."</a>)"))
|
||||
if (admin_update($download_id = $sql->db_Insert('download',array_merge($dlInfo,$dlMirrors)), 'insert', DOWLAN_1." (<a href='".e_BASE."download.php?view.".$download_id."'>".$_POST['download_name']."</a>)"))
|
||||
{
|
||||
$dlInfo['download_id'] = $download_id;
|
||||
$this->downloadLog('DOWNL_05',$dlInfo,$dlMirrors);
|
||||
@ -1386,7 +1386,7 @@ class download
|
||||
unset($dlInfo['download_class']); // Also replicating 0.7
|
||||
$e_event->trigger("dlpost", $dlInfo);
|
||||
|
||||
if ($_POST['remove_upload'])
|
||||
if ($_POST['remove_upload'])
|
||||
{
|
||||
$sql->db_Update("upload", "upload_active='1' WHERE upload_id='".$_POST['remove_id']."'");
|
||||
$mes = "<br />".$_POST['download_name']." ".DOWLAN_104;
|
||||
@ -1699,17 +1699,17 @@ class download
|
||||
$download_category_icon .= trim(chr(1).$tp->toDB($_POST['download_category_icon_empty']));
|
||||
}
|
||||
|
||||
if ($id)
|
||||
if ($id)
|
||||
{
|
||||
admin_update($sql->db_Update("download_category", "download_category_name='{$download_category_name}', download_category_description='{$download_category_description}', download_category_icon ='{$download_category_icon}', download_category_parent= '{$download_categoory_parent}', download_category_class='{$download_category_class}' WHERE download_category_id='{$id}'"), 'update', DOWLAN_48);
|
||||
$admin_log->log_event('DOWNL_03',$download_category_name.'[!br!]'.$download_category_description,E_LOG_INFORMATIVE,'');
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
admin_update($sql->db_Insert("download_category", "0, '{$download_category_name}', '{$download_category_description}', '{$download_category_icon}', '{$download_categoory_parent}', '{$download_category_class}', 0 "), 'insert', DOWLAN_47);
|
||||
$admin_log->log_event('DOWNL_02',$download_category_name.'[!br!]'.$download_category_description,E_LOG_INFORMATIVE,'');
|
||||
}
|
||||
if ($sub_action == "sn")
|
||||
if ($sub_action == "sn")
|
||||
{
|
||||
$sql->db_Delete("tmp", "tmp_time='{$id}' ");
|
||||
}
|
||||
@ -1874,8 +1874,8 @@ class download
|
||||
{
|
||||
admin_update($sql -> db_Update("download_mirror", "mirror_name='{$name}', mirror_url='{$url}', mirror_image='".$tp->toDB($_POST['mirror_image'])."', mirror_location='{$location}', mirror_description='{$description}' WHERE mirror_id=".intval($_POST['id'])), 'update', DOWLAN_133);
|
||||
$admin_log->log_event('DOWNL_13','ID: '.intval($_POST['id']).'[!br!]'.$logString,E_LOG_INFORMATIVE,'');
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
admin_update($sql -> db_Insert("download_mirror", "0, '{$name}', '{$url}', '".$tp->toDB($_POST['mirror_image'])."', '{$location}', '{$description}', 0"), 'insert', DOWLAN_134);
|
||||
$admin_log->log_event('DOWNL_12',$logString,E_LOG_INFORMATIVE,'');
|
||||
@ -1925,7 +1925,7 @@ class download
|
||||
} // end class.
|
||||
|
||||
|
||||
function download_adminmenu($parms)
|
||||
function download_adminmenu($parms)
|
||||
{
|
||||
global $download;
|
||||
global $action;
|
||||
|
@ -34,7 +34,7 @@ if (isset($_POST['submit-mye107']) || varset($_POST['submit-mymenus']))
|
||||
}
|
||||
|
||||
|
||||
//TODO LANs throughout.
|
||||
//TODO LANs throughout.
|
||||
|
||||
// ---------------------- Start Panel --------------------------------
|
||||
|
||||
@ -43,7 +43,7 @@ if (isset($_POST['submit-mye107']) || varset($_POST['submit-mymenus']))
|
||||
{
|
||||
$user_pref['core-infopanel-mye107'] = $pref['core-infopanel-default'];
|
||||
}
|
||||
|
||||
|
||||
$iconlist = array_merge($array_functions_assoc, getPluginLinks(E_16_PLUGMANAGER, "array"));
|
||||
|
||||
$text .= "
|
||||
@ -68,13 +68,13 @@ if (isset($_POST['submit-mye107']) || varset($_POST['submit-mymenus']))
|
||||
$text .= render_links($val['link'], $val['title'], $val['caption'], $val['perms'], $val['icon_32'], "div");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$text .= "<div class='clear'> </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>";
|
||||
|
||||
|
||||
|
||||
|
||||
// ------------------------------- e107 News --------------------------------
|
||||
$text .= "
|
||||
<div id='core-infopanel_news' class='f-left' style='width:49%'>
|
||||
@ -82,21 +82,21 @@ if (isset($_POST['submit-mye107']) || varset($_POST['submit-mymenus']))
|
||||
<div class='main_caption bevel left'><b>e107 News</b></div>
|
||||
<div class='left block-text'>";
|
||||
// TODO Load with Ajax
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
$xml = e107::getXml();
|
||||
$vars = $xml->loadXMLfile('http://www.e107.org/e107_plugins/rss_menu/rss.php?1.2', true, true);
|
||||
$text .= print_r($vars,TRUE);
|
||||
*/
|
||||
|
||||
|
||||
$text .= "
|
||||
RSS News feed from e107.org goes here.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
|
||||
|
||||
// ---------------------Latest Stuff ---------------------------
|
||||
$text .= "
|
||||
<div id='core-infopanel_latest' class='f-left' style='width:49%' >
|
||||
@ -104,7 +104,7 @@ $text .= "
|
||||
<table cellspacing='0' cellpadding='0'>
|
||||
<tr>
|
||||
<td style='padding:0px'>";
|
||||
require_once (e_FILE."shortcode/batch/admin_shortcodes.php");
|
||||
require_once (e_CORE."shortcodes/batch/admin_shortcodes.php");
|
||||
$text .= $tp->parseTemplate("{ADMIN_LATEST}");
|
||||
$text .= "</td><td style='padding:0px'>";
|
||||
$text .= $tp->parseTemplate("{ADMIN_STATUS}");
|
||||
@ -112,15 +112,15 @@ $text .= "
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
|
||||
|
||||
// ---------------------- Who's Online ------------------------
|
||||
// TODO Could use a new _menu item instead.
|
||||
// TODO Could use a new _menu item instead.
|
||||
$text .= "
|
||||
<div id='core-infopanel_online' class='f-left' style='width:49%'>
|
||||
<div style='border:1px solid silver;margin:10px'>
|
||||
<div class='main_caption bevel left'><b>Who's Online</b></div>
|
||||
<div class='left block-text'>
|
||||
|
||||
|
||||
|
||||
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
||||
<colgroup span='3'>
|
||||
@ -153,7 +153,7 @@ $text .= "
|
||||
";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$text .= "</tbody></table></div>
|
||||
</div>
|
||||
</div>
|
||||
@ -201,7 +201,7 @@ function renderOnlineName($val)
|
||||
{
|
||||
return "Guest";
|
||||
}
|
||||
return $val;
|
||||
return $val;
|
||||
}
|
||||
|
||||
function render_info_panel($caption, $text)
|
||||
@ -237,7 +237,7 @@ function render_infopanel_icons()
|
||||
$frm = e107::getSingleton('e_form');
|
||||
global $iconlist,$pluglist, $user_pref;
|
||||
$text = "";
|
||||
|
||||
|
||||
|
||||
foreach ($iconlist as $key=>$icon)
|
||||
{
|
||||
@ -271,7 +271,7 @@ function render_infopanel_menu_options()
|
||||
$text = "";
|
||||
$menu_qry = 'SELECT * FROM #menus WHERE menu_id!= 0 GROUP BY menu_name ORDER BY menu_name';
|
||||
$settings = varset($user_pref['core-infopanel-menus'],array());
|
||||
|
||||
|
||||
if (e107::getDb()->db_Select_gen($menu_qry))
|
||||
{
|
||||
while ($row = e107::getDb()->db_Fetch())
|
||||
|
@ -30,8 +30,8 @@ $codes = array(
|
||||
'admin_status',
|
||||
'admin_update',
|
||||
'admin_userlan',
|
||||
'admin_menumanager',
|
||||
'admin_menumanager',
|
||||
);
|
||||
|
||||
register_shortcode('admin_shortcodes', $codes, e_FILE.'shortcode/batch/admin_shortcodes_class.php');
|
||||
register_shortcode('admin_shortcodes', $codes, e_CORE.'shortcodes/batch/admin_shortcodes_class.php');
|
||||
?>
|
@ -22,7 +22,7 @@ if (!defined('e107_INIT'))
|
||||
}
|
||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_comment.php");
|
||||
global $comment_shortcodes;
|
||||
require_once (e_FILE."shortcode/batch/comment_shortcodes.php");
|
||||
require_once (e_CORE."shortcodes/batch/comment_shortcodes.php");
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
@ -40,7 +40,7 @@ class comment
|
||||
5 => 'docs',
|
||||
6 => 'bugtrack'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Display the comment editing form
|
||||
*
|
||||
@ -349,13 +349,13 @@ class comment
|
||||
{
|
||||
//rateindex : the posted value from the rateselect box (without the urljump) (see function rateselect())
|
||||
global $e_event,$e107,$pref,$rater;
|
||||
|
||||
|
||||
$sql = e107::getDb();
|
||||
$sql2 = e107::getDb('sql2');
|
||||
$tp = e107::getParser();
|
||||
$e107cache = e107::getCache();
|
||||
|
||||
|
||||
|
||||
|
||||
if (isset($pref['comments_disabled']) && $pref['comments_disabled'] == TRUE)
|
||||
{
|
||||
return;
|
||||
@ -428,54 +428,54 @@ class comment
|
||||
$e107cache->clear("comment");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//FIXME - don't sanitize, pass raw data to e_event, use DB array (inner db sanitize)
|
||||
$edata_li = array(
|
||||
// comment_id - auto-assigned
|
||||
'comment_pid' => intval($pid),
|
||||
'comment_item_id' => $id,
|
||||
'comment_subject' => $subject,
|
||||
'comment_author_id' => $cuser_id,
|
||||
'comment_pid' => intval($pid),
|
||||
'comment_item_id' => $id,
|
||||
'comment_subject' => $subject,
|
||||
'comment_author_id' => $cuser_id,
|
||||
'comment_author_name' => $cuser_name,
|
||||
'comment_author_email' => $tp->toDB($cuser_mail),
|
||||
'comment_datestamp' => $_t,
|
||||
'comment_comment' => $comment,
|
||||
'comment_datestamp' => $_t,
|
||||
'comment_comment' => $comment,
|
||||
'comment_blocked' => 0, //Not blocked by default
|
||||
'comment_ip' => $ip,
|
||||
'comment_ip' => $ip,
|
||||
'comment_type' => $tp->toDB($type, true),
|
||||
'comment_lock' => 0 //Not locked by default
|
||||
);
|
||||
|
||||
|
||||
//SecretR: new event 'prepostcomment' - allow plugin hooks - e.g. Spam Check
|
||||
$edata_li_hook = array_merge($edata_li, array('comment_nick' => $cuser_id.'.'.$cuser_name, 'comment_time' => $_t));
|
||||
if($e_event->trigger("prepostcomment", $edata_li_hook))
|
||||
{
|
||||
return false; //3rd party code interception
|
||||
}
|
||||
|
||||
|
||||
//allow 3rd party code to modify insert data
|
||||
if(is_array($edata_li_hook))
|
||||
{
|
||||
foreach (array_keys($edata_li) as $k)
|
||||
{
|
||||
if(isset($edata_li_hook[$k]))
|
||||
if(isset($edata_li_hook[$k]))
|
||||
{
|
||||
$edata_li[$k] = $edata_li_hook[$k]; //sanitize?
|
||||
continue;
|
||||
}
|
||||
if($k === 'break')
|
||||
if($k === 'break')
|
||||
{
|
||||
$break = $edata_li_hook[$k];
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($edata_li_hook);
|
||||
|
||||
|
||||
if (!($inserted_id = $sql->db_Insert("comments", $edata_li)))
|
||||
{
|
||||
//echo "<b>".COMLAN_323."</b> ".COMLAN_11;
|
||||
e107::getMessage()->addStack(COMLAN_11, 'postcomment', E_MESSAGE_ERROR);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -487,21 +487,21 @@ class comment
|
||||
$edata_li["comment_nick"] = $cuser_id.'.'.$cuser_name;
|
||||
$edata_li["comment_time"] = $_t;
|
||||
$edata_li["comment_id"] = $inserted_id;
|
||||
|
||||
|
||||
//Why?
|
||||
/*unset($edata_li['comment_pid']);
|
||||
unset($edata_li['comment_author_email']);
|
||||
unset($edata_li['comment_ip']);*/
|
||||
|
||||
|
||||
$e_event->trigger("postcomment", $edata_li);
|
||||
$e107cache->clear("comment");
|
||||
|
||||
|
||||
//TODO - should be handled by news
|
||||
if (!$type || $type == "news")
|
||||
{
|
||||
$sql->db_Update("news", "news_comment_total=news_comment_total+1 WHERE news_id=".intval($id));
|
||||
}
|
||||
|
||||
|
||||
//if rateindex is posted, enter the rating from this user
|
||||
if ($rateindex)
|
||||
{
|
||||
@ -535,7 +535,7 @@ class comment
|
||||
{
|
||||
return $table;
|
||||
}
|
||||
|
||||
|
||||
switch ($table)
|
||||
{
|
||||
case "news":
|
||||
@ -569,7 +569,7 @@ class comment
|
||||
}
|
||||
return $type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert type number to (core) table string
|
||||
* @param integer|string $type
|
||||
@ -589,7 +589,7 @@ class comment
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
@ -631,17 +631,17 @@ class comment
|
||||
// Query no longer used
|
||||
// $count_comments = $this -> count_comments($table, $id, $pid=FALSE);
|
||||
$type = $this->getCommentType($table);
|
||||
$query = $pref['nested_comments'] ?
|
||||
$query = $pref['nested_comments'] ?
|
||||
"SELECT c.*, u.*, ue.* FROM #comments AS c
|
||||
LEFT JOIN #user AS u ON c.comment_author_id = u.user_id
|
||||
LEFT JOIN #user_extended AS ue ON c.comment_author_id = ue.user_extended_id
|
||||
WHERE c.comment_item_id='".intval($id)."' AND c.comment_type='".$tp->toDB($type, true)."' AND c.comment_pid='0' ORDER BY c.comment_datestamp"
|
||||
:
|
||||
WHERE c.comment_item_id='".intval($id)."' AND c.comment_type='".$tp->toDB($type, true)."' AND c.comment_pid='0' ORDER BY c.comment_datestamp"
|
||||
:
|
||||
"SELECT c.*, u.*, ue.* FROM #comments AS c
|
||||
LEFT JOIN #user AS u ON c.comment_author_id = u.user_id
|
||||
LEFT JOIN #user_extended AS ue ON c.comment_author_id = ue.user_extended_id
|
||||
WHERE c.comment_item_id='".intval($id)."' AND c.comment_type='".$tp->toDB($type, true)."' ORDER BY c.comment_datestamp";
|
||||
|
||||
|
||||
$text = "";
|
||||
$comment = '';
|
||||
$modcomment = '';
|
||||
@ -649,10 +649,10 @@ class comment
|
||||
$ret['comment'] = '';
|
||||
if ($comment_total = $sql->db_Select_gen($query))
|
||||
{
|
||||
$width = 0;
|
||||
$width = 0;
|
||||
//Shortcodes could use $sql, so just grab all results
|
||||
$rows = $sql->db_getList();
|
||||
|
||||
|
||||
//while ($row = $sql->db_Fetch())
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
@ -732,9 +732,9 @@ class comment
|
||||
global $sql;
|
||||
$authors = array();
|
||||
$qry = "
|
||||
SELECT DISTINCT(comment_author_id) AS author
|
||||
SELECT DISTINCT(comment_author_id) AS author
|
||||
FROM #comments
|
||||
WHERE comment_item_id='{$id}' AND comment_type='{$comment_type}'
|
||||
WHERE comment_item_id='{$id}' AND comment_type='{$comment_type}'
|
||||
GROUP BY author
|
||||
";
|
||||
if ($sql->db_Select_gen($qry))
|
||||
@ -775,9 +775,9 @@ class comment
|
||||
{
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
$files = e107::getPref('e_comment_list');
|
||||
|
||||
|
||||
foreach ($files as $file=>$perms)
|
||||
{
|
||||
unset($e_comment, $key);
|
||||
|
@ -17,7 +17,7 @@
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
class news {
|
||||
|
||||
|
||||
protected static $_rewrite_data = array();
|
||||
protected static $_rewrite_map = null;
|
||||
|
||||
@ -26,80 +26,80 @@ class news {
|
||||
function submit_item($news, $smessages = false)
|
||||
{
|
||||
global $e107cache, $e_event, $pref, $admin_log;
|
||||
|
||||
|
||||
$tp = e107::getParser();
|
||||
$sql = e107::getDb();
|
||||
|
||||
|
||||
require_once (e_HANDLER."message_handler.php");
|
||||
$emessage = eMessage::getInstance();
|
||||
|
||||
|
||||
$error = false;
|
||||
if(empty($news['news_title']))
|
||||
{
|
||||
$error = true;
|
||||
$emessage->add('Validation error: News title can\'t be empty!', E_MESSAGE_ERROR, $smessages);
|
||||
}
|
||||
|
||||
|
||||
if(empty($news['news_category']))
|
||||
{
|
||||
$error = true;
|
||||
$emessage->add('Validation error: News category can\'t be empty!', E_MESSAGE_ERROR, $smessages);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$data = array();
|
||||
//DB Array
|
||||
$data['data']['news_title'] = $news['news_title'];
|
||||
$data['_FIELD_TYPES']['news_title'] = 'todb';
|
||||
|
||||
|
||||
$data['data']['news_body'] = $news['news_body'];
|
||||
$data['_FIELD_TYPES']['news_body'] = 'todb';
|
||||
|
||||
|
||||
$data['data']['news_extended'] = $news['news_extended'];
|
||||
$data['_FIELD_TYPES']['news_extended'] = 'todb';
|
||||
|
||||
|
||||
$data['data']['news_datestamp'] = $news['news_datestamp'];
|
||||
$data['_FIELD_TYPES']['news_datestamp'] = 'int';
|
||||
|
||||
|
||||
$data['data']['news_author'] = $news['news_author'] ? $news['news_author'] : USERID;
|
||||
$data['_FIELD_TYPES']['news_author'] = 'int';
|
||||
|
||||
|
||||
$data['data']['news_category'] = $news['news_category'];
|
||||
$data['_FIELD_TYPES']['news_category'] = 'int';
|
||||
|
||||
|
||||
$data['data']['news_allow_comments'] = $news['news_allow_comments'];
|
||||
$data['_FIELD_TYPES']['news_allow_comments'] = 'int';
|
||||
|
||||
|
||||
$data['data']['news_start'] = $news['news_start'];
|
||||
$data['_FIELD_TYPES']['news_start'] = 'int';
|
||||
|
||||
|
||||
$data['data']['news_end'] = $news['news_end'];
|
||||
$data['_FIELD_TYPES']['news_end'] = 'int';
|
||||
|
||||
|
||||
$data['data']['news_class'] = $news['news_class'];
|
||||
$data['_FIELD_TYPES']['news_class'] = 'todb';
|
||||
|
||||
|
||||
$data['data']['news_render_type'] = $news['news_render_type'];
|
||||
$data['_FIELD_TYPES']['news_render_type'] = 'int';
|
||||
|
||||
|
||||
|
||||
|
||||
//news_comment_total
|
||||
|
||||
|
||||
$data['data']['news_summary'] = $news['news_summary'];
|
||||
$data['_FIELD_TYPES']['news_summary'] = 'todb';
|
||||
|
||||
|
||||
$data['data']['news_thumbnail'] = $news['news_thumbnail'];
|
||||
$data['_FIELD_TYPES']['news_thumbnail'] = 'todb';
|
||||
|
||||
|
||||
$data['data']['news_sticky'] = $news['news_sticky'];
|
||||
$data['_FIELD_TYPES']['news_sticky'] = 'int';
|
||||
|
||||
$data['data']['news_meta_keywords'] = $news['news_meta_keywords'];
|
||||
$data['_FIELD_TYPES']['news_meta_keywords'] = 'todb';
|
||||
|
||||
|
||||
$data['data']['news_meta_description'] = strip_tags($tp->toHTML($news['news_meta_description'], true)); //handle bbcodes
|
||||
$data['_FIELD_TYPES']['news_meta_description'] = 'todb';
|
||||
|
||||
|
||||
$datarw = array();
|
||||
$datarw['data']['news_rewrite_id'] = $news['news_rewrite_id'];
|
||||
$datarw['_FIELD_TYPES']['news_rewrite_id'] = 'int';
|
||||
@ -107,7 +107,7 @@ class news {
|
||||
$datarw['_FIELD_TYPES']['news_rewrite_string'] = 'todb';
|
||||
$datarw['data']['news_rewrite_type'] = 1;
|
||||
$datarw['_FIELD_TYPES']['news_rewrite_type'] = 'int';
|
||||
|
||||
|
||||
if($error)
|
||||
{
|
||||
$data['error'] = true;
|
||||
@ -121,10 +121,10 @@ class news {
|
||||
|
||||
//XXX - Now hooks are executed only if no mysql error is found. Should it stay so? Seems sensible to me!
|
||||
if ($news['news_id'])
|
||||
{
|
||||
{
|
||||
// Updating existing item
|
||||
$data['WHERE'] = 'news_id='.intval($news['news_id']);
|
||||
|
||||
|
||||
//$vals = "news_datestamp = '".intval($news['news_datestamp'])."', ".$author_insert." news_title='".$news['news_title']."', news_body='".$news['news_body']."', news_extended='".$news['news_extended']."', news_category='".intval($news['cat_id'])."', news_allow_comments='".intval($news['news_allow_comments'])."', news_start='".intval($news['news_start'])."', news_end='".intval($news['news_end'])."', news_class='".$tp->toDB($news['news_class'])."', news_render_type='".intval($news['news_rendertype'])."' , news_summary='".$news['news_summary']."', news_thumbnail='".$tp->toDB($news['news_thumbnail'])."', news_sticky='".intval($news['news_sticky'])."' WHERE news_id='".intval($news['news_id'])."' ";
|
||||
if ($sql->db_Update('news', $data))
|
||||
{
|
||||
@ -136,14 +136,14 @@ class news {
|
||||
{
|
||||
$error = true;
|
||||
}
|
||||
|
||||
|
||||
e107::getEvent()->trigger('newsupd', $data['data']);
|
||||
$message = LAN_NEWS_21;
|
||||
$emessage->add(LAN_NEWS_21, E_MESSAGE_SUCCESS, $smessages);
|
||||
e107::getCache()->clear('news.php');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//FIXME - triggerHook should return array(message, message_type)
|
||||
$evdata = array('method'=>'update', 'table'=>'news', 'id'=>$news['news_id'], 'plugin'=>'news', 'function'=>'submit_item');
|
||||
$emessage->add(e107::getEvent()->triggerHook($evdata), E_MESSAGE_INFO, $smessages);
|
||||
@ -174,7 +174,7 @@ class news {
|
||||
$emessage->add(LAN_NEWS_46, E_MESSAGE_INFO, $smessages);
|
||||
$message = "<strong>".LAN_NEWS_46."</strong>";
|
||||
}
|
||||
|
||||
|
||||
//FIXME - triggerHook should return array(message, message_type)
|
||||
$evdata = array('method'=>'update', 'table'=>'news', 'id'=>$news['news_id'], 'plugin'=>'news', 'function'=>'submit_item');
|
||||
$emessage->add(e107::getEvent()->triggerHook($evdata), E_MESSAGE_INFO, $smessages);
|
||||
@ -183,7 +183,7 @@ class news {
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// Adding item
|
||||
$data['data']['news_id'] = $sql->db_Insert('news', $data);
|
||||
$news['news_id'] = $data['data']['news_id'];
|
||||
@ -194,18 +194,18 @@ class news {
|
||||
$message = LAN_NEWS_6;
|
||||
$emessage->add(LAN_NEWS_6, E_MESSAGE_SUCCESS, $smessages);
|
||||
e107::getCache()->clear('news.php');
|
||||
|
||||
|
||||
//moved down - prevent wrong mysql_insert_id
|
||||
e107::getAdminLog()->logArrayAll('NEWS_08', $logData);
|
||||
|
||||
|
||||
//manage rewrites
|
||||
if('error' === $this->handleRewriteSubmit('insert', $data['data'], $datarw, $smessages))
|
||||
{
|
||||
$error = true;
|
||||
}
|
||||
|
||||
|
||||
e107::getEvent()->trigger('newspost', $data['data']);
|
||||
|
||||
|
||||
//XXX - triggerHook after trigger?
|
||||
$evdata = array('method'=>'create', 'table'=>'news', 'id'=>$data['data']['news_id'], 'plugin'=>'news', 'function'=>'submit_item');
|
||||
$emessage->add($e_event->triggerHook($evdata), E_MESSAGE_INFO, $smessages);
|
||||
@ -221,9 +221,9 @@ class news {
|
||||
/* FIXME - trackback should be hooked! */
|
||||
if($news['news_id'] && $pref['trackbackEnabled'])
|
||||
{
|
||||
|
||||
|
||||
$excerpt = e107::getParser()->text_truncate(strip_tags(e107::getParser()->post_toHTML($news['news_body'])), 100, '...');
|
||||
|
||||
|
||||
// $id=mysql_insert_id();
|
||||
$permLink = $e107->base_path."comment.php?comment.news.".intval($news['news_id']);
|
||||
|
||||
@ -233,14 +233,14 @@ class news {
|
||||
if($_POST['trackback_urls'])
|
||||
{
|
||||
$urlArray = explode("\n", $_POST['trackback_urls']);
|
||||
foreach($urlArray as $pingurl)
|
||||
foreach($urlArray as $pingurl)
|
||||
{
|
||||
if(!$terror = $trackback->sendTrackback($permLink, $pingurl, $news['news_title'], $excerpt))
|
||||
{
|
||||
$message .= "<br />successfully pinged {$pingurl}.";
|
||||
$emessage->add("Successfully pinged {$pingurl}.", E_MESSAGE_SUCCESS, $smessages);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
$message .= "<br />was unable to ping {$pingurl}<br />[ Error message returned was : '{$terror}'. ]";
|
||||
$emessage->add("was unable to ping {$pingurl}<br />[ Error message returned was : '{$terror}'. ]", E_MESSAGE_ERROR, $smessages);
|
||||
@ -282,11 +282,11 @@ class news {
|
||||
$data['error'] = $error;
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Manage SEF URL string for current news
|
||||
* FIXME - news rewrites should go to different handler
|
||||
*
|
||||
*
|
||||
* @param string $action insert|update
|
||||
* @param array $news_data XXX - could be changed to news_id only (integer)
|
||||
* @param array $rewrite_data
|
||||
@ -297,13 +297,13 @@ class news {
|
||||
{
|
||||
$rewrite_data['data']['news_rewrite_source'] = $news_data['news_id'];
|
||||
$rewrite_data['_FIELD_TYPES']['news_rewrite_source'] = 'int';
|
||||
|
||||
|
||||
$old_rewrite_data = array();
|
||||
if(e107::getDb()->db_Select('news_rewrite', '*', 'news_rewrite_source='.intval($rewrite_data['data']['news_rewrite_source']).' AND news_rewrite_type='.intval($rewrite_data['data']['news_rewrite_type'])))
|
||||
{
|
||||
$old_rewrite_data = e107::getDb()->db_Fetch();
|
||||
}
|
||||
|
||||
|
||||
//Delete if required
|
||||
if (empty($rewrite_data['data']['news_rewrite_string']))
|
||||
{
|
||||
@ -314,7 +314,7 @@ class news {
|
||||
e107::getAdminLog()->logArrayAll('NEWS_13', $old_rewrite_data);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -337,10 +337,10 @@ class news {
|
||||
eMessage::getInstance()->add('mySQL error #'.e107::getDb()->getLastErrorNumber().': '.e107::getDb()->getLastErrorText(), E_MESSAGE_DEBUG, $session_message);
|
||||
return 'error';
|
||||
break;
|
||||
|
||||
|
||||
case 'update':
|
||||
$id = intval($rewrite_data['data']['news_rewrite_id']);
|
||||
unset($rewrite_data['data']['news_rewrite_id']);
|
||||
unset($rewrite_data['data']['news_rewrite_id']);
|
||||
if($id)
|
||||
{
|
||||
$rewrite_data['WHERE'] = 'news_rewrite_id='.$id;
|
||||
@ -353,7 +353,7 @@ class news {
|
||||
return true;
|
||||
}
|
||||
elseif (e107::getDb()->getLastErrorNumber())
|
||||
{
|
||||
{
|
||||
eMessage::getInstance()->add('Friendly URL string related problem detected!', E_MESSAGE_ERROR, $session_message);
|
||||
if(1062 == e107::getDb()->getLastErrorNumber()) //detect duplicate mysql errnum
|
||||
{
|
||||
@ -362,14 +362,14 @@ class news {
|
||||
eMessage::getInstance()->add('mySQL error #'.e107::getDb()->getLastErrorNumber().': '.e107::getDb()->getLastErrorText(), E_MESSAGE_DEBUG, $session_message);
|
||||
return 'error';
|
||||
}
|
||||
|
||||
|
||||
$rewrite_data['data']['news_rewrite_id'] = $id;
|
||||
if($old_rewrite_data) self::clearRewriteCache($old_rewrite_data['news_rewrite_string']);
|
||||
self::setRewriteCache($rewrite_data['data']['news_rewrite_string'], $rewrite_data['data']);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$rewrite_data['data']['news_rewrite_id'] = 0;
|
||||
if($rewrite_data['data']['news_rewrite_id'] = e107::getDb()->db_Insert('news_rewrite', $rewrite_data))
|
||||
{
|
||||
@ -378,7 +378,7 @@ class news {
|
||||
e107::getAdminLog()->logArrayAll('NEWS_12', $rewrite_data['data']);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
eMessage::getInstance()->add('Friendly URL string related problem detected!', E_MESSAGE_ERROR, $session_message);
|
||||
if(1062 == e107::getDb()->getLastErrorNumber()) //detect duplicate mysql errnum
|
||||
{
|
||||
@ -388,10 +388,10 @@ class news {
|
||||
return 'error';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static function retrieveRewriteString($news_id, $type = 1)
|
||||
{
|
||||
//XXX - Best way we have now, discuss
|
||||
@ -416,7 +416,7 @@ class news {
|
||||
}
|
||||
unset($tmp);
|
||||
}
|
||||
|
||||
|
||||
//convert type if needed
|
||||
if(is_string($type))
|
||||
{
|
||||
@ -426,16 +426,16 @@ class news {
|
||||
case 'extend':
|
||||
$type = 1;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
$type = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (isset(self::$_rewrite_map[$type][$news_id]) ? self::$_rewrite_map[$type][$news_id] : '');
|
||||
}
|
||||
|
||||
|
||||
public static function retrieveRewriteData($sefstr, $force = true)
|
||||
{
|
||||
//check runtime cache
|
||||
@ -443,55 +443,55 @@ class news {
|
||||
{
|
||||
return self::$_rewrite_data[$sefstr];
|
||||
}
|
||||
|
||||
|
||||
//check server cache if allowed
|
||||
if(!$force && ($ret = self::getRewriteCache($sefstr, true)))
|
||||
{
|
||||
self::$_rewrite_data[$sefstr] = $ret;
|
||||
return self::$_rewrite_data[$sefstr];
|
||||
}
|
||||
|
||||
|
||||
//search DB
|
||||
$ret = array();
|
||||
if(e107::getDb()->db_Select('news_rewrite', '*', "news_rewrite_string='".e107::getParser()->toDB($sefstr)."'"))
|
||||
{
|
||||
$ret = e107::getDb()->db_Fetch();
|
||||
}
|
||||
|
||||
|
||||
//set runtime cache
|
||||
self::$_rewrite_data[$sefstr] = $ret;
|
||||
|
||||
|
||||
//set server cache
|
||||
if($ret)
|
||||
{
|
||||
self::setRewriteCache($sefstr, $ret);
|
||||
}
|
||||
|
||||
|
||||
return self::$_rewrite_data[$sefstr];
|
||||
}
|
||||
|
||||
|
||||
public static function getRewriteCache($sefstr, $toArray = true)
|
||||
{
|
||||
$sefstr = md5($sefstr);
|
||||
|
||||
|
||||
$ret = ecache::retrieve_sys('news_sefurl'.$sefstr, false, true);
|
||||
|
||||
|
||||
if($ret && $toArray)
|
||||
{
|
||||
return e107::getArrayStorage()->ReadArray($ret);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
public static function clearRewriteCache($sefstr = '')
|
||||
{
|
||||
if($sefstr) $sefstr = md5($sefstr);
|
||||
ecache::clear_sys("news_sefurl".$sefstr);
|
||||
}
|
||||
|
||||
|
||||
public static function setRewriteCache($sefstr, $data)
|
||||
{
|
||||
$sefstr = md5($sefstr);
|
||||
$sefstr = md5($sefstr);
|
||||
if(is_array($data)) $data = e107::getArrayStorage()->WriteArray($data, false);
|
||||
ecache::set_sys("news_sefurl".$sefstr, $data, true);
|
||||
}
|
||||
@ -534,8 +534,8 @@ class news {
|
||||
$tmp['caticon'] = (defined("NEWSLIST_CATICON")) ? NEWSLIST_CATICON : ICONSTYLE;
|
||||
|
||||
if(!$param) $param = array();
|
||||
$param = array_merge($tmp, $param);
|
||||
|
||||
$param = array_merge($tmp, $param);
|
||||
|
||||
|
||||
// Next three images aren't always defined by the caller, even if most of $param is.
|
||||
if (!isset($param['image_nonew_small']))
|
||||
@ -589,7 +589,7 @@ class news {
|
||||
}
|
||||
$loop_uid = $news['news_author'];
|
||||
|
||||
require_once(e_FILE.'shortcode/batch/news_shortcodes.php');
|
||||
require_once(e_CORE.'shortcodes/batch/news_shortcodes.php');
|
||||
setScVar('news_shortcodes', 'news_item', $news);
|
||||
setScVar('news_shortcodes', 'param', $param);
|
||||
$text = $e107->tp->parseTemplate($NEWS_PARSE, true);
|
||||
@ -622,10 +622,10 @@ class news {
|
||||
|
||||
require_once(e_HANDLER.'model_class.php');
|
||||
|
||||
class e_news_item extends e_model
|
||||
class e_news_item extends e_model
|
||||
{
|
||||
protected $_loaded_once = false;
|
||||
|
||||
|
||||
/**
|
||||
* Shortcodes - simple field getter (basic formatting)
|
||||
* THIS IS ONLY TEST, maybe useful for fields requiring simple formatting - it's a way too complicated for designers,
|
||||
@ -639,20 +639,20 @@ class e_news_item extends e_model
|
||||
{
|
||||
$tmp = explode('|', $parm, 2);
|
||||
$field = $tmp[0];
|
||||
|
||||
|
||||
if(!is_array($parm))
|
||||
{
|
||||
parse_str(varset($tmp[1]), $parm);
|
||||
}
|
||||
$val = $this->get($field, '');
|
||||
|
||||
|
||||
//do more with $parm array, just an example here
|
||||
if(varsettrue($parm['format']))
|
||||
{
|
||||
switch ($parm['format'])
|
||||
{
|
||||
//USAGE: {NEWS_FIELD=body|format=html&arg=1,BODY} -> callback e107->toHTML($value, true, 'BODY');
|
||||
case 'html':
|
||||
case 'html':
|
||||
$method = 'toHTML';
|
||||
$callback = e107::getParser();
|
||||
$parm['arg'] = explode(',', varset($parm['arg']));
|
||||
@ -660,11 +660,11 @@ class e_news_item extends e_model
|
||||
$params = array($val); //value is always the first callback argument
|
||||
$params += $parm['arg'];
|
||||
break;
|
||||
|
||||
|
||||
//USAGE: {NEWS_FIELD=body|format=html_truncate&arg=200,...} -> callback e107->html_truncate($value, 200, '...');
|
||||
case 'html_truncate':
|
||||
$val = e107::getParser()->toHTML($val, true);
|
||||
|
||||
|
||||
//USAGE: {NEWS_FIELD=title|format=text_truncate&arg=100,...} -> callback e107->text_truncate($value, 200, '...');
|
||||
case 'text_truncate':
|
||||
$method = $parm['format'];
|
||||
@ -672,7 +672,7 @@ class e_news_item extends e_model
|
||||
$params = array($val); //value is always the first callback argument
|
||||
$params = array_merge($params, explode(',', $parm['arg']));
|
||||
break;
|
||||
|
||||
|
||||
//USAGE: {NEWS_FIELD=title|format=date} -> strftime($pref[shortdate], $value);
|
||||
//USAGE: {NEWS_FIELD=title|format=date&arg=%Y} -> strftime('%Y', $value);
|
||||
case 'date':
|
||||
@ -683,18 +683,18 @@ class e_news_item extends e_model
|
||||
//should be done with date handler (awaiting for modifications)
|
||||
return strftime(varset($parm['arg'], e107::getPref('shortdate')), $val);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return $val;
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
return call_user_func_array(array($callback, $method), $params);
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Shorthand getter for news fields
|
||||
*
|
||||
@ -706,7 +706,7 @@ class e_news_item extends e_model
|
||||
{
|
||||
return parent::get('news_'.$news_field, $default);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load news item by id
|
||||
*
|
||||
@ -720,13 +720,13 @@ class e_news_item extends e_model
|
||||
{
|
||||
$id = intval($id);
|
||||
$nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
|
||||
|
||||
|
||||
$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
||||
WHERE n.news_id={$id} AND n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
||||
AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")";
|
||||
|
||||
|
||||
if(e107::getDb()->db_Select_gen($query))
|
||||
{
|
||||
$this->setData(e107::getDb()->db_Fetch());
|
||||
@ -737,7 +737,7 @@ class e_news_item extends e_model
|
||||
}
|
||||
}
|
||||
|
||||
class e_news_tree extends e_model
|
||||
class e_news_tree extends e_model
|
||||
{
|
||||
/**
|
||||
* Current tree news category id
|
||||
@ -745,12 +745,12 @@ class e_news_tree extends e_model
|
||||
* @var integer
|
||||
*/
|
||||
protected $_current_category_id;
|
||||
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_tree_db_total = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -763,7 +763,7 @@ class e_news_tree extends e_model
|
||||
$this->load($category_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set current category Id
|
||||
*
|
||||
@ -775,11 +775,11 @@ class e_news_tree extends e_model
|
||||
$this->_current_category_id = intval($category_id);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get news item object from the tree
|
||||
* Preparing for future news SEF string (string $name)
|
||||
*
|
||||
*
|
||||
* @param string|integer $name
|
||||
* @param integer $category_id optional category Id
|
||||
* @return e_news_item
|
||||
@ -792,7 +792,7 @@ class e_news_tree extends e_model
|
||||
}
|
||||
return $this->getData('__tree/'.$category_id.'/'.$name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set news item object
|
||||
*
|
||||
@ -810,7 +810,7 @@ class e_news_tree extends e_model
|
||||
$this->setData('__tree/'.$category_id.'/'.$name, new e_news_item($data));
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set new category tree
|
||||
*
|
||||
@ -827,7 +827,7 @@ class e_news_tree extends e_model
|
||||
$this->setData('__tree/'.$category_id, $tree);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get tree by category id
|
||||
*
|
||||
@ -842,7 +842,7 @@ class e_news_tree extends e_model
|
||||
}
|
||||
return $this->getData('__tree/'.$category_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Total records found (DB)
|
||||
* @param integer $category_id [optional]
|
||||
@ -856,7 +856,7 @@ class e_news_tree extends e_model
|
||||
}
|
||||
return (isset($this->_tree_db_total[$category_id]) ? $this->_tree_db_total[$category_id] : 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load tree by category id
|
||||
*
|
||||
@ -871,13 +871,13 @@ class e_news_tree extends e_model
|
||||
if(is_string($qry_data)) { parse_str($qry_data, $qry_data); }
|
||||
|
||||
$limit_from = varset($qry_data['limit_from'], 0);
|
||||
$limit_to = varset($qry_data['limit_to'], e107::getPref('newspost', 15));
|
||||
$limit_to = varset($qry_data['limit_to'], e107::getPref('newspost', 15));
|
||||
$order = varset($qry_data['order'], 'n.news_sticky DESC, n.news_datestamp DESC');
|
||||
|
||||
|
||||
$this->setCurrentCategoryId($category_id);
|
||||
|
||||
|
||||
//TODO - file cache $cacheString = md5($category_id.$limit_from.$order.e_CLASS_REGEXP);
|
||||
|
||||
|
||||
if($force || !$this->isTree())
|
||||
{
|
||||
$nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
|
||||
@ -891,12 +891,12 @@ class e_news_tree extends e_model
|
||||
WHERE{$where} n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
|
||||
AND n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
||||
ORDER BY ".e107::getParser()->toDB($order)." LIMIT ".intval($limit_from).",".intval($limit_to);
|
||||
|
||||
|
||||
$tree = array();
|
||||
if(e107::getDb()->db_Select_gen($query))
|
||||
{
|
||||
$this->_tree_db_total[$category_id] = (integer) e107::getDb()->total_results;
|
||||
|
||||
|
||||
while (true)
|
||||
{
|
||||
$row = e107::getDb()->db_Fetch();
|
||||
@ -908,22 +908,22 @@ class e_news_tree extends e_model
|
||||
}
|
||||
}
|
||||
$this->setTree($tree);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
function isTree($category_id = null)
|
||||
{
|
||||
if(null === $category_id)
|
||||
{
|
||||
$category_id = $this->_current_category_id;
|
||||
}
|
||||
|
||||
|
||||
return $this->isData('__tree/'.$category_id);
|
||||
}
|
||||
|
||||
|
||||
function isNode($name, $category_id = null)
|
||||
{
|
||||
if(null === $category_id)
|
||||
@ -932,7 +932,7 @@ class e_news_tree extends e_model
|
||||
}
|
||||
return $this->isData('__tree/'.$category_id.'/'.$name);
|
||||
}
|
||||
|
||||
|
||||
function hasNode($name, $category_id = null)
|
||||
{
|
||||
if(null === $category_id)
|
||||
@ -956,38 +956,38 @@ class e_news_category_item extends e_model
|
||||
{
|
||||
return parent::get('category_'.$category_field, $default);
|
||||
}
|
||||
|
||||
|
||||
public function sc_news_category_title($parm = '')
|
||||
{
|
||||
if('attribute' == $parm) return e107::getParser()->toAttribute($this->get('name'));
|
||||
return $this->get('name');
|
||||
}
|
||||
|
||||
|
||||
public function sc_news_category_url($parm = '')
|
||||
{
|
||||
|
||||
|
||||
$url = e107::getUrl()->create('core:news', 'main', 'action=list&id='.$this->getId().'&sef='.$this->get('rewrite_string'));
|
||||
switch($parm)
|
||||
{
|
||||
case 'link':
|
||||
return '<a href="'.$url.'" class="news-category">'.$this->sc_news_category_title().'</a>';
|
||||
break;
|
||||
|
||||
|
||||
case 'link_icon':
|
||||
return '<a href="'.$url.'" class="news-category">'.$this->sc_news_category_icon().' '.$this->sc_news_category_title().'</a>';
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return $url;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function sc_news_category_link()
|
||||
{
|
||||
return $this->sc_news_category_url('link');
|
||||
}
|
||||
|
||||
|
||||
public function sc_news_category_icon($parm = '')
|
||||
{
|
||||
if(!$this->get('icon'))
|
||||
@ -998,7 +998,7 @@ class e_news_category_item extends e_model
|
||||
{
|
||||
$src = e107::getParser()->replaceConstants($this->get('icon'));
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$src = e_IMAGE_ABS.'icons/'.$this->get('icon');
|
||||
}
|
||||
@ -1010,13 +1010,13 @@ class e_news_category_item extends e_model
|
||||
case 'link':
|
||||
return '<a href="'.$this->sc_news_category_url().'" class="news-category" title="'.$this->sc_news_category_title('attribute').'"><img src="'.$src.'" class="icon news-category" alt="'.$this->sc_news_category_title('attribute').'" /></a>';
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return '<img src="'.$src.'" class="icon news-category" alt="'.$this->sc_news_category_title('attribute').'" />';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function sc_news_category_news_count($parm = '')
|
||||
{
|
||||
if(!$this->is('category_news_count'))
|
||||
@ -1025,7 +1025,7 @@ class e_news_category_item extends e_model
|
||||
}
|
||||
return (string) $this->get('news_count');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class e_news_category_tree extends e_model
|
||||
@ -1034,14 +1034,14 @@ class e_news_category_tree extends e_model
|
||||
* @var array
|
||||
*/
|
||||
protected $_tree_db_total = array();
|
||||
|
||||
|
||||
/**
|
||||
* Get category news item object from the tree
|
||||
* If $force_empty is true and corresponding category object can't be found,
|
||||
* If $force_empty is true and corresponding category object can't be found,
|
||||
* empty object will be set/returned if
|
||||
*
|
||||
*
|
||||
* @param integer $category_id
|
||||
* @param boolean $force_empty
|
||||
* @param boolean $force_empty
|
||||
* @return e_news_category_item
|
||||
*/
|
||||
function getNode($category_id, $force_empty = false)
|
||||
@ -1052,10 +1052,10 @@ class e_news_category_tree extends e_model
|
||||
$default = new e_news_category();
|
||||
$this->setNode($category_id, $default);
|
||||
}
|
||||
|
||||
|
||||
return $this->getData('__tree/'.$category_id, $default);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set category news item object
|
||||
*
|
||||
@ -1071,10 +1071,10 @@ class e_news_category_tree extends e_model
|
||||
}
|
||||
$this->_tree_total = null;
|
||||
$this->setData('__tree/'.$category_id, $category_object);
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set news category tree array
|
||||
*
|
||||
@ -1085,10 +1085,10 @@ class e_news_category_tree extends e_model
|
||||
{
|
||||
$this->_tree_total = null;
|
||||
$this->setData('__tree', $tree);
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get news category tree array
|
||||
*
|
||||
@ -1098,10 +1098,10 @@ class e_news_category_tree extends e_model
|
||||
{
|
||||
return $this->getData('__tree', array());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Total records found (DB)
|
||||
*
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
function getTreeTotal()
|
||||
@ -1112,10 +1112,10 @@ class e_news_category_tree extends e_model
|
||||
}
|
||||
return $this->_tree_total;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load category data from the DB
|
||||
*
|
||||
*
|
||||
* @param boolean $force
|
||||
* @return e_news_category_tree
|
||||
*/
|
||||
@ -1131,7 +1131,7 @@ class e_news_category_tree extends e_model
|
||||
{
|
||||
$qry = "
|
||||
SELECT nc.*, ncr.news_rewrite_string AS category_rewrite_string, ncr.news_rewrite_id AS category_rewrite_id FROM #news_category AS nc
|
||||
LEFT JOIN #news_rewrite AS ncr ON nc.category_id=ncr.news_rewrite_source AND ncr.news_rewrite_type=2
|
||||
LEFT JOIN #news_rewrite AS ncr ON nc.category_id=ncr.news_rewrite_source AND ncr.news_rewrite_type=2
|
||||
ORDER BY nc.category_order ASC
|
||||
";
|
||||
}
|
||||
@ -1139,11 +1139,11 @@ class e_news_category_tree extends e_model
|
||||
{
|
||||
$qry = "SELECT * FROM #news_category ORDER BY category_order ASC";
|
||||
}
|
||||
|
||||
|
||||
$tree = array();
|
||||
$sql = e107::getDb();
|
||||
$sql->db_Mark_Time('news_category_tree');
|
||||
|
||||
|
||||
if($sql->db_Select_gen($qry))
|
||||
{
|
||||
while($row = $sql->db_Fetch())
|
||||
@ -1152,13 +1152,13 @@ class e_news_category_tree extends e_model
|
||||
}
|
||||
}
|
||||
$this->setTree($tree);
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load active categories only (containing active news items)
|
||||
*
|
||||
*
|
||||
* @param boolean $force
|
||||
* @return e_news_category_tree
|
||||
*/
|
||||
@ -1176,7 +1176,7 @@ class e_news_category_tree extends e_model
|
||||
{
|
||||
$qry = "
|
||||
SELECT COUNT(n.news_id) AS category_news_count, nc.*, ncr.news_rewrite_string AS category_rewrite_string, ncr.news_rewrite_id AS category_rewrite_id FROM #news_category AS nc
|
||||
LEFT JOIN #news_rewrite AS ncr ON nc.category_id=ncr.news_rewrite_source AND ncr.news_rewrite_type=2
|
||||
LEFT JOIN #news_rewrite AS ncr ON nc.category_id=ncr.news_rewrite_source AND ncr.news_rewrite_type=2
|
||||
LEFT JOIN #news AS n ON n.news_category=nc.category_id
|
||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
||||
AND n.news_start < ".$time." AND (n.news_end=0 || n.news_end>".$time.")
|
||||
@ -1195,11 +1195,11 @@ class e_news_category_tree extends e_model
|
||||
ORDER BY nc.category_order ASC
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
$tree = array();
|
||||
$sql = e107::getDb();
|
||||
$sql->db_Mark_Time('news_category_tree');
|
||||
|
||||
|
||||
if($sql->db_Select_gen($qry))
|
||||
{
|
||||
while($row = $sql->db_Fetch())
|
||||
@ -1208,13 +1208,13 @@ class e_news_category_tree extends e_model
|
||||
}
|
||||
}
|
||||
$this->setTree($tree);
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render Category tree
|
||||
*
|
||||
*
|
||||
* @param array $parms [return, parsesc=>1|0, mode=>string]
|
||||
* @param boolean $tablerender
|
||||
* @param array $force_template template override
|
||||
@ -1226,36 +1226,36 @@ class e_news_category_tree extends e_model
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
$template = $force_template; //TODO template search, more template freedom, tree shortcodes
|
||||
$ret = array();
|
||||
$tp = e107::getParser();
|
||||
|
||||
|
||||
if(!isset($parms['parsesc'])) $parms['parsesc'] = true;
|
||||
$parsesc = $parms['parsesc'] ? true : false;
|
||||
|
||||
|
||||
foreach ($this->getTree() as $cat)
|
||||
{
|
||||
$ret[] = $tp->parseTemplate($template['item'], $parsesc, $cat);
|
||||
}
|
||||
|
||||
|
||||
if($ret)
|
||||
{
|
||||
$separator = varset($template['separator'], '');
|
||||
$ret = implode($separator, $ret);
|
||||
$return = isset($parms['return']) ? true : false;
|
||||
|
||||
|
||||
if($tablerender)
|
||||
{
|
||||
$caption = vartrue($parms['caption']) ? defset($parms['caption'], $parms['caption']) : LAN_NEWSCAT_MENU_TITLE; // found in plugins/news/languages/English.php
|
||||
$mod = true === $tablerender ? 'news_categories_menu' : $tablerender;
|
||||
return e107::getRender()->tablerender($caption, $ret, varset($parms['mode'], $mod), $return);
|
||||
}
|
||||
|
||||
|
||||
if($return) return $ret;
|
||||
echo $ret;
|
||||
}
|
||||
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@ -80,14 +80,14 @@ function display_help($tagid="helpb", $mode = 1, $addtextfunc = "addtext", $help
|
||||
$BBCODE_TEMPLATE = $temp[$mode];
|
||||
}
|
||||
|
||||
if(is_readable(e_FILE."shortcode/batch/bbcode_shortcodes.php"))
|
||||
if(is_readable(e_CORE."shortcodes/batch/bbcode_shortcodes.php"))
|
||||
{
|
||||
require_once(e_FILE."shortcode/batch/bbcode_shortcodes.php");
|
||||
require_once(e_CORE."shortcodes/batch/bbcode_shortcodes.php");
|
||||
return $tp->parseTemplate($BBCODE_TEMPLATE);
|
||||
}
|
||||
else
|
||||
{
|
||||
return "ERROR: ".e_FILE."shortcode/batch/bbcode_shortcodes.php IS NOT READABLE.";
|
||||
return "ERROR: ".e_CORE."shortcodes/batch/bbcode_shortcodes.php IS NOT READABLE.";
|
||||
}
|
||||
|
||||
}
|
||||
@ -230,7 +230,7 @@ function PreImage_Select($formid) {
|
||||
|
||||
|
||||
// Parameter '$bbcode_filedir' removed - not used in code.
|
||||
function PreFile_Select($formid='prefile_selector')
|
||||
function PreFile_Select($formid='prefile_selector')
|
||||
{
|
||||
require_once(e_HANDLER."userclass_class.php");
|
||||
global $IMAGES_DIRECTORY, $fl;
|
||||
|
@ -31,7 +31,7 @@ if (!defined('e107_INIT')) { exit; }
|
||||
function register_shortcode($classFunc, $codes, $path='', $force = false)
|
||||
{
|
||||
$sc = e107::getScParser();
|
||||
|
||||
|
||||
//If codes is set to true, let's go get a list of shortcode methods
|
||||
if(/*is_bool($codes) && */$codes === true) //double check fix
|
||||
{
|
||||
@ -46,14 +46,14 @@ function register_shortcode($classFunc, $codes, $path='', $force = false)
|
||||
}
|
||||
unset($tmp);
|
||||
}
|
||||
|
||||
|
||||
//Register object feature
|
||||
$classObj = null;
|
||||
if(is_object($classFunc))
|
||||
{
|
||||
$classObj = $classFunc;
|
||||
$classFunc = get_class($classObj);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//We only register these shortcodes if they have not already been registered in some manner
|
||||
@ -68,7 +68,7 @@ function register_shortcode($classFunc, $codes, $path='', $force = false)
|
||||
$sc->registered_codes[$code] = array('type' => 'class', 'path' => $path, 'class' => $classFunc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//register object if required
|
||||
if(null !== $classObj && !isset($sc->scClasses[$classFunc]))
|
||||
{
|
||||
@ -139,7 +139,7 @@ function initShortcodeClass($class, $force = false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class e_shortcode
|
||||
{
|
||||
@ -161,18 +161,19 @@ class e_shortcode
|
||||
$this->loadThemeShortcodes();
|
||||
$this->loadPluginShortcodes();
|
||||
$this->loadPluginSCFiles();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register any shortcode from the shortcode/override/ directory
|
||||
* Register any shortcode from the shortcodes/override/ directory
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
//FIXME - should use e_SYSTEM/override/
|
||||
protected function loadOverrideShortcodes()
|
||||
{
|
||||
$pref = e107::getConfig('core')->getPref();
|
||||
|
||||
|
||||
if(varset($pref['sc_override']))
|
||||
{
|
||||
$tmp = explode(',', $pref['sc_override']);
|
||||
@ -184,7 +185,7 @@ class e_shortcode
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register any shortcodes that were registered by the theme
|
||||
* $register_sc[] = 'MY_THEME_CODE'
|
||||
@ -194,7 +195,7 @@ class e_shortcode
|
||||
protected function loadThemeShortcodes()
|
||||
{
|
||||
global $register_sc;
|
||||
|
||||
|
||||
if(isset($register_sc) && is_array($register_sc))
|
||||
{
|
||||
foreach($register_sc as $code)
|
||||
@ -207,8 +208,8 @@ class e_shortcode
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Register all .sc files found in plugin directories (via pref)
|
||||
*
|
||||
@ -217,7 +218,7 @@ class e_shortcode
|
||||
protected function loadPluginSCFiles()
|
||||
{
|
||||
$pref = e107::getConfig('core')->getPref();
|
||||
|
||||
|
||||
if(varset($pref['shortcode_list'], '') != '')
|
||||
{
|
||||
foreach($pref['shortcode_list'] as $path => $namearray)
|
||||
@ -252,7 +253,7 @@ class e_shortcode
|
||||
protected function loadPluginShortcodes()
|
||||
{
|
||||
$pref = e107::getConfig('core')->getPref();
|
||||
|
||||
|
||||
if(!vartrue($pref['e_shortcode_list']))
|
||||
{
|
||||
return;
|
||||
@ -267,7 +268,7 @@ class e_shortcode
|
||||
$path = e_PLUGIN.$key.'/e_shortcode.php';
|
||||
$classFunc = $key.'_shortcodes';
|
||||
$this->scClasses[$classFunc] = new $classFunc;
|
||||
|
||||
|
||||
$tmp = get_class_methods($classFunc);
|
||||
foreach($tmp as $c)
|
||||
{
|
||||
@ -295,7 +296,7 @@ class e_shortcode
|
||||
$coreBatchList = array('admin_shortcodes.php');
|
||||
foreach($coreBatchList as $cb)
|
||||
{
|
||||
include_once(e_FILE.'shortcode/batch/'.$cb);
|
||||
include_once(e_CORE.'shortcodes/batch/'.$cb);
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,7 +304,7 @@ class e_shortcode
|
||||
{
|
||||
return in_array($code, $this->registered_codes);
|
||||
}
|
||||
|
||||
|
||||
public function resetScClass($className, $object)
|
||||
{
|
||||
if($this->isScClass($className))
|
||||
@ -311,7 +312,7 @@ class e_shortcode
|
||||
$this->scClasses[$className] = $object;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function isScClass($className)
|
||||
{
|
||||
return isset($this->scClasses[$className]);
|
||||
@ -326,7 +327,7 @@ class e_shortcode
|
||||
{
|
||||
$saveParseSCFiles = $this->parseSCFiles; // In case of nested call
|
||||
$this->parseSCFiles = $useSCFiles;
|
||||
|
||||
|
||||
if(is_object($eVars)) {
|
||||
$this->eVars = $eVars;
|
||||
}
|
||||
@ -335,13 +336,13 @@ class e_shortcode
|
||||
if(is_object($extraCodes))
|
||||
{
|
||||
$classname = get_class($extraCodes);
|
||||
|
||||
|
||||
//register once
|
||||
if(!$this->isScClass($classname))
|
||||
{
|
||||
register_shortcode($extraCodes, true);
|
||||
}
|
||||
|
||||
|
||||
//always overwrite object
|
||||
$this->scClasses[$classname] = $extraCodes;
|
||||
}
|
||||
@ -445,14 +446,14 @@ class e_shortcode
|
||||
}
|
||||
if(method_exists($this->scClasses[$_class], $_method))
|
||||
{
|
||||
|
||||
|
||||
$ret = $this->scClasses[$_class]->$_method($parm, $sc_mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $_class.'::'.$_method.' NOT FOUND!<br />';
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'func':
|
||||
@ -474,7 +475,7 @@ class e_shortcode
|
||||
break;
|
||||
|
||||
case 'override':
|
||||
$scFile = e_FILE.'shortcode/override/'.strtolower($code).'.sc';
|
||||
$scFile = e_FILE.'shortcodes/override/'.strtolower($code).'.sc';
|
||||
break;
|
||||
|
||||
case 'theme':
|
||||
@ -487,13 +488,13 @@ class e_shortcode
|
||||
{
|
||||
// Code is not registered, let's look for .sc or .php file
|
||||
// .php file takes precedence over .sc file
|
||||
if(is_readable(e_FILE.'shortcode/'.strtolower($code).'.php'))
|
||||
if(is_readable(e_CORE.'shortcodes/single/'.strtolower($code).'.php'))
|
||||
{
|
||||
$_function = strtolower($code).'_shortcode';
|
||||
$_class = strtolower($code);
|
||||
|
||||
include_once(e_FILE.'shortcode/'.strtolower($code).'.php');
|
||||
|
||||
|
||||
include_once(e_CORE.'shortcodes/single/'.strtolower($code).'.php');
|
||||
|
||||
if(class_exists($_class, false)) // prevent __autoload - performance
|
||||
{
|
||||
$ret = call_user_func(array($_class,$_function), $parm);
|
||||
@ -505,7 +506,7 @@ class e_shortcode
|
||||
}
|
||||
else
|
||||
{
|
||||
$scFile = e_FILE.'shortcode/'.strtolower($code).'.sc';
|
||||
$scFile = e_CORE.'shortcodes/single/'.strtolower($code).'.sc';
|
||||
}
|
||||
}
|
||||
if ($scFile && file_exists($scFile))
|
||||
@ -523,7 +524,7 @@ class e_shortcode
|
||||
|
||||
if(E107_DBG_SC && $scFile)
|
||||
{
|
||||
// echo (isset($scFile)) ? "<br />sc_file= ".str_replace(e_FILE.'shortcode/', '', $scFile).'<br />' : '';
|
||||
// echo (isset($scFile)) ? "<br />sc_file= ".str_replace(e_CORE.'shortcodes/single/', '', $scFile).'<br />' : '';
|
||||
// echo "<br />sc= <b>$code</b>";
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ $menu_pref = e107::getConfig('menu')->getPref('');
|
||||
if(isset($campaign))
|
||||
{
|
||||
$parm = $campaign;
|
||||
$bannersccode = file_get_contents(e_FILE.'shortcode/banner.sc');
|
||||
$bannersccode = file_get_contents(e_CORE.'shortcodes/single/banner.sc');
|
||||
$BANNER = eval($bannersccode);
|
||||
$txt = $BANNER_MENU_START;
|
||||
$txt .= preg_replace("/\{(.*?)\}/e", '$\1', $BANNER_MENU);
|
||||
@ -80,11 +80,11 @@ else
|
||||
$parms[] = $menu_pref['banner_campaign'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$txt = $BANNER_MENU_START;
|
||||
foreach ($parms as $parm)
|
||||
{
|
||||
$bannersccode = file_get_contents(e_FILE.'shortcode/banner.sc');
|
||||
$bannersccode = file_get_contents(e_CORE.'shortcodes/banner.sc');
|
||||
$BANNER = eval($bannersccode);
|
||||
$txt .= preg_replace("/\{(.*?)\}/e", '$\1', $BANNER_MENU);
|
||||
}
|
||||
|
@ -2,63 +2,63 @@
|
||||
//error_reporting(E_ALL);
|
||||
|
||||
|
||||
if (e_ADMIN_AREA !== TRUE)
|
||||
if (e_ADMIN_AREA !== TRUE && e107::isInstalled('facebook'))
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
e107::getEvent()->register('logout',array('e_facebook','fb_logout'),e_PLUGIN.'facebook/facebook_function.php');
|
||||
global $fb;
|
||||
|
||||
|
||||
$fb = e107::getSingleton('e_facebook',e_PLUGIN.'facebook/facebook_function.php');
|
||||
include_once (e_PLUGIN.'facebook/facebook_function.php');
|
||||
|
||||
|
||||
if (function_exists('prevent_cache_headers'))
|
||||
{
|
||||
prevent_cache_headers();
|
||||
}
|
||||
|
||||
define('XMLNS', "xmlns:fb='http://www.facebook.com/2008/fbml'");
|
||||
|
||||
|
||||
global $pref;
|
||||
|
||||
|
||||
if ($pref['disable_emailcheck'] == 0) // Ensure "Make entering an email address optional" is setted to "ON";
|
||||
{
|
||||
$pref['disable_emailcheck'] = 1;
|
||||
save_prefs();
|
||||
}
|
||||
|
||||
|
||||
if (e_QUERY == 'facebook') // when clicked it inserts a new User in e107.
|
||||
{
|
||||
Fb_Connect_Me();
|
||||
}
|
||||
|
||||
|
||||
if (e_QUERY == 'login') // simple Re-Login after logged out from e107
|
||||
{
|
||||
$fb->fb_login(); // Fb_LogIn();
|
||||
}
|
||||
|
||||
|
||||
if (e_QUERY == 'logout') // simulate Facebook logOut when logged out from e107
|
||||
{
|
||||
// Fb_LogOut();
|
||||
}
|
||||
|
||||
|
||||
if (e_QUERY == 'facebook_switch')
|
||||
{
|
||||
Switch_Facebook_User();
|
||||
}
|
||||
|
||||
if (USERID && (e_QUERY == 'facebook_link') && $fb->fb_uid) //
|
||||
if (USERID && (e_QUERY == 'facebook_link') && $fb->fb_uid) //
|
||||
{
|
||||
// $fb->Add_Facebook_Connect_User('', USERID);
|
||||
$fb->addFacebookUser();
|
||||
}
|
||||
|
||||
|
||||
if (e_QUERY == 'facebook_delete')
|
||||
{
|
||||
|
||||
|
||||
Delete_Duplicate_Facebook_User();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -71,29 +71,29 @@ if (e_ADMIN_AREA !== TRUE)
|
||||
* rendering takes over. otherwise, it might miss some elements in the doc.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
global $onload_js;
|
||||
|
||||
|
||||
$text .= render_facebook_init_js($fb->fb_uid);
|
||||
// Print out all onload function calls
|
||||
|
||||
|
||||
if ($onload_js)
|
||||
{
|
||||
|
||||
|
||||
$text .= '<script type="text/javascript">'.'window.onload = function() { '.$onload_js.' };'.'</script>';
|
||||
|
||||
|
||||
}
|
||||
return $text;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Facebook Deprecated get Feed Story trough Template Bundle 2009
|
||||
*
|
||||
|
||||
|
||||
function getTemplateData() {
|
||||
|
||||
|
||||
$template_data = array(
|
||||
'post_title' => $_POST[ 'subject' ],
|
||||
'body' => $_POST[ 'comment' ],
|
||||
@ -102,13 +102,13 @@ if (e_ADMIN_AREA !== TRUE)
|
||||
'blogname' => SITENAME,
|
||||
'blogdesc' => SITEDESCRIPTION,
|
||||
'siteurl' => SITEURLBASE);
|
||||
|
||||
|
||||
return $template_data;
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* get Feed Story infos to send to Facebook
|
||||
*
|
||||
@ -121,22 +121,22 @@ if (e_ADMIN_AREA !== TRUE)
|
||||
{
|
||||
//global $pref;
|
||||
//$stream = facebook_client()->api_client->stream_get('','','','','',''.$pref[ 'Facebook_App-Bundle' ].'','');
|
||||
|
||||
|
||||
// $stream = facebook_client()->api_client->stream_publish($_POST[ 'comment' ]);
|
||||
|
||||
|
||||
return $_POST['comment'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* if comment is submitted and "publish_to_facebook" is checked send a copy to Facebook
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
if (isset($_POST['commentsubmit']) && ($_POST['publish_to_facebook'] == true))
|
||||
{
|
||||
|
||||
|
||||
register_feed_form_js();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
78
news.php
78
news.php
@ -96,7 +96,7 @@ if(NEWS_REWRITE)
|
||||
//item
|
||||
$rewrite_join = 'LEFT JOIN #news_rewrite AS nr ON n.news_id=nr.news_rewrite_source AND nr.news_rewrite_type=1';
|
||||
$rewrite_cols = ', nr.*';
|
||||
|
||||
|
||||
//category
|
||||
$rewrite_join_cat = 'LEFT JOIN #news_rewrite AS ncr ON n.news_category=ncr.news_rewrite_source AND ncr.news_rewrite_type=2';
|
||||
$rewrite_cols_cat = ', ncr.news_rewrite_id AS news_category_rewrite_id, ncr.news_rewrite_string AS news_category_rewrite_string ';
|
||||
@ -130,8 +130,8 @@ if ($action == 'cat' || $action == 'all')
|
||||
// show archive of all news items using list-style template.
|
||||
$news_total = $sql->db_Count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().")");
|
||||
$query = "
|
||||
SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon,
|
||||
nc.category_meta_keywords, nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||
SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon,
|
||||
nc.category_meta_keywords, nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||
FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
||||
@ -150,7 +150,7 @@ if ($action == 'cat' || $action == 'all')
|
||||
if(!defined("NEWSLIST_LIMIT")) { define("NEWSLIST_LIMIT",10); }
|
||||
$query = "
|
||||
SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon, nc.category_meta_keywords,
|
||||
nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||
nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||
FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
||||
@ -162,13 +162,13 @@ if ($action == 'cat' || $action == 'all')
|
||||
ORDER BY n.news_datestamp DESC
|
||||
LIMIT ".intval($newsfrom).",".NEWSLIST_LIMIT;
|
||||
}
|
||||
|
||||
|
||||
$newsList = array();
|
||||
if($sql->db_Select_gen($query))
|
||||
{
|
||||
$newsList = $sql->db_getList();
|
||||
}
|
||||
|
||||
|
||||
if($action == 'cat') setNewsFrontMeta($newsList[1], 'category');
|
||||
elseif($category_name)
|
||||
{
|
||||
@ -199,14 +199,14 @@ if ($action == 'cat' || $action == 'all')
|
||||
</div>\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
$param = array();
|
||||
$param['itemlink'] = (defined("NEWSLIST_ITEMLINK")) ? NEWSLIST_ITEMLINK : "";
|
||||
$param['thumbnail'] =(defined("NEWSLIST_THUMB")) ? NEWSLIST_THUMB : "border:0px";
|
||||
$param['catlink'] = (defined("NEWSLIST_CATLINK")) ? NEWSLIST_CATLINK : "";
|
||||
$param['caticon'] = (defined("NEWSLIST_CATICON")) ? NEWSLIST_CATICON : ICONSTYLE;
|
||||
$param['current_action'] = $action;
|
||||
|
||||
|
||||
foreach($newsList as $row)
|
||||
{
|
||||
$text .= $ix->render_newsitem($row, 'return', '', $NEWSLISTSTYLE, $param);
|
||||
@ -241,7 +241,7 @@ if ($action == 'cat' || $action == 'all')
|
||||
//------------------------------------------------------
|
||||
// DISPLAY SINGLE ITEM IN EXTENDED FORMAT HERE
|
||||
//------------------------------------------------------
|
||||
if ($action == 'extend')
|
||||
if ($action == 'extend')
|
||||
{ // --> Cache
|
||||
if($newsCachedPage = checkCache($cacheString))
|
||||
{
|
||||
@ -253,8 +253,8 @@ if ($action == 'extend')
|
||||
if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'])
|
||||
{
|
||||
$query = "
|
||||
SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name,
|
||||
nc.category_icon, nc.category_meta_keywords, nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||
SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name,
|
||||
nc.category_icon, nc.category_meta_keywords, nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||
FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
||||
@ -269,37 +269,37 @@ if ($action == 'extend')
|
||||
else
|
||||
{
|
||||
$query = "
|
||||
SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon, nc.category_meta_keywords,
|
||||
SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon, nc.category_meta_keywords,
|
||||
nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||
FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
|
||||
{$rewrite_join}
|
||||
{$rewrite_join_cat}
|
||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."'
|
||||
AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
||||
AND n.news_start < ".time()."
|
||||
AND (n.news_end=0 || n.news_end>".time().")
|
||||
WHERE n.news_class REGEXP '".e_CLASS_REGEXP."'
|
||||
AND NOT (n.news_class REGEXP ".$nobody_regexp.")
|
||||
AND n.news_start < ".time()."
|
||||
AND (n.news_end=0 || n.news_end>".time().")
|
||||
AND n.news_id=".intval($sub_action);
|
||||
}
|
||||
if ($sql->db_Select_gen($query))
|
||||
{
|
||||
$news = $sql->db_Fetch();
|
||||
$id = $news['news_category']; // Use category of this news item to generate next/prev links
|
||||
|
||||
|
||||
//***NEW [SecretR] - comments handled inside now
|
||||
e107::setRegistry('news/page_allow_comments', !$news['news_allow_comments']);
|
||||
if(!$news['news_allow_comments'] && isset($_POST['commentsubmit']))
|
||||
{
|
||||
$pid = intval(varset($_POST['pid'], 0)); // ID of the specific comment being edited (nested comments - replies)
|
||||
|
||||
|
||||
$clean_authorname = $_POST['author_name'];
|
||||
$clean_comment = $_POST['comment'];
|
||||
$clean_subject = $_POST['subject'];
|
||||
|
||||
|
||||
e107::getSingleton('comment')->enter_comment($clean_authorname, $clean_comment, 'news', $sub_action, $pid, $clean_subject);
|
||||
}
|
||||
|
||||
|
||||
//More SEO
|
||||
setNewsFrontMeta($news);
|
||||
/*
|
||||
@ -318,8 +318,8 @@ if ($action == 'extend')
|
||||
if (!isset($news['news_extended'])) $news['news_extended'] = '';
|
||||
$news['news_extended'].="<div style='text-align:center;'><a href='".e_SELF."?cat.".$id."'>".LAN_NEWS_85."</a> <a href='".e_SELF."'>".LAN_NEWS_84."</a></div>";
|
||||
$prev_query = "SELECT news_id, news_title FROM `#news`
|
||||
WHERE `news_id` < ".intval($sub_action)." AND `news_category`=".$id." AND `news_class` REGEXP '".e_CLASS_REGEXP."'
|
||||
AND NOT (`news_class` REGEXP ".$nobody_regexp.")
|
||||
WHERE `news_id` < ".intval($sub_action)." AND `news_category`=".$id." AND `news_class` REGEXP '".e_CLASS_REGEXP."'
|
||||
AND NOT (`news_class` REGEXP ".$nobody_regexp.")
|
||||
AND `news_start` < ".time()." AND (`news_end`=0 || `news_end` > ".time().') ORDER BY `news_id` DESC LIMIT 1';
|
||||
$sql->db_Select_gen($prev_query);
|
||||
$prev_news = $sql->db_Fetch();
|
||||
@ -328,8 +328,8 @@ if ($action == 'extend')
|
||||
$news['news_extended'].="<div style='float:right;'><a href='".e_SELF."?extend.".$prev_news['news_id']."'>".LAN_NEWS_86."</a></div>";
|
||||
}
|
||||
$next_query = "SELECT news_id, news_title FROM `#news` AS n
|
||||
WHERE `news_id` > ".intval($sub_action)." AND `news_category` = ".$id." AND `news_class` REGEXP '".e_CLASS_REGEXP."'
|
||||
AND NOT (`news_class` REGEXP ".$nobody_regexp.")
|
||||
WHERE `news_id` > ".intval($sub_action)." AND `news_category` = ".$id." AND `news_class` REGEXP '".e_CLASS_REGEXP."'
|
||||
AND NOT (`news_class` REGEXP ".$nobody_regexp.")
|
||||
AND `news_start` < ".time()." AND (`news_end`=0 || `news_end` > ".time().') ORDER BY `news_id` ASC LIMIT 1';
|
||||
$sql->db_Select_gen($next_query);
|
||||
$next_news = $sql->db_Fetch();
|
||||
@ -341,10 +341,10 @@ if ($action == 'extend')
|
||||
}
|
||||
|
||||
require_once(HEADERF);
|
||||
|
||||
|
||||
$param = array();
|
||||
$param['current_action'] = $action;
|
||||
|
||||
|
||||
ob_start();
|
||||
$ix->render_newsitem($news, 'extend', '', '', $param);
|
||||
if(e107::getRegistry('news/page_allow_comments'))
|
||||
@ -384,7 +384,7 @@ switch ($action)
|
||||
$sub_action = intval($sub_action);
|
||||
// $news_total = $sql->db_Count("news", "(*)", "WHERE news_category={$sub_action} AND news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().")");
|
||||
$query = "
|
||||
SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name,
|
||||
SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name,
|
||||
nc.category_icon, nc.category_meta_keywords, nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||
FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
@ -404,7 +404,7 @@ switch ($action)
|
||||
if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'])
|
||||
{
|
||||
$query = "
|
||||
SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name,
|
||||
SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name,
|
||||
nc.category_icon, nc.category_meta_keywords, nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||
FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
@ -449,7 +449,7 @@ switch ($action)
|
||||
$startdate = mktime(0, 0, 0, $month, $day, $year);
|
||||
$enddate = mktime(23, 59, 59, $month, $lastday, $year);
|
||||
$query = "
|
||||
SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name,
|
||||
SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name,
|
||||
nc.category_icon, nc.category_meta_keywords, nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||
FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
@ -477,8 +477,8 @@ switch ($action)
|
||||
// Get number of news item to show
|
||||
if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled']) {
|
||||
$query = "
|
||||
SELECT SQL_CALC_FOUND_ROWS COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle,
|
||||
nc.category_name, nc.category_icon, nc.category_meta_keywords, nc.category_meta_description,
|
||||
SELECT SQL_CALC_FOUND_ROWS COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle,
|
||||
nc.category_name, nc.category_icon, nc.category_meta_keywords, nc.category_meta_description,
|
||||
COUNT(*) AS tbcount{$rewrite_cols_cat}{$rewrite_cols}
|
||||
FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
@ -495,7 +495,7 @@ switch ($action)
|
||||
else
|
||||
{
|
||||
$query = "
|
||||
SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon,
|
||||
SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon,
|
||||
nc.category_meta_keywords, nc.category_meta_description{$rewrite_cols_cat}{$rewrite_cols}
|
||||
FROM #news AS n
|
||||
LEFT JOIN #user AS u ON n.news_author = u.user_id
|
||||
@ -657,7 +657,7 @@ else
|
||||
// #### normal newsitems, rendered via render_newsitem(), the $query is changed above (no other changes made) ---------
|
||||
$param = array();
|
||||
$param['current_action'] = $action;
|
||||
|
||||
|
||||
$i= 1;
|
||||
while(isset($newsAr[$i]) && $i <= $interval) {
|
||||
$news = $newsAr[$i];
|
||||
@ -695,7 +695,7 @@ function show_newsarchive($newsAr, $i = 1)
|
||||
global $ns, $gen, $pref, $tp, $news_archive_shortcodes, $NEWSARCHIVE, $news2;
|
||||
|
||||
// do not show the news archive on the news.php?item.X page (but only on the news mainpage)
|
||||
require_once(e_FILE.'shortcode/batch/news_archives.php');
|
||||
require_once(e_CORE.'shortcodes/batch/news_archives.php');
|
||||
|
||||
$textnewsarchive = '';
|
||||
ob_start();
|
||||
@ -843,29 +843,29 @@ function setNewsFrontMeta($news, $type='news')
|
||||
{
|
||||
define('e_PAGETITLE', $news['news_title']);
|
||||
}
|
||||
|
||||
|
||||
if($news['news_meta_keywords'] && !defined('META_KEYWORDS'))
|
||||
{
|
||||
define('META_KEYWORDS', $news['news_meta_keywords']);
|
||||
}
|
||||
|
||||
|
||||
if($news['news_meta_description'] && !defined('META_DESCRIPTION'))
|
||||
{
|
||||
define('META_DESCRIPTION', $news['news_meta_description']);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if($news['category_name'] && !defined('e_PAGETITLE'))
|
||||
{
|
||||
define('e_PAGETITLE', $news['category_name']);
|
||||
}
|
||||
|
||||
|
||||
if($news['category_meta_keywords'] && !defined('META_KEYWORDS'))
|
||||
{
|
||||
define('META_KEYWORDS', $news['category_meta_keywords']);
|
||||
}
|
||||
|
||||
|
||||
if($news['category_meta_description'] && !defined('META_DESCRIPTION'))
|
||||
{
|
||||
define('META_DESCRIPTION', $news['category_meta_description']);
|
||||
|
@ -39,9 +39,9 @@ require_once(e_HANDLER.'validator_class.php');
|
||||
$userMethods = e107::getSession();
|
||||
$userMethods->deleteExpired(); // Delete time-expired partial registrations
|
||||
|
||||
require_once(e107::coreTemplatePath('signup')); //correct way to load a core template.
|
||||
require_once(e107::coreTemplatePath('signup')); //correct way to load a core template.
|
||||
|
||||
include_once(e_FILE.'shortcode/batch/signup_shortcodes.php');
|
||||
include_once(e_CORE.'shortcodes/batch/signup_shortcodes.php');
|
||||
|
||||
$signup_imagecode = ($pref['signcode'] && extension_loaded('gd'));
|
||||
$text = '';
|
||||
@ -257,7 +257,7 @@ if($signup_imagecode)
|
||||
|
||||
|
||||
if (USER || ($pref['user_reg'] == 0) || (vartrue($pref['auth_method'],'e107') != 'e107'))
|
||||
{
|
||||
{
|
||||
header('location: '.e_HTTP.'index.php');
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| Copyright (C) 2008-2009 e107 Inc
|
||||
| Copyright (C) 2008-2009 e107 Inc
|
||||
| http://e107.org
|
||||
|
|
||||
|
|
||||
@ -28,7 +28,7 @@ header('Content-type: text/html; charset=utf-8');
|
||||
|
||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
|
||||
|
||||
require_once(e_FILE.'shortcode/batch/sitedown_shortcodes.php');
|
||||
require_once(e_CORE.'shortcodes/batch/sitedown_shortcodes.php');
|
||||
|
||||
if (!$SITEDOWN_TABLE)
|
||||
{
|
||||
|
22
upload.php
22
upload.php
@ -3,7 +3,7 @@
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| Copyright (C) 2008-2009 e107 Inc
|
||||
| Copyright (C) 2008-2009 e107 Inc
|
||||
| http://e107.org
|
||||
|
|
||||
|
|
||||
@ -19,7 +19,7 @@
|
||||
require_once("class2.php");
|
||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
|
||||
|
||||
if (!$pref['upload_enabled'] || $pref['upload_class'] == 255)
|
||||
if (!$pref['upload_enabled'] || $pref['upload_class'] == 255)
|
||||
{
|
||||
header("location: ".e_BASE."index.php");
|
||||
exit;
|
||||
@ -29,7 +29,7 @@ require_once(HEADERF);
|
||||
|
||||
if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:97%"); }
|
||||
|
||||
if (!check_class($pref['upload_class']))
|
||||
if (!check_class($pref['upload_class']))
|
||||
{
|
||||
$text = "<div style='text-align:center'>".LAN_UL_002."</div>";
|
||||
$ns->tablerender(LAN_UL_020, $text);
|
||||
@ -40,9 +40,9 @@ if (!check_class($pref['upload_class']))
|
||||
|
||||
$message = '';
|
||||
$postemail ='';
|
||||
if (isset($_POST['upload']))
|
||||
if (isset($_POST['upload']))
|
||||
{
|
||||
if (($_POST['file_email'] || USER == TRUE) && $_POST['file_name'] && $_POST['file_description'] && $_POST['download_category'])
|
||||
if (($_POST['file_email'] || USER == TRUE) && $_POST['file_name'] && $_POST['file_description'] && $_POST['download_category'])
|
||||
{
|
||||
require_once(e_HANDLER."upload_handler.php");
|
||||
// $uploaded = file_upload(e_FILE."public/", "unique");
|
||||
@ -53,7 +53,7 @@ if (isset($_POST['upload']))
|
||||
{
|
||||
$message = LAN_UL_021.'<br />';
|
||||
}
|
||||
|
||||
|
||||
// Now see if we have a code file
|
||||
if (count($uploaded) > 0)
|
||||
{
|
||||
@ -67,7 +67,7 @@ if (isset($_POST['upload']))
|
||||
$message .= $uploaded[0]['message'].'<br />';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Now see if we have an image file
|
||||
if (count($uploaded) > 1)
|
||||
{
|
||||
@ -134,9 +134,9 @@ if (isset($_POST['upload']))
|
||||
$e_event->trigger("fileupload", $edata_fu);
|
||||
$message .= "<br />".LAN_404;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{ // Error - missing data
|
||||
require_once(e_HANDLER."message_handler.php");
|
||||
message_handler("ALERT", 5);
|
||||
@ -163,7 +163,7 @@ $text = "<div style='text-align:center'>
|
||||
<td class='forumheader3'>".DOWLAN_11.":</td>
|
||||
<td class='forumheader3'>";
|
||||
|
||||
require_once(e_FILE."shortcode/batch/download_shortcodes.php");
|
||||
require_once(e_CORE."shortcodes/batch/download_shortcodes.php");
|
||||
$dlparm = (isset($download_category)) ? $download_category : "";
|
||||
$text .= $tp->parseTemplate("{DOWNLOAD_CATEGORY_SELECT={$dlparm}}",true,$download_shortcodes);
|
||||
|
||||
@ -214,7 +214,7 @@ $text .= " ".$allowed_filetypes."<br />".LAN_407."<br />
|
||||
$text .= "<span style='text-decoration:underline'>".LAN_408."</span> ".LAN_420."</td>
|
||||
</tr>";
|
||||
|
||||
if (!USER)
|
||||
if (!USER)
|
||||
{ // Prompt for name, email
|
||||
$text .= "<tr>
|
||||
<td class='forumheader3'>".LAN_61."</td>
|
||||
|
2
user.php
2
user.php
@ -23,7 +23,7 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
|
||||
global $user;
|
||||
$user['user_id'] = USERID;
|
||||
|
||||
require_once(e_FILE."shortcode/batch/user_shortcodes.php");
|
||||
require_once(e_CORE."shortcodes/batch/user_shortcodes.php");
|
||||
require_once(e_HANDLER."form_handler.php");
|
||||
|
||||
if (isset($_POST['delp']))
|
||||
|
@ -32,13 +32,13 @@ define("US_DEBUG",FALSE);
|
||||
//define('US_DEBUG', false);
|
||||
|
||||
|
||||
if (!USER)
|
||||
if (!USER)
|
||||
{ // Must be logged in to change settings
|
||||
header('location:'.e_BASE.'index.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
if ((!ADMIN || !getperms("4")) && e_QUERY && e_QUERY != "update" )
|
||||
if ((!ADMIN || !getperms("4")) && e_QUERY && e_QUERY != "update" )
|
||||
{
|
||||
header('location:'.e_BASE.'usersettings.php');
|
||||
exit();
|
||||
@ -56,8 +56,8 @@ $ue = new e107_user_extended;
|
||||
$userMethods = e107::getSession();
|
||||
|
||||
require_once (e_HANDLER.'ren_help.php');
|
||||
include_once (e107::coreTemplatePath('usersettings')); //correct way to load a core template.
|
||||
include_once (e_FILE.'shortcode/batch/usersettings_shortcodes.php');
|
||||
include_once (e107::coreTemplatePath('usersettings')); //correct way to load a core template.
|
||||
include_once (e_CORE.'shortcodes/batch/usersettings_shortcodes.php');
|
||||
|
||||
require_once (e_HANDLER.'calendar/calendar_class.php');
|
||||
$cal = new DHTML_Calendar(true);
|
||||
@ -284,7 +284,7 @@ if (isset($_POST['updatesettings']))
|
||||
unset($changedUserData['user_loginname']);
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{ // Invalid data - from hooked in trigger event
|
||||
$message = "<div style='text-align:center'>".$ret."</div>";
|
||||
$caption = LAN_OK;
|
||||
@ -297,7 +297,7 @@ elseif (isset($_POST['SaveValidatedInfo']))
|
||||
if (!$adminEdit && !empty($_POST['updated_data']) && !empty($_POST['currentpassword']) && !empty($_POST['updated_key']))
|
||||
{ // Got some data confirmed with password entry
|
||||
$new_data = base64_decode($_POST['updated_data']);
|
||||
if (md5($new_data) != $_POST['updated_key'])
|
||||
if (md5($new_data) != $_POST['updated_key'])
|
||||
{ // Should only happen if someone's fooling around
|
||||
echo 'Mismatch on validation key<br />';
|
||||
exit();
|
||||
@ -306,7 +306,7 @@ elseif (isset($_POST['SaveValidatedInfo']))
|
||||
if (isset($_POST['updated_extended']))
|
||||
{
|
||||
$new_extended = base64_decode($_POST['updated_extended']);
|
||||
if (md5($new_extended) != $_POST['extended_key'])
|
||||
if (md5($new_extended) != $_POST['extended_key'])
|
||||
{ // Should only happen if someone's fooling around
|
||||
echo 'Mismatch on validity key<br />';
|
||||
exit();
|
||||
@ -369,7 +369,7 @@ if ($dataToSave)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((isset($changedUserData['user_loginname']) && $userMethods->isPasswordRequired('user_loginname'))
|
||||
if ((isset($changedUserData['user_loginname']) && $userMethods->isPasswordRequired('user_loginname'))
|
||||
|| (isset($changedUserData['user_email']) && $userMethods->isPasswordRequired('user_email')))
|
||||
{
|
||||
if ($_uid)
|
||||
@ -691,7 +691,7 @@ $ns->tablerender(LAN_USET_39, $text);
|
||||
|
||||
|
||||
// If a field is required, returns a red asterisk
|
||||
function req($field)
|
||||
function req($field)
|
||||
{
|
||||
$ret = "";
|
||||
if ($field == 2)
|
||||
@ -710,12 +710,12 @@ function delete_file($fname, $dir = 'avatars/')
|
||||
global $sql;
|
||||
$fname = trim($fname);
|
||||
if (!$fname) return false;
|
||||
|
||||
if (preg_match("#Binary (.*?)/#", $fname, $match))
|
||||
|
||||
if (preg_match("#Binary (.*?)/#", $fname, $match))
|
||||
{
|
||||
return $sql -> db_Delete("rbinary", "binary_id='".$tp -> toDB($match[1])."'");
|
||||
}
|
||||
elseif (file_exists(e_UPLOAD.$dir.$fname))
|
||||
elseif (file_exists(e_UPLOAD.$dir.$fname))
|
||||
{
|
||||
unlink(e_UPLOAD.$dir.$fname);
|
||||
return true;
|
||||
@ -724,7 +724,7 @@ function delete_file($fname, $dir = 'avatars/')
|
||||
}
|
||||
|
||||
|
||||
function headerjs()
|
||||
function headerjs()
|
||||
{
|
||||
global $cal;
|
||||
$script = "<script type=\"text/javascript\">
|
||||
|
Loading…
x
Reference in New Issue
Block a user