90 lines
3.9 KiB
PHP
Executable File
90 lines
3.9 KiB
PHP
Executable File
<?php
|
||
ini_set( 'display_errors', 0 );
|
||
$_SESSION[ 'id' ] = $_GET[ 'id' ];
|
||
if ( $_SESSION[ 'dostup' ] !== 'a' ) header( 'Location: /login/' );
|
||
|
||
class modClass
|
||
{
|
||
|
||
static function list_dir ( $dir )
|
||
{
|
||
if ( $dir [ strlen( $dir ) - 1 ] != '/' ) $dir .= '/';
|
||
$nDir = opendir( $dir );
|
||
while ( false !== ( $file = readdir( $nDir ) ) ) {
|
||
if ( $file != '.' AND $file != '..' ) {
|
||
if ( is_dir( $dir . $file ) ) $files [] = $file;
|
||
}
|
||
}
|
||
closedir( $nDir );
|
||
return $files;
|
||
}
|
||
|
||
public static $catID = 0;
|
||
// int
|
||
/* ----------------------------------------------------------------------
|
||
28.11.2024
|
||
Получаем список категорий
|
||
---------------------------------------------------------------------- */
|
||
static function getListPages( $id = 0 ) {
|
||
if ( $_SESSION[ 'dostup' ] == 'a' )
|
||
return DB::getAll( 'SELECT `id`, `title` FROM `content` WHERE `content_type`=? AND `status`=? AND `content_category`=? ORDER BY `title`', [ 7, 1, $id ] );
|
||
else
|
||
return DB::getAll( 'SELECT `id`, `title` FROM `content` WHERE `content_type`=? AND `status`=? AND `content_category`=? AND `user`=? ORDER BY `title`', [ 7, 1, $id, $_SESSION[ 'user_id' ] ] );
|
||
}
|
||
/* ----------------------------------------------------------------------
|
||
28.11.2024
|
||
Получаем список ВСЕХ категорий
|
||
---------------------------------------------------------------------- */
|
||
static function getAllListPages() {
|
||
if ( $_SESSION[ 'dostup' ] == 'a' )
|
||
return DB::getAll( 'SELECT `id`, `title` FROM `content` WHERE `content_type`=? AND `status`=? ORDER BY `title`', [ 7, 1 ] );
|
||
else
|
||
return DB::getAll( 'SELECT `id`, `title` FROM `content` WHERE `content_type`=? AND `status`=? AND `user`=? ORDER BY `title`', [ 7, 1, $_SESSION[ 'user_id' ] ] );
|
||
}
|
||
/* ----------------------------------------------------------------------
|
||
28.11.2024
|
||
Получаем Информацию о текущей категории
|
||
---------------------------------------------------------------------- */
|
||
static function getCategoryInfo()
|
||
{
|
||
$res = DB::getRow( 'SELECT * FROM `content` WHERE `content_type`=? AND `id`=? LIMIT 1', [ 7, $_GET[ 'id' ] ] );
|
||
$res[ 'json' ] = core::j( $res[ 'json' ] );
|
||
return $res;
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
$smarty->assign( 'modList', modClass::list_dir('api/modules') );
|
||
|
||
|
||
$code = file_get_contents( 'api/modules/' . $_GET[ 'id' ] . '/index.php' );
|
||
$smarty->assign( 'codePHP', $code );
|
||
|
||
|
||
$code=(file_exists("skin/" . $_SERVER['SERVER_NAME'] . '/inc/mod/' . $_GET['id'] . '/index.html'))?file_get_contents( "skin/" . $_SERVER['SERVER_NAME'] . '/inc/mod/' . $_GET['id'] . '/index.html' ):$code = file_get_contents( 'api/modules/' . $_GET[ 'id' ] . '/index.html' );
|
||
|
||
|
||
$smarty->assign( 'codeHTML', base64_encode( $code ) );
|
||
|
||
$code = file_get_contents( 'api/modules/' . $_GET[ 'id' ] . '/ajax.php' );
|
||
$smarty->assign( 'codeAJAX', $code );
|
||
|
||
$code = file_get_contents( 'api/modules/' . $_GET[ 'id' ] . '/mod.js' );
|
||
$smarty->assign( 'codeJS', $code );
|
||
|
||
/*
|
||
$smarty->assign( 'categoryList', modClass::getListPages( $_GET[ 'id' ] ) );
|
||
$smarty->assign( 'all_cats', modClass::getAllListPages() );
|
||
if ( $_GET[ 'id' ] )$smarty->assign( 'thisCategoryInfo', modClass::getCategoryInfo() );
|
||
*/
|
||
/*----------------------------------------------------------------------
|
||
07.10.2022
|
||
Подключаемые области
|
||
----------------------------------------------------------------------*/
|
||
/*$smarty->assign( 'cat_list', 'api/modules/' . $_GET[ 'mod' ] . '/cat_list.html' );
|
||
$smarty->assign( 'pages_list', 'api/modules/' . $_GET[ 'mod' ] . '/pages_list.html' );
|
||
$smarty->assign( 'modal_new_cat', 'api/modules/' . $_GET[ 'mod' ] . '/modal_new_cat.html' );
|
||
$smarty->assign( 'modal_del_page', 'api/modules/' . $_GET[ 'mod' ] . '/modal_del_page.html' );*/
|
||
?>
|