setValue('Lang', $sPosLang);
$User->setValue('LangID', $_APP['languages'][$sPosLang]['0']);
}
else {
$User->setValue('Lang', $_APP['defaultLang']);
$User->setValue('LangID', $_APP['languages'][$_APP['defaultLang']]['0']);
}
$shine = new softHostWSEngine;
openADOdb();
//print_r($_SESSION);
if (!$shine->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);
// echo '
'.print_r($arrMatches, 1).'
';
if (is_array($arrMatches[0]))
foreach ($arrMatches[0] as $key => $strMatch) {
// SHINE module and action
// [1] = module, [2] = action ("|" included)
// $strRewrittenURL = $_PATH[script].'/'.$arrMatches[1][$key].($arrMatches[2][$key] ? $arrMatches[2][$key] : '').'/';
$strModulAndAction = $arrMatches[1][$key].($arrMatches[2][$key] ? str_replace('|', '_', $arrMatches[2][$key]) : '');
$strParamsAndValues = '';
for($i = 0; $i < 8; $i++) {
$paramNameIndex = ($i * 5) + 6;
// GET params
if ($arrMatches[$paramNameIndex][$key])
$strParamsAndValues .= $arrMatches[$paramNameIndex][$key].'_'.$arrMatches[$paramNameIndex + 2][$key].'-';
}
$strParamsAndValues = substr($strParamsAndValues, 0, -1);
$_strMatch = $strMatch;
$_strMatch = str_replace('/', '\/', $_strMatch);
$_strMatch = str_replace('|', '\|', $_strMatch);
$_strMatch = str_replace('?', '\?', $_strMatch);
$__strMatch = "/$_strMatch".'([\w =\"\'\(\)\-\+#:;,\.!º䣂Įκª�([\w\d -"\';&=\/\.\-\+<>:%,!\?º䣂Įκª�\)\[\]\t\n\r]*)<\/a>/Ui'; // \?
preg_match_all($__strMatch, $strFinalOutput, $arrStringMatches);
// echo "$strMatch - " . count($arrStringMatches[1]) . "
";
// echo "$strMatch - " . (print_r($arrStringMatches[2], 1)) . "
";
$strSiteTitle = strb($arrStringMatches[1][0], 'htitle="', '"');
// echo $arrStringMatches[1][0].'
';
if (strlen($strSiteTitle))
$arrStringMatches[2][0] = $strSiteTitle;
if (strlen($arrStringMatches[2][0])) {
if (strstr($arrStringMatches[2][0], '';
$strHTMLName = trim(strip_tags($arrStringMatches[2][0]));
$strHTMLName = prepareSmartURL(trim(limitText($strHTMLName, 100, ' ', '')));
}
else
$strHTMLName = ''; //TO DO: ...
// echo $strModulAndAction."
";
// echo $strRewrittenURL.'
';
// if($_APP['smartURLsForcedExpressions'][$keyURL]){
//
//// $strRewrittenURL = str_replace($keyURL, substr($_APP['smartURLsForcedExpressions'][$keyURL],1), $strRewrittenURL);
// }
if (is_array($_APP['smartURLsSpecialTerms']))
$strModulAndAction = str_replace(array_keys($_APP['smartURLsSpecialTerms']), array_values($_APP['smartURLsSpecialTerms']), $strModulAndAction);
// $strFinalURL = $_PATH['script'].'/'.$strHTMLName .
// '*' . $strParamsAndValues . '-' . $strModulAndAction . $_APP['smartURLExtension'];
$keyURL = '*'.$strParamsAndValues . '-' . $strModulAndAction . $_APP['smartURLExtension'];
// echo $keyURL.' = '.$_APP['smartURLsForcedExpressions'][$User->getValue('Lang')][$keyURL].'
';
// die(print_r($_APP,1));
if($_APP['smartURLsForcedExpressions'][$User->getValue('Lang')][$keyURL])
$strFinalURL = $_APP['smartURLsForcedExpressions'][$User->getValue('Lang')][$keyURL];
else
$strFinalURL = $strHTMLName . $keyURL;
// $strFinalURL = ($User->getValue('Lang') != $_APP['defaultLang']) ? $User->getValue('Lang').'/'.$strFinalURL : $strFinalURL;
if (strstr($strFinalOutput, $strMatch.'"'))
$strFinalOutput = str_replace($strMatch.'"', $strFinalURL.'"', $strFinalOutput);
elseif(strstr($strFinalOutput, $strMatch."'"))
$strFinalOutput = str_replace($strMatch."'", $strFinalURL."'", $strFinalOutput);
else
$strFinalOutput = str_replace($strMatch.' ', $strFinalURL.' ', $strFinalOutput);
}
}
//print_r($_SESSION);
////die();
$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] && in_array($_SERVER[REMOTE_ADDR], $_APP[developerIPs]) && $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
*/
?>