From: <txm...@us...> - 2014-04-17 21:19:20
|
Revision: 12457 http://sourceforge.net/p/xoops/svn/12457 Author: txmodxoops Date: 2014-04-17 21:19:14 +0000 (Thu, 17 Apr 2014) Log Message: ----------- To continue with stable versions but they have renewed and full of code refactoring Step by step I hope to get a clean version with code much more readable and understandable for all users those who want to extend and expand this module Test and let them know how it works Added Paths: ----------- XoopsModules/TDMCreate/branches/timgno/1.42/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/about.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/building.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/footer.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/header.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/includes.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/index.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/menu.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/modules.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/tables.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/class/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/class/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/class/logoGenerator.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/class/modules.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/class/structure.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/class/tables.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_admin_about.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_admin_footer.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_admin_header.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_admin_help.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_admin_index.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_admin_language.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_admin_menu.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_admin_pages.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_admin_permissions.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_blocks.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_blocks_language.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_blocks_templates.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_changelog.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_class.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_class_helper.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_class_module.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_class_request.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_css_style.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_header.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_help_language.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_include_comments.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_include_common.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_include_functions.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_include_functions_comments.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_include_install.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_include_jquery.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_include_notifications.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_include_search.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_js_jquery.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_languages.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_main_language.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_modinfo_language.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_sql.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_structure.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_templates.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_templates_admin_about.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_templates_admin_help.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_templates_footer.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_templates_header.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_templates_index.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_templates_pages.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_user_comments.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_user_footer.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_user_header.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_user_index.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_user_pages.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_waiting.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/const/const_xoopsversion.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/css/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/css/admin.css XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/css/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/docs/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/docs/changelog.txt XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/docs/credits.txt XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/docs/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/docs/install.txt XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/docs/lang_diff.txt XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/docs/license.txt XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/docs/readme.txt XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/16/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/16/arrow.gif XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/16/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/16/off.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/16/on.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/16/toggle.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/32/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/32/addmodule.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/32/addtable.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/32/builder.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/32/dashboard.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/32/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/arrow.gif XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/blank.gif XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/loading.gif XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/off.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/icons/on.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/loading.gif XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/logos/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/logos/VeraBd.ttf XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/logos/green.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/logos/red.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/logos/xoops2.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/module_logo.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/tdmcreate_slogo.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/txmodxoops_logo.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/uploads/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/uploads/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/uploads/modules/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/uploads/modules/Car_logo.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/uploads/modules/My Module_logo.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/uploads/modules/Test1Logo.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/uploads/modules/Test1_logo.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/uploads/modules/empty.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/uploads/modules/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/uploads/modules/mymodule_logo.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/uploads/modules/xcvLogo.txt XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/uploads/tables/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/uploads/tables/blank.gif XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/uploads/tables/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/images/xoops2.png XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/include/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/include/common.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/include/functions.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/include/functions_const.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/include/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/include/install.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/include/jq.init.js XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/include/update.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/js/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/js/functions.js XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/js/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/language/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/language/english/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/language/english/admin.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/language/english/help/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/language/english/help/help.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/language/english/help/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/language/english/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/language/english/modinfo.php XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/language/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/language/update language 1.0 to 1.1.txt XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/language/update language 1.1 to 1.15.txt XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/language/update language 1.1 to 1.37.txt XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/language/update language 1.15 to 1.37.txt XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/language/update language 1.37 to 1.38.txt XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/language/update language 1.38 to 1.39.txt XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/modules/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/modules/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/sql/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/sql/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/sql/mysql.sql XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/templates/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/templates/admin/ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/templates/admin/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/templates/index.html XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/xoops_version.php Added: XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/about.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/about.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/about.php 2014-04-17 21:19:14 UTC (rev 12457) @@ -0,0 +1,24 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ +/** + * tdmcreate module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package tdmcreate + * @since 2.5.0 + * @author Txmod Xoops http://www.txmodxoops.org + * @version $Id: about.php 11084 2013-02-23 15:44:20Z timgno $ + */ +include 'header.php'; +echo $adminMenu->addNavigation('about.php'); +echo $adminMenu->renderabout('6KJ7RW5DR3VTJ', false); +include 'footer.php'; \ No newline at end of file Added: XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/building.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/building.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/building.php 2014-04-17 21:19:14 UTC (rev 12457) @@ -0,0 +1,269 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ +/** + * tdmcreate module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package tdmcreate + * @since 2.5.0 + * @author Txmod Xoops http://www.txmodxoops.org + * @version $Id: building.php 11084 2013-02-23 15:44:20Z timgno $ + */ +include 'header.php'; +$op = TDMCreate_CleanVars( $_REQUEST, 'op', 'default', 'string' ); + +if (isset($_REQUEST['mod_name'])) { + $modules =& $modulesHandler->get($_REQUEST['mod_name']); +} else { + $modules =& $modulesHandler; +} + +$mod_name = strtolower($modules->getVar('mod_name')); +$mod_author_website_name = $modules->getVar('mod_author_website_name'); +$mod_author_website_url = $modules->getVar('mod_author_website_url'); +$mod_user = $modules->getVar('mod_user'); +$mod_notifications = $modules->getVar('mod_notifications'); +$mod_permissions = $modules->getVar('mod_permissions'); + +if (isset($_REQUEST['table_name'])) { + $tables =& $tablesHandler->get($_REQUEST['table_name']); +} else { + $tables =& $tablesHandler; +} + +//Name of tables +$criteria = new CriteriaCompo(); +if (isset($_REQUEST['mod_name'])) { + $criteria->add(new Criteria('table_mid', $_REQUEST['mod_name'])); +} else { + $criteria->add(new Criteria('table_mid')); +} + +$nb_tables = $tablesHandler->getCount($criteria); +$tables_arr = $tablesHandler->getAll($criteria); + +$from_dir = $modPath.'/modules/'.strtolower($mod_name); +$to_dir = XOOPS_ROOT_PATH.'/modules/'.strtolower($mod_name); +$class = 'even'; +echo $adminMenu->addNavigation('building.php'); +switch ($op) { + case 'build': + // Clear local directory of this module if exist + TDMCreate_clearDir($from_dir); + // Clear in root modules directory of this module if exist + TDMCreate_clearDir($to_dir); + // Debut + TDMCreate_OpenTable(_AM_TDMCREATE_BUILDING_FILES, _AM_TDMCREATE_BUILDING_SUCCESS, _AM_TDMCREATE_BUILDING_FAILED); + /************************************************/ + /*Structure*/ + /************************************************/ + //Creation of the structure of folders and files + const_structure($modules); + xoops_load('XoopsFile'); + $folder = XoopsFile::getHandler('folder'); + echo '<tr class="'.$class.'">'; + if ( $modules->getVar('mod_install') == 1 ) { + if ( $root_modules = $folder->inXoopsPath('/modules') ) { + if ( $folder->copy(array($root_modules, $from_dir, '755')) ) { + echo '<td style="padding-left: 30px;">'.sprintf(_AM_TDMCREATE_CONST_OK_ARCHITECTURE_ROOT, $to_dir).'</td> + <td> </td> + <td class="center"><img src='. $pathIcon16 .'/off.png></td>'; + } else { + echo '<td style="padding-left: 30px;">'.sprintf(_AM_TDMCREATE_CONST_NOTOK_ARCHITECTURE_ROOT, $to_dir).'</td> + <td> </td> + <td class="center"><img src='. $pathIcon16 .'/off.png></td>'; + } + } + } + echo '</tr>'; + //Creation of changelog.txt + const_changelog($modules); + + $result = $xoopsDB->queryF("SELECT COUNT(*) FROM " . $xoopsDB->prefix('mod_tdmcreate_tables') . " WHERE table_name = 'mod_".strtolower($mod_name)."_categories'"); + list( $category ) = $xoopsDB->fetchRow($result); + + foreach (array_keys($tables_arr) as $i) + { + // Variables + $table_name = $tables_arr[$i]->getVar('table_name'); + $table_fieldname = $tables_arr[$i]->getVar('table_fieldname'); + $table_category = $tables_arr[$i]->getVar('table_category'); + $table_fields = $tables_arr[$i]->getVar('table_fields'); + $table_parameters = $tables_arr[$i]->getVar('table_parameters'); + $table_image = $tables_arr[$i]->getVar('table_image'); + $table_blocks = $tables_arr[$i]->getVar('table_blocks'); + $table_admin = $tables_arr[$i]->getVar('table_admin'); + $table_user = $tables_arr[$i]->getVar('table_user'); + $table_search = $tables_arr[$i]->getVar('table_search'); + $table_comments = $tables_arr[$i]->getVar('table_comments'); + $table_notifications = $tables_arr[$i]->getVar('table_notifications'); + $table_permissions = $tables_arr[$i]->getVar('table_permissions'); + $table_waiting = $tables_arr[$i]->getVar('table_waiting'); + + // Fabrication + // Copy of images tables + $table_image1 = $modPath . '/images/uploads/tables/' . $table_image; + if (file_exists($table_image1)) { + copy($table_image1, $modPath . '/modules/' . strtolower($mod_name) . '/images/icons/32/' . $table_image); + } + // Creation of classes + if ( $table_admin == 1 || $table_user == 1) { + const_class($modules, $table_name, $table_fieldname, $table_fields, $table_parameters, $table_category, $table_permissions); + } + // Creation of pages admin + if ( $table_admin == 1 ) { + const_admin_pages($modules, $table_name, $table_fieldname, $table_fields, $table_parameters, $category); + } + // Creation of pages and templates user + if ( $table_user == 1 && $table_name != null ) { + const_user_pages($modules, $table_name, $table_fieldname, $table_fields, $table_parameters); + const_templates_pages($modules, $table_name, $table_fieldname, $table_fields, $table_parameters); + } + // Creation of search + if ( $table_search == 1 ) { + const_include_search($modules, $table_name, $table_fieldname, $table_fields, $table_parameters, $table_image); + } + // Creation of admin permissions.php + if ( $table_permissions == 1) { + const_admin_permissions($modules, $table_name, $table_fields, $table_parameters); + } + // Creation of notifications + if ( $table_notifications == 1 ) { + const_include_notifications($modules, $table_name, $table_fieldname, $table_fields, $table_parameters); + } + // Creation of the file mysql.sql + const_sql($modules, $table_name, $table_fieldname, $table_fields, $category); + + // Creation of blocks + if ( $table_blocks == 1 ) { + const_blocks($modules, $table_name, $table_fieldname, $table_fields, $table_parameters, $category); + //Creation of template per blocks + const_blocks_templates($modules, $table_name, $table_fieldname, $table_fields, $table_parameters); + } + //$class = ($class == 'even') ? 'odd' : 'even'; + } + $table_name = isset($table_name) ? $table_name : null; + $table_comments = isset($table_comments) ? $table_comments : null; + $table_waiting = isset($table_waiting) ? $table_waiting : null; + $table_parameters = isset($table_parameters) ? $table_parameters : null; + $table_user = isset($table_user) ? $table_user : null; + $table_admin = isset($table_admin) ? $table_admin : null; + $table_fields = isset($table_fields) ? $table_fields : null; + $table_blocks = isset($table_blocks) ? $table_blocks : null; + $table_image = isset($table_image) ? $table_image : null; + $table_permissions = isset($table_permissions) ? $table_permissions : null; + $table_notifications = isset($table_notifications) ? $table_notifications : null; + //Creation of architecture of more fields and data + //const_architecture(null, null, $table_admin, $table_blocks, $table_admin, $table_blocks ); + // Creation of comments + if ( $table_comments == 1 ) { + const_include_comments($modules, $table_name, $table_fieldname, $table_fields, $table_parameters); + } + + if ( $table_waiting == 1 ) { + // Creation of Waiting Plugin + const_waiting($modules, $tables_arr); + } + // Creation of class helper, module & request + if ( $table_name != '' ) { + const_class_helper($modules); + const_class_module($modules); + const_class_request($modules); + } + // Creation of xoopsversion.php + const_xoopsversion($modules, $table_name, $table_fields, $table_parameters, $table_image, $tables_arr); + // Creation of template index + const_templates_index($modules); + // Creation of template header + const_templates_header($modules, $tables_arr); + // Creation of template footer + const_templates_footer($modules, $table_comments, $table_notifications); + + if ( $table_admin == 1 ) { + // Creation of template admin about + const_templates_admin_about($modules); + // Creation of template admin help + const_templates_admin_help($modules); + } + // Include + /////////////////////////////////////////////////////////////////////// + // Configs + const_include_common($modules, $mod_author_website_name, $mod_author_website_url); + // Functions + const_include_functions($modules); + //Creation of file install per l'uploads + const_include_install($modules, $tables_arr); + // Language + /////////////////////////////////////////////////////////////////////// + if ( $mod_user == 1 ) { + //Creation of language main.php + const_main_language($modules, $tables_arr); + } + // Creation of language modinfo.php + const_modinfo_language($modules, $table_name, $table_image, $tables_arr, $mod_notifications); + if ( $table_admin == 1 ) { + // Creation of language admin.php + const_admin_language($modules, $tables_arr, $mod_permissions); + } + if ( $table_blocks == 1 ) { + // Creation of language blocks.php + const_blocks_language($modules, $tables_arr); + } + // Creation of language help/help.html + const_help_language($modules); + /////////////////////////////////////////////////////////////////////// + //Creation of style.css + const_css_style($modules); + /************************************************/ + /*Admin*/ + /************************************************/ + // Creation of admin header.php + const_admin_header($modules, $table_name, $tables_arr); + // Creation of admin index.php + const_admin_index($modules, $tables_arr); + // Creation of admin footer.php + const_admin_footer($modules); + // Creation of admin menu.php + const_admin_menu($modules, $tables_arr, $mod_permissions); + // Creation of admin about.php + const_admin_about($modules); + /************************************************/ + /*User*/ + /************************************************/ + if ( $mod_user == 1 ) { + const_user_header($modules); + const_user_index($modules); + const_user_footer($modules); + } + if ( $modules->getVar('mod_install') == 1 ) { + copyInRootModules($from_dir, $to_dir); + } + TDMCreate_CloseTable(); + break; + + case 'default': + default: + include_once(XOOPS_ROOT_PATH . '/class/xoopsformloader.php'); + $action = $_SERVER['REQUEST_URI']; + + $form = new XoopsThemeForm(_AM_TDMCREATE_ADMIN_CONST, 'buildform', $action, 'post', true); + + $mod_select = new XoopsFormSelect(_AM_TDMCREATE_CONST_MODULES, 'mod_name', 'mod_name'); + $mod_select->addOptionArray($modulesHandler->getList()); + $form->addElement($mod_select, true); + + $form->addElement(new XoopsFormHidden('op', 'build')); + $form->addElement(new XoopsFormButton(_REQUIRED.' <span class="red bold">*</span>', 'submit', _SUBMIT, 'submit')); + $form->display(); + break; +} +include 'footer.php'; \ No newline at end of file Added: XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/footer.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/footer.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/footer.php 2014-04-17 21:19:14 UTC (rev 12457) @@ -0,0 +1,26 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ +/** + * tdmcreate module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package tdmcreate + * @since 2.5.0 + * @author Txmod Xoops http://www.txmodxoops.org + * @version $Id: footer.php 12207 2013-10-23 02:46:52Z beckmi $ + */ +echo "<div align='center'><a href='http://www.xoops.org' title='Visit XOOPS' target='_blank'> + <img src='".$pathIcon32."/xoopsmicrobutton.gif' alt='XOOPS' /></a></div>"; +echo "<div class='center smallsmall italic pad5'> + <strong>" . $xoopsModule->getVar('name') . "</strong> is maintained by the + <a href='http://xoops.org/forums/newbb' title='Visit Support Forum' class='tooltip' rel='external'>Support Forum</a></div>"; +xoops_cp_footer(); \ No newline at end of file Added: XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/header.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/header.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/header.php 2014-04-17 21:19:14 UTC (rev 12457) @@ -0,0 +1,54 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ +/** + * tdmcreate module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package tdmcreate + * @since 2.5.0 + * @author Txmod Xoops http://www.txmodxoops.org + * @version $Id: header.php 12207 2013-10-23 02:46:52Z beckmi $ + */ +include_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php'; +include_once('../include/functions.php'); +include_once 'includes.php'; +// +$thisDirname = $GLOBALS['xoopsModule']->getVar('dirname'); +// +$pathIcon16 = '../' . $xoopsModule->getInfo('icons16'); +$pathIcon32 = '../' . $xoopsModule->getInfo('icons32'); +$pathModuleAdmin = $xoopsModule->getInfo('dirmoduleadmin'); + +// Get class handler +$modulesHandler =& xoops_getModuleHandler('modules', $thisDirname); +$tablesHandler =& xoops_getModuleHandler('tables', $thisDirname); +// +$myts =& MyTextSanitizer::getInstance(); +if (!isset($xoopsTpl) || !is_object($xoopsTpl)) { + include_once(XOOPS_ROOT_PATH."/class/template.php"); + $xoopsTpl = new XoopsTpl(); +} +// +$GLOBALS['xoopsTpl']->assign('pathIcon16', $pathIcon16); +$GLOBALS['xoopsTpl']->assign('pathIcon32', $pathIcon32); +//Load languages +xoops_loadLanguage('admin', $thisDirname); +xoops_loadLanguage('modinfo', $thisDirname); +xoops_loadLanguage('main', $thisDirname); +// Locad admin menu class +if ( file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))){ + include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'); +}else{ + redirect_header("../../../admin.php", 5, _AM_MODULEADMIN_MISSING, false); +} +xoops_cp_header(); +$adminMenu = new ModuleAdmin(); \ No newline at end of file Added: XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/includes.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/includes.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/includes.php 2014-04-17 21:19:14 UTC (rev 12457) @@ -0,0 +1,66 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ +/** + * tdmcreate module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package tdmcreate + * @since 2.5.0 + * @author Txmod Xoops http://www.txmodxoops.org + * @version $Id: includes.php 11084 2013-02-23 15:44:20Z timgno $ + */ +include '../../../include/cp_header.php'; +include_once("../include/functions.php"); + +$modPath = XOOPS_ROOT_PATH.'/modules/TDMCreate'; +$cPath = $modPath.'/const'; + +include_once $cPath.'/const_structure.php'; +include_once $cPath.'/const_xoopsversion.php'; +include_once $cPath.'/const_changelog.php'; +include_once $cPath.'/const_include_search.php'; +include_once $cPath.'/const_include_comments.php'; +include_once $cPath.'/const_include_notifications.php'; +include_once $cPath.'/const_include_common.php'; +include_once $cPath.'/const_include_functions.php'; +include_once $cPath.'/const_include_install.php'; +include_once $cPath.'/const_waiting.php'; +include_once $cPath.'/const_css_style.php'; +include_once $cPath.'/const_sql.php'; +include_once $cPath.'/const_blocks.php'; +include_once $cPath.'/const_blocks_templates.php'; +include_once $cPath.'/const_class.php'; +include_once $cPath.'/const_class_helper.php'; +include_once $cPath.'/const_class_request.php'; +include_once $cPath.'/const_class_module.php'; +include_once $cPath.'/const_admin_header.php'; +include_once $cPath.'/const_admin_footer.php'; +include_once $cPath.'/const_admin_menu.php'; +include_once $cPath.'/const_admin_index.php'; +include_once $cPath.'/const_admin_pages.php'; +include_once $cPath.'/const_admin_about.php'; +include_once $cPath.'/const_admin_permissions.php'; +include_once $cPath.'/const_admin_language.php'; +include_once $cPath.'/const_modinfo_language.php'; +include_once $cPath.'/const_help_language.php'; +include_once $cPath.'/const_blocks_language.php'; +include_once $cPath.'/const_main_language.php'; +include_once $cPath.'/const_user_header.php'; +include_once $cPath.'/const_user_index.php'; +include_once $cPath.'/const_user_pages.php'; +include_once $cPath.'/const_user_footer.php'; +include_once $cPath.'/const_templates_header.php'; +include_once $cPath.'/const_templates_index.php'; +include_once $cPath.'/const_templates_pages.php'; +include_once $cPath.'/const_templates_footer.php'; +include_once $cPath.'/const_templates_admin_about.php'; +include_once $cPath.'/const_templates_admin_help.php'; \ No newline at end of file Added: XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/index.html =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/index.html (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/index.html 2014-04-17 21:19:14 UTC (rev 12457) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/index.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/index.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/index.php 2014-04-17 21:19:14 UTC (rev 12457) @@ -0,0 +1,32 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ +/** + * tdmcreate module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package tdmcreate + * @since 2.5.0 + * @author Txmod Xoops http://www.txmodxoops.org + * @version $Id: index.php 11084 2013-02-23 15:44:20Z timgno $ + */ +include 'header.php'; + $criteria = new CriteriaCompo(); + $count_modules = $modulesHandler->getCount($criteria); + $count_tables = $tablesHandler->getCount($criteria); + +$adminMenu->addInfoBox(_AM_TDMCREATE_ADMIN_NUMMODULES) ; +$adminMenu->addInfoBoxLine(_AM_TDMCREATE_ADMIN_NUMMODULES, '<label>' ._AM_TDMCREATE_THEREARE_NUMMODULES. '</label>', $count_modules, 'Green') ; +$adminMenu->addInfoBoxLine(_AM_TDMCREATE_ADMIN_NUMMODULES, '<label>' ._AM_TDMCREATE_THEREARE_NUMTABLES. '</label>', $count_tables, 'Orange'); + + echo $adminMenu->addNavigation('index.php'); + echo $adminMenu->renderIndex(); +include 'footer.php'; \ No newline at end of file Added: XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/menu.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/menu.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/menu.php 2014-04-17 21:19:14 UTC (rev 12457) @@ -0,0 +1,46 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ +/** + * tdmcreate module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package tdmcreate + * @since 2.5.0 + * @author Txmod Xoops http://www.txmodxoops.org + * @version $Id: menu.php 11084 2013-02-23 15:44:20Z timgno $ + */ +$module_handler =& xoops_gethandler('module'); +$xoopsModule =& XoopsModule::getByDirname('TDMCreate'); +$moduleInfo =& $module_handler->get($xoopsModule->getVar('mid')); +$pathIcon32 = $moduleInfo->getInfo('icons32'); +$adminmenu = array(); +$i = 1; +$adminmenu[$i]["title"] = _MI_TDMCREATE_ADMIN_INDEX; +$adminmenu[$i]["link"] = 'admin/index.php'; +$adminmenu[$i]["icon"] = $pathIcon32.'/home.png'; +$i++; +$adminmenu[$i]["title"] = _MI_TDMCREATE_ADMIN_MODULES; +$adminmenu[$i]["link"] = 'admin/modules.php'; +$adminmenu[$i]["icon"] = 'images/icons/32/addmodule.png'; +$i++; +$adminmenu[$i]["title"] = _MI_TDMCREATE_ADMIN_TABLES; +$adminmenu[$i]["link"] = 'admin/tables.php'; +$adminmenu[$i]["icon"] = 'images/icons/32/addtable.png'; +$i++; +$adminmenu[$i]["title"] = _MI_TDMCREATE_ADMIN_CONST; +$adminmenu[$i]["link"] = 'admin/building.php'; +$adminmenu[$i]["icon"] = 'images/icons/32/builder.png'; +$i++; +$adminmenu[$i]["title"] = _MI_TDMCREATE_ADMIN_ABOUT; +$adminmenu[$i]["link"] = 'admin/about.php'; +$adminmenu[$i]["icon"] = $pathIcon32.'/about.png'; +unset($i); \ No newline at end of file Added: XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/modules.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/modules.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/modules.php 2014-04-17 21:19:14 UTC (rev 12457) @@ -0,0 +1,188 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ +/** + * tdmcreate module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package tdmcreate + * @since 2.5.0 + * @author Txmod Xoops http://www.txmodxoops.org + * @version $Id: modules.php 11084 2013-02-23 15:44:20Z timgno $ + */ +include_once 'header.php'; +$op = TDMCreate_CleanVars( $_REQUEST, 'op', 'list', 'string' ); +echo $adminMenu->addNavigation('modules.php'); +switch ($op) +{ + case 'save': + if (!$GLOBALS['xoopsSecurity']->check()) { + redirect_header('modules.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + } + + if (isset($_REQUEST['mod_id'])) { + $obj =& $modulesHandler->get($_REQUEST['mod_id']); + } else { + $obj =& $modulesHandler->create(); + } + //Image 'gif|jpeg|pjpeg|png' 500000 + include_once XOOPS_ROOT_PATH.'/class/uploader.php'; + $uploaddir = XOOPS_ROOT_PATH . '/modules/'.$xoopsModule->dirname().'/images/uploads/modules/'; + $uploader = new XoopsMediaUploader($uploaddir, xoops_getModuleOption('mimetypes', $thisDirname), + xoops_getModuleOption('maxsize', $thisDirname), null, null); + + if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { + $extension = preg_replace( '/^.+\.([^.]+)$/sU' , '\\1' , $_FILES['attachedfile']['name']) ; + $img_name = $obj->getVar('mod_name').'_slogo.'.$extension; + $uploader->setTargetFileName($img_name); + $uploader->fetchMedia($_POST['xoops_upload_file'][0]); + if (!$uploader->upload()) { + $errors = $uploader->getErrors(); + redirect_header('javascript:history.go(-1)', 3, $errors); + } else { + $obj->setVar('mod_image', $uploader->getSavedFileName()); + } + } else { + $obj->setVar('mod_image', $_POST['mod_image']); + } + + $obj->setVar('mod_name', preg_replace('/\s+/', '', $_POST['mod_name'])); //remove all spaces from the new name + $obj->setVar('mod_version', $_POST['mod_version']); + $obj->setVar('mod_since', $_POST['mod_since']); + $obj->setVar('mod_min_php', $_POST['mod_min_php']); + $obj->setVar('mod_min_xoops', $_POST['mod_min_xoops']); + $obj->setVar('mod_min_admin', $_POST['mod_min_admin']); + $obj->setVar('mod_min_mysql', $_POST['mod_min_mysql']); + $obj->setVar('mod_description', $_POST['mod_description']); + $obj->setVar('mod_author', $_POST['mod_author']); + $obj->setVar('mod_author_mail', $_POST['mod_author_mail']); + $obj->setVar('mod_author_website_url', $_POST['mod_author_website_url']); + $obj->setVar('mod_author_website_name', $_POST['mod_author_website_name']); + $obj->setVar('mod_credits', $_POST['mod_credits']); + $obj->setVar('mod_license', $_POST['mod_license']); + $obj->setVar('mod_release_info', $_POST['mod_release_info']); + $obj->setVar('mod_release_file', $_POST['mod_release_file']); + $obj->setVar('mod_manual', $_POST['mod_manual']); + $obj->setVar('mod_manual_file', $_POST['mod_manual_file']); + $obj->setVar('mod_demo_site_url', $_POST['mod_demo_site_url']); + $obj->setVar('mod_demo_site_name', $_POST['mod_demo_site_name']); + $obj->setVar('mod_support_url', $_POST['mod_support_url']); + $obj->setVar('mod_support_name', $_POST['mod_support_name']); + $obj->setVar('mod_website_url', $_POST['mod_website_url']); + $obj->setVar('mod_website_name', $_POST['mod_website_name']); + $obj->setVar('mod_release', $_POST['mod_release']); + $obj->setVar('mod_status', $_POST['mod_status']); + $obj->setVar('mod_admin', $_REQUEST['mod_admin']); + $obj->setVar('mod_user', $_REQUEST['mod_user']); + $obj->setVar('mod_search', $_REQUEST['mod_search']); + $obj->setVar('mod_comments', $_REQUEST['mod_comments']); + $obj->setVar('mod_notifications', $_REQUEST['mod_notifications']); + $obj->setVar('mod_permissions', $_REQUEST['mod_permissions']); + $obj->setVar('mod_install', $_REQUEST['mod_install']); + $obj->setVar('mod_donations', $_POST['mod_donations']); + $obj->setVar('mod_subversion', $_POST['mod_subversion']); + + if ($modulesHandler->insert($obj)) { + redirect_header('modules.php?op=list', 2, _AM_TDMCREATE_FORMOK); + } + break; + + case 'new': + $GLOBALS['xoTheme']->addScript('modules/TDMCreate/js/functions.js'); + $adminMenu->addItemButton(_AM_TDMCREATE_MODULES_LIST, 'modules.php?op=list', 'list'); + echo $adminMenu->renderButton(); + + $obj =& $modulesHandler->create(); + $form = $obj->getForm(); + break; + case 'edit': + $GLOBALS['xoTheme']->addScript('modules/TDMCreate/js/functions.js'); + $obj =& $modulesHandler->get($_REQUEST['mod_id']); + $form = $obj->getForm(); + break; + case 'delete': + $obj =& $modulesHandler->get($_REQUEST['mod_id']); + if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) + { + if (!$GLOBALS['xoopsSecurity']->check()) { + redirect_header('modules.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + } + if ($modulesHandler->delete($obj)) { + $xoopsDB->queryF("DELETE FROM ".$xoopsDB->prefix("tdmcreate_modules")." WHERE mod_id = ".$_REQUEST['mod_id']); + redirect_header('modules.php', 3, _AM_TDMCREATE_FORMDELOK); + } else { + echo $obj->getHtmlErrors(); + } + } else { + xoops_confirm(array('ok' => 1, 'mod_id' => $_REQUEST['mod_id'], 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_TDMCREATE_FORMSUREDEL, $obj->getVar('mod_name'))); + } + break; + case 'list': + default: + $adminMenu->addItemButton(_AM_TDMCREATE_MODULES_NEW, 'modules.php?op=new', 'add'); + echo $adminMenu->renderButton(); + + $criteria = new CriteriaCompo(); + $criteria->setSort('mod_id'); + $criteria->setOrder('ASC'); + $mod_arr = $modulesHandler->getall($criteria); + $numrows_modules = $modulesHandler->getCount(); + + if ( $numrows_modules > 0 ) + { + echo '<table width="100%" cellspacing="1" class="outer">'; + echo '<tr class="center">'; + echo '<th width="1%">'._AM_TDMCREATE_ID.'</th>'; + echo '<th width="10%">'._AM_TDMCREATE_NAME.'</th>'; + echo '<th width="10%">'._AM_TDMCREATE_IMAGE.'</th>'; + echo '<th width="15%">'._AM_TDMCREATE_DISPLAY_ADMIN.'</th>'; + echo '<th width="15%">'._AM_TDMCREATE_DISPLAY_USER.'</th>'; + echo '<th width="1%">'._AM_TDMCREATE_FORMACTION.'</th>'; + echo '</tr>'; + $class = 'odd'; + foreach (array_keys($mod_arr) as $i) + { + $mod_id = $mod_arr[$i]->getVar('mod_id'); + $mod_name = $mod_arr[$i]->getVar('mod_name'); + $mod_image = $mod_arr[$i]->getVar('mod_image'); + //$mod_blocks = $mod_arr[$i]->getVar('mod_blocks'); + $mod_admin = $mod_arr[$i]->getVar('mod_admin'); + $mod_user = $mod_arr[$i]->getVar('mod_user'); + $admin = ($mod_admin == 1) ? _YES : _NO; + $user = ($mod_user == 1) ? _YES : _NO; + echo '<tr class="odd center">'; + echo '<td><b>'.$i.'</b></td>'; + $nbsps = ' '; + echo '<td class="left">'.$nbsps.'<img src="../images/icons/16/arrow.gif" alt="Arrow" />'.$nbsps.'<b>'.$mod_name.'</b></td>'; + echo '<td><img src="../images/uploads/modules/'.$mod_image.'" height="30px" /></td>'; + echo '<td>'.$admin.'</td>'; + echo '<td>'.$user.'</td>'; + echo '<td>'; + echo '<a href="modules.php?op=edit&mod_id='.$mod_id.'"><img src="'. $pathIcon16 .'/edit.png" alt="'._EDIT.'" title="'._EDIT.'" /></a> <a href="modules.php?op=delete&mod_id='.$mod_id.'"><img src="'. $pathIcon16 .'/delete.png" alt="'._DELETE.'" title="'._DELETE.'" /></a>'; + echo '</td>'; + echo '</tr>'; + } + echo '</table><br><br>'; + } else { + echo '<table width="100%" cellspacing="1" class="outer">'; + echo '<tr class="center">'; + echo '<th width="1%">'._AM_TDMCREATE_ID.'</th>'; + echo '<th width="10%">'._AM_TDMCREATE_NAME.'</th>'; + echo '<th width="10%">'._AM_TDMCREATE_IMAGE.'</th>'; + echo '<th width="15%">'._AM_TDMCREATE_DISPLAY_ADMIN.'</th>'; + echo '<th width="15%">'._AM_TDMCREATE_DISPLAY_USER.'</th>'; + echo '<th width="1%">'._AM_TDMCREATE_FORMACTION.'</th>'; + echo '<tr><td class="errorMsg" colspan="8">No modules</td></tr>'; + echo '</tr></table><br><br>'; + } + break; +} +include_once 'footer.php'; \ No newline at end of file Added: XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/tables.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/tables.php (rev 0) +++ XoopsModules/TDMCreate/branches/timgno/1.42/TDMCreate/admin/tables.php 2014-04-17 21:19:14 UTC (rev 12457) @@ -0,0 +1,486 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ +/** + * tdmcreate module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package tdmcreate + * @since 2.5.0 + * @author Txmod Xoops http://www.txmodxoops.org + * @version $Id: tables.php 11084 2013-02-23 15:44:20Z timgno $ + */ +include_once 'header.php'; +$op = TDMCreate_CleanVars( $_REQUEST, 'op', 'default', 'string' ); +$table_id = TDMCreate_CleanVars( $_REQUEST, 'table_id', 0 ); +echo $adminMenu->addNavigation('tables.php'); +switch ($op) { + case 'save_table': + if (isset($_REQUEST['table_id'])) { + $obj =& $tablesHandler->get($_REQUEST['table_id']); + } else { + $obj =& $tablesHandler->create(); + } + + $obj->setVar('table_mid', $_REQUEST['table_mid']); + + if ( $_REQUEST['select'] == 1 ) + { + $obj->setVar('table_name', 'categories'); + $obj->setVar('table_category', 1); + $obj->setVar('table_fieldname', 'cat'); + $obj->setVar('table_blocks', 0); + $obj->setVar('table_admin', 1); + $obj->setVar('table_user', 1); + $obj->setVar('table_status', 0); + $obj->setVar('table_waiting', 0); + $obj->setVar('table_online', 0); + $obj->setVar('table_search', 0); + $obj->setVar('table_comments', 0); + $obj->setVar('table_notifications', 0); + $obj->setVar('table_permissions', 0); + $obj->setVar('table_nbfields', 7); + + $table_fields = 'cat_id:int:8:unsigned:NOT NULL: :primary|cat_pid:int:5:unsigned:NOT NULL:0:unique|cat_title:varchar:255: :NOT NULL: :unique|cat_desc:text: : :NOT NULL: :|cat_image:varchar:255: :NOT NULL: :|cat_weight:int:5:unsigned:NOT NULL:0:|cat_color:varchar:10: :NULL: :'; + + $table_parameters = 'XoopsFormCategory:0:0:0:0:0:1|XoopsFormText:1:1:0:1:0:1|XoopsFormTextArea:0:1:0:0:0:1|XoopsFormUploadImage:1:1:0:0:0:0|XoopsFormText:1:1:0:0:0:0|XoopsFormColorPicker:1:1:0:0:0:0|XoopsFormSelectUser:0:0:0:0:0:1|XoopsFormTextDateSelect:0:0:0:0:0:1|XoopsFormCheckBox:1:1:0:0:0:1'; + + //Image + include_once XOOPS_ROOT_PATH.'/class/uploader.php'; + + if(is_dir($pathIcon32)){ + $uploaddir = $pathIcon32; + }else{ + $uploaddir = XOOPS_ROOT_PATH . "/modules/".$xoopsModule->dirname()."/images/uploads/tables/"; + } + + $uploader = new XoopsMediaUploader($uploaddir, "gif|jpeg|pjpeg|png", 104857600, null, null); + + if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { + $extension = preg_replace( "/^.+\.([^.]+)$/sU" , "\\1" , $_FILES["attachedfile1"]['name']) ; + $name_img = 'category.'.$extension; + $uploader->setTargetFileName($name_img); + $uploader->fetchMedia($_POST['xoops_upload_file'][0]); + if (!$uploader->upload()) { + $errors = $uploader->getErrors(); + redirect_header("javascript:history.go(-1)",3, $errors); + } else { + $obj->setVar('table_image', $uploader->getSavedFileName()); + } + } else { + $obj->setVar('table_image', $_REQUEST['table_image1']); + } + } else { + + $obj->setVar('table_name', strtolower($_REQUEST['table_name'])); + $obj->setVar('table_fieldname', strtolower($_REQUEST['table_fieldname'])); + $obj->setVar('table_nbfields', $_REQUEST['table_nbfields']); + $obj->setVar('table_blocks', $_REQUEST['table_blocks']); + $obj->setVar('table_admin', $_REQUEST['table_admin']); + $obj->setVar('table_user', $_REQUEST['table_user']); + $obj->setVar('table_status', $_REQUEST['table_status']); + $obj->setVar('table_waiting', $_REQUEST['table_waiting']); + $obj->setVar('table_online', $_REQUEST['table_online']); + $obj->setVar('table_search', $_REQUEST['table_search']); + $obj->setVar('table_comments', $_REQUEST['table_comments']); + $obj->setVar('table_notifications', $_REQUEST['table_notifications']); + $obj->setVar('table_permissions', $_REQUEST['table_permissions']); + + $table_fields = ''; + $table_parameters = ''; + for($i=0; $i<$_REQUEST['table_nbfields']; $i++) + { + //Additions of parameters: text: on: off: ... + if ( $i != 0 ) { + $table_parameters .= ( !empty($_REQUEST['fields_param_elements'][$i]) ) ? "".$_REQUEST['fields_param_elements'][$i].":" : " :"; + $table_parameters .= ( !empty($_REQUEST['fields_param_admin'][$i]) ) ? "1:" : "0:"; + $table_parameters .= ( !empty($_REQUEST['fields_param_user'][$i]) ) ? "1:" : "0:"; + $table_parameters .= ( !empty($_REQUEST['fields_param_blocks'][$i]) ) ? "1:" : "0:"; + $table_parameters .= ( $i == $_REQUEST['fields_param_main_field']) ? "1:" : "0:"; + $table_parameters .= ( !empty($_REQUEST['fields_param_search_field'][$i]) ) ? "1:" : "0:"; + $table_parameters .= ( !empty($_REQUEST['fields_param_required_field'][$i]) ) ? "1" : "0"; + } + + //Additions of fields: test: int: 4: ... + $table_fields .= (!empty($_REQUEST['fields_name'][$i])) ? $_REQUEST['fields_name'][$i].":" : " :"; + $table_fields .= (!empty($_REQUEST['fields_type'][$i])) ? $_REQUEST['fields_type'][$i].":" : " :"; + $table_fields .= (!empty($_REQUEST['fields_value'][$i])) ? $_REQUEST['fields_value'][$i].":" : " :"; + $table_fields .= (!empty($_REQUEST['fields_attributes'][$i])) ? $_REQUEST['fields_attributes'][$i].":" : " :"; + $table_fields .= (!empty($_REQUEST['fields_null'][$i])) ? strtoupper($_REQUEST['fields_null'][$i]).":" : " :"; + $table_fields .= (!empty($_REQUEST['fields_default'][$i])) ? $_REQUEST['fields_default'][$i].":" : " :"; + $table_fields .= (!empty($_REQUEST['fields_index'][$i])) ? $_REQUEST['fields_index'][$i]."" : " "; + + // Break between fields and between the parameters + if ( $i != $_REQUEST['table_nbfields'] - 1) { + $table_fields .= '|'; + if ( $i != 0 ) + $table_parameters .= '|'; + } else { + if ( isset($_REQUEST['table_status']) ) { + if ( $_REQUEST['table_status'] == 1 ) { + $table_fields .= '|'.strtolower($_REQUEST['table_fieldname']).'_status:int:10:unsigned:NOT NULL:0:'; + $table_parameters .= '|XoopsFormCheckBox:1:1:1:0:0:1'; + } + } else { + $table_fields .= ''; + $table_parameters .= ''; + } + if ( isset($_REQUEST['table_waiting']) ) { + if ( $_REQUEST['table_waiting'] == 1 ) { + $table_fields .= '|'.strtolower($_REQUEST['table_fieldname']).'_waiting:int:10:unsigned:NOT NULL:0:'; + $table_parameters .= '|XoopsFormCheckBox:1:1:1:0:0:1'; + } + } else { + $table_fields .= ''; + $table_parameters .= ''; + } + if ( isset($_REQUEST['table_online']) ) { + if ( $_REQUEST['table_online'] == 1 ) { + $table_fields .= '|'.strtolower($_REQUEST['table_fieldname']).'_online:tinyint:1: unsigned:NOT NULL:0:'; $table_parameters .= '|XoopsFormCheckBox:1:1:1:0:0:1'; + } + } else { + $table_fields .= ''; + $table_parameters .= ''; + } + } + } + } + $obj->setVar('table_fields', $table_fields); + $obj->setVar('table_parameters', $table_parameters); + + if ($tablesHandler->insert($obj)) { + redirect_header('tables.php', 2, _AM_TDMCREATE_FORMOK); + } + + break; + + case 'table_save_fields': + if (!$GLOBALS['xoopsSecurity']->check()) { + redirect_header('tables.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + } + + if (isset($_REQUEST['table_id'])) { + $obj =& $tablesHandler->get($_REQUEST['table_id']); + } else { + $obj =& $tablesHandler->create(); + } + + //Image + include_once XOOPS_ROOT_PATH.'/class/uploader.php'; + if(is_dir($pathIcon32)){ + $uploaddir = $pathIcon32; + }else{ + $uploaddir = XOOPS_ROOT_PATH . '/modules/'.$xoopsModule->dirname().'/images/uploads/tables/'; + } + $uploader = new XoopsMediaUploader($uploaddir, 'gif|jpeg|pjpeg|png', 104857600, null, null); + + if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { + $extension = preg_replace( '/^.+\.([^.]+)$/sU' , '\\1' , $_FILES['attachedfile']['name']); + $name_img = $_REQUEST['table_name'].'.'.$extension; + $uploader->setTargetFileName($name_img); + $uploader->fetchMedia($_POST['xoops_upload_file'][0]); + if (!$uploader->upload()) { + $errors = $uploader->getErrors(); + redirect_header('javascript:history.go(-1)', 3, $errors); + } else { + $obj->setVar('table_image', $uploader->getSavedFileName()); + } + } else { + $obj->setVar('table_image', $_REQUEST['table_image']); + } + + + $oldname = $obj->getVar('table_fieldname'); + + $obj->setVar('table_mid', strtolower($_POST['table_mid'])); + $obj->setVar('table_name', strtolower($_POST['table_name'])); + $obj->setVar('table_fieldname', strtolower($_POST['table_fieldname'])); + $obj->setVar('table_nbfields', $_POST['table_nbfields']); + $obj->setVar('table_blocks', $_REQUEST['table_blocks']); + $obj->setVar('table_admin', $_REQUEST['table_admin']); + $obj->setVar('table_user', $_REQUEST['table_user']); + $obj->setVar('table_status', $_REQUEST['table_status']); + $obj->setVar('table_waiting', $_REQUEST['table_waiting']); + $obj->setVar('table_online', $_REQUEST['table_online']); + $obj->setVar('table_search', $_REQUEST['table_search']); + $obj->setVar('table_comments', $_REQUEST['table_comments']); + $obj->setVar('table_notifications', $_REQUEST['table_notifications']); + $obj->setVar('table_permissions', $_REQUEST['table_permissions']); + + $table_fields = $obj->getVar('table_fields'); + $table_nbfields=$_REQUEST['table_nbfields']; + + $fields_total = explode('|', $table_fields); + $count_fields = count($fields_total); + + $newname = strtolower($_REQUEST['table_fieldname']); + //echo $count_parameters; + //fields + for($i=0; $i<$count_fields; $i++) + { + $fields = explode(":", $fields_total[$i]); + $fields[0] = $newname . substr($fields[0], stripos($fields[0], '_')); + $newfields[$i] = implode(":", $fields); + } + + $newTableFields=implode("|",$newfields); + $obj->setVar('table_fields', $newTableFields); + + if ($tablesHandler->insert($obj)) { + redirect_header('tables.php', 2, _AM_TDMCREATE_FORMOK); + } + break; + + case "edit_table": + $GLOBALS['xoTheme']->addScript('modules/TDMCreate/js/functions.js'); + $table_id = TDMCreate_CleanVars( $_REQUEST, 'table_id', 0); + $table_mid = TDMCreate_CleanVars( $_REQUEST, 'table_mid', 0); + $obj =& $tablesHandler->get($_REQUEST['table_id']); + $form = $obj->getFormTable(false, $_REQUEST['table_id'], $_REQUEST['table_mid']); + break; + + case "edit_fields": + $obj =& $tablesHandler->get($_REQUEST['table_id']); + $table_id = TDMCreate_CleanVars( $_REQUEST, 'table_id', 0); + $form = $obj->getFormEditFields(false, $_REQUEST['table_id']); + break; + + case "delete_table": + $table_id = TDMCreate_CleanVars( $_REQUEST, 'table_id', 0); + $obj =& $tablesHandler->get($table_id); + if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) { + if (!$GLOBALS['xoopsSecurity']->check()) { + redirect_header('tables.php', 3, impl... [truncated message content] |