// // ------------------------------------------------------------------------- // include_once( '../../../include/cp_header.php' ) ; include_once "../include/gtickets.php" ; include_once XOOPS_ROOT_PATH.'/class/template.php'; include_once dirname(dirname(__FILE__)).'/include/Text_Diff.php' ; include_once dirname(dirname(__FILE__)).'/include/Text_Diff_Renderer.php' ; include_once dirname(dirname(__FILE__)).'/include/Text_Diff_Renderer_unified.php' ; $xoops_system_path = XOOPS_ROOT_PATH . '/modules/system' ; // initials $db =& Database::getInstance(); $myts =& MyTextSanitizer::getInstance() ; // determine language $language = $xoopsConfig['language'] ; if( ! file_exists( "$xoops_system_path/language/$language/admin/tplsets.php") ) $language = 'english' ; // load language constants // to prevent from notice that constants already defined $error_reporting_level = error_reporting( 0 ) ; include_once( "$xoops_system_path/constants.php" ) ; include_once( "$xoops_system_path/language/$language/admin.php" ) ; include_once( "$xoops_system_path/language/$language/admin/tplsets.php" ) ; error_reporting( $error_reporting_level ) ; // check $xoopsModule if( ! is_object( $xoopsModule ) ) redirect_header( XOOPS_URL.'/user.php' , 1 , _NOPERM ) ; // check access right (needs system_admin of tplset) $sysperm_handler =& xoops_gethandler('groupperm'); if (!$sysperm_handler->checkRight('system_admin', XOOPS_SYSTEM_TPLSET, $xoopsUser->getGroups())) redirect_header( XOOPS_URL.'/user.php' , 1 , _NOPERM ) ; // tpl_file from $_GET $tpl_file = $myts->stripSlashesGPC( @$_GET['tpl_file'] ) ; $tpl_file = str_replace( 'db:' , '' , $tpl_file ) ; $tpl_file4sql = addslashes( $tpl_file ) ; // tpl_file from $_GET $tpl_tplset = $myts->stripSlashesGPC( @$_GET['tpl_tplset'] ) ; if( ! $tpl_tplset ) $tpl_tplset = $xoopsConfig['template_set'] ; $tpl_tplset4sql = addslashes( $tpl_tplset ) ; // get information from tplfile table $sql = "SELECT * FROM ".$db->prefix("tplfile")." f NATURAL LEFT JOIN ".$db->prefix("tplsource")." s WHERE f.tpl_file='$tpl_file4sql' ORDER BY f.tpl_tplset='$tpl_tplset4sql' DESC,f.tpl_tplset='default' DESC" ; $tpl = $db->fetchArray( $db->query( $sql ) ) ; // error in specifying tpl_file if( empty( $tpl ) ) { if( strncmp( $tpl_file , 'file:' , 5 ) === 0 ) { die( 'Not DB template' ) ; } else { die( 'Invalid tpl_file.' ) ; } } //************// // POST stage // //************// if( ! empty( $_POST['do_modify'] ) ) { // Ticket Check if ( ! $xoopsGTicket->check() ) { redirect_header(XOOPS_URL.'/',3,$xoopsGTicket->getErrors()); } $result = $db->query( "SELECT tpl_id FROM ".$db->prefix("tplfile")." WHERE tpl_file='$tpl_file4sql' AND tpl_tplset='".addslashes($tpl['tpl_tplset'])."'" ) ; while( list( $tpl_id ) = $db->fetchRow( $result ) ) { $sql = "UPDATE ".$db->prefix("tplsource")." SET tpl_source='".addslashes($myts->stripSlashesGPC($_POST['tpl_source']))."' WHERE tpl_id=$tpl_id" ; if( ! $db->query( $sql ) ) die( 'SQL Error' ) ; $db->query( "UPDATE ".$db->prefix("tplfile")." SET tpl_lastmodified=UNIX_TIMESTAMP() WHERE tpl_id=$tpl_id" ) ; xoops_template_touch( $tpl_id ) ; } redirect_header( 'mytplsadmin.php?dirname='.$tpl['tpl_module'] , 1 , _MD_AM_DBUPDATED ) ; exit ; } xoops_cp_header() ; $mymenu_fake_uri = "/admin/mytplsadmin.php?dirname={$tpl['tpl_module']}" ; if( file_exists( './mymenu.php' ) ) include( './mymenu.php' ) ; echo "