Войти или зарегистрироваться
Выберите удобный способ — аккаунт создастся автоматически.
Или войдите по логину и паролю

23.03.2008, 12:28
|
|
Участник форума
Регистрация: 28.01.2008
Сообщений: 247
С нами:
9623364
Репутация:
28
|
|
Например, еще один дезенденый вариант:
PHP код:
<?php
class SiteItemAdm
{
public $db = NULL;
public $FS_FILE = NULL;
public $TBL_ITEM = NULL;
public $ID = 0;
public $ADM_TPL_PATH = NULL;
public $PAGE_URL = NULL;
public $IDX = "id";
public $O_FS = NULL;
public $ERR_MSG = "";
public $FS_ACTIVE_ONLY = false;
public $_search_by = NULL;
public function SiteItemAdm( )
{
$this->db =& $db;
}
public function &getFSInstance( )
{
if ( !isset( $this->O_FS ) )
{
$this->O_FS =& Factory::create( "FieldsSet", $this->FS_FILE );
if ( $this->FS_ACTIVE_ONLY )
{
$this->O_FS->ITERATOR_FILTER = create_function( "\$o_f", "return \$o_f->ACTIVE;" );
}
}
return $this->O_FS;
}
public function ShowPage( )
{
if ( $_REQUEST['submdel'] && $_REQUEST['chk_id'] )
{
$this->ItemsDelete( );
if ( !$this->ERR_MSG )
{
header( "Location: ".$this->PAGE_URL );
exit( );
}
}
else if ( $_POST['submexport'] )
{
$this->ItemsExport( );
}
$clean['id'] = is_scalar( $_GET['id'] ) && preg_match( "/^\\w+\$/", $_GET['id'] ) ? $_GET['id'] : NULL;
if ( $clean['id'] )
{
$this->ID = $clean['id'];
$this->getFSInstance( );
$this->O_FS->EditFieldsSetup( );
if ( $_POST['go'] )
{
$this->_makeReadOnlyHidden( );
$this->ERR_MSG = $this->ItemValidate( );
if ( !$this->ERR_MSG )
{
$this->_editFormProcess( );
}
}
$this->EditFormShow( );
}
else if ( $_GET['pg'] == "add" )
{
$this->getFSInstance( );
if ( $_POST['go'] )
{
$this->ERR_MSG = $this->ItemValidate( );
if ( !$this->ERR_MSG )
{
$this->AddFormProcess( );
}
}
$this->AddFormShow( );
}
else
{
$this->ListShow( );
}
}
public function ItemsExport( )
{
$o_ex =& new ExportData( );
$o_ex->TBL = $this->TBL_ITEM;
$o_ex->SQL = "SELECT * FROM ".$this->TBL_ITEM." WHERE 1".$this->ListSQLGet( );
$o_ex->Export( );
}
public function ItemsDeleteSQLIds( $var_name = "" )
{
if ( !$var_name )
{
$var_name = "chk_id";
}
$s_id = $_REQUEST[$var_name];
if ( !$s_id )
{
return;
}
if ( !is_array( $s_id ) )
{
$s_id = array(
$s_id
);
}
$s_id = array_map( array(
$this->db,
"esc"
), $s_id );
return implode( ",", $s_id );
}
public function ItemsDelete( )
{
$s_id = $this->ItemsDeleteSQLIds( );
$this->getFSInstance( );
$ql = "FROM ".$this->TBL_ITEM." WHERE ".$this->IDX." IN(".$s_id.")";
$res = $this->db->query( "SELECT * ".$ql );
while ( $v = mysql_fetch_assoc( $res ) )
{
hwdeleterelatedfiles( $v, $this->O_FS->A_UPLOAD_DB );
}
$this->db->query( "DELETE ".$ql );
return $s_id;
}
public function ListShow( )
{
global $sort_by;
global $a_d;
global $nav;
global $q;
global $search_by;
global $per_row;
global $numrecs;
$whitelist = array(
"sort_by" => array( "type" => "regexp", "pattern" => "/^[\\w ,]+\$/" ),
"a_d" => array(
"type" => "option",
"options" => array( "asc", "desc" )
),
"off" => array( "type" => "int" ),
"per_row" => array( "type" => "int" )
);
$clean = esfilter( $_REQUEST, $whitelist );
$sort_by = $clean['sort_by'] ? $clean['sort_by'] : $this->IDX;
$a_d = $clean['a_d'] ? $clean['a_d'] : "desc";
$per_row = $clean['per_row'] ? $clean['per_row'] : 10;
if ( !$clean['off'] || $_SERVER['REQUEST_METHOD'] == "POST" )
{
$clean['off'] = 0;
}
$num = $clean['off'] * $per_row;
$ql = "SELECT /*!40000 SQL_CALC_FOUND_ROWS */ ".$this->ListSQLFieldsGet( )." FROM ".$this->TBL_ITEM." WHERE 1".$this->ListSQLGet( );
if ( preg_match( "/[, ]/", $sort_by ) )
{
$_sort_by = "'".preg_replace( "/\\s*,\\s*/", "','", $sort_by )."'";
$_sort_by = preg_replace( "/\\s+(ASC|DESC)'/i", "' \\1", $_sort_by );
if ( preg_match_all( "/'[\\w]+'/", $_sort_by, $m ) )
{
$cnt = count( $m[0] );
$i = 0;
for ( ; $i < $cnt; ++$i )
{
$db_f = substr( $m[0][$i], 1, -1 );
if ( $this->ColInTable( $db_f ) )
{
$_sort_by = str_replace( $m[0][$i], $db_f, $_sort_by );
}
}
}
$ql .= " ORDER BY ".$_sort_by;
unset( $_sort_by );
}
else if ( $this->ColInTable( $sort_by ) )
{
$ql .= " ORDER BY {$sort_by} {$a_d}";
}
$ql .= " LIMIT {$num},{$per_row}";
$ql = $this->_listSQLAdjust( $ql );
$res = $this->db->query( $ql );
$numrecs = mysql_num_rows( $res );
if ( !$numrecs )
{
}
else
{
$numrecs = hwsqlcalcrows( $ql );
}
if ( $numrecs )
{
$ex_p = $this->ListNavGet( );
$ex_p = array_flip( $ex_p );
foreach ( array_keys( $ex_p ) as $k )
{
if ( isset( $k ) )
{
$ex_p[$k] = $$k;
}
else if ( isset( $_REQUEST[$k] ) && !is_array( $_REQUEST[$k] ) )
{
$ex_p[$k] = $_REQUEST[$k];
}
else
{
$ex_p[$k] = "";
}
}
$nav = getnavigation( $this->PAGE_URL, $per_row, 10, $numrecs, $clean['off'], $ex_p );
unset( $ex_p );
}
$tpl =& new HawkTpl( );
$tpl->InitArray( "row" );
$A_ID = $this->ListSQLResultReview( $res, $tpl );
while ( $v = mysql_fetch_assoc( $res ) )
{
$v['num'] = ++$num;
$this->ListRenderRow( $v );
$a_ph = $A_ID[$v[$this->IDX]];
if ( $a_ph )
{
$v = array_merge( $v, $a_ph );
}
$tpl->AddCell( "row", $v );
}
$search_by = $this->_getSelect( $this->ListSearchFieldsGet( ), $_REQUEST['search_by'] );
$sort_by = $this->_getSelect( $this->ListSortFieldsGet( ), $sort_by );
$a_v = array( "asc" => "{Ascendant}", "desc" => "{Descendant}" );
$a_d = $this->_getSelect( $a_v, $a_d );
$a_v = array( "10" => "10", "15" => "15", "20" => "20", "25" => "25", "30" => "30", "40" => "40", "50" => "50", "75" => "75", "100" => "100" );
$per_row = $this->_getSelect( $a_v, $per_row );
$GLOBALS['GLOBALS']['PAGE_URL'] = $this->PAGE_URL;
if ( $this->ERR_MSG )
{
$GLOBALS['GLOBALS']['err_msg'] = $this->ERR_MSG;
}
$q = htmlspecialchars( $_REQUEST['q'], ENT_QUOTES, $CHARSET );
$tpl->Parse( $this->TplGetPath( "list.htm" ), "\$numrecs,\$q,\$a_d,\$PAGE_URL".$this->ListRenderTpl( ).",\$nav,\$per_row,\$sort_by,\$search_by", 1 );
}
public function ListSearchFieldsGet( )
{
if ( is_array( $this->_search_by ) )
{
return $this->_search_by;
}
$a_v = array( "ID" );
$this->getFSInstance( );
$a_no_search = array( "checkboxes", "checkbox" );
$this->O_FS->rewind( );
while ( $o_f =& $this->O_FS->next( ) )
{
if ( in_array( $o_f->TYPE, $a_no_search ) )
{
continue;
}
$f_db = $o_f->DB_F;
$a_v[$f_db] = $o_f->TITLE;
}
$this->_search_by = $a_v;
return $a_v;
}
public function ListRenderTpl( )
{
return "";
}
public function ListSQLGet( )
{
$search_by = ( boolean )$_REQUEST['search_by'];
$q = trim( ( boolean )$_REQUEST['q'] );
$ql = "";
if ( $q && $search_by )
{
$a_v = $this->ListSearchFieldsGet( );
if ( !isset( $a_v[$search_by] ) )
{
return $ql;
}
unset( $a_v );
$is_exact_match = false;
if ( 2 < strlen( $q ) && $q[0] == "\"" && substr( $q, -1 ) == "\"" )
{
$q = substr( $q, 1, -1 );
$is_exact_match = true;
}
$q = addcslashes( $this->db->quote( $q ), "%_" );
if ( !$is_exact_match )
{
$q = "%{$q}%";
}
$ql .= " AND {$search_by} LIKE '{$q}'";
}
return $ql;
}
public function ListSQLFieldsGet( )
{
return "*";
}
public function _listSQLAdjust( $ql )
{
return $ql;
}
public function ListRenderRow( &$v )
{
}
public function ListNavGet( )
{
return array( "sort_by", "a_d", "per_row", "search_by", "q" );
}
public function ListSortFieldsGet( )
{
return array( "ID" );
}
public function ListSQLResultReview( $res, &$tpl )
{
}
public function ItemValidate( )
{
$this->getFSInstance( );
return $this->O_FS->ValidateData( );
}
public function AddFormShow( $show = true )
{
$a_v = $this->AddReadOnlyFieldsGet( );
if ( $a_v )
{
foreach ( $a_v as $k )
{
$this->O_FS->SetFieldProperty( "TYPE", "hidden", $k );
}
}
$tpl =& new HawkTpl( );
$tpl->InitArray( "row" );
$tpl_f = file_exists( $this->TplGetPath( "add.htm" ) ) ? "add" : "edit";
return $tpl->Parse( $this->TplGetPath( $tpl_f.".htm" ), $this->AddRenderTpl( $tpl ), $show );
}
public function AddFormProcess( )
{
$a_upload = $this->O_FS->A_UPLOAD;
foreach ( $a_upload as $k )
{
uploadisok( $k );
}
$this->db->query( "INSERT INTO ".$this->TBL_ITEM." SET ".substr( $this->O_FS->GetUpdateSQL( "", FALSE ), 1 ).$this->AddSQLAddonGet( ) );
if ( !$this->db->affected_rows( ) )
{
exit( "Error: user creation failed" );
}
$id = $this->db->insert_id( );
if ( !$id && $_POST[$this->IDX] )
{
$id = $this->db->quote( $_POST[$this->IDX] );
}
$this->AddAfterCreate( $id );
header( "Location: ".$this->PAGE_URL );
exit( );
}
public function AddSQLAddonGet( )
{
return "";
}
public function AddReadOnlyFieldsGet( )
{
return array( );
}
public function AddAfterCreate( $id )
{
}
public function AddRenderTpl( &$tpl )
{
return $this->ItemRender( $tpl, 0 );
}
public function EditFormShow( $show = true )
{
$tpl =& new HawkTpl( );
$tpl->InitArray( "row" );
$a_Item = $this->db->one_assoc( "SELECT * FROM ".$this->TBL_ITEM." WHERE {$this->IDX}='{$this->ID}'" );
if ( !$a_Item )
{
header( "Location: ".$this->PAGE_URL );
exit( );
}
$this->_makeReadOnlyHidden( $a_Item );
$this->O_FS->LoadValues( $a_Item );
return $tpl->Parse( $this->TplGetPath( "edit.htm" ), $this->EditRenderTpl( $tpl, $a_Item ), $show );
}
public function _makeReadOnlyHidden( $a_Item = false )
{
$a_v = $this->EditReadOnlyFieldsGet( $a_Item );
if ( $a_v )
{
foreach ( $a_v as $k )
{
$this->O_FS->SetFieldProperty( "TYPE", "hidden", $k );
}
}
}
public function _editFormProcess( )
{
$a_upload = $this->O_FS->A_UPLOAD_DB;
if ( $a_upload )
{
$old_files = $this->db->one_assoc( "SELECT ".implode( ",", $a_upload )." FROM ".$this->TBL_ITEM." WHERE ".$this->IDX."=\"".$this->ID."\"" );
}
$a_skip = array( );
$a_upload = $this->O_FS->A_UPLOAD;
if ( $a_upload )
{
foreach ( $a_upload as $k )
{
$f_db = $this->O_FS->GetDbFByID( $k );
if ( !uploadisok( $k, $old_files[$f_db] ) )
{
$a_skip[] = $k;
}
}
}
$this->db->query( "UPDATE ".$this->TBL_ITEM." SET ".substr( $this->O_FS->GetUpdateSQL( $a_skip, FALSE ), 1 ).$this->_EditSQLAddonGet( )." WHERE {$this->IDX}='{$this->ID}'" );
$this->EditAfterUpdate( );
$this->ERR_MSG = hwlng( "updated_ok" );
}
public function EditRenderTpl( &$tpl, $a_Item )
{
return $this->ItemRender( $tpl );
}
public function _EditSQLAddonGet( )
{
return "";
}
public function EditReadOnlyFieldsGet( $a_Item = false )
{
return array( );
}
public function EditAfterUpdate( )
{
}
public function ItemRender( &$tpl, $w_hidden = true, $auto = true )
{
$this->getFSInstance( );
$z = $a_out = array( );
$this->O_FS->rewind( );
while ( $o_f =& $this->O_FS->next( ) )
{
if ( !$w_hidden && $o_f->TYPE == "hidden" )
{
continue;
}
if ( isset( $_POST[$o_f->ID] ) )
{
$o_f->VALUE = $_POST[$o_f->ID];
}
if ( !$auto )
{
$a_out["ctl_{$o_f->ID}"] = $o_f->GetInputCtrl( );
}
else
{
$z['f_t'] = $o_f->TITLE;
$z['f_v'] = $o_f->GetInputCtrl( );
if ( $o_f->TYPE == "hidden" )
{
$z['f_txt'] = "";
}
else
{
$z['f_txt'] = $o_f->TXT;
}
if ( $o_f->ACTIVE )
{
$z['css'] = $o_f->REQUIRED ? "req" : "none";
}
else
{
$z['css'] = "adm";
}
$tpl->AddCell( "row", $z );
}
}
$a_out['enc_type'] = $this->O_FS->A_UPLOAD ? "ENCTYPE=\"multipart/form-data\"" : "";
$a_out['PAGE_URL'] = $this->PAGE_URL;
$a_out['id'] = $this->ID;
$GLOBALS['GLOBALS']['err_msg'] = $a_out['err_msg'] = $this->ERR_MSG;
return $a_out;
}
public function _getSelect( $a_v, $s_cur = "" )
{
$s = "";
if ( $a_v )
{
foreach ( $a_v as $k => $v )
{
$s .= "<option".( $k == $s_cur ? " selected" : "" )." value=\"".$k."\">".$v;
}
}
return $s;
}
public function ColInTable( $col, $tbl = "" )
{
if ( !$tbl )
{
$tbl = $this->TBL_ITEM;
}
$res = $this->db->query( "SHOW FIELDS FROM ".$tbl );
while ( $v = mysql_fetch_assoc( $res ) )
{
if ( $v['Field'] == $col )
{
return 1;
}
}
return 0;
}
public function TplGetPath( $fn )
{
return $this->ADM_TPL_PATH.$fn;
}
}
?>
Последний раз редактировалось serg-php; 23.03.2008 в 12:33..
|
|
|

23.03.2008, 12:31
|
|
Участник форума
Регистрация: 28.01.2008
Сообщений: 247
С нами:
9623364
Репутация:
28
|
|
Ошибку получаю:
Fatal error: Call to a member function query() on a non-object in
- это строка
PHP код:
$res = $this->db->query( "SHOW FIELDS FROM ".$tbl );
|
|
|

24.03.2008, 11:22
|
|
Новичок
Регистрация: 21.03.2008
Сообщений: 5
С нами:
9548298
Репутация:
0
|
|
Сообщение от serg-php
Ошибку получаю:
А там есть в коде инициализация базы?
И что в $tbl?
Сама таблица на месте?
|
|
|

25.03.2008, 00:39
|
|
Участник форума
Регистрация: 28.01.2008
Сообщений: 247
С нами:
9623364
Репутация:
28
|
|
Таблица на месте!
|
|
|

25.03.2008, 00:42
|
|
Участник форума
Регистрация: 28.01.2008
Сообщений: 247
С нами:
9623364
Репутация:
28
|
|
Выше привел оригинал файла до дезенда!
|
|
|

26.03.2008, 02:30
|
|
Участник форума
Регистрация: 28.01.2008
Сообщений: 247
С нами:
9623364
Репутация:
28
|
|
Другой подход
Код скрипта следующий:
Код:
<?php
function ShowModSetupPage( $tpl_f = "" )
{
global $O_HW;
global $err_msg;
global $MOD_CFG;
$A_CFG = array( );
include( SITE_PATH."modules/".HW_MOD."/hw_info.php" );
if ( $A_CFG )
{
$a_v = $O_HW->GetModOptions( HW_MOD );
if ( is_array( $a_v ) )
{
foreach ( array_keys( $a_v ) as $k )
{
if ( !isset( $A_CFG[$k] ) )
{
unset( $a_v[$k] );
}
}
if ( $a_v )
{
$A_CFG = array_merge( $A_CFG, $a_v );
}
unset( $a_v );
}
}
if ( $_POST['go'] )
{
if ( $A_CFG )
{
foreach ( array_keys( $A_CFG ) as $k )
{
if ( !isset( $_POST[$k] ) && substr( $k, 0, 3 ) != "EN_" )
{
continue;
}
$A_CFG[$k] = $_POST[$k];
}
}
$func = HW_MOD."_SetupValidate";
if ( function_exists( $func ) )
{
$err_msg = $func( );
}
if ( !$err_msg )
{
$func = HW_MOD."_SetupOnSave";
if ( function_exists( $func ) )
{
$func( $A_CFG );
}
$O_HW->SetModOptions( HW_MOD, $A_CFG );
$MOD_CFG = $O_HW->GetModOptions( HW_MOD );
$err_msg = hwlng( "updated_ok" );
}
}
$z = array( );
if ( $A_CFG )
{
foreach ( $A_CFG as $k => $v )
{
if ( substr( $k, 0, 3 ) == "EN_" )
{
$z[$k] = $v ? "checked" : "";
}
else
{
$z[$k] = $v;
}
}
}
$func = HW_MOD."_SetupPrepare";
if ( function_exists( $func ) )
{
$func( $z );
}
if ( !$tpl_f )
{
$tpl_f = HW_MOD_TPL."setup.htm";
}
return evaladvtpl( $tpl_f, $z );
}
function hwGetModuleDescr( $mod )
{
global $db;
list( $state, $descr ) = $db->one_row( "SELECT state,descr FROM ".TBL_MODULES." WHERE dir=".$db->esc( $mod )." AND admin_capable=\"1\"" );
if ( $state != "A" && $state != "I" )
{
showadmheader( );
echo "Module is not available";
showadmfooter( );
exit( );
}
return $descr;
}
define( "HTTP_HOST", $_SERVER['HTTP_HOST'] );
define( "ADMIN_AREA", 1 );
require( "../inc/application.php" );
if ( basename( __FILE__ ) != "modules.php" )
{
exit( "Access Denied" );
}
$mod = $_POST['mod'] ? $_POST['mod'] : $_GET['mod'];
$mod = ( boolean )$mod;
$a_mods = hwmodgetarray( );
if ( !$mod || !$a_mods[$mod] )
{
exit( "Module not found" );
}
checkloggedinadm( );
$HW_MOD = $mod;
$HW_MOD_DIR = MOD_DIR.$HW_MOD."/";
$HW_MOD_URL = "modules.php?mod=".$HW_MOD;
define( "HW_MOD", $mod );
define( "HW_MOD_DIR", MOD_DIR.HW_MOD."/" );
define( "HW_MOD_URL", "modules.php?mod=".HW_MOD );
define( "HW_MOD_TPL", HW_MOD_DIR."tpl/admin/" );
$MOD_CFG = $O_HW->GetModOptions( HW_MOD );
$mod_descr = hwgetmoduledescr( HW_MOD );
if ( !hwhasvalidkey( HW_MOD ) )
{
exit( "Module is not licensed for this domain : ".HW_MOD );
}
include( HW_MOD_DIR."hw_admin.php" );
hwmodloadlng( HW_MOD );
$HW_WRAP = 1;
if ( $pg == "setup" || $_GET['pg'] == "setup" )
{
$buf = showmodsetuppage( );
}
else
{
$func = HW_MOD."_main";
if ( !function_exists( $func ) )
{
exit( );
}
ob_start( );
$ret_buf = $func( );
$buf = ob_get_contents( );
ob_end_clean( );
if ( empty( $buf ) )
{
$buf = $ret_buf;
}
unset( $ret_buf );
}
if ( $HW_WRAP )
{
$buf = showadmheader( 0 ).$buf.showadmfooter( 0 );
}
hwprocesstags( $buf );
echo $buf;
printparsetime( );
?>
Запускаю в системе - получаю ответ
Очевидно, шибка в отрезке
Код:
define( "HTTP_HOST", $_SERVER['HTTP_HOST'] );
define( "ADMIN_AREA", 1 );
require( "../inc/application.php" );
if ( basename( __FILE__ ) != "modules.php" )
{
exit( "Access Denied" );
}
$mod = $_POST['mod'] ? $_POST['mod'] : $_GET['mod'];
$mod = ( boolean )$mod;
$a_mods = hwmodgetarray( );
if ( !$mod || !$a_mods[$mod] )
{
exit( "Module not found" );
}
а особенно в
Код:
$mod = $_POST['mod'] ? $_POST['mod'] : $_GET['mod'];
$mod = ( boolean )$mod;
$a_mods = hwmodgetarray( );
Прошу помочь. Подозрение общее на ошибку в цикле, либо пропущена запятая или скобка!
|
|
|

26.03.2008, 03:17
|
|
Новичок
Регистрация: 14.03.2008
Сообщений: 3
С нами:
9558386
Репутация:
0
|
|
Сообщение от serg-php
Прошу помочь. Подозрение общее на ошибку в цикле, либо пропущена запятая или скобка!
На твоём месте ябы закомментировал бы так
Код:
<?php
function ShowModSetupPage( $tpl_f = "" )
{
global $O_HW;
global $err_msg;
global $MOD_CFG;
$A_CFG = array( );
include( SITE_PATH."modules/".HW_MOD."/hw_info.php" );
if ( $A_CFG )
{
$a_v = $O_HW->GetModOptions( HW_MOD );
if ( is_array( $a_v ) )
{
foreach ( array_keys( $a_v ) as $k )
{
if ( !isset( $A_CFG[$k] ) )
{
unset( $a_v[$k] );
}
}
if ( $a_v )
{
$A_CFG = array_merge( $A_CFG, $a_v );
}
unset( $a_v );
}
}
if ( $_POST['go'] )
{
if ( $A_CFG )
{
foreach ( array_keys( $A_CFG ) as $k )
{
if ( !isset( $_POST[$k] ) && substr( $k, 0, 3 ) != "EN_" )
{
continue;
}
$A_CFG[$k] = $_POST[$k];
}
}
$func = HW_MOD."_SetupValidate";
if ( function_exists( $func ) )
{
$err_msg = $func( );
}
if ( !$err_msg )
{
$func = HW_MOD."_SetupOnSave";
if ( function_exists( $func ) )
{
$func( $A_CFG );
}
$O_HW->SetModOptions( HW_MOD, $A_CFG );
$MOD_CFG = $O_HW->GetModOptions( HW_MOD );
$err_msg = hwlng( "updated_ok" );
}
}
$z = array( );
if ( $A_CFG )
{
foreach ( $A_CFG as $k => $v )
{
if ( substr( $k, 0, 3 ) == "EN_" )
{
$z[$k] = $v ? "checked" : "";
}
else
{
$z[$k] = $v;
}
}
}
$func = HW_MOD."_SetupPrepare";
if ( function_exists( $func ) )
{
$func( $z );
}
if ( !$tpl_f )
{
$tpl_f = HW_MOD_TPL."setup.htm";
}
return evaladvtpl( $tpl_f, $z );
}
function hwGetModuleDescr( $mod )
{
global $db;
list( $state, $descr ) = $db->one_row( "SELECT state,descr FROM ".TBL_MODULES." WHERE dir=".$db->esc( $mod )." AND admin_capable=\"1\"" );
if ( $state != "A" && $state != "I" )
{
showadmheader( );
echo "Module is not available";
showadmfooter( );
exit( );
}
return $descr;
}
define( "HTTP_HOST", $_SERVER['HTTP_HOST'] );
define( "ADMIN_AREA", 1 );
require( "../inc/application.php" );
if ( basename( __FILE__ ) != "modules.php" )
{
exit( "Access Denied" );
}
$mod = $_POST['mod'] ? $_POST['mod'] : $_GET['mod'];
$mod = ( boolean )$mod;
//$a_mods = hwmodgetarray( ); закомментил т.к. больше нигде не встречается
//if ( !$mod || !$a_mods[$mod] ) скрипт выполняет условие которое нам ненадо? так закоменнтим это условие!
//{
// exit( "Module not found" );
//}
checkloggedinadm( );
$HW_MOD = $mod;
$HW_MOD_DIR = MOD_DIR.$HW_MOD."/";
$HW_MOD_URL = "modules.php?mod=".$HW_MOD;
define( "HW_MOD", $mod );
define( "HW_MOD_DIR", MOD_DIR.HW_MOD."/" );
define( "HW_MOD_URL", "modules.php?mod=".HW_MOD );
define( "HW_MOD_TPL", HW_MOD_DIR."tpl/admin/" );
$MOD_CFG = $O_HW->GetModOptions( HW_MOD );
//$mod_descr = hwgetmoduledescr( HW_MOD ); закомментил т.к. больше нигде не встречается
//if ( !hwhasvalidkey( HW_MOD ) )
//{
// exit( "Module is not licensed for this domain : ".HW_MOD );
//}
include( HW_MOD_DIR."hw_admin.php" );
hwmodloadlng( HW_MOD );
$HW_WRAP = 1;
if ( $pg == "setup" || $_GET['pg'] == "setup" )
{
$buf = showmodsetuppage( );
}
else
{
$func = HW_MOD."_main";
if ( !function_exists( $func ) )
{
exit( );
}
ob_start( );
$ret_buf = $func( );
$buf = ob_get_contents( );
ob_end_clean( );
if ( empty( $buf ) )
{
$buf = $ret_buf;
}
unset( $ret_buf );
}
if ( $HW_WRAP )
{
$buf = showadmheader( 0 ).$buf.showadmfooter( 0 );
}
hwprocesstags( $buf );
echo $buf;
printparsetime( );
?>
|
|
|

27.03.2008, 02:03
|
|
Участник форума
Регистрация: 28.01.2008
Сообщений: 247
С нами:
9623364
Репутация:
28
|
|
Warning: include(Y:/home/localhost/www/mysite/modules/1hw_admin.php) [function.include]: failed to open stream: No such file or directory in Y:\home\localhost\www\mysite\admin\modules.php on line 128
Warning: include() [function.include]: Failed opening 'Y:/home/localhost/www/mysite/modules/1hw_admin.php' for inclusion (include_path='.;/usr/local/php5/PEAR') in Y:\home\localhost\www\mysite\admin\modules.php on line 128
Комментировать, отсюда следует ничего не надо.
Ошибка в синтаксисе - это одна строка.
Скрипт не может обратиться к модулю, потому что не получил название папки, путь к которой \modules\Member_phpBB2\hw_admin.php
|
|
|

27.03.2008, 16:06
|
|
Новичок
Регистрация: 21.03.2008
Сообщений: 5
С нами:
9548298
Репутация:
0
|
|
Ну да пропиши ее напрямую
|
|
|

30.03.2008, 14:59
|
|
Участник форума
Регистрация: 28.01.2008
Сообщений: 247
С нами:
9623364
Репутация:
28
|
|
Вся проблема в том, что дезендер делает ошибки! Я не знаю какой там файл нужен!
|
|
|
|
 |
|
Предыдущая тема
Следующая тема
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|