ACC SHELL
<?php
require "./admin/mysql_connect.php";
$screen = ( isset( $_GET[ "screen" ] ) )?$_GET[ "screen" ]:"index";
require "./smarty/Smarty.class.php";
$smarty = new Smarty;
$smarty->template_dir = "./smarty/templates/";
$smarty->compile_dir = "./smarty/templates_c/";
$smarty->config_dir = "./smarty/configs/";
$smarty->cache_dir = "./smarty/cache/";
function noCzechChars( $text )
{
$result = str_replace( "ě", "e", $text );
$result = str_replace( "š", "s", $result );
$result = str_replace( "č", "c", $result );
$result = str_replace( "ř", "r", $result );
$result = str_replace( "ž", "z", $result );
$result = str_replace( "ý", "y", $result );
$result = str_replace( "á", "a", $result );
$result = str_replace( "í", "i", $result );
$result = str_replace( "é", "e", $result );
$result = str_replace( "ú", "u", $result );
$result = str_replace( "ů", "u", $result );
$result = str_replace( "ť", "t", $result );
$result = str_replace( "ň", "n", $result );
$result = str_replace( "ď", "d", $result );
$result = str_replace( "ö", "o", $result );
$result = str_replace( "ë", "e", $result );
$result = str_replace( "ó", "o", $result );
return $result;
}
$query = "SELECT * FROM `content` WHERE display = 1 ORDER BY `order` ASC";
$result = mysql_query( $query, $dbc );
if ( mysql_num_rows( $result ) > 0 )
{
$i = -1;
while ( $row = mysql_fetch_row( $result ) )
{
$i++;
$table[ $i ][ 'title' ] = $row[ 1 ];
$table[ $i ][ 'link' ] = str_replace( " ", "_", strtolower( noCzechChars( $row[ 1 ] ) ) );
}
}
$smarty->assign( 'table', $table );
$smarty->display( 'header.tpl' );
$query = "SELECT * FROM `content`";
@$result = mysql_query( $query, $dbc );
if ( @mysql_num_rows( $result ) > 0 ) {
while ( $row = mysql_fetch_row( $result ) ) {
if ( str_replace( " ", "_", strtolower( noCzechChars( $row[ 1 ] ) ) ) == $screen ) {
echo "<h2>". $row[ 1 ]. "</h2>";
echo $content = preg_replace( "/\.\.\/images/", "images", $row[ 2 ] );
break;
}
}
}
/*if ( file_exists( "pages/$action.php" ) ) {
require "./pages/$action.php";
} else {
echo "Omlouváme se, ale požadovaná stránka není dostupná<br />\n"
."Informujte o tom prosím systémového administrátora\n";
}*/
$smarty->display( 'footer.tpl' );
?>
ACC SHELL 2018