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

Backward compatibility fixes.

This commit is contained in:
Cameron 2014-01-20 03:26:15 -08:00
parent 852bd59597
commit 8796039d08
3 changed files with 180 additions and 6 deletions

View File

@ -2,20 +2,33 @@
/* /*
* e107 website system * e107 website system
* *
* Copyright (C) 2008-2013 e107 Inc (e107.org) * Copyright (C) 2008-2014 e107 Inc (e107.org)
* Released under the terms and conditions of the * Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
* * Exists only for BC.
*/ */
// Moc: up for removal? Replaced by /e107_admin/comment.php
require_once("../class2.php"); require_once("../class2.php");
if (!getperms("B")) { if (!getperms("B")) {
header("location:".e_BASE."index.php"); header("location:".e_BASE."index.php");
exit; exit;
} }
$tmp = explode(".", e_QUERY);
$table = $tmp[0];
$id = intval($tmp[1]);
$editid = intval($tmp[2]);
$url = e_ADMIN_ABS."comment.php?searchquery=".$id."&filter_options=comment_type__".e107::getComment()->getCommentType($table);
e107::getRedirect()->go($url);
exit;
/*
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE); include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
require_once("auth.php"); require_once("auth.php");
@ -195,5 +208,7 @@ function delete_children($row, $cid)
$sql->db_Delete("comments", "comment_id='$cid'"); $sql->db_Delete("comments", "comment_id='$cid'");
} }
} }
*/
?> ?>

View File

@ -7,8 +7,39 @@ function plugin_shortcode($parm = '')
@list($menu,$parms) = explode('|',$parm.'|', 2); @list($menu,$parms) = explode('|',$parm.'|', 2);
$path = $tp->toDB(dirname($menu)); $path = $tp->toDB(dirname($menu));
$name = $tp->toDB(basename($menu)); $name = $tp->toDB(basename($menu));
//BC Fix for v2.x
$changeMenuPaths = array(
array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'),
array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'compliance_menu'),
array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'powered_by_menu'),
array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'),
array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'counter_menu'),
array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'latestnews_menu'),
array('oldpath' => 'compliance_menu', 'newpath' => 'siteinfo', 'menu' => 'compliance_menu'),
array('oldpath' => 'powered_by_menu', 'newpath' => 'siteinfo', 'menu' => 'powered_by_menu'),
array('oldpath' => 'sitebutton_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'),
array('oldpath' => 'counter_menu', 'newpath' => 'siteinfo', 'menu' => 'counter_menu'),
array('oldpath' => 'usertheme_menu', 'newpath' => 'user_menu', 'menu' => 'usertheme_menu'),
array('oldpath' => 'userlanguage_menu', 'newpath' => 'user_menu', 'menu' => 'userlanguage_menu'),
array('oldpath' => 'lastseen_menu', 'newpath' => 'online', 'menu' => 'lastseen_menu'),
array('oldpath' => 'other_news_menu', 'newpath' => 'news', 'menu' => 'other_news_menu'),
array('oldpath' => 'other_news_menu', 'newpath' => 'news', 'menu' => 'other_news2_menu')
);
foreach($changeMenuPaths as $k=>$v)
{
if($v['oldpath'] == $path && $v['menu'] == $name)
{
$path = $v['newpath'];
continue;
}
}
if($path == '.') if($path == '.')
{ {
@ -18,6 +49,18 @@ function plugin_shortcode($parm = '')
* @todo check if plugin is installed when installation required * @todo check if plugin is installed when installation required
*/ */
/** /**
* fixed todo: $mode is provided by the menu itself, return is always true, added optional menu parameters * fixed todo: $mode is provided by the menu itself, return is always true, added optional menu parameters
*/ */

View File

@ -17,6 +17,16 @@ if (!defined('e107_INIT')) { exit; }
class parseXml extends xmlClass // BC with v1.x class parseXml extends xmlClass // BC with v1.x
{ {
function __construct()
{
$data = debug_backtrace(true);
$log = e107::getAdminLog();
$log->addDebug('Deprecated XML Parser Used');
$log->addArray($data);
$log->save('DEPRECATED',E_LOG_NOTICE);
}
function setUrl($feed) function setUrl($feed)
{ {
@ -25,9 +35,110 @@ class parseXml extends xmlClass // BC with v1.x
function getRemoteXmlFile($address, $timeout = 10) function getRemoteXmlFile($address, $timeout = 10)
{ {
return $this->getRemoteFile($address, $timeout); // $data = $this->getRemoteFile($address, $timeout);
$fl = e107::getFile();
$data = $fl->getRemoteContent($address);
$this->xmlLegacyContents = $data;
return $data;
} }
function parseXmlContents ()
{
$log = e107::getAdminLog();
foreach($this -> xmlData as $key => $value)
{
unset($this -> xmlData[$key]);
}
foreach($this -> counterArray as $key => $value)
{
unset($this -> counterArray[$key]);
}
if(!function_exists('xml_parser_create'))
{
$log->addDebug("No XML source specified")->save('XML',E_LOG_WARNING);
return FALSE;
}
if(!$this -> xmlLegacyContents)
{
$log->addDebug("No XML source specified")->save('XML');
return FALSE;
}
$this->parser = xml_parser_create('');
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, 'startElement', 'endElement');
xml_set_character_data_handler( $this->parser, 'characterData' );
$array = explode("\n", $this -> xmlLegacyContents);
foreach($array as $data)
{
if(strlen($data == 4096))
{
$log->addDebug("The XML cannot be parsed as it is badly formed.")->save('XML');
return FALSE;
}
if (!xml_parse($this->parser, $data))
{
$error = sprintf('XML error: %s at line %d, column %d', xml_error_string(xml_get_error_code($this->parser)), xml_get_current_line_number($this->parser),xml_get_current_column_number($this->parser));
$log->addDebug($error)->save('XML');
return FALSE;
}
}
xml_parser_free( $this->parser );
return $this -> xmlData;
}
function startElement ($p, $element, &$attrs)
{
$this -> start_tag = $element;
$this -> current_tag = strtolower($element);
if(!array_key_exists($this -> current_tag, $this -> counterArray))
{
$this -> counterArray[$this -> current_tag] = 0;
$this -> xmlData[$this -> current_tag][$this -> counterArray[$this -> current_tag]] = "";
}
}
function endElement ($p, $element)
{
if($this -> start_tag == $element)
{
$this -> counterArray[$this -> current_tag] ++;
}
}
function characterData ($p, $data)
{
$data = trim ( chop ( $data ));
$data = preg_replace('/&(?!amp;)/', '&', $data);
if(!array_key_exists($this -> current_tag, $this -> xmlData))
{
$this -> xmlData [$this -> current_tag] = array();
}
if(array_key_exists($this -> counterArray[$this -> current_tag], $this -> xmlData [$this -> current_tag]))
{
$this -> xmlData [$this -> current_tag] [$this -> counterArray[$this -> current_tag]] .= $data;
}
else
{
$this -> xmlData [$this -> current_tag] [$this -> counterArray[$this -> current_tag]] = $data;
}
}
} }
@ -304,7 +415,8 @@ class xmlClass
if($feed) if($feed)
{ {
$this->_feedUrl = $feed; $this->_feedUrl = $feed;
} }
return $this;
} }
/** /**
@ -318,6 +430,10 @@ class xmlClass
*/ */
function getRemoteFile($address, $timeout = 10, $postData=null) function getRemoteFile($address, $timeout = 10, $postData=null)
{ {
$debug = debug_backtrace(true);
e107::getAdminLog()->addDebug("Deprecated getRemoteFile() method used. Use e_file::getRemoteContent() instead.")->addArray($debug)->save('DEPRECATED',E_LOG_NOTICE);
$_file = e107::getFile(); $_file = e107::getFile();
$this->xmlFileContents = $_file->getRemoteContent($address, array('timeout' => $timeout, 'post' => $postData)); $this->xmlFileContents = $_file->getRemoteContent($address, array('timeout' => $timeout, 'post' => $postData));
$this->error = $_file->error; $this->error = $_file->error;