From: <txm...@us...> - 2015-04-24 22:03:18
|
Revision: 13042 http://sourceforge.net/p/xoops/svn/13042 Author: txmodxoops Date: 2015-04-24 22:03:15 +0000 (Fri, 24 Apr 2015) Log Message: ----------- Fixed issues to creaction folders & files Modified Paths: -------------- XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/admin/building.php XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/admin/fields.php XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/fields.php XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/files/TDMCreateArchitecture.php XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/files/TDMCreateStructure.php XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/files/user/UserXoopsVersion.php XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/logoGenerator.php XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/include/common.php Modified: XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/admin/building.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/admin/building.php 2015-04-24 17:26:17 UTC (rev 13041) +++ XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/admin/building.php 2015-04-24 22:03:15 UTC (rev 13042) @@ -45,8 +45,6 @@ // Structure include_once TDMC_PATH . '/class/files/TDMCreateArchitecture.php'; $handler = TDMCreateArchitecture::getInstance(); - $handler->createPath(TDMC_PATH); - $handler->createUploadPath(TDMC_UPLOAD_PATH); // Creation of the structure of folders and files $base_architecture = $handler->createBaseFoldersFiles( $moduleObj ); if(false !== $base_architecture) { Modified: XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/admin/fields.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/admin/fields.php 2015-04-24 17:26:17 UTC (rev 13041) +++ XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/admin/fields.php 2015-04-24 22:03:15 UTC (rev 13042) @@ -171,14 +171,14 @@ $fieldsObj->setVar( 'field_tid', $fieldTid ); $fieldsObj->setVar( 'field_numb', $fieldNumb ); $fieldsObj->setVar( 'field_order', (isset($_POST['field_order'][$key]) ? $_POST['field_order'][$key] : $orderId) ); - $fieldsObj->setVar( 'field_name', (isset($_POST['field_name'][$key]) ? $_POST['field_name'][$key] : '') ); - $fieldsObj->setVar( 'field_type', (isset($_POST['field_type'][$key]) ? $_POST['field_type'][$key] : '') ); - $fieldsObj->setVar( 'field_value', (isset($_POST['field_value'][$key]) ? $_POST['field_value'][$key] : '') ); - $fieldsObj->setVar( 'field_attribute', (isset($_POST['field_attribute'][$key]) ? $_POST['field_attribute'][$key] : '') ); - $fieldsObj->setVar( 'field_null', (isset($_POST['field_null'][$key]) ? $_POST['field_null'][$key] : '') ); - $fieldsObj->setVar( 'field_default', (isset($_POST['field_default'][$key]) ? $_POST['field_default'][$key] : '') ); - $fieldsObj->setVar( 'field_key', (isset($_POST['field_key'][$key]) ? $_POST['field_key'][$key] : '') ); - $fieldsObj->setVar( 'field_element', (isset($_POST['field_element'][$key]) ? $_POST['field_element'][$key] : '') ); + $fieldsObj->setVar( 'field_name', (!empty($_POST['field_name'][$key]) ? $_POST['field_name'][$key] : '') ); + $fieldsObj->setVar( 'field_type', (!empty($_POST['field_type'][$key]) ? $_POST['field_type'][$key] : '') ); + $fieldsObj->setVar( 'field_value', (!empty($_POST['field_value'][$key]) ? $_POST['field_value'][$key] : '') ); + $fieldsObj->setVar( 'field_attribute', (!empty($_POST['field_attribute'][$key]) ? $_POST['field_attribute'][$key] : '') ); + $fieldsObj->setVar( 'field_null', (!empty($_POST['field_null'][$key]) ? $_POST['field_null'][$key] : '') ); + $fieldsObj->setVar( 'field_default', (!empty($_POST['field_default'][$key]) ? $_POST['field_default'][$key] : '') ); + $fieldsObj->setVar( 'field_key', (!empty($_POST['field_key'][$key]) ? $_POST['field_key'][$key] : '') ); + $fieldsObj->setVar( 'field_element', (!empty($_POST['field_element'][$key]) ? $_POST['field_element'][$key] : '') ); $fieldsObj->setVar( 'field_parent', ((isset($_REQUEST['field_parent'][$key]) == 1) ? 1 : 0) ); $fieldsObj->setVar( 'field_inlist', ((isset($_REQUEST['field_inlist'][$key]) == 1) ? 1 : 0) ); $fieldsObj->setVar( 'field_inform', ((isset($_REQUEST['field_inform'][$key]) == 1) ? 1 : 0) ); Modified: XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/fields.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/fields.php 2015-04-24 17:26:17 UTC (rev 13041) +++ XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/fields.php 2015-04-24 22:03:15 UTC (rev 13042) @@ -214,7 +214,7 @@ $parameters_tray = new XoopsFormElementTray('', '<br />'); // Field Elements $criteria_element = new CriteriaCompo(); - $criteria_element->add(new Criteria('fieldelement_tid', 0)); + $criteria_element->add(new Criteria('fieldelement_tid', $field_tid)); $criteria_table = new CriteriaCompo(); $criteria_table->add(new Criteria('fieldelement_mid', $field_mid)); $field_elements_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_ELEMENT_NAME, 'field_element['.$i.']'); @@ -352,7 +352,7 @@ $parameters_tray = new XoopsFormElementTray('', '<br />'); // Field Elements $criteria_element = new CriteriaCompo(); - $criteria_element->add(new Criteria('fieldelement_tid', 0)); + $criteria_element->add(new Criteria('fieldelement_tid', $field_tid)); $criteria_table = new CriteriaCompo(); $criteria_table->add(new Criteria('fieldelement_mid', $field_mid)); $field_elements_select = new XoopsFormSelect(_AM_TDMCREATE_FIELD_ELEMENT_NAME, 'field_element['.$id.']', $field->getVar('field_element')); Modified: XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/files/TDMCreateArchitecture.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/files/TDMCreateArchitecture.php 2015-04-24 17:26:17 UTC (rev 13041) +++ XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/files/TDMCreateArchitecture.php 2015-04-24 22:03:15 UTC (rev 13042) @@ -16,7 +16,7 @@ * @package tdmcreate * @since 2.5.0 * @author Txmod Xoops http://www.txmodxoops.org - * @version $Id: architecture.php 12258 2014-01-02 09:33:29Z timgno $ + * @version $Id: TDMCreateArchitecture.php 12258 2014-01-02 09:33:29Z timgno $ */ defined('XOOPS_ROOT_PATH') or die('Restricted access'); require_once 'TDMCreateStructure.php'; @@ -37,7 +37,9 @@ */ public function __construct() { $this->tdmcreate = TDMCreateHelper::getInstance(); - $this->structure = TDMCreateStructure::getInstance(); + $this->structure = TDMCreateStructure::getInstance(); + $this->structure->setPath(TDMC_PATH); + $this->structure->setUploadPath(TDMC_UPLOAD_REPOSITORY_PATH); } /* * @static function &getInstance @@ -96,9 +98,11 @@ } // $indexFile = XOOPS_UPLOAD_PATH.'/index.html'; - $stlModuleAuthor = str_replace(' ', '', strtolower($module->getVar('mod_author'))); + $stlModuleAuthor = str_replace(' ', '', strtolower($module->getVar('mod_author'))); + $this->structure->setModuleName($module->getVar('mod_dirname')); + $uploadPath = $this->structure->getUploadPath(); // Creation of "module" folder in the Directory repository - $this->structure->makeDir(TDMC_UPLOAD_REPOSITORY_PATH.'/'. $module->getVar('mod_dirname')); + $this->structure->makeDir($uploadPath . '/'. $this->structure->getModuleName()); // Copied of index.html file in "root module" folder $this->structure->copyFile('', $indexFile, 'index.html'); if ( $module->getVar('mod_admin') == 1) { @@ -208,7 +212,7 @@ // Module $modId = $module->getVar('mod_id'); $moduleDirname = $module->getVar('mod_dirname'); - $uploadTablesIcons32 = $this->getUploadPath().'/images/tables'; + $uploadTablesIcons32 = $this->structure->getUploadPath().'/images/tables'; $framePathIcon32 = XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32'; $icon32 = 'assets/icons/32'; // Id of tables Modified: XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/files/TDMCreateStructure.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/files/TDMCreateStructure.php 2015-04-24 17:26:17 UTC (rev 13041) +++ XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/files/TDMCreateStructure.php 2015-04-24 22:03:15 UTC (rev 13042) @@ -16,7 +16,7 @@ * @package tdmcreate * @since 2.5.0 * @author Txmod Xoops http://www.txmodxoops.org - * @version $Id: structure.php 12258 2014-01-02 09:33:29Z timgno $ + * @version $Id: TDMCreateStructure.php 12258 2014-01-02 09:33:29Z timgno $ */ defined('XOOPS_ROOT_PATH') or die('Restricted access'); xoops_load('XoopsFile'); @@ -33,7 +33,7 @@ /* * @var string */ - protected $folderName = null; + private $folderName = null; /* * @var string */ @@ -45,16 +45,8 @@ /* * @var mixed */ - private $uploadPath = null; + private $uploadPath = null; /* - * @var string - */ - private $fromFile = null; - /* - * @var string - */ - private $toFile = null; - /* * @public function constructor class * @param string $path */ @@ -73,40 +65,82 @@ $instance = new self(); } return $instance; - } + } /* * @public function setPath * @param string $path */ public function setPath($path) { $this->path = $path; - } + } /* - * @public function setUploadPath - * @param string $path - */ - public function setUploadPath($path) { - $this->uploadPath = $path; - } - /* * @public function getPath * @return string $path */ public function getPath() { return $this->path; + } + /* + * @protected function setUploadPath + * @param string $path + */ + protected function setUploadPath($path) { + $this->uploadPath = $path; } /* - * @public function getUploadPath + * @protected function getUploadPath * @return string $path */ - public function getUploadPath() { + protected function getUploadPath() { return $this->uploadPath; } + /* + * @protected function setModuleName + * @param string $moduleName + */ + protected function setModuleName($moduleName) { + $this->moduleName = $moduleName; + } + /* + * @protected function getModuleName + * @return string $moduleName + */ + protected function getModuleName() { + return $this->moduleName; + } + /* + * @private function setFolderName + * @param string $folderName + */ + private function setFolderName($folderName) { + $this->folderName = $folderName; + } + /* + * @private function getFolderName + * @return string $folderName + */ + private function getFolderName() { + return $this->folderName; + } + /* + * @private function setFileName + * @param string $fileName + */ + private function setFileName($fileName) { + $this->fileName = $fileName; + } + /* + * @private function getFileName + * @return string $fileName + */ + private function getFileName() { + return $this->fileName; + } /* - * @public function isDir + * @private function isDir * @param string $dname */ - public function isDir($dname) + private function isDir($dname) { if(!is_dir($dname)) { mkdir($dname, 0755); @@ -116,34 +150,26 @@ } } /* - * @public function makeDir + * @protected function makeDir * @param string $dir */ - public function makeDir($dir) + protected function makeDir($dir) { $this->isDir(strtolower(trim($dir))); - } + } /* - * @public function makeModuleDir - * @param string $dir - */ - public function makeModuleDir($dir) - { - $this->isDir(strtolower(trim($dir))); - } - /* - * @public function folderPath + * @public function addFolderPath * @param string $folderName * @param string $fileName */ - public function folderPath($folderName, $fileName = null) + private function addFolderPath($folderName, $fileName = false) { - $this->folderName = $folderName; - if( $fileName != null ) { - $this->fileName = $fileName; - $ret = $this->path . DIRECTORY_SEPARATOR . $this->moduleName . DIRECTORY_SEPARATOR . $this->folderName . DIRECTORY_SEPARATOR . $this->fileName; + $this->setFolderName($folderName); + if( $fileName ) { + $this->setFileName($fileName); + $ret = $this->getUploadPath() . DS . $this->getModuleName() . DS . $this->getFolderName() . DS . $this->getFileName(); } else { - $ret = $this->path . DIRECTORY_SEPARATOR . $this->moduleName . DIRECTORY_SEPARATOR . $this->folderName; + $ret = $this->getUploadPath() . DS . $this->getModuleName() . DS . $this->getFolderName(); } return $ret; } @@ -153,18 +179,18 @@ */ public function makeDirInModule($dirName) { - $fname = $this->folderPath($dirName); + $fname = $this->addFolderPath($dirName); $this->makeDir($fname); } /* * @public function makeDir & copy file * @param string $folderName - * @param string $toFile - * @param string $file + * @param string $fromFile + * @param string $toFile */ public function makeDirAndCopyFile($folderName, $fromFile, $toFile) { - $dname = $this->folderPath($folderName); + $dname = $this->addFolderPath($folderName); $this->makeDir($dname); $this->copyFile($folderName, $fromFile, $toFile); } @@ -176,25 +202,23 @@ */ public function copyFile($folderName, $fromFile, $toFile) { - $this->fromFile = $fromFile; - $this->toFile = $toFile; - $dname = $this->folderPath($folderName); - $fname = $this->folderPath($folderName) . DIRECTORY_SEPARATOR . $this->toFile; - $this->setCopy($dname, $fname); + $dname = $this->addFolderPath($folderName); + $fname = $this->addFolderPath($folderName, $toFile); + $this->setCopy($dname, $fromFile, $fname); } /* * @public function setCopy * @param string $dname * @param string $fname */ - public function setCopy($dname, $fname) + public function setCopy($dname, $fromFile, $fname) { if(is_dir($dname)) { chmod($dname, 0777); - copy($this->fromFile, $fname); + copy($fromFile, $fname); } else { $this->makeDir($dname); - copy($this->fromFile, $fname); + copy($fromFile, $fname); } } } \ No newline at end of file Modified: XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/files/user/UserXoopsVersion.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/files/user/UserXoopsVersion.php 2015-04-24 17:26:17 UTC (rev 13041) +++ XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/files/user/UserXoopsVersion.php 2015-04-24 22:03:15 UTC (rev 13042) @@ -566,9 +566,8 @@ foreach(array_keys($tables) as $t) { $tableName = $tables[$t]->getVar('table_name'); - $count = count($tableName); if($tables[$t]->getVar('table_notifications') == 1) { - if($t < $count) { + if($t < count($tableName)) { $notify_file .= "'".$tableName.".php', "; } else { $notify_file .= "'".$tableName.".php'"; Modified: XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/logoGenerator.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/logoGenerator.php 2015-04-24 17:26:17 UTC (rev 13041) +++ XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/class/logoGenerator.php 2015-04-24 22:03:15 UTC (rev 13042) @@ -48,36 +48,23 @@ } } } - - $dirname = 'tdmcreate'; - $iconFileName = XOOPS_ROOT_PATH . "/Frameworks/moduleclasses/icons/32/".basename($logoIcon); - - //$dirlogos = TDMC_PATH . "/assets/images/logos"; - //$dirlogos = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/assets/images/logos"; if (!file_exists($imageBase = TDMC_IMAGE_LOGOS_PATH . "/xoops2.png") || !file_exists($font = TDMC_IMAGE_LOGOS_PATH . "/VeraBd.ttf") || - !file_exists($iconFile = $iconFileName)) { + !file_exists($iconFile = XOOPS_ICONS32_PATH . '/' . basename($logoIcon))) { return false; } - $imageModule = imagecreatefrompng($imageBase); $imageIcon = imagecreatefrompng($iconFile); - // Write text $text_color = imagecolorallocate($imageModule, 0, 0, 0); $space_to_border = (92 - strlen($moduleDirname) * 7.5) / 2; imagefttext($imageModule, 8.5, 0, $space_to_border, 45, $text_color, $font, ucfirst($moduleDirname), array()); - imagecopy($imageModule, $imageIcon, 29, 2, 0, 0, 32, 32); - $targetImage = TDMC_UPLOAD_IMGMOD_URL . "/" . $moduleDirname . "_logo.png"; - //$targetImage = "/uploads/" . $dirname . "/images/repository/" . $moduleDirname . "_logo.png"; - imagepng($imageModule, XOOPS_ROOT_PATH . $targetImage ); - imagedestroy($imageModule); imagedestroy($imageIcon); - + return XOOPS_URL.$targetImage; } } \ No newline at end of file Modified: XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/include/common.php =================================================================== --- XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/include/common.php 2015-04-24 17:26:17 UTC (rev 13041) +++ XoopsModules/TDMCreate/branches/timgno/1.91a1/tdmcreate/include/common.php 2015-04-24 22:03:15 UTC (rev 13042) @@ -20,6 +20,8 @@ */ defined('XOOPS_ROOT_PATH') or die('Restricted access'); $dirname = $GLOBALS['xoopsModule']->getVar('dirname'); +// Root Frameworks icons 32x32 directory +define('XOOPS_ICONS32_PATH', XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32' ); // Local Directories define('TDMC_PATH', XOOPS_ROOT_PATH . '/modules/' . $dirname ); define('TDMC_URL', XOOPS_URL . '/modules/' . $dirname ); @@ -38,8 +40,8 @@ define('TDMC_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $dirname ); define('TDMC_UPLOAD_REPOSITORY_PATH', TDMC_UPLOAD_PATH . '/repository' ); define('TDMC_UPLOAD_REPOSITORY_URL', TDMC_UPLOAD_URL . '/repository' ); -define('TDMC_UPLOAD_IMGMOD_PATH', TDMC_UPLOAD_PATH . '/images/repository' ); -define('TDMC_UPLOAD_IMGMOD_URL', TDMC_UPLOAD_URL . '/images/repository' ); +define('TDMC_UPLOAD_IMGMOD_PATH', TDMC_UPLOAD_PATH . '/images/modules' ); +define('TDMC_UPLOAD_IMGMOD_URL', TDMC_UPLOAD_URL . '/images/modules' ); define('TDMC_UPLOAD_IMGTAB_PATH', TDMC_UPLOAD_PATH . '/images/tables' ); define('TDMC_UPLOAD_IMGTAB_URL', TDMC_UPLOAD_URL . '/images/tables' ); // Xoops Request |