Core file Hacks

From Popms Wiki
Jump to: navigation, search

List of the all hacks to to the core files on the website, forum, wiki...


Contents

[edit] File aliases

/administrator/components/com_joomfish/models/ContentObject.php

function filterName(&$alias){
  if($alias=="") {
        $alias = JRequest::getString("refField_name");
  }
  $alias = JFilterOutput::stringURLSafe($alias);
}
// HACK
function filterName(&$alias){
  if($alias=="") {
        $alias = JRequest::getString("refField_name");
  }
  $alias = JFilterOutput::stringURLSafe($alias);
}
function filterfile_title(&$alias){
  if($alias=="") {
        $alias = JRequest::getString("refField_file_title");
  }
  $alias = JFilterOutput::stringURLSafe($alias);
}

/administrator/components/com_joomfish/contentelements/jdownloads_files.xml

<field type="referenceid" name="file_id" translate="0">ID</field>
<field type="titletext" name="file_title" translate="1">Title</field>
<field type="htmltext" name="description" translate="1">Description</field>
// HACK
<field type="referenceid" name="file_id" translate="0">ID</field>
<field type="titletext" name="file_title" translate="1">Title</field>
<field type="text" name="file_alias" translate="1" posthandler="filterfile_title">File Alias</field>
<field type="htmltext" name="description" translate="1">Description</field>

Hack purpose: Automatic generator for file aliases for translated downloads.

[edit] Nicks of translators

/administrator/components/com_joomfish/contentelements/content.xml

<field type="text" name="title_alias" length="50" maxlength="250" translate="0">Title Alias</field>
<field type="text" name="alias" length="50" maxlength="250" translate="1" posthandler="filterTitle">Alias</field>
// HACK
<field type="text" name="title_alias" length="50" maxlength="250" translate="0">Title Alias</field>
<field type="text" name="created_by_alias" translate="1">Author Alias</field>
<field type="text" name="alias" length="50" maxlength="250" translate="1" posthandler="filterTitle">Alias</field>

Hack purpose: Nick of translators are displayed in the translated articles.

[edit] Unused functionality of jDownloads

/components/com_jdownloads/jdownloads.html.php

<!--?php
/*$document->addScript(JURI::base().'components/com_jdownloads/rating/js/ajaxvote.js');
 
if ($jlistConfig['use.lightbox.function']){
    $document->addScript(JURI::base().'components/com_jdownloads/lightbox/lightbox.js');
    $mainframe->addCustomHeadTag( "<link href=\"".JURI::base()."components/com_jdownloads/lightbox/lightbox.css\" rel=\"stylesheet\" type=\"text/css\"/>" );
}    
 
$mainframe->addCustomHeadTag('<script type="text/javascript">var live_site = "'.JURI::base().'";</script>');
$mainframe->addCustomHeadTag('<script type="text/javascript">
    function openWindow (url) {
        fenster = window.open(url, "_blank", "width=550, height=480, STATUS=YES, DIRECTORIES=NO, MENUBAR=NO, SCROLLBARS=YES, RESIZABLE=NO");
        fenster.focus();
        }
    </script>');*/
 
$mainframe->addCustomHeadTag( "<link href=\"".JURI::base()."components/com_jdownloads/jdownloads_fe.css\" rel=\"stylesheet\" type=\"text/css\"/>" );
//$mainframe->addCustomHeadTag( "<link href=\"".JURI::base()."components/com_jdownloads/rating/css/ajaxvote.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\"/>" );

/components/com_jdownloads/jdownloads.php

<!--?php
// show only one category
function showOneCategory($option, $cid) {
    global $mainframe, $limit, $limitstart, $site_aktuell, $jlistConfig, $Itemid, $jlistTemplates;
 
    //$session = JFactory::getSession();
    //$session->set('jd_sec_check', 1);
    //JHTML::_('behavior.modal');
(...)
 
// einzelnen download mit detaillierten infos anzeigen
function showDownload($option,$cid){
   global $mainframe, $jlistConfig, $Itemid;
 
    //$session = JFactory::getSession();
    //$session->set('jd_sec_check', 1);
 
   //JHTML::_('behavior.modal');
(...)
 
// show only categories
function showCats($option,$cid){
        global $jlistConfig, $limit, $limitstart, $site_aktuell, $mainframe, $jlistTemplates;
 
    $user = &JFactory::getUser();
//    JHTML::_('behavior.modal');


/components/com_content/controller.php

<!--?php
        function display()
        {
                //JHTML::_('behavior.caption');

Hack purpose: Unused JavaScript and CSS files are not embedded inside HTML of the site. This reduces size of the site, number of HTTP requests and 404 error codes.

[edit] Advanced router

/plugins/system/jfrouter/content.php

<!--?php
/** ensure this file is being included by a parent file */
defined( '_JEXEC' ) or die( 'Restricted access' );
 
function JFRouterHelperContent ($router,&$uri){
        list($id, $alias) = split(':', $uri--->getVar('id'));
        $lang = substr($uri->_path, 10);
        if($id > 0 && strlen($lang) > 0 && $lang != 'en' && $uri->getVar('view') == 'article') {
                $sql = "SELECT value FROM #__jf_content WHERE reference_id = ".$id."
                        AND reference_field = 'alias'
                        AND reference_table = 'content'
                        AND language_id = (SELECT id FROM #__languages WHERE shortcode = '".$lang."')";
                $db = JFactory::getDBO();
                $db->setQuery($sql);
                $alias = $db->loadResult();
                if(strlen($alias) > 0)
                        $uri->setVar('id', $id.':'.$alias);
        }
}
?>

Hack purpose: Advanced router to Joom!Fish costs 71,40 EUR, this hack tweaks routing for articles. Instead of "/es/consejos/consejos-avanzados/55-tricks-with-followers" there's "/es/consejos/consejos-avanzados/55-unidades-avanzados".

[edit] SEF links

SEF links for forums, wiki and Joomla! - hacked configuration file of the www server - lighttpd.conf

        # to avoid fake report about redirection to malware
        $HTTP["useragent"] =~ "^.*(G|g)oogle.*$" {
            url.redirect = (
              "^/(.*)/finish/(.*)/49-populous-the-beginning$" => "/path/does/not/exist",
              "^/en/downloads/programs/viewdownload/7-programs/49-populous-the-beginning$" => "/path/does/not/exist",
              "^/(.*)/viewdownload/(.*)/49-populous-the-beginning$" => "/$1/viewdownload/$2/49-populous3-the-beginning"
            )
        }
        else $HTTP["useragent"] =~ ".*" {
            url.redirect = (
              "^/(.*)/finish/(.*)/49-populous-the-beginning$" => "/downloads/Programs/pop3tb_uw.exe",
              "^/(.*)/49-populous-the-beginning.html$" => "/$1/49-populous-the-beginning",
              "^/(.*)/viewdownload/(.*)/49-populous-the-beginning$" => "/$1/viewdownload/$2/49-populous3-the-beginning"
            )
        }
        url.rewrite-once = (
          "^/(.*)/49-populous-the-beginning$" => "$0",
          "^/forums$" => "/forums/index.php",
          #url doesn't contain any dot, so assume it's a SEF link
          "^/forums/[^\.]*$" => "/forums/index.php",
          #url contains a dot, so assume it's a casual file and don't do anything
          "^/forums/.*$" => "$0",
 
          "^/wiki(/)?$" => "/wiki/index.php",
          #url doesn't contain any dot, so assume it's a SEF link
          "^/wiki/([^\.]*)$" => "/wiki/index.php/$1",
          #special sites of a wiki redirect to a traditional link
          "^/wiki\?(.*)$" => "/wiki/index.php?$1",
          #url contains a dot, so assume it's a casual file and don't do anything
          "^/wiki/.*$" => "$0",
 
          "^/phpmyadmin.*|/administrator.*$" => "$0", #phpmyadmin nor administrator panels don't have SEF urls
          "/(.*?)/index.php$" => "index.php", #for some reason logout link in joomla contains "index.php" at the end of url
          "^/[^\.]*?(\.feed|\.feed?.*|\.raw|[^\.]*)$" => "index.php" #general rule for the joomla
        )

Hack purpose: SEF urls for forum, website and wiki were designed for Apache server. We're using lighttpd server, so we had to write own rules for mod_rewrite.

Personal tools
Namespaces

Variants
Actions
Navigation
Tools