You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(361) |
Oct
(65) |
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(798) |
Feb
(694) |
Mar
(586) |
Apr
(145) |
May
(24) |
Jun
(24) |
Jul
(56) |
Aug
(11) |
Sep
(138) |
Oct
(107) |
Nov
(58) |
Dec
(39) |
| 2004 |
Jan
(157) |
Feb
(24) |
Mar
(13) |
Apr
(14) |
May
(73) |
Jun
(106) |
Jul
(217) |
Aug
(91) |
Sep
(116) |
Oct
(357) |
Nov
(27) |
Dec
(272) |
| 2005 |
Jan
(97) |
Feb
(40) |
Mar
(167) |
Apr
(365) |
May
(344) |
Jun
(357) |
Jul
(407) |
Aug
(529) |
Sep
(204) |
Oct
(52) |
Nov
(80) |
Dec
(1) |
| 2006 |
Jan
(2) |
Feb
(1) |
Mar
(11) |
Apr
(112) |
May
(121) |
Jun
(86) |
Jul
(51) |
Aug
(48) |
Sep
(107) |
Oct
(20) |
Nov
(50) |
Dec
(11) |
| 2007 |
Jan
(7) |
Feb
(11) |
Mar
(8) |
Apr
(11) |
May
(2) |
Jun
(25) |
Jul
(67) |
Aug
(134) |
Sep
(54) |
Oct
(69) |
Nov
(10) |
Dec
(74) |
| 2008 |
Jan
(73) |
Feb
(81) |
Mar
(64) |
Apr
(98) |
May
(157) |
Jun
(68) |
Jul
(80) |
Aug
(108) |
Sep
(176) |
Oct
(107) |
Nov
(265) |
Dec
(60) |
| 2009 |
Jan
(149) |
Feb
(140) |
Mar
(195) |
Apr
(141) |
May
(53) |
Jun
(45) |
Jul
(98) |
Aug
(153) |
Sep
(160) |
Oct
(138) |
Nov
(139) |
Dec
(104) |
| 2010 |
Jan
(188) |
Feb
(259) |
Mar
(133) |
Apr
(104) |
May
(42) |
Jun
(121) |
Jul
(38) |
Aug
(223) |
Sep
(259) |
Oct
(255) |
Nov
(106) |
Dec
(157) |
| 2011 |
Jan
(202) |
Feb
(110) |
Mar
(261) |
Apr
(272) |
May
(218) |
Jun
(108) |
Jul
(141) |
Aug
(205) |
Sep
(326) |
Oct
(279) |
Nov
(368) |
Dec
(238) |
| 2012 |
Jan
(239) |
Feb
(3) |
Mar
|
Apr
(1) |
May
(2) |
Jun
|
Jul
(3) |
Aug
(6) |
Sep
(5) |
Oct
|
Nov
|
Dec
|
| 2013 |
Jan
(1) |
Feb
(3) |
Mar
(9) |
Apr
(10) |
May
|
Jun
(1) |
Jul
(3) |
Aug
(1) |
Sep
(2) |
Oct
(1) |
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
(1) |
Dec
(1) |
| 2016 |
Jan
|
Feb
(1) |
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
1
(7) |
|
2
(1) |
3
(5) |
4
(1) |
5
(4) |
6
|
7
|
8
|
|
9
(2) |
10
(2) |
11
|
12
|
13
|
14
|
15
|
|
16
|
17
|
18
|
19
(1) |
20
|
21
(1) |
22
(1) |
|
23
(9) |
24
(2) |
25
(3) |
26
(1) |
27
|
28
(1) |
29
(2) |
|
30
(5) |
31
(3) |
|
|
|
|
|
|
From: <sk...@us...> - 2006-07-31 01:05:45
|
Revision: 643 Author: skalpa Date: 2006-07-30 18:05:39 -0700 (Sun, 30 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=643&view=rev Log Message: ----------- Gave the installer the ability to handle subfolders of the main "modules" folder Modified Paths: -------------- XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php Modified: XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php =================================================================== --- XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php 2006-07-31 00:55:51 UTC (rev 642) +++ XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php 2006-07-31 01:05:39 UTC (rev 643) @@ -33,10 +33,32 @@ exit("Access Denied"); } + +function scanModules( $root, $folder = '' ) { + global $xoops; + $modules = array(); + $dh = opendir( "$root$folder" ); + while ( $file = readdir( $dh ) ) { + if ( substr( $file, 0, 1 ) == '.' || $file == 'CVS' || !is_dir( "$root$folder$file" ) ) { + continue; + } + if ( file_exists( "$root$folder$file/xoops_version.php" ) ) { + $modules[] = "$folder$file"; + } else { + $modules = array_merge( $modules, scanModules( $root, "$folder$file/" ) ); + } + } + return $modules; +} + function xoops_module_list() { - xoops_cp_header(); - echo " + global $xoops; + xoops_cp_header(); + + $mods = scanModules( $xoops->path( "modules/" ), '' ); + + echo " <h1>"._MD_AM_MODADMIN."</h1> <form action='admin.php' method='post' name='moduleadmin' id='moduleadmin'> <table class='outer' width='100%' cellpadding='4' cellspacing='1'> @@ -95,8 +117,9 @@ <table width='100%' border='0' class='outer' cellpadding='4' cellspacing='1'> <tr align='center'><th>"._MD_AM_MODULE."</th><th>"._MD_AM_VERSION."</th><th>"._MD_AM_ACTION."</th></tr> "; - require_once XOOPS_ROOT_PATH."/class/xoopslists.php"; - $dirlist = XoopsLists::getModulesList(); + //require_once XOOPS_ROOT_PATH."/class/xoopslists.php"; + //$dirlist = XoopsLists::getModulesList(); + $dirlist = $mods; $count = 0; foreach($dirlist as $file){ clearstatcache(); @@ -127,7 +150,7 @@ function xoops_module_install($dirname) { global $xoopsUser, $xoopsConfig; - + require_once XOOPS_ROOT_PATH . '/class/xos_install_ModuleInstaller.php'; $installer = new xos_install_ModuleInstaller(); $installer->db = $GLOBALS['xoopsDB']; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-31 00:55:55
|
Revision: 642 Author: skalpa Date: 2006-07-30 17:55:51 -0700 (Sun, 30 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=642&view=rev Log Message: ----------- Modified the XoopsModule::loadInfo method to automatically set dirname, instead of always using an hardcoded value found in xoops_version Modified Paths: -------------- XoopsCore/branches/tasks/1528144-workbench/htdocs/kernel/module.php Modified: XoopsCore/branches/tasks/1528144-workbench/htdocs/kernel/module.php =================================================================== --- XoopsCore/branches/tasks/1528144-workbench/htdocs/kernel/module.php 2006-07-31 00:33:04 UTC (rev 641) +++ XoopsCore/branches/tasks/1528144-workbench/htdocs/kernel/module.php 2006-07-31 00:55:51 UTC (rev 642) @@ -202,7 +202,10 @@ } return; } - $this->modinfo =& $modversion; + if ( !isset( $modversion['dirname'] ) ) { + $modversion['dirname'] = $dirname; + } + $this->modinfo = $modversion; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-31 00:33:10
|
Revision: 641 Author: skalpa Date: 2006-07-30 17:33:04 -0700 (Sun, 30 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=641&view=rev Log Message: ----------- Enhanced the modules detection routine to recognize modules stored in subfolders Modified Paths: -------------- XoopsCore/branches/tasks/1528144-workbench/htdocs/include/common.php Modified: XoopsCore/branches/tasks/1528144-workbench/htdocs/include/common.php =================================================================== --- XoopsCore/branches/tasks/1528144-workbench/htdocs/include/common.php 2006-07-30 23:27:27 UTC (rev 640) +++ XoopsCore/branches/tasks/1528144-workbench/htdocs/include/common.php 2006-07-31 00:33:04 UTC (rev 641) @@ -301,10 +301,11 @@ } if (file_exists('./xoops_version.php')) { - $url_arr = explode( '/', strstr( $_SERVER['PHP_SELF'],'/modules/') ); + $mod_url = strstr( $_SERVER['PHP_SELF'],'/modules/'); + $mod_url = substr( $mod_url, 9, strrpos( $mod_url, '/' ) - 9 ); $module_handler =& xoops_gethandler('module'); - $xoopsModule =& $module_handler->getByDirname($url_arr[2]); - unset($url_arr); + $xoopsModule =& $module_handler->getByDirname( $mod_url ); + unset($mod_url); if (!$xoopsModule || !$xoopsModule->getVar('isactive')) { include_once XOOPS_ROOT_PATH."/header.php"; echo "<h4>"._MODULENOEXIST."</h4>"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-30 23:27:33
|
Revision: 640 Author: skalpa Date: 2006-07-30 16:27:27 -0700 (Sun, 30 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=640&view=rev Log Message: ----------- Added disableblocks feature to the blocks aggregator Modified Paths: -------------- XoopsCore/branches/tasks/1528144-workbench/htdocs/class/theme_blocks.php Modified: XoopsCore/branches/tasks/1528144-workbench/htdocs/class/theme_blocks.php =================================================================== --- XoopsCore/branches/tasks/1528144-workbench/htdocs/class/theme_blocks.php 2006-07-30 23:26:11 UTC (rev 639) +++ XoopsCore/branches/tasks/1528144-workbench/htdocs/class/theme_blocks.php 2006-07-30 23:27:27 UTC (rev 640) @@ -53,7 +53,12 @@ function retrieveBlocks() { global $xoopsUser, $xoopsModule, $xoopsConfig; - + + // The "disableblocks" feature is temporary and will be removed + // you should not use it or rely on this behavior in a module !!! + if ( @$GLOBALS['xoopsOption']['disableblocks'] ) { + return; + } $startMod = ( $xoopsConfig['startpage'] == '--' ) ? 'system' : $xoopsConfig['startpage']; if ( @is_object( $xoopsModule ) ) { list( $mid, $dirname ) = array( $xoopsModule->getVar('mid'), $xoopsModule->getVar('dirname') ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-30 23:26:19
|
Revision: 639 Author: skalpa Date: 2006-07-30 16:26:11 -0700 (Sun, 30 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=639&view=rev Log Message: ----------- Finished moving the last installation code to the dedicated class Modified Paths: -------------- XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php Modified: XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php =================================================================== --- XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php 2006-07-30 00:37:07 UTC (rev 638) +++ XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php 2006-07-30 23:26:11 UTC (rev 639) @@ -88,6 +88,13 @@ $this->log( "Module data inserted successfully. Module ID: " . $this->module->getVar( 'mid' ) ); $this->installTemplates(); $this->installBlocks(); + $this->installConfig(); + $this->createPermissions(); + // Run post-installation script + $script = $this->module->getInfo( 'onInstall' ); + if ( $script ) { + $this->runScript( 'install', $script ); + } return true; } /** @@ -168,7 +175,7 @@ 'tpl_refid' => $mid, 'tpl_file' => $tpl['file'], 'tpl_desc' => $tpl['description'], - 'tpl_source' => xoops_module_gettemplate( $dirname, $tpl['file'] ), + 'tpl_source' => $this->getTemplateSource( $dirname, $tpl['file'] ), 'tpl_lastmodified' => $time, 'tpl_lastimported' => 0, ), true ); @@ -200,7 +207,7 @@ $edit_func = isset( $block['edit_func'] ) ? trim( $block['edit_func'] ) : ''; $template = ''; if ( isset( $block['template'] ) ) { - $content = xoops_module_gettemplate( $dirname, $block['template'], true ); + $content = $this->getTemplateSource( $dirname, $block['template'], true ); if ( !empty( $content ) ) { $template = trim( $block['template'] ); } @@ -331,11 +338,43 @@ return true; } + + function createPermissions() { + global $xoopsUser; + + $groups = $xoopsUser->getGroups(); + $mid = $this->module->getVar( 'mid', 'n' ); + $blocks = XoopsBlock::getByModule( $mid, false ); + $hndPerm = xoops_gethandler( 'groupperm' ); + + foreach ($groups as $mygroup) { + if ( $hndPerm->checkRight( 'module_admin', 0, $mygroup ) ) { + $this->insertPermission( $hndPerm, $mygroup, $mid, 'module_admin' ); + } + $this->insertPermission( $hndPerm, $mygroup, $mid, 'module_read' ); + foreach ($blocks as $blc ) { + $this->insertPermission( $hndPerm, $mygroup, $blc, 'block_read' ); + } + } + return true; + } + function insertPermission( $handler, $group, $item, $name ) { + $perm = $handler->create(); + $perm->setVar( 'gperm_groupid', $group ); + $perm->setVar( 'gperm_itemid', $item ); + $perm->setVar( 'gperm_name', $name ); + $perm->setVar( 'gperm_modid', 1 ); + if ( !$handler->insert( $perm ) ) { + $this->log( "ERROR: Could not add $name permission. Item ID: $item. Group ID: $group" ); + return false; + } else { + $this->log( "Added $name permission. Item ID: $item. Group ID: $group" ); + return true; + } + } - - function insertTemplate( $tplEngine, $hndTpl, $tplObject ) { $file = $tplObject->getVar( 'tpl_file', 'n' ); if ( !$hndTpl->insert( $tplObject ) ) { @@ -351,11 +390,25 @@ } + function runScript( $type, $script ) { + $dirname = $this->module->getVar( 'dirname', 'n' ); + include_once XOOPS_ROOT_PATH . "/modules/$dirname/$script"; + $func = "xoops_module_{$type}_$dirname"; + if ( function_exists( $func ) ) { + if ( !( $lastmsg = $func($this->module) ) ) { + $this->log( "Failed to execute $func" ); + } else { + $this->log( "$func executed successfully" ); + if ( is_string( $lastmsg ) ) { + $this->log( $lastmsg ); + } + } + } + } - function log( $msg ) { $this->events[] = $msg; } @@ -372,10 +425,18 @@ $this->db->query("DROP TABLE " . $this->db->prefix( $ct ) ); } } - + function getTemplateSource( $dirname, $template, $block = false ) { + $block = $block ? 'blocks/' : ''; + $path = XOOPS_ROOT_PATH . "/modules/$dirname/templates/$block$template"; + if ( !file_exists( $path ) ) { + return false; + } + return str_replace( array( "\rn", "\r" ), "\n", file_get_contents( $path ) ); + } + } Modified: XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php =================================================================== --- XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php 2006-07-30 00:37:07 UTC (rev 638) +++ XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php 2006-07-30 23:26:11 UTC (rev 639) @@ -125,134 +125,26 @@ xoops_cp_footer(); } -function xoops_module_install($dirname) -{ +function xoops_module_install($dirname) { global $xoopsUser, $xoopsConfig; require_once XOOPS_ROOT_PATH . '/class/xos_install_ModuleInstaller.php'; $installer = new xos_install_ModuleInstaller(); $installer->db = $GLOBALS['xoopsDB']; - if ( $installer->installModule( $dirname ) ) { - echo implode( "<br />\n", $installer->events ); - echo 'ok'; + $result = $installer->installModule( $dirname ); + $output = implode( "<br />\n", $installer->events ) . "<br />\n"; + + if ( $result ) { + $output .= sprintf( _MD_AM_OKINS, $installer->module->getVar( 'name' ) ); } else { - echo "error: " . $installer->error; + $output .= $installer->error . "<br />\n"; + $output .= sprintf( _MD_AM_FAILINS, $dirname ); } - return; - - // RMV-NOTIFY - - - $groups =& $xoopsUser->getGroups(); - // retrieve all block ids for this module - $blocks =& XoopsBlock::getByModule($newmid, false); - $msgs[] = 'Setting group rights...'; - $gperm_handler =& xoops_gethandler('groupperm'); - foreach ($groups as $mygroup) { - if ($gperm_handler->checkRight('module_admin', 0, $mygroup)) { - $mperm =& $gperm_handler->create(); - $mperm->setVar('gperm_groupid', $mygroup); - $mperm->setVar('gperm_itemid', $newmid); - $mperm->setVar('gperm_name', 'module_admin'); - $mperm->setVar('gperm_modid', 1); - if (!$gperm_handler->insert($mperm)) { - $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not add admin access right for Group ID <b>'.$mygroup.'</b></span>'; - } else { - $msgs[] = ' Added admin access right for Group ID <b>'.$mygroup.'</b>'; - } - unset($mperm); - } - $mperm =& $gperm_handler->create(); - $mperm->setVar('gperm_groupid', $mygroup); - $mperm->setVar('gperm_itemid', $newmid); - $mperm->setVar('gperm_name', 'module_read'); - $mperm->setVar('gperm_modid', 1); - if (!$gperm_handler->insert($mperm)) { - $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not add user access right for Group ID: <b>'.$mygroup.'</b></span>'; - } else { - $msgs[] = ' Added user access right for Group ID: <b>'.$mygroup.'</b>'; - } - unset($mperm); - foreach ($blocks as $blc) { - $bperm =& $gperm_handler->create(); - $bperm->setVar('gperm_groupid', $mygroup); - $bperm->setVar('gperm_itemid', $blc); - $bperm->setVar('gperm_name', 'block_read'); - $bperm->setVar('gperm_modid', 1); - if (!$gperm_handler->insert($bperm)) { - $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not add block access right. Block ID: <b>'.$blc.'</b> Group ID: <b>'.$mygroup.'</b></span>'; - } else { - $msgs[] = ' Added block access right. Block ID: <b>'.$blc.'</b> Group ID: <b>'.$mygroup.'</b>'; - } - unset($bperm); - } - } - unset($blocks); - unset($groups); - - // execute module specific install script if any - $install_script = $module->getInfo('onInstall'); - if (false != $install_script && trim($install_script) != '') { - include_once XOOPS_ROOT_PATH.'/modules/'.$dirname.'/'.trim($install_script); - if (function_exists('xoops_module_install_'.$dirname)) { - $func = 'xoops_module_install_'.$dirname; - if ( !( $lastmsg = $func($module) ) ) { - $msgs[] = 'Failed to execute '.$func; - } else { - $msgs[] = '<b>'.$func.'</b> executed successfully.'; - if ( is_string( $lastmsg ) ) { - $msgs[] = $lastmsg; - } - } - } - } - - $ret = '<p><code>'; - foreach ($msgs as $m) { - $ret .= $m.'<br />'; - } - unset($msgs); - unset($errs); - $ret .= '</code><br />'.sprintf(_MD_AM_OKINS, "<b>".$module->getVar('name')."</b>").'</p>'; - unset($module); - return $ret; - - $ret = '<p>'; - foreach ($errs as $er) { - $ret .= ' '.$er.'<br />'; - } - unset($msgs); - unset($errs); - $ret .= '<br />'.sprintf(_MD_AM_FAILINS, '<b>'.$dirname.'</b>').' '._MD_AM_ERRORSC.'</p>'; - return $ret; - //return "<p>".sprintf(_MD_AM_FAILINS, "<b>".$dirname."</b>")." "._MD_AM_ERRORSC."<br /> ".sprintf(_MD_AM_ALEXISTS, $dirname)."</p>"; - } - -function &xoops_module_gettemplate($dirname, $template, $block=false) -{ - global $xoopsConfig; - if ($block) { - $path = XOOPS_ROOT_PATH.'/modules/'.$dirname.'/templates/blocks/'.$template; - } else { - $path = XOOPS_ROOT_PATH.'/modules/'.$dirname.'/templates/'.$template; - } - if (!file_exists($path)) { - return false; - } else { - $lines = file($path); - } - if (!$lines) { - return false; - } - $ret = ''; - $count = count($lines); - for ($i = 0; $i < $count; $i++) { - $ret .= str_replace("\n", "\r\n", str_replace("\r\n", "\n", $lines[$i])); - } - return $ret; + return $output; } + function xoops_module_uninstall($dirname) { global $xoopsConfig; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: Eleutherius C. <el...@ai...> - 2006-07-30 18:01:24
|
=20 TIjFFANY & CO BVjLGARI ROjLEX BRjEITLING OMjEGA CAjRTIER PAjTEK =20 Best prijcces online at http://www.urwatchktime.com =20 , , , , Source not visible. Fido stood on its hind legs-then jumped high into the air despite another burst of bullets. |
|
From: <sk...@us...> - 2006-07-30 00:37:17
|
Revision: 638 Author: skalpa Date: 2006-07-29 17:37:07 -0700 (Sat, 29 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=638&view=rev Log Message: ----------- Moved module configuration data insertion code to the ModuleInstaller class Here I didn't touch anything at all, just performed a lame copy/paste between the 2 files (this part is reall too messy to be touched :S) Modified Paths: -------------- XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php Modified: XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php =================================================================== --- XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php 2006-07-30 00:18:26 UTC (rev 637) +++ XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php 2006-07-30 00:37:07 UTC (rev 638) @@ -243,7 +243,99 @@ } } } + + /** + * Insert the current module conofiguration data/values into the db + */ + function installConfig() { + $mid = $this->module->getVar( 'mid', 'n' ); + $configs = $this->module->getInfo('config'); + if ($configs != false) { + if ($this->module->getVar('hascomments') != 0) { + include_once(XOOPS_ROOT_PATH.'/include/comment_constants.php'); + array_push($configs, array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN))); + array_push($configs, array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0)); + } + } else { + if ($this->module->getVar('hascomments') != 0) { + $configs = array(); + include_once(XOOPS_ROOT_PATH.'/include/comment_constants.php'); + $configs[] = array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN)); + $configs[] = array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0); + } + } + if ($this->module->getVar('hasnotification') != 0) { + if (empty($configs)) { + $configs = array(); + } + // Main notification options + include_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; + include_once XOOPS_ROOT_PATH . '/include/notification_functions.php'; + $options = array(); + $options['_NOT_CONFIG_DISABLE'] = XOOPS_NOTIFICATION_DISABLE; + $options['_NOT_CONFIG_ENABLEBLOCK'] = XOOPS_NOTIFICATION_ENABLEBLOCK; + $options['_NOT_CONFIG_ENABLEINLINE'] = XOOPS_NOTIFICATION_ENABLEINLINE; + $options['_NOT_CONFIG_ENABLEBOTH'] = XOOPS_NOTIFICATION_ENABLEBOTH; + //$configs[] = array ('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLED', 'description' => '_NOT_CONFIG_ENABLEDDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1); + $configs[] = array ('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLE', 'description' => '_NOT_CONFIG_ENABLEDSC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => XOOPS_NOTIFICATION_ENABLEBOTH, 'options' => $options); + // Event-specific notification options + // FIXME: doesn't work when update module... can't read back the array of options properly... " changing to " + $options = array(); + $categories =& notificationCategoryInfo( '', $mid ); + foreach ($categories as $category) { + $events = notificationEvents ($category['name'], false, $mid ); + foreach ($events as $event) { + if (!empty($event['invisible'])) { + continue; + } + $option_name = $category['title'] . ' : ' . $event['title']; + $option_value = $category['name'] . '-' . $event['name']; + $options[$option_name] = $option_value; + } + } + $configs[] = array ('name' => 'notification_events', 'title' => '_NOT_CONFIG_EVENTS', 'description' => '_NOT_CONFIG_EVENTSDSC', 'formtype' => 'select_multi', 'valuetype' => 'array', 'default' => array_values($options), 'options' => $options); + } + if ($configs != false) { + $config_handler = xoops_gethandler('config'); + $order = 0; + foreach ($configs as $config) { + $confobj = $config_handler->createConfig(); + $confobj->setVar('conf_modid', $mid); + $confobj->setVar('conf_catid', 0); + $confobj->setVar('conf_name', $config['name']); + $confobj->setVar('conf_title', $config['title'], true); + $confobj->setVar('conf_desc', $config['description'], true); + $confobj->setVar('conf_formtype', $config['formtype']); + $confobj->setVar('conf_valuetype', $config['valuetype']); + $confobj->setConfValueForInput($config['default'], true); + //$confobj->setVar('conf_value', $config['default'], true); + $confobj->setVar('conf_order', $order); + if (isset($config['options']) && is_array($config['options'])) { + foreach ($config['options'] as $key => $value) { + $confop = $config_handler->createConfigOption(); + $confop->setVar('confop_name', $key, true); + $confop->setVar('confop_value', $value, true); + $confobj->setConfOptions($confop); + $this->log( "Config option added. Name: $key. Value: $value" ); + } + } + $order++; + if ($config_handler->insertConfig($confobj) != false) { + $this->log( "Config {$config['name']} added to the database." ); + } else { + $this->log( "ERROR: Could not insert config {$config['name']} into the database" ); + } + } + } + return true; + } + + + + + + function insertTemplate( $tplEngine, $hndTpl, $tplObject ) { $file = $tplObject->getVar( 'tpl_file', 'n' ); if ( !$hndTpl->insert( $tplObject ) ) { Modified: XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php =================================================================== --- XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php 2006-07-30 00:18:26 UTC (rev 637) +++ XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php 2006-07-30 00:37:07 UTC (rev 638) @@ -141,93 +141,9 @@ } return; - $configs = $module->getInfo('config'); - if ($configs != false) { - if ($module->getVar('hascomments') != 0) { - include_once(XOOPS_ROOT_PATH.'/include/comment_constants.php'); - array_push($configs, array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN))); - array_push($configs, array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0)); - } - } else { - if ($module->getVar('hascomments') != 0) { - $configs = array(); - include_once(XOOPS_ROOT_PATH.'/include/comment_constants.php'); - $configs[] = array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN)); - $configs[] = array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0); - } - } // RMV-NOTIFY - if ($module->getVar('hasnotification') != 0) { - if (empty($configs)) { - $configs = array(); - } - // Main notification options - include_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; - include_once XOOPS_ROOT_PATH . '/include/notification_functions.php'; - $options = array(); - $options['_NOT_CONFIG_DISABLE'] = XOOPS_NOTIFICATION_DISABLE; - $options['_NOT_CONFIG_ENABLEBLOCK'] = XOOPS_NOTIFICATION_ENABLEBLOCK; - $options['_NOT_CONFIG_ENABLEINLINE'] = XOOPS_NOTIFICATION_ENABLEINLINE; - $options['_NOT_CONFIG_ENABLEBOTH'] = XOOPS_NOTIFICATION_ENABLEBOTH; - //$configs[] = array ('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLED', 'description' => '_NOT_CONFIG_ENABLEDDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1); - $configs[] = array ('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLE', 'description' => '_NOT_CONFIG_ENABLEDSC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => XOOPS_NOTIFICATION_ENABLEBOTH, 'options' => $options); - // Event-specific notification options - // FIXME: doesn't work when update module... can't read back the array of options properly... " changing to " - $options = array(); - $categories =& notificationCategoryInfo('',$module->getVar('mid')); - foreach ($categories as $category) { - $events =& notificationEvents ($category['name'], false, $module->getVar('mid')); - foreach ($events as $event) { - if (!empty($event['invisible'])) { - continue; - } - $option_name = $category['title'] . ' : ' . $event['title']; - $option_value = $category['name'] . '-' . $event['name']; - $options[$option_name] = $option_value; - } - } - $configs[] = array ('name' => 'notification_events', 'title' => '_NOT_CONFIG_EVENTS', 'description' => '_NOT_CONFIG_EVENTSDSC', 'formtype' => 'select_multi', 'valuetype' => 'array', 'default' => array_values($options), 'options' => $options); - } - if ($configs != false) { - $msgs[] = 'Adding module config data...'; - $config_handler =& xoops_gethandler('config'); - $order = 0; - foreach ($configs as $config) { - $confobj =& $config_handler->createConfig(); - $confobj->setVar('conf_modid', $newmid); - $confobj->setVar('conf_catid', 0); - $confobj->setVar('conf_name', $config['name']); - $confobj->setVar('conf_title', $config['title'], true); - $confobj->setVar('conf_desc', $config['description'], true); - $confobj->setVar('conf_formtype', $config['formtype']); - $confobj->setVar('conf_valuetype', $config['valuetype']); - $confobj->setConfValueForInput($config['default'], true); - //$confobj->setVar('conf_value', $config['default'], true); - $confobj->setVar('conf_order', $order); - $confop_msgs = ''; - if (isset($config['options']) && is_array($config['options'])) { - foreach ($config['options'] as $key => $value) { - $confop =& $config_handler->createConfigOption(); - $confop->setVar('confop_name', $key, true); - $confop->setVar('confop_value', $value, true); - $confobj->setConfOptions($confop); - $confop_msgs .= '<br /> Config option added. Name: <b>'.$key.'</b> Value: <b>'.$value.'</b>'; - unset($confop); - } - } - $order++; - if ($config_handler->insertConfig($confobj) != false) { - $msgs[] = ' Config <b>'.$config['name'].'</b> added to the database.'.$confop_msgs; - } else { - $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not insert config <b>'.$config['name'].'</b> to the database.</span>'; - } - unset($confobj); - } - unset($configs); - } - $groups =& $xoopsUser->getGroups(); // retrieve all block ids for this module $blocks =& XoopsBlock::getByModule($newmid, false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-30 00:18:36
|
Revision: 637 Author: skalpa Date: 2006-07-29 17:18:26 -0700 (Sat, 29 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=637&view=rev Log Message: ----------- Moved the templates and blocks installation code to the ModuleInstaller class Modified Paths: -------------- XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php Modified: XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php =================================================================== --- XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php 2006-07-29 19:32:30 UTC (rev 636) +++ XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php 2006-07-30 00:18:26 UTC (rev 637) @@ -53,6 +53,8 @@ var $error = ''; var $events = array(); + var $createdTables = array(); + /** * Performs installation of the module located in the specified folder * @@ -79,7 +81,14 @@ return false; } } - return true; + if ( !$hndModule->insert( $this->module ) ) { + $this->dropDatabaseTables(); + return $this->fail( "Could not insert module into the database" ); + } + $this->log( "Module data inserted successfully. Module ID: " . $this->module->getVar( 'mid' ) ); + $this->installTemplates(); + $this->installBlocks(); + return true; } /** * Parses and executes the commands contained in the specified SQL file @@ -95,7 +104,7 @@ $pieces = array(); SqlUtility::splitMySQLFile( $pieces, $content ); - $created_tables = array(); + $this->createdTables = array(); $error = false; $prefix = $this->db->prefix; foreach ( $pieces as $piece ) { @@ -121,8 +130,8 @@ * Also, the messages displayed assume that the SQL file is only made of create/insert * statements, which is wrong */ - if ( !in_array( $table, $created_tables ) ) { - $created_tables[] = $table; + if ( !in_array( $table, $this->createdTables ) ) { + $this->createdTables[] = $table; $this->log( "Table $table created" ); } else { $this->log( "Data inserted into table $table" ); @@ -130,13 +139,131 @@ } if ( $error ) { // there was an error, delete the tables created so far, so the next installation will not fail - $this->dropDatabaseTables( $created_tables ); + $this->dropDatabaseTables(); return false; } return true; } + /** + * Insert the current module templates data into the db + */ + function installTemplates() { + $templates = $this->module->getInfo('templates'); + if ( !$templates ) { + return true; + } + include_once XOOPS_ROOT_PATH.'/class/template.php'; + $tplEngine = new XoopsTpl(); + $hndTpl = xoops_gethandler( 'tplfile' ); + extract( $this->module->getValues( array( 'mid', 'dirname' ), 'n' ) ); + $time = time(); + + foreach ( $templates as $tpl ) { + $tplObject = $hndTpl->create(); + $tplObject->setVars( array( + 'tpl_tplset' => 'default', + 'tpl_type' => 'module', + 'tpl_module' => $dirname, + 'tpl_refid' => $mid, + 'tpl_file' => $tpl['file'], + 'tpl_desc' => $tpl['description'], + 'tpl_source' => xoops_module_gettemplate( $dirname, $tpl['file'] ), + 'tpl_lastmodified' => $time, + 'tpl_lastimported' => 0, + ), true ); + $this->insertTemplate( $tplEngine, $hndTpl, $tplObject ); + } + return true; + } + /** + * Insert the current module blocks data into the db + */ + function installBlocks() { + $blocks = $this->module->getInfo('blocks'); + if ( !$blocks ) { + return true; + } + include_once XOOPS_ROOT_PATH.'/class/template.php'; + $tplEngine = new XoopsTpl(); + $hndTpl = xoops_gethandler( 'tplfile' ); + extract( $this->module->getValues( array( 'mid', 'dirname' ), 'n' ) ); + $time = time(); + + foreach ($blocks as $blockkey => $block) { + // break the loop if missing block config + if ( !isset( $block['file'] ) || !isset( $block['show_func'] ) ) { + break; + } + $newbid = $this->db->genId( $this->db->prefix('newblocks') . '_bid_seq' ); + $options = !empty( $block['options'] ) ? trim( $block['options'] ) : ''; + $edit_func = isset( $block['edit_func'] ) ? trim( $block['edit_func'] ) : ''; + $template = ''; + if ( isset( $block['template'] ) ) { + $content = xoops_module_gettemplate( $dirname, $block['template'], true ); + if ( !empty( $content ) ) { + $template = trim( $block['template'] ); + } + } + $block_name = addslashes( trim( $block['name'] ) ); + $values = implode( ',', array( + $newbid, $mid, intval( $blockkey ), $this->db->quoteString( $options ), + $this->db->quoteString($block_name), $this->db->quoteString($block_name), + "''", 0, 0, 0, "'M'", "'H'", 1, $this->db->quoteString( $dirname ), + $this->db->quoteString( trim( $block['file'] ) ), $this->db->quoteString( trim( $block['show_func'] ) ), + $this->db->quoteString( trim( $block['edit_func'] ) ), $this->db->quoteString( $template ), + 0, time(), + ) ); + $sql = "INSERT INTO " . $this->db->prefix("newblocks") . + " ( bid, mid, func_num, options, name, title, content, side, weight, visible," . + " block_type, c_type, isactive, dirname, func_file, show_func, edit_func," . + " template, bcachetime, last_modified ) VALUES ($values)"; + if ( !$this->db->query( $sql ) ) { + $this->log( "ERROR: Could not insert block {$block['name']} data into the database" ); + $this->log( "SQL error: " . $this->db->error() ); + } else { + $newbid = $this->db->getInsertId(); + $this->log( "Block {$block['name']} inserted. Block ID: $newbid" ); + $this->db->query( 'INSERT INTO ' . $this->db->prefix('block_module_link') . " (block_id, module_id) VALUES ($newbid, -1)" ); + if ( $template ) { + $tplObject = $hndTpl->create(); + $tplObject->setVars( array( + 'tpl_tplset' => 'default', + 'tpl_type' => 'block', + 'tpl_module' => $dirname, + 'tpl_refid' => $newbid, + 'tpl_file' => $block['template'], + 'tpl_desc' => $block['description'], + 'tpl_source' => $content, + 'tpl_lastmodified' => $time, + 'tpl_lastimported' => 0, + ), true ); + $this->insertTemplate( $tplEngine, $hndTpl, $tplObject ); + } + } + } + } + function insertTemplate( $tplEngine, $hndTpl, $tplObject ) { + $file = $tplObject->getVar( 'tpl_file', 'n' ); + if ( !$hndTpl->insert( $tplObject ) ) { + $this->log( "ERROR: Could not insert template $file into the database" ); + } else { + $this->log( "Template $file added to the database" ); + if ( !$tplEngine->touch( "db:$file" ) ) { + $this->log( "ERROR: Failed to compile template $file" ); + } else { + $this->log( "Template $file compiled" ); + } + } + } + + + + + + + function log( $msg ) { $this->events[] = $msg; } @@ -145,7 +272,10 @@ $this->error = $msg; return false; } - function dropDatabaseTables( $tables ) { + function dropDatabaseTables( $tables = null ) { + if ( !isset( $tables ) ) { + $tables = $this->createdTables; + } foreach ( $tables as $ct ) { $this->db->query("DROP TABLE " . $this->db->prefix( $ct ) ); } Modified: XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php =================================================================== --- XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php 2006-07-29 19:32:30 UTC (rev 636) +++ XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php 2006-07-30 00:18:26 UTC (rev 637) @@ -140,213 +140,93 @@ echo "error: " . $installer->error; } return; - // if no error, save the module info and blocks info associated with it - if ($error == false) { - if (!$module_handler->insert($module)) { - $errs[] = 'Could not insert <b>'.$module->getVar('name').'</b> to database.'; - foreach ($created_tables as $ct) { - $db->query("DROP TABLE ".$db->prefix($ct)); - } - $ret = "<p>".sprintf(_MD_AM_FAILINS, "<b>".$module->name()."</b>")." "._MD_AM_ERRORSC."<br />"; - foreach ( $errs as $err ) { - $ret .= " - ".$err."<br />"; - } - $ret .= "</p>"; - unset($module); - unset($created_tables); - unset($errs); - unset($msgs); - return $ret; - } else { - $newmid = $module->getVar('mid'); - unset($created_tables); - $msgs[] = 'Module data inserted successfully. Module ID: <b>'.$newmid.'</b>'; - $tplfile_handler =& xoops_gethandler('tplfile'); - $templates = $module->getInfo('templates'); - if ($templates != false) { - $msgs[] = 'Adding templates...'; - foreach ($templates as $tpl) { - $tplfile =& $tplfile_handler->create(); - $tpldata =& xoops_module_gettemplate($dirname, $tpl['file']); - $tplfile->setVar('tpl_source', $tpldata, true); - $tplfile->setVar('tpl_refid', $newmid); - $tplfile->setVar('tpl_tplset', 'default'); - $tplfile->setVar('tpl_file', $tpl['file']); - $tplfile->setVar('tpl_desc', $tpl['description'], true); - $tplfile->setVar('tpl_module', $dirname); - $tplfile->setVar('tpl_lastmodified', time()); - $tplfile->setVar('tpl_lastimported', 0); - $tplfile->setVar('tpl_type', 'module'); - if (!$tplfile_handler->insert($tplfile)) { - $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not insert template <b>'.$tpl['file'].'</b> to the database.</span>'; - } else { - $newtplid = $tplfile->getVar('tpl_id'); - $msgs[] = ' Template <b>'.$tpl['file'].'</b> added to the database. (ID: <b>'.$newtplid.'</b>)'; - // generate compiled file - include_once XOOPS_ROOT_PATH.'/class/template.php'; - if (!xoops_template_touch($newtplid)) { - $msgs[] = ' <span style="color:#ff0000;">ERROR: Failed compiling template <b>'.$tpl['file'].'</b>.</span>'; - } else { - $msgs[] = ' Template <b>'.$tpl['file'].'</b> compiled.</span>'; - } - } - unset($tpldata); - } - } - include_once XOOPS_ROOT_PATH.'/class/template.php'; - xoops_template_clear_module_cache($newmid); - $blocks = $module->getInfo('blocks'); - if ($blocks != false) { - $msgs[] = 'Adding blocks...'; - foreach ($blocks as $blockkey => $block) { - // break the loop if missing block config - if (!isset($block['file']) || !isset($block['show_func'])) { - break; - } - $options = ''; - if (!empty($block['options'])) { - $options = trim($block['options']); - } - $newbid = $db->genId($db->prefix('newblocks').'_bid_seq'); - $edit_func = isset($block['edit_func']) ? trim($block['edit_func']) : ''; - $template = ''; - if ((isset($block['template']) && trim($block['template']) != '')) { - $content =& xoops_module_gettemplate($dirname, $block['template'], true); - } - if (empty($content)) { - $content = ''; - } else { - $template = trim($block['template']); - } - $block_name = addslashes(trim($block['name'])); - $sql = "INSERT INTO ".$db->prefix("newblocks")." (bid, mid, func_num, options, name, title, content, side, weight, visible, block_type, c_type, isactive, dirname, func_file, show_func, edit_func, template, bcachetime, last_modified) VALUES ($newbid, $newmid, ".intval($blockkey).", '$options', '".$block_name."','".$block_name."', '', 0, 0, 0, 'M', 'H', 1, '".addslashes($dirname)."', '".addslashes(trim($block['file']))."', '".addslashes(trim($block['show_func']))."', '".addslashes($edit_func)."', '".$template."', 0, ".time().")"; - if (!$db->query($sql)) { - $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not add block <b>'.$block['name'].'</b> to the database! Database error: <b>'.$db->error().'</b></span>'; - } else { - if (empty($newbid)) { - $newbid = $db->getInsertId(); - } - $msgs[] = ' Block <b>'.$block['name'].'</b> added. Block ID: <b>'.$newbid.'</b>'; - $sql = 'INSERT INTO '.$db->prefix('block_module_link').' (block_id, module_id) VALUES ('.$newbid.', -1)'; - $db->query($sql); - if ($template != '') { - $tplfile =& $tplfile_handler->create(); - $tplfile->setVar('tpl_refid', $newbid); - $tplfile->setVar('tpl_source', $content, true); - $tplfile->setVar('tpl_tplset', 'default'); - $tplfile->setVar('tpl_file', $block['template']); - $tplfile->setVar('tpl_module', $dirname); - $tplfile->setVar('tpl_type', 'block'); - $tplfile->setVar('tpl_desc', $block['description'], true); - $tplfile->setVar('tpl_lastimported', 0); - $tplfile->setVar('tpl_lastmodified', time()); - if (!$tplfile_handler->insert($tplfile)) { - $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not insert template <b>'.$block['template'].'</b> to the database.</span>'; - } else { - $newtplid = $tplfile->getVar('tpl_id'); - $msgs[] = ' Template <b>'.$block['template'].'</b> added to the database. (ID: <b>'.$newtplid.'</b>)'; - // generate compiled file - include_once XOOPS_ROOT_PATH.'/class/template.php'; - if (!xoops_template_touch($newtplid)) { - $msgs[] = ' <span style="color:#ff0000;">ERROR: Failed compiling template <b>'.$block['template'].'</b>.</span>'; - } else { - $msgs[] = ' Template <b>'.$block['template'].'</b> compiled.</span>'; - } - } - } - } - unset($content); - } - unset($blocks); - } - $configs = $module->getInfo('config'); - if ($configs != false) { - if ($module->getVar('hascomments') != 0) { - include_once(XOOPS_ROOT_PATH.'/include/comment_constants.php'); - array_push($configs, array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN))); - array_push($configs, array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0)); - } - } else { - if ($module->getVar('hascomments') != 0) { - $configs = array(); - include_once(XOOPS_ROOT_PATH.'/include/comment_constants.php'); - $configs[] = array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN)); - $configs[] = array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0); - } - } - // RMV-NOTIFY - if ($module->getVar('hasnotification') != 0) { - if (empty($configs)) { - $configs = array(); - } - // Main notification options - include_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; - include_once XOOPS_ROOT_PATH . '/include/notification_functions.php'; - $options = array(); - $options['_NOT_CONFIG_DISABLE'] = XOOPS_NOTIFICATION_DISABLE; - $options['_NOT_CONFIG_ENABLEBLOCK'] = XOOPS_NOTIFICATION_ENABLEBLOCK; - $options['_NOT_CONFIG_ENABLEINLINE'] = XOOPS_NOTIFICATION_ENABLEINLINE; - $options['_NOT_CONFIG_ENABLEBOTH'] = XOOPS_NOTIFICATION_ENABLEBOTH; + $configs = $module->getInfo('config'); + if ($configs != false) { + if ($module->getVar('hascomments') != 0) { + include_once(XOOPS_ROOT_PATH.'/include/comment_constants.php'); + array_push($configs, array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN))); + array_push($configs, array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0)); + } + } else { + if ($module->getVar('hascomments') != 0) { + $configs = array(); + include_once(XOOPS_ROOT_PATH.'/include/comment_constants.php'); + $configs[] = array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN)); + $configs[] = array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0); + } + } + // RMV-NOTIFY + if ($module->getVar('hasnotification') != 0) { + if (empty($configs)) { + $configs = array(); + } + // Main notification options + include_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; + include_once XOOPS_ROOT_PATH . '/include/notification_functions.php'; + $options = array(); + $options['_NOT_CONFIG_DISABLE'] = XOOPS_NOTIFICATION_DISABLE; + $options['_NOT_CONFIG_ENABLEBLOCK'] = XOOPS_NOTIFICATION_ENABLEBLOCK; + $options['_NOT_CONFIG_ENABLEINLINE'] = XOOPS_NOTIFICATION_ENABLEINLINE; + $options['_NOT_CONFIG_ENABLEBOTH'] = XOOPS_NOTIFICATION_ENABLEBOTH; - //$configs[] = array ('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLED', 'description' => '_NOT_CONFIG_ENABLEDDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1); - $configs[] = array ('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLE', 'description' => '_NOT_CONFIG_ENABLEDSC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => XOOPS_NOTIFICATION_ENABLEBOTH, 'options' => $options); - // Event-specific notification options - // FIXME: doesn't work when update module... can't read back the array of options properly... " changing to " - $options = array(); - $categories =& notificationCategoryInfo('',$module->getVar('mid')); - foreach ($categories as $category) { - $events =& notificationEvents ($category['name'], false, $module->getVar('mid')); - foreach ($events as $event) { - if (!empty($event['invisible'])) { - continue; - } - $option_name = $category['title'] . ' : ' . $event['title']; - $option_value = $category['name'] . '-' . $event['name']; - $options[$option_name] = $option_value; - } - } - $configs[] = array ('name' => 'notification_events', 'title' => '_NOT_CONFIG_EVENTS', 'description' => '_NOT_CONFIG_EVENTSDSC', 'formtype' => 'select_multi', 'valuetype' => 'array', 'default' => array_values($options), 'options' => $options); + //$configs[] = array ('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLED', 'description' => '_NOT_CONFIG_ENABLEDDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1); + $configs[] = array ('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLE', 'description' => '_NOT_CONFIG_ENABLEDSC', 'formtype' => 'select', 'valuetype' => 'int', 'default' => XOOPS_NOTIFICATION_ENABLEBOTH, 'options' => $options); + // Event-specific notification options + // FIXME: doesn't work when update module... can't read back the array of options properly... " changing to " + $options = array(); + $categories =& notificationCategoryInfo('',$module->getVar('mid')); + foreach ($categories as $category) { + $events =& notificationEvents ($category['name'], false, $module->getVar('mid')); + foreach ($events as $event) { + if (!empty($event['invisible'])) { + continue; } + $option_name = $category['title'] . ' : ' . $event['title']; + $option_value = $category['name'] . '-' . $event['name']; + $options[$option_name] = $option_value; + } + } + $configs[] = array ('name' => 'notification_events', 'title' => '_NOT_CONFIG_EVENTS', 'description' => '_NOT_CONFIG_EVENTSDSC', 'formtype' => 'select_multi', 'valuetype' => 'array', 'default' => array_values($options), 'options' => $options); + } - if ($configs != false) { - $msgs[] = 'Adding module config data...'; - $config_handler =& xoops_gethandler('config'); - $order = 0; - foreach ($configs as $config) { - $confobj =& $config_handler->createConfig(); - $confobj->setVar('conf_modid', $newmid); - $confobj->setVar('conf_catid', 0); - $confobj->setVar('conf_name', $config['name']); - $confobj->setVar('conf_title', $config['title'], true); - $confobj->setVar('conf_desc', $config['description'], true); - $confobj->setVar('conf_formtype', $config['formtype']); - $confobj->setVar('conf_valuetype', $config['valuetype']); - $confobj->setConfValueForInput($config['default'], true); - //$confobj->setVar('conf_value', $config['default'], true); - $confobj->setVar('conf_order', $order); - $confop_msgs = ''; - if (isset($config['options']) && is_array($config['options'])) { - foreach ($config['options'] as $key => $value) { - $confop =& $config_handler->createConfigOption(); - $confop->setVar('confop_name', $key, true); - $confop->setVar('confop_value', $value, true); - $confobj->setConfOptions($confop); - $confop_msgs .= '<br /> Config option added. Name: <b>'.$key.'</b> Value: <b>'.$value.'</b>'; - unset($confop); - } - } - $order++; - if ($config_handler->insertConfig($confobj) != false) { - $msgs[] = ' Config <b>'.$config['name'].'</b> added to the database.'.$confop_msgs; - } else { - $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not insert config <b>'.$config['name'].'</b> to the database.</span>'; - } - unset($confobj); - } - unset($configs); + if ($configs != false) { + $msgs[] = 'Adding module config data...'; + $config_handler =& xoops_gethandler('config'); + $order = 0; + foreach ($configs as $config) { + $confobj =& $config_handler->createConfig(); + $confobj->setVar('conf_modid', $newmid); + $confobj->setVar('conf_catid', 0); + $confobj->setVar('conf_name', $config['name']); + $confobj->setVar('conf_title', $config['title'], true); + $confobj->setVar('conf_desc', $config['description'], true); + $confobj->setVar('conf_formtype', $config['formtype']); + $confobj->setVar('conf_valuetype', $config['valuetype']); + $confobj->setConfValueForInput($config['default'], true); + //$confobj->setVar('conf_value', $config['default'], true); + $confobj->setVar('conf_order', $order); + $confop_msgs = ''; + if (isset($config['options']) && is_array($config['options'])) { + foreach ($config['options'] as $key => $value) { + $confop =& $config_handler->createConfigOption(); + $confop->setVar('confop_name', $key, true); + $confop->setVar('confop_value', $value, true); + $confobj->setConfOptions($confop); + $confop_msgs .= '<br /> Config option added. Name: <b>'.$key.'</b> Value: <b>'.$value.'</b>'; + unset($confop); } } + $order++; + if ($config_handler->insertConfig($confobj) != false) { + $msgs[] = ' Config <b>'.$config['name'].'</b> added to the database.'.$confop_msgs; + } else { + $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not insert config <b>'.$config['name'].'</b> to the database.</span>'; + } + unset($confobj); + } + unset($configs); + } $groups =& $xoopsUser->getGroups(); // retrieve all block ids for this module @@ -421,8 +301,8 @@ $ret .= '</code><br />'.sprintf(_MD_AM_OKINS, "<b>".$module->getVar('name')."</b>").'</p>'; unset($module); return $ret; - } else { - $ret = '<p>'; + + $ret = '<p>'; foreach ($errs as $er) { $ret .= ' '.$er.'<br />'; } @@ -430,7 +310,6 @@ unset($errs); $ret .= '<br />'.sprintf(_MD_AM_FAILINS, '<b>'.$dirname.'</b>').' '._MD_AM_ERRORSC.'</p>'; return $ret; - } //return "<p>".sprintf(_MD_AM_FAILINS, "<b>".$dirname."</b>")." "._MD_AM_ERRORSC."<br /> ".sprintf(_MD_AM_ALEXISTS, $dirname)."</p>"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-29 19:32:38
|
Revision: 636 Author: skalpa Date: 2006-07-29 12:32:30 -0700 (Sat, 29 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=636&view=rev Log Message: ----------- Moved module installation SQL processing to the ModuleInstaller class Modified Paths: -------------- XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php Modified: XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php =================================================================== --- XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php 2006-07-29 15:30:51 UTC (rev 635) +++ XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php 2006-07-29 19:32:30 UTC (rev 636) @@ -26,23 +26,134 @@ class xos_install_ModuleInstaller { /** - * Link resource to the target database - * @var resource + * Connection to the database of the system where the module should be installed/uninstalled + * @var XoopsMySQLDatabase */ - var $db; + var $db = false; + /** + * XoopsModule instance representing the module being processed + * @var XoopsModule + */ + var $module = false; + /** + * Names of the XOOPS tables + * @var array + */ + var $reservedTables = array( + 'avatar', 'avatar_users_link', 'block_module_link', 'xoopscomments', + 'config', 'configcategory', 'configoption', + 'image', 'imagebody', 'imagecategory', 'imgset', 'imgset_tplset_link', 'imgsetimg', + 'groups','groups_users_link','group_permission', 'online', 'bannerclient', 'banner', 'bannerfinish', + 'priv_msgs', 'ranks', 'session', 'smiles', 'users', 'newblocks', 'modules', + 'tplfile', 'tplset', 'tplsource', 'xoopsnotifications', + 'banner', 'bannerclient', 'bannerfinish' + ); + - function installModule( $moduleInfo, $dirname ) { + var $error = ''; + var $events = array(); + + /** + * Performs installation of the module located in the specified folder + * + * @param string $dirname Path to the module that should be installed (relative to the modules folder) + * @return bool + */ + function installModule( $dirname ) { + global $xoops; + $hndModule =& xoops_gethandler( 'module' ); if ( $hndModule->getCount( new Criteria( 'dirname', $dirname ) ) ) { - trigger_error( "Module located in $dirname is already installer", E_USER_WARNING ); - return false; + return $this->fail( "Module located in $dirname is already installed" ); } + $this->module = $hndModule->create(); + $this->module->loadInfoAsVar( $dirname, false ); + $this->module->setVar('weight', 1); + + $sqlfile = $this->module->getInfo( 'sqlfile' ); + if ( $sqlfile && is_array( $sqlfile ) ) { + if ( !isset( $sqlfile[XOOPS_DB_TYPE] ) ) { + return $this->fail( "No SQL file provided for " . XOOPS_DB_TYPE . " databases" ); + } + if ( !$this->executeSqlFile( $xoops->path( "modules/$dirname/" . $sqlfile[XOOPS_DB_TYPE] ) ) ) { + return false; + } + } + return true; } + /** + * Parses and executes the commands contained in the specified SQL file + * @param string $path Path to the SQL file to process + * @return bool + */ + function executeSqlFile( $path ) { + if ( !file_exists( $path ) ) { + return $this->fail( "SQL file '$path' not found" ); + } + include_once XOOPS_ROOT_PATH.'/class/database/sqlutility.php'; + $content = trim( file_get_contents( $path ) ); + $pieces = array(); + SqlUtility::splitMySQLFile( $pieces, $content ); + $created_tables = array(); + $error = false; + $prefix = $this->db->prefix; + foreach ( $pieces as $piece ) { + // [0] contains the prefixed query + // [4] contains unprefixed table name + if ( ! ( $query = SqlUtility::prefixQuery( $piece, $prefix ) ) ) { + $error = !$this->fail( "Invalid SQL in file $path.\n$piece" ); + break; + } + list( $query, $dummy1, $dummy2, $dummy3, $table ) = $query; + if ( in_array( $table, $this->reservedTables ) ) { // check if the table name is reserved + $error = !$this->fail( "$table is a reserved table name" ); + break; + } + if ( !$this->db->query( $query ) ) { + $error = !$this->fail( $this->db->error() ); + break; + } + /** + * @internal: I kept this as it was in the 2.0.x code, but this is a nice bug: + * if one module inserts data into an external table, and installation fails at some + * point, then the external table will be dropped (not cool). + * Also, the messages displayed assume that the SQL file is only made of create/insert + * statements, which is wrong + */ + if ( !in_array( $table, $created_tables ) ) { + $created_tables[] = $table; + $this->log( "Table $table created" ); + } else { + $this->log( "Data inserted into table $table" ); + } + } + if ( $error ) { + // there was an error, delete the tables created so far, so the next installation will not fail + $this->dropDatabaseTables( $created_tables ); + return false; + } + return true; + } + + function log( $msg ) { + $this->events[] = $msg; + } + function fail( $msg ) { + $this->error = $msg; + return false; + } + function dropDatabaseTables( $tables ) { + foreach ( $tables as $ct ) { + $this->db->query("DROP TABLE " . $this->db->prefix( $ct ) ); + } + } + + } Modified: XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php =================================================================== --- XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php 2006-07-29 15:30:51 UTC (rev 635) +++ XoopsCore/branches/tasks/1528144-workbench/htdocs/modules/system/admin/modulesadmin/modulesadmin.php 2006-07-29 19:32:30 UTC (rev 636) @@ -37,7 +37,7 @@ { xoops_cp_header(); echo " - <h4 style='text-align:left'>"._MD_AM_MODADMIN."</h4> + <h1>"._MD_AM_MODADMIN."</h1> <form action='admin.php' method='post' name='moduleadmin' id='moduleadmin'> <table class='outer' width='100%' cellpadding='4' cellspacing='1'> <tr align='center'><th>"._MD_AM_MODULE."</th><th>"._MD_AM_VERSION."</th><th>"._MD_AM_LASTUP."</th><th>"._MD_AM_ACTIVE."</th><th>"._MD_AM_ORDER."<br /><small>"._MD_AM_ORDER0."</small></th><th>"._MD_AM_ACTION."</th></tr> @@ -128,82 +128,18 @@ function xoops_module_install($dirname) { global $xoopsUser, $xoopsConfig; - $dirname = trim($dirname); - $db =& Database::getInstance(); - $reservedTables = array('avatar', 'avatar_users_link', 'block_module_link', 'xoopscomments', 'config', 'configcategory', 'configoption', 'image', 'imagebody', 'imagecategory', 'imgset', 'imgset_tplset_link', 'imgsetimg', 'groups','groups_users_link','group_permission', 'online', 'bannerclient', 'banner', 'bannerfinish', 'priv_msgs', 'ranks', 'session', 'smiles', 'users', 'newblocks', 'modules', 'tplfile', 'tplset', 'tplsource', 'xoopsnotifications', 'banner', 'bannerclient', 'bannerfinish'); - $module_handler =& xoops_gethandler('module'); - if ($module_handler->getCount(new Criteria('dirname', $dirname)) == 0) { - $module =& $module_handler->create(); - $module->loadInfoAsVar($dirname); - $module->setVar('weight', 1); - $error = false; - $errs = array(); - $sqlfile =& $module->getInfo('sqlfile'); - $msgs = array(); - $msgs[] = '<h4 style="text-align:left;margin-bottom: 0px;border-bottom: dashed 1px #000000;">Installing '.$module->getInfo('name').'</h4>'; - if ($module->getInfo('image') != false && trim($module->getInfo('image')) != '') { - $msgs[] ='<img src="'.XOOPS_URL.'/modules/'.$dirname.'/'.trim($module->getInfo('image')).'" alt="" />'; - } - $msgs[] ='<b>Version:</b> '.$module->getInfo('version'); - if ($module->getInfo('author') != false && trim($module->getInfo('author')) != '') { - $msgs[] ='<b>Author:</b> '.trim($module->getInfo('author')); - } - $msgs[] = ''; - $errs[] = '<h4 style="text-align:left;margin-bottom: 0px;border-bottom: dashed 1px #000000;">Installing '.$module->getInfo('name').'</h4>'; - if ($sqlfile != false && is_array($sqlfile)) { + + require_once XOOPS_ROOT_PATH . '/class/xos_install_ModuleInstaller.php'; + $installer = new xos_install_ModuleInstaller(); + $installer->db = $GLOBALS['xoopsDB']; - $sql_file_path = XOOPS_ROOT_PATH."/modules/".$dirname."/".$sqlfile[XOOPS_DB_TYPE]; - if (!file_exists($sql_file_path)) { - $errs[] = "SQL file not found at <b>$sql_file_path</b>"; - $error = true; - } else { - $msgs[] = "SQL file found at <b>$sql_file_path</b>.<br /> Creating tables..."; - include_once XOOPS_ROOT_PATH.'/class/database/sqlutility.php'; - $sql_query = fread(fopen($sql_file_path, 'r'), filesize($sql_file_path)); - $sql_query = trim($sql_query); - SqlUtility::splitMySqlFile($pieces, $sql_query); - $created_tables = array(); - foreach ($pieces as $piece) { - // [0] contains the prefixed query - // [4] contains unprefixed table name - $prefixed_query = SqlUtility::prefixQuery($piece, $db->prefix()); - if (!$prefixed_query) { - $errs[] = "<b>$piece</b> is not a valid SQL!"; - $error = true; - break; - } - // check if the table name is reserved - if (!in_array($prefixed_query[4], $reservedTables)) { - // not reserved, so try to create one - if (!$db->query($prefixed_query[0])) { - $errs[] = $db->error(); - $error = true; - break; - } else { - - if (!in_array($prefixed_query[4], $created_tables)) { - $msgs[] = ' Table <b>'.$db->prefix($prefixed_query[4]).'</b> created.'; - $created_tables[] = $prefixed_query[4]; - } else { - $msgs[] = ' Data inserted to table <b>'.$db->prefix($prefixed_query[4]).'</b>.'; - } - } - } else { - // the table name is reserved, so halt the installation - $errs[] = '<b>'.$prefixed_query[4]."</b> is a reserved table!"; - $error = true; - break; - } - } - // if there was an error, delete the tables created so far, so the next installation will not fail - if ($error == true) { - foreach ($created_tables as $ct) { - //echo $ct; - $db->query("DROP TABLE ".$db->prefix($ct)); - } - } - } - } + if ( $installer->installModule( $dirname ) ) { + echo implode( "<br />\n", $installer->events ); + echo 'ok'; + } else { + echo "error: " . $installer->error; + } + return; // if no error, save the module info and blocks info associated with it if ($error == false) { if (!$module_handler->insert($module)) { @@ -495,11 +431,8 @@ $ret .= '<br />'.sprintf(_MD_AM_FAILINS, '<b>'.$dirname.'</b>').' '._MD_AM_ERRORSC.'</p>'; return $ret; } + //return "<p>".sprintf(_MD_AM_FAILINS, "<b>".$dirname."</b>")." "._MD_AM_ERRORSC."<br /> ".sprintf(_MD_AM_ALEXISTS, $dirname)."</p>"; } - else { - return "<p>".sprintf(_MD_AM_FAILINS, "<b>".$dirname."</b>")." "._MD_AM_ERRORSC."<br /> ".sprintf(_MD_AM_ALEXISTS, $dirname)."</p>"; - } -} function &xoops_module_gettemplate($dirname, $template, $block=false) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-29 15:31:00
|
Revision: 635 Author: skalpa Date: 2006-07-29 08:30:51 -0700 (Sat, 29 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=635&view=rev Log Message: ----------- "Created a new ModuleInstaller class Am going to move most of the modules installation panel to this class. At least this precise functionality has to be taken care of right now, as the modulatisation of some core features will require the installation of some modules from the install wizard (and it will be needed immediately, as the work done on this branch will give birth to a \"workbench\" module that needs to be installed). This class is supposed to make this easy." Added Paths: ----------- XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php Added: XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php =================================================================== --- XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php (rev 0) +++ XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php 2006-07-29 15:30:51 UTC (rev 635) @@ -0,0 +1,49 @@ +<?php +/** +* xos_install_ModuleInstaller main class file +* +* @copyright The Xoops project http://www.xoops.org/ +* @license http://www.fsf.org/copyleft/gpl.html GNU public license +* @author Skalpa Keo <sk...@xo...> +* @author Kazumi Ono +* @since 2.3.0 +* @version $Id$ +* @package xos_install +* @subpackage xos_install_ModuleInstaller +*/ + +/** +* xos_install_ModuleInstaller +* +* This class encapsulates the modules installation/update/uninstallation code. +* +* +* @author Skalpa Keo <sk...@xo...> +* @package xos_install +* @subpackage xos_install_ModuleInstaller +* @since 2.3.0 +*/ + +class xos_install_ModuleInstaller { + /** + * Link resource to the target database + * @var resource + */ + var $db; + + function installModule( $moduleInfo, $dirname ) { + $hndModule =& xoops_gethandler( 'module' ); + if ( $hndModule->getCount( new Criteria( 'dirname', $dirname ) ) ) { + trigger_error( "Module located in $dirname is already installer", E_USER_WARNING ); + return false; + } + } + + + + + +} + + +?> \ No newline at end of file Property changes on: XoopsCore/branches/tasks/1528144-workbench/htdocs/class/xos_install_ModuleInstaller.php ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Author Date Id Rev URL" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-28 12:13:00
|
Revision: 634 Author: skalpa Date: 2006-07-27 05:24:44 -0700 (Thu, 27 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=634&view=rev Log Message: ----------- Added 2 new templates for the administation interface: - theme_admin is a new canvas template used by both the control center and workbench modules instead of the default - admin_treenode is included by theme_admin to render the main navigation tree items The admin modules assign 2 additional template vars: - navbar contains a list of links to be displayed in the horizontal navigation bar (under the banner) - nodes contains the main navigation tree content. the structure of a node is: "name" Name (ID) of this item "label": Label (dispayed name) of this item "icon": URL of this item icon (optional) "link": URL of this panel page "children": Array of nodes (optional) Added Paths: ----------- XoopsCore/branches/tasks/1528144-workbench/htdocs/themes/default/admin_treenode.html XoopsCore/branches/tasks/1528144-workbench/htdocs/themes/default/theme_admin.html Added: XoopsCore/branches/tasks/1528144-workbench/htdocs/themes/default/admin_treenode.html =================================================================== --- XoopsCore/branches/tasks/1528144-workbench/htdocs/themes/default/admin_treenode.html (rev 0) +++ XoopsCore/branches/tasks/1528144-workbench/htdocs/themes/default/admin_treenode.html 2006-07-27 12:24:44 UTC (rev 634) @@ -0,0 +1,12 @@ +<li class="<{$name}>"> + <{if $node.link}><a class="label" href="<{$node.link}>"><{$node.label}></a> + <{else}><span class="label"><{$node.label}></span> + <{/if}> + <{if $node.children}> + <ul> + <{foreach from=$node.children key=name item=node}> + <{includeq file="$theme_name/admin_treenode.html"}> + <{/foreach}> + </ul> + <{/if}> +</li> Property changes on: XoopsCore/branches/tasks/1528144-workbench/htdocs/themes/default/admin_treenode.html ___________________________________________________________________ Name: svn:keywords + "Author Date Id Rev URL" Added: XoopsCore/branches/tasks/1528144-workbench/htdocs/themes/default/theme_admin.html =================================================================== --- XoopsCore/branches/tasks/1528144-workbench/htdocs/themes/default/theme_admin.html (rev 0) +++ XoopsCore/branches/tasks/1528144-workbench/htdocs/themes/default/theme_admin.html 2006-07-27 12:24:44 UTC (rev 634) @@ -0,0 +1,83 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" +><html + xmlns="http://www.w3.org/1999/xhtml" + lang="<{$xoops_langcode}>" xml:lang="<{$xoops_langcode}>" +><head> + <{assign var=theme_name value=$xoTheme->folderName}> + + <title><{$xoops_pagetitle}> : <{$xoops_sitename}></title> + + <meta name="robots" content="<{$xoops_meta_robots}>" /> + <meta name="keywords" content="<{$xoops_meta_keywords}>" /> + <meta name="description" content="<{$xoops_meta_description}>" /> + <meta name="rating" content="<{$xoops_meta_rating}>" /> + <meta name="author" content="<{$xoops_meta_author}>" /> + <meta name="copyright" content="<{$xoops_meta_copyright}>" /> + <meta name="generator" content="XOOPS" /> + + + <link rel="shortcut icon" type="image/ico" href="<{xoImgUrl /favicon.ico}>" /> + <link rel="icon" type="image/png" href="<{xoImgUrl /icon.png}>" /> + <link rel="stylesheet" type="text/css" media="screen" href="<{xoImgUrl /layout-soup.css}>" /> + <link rel="stylesheet" type="text/css" media="all" title="Blue" href="<{xoImgUrl /style.css}>" /> + <{$xoops_module_header}> + +<!--[if lt IE 8]> + <script type="text/javascript"> + var WEBFX_PNG_PATTERN=".*\/icons\/.*.png"; + var WEBFX_PNG_BLANK = "<{xoImgUrl img/blank.gif}>"; + </script> + <style type="text/css"> + img { behavior: url(<{xoImgUrl /js/pngbehavior.htc}>); } + #xo-page .xo-blockszone > .xo-block { + border: 1px solid #c6c1c1; + background: url(<{xoImgUrl /img/centerblock-inner_old.png}>) repeat-x left top; + padding-top: 2px; + } + </style> +<![endif]--> +</head> +<body class="<{$xoops_dirname}> theme-admin"> +<div id="xo-canvas"<{if $columns_layout}> class="<{$columns_layout}>"<{/if}>> + <div id="xo-banner"> + <a id="xo-main-logo" href="<{xoAppUrl /}>"><img src="<{xoImgUrl img/header-logo.png}>" alt="<{$xoops_sitename}>" /></a> + <{includeq file="$theme_name/userbar.html"}> + </div> + <ul id="xo-globalnav" class="x2-nl x2-navigation"> + <li class="x2-label">Main navigation</li> + <{foreachq from=$navbar key=class item=navitem}> + <li class="<{$class}>"> + <a href="<{$navitem.link}>"><{$navitem.label}></a> + </li> + <{/foreach}> + </ul> + <div id="xo-canvas-content"> + <{if $xoBlocks.canvas_top}> + <{includeq file="$theme_name/blockszone.html" blocks=$xoBlocks.canvas_top + zoneClass='' zoneId='xo-canvas-header' + }> + <{/if}> + <table id="xo-canvas-columns" cellspacing="0"> + <tr> + <td id="xo-page"> + Main admin page + <{if $xoops_contents}><div id="xo-content"><{$xoops_contents}></div><{/if}> + </td> + <td id="xo-canvas-rightcolumn" class="xo-canvas-column"> + <ul id="xo-admin-tree"> + <{foreach from=$nodes.children key=name item=node}> + <{includeq file="$theme_name/admin_treenode.html"}> + <{/foreach}> + </ul> + </td> + </tr> + </table> + </div> + <!--{xo-logger-output}--> + <div id="xo-footer"> + <{$xoops_footer}> + </div> +</div> +</body> +</html> Property changes on: XoopsCore/branches/tasks/1528144-workbench/htdocs/themes/default/theme_admin.html ___________________________________________________________________ Name: svn:keywords + "Author Date Id Rev URL" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ph...@us...> - 2006-07-26 15:12:39
|
Revision: 633 Author: phppp Date: 2006-07-26 08:12:30 -0700 (Wed, 26 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=633&view=rev Log Message: ----------- keep xoops_redirect on login failure Modified Paths: -------------- XoopsCore/branches/2.0.x/2.0.15/htdocs/include/checklogin.php Modified: XoopsCore/branches/2.0.x/2.0.15/htdocs/include/checklogin.php =================================================================== --- XoopsCore/branches/2.0.x/2.0.15/htdocs/include/checklogin.php 2006-07-25 05:25:16 UTC (rev 632) +++ XoopsCore/branches/2.0.x/2.0.15/htdocs/include/checklogin.php 2006-07-26 15:12:30 UTC (rev 633) @@ -96,9 +96,11 @@ $notification_handler->doLoginMaintenance($user->getVar('uid')); redirect_header($url, 1, sprintf(_US_LOGGINGU, $user->getVar('uname')), false); -} else { +}elseif(empty($_POST['xoops_redirect'])){ redirect_header(XOOPS_URL.'/user.php', 5, $xoopsAuth->getHtmlErrors()); +}else{ + redirect_header(XOOPS_URL.'/user.php?xoops_redirect='.urlencode(trim($_POST['xoops_redirect'])), 5, $xoopsAuth->getHtmlErrors(), false); } exit(); -?> +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-25 05:25:24
|
Revision: 632 Author: skalpa Date: 2006-07-24 22:25:16 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=632&view=rev Log Message: ----------- Creating work branch for patch #1528144 (workbench creation) Added Paths: ----------- XoopsCore/branches/tasks/1528144-workbench/ Copied: XoopsCore/branches/tasks/1528144-workbench (from rev 631, XoopsCore/trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-25 05:18:40
|
Revision: 631 Author: skalpa Date: 2006-07-24 22:18:29 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=631&view=rev Log Message: ----------- Updated changelogs with the changes made yesterday Modified Paths: -------------- XoopsCore/branches/2.0.x/2.0.15/docs/changelog.txt XoopsCore/trunk/docs/changelog.txt Modified: XoopsCore/branches/2.0.x/2.0.15/docs/changelog.txt =================================================================== --- XoopsCore/branches/2.0.x/2.0.15/docs/changelog.txt 2006-07-24 01:12:44 UTC (rev 630) +++ XoopsCore/branches/2.0.x/2.0.15/docs/changelog.txt 2006-07-25 05:18:29 UTC (rev 631) @@ -1,6 +1,15 @@ XOOPS v2.0.x Changelog ++ Added XoopsObject::getValues() to get several values in an array (skalpa) ++ Added backtrace support to the error handler and killed the useless blank page (skalpa) + +- Fixed external rewriting support (skalpa) +- Fixed bug #1517865: Sanitizer changes parameters values (skalpa) +- Fixed bug #1513533: mysql extension availability isn't checked (skalpa/dave_l) +- Fixed bug #1520277: Error reporting is enabled in the installer (skalpa/) +- Removed more references related notices (skalpa/chappy+herko) + ============================ 2006/06/26: Version 2.0.14 ============================ Modified: XoopsCore/trunk/docs/changelog.txt =================================================================== --- XoopsCore/trunk/docs/changelog.txt 2006-07-24 01:12:44 UTC (rev 630) +++ XoopsCore/trunk/docs/changelog.txt 2006-07-25 05:18:29 UTC (rev 631) @@ -7,6 +7,17 @@ - Redesigned the installer (skalpa/snowinmyhands+leostotch) ============================ + ++ Added XoopsObject::getValues() to get several values in an array (skalpa) ++ Added backtrace support to the error handler and killed the useless blank page (skalpa) + +- Fixed external rewriting support (skalpa) +- Fixed bug #1517865: Sanitizer changes parameters values (skalpa) +- Fixed bug #1513533: mysql extension availability isn't checked (skalpa/dave_l) +- Fixed bug #1520277: Error reporting is enabled in the installer (skalpa/) +- Removed more references related notices (skalpa/chappy+herko) + +============================ 2006/06/26: Version 2.0.14 ============================ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: Tudur A. <ant...@ca...> - 2006-07-25 00:15:49
|
=20 VljAGGRA from 3 , 33 $ =20 http://www.kaverxazesa.com =20 , , , , something that old? You use it if that is all that you have. There is a mystery here that we are about to solve. Remember the ancient explosive that blew |
|
From: Linden D. <lin...@hu...> - 2006-07-24 14:22:52
|
=20 VljAGRA from 3 , 33 $ =20 http://www.einkertancase.com =20 , , , , feebly and fearfully back. Relax Jim, sit back and enjoy the ride. It was hard to do. I admit I did not see much of the passing scenery, being too involved with thoughts of survival. Nor did I relax until |
|
From: <ph...@us...> - 2006-07-24 01:12:53
|
Revision: 630 Author: phppp Date: 2006-07-23 18:12:44 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=630&view=rev Log Message: ----------- Added handling for multiple redirect Modified Paths: -------------- XoopsCore/branches/2.0.x/2.0.15/htdocs/user.php Modified: XoopsCore/branches/2.0.x/2.0.15/htdocs/user.php =================================================================== --- XoopsCore/branches/2.0.x/2.0.15/htdocs/user.php 2006-07-23 23:55:00 UTC (rev 629) +++ XoopsCore/branches/2.0.x/2.0.15/htdocs/user.php 2006-07-24 01:12:44 UTC (rev 630) @@ -56,7 +56,9 @@ $xoopsTpl->assign('lang_sendpassword', _US_SENDPASSWORD); $xoopsTpl->assign('mailpasswd_token', $GLOBALS['xoopsSecurity']->createToken()); include 'footer.php'; - } elseif ( $xoopsUser ) { + } elseif ( !empty($_GET['xoops_redirect']) ) { + header('Location: '.$_GET['xoops_redirect']); + } else { header('Location: '.XOOPS_URL.'/userinfo.php?uid='.$xoopsUser->getVar('uid')); } exit(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-23 23:55:11
|
Revision: 629 Author: skalpa Date: 2006-07-23 16:55:00 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=629&view=rev Log Message: ----------- Fixed external rewriting compatibility Supposed to have been done in 2.0.14 :-@ Modified Paths: -------------- XoopsCore/branches/2.0.x/2.0.15/htdocs/include/common.php XoopsCore/trunk/htdocs/include/common.php Modified: XoopsCore/branches/2.0.x/2.0.15/htdocs/include/common.php =================================================================== --- XoopsCore/branches/2.0.x/2.0.15/htdocs/include/common.php 2006-07-23 23:37:49 UTC (rev 628) +++ XoopsCore/branches/2.0.x/2.0.15/htdocs/include/common.php 2006-07-23 23:55:00 UTC (rev 629) @@ -301,7 +301,7 @@ } if (file_exists('./xoops_version.php')) { - $url_arr = explode('/',strstr($xoopsRequestUri,'/modules/')); + $url_arr = explode( '/', strstr( $_SERVER['PHP_SELF'],'/modules/') ); $module_handler =& xoops_gethandler('module'); $xoopsModule =& $module_handler->getByDirname($url_arr[2]); unset($url_arr); Modified: XoopsCore/trunk/htdocs/include/common.php =================================================================== --- XoopsCore/trunk/htdocs/include/common.php 2006-07-23 23:37:49 UTC (rev 628) +++ XoopsCore/trunk/htdocs/include/common.php 2006-07-23 23:55:00 UTC (rev 629) @@ -301,7 +301,7 @@ } if (file_exists('./xoops_version.php')) { - $url_arr = explode('/',strstr($xoopsRequestUri,'/modules/')); + $url_arr = explode( '/', strstr( $_SERVER['PHP_SELF'],'/modules/') ); $module_handler =& xoops_gethandler('module'); $xoopsModule =& $module_handler->getByDirname($url_arr[2]); unset($url_arr); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-23 23:37:55
|
Revision: 628 Author: skalpa Date: 2006-07-23 16:37:49 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=628&view=rev Log Message: ----------- Added a smarty implementation of the page nav (it's used in the new xoops.org sites) Added Paths: ----------- XoopsCore/trunk/htdocs/class/smarty/xoops_plugins/function.xoPageNav.php Added: XoopsCore/trunk/htdocs/class/smarty/xoops_plugins/function.xoPageNav.php =================================================================== --- XoopsCore/trunk/htdocs/class/smarty/xoops_plugins/function.xoPageNav.php (rev 0) +++ XoopsCore/trunk/htdocs/class/smarty/xoops_plugins/function.xoPageNav.php 2006-07-23 23:37:49 UTC (rev 628) @@ -0,0 +1,47 @@ +<?php +/* + itemsCount: Total number of items in the current list + pageSize: Number of items in each page + offset: Index of the 1st item currently displayed + linksCount: Number of direct links to show (default to 5) + url: URL mask used to generate links (%s will be replace by offset) + itemsCount=$items_count pageSize=$module_config.perpage offset=$offset + url="viewcat.php?cid=`$entity.cid`&orderby=`$sort_order`&offset=%s" +*/ + +function smarty_function_xoPageNav( $params, &$smarty ) { + global $xoops; + + extract( $params ); + if ( $pageSize < 1 ) { + $pageSize = 10; + } + $pagesCount = intval( $itemsCount / $pageSize ); + if ( $itemsCount <= $pageSize || $pagesCount < 2 ) { + return ''; + } + $str = ''; + $currentPage = intval( $offset / $pageSize ) + 1; + $lastPage = intval( $itemsCount / $pageSize ) + 1; + + $minPage = min( 1, ceil( $currentPage - $linksCount/2 ) ); + $maxPage = max( $lastPage, floor( $currentPage + $linksCount/2 ) ); + + if ( $currentPage > 1 ) { + $str .= '<a href="' . $xoops->url( str_replace( '%s', $offset-$pageSize, $url ) ) . '">Previous</a>'; + } + for ( $i = $minPage; $i <= $maxPage; $i++ ) { + $tgt = htmlspecialchars( $xoops->url( str_replace( '%s', ($i - 1) * $pageSize, $url ) ), ENT_QUOTES ); + $str .= "<a href='$tgt'>$i</a>"; + } + if ( $currentPage < $lastPage ) { + $str .= '<a href="' . $xoops->url( str_replace( '%s', $offset+$pageSize, $url ) ) . '">Next</a>'; + } + $class = @!empty($class) ? htmlspecialchars( $class, ENT_QUOTES ) : 'pagenav'; + + $str = "<div class='$class'>$str</div>"; + return $str; + +} + +?> \ No newline at end of file Property changes on: XoopsCore/trunk/htdocs/class/smarty/xoops_plugins/function.xoPageNav.php ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + "Author Date Id Rev URL" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-23 23:20:05
|
Revision: 627 Author: skalpa Date: 2006-07-23 16:19:52 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=627&view=rev Log Message: ----------- Added backtrace support to the error handler Modified Paths: -------------- XoopsCore/branches/2.0.x/2.0.15/htdocs/class/database/databasefactory.php XoopsCore/branches/2.0.x/2.0.15/htdocs/class/logger.php XoopsCore/trunk/htdocs/class/database/databasefactory.php XoopsCore/trunk/htdocs/class/logger.php Modified: XoopsCore/branches/2.0.x/2.0.15/htdocs/class/database/databasefactory.php =================================================================== --- XoopsCore/branches/2.0.x/2.0.15/htdocs/class/database/databasefactory.php 2006-07-23 09:11:18 UTC (rev 626) +++ XoopsCore/branches/2.0.x/2.0.15/htdocs/class/database/databasefactory.php 2006-07-23 23:19:52 UTC (rev 627) @@ -31,7 +31,7 @@ $instance->setLogger(XoopsLogger::instance()); $instance->setPrefix(XOOPS_DB_PREFIX); if (!$instance->connect()) { - trigger_error("Unable to connect to database", E_USER_ERROR); + trigger_error("notrace:Unable to connect to database", E_USER_ERROR); } } return $instance; Modified: XoopsCore/branches/2.0.x/2.0.15/htdocs/class/logger.php =================================================================== --- XoopsCore/branches/2.0.x/2.0.15/htdocs/class/logger.php 2006-07-23 09:11:18 UTC (rev 626) +++ XoopsCore/branches/2.0.x/2.0.15/htdocs/class/logger.php 2006-07-23 23:19:52 UTC (rev 627) @@ -123,16 +123,46 @@ function handleError( $errno, $errstr, $errfile, $errline ) { if ( $this->activated && ( $errno & error_reporting() ) ) { // NOTE: we only store relative pathnames - $errfile = str_replace( array( '\\', XOOPS_ROOT_PATH ), array( '/', '' ), $errfile ); + $errfile = $this->sanitizePath( $errfile ); $this->errors[] = compact( 'errno', 'errstr', 'errfile', 'errline' ); } if ( $errno == E_USER_ERROR ) { + $trace = true; + if ( substr( $errstr, 0, '8' ) == 'notrace:' ) { + $trace = false; + $errstr = substr( $errstr, 8 ); + } echo 'This page cannot be displayed due to an internal error.<br/><br/>'; - echo 'If you are the administrator of this site, please visit the <a href="http://www.xoops.org/modules/smartfaq/faq.php?faqid=80">Xoops Troubleshooting Page</a> for assistance.<br/><br/>'; + echo "You can provide the following information to the administrators of "; + echo "this site to help them solve the problem:<br /><br />"; + echo "Error: $errstr<br />"; + if ( $trace && function_exists( 'debug_backtrace' ) ) { + echo "Backtrace:<br />"; + $trace = debug_backtrace(); + array_shift( $trace ); + foreach ( $trace as $step ) { + if ( isset( $step['file'] ) ) { + echo $this->sanitizePath( $step['file'] ); + echo ' (' . $step['line'] . ")\n<br />"; + } + } + } exit(); } } /** + * @access protected + */ + function sanitizePath( $path ) { + $path = str_replace( + array( '\\', XOOPS_ROOT_PATH, str_replace( '\\', '/', realpath( XOOPS_ROOT_PATH ) ) ), + array( '/', '', '' ), + $path + ); + return $path; + } + + /** * Output buffering callback inserting logger dump in page output */ function render( $output ) { Modified: XoopsCore/trunk/htdocs/class/database/databasefactory.php =================================================================== --- XoopsCore/trunk/htdocs/class/database/databasefactory.php 2006-07-23 09:11:18 UTC (rev 626) +++ XoopsCore/trunk/htdocs/class/database/databasefactory.php 2006-07-23 23:19:52 UTC (rev 627) @@ -31,7 +31,7 @@ $instance->setLogger(XoopsLogger::instance()); $instance->setPrefix(XOOPS_DB_PREFIX); if (!$instance->connect()) { - trigger_error("Unable to connect to database", E_USER_ERROR); + trigger_error("notrace:Unable to connect to database", E_USER_ERROR); } } return $instance; Modified: XoopsCore/trunk/htdocs/class/logger.php =================================================================== --- XoopsCore/trunk/htdocs/class/logger.php 2006-07-23 09:11:18 UTC (rev 626) +++ XoopsCore/trunk/htdocs/class/logger.php 2006-07-23 23:19:52 UTC (rev 627) @@ -123,16 +123,46 @@ function handleError( $errno, $errstr, $errfile, $errline ) { if ( $this->activated && ( $errno & error_reporting() ) ) { // NOTE: we only store relative pathnames - $errfile = str_replace( array( '\\', XOOPS_ROOT_PATH ), array( '/', '' ), $errfile ); + $errfile = $this->sanitizePath( $errfile ); $this->errors[] = compact( 'errno', 'errstr', 'errfile', 'errline' ); } if ( $errno == E_USER_ERROR ) { + $trace = true; + if ( substr( $errstr, 0, '8' ) == 'notrace:' ) { + $trace = false; + $errstr = substr( $errstr, 8 ); + } echo 'This page cannot be displayed due to an internal error.<br/><br/>'; - echo 'If you are the administrator of this site, please visit the <a href="http://www.xoops.org/modules/smartfaq/faq.php?faqid=80">Xoops Troubleshooting Page</a> for assistance.<br/><br/>'; + echo "You can provide the following information to the administrators of "; + echo "this site to help them solve the problem:<br /><br />"; + echo "Error: $errstr<br />"; + if ( $trace && function_exists( 'debug_backtrace' ) ) { + echo "Backtrace:<br />"; + $trace = debug_backtrace(); + array_shift( $trace ); + foreach ( $trace as $step ) { + if ( isset( $step['file'] ) ) { + echo $this->sanitizePath( $step['file'] ); + echo ' (' . $step['line'] . ")\n<br />"; + } + } + } exit(); } } /** + * @access protected + */ + function sanitizePath( $path ) { + $path = str_replace( + array( '\\', XOOPS_ROOT_PATH, str_replace( '\\', '/', realpath( XOOPS_ROOT_PATH ) ) ), + array( '/', '', '' ), + $path + ); + return $path; + } + + /** * Output buffering callback inserting logger dump in page output */ function render( $output ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-23 09:11:29
|
Revision: 626 Author: skalpa Date: 2006-07-23 02:11:18 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=626&view=rev Log Message: ----------- Added XoopsObject::getValues() to get several values in an array Modified Paths: -------------- XoopsCore/branches/2.0.x/2.0.15/htdocs/kernel/object.php XoopsCore/trunk/htdocs/kernel/object.php Modified: XoopsCore/branches/2.0.x/2.0.15/htdocs/kernel/object.php =================================================================== --- XoopsCore/branches/2.0.x/2.0.15/htdocs/kernel/object.php 2006-07-23 06:52:33 UTC (rev 625) +++ XoopsCore/branches/2.0.x/2.0.15/htdocs/kernel/object.php 2006-07-23 09:11:18 UTC (rev 626) @@ -265,7 +265,32 @@ { return $this->vars; } - + /** + * Returns the values of the specified variables + * + * @param mixed $keys An array containing the names of the keys to retrieve, or null to get all of them + * @param string $format Format to use (see getVar) + * @param int $maxDepth Maximum level of recursion to use if some vars are objects themselves + * @return array associative array of key->value pairs + */ + function getValues( $keys = null, $format = 's', $maxDepth = 1 ) { + if ( !isset( $keys ) ) { + $keys = array_keys( $this->vars ); + } + $vars = array(); + foreach ( $keys as $key ) { + if ( isset( $this->vars[$key] ) ) { + if ( is_object( $this->vars[$key] ) && is_a( $this->vars[$key], 'XoopsObject' ) ) { + if ( $maxDepth ) { + $vars[$key] = $this->vars[$key]->getValues( null, $format, $maxDepth - 1 ); + } + } else { + $vars[$key] = $this->getVar( $key, $format ); + } + } + } + return $vars; + } /** * returns a specific variable for the object in a proper format * Modified: XoopsCore/trunk/htdocs/kernel/object.php =================================================================== --- XoopsCore/trunk/htdocs/kernel/object.php 2006-07-23 06:52:33 UTC (rev 625) +++ XoopsCore/trunk/htdocs/kernel/object.php 2006-07-23 09:11:18 UTC (rev 626) @@ -265,7 +265,32 @@ { return $this->vars; } - + /** + * Returns the values of the specified variables + * + * @param mixed $keys An array containing the names of the keys to retrieve, or null to get all of them + * @param string $format Format to use (see getVar) + * @param int $maxDepth Maximum level of recursion to use if some vars are objects themselves + * @return array associative array of key->value pairs + */ + function getValues( $keys = null, $format = 's', $maxDepth = 1 ) { + if ( !isset( $keys ) ) { + $keys = array_keys( $this->vars ); + } + $vars = array(); + foreach ( $keys as $key ) { + if ( isset( $this->vars[$key] ) ) { + if ( is_object( $this->vars[$key] ) && is_a( $this->vars[$key], 'XoopsObject' ) ) { + if ( $maxDepth ) { + $vars[$key] = $this->vars[$key]->getValues( null, $format, $maxDepth - 1 ); + } + } else { + $vars[$key] = $this->getVar( $key, $format ); + } + } + } + return $vars; + } /** * returns a specific variable for the object in a proper format * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-23 06:52:46
|
Revision: 625 Author: skalpa Date: 2006-07-22 23:52:33 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=625&view=rev Log Message: ----------- Fixed additional notices reported on SF Modified Paths: -------------- XoopsCore/branches/2.0.x/2.0.15/htdocs/modules/system/admin/preferences/main.php XoopsCore/trunk/htdocs/modules/system/admin/preferences/main.php Modified: XoopsCore/branches/2.0.x/2.0.15/htdocs/modules/system/admin/preferences/main.php =================================================================== --- XoopsCore/branches/2.0.x/2.0.15/htdocs/modules/system/admin/preferences/main.php 2006-07-23 06:15:38 UTC (rev 624) +++ XoopsCore/branches/2.0.x/2.0.15/htdocs/modules/system/admin/preferences/main.php 2006-07-23 06:52:33 UTC (rev 625) @@ -47,7 +47,7 @@ } if ($op == 'list') { $confcat_handler =& xoops_gethandler('configcategory'); - $confcats =& $confcat_handler->getObjects(); + $confcats = $confcat_handler->getObjects(); $catcount = count($confcats); xoops_cp_header(); echo '<h4 style="text-align:left">'._MD_AM_SITEPREF.'</h4><ul>'; Modified: XoopsCore/trunk/htdocs/modules/system/admin/preferences/main.php =================================================================== --- XoopsCore/trunk/htdocs/modules/system/admin/preferences/main.php 2006-07-23 06:15:38 UTC (rev 624) +++ XoopsCore/trunk/htdocs/modules/system/admin/preferences/main.php 2006-07-23 06:52:33 UTC (rev 625) @@ -47,7 +47,7 @@ } if ($op == 'list') { $confcat_handler =& xoops_gethandler('configcategory'); - $confcats =& $confcat_handler->getObjects(); + $confcats = $confcat_handler->getObjects(); $catcount = count($confcats); xoops_cp_header(); echo '<h4 style="text-align:left">'._MD_AM_SITEPREF.'</h4><ul>'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-23 06:15:44
|
Revision: 624 Author: skalpa Date: 2006-07-22 23:15:38 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=624&view=rev Log Message: ----------- Fixed bug #1517865: Sanitizer changes parameters values That's the r621 change I just applied to the trunk one hour ago Modified Paths: -------------- XoopsCore/branches/2.0.x/2.0.15/htdocs/class/module.textsanitizer.php Modified: XoopsCore/branches/2.0.x/2.0.15/htdocs/class/module.textsanitizer.php =================================================================== --- XoopsCore/branches/2.0.x/2.0.15/htdocs/class/module.textsanitizer.php 2006-07-23 05:35:17 UTC (rev 623) +++ XoopsCore/branches/2.0.x/2.0.15/htdocs/class/module.textsanitizer.php 2006-07-23 06:15:38 UTC (rev 624) @@ -282,7 +282,7 @@ * @param bool $br convert linebreaks? * @return string **/ - function &displayTarea(&$text, $html = 0, $smiley = 1, $xcode = 1, $image = 1, $br = 1) + function &displayTarea( $text, $html = 0, $smiley = 1, $xcode = 1, $image = 1, $br = 1) { if ($html != 1) { // html not allowed @@ -322,7 +322,7 @@ * @param bool $br convert linebreaks? * @return string **/ - function &previewTarea(&$text, $html = 0, $smiley = 1, $xcode = 1, $image = 1, $br = 1) + function &previewTarea( $text, $html = 0, $smiley = 1, $xcode = 1, $image = 1, $br = 1) { $text = $this->stripSlashesGPC($text); if ($html != 1) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-23 05:35:27
|
Revision: 623 Author: skalpa Date: 2006-07-22 22:35:17 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=623&view=rev Log Message: ----------- Fixed bug #1513533: mysql extension availability isn't checked Modified Paths: -------------- XoopsCore/branches/2.0.x/2.0.15/htdocs/class/database/mysqldatabase.php XoopsCore/trunk/htdocs/class/database/mysqldatabase.php Modified: XoopsCore/branches/2.0.x/2.0.15/htdocs/class/database/mysqldatabase.php =================================================================== --- XoopsCore/branches/2.0.x/2.0.15/htdocs/class/database/mysqldatabase.php 2006-07-23 04:28:07 UTC (rev 622) +++ XoopsCore/branches/2.0.x/2.0.15/htdocs/class/database/mysqldatabase.php 2006-07-23 05:35:17 UTC (rev 623) @@ -71,6 +71,10 @@ */ function connect($selectdb = true) { + if ( !extension_loaded( 'mysql' ) ) { + trigger_error( 'notrace:mysql extension not loaded', E_USER_ERROR ); + return false; + } if (XOOPS_DB_PCONNECT == 1) { $this->conn = @mysql_pconnect(XOOPS_DB_HOST, XOOPS_DB_USER, XOOPS_DB_PASS); } else { Modified: XoopsCore/trunk/htdocs/class/database/mysqldatabase.php =================================================================== --- XoopsCore/trunk/htdocs/class/database/mysqldatabase.php 2006-07-23 04:28:07 UTC (rev 622) +++ XoopsCore/trunk/htdocs/class/database/mysqldatabase.php 2006-07-23 05:35:17 UTC (rev 623) @@ -71,6 +71,10 @@ */ function connect($selectdb = true) { + if ( !extension_loaded( 'mysql' ) ) { + trigger_error( 'notrace:mysql extension not loaded', E_USER_ERROR ); + return false; + } if (XOOPS_DB_PCONNECT == 1) { $this->conn = @mysql_pconnect(XOOPS_DB_HOST, XOOPS_DB_USER, XOOPS_DB_PASS); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sk...@us...> - 2006-07-23 04:28:18
|
Revision: 622 Author: skalpa Date: 2006-07-22 21:28:07 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/xoops/?rev=622&view=rev Log Message: ----------- Fixed bug #1520277: Error reporting is enabled in the installer Modified Paths: -------------- XoopsCore/branches/2.0.x/2.0.15/htdocs/install/class/textsanitizer.php XoopsCore/branches/2.0.x/2.0.15/htdocs/install/index.php Modified: XoopsCore/branches/2.0.x/2.0.15/htdocs/install/class/textsanitizer.php =================================================================== --- XoopsCore/branches/2.0.x/2.0.15/htdocs/install/class/textsanitizer.php 2006-07-23 03:10:42 UTC (rev 621) +++ XoopsCore/branches/2.0.x/2.0.15/htdocs/install/class/textsanitizer.php 2006-07-23 04:28:07 UTC (rev 622) @@ -72,7 +72,7 @@ return addslashes($text); } if (!get_magic_quotes_gpc()) { - $text =& addslashes($text); + $text = addslashes($text); } return $text; } @@ -83,7 +83,7 @@ function &stripSlashesGPC($text) { if (get_magic_quotes_gpc()) { - $text =& stripslashes($text); + $text = stripslashes($text); } return $text; } Modified: XoopsCore/branches/2.0.x/2.0.15/htdocs/install/index.php =================================================================== --- XoopsCore/branches/2.0.x/2.0.15/htdocs/install/index.php 2006-07-23 03:10:42 UTC (rev 621) +++ XoopsCore/branches/2.0.x/2.0.15/htdocs/install/index.php 2006-07-23 04:28:07 UTC (rev 622) @@ -25,7 +25,7 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // -error_reporting (E_ALL); +error_reporting (0); include_once './passwd.php'; if(INSTALL_USER != '' || INSTALL_PASSWD != ''){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |