mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 12:48:24 +01:00
More cleanup
This commit is contained in:
parent
064c5c7d1e
commit
0c1ed5165f
@ -248,6 +248,9 @@ class admin_newspost
|
||||
function __construct($qry, $pstobj)
|
||||
{
|
||||
global $user_pref;
|
||||
|
||||
|
||||
|
||||
$this->parseRequest($qry);
|
||||
|
||||
require_once(e_HANDLER."cache_handler.php");
|
||||
@ -377,7 +380,7 @@ class admin_newspost
|
||||
{
|
||||
/*if($sefstr) $sefstr = md5($sefstr);
|
||||
ecache::clear_sys("news_sefurl".$sefstr);*/
|
||||
news::clearRewriteCache($sefstr);
|
||||
// news::clearRewriteCache($sefstr);
|
||||
}
|
||||
|
||||
function set_rwcache($sefstr, $data)
|
||||
@ -385,7 +388,7 @@ class admin_newspost
|
||||
/**$sefstr = md5($sefstr);
|
||||
if(is_array($data)) $data = e107::getArrayStorage()->WriteArray($data, false);
|
||||
ecache::set_sys("news_sefurl".$sefstr, $data, true);*/
|
||||
news::setRewriteCache($sefstr, $data);
|
||||
// news::setRewriteCache($sefstr, $data);
|
||||
}
|
||||
|
||||
function ajax_observer()
|
||||
@ -461,6 +464,9 @@ class admin_newspost
|
||||
|
||||
function show_page()
|
||||
{
|
||||
|
||||
print_a($POST);
|
||||
|
||||
switch ($this->getAction()) {
|
||||
case 'savepreset':
|
||||
case 'clr_preset':
|
||||
@ -523,13 +529,7 @@ class admin_newspost
|
||||
switch ($delete) {
|
||||
case 'main':
|
||||
//clear rewrite cache
|
||||
if(e107::getDb()->db_Select('news_rewrite', 'news_rewrite_id, news_rewrite_string', 'news_rewrite_source='.$del_id.' AND news_rewrite_type=1'))
|
||||
{
|
||||
$tmp = e107::getDb()->db_Fetch();
|
||||
e107::getDb()->db_Delete('news_rewrite', 'news_rewrite_id='.$tmp['news_rewrite_id']);
|
||||
$this->clear_rwcache($tmp['news_rewrite_string']);
|
||||
unset($tmp);
|
||||
}
|
||||
|
||||
if ($e107->sql->db_Count('news','(*)',"WHERE news_id={$del_id}"))
|
||||
{
|
||||
e107::getEvent()->trigger("newsdel", $del_id);
|
||||
@ -551,13 +551,7 @@ class admin_newspost
|
||||
//clear rewrite cache
|
||||
if(!getperms('0|7')) $this->noPermissions();
|
||||
|
||||
if(e107::getDb()->db_Select('news_rewrite', 'news_rewrite_id, news_rewrite_string', 'news_rewrite_source='.$del_id.' AND news_rewrite_type=2'))
|
||||
{
|
||||
$tmp = e107::getDb()->db_Fetch();
|
||||
e107::getDb()->db_Delete('news_rewrite', 'news_rewrite_id='.$tmp['news_rewrite_id']);
|
||||
$this->clear_rwcache($tmp['news_rewrite_string']);
|
||||
unset($tmp);
|
||||
}
|
||||
|
||||
if ($e107->sql->db_Count('news_category','(*)',"WHERE category_id={$del_id}"))
|
||||
{
|
||||
e107::getEvent()->trigger("newscatdel", $del_id);
|
||||
@ -1072,10 +1066,8 @@ class admin_newspost
|
||||
// --------------------------------------------
|
||||
|
||||
$query = "
|
||||
SELECT n.*, nc.*, nr.news_rewrite_string, ncr.news_rewrite_string AS news_category_rewrite_string, u.user_name FROM #news AS n
|
||||
SELECT n.*, nc.*, u.user_name FROM #news AS n
|
||||
LEFT JOIN #news_category AS nc ON n.news_category=nc.category_id
|
||||
LEFT JOIN #news_rewrite AS nr ON n.news_id=nr.news_rewrite_source AND nr.news_rewrite_type=1
|
||||
LEFT JOIN #news_rewrite AS ncr ON n.news_category=ncr.news_rewrite_source AND nr.news_rewrite_type=2
|
||||
LEFT JOIN #user AS u ON n.news_author=u.user_id
|
||||
";
|
||||
|
||||
@ -1334,17 +1326,6 @@ class admin_newspost
|
||||
$_POST['news_meta_description'] = $row['news_meta_description'];
|
||||
}
|
||||
}
|
||||
|
||||
$row = array();
|
||||
if(e107::getDb()->db_Select('news_rewrite', '*', 'news_rewrite_source='.intval($this->getId()).' AND news_rewrite_type=1'))
|
||||
{
|
||||
$row = e107::getDb()->db_Fetch();
|
||||
}
|
||||
|
||||
$_POST['news_rewrite_id'] = varset($row['news_rewrite_id'], 0);
|
||||
$_POST['news_rewrite_source'] = $this->getId();
|
||||
$_POST['news_rewrite_string'] = isset($_POST['news_rewrite_string']) ? $_POST['news_rewrite_string'] : varset($row['news_rewrite_string'], '');
|
||||
$_POST['news_rewrite_type'] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2020,9 +2001,9 @@ class admin_newspost
|
||||
'news_rewrite_string' => '',
|
||||
'news_rewrite_type' => 0
|
||||
);
|
||||
if ($e107->sql->db_Select('news_rewrite', '*', 'news_rewrite_source='.$this->getId().' AND news_rewrite_type=2'))
|
||||
// if ($e107->sql->db_Select('news_rewrite', '*', 'news_rewrite_source='.$this->getId().' AND news_rewrite_type=2'))
|
||||
{
|
||||
$category_rewrite = $e107->sql->db_Fetch();
|
||||
// $category_rewrite = $e107->sql->db_Fetch();
|
||||
}
|
||||
$jshelper->addResponseAction('fill-form', $category_rewrite);
|
||||
|
||||
|
136
url.php
Normal file
136
url.php
Normal file
@ -0,0 +1,136 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2011 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
* $URL: /cvs_backup/e107_0.8/e107_admin/db_verify.php,v $
|
||||
* $Revision: 12255 $
|
||||
* $Id: 2011-06-07 17:16:42 -0700 (Tue, 07 Jun 2011) $
|
||||
* $Author: e107coders $
|
||||
*
|
||||
*/
|
||||
define("e_SELF_DISABLE",TRUE);
|
||||
define("e_QUERY_DISABLE",TRUE);
|
||||
exit;
|
||||
require_once("class2.php");
|
||||
require_once(HEADERF);
|
||||
|
||||
|
||||
// new eUrl Draft.
|
||||
// TODO Move to e107_handlers/eUrl.php once complete.
|
||||
class eUrl
|
||||
{
|
||||
protected $urlPath;
|
||||
protected $urlSrch;
|
||||
protected $include;
|
||||
|
||||
public $incFile;
|
||||
|
||||
|
||||
function __construct()
|
||||
{
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
$tmp = str_replace(e_HTTP,'',e_REQUEST_HTTP);
|
||||
list($urlPath,$urlSrch) = explode("/",$tmp,2);
|
||||
|
||||
if($urlSrch)
|
||||
{
|
||||
$this->urlPath = $urlPath;
|
||||
$this->urlSrch = $urlSrch;
|
||||
}
|
||||
else // Root position SEF Url.
|
||||
{
|
||||
$this->urlPath = "";
|
||||
$this->urlSrch = $urlPath;
|
||||
}
|
||||
|
||||
$this->include = $this->getInclude(); //TODO Clean and Check returned URL.
|
||||
|
||||
list($self,$query) = explode("?",$this->include);
|
||||
$this->incFile = $tp->replaceConstants($self);
|
||||
|
||||
if(!$query && $_SERVER['QUERY_STRING'])
|
||||
{
|
||||
$e_QUERY = str_replace(array('{', '}', '%7B', '%7b', '%7D', '%7d'), '', rawurldecode($_SERVER['QUERY_STRING']));
|
||||
$e_QUERY = str_replace('&', '&', $tp->post_toForm($e_QUERY));
|
||||
$query = $e_QUERY;
|
||||
}
|
||||
|
||||
define("e_SELF", e_REQUEST_SELF);
|
||||
define("e_QUERY", $query);
|
||||
}
|
||||
|
||||
|
||||
function getInclude()
|
||||
{
|
||||
// Check SiteLinks First
|
||||
$lnk = e107::getSitelinks();
|
||||
$links = $lnk->getlinks(0);
|
||||
if(isset($lnk->sefList[$this->urlSrch]))
|
||||
{
|
||||
return $lnk->sefList[$this->urlSrch];
|
||||
}
|
||||
|
||||
// Check Plugins (including News and Pages)
|
||||
$urlConfig = e107::getAddonConfig('e_url');
|
||||
|
||||
foreach($urlConfig as $class_name=>$val)
|
||||
{
|
||||
foreach($val as $p=>$t)
|
||||
{
|
||||
if((vartrue($t['path']) == $this->urlPath) && vartrue($t['function']))
|
||||
{
|
||||
if($ret = e107::callMethod($class_name."_url", $t['function'], $this->urlSrch))
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function debug()
|
||||
{
|
||||
echo "<br />REQUEST=".$_SERVER['REQUEST_URI'];
|
||||
echo "<br />URI Path= ".$this->urlPath;
|
||||
echo "<br />URI Found= ".$this->urlSrch;
|
||||
echo "<br />Calculated e_SELF= ".$this->include;
|
||||
echo "<br />Renewed e_SELF= ".e_SELF;
|
||||
|
||||
echo "<br />e_QUERY= ".e_QUERY;
|
||||
echo "<br />Including: ".$this->incFile;
|
||||
|
||||
// echo "<br />e_REQUEST_URL= ".e_REQUEST_URL;
|
||||
// echo "<br />e_REQUEST_SELF= " . e_REQUEST_SELF; // full URL without the QUERY string
|
||||
// echo "<br />e_REQUEST_URI= " .e_REQUEST_URI; // absolute http path + query string
|
||||
// echo "<br />e_REQUEST_HTTP= ". e_REQUEST_HTTP; // SELF URL without the QUERY string and leading domain part
|
||||
// echo "<br />e_HTTP= ".e_HTTP;
|
||||
// echo "<br />e_SELF= ".e_SELF;
|
||||
}
|
||||
|
||||
function create()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$url = new eUrl;
|
||||
$url->debug();
|
||||
|
||||
|
||||
if($url->incFile)
|
||||
{
|
||||
require_once($url->incFile);
|
||||
}
|
||||
|
||||
|
||||
require_once(FOOTERF); // in case of URL failure.
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user