Location: PHPKode > projects > Quick.Cms - free and simple to use CMS > admin.php
<?php
/*
* Quick.Cms by OpenSolution.org
* www.OpenSolution.org
*/
extract( $_GET );
define( 'ADMIN_PAGE', true );
$_SERVER['REQUEST_URI'] = htmlspecialchars( strip_tags( $_SERVER['REQUEST_URI'] ) );
$_SERVER['PHP_SELF'] = htmlspecialchars( strip_tags( $_SERVER['PHP_SELF'] ) );

require 'database/config/general.php';
require DB_CONFIG_LANG;

session_start( );

header( 'Content-Type: text/html; charset='.$config['charset'] );
require_once DIR_LIBRARIES.'file-jobs.php';
require_once DIR_LIBRARIES.'flat-files.php';
require_once DIR_LIBRARIES.'image-jobs.php';
require_once DIR_LIBRARIES.'trash.php';
require_once DIR_PLUGINS.'plugins-admin.php';

require_once DIR_DATABASE.'_fields.php';
require_once DIR_CORE.'common-admin.php';
require_once DIR_CORE.'pages.php';
require_once DIR_CORE.'pages-admin.php';
require_once DIR_CORE.'lang-admin.php';
require_once DIR_CORE.'files.php';
require_once DIR_CORE.'files-admin.php';

$p = !empty( $p ) ? strip_tags( $p ) : 'news';

if( !isset( $iTypeSearch ) )
  $iTypeSearch = 1;

if( $p == 'search' ){
  $aSearchActions = Array( 1 => 'pages-list' );
  $p = ( isset( $aSearchActions[$iTypeSearch] ) ) ? $aSearchActions[$iTypeSearch] : null;
}

$sPhrase = isset( $sPhrase ) && !empty( $sPhrase ) ? trim( changeSpecialChars( htmlspecialchars( stripslashes( $sPhrase ) ) ) ) : null;
if( !isset( $sSort ) )
  $sSort = null;
$aActions = getAction( $p );

$sDateLog = displayDate( $config['before_last_login'] );
loginActions( $p, SESSION_KEY_NAME );

$oFFS = FlatFilesSerialize::getInstance( );
$oImage = ImageJobs::getInstance( );
$oPage = PagesAdmin::getInstance( );
$oFile = FilesAdmin::getInstance( );

if( isset( $config['login'] ) && isset( $config['pass'] ) && $config['login'] == $config['pass'] )
  $sMsg .= '<div id="msg" class="error">'.$lang['Change_login_and_pass'].'</div>';

if( ( strstr( $p, '-delete' ) || count( $_POST ) > 0 ) && !empty( $_SERVER['HTTP_REFERER'] ) && !strstr( $_SERVER['HTTP_REFERER'], $_SERVER['SCRIPT_NAME'] ) ){
  header( 'Location: '.$_SERVER['PHP_SELF'].'?p=error' );
  exit;
}

// back-end dashboard
if( $p == 'news' || $p == 'login' ){
  require_once DIR_TEMPLATES.'admin/home.php';
}

// pages actions
elseif( $p == 'pages-list' ){
  $iTypeSearch = 1;
  require_once DIR_TEMPLATES.'admin/pages.php';
}
elseif( $p == 'pages-form' ){
  $iTypeSearch = 1;
  require_once DIR_TEMPLATES.'admin/pages-form.php';
}
elseif( $p == 'pages-delete' && isset( $iPage ) && is_numeric( $iPage ) ){
  if( !isset( $bWithoutFiles ) )
    $bWithoutFiles = null;
  $oPage->deletePage( $iPage, $bWithoutFiles );
  header( 'Location: '.$_SERVER['PHP_SELF'].'?p=pages-list&sOption=del' );
  exit;
}

// translations actions
elseif( $p == 'lang-list' || $p == 'lang-translations' ){
  require_once DIR_TEMPLATES.'admin/languages.php';
}
elseif( $p == 'lang-form' ){
  require_once DIR_TEMPLATES.'admin/languages-form.php';
}
elseif( $p == 'lang-delete' && isset( $sLanguage ) && !empty( $sLanguage ) ){
  deleteLanguage( $sLanguage );
  header( 'Location: '.$_SERVER['PHP_SELF'].'?p=lang-list&sOption=del' );
  exit;
}

// settings
elseif( $p == 'tools-config' ){
  require_once DIR_TEMPLATES.'admin/settings.php';
}

// files actions
elseif( $p == 'files-in-dir' ){
  header( 'Cache-Control: no-cache' );
  header( 'Content-type: text/html' );
  echo $oFile->listFilesInDir( 'time' );
  exit;
}
elseif( $p == 'files-upload' && !empty( $sFileName ) ){
  echo $oFile->uploadFile( $sFileName );
  exit;
}
// plugins actions

// error page
else{
  require_once DIR_TEMPLATES.'admin/_header.php'; // include headers
  require_once DIR_TEMPLATES.'admin/_menu.php'; // include menu
  echo '<div id="msg" class="error">'.$lang['Operation_unknown'].'</div>';
  require_once DIR_TEMPLATES.'admin/_footer.php'; // include menu
}
?>
Return current item: Quick.Cms - free and simple to use CMS