4 * Arthrology for Elxis CMS 2008.x and 2009.x+
10 * @author Apostolos Koutsoulelos <akoutsoulelos@yahoo.gr>
11 * @authorurl http://www.bitcraft-labs.gr
12 * @copyright Copyright (C) 2009-2011 Apostolos Koutsoulelos. All rights reserved.
13 * @license GNU/GPL (http://www.gnu.org/copyleft/gpl.html)
15 * @link http://www.elxis-downloads.com/downloads/miscellaneous/204.html
18 // Prevent direct inclusion of this file
19 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
21 if (!defined('ARTHBASE')) {
23 if (($_VERSION->RELEASE
>= 2009) && ($_VERSION->DEV_LEVEL
>= 1)) {
24 define('ARTHBASE', 'arthrology');
26 define('ARTHBASE', 'com_arthrology');
30 // Generate SEO Pro page
31 function seogen_com_arthrology($link) {
32 global $mosConfig_live_site, $database;
34 if (trim($link) == '') { return ''; }
36 $database->setQuery( "SELECT params FROM #__components WHERE link = 'option=com_arthrology'" );
37 $text = $database->loadResult();
38 $config_values = new mosParameters( $text );
41 $vars['option'] = 'com_arthrology';
44 $half = preg_split('/[\?]/', $link);
45 if (isset($half[1])) {
46 $half2 = preg_split('/[\#]/', $half[1]);
47 $parts = preg_split('/[\&]/', $half2[0], -1, PREG_SPLIT_NO_EMPTY
);
48 if (count($parts) >0) {
49 foreach ($parts as $part) {
50 list($x, $y) = preg_split('/[\=]/', $part, 2);
57 // Generate SEO Pro page depending task
58 switch ($vars['task']) {
60 return $mosConfig_live_site.'/'.ARTHBASE
.'/search.html';
63 return $mosConfig_live_site.'/'.ARTHBASE
.'/results.html';
66 return $mosConfig_live_site.'/'.ARTHBASE
.'/';
71 // Restore original page
72 function seores_com_arthrology($seolink='', $register_globals=0) {
73 global $database, $lang;
75 $seolink = urldecode($seolink);
76 $seolink = trim(preg_replace('/(&)/', '&', $seolink));
77 $link = preg_split('/[\?]/', $seolink);
78 $itemsyn = intval(mosGetParam( $_SESSION, 'itemsyn', 0 ));
80 $QUERY_STRING = array();
82 $_GET['option'] = 'com_arthrology';
83 $_REQUEST['option'] = 'com_arthrology';
84 $QUERY_STRING[] = 'option=com_arthrology';
86 if (($link[0] == ARTHBASE
.'/') OR ($link[0] == ARTHBASE
)) { // URL = ../arthrology/
88 $_GET['task'] = $task;
89 $_REQUEST['task'] = $task;
90 $QUERY_STRING[] = 'task='.$task;
91 } else { // ULR = ../arthrology/results.html
92 $parts = preg_split('/[\/]/', $link[0]); // or ../arthrology/search.html
93 $part = preg_replace('/(\.html)$/', '', $parts[1]);
95 $_GET['task'] = $part;
96 $_REQUEST['task'] = $part;
97 $QUERY_STRING[] = 'task='.$part;
100 $query = "SELECT id FROM #__menu WHERE link='index.php?option=com_arthrology' AND published='1'"
101 ."\n AND ((language IS NULL) OR (language LIKE '%$lang%'))";
103 if ($itemsyn) { $_Itemid = $itemsyn; }
104 if (isset($_Itemid) && ($_Itemid > 0)) {
107 $database->setQuery($query, '#__', 1, 0);
108 $Itemid = intval($database->loadResult());
111 $_GET['Itemid'] = $Itemid;
112 $_REQUEST['Itemid'] = $Itemid;
113 $QUERY_STRING[] = 'Itemid='.$Itemid;
116 if (count($QUERY_STRING) > 0) { $qs = implode('&',$QUERY_STRING); }
117 if (trim($link[1]) != '') { $qs .= ($qs == '') ?
$link[1] : '&'.$link[1]; }
119 $_SERVER['QUERY_STRING'] = $qs;
120 $_SERVER['REQUEST_URI'] = ($qs != '') ?
'/index.php?'.$qs : '/index.php';