| Server IP : 180.180.241.3 / Your IP : 216.73.216.216 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/AppServ/www/news/administrator/components/com_simple_review/classes/ |
Upload File : |
<?php
/**
* $Id$
*
* Copyright (C) 2005-2011 Rowan Youngson
*
* This file is part of Simple Review.
*
* Simple Review is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Simple Review is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with Simple Review. If not, see <http://www.gnu.org/licenses/>.
*/
/** ensure this file is being included by a parent file */
defined( '_JEXEC' ) or die('Direct Access to this location is not allowed.');
require_once("SRBridgeDatabaseJoomla15.php");
class SRBridgeJoomla15 extends SRBridgeCMS
{
var $_document = null;
var $_documentType = null;
function SRBridgeJoomla15()
{
global $option;
$this->SystemToBridge = 'Joomla15';
$this->AdminPage = 'index2.php';
$this->AdminTemplate = 'khepri';
$this->Database =& JFactory::getDbo();
$this->Option = $option;
$this->PathJoomla = JPATH_SITE;
//TODO: is this needed/correct?
$this->PathComponentFrontEnd = JPATH_COMPONENT_SITE;
//$this->PathComponentAdministrator = JPATH_COMPONENT_ADMINISTRATOR;
$this->PathComponentAdministrator = JPATH_ADMINISTRATOR.DS.'components'.DS.'com_simple_review';
$this->SiteUrl = JURI::root(false);
$this->SiteDomain = JURI::base();//dirname(JURI::base());
$config = new JConfig();
$this->InDebugMode = $config->debug == '1';
$this->UsingSeoLinks = $config->sef == '1';
$this->Database =& JFactory::getDBO();
$this->CurrentUser = new SRBridgeUser();
}
function AddCustomTag($tag)
{
if ($this->GetDocumentType() === 'html')
{
$document = &$this->GetDocument();
$document->addCustomTag($tag);
}
}
function AddMetaDescription($description)
{
$document =& $this->GetDocument();
$document->setMetadata('description', $description);
}
function AddMetaKeywords($keywords)
{
$document =& $this->GetDocument();
$document->setMetadata('keywords', $keywords);
}
function GetParameter( &$array, $key, $default = null, $type = '')
{
return JArrayHelper::getValue( $array, $key, $default, $type);
}
//Does not include query string so will not work correctly if SEO is off
function GetCurrentPath()
{
$link =& JURI::getInstance( JURI::current() );
return $link->getPath();
}
function &GetDocument()
{
if($this->_document === null)
{
$this->_document = &JFactory::getDocument();
}
return $this->_document;
}
function GetDocumentType()
{
if($this->_documentType === null)
{
$document =& $this->GetDocument();
$this->_documentType = $document->getType();
}
return $this->_documentType;
}
function GetItemID()
{
$component =& JComponentHelper::getComponent('com_simple_review');
$menus = &JApplication::getMenu('site', array());
$items = $menus->getItems('componentid', $component->id);
$itemID = 0;
if($items != null)
{
foreach($items as $item)
{
if((!isset($item->published) || $item->published) && $item->menutype != 'usermenu')
{
$itemID = $item->id;
break;
}
}
}
return $itemID;
}
function GracefulExit($message)
{
$mainframe =& JFactory::getApplication();
echo $message;
$mainframe->close();
}
function Redirect($url, $text = '')
{
$mainframe =& JFactory::getApplication();
$url = str_replace('&', '&', $url);
$mainframe->redirect( $url, $text );
}
function RewriteUrl($url)
{
return JRoute::_($url);
}
function MakeUrlSafe($string)
{
return JFilterOutput::stringURLSafe($string);
}
function SetPageTitle($title)
{
$document=& $this->GetDocument();
$document->setTitle($title);
}
function IncludeJQuery($provider = null)
{
if($this->GetDocumentType() !== 'html')
{
return;
}
if($provider == null)
{
$addonManager =& Addon_Manager::Get();
$this->IncludeJQuery($addonManager->GetSetting('JQuery', _SR_ADDON_TYPE_MODULE, 'Configuration_Module'));
return;
}
if($provider == 'Exclude')
{
?>
<script type="text/javascript">
if(typeof(jQuery) == "undefined")
{
alert('You have chosen not to include the required jQuery library and it is not currently loaded by another component.');
}
</script>
<?php
return;
}
if($provider == 'Google')
{
$this->IncludeJSLink('http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js');
$this->AddCustomTag( "<script type='text/javascript'>jQuery.noConflict();</script>" );
}
else
{
$this->IncludeJSLink($this->SiteUrl.'components/com_simple_review/javascript/jquery-1.6.1.min.js');
$this->AddCustomTag( "<script type='text/javascript'>jQuery.noConflict();</script>" );
}
}
function IncludeJQueryUI($provider = null)
{
if($this->GetDocumentType() !== 'html')
{
return;
}
if($provider == null)
{
$addonManager =& Addon_Manager::Get();
$this->IncludeJQueryUI($addonManager->GetSetting('JQueryUI', _SR_ADDON_TYPE_MODULE, 'Configuration_Module'));
return;
}
if($provider == 'Exclude')
{
$this->AddCustomTag(
'<script type="text/javascript">'
.'if(typeof(jQuery) == "undefined" || !jQuery.selectable)'
.'{'
.'alert("You have chosen not to include the required jQuery UI library and it is not currently loaded by another component.");'
.'}'
.'</script>'
);
return;
}
if($provider == 'Google')
{
$this->IncludeJSLink( 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js');
$this->IncludeCssLink( 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/smoothness/jquery-ui.css');
}
else
{
$this->IncludeJSLink($this->SiteUrl.'components/com_simple_review/javascript/jquery-ui-1.8.13.custom.min.js');
$this->IncludeCssLink( $this->SiteUrl.'components/com_simple_review/templates/default/css/jqueryui/jquery-ui-1.8.13.custom.css');
}
}
function IncludeCssLink($url)
{
if($this->GetDocumentType() !== 'html')
{
return;
}
$this->AddCustomTag( '<link rel="stylesheet" href="'.$url.'" type="text/css" media="all" />');
}
function IncludeJSLink($url)
{
if($this->GetDocumentType() !== 'html')
{
return;
}
$this->AddCustomTag( "<script type='text/javascript' src='$url'></script>" );
}
}
?>