Ejemplo n.º 1
0
/**
 * Display required javascript codes for AJAX function calls
 **/
function azrulSysBot()
{
    static $added = false;
    if (!$added) {
        $format = 'html';
        // Don't display mambots on pdf view for 1.5
        if (azrulGetJoomlaVersion() == '1.5') {
            $format = JRequest::getWord('format', 'html');
            if ($format == 'pdf') {
                return;
            }
        }
        // Include ajax file
        include_once AZRUL_SYSTEM_PATH . '/pc_includes/ajax.php';
        $jax = new JAX(AZRUL_SYSTEM_LIVE . '/pc_includes');
        $jax->setReqURI(AZRUL_BASE_LIVE . '/index.php');
        $jax->process();
        if (!isset($_POST['no_html']) && $format == 'html') {
            global $mainframe;
            $mainframe->addCustomHeadTag($jax->getScript());
        }
        $added = true;
    }
}
Ejemplo n.º 2
0
 /**
  * Return the script thatshould be added to the <head> section
  */
 function getScript()
 {
     global $mainframe;
     $reqURI = $this->_reqURL;
     $compress = $mainframe->getCfg('gzip');
     # if host have wwww, but mosConfig doesn't
     //if (substr($_SERVER['HTTP_HOST'], 0, 4) == "www.") {
     if (substr_count(@$_SERVER['HTTP_HOST'], "www.") != 0 && substr_count($reqURI, "www.") == 0) {
         $reqURI = str_replace("://", "://www.", $reqURI);
     } else {
         if (substr_count(@$_SERVER['HTTP_HOST'], "www.") == 0 && substr_count($reqURI, "www.") != 0) {
             // host do not have 'www' but mosConfig does
             $reqURI = str_replace("www.", "", $reqURI);
         }
     }
     /* Check for HTTPS */
     if (isset($HTTP_SERVER_VARS)) {
         if (isset($HTTP_SERVER_VARS['HTTPS'])) {
             if ($HTTP_SERVER_VARS['HTTPS'] == "ON") {
                 $reqURI = str_replace("http://", "https://", $reqURI);
             }
         }
     }
     $siteType = azrulGetJoomlaVersion() == '1.5' ? '1.5' : '1.0';
     $html = "<script type='text/javascript'>\n/*<![CDATA[*/\n\tvar jax_live_site = '{$reqURI}';\n\tvar jax_site_type = '{$siteType}';\n/*]]>*/\n</script>";
     $html .= "<script type=\"text/javascript\" src=\"{$this->_livePath}/ajax_" . AZRUL_SYSTEM . ".js\"></script>\n";
     return $this->_fixHTTPS($html);
 }
Ejemplo n.º 3
0
if (!defined('AZRUL_SYSTEM_LIVE')) {
    if (azrulGetJoomlaVersion() == '1.0' || azrulGetJoomlaVersion() == 'MAMBO') {
        global $mosConfig_live_site;
        define('AZRUL_SYSTEM_LIVE', rtrim($mosConfig_live_site, '/') . '/mambots/system');
    } else {
        if (azrulGetJoomlaVersion() == '1.5') {
            define('AZRUL_SYSTEM_LIVE', rtrim(JURI::root(), '/') . '/plugins/system');
        }
    }
}
if (!defined('AZRUL_BASE_LIVE')) {
    if (azrulGetJoomlaVersion() == '1.0' || azrulGetJoomlaVersion() == 'MAMBO') {
        global $mosConfig_live_site;
        define('AZRUL_BASE_LIVE', rtrim($mosConfig_live_site, '/'));
    } else {
        if (azrulGetJoomlaVersion() == '1.5') {
            define('AZRUL_BASE_LIVE', rtrim(JURI::root(), '/'));
        }
    }
}
function azrulGetJoomlaVersion()
{
    static $version;
    if (!isset($version)) {
        // Get the base path
        $base = rtrim(dirname(dirname(dirname(dirname(__FILE__)))), '/');
        if (class_exists('JFactory') && defined('_JEXEC') && file_exists($base . '/libraries/joomla/factory.php')) {
            $version = '1.5';
        } else {
            if (defined('_VALID_MOS') && class_exists('joomlaVersion')) {
                $version = '1.0';
Ejemplo n.º 4
0
 /**
  * Return the script thatshould be added to the <head> section
  */
 function getScript()
 {
     $mainframe = JFactory::getApplication();
     $reqURI = $this->_reqURL;
     $compress = $mainframe->getCfg('gzip');
     # if host have wwww, but mosConfig doesn't
     //if (substr($_SERVER['HTTP_HOST'], 0, 4) == "www.") {
     if (substr_count(@$_SERVER['HTTP_HOST'], "www.") != 0 && substr_count($reqURI, "www.") == 0) {
         $reqURI = str_replace("://", "://www.", $reqURI);
     } else {
         if (substr_count(@$_SERVER['HTTP_HOST'], "www.") == 0 && substr_count($reqURI, "www.") != 0) {
             // host do not have 'www' but mosConfig does
             $reqURI = str_replace("www.", "", $reqURI);
         }
     }
     /* Check for HTTPS */
     if (isset($HTTP_SERVER_VARS)) {
         if (isset($HTTP_SERVER_VARS['HTTPS'])) {
             if ($HTTP_SERVER_VARS['HTTPS'] == "ON") {
                 $reqURI = str_replace("http://", "https://", $reqURI);
             }
         }
     }
     $siteType = azrulGetJoomlaVersion() == '1.6' ? '1.6' : '1.5';
     //fix the uri if languagefilter plugin is enabled in J1.6
     if ($siteType == '1.6') {
         $reqURI = $this->_fixLangSwitcher($reqURI);
     }
     $tokenStr = JUtility::getToken();
     $html = "<script type='text/javascript'>\r\n/*<![CDATA[*/\r\n\tvar jax_live_site = '{$reqURI}';\r\n\tvar jax_site_type = '{$siteType}';\r\n\tvar jax_token_var='{$tokenStr}';\r\n/*]]>*/\r\n</script>";
     $html .= "<script type=\"text/javascript\" src=\"{$this->_livePath}/ajax_" . AZRUL_SYSTEM . ".js\"></script>\n";
     return $this->_fixHTTPS($html);
 }