Minor fix

This commit is contained in:
Laurent Destailleur
2012-01-18 00:15:10 +01:00
parent 9200a77a37
commit c3d9be25be
4 changed files with 12 additions and 16 deletions

View File

@@ -37,7 +37,7 @@ require_once($path."../../htdocs/master.inc.php");
// After this $db is a defined handler to database. // After this $db is a defined handler to database.
// Main // Main
$version='1.34'; $version='3.2';
@set_time_limit(0); @set_time_limit(0);
$error=0; $error=0;
@@ -127,13 +127,13 @@ else
// Define working variables // Define working variables
$table=strtolower($table); $table=strtolower($table);
$tablenollx=preg_replace('/llx_/i','',$table); $tablenoprefix=preg_replace('/'.preg_quote(MAIN_DB_PREFIX).'/i','',$table);
$classname=ucfirst($tablenollx); $classname=preg_replace('/_/','',ucfirst($tablenoprefix));
$classmin=strtolower($classname); $classmin=preg_replace('/_/','',strtolower($classname));
// Read skeleton_class.class.php file // Read skeleton_class.class.php file
$skeletonfile='skeleton_class.class.php'; $skeletonfile=$path.'skeleton_class.class.php';
$sourcecontent=file_get_contents($skeletonfile); $sourcecontent=file_get_contents($skeletonfile);
if (! $sourcecontent) if (! $sourcecontent)
{ {
@@ -159,7 +159,7 @@ $targetcontent=preg_replace('/\s*\/\/\.\.\./', '', $targetcontent);
$targetcontent=preg_replace('/Put here some comments/','Initialy built by build_class_from_table on '.strftime('%Y-%m-%d %H:%M',mktime()), $targetcontent); $targetcontent=preg_replace('/Put here some comments/','Initialy built by build_class_from_table on '.strftime('%Y-%m-%d %H:%M',mktime()), $targetcontent);
// Substitute table name // Substitute table name
$targetcontent=preg_replace('/MAIN_DB_PREFIX."mytable/', 'MAIN_DB_PREFIX."'.$tablenollx, $targetcontent); $targetcontent=preg_replace('/MAIN_DB_PREFIX."mytable/', 'MAIN_DB_PREFIX."'.$tablenoprefix, $targetcontent);
// Substitute declaration parameters // Substitute declaration parameters
$varprop="\n"; $varprop="\n";
@@ -366,7 +366,7 @@ else $error++;
//-------------------------------- //--------------------------------
// Read skeleton_script.php file // Read skeleton_script.php file
$skeletonfile='skeleton_script.php'; $skeletonfile=$path.'skeleton_script.php';
$sourcecontent=file_get_contents($skeletonfile); $sourcecontent=file_get_contents($skeletonfile);
if (! $sourcecontent) if (! $sourcecontent)
{ {
@@ -393,7 +393,7 @@ $targetcontent=preg_replace('/\s*\/\/\.\.\./', '', $targetcontent);
$targetcontent=preg_replace('/Put here some comments/','Initialy built by build_class_from_table on '.strftime('%Y-%m-%d %H:%M',mktime()), $targetcontent); $targetcontent=preg_replace('/Put here some comments/','Initialy built by build_class_from_table on '.strftime('%Y-%m-%d %H:%M',mktime()), $targetcontent);
// Substitute table name // Substitute table name
$targetcontent=preg_replace('/MAIN_DB_PREFIX."mytable/', 'MAIN_DB_PREFIX."'.$tablenollx, $targetcontent); $targetcontent=preg_replace('/MAIN_DB_PREFIX."mytable/', 'MAIN_DB_PREFIX."'.$tablenoprefix, $targetcontent);
// Build file // Build file
$fp=fopen($outfile,"w"); $fp=fopen($outfile,"w");
@@ -407,6 +407,6 @@ else $error++;
// -------------------- END OF BUILD_CLASS_FROM_TABLE SCRIPT -------------------- // -------------------- END OF BUILD_CLASS_FROM_TABLE SCRIPT --------------------
print "You must rename files by removing the 'out.' prefix in their name.\n"; print "You can now rename generated files by removing the 'out.' prefix in their name and store them in a directory of your choice.\n";
return $error; return $error;
?> ?>

View File

@@ -20,8 +20,7 @@
* \file dev/skeletons/skeleton_class.class.php * \file dev/skeletons/skeleton_class.class.php
* \ingroup mymodule othermodule1 othermodule2 * \ingroup mymodule othermodule1 othermodule2
* \brief This file is an example for a CRUD class file (Create/Read/Update/Delete) * \brief This file is an example for a CRUD class file (Create/Read/Update/Delete)
* \author Put author name here * Put here some comments
* \remarks Put here some comments
*/ */
// Put here all includes required by your class file // Put here all includes required by your class file
@@ -33,7 +32,6 @@
/** /**
* \class Skeleton_Class * \class Skeleton_Class
* \brief Put here description of your class * \brief Put here description of your class
* \remarks Put here some comments
*/ */
class Skeleton_Class // extends CommonObject class Skeleton_Class // extends CommonObject
{ {

View File

@@ -20,8 +20,7 @@
* \file dev/skeletons/skeleton_page.php * \file dev/skeletons/skeleton_page.php
* \ingroup mymodule othermodule1 othermodule2 * \ingroup mymodule othermodule1 othermodule2
* \brief This file is an example of a php page * \brief This file is an example of a php page
* \author Put author name here * Put here some comments
* \remarks Put here some comments
*/ */
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');

View File

@@ -21,8 +21,7 @@
* \file dev/skeletons/skeleton_script.php * \file dev/skeletons/skeleton_script.php
* \ingroup mymodule othermodule1 othermodule2 * \ingroup mymodule othermodule1 othermodule2
* \brief This file is an example for a command line script * \brief This file is an example for a command line script
* \author Put author name here * Put here some comments
* \remarks Put here some comments
*/ */
$sapi_type = php_sapi_name(); $sapi_type = php_sapi_name();