|
From: <txm...@us...> - 2013-02-20 22:12:14
|
Revision: 11084
http://sourceforge.net/p/xoops/svn/11084
Author: txmodxoops
Date: 2013-02-20 22:12:11 +0000 (Wed, 20 Feb 2013)
Log Message:
-----------
Needed re-installation
Updated
Test
Modified Paths:
--------------
XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/fields.php
XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/header.php
XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/import.php
XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/modules.php
XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/tables.php
XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/class/form/fields.php
XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/class/form/modules.php
XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/include/functions.php
XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/sql/mysql.sql
XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/templates/admin/tdmcreate_fields.html
XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/templates/admin/tdmcreate_modules.html
XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/templates/admin/tdmcreate_tables.html
Removed Paths:
-------------
XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/extensions.php
XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/class/extensions.php
XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/class/form/extensions.php
XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/templates/admin/tdmcreate_fields_form.html
Deleted: XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/extensions.php
===================================================================
--- XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/extensions.php 2013-02-20 20:29:40 UTC (rev 11083)
+++ XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/extensions.php 2013-02-20 22:12:11 UTC (rev 11084)
@@ -1,182 +0,0 @@
-<?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.6.0
- * @author XOOPS Development Team
- * @version $Id: extensions.php 10665 2012-12-27 10:14:15Z timgno $
- */
-include dirname(__FILE__) . '/header.php';
-// Preferences Limit
-$nb_pager = $xoops->getModuleConfig('pager');
-// Get Action type
-$op = $system->cleanVars($_REQUEST, 'op', 'list', 'string');
-// Get limit pager
-$limit = $system->cleanVars($_REQUEST, 'limit', 0, 'int');
-// Get start pager
-$start = $system->cleanVars($_REQUEST, 'start', 0, 'int');
-// heaser
-$xoops->header('tdmcreate_extensions.html');
-// Get handler
-/* @var $extensions_handler TDMCreateExtensionsHandler */
-$extensions_Handler = $xoops->getModuleHandler('extensions');
-
-$admin_menu->renderNavigation('extensions.php');
-switch ($op)
-{
- case 'list':
- default:
- $admin_menu->addItemButton(TDMCreateLocale::ADD_EXTENSION, 'extensions.php?op=new', 'add');
- $admin_menu->renderButton();
- $criteria = new CriteriaCompo();
- $criteria->setSort('ext_name');
- $criteria->setOrder('ASC');
- $criteria->setStart($start);
- $criteria->setLimit($limit);
- $numrows_exts = $extensions_Handler->getCount($criteria);
- $exts_arr = $extensions_Handler->getAll($criteria);
- $xoops->tpl()->assign('extensions_count', $numrows_exts);
- unset($criteria);
- if ($numrows_exts > 0) {
- foreach (array_keys($exts_arr) as $i) {
- $ext['id'] = $exts_arr[$i]->getVar('ext_id');
- $ext['name'] = $exts_arr[$i]->getVar('ext_name');
- $ext['version'] = $exts_arr[$i]->getVar('ext_version');
- $ext['image'] = $exts_arr[$i]->getVar('ext_image');
- $ext['release'] = $exts_arr[$i]->getVar('ext_release');
- $ext['status'] = $exts_arr[$i]->getVar('ext_status');
- $ext['admin'] = $exts_arr[$i]->getVar('ext_admin');
- $ext['user'] = $exts_arr[$i]->getVar('ext_user');
- $ext['submenu'] = $exts_arr[$i]->getVar('ext_submenu');
- $ext['search'] = $exts_arr[$i]->getVar('ext_search');
- $ext['comments'] = $exts_arr[$i]->getVar('ext_comments');
- $ext['notifications'] = $exts_arr[$i]->getVar('ext_notifications');
- $xoops->tpl()->append_by_ref('extensions', $ext);
- unset($ext);
- }
- // Display Page Navigation
- if ($numrows_exts > $nb_pager) {
- $nav = new XoopsPageNav($numrows_exts, $nb_pager, $start, 'start');
- $xoops->tpl()->assign('pagenav', $nav->renderNav(4));
- }
- } else {
- $xoops->tpl()->assign('error_message', TDMCreateLocale::E_NO_EXTENSIONS);
- }
- break;
-
- case 'new':
- $admin_menu->addItemButton(TDMCreateLocale::EXTENSIONS_LIST, 'extensions.php', 'application-view-detail');
- $admin_menu->renderButton();
-
- $obj = $extensions_Handler->create();
- $form = $xoops->getModuleForm($obj, 'extensions');
- $xoops->tpl()->assign('form', $form->render());
- break;
-
- case 'save':
- if (!$xoops->security()->check()) {
- $xoops->redirect('extensions.php', 3, implode(',', $xoops->security()->getErrors()));
- }
- $id = $system->cleanVars($_REQUEST, 'ext_id', 0, 'int');
- if ($id > 0) {
- $obj = $extensions_Handler->get($id);
- } else {
- $obj = $extensions_Handler->create();
- }
- //Form extension save
- $obj->setVars(array('ext_name' => $_POST['ext_name'], 'ext_version' => $_POST['ext_version'],
- 'ext_description' => $_POST['ext_description'], 'ext_author' => $_POST['ext_author'],
- 'ext_author_mail' => $_POST['ext_author_mail'], 'ext_author_website_url' => $_POST['ext_author_website_url'],
- 'ext_author_website_name' => $_POST['ext_author_website_name'], 'ext_credits' => $_POST['ext_credits'],
- 'ext_license' => $_POST['ext_license'], 'ext_release_info' => $_POST['ext_release_info'],
- 'ext_release_file' => $_POST['ext_release_file'], 'ext_manual' => $_POST['ext_manual'],
- 'ext_manual_file' => $_POST['ext_manual_file']));
-
- //Form extension_image
- $uploader = new XoopsMediaUploader( TDMC_EXTENSIONS_PATH_IMG, $xoops->getModuleConfig('mimetypes'),
- $xoops->getModuleConfig('maxuploadsize'), null, null);
- if ($uploader->fetchMedia($_POST['extensions_image'][0])) {
- $extension = preg_replace( "/^.+\.([^.]+)$/sU" , "\\1" , $_FILES['extensions_image']['name']);
- $name_img = 'logo.'.$extension;
- $uploader->setPrefix($name_img);
- $uploader->fetchMedia($_POST['extensions_image'][0]);
- if (!$uploader->upload()) {
- $xoops->redirect('javascript:history.go(-1)',3, $uploader->getErrors());
- } else {
- $obj->setVar('ext_image', $uploader->getSavedFileName());
- }
- } else {
- if ($_POST['extensions_image'] == 'blank.gif') {
- $obj->setVar('ext_image', $_POST['ext_image']);
- } else {
- $obj->setVar('ext_image', $_POST['extensions_image']);
- }
- }
-
- //Form extension save
- $obj->setVars(array('ext_demo_site_url' => $_POST['ext_demo_site_url'], 'ext_demo_site_name' => $_POST['ext_demo_site_name'],
- 'ext_forum_site_url' => $_POST['ext_forum_site_url'], 'ext_forum_site_name' => $_POST['ext_forum_site_name'],
- 'ext_website_url' => $_POST['ext_website_url'], 'ext_website_name' => $_POST['ext_website_name'],
- 'ext_release' => $_POST['ext_release'], 'ext_status' => $_POST['ext_status'],
- 'ext_admin' => (($_REQUEST['ext_admin'] == 1) ? '1' : '0'),
- 'ext_user' => (($_REQUEST['ext_user'] == 1) ? '1' : '0'),
- 'ext_submenu' => (($_REQUEST['ext_submenu'] == 1) ? '1' : '0'),
- 'ext_search' => (($_REQUEST['ext_search'] == 1) ? '1' : '0'),
- 'ext_comments' => (($_REQUEST['ext_comments'] == 1) ? '1' : '0'),
- 'ext_notifications' => (($_REQUEST['ext_notifications'] == 1) ? '1' : '0'),
- 'ext_paypal' => $_POST['ext_paypal'],
- 'ext_subversion' => $_POST['ext_subversion']));
- // Insert Data
- if ($extensions_Handler->insert($obj)) {
- $xoops->redirect('extensions.php?op=list', 2, XoopsLocale::S_DATA_INSERTED);
- }
- // Form Data
- $xoops->error($obj->getHtmlErrors());
- $form = $xoops->getModuleForm($obj, 'extensions');
- $xoops->tpl()->assign('form', $form->render());
- break;
-
- case 'edit':
- $admin_menu->addItemButton(TDMCreateLocale::EXTENSION_ADD, 'extensions.php?op=new', 'add');
- $admin_menu->addItemButton(TDMCreateLocale::EXTENSIONS_LIST, 'extensions.php', 'application-view-detail');
- $admin_menu->renderButton();
-
- $obj = $extensions_Handler->get($system->cleanVars($_REQUEST, 'ext_id', 0, 'int'));
- $form = $xoops->getModuleForm($obj, 'extensions');
- $xoops->tpl()->assign('form', $form->render());
- break;
-
- case 'delete':
- $id = $system->cleanVars($_REQUEST, 'ext_id', 0, 'int');
- if ($id != 0) {
- $obj = $extensions_Handler->get($id);
- if (isset($_POST['ok']) && $_POST['ok'] == 1) {
- if (!$xoops->security()->check()) {
- $xoops->redirect('extensions.php', 3, implode(',', $xoops->security()->getErrors()));
- }
- if ($extensions_Handler->delete($obj)) {
- $xoops->redirect('extensions.php', 2, sprintf(TDMCreateLocale::S_DELETED, TDMCreateLocale::EXTENSION));
- } else {
- $xoops->error($obj->getHtmlErrors());
- }
- } else {
- $xoops->confirm(array('ok' => 1, 'id' => $id, 'op' => 'delete'), 'extensions.php', sprintf(TDMCreateLocale::QF_ARE_YOU_SURE_TO_DELETE, $obj->getVar('ext_name')) . '<br />');
- }
- } else {
- $xoops->redirect('extensions.php', 1, TDMCreateLocale::E_DATABASE_ERROR);
- }
- break;
-}
-$xoops->footer();
\ No newline at end of file
Modified: XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/fields.php
===================================================================
--- XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/fields.php 2013-02-20 20:29:40 UTC (rev 11083)
+++ XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/fields.php 2013-02-20 22:12:11 UTC (rev 11084)
@@ -62,12 +62,14 @@
// Assign Template variables
$xoops->tpl()->assign('fields_list', true);
$xoops->tpl()->assign('fields_count', $numrows_fields);
- $mytree = new XoopsObjectTree($table_arr, 'table_id', 'table_mid');
+ /*$mytree = new XoopsObjectTree($table_arr, 'table_id', 'table_mid');
+ tdmcreate_getPathTree($mytree, $table_arr[$i]->getVar('table_mid'), $table_arr, 'table_name');*/
if ($numrows_tables > 0) {
foreach (array_keys($table_arr) as $i) {
$tables['id'] = $table_arr[$i]->getVar('table_id');
$tables['name'] = $table_arr[$i]->getVar('table_name');
- $tables['mid'] = tdmcreate_getPathTree($mytree, $table_arr[$i]->getVar('table_mid'), $table_arr, 'table_name');
+ $module_name = $modules_Handler->get($table_arr[$i]->getVar('table_mid'));
+ $tables['mid'] = $module_name->getVar('mod_name');
$tables['image'] = $table_arr[$i]->getVar('table_image');
$tables['nbfields'] = $table_arr[$i]->getVar('table_nbfields');
$tables['blocks'] = $table_arr[$i]->getVar('table_blocks');
@@ -78,28 +80,28 @@
$tables['comments'] = $table_arr[$i]->getVar('table_comments');
$tables['notifications'] = $table_arr[$i]->getVar('table_notifications');
$xoops->tpl()->append_by_ref('tables', $tables);
- unset($tables);
- if ($numrows_fields > 0) {
- foreach (array_keys($field_arr) as $i) {
- $field['id'] = $field_arr[$i]->getVar('field_id');
- $table_name = $tables_Handler->get($field_arr[$i]->getVar('field_tid'));
- $field['tid'] = $table_name->getVar('table_name');
- $field['name'] = $field_arr[$i]->getVar('field_name');
- $field['type'] = $field_arr[$i]->getVar('field_type');
- $field['value'] = $field_arr[$i]->getVar('field_value');
- $field['blocks'] = $field_arr[$i]->getVar('field_blocks');
- $field['attribute'] = $field_arr[$i]->getVar('field_attribute');
- $field['default'] = $field_arr[$i]->getVar('field_default');
- $field['key'] = $field_arr[$i]->getVar('field_key');
- $field['auto_increment'] = $field_arr[$i]->getVar('field_auto_increment');
- $field['blocks'] = $field_arr[$i]->getVar('field_blocks');
- $field['search'] = $field_arr[$i]->getVar('field_search');
- $field['required'] = $field_arr[$i]->getVar('field_required');
- $xoops->tpl()->append_by_ref('fields', $field);
- unset($field);
- }
+ unset($tables);
+ }
+ if ($numrows_fields > 0) {
+ foreach (array_keys($field_arr) as $i) {
+ $field['id'] = $field_arr[$i]->getVar('field_id');
+ $table_name = $tables_Handler->get($field_arr[$i]->getVar('field_tid'));
+ $field['tid'] = $table_name->getVar('table_name');
+ $field['name'] = $field_arr[$i]->getVar('field_name');
+ $field['type'] = $field_arr[$i]->getVar('field_type');
+ $field['value'] = $field_arr[$i]->getVar('field_value');
+ $field['blocks'] = $field_arr[$i]->getVar('field_blocks');
+ $field['attribute'] = $field_arr[$i]->getVar('field_attribute');
+ $field['default'] = $field_arr[$i]->getVar('field_default');
+ $field['key'] = $field_arr[$i]->getVar('field_key');
+ $field['auto_increment'] = $field_arr[$i]->getVar('field_auto_increment');
+ $field['blocks'] = $field_arr[$i]->getVar('field_blocks');
+ $field['search'] = $field_arr[$i]->getVar('field_search');
+ $field['required'] = $field_arr[$i]->getVar('field_required');
+ $xoops->tpl()->append_by_ref('fields', $field);
+ unset($field);
}
- }
+ }
// Display Page Navigation
if ($numrows_tables > $nb_pager) {
$nav = new XoopsPageNav($numrows_tables, $nb_pager, $start, 'start');
Modified: XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/header.php
===================================================================
--- XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/header.php 2013-02-20 20:29:40 UTC (rev 11083)
+++ XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/header.php 2013-02-20 22:12:11 UTC (rev 11084)
@@ -16,34 +16,29 @@
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
* @package tdmcreate
* @since 2.6.0
- * @author TDM Xoops (AKA Developers)
+ * @author TXMod Xoops (AKA Timgno)
* @version $Id: header.php 10665 2012-12-27 10:14:15Z timgno $
*/
require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php';
include_once dirname(dirname(__FILE__)) . '/include/common.php';
include_once dirname(dirname(__FILE__)) . '/include/functions.php';
-// Get XoopsLoad system
+include_once dirname(dirname(__FILE__)) . '/class/helper.php';
+// Get main instance
XoopsLoad::load('system', 'system');
-// Get main instance
$system = System::getInstance();
+// Get main locale instance
$xoops = Xoops::getInstance();
-// Preferences Limit
-$nb_pager = $xoops->getModuleConfig('adminpager');
-// Get Action type
-$op = $system->cleanVars($_REQUEST, 'op', 'list', 'string');
-// Get limit pager
-$limit = $system->cleanVars($_REQUEST, 'limit', 0, 'int');
-// Get start pager
-$start = $system->cleanVars($_REQUEST, 'start', 0, 'int');
+$helper = TDMCreate::getInstance();
+$request = $xoops->request();
// Get handler
-$modules_Handler = $xoops->getModuleHandler('modules');
-$tables_Handler = $xoops->getModuleHandler('tables');
-$import_Handler = $xoops->getModuleHandler('import');
-$fields_Handler = $xoops->getModuleHandler('fields');
-$fieldtype_Handler = $xoops->getModuleHandler('fieldtype');
-$fieldattrs_Handler = $xoops->getModuleHandler('fieldattributes');
-$fieldnull_Handler = $xoops->getModuleHandler('fieldnull');
-$fieldkey_Handler = $xoops->getModuleHandler('fieldkey');
-$fieldelements_Handler = $xoops->getModuleHandler('fieldelements');
+$modules_Handler = $helper->getHandlerModules();
+$tables_Handler = $helper->getHandlerTables();
+$import_Handler = $helper->getHandlerImport();
+$fields_Handler = $helper->getHandlerFields();
+// Get $_POST, $_GET, $_REQUEST
+$op = $request->asStr('op', 'list');
+$start = $request->asInt('start', 0);
+// Parameters
+$nb_pager = $helper->getConfig('adminpager');
// Get admin menu istance
$admin_menu = new XoopsModuleAdmin();
\ No newline at end of file
Modified: XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/import.php
===================================================================
--- XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/import.php 2013-02-20 20:29:40 UTC (rev 11083)
+++ XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/import.php 2013-02-20 22:12:11 UTC (rev 11084)
@@ -23,6 +23,7 @@
$nb_pager = $xoops->getModuleConfig('pager');
// Get Action type
$op = $system->cleanVars($_REQUEST, 'op', 'list', 'string');
+$import_id = $system->cleanVars($_REQUEST, 'import_id', 0, 'int');
// Get limit pager
$limit = $system->cleanVars($_REQUEST, 'limit', 0, 'int');
// Get start pager
@@ -37,7 +38,7 @@
switch ($op)
{
case 'list':
- $admin_menu->addItemButton(TDMCreateLocale::IMPORT_OLD_MODULE, 'import.php?op=import', 'add');
+ $admin_menu->addItemButton(TDMCreateLocale::IMPORT_OLD_MODULE, 'import.php?op=new', 'add');
$admin_menu->renderButton();
// Get modules list
$criteria = new CriteriaCompo();
@@ -45,12 +46,12 @@
$criteria->setOrder('ASC');
$criteria->setStart($start);
$criteria->setLimit($nb_pager);
- $numrows = $import_Handler->getCount($criteria);
+ $num_imports = $import_Handler->getCount($criteria);
$import_arr = $import_Handler->getAll($criteria);
// Assign Template variables
- $xoops->tpl()->assign('import_count', $numrows);
+ $xoops->tpl()->assign('imports_count', $num_imports);
unset($criteria);
- if ($numrows > 0) {
+ if ($num_imports > 0) {
foreach (array_keys($import_arr) as $i) {
$import['id'] = $import_arr[$i]->getVar('import_id');
$import['mid'] = $import_arr[$i]->getVar('import_mid');
@@ -70,7 +71,7 @@
}
break;
- case 'import':
+ case 'new':
$admin_menu->addItemButton(TDMCreateLocale::IMPORTED_LIST, 'import.php', 'application-view-detail');
$admin_menu->renderButton();
@@ -83,83 +84,121 @@
if (!$xoops->security()->check()) {
$xoops->redirect('modules.php', 3, implode(',', $xoops->security()->getErrors()));
}
- $id = $system->cleanVars($_REQUEST, 'import_id', 0, 'int');
- if ($id > 0) {
- $obj = $import_Handler->get($id);
+
+ if ($import_id > 0) {
+ $obj = $import_Handler->get($import_id);
+ //Form imported edited save
+ $obj->setVar('import_mid', $_POST['import_mid']);
+ $obj->setVar('import_name', $_POST['import_name']);
+ $obj->setVar('import_nbtables', $_POST['import_nbtables']);
+ $obj->setVar('import_tablename', $_POST['import_mid']);
+ $obj->setVar('import_nbfields', $_POST['import_nbfields']);
+ $obj->setVar('import_fieldelements', $_POST['import_fieldelements']);
} else {
$obj = $import_Handler->create();
- }
-
- $files = $_FILES['importfile'];
- // If incoming data have been entered correctly
- if($_POST['upload'] == _SUBMIT && isset($files['tmp_name']) && (substr($files['name'], -4) == '.sql'))
- {
- // File recovery
- $dir = TDMC_UPLOAD_PATH_FILES;
- $file = $_FILES['importfile'];
- $tmp_name = $file['tmp_name'];
- // Copy files to the server
- if (is_uploaded_file($tmp_name)) {
- readfile($tmp_name);
- // The directory where you saved the file
- if ($file['error'] == UPLOAD_ERR_OK) {
- $name = $file['name'];
- move_uploaded_file($tmp_name, $dir.'/'.$name);
+ //Form imported save
+ $obj->setVar('import_name', $_POST['import_name']);
+ $obj->setVar('import_mid', $_POST['import_mid']);
+ $files = $_FILES['importfile'];
+ // If incoming data have been entered correctly
+ if($_POST['upload'] == XoopsLocale::A_SUBMIT && isset($files['tmp_name']) && (substr($files['name'], -4) == '.sql'))
+ {
+ // File recovery
+ $dir = TDMC_UPLOAD_PATH_FILES;
+ $file = $_FILES['importfile'];
+ $tmp_name = $file['tmp_name'];
+ // Copy files to the server
+ if (is_uploaded_file($tmp_name)) {
+ readfile($tmp_name);
+ // The directory where you saved the file
+ if ($file['error'] == UPLOAD_ERR_OK) {
+ $name = $file['name'];
+ move_uploaded_file($tmp_name, $dir.'/'.$name);
+ }
+ } else {
+ $xoops->redirect('import.php', 3, sprintf(TDMCreateLocale::E_FILE_NOT_UPLOADING, $file['tmp_name']));
+ }
+
+ // Copies data in the db
+ $filename = $dir.'/'.$name;
+ // File size
+ $filesize = $files['size'];
+ // Check that the file was inserted and that there is
+ if ( ($handle = fopen($filename, 'r') ) !== false)
+ {
+ // File reading until at the end
+ while ( !feof( $handle ))
+ {
+ $buffer = fgets($handle, filesize($filename));
+ if(strlen($buffer) > 1)
+ {
+ // search all comments
+ $search = array ( '/\/\*.*(\n)*.*(\*\/)?/', '/\s*--.*\n/', '/\s*#.*\n/' );
+ // and replace with null
+ $replace = array ( "\n" );
+ $buffer = preg_replace($search, $replace, $buffer);
+ $buffer = str_replace('`', '', $buffer);
+ $buffer = str_replace(',', '', $buffer);
+
+ preg_match_all('/((\s)*(CREATE TABLE)(\s)+(.*)(\s)+(\())/', $buffer, $tablematch); // table name ... (match)
+ if(count($tablematch[0]) > 0)
+ array_push( $res_table, $tablematch[5][0] );
+ /*preg_match_all('/((\()(\s)+([a-z_]+)(\s)*(.*)(\())/', $buffer, $fieldsmatch); // fields ... (match)
+ if(count($fieldsmatch[0]) > 0)
+ array_push( $res_fields, $fieldsmatch[4][0] ); */
+ /*preg_match_all('/((\()(\s)+([a-z_]+)(\s)*(.*)(\())/', $buffer, $typematch); // type ... (match)
+ if(count($typematch[0]) > 0)
+ array_push( $res_keys, $typematch[6][0] ); */
+ /*preg_match_all('/(\s)(\((.*)\))/', $buffer, $typevmatch); // type value ... (match)
+ if(count($typevmatch[0]) > 0)
+ array_push( $res_keys, $typevmatch[4][0] ); */
+ /*preg_match_all('/(\s)(\((.*)\))/', $buffer, $unsmatch); // unsigned ... (match)
+ if(count($unsmatch[0]) > 0)
+ array_push( $res_unsigned, $unsmatch[4][0] ); */
+ /*preg_match_all('/(\s)(\((.*)\))/', $buffer, $nullmatch); // NOT NULL ... (match)
+ if(count($nullmatch[0]) > 0)
+ array_push( $res_null, $nullmatch[4][0] ); */
+ /*preg_match_all('/(\s)(\((.*)\))/', $buffer, $defaultmatch); // default ... (match)
+ if(count($defaultmatch[0]) > 0)
+ array_push( $res_keys, $defaultmatch[4][0] ); */
+ /*preg_match_all('/(\s)(\((.*)\))/', $buffer, $defaultvmatch); // default value ... (match)
+ if(count($defaultvmatch[0]) > 0)
+ array_push( $res_keys, $defaultvmatch[4][0] ); */
+ } else {
+ $xoops->redirect('import.php', 3, sprintf(TDMCreateLocale::E_SQL_FILE_DATA_NOT_MATCH, $buffer));
+ }
+ }
+
+ // Insert query
+ if(strlen($res_table[0]) > 0)
+ {
+ $t = 0;
+ foreach(array_keys($res_table) as $table)
+ {
+ $obj->setVar('import_tablename', $res_table[$table]); //$_POST['import_tablename']
+ $obj->setVar('import_nbtables', $t); $t++; //$_POST['import_nbtables']
+ if(strlen($res_table[0]) > 0)
+ {
+ $f = 0;
+ foreach(array_keys($res_fields) as $field)
+ {
+ $obj->setVar('import_nbfields', $f); $f++; // $_POST['import_nbfields']
+ $obj->setVar('import_fieldelements', $_POST['import_fieldelements']);
+ }
+ unset($f);
+ }
+ }
+ unset($t);
+ }
+ } else {
+ $xoops->redirect('import.php', 3, TDMCreateLocale::E_FILE_NOT_OPEN_READING);
}
+ $xoops->redirect('import.php', 3, TDMCreateLocale::S_DATA_ENTERED);
+ fclose($handle);
} else {
- $xoops->redirect('import.php', 3, 'Error in file upload:'. $file['tmp_name']);
- }
-
- // Copies data in the db
- $filename = $dir.'/'.$name;
- // File size
- $filesize = $files['size'];
- // Check that the file was inserted and that there is
- if ( ($handle = fopen($filename, 'r') ) !== false)
- {
- // File reading until at the end
- while ( !feof( $handle ))
- {
- // Use the fgets function to retrieve the information in the sql file
- // The second parameter is the size of the file, we have recovered over
- $row = fgets($handle, $filesize); // reads the entire row for the whole file
- if(strlen($row) > 1)
- {
- // change the ' and ; in null
- $search = array ( '/\/\*.*(\n)*.*(\*\/)?/', '/\s*--.*\n/', '/\s*#.*\n/' );
- // replace in null
- $replace = array ( "\n" );
- $row = preg_replace($search, $replace, $row);
- // I'll put your details in the row into an array divided by separator
- $arrayrow = explode( ',\n', $row);
- $arrayrow = preg_replace('/\s/', ' ', $arrayrow);
- // Insert query
- if(strlen($arrayrow[0]) > 0) {
- preg_match_all('/([A-Za-z0-9_=]+?[^\,\;\(\)$])/Ui', $row, $matches);
- for ($i = 0; $i < count($matches[0]); $i++) {
- //Form imported save
- $obj->setVars(array('import_mid' => $_POST['import_mid'], 'import_name' => $_POST['import_name'],
- 'import_nbtables' => $i, 'import_tablename' => $matches[0][$i],
- 'import_nbfields' => $matches[0][$i], 'import_fieldname' => $matches[0][$i],
- 'import_fieldtype' => $matches[0][$i], 'import_fieldvalue' => $matches[0][$i],
- 'import_nbfieldefault' => $matches[0][$i]));
- }///**/
- } else {
- $xoops->redirect('import.php?op=list', 3, 'Error: data in sql file do not match. Row: '.$row);
- }
- }
- // reset for the next insertion
- $arrayrow = array_slice($arrayrrow, 0, 0);
- $row = '';
- }
- } else {
- $xoops->redirect('import.php', 3, 'Could not open file for reading!');
- }
- $xoops->redirect('import.php', 3, 'Data entered successfull!');
- fclose($handle);
- } else {
- $xoops->redirect('import.php', 3, 'Not sql file or data entered!');
- }
+ $xoops->redirect('import.php', 3, TDMCreateLocale::E_DATABASE_SQL_FILE_NOT_IMPORTED);
+ }
+ }
if ($import_Handler->insert($obj)) {
$xoops->redirect('import.php', 3, TDMCreateLocale::FORM_OK);
@@ -175,15 +214,14 @@
$admin_menu->addItemButton(TDMCreateLocale::IMPORTED_LIST, 'import.php', 'application-view-detail');
$admin_menu->renderButton();
- $obj = $import_Handler->get($system->cleanVars($_REQUEST, 'import_id', 0, 'int'));
+ $obj = $import_Handler->get($import_id);
$form = $xoops->getModuleForm($obj, 'import');
$xoops->tpl()->assign('form', $form->render());
break;
case 'delete':
- $id = $system->cleanVars($_REQUEST, 'import_id', 0, 'int');
- if ($id > 0) {
- $obj = $import_Handler->get($id);
+ if ($import_id > 0) {
+ $obj = $import_Handler->get($import_id);
if (isset($_POST['ok']) && $_POST['ok'] == 1) {
if (!$xoops->security()->check()) {
$xoops->redirect('import.php', 3, implode(',', $xoops->security()->getErrors()));
@@ -194,7 +232,7 @@
$xoops->error($obj->getHtmlErrors());
}
} else {
- $xoops->confirm(array('ok' => 1, 'id' => $id, 'op' => 'delete'), 'import.php', sprintf(TDMCreateLocale::QF_ARE_YOU_SURE_TO_DELETE, $obj->getVar('import_name')) . '<br />');
+ $xoops->confirm(array('ok' => 1, 'id' => $import_id, 'op' => 'delete'), 'import.php', sprintf(TDMCreateLocale::QF_ARE_YOU_SURE_TO_DELETE, $obj->getVar('import_name')) . '<br />');
}
} else {
$xoops->redirect('import.php', 1, TDMCreateLocale::E_DATABASE_ERROR);
Modified: XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/modules.php
===================================================================
--- XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/modules.php 2013-02-20 20:29:40 UTC (rev 11083)
+++ XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/modules.php 2013-02-20 22:12:11 UTC (rev 11084)
@@ -19,19 +19,10 @@
* @version $Id: modules.php 10665 2012-12-27 10:14:15Z timgno $
*/
include dirname(__FILE__) . '/header.php';
-// Preferences Limit
-$nb_pager = $xoops->getModuleConfig('adminpager');
// Get Action type
-$op = $system->cleanVars($_REQUEST, 'op', 'list', 'string');
$mod_id = $system->cleanVars($_REQUEST, 'mod_id', 0, 'int');
-// Get limit pager
-$limit = $system->cleanVars($_REQUEST, 'limit', 0, 'int');
-// Get start pager
-$start = $system->cleanVars($_REQUEST, 'start', 0, 'int');
// Get handler
$xoops->header('tdmcreate_modules.html');
-/* @var $modules_handler TDMCreateModulesHandler */
-$modules_Handler = $xoops->getModuleHandler('modules');
$admin_menu->renderNavigation('modules.php');
switch ($op)
@@ -91,29 +82,35 @@
if (!$xoops->security()->check()) {
$xoops->redirect('modules.php', 3, implode(',', $xoops->security()->getErrors()));
}
-
+ $mod_id = $request->asInt('mod_id', 0);
if ($mod_id > 0) {
$obj = $modules_Handler->get($mod_id);
} else {
$obj = $modules_Handler->create();
}
//Form module save
- $obj->setVars(array('mod_name' => $_POST['mod_name'], 'mod_isextension' => (($_REQUEST['mod_isextension'] == 1) ? '1' : '0'),
- 'mod_version' => $_POST['mod_version'], 'mod_description' => $_POST['mod_description'],
- 'mod_author' => $_POST['mod_author'], 'mod_author_mail' => $_POST['mod_author_mail'],
- 'mod_author_website_url' => $_POST['mod_author_website_url'],
- 'mod_author_website_name' => $_POST['mod_author_website_name'], 'mod_credits' => $_POST['mod_credits'],
- 'mod_license' => $_POST['mod_license'], 'mod_release_info' => $_POST['mod_release_info'],
- 'mod_release_file' => $_POST['mod_release_file'], 'mod_manual' => $_POST['mod_manual'],
- 'mod_manual_file' => $_POST['mod_manual_file']));
+ $obj->setVars(array('mod_name' => $request->asStr('mod_name', ''),
+ 'mod_isextension' => $request->asInt('mod_isextension', 0),
+ 'mod_version' => $request->asStr('mod_version', ''),
+ 'mod_description' => $request->asStr('mod_description', ''),
+ 'mod_author' => $request->asStr('mod_author', ''),
+ 'mod_author_mail' => $request->asStr('mod_author_mail', ''),
+ 'mod_author_website_url' => $request->asStr('mod_author_website_url', ''),
+ 'mod_author_website_name' => $request->asStr('mod_author_website_name', ''),
+ 'mod_credits' => $request->asStr('mod_credits', ''),
+ 'mod_license' => $request->asStr('mod_license', ''),
+ 'mod_release_info' => $request->asStr('mod_release_info', ''),
+ 'mod_release_file' => $request->asStr('mod_release_file', ''),
+ 'mod_manual' => $request->asStr('mod_manual', ''),
+ 'mod_manual_file' => $request->asStr('mod_manual_file', '')));
//Form module_image
- $uploader = new XoopsMediaUploader( TDMC_MODULES_PATH_IMG, $xoops->getModuleConfig('mimetypes'),
- $xoops->getModuleConfig('maxuploadsize'), null, null);
- if ($uploader->fetchMedia($_POST['modules_image'][0])) {
- $extension = preg_replace( "/^.+\.([^.]+)$/sU" , "\\1" , $_FILES['modules_image']['name']);
- $name_img = 'logo.'.$extension;
- $uploader->setPrefix($name_img);
- $uploader->fetchMedia($_POST['modules_image'][0]);
+ $uploader = new XoopsMediaUploader( TDMC_MODULES_PATH_IMG, $helper->getConfig('mimetypes'),
+ $helper->getConfig('maxuploadsize'), null, null);
+ if ($uploader->fetchMedia('xoops_upload_file')) {
+ $extension = preg_replace( "/^.+\.([^.]+)$/sU" , "\\1" , $_FILES['xoops_upload_file']['name']);
+ $img_name = 'logo.'.$extension;
+ $uploader->setPrefix($img_name);
+ $uploader->fetchMedia('xoops_upload_file');
if (!$uploader->upload()) {
$xoops->redirect('javascript:history.go(-1)',3, $uploader->getErrors());
} else {
@@ -128,21 +125,25 @@
}
//Form module save
- $obj->setVars(array('mod_demo_site_url' => $_POST['mod_demo_site_url'], 'mod_demo_site_name' => $_POST['mod_demo_site_name'],
- 'mod_support_url' => $_POST['mod_support_url'], 'mod_support_name' => $_POST['mod_support_name'],
- 'mod_website_url' => $_POST['mod_website_url'], 'mod_website_name' => $_POST['mod_website_name'],
- 'mod_release' => $_POST['mod_release'], 'mod_status' => $_POST['mod_status'],
- 'mod_admin' => (($_REQUEST['mod_admin'] == 1) ? '1' : '0'),
- 'mod_user' => (($_REQUEST['mod_user'] == 1) ? '1' : '0'),
- 'mod_submenu' => (($_REQUEST['mod_submenu'] == 1) ? '1' : '0'),
- 'mod_search' => (($_REQUEST['mod_search'] == 1) ? '1' : '0'),
- 'mod_comments' => (($_REQUEST['mod_comments'] == 1) ? '1' : '0'),
- 'mod_notifications' => (($_REQUEST['mod_notifications'] == 1) ? '1' : '0'),
- 'mod_paypal' => $_POST['mod_paypal'],
- 'mod_subversion' => $_POST['mod_subversion']));
+ $obj->setVars(array('mod_demo_site_url' => $request->asStr('mod_demo_site_url', ''),
+ 'mod_demo_site_name' => $request->asStr('mod_demo_site_name', ''),
+ 'mod_support_url' => $request->asStr('mod_support_url', ''),
+ 'mod_support_name' => $request->asStr('mod_support_name', ''),
+ 'mod_website_url' => $request->asStr('mod_website_url', ''),
+ 'mod_website_name' => $request->asStr('mod_website_name', ''),
+ 'mod_release' => $request->asStr('mod_release', ''),
+ 'mod_status' => $request->asStr('mod_status', ''),
+ 'mod_admin' => $request->asInt('mod_admin', 0),
+ 'mod_user' => $request->asInt('mod_user', 0),
+ 'mod_submenu' => $request->asInt('mod_submenu', 0),
+ 'mod_search' => $request->asInt('mod_search', 0),
+ 'mod_comments' => $request->asInt('mod_comments', 0),
+ 'mod_notifications' => $request->asInt('mod_notifications', 0),
+ 'mod_paypal' => $request->asStr('mod_paypal', ''),
+ 'mod_subversion' => $request->asStr('mod_subversion', '')));
// Insert Data
if ($modules_Handler->insert($obj)) {
- $xoops->redirect('modules.php?op=list', 2, XoopsLocale::S_DATA_INSERTED);
+ $xoops->redirect('modules.php', 2, XoopsLocale::S_DATA_INSERTED);
}
// Form Data
$xoops->error($obj->getHtmlErrors());
@@ -154,13 +155,18 @@
$admin_menu->addItemButton(TDMCreateLocale::ADD_MODULE, 'modules.php?op=new', 'add');
$admin_menu->addItemButton(TDMCreateLocale::MODULES_LIST, 'modules.php', 'application-view-detail');
$admin_menu->renderButton();
-
- $obj = $modules_Handler->get($system->cleanVars($_REQUEST, 'mod_id', 0, 'int'));
- $form = $xoops->getModuleForm($obj, 'modules');
- $xoops->tpl()->assign('form', $form->render());
+ $mod_id = $request->asInt('mod_id', 0);
+ if ($mod_id > 0) {
+ $obj = $modules_Handler->get($mod_id);
+ $form = $helper->getForm($obj, 'modules');
+ $xoops->tpl()->assign('form', $form->render());
+ } else {
+ $xoops->redirect('modules.php', 1, XoopsLocale::E_DATABASE_NOT_UPDATED);
+ }
break;
- case 'delete':
+ case 'delete':
+ $mod_id = $request->asInt('mod_id', 0);
if ($mod_id > 0) {
$obj = $modules_Handler->get($mod_id);
if (isset($_POST['ok']) && $_POST['ok'] == 1) {
@@ -173,7 +179,7 @@
$xoops->error($obj->getHtmlErrors());
}
} else {
- $xoops->confirm(array('ok' => 1, 'id' => $mod_id, 'op' => 'delete'), 'modules.php', sprintf(TDMCreateLocale::QF_ARE_YOU_SURE_TO_DELETE, $obj->getVar('mod_name')) . '<br />');
+ $xoops->confirm(array('ok' => 1, 'mod_id' => $mod_id, 'op' => 'delete'), 'modules.php', sprintf(TDMCreateLocale::QF_ARE_YOU_SURE_TO_DELETE, $obj->getVar('mod_name')) . '<br />');
}
} else {
$xoops->redirect('modules.php', 1, XoopsLocale::E_DATABASE_NOT_UPDATED);
Modified: XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/tables.php
===================================================================
--- XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/tables.php 2013-02-20 20:29:40 UTC (rev 11083)
+++ XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/admin/tables.php 2013-02-20 22:12:11 UTC (rev 11084)
@@ -68,8 +68,7 @@
unset($criteria);
// Assign Template variables
- $xoops->tpl()->assign('mods_count', $numrows_mods);
- $mytree = new XoopsObjectTree($table_arr, 'table_id', 'table_mid');
+ $xoops->tpl()->assign('mods_count', $numrows_mods);
if ($numrows_mods > 0) {
foreach (array_keys($mod_arr) as $i) {
$mod['id'] = $mod_arr[$i]->getVar('mod_id');
@@ -85,26 +84,27 @@
$mod['comments'] = $mod_arr[$i]->getVar('mod_comments');
$mod['notifications'] = $mod_arr[$i]->getVar('mod_notifications');
$xoops->tpl()->append_by_ref('modules', $mod);
- unset($mod);
- if ($numrows_tables > 0) {
- foreach (array_keys($table_arr) as $i) {
- $tables['id'] = $table_arr[$i]->getVar('table_id');
- $tables['name'] = $table_arr[$i]->getVar('table_name');
- $tables['mid'] = TDMCreate_getPathTree($mytree, $table_arr[$i]->getVar('table_mid'), $table_arr, 'table_name');
- $tables['image'] = $table_arr[$i]->getVar('table_image');
- $tables['nbfields'] = $table_arr[$i]->getVar('table_nbfields');
- $tables['blocks'] = $table_arr[$i]->getVar('table_blocks');
- $tables['admin'] = $table_arr[$i]->getVar('table_admin');
- $tables['user'] = $table_arr[$i]->getVar('table_user');
- $tables['submenu'] = $table_arr[$i]->getVar('table_submenu');
- $tables['search'] = $table_arr[$i]->getVar('table_search');
- $tables['comments'] = $table_arr[$i]->getVar('table_comments');
- $tables['notifications'] = $table_arr[$i]->getVar('table_notifications');
- $xoops->tpl()->append_by_ref('tables', $tables);
- unset($tables);
- }
+ unset($mod);
+ }
+ if ($numrows_tables > 0) {
+ foreach (array_keys($table_arr) as $i) {
+ $tables['id'] = $table_arr[$i]->getVar('table_id');
+ $tables['name'] = $table_arr[$i]->getVar('table_name');
+ $module_name = $modules_Handler->get($table_arr[$i]->getVar('table_mid'));
+ $tables['mid'] = $module_name->getVar('mod_name');
+ $tables['image'] = $table_arr[$i]->getVar('table_image');
+ $tables['nbfields'] = $table_arr[$i]->getVar('table_nbfields');
+ $tables['blocks'] = $table_arr[$i]->getVar('table_blocks');
+ $tables['admin'] = $table_arr[$i]->getVar('table_admin');
+ $tables['user'] = $table_arr[$i]->getVar('table_user');
+ $tables['submenu'] = $table_arr[$i]->getVar('table_submenu');
+ $tables['search'] = $table_arr[$i]->getVar('table_search');
+ $tables['comments'] = $table_arr[$i]->getVar('table_comments');
+ $tables['notifications'] = $table_arr[$i]->getVar('table_notifications');
+ $xoops->tpl()->append_by_ref('tables', $tables);
+ unset($tables);
}
- }
+ }
// Display Page Navigation
if ($numrows_mods > $nb_pager) {
$nav = new XoopsPageNav($numrows_mods, $nb_pager, $start, 'start');
@@ -135,7 +135,7 @@
$obj = $tables_Handler->create();
}
//Form tables
- $obj->setVars(array('table_mid' => $_POST['table_mid'], 'table_name' => $_POST['table_name'],
+ $obj->setVars(array('table_mid' => $request->asInt('mod_id', 0), 'table_name' => $_POST['table_name'],
'table_nbfields' => $_POST['table_nbfields'], 'table_fieldname' => $_POST['table_fieldname']));
//Form table_image
$pathIcon32 = XOOPS_ROOT_PATH . '/media/xoops/images/icons/32';
@@ -170,7 +170,7 @@
if( $tables_Handler->insert($obj) ) {
if( $obj->isNew() )
- $xoops->redirect('fields.php?op=new&fields_tid='.$obj->getVar('table_id'), 3, XoopsLocale::S_DATA_INSERTED);
+ $xoops->redirect('fields.php?op=new&tid='.$obj->getVar('table_id'), 3, XoopsLocale::S_DATA_INSERTED);
else
$xoops->redirect('tables.php', 3, XoopsLocale::S_DATABASE_UPDATED);
}
@@ -190,7 +190,7 @@
$xoops->tpl()->assign('form', $form->render());
break;
- case 'delete':
+ case 'delete':
if ($table_id > 0) {
$obj = $tables_Handler->get($table_id);
if (isset($_POST['ok']) && $_POST['ok'] == 1) {
Deleted: XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/class/extensions.php
===================================================================
--- XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/class/extensions.php 2013-02-20 20:29:40 UTC (rev 11083)
+++ XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/class/extensions.php 2013-02-20 22:12:11 UTC (rev 11084)
@@ -1,75 +0,0 @@
-<?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.6.0
- * @author TDM Xoops (AKA Developers)
- * @version $Id: extensions.php 10665 2012-12-27 10:14:15Z timgno $
- */
-defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined");
-
-class TDMCreateExtensions extends XoopsObject
-{
- /**
- * Constructor
- */
- public function __construct()
- {
- $xoops = Xoops::getInstance();
-
- $this->initVar('ext_id', XOBJ_DTYPE_INT, null, true);
- $this->initVar('ext_name',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('name'));
- $this->initVar('ext_version',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('version'));
- $this->initVar('ext_description',XOBJ_DTYPE_TXTAREA, $xoops->getModuleConfig('description'));
- $this->initVar('ext_author',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('author'));
- $this->initVar('ext_author_mail',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('author_email'));
- $this->initVar('ext_author_website_url',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('author_website_url'));
- $this->initVar('ext_author_website_name',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('author_website'));
- $this->initVar('ext_credits',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('credits'));
- $this->initVar('ext_license',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('license'));
- $this->initVar('ext_release_info',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('release_info'));
- $this->initVar('ext_release_file',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('release_file'));
- $this->initVar('ext_manual',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('manual'));
- $this->initVar('ext_manual_file',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('manual_file'));
- $this->initVar('ext_image',XOBJ_DTYPE_TXTBOX, null);
- $this->initVar('ext_demo_site_url',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('demo_site_url'));
- $this->initVar('ext_demo_site_name',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('demo_site_name'));
- $this->initVar('ext_forum_site_url',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('forum_site_url'));
- $this->initVar('ext_forum_site_name',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('forum_site_name'));
- $this->initVar('ext_website_url',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('website_url'));
- $this->initVar('ext_website_name',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('website_name'));
- $this->initVar('ext_release',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('release'));
- $this->initVar('ext_status',XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('status'));
- $this->initVar('ext_admin',XOBJ_DTYPE_INT,$xoops->getModuleConfig('display_admin'));
- $this->initVar('ext_user',XOBJ_DTYPE_INT, $xoops->getModuleConfig('display_user'));
- $this->initVar('ext_submenu', XOBJ_DTYPE_INT, $xoops->getModuleConfig('display_submenu'));
- $this->initVar('ext_search',XOBJ_DTYPE_INT, $xoops->getModuleConfig('active_search'));
- $this->initVar('ext_comments',XOBJ_DTYPE_INT, $xoops->getModuleConfig('active_comments'));
- $this->initVar('ext_notifications', XOBJ_DTYPE_INT, $xoops->getModuleConfig('active_notifies'));
- $this->initVar('ext_paypal_button', XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('paypal_button'));
- $this->initVar('ext_subversion', XOBJ_DTYPE_TXTBOX, $xoops->getModuleConfig('subversion'));
- }
-}
-
-class TDMCreateExtensionsHandler extends XoopsPersistableObjectHandler
-{
- /**
- * @param null|XoopsDatabase $db
- */
- public function __construct(XoopsDatabase $db = null)
- {
- parent::__construct($db, 'tdmcreate_extensions', 'tdmcreateextensions', 'ext_id', 'ext_name');
- }
-}
\ No newline at end of file
Deleted: XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/class/form/extensions.php
===================================================================
--- XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/class/form/extensions.php 2013-02-20 20:29:40 UTC (rev 11083)
+++ XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/class/form/extensions.php 2013-02-20 22:12:11 UTC (rev 11084)
@@ -1,124 +0,0 @@
-<?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.6.0
- * @author TDM Xoops (AKA Developers)
- * @version $Id$
- */
-defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined");
-
-class TDMCreateExtensionsForm extends XoopsThemeForm
-{
- /**
- * @param TDMCreateExtensions|XoopsObject $obj
- */
- public function __construct(TDMCreateExtensions &$obj)
- {
- $xoops = Xoops::getInstance();
-
- $title = $obj->isNew() ? sprintf(TDMCreateLocale::ADD_EXTENSION) : sprintf(TDMCreateLocale::EDIT_EXTENSION);
-
- parent::__construct($title, 'form', 'extensions.php', 'post', true);
- $this->setExtra('enctype="multipart/form-data"');
-
- $this->insertBreak('<div class="center"><b>'.TDMCreateLocale::IMPORTANT.'</b></div>','head');
- $this->addElement(new XoopsFormText(XoopsLocale::C_NAME, 'ext_name', 50, 255, $obj->getVar('ext_name')), true);
- $this->addElement(new XoopsFormText(XoopsLocale::C_VERSION, 'ext_version', 2, 5, $obj->getVar('ext_version')), true);
- $editor_configs=array();
- $editor_configs['name'] = 'ext_description';
- $editor_configs['value'] = $obj->getVar('ext_description', 'e');
- $editor_configs['rows'] = 5;
- $editor_configs['cols'] = 80;
- $editor_configs['width'] = '100%';
- $editor_configs['height'] = '400px';
- $editor_configs['editor'] = $xoops->getModuleConfig('editor');
- $this->addElement( new XoopsFormEditor(XoopsLocale::C_DESCRIPTION, 'ext_description', $editor_configs), true );
- $this->addElement(new XoopsFormText(XoopsLocale::C_AUTHOR, 'ext_author', 50, 255, $obj->getVar('ext_author')), true);
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_LICENSE, 'ext_license', 50, 255, $obj->getVar('ext_license')), true);
- $option_tray = new XoopsFormElementTray(XoopsLocale::OPTIONS, ' ');
- $display_admin = $obj->isNew() ? 0 : $obj->getVar('ext_admin');
- $check_display_admin = new XoopsFormCheckBox(' ', 'ext_admin', $display_admin);
- $check_display_admin->addOption(1, TDMCreateLocale::C_ADMIN);
- $option_tray->addElement($check_display_admin);
- $display_user = $obj->isNew() ? 0 : $obj->getVar('ext_user');
- $check_display_user = new XoopsFormCheckBox(' ', 'ext_user', $display_user);
- $check_display_user->addOption(1, TDMCreateLocale::C_USER);
- $option_tray->addElement($check_display_user);
- $display_submenu = $obj->isNew() ? 0 : $obj->getVar('ext_submenu');
- $check_display_submenu = new XoopsFormCheckBox(' ', 'ext_submenu', $display_submenu);
- $check_display_submenu->addOption(1, TDMCreateLocale::C_SUBMENU);
- $option_tray->addElement($check_display_submenu);
- $active_search = $obj->isNew() ? 0 : $obj->getVar('ext_search');
- $check_active_search = new XoopsFormCheckBox(' ', 'ext_search', $active_search);
- $check_active_search->addOption(1, TDMCreateLocale::C_SEARCH);
- $option_tray->addElement($check_active_search);
- $active_comments = $obj->isNew() ? 0 : $obj->getVar('ext_comments');
- $check_active_comments = new XoopsFormCheckBox(' ', 'ext_comments', $active_comments);
- $check_active_comments->addOption(1, TDMCreateLocale::C_COMMENTS);
- $option_tray->addElement($check_active_comments);
- $active_notifies = $obj->isNew() ? 0 : $obj->getVar('ext_notifications');
- $check_active_notifies = new XoopsFormCheckBox(' ', 'ext_notifications', $active_notifies);
- $check_active_notifies->addOption(1, TDMCreateLocale::C_NOTIFICATIONS);
- $option_tray->addElement($check_active_notifies);
- $this->addElement($option_tray);
-
- $ext_image = $obj->getVar('ext_image') ? $obj->getVar('ext_image') : 'default_slogo.png';
- $uploadir = 'uploads/tdmcreate/images/extensions';
- $imgtray = new XoopsFormElementTray(TDMCreateLocale::C_IMAGE,'<br />');
- $imgpath = sprintf(TDMCreateLocale::CF_IMAGE_PATH, './'.$uploadir.'/');
- $imageselect = new XoopsFormSelect($imgpath, 'extensions_image', $ext_image);
- $image_array = XoopsLists::getImgListAsArray( XOOPS_ROOT_PATH.'/'.$uploadir );
- foreach( $image_array as $image ) {
- $imageselect->addOption("$image", $image);
- }
- $imageselect->setExtra( "onchange='showImgSelected(\"image3\", \"extensions_image\", \"".$uploadir."\", \"\", \"".XOOPS_URL."\")'" );
- $imgtray->addElement($imageselect);
- $imgtray->addElement( new XoopsFormLabel( '', "<br /><img src='".XOOPS_URL."/".$uploadir."/".$ext_image."' name='image3' id='image3' alt='' />" ) );
- $fileseltray = new XoopsFormElementTray('','<br />');
- $fileseltray->addElement(new XoopsFormFile(XoopsLocale::A_UPLOAD, 'extensions_image', $xoops->getModuleConfig('maxuploadsize')));
- $fileseltray->addElement(new XoopsFormLabel(''));
- $imgtray->addElement($fileseltray);
- $this->addElement($imgtray);
-
- $this->insertBreak('<div class="center"><b>'.TDMCreateLocale::NOT_IMPORTANT.'</b></div>','head');
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_AUTHOR_MAIL, 'ext_author_mail', 50, 255, $obj->getVar('ext_author_mail')));
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_AUTHOR_WEBSITE_URL, 'ext_author_website_url', 50, 255, $obj->getVar('ext_author_website_url')));
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_AUTHOR_WEBSITE_NAME, 'ext_author_website_name', 50, 255, $obj->getVar('ext_author_website_name')));
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_CREDITS, 'ext_credits', 50, 255, $obj->getVar('ext_credits')));
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_RELEASE_INFO, 'ext_release_info', 50, 255, $obj->getVar('ext_release_info')));
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_RELEASE_FILE, 'ext_release_file', 50, 255, $obj->getVar('ext_release_file')));
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_MANUAL, 'ext_manual', 50, 255, $obj->getVar('ext_manual')));
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_MANUAL_FILE, 'ext_manual_file', 50, 255, $obj->getVar('ext_manual_file')));
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_DEMO_SITE_URL, 'ext_demo_site_url', 50, 255, $obj->getVar('ext_demo_site_url')));
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_DEMO_SITE_NAME, 'ext_demo_site_name', 50, 255, $obj->getVar('ext_demo_site_name')));
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_FORUM_SITE_URL, 'ext_forum_site_url', 50, 255, $obj->getVar('ext_forum_site_url')));
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_FORUM_SITE_NAME, 'ext_forum_site_name', 50, 255, $obj->getVar('ext_forum_site_name')));
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_WEBSITE_URL, 'ext_website_url', 50, 255, $obj->getVar('ext_website_url')));
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_WEBSITE_NAME, 'ext_website_name', 50, 255, $obj->getVar('ext_website_name')));
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_RELEASE, 'ext_release', 50, 255, $obj->getVar('ext_release')));
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_STATUS, 'ext_status', 50, 255, $obj->getVar('ext_status')));
-
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_PAYPAL_BUTTON, 'ext_paypal_button', 50, 255, $obj->getVar('ext_paypal_button')));
- $this->addElement(new XoopsFormText(TDMCreateLocale::C_SUBVERSION, 'ext_subversion', 5, 25, $obj->getVar('ext_subversion')));
-
- if (!$obj->isNew()) {
- $this->addElement(new XoopsFormHidden( 'id', $obj->getVar('ext_id') ) );
- }
- $this->addElement(new XoopsFormHidden('op', 'save' ) );
- $this->addElement(new XoopsFormButton('', 'submit', XoopsLocale::A_SUBMIT, 'submit' ) );
- }
-}
\ No newline at end of file
Modified: XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/class/form/fields.php
===================================================================
--- XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/class/form/fields.php 2013-02-20 20:29:40 UTC (rev 11083)
+++ XoopsModules26/tdmcreate/branches/2.01/timgno/tdmcreate/class/form/fields.php 2013-02-20 22:12:11 UTC (rev 11084)
@@ -8,7 +8,6 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
-
/**
* tdmcreate module
*
@@ -28,144 +27,140 @@
*/
public function __construct(TDMCreateFields &$obj)
{
- $xoops = Xoops::getInstance();
-
- $title = $obj->isNew() ? sprintf(TDMCreateLocale::ADD_FIELD) : sprintf(TDMCreateLocale::EDIT_FIELD);
-
+ $system = System::getInstance();
+ $xoops = Xoops::getInstance();
+ $request = $xoops->request();
+
+ $title = $obj->isNew() ? sprintf(TDMCreateLocale::ADD_FIELDS) : sprintf(TDMCreateLocale::EDIT_FIELDS);
+
parent::__construct($title, 'form', false, 'post', true);
$this->setExtra('enctype="multipart/form-data"');
-
- // New Object HtmlTable
- /*$tableForm = new TDMCreate_HtmlTable(null, 'display outer');
- // header row
- $tableForm->addRow('center bgblue');
- $cells = array(TDMCreateLocale::FIELD_NUMBER, TDMCreateLocale::FIELD_NAME, TDMCreateLocale::FIELD_TYPE, TDMCreateLocale::FIELD_VALUE, TDMCreateLocale::FIELD_ATTRIBUTE, TDMCreateLocale::FIELD_NULL, TDMCreateLocale::FIELD_DEFAULT, TDMCreateLocale::FIELD_KEY, TDMCreateLocale::FIELD_OTHERS);
- $tableForm->addCells($cells, 'first', 'header');
-
- $tables_Handler = $xoops->getModuleHandler('tables');
- $criteria = new CriteriaCompo(new Criteria('table_name', $obj->getVar('table_name')));
- $criteria->add(new Criteria('table_nbfields', $obj->getVar('table_nbfields')));
- $nb_fields = $tablesHandler->getAll($criteria);
+
+ $tables_Handler = $xoops->getModuleHandler('tables');
+ $criteria = new CriteriaCompo();
+ $criteria->add(new Criteria('table_id', 0, '!='));
+ $criteria->setSort('table_name');
+ $criteria->setOrder('ASC');
+ $tables_arr = $tables_Handler->getAll($criteria);
unset($criteria);
- for($i = 1; $i <= count($nb_fields); $i++)
- {
- $field_name = $this->isNew() ? $obj->getVar('table_fieldname') : $obj->getVar('field_name');
- $field_name = new XoopsFormText(TDMCreateLocale::FIELD_NAME, 'field_name', 15, 255, $field_name);
- // fieldtype
- $fieldtypeHandler=& xoops_getModuleHandler('tdmcreate_fieldtype');
- $fieldtype_select = new XoopsFormSelect(TDMCreateLocale::FIELD_TYPE, 'field_type', $obj->getVar('field_type'));
- $fieldtype_select->addOptionArray($fieldtypeHandler->getList());
- // fieldvalue
- $field_value = new XoopsFormText(TDMCreateLocale::FIELD_VALUE, 'field_value', 5, 20, $obj->getVar('field_value'));
- // fieldattributes
- $fieldattrsHandler=& xoops_getModuleHandler('tdmcreate_fieldattributes');
- $field_attributes_select = new XoopsFormSelect(TDMCreateLocale::FIELD_TYPE, 'field_attribute', $obj->getVar('field_attribute'));
- $field_attributes_select->addOptionArray($fieldattrsHandler->getList());
- // fieldnull
- $fieldnullHandler=& xoops_getModuleHandler('tdmcreate_fieldnull');
- $field_null_select = new XoopsFormSelect(TDMCreateLocale::FIELD_NULL, 'field_null', $obj->getVar('field_null'));
- $field_null_select->addOptionArray($fieldnullHandler->getList());
- // fielddefault
- $field_default = new XoopsFormText(TDMCreateLocale::FIELD_DEFAULT, 'field_default', 15, 25, $obj->getVar('field_default'));
- //...
[truncated message content] |