|
From: <be...@us...> - 2013-09-15 01:28:36
|
Revision: 12050
http://sourceforge.net/p/xoops/svn/12050
Author: beckmi
Date: 2013-09-15 01:28:32 +0000 (Sun, 15 Sep 2013)
Log Message:
-----------
Bug ID: 1273 template duplicate issue (irmtfan)
Modified Paths:
--------------
XoopsCore/branches/2.5.x/2.5.7/docs/changelog.250.txt
XoopsCore/branches/2.5.x/2.5.7/htdocs/install/sql/mysql.structure.sql
XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/system/admin/modulesadmin/main.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/system/include/update.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/system/xoops_version.php
Modified: XoopsCore/branches/2.5.x/2.5.7/docs/changelog.250.txt
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/docs/changelog.250.txt 2013-09-14 21:28:28 UTC (rev 12049)
+++ XoopsCore/branches/2.5.x/2.5.7/docs/changelog.250.txt 2013-09-15 01:28:32 UTC (rev 12050)
@@ -11,6 +11,7 @@
- ID: 1278 _AM_SENDMTOUSERS missed (Mowaffaq/mamba)
- ID: 1285 check if session exists before attempting to start a new one (wishcraft)
- ID: 1287 assigning "static" to various class methods (wishcraft/mamba)
+- ID: 1273 template duplicate issue (irmtfan)
- reversing fix for potential lack of rendering css and javascript in Installer on the last screen by culex
- removing @ in link[@rel*=style][title] in styleswitch.js (not needed in jQuery 1.83) (SMEDrieben/Mamba)
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/install/sql/mysql.structure.sql
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/install/sql/mysql.structure.sql 2013-09-14 21:28:28 UTC (rev 12049)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/install/sql/mysql.structure.sql 2013-09-15 01:28:32 UTC (rev 12050)
@@ -498,7 +498,7 @@
#
# Table structure for table `tplfile`
#
-
+# irmtfan bug fix: solve templates duplicate issue
CREATE TABLE tplfile (
tpl_id mediumint(7) unsigned NOT NULL auto_increment,
tpl_refid smallint(5) unsigned NOT NULL default '0',
@@ -511,7 +511,8 @@
tpl_type varchar(20) NOT NULL default '',
PRIMARY KEY (tpl_id),
KEY tpl_refid (tpl_refid,tpl_type),
- KEY tpl_tplset (tpl_tplset,tpl_file(10))
+ KEY tpl_tplset (tpl_tplset,tpl_file(10)) ,
+ UNIQUE tpl_refid_module_set_file_type (tpl_refid, tpl_module, tpl_tplset, tpl_file, tpl_type)
) ENGINE=MyISAM;
# --------------------------------------------------------
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/system/admin/modulesadmin/main.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/system/admin/modulesadmin/main.php 2013-09-14 21:28:28 UTC (rev 12049)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/system/admin/modulesadmin/main.php 2013-09-15 01:28:32 UTC (rev 12050)
@@ -30,20 +30,22 @@
// ------------------------------------------------------------------------- //
// Check users rights
-if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) exit(_NOPERM);
+if (!is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid())) {
+ exit(_NOPERM);
+}
include_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
include_once XOOPS_ROOT_PATH . '/modules/system/admin/modulesadmin/modulesadmin.php';
-if ( isset($_POST) ) {
- foreach ( $_POST as $k => $v ) {
+if (isset($_POST)) {
+ foreach ($_POST as $k => $v) {
${$k} = $v;
}
}
// Get Action type
-$op = system_CleanVars ( $_REQUEST, 'op', 'list', 'string' );
-$module = system_CleanVars ( $_REQUEST, 'module', '', 'string' );
+$op = system_CleanVars($_REQUEST, 'op', 'list', 'string');
+$module = system_CleanVars($_REQUEST, 'module', '', 'string');
if (in_array($op, array('confirm', 'submit', 'install_ok', 'update_ok', 'uninstall_ok'))) {
if (!$GLOBALS['xoopsSecurity']->check()) {
@@ -60,41 +62,43 @@
// Call Header
xoops_cp_header();
// Define Stylesheet
- $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/admin.css');
- $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css');
+ $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
+ $xoTheme->addStylesheet(
+ XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'
+ );
// Define scripts
$xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
$xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js');
$xoTheme->addScript('modules/system/js/admin.js');
$xoTheme->addScript('modules/system/js/module.js');
// Define Breadcrumb and tips
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath') );
- $xoBreadCrumb->addHelp( system_adminVersion('modulesadmin', 'help') );
- $xoBreadCrumb->addTips( _AM_SYSTEM_MODULES_TIPS );
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
+ $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help'));
+ $xoBreadCrumb->addTips(_AM_SYSTEM_MODULES_TIPS);
$xoBreadCrumb->render();
// Get Module Handler
$module_handler =& xoops_gethandler('module');
- $criteria = new CriteriaCompo();
+ $criteria = new CriteriaCompo();
$criteria->setSort('weight');
$criteria->setOrder('ASC');
// Get all installed modules
- $installed_mods = $module_handler->getObjects( $criteria );
- $listed_mods = array();
- $i = 0;
- $install_mods = array();
- foreach ( $installed_mods as $module ) {
- $listed_mods[$i] = $module->toArray();
+ $installed_mods = $module_handler->getObjects($criteria);
+ $listed_mods = array();
+ $i = 0;
+ $install_mods = array();
+ foreach ($installed_mods as $module) {
+ $listed_mods[$i] = $module->toArray();
$listed_mods[$i]['image'] = $module->getInfo('image');
$listed_mods[$i]['adminindex'] = $module->getInfo('adminindex');
- $listed_mods[$i]['version'] = round( $module->getVar('version') / 100, 2 );
- $listed_mods[$i]['last_update'] = formatTimestamp( $module->getVar('last_update'), 'm' );
+ $listed_mods[$i]['version'] = round($module->getVar('version') / 100, 2);
+ $listed_mods[$i]['last_update'] = formatTimestamp($module->getVar('last_update'), 'm');
$listed_mods[$i]['author'] = $module->getInfo('author');
$listed_mods[$i]['credits'] = $module->getInfo('credits');
$listed_mods[$i]['license'] = $module->getInfo('license');
$listed_mods[$i]['description'] = $module->getInfo('description');
- if ( round( $module->getInfo( 'version' ), 2 ) != $listed_mods[$i]['version']){
+ if (round($module->getInfo('version'), 2) != $listed_mods[$i]['version']) {
$listed_mods[$i]['warning_update'] = true;
- }else{
+ } else {
$listed_mods[$i]['warning_update'] = false;
}
$install_mods[] = $module->getInfo('dirname');
@@ -102,14 +106,14 @@
$i++;
}
// Get module to install
- $dirlist = XoopsLists::getModulesList();
+ $dirlist = XoopsLists::getModulesList();
$toinstall_mods = array();
- $i=0;
+ $i = 0;
foreach ($dirlist as $file) {
- if ( file_exists( XOOPS_ROOT_PATH . '/modules/' . $file . '/xoops_version.php' ) ) {
+ if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $file . '/xoops_version.php')) {
clearstatcache();
$file = trim($file);
- if ( !in_array($file, $install_mods) ) {
+ if (!in_array($file, $install_mods)) {
$i++;
}
}
@@ -129,34 +133,36 @@
// Call Header
xoops_cp_header();
// Define Stylesheet
- $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/admin.css');
- $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css');
+ $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
+ $xoTheme->addStylesheet(
+ XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'
+ );
// Define scripts
$xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
$xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js');
$xoTheme->addScript('modules/system/js/admin.js');
// Define Breadcrumb and tips
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath') );
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_TOINSTALL );
- $xoBreadCrumb->addHelp( system_adminVersion('modulesadmin', 'help') . '#install' );
- $xoBreadCrumb->addTips( _AM_SYSTEM_MODULES_TIPS );
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_TOINSTALL);
+ $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#install');
+ $xoBreadCrumb->addTips(_AM_SYSTEM_MODULES_TIPS);
$xoBreadCrumb->render();
// Get Module Handler
$module_handler =& xoops_gethandler('module');
// Get all installed modules
$installed_mods = $module_handler->getObjects();
- foreach ( $installed_mods as $module ) {
+ foreach ($installed_mods as $module) {
$install_mods[] = $module->getInfo('dirname');
}
// Get module to install
- $dirlist = XoopsLists::getModulesList();
+ $dirlist = XoopsLists::getModulesList();
$toinstall_mods = array();
- $i=0;
+ $i = 0;
foreach ($dirlist as $file) {
- if ( file_exists( XOOPS_ROOT_PATH . '/modules/' . $file . '/xoops_version.php' ) ) {
+ if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $file . '/xoops_version.php')) {
clearstatcache();
$file = trim($file);
- if ( !in_array($file, $install_mods) ) {
+ if (!in_array($file, $install_mods)) {
$module =& $module_handler->create();
$module->loadInfo($file);
$toinstall_mods[$i]['name'] = $module->getInfo('name');
@@ -183,16 +189,16 @@
case 'order':
// Get Module Handler
$module_handler =& xoops_gethandler('module');
- if ( isset($_POST['mod']) ) {
- $i=1;
+ if (isset($_POST['mod'])) {
+ $i = 1;
foreach ($_POST['mod'] as $order) {
- if( $order > 0 ) {
+ if ($order > 0) {
$module = $module_handler->get($order);
//Change order only for visible modules
if ($module->getVar('weight') != 0) {
$module->setVar('weight', $i);
if (!$module_handler->insert($module)) {
- $error=true;
+ $error = true;
}
$i++;
}
@@ -208,32 +214,32 @@
// Call Header
xoops_cp_header();
// Define Stylesheet
- $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/admin.css');
+ $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
// Define Breadcrumb and tips
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath') );
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_VALIDATE );
- $xoBreadCrumb->addHelp( system_adminVersion('modulesadmin', 'help') . '#confirm' );
- $xoBreadCrumb->addTips( _AM_SYSTEM_MODULES_CONFIRM_TIPS );
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_VALIDATE);
+ $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#confirm');
+ $xoBreadCrumb->addTips(_AM_SYSTEM_MODULES_CONFIRM_TIPS);
$xoBreadCrumb->render();
$error = array();
- if ( !is_writable(XOOPS_CACHE_PATH.'/') ) {
+ if (!is_writable(XOOPS_CACHE_PATH . '/')) {
// attempt to chmod 666
- if ( !chmod(XOOPS_CACHE_PATH.'/', 0777) ) {
- $error[] = sprintf(_MUSTWABLE, "<strong>".XOOPS_CACHE_PATH.'/</strong>');
+ if (!chmod(XOOPS_CACHE_PATH . '/', 0777)) {
+ $error[] = sprintf(_MUSTWABLE, "<strong>" . XOOPS_CACHE_PATH . '/</strong>');
}
}
- if ( count($error) > 0 ) {
+ if (count($error) > 0) {
// Display Error
xoops_error($error);
// Call Footer
xoops_cp_footer();
exit();
}
- $i = 0;
+ $i = 0;
$modifs_mods = array();
- $module = empty($_POST['module']) ? array() : $_POST['module'];
+ $module = empty($_POST['module']) ? array() : $_POST['module'];
foreach ($module as $mid) {
- $mid = (int) $mid;
+ $mid = (int)$mid;
$modifs_mods[$i]['mid'] = $mid;
$modifs_mods[$i]['oldname'] = $myts->htmlspecialchars($myts->stripSlashesGPC($oldname[$mid]));
$modifs_mods[$i]['newname'] = $myts->htmlspecialchars(trim($myts->stripslashesGPC($newname[$mid])));
@@ -249,21 +255,21 @@
case 'display':
// Get module handler
$module_handler =& xoops_gethandler('module');
- $module_id = system_CleanVars ( $_POST, 'mid', 0, 'int' );
- if ( $module_id > 0 ) {
- $module =& $module_handler->get( $module_id );
- $old = $module->getVar('isactive');
+ $module_id = system_CleanVars($_POST, 'mid', 0, 'int');
+ if ($module_id > 0) {
+ $module =& $module_handler->get($module_id);
+ $old = $module->getVar('isactive');
// Set value
- $module->setVar('isactive', !$old );
+ $module->setVar('isactive', !$old);
if (!$module_handler->insert($module)) {
- $error=true;
+ $error = true;
}
- $blocks = XoopsBlock::getByModule($module_id);
- $bcount = count($blocks);
- for ($i = 0; $i < $bcount; $i++) {
- $blocks[$i]->setVar('isactive', !$old);
- $blocks[$i]->store();
- }
+ $blocks = XoopsBlock::getByModule($module_id);
+ $bcount = count($blocks);
+ for ($i = 0; $i < $bcount; $i++) {
+ $blocks[$i]->setVar('isactive', !$old);
+ $blocks[$i]->store();
+ }
//Set active modules in cache folder
xoops_setActiveModules();
}
@@ -272,24 +278,24 @@
case 'display_in_menu':
// Get module handler
$module_handler =& xoops_gethandler('module');
- $module_id = system_CleanVars ( $_POST, 'mid', 0, 'int' );
- if ( $module_id > 0 ) {
+ $module_id = system_CleanVars($_POST, 'mid', 0, 'int');
+ if ($module_id > 0) {
$module =& $module_handler->get($module_id);
- $old = $module->getVar('weight');
+ $old = $module->getVar('weight');
// Set value
- $module->setVar('weight', !$old );
+ $module->setVar('weight', !$old);
if (!$module_handler->insert($module)) {
- $error=true;
+ $error = true;
}
}
- break;
+ break;
case 'submit':
- $ret = array();
- $write = false;
+ $ret = array();
+ $write = false;
$module = empty($_POST['module']) ? array() : $_POST['module'];
foreach ($module as $mid) {
- if (isset($newstatus[$mid]) && $newstatus[$mid] ==1) {
+ if (isset($newstatus[$mid]) && $newstatus[$mid] == 1) {
if ($oldstatus[$mid] == 0) {
$ret[] = xoops_module_activate($mid);
}
@@ -299,12 +305,12 @@
}
}
$newname[$mid] = trim($newname[$mid]);
- if ($oldname[$mid] != $newname[$mid] ) {
+ if ($oldname[$mid] != $newname[$mid]) {
$ret[] = xoops_module_change($mid, $newname[$mid]);
$write = true;
}
}
- if ( $write ) {
+ if ($write) {
// Flush cache files for cpanel GUIs
xoops_load('cpanel', 'system');
XoopsSystemCpanel::flush();
@@ -317,13 +323,13 @@
// Call Header
xoops_cp_header();
// Define Stylesheet
- $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/admin.css');
+ $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
// Define Breadcrumb and tips
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath') );
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_SUBMITRES );
- $xoBreadCrumb->addHelp( system_adminVersion('modulesadmin', 'help') . '#submit' );
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_SUBMITRES);
+ $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#submit');
$xoBreadCrumb->render();
- if ( count($ret) > 0 ) {
+ if (count($ret) > 0) {
$xoopsTpl->assign('result', $ret);
}
// Call Footer
@@ -334,30 +340,38 @@
$module = $myts->htmlspecialchars($module);
// Get module handler
$module_handler =& xoops_gethandler('module');
- $mod =& $module_handler->create();
+ $mod =& $module_handler->create();
$mod->loadInfoAsVar($module);
// Construct message
if ($mod->getInfo('image') != false && trim($mod->getInfo('image')) != '') {
- $msgs ='<img src="' . XOOPS_URL . '/modules/' . $mod->getVar('dirname', 'n') . '/' . trim($mod->getInfo('image')) . '" alt="" />';
+ $msgs = '<img src="' . XOOPS_URL . '/modules/' . $mod->getVar('dirname', 'n') . '/' . trim(
+ $mod->getInfo('image')
+ ) . '" alt="" />';
}
- $msgs .= '<br /><span style="font-size:smaller;">' . $mod->getVar('name', 's') . '</span><br /><br />' . _AM_SYSTEM_MODULES_RUSUREINS;
+ $msgs .= '<br /><span style="font-size:smaller;">' . $mod->getVar('name', 's')
+ . '</span><br /><br />' . _AM_SYSTEM_MODULES_RUSUREINS;
// Call Header
xoops_cp_header();
// Define Stylesheet
- $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/admin.css');
+ $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
// Define Breadcrumb and tips
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath') );
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_INSTALL );
- $xoBreadCrumb->addHelp( system_adminVersion('modulesadmin', 'help') . '#install' );
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_INSTALL);
+ $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#install');
$xoBreadCrumb->render();
// Display question message
- xoops_confirm(array('module' => $module, 'op' => 'install_ok', 'fct' => 'modulesadmin'), 'admin.php', $msgs, _AM_SYSTEM_MODULES_INSTALL);
+ xoops_confirm(
+ array('module' => $module, 'op' => 'install_ok', 'fct' => 'modulesadmin'),
+ 'admin.php',
+ $msgs,
+ _AM_SYSTEM_MODULES_INSTALL
+ );
// Call Footer
xoops_cp_footer();
break;
case 'install_ok':
- $ret = array();
+ $ret = array();
$ret[] = xoops_module_install($module);
// Flush cache files for cpanel GUIs
xoops_load('cpanel', 'system');
@@ -369,11 +383,11 @@
// Call Header
xoops_cp_header();
// Define Stylesheet
- $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/admin.css');
+ $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
// Define Breadcrumb and tips
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath') );
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_INSTALL );
- $xoBreadCrumb->addHelp( system_adminVersion('modulesadmin', 'help') . '#install' );
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_INSTALL);
+ $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#install');
$xoBreadCrumb->render();
if (count($ret) > 0) {
foreach ($ret as $msg) {
@@ -390,29 +404,37 @@
$module = $myts->htmlspecialchars($module);
// Get module handler
$module_handler =& xoops_gethandler('module');
- $mod =& $module_handler->getByDirname($module);
+ $mod =& $module_handler->getByDirname($module);
// Construct message
if ($mod->getInfo('image') != false && trim($mod->getInfo('image')) != '') {
- $msgs ='<img src="' . XOOPS_URL . '/modules/' . $mod->getVar('dirname', 'n') . '/' . trim($mod->getInfo('image')) . '" alt="" />';
+ $msgs = '<img src="' . XOOPS_URL . '/modules/' . $mod->getVar('dirname', 'n') . '/' . trim(
+ $mod->getInfo('image')
+ ) . '" alt="" />';
}
- $msgs .= '<br /><span style="font-size:smaller;">' . $mod->getVar('name') . '</span><br /><br />' . _AM_SYSTEM_MODULES_RUSUREUNINS;
+ $msgs .= '<br /><span style="font-size:smaller;">' . $mod->getVar('name')
+ . '</span><br /><br />' . _AM_SYSTEM_MODULES_RUSUREUNINS;
// Call Header
xoops_cp_header();
// Define Stylesheet
- $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/admin.css');
+ $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
// Define Breadcrumb and tips
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath') );
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_UNINSTALL );
- $xoBreadCrumb->addHelp( system_adminVersion('modulesadmin', 'help') . '#delete' );
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_UNINSTALL);
+ $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#delete');
$xoBreadCrumb->render();
// Display Question
- xoops_confirm(array('module' => $module, 'op' => 'uninstall_ok', 'fct' => 'modulesadmin'), 'admin.php', $msgs, _AM_SYSTEM_MODULES_UNINSTALL);
+ xoops_confirm(
+ array('module' => $module, 'op' => 'uninstall_ok', 'fct' => 'modulesadmin'),
+ 'admin.php',
+ $msgs,
+ _AM_SYSTEM_MODULES_UNINSTALL
+ );
// Call Footer
xoops_cp_footer();
break;
case 'uninstall_ok':
- $ret = array();
+ $ret = array();
$ret[] = xoops_module_uninstall($module);
// Flush cache files for cpanel GUIs
xoops_load("cpanel", "system");
@@ -424,11 +446,11 @@
// Call Header
xoops_cp_header();
// Define Stylesheet
- $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/admin.css');
+ $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
// Define Breadcrumb and tips
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath') );
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_UNINSTALL );
- $xoBreadCrumb->addHelp( system_adminVersion('modulesadmin', 'help') . '#delete' );
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_UNINSTALL);
+ $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#delete');
$xoBreadCrumb->render();
if (count($ret) > 0) {
foreach ($ret as $msg) {
@@ -445,70 +467,83 @@
$module = $myts->htmlspecialchars($module);
// Get module handler
$module_handler =& xoops_gethandler('module');
- $mod =& $module_handler->getByDirname($module);
+ $mod =& $module_handler->getByDirname($module);
// Construct message
if ($mod->getInfo('image') != false && trim($mod->getInfo('image')) != '') {
- $msgs ='<img src="' . XOOPS_URL . '/modules/' . $mod->getVar('dirname', 'n') . '/' . trim($mod->getInfo('image')) . '" alt="" />';
+ $msgs = '<img src="' . XOOPS_URL . '/modules/' . $mod->getVar('dirname', 'n') . '/' . trim(
+ $mod->getInfo('image')
+ ) . '" alt="" />';
}
- $msgs .= '<br /><span style="font-size:smaller;">' . $mod->getVar('name', 's') . '</span><br /><br />' . _AM_SYSTEM_MODULES_RUSUREUPD;
+ $msgs .= '<br /><span style="font-size:smaller;">' . $mod->getVar('name', 's')
+ . '</span><br /><br />' . _AM_SYSTEM_MODULES_RUSUREUPD;
// Call Header
xoops_cp_header();
// Define Stylesheet
- $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/admin.css');
+ $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
// Define Breadcrumb and tips
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath') );
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_UPDATE );
- $xoBreadCrumb->addHelp( system_adminVersion('modulesadmin', 'help') . '#update' );
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_UPDATE);
+ $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#update');
$xoBreadCrumb->render();
// Display message
- xoops_confirm(array('dirname' => $module, 'op' => 'update_ok', 'fct' => 'modulesadmin'), 'admin.php', $msgs, _AM_SYSTEM_MODULES_UPDATE);
+ xoops_confirm(
+ array('dirname' => $module, 'op' => 'update_ok', 'fct' => 'modulesadmin'),
+ 'admin.php',
+ $msgs,
+ _AM_SYSTEM_MODULES_UPDATE
+ );
// Call Footer
xoops_cp_footer();
break;
case 'update_ok':
- $dirname = $myts->htmlspecialchars(trim($dirname));
+ $dirname = $myts->htmlspecialchars(trim($dirname));
$module_handler =& xoops_gethandler('module');
- $module =& $module_handler->getByDirname($dirname);
+ $module =& $module_handler->getByDirname($dirname);
// Save current version for use in the update function
$prev_version = $module->getVar('version');
- $clearTpl = new XoopsTpl();
+ $clearTpl = new XoopsTpl();
$clearTpl->clearCache($dirname);
// we dont want to change the module name set by admin
$temp_name = $module->getVar('name');
$module->loadInfoAsVar($dirname);
$module->setVar('name', $temp_name);
- $module->setVar('last_update', time() );
+ $module->setVar('last_update', time());
// Call Header
// Define main template
$xoopsOption['template_main'] = 'system_header.html';
// Call Header
xoops_cp_header();
// Define Stylesheet
- $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/admin.css');
+ $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
// Define Breadcrumb and tips
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath') );
- $xoBreadCrumb->addLink( _AM_SYSTEM_MODULES_UPDATE );
- $xoBreadCrumb->addHelp( system_adminVersion('modulesadmin', 'help') . '#update' );
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath'));
+ $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_UPDATE);
+ $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#update');
$xoBreadCrumb->render();
if (!$module_handler->insert($module)) {
- echo '<p>Could not update '.$module->getVar('name').'</p>';
- echo "<br /><div class='center'><a href='admin.php?fct=modulesadmin'>" . _AM_SYSTEM_MODULES_BTOMADMIN . "</a></div>";
+ echo '<p>Could not update ' . $module->getVar('name') . '</p>';
+ echo "<br /><div class='center'><a href='admin.php?fct=modulesadmin'>" . _AM_SYSTEM_MODULES_BTOMADMIN
+ . "</a></div>";
} else {
$newmid = $module->getVar('mid');
- $msgs = array();
+ $msgs = array();
$msgs[] = '<div id="xo-module-log"><div class="header">';
- $msgs[] = $errs[] = '<h4>' . _AM_SYSTEM_MODULES_UPDATING . $module->getInfo('name', 's') . '</h4>';
+ $msgs[] = $errs[] = '<h4>' . _AM_SYSTEM_MODULES_UPDATING . $module->getInfo('name', 's') . '</h4>';
if ($module->getInfo('image') != false && trim($module->getInfo('image')) != '') {
- $msgs[] ='<img src="' . XOOPS_URL . '/modules/' . $dirname . '/' . trim($module->getInfo('image')) . '" alt="" />';
+ $msgs[] = '<img src="' . XOOPS_URL . '/modules/' . $dirname . '/' . trim($module->getInfo('image'))
+ . '" alt="" />';
}
- $msgs[] ='<strong>' . _VERSION . ':</strong> ' . $module->getInfo('version');
+ $msgs[] = '<strong>' . _VERSION . ':</strong> ' . $module->getInfo('version');
if ($module->getInfo('author') != false && trim($module->getInfo('author')) != '') {
- $msgs[] ='<strong>' . _AUTHOR . ':</strong> ' . $myts->htmlspecialchars(trim($module->getInfo('author')));
+ $msgs[]
+ = '<strong>' . _AUTHOR . ':</strong> ' . $myts->htmlspecialchars(trim($module->getInfo('author')));
}
- $msgs[] = '</div><div class="logger">';
- $msgs[] = _AM_SYSTEM_MODULES_MODULE_DATA_UPDATE;
+ $msgs[] = '</div><div class="logger">';
+ $msgs[] = _AM_SYSTEM_MODULES_MODULE_DATA_UPDATE;
$tplfile_handler =& xoops_gethandler('tplfile');
+ // irmtfan bug fix: remove codes for delete templates
+ /*
$deltpl = $tplfile_handler->find('default', 'module', $module->getVar('mid'));
$delng = array();
if (is_array($deltpl)) {
@@ -520,46 +555,72 @@
}
}
}
+ */
+ // irmtfan bug fix: remove codes for delete templates
$templates = $module->getInfo('templates');
if ($templates != false) {
$msgs[] = _AM_SYSTEM_MODULES_TEMPLATES_UPDATE;
foreach ($templates as $tpl) {
$tpl['file'] = trim($tpl['file']);
- if (!in_array($tpl['file'], $delng)) {
- $type = (isset($tpl['type']) ? $tpl['type'] : 'module');
- $tpldata =& xoops_module_gettemplate($dirname, $tpl['file'], $type);
- $tplfile =& $tplfile_handler->create();
- $tplfile->setVar('tpl_refid', $newmid);
- $tplfile->setVar('tpl_lastimported', 0);
- $tplfile->setVar('tpl_lastmodified', time());
+ // START irmtfan solve templates duplicate issue
+ // if (!in_array($tpl['file'], $delng)) { // irmtfan bug fix: remove codes for delete templates
+ $type = (isset($tpl['type']) ? $tpl['type'] : 'module');
+ if (preg_match("/\.css$/i", $tpl['file'])) {
+ $type = 'css';
+ }
+ $criteria = new CriteriaCompo();
+ $criteria->add(new Criteria("tpl_refid", $newmid), "AND");
+ $criteria->add(new Criteria("tpl_module", $dirname), "AND");
+ $criteria->add(new Criteria("tpl_tplset", 'default'), "AND");
+ $criteria->add(new Criteria("tpl_file", $tpl['file']), "AND");
+ $criteria->add(new Criteria("tpl_type", $type), "AND");
+ $tplfiles = $tplfile_handler->getObjects($criteria);
- if (preg_match("/\.css$/i", $tpl['file'])) {
- $tplfile->setVar('tpl_type', 'css');
- } else {
- $tplfile->setVar('tpl_type', $type );
- }
- $tplfile->setVar('tpl_source', $tpldata, true);
- $tplfile->setVar('tpl_module', $dirname);
- $tplfile->setVar('tpl_tplset', 'default');
- $tplfile->setVar('tpl_file', $tpl['file'], true);
- $tplfile->setVar('tpl_desc', $tpl['description'], true);
- if (!$tplfile_handler->insert($tplfile)) {
- $msgs[] = ' <span style="color:#ff0000;">'.sprintf(_AM_SYSTEM_MODULES_TEMPLATE_ADD_ERROR, "<strong>".$tpl['file']."</strong>").'</span>';
- } else {
- $newid = $tplfile->getVar('tpl_id');
- $msgs[] = ' '.sprintf(_AM_SYSTEM_MODULES_TEMPLATE_INSERT_DATA, "<strong>".$tpl['file']."</strong>");
- if ($xoopsConfig['template_set'] == 'default') {
- if (!xoops_template_touch($newid)) {
- $msgs[] = ' <span style="color:#ff0000;">'.sprintf(_AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE_ERROR, "<strong>".$tpl['file']."</strong>").'</span>';
- } else {
- $msgs[] = ' <span>'.sprintf(_AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE, "<strong>".$tpl['file']."</strong>").'</span>';
- }
+ $tpldata =& xoops_module_gettemplate($dirname, $tpl['file'], $type);
+ $tplfile = empty($tplfiles) ? $tplfile_handler->create() : $tplfiles[0];
+ // END irmtfan solve templates duplicate issue
+ $tplfile->setVar('tpl_refid', $newmid);
+ $tplfile->setVar('tpl_lastimported', 0);
+ $tplfile->setVar('tpl_lastmodified', time());
+ $tplfile->setVar('tpl_type', $type);
+ $tplfile->setVar('tpl_source', $tpldata, true);
+ $tplfile->setVar('tpl_module', $dirname);
+ $tplfile->setVar('tpl_tplset', 'default');
+ $tplfile->setVar('tpl_file', $tpl['file'], true);
+ $tplfile->setVar('tpl_desc', $tpl['description'], true);
+ if (!$tplfile_handler->insert($tplfile)) {
+ $msgs[] = ' <span style="color:#ff0000;">' . sprintf(
+ _AM_SYSTEM_MODULES_TEMPLATE_ADD_ERROR,
+ "<strong>" . $tpl['file'] . "</strong>"
+ ) . '</span>';
+ } else {
+ $newid = $tplfile->getVar('tpl_id');
+ $msgs[] = ' ' . sprintf(
+ _AM_SYSTEM_MODULES_TEMPLATE_INSERT_DATA,
+ "<strong>" . $tpl['file'] . "</strong>"
+ );
+ if ($xoopsConfig['template_set'] == 'default') {
+ if (!xoops_template_touch($newid)) {
+ $msgs[] = ' <span style="color:#ff0000;">' . sprintf(
+ _AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE_ERROR,
+ "<strong>" . $tpl['file'] . "</strong>"
+ ) . '</span>';
+ } else {
+ $msgs[] = ' <span>' . sprintf(
+ _AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE,
+ "<strong>" . $tpl['file'] . "</strong>"
+ ) . '</span>';
}
}
- unset($tpldata);
+ }
+ unset($tpldata);
+ // irmtfan bug fix: remove codes for delete templates
+ /*
} else {
$msgs[] = ' <span style="color:#ff0000;">'.sprintf(_AM_SYSTEM_MODULES_TEMPLATE_DELETE_OLD_ERROR, "<strong>".$tpl['file']."</strong>").'</span>';
}
+ */
+ // irmtfan bug fix: remove codes for delete templates
}
}
$blocks = $module->getInfo('blocks');
@@ -568,11 +629,13 @@
$showfuncs = array();
$funcfiles = array();
foreach ($blocks as $i => $block) {
- if (isset($block['show_func']) && $block['show_func'] != '' && isset($block['file']) && $block['file'] != '') {
- $editfunc = isset($block['edit_func']) ? $block['edit_func'] : '';
+ if (isset($block['show_func']) && $block['show_func'] != '' && isset($block['file'])
+ && $block['file'] != ''
+ ) {
+ $editfunc = isset($block['edit_func']) ? $block['edit_func'] : '';
$showfuncs[] = $block['show_func'];
$funcfiles[] = $block['file'];
- $template = '';
+ $template = '';
if ((isset($block['template']) && trim($block['template']) != '')) {
$content = xoops_module_gettemplate($dirname, $block['template'], 'blocks');
}
@@ -585,17 +648,27 @@
if (!empty($block['options'])) {
$options = $block['options'];
}
- $sql = "SELECT bid, name FROM ".$xoopsDB->prefix('newblocks')." WHERE mid=".$module->getVar('mid')." AND func_num=".$i." AND show_func='".addslashes($block['show_func'])."' AND func_file='".addslashes($block['file'])."'";
+ $sql
+ =
+ "SELECT bid, name FROM " . $xoopsDB->prefix('newblocks') . " WHERE mid=" . $module->getVar(
+ 'mid'
+ ) . " AND func_num=" . $i . " AND show_func='" . addslashes($block['show_func'])
+ . "' AND func_file='" . addslashes($block['file']) . "'";
$fresult = $xoopsDB->query($sql);
- $fcount = 0;
+ $fcount = 0;
while ($fblock = $xoopsDB->fetchArray($fresult)) {
$fcount++;
- $sql = "UPDATE ".$xoopsDB->prefix("newblocks")." SET name='".addslashes($block['name'])."', edit_func='".addslashes($editfunc)."', content='', template='".$template."', last_modified=".time()." WHERE bid=".$fblock['bid'];
+ $sql
+ =
+ "UPDATE " . $xoopsDB->prefix("newblocks") . " SET name='" . addslashes($block['name'])
+ . "', edit_func='" . addslashes($editfunc) . "', content='', template='" . $template
+ . "', last_modified=" . time() . " WHERE bid=" . $fblock['bid'];
$result = $xoopsDB->query($sql);
if (!$result) {
- $msgs[] = " ".sprintf(_AM_SYSTEM_MODULES_UPDATE_ERROR, $fblock['name']);
+ $msgs[] = " " . sprintf(_AM_SYSTEM_MODULES_UPDATE_ERROR, $fblock['name']);
} else {
- $msgs[] = " ".sprintf(_AM_SYSTEM_MODULES_BLOCK_UPDATE, $fblock['name']).sprintf(_AM_SYSTEM_MODULES_BLOCK_ID, "<strong>".$fblock['bid']."</strong>");
+ $msgs[] = " " . sprintf(_AM_SYSTEM_MODULES_BLOCK_UPDATE, $fblock['name'])
+ . sprintf(_AM_SYSTEM_MODULES_BLOCK_ID, "<strong>" . $fblock['bid'] . "</strong>");
if ($template != '') {
$tplfile = $tplfile_handler->find('default', 'block', $fblock['bid']);
if (count($tplfile) == 0) {
@@ -612,16 +685,32 @@
$tplfile_new->setVar('tpl_desc', $block['description'], true);
$tplfile_new->setVar('tpl_lastmodified', time());
$tplfile_new->setVar('tpl_lastimported', 0);
- $tplfile_new->setVar('tpl_file', $block['template'], true); // irmtfan bug fix: block template file will not updated after update the module
+ $tplfile_new->setVar(
+ 'tpl_file',
+ $block['template'],
+ true
+ ); // irmtfan bug fix: block template file will not updated after update the module
if (!$tplfile_handler->insert($tplfile_new)) {
- $msgs[] = ' <span style="color:#ff0000;">'.sprintf(_AM_SYSTEM_MODULES_TEMPLATE_UPDATE_ERROR, "<strong>".$block['template']."</strong>").'</span>';
+ $msgs[] = ' <span style="color:#ff0000;">' . sprintf(
+ _AM_SYSTEM_MODULES_TEMPLATE_UPDATE_ERROR,
+ "<strong>" . $block['template'] . "</strong>"
+ ) . '</span>';
} else {
- $msgs[] = " ".sprintf(_AM_SYSTEM_MODULES_TEMPLATE_UPDATE, "<strong>".$block['template']."</strong>");
+ $msgs[] = " " . sprintf(
+ _AM_SYSTEM_MODULES_TEMPLATE_UPDATE,
+ "<strong>" . $block['template'] . "</strong>"
+ );
if ($xoopsConfig['template_set'] == 'default') {
if (!xoops_template_touch($tplfile_new->getVar('tpl_id'))) {
- $msgs[] = ' <span style="color:#ff0000;">'.sprintf(_AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE_ERROR, "<strong>".$block['template']."</strong>").'</span>';
+ $msgs[] = ' <span style="color:#ff0000;">' . sprintf(
+ _AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE_ERROR,
+ "<strong>" . $block['template'] . "</strong>"
+ ) . '</span>';
} else {
- $msgs[] = " ".sprintf(_AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE, "<strong>".$block['template']."</strong>");
+ $msgs[] = " " . sprintf(
+ _AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE,
+ "<strong>" . $block['template'] . "</strong>"
+ );
}
}
@@ -630,13 +719,20 @@
}
}
if ($fcount == 0) {
- $newbid = $xoopsDB->genId($xoopsDB->prefix('newblocks').'_bid_seq');
+ $newbid = $xoopsDB->genId($xoopsDB->prefix('newblocks') . '_bid_seq');
$block_name = addslashes($block['name']);
$block_type = ($module->getVar('dirname') == 'system') ? 'S' : 'M';
- $sql = "INSERT INTO ".$xoopsDB->prefix("newblocks")." (bid, mid, func_num, options, name, title, content, side, weight, visible, block_type, isactive, dirname, func_file, show_func, edit_func, template, last_modified) VALUES (".$newbid.", ".$module->getVar('mid').", ".$i.",'".addslashes($options)."','".$block_name."', '".$block_name."', '', 0, 0, 0, '{$block_type}', 1, '".addslashes($dirname)."', '".addslashes($block['file'])."', '".addslashes($block['show_func'])."', '".addslashes($editfunc)."', '".$template."', ".time().")";
- $result = $xoopsDB->query($sql);
+ $sql = "INSERT INTO " . $xoopsDB->prefix("newblocks")
+ . " (bid, mid, func_num, options, name, title, content, side, weight, visible, block_type, isactive, dirname, func_file, show_func, edit_func, template, last_modified) VALUES ("
+ . $newbid . ", " . $module->getVar('mid') . ", " . $i . ",'" . addslashes($options)
+ . "','" . $block_name . "', '" . $block_name . "', '', 0, 0, 0, '{$block_type}', 1, '"
+ . addslashes($dirname) . "', '" . addslashes($block['file']) . "', '" . addslashes(
+ $block['show_func']
+ ) . "', '" . addslashes($editfunc) . "', '" . $template . "', " . time() . ")";
+ $result = $xoopsDB->query($sql);
if (!$result) {
- $msgs[] = ' '.sprintf(_AM_SYSTEM_MODULES_SQL_NOT_CREATE, $block['name']);echo $sql;
+ $msgs[] = ' ' . sprintf(_AM_SYSTEM_MODULES_SQL_NOT_CREATE, $block['name']);
+ echo $sql;
} else {
if (empty($newbid)) {
$newbid = $xoopsDB->getInsertId();
@@ -654,9 +750,22 @@
$bperm->setVar('gperm_name', 'block_read');
$bperm->setVar('gperm_modid', 1);
if (!$gperm_handler->insert($bperm)) {
- $msgs[] = ' <span style="color:#ff0000;">'._AM_SYSTEM_MODULES_BLOCK_ACCESS_ERROR .sprintf(_AM_SYSTEM_MODULES_BLOCK_ID, "<strong>".$newbid."</strong>"). sprintf(_AM_SYSTEM_MODULES_GROUP_ID, "<strong>".$mygroup."</strong>").'</span>';
+ $msgs[] = ' <span style="color:#ff0000;">'
+ . _AM_SYSTEM_MODULES_BLOCK_ACCESS_ERROR . sprintf(
+ _AM_SYSTEM_MODULES_BLOCK_ID,
+ "<strong>" . $newbid . "</strong>"
+ ) . sprintf(
+ _AM_SYSTEM_MODULES_GROUP_ID,
+ "<strong>" . $mygroup . "</strong>"
+ ) . '</span>';
} else {
- $msgs[] = ' '._AM_SYSTEM_MODULES_BLOCK_ACCESS. sprintf(_AM_SYSTEM_MODULES_BLOCK_ID, "<strong>".$newbid."</strong>") . sprintf(_AM_SYSTEM_MODULES_GROUP_ID, "<strong>".$mygroup."</strong>");
+ $msgs[] = ' ' . _AM_SYSTEM_MODULES_BLOCK_ACCESS . sprintf(
+ _AM_SYSTEM_MODULES_BLOCK_ID,
+ "<strong>" . $newbid . "</strong>"
+ ) . sprintf(
+ _AM_SYSTEM_MODULES_GROUP_ID,
+ "<strong>" . $mygroup . "</strong>"
+ );
}
}
@@ -672,21 +781,37 @@
$tplfile->setVar('tpl_lastmodified', time());
$tplfile->setVar('tpl_desc', $block['description'], true);
if (!$tplfile_handler->insert($tplfile)) {
- $msgs[] = ' <span style="color:#ff0000;">'.sprintf(_AM_SYSTEM_MODULES_TEMPLATE_ADD_ERROR, "<strong>".$block['template']."</strong>").'</span>';
+ $msgs[] = ' <span style="color:#ff0000;">' . sprintf(
+ _AM_SYSTEM_MODULES_TEMPLATE_ADD_ERROR,
+ "<strong>" . $block['template'] . "</strong>"
+ ) . '</span>';
} else {
- $newid = $tplfile->getVar('tpl_id');
- $msgs[] = ' '.sprintf(_AM_SYSTEM_MODULES_TEMPLATE_ADD_DATA, "<strong>".$block['template']."</strong>");
+ $newid = $tplfile->getVar('tpl_id');
+ $msgs[] = ' ' . sprintf(
+ _AM_SYSTEM_MODULES_TEMPLATE_ADD_DATA,
+ "<strong>" . $block['template'] . "</strong>"
+ );
if ($xoopsConfig['template_set'] == 'default') {
if (!xoops_template_touch($newid)) {
- $msgs[] = ' <span style="color:#ff0000;">'.sprintf(_AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE_FAILD, "<strong>".$block['template']."</strong>").'</span>';
+ $msgs[] = ' <span style="color:#ff0000;">' . sprintf(
+ _AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE_FAILD,
+ "<strong>" . $block['template'] . "</strong>"
+ ) . '</span>';
} else {
- $msgs[] = ' '.sprintf(_AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE, "<strong>".$block['template']."</strong>");
+ $msgs[] = ' ' . sprintf(
+ _AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE,
+ "<strong>" . $block['template'] . "</strong>"
+ );
}
}
}
}
- $msgs[] = ' '.sprintf(_AM_SYSTEM_MODULES_BLOCK_CREATED, "<strong>".$block['name']."</strong>").sprintf(_AM_SYSTEM_MODULES_BLOCK_ID, "<strong>".$newbid."</strong>");
- $sql = 'INSERT INTO '.$xoopsDB->prefix('block_module_link').' (block_id, module_id) VALUES ('.$newbid.', -1)';
+ $msgs[] = ' ' . sprintf(
+ _AM_SYSTEM_MODULES_BLOCK_CREATED,
+ "<strong>" . $block['name'] . "</strong>"
+ ) . sprintf(_AM_SYSTEM_MODULES_BLOCK_ID, "<strong>" . $newbid . "</strong>");
+ $sql = 'INSERT INTO ' . $xoopsDB->prefix('block_module_link')
+ . ' (block_id, module_id) VALUES (' . $newbid . ', -1)';
$xoopsDB->query($sql);
}
}
@@ -694,21 +819,43 @@
}
$block_arr = XoopsBlock::getByModule($module->getVar('mid'));
foreach ($block_arr as $block) {
- if (!in_array($block->getVar('show_func'), $showfuncs) || !in_array($block->getVar('func_file'), $funcfiles)) {
- $sql = sprintf("DELETE FROM %s WHERE bid = %u", $xoopsDB->prefix('newblocks'), $block->getVar('bid'));
- if(!$xoopsDB->query($sql)) {
- $msgs[] = ' <span style="color:#ff0000;">'.sprintf(_AM_SYSTEM_MODULES_BLOCK_DELETE_ERROR, "<strong>".$block->getVar('name')."</strong>").sprintf(_AM_SYSTEM_MODULES_BLOCK_ID, "<strong>".$block->getVar('bid')."</strong>").'</span>';
+ if (!in_array($block->getVar('show_func'), $showfuncs)
+ || !in_array(
+ $block->getVar('func_file'),
+ $funcfiles
+ )
+ ) {
+ $sql = sprintf(
+ "DELETE FROM %s WHERE bid = %u",
+ $xoopsDB->prefix('newblocks'),
+ $block->getVar('bid')
+ );
+ if (!$xoopsDB->query($sql)) {
+ $msgs[] = ' <span style="color:#ff0000;">' . sprintf(
+ _AM_SYSTEM_MODULES_BLOCK_DELETE_ERROR,
+ "<strong>" . $block->getVar('name') . "</strong>"
+ ) . sprintf(
+ _AM_SYSTEM_MODULES_BLOCK_ID,
+ "<strong>" . $block->getVar('bid') . "</strong>"
+ ) . '</span>';
} else {
- $msgs[] = ' Block <strong>'.$block->getVar('name').' deleted. Block ID: <strong>'.$block->getVar('bid').'</strong>';
+ $msgs[]
+ = ' Block <strong>' . $block->getVar('name') . ' deleted. Block ID: <strong>'
+ . $block->getVar('bid') . '</strong>';
if ($block->getVar('template') != '') {
$tplfiles = $tplfile_handler->find(null, 'block', $block->getVar('bid'));
if (is_array($tplfiles)) {
$btcount = count($tplfiles);
for ($k = 0; $k < $btcount; $k++) {
if (!$tplfile_handler->delete($tplfiles[$k])) {
- $msgs[] = ' <span style="color:#ff0000;">'._AM_SYSTEM_MODULES_BLOCK_DEPRECATED_ERROR. '(ID: <strong>'.$tplfiles[$k]->getVar('tpl_id').'</strong>)</span>';
+ $msgs[] = ' <span style="color:#ff0000;">'
+ . _AM_SYSTEM_MODULES_BLOCK_DEPRECATED_ERROR . '(ID: <strong>'
+ . $tplfiles[$k]->getVar('tpl_id') . '</strong>)</span>';
} else {
- $msgs[] = ' '.sprintf(_AM_SYSTEM_MODULES_BLOCK_DEPRECATED, "<strong>".$tplfiles[$k]->getVar('tpl_file')."</strong>");
+ $msgs[] = ' ' . sprintf(
+ _AM_SYSTEM_MODULES_BLOCK_DEPRECATED,
+ "<strong>" . $tplfiles[$k]->getVar('tpl_file') . "</strong>"
+ );
}
}
}
@@ -723,21 +870,38 @@
// first delete all config entries
$config_handler =& xoops_gethandler('config');
- $configs = $config_handler->getConfigs(new Criteria('conf_modid', $module->getVar('mid')));
- $confcount = count($configs);
- $config_delng = array();
+ $configs = $config_handler->getConfigs(new Criteria('conf_modid', $module->getVar('mid')));
+ $confcount = count($configs);
+ $config_delng = array();
if ($confcount > 0) {
$msgs[] = _AM_SYSTEM_MODULES_MODULE_DATA_DELETE;
for ($i = 0; $i < $confcount; $i++) {
if (!$config_handler->deleteConfig($configs[$i])) {
- $msgs[] = ' <span style="color:#ff0000;">'._AM_SYSTEM_MODULES_GONFIG_DATA_DELETE_ERROR. sprintf(_AM_SYSTEM_MODULES_GONFIG_ID, "<strong>".$configs[$i]->getvar('conf_id')."</strong>").'</span>';
+ $msgs[]
+ = ' <span style="color:#ff0000;">' . _AM_SYSTEM_MODULES_GONFIG_DATA_DELETE_ERROR
+ . sprintf(
+ _AM_SYSTEM_MODULES_GONFIG_ID,
+ "<strong>" . $configs[$i]->getvar('conf_id') . "</strong>"
+ ) . '</span>';
// save the name of config failed to delete for later use
$config_delng[] = $configs[$i]->getvar('conf_name');
} else {
- $config_old[$configs[$i]->getvar('conf_name')]['value'] = $configs[$i]->getvar('conf_value', 'N');
- $config_old[$configs[$i]->getvar('conf_name')]['formtype'] = $configs[$i]->getvar('conf_formtype');
- $config_old[$configs[$i]->getvar('conf_name')]['valuetype'] = $configs[$i]->getvar('conf_valuetype');
- $msgs[] = " "._AM_SYSTEM_MODULES_GONFIG_DATA_DELETE. sprintf(_AM_SYSTEM_MODULES_GONFIG_ID, "<strong>".$configs[$i]->getVar('conf_id')."</strong>");
+ $config_old[$configs[$i]->getvar('conf_name')]['value'] = $configs[$i]->getvar(
+ 'conf_value',
+ 'N'
+ );
+ $config_old[$configs[$i]->getvar('conf_name')]['formtype'] = $configs[$i]->getvar(
+ 'conf_formtype'
+ ...
[truncated message content] |