getModule()) {
$shine->setValue('strModule', 'mainpage');
$strFinalOutput = $shine->displayPage('mainpage');
}
else {
$strFinalOutput = $shine->displayPage();
}
if ($_APP[smartURLs] == 1) {
// SHINE module and action
$URLMatch .= "/$_PATH[script]\/([a-zA-Z_\/]*)([|a-zA-Z]*)(\?*)";
$URLMatch .= str_repeat("((&?)([\w\[\]\|\-\ ]*)(=?)([ |\w-%\.]*)?)", 8).'/';
// echo $URLMatch.'
';
preg_match_all($URLMatch, $strFinalOutput, $arrMatches);
// print_r($arrMatches[0]);
//echo '
'.print_r($arrMatches, 1).'
';
if (is_array($arrMatches[0]))
foreach ($arrMatches[0] as $key => $strMatch) {
if(!strpos($strMatch,'html')){
// echo " #####################################
";
// echo " - ".$strMatch."
";
// SHINE module and action
$strRewrittenURL = $_PATH[script].'/'.$arrMatches[1][$key].($arrMatches[2][$key] ? $arrMatches[2][$key] : '').'/';
for($i = 0; $i < 8; $i++) {
$paramNameIndex = ($i * 5) + 6;
// GET params
// echo '$arrMatches['.$paramNameIndex.']['.$key.'] = '.$arrMatches[$paramNameIndex][$key]."
";
if ($arrMatches[$paramNameIndex][$key])
$strRewrittenURL .= $arrMatches[$paramNameIndex][$key].'_'.$arrMatches[$paramNameIndex + 2][$key].'/';
}
// echo $strRewrittenURL."
";
$_strMatch = $strMatch;
$_strMatch = str_replace('/', '\/', $_strMatch);
$_strMatch = str_replace('-', '\-', $_strMatch);
$_strMatch = str_replace('|', '\|', $_strMatch);
$_strMatch = str_replace('?', '\?', $_strMatch);
$_strMatch = str_replace('[', '\[', $_strMatch);
$_strMatch = str_replace(']', '\]', $_strMatch);
$_strMatch = str_replace(' ', '\ ', $_strMatch);
$__strMatch = "/$_strMatch".'([\w =\"\'\(\)\-\+#:;,\.]*)>([\w\d -"\';&=\/\.\-\+<>:%,!\?บใ\*\(\)\[\]]*)<\/a>/'; // \?
preg_match_all($__strMatch, $strFinalOutput, $arrStringMatches);
$strSiteTitle = strb($arrStringMatches[1][0], 'htitle="', '"');
//echo $arrStringMatches[1][0].'
';
if (strlen($strSiteTitle))
$arrStringMatches[2][0] = $strSiteTitle;
// echo "$__strMatch - ";
if (strlen($arrStringMatches[2][0])) {
if (strstr($arrStringMatches[2][0], '
'.print_r($arrStringMatches, 1).'';
// ...
if (is_array($_APP['smartURLsSpecialTerms'])){
$keyURL = str_replace( $_PATH[script], "", $strRewrittenURL);
if($_APP['smartURLsForcedExpressions'][$keyURL])
$strRewrittenURL = str_replace($keyURL, $_APP['smartURLsForcedExpressions'][$keyURL], $strRewrittenURL);
// else
$strRewrittenURL = str_replace(array_keys($_APP['smartURLsSpecialTerms']), array_values($_APP['smartURLsSpecialTerms']), $strRewrittenURL);
}
if(strstr($strRewrittenURL, ".html") !== false)
$strHTMLName = "";
// $strRewrittenURL = str_replace("/]", "]", $strRewrittenURL);
// if($arrStringMatches[0][0] == 'componente/categories?categoryID=68&filter[Viteza citire DVD-Rom|545]=4063">16x'){
// echo"$__strMatch
";
// print_r($arrStringMatches);
// echo "
#####################
";
// echo "$strMatch\"
$strRewrittenURL\"";
// }
if (strstr($strFinalOutput, $strMatch.'"'))
$strFinalOutput = str_replace($strMatch.'"', $strRewrittenURL.$strHTMLName.'"', $strFinalOutput);
elseif(strstr($strFinalOutput, $strMatch."'"))
$strFinalOutput = str_replace($strMatch."'", $strRewrittenURL.$strHTMLName."'", $strFinalOutput);
else
$strFinalOutput = str_replace($strMatch.' ', $strRewrittenURL.$strHTMLName.' ', $strFinalOutput);
}
}
// $strFinalOutput = str_replace(array_keys($_APP['smartURLsSpecialTerms']), array_values($_APP['smartURLsSpecialTerms']), $strFinalOutput);
}
$shine->db->Close();
if($_REQUEST[printPage])
$strFinalOutput = getPrintPage($strFinalOutput);
//echo preg_replace('!\s+!', ' ', $strFinalOutput);
echo $strFinalOutput;
$User->setValue('PageRand', $_APP['rand']);
//echo $REMOTE_ADDR;
if ($_APP[debugLevel] > 0 && !$_REQUEST[printPage]&& !$_REQUEST[recomendedUrl] && strstr($REMOTE_ADDR, '192.168') && $shine->getModule() != 'news') {
echo '
======debug info======
';
echo 'User: '.$User->getValue('Name').'
';
echo 'Auto-logout: '.date('d.m.y H:i', $User->getValue('ValidUntil')).'
';
echo 'Module: '.$shine->getModule().'
';
echo 'Execution time: '.$shine->getExecutionTime(). ' seconds.
';
echo 'DB queries: '.$shine->noQueries. '
';
echo '$_SESSION : ';
print_r($_SESSION);
echo '
';
echo '$_REQUEST : ';
print_r($_REQUEST);
echo '
';
}
/*
* /Main
*/
?>