| version 1.7, 2002/09/29 03:36:53 |
version 1.8, 2002/09/29 17:11:30 |
| Line 30 $id = $HTTP_POST_VARS['id']; |
|
| Line 30 $id = $HTTP_POST_VARS['id']; |
|
| |
|
| $phpExtension = '.phtml'; |
$phpExtension = '.phtml'; |
| $phpExtension = '.php'; |
$phpExtension = '.php'; |
| # directory to put the .php file into |
// directory to put the .php file into |
| $destDir = '.'; |
$destDir = '.'; |
| # directory to put the .inc file into |
// directory to put the .inc file into |
| $inclDir = '.'; |
$inclDir = '.'; |
| $headerFile = 'SiteHeader.inc'; |
$headerFile = 'SiteHeader.inc'; |
| $footerFile = 'SiteFooter.inc'; |
$footerFile = 'SiteFooter.inc'; |
|
|
| echo '<h2>You may now copy and paste it into your PHP editor</h2>'."\n"; |
echo '<h2>You may now copy and paste it into your PHP editor</h2>'."\n"; |
| //echo '<hr><pre>'."\n"; |
//echo '<hr><pre>'."\n"; |
| echo_buffer('<div class="main"> |
echo_buffer('<div class="main"> |
| <h3><?php echo \''.$pageTitle.'\'; ?></h3> |
<h3>'.$pageTitle.'</h3> |
| <?php |
<?php |
| // MySQL host name, user name, password, database, and table to edit'. |
// MySQL host name, user name, password, database, and table to edit'. |
| # NOTE: coder is strongly urged to remove the hn, un, pw lines from |
/* NOTE: coder is strongly urged to remove the hn, un, pw lines from |
| # here and set values in PME_site_defaults.inc |
here and set values in PME_site_defaults.inc |
| #require "PME_site_defaults.inc"; |
require "PME_site_defaults.inc"; */ |
| ' |
' |
| $opts["hn"]="'.$hn.'"; |
$opts["hn"] = "'.$hn.'"; |
| $opts["un"]="'.$un.'"; |
$opts["un"] = "'.$un.'"; |
| $opts["pw"]="'.$pw.'"; |
$opts["pw"] = "'.$pw.'"; |
| $opts["db"]="'.$db.'"; |
$opts["db"] = "'.$db.'"; |
| $opts["tb"]="'.$tb.'"; |
$opts["tb"] = "'.$tb.'"; |
| |
|
| // Name of field which is the unique key |
// Name of field which is the unique key |
| $opts["key"]="'.$id.'"; |
$opts["key"] = "'.$id.'"; |
| |
|
| // Type of key field (int/real/string/date etc)'); |
// Type of key field (int/real/string/date etc)'); |
| if ($id=="") { |
if ($id=="") { |
| echo_buffer('$opts["key_type"]="";'); |
echo_buffer('$opts["key_type"]="";'); |
| } else { |
} else { |
|
|
| $fd = @mysql_field_name($fds, $j); |
$fd = @mysql_field_name($fds, $j); |
| if ($fd == '') { break; } |
if ($fd == '') { break; } |
| if ($fd == $id) { |
if ($fd == $id) { |
| echo_buffer('$opts["key_type"]="'.@mysql_field_type($fds, $j).'";'); |
echo_buffer('$opts["key_type"] = "'.@mysql_field_type($fds, $j).'";'); |
| break; |
break; |
| } |
} |
| ++$j; |
++$j; |
| } |
} |
| } |
} |
| echo_buffer("// Initial field to sort on"); |
echo_buffer("// Initial field to sort on"); |
| echo_buffer('$opts["sort_field"]="'.$id.'";'); |
echo_buffer('$opts["sort_field"] = "'.$id.'";'); |
| |
|
| echo_buffer(" |
echo_buffer(" |
| // Number of records to display on the screen |
// Number of records to display on the screen |
| // note that \$inc = -1 lists _all_ records in a table |
// Note value of -1 lists all records in a table. |
| \$opts['inc']= 15; |
\$opts['inc'] = 15; |
| |
|
| // Options you wish to give the users |
// Options you wish to give the users |
| // A(dd) C(hange) (co)P(y) V(iew) D(elete) F(ilter) I(nitial sort suppressed) |
// A(dd) C(hange) (co)P(y) V(iew) D(elete) F(ilter) I(nitial sort suppressed) |
| \$opts['options']='ACPVDF'; |
\$opts['options'] = 'ACPVDF'; |
| |
|
| // Number of lines to display on multiple selection filters |
// Number of lines to display on multiple selection filters |
| \$opts['multiple']='4'; |
\$opts['multiple'] = '4'; |
| |
|
| // Number of lines to display on multiple selection filters |
// Number of lines to display on multiple selection filters |
| #\$opts['default_sort_columns'] = array('pushId','due','priority','task'); |
//\$opts['default_sort_columns'] = array('pushId','due','priority','task'); |
| |
|
| // action hyper'link's, 'button's, or 'graphic's |
// Navigation style: B - buttons (default), T - text links, G - graphic links |
| \$opts['actionStyle']='button'; |
// Buttons position: U - up, D - down (default) |
| #\$opts['actionStyle']='link'; |
\$opts['navigation'] = 'DB'; |
| #\$opts['actionStyle']='graphic'; |
|
| |
// Display special page elements |
| /* navigation style: B - buttons (default), T - text links, G - graphic links |
\$opts['display'] = array( |
| buttons position: U - up, D - down (default) */ |
'query' => false, |
| \$opts['navigation']='DB'; |
'sort' => false, |
| |
'time' => false |
| \$opts['display_query']=true; |
); |
| \$opts['display_sort']=true; |
|
| |
|
| /* |
/* |
| Field definitions. Fields will be displayed left to right |
Field definitions. Fields will be displayed left to right |
|
|
| \$value value of the field |
\$value value of the field |
| \$page this HTML page |
\$page this HTML page |
| \$row mysql_fetch_assoc() for this row |
\$row mysql_fetch_assoc() for this row |
| |
['URLarget'] HTML target link specification (for example: _blank) |
| ['required'] = true will generate javascript to prevent null entries by users |
['required'] = true will generate javascript to prevent null entries by users |
| ['options'] is an optional parameter to control whether a field is |
['options'] is an optional parameter to control whether a field is |
| displayed in the A(dd), C(hange), D(elete), view, or L(ist) views |
displayed in the A(dd), C(hange), D(elete), view, or L(ist) views |
|
|
| $tb_desc = mysql_query("describe $tb"); |
$tb_desc = mysql_query("describe $tb"); |
| $fds = mysql_list_fields($db, $tb, $dbl); |
$fds = mysql_list_fields($db, $tb, $dbl); |
| $num_fds = mysql_num_fields($fds); |
$num_fds = mysql_num_fields($fds); |
| for ($k=0 ; $k<$num_fds; $k++) |
for ($k = 0; $k < $num_fds; $k++) { |
| { |
$fd = mysql_field_name($fds,$k); |
| $fd = mysql_field_name($fds,$k); |
|
| $fm = mysql_fetch_field($fds,$k); |
$fm = mysql_fetch_field($fds,$k); |
| $fn = ucwords( |
$fn = strtr($fd, "_-.", " "); |
| strtr( |
$fn = preg_replace('/(^| +)id( +|$)/', '\\1ID\\2', $fn); // uppercase IDs |
| $fd, |
$fn = ucfirst($fn); |
| "_-.", |
$row = mysql_fetch_array($tb_desc); |
| " " |
echo_buffer('$fdd["'.$fd.'"] = array('); |
| ) |
echo_buffer(" 'name'=>'".str_replace('\'','\\\'',$fn)."',"); |
| ); |
if (substr($row[1],0,3) == 'set') { |
| $row = mysql_fetch_array($tb_desc); |
echo_buffer(" 'select'=>'M',"); |
| echo_buffer('$fdd["'.$fd.'"] = array('); |
echo_buffer(" 'type'=>'set',"); |
| echo_buffer(" 'name'=>'".str_replace('\'','\\\'',$fn)."',"); |
} else { |
| if (substr($row[1],0,3) == 'set') { |
echo_buffer(" 'select'=>'T',"); |
| echo_buffer(" 'select'=>'M',"); |
echo_buffer(" 'type'=>'".mysql_field_type($fds,$k)."',"); |
| echo_buffer(" 'type'=>'set',"); |
} |
| } else { |
echo_buffer(" 'maxlen'=>".mysql_field_len($fds,$k).','); |
| echo_buffer(" 'select'=>'T',"); |
echo_buffer(" 'nowrap'=>false,"); |
| echo_buffer(" 'type'=>'".mysql_field_type($fds,$k)."',"); |
if (stristr(mysql_field_flags($fds,$k),'not_null')) { |
| } |
echo_buffer(" 'required'=>true,"); |
| echo_buffer(" 'maxlen'=>".mysql_field_len($fds,$k).','); |
} |
| echo_buffer(" 'nowrap'=>false,"); |
// blobs -> textarea |
| if (stristr(mysql_field_flags($fds,$k),'not_null')) { |
if (mysql_field_type($fds,$k)=='blob') |
| echo_buffer(" 'required'=>true,"); |
{ |
| } |
echo_buffer(" 'textarea'=>array("); |
| # blobs -> textarea |
echo_buffer(" 'rows'=>5,"); |
| if (mysql_field_type($fds,$k)=='blob') |
echo_buffer(" 'cols'=>50,"); |
| { |
echo_buffer(" 'wrap'=>'virtual'"); |
| echo_buffer(" 'textarea'=>array("); |
echo_buffer(" ),"); |
| echo_buffer(" 'rows'=>5,"); |
} |
| echo_buffer(" 'cols'=>50,"); |
// timestamps are read-only |
| echo_buffer(" 'wrap'=>'virtual'"); |
if (mysql_field_type($fds,$k)=='timestamp') |
| echo_buffer(" ),"); |
{ |
| } |
echo_buffer(" 'options'=>'R',"); |
| # timestamps are read-only |
} |
| if (mysql_field_type($fds,$k)=='timestamp') |
|
| { |
// SETs and ENUMs get special treatment |
| echo_buffer(" 'options'=>'R',"); |
if (substr($row[1],0,3) == 'set') { |
| } |
echo_buffer(" 'values'=>array".substr($row[1],3).','); |
| |
} |
| # SETs and ENUMs get special treatment |
if (substr($row[1],0,4) == 'enum') { |
| if (substr($row[1],0,3) == 'set') { |
echo_buffer(" 'values'=>array".substr($row[1],4).','); |
| echo_buffer(" 'values'=>array".substr($row[1],3).','); |
} |
| } |
|
| if (substr($row[1],0,4) == 'enum') { |
// automatic support for Default values |
| echo_buffer(" 'values'=>array".substr($row[1],4).','); |
if ($row[4] != '' && $row[4] != 'NULL') { |
| } |
echo_buffer(" 'default'=>'".$row[4]."',"); |
| |
} |
| # automatic support for Default values |
echo_buffer(" 'sort'=>true"); |
| if ($row[4] != '' && $row[4] != 'NULL') { |
echo_buffer(');'); |
| echo_buffer(" 'default'=>'".$row[4]."',"); |
echo_buffer(''); |
| } |
} |
| echo_buffer(" 'sort'=>true"); |
|
| echo_buffer(');'); |
|
| echo_buffer(''); |
|
| } |
|
| |
|
| echo_buffer(" |
echo_buffer(" |
| \$opts['fdd'] = \$fdd; |
\$opts['fdd'] = \$fdd; |
| |
|
| /* |
/* Table-level filter capability (if set, is included in the WHERE clause of any |
| table-level filter capability |
generated SELECT statement; this gives you ability to wirk only with subset of |
| |
data from table) |
| if set, is included in the WHERE clause of any generated SELECT statement |
|
| |
Some valid examples: |
| example: |
\$opts['filters'] = \"column1 like '%11%' AND column2<17\"; |
| \$opts['filters'] = \"column1 like '%11%' AND column2<17\"; |
\$opts['filters'] = \"section_id = 9\"; |
| ); |
\$opts['filters'] = \"Table0.sessions_count > 200\"; |
| */ |
*/ |
| |
|
| /* |
/* |
| Triggers are files that are included (via require) that perform |
Triggers are files that are included (via require) that perform |
| Line 444 They _must_ return true or false to indi |
|
| Line 439 They _must_ return true or false to indi |
|
| */ |
*/ |
| |
|
| /* |
/* |
| \$opts['triggers']['insert']['before']='".substr($contentFile,0,strrpos($contentFile,'.inc'))."TIB.inc'; |
\$opts['triggers']['insert']['before']='".substr($contentFile,0,strrpos($contentFile,'.inc')).".TIB.inc'; |
| \$opts['triggers']['insert']['after'] ='".substr($contentFile,0,strrpos($contentFile,'.inc'))."TIA.inc'; |
\$opts['triggers']['insert']['after'] ='".substr($contentFile,0,strrpos($contentFile,'.inc')).".TIA.inc'; |
| \$opts['triggers']['update']['before']='".substr($contentFile,0,strrpos($contentFile,'.inc'))."TUB.inc'; |
\$opts['triggers']['update']['before']='".substr($contentFile,0,strrpos($contentFile,'.inc')).".TUB.inc'; |
| \$opts['triggers']['update']['after'] ='".substr($contentFile,0,strrpos($contentFile,'.inc'))."TUA.inc'; |
\$opts['triggers']['update']['after'] ='".substr($contentFile,0,strrpos($contentFile,'.inc')).".TUA.inc'; |
| \$opts['triggers']['delete']['before']='".substr($contentFile,0,strrpos($contentFile,'.inc'))."TDB.inc'; |
\$opts['triggers']['delete']['before']='".substr($contentFile,0,strrpos($contentFile,'.inc')).".TDB.inc'; |
| \$opts['triggers']['delete']['after'] ='".substr($contentFile,0,strrpos($contentFile,'.inc'))."TDA.inc'; |
\$opts['triggers']['delete']['after'] ='".substr($contentFile,0,strrpos($contentFile,'.inc')).".TDA.inc'; |
| */ |
*/ |
| |
|
| /* |
/* Logtable schema |
| logtable schema |
|
| |
|
| CREATE TABLE changelog ( |
CREATE TABLE changelog ( |
| updated timestamp(14) NOT NULL, |
updated timestamp(14) NOT NULL, |
| Line 473 CREATE TABLE changelog ( |
|
| Line 467 CREATE TABLE changelog ( |
|
| |
|
| |
|
| echo_buffer(" |
echo_buffer(" |
| # get the user's default language and use it if possible |
/* Get the user's default language and use it if possible or you can specify |
| |
language particular one you want to use. Available languages are: |
| |
DE EN-US EN FR IT NL PG SK SP */ |
| \$opts['language']= \$HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE']; |
\$opts['language']= \$HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE']; |
| |
|
| // and now the all-important call to phpMyEdit |
// and now the all-important call to phpMyEdit |