Subversion Repositories Applications.bazar

Compare Revisions

No changes between revisions

Ignore whitespace Rev 467 → Rev 468

/trunk/jrest/util/cel_inventory.php
New file
0,0 → 1,252
<style type="text/css">
hr.pme-hr { border: 0px solid; padding: 0px; margin: 0px; border-top-width: 1px; height: 1px; }
table.pme-main { border: #004d9c 1px solid; border-collapse: collapse; border-spacing: 0px; width: 100%; }
table.pme-navigation { border: #004d9c 0px solid; border-collapse: collapse; border-spacing: 0px; width: 100%; }
th.pme-header { border: #004d9c 1px solid; padding: 4px; background: #add8e6; }
td.pme-key-0, td.pme-value-0, td.pme-help-0, td.pme-navigation-0, td.pme-cell-0,
td.pme-key-1, td.pme-value-1, td.pme-help-0, td.pme-navigation-1, td.pme-cell-1,
td.pme-sortinfo, td.pme-filter { border: #004d9c 1px solid; padding: 3px; }
td.pme-buttons { text-align: left; }
td.pme-message { text-align: center; }
td.pme-stats { text-align: right; }
</style><?php
 
/*
* IMPORTANT NOTE: This generated file contains only a subset of huge amount
* of options that can be used with phpMyEdit. To get information about all
* features offered by phpMyEdit, check official documentation. It is available
* online and also for download on phpMyEdit project management page:
*
* http://platon.sk/projects/main_page.php?project_id=5
*
* This file was generated by:
*
* phpMyEdit version: 5.6
* phpMyEdit.class.php core class: 1.188
* phpMyEditSetup.php script: 1.48
* generating setup script: 1.48
*/
 
// MySQL host name, user name, password, database, and table
$opts['hn'] = 'localhost';
$opts['un'] = 'root';
$opts['pw'] = '';
$opts['db'] = 'cel';
$opts['tb'] = 'cel_inventory';
 
// Name of field which is the unique key
$opts['key'] = 'id';
 
// Type of key field (int/real/string/date etc.)
$opts['key_type'] = 'int';
 
// Sorting field(s)
$opts['sort_field'] = array('id');
 
// Number of records to display on the screen
// Value of -1 lists all records in a table
$opts['inc'] = 15;
 
// Options you wish to give the users
// A - add, C - change, P - copy, V - view, D - delete,
// F - filter, I - initial sort suppressed
$opts['options'] = 'ACPVDF';
 
// Number of lines to display on multiple selection filters
$opts['multiple'] = '4';
 
// Navigation style: B - buttons (default), T - text links, G - graphic links
// Buttons position: U - up, D - down (default)
$opts['navigation'] = 'TB';
 
// Display special page elements
$opts['display'] = array(
'form' => true,
'query' => true,
'sort' => true,
'time' => true,
'tabs' => true
);
 
// Set default prefixes for variables
$opts['js']['prefix'] = 'PME_js_';
$opts['dhtml']['prefix'] = 'PME_dhtml_';
$opts['cgi']['prefix']['operation'] = 'PME_op_';
$opts['cgi']['prefix']['sys'] = 'PME_sys_';
$opts['cgi']['prefix']['data'] = 'PME_data_';
 
/* Get the user's default language and use it if possible or you can
specify particular one you want to use. Refer to official documentation
for list of available languages. */
$opts['language'] = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
 
/* Table-level filter capability. If set, it is included in the WHERE clause
of any generated SELECT statement in SQL query. This gives you ability to
work only with subset of data from table.
 
$opts['filters'] = "column1 like '%11%' AND column2<17";
$opts['filters'] = "section_id = 9";
$opts['filters'] = "PMEtable0.sessions_count > 200";
*/
 
/* Field definitions
Fields will be displayed left to right on the screen in the order in which they
appear in generated list. Here are some most used field options documented.
 
['name'] is the title used for column headings, etc.;
['maxlen'] maximum length to display add/edit/search input boxes
['trimlen'] maximum length of string content to display in row listing
['width'] is an optional display width specification for the column
e.g. ['width'] = '100px';
['mask'] a string that is used by sprintf() to format field output
['sort'] true or false; means the users may sort the display on this column
['strip_tags'] true or false; whether to strip tags from content
['nowrap'] true or false; whether this field should get a NOWRAP
['select'] T - text, N - numeric, D - drop-down, M - multiple selection
['options'] optional parameter to control whether a field is displayed
L - list, F - filter, A - add, C - change, P - copy, D - delete, V - view
Another flags are:
R - indicates that a field is read only
W - indicates that a field is a password field
H - indicates that a field is to be hidden and marked as hidden
['URL'] is used to make a field 'clickable' in the display
e.g.: 'mailto:$value', 'http://$value' or '$page?stuff';
['URLtarget'] HTML target link specification (for example: _blank)
['textarea']['rows'] and/or ['textarea']['cols']
specifies a textarea is to be used to give multi-line input
e.g. ['textarea']['rows'] = 5; ['textarea']['cols'] = 10
['values'] restricts user input to the specified constants,
e.g. ['values'] = array('A','B','C') or ['values'] = range(1,99)
['values']['table'] and ['values']['column'] restricts user input
to the values found in the specified column of another table
['values']['description'] = 'desc_column'
The optional ['values']['description'] field allows the value(s) displayed
to the user to be different to those in the ['values']['column'] field.
This is useful for giving more meaning to column values. Multiple
descriptions fields are also possible. Check documentation for this.
*/
 
$opts['fdd']['id'] = array(
'name' => 'ID',
'select' => 'T',
'options' => 'AVCPDR', // auto increment
'maxlen' => 20,
'default' => '0',
'sort' => true
);
$opts['fdd']['identifiant'] = array(
'name' => 'Identifiant',
'select' => 'T',
'maxlen' => 128,
'sort' => true
);
$opts['fdd']['ordre'] = array(
'name' => 'Ordre',
'select' => 'T',
'maxlen' => 20,
'sort' => true
);
$opts['fdd']['nom_sel'] = array(
'name' => 'Nom sel',
'select' => 'T',
'maxlen' => 255,
'sort' => true
);
$opts['fdd']['num_nom_sel'] = array(
'name' => 'Num nom sel',
'select' => 'T',
'maxlen' => 11,
'sort' => true
);
$opts['fdd']['nom_ret'] = array(
'name' => 'Nom ret',
'select' => 'T',
'maxlen' => 255,
'sort' => true
);
$opts['fdd']['num_nom_ret'] = array(
'name' => 'Num nom ret',
'select' => 'T',
'maxlen' => 11,
'sort' => true
);
$opts['fdd']['num_taxon'] = array(
'name' => 'Num taxon',
'select' => 'T',
'maxlen' => 11,
'sort' => true
);
$opts['fdd']['famille'] = array(
'name' => 'Famille',
'select' => 'T',
'maxlen' => 255,
'sort' => true
);
$opts['fdd']['location'] = array(
'name' => 'Location',
'select' => 'T',
'maxlen' => 50,
'sort' => true
);
$opts['fdd']['id_location'] = array(
'name' => 'ID location',
'select' => 'T',
'maxlen' => 10,
'sort' => true
);
$opts['fdd']['date_observation'] = array(
'name' => 'Date observation',
'select' => 'T',
'maxlen' => 19,
'sort' => true
);
$opts['fdd']['station'] = array(
'name' => 'Station',
'select' => 'T',
'maxlen' => 255,
'sort' => true
);
$opts['fdd']['milieu'] = array(
'name' => 'Milieu',
'select' => 'T',
'maxlen' => 255,
'sort' => true
);
$opts['fdd']['commentaire'] = array(
'name' => 'Commentaire',
'select' => 'T',
'maxlen' => 1024,
'sort' => true
);
$opts['fdd']['transmission'] = array(
'name' => 'Transmission',
'select' => 'T',
'maxlen' => 4,
'sort' => true
);
$opts['fdd']['date_creation'] = array(
'name' => 'Date creation',
'select' => 'T',
'maxlen' => 19,
'sort' => true
);
$opts['fdd']['date_modification'] = array(
'name' => 'Date modification',
'select' => 'T',
'maxlen' => 19,
'sort' => true
);
$opts['fdd']['date_transmission'] = array(
'name' => 'Date transmission',
'select' => 'T',
'maxlen' => 19,
'sort' => true
);
 
// Now important call to phpMyEdit
require_once 'phpMyEdit.class.php';
new phpMyEdit($opts);
 
?>
 
/trunk/jrest/util/phpMyEditSetup.php
New file
0,0 → 1,569
<?php
 
/*
* phpMyEdit - instant MySQL table editor and code generator
*
* phpMyEditSetup.php - interactive table configuration utility (setup)
* ____________________________________________________________
*
* Copyright (c) 1999-2002 John McCreesh <jpmcc@users.sourceforge.net>
* Copyright (c) 2001-2002 Jim Kraai <jkraai@users.sourceforge.net>
* Versions 5.0 and higher developed by Ondrej Jombik <nepto@php.net>
* Copyright (c) 2002-2006 Platon Group, http://platon.sk/
* All rights reserved.
*
* See README file for more information about this software.
* See COPYING file for license information.
*
* Download the latest version from
* http://platon.sk/projects/phpMyEdit/
*/
 
/* $Platon: phpMyEdit/phpMyEditSetup.php,v 1.48 2006-09-09 07:38:54 nepto Exp $ */
 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<title>phpMyEdit Setup</title>
<style type="text/css">
<!--
body { font-family: "Verdana", "Arial", "Sans-Serif"; text-align: left }
h1 { color: #004d9c; font-size: 13pt; font-weight: bold }
h2 { color: #004d9c; font-size: 11pt; font-weight: bold }
h3 { color: #004d9c; font-size: 11pt; }
p { color: #004d9c; font-size: 9pt; }
table { border: 1px solid #004d9c; border-collapse: collapse; border-spacing: 0px; }
td { border: 1px solid; padding: 3px; color: #004d9c; font-size: 9pt; }
hr
{
height: 1px;
background-color: #000000;
color: #000000;
border: solid #000000 0;
padding: 0;
margin: 0;
border-top-width: 1px;
}
-->
</style>
</head>
<body bgcolor="white">
 
<?php
 
if (! defined('PHP_EOL')) {
define('PHP_EOL', strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? "\r\n"
: strtoupper(substr(PHP_OS, 0, 3) == 'MAC') ? "\r" : "\n");
}
 
$hn = @$_POST['hn'];
$un = @$_POST['un'];
$pw = @$_POST['pw'];
if(strlen($_POST['db'])>0) $db = @$_POST['db'];
if(strlen($_POST['tb'])>0) $tb = @$_POST['tb'];
$id = @$_POST['id'];
$submit = @$_POST['submit'];
$options = @$_POST['options'];
$baseFilename = @$_POST['baseFilename'];
$pageTitle = @$_POST['pageTitle'];
$pageHeader = @$_POST['pageHeader'];
$HTMLissues = @$_POST['HTMLissues'];
$CSSstylesheet = @$_POST['CSSstylesheet'];
 
$phpExtension = '.php';
if (isset($baseFilename) && $baseFilename != '') {
$phpFile = $baseFilename.$phpExtension;
//$contentFile = $baseFilename.'Content.inc';
$contentFile = $baseFilename.'.php';
} elseif (isset($tb)) {
$phpFile = $tb.$phpExtension;
//$contentFile = $tb.'Content.inc';
$contentFile = $tb.'.php';
} else {
$phpFile = 'index'.$phpExtension;
//$contentFile = 'Content.inc';
$contentFile = 'phpMyEdit-content.php';
}
 
$buffer = '';
 
function echo_html($x)
{
echo htmlspecialchars($x),PHP_EOL;
}
 
function echo_buffer($x)
{
global $buffer;
$buffer .= $x.PHP_EOL;
}
 
#:#####################################:#
#:# Function: check_constraints #:#
#:# Parameters: tb=table name #:#
#:# fd=field name #:#
#:# return: lookup default for #:#
#:# said constraint #:#
#:# or null if no #:#
#:# constraint is found. #:#
#:# Contributed by Wade Ryan, #:#
#:# 20060906 #:#
#:#####################################:#
function check_constraints($tb,$fd)
{
$query = "show create table $tb";
$result = mysql_query($query);
$tableDef = preg_split('/\n/',mysql_result($result,0,1));
 
$constraint_arg="";
while (list($key,$val) = each($tableDef)) {
$words=preg_split("/[\s'`()]+/", $val);
if ($words[1] == "CONSTRAINT" && $words[6]=="REFERENCES") {
if ($words[5]==$fd) {
$constraint_arg=" 'values' => array(\n".
" 'table' => '$words[7]',\n".
" 'column' => '$words[8]'\n".
" ),\n";
}
 
}
}
return $constraint_arg;
}
 
function get_versions()
{
$ret_ar = array();
$dirname = dirname(__FILE__);
foreach (array(
'current' => __FILE__,
'setup' => "$dirname/phpMyEditSetup.php",
'core' => "$dirname/phpMyEdit.class.php",
'version' => "$dirname/doc/VERSION")
as $type => $file) {
if (@file_exists($file) && @is_readable($file)) {
if (($f = fopen($file, 'r')) == false) {
continue;
}
$str = trim(fread($f, 4096));
if (strpos($str, ' ') === false && strlen($str) < 10) {
$ret_ar[$type] = $str;
} else if (preg_match('|\$'.'Platon:\s+\S+,v\s+(\d+.\d+)\s+|', $str, $matches)) {
$ret_ar[$type] = $matches[1];
}
fclose($f);
}
}
return $ret_ar;
}
 
 
$self = basename($_SERVER['PHP_SELF']);
$dbl = @mysql_pconnect($hn, $un, $pw);
 
if ((!$dbl) or empty($submit)) {
echo '<h1>Please log in to your MySQL database</h1>';
if (!empty($submit)) {
echo '<h2>Sorry - login failed - please try again</h2>'.PHP_EOL;
}
if (! isset($hn)) {
$hn = 'localhost';
}
echo '
<form action="'.htmlspecialchars($self).'" method="POST">
<table border="1" cellpadding="1" cellspacing="0" summary="Login form">
<tr>
<td>Hostname:</td>
<td><input type="text" name="hn" value="'.htmlspecialchars($hn).'"></td>
</tr><tr>
<td>Username:</td>
<td><input type="text" name="un" value="'.htmlspecialchars($un).'"></td>
</tr><tr>
<td>Password:</td>
<td><input type="password" name="pw" value="'.htmlspecialchars($pw).'"></td>
</tr><tr>
<td>Database:</td>
<td><input type="text" name="db" value="'.htmlspecialchars($db).'"></td>
</tr><tr>
<td>Table:</td>
<td><input type="text" name="tb" value="'.htmlspecialchars($tb).'"></td>
</tr>
</table><br>
<input type="submit" name="submit" value="Submit">
</form>'.PHP_EOL;
} else if (! isset($db)) {
$dbs = @mysql_list_dbs($dbl);
$num_dbs = @mysql_num_rows($dbs);
echo '<h1>Please select a database</h1>
<form action="'.htmlspecialchars($self).'" method="POST">
<input type="hidden" name="hn" value="'.htmlspecialchars($hn).'">
<input type="hidden" name="un" value="'.htmlspecialchars($un).'">
<input type="hidden" name="pw" value="'.htmlspecialchars($pw).'">
<table border="1" cellpadding="1" cellspacing="1" summary="Database selection">'.PHP_EOL;
for ($i = 0; $i < $num_dbs; $i++) {
$db = @mysql_db_name($dbs, $i);
$checked = ! strcasecmp($un, $db) ? ' checked' : '';
$db = htmlspecialchars($db);
echo '<tr><td><input'.$checked.' type="radio" name="db" value="'.$db.'"></td><td>'.$db.'</td></tr>'.PHP_EOL;
}
echo '</table><br>
<input type="submit" name="submit" value="Submit">
<input type="submit" name="cancel" value="Cancel">
</form>'.PHP_EOL;
} else if (!isset($tb)) {
echo '<h1>Please select a table from database: '.htmlspecialchars($db).'</h1>
<form action="'.htmlspecialchars($self).'" method="POST">
<input type="hidden" name="hn" value="'.htmlspecialchars($hn).'">
<input type="hidden" name="un" value="'.htmlspecialchars($un).'">
<input type="hidden" name="pw" value="'.htmlspecialchars($pw).'">
<input type="hidden" name="db" value="'.htmlspecialchars($db).'">
<table border="1" cellpadding="1" cellspacing="1" summary="Table selection">'.PHP_EOL;
$tbs = @mysql_list_tables($db, $dbl);
$num_tbs = @mysql_num_rows($tbs);
for ($j = 0; $j < $num_tbs; $j++) {
$tb = @mysql_tablename($tbs, $j);
$tb = htmlspecialchars($tb);
$checked = $j == 0 ? ' checked' : '';
echo '<tr><td><input'.$checked.' type="radio" name="tb" value="'.$tb.'"></td><td>'.$tb.'</td></tr>'.PHP_EOL;
}
echo '</table><br>
<input type="submit" name="submit" value="Submit">
<input type="submit" name="cancel" value="Cancel">
</form>'.PHP_EOL;
} else if (!isset($id)) {
echo ' <h1>Please select an identifier from table: '.htmlspecialchars($tb).'</h1>
<p>
This field will be used in change, view, copy and delete operations.<br>
The field should be numeric and must uniquely identify a record.
</p>
<p>
Please note, that there were problems reported by phpMyEdit users
regarding using MySQL reserved word as unique key name (the example for
this is "key" name). Thus we recommend you to use another name
of unique key. Usage of "id" or "ID" should be safe and good idea.
</p>
<form action="'.htmlspecialchars($self).'" method="POST">
<input type="hidden" name="hn" value="'.htmlspecialchars($hn).'">
<input type="hidden" name="un" value="'.htmlspecialchars($un).'">
<input type="hidden" name="pw" value="'.htmlspecialchars($pw).'">
<input type="hidden" name="db" value="'.htmlspecialchars($db).'">
<input type="hidden" name="tb" value="'.htmlspecialchars($tb).'">
<table border="1" cellpadding="1" cellspacing="1" summary="Key selection">'.PHP_EOL;
// <tr><td><input type="radio" name="id" value="">
// <td><i>None</i></td><td><i>No id field required</i></td></tr>
@mysql_select_db($db);
$tb_desc = @mysql_query("DESCRIBE $tb");
$fds = @mysql_list_fields($db,$tb,$dbl);
for ($j = 0; ($fd = @mysql_field_name($fds, $j)) != false; $j++) {
$ff = @mysql_field_flags($fds, $j);
strlen($ff) <= 0 && $ff = '---';
$checked = stristr($ff, 'primary_key') ? ' checked' : '';
echo '<tr><td><input',$checked,' type="radio" name="id" value="',htmlspecialchars($fd),'"></td>';
echo '<td>',htmlspecialchars($fd),'</td>';
echo '<td>',htmlspecialchars($ff),'</td>';
$r = @mysql_fetch_array($tb_desc, $j);
}
echo '</table><br>
<input type="submit" name="submit" value="Submit">
<input type="submit" name="cancel" value="Cancel">
</form>'.PHP_EOL;
 
} else if (!isset($options)) {
echo '<h1>Please select additional options</h1>
<form action="'.htmlspecialchars($self).'" method="POST">
<input type="hidden" name="hn" value="'.htmlspecialchars($hn).'">
<input type="hidden" name="un" value="'.htmlspecialchars($un).'">
<input type="hidden" name="pw" value="'.htmlspecialchars($pw).'">
<input type="hidden" name="db" value="'.htmlspecialchars($db).'">
<input type="hidden" name="tb" value="'.htmlspecialchars($tb).'">
<input type="hidden" name="id" value="'.htmlspecialchars($id).'">
<table border="1" cellpadding="1" cellspacing="1" summary="Additional options">
<tr><td>Base filename</td><td><input type="text" name=baseFilename value ="'.htmlspecialchars($tb).'"></td></tr>
<tr><td>Page title</td><td><input type="text" name=pageTitle value ="'.htmlspecialchars($tb).'"></td></tr>
<tr><td>Page header</td><td><input type="checkbox" name=pageHeader></td></tr>
<tr><td>HTML header &amp; footer</td><td><input type="checkbox" name=HTMLissues></td></tr>
<tr><td>CSS basic stylesheet</td><td><input checked type="checkbox" name=CSSstylesheet></td></tr>
</table><br>
<input type="submit" name="submit" value="Submit">
<input type="submit" name="cancel" value="Cancel">
<input type="hidden" name="options" value="1">
</form>'.PHP_EOL;
} else {
echo '<h1>Here is your phpMyEdit calling program</h1>'.PHP_EOL;
echo '<h2>You may now copy and paste it into your PHP editor</h2>'.PHP_EOL;
if ($pageHeader) {
echo_buffer('<h3>'.$pageTitle.'</h3>');
}
$versions = '';
$versions_ar = get_versions();
foreach (array(
'version' => 'phpMyEdit version:',
'core' => 'phpMyEdit.class.php core class:',
'setup' => 'phpMyEditSetup.php script:',
'current' => 'generating setup script:')
as $type => $desc) {
$version = isset($versions_ar[$type]) ? $versions_ar[$type] : 'unknown';
$versions .= sprintf("\n * %36s %s", $desc, $version);
}
echo_buffer("<?php
 
/*
* IMPORTANT NOTE: This generated file contains only a subset of huge amount
* of options that can be used with phpMyEdit. To get information about all
* features offered by phpMyEdit, check official documentation. It is available
* online and also for download on phpMyEdit project management page:
*
* http://platon.sk/projects/main_page.php?project_id=5
*
* This file was generated by:
*$versions
*/
 
// MySQL host name, user name, password, database, and table
\$opts['hn'] = '$hn';
\$opts['un'] = '$un';
\$opts['pw'] = '$pw';
\$opts['db'] = '$db';
\$opts['tb'] = '$tb';
 
// Name of field which is the unique key
\$opts['key'] = '$id';
 
// Type of key field (int/real/string/date etc.)");
 
if ($id == '') {
echo_buffer("\$opts['key_type'] = '';");
} else {
$fds = @mysql_list_fields($db,$tb,$dbl);
for ($j = 0; ($fd = @mysql_field_name($fds, $j)) != ''; $j++) {
if ($fd == $id) {
echo_buffer("\$opts['key_type'] = '".@mysql_field_type($fds, $j)."';");
break;
}
}
}
echo_buffer("
// Sorting field(s)
\$opts['sort_field'] = array('$id');
 
// Number of records to display on the screen
// Value of -1 lists all records in a table
\$opts['inc'] = 15;
 
// Options you wish to give the users
// A - add, C - change, P - copy, V - view, D - delete,
// F - filter, I - initial sort suppressed
\$opts['options'] = 'ACPVDF';
 
// Number of lines to display on multiple selection filters
\$opts['multiple'] = '4';
 
// Navigation style: B - buttons (default), T - text links, G - graphic links
// Buttons position: U - up, D - down (default)
\$opts['navigation'] = 'DB';
 
// Display special page elements
\$opts['display'] = array(
'form' => true,
'query' => true,
'sort' => true,
'time' => true,
'tabs' => true
);
 
// Set default prefixes for variables
\$opts['js']['prefix'] = 'PME_js_';
\$opts['dhtml']['prefix'] = 'PME_dhtml_';
\$opts['cgi']['prefix']['operation'] = 'PME_op_';
\$opts['cgi']['prefix']['sys'] = 'PME_sys_';
\$opts['cgi']['prefix']['data'] = 'PME_data_';
 
/* Get the user's default language and use it if possible or you can
specify particular one you want to use. Refer to official documentation
for list of available languages. */
\$opts['language'] = \$_SERVER['HTTP_ACCEPT_LANGUAGE'];
 
/* Table-level filter capability. If set, it is included in the WHERE clause
of any generated SELECT statement in SQL query. This gives you ability to
work only with subset of data from table.
 
\$opts['filters'] = \"column1 like '%11%' AND column2<17\";
\$opts['filters'] = \"section_id = 9\";
\$opts['filters'] = \"PMEtable0.sessions_count > 200\";
*/
 
/* Field definitions
Fields will be displayed left to right on the screen in the order in which they
appear in generated list. Here are some most used field options documented.
 
['name'] is the title used for column headings, etc.;
['maxlen'] maximum length to display add/edit/search input boxes
['trimlen'] maximum length of string content to display in row listing
['width'] is an optional display width specification for the column
e.g. ['width'] = '100px';
['mask'] a string that is used by sprintf() to format field output
['sort'] true or false; means the users may sort the display on this column
['strip_tags'] true or false; whether to strip tags from content
['nowrap'] true or false; whether this field should get a NOWRAP
['select'] T - text, N - numeric, D - drop-down, M - multiple selection
['options'] optional parameter to control whether a field is displayed
L - list, F - filter, A - add, C - change, P - copy, D - delete, V - view
Another flags are:
R - indicates that a field is read only
W - indicates that a field is a password field
H - indicates that a field is to be hidden and marked as hidden
['URL'] is used to make a field 'clickable' in the display
e.g.: 'mailto:\$value', 'http://\$value' or '\$page?stuff';
['URLtarget'] HTML target link specification (for example: _blank)
['textarea']['rows'] and/or ['textarea']['cols']
specifies a textarea is to be used to give multi-line input
e.g. ['textarea']['rows'] = 5; ['textarea']['cols'] = 10
['values'] restricts user input to the specified constants,
e.g. ['values'] = array('A','B','C') or ['values'] = range(1,99)
['values']['table'] and ['values']['column'] restricts user input
to the values found in the specified column of another table
['values']['description'] = 'desc_column'
The optional ['values']['description'] field allows the value(s) displayed
to the user to be different to those in the ['values']['column'] field.
This is useful for giving more meaning to column values. Multiple
descriptions fields are also possible. Check documentation for this.
*/
");
 
@mysql_select_db($db);
$tb_desc = @mysql_query("DESCRIBE $tb");
$fds = @mysql_list_fields($db, $tb, $dbl);
$num_fds = @mysql_num_fields($fds);
$ts_cnt = 0;
for ($k = 0; $k < $num_fds; $k++) {
$fd = mysql_field_name($fds,$k);
$fm = mysql_fetch_field($fds,$k);
$fn = strtr($fd, '_-.', ' ');
$fn = preg_replace('/(^| +)id( +|$)/', '\\1ID\\2', $fn); // uppercase IDs
$fn = ucfirst($fn);
$row = @mysql_fetch_array($tb_desc);
echo_buffer('$opts[\'fdd\'][\''.$fd.'\'] = array('); // )
echo_buffer(" 'name' => '".str_replace('\'','\\\'',$fn)."',");
$auto_increment = strstr($row[5], 'auto_increment') ? 1 : 0;
if (substr($row[1],0,3) == 'set') {
echo_buffer(" 'select' => 'M',");
} else {
echo_buffer(" 'select' => 'T',");
}
if ($auto_increment) {
echo_buffer(" 'options' => 'AVCPDR', // auto increment");
}
// timestamps are read-only
else if (@mysql_field_type($fds, $k) == 'timestamp') {
if ($ts_cnt > 0) {
echo_buffer(" 'options' => 'AVCPD',");
} else { // first timestamp
echo_buffer(" 'options' => 'AVCPDR', // updated automatically (MySQL feature)");
}
$ts_cnt++;
}
echo_buffer(" 'maxlen' => ".@mysql_field_len($fds,$k).',');
// blobs -> textarea
if (@mysql_field_type($fds,$k) == 'blob') {
echo_buffer(" 'textarea' => array(");
echo_buffer(" 'rows' => 5,");
echo_buffer(" 'cols' => 50),");
}
// SETs and ENUMs get special treatment
if ((substr($row[1],0,3) == 'set' || substr($row[1],0,4) == 'enum')
&& ! (($pos = strpos($row[1], '(')) === false)) {
$indent = str_repeat(' ', 18);
$outstr = substr($row[1], $pos + 2, -2);
$outstr = explode("','", $outstr);
$outstr = str_replace("''", "'", $outstr);
$outstr = str_replace('"', '\\"', $outstr);
$outstr = implode('",'.PHP_EOL.$indent.'"', $outstr);
echo_buffer(" 'values' => array(".PHP_EOL.$indent.'"'.$outstr.'"),');
}
// automatic support for Default values
if ($row[4] != '' && $row[4] != 'NULL') {
echo_buffer(" 'default' => '".$row[4]."',");
} else if ($auto_increment) {
echo_buffer(" 'default' => '0',");
}
// check for table constraints
$outstr = check_constraints($tb, $fd);
if ($outstr != '') {
echo_buffer($outstr);
}
echo_buffer(" 'sort' => true");
//echo_buffer(" 'nowrap' => false,");
echo_buffer(');');
}
 
echo_buffer("
// Now important call to phpMyEdit
require_once 'phpMyEdit.class.php';
new phpMyEdit(\$opts);
 
?>
");
 
$css_directive = <<<END
<style type="text/css">
hr.pme-hr { border: 0px solid; padding: 0px; margin: 0px; border-top-width: 1px; height: 1px; }
table.pme-main { border: #004d9c 1px solid; border-collapse: collapse; border-spacing: 0px; width: 100%; }
table.pme-navigation { border: #004d9c 0px solid; border-collapse: collapse; border-spacing: 0px; width: 100%; }
th.pme-header { border: #004d9c 1px solid; padding: 4px; background: #add8e6; }
td.pme-key-0, td.pme-value-0, td.pme-help-0, td.pme-navigation-0, td.pme-cell-0,
td.pme-key-1, td.pme-value-1, td.pme-help-0, td.pme-navigation-1, td.pme-cell-1,
td.pme-sortinfo, td.pme-filter { border: #004d9c 1px solid; padding: 3px; }
td.pme-buttons { text-align: left; }
td.pme-message { text-align: center; }
td.pme-stats { text-align: right; }
</style>
END;
if (! $CSSstylesheet) {
$css_directive = '';
}
 
if ($HTMLissues) {
$buffer = <<<END
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>$pageTitle</title>
$css_directive
</head>
<body>
$buffer
</body>
</html>
END;
} else if ($CSSstylesheet) {
$buffer = $css_directive . $buffer;
}
// write the content include file
echo 'Trying to write content file to: <b>'.'./'.$contentFile.'</b><br>'.PHP_EOL;
$filehandle = @fopen('./'.$contentFile, 'w+');
if ($filehandle) {
fwrite($filehandle, $buffer);
flush($filehandle);
fclose($filehandle);
echo 'phpMyEdit content file written successfully<br>';
} else {
echo 'phpMyEdit content file was NOT written due to inssufficient privileges.<br>';
echo 'Please copy and paste content listed below to <i>'.'./'.$contentFile.'</i> file.';
}
echo '<br><hr>';
echo '<pre>';
echo_html($buffer);
echo '</pre><hr>'.PHP_EOL;
}
 
?>
 
</body>
</html>
 
/trunk/jrest/util/phpMyEdit.class.php
New file
0,0 → 1,3312
<?php
 
/*
* phpMyEdit - instant MySQL table editor and code generator
*
* phpMyEdit.class.php - main table editor class definition file
* ____________________________________________________________
*
* Copyright (c) 1999-2002 John McCreesh <jpmcc@users.sourceforge.net>
* Copyright (c) 2001-2002 Jim Kraai <jkraai@users.sourceforge.net>
* Versions 5.0 and higher developed by Ondrej Jombik <nepto@php.net>
* Copyright (c) 2002-2006 Platon Group, http://platon.sk/
* All rights reserved.
*
* See README file for more information about this software.
* See COPYING file for license information.
*
* Download the latest version from
* http://platon.sk/projects/phpMyEdit/
*/
 
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.188 2006-09-08 16:30:31 michal Exp $ */
 
/* This is a generic table editing program. The table and fields to be
edited are defined in the calling program.
 
This program works in three passes.
* Pass 1 (the last part of the program) displays the selected MySQL
table in a scrolling table on the screen. Radio buttons are used to
select a record for editing or deletion. If the user chooses Add,
Change, Copy, View or Delete buttons.
* Pass 2 starts, displaying the selected record. If the user chooses
the Save button from this screen.
* Pass 3 processes the update and the display returns to the
original table view (Pass 1).
*/
 
class phpMyEdit_timer /* {{{ */
{
var $startTime;
var $started;
 
function phpMyEdit_timer($start = true)
{
$this->started = false;
if ($start) {
$this->start();
}
}
 
function start()
{
$startMtime = explode(' ', microtime());
$this->startTime = (double) $startMtime[0] + (double) $startMtime[1];
$this->started = true;
}
 
function end($iterations = 1)
{
// get the time, check whether the timer was started later
$endMtime = explode(' ', microtime());
if ($this->started) {
$endTime = (double)($endMtime[0])+(double)($endMtime[1]);
$dur = $endTime - $this->startTime;
$avg = 1000 * $dur / $iterations;
$avg = round(1000 * $avg) / 1000;
return $avg;
} else {
return 'phpMyEdit_timer ERROR: timer not started';
}
}
} /* }}} */
 
if (! function_exists('array_search')) { /* {{{ */
function array_search($needle, $haystack)
{
foreach ($haystack as $key => $value) {
if ($needle == $value)
return $key;
}
return false;
}
} /* }}} */
 
if (! function_exists('realpath')) { /* {{{ */
function realpath($path)
{
return $path;
}
} /* }}} */
 
class phpMyEdit
{
// Class variables {{{
 
// Database handling
var $hn; // hostname
var $un; // user name
var $pw; // password
var $tb; // table
var $db; // database
var $dbp; // database with point
var $dbh; // database handle
var $close_dbh; // if database handle should be closed
 
// Record manipulation
var $key; // name of field which is the unique key
var $key_num; // number of field which is the unique key
var $key_type; // type of key field (int/real/string/date etc.)
var $key_delim; // character used for key value quoting
var $rec; // number of record selected for editing
var $inc; // number of records to display
var $fm; // first record to display
var $fl; // is the filter row displayed (boolean)
var $fds; // sql field names
var $fdn; // sql field names => $k
var $num_fds; // number of fields
var $options; // options for users: ACDFVPI
var $fdd; // field definitions
var $qfn; // value of all filters used during the last pass
var $sfn; // sort field number (- = descending sort order)
var $cur_tab; // current selected tab
 
// Operation
var $navop; // navigation buttons/operations
var $sw; // filter display/hide/clear button
var $operation; // operation to do: Add, Change, Delete
var $saveadd;
var $moreadd;
var $canceladd;
var $savechange;
var $morechange;
var $cancelchange;
var $savecopy;
var $cancelcopy;
var $savedelete;
var $canceldelete;
var $cancelview;
 
// Additional features
var $labels; // multilingual labels
var $cgi; // CGI variable features array
var $js; // JS configuration array
var $dhtml; // DHTML configuration array
var $url; // URL array
var $message; // informational message to print
var $notify; // change notification e-mail adresses
var $logtable; // name of optional logtable
var $navigation; // navigation style
var $tabs; // TAB names
var $timer = null; // phpMyEdit_timer object
 
// Predefined variables
var $comp_ops = array('<'=>'<','<='=>'<=','='=>'=','>='=>'>=','>'=>'>');
var $sql_aggrs = array(
'sum' => 'Total',
'avg' => 'Average',
'min' => 'Minimum',
'max' => 'Maximum',
'count' => 'Count');
var $page_types = array(
'L' => 'list',
'F' => 'filter',
'A' => 'add',
'V' => 'view',
'C' => 'change',
'P' => 'copy',
'D' => 'delete'
);
var $default_buttons = array(
'L' => array('<<','<','add','view','change','copy','delete','>','>>','goto','goto_combo'),
'F' => array('<<','<','add','view','change','copy','delete','>','>>','goto','goto_combo'),
'A' => array('save','more','cancel'),
'C' => array('save','more','cancel'),
'P' => array('save', 'cancel'),
'D' => array('save','cancel'),
'V' => array('change','cancel')
);
// }}}
 
/*
* column specific functions
*/
 
function col_has_sql($k) { return isset($this->fdd[$k]['sql']); }
function col_has_sqlw($k) { return isset($this->fdd[$k]['sqlw']) && !$this->virtual($k); }
function col_has_values($k) { return isset($this->fdd[$k]['values']) || isset($this->fdd[$k]['values2']); }
function col_has_php($k) { return isset($this->fdd[$k]['php']); }
function col_has_URL($k) { return isset($this->fdd[$k]['URL'])
|| isset($this->fdd[$k]['URLprefix']) || isset($this->fdd[$k]['URLpostfix']); }
function col_has_multiple($k)
{ return $this->col_has_multiple_select($k) || $this->col_has_checkboxes($k); }
function col_has_multiple_select($k)
{ return $this->fdd[$k]['select'] == 'M' && ! $this->fdd[$k]['values']['table']; }
function col_has_checkboxes($k)
{ return $this->fdd[$k]['select'] == 'C' && ! $this->fdd[$k]['values']['table']; }
function col_has_radio_buttons($k)
{ return $this->fdd[$k]['select'] == 'O' && ! $this->fdd[$k]['values']['table']; }
function col_has_datemask($k)
{ return isset($this->fdd[$k]['datemask']) || isset($this->fdd[$k]['strftimemask']); }
 
/*
* functions for indicating whether navigation style is enabled
*/
 
function nav_buttons() { return stristr($this->navigation, 'B'); }
function nav_text_links() { return stristr($this->navigation, 'T'); }
function nav_graphic_links() { return stristr($this->navigation, 'G'); }
function nav_up() { return (stristr($this->navigation, 'U') && !($this->buttons[$this->page_type]['up'] === false)); }
function nav_down() { return (stristr($this->navigation, 'D') && !($this->buttons[$this->page_type]['down'] === false)); }
 
/*
* functions for indicating whether operations are enabled
*/
 
function add_enabled() { return stristr($this->options, 'A'); }
function change_enabled() { return stristr($this->options, 'C'); }
function delete_enabled() { return stristr($this->options, 'D'); }
function filter_enabled() { return stristr($this->options, 'F'); }
function view_enabled() { return stristr($this->options, 'V'); }
function copy_enabled() { return stristr($this->options, 'P') && $this->add_enabled(); }
function tabs_enabled() { return $this->display['tabs'] && count($this->tabs) > 0; }
function hidden($k) { return stristr($this->fdd[$k]['input'],'H'); }
function password($k) { return stristr($this->fdd[$k]['input'],'W'); }
function readonly($k) { return stristr($this->fdd[$k]['input'],'R') || $this->virtual($k); }
function virtual($k) { return stristr($this->fdd[$k]['input'],'V') && $this->col_has_sql($k); }
 
function add_operation() { return $this->operation == $this->labels['Add'] && $this->add_enabled(); }
function change_operation() { return $this->operation == $this->labels['Change'] && $this->change_enabled(); }
function copy_operation() { return $this->operation == $this->labels['Copy'] && $this->copy_enabled(); }
function delete_operation() { return $this->operation == $this->labels['Delete'] && $this->delete_enabled(); }
function view_operation() { return $this->operation == $this->labels['View'] && $this->view_enabled(); }
function filter_operation() { return $this->fl && $this->filter_enabled() && $this->list_operation(); }
function list_operation() { /* covers also filtering page */ return ! $this->change_operation()
&& ! $this->add_operation() && ! $this->copy_operation()
&& ! $this->delete_operation() && ! $this->view_operation(); }
function next_operation() { return ($this->navop == $this->labels['Next']) || ($this->navop == '>'); }
function prev_operation() { return ($this->navop == $this->labels['Prev']) || ($this->navop == '<'); }
function first_operation() { return ($this->navop == $this->labels['First']) || ($this->navop == '<<'); }
function last_operation() { return ($this->navop == $this->labels['Last']) || ($this->navop == '>>'); }
function clear_operation() { return $this->sw == $this->labels['Clear']; }
 
function add_canceled() { return $this->canceladd == $this->labels['Cancel']; }
function view_canceled() { return $this->cancelview == $this->labels['Cancel']; }
function change_canceled() { return $this->cancelchange == $this->labels['Cancel']; }
function copy_canceled() { return $this->cancelcopy == $this->labels['Cancel']; }
function delete_canceled() { return $this->canceldelete == $this->labels['Cancel']; }
 
function is_values2($k, $val = 'X') /* {{{ */
{
return $val === null ||
(isset($this->fdd[$k]['values2']) && !isset($this->fdd[$k]['values']['table']));
} /* }}} */
 
function processed($k) /* {{{ */
{
if ($this->virtual($k)) {
return false;
}
$options = @$this->fdd[$k]['options'];
if (! isset($options)) {
return true;
}
return
($this->saveadd == $this->labels['Save'] && stristr($options, 'A')) ||
($this->moreadd == $this->labels['More'] && stristr($options, 'A')) ||
($this->savechange == $this->labels['Save'] && stristr($options, 'C')) ||
($this->morechange == $this->labels['Apply'] && stristr($options, 'C')) ||
($this->savecopy == $this->labels['Save'] && stristr($options, 'P')) ||
($this->savedelete == $this->labels['Save'] && stristr($options, 'D'));
} /* }}} */
 
function displayed($k) /* {{{ */
{
if (is_numeric($k)) {
$k = $this->fds[$k];
}
$options = @$this->fdd[$k]['options'];
if (! isset($options)) {
return true;
}
return
($this->add_operation() && stristr($options, 'A')) ||
($this->view_operation() && stristr($options, 'V')) ||
($this->change_operation() && stristr($options, 'C')) ||
($this->copy_operation() && stristr($options, 'P')) ||
($this->delete_operation() && stristr($options, 'D')) ||
($this->filter_operation() && stristr($options, 'F')) ||
($this->list_operation() && stristr($options, 'L'));
} /* }}} */
function debug_var($name, $val) /* {{{ */
{
if (is_array($val) || is_object($val)) {
echo "<pre>$name\n";
ob_start();
//print_r($val);
var_dump($val);
$content = ob_get_contents();
ob_end_clean();
echo htmlspecialchars($content);
echo "</pre>\n";
} else {
echo 'debug_var()::<i>',htmlspecialchars($name),'</i>';
echo '::<b>',htmlspecialchars($val),'</b>::',"<br />\n";
}
} /* }}} */
 
function myquery($qry, $line = 0, $debug = 0) /* {{{ */
{
global $debug_query;
if ($debug_query || $debug) {
$line = intval($line);
echo '<h4>MySQL query at line ',$line,'</h4>',htmlspecialchars($qry),'<hr />',"\n";
}
if (isset($this->db)) {
$ret = @mysql_db_query($this->db, $qry, $this->dbh);
} else {
$ret = @mysql_query($qry, $this->dbh);
}
if (! $ret) {
echo '<h4>MySQL error ',mysql_errno($this->dbh),'</h4>';
echo htmlspecialchars(mysql_error($this->dbh)),'<hr />',"\n";
}
return $ret;
} /* }}} */
 
function make_language_labels($language) /* {{{ */
{
// just try the first language and variant
// this isn't content-negotiation rfc compliant
$language = strtoupper($language);
 
// try the full language w/ variant
$file = $this->dir['lang'].'PME.lang.'.$language.'.inc';
 
if (! file_exists($file)) {
// try the language w/o variant
$file = $this->dir['lang'].'PME.lang.'.substr($language,0,2).'.inc';
}
if (! file_exists($file)) {
// default to classical English
$file = $this->dir['lang'].'PME.lang.EN.inc';
}
$ret = @include($file);
if (! is_array($ret)) {
return $ret;
}
$small = array(
'Search' => 'v',
'Hide' => '^',
'Clear' => 'X',
'Query' => htmlspecialchars('>'));
if ((!$this->nav_text_links() && !$this->nav_graphic_links())
|| !isset($ret['Search']) || !isset($ret['Query'])
|| !isset($ret['Hide']) || !isset($ret['Clear'])) {
foreach ($small as $key => $val) {
$ret[$key] = $val;
}
}
return $ret;
} /* }}} */
 
function set_values($field_num, $prepend = null, $append = null, $strict = false) /* {{{ */
{
return (array) $prepend + (array) $this->fdd[$field_num]['values2']
+ (isset($this->fdd[$field_num]['values']['table']) || $strict
? $this->set_values_from_table($field_num, $strict)
: array())
+ (array) $append;
} /* }}} */
 
function set_values_from_table($field_num, $strict = false) /* {{{ */
{
$db = &$this->fdd[$field_num]['values']['db'];
$table = &$this->fdd[$field_num]['values']['table'];
$key = &$this->fdd[$field_num]['values']['column'];
$desc = &$this->fdd[$field_num]['values']['description'];
$dbp = isset($db) ? "$db." : $this->dbp;
$qparts['type'] = 'select';
if ($table) {
$qparts['select'] = 'DISTINCT '.$table.'.'.$key;
if ($desc && is_array($desc) && is_array($desc['columns'])) {
$qparts['select'] .= ',CONCAT('; // )
$num_cols = sizeof($desc['columns']);
if (isset($desc['divs'][-1])) {
$qparts['select'] .= '"'.addslashes($desc['divs'][-1]).'",';
}
foreach ($desc['columns'] as $key => $val) {
if ($val) {
$qparts['select'] .= 'IFNULL('.$val.',"")';
if ($desc['divs'][$key]) {
$qparts['select'] .= ',"'.addslashes($desc['divs'][$key]).'"';
}
$qparts['select'] .= ',';
}
}
$qparts['select']{strlen($qparts['select']) - 1} = ')';
$qparts['select'] .= ' AS PMEalias'.$field_num;
$qparts['orderby'] = 'PMEalias'.$field_num;
} else if ($desc && is_array($desc)) {
// TODO
} else if ($desc) {
$qparts['select'] .= ','.$table.'.'.$desc;
$qparts['orderby'] = $desc;
} else if ($key) {
$qparts['orderby'] = $key;
}
$qparts['from'] = "$dbp$table";
$ar = array(
'table' => $table,
'column' => $column,
'description' => $desc);
$qparts['where'] = $this->substituteVars($this->fdd[$field_num]['values']['filters'], $ar);
if ($this->fdd[$field_num]['values']['orderby']) {
$qparts['orderby'] = $this->substituteVars($this->fdd[$field_num]['values']['orderby'], $ar);
}
} else { /* simple value extraction */
$key = &$this->fds[$field_num];
$this->virtual($field_num) && $key = $this->fqn($field_num);
$qparts['select'] = 'DISTINCT '.$key.' AS PMEkey';
$qparts['orderby'] = 'PMEkey';
$qparts['from'] = $this->dbp.$this->tb;
}
$values = array();
$res = $this->myquery($this->get_SQL_query($qparts), __LINE__);
while ($row = @mysql_fetch_array($res, MYSQL_NUM)) {
$values[$row[0]] = $desc ? $row[1] : $row[0];
}
return $values;
} /* }}} */
 
function fqn($field, $dont_desc = false, $dont_cols = false) /* {{{ */
{
is_numeric($field) || $field = array_search($field, $this->fds);
// if read SQL expression exists use it
if ($this->col_has_sql($field))
return $this->fdd[$field]['sql'];
// on copy/change always use simple key retrieving
if ($this->add_operation()
|| $this->copy_operation()
|| $this->change_operation()) {
$ret = 'PMEtable0.'.$this->fds[$field];
} else {
if ($this->fdd[$this->fds[$field]]['values']['description'] && ! $dont_desc) {
$desc = &$this->fdd[$this->fds[$field]]['values']['description'];
if (is_array($desc) && is_array($desc['columns'])) {
$ret = 'CONCAT('; // )
$num_cols = sizeof($desc['columns']);
if (isset($desc['divs'][-1])) {
$ret .= '"'.addslashes($desc['divs'][-1]).'",';
}
foreach ($desc['columns'] as $key => $val) {
if ($val) {
$ret .= 'PMEjoin'.$field.'.'.$val;
if ($desc['divs'][$key]) {
$ret .= ',"'.addslashes($desc['divs'][$key]).'"';
}
$ret .= ',';
}
}
$ret{strlen($ret) - 1} = ')';
} else if (is_array($desc)) {
// TODO
} else {
$ret = 'PMEjoin'.$field.'.'.$this->fdd[$this->fds[$field]]['values']['description'];
}
// TODO: remove me
} elseif (0 && $this->fdd[$this->fds[$field]]['values']['column'] && ! $dont_cols) {
$ret = 'PMEjoin'.$field.'.'.$this->fdd[$this->fds[$field]]['values']['column'];
} else {
$ret = 'PMEtable0.'.$this->fds[$field];
}
// TODO: not neccessary, remove me!
if (is_array($this->fdd[$this->fds[$field]]['values2'])) {
}
}
return $ret;
} /* }}} */
 
function get_SQL_query($parts) /* {{{ */
{
foreach ($parts as $k => $v) {
$parts[$k] = trim($parts[$k]);
}
switch ($parts['type']) {
case 'select':
$ret = 'SELECT ';
if ($parts['DISTINCT'])
$ret .= 'DISTINCT ';
$ret .= $parts['select'];
$ret .= ' FROM '.$parts['from'];
if ($parts['where'] != '')
$ret .= ' WHERE '.$parts['where'];
if ($parts['groupby'] != '')
$ret .= ' GROUP BY '.$parts['groupby'];
if ($parts['having'] != '')
$ret .= ' HAVING '.$parts['having'];
if ($parts['orderby'] != '')
$ret .= ' ORDER BY '.$parts['orderby'];
if ($parts['limit'] != '')
$ret .= ' LIMIT '.$parts['limit'];
if ($parts['procedure'] != '')
$ret .= ' PROCEDURE '.$parts['procedure'];
break;
case 'update':
$ret = 'UPDATE '.$parts['table'];
$ret .= ' SET '.$parts['fields'];
if ($parts['where'] != '')
$ret .= ' WHERE '.$parts['where'];
break;
case 'insert':
$ret = 'INSERT INTO '.$parts['table'];
$ret .= ' VALUES '.$parts['values'];
break;
case 'delete':
$ret = 'DELETE FROM '.$parts['table'];
if ($parts['where'] != '')
$ret .= ' WHERE '.$parts['where'];
break;
default:
die('unknown query type');
break;
}
return $ret;
} /* }}} */
 
function get_SQL_column_list() /* {{{ */
{
$fields = array();
for ($k = 0; $k < $this->num_fds; $k++) {
if (! $this->displayed[$k] && $k != $this->key_num) {
continue;
}
$fields[] = $this->fqn($k).' AS qf'.$k;
if ($this->col_has_values($k)) {
$fields[] = $this->fqn($k, true, true).' AS qf'.$k.'_idx';
}
if ($this->col_has_datemask($k)) {
$fields[] = 'UNIX_TIMESTAMP('.$this->fqn($k).') AS qf'.$k.'_timestamp';
}
}
return join(',', $fields);
} /* }}} */
 
function get_SQL_join_clause() /* {{{ */
{
$main_table = 'PMEtable0';
$join_clause = $this->tb." AS $main_table";
for ($k = 0, $numfds = sizeof($this->fds); $k < $numfds; $k++) {
$main_column = $this->fds[$k];
if($this->fdd[$main_column]['values']['db']) {
$dbp = $this->fdd[$main_column]['values']['db'].'.';
} else {
$dbp = $this->dbp;
}
$table = @$this->fdd[$main_column]['values']['table'];
$join_column = @$this->fdd[$main_column]['values']['column'];
$join_desc = @$this->fdd[$main_column]['values']['description'];
if ($join_desc != '' && $join_column != '') {
$join_table = 'PMEjoin'.$k;
$ar = array(
'main_table' => $main_table,
'main_column' => $main_column,
'join_table' => $join_table,
'join_column' => $join_column,
'join_description' => $join_desc);
$join_clause .= " LEFT OUTER JOIN $dbp$table AS $join_table ON (";
$join_clause .= isset($this->fdd[$main_column]['values']['join'])
? $this->substituteVars($this->fdd[$main_column]['values']['join'], $ar)
: "$join_table.$join_column = $main_table.$main_column";
if (isset($this->fdd[$main_column]['values']['filters'])) {
$join_clause .= ' AND ';
$join_clause .= $this->substituteVars($this->fdd[$main_column]['values']['filters'], $ar);
}
$join_clause .= ')';
}
}
return $join_clause;
} /* }}} */
 
function get_SQL_where_from_query_opts($qp = null, $text = 0) /* {{{ */
{
if ($qp == null) {
$qp = $this->query_opts;
}
$where = array();
foreach ($qp as $field => $ov) {
if (is_numeric($field)) {
$tmp_where = array();
foreach ($ov as $field2 => $ov2) {
$tmp_where[] = sprintf('%s %s %s', $field2, $ov2['oper'], $ov2['value']);
}
$where[] = '('.join(' OR ', $tmp_where).')';
} else {
if (is_array($ov['value'])) {
$tmp_ov_val = '';
foreach ($ov['value'] as $ov_val) {
strlen($tmp_ov_val) > 0 && $tmp_ov_val .= ' OR ';
$tmp_ov_val .= sprintf('FIND_IN_SET("%s",%s)', $ov_val, $field);
}
$where[] = "($tmp_ov_val)";
} else {
$where[] = sprintf('%s %s %s', $field, $ov['oper'], $ov['value']);
}
}
}
// Add any coder specified filters
if (! $text && $this->filters) {
$where[] = '('.$this->filters.')';
}
if (count($where) > 0) {
if ($text) {
return str_replace('%', '*', join(' AND ',$where));
} else {
return join(' AND ',$where);
}
}
return ''; /* empty string */
} /* }}} */
 
function gather_query_opts() /* {{{ */
{
$this->query_opts = array();
$this->prev_qfn = $this->qfn;
$this->qfn = '';
if ($this->clear_operation()) {
return;
}
// gathers query options into an array, $this->query_opts
$qo = array();
for ($k = 0; $k < $this->num_fds; $k++) {
$l = 'qf'.$k;
$lc = 'qf'.$k.'_comp';
$li = 'qf'.$k.'_id';
$m = $this->get_sys_cgi_var($l);
$mc = $this->get_sys_cgi_var($lc);
$mi = $this->get_sys_cgi_var($li);
if (! isset($m) && ! isset($mi)) {
continue;
}
if (is_array($m) || is_array($mi)) {
if (is_array($mi)) {
$m = $mi;
$l = $li;
}
if (in_array('*', $m)) {
continue;
}
if ($this->col_has_values($k) && $this->col_has_multiple($k)) {
foreach (array_keys($m) as $key) {
$m[$key] = addslashes($m[$key]);
}
$qo[$this->fqn($k)] = array('value' => $m);
} else {
$qf_op = '';
foreach (array_keys($m) as $key) {
if ($qf_op == '') {
$qf_op = 'IN';
$qf_val = '"'.addslashes($m[$key]).'"';
$afilter = ' IN ("'.addslashes($m[$key]).'"'; // )
} else {
$afilter = $afilter.',"'.addslashes($m[$key]).'"';
$qf_val .= ',"'.addslashes($m[$key]).'"';
}
$this->qfn .= '&'.$this->cgi['prefix']['sys'].$l.'['.rawurlencode($key).']='.rawurlencode($m[$key]);
}
$afilter = $afilter.')';
// XXX: $dont_desc and $dont_cols hack
$dont_desc = isset($this->fdd[$k]['values']['description']);
$dont_cols = isset($this->fdd[$k]['values']['column']);
$qo[$this->fqn($k, $dont_desc, $dont_cols)] =
array('oper' => $qf_op, 'value' => "($qf_val)"); // )
}
} else if (isset($mi)) {
if ($mi == '*') {
continue;
}
if ($this->fdd[$k]['select'] != 'M' && $this->fdd[$k]['select'] != 'D' && $mi == '') {
continue;
}
$afilter = addslashes($mi);
$qo[$this->fqn($k, true, true)] = array('oper' => '=', 'value' => "'$afilter'");
$this->qfn .= '&'.$this->cgi['prefix']['sys'].$li.'='.rawurlencode($mi);
} else if (isset($m)) {
if ($m == '*') {
continue;
}
if ($this->fdd[$k]['select'] != 'M' && $this->fdd[$k]['select'] != 'D' && $m == '') {
continue;
}
$afilter = addslashes($m);
if ($this->fdd[$k]['select'] == 'N') {
$mc = in_array($mc, $this->comp_ops) ? $mc : '=';
$qo[$this->fqn($k)] = array('oper' => $mc, 'value' => "'$afilter'");
$this->qfn .= '&'.$this->cgi['prefix']['sys'].$l .'='.rawurlencode($m);
$this->qfn .= '&'.$this->cgi['prefix']['sys'].$lc.'='.rawurlencode($mc);
} else {
$afilter = '%'.str_replace('*', '%', $afilter).'%';
$ids = array();
$ar = array();
$ar[$this->fqn($k)] = array('oper' => 'LIKE', 'value' => "'$afilter'");
if (is_array($this->fdd[$k]['values2'])) {
foreach ($this->fdd[$k]['values2'] as $key => $val) {
if (strlen($m) > 0 && stristr($val, $m)) {
$ids[] = '"'.addslashes($key).'"';
}
}
if (count($ids) > 0) {
$ar[$this->fqn($k, true, true)]
= array('oper' => 'IN', 'value' => '('.join(',', $ids).')');
}
}
$qo[] = $ar;
$this->qfn .= '&'.$this->cgi['prefix']['sys'].$l.'='.rawurlencode($m);
}
}
}
$this->query_opts = $qo;
} /* }}} */
 
/*
* Create JavaScripts
*/
 
function form_begin() /* {{{ */
{
$page_name = htmlspecialchars($this->page_name);
if ($this->add_operation() || $this->change_operation() || $this->copy_operation()
|| $this->view_operation() || $this->delete_operation()) {
$field_to_tab = array();
for ($tab = $k = $this->cur_tab = 0; $k < $this->num_fds; $k++) {
if (isset($this->fdd[$k]['tab'])) {
if ($tab == 0 && $k > 0) {
$this->tabs[0] = 'PMEtab0';
$this->cur_tab = 1;
$tab++;
}
if (is_array($this->fdd[$k]['tab'])) {
$this->tabs[$tab] = @$this->fdd[$k]['tab']['name'];
$this->fdd[$k]['tab']['default'] && $this->cur_tab = $tab;
} else {
$this->tabs[$tab] = @$this->fdd[$k]['tab'];
}
$tab++;
}
$field_to_tab[$k] = max(0, $tab - 1);
}
if (preg_match('/^'.$this->dhtml['prefix'].'tab(\d+)$/', $this->get_sys_cgi_var('cur_tab'), $parts)) {
$this->cur_tab = $parts[1];
}
if ($this->tabs_enabled()) {
// initial TAB styles
echo '<style type="text/css" media="screen">',"\n";
for ($i = 0; $i < count($this->tabs); $i++) {
echo ' #'.$this->dhtml['prefix'].'tab',$i,' { display: ';
echo (($i == $this->cur_tab || $this->tabs[$i] == 'PMEtab0' ) ? 'block' : 'none') ,'; }',"\n";
}
echo '</style>',"\n";
// TAB javascripts
echo '<script type="text/javascript"><!--',"\n\n";
$css_class_name1 = $this->getCSSclass('tab', $position);
$css_class_name2 = $this->getCSSclass('tab-selected', $position);
echo 'var '.$this->js['prefix'].'cur_tab = "'.$this->dhtml['prefix'].'tab',$this->cur_tab,'";
 
function '.$this->js['prefix'].'show_tab(tab_name)
{';
if ($this->nav_up()) {
echo '
document.getElementById('.$this->js['prefix'].'cur_tab+"_up_label").className = "',$css_class_name1,'";
document.getElementById('.$this->js['prefix'].'cur_tab+"_up_link").className = "',$css_class_name1,'";
document.getElementById(tab_name+"_up_label").className = "',$css_class_name2,'";
document.getElementById(tab_name+"_up_link").className = "',$css_class_name2,'";';
}
if ($this->nav_down()) {
echo '
document.getElementById('.$this->js['prefix'].'cur_tab+"_down_label").className = "',$css_class_name1,'";
document.getElementById('.$this->js['prefix'].'cur_tab+"_down_link").className = "',$css_class_name1,'";
document.getElementById(tab_name+"_down_label").className = "',$css_class_name2,'";
document.getElementById(tab_name+"_down_link").className = "',$css_class_name2,'";';
}
echo '
document.getElementById('.$this->js['prefix'].'cur_tab).style.display = "none";
document.getElementById(tab_name).style.display = "block";
'.$this->js['prefix'].'cur_tab = tab_name;
document.'.$this->cgi['prefix']['sys'].'form.'.$this->cgi['prefix']['sys'].'cur_tab.value = tab_name;
}',"\n\n";
echo '// --></script>', "\n";
}
}
 
if ($this->add_operation() || $this->change_operation() || $this->copy_operation()) {
$first_required = true;
for ($k = 0; $k < $this->num_fds; $k++) {
if ($this->displayed[$k] && ! $this->readonly($k) && ! $this->hidden($k)
&& ($this->fdd[$k]['js']['required'] || isset($this->fdd[$k]['js']['regexp']))) {
if ($first_required) {
$first_required = false;
echo '<script type="text/javascript"><!--',"\n";
echo '
function '.$this->js['prefix'].'trim(str)
{
while (str.substring(0, 1) == " "
|| str.substring(0, 1) == "\\n"
|| str.substring(0, 1) == "\\r")
{
str = str.substring(1, str.length);
}
while (str.substring(str.length - 1, str.length) == " "
|| str.substring(str.length - 1, str.length) == "\\n"
|| str.substring(str.length - 1, str.length) == "\\r")
{
str = str.substring(0, str.length - 1);
}
return str;
}
 
function '.$this->js['prefix'].'form_control(theForm)
{',"\n";
}
if ($this->col_has_values($k)) {
$condition = 'theForm.'.$this->cgi['prefix']['data'].$this->fds[$k].'.selectedIndex == -1';
$multiple = $this->col_has_multiple_select($k);
} else {
$condition = '';
$multiple = false;
if ($this->fdd[$k]['js']['required']) {
$condition = $this->js['prefix'].'trim(theForm.'.$this->cgi['prefix']['data'].$this->fds[$k].'.value) == ""';
}
if (isset($this->fdd[$k]['js']['regexp'])) {
$condition .= (strlen($condition) > 0 ? ' || ' : '');
$condition .= sprintf('!(%s.test('.$this->js['prefix'].'trim(theForm.%s.value)))',
$this->fdd[$k]['js']['regexp'], $this->cgi['prefix']['data'].$this->fds[$k]);
}
}
 
/* Multiple selects have their name like ``name[]''.
It is not possible to work with them directly, because
theForm.name[].something will result into JavaScript
syntax error. Following search algorithm is provided
as a workaround for this.
*/
if ($multiple) {
echo '
multiple_select = null;
for (i = 0; i < theForm.length; i++) {
if (theForm.elements[i].name == "',$this->cgi['prefix']['data'].$this->fds[$k],'[]") {
multiple_select = theForm.elements[i];
break;
}
}
if (multiple_select != null && multiple_select.selectedIndex == -1) {';
} else {
echo '
if (',$condition,') {';
}
echo '
alert("';
if (isset($this->fdd[$k]['js']['hint'])) {
echo htmlspecialchars($this->fdd[$k]['js']['hint']);
} else {
echo $this->labels['Please enter'],' ',$this->fdd[$k]['name'],'.';
}
echo '");';
if ($this->tabs_enabled() && $field_to_tab[$k] >= $this->cur_tab) {
echo '
'.$this->js['prefix'].'show_tab("'.$this->dhtml['prefix'].'tab',$field_to_tab[$k],'");';
}
echo '
theForm.',$this->cgi['prefix']['data'].$this->fds[$k],'.focus();
return false;
}',"\n";
}
}
if (! $first_required) {
echo '
return true;
}',"\n\n";
echo '// --></script>', "\n";
}
}
 
if ($this->filter_operation()) {
echo '<script type="text/javascript"><!--',"\n";
echo '
function '.$this->js['prefix'].'filter_handler(theForm, theEvent)
{
var pressed_key = null;
if (theEvent.which) {
pressed_key = theEvent.which;
} else {
pressed_key = theEvent.keyCode;
}
if (pressed_key == 13) { // enter pressed
theForm.submit();
return false;
}
return true;
}',"\n\n";
echo '// --></script>', "\n";
}
 
if ($this->display['form']) {
echo '<form class="',$this->getCSSclass('form'),'" method="post"';
echo ' action="',$page_name,'" name="'.$this->cgi['prefix']['sys'].'form">',"\n";
}
return true;
} /* }}} */
 
function form_end() /* {{{ */
{
if ($this->display['form']) {
echo '</form>',"\n";
}
} /* }}} */
 
function display_tab_labels($position) /* {{{ */
{
if (! is_array($this->tabs)) {
return false;
}
echo '<table summary="labels" class="',$this->getCSSclass('tab', $position),'">',"\n";
echo '<tr class="',$this->getCSSclass('tab', $position),'">',"\n";
for ($i = ($this->tabs[0] == 'PMEtab0' ? 1 : 0); $i < count($this->tabs); $i++) {
$css_class_name = $this->getCSSclass($i != $this->cur_tab ? 'tab' : 'tab-selected', $position);
echo '<td class="',$css_class_name,'" id="'.$this->dhtml['prefix'].'tab',$i,'_',$position,'_label">';
echo '<a class="',$css_class_name,'" id="'.$this->dhtml['prefix'].'tab',$i,'_',$position,'_link';
echo '" href="javascript:'.$this->js['prefix'].'show_tab(\''.$this->dhtml['prefix'].'tab',$i,'\')">';
echo $this->tabs[$i],'</a></td>',"\n";
}
echo '<td class="',$this->getCSSclass('tab-end', $position),'">&nbsp;</td>',"\n";
echo '</tr>',"\n";
echo '</table>',"\n";
} /* }}} */
 
/*
* Display functions
*/
 
function display_add_record() /* {{{ */
{
for ($tab = 0, $k = 0; $k < $this->num_fds; $k++) {
if (isset($this->fdd[$k]['tab']) && $this->tabs_enabled() && $k > 0) {
$tab++;
echo '</table>',"\n";
echo '</div>',"\n";
echo '<div id="'.$this->dhtml['prefix'].'tab',$tab,'">',"\n";
echo '<table class="',$this->getCSSclass('main'),'" summary="',$this->tb,'">',"\n";
}
if (! $this->displayed[$k]) {
continue;
}
if ($this->hidden($k)) {
echo $this->htmlHiddenData($this->fds[$k], $this->fdd[$k]['default']);
continue;
}
$css_postfix = @$this->fdd[$k]['css']['postfix'];
$css_class_name = $this->getCSSclass('input', null, 'next', $css_postfix);
$escape = isset($this->fdd[$k]['escape']) ? $this->fdd[$k]['escape'] : true;
echo '<tr class="',$this->getCSSclass('row', null, true, $css_postfix),'">',"\n";
echo '<td class="',$this->getCSSclass('key', null, true, $css_postfix),'">';
echo $this->fdd[$k]['name'],'</td>',"\n";
echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'"';
echo $this->getColAttributes($k),">\n";
if ($this->col_has_values($k)) {
$vals = $this->set_values($k);
$selected = @$this->fdd[$k]['default'];
$multiple = $this->col_has_multiple($k);
$readonly = $this->readonly($k);
$strip_tags = true;
//$escape = true;
if ($this->col_has_checkboxes($k) || $this->col_has_radio_buttons($k)) {
echo $this->htmlRadioCheck($this->cgi['prefix']['data'].$this->fds[$k],
$css_class_name, $vals, $selected, $multiple, $readonly,
$strip_tags, $escape);
} else {
echo $this->htmlSelect($this->cgi['prefix']['data'].$this->fds[$k],
$css_class_name, $vals, $selected, $multiple, $readonly,
$strip_tags, $escape);
}
} elseif (isset ($this->fdd[$k]['textarea'])) {
echo '<textarea class="',$css_class_name,'" name="',$this->cgi['prefix']['data'].$this->fds[$k],'"';
echo ($this->readonly($k) ? ' disabled="disabled"' : '');
if (intval($this->fdd[$k]['textarea']['rows']) > 0) {
echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"';
}
if (intval($this->fdd[$k]['textarea']['cols']) > 0) {
echo ' cols="',$this->fdd[$k]['textarea']['cols'],'"';
}
if (isset($this->fdd[$k]['textarea']['wrap'])) {
echo ' wrap="',$this->fdd[$k]['textarea']['wrap'],'"';
} else {
echo ' wrap="virtual"';
}
echo '>';
if($escape) echo htmlspecialchars($this->fdd[$k]['default']);
else echo $this->fdd[$k]['default'];
echo '</textarea>',"\n";
} elseif ($this->col_has_php($k)) {
echo include($this->fdd[$k]['php']);
} else {
// Simple edit box required
$size_ml_props = '';
$maxlen = intval($this->fdd[$k]['maxlen']);
$size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] : min($maxlen, 60);
$size && $size_ml_props .= ' size="'.$size.'"';
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';
echo '<input class="',$css_class_name,'" ';
echo ($this->password($k) ? 'type="password"' : 'type="text"');
echo ($this->readonly($k) ? ' disabled="disabled"' : '');
echo ' name="',$this->cgi['prefix']['data'].$this->fds[$k],'"';
echo $size_ml_props,' value="';
if($escape) echo htmlspecialchars($this->fdd[$k]['default']);
else echo $this->fdd[$k]['default'];
echo '" />';
}
echo '</td>',"\n";
if ($this->guidance) {
$css_class_name = $this->getCSSclass('help', null, true, $css_postfix);
$cell_value = $this->fdd[$k]['help'] ? $this->fdd[$k]['help'] : '&nbsp;';
echo '<td class="',$css_class_name,'">',$cell_value,'</td>',"\n";
}
echo '</tr>',"\n";
}
} /* }}} */
 
function display_copy_change_delete_record() /* {{{ */
{
/*
* For delete or change: SQL SELECT to retrieve the selected record
*/
 
$qparts['type'] = 'select';
$qparts['select'] = $this->get_SQL_column_list();
$qparts['from'] = $this->get_SQL_join_clause();
$qparts['where'] = '('.$this->fqn($this->key).'='
.$this->key_delim.$this->rec.$this->key_delim.')';
 
$res = $this->myquery($this->get_SQL_query($qparts),__LINE__);
if (! ($row = @mysql_fetch_array($res, MYSQL_ASSOC))) {
return false;
}
for ($tab = 0, $k = 0; $k < $this->num_fds; $k++) {
if (isset($this->fdd[$k]['tab']) && $this->tabs_enabled() && $k > 0) {
$tab++;
echo '</table>',"\n";
echo '</div>',"\n";
echo '<div id="'.$this->dhtml['prefix'].'tab',$tab,'">',"\n";
echo '<table class="',$this->getCSSclass('main'),'" summary="',$this->tb,'">',"\n";
}
if (! $this->displayed[$k]) {
continue;
}
if ($this->copy_operation() || $this->change_operation()) {
if ($this->hidden($k)) {
if ($k != $this->key_num) {
echo $this->htmlHiddenData($this->fds[$k], $row["qf$k"]);
}
continue;
}
$css_postfix = @$this->fdd[$k]['css']['postfix'];
echo '<tr class="',$this->getCSSclass('row', null, 'next', $css_postfix),'">',"\n";
echo '<td class="',$this->getCSSclass('key', null, true, $css_postfix),'">';
echo $this->fdd[$k]['name'],'</td>',"\n";
/* There are two possibilities of readonly fields handling:
1. Display plain text for readonly timestamps, dates and URLs.
2. Display disabled input field
In all cases particular readonly field will NOT be saved. */
if ($this->readonly($k) && ($this->col_has_datemask($k) || $this->col_has_URL($k))) {
echo $this->display_delete_field($row, $k);
} elseif ($this->password($k)) {
echo $this->display_password_field($row, $k);
} else {
echo $this->display_change_field($row, $k);
}
if ($this->guidance) {
$css_class_name = $this->getCSSclass('help', null, true, $css_postfix);
$cell_value = $this->fdd[$k]['help'] ? $this->fdd[$k]['help'] : '&nbsp;';
echo '<td class="',$css_class_name,'">',$cell_value,'</td>',"\n";
}
echo '</tr>',"\n";
} elseif ($this->delete_operation() || $this->view_operation()) {
$css_postfix = @$this->fdd[$k]['css']['postfix'];
echo '<tr class="',$this->getCSSclass('row', null, 'next', $css_postfix),'">',"\n";
echo '<td class="',$this->getCSSclass('key', null, true, $css_postfix),'">';
echo $this->fdd[$k]['name'],'</td>',"\n";
if ($this->password($k)) {
echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'"';
echo $this->getColAttributes($k),'>',$this->labels['hidden'],'</td>',"\n";
} else {
$this->display_delete_field($row, $k);
}
if ($this->guidance) {
$css_class_name = $this->getCSSclass('help', null, true, $css_postfix);
$cell_value = $this->fdd[$k]['help'] ? $this->fdd[$k]['help'] : '&nbsp;';
echo '<td class="',$css_class_name,'">',$cell_value,'</td>',"\n";
}
echo '</tr>',"\n";
}
}
} /* }}} */
 
function display_change_field($row, $k) /* {{{ */
{
$css_postfix = @$this->fdd[$k]['css']['postfix'];
$css_class_name = $this->getCSSclass('input', null, true, $css_postfix);
$escape = isset($this->fdd[$k]['escape']) ? $this->fdd[$k]['escape'] : true;
echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'"';
echo $this->getColAttributes($k),">\n";
if ($this->col_has_values($k)) {
$vals = $this->set_values($k);
$multiple = $this->col_has_multiple($k);
$readonly = $this->readonly($k);
$strip_tags = true;
//$escape = true;
if ($this->col_has_checkboxes($k) || $this->col_has_radio_buttons($k)) {
echo $this->htmlRadioCheck($this->cgi['prefix']['data'].$this->fds[$k],
$css_class_name, $vals, $row["qf$k"], $multiple, $readonly,
$strip_tags, $escape);
} else {
echo $this->htmlSelect($this->cgi['prefix']['data'].$this->fds[$k],
$css_class_name, $vals, $row["qf$k"], $multiple, $readonly,
$strip_tags, $escape);
}
} elseif (isset($this->fdd[$k]['textarea'])) {
echo '<textarea class="',$css_class_name,'" name="',$this->cgi['prefix']['data'].$this->fds[$k],'"';
echo ($this->readonly($k) ? ' disabled="disabled"' : '');
if (intval($this->fdd[$k]['textarea']['rows']) > 0) {
echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"';
}
if (intval($this->fdd[$k]['textarea']['cols']) > 0) {
echo ' cols="',$this->fdd[$k]['textarea']['cols'],'"';
}
if (isset($this->fdd[$k]['textarea']['wrap'])) {
echo ' wrap="',$this->fdd[$k]['textarea']['wrap'],'"';
} else {
echo ' wrap="virtual"';
}
echo '>';
if($escape) echo htmlspecialchars($row["qf$k"]);
else echo $row["qf$k"];
echo '</textarea>',"\n";
} elseif ($this->col_has_php($k)) {
echo include($this->fdd[$k]['php']);
} else {
$size_ml_props = '';
$maxlen = intval($this->fdd[$k]['maxlen']);
$size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] : min($maxlen, 60);
$size && $size_ml_props .= ' size="'.$size.'"';
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';
echo '<input class="',$css_class_name,'" type="text" ';
echo ($this->readonly($k) ? 'disabled="disabled" ' : '');
echo 'name="',$this->cgi['prefix']['data'].$this->fds[$k],'" value="';
if($escape) echo htmlspecialchars($row["qf$k"]);
else echo $row["qf$k"];
echo '" />',"\n";
}
echo '</td>',"\n";
} /* }}} */
 
function display_password_field($row, $k) /* {{{ */
{
$css_postfix = @$this->fdd[$k]['css']['postfix'];
echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'"';
echo $this->getColAttributes($k),">\n";
$size_ml_props = '';
$maxlen = intval($this->fdd[$k]['maxlen']);
$size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] : min($maxlen, 60);
$size && $size_ml_props .= ' size="'.$size.'"';
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';
echo '<input class="',$this->getCSSclass('value', null, true, $css_postfix),'" type="password" ';
echo ($this->readonly($k) ? 'disabled="disabled" ' : '');
echo 'name="',$this->cgi['prefix']['data'].$this->fds[$k],'" value="';
echo htmlspecialchars($row["qf$k"]),'" ',$size_ml_props,' />',"\n";
echo '</td>',"\n";
} /* }}} */
 
function display_delete_field($row, $k) /* {{{ */
{
$css_postfix = @$this->fdd[$k]['css']['postfix'];
$css_class_name = $this->getCSSclass('value', null, true, $css_postfix);
echo '<td class="',$css_class_name,'"',$this->getColAttributes($k),">\n";
echo $this->cellDisplay($k, $row, $css_class_name);
echo '</td>',"\n";
} /* }}} */
 
/**
* Returns CSS class name
*/
function getCSSclass($name, $position = null, $divider = null, $postfix = null) /* {{{ */
{
static $div_idx = -1;
$elements = array($this->css['prefix'], $name);
if ($this->page_type && $this->css['page_type']) {
if ($this->page_type != 'L' && $this->page_type != 'F') {
$elements[] = $this->page_types[$this->page_type];
}
}
if ($position && $this->css['position']) {
$elements[] = $position;
}
if ($divider && $this->css['divider']) {
if ($divider === 'next') {
$div_idx++;
if ($this->css['divider'] > 0 && $div_idx >= $this->css['divider']) {
$div_idx = 0;
}
}
$elements[] = $div_idx;
}
if ($postfix) {
$elements[] = $postfix;
}
return join($this->css['separator'], $elements);
} /* }}} */
 
/**
* Returns field cell HTML attributes
*/
function getColAttributes($k) /* {{{ */
{
$colattrs = '';
if (isset($this->fdd[$k]['colattrs'])) {
$colattrs .= ' ';
$colattrs .= trim($this->fdd[$k]['colattrs']);
}
if (isset($this->fdd[$k]['nowrap'])) {
$colattrs .= ' nowrap';
}
return $colattrs;
} /* }}} */
 
/**
* Substitutes variables in string
* (this is very simple but secure eval() replacement)
*/
function substituteVars($str, $subst_ar) /* {{{ */
{
$array = preg_split('/(\\$\w+)/', $str, -1, PREG_SPLIT_DELIM_CAPTURE);
$count = count($array);
for ($i = 1; $i < $count; $i += 2) {
$key = substr($array[$i], 1);
if (isset($subst_ar[$key])) {
$array[$i] = $subst_ar[$key];
}
}
return join('', $array);
} /* }}} */
 
/**
* Print URL
*/
function urlDisplay($k, $link_val, $disp_val, $css, $key) /* {{{ */
{
$escape = isset($this->fdd[$k]['escape']) ? $this->fdd[$k]['escape'] : true;
$ret = '';
$name = $this->fds[$k];
$page = $this->page_name;
$url = $this->cgi['prefix']['sys'].'rec'.'='.$key.'&'.$this->cgi['prefix']['sys'].'fm'
.'='.$this->fm.'&'.$this->cgi['prefix']['sys'].'fl'.'='.$this->fl;
$url .= '&'.$this->cgi['prefix']['sys'].'qfn'.'='.rawurlencode($this->qfn).$this->qfn;
$url .= '&'.$this->get_sfn_cgi_vars().$this->cgi['persist'];
$ar = array(
'key' => $key,
'name' => $name,
'link' => $link_val,
'value' => $disp_val,
'css' => $css,
'page' => $page,
'url' => $url
);
$urllink = isset($this->fdd[$k]['URL'])
? $this->substituteVars($this->fdd[$k]['URL'], $ar)
: $link_val;
$urldisp = isset($this->fdd[$k]['URLdisp'])
? $this->substituteVars($this->fdd[$k]['URLdisp'], $ar)
: $disp_val;
$target = isset($this->fdd[$k]['URLtarget'])
? 'target="'.htmlspecialchars($this->fdd[$k]['URLtarget']).'" '
: '';
$prefix_found = false;
$postfix_found = false;
$prefix_ar = @$this->fdd[$k]['URLprefix'];
$postfix_ar = @$this->fdd[$k]['URLpostfix'];
is_array($prefix_ar) || $prefix_ar = array($prefix_ar);
is_array($postfix_ar) || $postfix_ar = array($postfix_ar);
foreach ($prefix_ar as $prefix) {
if (! strncmp($prefix, $urllink, strlen($prefix))) {
$prefix_found = true;
break;
}
}
foreach ($postfix_ar as $postfix) {
if (! strncmp($postfix, $urllink, strlen($postfix))) {
$postfix_found = true;
break;
}
}
$prefix_found || $urllink = array_shift($prefix_ar).$urllink;
$postfix_found || $urllink = $urllink.array_shift($postfix_ar);
if (strlen($urllink) <= 0 || strlen($urldisp) <= 0) {
$ret = '&nbsp;';
} else {
if ($escape) {
$urldisp = htmlspecialchars($urldisp);
}
$urllink = htmlspecialchars($urllink);
$ret = '<a '.$target.'class="'.$css.'" href="'.$urllink.'">'.$urldisp.'</a>';
}
return $ret;
} /* }}} */
 
function cellDisplay($k, $row, $css) /* {{{ */
{
$escape = isset($this->fdd[$k]['escape']) ? $this->fdd[$k]['escape'] : true;
$key_rec = $row['qf'.$this->key_num];
if (@$this->fdd[$k]['datemask']) {
$value = intval($row["qf$k".'_timestamp']);
$value = $value ? @date($this->fdd[$k]['datemask'], $value) : '';
} else if (@$this->fdd[$k]['strftimemask']) {
$value = intval($row["qf$k".'_timestamp']);
$value = $value ? @strftime($this->fdd[$k]['strftimemask'], $value) : '';
} else if ($this->is_values2($k, $row["qf$k"])) {
$value = $row['qf'.$k.'_idx'];
if ($this->fdd[$k]['select'] == 'M') {
$value_ar = explode(',', $value);
$value_ar2 = array();
foreach ($value_ar as $value_key) {
if (isset($this->fdd[$k]['values2'][$value_key])) {
$value_ar2[$value_key] = $this->fdd[$k]['values2'][$value_key];
$escape = false;
}
}
$value = join(', ', $value_ar2);
} else {
if (isset($this->fdd[$k]['values2'][$value])) {
$value = $this->fdd[$k]['values2'][$value];
$escape = false;
}
}
} elseif (isset($this->fdd[$k]['values2'][$row["qf$k"]])) {
$value = $this->fdd[$k]['values2'][$row["qf$k"]];
} else {
$value = $row["qf$k"];
}
$original_value = $value;
if (@$this->fdd[$k]['strip_tags']) {
$value = strip_tags($value);
}
if ($num_ar = @$this->fdd[$k]['number_format']) {
if (! is_array($num_ar)) {
$num_ar = array($num_ar);
}
if (count($num_ar) == 1) {
list($nbDec) = $num_ar;
$value = number_format($value, $nbDec);
} else if (count($num_ar) == 3) {
list($nbDec, $decPoint, $thSep) = $num_ar;
$value = number_format($value, $nbDec, $decPoint, $thSep);
}
}
if (intval($this->fdd[$k]['trimlen']) > 0 && strlen($value) > $this->fdd[$k]['trimlen']) {
$value = ereg_replace("[\r\n\t ]+",' ',$value);
$value = substr($value, 0, $this->fdd[$k]['trimlen'] - 3).'...';
}
if (@$this->fdd[$k]['mask']) {
$value = sprintf($this->fdd[$k]['mask'], $value);
}
if ($this->col_has_php($k)) {
return include($this->fdd[$k]['php']);
}
if ($this->col_has_URL($k)) {
return $this->urlDisplay($k, $original_value, $value, $css, $key_rec);
}
if (strlen($value) <= 0) {
return '&nbsp;';
}
if ($escape) {
$value = htmlspecialchars($value);
}
return nl2br($value);
} /* }}} */
 
/**
* Creates HTML submit input element
*
* @param name element name
* @param label key in the language hash used as label
* @param css_class_name CSS class name
* @param js_validation if add JavaScript validation subroutine to button
* @param disabled if mark the button as disabled
* @param js any extra text in tags
*/
function htmlSubmit($name, $label, $css_class_name, $js_validation = true, $disabled = false, $js = NULL) /* {{{ */
{
// Note that <input disabled> isn't valid HTML, but most browsers support it
if($disabled == -1) return;
$markdisabled = $disabled ? ' disabled="disabled"' : '';
$ret = '<input'.$markdisabled.' type="submit" class="'.$css_class_name
.'" name="'.$this->cgi['prefix']['sys'].ltrim($markdisabled).$name
.'" value="'.(isset($this->labels[$label]) ? $this->labels[$label] : $label);
if ($js_validation) {
$ret .= '" onclick="return '.$this->js['prefix'].'form_control(this.form);';
}
$ret .='"';
if(isset($js)) $ret .= ' '.$js;
$ret .= ' />';
return $ret;
} /* }}} */
 
/**
* Creates HTML hidden input element
*
* @param name element name
* @param value value
*/
 
function htmlHiddenSys($name, $value) /* {{{ */
{
return $this->htmlHidden($this->cgi['prefix']['sys'].$name, $value);
} /* }}} */
 
function htmlHiddenData($name, $value) /* {{{ */
{
return $this->htmlHidden($this->cgi['prefix']['data'].$name, $value);
} /* }}} */
 
function htmlHidden($name, $value) /* {{{ */
{
return '<input type="hidden" name="'.htmlspecialchars($name)
.'" value="'.htmlspecialchars($value).'" />'."\n";
} /* }}} */
 
/**
* Creates HTML select element (tag)
*
* @param name element name
* @param css CSS class name
* @param kv_array key => value array
* @param selected selected key (it can be single string, array of
* keys or multiple values separated by comma)
* @param multiple bool for multiple selection
* @param readonly bool for readonly/disabled selection
* @param strip_tags bool for stripping tags from values
* @param escape bool for HTML escaping values
* @param js string to be in the <select >, ususally onchange='..';
*/
function htmlSelect($name, $css, $kv_array, $selected = null, /* ...) {{{ */
/* booleans: */ $multiple = false, $readonly = false, $strip_tags = false, $escape = true, $js = NULL)
{
$ret = '<select class="'.htmlspecialchars($css).'" name="'.htmlspecialchars($name);
if ($multiple) {
$ret .= '[]" multiple size="'.$this->multiple;
if (! is_array($selected) && $selected !== null) {
$selected = explode(',', $selected);
}
}
$ret .= '"'.($readonly ? ' disabled="disabled"' : '').$js.'>'."\n";
if (! is_array($selected)) {
$selected = $selected === null ? array() : array($selected);
}
$found = false;
foreach ($kv_array as $key => $value) {
$ret .= '<option value="'.htmlspecialchars($key).'"';
if ((! $found || $multiple) && in_array((string) $key, $selected, 1)
|| (count($selected) == 0 && ! $found && ! $multiple)) {
$ret .= ' selected="selected"';
$found = true;
}
$strip_tags && $value = strip_tags($value);
$escape && $value = htmlspecialchars($value);
$ret .= '>'.$value.'</option>'."\n";
}
$ret .= '</select>';
return $ret;
} /* }}} */
 
/**
* Creates HTML checkboxes or radio buttons
*
* @param name element name
* @param css CSS class name
* @param kv_array key => value array
* @param selected selected key (it can be single string, array of
* keys or multiple values separated by comma)
* @param multiple bool for multiple selection (checkboxes)
* @param readonly bool for readonly/disabled selection
* @param strip_tags bool for stripping tags from values
* @param escape bool for HTML escaping values
* @param js string to be in the <select >, ususally onchange='..';
*/
function htmlRadioCheck($name, $css, $kv_array, $selected = null, /* ...) {{{ */
/* booleans: */ $multiple = false, $readonly = false, $strip_tags = false, $escape = true, $js = NULL)
{
$ret = '';
if ($multiple) {
if (! is_array($selected) && $selected !== null) {
$selected = explode(',', $selected);
}
}
if (! is_array($selected)) {
$selected = $selected === null ? array() : array($selected);
}
$found = false;
foreach ($kv_array as $key => $value) {
$ret .= '<input type="'.($multiple ? 'checkbox' : 'radio').'" name="';
$ret .= htmlspecialchars($name).'[]" value="'.htmlspecialchars($key).'"';
if ((! $found || $multiple) && in_array((string) $key, $selected, 1)
|| (count($selected) == 0 && ! $found && ! $multiple)) {
$ret .= ' checked';
$found = true;
}
if ($readonly) {
$ret .= ' disabled="disabled"';
}
$strip_tags && $value = strip_tags($value);
$escape && $value = htmlspecialchars($value);
$ret .= '>'.$value.'<br>'."\n";
}
return $ret;
} /* }}} */
 
/**
* Returns original variables HTML code for use in forms or links.
*
* @param mixed $origvars string or array of original varaibles
* @param string $method type of method ("POST" or "GET")
* @param mixed $default_value default value of variables
* if null, empty values will be skipped
* @return get HTML code of original varaibles
*/
function get_origvars_html($origvars, $method = 'post', $default_value = '') /* {{{ */
{
$ret = '';
$method = strtoupper($method);
if ($method == 'POST') {
if (! is_array($origvars)) {
$new_origvars = array();
foreach (explode('&', $origvars) as $param) {
$parts = explode('=', $param, 2);
if (! isset($parts[1])) {
$parts[1] = $default_value;
}
if (strlen($parts[0]) <= 0) {
continue;
}
$new_origvars[$parts[0]] = $parts[1];
}
$origvars =& $new_origvars;
}
foreach ($origvars as $key => $val) {
if (strlen($val) <= 0 && $default_value === null) {
continue;
}
$key = rawurldecode($key);
$val = rawurldecode($val);
$ret .= $this->htmlHidden($key, $val);
}
} else if (! strncmp('GET', $method, 3)) {
if (! is_array($origvars)) {
$ret .= $origvars;
} else {
foreach ($origvars as $key => $val) {
if (strlen($val) <= 0 && $default_value === null) {
continue;
}
$ret == '' || $ret .= '&amp;';
$ret .= htmlspecialchars(rawurlencode($key));
$ret .= '=';
$ret .= htmlspecialchars(rawurlencode($val));
}
}
if ($method[strlen($method) - 1] == '+') {
$ret = "?$ret";
}
} else {
trigger_error('Unsupported Platon::get_origvars_html() method: '
.$method, E_USER_ERROR);
}
return $ret;
} /* }}} */
 
function get_sfn_cgi_vars($alternative_sfn = null) /* {{{ */
{
if ($alternative_sfn === null) { // FAST! (cached return value)
static $ret = null;
$ret == null && $ret = $this->get_sfn_cgi_vars($this->sfn);
return $ret;
}
$ret = '';
$i = 0;
foreach ($alternative_sfn as $val) {
$ret != '' && $ret .= '&';
$ret .= rawurlencode($this->cgi['prefix']['sys'].'sfn')."[$i]=".rawurlencode($val);
$i++;
}
return $ret;
} /* }}} */
 
function get_default_cgi_prefix($type) /* {{{ */
{
switch ($type) {
case 'operation': return 'PME_op_';
case 'sys': return 'PME_sys_';
case 'data': return 'PME_data_';
}
return '';
} /* }}} */
 
function get_sys_cgi_var($name, $default_value = null) /* {{{ */
{
if (isset($this)) {
return $this->get_cgi_var($this->cgi['prefix']['sys'].$name, $default_value);
}
return phpMyEdit::get_cgi_var(phpMyEdit::get_default_cgi_prefix('sys').$name, $default_value);
} /* }}} */
 
function get_data_cgi_var($name, $default_value = null) /* {{{ */
{
if (isset($this)) {
return $this->get_cgi_var($this->cgi['prefix']['data'].$name, $default_value);
}
return phpMyEdit::get_cgi_var(phpMyEdit::get_default_cgi_prefix('data').$name, $default_value);
} /* }}} */
 
function get_cgi_var($name, $default_value = null) /* {{{ */
{
if (isset($this) && isset($this->cgi['overwrite'][$name])) {
return $this->cgi['overwrite'][$name];
}
 
static $magic_quotes_gpc = null;
if ($magic_quotes_gpc === null) {
$magic_quotes_gpc = get_magic_quotes_gpc();
}
$var = @$_GET[$name];
if (! isset($var)) {
$var = @$_POST[$name];
}
if (isset($var)) {
if ($magic_quotes_gpc) {
if (is_array($var)) {
foreach (array_keys($var) as $key) {
$var[$key] = stripslashes($var[$key]);
}
} else {
$var = stripslashes($var);
}
}
} else {
$var = @$default_value;
}
if (isset($this) && $var === null && isset($this->cgi['append'][$name])) {
return $this->cgi['append'][$name];
}
return $var;
} /* }}} */
 
function get_server_var($name) /* {{{ */
{
if (isset($_SERVER[$name])) {
return $_SERVER[$name];
}
global $HTTP_SERVER_VARS;
if (isset($HTTP_SERVER_VARS[$name])) {
return $HTTP_SERVER_VARS[$name];
}
global $$name;
if (isset($$name)) {
return $$name;
}
return null;
} /* }}} */
 
/*
* Debug functions
*/
 
function print_get_vars ($miss = 'No GET variables found') // debug only /* {{{ */
{
// we parse form GET variables
if (is_array($_GET)) {
echo "<p> Variables per GET ";
foreach ($_GET as $k => $v) {
if (is_array($v)) {
foreach ($v as $akey => $aval) {
// $_GET[$k][$akey] = strip_tags($aval);
// $$k[$akey] = strip_tags($aval);
echo "$k\[$akey\]=$aval ";
}
} else {
// $_GET[$k] = strip_tags($val);
// $$k = strip_tags($val);
echo "$k=$v ";
}
}
echo '</p>';
} else {
echo '<p>';
echo $miss;
echo '</p>';
}
} /* }}} */
 
function print_post_vars($miss = 'No POST variables found') // debug only /* {{{ */
{
global $_POST;
// we parse form POST variables
if (is_array($_POST)) {
echo "<p>Variables per POST ";
foreach ($_POST as $k => $v) {
if (is_array($v)) {
foreach ($v as $akey => $aval) {
// $_POST[$k][$akey] = strip_tags($aval);
// $$k[$akey] = strip_tags($aval);
echo "$k\[$akey\]=$aval ";
}
} else {
// $_POST[$k] = strip_tags($val);
// $$k = strip_tags($val);
echo "$k=$v ";
}
}
echo '</p>';
} else {
echo '<p>';
echo $miss;
echo '</p>';
}
} /* }}} */
 
function print_vars ($miss = 'Current instance variables') // debug only /* {{{ */
{
echo "$miss ";
echo 'page_name=',$this->page_name,' ';
echo 'hn=',$this->hn,' ';
echo 'un=',$this->un,' ';
echo 'pw=',$this->pw,' ';
echo 'db=',$this->db,' ';
echo 'dbp=',$this->dbp,' ';
echo 'dbh=',$this->dbh,' ';
echo 'tb=',$this->tb,' ';
echo 'key=',$this->key,' ';
echo 'key_type=',$this->key_type,' ';
echo 'inc=',$this->inc,' ';
echo 'options=',$this->options,' ';
echo 'fdd=',$this->fdd,' ';
echo 'fl=',$this->fl,' ';
echo 'fm=',$this->fm,' ';
echo 'sfn=',htmlspecialchars($this->get_sfn_cgi_vars()),' ';
echo 'qfn=',$this->qfn,' ';
echo 'sw=',$this->sw,' ';
echo 'rec=',$this->rec,' ';
echo 'navop=',$this->navop,' ';
echo 'saveadd=',$this->saveadd,' ';
echo 'moreadd=',$this->moreadd,' ';
echo 'canceladd=',$this->canceladd,' ';
echo 'savechange=',$this->savechange,' ';
echo 'morechange=',$this->morechange,' ';
echo 'cancelchange=',$this->cancelchange,' ';
echo 'savecopy=',$this->savecopy,' ';
echo 'cancelcopy=',$this->cancelcopy,' ';
echo 'savedelete=',$this->savedelete,' ';
echo 'canceldelete=',$this->canceldelete,' ';
echo 'cancelview=',$this->cancelview,' ';
echo 'operation=',$this->operation,' ';
echo "\n";
} /* }}} */
 
/*
* Display buttons at top and bottom of page
*/
function display_list_table_buttons($position, $listall = false) /* {{{ */
{
if (($but_str = $this->display_buttons($position)) === null)
return;
if($position == 'down') echo '<hr class="'.$this->getCSSclass('hr', 'down').'" />'."\n";
echo '<table summary="navigation" class="',$this->getCSSclass('navigation', $position),'">',"\n";
echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n";
echo '<td class="',$this->getCSSclass('buttons', $position),'">',"\n";
echo $but_str,'</td>',"\n";
// Message is now written here
if (strlen(@$this->message) > 0) {
echo '<td class="',$this->getCSSclass('message', $position),'">',$this->message,'</td>',"\n";
}
if($this->display['num_pages'] || $this->display['num_records'])
echo '<td class="',$this->getCSSclass('stats', $position),'">',"\n";
if($this->display['num_pages']) {
if ($listall) {
echo $this->labels['Page'],':&nbsp;1&nbsp;',$this->labels['of'],'&nbsp;1';
} else {
$current_page = intval($this->fm / $this->inc) + 1;
$total_pages = max(1, ceil($this->total_recs / abs($this->inc)));
echo $this->labels['Page'],':&nbsp;',$current_page;
echo '&nbsp;',$this->labels['of'],'&nbsp;',$total_pages;
}
}
if($this->display['num_records'])
echo '&nbsp; ',$this->labels['Records'],':&nbsp;',$this->total_recs;
if($this->display['num_pages'] || $this->display['num_records']) echo '</td>';
echo '</tr></table>',"\n";
if($position == 'up') echo '<hr class="'.$this->getCSSclass('hr', 'up').'" />'."\n";
} /* }}} */
 
/*
* Display buttons at top and bottom of page
*/
function display_record_buttons($position) /* {{{ */
{
if (($but_str = $this->display_buttons($position)) === null)
return;
if ($position == 'down') {
if ($this->tabs_enabled()) $this->display_tab_labels('down');
echo '<hr class="',$this->getCSSclass('hr', 'down'),'" />',"\n";
}
echo '<table summary="navigation" class="',$this->getCSSclass('navigation', $position),'">',"\n";
echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n";
echo '<td class="',$this->getCSSclass('buttons', $position),'">',"\n";
echo $but_str,'</td>',"\n";
// Message is now written here
//echo '</td>',"\n";
if (strlen(@$this->message) > 0) {
echo '<td class="',$this->getCSSclass('message', $position),'">',$this->message,'</td>',"\n";
}
echo '</tr></table>',"\n";
if ($position == 'up') {
if ($this->tabs_enabled()) $this->display_tab_labels('up');
echo '<hr class="',$this->getCSSclass('hr', 'up'),'" />',"\n";
}
} /* }}} */
 
function display_buttons($position) /* {{{ */
{
$nav_fnc = 'nav_'.$position;
if(! $this->$nav_fnc())
return;
$buttons = (is_array($this->buttons[$this->page_type][$position]))
? $this->buttons[$this->page_type][$position]
: $this->default_buttons[$this->page_type];
foreach ($buttons as $name) {
$ret .= $this->display_button($name, $position)."\n";
}
return $ret;
} /* }}} */
 
function display_button($name, $position = 'up') /* {{{ */
{
if (is_array($name)) {
if (isset($name['code'])) return $name['code'];
return $this->htmlSubmit($name['name'], $name['value'], $name['css'], $name['disabled'], $name['js']);
}
$disabled = 1; // show disabled by default
if ($name[0] == '+') { $name = substr($name, 1); $disabled = 0; } // always show disabled as enabled
if ($name[0] == '-') { $name = substr($name, 1); $disabled = -1; } // don't show disabled
if ($name == 'cancel') {
return $this->htmlSubmit('cancel'.$this->page_types[$this->page_type], 'Cancel',
$this->getCSSclass('cancel', $position), false);
}
if (in_array($name, array('add','view','change','copy','delete'))) {
$enabled_fnc = $name.'_enabled';
$enabled = $this->$enabled_fnc();
if ($name != 'add' && ! $this->total_recs && strstr('LF', $this->page_type))
$enabled = false;
return $this->htmlSubmit('operation', ucfirst($name),
$this->getCSSclass($name, $position), false, $enabled ? 0 : $disabled);
}
if ($name == 'savedelete') {
$enabled = $this->delete_enabled();
$js = 'onclick="return confirm(\''.$this->labels['Delete'].' ?\');"';
return $this->htmlSubmit('savedelete', 'Delete',
$this->getCSSclass('save', $position), false, $enabled ? 0 : $disabled, $js);
}
if (in_array($name, array('save','more'))) {
$validation = true; // if js validation
if ($this->page_type == 'D' && $name == 'save' ) { $value = 'Delete'; $validation = false; }
elseif ($this->page_type == 'C' && $name == 'more' ) { $value = 'Apply'; }
else $value = ucfirst($name);
return $this->htmlSubmit($name.$this->page_types[$this->page_type], $value,
$this->getCSSclass($name, $position), $validation);
}
$listall = $this->inc <= 0;
if ($listall) {
$disabledprev = true;
$disablednext = true;
$total_pages = 1;
$current_page = 1;
} else {
$disabledprev = $this->fm <= 0;
$disablednext = $this->fm + $this->inc >= $this->total_recs;
$total_pages = max(1, ceil($this->total_recs / abs($this->inc)));
$current_page = ceil($this->fm / abs($this->inc)); // must + 1
}
$disabledfirst = $disabledprev;
$disabledlast = $disablednext;
// some statistics first
if ($name == 'total_pages') return $total_pages;
if ($name == 'current_page') return ($current_page+1);
if ($name == 'total_recs') return ($this->total_recs);
// now some goto buttons/dropdowns/inputs...
if ($name == 'goto_text') {
$ret = '<input type="text" class="'.$this->getCSSclass('gotopn', $position).'"';
$ret .= ' name="'.$this->cgi['prefix']['sys'].'navpn'.$position.'" value="'.($current_page+1).'"';
$ret .= ' size="'.(strlen($total_pages)+1).'" maxlength="'.(strlen($total_pages)+1).'"';
// TODO some js here.... on enter submit, on click erase ?...
$ret .=' oneypress="return PE_filter_handler(this.form, event);" />';
return $ret;
}
if ($name == 'goto_combo') {
$disabledgoto = !($listall || ($disablednext && $disabledprev)) ? '' : ' disabled';
if ($disablegoto != '' && $disabled < 0) return;
$kv_array = array();
for ($i = 0; $i < $total_pages; $i++) {
$kv_array[$this->inc * $i] = $i + 1;
}
// TODO: add onchange="return this.form.submit();" DONE ???
return $this->htmlSelect($this->cgi['prefix']['sys'].ltrim($disabledgoto).'navfm'.$position,
$this->getCSSclass('goto', $position), $kv_array, (string)$this->fm, false, $disabledgoto,
false, true, 'onchange="return this.form.submit();"');
}
if ($name == 'goto') {
return $this->htmlSubmit('navop', 'Go to', $this->getCSSclass('goto', $position),
false, ($listall || ($disablednext && $disabledprev)) ? $disabled : 0);
}
if (in_array($name, array('first','prev','next','last','<<','<','>','>>'))) {
$disabled_var = 'disabled'.$name;
$name2 = $name;
if (strlen($name) <= 2) {
$nav_values = array('<<' => 'first', '<' => 'prev', '>' => 'next', '>>' => 'last');
$disabled_var = 'disabled'.$nav_values[$name];
$name2 = $nav_values[$name];
}
return $this->htmlSubmit('navop', ucfirst($name),
$this->getCSSclass($name2, $position), false, $$disabled_var ? $disabled : 0);
}
if(isset($this->labels[$name])) return $this->labels[$name];
return $name;
} /* }}} */
 
function number_of_recs() /* {{{ */
{
$count_parts = array(
'type' => 'select',
'select' => 'count(*)',
'from' => $this->get_SQL_join_clause(),
'where' => $this->get_SQL_where_from_query_opts());
$res = $this->myquery($this->get_SQL_query($count_parts), __LINE__);
$row = @mysql_fetch_array($res, MYSQL_NUM);
$this->total_recs = $row[0];
} /* }}} */
 
/*
* Table Page Listing
*/
function list_table() /* {{{ */
{
if ($this->fm == '') {
$this->fm = 0;
}
$this->fm = $this->navfm;
if ($this->prev_operation()) {
$this->fm = $this->fm - $this->inc;
if ($this->fm < 0) {
$this->fm = 0;
}
}
if ($this->first_operation()) {
$this->fm = 0;
} // last operation must be performed below, after retrieving total_recs
if ($this->next_operation()) {
$this->fm += $this->inc;
}
$this->number_of_recs();
if ($this->last_operation() || $this->fm > $this->total_recs) { // if goto_text is badly set
$this->fm = (int)(($this->total_recs - 1)/$this->inc)*$this->inc;
}
// If sort sequence has changed, restart listing
$this->qfn != $this->prev_qfn && $this->fm = 0;
if (0) { // DEBUG
echo 'qfn vs. prev_qfn comparsion ';
echo '[<b>',htmlspecialchars($this->qfn),'</b>]';
echo '[<b>',htmlspecialchars($this->prev_qfn),'</b>]<br />';
echo 'comparsion <u>',($this->qfn == $this->prev_qfn ? 'proved' : 'failed'),'</u>';
echo '<hr />';
}
/*
* If user is allowed to Change/Delete records, we need an extra column
* to allow users to select a record
*/
$select_recs = $this->key != '' &&
($this->change_enabled() || $this->delete_enabled() || $this->view_enabled());
// Are we doing a listall?
$listall = $this->inc <= 0;
/*
* Display the MySQL table in an HTML table
*/
$this->form_begin();
echo $this->get_origvars_html($this->get_sfn_cgi_vars());
echo $this->htmlHiddenSys('fl', $this->fl);
// Display buttons at top and/or bottom of page.
$this->display_list_table_buttons('up', $listall);
if ($this->cgi['persist'] != '') {
echo $this->get_origvars_html($this->cgi['persist']);
}
if (! $this->filter_operation()) {
echo $this->get_origvars_html($this->qfn);
}
echo $this->htmlHiddenSys('qfn', $this->qfn);
echo $this->htmlHiddenSys('fm', $this->fm);
echo '<table class="',$this->getCSSclass('main'),'" summary="',$this->tb,'">',"\n";
echo '<tr class="',$this->getCSSclass('header'),'">',"\n";
/*
* System (navigation, selection) columns counting
*/
$sys_cols = 0;
$sys_cols += intval($this->filter_enabled() || $select_recs);
if ($sys_cols > 0) {
$sys_cols += intval($this->nav_buttons()
&& ($this->nav_text_links() || $this->nav_graphic_links()));
}
/*
* We need an initial column(s) (sys columns)
* if we have filters, Changes or Deletes enabled
*/
if ($sys_cols) {
echo '<th class="',$this->getCSSclass('header'),'" colspan="',$sys_cols,'">';
if ($this->filter_enabled()) {
if ($this->filter_operation()) {
echo $this->htmlSubmit('sw', 'Hide', $this->getCSSclass('hide'), false);
echo $this->htmlSubmit('sw', 'Clear', $this->getCSSclass('clear'), false);
} else {
echo $this->htmlSubmit('sw', 'Search', $this->getCSSclass('search'), false);
}
} else {
echo '&nbsp;';
}
echo '</th>',"\n";
}
for ($k = 0; $k < $this->num_fds; $k++) {
$fd = $this->fds[$k];
if (! $this->displayed[$k]) {
continue;
}
$css_postfix = @$this->fdd[$k]['css']['postfix'];
$css_class_name = $this->getCSSclass('header', null, null, $css_postfix);
$fdn = $this->fdd[$fd]['name'];
if (! $this->fdd[$fd]['sort'] || $this->password($fd)) {
echo '<th class="',$css_class_name,'">',$fdn,'</th>',"\n";
} else {
// Clicking on the current sort field reverses the sort order
$new_sfn = $this->sfn;
array_unshift($new_sfn, in_array("$k", $new_sfn, 1) ? "-$k" : $k);
echo '<th class="',$css_class_name,'">';
echo '<a class="',$css_class_name,'" href="';
echo htmlspecialchars($this->page_name.'?'.$this->cgi['prefix']['sys'].'fm'.'=0'
.'&'.$this->cgi['prefix']['sys'].'fl'.'='.$this->fl
.'&'.$this->cgi['prefix']['sys'].'qfn'.'='.rawurlencode($this->qfn).$this->qfn
.'&'.$this->get_sfn_cgi_vars($new_sfn).$this->cgi['persist']);
echo '">',$fdn,'</a></th>',"\n";
}
}
echo '</tr>',"\n";
 
/*
* Prepare the SQL Query from the data definition file
*/
$qparts['type'] = 'select';
$qparts['select'] = $this->get_SQL_column_list();
// Even if the key field isn't displayed, we still need its value
if ($select_recs) {
if (!in_array ($this->key, $this->fds)) {
$qparts['select'] .= ','.$this->fqn($this->key);
}
}
$qparts['from'] = $this->get_SQL_join_clause();
$qparts['where'] = $this->get_SQL_where_from_query_opts();
// build up the ORDER BY clause
if (isset($this->sfn)) {
$sort_fields = array();
$sort_fields_w = array();
foreach ($this->sfn as $field) {
if ($field[0] == '-') {
$field = substr($field, 1);
$desc = true;
} else {
$field = $field;
$desc = false;
}
$sort_field = $this->fqn($field);
$sort_field_w = $this->fdd[$field]['name'];
$this->col_has_sql($field) && $sort_field_w .= ' (sql)';
if ($desc) {
$sort_field .= ' DESC';
$sort_field_w .= ' '.$this->labels['descending'];
} else {
$sort_field_w .= ' '.$this->labels['ascending'];
}
$sort_fields[] = $sort_field;
$sort_fields_w[] = $sort_field_w;
}
if (count($sort_fields) > 0) {
$qparts['orderby'] = join(',', $sort_fields);
}
}
$qparts['limit'] = $listall ? '' : $this->fm.','.$this->inc;
 
/*
* Main list_table() query
*
* Each row of the HTML table is one record from the SQL query. We must
* perform this query before filter printing, because we want to use
* mysql_field_len() function. We will also fetch the first row to get
* the field names.
*/
$query = $this->get_SQL_query($qparts);
$res = $this->myquery($query, __LINE__);
if ($res == false) {
$this->error('invalid SQL query', $query);
return false;
}
$row = @mysql_fetch_array($res, MYSQL_ASSOC);
 
/* FILTER {{{
*
* Draw the filter and fill it with any data typed in last pass and stored
* in the array parameter keyword 'filter'. Prepare the SQL WHERE clause.
*/
if ($this->filter_operation()) {
// Filter row retrieval
$fields = false;
$filter_row = $row;
if (! is_array($filter_row)) {
unset($qparts['where']);
$query = $this->get_SQL_query($qparts);
$res = $this->myquery($query, __LINE__);
if ($res == false) {
$this->error('invalid SQL query', $query);
return false;
}
$filter_row = @mysql_fetch_array($res, MYSQL_ASSOC);
}
/* Variable $fields is used to get index of particular field in
result. That index can be passed in example to mysql_field_len()
function. Use field names as indexes to $fields array. */
if (is_array($filter_row)) {
$fields = array_flip(array_keys($filter_row));
}
if ($fields != false) {
$css_class_name = $this->getCSSclass('filter');
echo '<tr class="',$css_class_name,'">',"\n";
echo '<td class="',$css_class_name,'" colspan="',$sys_cols,'">';
echo $this->htmlSubmit('filter', 'Query', $this->getCSSclass('query'), false);
echo '</td>', "\n";
for ($k = 0; $k < $this->num_fds; $k++) {
if (! $this->displayed[$k]) {
continue;
}
$css_postfix = @$this->fdd[$k]['css']['postfix'];
$css_class_name = $this->getCSSclass('filter', null, null, $css_postfix);
$this->field_name = $this->fds[$k];
$fd = $this->field_name;
$this->field = $this->fdd[$fd];
$l = 'qf'.$k;
$lc = 'qf'.$k.'_comp';
$li = 'qf'.$k.'_id';
if ($this->clear_operation()) {
$m = null;
$mc = null;
$mi = null;
} else {
$m = $this->get_sys_cgi_var($l);
$mc = $this->get_sys_cgi_var($lc);
$mi = $this->get_sys_cgi_var($li);
}
echo '<td class="',$css_class_name,'">';
if ($this->password($k)) {
echo '&nbsp;';
} else if ($this->fdd[$fd]['select'] == 'D' || $this->fdd[$fd]['select'] == 'M') {
// Multiple fields processing
// Default size is 2 and array required for values.
$from_table = ! $this->col_has_values($k) || isset($this->fdd[$k]['values']['table']);
$vals = $this->set_values($k, array('*' => '*'), null, $from_table);
$selected = $mi;
$multiple = $this->col_has_multiple_select($k);
$multiple |= $this->fdd[$fd]['select'] == 'M';
$readonly = false;
$strip_tags = true;
$escape = true;
echo $this->htmlSelect($this->cgi['prefix']['sys'].$l.'_id', $css_class_name,
$vals, $selected, $multiple, $readonly, $strip_tags, $escape);
} elseif ($this->fdd[$fd]['select'] == 'N' || $this->fdd[$fd]['select'] == 'T') {
$size_ml_props = '';
$maxlen = intval($this->fdd[$k]['maxlen']);
$maxlen > 0 || $maxlen = intval(@mysql_field_len($res, $fields["qf$k"]));
$size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size']
: ($maxlen < 30 ? min($maxlen, 8) : 12);
$size && $size_ml_props .= ' size="'.$size.'"';
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';
if ($this->fdd[$fd]['select'] == 'N') {
$mc = in_array($mc, $this->comp_ops) ? $mc : '=';
echo $this->htmlSelect($this->cgi['prefix']['sys'].$l.'_comp',
$css_class_name, $this->comp_ops, $mc);
}
echo '<input class="',$css_class_name,'" value="',htmlspecialchars(@$m);
echo '" type="text" name="'.$this->cgi['prefix']['sys'].'qf'.$k.'"',$size_ml_props;
echo ' onkeypress="return '.$this->js['prefix'].'filter_handler(this.form, event);" />';
} else {
echo '&nbsp;';
}
echo '</td>',"\n";
}
echo '</tr>',"\n";
}
} // }}}
/*
* Display sorting sequence
*/
if ($qparts['orderby'] && $this->display['sort']) {
$css_class_name = $this->getCSSclass('sortinfo');
echo '<tr class="',$css_class_name,'">',"\n";
echo '<td class="',$css_class_name,'" colspan="',$sys_cols,'">';
echo '<a class="',$css_class_name,'" href="';
echo htmlspecialchars($this->page_name
.'?'.$this->cgi['prefix']['sys'].'fl'.'='.$this->fl
.'&'.$this->cgi['prefix']['sys'].'fm'.'='.$this->fm
.'&'.$this->cgi['prefix']['sys'].'qfn'.'='.rawurlencode($this->qfn)
.$this->qfn.$this->cgi['persist']);
echo '">',$this->labels['Clear'],'</a></td>',"\n";
echo '<td class="',$css_class_name,'" colspan="',$this->num_fields_displayed,'">';
echo $this->labels['Sorted By'],': ',join(', ', $sort_fields_w),'</td></tr>',"\n";
}
 
/*
* Display the current query
*/
$text_query = $this->get_SQL_where_from_query_opts(null, true);
if ($text_query != '' && $this->display['query']) {
$css_class_name = $this->getCSSclass('queryinfo');
echo '<tr class="',$css_class_name,'">',"\n";
echo '<td class="',$css_class_name,'" colspan="',$sys_cols,'">';
echo '<a class="',$css_class_name,'" href="';
echo htmlspecialchars($this->get_server_var('PHP_SELF')
.'?'.$this->cgi['prefix']['sys'].'fl'.'='.$this->fl
.'&'.$this->cgi['prefix']['sys'].'fm'.'='.$this->fm
.'&'.$this->cgi['prefix']['sys'].'qfn'.'='.rawurlencode($this->qfn)
.'&'.$this->get_sfn_cgi_vars().$this->cgi['persist']);
echo '">',$this->labels['Clear'],'</a></td>',"\n";
echo '<td class="',$css_class_name,'" colspan="',$this->num_fields_displayed,'">';
echo $this->labels['Current Query'],': ',htmlspecialchars($text_query),'</td></tr>',"\n";
}
 
if ($this->nav_text_links() || $this->nav_graphic_links()) {
$qstrparts = array();
strlen($this->fl) > 0 && $qstrparts[] = $this->cgi['prefix']['sys'].'fl'.'='.$this->fl;
strlen($this->fm) > 0 && $qstrparts[] = $this->cgi['prefix']['sys'].'fm'.'='.$this->fm;
count($this->sfn) > 0 && $qstrparts[] = $this->get_sfn_cgi_vars();
strlen($this->cgi['persist']) > 0 && $qstrparts[] = $this->cgi['persist'];
$qpview = $qstrparts;
$qpcopy = $qstrparts;
$qpchange = $qstrparts;
$qpdelete = $qstrparts;
$qp_prefix = $this->cgi['prefix']['sys'].'operation'.'='.$this->cgi['prefix']['operation'];
$qpview[] = $qp_prefix.'View';
$qpcopy[] = $qp_prefix.'Copy';
$qpchange[] = $qp_prefix.'Change';
$qpdelete[] = $qp_prefix.'Delete';
$qpviewStr = htmlspecialchars($this->page_name.'?'.join('&',$qpview).$this->qfn);
$qpcopyStr = htmlspecialchars($this->page_name.'?'.join('&',$qpcopy).$this->qfn);
$qpchangeStr = htmlspecialchars($this->page_name.'?'.join('&',$qpchange).$this->qfn);
$qpdeleteStr = htmlspecialchars($this->page_name.'?'.join('&',$qpdelete).$this->qfn);
}
 
$fetched = true;
$first = true;
$rowCount = 0;
while ((!$fetched && ($row = @mysql_fetch_array($res, MYSQL_ASSOC)) != false)
|| ($fetched && $row != false)) {
$fetched = false;
echo '<tr class="',$this->getCSSclass('row', null, 'next'),'">',"\n";
if ($sys_cols) { /* {{{ */
$key_rec = $row['qf'.$this->key_num];
$queryAppend = htmlspecialchars('&'.$this->cgi['prefix']['sys'].'rec'.'='.$key_rec);
$viewQuery = $qpviewStr . $queryAppend;
$copyQuery = $qpcopyStr . $queryAppend;
$changeQuery = $qpchangeStr . $queryAppend;
$deleteQuery = $qpdeleteStr . $queryAppend;
$viewTitle = htmlspecialchars($this->labels['View']);
$changeTitle = htmlspecialchars($this->labels['Change']);
$copyTitle = htmlspecialchars($this->labels['Copy']);
$deleteTitle = htmlspecialchars($this->labels['Delete']);
$css_class_name = $this->getCSSclass('navigation', null, true);
if ($select_recs) {
if (! $this->nav_buttons() || $sys_cols > 1) {
echo '<td class="',$css_class_name,'">';
}
if ($this->nav_graphic_links()) {
$printed_out = false;
if ($this->view_enabled()) {
$printed_out = true;
echo '<a class="',$css_class_name,'" href="',$viewQuery,'"><img class="';
echo $css_class_name,'" src="',$this->url['images'];
echo 'pme-view.png" height="15" width="16" border="0" ';
echo 'alt="',$viewTitle,'" title="',$viewTitle,'" /></a>';
}
if ($this->change_enabled()) {
$printed_out && print('&nbsp;');
$printed_out = true;
echo '<a class="',$css_class_name,'" href="',$changeQuery,'"><img class="';
echo $css_class_name,'" src="',$this->url['images'];
echo 'pme-change.png" height="15" width="16" border="0" ';
echo 'alt="',$changeTitle,'" title="',$changeTitle,'" /></a>';
}
if ($this->copy_enabled()) {
$printed_out && print('&nbsp;');
$printed_out = true;
echo '<a class="',$css_class_name,'" href="',$copyQuery,'"><img class="';
echo $css_class_name,'" src="',$this->url['images'];
echo 'pme-copy.png" height="15" width="16" border="0" ';
echo 'alt="',$copyTitle,'" title="',$copyTitle,'" /></a>';
}
if ($this->delete_enabled()) {
$printed_out && print('&nbsp;');
$printed_out = true;
echo '<a class="',$css_class_name,'" href="',$deleteQuery,'"><img class="';
echo $css_class_name,'" src="',$this->url['images'];
echo 'pme-delete.png" height="15" width="16" border="0" ';
echo 'alt="',$deleteTitle,'" title="',$deleteTitle,'" /></a>';
}
}
if ($this->nav_text_links()) {
if ($this->nav_graphic_links()) {
echo '<br class="',$css_class_name,'">';
}
$printed_out = false;
if ($this->view_enabled()) {
$printed_out = true;
echo '<a href="',$viewQuery,'" title="',$viewTitle,'" class="',$css_class_name,'">V</a>';
}
if ($this->change_enabled()) {
$printed_out && print('&nbsp;');
$printed_out = true;
echo '<a href="',$changeQuery,'" title="',$changeTitle,'" class="',$css_class_name,'">C</a>';
}
if ($this->copy_enabled()) {
$printed_out && print('&nbsp;');
$printed_out = true;
echo '<a href="',$copyQuery,'" title="',$copyTitle,'" class="',$css_class_name,'">P</a>';
}
if ($this->delete_enabled()) {
$printed_out && print('&nbsp;');
$printed_out = true;
echo '<a href="',$deleteQuery,'" title="',$deleteTitle,'" class="',$css_class_name,'">D</a>';
}
}
if (! $this->nav_buttons() || $sys_cols > 1) {
echo '</td>',"\n";
}
if ($this->nav_buttons()) {
echo '<td class="',$css_class_name,'"><input class="',$css_class_name;
echo '" type="radio" name="'.$this->cgi['prefix']['sys'].'rec';
echo '" value="',htmlspecialchars($key_rec),'"';
if (($this->rec == '' && $first) || ($this->rec == $key_rec)) {
echo ' checked';
$first = false;
}
echo ' /></td>',"\n";
}
} elseif ($this->filter_enabled()) {
echo '<td class="',$css_class_name,'" colspan=',$sys_cols,'>&nbsp;</td>',"\n";
}
} /* }}} */
for ($k = 0; $k < $this->num_fds; $k++) { /* {{{ */
$fd = $this->fds[$k];
if (! $this->displayed[$k]) {
continue;
}
$css_postfix = @$this->fdd[$k]['css']['postfix'];
$css_class_name = $this->getCSSclass('cell', null, true, $css_postfix);
if ($this->password($k)) {
echo '<td class="',$css_class_name,'">',$this->labels['hidden'],'</td>',"\n";
continue;
}
echo '<td class="',$css_class_name,'"',$this->getColAttributes($fd),'>';
echo $this->cellDisplay($k, $row, $css_class_name);
echo '</td>',"\n";
} /* }}} */
echo '</tr>',"\n";
}
 
/*
* Display and accumulate column aggregation info, do totalling query
* XXX this feature does not work yet!!!
*/
// aggregates listing (if any)
if ($$var_to_total) {
// do the aggregate query if necessary
//if ($vars_to_total) {
$qp = array();
$qp['type'] = 'select';
$qp['select'] = $aggr_from_clause;
$qp['from'] = $this->get_SQL_join_clause();
$qp['where'] = $this->get_SQL_where_from_query_opts();
$tot_query = $this->get_SQL_query($qp);
$totals_result = $this->myquery($tot_query,__LINE__);
$tot_row = @mysql_fetch_array($totals_result, MYSQL_ASSOC);
//}
$qp_aggr = $qp;
echo "\n",'<tr class="TODO-class">',"\n",'<td class="TODO-class">&nbsp;</td>',"\n";
/*
echo '<td>';
echo printarray($qp_aggr);
echo printarray($vars_to_total);
echo '</td>';
echo '<td colspan="'.($this->num_fds-1).'">'.$var_to_total.' '.$$var_to_total.'</td>';
*/
// display the results
for ($k=0;$k<$this->num_fds;$k++) {
$fd = $this->fds[$k];
if (stristr($this->fdd[$fd]['options'],'L') or !isset($this->fdd[$fd]['options'])) {
echo '<td>';
$aggr_var = 'qf'.$k.'_aggr';
$$aggr_var = $this->get_sys_cgi_var($aggr_var);
if ($$aggr_var) {
echo $this->sql_aggrs[$$aggr_var],': ',$tot_row[$aggr_var];
} else {
echo '&nbsp;';
}
echo '</td>',"\n";
}
}
echo '</tr>',"\n";
}
echo '</table>',"\n"; // end of table rows listing
$this->display_list_table_buttons('down', $listall);
$this->form_end();
} /* }}} */
 
function display_record() /* {{{ */
{
// PRE Triggers
$ret = true;
if ($this->change_operation()) {
$ret &= $this->exec_triggers_simple('update', 'pre');
// if PRE update fails, then back to view operation
if (! $ret) {
$this->operation = $this->labels['View'];
$ret = true;
}
}
if ($this->add_operation() || $this->copy_operation()) {
$ret &= $this->exec_triggers_simple('insert', 'pre');
}
if ($this->view_operation()) {
$ret &= $this->exec_triggers_simple('select', 'pre');
}
if ($this->delete_operation()) {
$ret &= $this->exec_triggers_simple('delete', 'pre');
}
// if PRE insert/view/delete fail, then back to the list
if ($ret == false) {
$this->operation = '';
$this->list_table();
return;
}
$this->form_begin();
if ($this->cgi['persist'] != '') {
echo $this->get_origvars_html($this->cgi['persist']);
}
echo $this->get_origvars_html($this->get_sfn_cgi_vars());
echo $this->get_origvars_html($this->qfn);
echo $this->htmlHiddenSys('cur_tab', $this->dhtml['prefix'].'tab'.$this->cur_tab);
echo $this->htmlHiddenSys('qfn', $this->qfn);
echo $this->htmlHiddenSys('rec', $this->copy_operation() ? '' : $this->rec);
echo $this->htmlHiddenSys('fm', $this->fm);
echo $this->htmlHiddenSys('fl', $this->fl);
$this->display_record_buttons('up');
if ($this->tabs_enabled()) {
echo '<div id="'.$this->dhtml['prefix'].'tab0">',"\n";
}
echo '<table class="',$this->getCSSclass('main'),'" summary="',$this->tb,'">',"\n";
if ($this->add_operation()) {
$this->display_add_record();
} else {
$this->display_copy_change_delete_record();
}
echo '</table>',"\n";
if ($this->tabs_enabled()) {
echo '</div>',"\n";
}
$this->display_record_buttons('down');
 
$this->form_end();
} /* }}} */
 
/*
* Action functions
*/
 
function do_add_record() /* {{{ */
{
// Preparing query
$query = '';
$key_col_val = '';
$newvals = array();
for ($k = 0; $k < $this->num_fds; $k++) {
if ($this->processed($k)) {
$fd = $this->fds[$k];
if ($this->readonly($k)) {
$fn = (string) @$this->fdd[$k]['default'];
} else {
$fn = $this->get_data_cgi_var($fd);
}
if ($fd == $this->key) {
$key_col_val = $fn;
}
$newvals[$fd] = is_array($fn) ? join(',',$fn) : $fn;
}
}
// Creating array of changed keys ($changed)
$changed = array_keys($newvals);
// Before trigger, newvals can be efectively changed
if ($this->exec_triggers('insert', 'before', $oldvals, $changed, $newvals) == false) {
return false;
}
// Real query (no additional query in this method)
foreach ($newvals as $fd => $val) {
if ($fd == '') continue;
if ($this->col_has_sqlw($this->fdn[$fd])) {
$val_as = addslashes($val);
$val_qas = '"'.addslashes($val).'"';
$value = $this->substituteVars(
$this->fdd[$this->fdn[$fd]]['sqlw'], array(
'val_qas' => $val_qas,
'val_as' => $val_as,
'val' => $val
));
} else {
$value = "'".addslashes($val)."'";
}
if ($query == '') {
$query = 'INSERT INTO `'.$this->tb.'` (`'.$fd.'`'; // )
$query2 = ') VALUES ('.$value.'';
} else {
$query .= ', `'.$fd.'`';
$query2 .= ', '.$value.'';
}
}
$query .= $query2.')';
$res = $this->myquery($query, __LINE__);
$this->message = @mysql_affected_rows($this->dbh).' '.$this->labels['record added'];
if (! $res) {
return false;
}
$this->rec = mysql_insert_id($this->dbh);
// Notify list
if (@$this->notify['insert'] || @$this->notify['all']) {
$this->email_notify(false, $newvals);
}
// Note change in log table
if ($this->logtable) {
$query = sprintf('INSERT INTO %s'
.' (updated, user, host, operation, tab, rowkey, col, oldval, newval)'
.' VALUES (NOW(), "%s", "%s", "insert", "%s", "%s", "", "", "%s")',
$this->logtable, addslashes($this->get_server_var('REMOTE_USER')),
addslashes($this->get_server_var('REMOTE_ADDR')), addslashes($this->tb),
addslashes($key_col_val), addslashes(serialize($newvals)));
$this->myquery($query, __LINE__);
}
// After trigger
if ($this->exec_triggers('insert', 'after', $oldvals, $changed, $newvals) == false) {
return false;
}
return true;
} /* }}} */
 
function do_change_record() /* {{{ */
{
// Preparing queries
$query_real = '';
$query_oldrec = '';
$newvals = array();
$oldvals = array();
$changed = array();
// Prepare query to retrieve oldvals
for ($k = 0; $k < $this->num_fds; $k++) {
if ($this->processed($k) && !$this->readonly($k)) {
$fd = $this->fds[$k];
$fn = $this->get_data_cgi_var($fd);
$newvals[$this->fds[$k]] = is_array($fn) ? join(',',$fn) : $fn;
if ($query_oldrec == '') {
$query_oldrec = 'SELECT '.$fd;
} else {
$query_oldrec .= ','.$fd;
}
}
}
$where_part = " WHERE (".$this->key.'='.$this->key_delim.$this->rec.$this->key_delim.')';
$query_newrec = $query_oldrec.' FROM ' . $this->tb;
$query_oldrec .= ' FROM ' . $this->tb . $where_part;
// Additional query (must go before real query)
$res = $this->myquery($query_oldrec, __LINE__);
$oldvals = @mysql_fetch_array($res, MYSQL_ASSOC);
@mysql_free_result($res);
// Creating array of changed keys ($changed)
foreach ($newvals as $fd => $value) {
if ($value != $oldvals[$fd])
$changed[] = $fd;
}
// Before trigger
if ($this->exec_triggers('update', 'before', $oldvals, $changed, $newvals) == false) {
return false;
}
// Build the real query respecting changes to the newvals array
foreach ($newvals as $fd => $val) {
if ($fd == '') continue;
if ($this->col_has_sqlw($this->fdn[$fd])) {
$val_as = addslashes($val);
$val_qas = '"'.addslashes($val).'"';
$value = $this->substituteVars(
$this->fdd[$this->fdn[$fd]]['sqlw'], array(
'val_qas' => $val_qas,
'val_as' => $val_as,
'val' => $val
));
} else {
$value = "'".addslashes($val)."'";
}
if ($query_real == '') {
$query_real = 'UPDATE '.$this->tb.' SET '.$fd.'='.$value;
} else {
$query_real .= ','.$fd.'='.$value;
}
}
$query_real .= $where_part;
// Real query
$res = $this->myquery($query_real, __LINE__);
$this->message = @mysql_affected_rows($this->dbh).' '.$this->labels['record changed'];
if (! $res) {
return false;
}
// Another additional query (must go after real query)
if (in_array($this->key, $changed)) {
$this->rec = $newvals[$this->key]; // key has changed
}
$query_newrec .= ' WHERE ('.$this->key.'='.$this->key_delim.$this->rec.$this->key_delim.')';
$res = $this->myquery($query_newrec, __LINE__);
$newvals = @mysql_fetch_array($res, MYSQL_ASSOC);
@mysql_free_result($res);
// Creating array of changed keys ($changed)
$changed = array();
foreach ($newvals as $fd => $value) {
if ($value != $oldvals[$fd])
$changed[] = $fd;
}
// Notify list
if (@$this->notify['update'] || @$this->notify['all']) {
if (count($changed) > 0) {
$this->email_notify($oldvals, $newvals);
}
}
// Note change in log table
if ($this->logtable) {
foreach ($changed as $key) {
$qry = sprintf('INSERT INTO %s'
.' (updated, user, host, operation, tab, rowkey, col, oldval, newval)'
.' VALUES (NOW(), "%s", "%s", "update", "%s", "%s", "%s", "%s", "%s")',
$this->logtable, addslashes($this->get_server_var('REMOTE_USER')),
addslashes($this->get_server_var('REMOTE_ADDR')), addslashes($this->tb),
addslashes($this->rec), addslashes($key),
addslashes($oldvals[$key]), addslashes($newvals[$key]));
$this->myquery($qry, __LINE__);
}
}
// After trigger
if ($this->exec_triggers('update', 'after', $oldvals, $changed, $newvals) == false) {
return false;
}
return true;
} /* }}} */
 
function do_delete_record() /* {{{ */
{
// Additional query
$query = 'SELECT * FROM '.$this->tb.' WHERE ('.$this->key.' = '
.$this->key_delim.$this->rec.$this->key_delim.')'; // )
$res = $this->myquery($query, __LINE__);
$oldvals = @mysql_fetch_array($res, MYSQL_ASSOC);
@mysql_free_result($res);
// Creating array of changed keys ($changed)
$changed = array_keys($oldvals);
$newvals = array();
// Before trigger
if ($this->exec_triggers('delete', 'before', $oldvals, $changed, $newvals) == false) {
return false;
}
// Real query
$query = 'DELETE FROM '.$this->tb.' WHERE ('.$this->key.' = '
.$this->key_delim.$this->rec.$this->key_delim.')'; // )
$res = $this->myquery($query, __LINE__);
$this->message = @mysql_affected_rows($this->dbh).' '.$this->labels['record deleted'];
if (! $res) {
return false;
}
// Notify list
if (@$this->notify['delete'] || @$this->notify['all']) {
$this->email_notify($oldvals, false);
}
// Note change in log table
if ($this->logtable) {
$query = sprintf('INSERT INTO %s'
.' (updated, user, host, operation, tab, rowkey, col, oldval, newval)'
.' VALUES (NOW(), "%s", "%s", "delete", "%s", "%s", "%s", "%s", "")',
$this->logtable, addslashes($this->get_server_var('REMOTE_USER')),
addslashes($this->get_server_var('REMOTE_ADDR')), addslashes($this->tb),
addslashes($this->rec), addslashes($key), addslashes(serialize($oldvals)));
$this->myquery($query, __LINE__);
}
// After trigger
if ($this->exec_triggers('delete', 'after', $oldvals, $changed, $newvals) == false) {
return false;
}
return true;
} /* }}} */
 
function email_notify($old_vals, $new_vals) /* {{{ */
{
if (! function_exists('mail')) {
return false;
}
if ($old_vals != false && $new_vals != false) {
$action = 'update';
$subject = 'Record updated in';
$body = 'An item with '.$this->fdd[$this->key]['name'].' = '
.$this->key_delim.$this->rec.$this->key_delim .' was updated in';
$vals = $new_vals;
} elseif ($new_vals != false) {
$action = 'insert';
$subject = 'Record added to';
$body = 'A new item was added into';
$vals = $new_vals;
} elseif ($old_vals != false) {
$action = 'delete';
$subject = 'Record deleted from';
$body = 'An item was deleted from';
$vals = $old_vals;
} else {
return false;
}
$addr = $this->get_server_var('REMOTE_ADDR');
$user = $this->get_server_var('REMOTE_USER');
$body = 'This notification e-mail was automatically generated by phpMyEdit.'."\n\n".$body;
$body .= ' table '.$this->tb.' in MySQL database '.$this->db.' on '.$this->page_name;
$body .= ' by '.($user == '' ? 'unknown user' : "user $user").' from '.$addr;
$body .= ' at '.date('d/M/Y H:i').' with the following fields:'."\n\n";
$i = 1;
foreach ($vals as $k => $text) {
$name = isset($this->fdd[$k]['name~'])
? $this->fdd[$k]['name~'] : $this->fdd[$k]['name'];
if ($action == 'update') {
if ($old_vals[$k] == $new_vals[$k]) {
continue;
}
$body .= sprintf("[%02s] %s (%s)\n WAS: %s\n IS: %s\n",
$i, $name, $k, $old_vals[$k], $new_vals[$k]);
} else {
$body .= sprintf('[%02s] %s (%s): %s'."\n", $i, $name, $k, $text);
}
$i++;
}
$body .= "\n--\r\n"; // \r is needed for signature separating
$body .= "phpMyEdit\ninstant MySQL table editor and code generator\n";
$body .= "http://platon.sk/projects/phpMyEdit/\n\n";
$subject = @$this->notify['prefix'].$subject.' '.$this->dbp.$this->tb;
$subject = trim($subject); // just for sure
$wrap_w = intval(@$this->notify['wrap']);
$wrap_w > 0 || $wrap_w = 72;
$from = (string) @$this->notify['from'];
$from != '' || $from = 'webmaster@'.strtolower($this->get_server_var('SERVER_NAME'));
$headers = 'From: '.$from."\n".'X-Mailer: PHP/'.phpversion().' (phpMyEdit)';
$body = wordwrap($body, $wrap_w, "\n", 1);
$emails = (array) $this->notify[$action] + (array) $this->notify['all'];
foreach ($emails as $email) {
if (! empty($email)) {
mail(trim($email), $subject, $body, $headers);
}
}
return true;
} /* }}} */
 
/*
* Apply triggers function
* Run a (set of) trigger(s). $trigger can be an Array or a filename
* Break and return false as soon as a trigger return false
* we need a reference on $newvals to be able to change value before insert/update
*/
function exec_triggers($op, $step, $oldvals, &$changed, &$newvals) /* {{{ */
{
if (! isset($this->triggers[$op][$step])) {
return true;
}
$ret = true;
$trig = $this->triggers[$op][$step];
if (is_array($trig)) {
ksort($trig);
for ($t = reset($trig); $t !== false && $ret != false; $t = next($trig)) {
$ret = include($t);
}
} else {
$ret = include($trig);
}
return $ret;
} /* }}} */
 
function exec_triggers_simple($op, $step) /* {{{ */
{
$oldvals = $newvals = $changed = array();
return $this->exec_triggers($op, $step, $oldvals, $changed, $newvals);
} /* }}} */
/*
* Recreate functions
*/
function recreate_fdd($default_page_type = 'L') /* {{{ */
{
// TODO: one level deeper browsing
$this->page_type = $default_page_type;
$this->filter_operation() && $this->page_type = 'F';
$this->view_operation() && $this->page_type = 'V';
if ($this->add_operation()
|| $this->saveadd == $this->labels['Save']
|| $this->moreadd == $this->labels['More']) {
$this->page_type = 'A';
}
if ($this->change_operation()
|| $this->savechange == $this->labels['Save']
|| $this->morechange == $this->labels['Apply']) {
$this->page_type = 'C';
}
if ($this->copy_operation() || $this->savecopy == $this->labels['Save']) {
$this->page_type = 'P';
}
if ($this->delete_operation() || $this->savedelete == $this->labels['Delete']) {
$this->page_type = 'D';
}
// Restore backups (if exists)
foreach (array_keys($this->fdd) as $column) {
foreach (array_keys($this->fdd[$column]) as $col_option) {
if ($col_option[strlen($col_option) - 1] != '~')
continue;
 
$this->fdd[$column][substr($col_option, 0, strlen($col_option) - 1)]
= $this->fdd[$column][$col_option];
unset($this->fdd[$column][$col_option]);
}
}
foreach (array_keys($this->fdd) as $column) {
foreach (array_keys($this->fdd[$column]) as $col_option) {
if (! strchr($col_option, '|')) {
continue;
}
$col_ar = explode('|', $col_option, 2);
if (! stristr($col_ar[1], $this->page_type)) {
continue;
}
// Make field backups
$this->fdd[$column][$col_ar[0] .'~'] = $this->fdd[$column][$col_ar[0]];
$this->fdd[$column][$col_option.'~'] = $this->fdd[$column][$col_option];
// Set particular field
$this->fdd[$column][$col_ar[0]] = $this->fdd[$column][$col_option];
unset($this->fdd[$column][$col_option]);
}
}
} /* }}} */
 
function recreate_displayed() /* {{{ */
{
$field_num = 0;
$num_fields_displayed = 0;
$this->fds = array();
$this->fdn = array();
$this->displayed = array();
$this->guidance = false;
foreach (array_keys($this->fdd) as $key) {
if (preg_match('/^\d+$/', $key)) { // skipping numeric keys
continue;
}
$this->fds[$field_num] = $key;
$this->fdn[$key] = $field_num;
/* We must use here displayed() function, because displayed[] array
is not created yet. We will simultaneously create that array as well. */
if ($this->displayed[$field_num] = $this->displayed($field_num)) {
$num_fields_displayed++;
}
if (is_array(@$this->fdd[$key]['values']) && ! isset($this->fdd[$key]['values']['table'])) {
foreach ($this->fdd[$key]['values'] as $val) {
$this->fdd[$key]['values2'][$val] = $val;
}
unset($this->fdd[$key]['values']);
}
isset($this->fdd[$key]['help']) && $this->guidance = true;
$this->fdd[$field_num] = $this->fdd[$key];
$field_num++;
}
$this->num_fds = $field_num;
$this->num_fields_displayed = $num_fields_displayed;
$this->key_num = array_search($this->key, $this->fds);
/* Adds first displayed column into sorting fields by replacing last
array entry. Also remove duplicite values and change column names to
their particular field numbers.
 
Note that entries like [0]=>'9' [1]=>'-9' are correct and they will
have desirable sorting behaviour. So there is no need to remove them.
*/
$this->sfn = array_unique($this->sfn);
$check_ar = array();
foreach ($this->sfn as $key => $val) {
if (preg_match('/^[-]?\d+$/', $val)) { // skipping numeric keys
$val = abs($val);
if (in_array($val, $check_ar) || $this->password($val)) {
unset($this->sfn[$key]);
} else {
$check_ar[] = $val;
}
continue;
}
if ($val[0] == '-') {
$val = substr($val, 1);
$minus = '-';
} else {
$minus = '';
}
if (($val = array_search($val, $this->fds)) === false || $this->password($val)) {
unset($this->sfn[$key]);
} else {
$val = intval($val);
if (in_array($val, $check_ar)) {
unset($this->sfn[$key]);
} else {
$this->sfn[$key] = $minus.$val;
$check_ar[] = $val;
}
}
}
$this->sfn = array_unique($this->sfn);
return true;
} /* }}} */
 
function backward_compatibility() /* {{{ */
{
foreach (array_keys($this->fdd) as $column) {
// move ['required'] to ['js']['required']
if (! isset($this->fdd[$column]['js']['required']) && isset($this->fdd[$column]['required'])) {
$this->fdd[$column]['js']['required'] = $this->fdd[$column]['required'];
}
// move 'HWR' flags from ['options'] into ['input']
if (isset($this->fdd[$column]['options'])) {
stristr($this->fdd[$column]['options'], 'H') && $this->fdd[$column]['input'] .= 'H';
stristr($this->fdd[$column]['options'], 'W') && $this->fdd[$column]['input'] .= 'W';
stristr($this->fdd[$column]['options'], 'R') && $this->fdd[$column]['input'] .= 'R';
}
}
} /* }}} */
 
/*
* Error handling function
*/
function error($message, $additional_info = '') /* {{{ */
{
echo '<h1>phpMyEdit error: ',htmlspecialchars($message),'</h1>',"\n";
if ($additional_info != '') {
echo '<hr />',htmlspecialchars($additional_info);
}
return false;
} /* }}} */
 
/*
* Database connection function
*/
function connect() /* {{{ */
{
if (isset($this->dbh)) {
return true;
}
if (!isset($this->db)) {
$this->error('no database defined');
return false;
}
if (!isset ($this->tb)) {
$this->error('no table defined');
return false;
}
$this->dbh = @ini_get('allow_persistent')
? @mysql_pconnect($this->hn, $this->un, $this->pw)
: @mysql_connect($this->hn, $this->un, $this->pw);
if (!$this->dbh) {
$this->error('could not connect to MySQL');
return false;
}
return true;
} /* }}} */
 
/*
* Database disconnection function
*/
function disconnect() /* {{{ */
{
if ($this->close_dbh) {
@mysql_close($this->dbh);
$this->dbh = null;
}
} /* }}} */
 
/*
* The workhorse
*/
function execute() /* {{{ */
{
// DEBUG - uncomment to enable
/*
//phpinfo();
$this->print_get_vars();
$this->print_post_vars();
$this->print_vars();
echo "<pre>query opts:\n";
echo print_r($this->query_opts);
echo "</pre>\n";
echo "<pre>get vars:\n";
echo print_r($this->get_opts);
echo "</pre>\n";
*/
 
// Let's do explicit quoting - it's safer
set_magic_quotes_runtime(0);
// Checking if language file inclusion was successful
if (! is_array($this->labels)) {
$this->error('could not locate language files', 'searched path: '.$this->dir['lang']);
return false;
}
// Database connection
if ($this->connect() == false) {
return false;
}
 
/*
* ======================================================================
* Pass 3: process any updates generated if the user has selected
* a save or cancel button during Pass 2
* ======================================================================
*/
// Cancel button - Cancel Triggers
if ($this->add_canceled() || $this->copy_canceled()) {
$this->exec_triggers_simple('insert', 'cancel');
}
if ($this->view_canceled()) {
$this->exec_triggers_simple('select', 'cancel');
}
if ($this->change_canceled()) {
$this->exec_triggers_simple('update', 'cancel');
}
if ($this->delete_canceled()) {
$this->exec_triggers_simple('delete', 'cancel');
}
// Save/More Button - database operations
if ($this->saveadd == $this->labels['Save'] || $this->savecopy == $this->labels['Save']) {
$this->add_enabled() && $this->do_add_record();
unset($this->saveadd);
unset($this->savecopy);
$this->recreate_fdd();
}
elseif ($this->moreadd == $this->labels['More']) {
$this->add_enabled() && $this->do_add_record();
$this->operation = $this->labels['Add']; // to force add operation
$this->recreate_fdd();
$this->recreate_displayed();
$this->backward_compatibility();
}
elseif ($this->savechange == $this->labels['Save']) {
$this->change_enabled() && $this->do_change_record();
unset($this->savechange);
$this->recreate_fdd();
}
elseif ($this->morechange == $this->labels['Apply']) {
$this->change_enabled() && $this->do_change_record();
$this->operation = $this->labels['Change']; // to force change operation
$this->recreate_fdd();
$this->recreate_displayed();
$this->backward_compatibility();
}
elseif ($this->savedelete == $this->labels['Delete']) {
$this->delete_enabled() && $this->do_delete_record();
unset($this->savedelete);
$this->recreate_fdd();
}
 
/*
* ======================================================================
* Pass 2: display an input/edit/confirmation screen if the user has
* selected an editing button on Pass 1 through this page
* ======================================================================
*/
if ($this->add_operation()
|| $this->change_operation() || $this->delete_operation()
|| $this->view_operation() || $this->copy_operation()) {
$this->display_record();
}
 
/*
* ======================================================================
* Pass 1 and Pass 3: display the MySQL table in a scrolling window on
* the screen (skip this step in 'Add More' mode)
* ======================================================================
*/
else {
$this->list_table();
}
 
$this->disconnect();
if ($this->display['time'] && $this->timer != null) {
echo $this->timer->end(),' miliseconds';
}
} /* }}} */
 
/*
* Class constructor
*/
function phpMyEdit($opts) /* {{{ */
{
// Set desirable error reporting level
$error_reporting = error_reporting(E_ALL & ~E_NOTICE);
// Database handle variables
if (isset($opts['dbh'])) {
$this->close_dbh = false;
$this->dbh = $opts['dbh'];
$this->dbp = '';
} else {
$this->close_dbh = true;
$this->dbh = null;
$this->dbp = $opts['db'].'.';
$this->hn = $opts['hn'];
$this->un = $opts['un'];
$this->pw = $opts['pw'];
$this->db = $opts['db'];
}
$this->tb = $opts['tb'];
// Other variables
$this->key = $opts['key'];
$this->key_type = $opts['key_type'];
$this->inc = $opts['inc'];
$this->options = $opts['options'];
$this->fdd = $opts['fdd'];
$this->multiple = intval($opts['multiple']);
$this->multiple <= 0 && $this->multiple = 2;
$this->filters = @$opts['filters'];
$this->triggers = @$opts['triggers'];
$this->notify = @$opts['notify'];
$this->logtable = @$opts['logtable'];
$this->page_name = @$opts['page_name'];
if (! isset($this->page_name)) {
$this->page_name = basename($this->get_server_var('PHP_SELF'));
isset($this->page_name) || $this->page_name = $this->tb;
}
$this->display['query'] = @$opts['display']['query'];
$this->display['sort'] = @$opts['display']['sort'];
$this->display['time'] = @$opts['display']['time'];
if ($this->display['time']) {
$this->timer = new phpMyEdit_timer();
}
$this->display['tabs'] = isset($opts['display']['tabs'])
? $opts['display']['tabs'] : true;
$this->display['form'] = isset($opts['display']['form'])
? $opts['display']['form'] : true;
$this->display['num_records'] = isset($opts['display']['num_records'])
? $opts['display']['num_records'] : true;
$this->display['num_pages'] = isset($opts['display']['num_pages'])
? $opts['display']['num_pages'] : true;
// Creating directory variables
$this->dir['root'] = dirname(realpath(__FILE__))
. (strlen(dirname(realpath(__FILE__))) > 0 ? '/' : '');
$this->dir['lang'] = $this->dir['root'].'lang/';
// Creating URL variables
$this->url['images'] = 'images/';
isset($opts['url']['images']) && $this->url['images'] = $opts['url']['images'];
// CSS classes policy
$this->css = @$opts['css'];
!isset($this->css['separator']) && $this->css['separator'] = '-';
!isset($this->css['prefix']) && $this->css['prefix'] = 'pme';
!isset($this->css['page_type']) && $this->css['page_type'] = false;
!isset($this->css['position']) && $this->css['position'] = false;
!isset($this->css['divider']) && $this->css['divider'] = 2;
$this->css['divider'] = intval(@$this->css['divider']);
// JS overall configuration
$this->js = @$opts['js'];
!isset($this->js['prefix']) && $this->js['prefix'] = 'PME_js_';
// DHTML overall configuration
$this->dhtml = @$opts['dhtml'];
!isset($this->dhtml['prefix']) && $this->dhtml['prefix'] = 'PME_dhtml_';
// Navigation
$this->navigation = @$opts['navigation'];
if (! $this->nav_buttons() && ! $this->nav_text_links() && ! $this->nav_graphic_links()) {
$this->navigation .= 'B'; // buttons are default
}
if (! $this->nav_up() && ! $this->nav_down()) {
$this->navigation .= 'D'; // down position is default
}
$this->buttons = $opts['buttons'];
// Language labels (must go after navigation)
$this->labels = $this->make_language_labels(isset($opts['language'])
? $opts['language'] : $this->get_server_var('HTTP_ACCEPT_LANGUAGE'));
// CGI variables
$this->cgi = @$opts['cgi'];
$this->cgi['persist'] = '';
if (@is_array($opts['cgi']['persist'])) {
foreach ($opts['cgi']['persist'] as $key => $val) {
if (is_array($val)) {
foreach($val as $key2 => $val2) {
$this->cgi['persist'] .= '&'.rawurlencode($key)
.'['.rawurlencode($key2).']='.rawurlencode($val2);
}
} else {
$this->cgi['persist'] .= '&'.rawurlencode($key).'='.rawurlencode($val);
}
}
}
foreach (array('operation', 'sys', 'data') as $type) {
if (! isset($this->cgi['prefix'][$type])) {
$this->cgi['prefix'][$type] = $this->get_default_cgi_prefix($type);
}
}
// Sorting variables
$this->sfn = $this->get_sys_cgi_var('sfn');
isset($this->sfn) || $this->sfn = array();
is_array($this->sfn) || $this->sfn = array($this->sfn);
isset($opts['sort_field']) || $opts['sort_field'] = array();
is_array($opts['sort_field']) || $opts['sort_field'] = array($opts['sort_field']);
$this->sfn = array_merge($this->sfn, $opts['sort_field']);
// Form variables all around
$this->fl = intval($this->get_sys_cgi_var('fl'));
$this->fm = intval($this->get_sys_cgi_var('fm'));
// $old_page = ceil($this->fm / abs($this->inc)) + 1;
$this->qfn = $this->get_sys_cgi_var('qfn');
$this->sw = $this->get_sys_cgi_var('sw');
$this->rec = $this->get_sys_cgi_var('rec', '');
$this->navop = $this->get_sys_cgi_var('navop');
$navfmup = $this->get_sys_cgi_var('navfmup');
$navfmdown = $this->get_sys_cgi_var('navfmdown');
$navpnup = $this->get_sys_cgi_var('navpnup');
$navpndown = $this->get_sys_cgi_var('navpndown');
if($navfmdown!=NULL && $navfmdown != $this->fm) $this->navfm = $navfmdown;
elseif($navfmup!=NULL && $navfmup != $this->fm) $this->navfm = $navfmup;
elseif($navpndown!=NULL && ($navpndown-1)*$this->inc != $this->fm) $this->navfm = ($navpndown-1)*$this->inc;
elseif($navpnup!=NULL && ($navpnup-1)*$this->inc != $this->fm) $this->navfm = ($navpnup-1)*$this->inc;
else $this->navfm = $this->fm;
$this->operation = $this->get_sys_cgi_var('operation');
$oper_prefix_len = strlen($this->cgi['prefix']['operation']);
if (! strncmp($this->cgi['prefix']['operation'], $this->operation, $oper_prefix_len)) {
$this->operation = $this->labels[substr($this->operation, $oper_prefix_len)];
}
$this->saveadd = $this->get_sys_cgi_var('saveadd');
$this->moreadd = $this->get_sys_cgi_var('moreadd');
$this->canceladd = $this->get_sys_cgi_var('canceladd');
$this->savechange = $this->get_sys_cgi_var('savechange');
$this->morechange = $this->get_sys_cgi_var('morechange');
$this->cancelchange = $this->get_sys_cgi_var('cancelchange');
$this->savecopy = $this->get_sys_cgi_var('savecopy');
$this->cancelcopy = $this->get_sys_cgi_var('cancelcopy');
$this->savedelete = $this->get_sys_cgi_var('savedelete');
$this->canceldelete = $this->get_sys_cgi_var('canceldelete');
$this->cancelview = $this->get_sys_cgi_var('cancelview');
// Filter setting
if (isset($this->sw)) {
$this->sw == $this->labels['Search'] && $this->fl = 1;
$this->sw == $this->labels['Hide'] && $this->fl = 0;
//$this->sw == $this->labels['Clear'] && $this->fl = 0;
}
// TAB names
$this->tabs = array();
// Setting key_delim according to key_type
if ($this->key_type == 'real') {
/* If 'real' key_type does not work,
try change MySQL datatype from float to double */
$this->rec = doubleval($this->rec);
$this->key_delim = '';
} elseif ($this->key_type == 'int') {
$this->rec = intval($this->rec);
$this->key_delim = '';
} else {
$this->key_delim = '"';
// $this->rec remains unmodified
}
// Specific $fdd modifications depending on performed action
$this->recreate_fdd();
// Extract SQL Field Names and number of fields
$this->recreate_displayed();
// Issue backward compatibility
$this->backward_compatibility();
// Gathering query options
$this->gather_query_opts();
// Call to action
!isset($opts['execute']) && $opts['execute'] = 1;
$opts['execute'] && $this->execute();
// Restore original error reporting level
error_reporting($error_reporting);
} /* }}} */
 
}
 
/* Modeline for ViM {{{
* vim:set ts=4:
* vim600:fdm=marker fdl=0 fdc=0:
* }}} */
 
?>
/trunk/jrest/util/extensions/phpMyEdit-mce-cal.class.php
New file
0,0 → 1,509
<?php
 
/*
* phpMyEdit - instant MySQL table editor and code generator
*
* extensions/phpMyEdit-mce-cal.class.php - phpMyEdit html area & calendar popup extension
* ____________________________________________________________
*
* Contribution of Adam Hammond <php@pixolet.co.uk>, London, UK
* Contribution of Ezudin Kurtowich <ekurtovic@ieee.org>, Sarajevo
* Copyright (c) 2003-2006 Platon Group, http://platon.sk/
* All rights reserved.
*
* Updated 28th Jul 2005
*
* Updated to use TinyMCE instead of HTMLArea
* Updated to handle multiple tabs and to use PME prefixes.
* Updated to include sub-form patch
*
*
*
* See README file for more information about this software.
* See COPYING file for license information.
*
* Download the latest version from
* http://platon.sk/projects/phpMyEdit/
*/
 
/* $Platon: phpMyEdit/extensions/phpMyEdit-mce-cal.class.php,v 1.6 2006-09-16 18:43:47 nepto Exp $ */
/*
OVERVIEW
--------
 
mce_cal extends the standard phpMyEdit class to allow
a calendar popup helper to be put on any text field and for any textarea
field to turned into an HTML editor.
This extension uses the free jsCalendar from http://dynarch.com/mishoo
and the TinyMCE code from http://tinymce.moxiecode.com/
REQUIREMENTS
------------
 
The requirement is a properly installed jsCalendar and TinyMCE script.
All browsers supported by these scripts are supported by this
extension. Note that version 1.44 or later for TinyMCE is required.
USAGE
-----
 
For both features:
1. Call to phpMyEdit-mce-cal.class.php instead
of phpMyEdit.class.php.
 
Example:
 
require_once 'extensions/phpMyEdit-mce-cal.class.php';
new phpMyEdit_mce_cal($opts);
 
 
 
HTML TextArea
 
This enables WYSIWYG editing of a textarea field.
In order to use it, you should:
 
1. Load TinyMCE script in the <head>...</head> section of your
phpMyEdit calling program as described in the htmlarea manual.
 
<!-- tinyMCE -->
<script language="javascript" type="text/javascript" src="js/<path to TinyMCE>"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "specific_textareas",
auto_reset_designmode : true
});
</script>
<!-- /tinyMCE -->
 
where 'js/<path to TinyMCE>' is the path to the javascript code
 
NOTES:
A. The PME implementation uses the "specific_textareas" mode - this
must always be set
 
B. Due to a bug in Mozilla, if any of the textareas being used as HTML
editors are in tabs and are initially hidden, the width and height
need to be specified in the tinyMCE initialization and
'auto_reset_designmode' must be set to 'true':
tinyMCE.init({
mode : "specific_textareas",
auto_reset_designmode : true,
width: "800",
height: "200"
});
 
2. Add 'html'=>true parameter to the textarea field definition
in your phpMyEdit calling program.
 
Example:
 
$opts['fdd']['col_name'] = array(
'name' => 'Column',
'select' => 'T',
'options' => 'ACPVD',
'required' => true,
'textarea' => array(
'html' => true,
'rows' => 11,
'cols' => 81)
);
 
3. It is also possible to have multiple text area formats on the same
form. This is done by specifying a text tag for the textarea:
 
$opts['fdd']['col_name'] = array(
'name' => 'Column',
'select' => 'T',
'options' => 'ACPVD',
'required' => true,
'textarea' => array(
'html' => 'format1',
'rows' => 11,
'cols' => 81)
);
 
You then need to initialize TinyMCE in the header to recognize all of
the tags used in the textareas.
EXAMPLE
In the following, two formats of tinyMCE editor are defined.
 
This example is the default, and will be used for any fields where
'html' is set to true.
 
tinyMCE.init({
mode : "specific_textareas",
auto_reset_designmode : true
});
 
This second example has an extra parameter, 'textarea_trigger', which is
set to the text tag given to the textarea in PME with 'mce_' prepended
to it.
 
tinyMCE.init({
mode : "specific_textareas",
auto_reset_designmode : true,
textarea_trigger : "mce_format1",
theme : "advanced",
width: "800",
height: "200",
plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print",
theme_advanced_buttons1_add_before : "save,separator",
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",
theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator",
theme_advanced_buttons3_add_before : "tablecontrols,separator",
theme_advanced_buttons3_add : "emotions,iespell,flash,advhr,separator,print",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "bottom",
content_css : "example_full.css",
plugin_insertdate_dateFormat : "%Y-%m-%d",
plugin_insertdate_timeFormat : "%H:%M:%S",
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]"
});
So:
'html' => 'format1' maps to textarea_trigger : "mce_format1"
'html' => 'foo' maps to textarea_trigger : "mce_foo"
'html' => 'bar' maps to textarea_trigger : "mce_bar"
 
You can initialize TinyMCE as many times as you need to give you as many
editor formats as you need.
 
CALENDAR
 
This extension enables the display of a popup calendar selection
against selected fields.
In order to use it, you should:
 
1. Load the jsCalendar scripts in the <head>...</head> section of
your phpMyEdit calling program, substituting the correct paths:
 
<script type="text/javascript" src="js/jscalendar/calendar.js"></script>
<script type="text/javascript" src="js/jscalendar/lang/calendar-en.js"></script>
<script type="text/javascript" src="js/jscalendar/calendar-setup.js"></script>
 
2. Choose your preferred jsCalendar CSS file (see jsCalendar
documentation) and add the following in the <head>...</head>
section of your phpMyEdit calling program, substituting the
correct path:
<link rel="stylesheet" type="text/css" media="screen"
href="js/jscalendar/calendar-system.css">
 
3. Add 'calendar' parameter to the field definitions where you
want a calendar popup in your phpMyEdit calling program.
 
Example:
 
$opts['fdd']['col_name'] = array(
'name' => 'Column',
'select' => 'T',
'options' => 'ACPVD',
'required' => true,
'calendar' => true
);
 
This is will display a button next to the field which pops up
a calendar when clicked. If that field has a 'strftimemask'
parameter set, it will use this for the date format.
For more advanced usage, you can set the 'calendar' parameter
to an array of valid jsCalendar Calendar.setup options
(see jSCalendar document for details). Note that not all
of these options make sense to use in phpMyEdit, and some
of them will actively break the function.
Example:
$opts['fdd']['col_name'] = array(
'name' => 'Column',
'select' => 'T',
'options' => 'ACPVD',
'required' => true,
'calendar' => array(
'ifFormat' => '%Y/%m/%d', // defaults to the ['strftimemask']
'firstDay' => 1, // 0 = Sunday, 1 = Monday
'singleClick' => true, // single or double click to close
'weekNumbers' => true, // Show week numbers
'showsTime' => false, // Show time as well as date
'timeFormat' => '24', // 12 or 24 hour clock
'button' => true, // Display button (rather then clickable area)
'label' => '...', // button label (used by phpMyEdit)
'date' => '2003-12-19 10:00' // Initial date/time for popup
// (see notes below)
)
);
 
NOTES
-----
 
1. The popup will normally set the initial value to the current
field value or to current date/time. 'date' option will always
override this, even if there is a current date/time value
in the field. If you want a default value only if the field
is currently empty, use the phpMyEdit 'default' option.
 
2. Only the options listed above may be set by the user, any other
options will be ignored.
3. The 'label' option can contain HTML markup which will be displayed as
the button/clickable area to pull up the calendar
 
SEARCH KEYWORD
--------------
 
Search for "htmlcal" string in this source code,
to find all extension related modifications.
*/
 
require_once dirname(__FILE__).'/../phpMyEdit.class.php';
 
class phpMyEdit_mce_cal extends phpMyEdit
{
/* calendar mod start */
 
var $calendars; // Array for collecting list of fields with calendar popups
/* Array of valid options for passing to Calendar.setup */
var $valid_opts = array(
'button','ifFormat','singleClick','firstDay',
'weekNumbers','showsTime','timeFormat','date'
);
 
/**
* Checks to see if the calendar parameter is set on the field
*
* @param k current field name
* @param curval current value of field (set to null for default)
*
* If the calendar parameter is set on the field, this function displays
* the button. It then pushes the Calendar.setup parameters into an array,
* including the user specified ones in the calling program is they exist.
* This array is then added to the $calendars array indexed by the field
* name. This allows for multiple fields with calendar popups.
*/
function calPopup_helper($k, $curval) /* {{{ */
{
if (@$this->fdd[$k]['calendar']) {
$cal_ar['ifFormat'] = '%Y-%m-%d %H:%M';
$cal_ar['showsTime'] = true;
$cal_ar['singleClick'] = false;
if (isset($curval)) {
if (substr($curval, 0, 4) != '0000')
$cal_ar['date'] = $curval;
}
if (isset($this->fdd[$k]['strftimemask'])) {
$cal_ar['ifFormat'] = $this->fdd[$k]['strftimemask'];
}
if (is_array($this->fdd[$k]['calendar'])) {
foreach($this->fdd[$k]['calendar'] as $ck => $cv) {
$cal_ar[$ck] = $cv;
}
}
$cal_ar['button'] = $this->dhtml['prefix'].'calbutton_'.$this->fds[$k];
$this->calendars[$this->fds[$k]] = $cal_ar;
 
$label = @$this->fdd[$k]['calendar']['label'];
strlen($label) || $label = '...';
 
$do_button = true;
if (isset($this->fdd[$k]['calendar']['button'])) {
$do_button = $this->fdd[$k]['calendar']['button'];
};
 
if ($do_button) {
echo '<button id="',$cal_ar['button'],'">',$label,'</button>';
} else {
echo '<span style="cursor: pointer" id="',$cal_ar['button'],'">',$label,'</span>';
}
}
} /* }}} */
 
/* calendar mod end */
 
function display_add_record() /* {{{ */
{
for ($tab = 0, $k = 0; $k < $this->num_fds; $k++) {
if (isset($this->fdd[$k]['tab']) && $this->tabs_enabled() && $k > 0) {
$tab++;
echo '</table>',"\n";
echo '</div>',"\n";
echo '<div id="'.$this->dhtml['prefix'].'tab',$tab,'">',"\n";
echo '<table class="',$this->getCSSclass('main'),'" summary="',$this->tb,'">',"\n";
}
if (! $this->displayed[$k]) {
continue;
}
if ($this->hidden($k)) {
echo $this->htmlHiddenData($this->fds[$k], $this->fdd[$k]['default']);
continue;
}
$css_postfix = @$this->fdd[$k]['css']['postfix'];
$css_class_name = $this->getCSSclass('input', null, 'next', $css_postfix);
echo '<tr class="',$this->getCSSclass('row', null, true, $css_postfix),'">',"\n";
echo '<td class="',$this->getCSSclass('key', null, true, $css_postfix),'">';
echo $this->fdd[$k]['name'],'</td>',"\n";
echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'"';
echo $this->getColAttributes($k),">\n";
if ($this->col_has_values($k)) {
$vals = $this->set_values($k);
$selected = @$this->fdd[$k]['default'];
$multiple = $this->col_has_multiple_select($k);
$readonly = $this->readonly($k);
$strip_tags = true;
$escape = true;
echo $this->htmlSelect($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name,
$vals, $selected, $multiple, $readonly, $strip_tags, $escape);
} elseif (isset ($this->fdd[$k]['textarea'])) {
echo '<textarea class="',$css_class_name,'" name="',$this->cgi['prefix']['data'].$this->fds[$k],'"';
echo ($this->readonly($k) ? ' disabled' : '');
if (intval($this->fdd[$k]['textarea']['rows']) > 0) {
echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"';
}
if (intval($this->fdd[$k]['textarea']['cols']) > 0) {
echo ' cols="',$this->fdd[$k]['textarea']['cols'],'"';
}
if (isset($this->fdd[$k]['textarea']['wrap'])) {
echo ' wrap="',$this->fdd[$k]['textarea']['wrap'],'"';
} else {
echo ' wrap="virtual"';
};
// mce mod start
if (isset($this->fdd[$k]['textarea']['html'])) {
$mce_tag = 'editable';
if (is_string($this->fdd[$k]['textarea']['html'])) {
$mce_tag = $this->fdd[$k]['textarea']['html'];
};
echo ' mce_'.$mce_tag.'=true ';
};
// mce mod end
echo '>',htmlspecialchars($this->fdd[$k]['default']),'</textarea>',"\n";
} else {
// Simple edit box required
$size_ml_props = '';
$maxlen = intval($this->fdd[$k]['maxlen']);
$size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] : min($maxlen, 60);
$size && $size_ml_props .= ' size="'.$size.'"';
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';
echo '<input class="',$css_class_name,'" ';
echo ($this->password($k) ? 'type="password"' : 'type="text"');
echo ($this->readonly($k) ? ' disabled' : '');
/* calendar mod start */
echo ' id="',$this->dhtml['prefix'].'fld_'.$this->fds[$k],'"';
/* calendar mod end */
echo ' name="',$this->cgi['prefix']['data'].$this->fds[$k],'"';
echo $size_ml_props,' value="';
echo htmlspecialchars($this->fdd[$k]['default']),'">';
/* calendar mod start */
/* Call htmlcal helper function */
$this->calPopup_helper($k, null);
/* calendar mod end */
}
echo '</td>',"\n";
if ($this->guidance) {
$css_class_name = $this->getCSSclass('help', null, true, $css_postfix);
$cell_value = $this->fdd[$k]['help'] ? $this->fdd[$k]['help'] : '&nbsp;';
echo '<td class="',$css_class_name,'">',$cell_value,'</td>',"\n";
}
echo '</tr>',"\n";
}
} /* }}} */
 
function display_change_field($row, $k) /* {{{ */
{
$css_postfix = @$this->fdd[$k]['css']['postfix'];
$css_class_name = $this->getCSSclass('input', null, true, $css_postfix);
echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'"';
echo $this->getColAttributes($k),">\n";
if ($this->col_has_values($k)) {
$vals = $this->set_values($k);
$multiple = $this->col_has_multiple_select($k);
$readonly = $this->readonly($k);
$strip_tags = true;
$escape = true;
echo $this->htmlSelect($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name,
$vals, $row["qf$k"], $multiple, $readonly, $strip_tags, $escape);
} elseif (isset($this->fdd[$k]['textarea'])) {
echo '<textarea class="',$css_class_name,'" name="',$this->cgi['prefix']['data'].$this->fds[$k],'"';
echo ($this->readonly($k) ? ' disabled' : '');
if (intval($this->fdd[$k]['textarea']['rows']) > 0) {
echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"';
}
if (intval($this->fdd[$k]['textarea']['cols']) > 0) {
echo ' cols="',$this->fdd[$k]['textarea']['cols'],'"';
}
if (isset($this->fdd[$k]['textarea']['wrap'])) {
echo ' wrap="',$this->fdd[$k]['textarea']['wrap'],'"';
} else {
echo ' wrap="virtual"';
};
// mce mod start
if (isset($this->fdd[$k]['textarea']['html'])) {
$mce_tag = 'editable';
if (is_string($this->fdd[$k]['textarea']['html'])) {
$mce_tag = $this->fdd[$k]['textarea']['html'];
};
echo ' mce_'.$mce_tag.'=true ';
};
// mce mod end
echo '>',htmlspecialchars($row["qf$k"]),'</textarea>',"\n";
} else {
$size_ml_props = '';
$maxlen = intval($this->fdd[$k]['maxlen']);
$size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] : min($maxlen, 60);
$size && $size_ml_props .= ' size="'.$size.'"';
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';
echo '<input class="',$css_class_name,'" type="text" ';
echo ($this->readonly($k) ? 'disabled ' : '');
/* calendar mod start */
echo ' id="',$this->dhtml['prefix'].'fld_'.$this->fds[$k],'"';
/* calendar mod end */
echo 'name="',$this->cgi['prefix']['data'].$this->fds[$k],'" value="';
echo htmlspecialchars($row["qf$k"]),'" ',$size_ml_props,'>',"\n";
/* calendar mod start */
/* Call calPopup helper function */
$this->calPopup_helper($k, htmlspecialchars($row["qf$k"]));
/* calendar mod end */
}
echo '</td>',"\n";
} /* }}} */
 
function form_end() /* {{{ */
{
if ($this->display['form']) {
echo '</form>',"\n";
 
/* calendar mod start */
 
/* Add script calls to the end of the form for all fields
with calendar popups. */
if (isset($this->calendars)) {
echo '<script type="text/javascript"><!--',"\n";
foreach($this->calendars as $ck => $cv) {
echo 'Calendar.setup({',"\n";
foreach ($cv as $ck1 => $cv1) {
if (in_array($ck1, $this->valid_opts)) {
echo "\t",str_pad($ck1, 15),' : "',$cv1,'",',"\n";
}
}
echo "\t",str_pad('inputField', 15),' : "',$this->dhtml['prefix'].'fld_'.$ck,'"',"\n";
echo '});',"\n";
};
echo '// -->',"\n";
echo '</script>',"\n";
};
/* calendar mod end */
};
} /* }}} */
 
}
 
?>
/trunk/jrest/util/extensions/phpMyEdit-calpopup.class.php
New file
0,0 → 1,357
<?php
 
/*
* phpMyEdit - instant MySQL table editor and code generator
*
* extensions/phpMyEdit-calpopup.class.php - phpMyEdit calendar popup extension
* ____________________________________________________________
*
* Contribution of Adam Hammond <php@pixolet.co.uk>, London, UK
* Copyright (c) 2003-2006 Platon Group, http://platon.sk/
* All rights reserved.
*
* See README file for more information about this software.
* See COPYING file for license information.
*
* Download the latest version from
* http://platon.sk/projects/phpMyEdit/
*/
/* $Platon: phpMyEdit/extensions/phpMyEdit-calpopup.class.php,v 1.9 2006-01-22 21:44:17 nepto Exp $ */
 
/*
OVERVIEW
--------
 
NOTE...This extension will not work with the CVS version of PME
 
calPopup extends the standard phpMyEdit class to allow
a calendar popup helper to be put on any text field.
This extension uses the free jsCalendar code from
http://dynarch.com/mishoo/calendar.epl website.
REQUIREMENTS
------------
 
The requirement is a properly installed jsCalendar script.
All browsers supported by jsCalendar are supported by this
extension.
 
USAGE
-----
 
This extension enables the display of a popup calendar selection
against selected fields.
In order to use it, you should:
 
1. Load the jsCalendar scripts in the <head>...</head> section of
your phpMyEdit calling program, substituting the correct paths:
 
<script type="text/javascript" src="js/calendar.js"></script>
<script type="text/javascript" src="js/lang/calendar-en.js"></script>
<script type="text/javascript" src="js/calendar-setup.js"></script>
 
2. Choose your preferred jsCalendar CSS file (see jsCalendar
documentation) and add the following in the <head>...</head>
section of your phpMyEdit calling program, substituting the
correct path:
<link rel="stylesheet" type="text/css" media="screen"
href="css/calendar-system.css">
 
NOTE: To avoid an unwanted side effect in the CSS style
produced by phpMyEditSetup.php, add a 'width:auto' property
into the '.calendar table' entry in your selected jsCalendar
style sheet.
 
3. Call to phpMyEdit-calPopup.class.php instead
of phpMyEdit.class.php.
 
Example:
 
require_once 'extensions/phpMyEdit-calpopup.class.php';
new phpMyEdit_calpopup($opts);
 
4. Add 'calendar' parameter to the field definitions where you
want a calendar popup in your phpMyEdit calling program.
 
Example:
 
$opts['fdd']['col_name'] = array(
'name' => 'Column',
'select' => 'T',
'options' => 'ACPVD',
'required' => true,
'calendar' => true
);
 
This is will display a button next to the field which pops up
a calendar when clicked. If that field has a 'strftimemask'
parameter set, it will use this for the date format.
For more advanced usage, you can set the 'calendar' parameter
to an array of valid jsCalendar Calendar.setup options
(see jSCalendar document for details). Note that not all
of these options make sense to use in phpMyEdit, and some
of them will actively break the function.
Example:
$opts['fdd']['col_name'] = array(
'name' => 'Column',
'select' => 'T',
'options' => 'ACPVD',
'required' => true,
'calendar' => array(
'ifFormat' => '%Y/%m/%d', // defaults to the ['strftimemask']
'firstDay' => 1, // 0 = Sunday, 1 = Monday
'singleClick' => true, // single or double click to close
'weekNumbers' => true, // Show week numbers
'showsTime' => false, // Show time as well as date
'timeFormat' => '24', // 12 or 24 hour clock
'label' => '...', // button label (used by phpMyEdit)
'date' => '2003-12-19 10:00' // Initial date/time for popup
// (see notes below)
)
);
 
NOTES
-----
 
1. The popup will normally set the initial value to the current
field value or to current date/time. 'date' option will always
override this, even if there is a current date/time value
in the field. If you want a default value only if the field
is currently empty, use the phpMyEdit 'default' option.
 
2. Only the options listed above may be set by the user, any other
options will be ignored.
 
SEARCH KEYWORD
--------------
 
Search for "CalPopup" string in this source code,
to find all extension related modifications.
*/
 
require_once dirname(__FILE__).'/../phpMyEdit.class.php';
 
class phpMyEdit_calpopup extends phpMyEdit
{
/* CalPopup mod start */
 
/* Array for collecting list of fields with calendar popups */
var $calendars;
 
/* Array of valid options for passing to Calendar.setup */
var $valid_opts = array(
'button','ifFormat','singleClick','firstDay',
'weekNumbers','showsTime','timeFormat','date'
);
 
/**
* Checks to see if the calendar parameter is set on the field
*
* @param k current field name
* @param curval current value of field (set to null for default)
*
* If the calendar parameter is set on the field, this function displays
* the button. It then pushes the Calendar.setup parameters into an array,
* including the user specified ones in the calling program is they exist.
* This array is then added to the $calendars array indexed by the field
* name. This allows for multiple fields with calendar popups.
*/
function CalPopup_helper($k, $curval) /* {{{ */
{
if (@$this->fdd[$k]['calendar']) {
$cal_ar['ifFormat'] = '%Y-%m-%d %H:%M';
$cal_ar['showsTime'] = true;
$cal_ar['singleClick'] = false;
if (isset($curval)) {
if (substr($curval, 0, 4) != '0000')
$cal_ar['date'] = $curval;
}
if (isset($this->fdd[$k]['strftimemask'])) {
$cal_ar['ifFormat'] = $this->fdd[$k]['strftimemask'];
}
if (is_array($this->fdd[$k]['calendar'])) {
foreach($this->fdd[$k]['calendar'] as $ck => $cv) {
$cal_ar[$ck] = $cv;
}
}
$cal_ar['button'] = 'pme_calpopup_button_'.$this->fds[$k];
$this->calendars[$this->fds[$k]] = $cal_ar;
$label = @$this->fdd[$k]['calendar']['label'];
strlen($label) || $label = '...';
echo '<button id="',$cal_ar['button'],'">',$label,'</button>';
}
} /* }}} */
 
/* CalPopup mod end */
 
function display_add_record() /* {{{ */
{
for ($tab = 0, $k = 0; $k < $this->num_fds; $k++) {
if (isset($this->fdd[$k]['tab']) && $this->tabs_enabled() && $k > 0) {
$tab++;
echo '</table>',"\n";
echo '</div>',"\n";
echo '<div id="phpMyEdit_tab',$tab,'">',"\n";
echo '<table class="',$this->getCSSclass('main'),'" summary="',$this->tb,'">',"\n";
}
if (! $this->displayed[$k]) {
continue;
}
if ($this->hidden($k)) {
echo $this->htmlHidden($this->fds[$k], $row["qf$k"]);
continue;
}
$css_postfix = @$this->fdd[$k]['css']['postfix'];
$css_class_name = $this->getCSSclass('input', null, 'next', $css_postfix);
echo '<tr class="',$this->getCSSclass('row', null, true, $css_postfix),'">',"\n";
echo '<td class="',$this->getCSSclass('key', null, true, $css_postfix),'">',$this->fdd[$k]['name'],'</td>',"\n";
echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'"';
echo $this->getColAttributes($k),">\n";
if ($this->col_has_values($k)) {
$vals = $this->set_values($k);
$selected = @$this->fdd[$k]['default'];
$multiple = $this->col_has_multiple_select($k);
$readonly = $this->readonly($k);
$strip_tags = true;
$escape = true;
echo $this->htmlSelect($this->fds[$k], $css_class_name, $vals, $selected,
$multiple, $readonly, $strip_tags, $escape);
} elseif (isset ($this->fdd[$k]['textarea'])) {
echo '<textarea class="',$css_class_name,'" name="',$this->fds[$k],'"';
echo ($this->readonly($k) ? ' disabled' : '');
if (intval($this->fdd[$k]['textarea']['rows']) > 0) {
echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"';
}
if (intval($this->fdd[$k]['textarea']['cols']) > 0) {
echo ' cols="',$this->fdd[$k]['textarea']['cols'],'"';
}
if (isset($this->fdd[$k]['textarea']['wrap'])) {
echo ' wrap="',$this->fdd[$k]['textarea']['wrap'],'"';
} else {
echo ' wrap="virtual"';
}
echo '>',htmlspecialchars($this->fdd[$k]['default']),'</textarea>',"\n";
} else {
// Simple edit box required
$size_ml_props = '';
$maxlen = intval($this->fdd[$k]['maxlen']);
$size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] : min($maxlen, 60);
$size && $size_ml_props .= ' size="'.$size.'"';
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';
 
/* CalPopup mod start */
if (@$this->fdd[$k]['calendar']) {
$size_ml_props .= ' id="pme_calpopup_input_'.$this->fds[$k].'"';
}
/* CalPopup mod end */
 
echo '<input class="',$css_class_name,'" type="text" ';
echo ($this->readonly($k) ? 'disabled ' : ''),' name="',$this->fds[$k],'"';
echo $size_ml_props,' value="';
echo htmlspecialchars($this->fdd[$k]['default']),'">';
 
/* CalPopup mod start */
/* Call CalPopup helper function */
$this->CalPopup_helper($k, null);
/* CalPopup mod end */
}
echo '</td>',"\n";
if ($this->guidance) {
$css_class_name = $this->getCSSclass('help', null, true, $css_postfix);
$cell_value = $this->fdd[$k]['help'] ? $this->fdd[$k]['help'] : '&nbsp;';
echo '<td class="',$css_class_name,'">',$cell_value,'</td>',"\n";
}
echo '</tr>',"\n";
}
} /* }}} */
 
function display_change_field($row, $k) /* {{{ */
{
$css_postfix = @$this->fdd[$k]['css']['postfix'];
$css_class_name = $this->getCSSclass('input', null, true, $css_postfix);
echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'"';
echo $this->getColAttributes($k),">\n";
if ($this->col_has_values($k)) {
$vals = $this->set_values($k);
$multiple = $this->col_has_multiple_select($k);
$readonly = $this->readonly($k);
$strip_tags = true;
$escape = true;
echo $this->htmlSelect($this->fds[$k], $css_class_name, $vals, $row["qf$k"],
$multiple, $readonly, $strip_tags, $escape);
} elseif (isset($this->fdd[$k]['textarea'])) {
echo '<textarea class="',$css_class_name,'" name="',$this->fds[$k],'"';
echo ($this->readonly($k) ? ' disabled' : '');
if (intval($this->fdd[$k]['textarea']['rows']) > 0) {
echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"';
}
if (intval($this->fdd[$k]['textarea']['cols']) > 0) {
echo ' cols="',$this->fdd[$k]['textarea']['cols'],'"';
}
if (isset($this->fdd[$k]['textarea']['wrap'])) {
echo ' wrap="',$this->fdd[$k]['textarea']['wrap'],'"';
} else {
echo ' wrap="virtual"';
}
echo '>',htmlspecialchars($row["qf$k"]),'</textarea>',"\n";
} else {
$size_ml_props = '';
$maxlen = intval($this->fdd[$k]['maxlen']);
$size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] : min($maxlen, 60);
$size && $size_ml_props .= ' size="'.$size.'"';
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';
 
/* CalPopup mod start */
if (@$this->fdd[$k]['calendar']) {
$size_ml_props .= ' id="pme_calpopup_input_'.$this->fds[$k].'"';
}
/* CalPopup mod end */
 
echo '<input class="',$css_class_name,'" type="text" ';
echo ($this->readonly($k) ? 'disabled ' : ''),'name="',$this->fds[$k],'" value="';
echo htmlspecialchars($row["qf$k"]),'" ',$size_ml_props,'>',"\n";
 
/* CalPopup mod start */
/* Call CalPopup helper function */
$this->CalPopup_helper($k, htmlspecialchars($row["qf$k"]));
/* CalPopup mod end */
}
echo '</td>',"\n";
} /* }}} */
 
function form_end() /* {{{ */
{
if ($this->display['form']) {
echo '</form>',"\n";
/* CalPopup mod start */
/* Add script calls to the end of the form for all fields
with calendar popups. */
if (isset($this->calendars)) {
echo '<script type="text/javascript"><!--',"\n";
foreach($this->calendars as $ck => $cv) {
echo 'Calendar.setup({',"\n";
foreach ($cv as $ck1 => $cv1) {
if (in_array($ck1, $this->valid_opts)) {
echo "\t",str_pad($ck1, 15),' : "',$cv1,'",',"\n";
}
}
echo "\t",str_pad('inputField', 15),' : "pme_calpopup_input_',$ck,'"',"\n";
echo '});',"\n";
};
echo '// --></script>',"\n";
};
 
/* CalPopup mod end */
};
} /* }}} */
}
 
?>
/trunk/jrest/util/extensions/phpMyEdit-messages.class.php
New file
0,0 → 1,329
<?php
 
/*
* phpMyEdit - instant MySQL table editor and code generator
*
* extensions/phpMyEdit-messages.class.php - phpMyEdit messages extension
* ____________________________________________________________
*
* Developed by Ondrej Jombik <nepto@platon.sk>
* Copyright (c) 2002-2006 Platon Group, http://platon.sk/
* All rights reserved.
*
* See README file for more information about this software.
* See COPYING file for license information.
*
* Download the latest version from
* http://platon.sk/projects/phpMyEdit/
*/
 
/* $Platon: phpMyEdit/extensions/phpMyEdit-messages.class.php,v 1.15 2006-06-17 11:14:54 nepto Exp $ */
 
/* This extension is part of phpMyEzin: Content Management System project,
where it handles discussion messages for particular articles. It depends on
some phpMyEzin characteristics, thus extension should not and cannot be used
outside this project. However there are planned some improvements for future
to make this extension handle any kind of tree-structured data. */
 
require_once dirname(__FILE__).'/../phpMyEdit.class.php';
 
class phpMyEdit_messages extends phpMyEdit
{
function phpMyEdit_messages($opts) /* {{{ */
{
$execute = 1;
isset($opts['execute']) && $execute = $opts['execute'];
$opts['execute'] = 0;
parent::phpMyEdit($opts);
$this->tb2 = $opts['tb2'];
$this->format_date = $opts['format_date'];
/* Preserved article ID in CGI environment. */
/* TODO: change to $this->article_id or something like this */
global $ezin_admin_article;
$ezin_admin_article = $this->get_data_cgi_var('article_id');
 
$execute && $this->execute();
} /* }}} */
 
function list_table() /* {{{ */
{
$ezin_admin_article_change_up = $this->get_sys_cgi_var('ezin_admin_article_change_up');
$ezin_admin_article_change_down = $this->get_sys_cgi_var('ezin_admin_article_change_down');
if (isset($ezin_admin_article_change_up)) {
$ezin_admin_article = $this->get_sys_cgi_var('ezin_admin_article_up');
} elseif (isset($ezin_admin_article_change_down)) {
$ezin_admin_article = $this->get_sys_cgi_var('ezin_admin_article_down');
}
!isset($ezin_admin_article) && $ezin_admin_article = $this->get_data_cgi_var('article_id');
$ezin_admin_article = intval($ezin_admin_article);
$query = sprintf('SELECT article_id, count(id) AS messages FROM %s'
.' GROUP BY article_id HAVING article_id = %d',
$this->tb, intval($ezin_admin_article));
if (($result = $this->myquery($query)) == false) {
return false;
}
$row = @mysql_fetch_array($result, MYSQL_ASSOC);
//$ezin_admin_article = intval($row['article_id']);
$ezin_admin_msgcount = intval($row['messages']);
@mysql_free_result($result);
 
echo '<form class="',$this->getCSSclass('form');
echo '" action="',$page_name,'" method="POST">',"\n";
 
if ($this->nav_up() || $ezin_admin_article <= 0) {
$this->message_nav_buttons($ezin_admin_article, $ezin_admin_msgcount, 'up');
echo '<hr class="',$this->getCSSclass('hr', 'up'),'">',"\n";
}
 
if ($ezin_admin_article > 0) {
echo '<table class="',$this->getCSSclass('main'),'" summary="',$this->tb,'">',"\n";
echo '<tr class="',$this->getCSSclass('header'),'">',"\n";
foreach (array('ID', 'Subject', ' ', 'Author', 'Date & Time', 'IP addresses') as $str) {
echo '<th class="',$this->getCSSclass('header'),'">';
echo Platon::htmlspecialchars2($str),'</th>',"\n";
}
echo '</tr>',"\n";
echo '<tr class="',$this->getCSSclass('header'),'">',"\n";
echo '<th class="',$this->getCSSclass('header'),'" colspan="6">';
echo 'Valid messages</td></tr>',"\n";
$message_ids = $this->message_process($ezin_admin_article, 0, 0);
$count_message_ids = count($message_ids);
if ($count_message_ids == 0) {
echo '<tr class="',$this->getCSSclass('row', null, 'next'),'">',"\n";
echo '<td class="',$this->getCSSclass('cell', null, true),'" colspan="6">',"\n";
echo '<i>There are no valid messages for this article.</i>';
echo '</td></tr>',"\n";
}
$query = sprintf('SELECT id, parent, article_id, author,'
.' email, homepage, subject, datetime, ip'
.' FROM %s WHERE article_id = %d ORDER BY datetime ASC',
$this->tb, intval($ezin_admin_article));
if (($result = $this->myquery($query)) == false) {
return false;
}
$all_ids = array();
$parents = array();
for ($i = 0; ($row = @mysql_fetch_array($result, MYSQL_ASSOC)); $i++) {
$all_ids[] = $row['id'];
$parents[$row['id']] = $row['parent'];
}
@mysql_free_result($result);
$all_ids = array_diff($all_ids, $message_ids);
echo '<tr class="',$this->getCSSclass('header'),'">',"\n";
echo '<th class="',$this->getCSSclass('header'),'" colspan="6">';
echo 'Invalid messages</td></tr>',"\n";
if (count($all_ids) > 0) {
/* To force buttons */
$count_message_ids = -1;
while (count($all_ids) > 0) {
//echo "<p>all_ids: "; var_dump($all_ids);echo '<br>';
$sub_ids = $this->message_process($ezin_admin_article,
$parents[array_shift($all_ids)], 0, true);
$all_ids = array_diff($all_ids, $sub_ids);
}
} else {
echo '<tr class="',$this->getCSSclass('row', null, 'next'),'">',"\n";
echo '<td class="',$this->getCSSclass('cell', null, true),'" colspan="6">',"\n";
echo '<i>There are no invalid messages for this article.</i>';
echo '</td></tr>',"\n";
}
echo '</table>';
}
if ($this->nav_down() && $ezin_admin_article > 0) {
echo '<hr class="',$this->getCSSclass('hr', 'down'),'">',"\n";
$this->message_nav_buttons($ezin_admin_article, $ezin_admin_msgcount, 'down');
}
echo $this->htmlHiddenData('article_id', $ezin_admin_article);
echo '</form>',"\n";
} /* }}} */
 
function message_process($article_id, $id, $level = 0, $parent = true) /* {{{ */
{
$id = intval($id);
$level = intval($level);
$query = sprintf('SELECT id, parent, article_id, author,'
.' email, homepage, subject, datetime, ip'
.' FROM %s WHERE %s = %d AND article_id = %d'
.' ORDER BY datetime ASC', $this->tb,
$parent == true ? 'parent' : 'id', intval($id), intval($article_id));
if (($result = $this->myquery($query)) == false) {
return false;
}
 
$ar = array();
$ar_out = array();
for ($i = 0; ($row = @mysql_fetch_array($result, MYSQL_ASSOC)); $i++) {
$ar[$i] = $row;
$ar_out[] = $row['id'];
}
$checked = ! $level && $parent ? ' checked' : '';
for ($i = 0; $i < count($ar); $i++) {
echo '<tr class="',$this->getCSSclass('row', null, 'next'),'">',"\n";
$css_class_name = $this->getCSSclass('cell', null, true);
$css_class_name2 = $this->getCSSclass('navigation', null, true);
echo '<td class="',$css_class_name,'">',$ar[$i]['id'],'</td>',"\n";
echo '<td class="',$css_class_name,'">';
for ($j = 0; $j < $level; $j++) {
echo '&nbsp;&nbsp;&nbsp;';
}
echo htmlspecialchars($ar[$i]['subject']);
echo '</td>',"\n";
echo '<td class="',$css_class_name2,'">';
echo '<input',$checked,' class="',$css_class_name2,'"';
echo ' type="radio" ','name="',$this->cgi['prefix']['sys'],'rec"';
echo ' value="',$ar[$i]['id'],'" class="link"></td>',"\n";
echo '<td class="',$css_class_name,'">',htmlspecialchars($ar[$i]['author']), '</td>';
echo '<td class="',$css_class_name,'">',htmlspecialchars($ar[$i]['datetime']),'</td>';
// TODO: do resolving
echo '<td class="',$css_class_name,'"><small>';
// this shoud be global IP-adress-deliminator
$output = false;
$ar_ip = preg_split('|([ ]*[ \\/,;]+[ ]*)|', $ar[$i]['ip'], -1, PREG_SPLIT_DELIM_CAPTURE);
foreach ($ar_ip as $ip) {
if (strlen($output) > 0) {
$output = true;
}
$ip = htmlspecialchars($ip);
if (preg_match('/^(\d{1,3}\.){3}\d{1,3}$/', $ip)) {
echo '<a class="',$css_class_name,'" target="_blank" href="http://',$ip,'">';
echo '<small>',$ip,'</small></a>';
} else {
echo $ip;
}
}
if (! $output) {
echo '&nbsp;';
}
echo '</small></td>',"\n";
echo '</tr>',"\n";
if ($parent) {
$ar_out = array_merge($ar_out, $this->message_process(
$article_id, $ar[$i]['id'], $level + 1));
}
strlen($checked) && $checked = '';
}
return $ar_out;
} /* }}} */
 
function message_nav_buttons($article_id, $messages_count, $position) /* {{{ */
{
echo '<table class="',$this->getCSSclass('navigation', $position),'">',"\n";
echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n";
echo '<td class="',$this->getCSSclass('buttons', $position),'">',"\n";
$this->print_article_select($article_id, 0, $position);
echo '</td>',"\n";
echo '<td class="',$this->getCSSclass('buttons2', $position),'">',"\n";
if ($article_id > 0) {
if ($this->add_enabled()) {
echo $this->htmlSubmit('operation', 'Add', $this->getCSSclass('add', $position), false, false);
}
if ($this->view_enabled()) {
echo '&nbsp;';
echo $this->htmlSubmit('operation', 'View', $this->getCSSclass('view', $position),
false, $messages_count <= 0);
}
if ($this->change_enabled()) {
echo '&nbsp;';
echo $this->htmlSubmit('operation', 'Change', $this->getCSSclass('change', $position),
false, $messages_count <= 0);
}
if ($this->delete_enabled()) {
echo '&nbsp;';
echo $this->htmlSubmit('operation', 'Delete', $this->getCSSclass('delete', $position),
false, $messages_count <= 0);
}
}
echo '</td></tr></table>',"\n";
} /* }}} */
 
function display_record_buttons() /* {{{ */
{
echo '<table class="',$this->getCSSclass('navigation', $position),'">',"\n";
echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n";
echo '<td class="',$this->getCSSclass('buttons', $position),'">',"\n";
$this->print_article_select($article_id, 1, $position);
echo '</td>',"\n";
if (strlen(@$this->message) > 0) {
echo '<td class="',$this->getCSSclass('message', $position),'">',$this->message,'</td>',"\n";
}
echo '<td class="',$this->getCSSclass('buttons2', $position),'">',"\n";
if ($this->change_operation()) {
echo $this->htmlSubmit('savechange', 'Save', $this->getCSSclass('save', $position), true), '&nbsp;';
echo $this->htmlSubmit('morechange', 'Apply', $this->getCSSclass('more', $position), true), '&nbsp;';
echo $this->htmlSubmit('cancelchange', 'Cancel', $this->getCSSclass('cancel', $position), false);
} elseif ($this->add_operation()) {
echo $this->htmlSubmit('saveadd', 'Save', $this->getCSSclass('save', $position), true), '&nbsp;';
echo $this->htmlSubmit('moreadd', 'More', $this->getCSSclass('more', $position), true), '&nbsp;';
echo $this->htmlSubmit('canceladd', 'Cancel', $this->getCSSclass('cancel', $position), false);
} elseif ($this->delete_operation()) {
echo $this->htmlSubmit('savedelete', 'Delete', $this->getCSSclass('save', $position), false), '&nbsp;';
echo $this->htmlSubmit('canceldelete', 'Cancel', $this->getCSSclass('cancel', $position), false);
} elseif ($this->view_operation()) {
if ($this->change_enabled()) {
echo $this->htmlSubmit('operation', 'Change', $this->getCSSclass('save', $position), false), '&nbsp;';
}
echo $this->htmlSubmit('cancelview', 'Cancel', $this->getCSSclass('cancel', $position), false);
}
// Message is now written here
echo '</td>',"\n";
echo '</tr></table>',"\n";
} /* }}} */
 
function print_article_select($selected_id, $disabled, $position) /* {{{ */
{
if ($selected_id <= 0) {
$rec = intval($this->get_sys_cgi_var('rec'));
if ($rec > 0) {
$query = sprintf('SELECT article_id FROM %s WHERE id = %d',
$this->tb, $rec);
$result = $this->myquery($query);
if ($result != false) {
$row = @mysql_fetch_array($result, MYSQL_NUM);
$selected_id = $row[0];
}
@mysql_free_result($result);
}
}
static $articles = null;
if ($articles == null) {
$articles = array();
$query = 'SELECT id, title, atitle, UNIX_TIMESTAMP(datetime) AS date'
.' FROM '.$this->tb2
.' ORDER BY date DESC';
if (($result = $this->myquery($query)) == false) {
return false;
}
for ($k = 0; ($row = @mysql_fetch_array($result, MYSQL_ASSOC)); $k++) {
$articles[] = $row;
}
@mysql_free_result($result);
}
echo '<select',($disabled ? ' disabled' : ''),' name="';
echo $this->cgi['prefix']['sys'].'ezin_admin_article_',$position,'" size="1">',"\n";
echo '<option value="0">-- Choose article --</option>',"\n";
foreach ($articles as $row) {
$row['title'] = empty($row['title']) ? $row['atitle'] : $row['title'];
$row['title'] = Platon::pretty_substr(strip_tags($row['title']), 40);
echo '<option'.($selected_id == $row['id'] ? ' selected' : '');
echo ' value="',$row['id'],'">',$row['title'];
if ($row['date'] > 0) {
printf(' [%d] (%s)', $row['id'], date($this->format_date, $row['date']));
}
echo '</option>',"\n";
}
echo '</select>',"\n";
if (! $disabled) {
echo $this->htmlSubmit('ezin_admin_article_change_'.$position, ' &gt; ', $this->get_sys_cgi_var('change', $position)), '&nbsp;', "\n";
}
return true;
} /* }}} */
 
}
 
/* Modeline for ViM {{{
* vim:set ts=4:
* vim600:fdm=marker fdl=0 fdc=0:
* }}} */
 
?>
/trunk/jrest/util/extensions/phpMyEdit-report.class.php
New file
0,0 → 1,319
<?php
 
/*
* phpMyEdit - instant MySQL table editor and code generator
*
* extensions/phpMyEdit-report.class.php - phpMyEdit report extension
* ____________________________________________________________
*
* Developed by Ondrej Jombik <nepto@platon.sk>
* Copyright (c) 2002-2006 Platon Group, http://platon.sk/
* All rights reserved.
*
* See README file for more information about this software.
* See COPYING file for license information.
*
* Download the latest version from
* http://platon.sk/projects/phpMyEdit/
*/
 
/* $Platon: phpMyEdit/extensions/phpMyEdit-report.class.php,v 1.12 2006-01-22 21:44:23 nepto Exp $ */
 
/* Extension TODO:
 
- allow user to enable/disable particular field in reporting (maybe 'X' flag
for indicating that field is forbidden is good idea)
- support for ['help'] in select fields screen
- make extension's option for selecting "Select fields" link or button
*/
 
require_once dirname(__FILE__).'/../phpMyEdit.class.php';
 
class phpMyEdit_report extends phpMyEdit
{
 
function phpMyEdit_report($opts) /* {{{ */
{
$opts['options'] = 'L';
$execute = 1;
isset($opts['execute']) && $execute = $opts['execute'];
$opts['execute'] = 0;
parent::phpMyEdit($opts);
$execute && $this->execute();
} /* }}} */
 
function make_language_labels($language) /* {{{ */
{
$ret = parent::make_language_labels($language);
strlen($ret['Make report']) <= 0 && $ret['Make report'] = 'Make report';
strlen($ret['Select fields']) <= 0 && $ret['Select fields'] = 'Select fields';
strlen($ret['Records per screen']) <= 0 && $ret['Records per screen'] = 'Records per screen';
return $ret;
} /* }}} */
 
function get_cgi_cookie_var($name, $default_value = null) /* {{{ */
{
$ret = $this->get_cgi_var($name, null);
if ($ret === null) {
global $HTTP_COOKIE_VARS;
$ret = @$HTTP_COOKIE_VARS[$name.'_'.$this->tb.'_cookie'];
if (! isset($ret)) {
$ret = $default_value;
}
}
return $ret;
} /* }}} */
 
function display_list_table_buttons($total_recs, $position) /* {{{ */
{ /* This is mostly copy/paste from core class. */
$listall = $this->inc <= 0; // Are we doing a listall?
echo '<table class="',$this->getCSSclass('navigation', $position),'">',"\n";
echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n";
echo '<td class="',$this->getCSSclass('buttons', $position),'">',"\n";
echo '<input class="',$this->getCSSclass('fields-select', $position);
echo '" type="submit" name="fields_select" value="',$this->labels['Select fields'],'">&nbsp;';
// Note that <input disabled isn't valid HTML, but most browsers support it
$disabled = ($this->fm > 0 && ! $listall) ? '' : ' disabled';
echo '<input',$disabled,' class="',$this->getCSSclass('prev', $position);
echo '" type="submit" name="',ltrim($disabled),'prev" value="',$this->labels['Prev'],'">&nbsp;';
$disabled = ($this->fm + $this->inc < $total_recs && ! $listall) ? '' : ' disabled';
echo '<input',$disabled,' class="',$this->getCSSclass('next', $position);
echo '" type="submit" name="',ltrim($disabled),'next" value="',$this->labels['Next'],'">';
// Message is now written here
echo '</td>',"\n";
if (strlen(@$this->message) > 0) {
echo '<td class="',$this->getCSSclass('message', $position),'">',$this->message,'</td>',"\n";
}
// Display page and records statistics
echo '<td class="',$this->getCSSclass('stats', $position),'">',"\n";
if ($listall) {
echo $this->labels['Page'],':&nbsp;1&nbsp;',$this->labels['of'],'&nbsp;1';
} else {
echo $this->labels['Page'],':&nbsp;',($this->fm / $this->inc) + 1;
echo '&nbsp;',$this->labels['of'],'&nbsp;',max(1, ceil($total_recs / abs($this->inc)));
}
echo '&nbsp; ',$this->labels['Records'],':&nbsp;',$total_recs;
echo '</td></tr></table>',"\n";
} /* }}} */
 
function display_report_selection_buttons($position) /* {{{ */
{
echo '<table class="',$this->getCSSclass('navigation', $position),'">',"\n";
echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n";
echo '<td class="',$this->getCSSclass('buttons', $position),'">',"\n";
echo '<input class="',$this->getCSSclass('make-report', $position);
echo '" type="submit" name="prepare_filter" value="',$this->labels['Make report'],'">',"\n";
echo '</td></tr></table>',"\n";
} /* }}} */
 
function get_select_fields_link() /* {{{ */
{
$link = '<a href="'.htmlspecialchars($this->page_name).'?fields_select=1';
for ($i = 0; $i < count($table_cols); $i++) {
$varname = 'qf'.$i;
$value = $this->get_cgi_cookie_var($varname);
if (! empty($value)) {
$link .= htmlspecialchars(
'&'.rawurlencode($varname).
'='.rawurlencode($value));
}
}
$link .= htmlspecialchars($this->cgi['persist']);
$link .= '">'.$this->labels['Select fields'].'</a>';
return $link;
} /* }}} */
 
function execute() /* {{{ */
{
global $HTTP_GET_VARS;
global $HTTP_POST_VARS;
 
/*
* Extracting field names
*/
 
$table_cols = array();
$all_table_cols = array();
 
if ($this->connect() == false) {
return false;
}
$query_parts = array(
'type' => 'select',
'select' => '*',
'from' => $this->tb,
'limit' => '1');
$result = $this->myquery($this->get_SQL_query($query_parts), __LINE__);
$all_table_cols = array_keys(@mysql_fetch_array($result, MYSQL_ASSOC));
if (count($all_table_cols) <= 0) {
$this->error('database fetch error');
return false;
}
foreach (array_keys($this->fdd) as $field_name) {
if (preg_match('/^\d*$/', $field_name))
continue;
if (($idx = array_search($field_name, $all_table_cols)) !== false)
$table_cols[$field_name] = mysql_field_len($result, $idx);
}
@mysql_free_result($result);
unset($all_table_cols);
 
/*
* Preparing variables
*/
 
$fields_select = $this->get_cgi_var('fields_select');
$filter = $this->get_cgi_var('filter');
$prepare_filter = $this->get_cgi_var('prepare_filter');
$this->inc = intval($this->get_cgi_cookie_var('inc'));
$force_select = true;
$none_displayed = true;
$expire_time = time() + (3600 * 24 * 30 * 12 * 5); // five years
$headers_sent = @headers_sent();
 
foreach (array_merge(array('@inc'), array_keys($table_cols)) as $col) {
$varname = ($col[0] == '@' ? substr($col, 1) : 'have_'.$col);
if (isset($HTTP_POST_VARS[$varname]) || isset($HTTP_GET_VARS[$varname])) {
$value = $HTTP_POST_VARS[$varname];
if (isset($HTTP_GET_VARS[$varname])) {
$value = $HTTP_GET_VARS[$varname];
}
if ($varname != 'inc' && ! empty($value)) {
$force_select = false;
}
$headers_sent || setcookie($varname.'_'.$this->tb.'_cookie', $value, $expire_time);
$this->cgi['persist'] .= '&'.urlencode($varname);
$this->cgi['persist'] .= '='.urlencode($value);
} else {
$headers_sent || setcookie($varname.'_'.$this->tb.'_cookie', '', time() - 10000);
}
}
 
$i = -1;
foreach (array_keys($this->fdd) as $key) {
$i++;
if (preg_match('/^\d*$/', $key))
continue;
$varname = 'have_'.$key;
$value = @$this->get_cgi_cookie_var($varname, '');
$options = @$value ? 'LV' : '';
$this->fdd[$i]['options'] = $options;
$this->fdd[$key]['options'] = $options;
$this->displayed[$i] = @$value ? true : false;
$value && $none_displayed = false;
}
 
/*
* Redirecting when neccessary
* (hackity hack with unregistering/unchecking fields)
*/
 
if ($prepare_filter && ! $headers_sent) {
$this->execute_redirect();
exit;
}
 
/*
* Check if field selection report screen has to be displayed
*/
 
if (isset($fields_select) || $force_select || $none_displayed) {
$this->execute_report_screen($table_cols);
return true;
}
 
if (0) {
$this->message .= $this->get_select_fields_link();
}
 
// parent class call
return parent::execute();
} /* }}} */
 
function execute_redirect() /* {{{ */
{
global $HTTP_SERVER_VARS;
global $HTTP_GET_VARS;
global $HTTP_POST_VARS;
$redirect_url = 'http://'.$HTTP_SERVER_VARS['HTTP_HOST'].$HTTP_SERVER_VARS['SCRIPT_NAME'];
$delim = '?';
foreach ($HTTP_POST_VARS + $HTTP_GET_VARS as $cgi_var_name => $cgi_var_value) {
$cgi_var_name == 'prepare_filter' && $cgi_var_name = 'filter';
$redirect_url .= $delim;
$redirect_url .= rawurlencode($cgi_var_name).'='.rawurlencode($cgi_var_value);
$delim == '?' && $delim = '&';
}
$redirect_url .= $this->cgi['persist'];
header('Location: '.$redirect_url);
exit;
} /* }}} */
 
function execute_report_screen($table_cols) /* {{{ */
{
echo '<form class="',$this->getCSSclass('form'),'" action="';
echo htmlspecialchars($this->page_name),'" method="POST">',"\n";
if ($this->nav_up()) {
$this->display_report_selection_buttons('up');
echo '<hr class="',$this->getCSSclass('hr', 'up'),'">',"\n";
}
echo '<table class="',$this->getCSSclass('main'),'" summary="',$this->tb,'">',"\n";
 
$i = 0;
foreach ($table_cols as $key => $val) {
$css_postfix = @$this->fdd[$key]['css']['postfix'];
$css_class_name = $this->getCSSclass('input', null, true, $css_postfix);
$varname = 'have_'.$key;
$value = $this->get_cgi_cookie_var($varname);
$checked = @$value ? ' checked' : '';
echo '<tr class="',$this->getCSSclass('row', null, 'next', $css_postfix),'">',"\n";
echo '<td class="',$this->getCSSclass('key', null, true, $css_postfix),'">';
echo $this->fdd[$i]['name'],'</td>',"\n";
echo '<td class="',$this->getCSSclass('check', null, true, $css_postfix),'">';
echo '<input class="',$css_class_name,'" type="checkbox" name="';
echo htmlspecialchars($varname),'"',$checked,'>';
echo '</td>',"\n";
echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'"';
echo $this->getColAttributes($key),">\n";
$varname = 'qf'.$i;
$value = $this->get_cgi_cookie_var($varname);
if ($this->fdd[$key]['select'] == 'D' || $this->fdd[$key]['select'] == 'M') {
$from_table = ! $this->col_has_values($key) || isset($this->fdd[$key]['values']['table']);
$selected = $value;
$value = $this->set_values($key, array('*' => '*'), null, $from_table);
$multiple = $this->col_has_multiple_select($key);
$multiple |= $this->fdd[$key]['select'] == 'M';
$readonly = false;
$strip_tags = true;
$escape = true;
echo $this->htmlSelect($varname.'_id', $css_class_name, $value, $selected,
$multiple, $readonly, $strip_tags, $escape);
} else {
echo '<input class="',$css_class_name,'" type=text name="';
echo htmlspecialchars($varname),'" value="',htmlspecialchars($value),'" size="';
echo min(40, $val),'" maxlength="',min(40, max(10, $val)),'">';
}
echo '</td>',"\n",'</tr>',"\n";
$i++;
}
echo '<tr class="',$this->getCSSclass('row', null, 'next', $css_postfix),'">',"\n";
echo '<td class="',$this->getCSSclass('key', null, true, $css_postfix),'" colspan="2">';
echo $this->labels['Records per screen'],'</td>';
echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'">';
echo '<input class="',$css_class_name,'" type="text" name="inc" value="',$this->inc.'">';
echo '</td></tr>',"\n";
echo '</table>',"\n";
if ($this->nav_down()) {
echo '<hr class="',$this->getCSSclass('hr', 'down'),'">',"\n";
$this->display_report_selection_buttons('down');
}
echo '</form>';
} /* }}} */
 
}
 
/* Modeline for ViM {{{
* vim:set ts=4:
* vim600:fdm=marker fdl=0 fdc=0:
* }}} */
 
?>
/trunk/jrest/util/extensions/phpMyEdit-htmlarea.class.php
New file
0,0 → 1,209
<?php
 
/*
* phpMyEdit - instant MySQL table editor and code generator
*
* extensions/phpMyEdit-htmlarea.class.php - phpMyEdit htmlArea extension
* ____________________________________________________________
*
* Contribution of Ezudin Kurtowich <ekurtovic@ieee.org>, Sarajevo
* Copyright (c) 2003-2006 Platon Group, http://platon.sk/
* All rights reserved.
*
* See README file for more information about this software.
* See COPYING file for license information.
*
* Download the latest version from
* http://platon.sk/projects/phpMyEdit/
*/
 
/* $Platon: phpMyEdit/extensions/phpMyEdit-htmlarea.class.php,v 1.10 2006-01-22 21:44:18 nepto Exp $ */
 
/*
OVERVIEW
--------
 
NOTE...This extension will not work with the CVS version of PME. It has
been replaced by the mce_cal extension.
htmlArea is a free WYSIWYG textarea replacement from
http://www.interactivetools.com/ website.
 
REQUIREMENTS
------------
The extension requires a properly installed htmlArea script
as described on the http://www.interactivetools.com/ site.
 
USAGE
-----
 
This extension enables WYSIWYG editing of a textarea field.
In order to use it, you should:
1. Load htmlArea script in the <head>...</head> section of your
phpMyEdit calling program as described in the htmlarea manual.
NOTE: To avoid an unwanted side effect in css style produced
by phpMyEditSetup.php, delete 'table-width:100%' property.
 
2. Call to phpMyEdit-htmlarea.class.php instead
of phpMyEdit.class.php.
 
Example:
 
require_once 'extensions/phpMyEdit-htmlarea.class.php';
new phpMyEdit_htmlarea($opts);
 
3. Add 'html'=>true parameter to the textarea field definition
in your phpMyEdit calling program.
 
Example:
$opts['fdd']['col_name'] = array(
'name' => 'Column',
'select' => 'T',
'options' => 'ACPVD',
'required' => true,
'textarea' => array(
'html' => true,
'rows' => 11,
'cols' => 81)
);
 
SEARCH KEYWORD
--------------
 
Search for "htmlArea" string in this source code,
to find all extension related modifications.
*/
 
require_once dirname(__FILE__).'/../phpMyEdit.class.php';
 
class phpMyEdit_htmlarea extends phpMyEdit
{
 
/*
* Display functions overriding
*/
 
function display_add_record() /* {{{ */
{
for ($k = 0; $k < $this->num_fds; $k++) {
if ($this->hidden($k)) {
echo $this->htmlHidden($this->fds[$k], $row["qf$k"]);
continue;
}
if (! $this->displayed[$k]) {
continue;
}
$css_postfix = @$this->fdd[$k]['css']['postfix'];
$css_class_name = $this->getCSSclass('input', null, 'next', $css_postfix);
echo '<tr class="',$this->getCSSclass('row', null, true, $css_postfix),'">',"\n";
echo '<td class="',$this->getCSSclass('key', null, true, $css_postfix),'">',$this->fdd[$k]['name'],'</td>',"\n";
echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'">'."\n";
if ($this->col_has_values($k)) {
$vals = $this->set_values($k);
$selected = @$this->fdd[$k]['default'];
$multiple = $this->fdd[$k]['select'] == 'M' && ! $this->fdd[$k]['values']['table'];
$readonly = $this->readonly($k);
echo $this->htmlSelect($this->fds[$k], $css_class_name, $vals, $selected, $multiple,$readonly);
} elseif (isset ($this->fdd[$k]['textarea'])) {
echo '<textarea class="',$css_class_name,'" name="'.$this->fds[$k].'"';
echo ($this->readonly($k) ? ' disabled' : '');
if (intval($this->fdd[$k]['textarea']['rows']) > 0) {
echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"';
}
if (intval($this->fdd[$k]['textarea']['cols']) > 0) {
echo ' cols="',$this->fdd[$k]['textarea']['cols'],'"';
}
if (isset($this->fdd[$k]['textarea']['wrap'])) {
echo ' wrap="',$this->fdd[$k]['textarea']['wrap'],'"';
} else {
echo ' wrap="virtual"';
}
echo '>',htmlspecialchars($this->fdd[$k]['default']),'</textarea>',"\n";
 
// EK htmlArea code modification is here
if (isset($this->fdd[$k]['textarea']['html'])) {
echo '<script type="text/javascript" language="javascript1.2"><!--',"\n";
echo 'editor_generate("',$this->fds[$k],'");',"\n";
echo '// --></script>';
}
} else {
// Simple edit box required
$size_ml_props = '';
$maxlen = intval($this->fdd[$k]['maxlen']);
//$maxlen > 0 || $maxlen = 300;
$size = min($maxlen, 60);
$size && $size_ml_props .= ' size="'.$size.'"';
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';
echo '<input class="',$css_class_name,'" type="text" ';
echo ($this->readonly($k) ? 'disabled ' : ''),' name="',$this->fds[$k],'"';
echo $size_ml_props,' value="';
echo htmlspecialchars($this->fdd[$k]['default']),'">';
}
echo '</td>',"\n";
if ($this->guidance) {
$css_class_name = $this->getCSSclass('help', null, true, $css_postfix);
$cell_value = $this->fdd[$k]['help'] ? $this->fdd[$k]['help'] : '&nbsp;';
echo '<td class="',$css_class_name,'">',$cell_value,'</td>',"\n";
}
echo '</tr>',"\n";
}
} /* }}} */
 
function display_change_field($row, $k) /* {{{ */
{
$css_postfix = @$this->fdd[$k]['css']['postfix'];
$css_class_name = $this->getCSSclass('input', null, true, $css_postfix);
echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'">',"\n";
if ($this->col_has_values($k)) {
$vals = $this->set_values($k);
$multiple = $this->fdd[$k]['select'] == 'M' && ! $this->fdd[$k]['values']['table'];
$readonly = $this->readonly($k);
echo $this->htmlSelect($this->fds[$k], $css_class_name, $vals, $row["qf$k"], $multiple, $readonly);
} elseif (isset($this->fdd[$k]['textarea'])) {
echo '<textarea class="',$css_class_name,'" name="'.$this->fds[$k].'"';
echo ($this->readonly($k) ? ' disabled' : '');
if (intval($this->fdd[$k]['textarea']['rows']) > 0) {
echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"';
}
if (intval($this->fdd[$k]['textarea']['cols']) > 0) {
echo ' cols="',$this->fdd[$k]['textarea']['cols'],'"';
}
if (isset($this->fdd[$k]['textarea']['wrap'])) {
echo ' wrap="',$this->fdd[$k]['textarea']['wrap'],'"';
} else {
echo ' wrap="virtual"';
}
echo '>',htmlspecialchars($row["qf$k"]),'</textarea>',"\n";
 
// EK htmlArea code modification is here
if (isset($this->fdd[$k]['textarea']['html'])) {
echo '<script type="text/javascript" language="javascript1.2"><!--',"\n";
echo 'editor_generate("',$this->fds[$k],'");',"\n";
echo '// --></script>';
}
} else {
$size_ml_props = '';
$maxlen = intval($this->fdd[$k]['maxlen']);
//$maxlen > 0 || $maxlen = 300;
$size = min($maxlen, 60);
$size && $size_ml_props .= ' size="'.$size.'"';
$maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';
echo '<input class="',$css_class_name,'" type="text" ';
echo ($this->readonly($k) ? 'disabled ' : ''),'name="',$this->fds[$k],'" value="';
echo htmlspecialchars($row["qf$k"]),'" ',$size_ml_props,'>',"\n";
}
echo '</td>',"\n";
} /* }}} */
 
}
 
/* Modeline for ViM {{{
* vim:set ts=4:
* vim600:fdm=marker fdl=0 fdc=0:
* }}} */
 
?>
/trunk/jrest/util/extensions/phpMyEdit-slide.class.php
New file
0,0 → 1,144
<?php
 
/*
* phpMyEdit - instant MySQL table editor and code generator
*
* extensions/phpMyEdit-slide.class.php - slide show extension for phpMyEdit
* ____________________________________________________________
*
* Developed by Ondrej Jombik <nepto@platon.sk>
* Copyright (c) 2002-2006 Platon Group, http://platon.sk/
* All rights reserved.
*
* See README file for more information about this software.
* See COPYING file for license information.
*
* Download the latest version from
* http://platon.sk/projects/phpMyEdit/
*/
 
/* $Platon: phpMyEdit/extensions/phpMyEdit-slide.class.php,v 1.10 2006-01-22 21:44:24 nepto Exp $ */
 
/*
* Coding elapsed time: from 8:30 to 10:30 at 30th October 2002
* with heavy patching phpMyEdit core class.
*
* Music used: E-Type (Campione, This is the Way and others)
*/
 
require_once dirname(__FILE__).'/../phpMyEdit.class.php';
 
class phpMyEdit_slide extends phpMyEdit
{
// Extension options array
var $ext;
 
function phpMyEdit_slide($opts) /* {{{ */
{
$execute = 1;
isset($opts['execute']) && $execute = $opts['execute'];
$opts['execute'] = 0;
parent::phpMyEdit($opts);
 
$this->ext = $opts['ext'];
 
$execute && $this->execute($opts);
} /* }}} */
 
function display_record_buttons() /* {{{ */
{
// TODO: classify this table and cells
echo '<table border=0 cellpadding=0 cellspacing=0 width="100%" style="border:0;padding:0;">';
echo '<tr><td align=left style="text-align:left;border:0;padding:0;" nowrap>' . "\n";
if ($this->change_operation()) {
echo '<input type="submit" name="savechange" value="'.$this->labels['Save'].'" />'."\n";
echo '<input type="submit" name="morechange" value="'.$this->labels['Apply'].'" />'."\n";
echo '<input type="button" name="cancel" value="'.$this->labels['Cancel'].'" onClick="form.submit();" />'."\n";
echo '<input type="hidden" name="rec_change" value="1">';
} elseif ($this->view_operation()) {
if ($this->change_enabled()) {
echo '<input type="submit" name="operation" value="'.$this->labels['Change'].'" />'."\n";
}
echo '<input type="submit" name="cancel" value="'.$this->labels['Cancel'].'" />'."\n";
}
 
if (! $this->ext['prev_disable']) {
$disabled = $this->ext['prev'] ? '' : ' disabled';
echo '<input'.$disabled.' type="submit" name="'.ltrim($disabled).'prev" value="'
.$this->labels['Prev'].'">&nbsp;';
echo '<input type="hidden" name="rec_prev" value="'.$this->ext['prev'].'">';
}
if (! $this->ext['next_disable']) {
$disabled = $this->ext['next'] ? '' : ' disabled';
echo '<input'.$disabled.' type="submit" name="'.ltrim($disabled).'next" value="'
.$this->labels['Next'].'">';
echo '<input type="hidden" name="rec_next" value="'.$this->ext['next'].'">';
}
echo '</td></tr></table>'."\n";
} /* }}} */
 
function execute($opts) /* {{{ */
{
if ($this->get_cgi_var('rec_change')
&& ($this->next_operation() || $this->prev_operation())) {
$this->operation = $this->labels['Change'];
}
if (! $this->change_operation()) {
$this->operation = $this->labels['View'];
}
if ($this->prev_operation()) {
! $this->ext['prev_disabled'] && $this->rec = $this->get_cgi_var('rec_prev');
$this->prev = '';
}
if ($this->next_operation()) {
! $this->ext['next_disabled'] && $this->rec = $this->get_cgi_var('rec_next');
$this->next = '';
}
if (! $this->rec) {
$this->rec = $this->ext['rec'];
}
 
if (! $this->rec
|| (! $this->ext['prev_disable'] && ! $this->ext['prev'])
|| (! $this->ext['next_disable'] && ! $this->ext['next'])) {
if ($this->connect() == false) {
return false;
}
$query_parts = array(
'type' => 'select',
// XXX FIXME - simplify query
'select' => 'PMEtable0.'.$this->key,
'from' => $this->get_SQL_join_clause(),
'where' => $this->get_SQL_where_from_query_opts());
// TODO: order by clausule according to default sort order options
$res = $this->myquery($this->get_SQL_query($query_parts), __LINE__);
$ids = array();
while (($row = @mysql_fetch_array($res, MYSQL_NUM)) !== false) {
$ids[] = $row[0];
}
@mysql_free_result($res);
if ($this->rec) {
$idx = array_search($this->rec, $ids);
$idx === false && $idx = 0;
} else {
$idx = 0;
}
 
$this->rec = $ids[$idx];
! $this->ext['prev'] && $this->ext['prev'] = $ids[$idx - 1];
! $this->ext['next'] && $this->ext['next'] = $ids[$idx + 1];
}
$this->recreate_fdd();
$this->recreate_displayed();
parent::execute();
} /* }}} */
 
}
 
/* Modeline for ViM {{{
* vim:set ts=4:
* vim600:fdm=marker fdl=0 fdc=0:
* }}} */
 
?>
/trunk/jrest/util/lang/PME.lang.RO.inc
New file
0,0 → 1,64
<?php
 
/*
* phpMyEdit language file
*
* language: romanian
* encoding: iso-8859-1
* date: 2004-12-23
* author: Sebastian Proksch <sproksch@yahoo.com>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.RO.inc,v 1.2 2004-12-27 20:14:29 nepto Exp $ */
 
return Array(
'Add' =>'Adauga',
'Copy' =>'Copiaza',
'Change' =>'Modifica',
'Delete' =>'Sterge',
'View' =>'Vizualizeaza',
'Prev' =>'Precedentul',
'Next' =>'Urmatorul',
'First' =>'First', // untranslated
'Last' =>'Last', // untranslated
'Go to' =>'Go to', // untranslated
'Page' =>'Pagina',
'Records' =>'Inregistrari',
'Save' =>'Salveaza',
'More' =>'Mai mult',
'Apply' =>'Aplica',
'Cancel' =>'Anuleaza',
'Search' =>'Cauta',
'Hide' =>'Ascunde',
'Clear' =>'Anuleaza tot',
'Query' =>'Interogare',
'Current Query' =>'Interogarea curenta',
'Sorted By' =>'Sortat dupa',
'ascending' =>'crescator',
'descending' =>'descrescator',
'hidden' =>'ascuns',
'of' =>'din',
'record added' =>'inregistrare adaugata',
'record changed'=>'inregistrare modificata',
'record deleted'=>'inregistrare stearsa',
'Please enter' =>'Introduceti va rog',
'months' => Array(
'01'=>'Ianuarie',
'02'=>'Februarie',
'03'=>'Martie',
'04'=>'Aprilie',
'05'=>'Mai',
'06'=>'Iunie',
'07'=>'Iulie',
'08'=>'August',
'09'=>'Septembrie',
'10'=>'Octombrie',
'11'=>'Noiembrie',
'12'=>'Decembrie'),
// phpMyEdit-report // untranslated
'Make report' => 'Make report',
'Select fields' => 'Select fields',
'Records per screen' => 'Records per screen',
);
 
?>
/trunk/jrest/util/lang/PME.lang.ZH.inc
New file
0,0 → 1,66
<?php
 
/*
* phpMyEdit language file
*
* language: chinese (traditional)
* encoding: big5
* date: 2003-06-26, 2004-10-17
* authors:
* Pao-Hsi Huang <doggy@miniasp.com>
* Manix Sio <manixsio@gmail.com>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.ZH.inc,v 1.5 2004-12-27 20:14:29 nepto Exp $ */
 
return Array(
'Add' =>'·s¼W',
'Copy' =>'½Æ»s',
'Change' =>'Åܧó',
'Delete' =>'§R°£',
'View' =>'À˵ø',
'Prev' =>'¤W¤@­¶',
'Next' =>'¤U¤@­¶',
'First' =>'²Ä¤@­¶',
'Last' =>'³Ì¥½¤@­¶',
'Go to' =>'«e©¹',
'Page' =>'­¶¼Æ',
'Records' =>'¸ê®Æµ§¼Æ',
'Save' =>'Àx¦s',
'More' =>'Àx¦s«áÄ~Äò·s¼W',
'Apply' =>'®M¥Î',
'Cancel' =>'¨ú®ø',
'Search' =>'·j´M',
'Hide' =>'ÁôÂÃ',
'Clear' =>'²M°£',
'Query' =>'¬d¸ß',
'Current Query' =>'¥Ø«e¬d¸ß±ø¥ó',
'Sorted By' =>'±Æ§Ç¨Ì¾Ú',
'ascending' =>'¤É¾­±Æ§Ç',
'descending' =>'­°¾­±Æ§Ç',
'hidden' =>'ÁôÂÃ',
'of' =>'Á`¦@­¶¼Æ',
'record added' =>'µ§¸ê®Æ³Q·s¼W',
'record changed' =>'µ§¸ê®Æ³Q§ó·s',
'record deleted' =>'µ§¸ê®Æ³Q§R°£',
'Please enter' =>'½Ð¿é¤J',
'months' => Array(
'01'=>'¤@¤ë',
'02'=>'¤G¤ë',
'03'=>'¤T¤ë',
'04'=>'¥|¤ë',
'05'=>'¤­¤ë',
'06'=>'¤»¤ë',
'07'=>'¤C¤ë',
'08'=>'¤K¤ë',
'09'=>'¤E¤ë',
'10'=>'¤Q¤ë',
'11'=>'¤Q¤@¤ë',
'12'=>'¤Q¤G¤ë'),
// phpMyEdit-report
'Make report' => '²£¥Í³øªí',
'Select fields' => '¿ï¨úÄæ¦ì',
'Records per screen' => '¨C­¶µ§¼Æ',
);
 
?>
/trunk/jrest/util/lang/PME.lang.PT.inc
New file
0,0 → 1,67
<?php
 
/*
* phpMyEdit language file
*
* language: portuguese (standard)
* encoding: iso-8859-1
* date: 2002-02
* author: unknown
*
* last_edit: 2006-05-23 by Sérgio Sanches <ssanches@dcc.online.pt>
* last_edit_purpose: full translation and correction
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.PT.inc,v 1.6 2006-05-29 08:18:04 nepto Exp $ */
 
return Array(
'Add' =>'Adicionar',
'Copy' =>'Copiar',
'Change' =>'Mudar',
'Delete' =>'Apagar',
'View' =>'Ver',
'Prev' =>'Anterior',
'Next' =>'Seguinte',
'First' =>'Primeiro',
'Last' =>'Último',
'Go to' =>'Ir para',
'Page' =>'Página',
'Records' =>'Registos',
'Save' =>'Guardar',
'More' =>'Mais',
'Apply' =>'Aplicar',
'Cancel' =>'Cancelar',
'Search' =>'Procurar',
'Hide' =>'Esconder',
'Clear' =>'Limpar',
'Query' =>'Pesquisa',
'Current Query' =>'Pesquisa Actual',
'Sorted By' =>'Ordenado Por',
'ascending' =>'ascendente',
'descending' =>'descendente',
'hidden' =>'escondido',
'of' =>'de',
'record added' =>'registo adicionado',
'record changed' =>'registo alterado',
'record deleted' =>'registo apagado',
'Please enter' =>'Por favor introduza ',
'months' => Array(
'01'=>'Janeiro',
'02'=>'Fevereiro',
'03'=>'Março',
'04'=>'Abril',
'05'=>'Maio',
'06'=>'Junho',
'07'=>'Julho',
'08'=>'Agosto',
'09'=>'Setembro',
'10'=>'Outubro',
'11'=>'Novembro',
'12'=>'Dezembro'),
// phpMyEdit-report
'Make report' => 'Criar relatório',
'Select fields' => 'Escolher campos',
'Records per screen' => 'Registos por ecran',
);
 
?>
/trunk/jrest/util/lang/PME.lang.CA.inc
New file
0,0 → 1,64
<?php
 
/*
* phpMyEdit language file
*
* language: català
* encoding: iso-8859-1
* date: 2006-04-06
* author: Josep Maria Faura <j.m.faura@telefonica.net>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.CA.inc,v 1.2 2006-04-11 10:30:46 nepto Exp $ */
 
return Array(
'Add' =>'Afegir',
'Copy' =>'Copiar',
'Change' =>'Modificar',
'Delete' =>'Suprimir',
'View' =>'Visualitzar',
'Prev' =>'Anterior',
'Next' =>'Següent',
'First' =>'Primer',
'Last' =>'Últim',
'Go to' =>'Ves a',
'Page' =>'Pàgina',
'Records' =>'Registres',
'Save' =>'Salvar',
'More' =>'Més',
'Apply' =>'Aplicar',
'Cancel' =>'Cancel·lar',
'Search' =>'Cercar',
'Hide' =>'Amagar',
'Clear' =>'Netejar',
'Query' =>'Consultar',
'Current Query' =>'Consulta actual',
'Sorted By' =>'Ordenat per',
'ascending' =>'ascendent',
'descending' =>'descendent',
'hidden' =>'amagat',
'of' =>'de',
'record added' =>'Registre afegit',
'record changed'=>'Registre modificat',
'record deleted'=>'Registre esborrat',
'Please enter' =>'Sisplau introdueixi ',
'months' => Array(
'01'=>'Gener',
'02'=>'Febrer',
'03'=>'Març',
'04'=>'Abril',
'05'=>'Maig',
'06'=>'Juny',
'07'=>'Juliol',
'08'=>'Agost',
'09'=>'Septembre',
'10'=>'Octubre',
'11'=>'Novembre',
'12'=>'Desembre'),
// phpMyEdit-report
'Make report' => 'Construir informe',
'Select fields' => 'Seleccionar camps',
'Records per screen' => 'Registres per pantalla',
);
 
?>
/trunk/jrest/util/lang/PME.lang.PT-BR.inc
New file
0,0 → 1,64
<?php
 
/*
* phpMyEdit language file
*
* language: portuguese (brazilian)
* encoding: iso-8859-1
* date: 2002-12-23, 2003-01-14, 2003-05-17, 2004-01-21
* author: Roberto Cohen <roberto.cohen@fireman.com.br>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.PT-BR.inc,v 1.8 2004-12-27 20:14:29 nepto Exp $ */
 
return Array(
'Add' =>'Adiciona',
'Copy' =>'Copia',
'Change' =>'Edita',
'Delete' =>'Remove',
'View' =>'Visualiza',
'Prev' =>'Anterior',
'Next' =>'Próximo',
'First' =>'Primeiro',
'Last' =>'Último',
'Go to' =>'Vai para',
'Page' =>'Página',
'Records' =>'Registros',
'Save' =>'Salva',
'More' =>'Mais',
'Apply' =>'Aplica',
'Cancel' =>'Cancela',
'Search' =>'Pesquisa',
'Hide' =>'Esconde',
'Clear' =>'Limpa',
'Query' =>'Resultado',
'Current Query' =>'Resultado atual',
'Sorted By' =>'Ordernado por',
'ascending' =>'crescente',
'descending' =>'descendente',
'hidden' =>'escondido',
'of' =>'de',
'record added' =>'registro adicionado',
'record changed'=>'registro editado',
'record deleted'=>'registro removido',
'Please enter' =>'Por favor, entre',
'months' => Array(
'01'=>'Janeiro',
'02'=>'Fevereiro',
'03'=>'Março',
'04'=>'Abril',
'05'=>'Maio',
'06'=>'Junho',
'07'=>'Julho',
'08'=>'Agosto',
'09'=>'Setembro',
'10'=>'Outubro',
'11'=>'Novembro',
'12'=>'Dezembro'),
// phpMyEdit-report
'Gerar relatório' => 'Make report',
'Selecionar campos' => 'Select fields',
'Registros por tela' => 'Records per screen',
);
 
?>
/trunk/jrest/util/lang/PME.lang.TR.inc
New file
0,0 → 1,66
<?php
 
/*
* phpMyEdit language file
*
* language: turkish
* encoding: iso-8859-9
* date: 2003-10-24, 2005-11-13
* authors:
* Nuri Akman <nuri.akman@hazine.gov.tr>
* Kadan Kongar <kagan.kongar@tsrsb.org.tr>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.TR.inc,v 1.4 2005-11-14 03:15:04 nepto Exp $ */
 
return Array(
'Add' =>'Ekle',
'Copy' =>'Kopyala',
'Change' =>'Deðiþtir',
'Delete' =>'Sil',
'View' =>'Bak',
'Prev' =>'Önceki',
'Next' =>'Sonraki',
'First' =>'Ýlk',
'Last' =>'Son',
'Go to' =>'Git',
'Page' =>'Sayfa',
'Records' =>'Kayýt',
'Save' =>'Kaydet',
'More' =>'Devamý',
'Apply' =>'Uygula',
'Cancel' =>'Ýptal',
'Search' =>'Ara',
'Hide' =>'Gizle',
'Clear' =>'Temizle',
'Query' =>'Sorgu',
'Current Query' =>'Aktif Sorgu',
'Sorted By' =>'Sýralama',
'ascending' =>'artan',
'descending' =>'azalan',
'hidden' =>'gizli',
'of' =>' / ',
'record added' =>'kayýt eklendi',
'record changed' =>'kayýt deðiþtirildi',
'record deleted' =>'kayýt silindi',
'Please enter' =>'Lütfen giriniz :',
'months' => Array(
'01'=>'Ocak',
'02'=>'Þubat',
'03'=>'Mart',
'04'=>'Nisan',
'05'=>'Mayýs',
'06'=>'Haziran',
'07'=>'Temmuz',
'08'=>'Auðustos',
'09'=>'Eylül',
'10'=>'Ekim',
'11'=>'Kasým',
'12'=>'Aralýk'),
// phpMyEdit-report
'Make report' => 'Rapor hazýrla',
'Select fields' => 'Alanlarý seçiniz',
'Records per screen' => 'Sayfa baþýna kayýt',
);
 
?>
/trunk/jrest/util/lang/PME.lang.RU.inc
New file
0,0 → 1,64
<?php
 
/*
* phpMyEdit language file
*
* language: russian
* encoding: windows-1251
* date: 2002-11-23
* author: Lev Zabudkin <zabudkin@mail.ru>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.RU.inc,v 1.11 2004-12-27 20:14:29 nepto Exp $ */
 
return Array(
'Add' =>'Äîáàâèòü',
'Copy' =>'Êîïèðîâàòü',
'Change' =>'Èçìåíèòü',
'Delete' =>'Óäàëèòü',
'View' =>'Ïðîñìîòð',
'Prev' =>'<<',
'Next' =>'>>',
'First' =>'I<',
'Last' =>'>I',
'Go to' =>'Ïåðåéòè',
'Page' =>'Ñòð.',
'Records' =>'Çàïèñåé',
'Save' =>'Ñîõðàíèòü',
'More' =>'Áîëüøå',
'Apply' =>'Ïðèìåíèòü',
'Cancel' =>'Îòìåíà',
'Search' =>'Ïîèñê',
'Hide' =>'Ñêðûòü',
'Clear' =>'Î÷èñòèòü',
'Query' =>'Çàïðîñ',
'Current Query' =>'Òåêóùèé çàïðîñ',
'Sorted By' =>'Îòñîðòèðîâàíî ïî',
'ascending' =>'- âîçðàñòàíèþ',
'descending' =>'- óáûâàíèþ',
'hidden' =>'ñêðûòî',
'of' =>'èç',
'record added' =>'çàïèñü äîáàâëåíà',
'record changed'=>'çàïèñü îáíîâëåíà',
'record deleted'=>'çàïèñü óäàëåíà',
'Please enter' =>'Ïîæàëóéñòà ââåäèòå',
'months' => Array(
'01'=>'ßíâàðü',
'02'=>'Ôåâðàëü',
'03'=>'Ìàðò',
'04'=>'Àïðåëü',
'05'=>'Ìàé',
'06'=>'Èþíü',
'07'=>'Èþëü',
'08'=>'Àâãóñò',
'09'=>'Ñåíòÿáðü',
'10'=>'Îêòÿáðü',
'11'=>'Íîÿáðü',
'12'=>'Äåêàáðü'),
// phpMyEdit-report
'Make report' => 'Ñîçäàòü îò÷åò',
'Select fields' => 'Âûáðàòü ïîëÿ',
'Records per screen' => 'Çàïèñåé íà ýêðàíå',
);
 
?>
/trunk/jrest/util/lang/PME.lang.EN-US.inc
New file
0,0 → 1,64
<?php
 
/*
* phpMyEdit language file
*
* language: english (United States)
* encoding: iso-8859-1
* date: 2002-02, 2003-05-01
* author: Jim Kraai <jkraai@users.sourceforge.net>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.EN-US.inc,v 1.10 2004-12-27 20:14:29 nepto Exp $ */
 
return Array(
'Add' =>'Add',
'Copy' =>'Copy',
'Change' =>'Change',
'Delete' =>'Delete',
'View' =>'View',
'Prev' =>'Prev',
'Next' =>'Next',
'First' =>'First',
'Last' =>'Last',
'Go to' =>'Go to',
'Page' =>'Page',
'Records' =>'Records',
'Save' =>'Save',
'More' =>'More',
'Apply' =>'Apply',
'Cancel' =>'Cancel',
'Search' =>'Search',
'Hide' =>'Hide',
'Clear' =>'Clear',
'Query' =>'Query',
'Current Query' =>'Current Query',
'Sorted By' =>'Sorted By',
'ascending' =>'ascending',
'descending' =>'descending',
'hidden' =>'hidden',
'of' =>'of',
'record added' =>'record added',
'record changed' =>'record changed',
'record deleted' =>'record deleted',
'Please enter' =>'Please enter',
'months' => Array(
'01'=>'January',
'02'=>'February',
'03'=>'March',
'04'=>'April',
'05'=>'May',
'06'=>'June',
'07'=>'July',
'08'=>'August',
'09'=>'September',
'10'=>'October',
'11'=>'November',
'12'=>'December'),
// phpMyEdit-report
'Make report' => 'Make report',
'Select fields' => 'Select fields',
'Records per screen' => 'Records per screen',
);
 
?>
/trunk/jrest/util/lang/PME.lang.ZH-SG.inc
New file
0,0 → 1,64
<?php
 
/*
* phpMyEdit language file
*
* language: chinese (Singapore)
* encoding: utf-8
* date: 2003-07-03
* author: Juraj Benadik <gastan at gastan.sk>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.ZH-SG.inc,v 1.4 2004-12-27 20:14:29 nepto Exp $ */
 
return Array(
'Add' =>'添加',
'Copy' =>'复制',
'Change' =>'更改',
'Delete' =>'删除',
'View' =>'查看',
'Prev' =>'上页',
'Next' =>'下页',
'First' =>'First', // untranslated
'Last' =>'Last', // untranslated
'Go to' =>'Go to', // untranslated
'Page' =>'页',
'Records' =>'记录',
'Save' =>'保存',
'More' =>'更多',
'Apply' =>'应用',
'Cancel' =>'取消',
'Search' =>'搜寻',
'Hide' =>'隐藏',
'Clear' =>'清除',
'Query' =>'查询',
'Current Query' =>'当前 查询',
'Sorted By' =>'排序方式',
'ascending' =>'上升',
'descending' =>'递减',
'hidden' =>'隐藏的',
'of' =>'总',
'record added' =>'记录添加',
'record changed' =>'记录更改',
'record deleted' =>'记录删除',
'Please enter' =>'请进入',
'months' => Array(
'01'=>'一月',
'02'=>'二月',
'03'=>'三月',
'04'=>'四月',
'05'=>'五月',
'06'=>'六月',
'07'=>'七月',
'08'=>'八月',
'09'=>'九月',
'10'=>'十月',
'11'=>'十一月',
'12'=>'十二月'),
// phpMyEdit-report
'Make report' => 'Make report',
'Select fields' => 'Select fields',
'Records per screen' => 'Records per screen',
);
 
?>
/trunk/jrest/util/lang/PME.lang.DE.inc
New file
0,0 → 1,67
<?php
 
/*
* phpMyEdit language file
*
* language: german (standard)
* encoding: iso-8859-1
* date: 2002-07
* authors:
* Christof Brandstetter <fellz@users.sourceforge.net>
* Gerd Xhonneux, http://xsite.xhonneux.com
* info: http://makeashorterlink.com/?O116223C2
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.DE.inc,v 1.14 2004-12-27 20:14:29 nepto Exp $ */
 
return Array(
'Add' =>'Hinzufügen',
'Copy' =>'Kopieren',
'Change' =>'Ändern',
'Delete' =>'Löschen',
'View' =>'Anzeigen',
'Prev' =>'Zurück',
'Next' =>'Weiter',
'First' =>'First', // untranslated
'Last' =>'Last', // untranslated
'Go to' =>'Go to', // untranslated
'Page' =>'Seite',
'Records' =>'Datensätze',
'Save' =>'Speichern',
'More' =>'Speichern, weiteren Datensatz hinzufügen',
'Apply' =>'Anwenden',
'Cancel' =>'Abbrechen',
'Search' =>'Suche',
'Hide' =>'Verstecken',
'Clear' =>'Löschen',
'Query' =>'Abfrage',
'Current Query' =>'Aktuelle Abfrage',
'Sorted By' =>'Sortiert nach',
'ascending' =>'aufsteigend',
'descending' =>'absteigend',
'hidden' =>'versteckt',
'of' =>'von',
'record added' =>'Datensatz hinzugefügt',
'record changed'=>'Datensatz geändert',
'record deleted'=>'Datensatz gelöscht',
'Please enter' =>'Bitte füllen sie dieses Feld aus:',
'months' => Array(
'01'=>'Januar',
'02'=>'Februar',
'03'=>'März',
'04'=>'April',
'05'=>'Mai',
'06'=>'Juni',
'07'=>'Juli',
'08'=>'August',
'09'=>'September',
'10'=>'Oktober',
'11'=>'November',
'12'=>'Dezember'),
// phpMyEdit-report
'Make report' => 'Make report',
'Select fields' => 'Select fields',
'Records per screen' => 'Records per screen',
);
 
?>
/trunk/jrest/util/lang/PME.lang.ES-MX.inc
New file
0,0 → 1,64
<?php
 
/*
* phpMyEdit language file
*
* language: spanish (mexican)
* encoding: iso-8859-1
* date: 2003-04-30
* author: unknown
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.ES-MX.inc,v 1.3 2004-12-27 20:14:29 nepto Exp $ */
 
return Array(
'Add' =>'Agregar',
'Copy' =>'Copiar',
'Change' =>'Cambiar',
'Delete' =>'Suprimir',
'View' =>'Ver',
'Prev' =>'Anterior',
'Next' =>'Siguiente',
'First' =>'First', // untranslated
'Last' =>'Last', // untranslated
'Go to' =>'Go to', // untranslated
'Page' =>'Página',
'Records' =>'Registros',
'Save' =>'Guardar',
'More' =>'Más',
'Apply' =>'Aplicar',
'Cancel' =>'Cancelar',
'Search' =>'Buscar',
'Hide' =>'Ocultar',
'Clear' =>'Limpiar',
'Query' =>'Consulta SQL',
'Current Query' =>'Consulta actual',
'Sorted By' =>'Ordenado por',
'ascending' =>'ascendente',
'descending' =>'descendente',
'hidden' =>'oculto',
'of' =>'de',
'record added' =>'registro agregado',
'record changed'=>'registro cambiado',
'record deleted'=>'registro borrado',
'Please enter' =>'Por favor introduzca ',
'months' => Array(
'01'=>'Enero',
'02'=>'Febrero',
'03'=>'Marzoa',
'04'=>'Abril',
'05'=>'Mayo',
'06'=>'Junio',
'07'=>'Julio',
'08'=>'Agosto',
'09'=>'Septiembre',
'10'=>'Octubre',
'11'=>'Noviembre',
'12'=>'Diciembre'),
// phpMyEdit-report
'Make report' => 'Make report',
'Select fields' => 'Select fields',
'Records per screen' => 'Records per screen',
);
 
?>
/trunk/jrest/util/lang/PME.lang.DK.inc
New file
0,0 → 1,64
<?php
 
/*
* phpMyEdit language file
*
* language: danish
* encoding: iso-8859-1
* date: 2003-03-19
* author: Henrik Nielsen <kontakt@innovapage.dk>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.DK.inc,v 1.5 2004-12-27 20:14:29 nepto Exp $ */
 
return Array(
'Add' =>'Tilføj',
'Copy' =>'Kopier',
'Change' =>'Ret',
'Delete' =>'Slet',
'View' =>'Se',
'Prev' =>'Tilbage',
'Next' =>'Næste',
'First' =>'First', // untranslated
'Last' =>'Last', // untranslated
'Go to' =>'Go to', // untranslated
'Page' =>'Side',
'Records' =>'Rækker',
'Save' =>'Gem',
'More' =>'Mere',
'Apply' =>'Tilføj',
'Cancel' =>'Fortryd',
'Search' =>'Søg',
'Hide' =>'Skjul',
'Clear' =>'Tøm',
'Query' =>'Søg',
'Current Query' =>'Current Query', // untranslated
'Sorted By' =>'Sorted By', // untranslated
'ascending' =>'ascending', // untranslated
'descending' =>'descending', // untranslated
'hidden' =>'hidden', // untranslated
'of' =>'af',
'record added' =>'række tilføjet',
'record changed' =>'række ændret',
'record deleted' =>'række slettet',
'Please enter' =>'Indtast venligst',
'months' => Array(
'01'=>'Januar',
'02'=>'Februar',
'03'=>'Marts',
'04'=>'April',
'05'=>'Maj',
'06'=>'Juni',
'07'=>'Juli',
'08'=>'August',
'09'=>'September',
'10'=>'Oktober',
'11'=>'November',
'12'=>'December'),
// phpMyEdit-report
'Make report' => 'Make report',
'Select fields' => 'Select fields',
'Records per screen' => 'Records per screen',
);
?>
/trunk/jrest/util/lang/PME.lang.EL.inc
New file
0,0 → 1,64
<?php
 
/*
* phpMyEdit language file
*
* language: greek
* encoding: iso-8859-7
* date: 2005-08-03
* author: Alexandros Vellis <avel@users.sourceforge.net>
*/
 
/* $Id$ */
 
return Array(
'Add' =>'Ðñüóèåóç',
'Copy' =>'ÁíôéãñáöÞ',
'Change' =>'ÁëëáãÞ',
'Delete' =>'ÄéáãñáöÞ',
'View' =>'ÅìöÜíéóç',
'Prev' =>'Ðñïçãïýìåíï',
'Next' =>'Åðüìåíï',
'First' =>'Ðñþôï',
'Last' =>'Ôåëåõôáßï',
'Go to' =>'ÐÞãáéíå óå',
'Page' =>'Óåëßäá',
'Records' =>'ÅããñáöÝò',
'Save' =>'ÁðïèÞêåõóç',
'More' =>'Ðåñéóóüôåñá',
'Apply' =>'ÕðïâïëÞ',
'Cancel' =>'Áêýñùóç',
'Search' =>'ÁíáæÞôçóç',
'Hide' =>'Êñýøå',
'Clear' =>'ÊáèÜñéóå',
'Query' =>'Åðåñþôçìá',
'Current Query' =>'ÔñÝ÷ïí Åðåñþôçìá',
'Sorted By' =>'Ôáîéíüìçóç Ìå',
'ascending' =>'áýîïõóá',
'descending' =>'öèßíïõóá',
'hidden' =>'êñõììÝíï',
'of' =>'áðü',
'record added' =>'ç åããñáöÞ ðñïóôÝèçêå',
'record changed' =>'ç åããñáöÞ Üëëáîå',
'record deleted' =>'ç åããñáöÞ äéáãñÜöçêå',
'Please enter' =>'Ðáñáêáëþ åéóÜãåôå',
'months' => Array(
'01'=>'ÉáíïõÜñéïò',
'02'=>'ÖåâñïõÜñéïò',
'03'=>'ÌÜñôéïò',
'04'=>'Áðñßëéïò',
'05'=>'ÌÜéïò',
'06'=>'Éïýíéïò',
'07'=>'Éïýëéïò',
'08'=>'Áýãïõóôïò',
'09'=>'ÓåðôÝìâñéïò',
'10'=>'Ïêôþâñéïò',
'11'=>'ÍïÝìâñéïò',
'12'=>'ÄåêÝìâñéïò'),
// phpMyEdit-report
'Make report' => 'Äçìéïõñãßá áíáöïñÜò',
'Select fields' => 'ÅðéëïãÞ ðåäßùí',
'Records per screen' => 'ÅããñáöÝò áíÜ ïèüíç',
);
 
?>
/trunk/jrest/util/lang/PME.lang.EN.inc
New file
0,0 → 1,64
<?php
 
/*
* phpMyEdit language file
*
* language: english
* encoding: iso-8859-1
* date: 2000, 2001, 2003-05-01
* author: John McCreesh <jpmcc@users.sourceforge.net>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.EN.inc,v 1.11 2004-12-27 20:14:29 nepto Exp $ */
 
return Array(
'Add' =>'Add',
'Copy' =>'Copy',
'Change' =>'Change',
'Delete' =>'Delete',
'View' =>'View',
'Prev' =>'Prev',
'Next' =>'Next',
'First' =>'First',
'Last' =>'Last',
'Go to' =>'Go to',
'Page' =>'Page',
'Records' =>'Records',
'Save' =>'Save',
'More' =>'More',
'Apply' =>'Apply',
'Cancel' =>'Cancel',
'Search' =>'Search',
'Hide' =>'Hide',
'Clear' =>'Clear',
'Query' =>'Query',
'Current Query' =>'Current Query',
'Sorted By' =>'Sorted By',
'ascending' =>'ascending',
'descending' =>'descending',
'hidden' =>'hidden',
'of' =>'of',
'record added' =>'record added',
'record changed' =>'record changed',
'record deleted' =>'record deleted',
'Please enter' =>'Please enter',
'months' => Array(
'01'=>'January',
'02'=>'February',
'03'=>'March',
'04'=>'April',
'05'=>'May',
'06'=>'June',
'07'=>'July',
'08'=>'August',
'09'=>'September',
'10'=>'October',
'11'=>'November',
'12'=>'December'),
// phpMyEdit-report
'Make report' => 'Make report',
'Select fields' => 'Select fields',
'Records per screen' => 'Records per screen',
);
 
?>
/trunk/jrest/util/lang/PME.lang.FR.inc
New file
0,0 → 1,67
<?php
 
/*
* phpMyEdit language file
*
* language: french (standard)
* encoding: iso-8859-1
* date: 2002-02, 2002-11-07, 2002-12-29
* authors:
* Dario <dartar@users.sourceforge.net>
* Kaid <kaid@fr.st>
* hbernard <hbernard@gynov.org>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.FR.inc,v 1.15 2004-12-27 20:14:29 nepto Exp $ */
 
return Array(
'Add' =>'Ajouter',
'Copy' =>'Copier',
'Change' =>'Modifier',
'Delete' =>'Supprimer',
'View' =>'Afficher',
'Prev' =>'Précédent',
'Next' =>'Suivant',
'First' =>'Début',
'Last' =>'Fin',
'Go to' =>'Aller à ',
'Page' =>'Page',
'Records' =>'Enregistrements',
'Save' =>'Enregistrer',
'More' =>'Enregistrer et continuer',
'Apply' =>'Appliquer',
'Cancel' =>'Annuler',
'Search' =>'Rechercher',
'Hide' =>'Cacher',
'Clear' =>'Vider',
'Query' =>'Requête',
'Current Query' =>'Requête courante',
'Sorted By' =>'Tri',
'ascending' =>'croissant',
'descending' =>'décroissant',
'hidden' =>'caché',
'of' =>'/', // untranslated
'record added' =>'Enregistrement ajouté',
'record changed'=>'Enregistrement modifié',
'record deleted'=>'Enregistrement supprimé',
'Please enter' =>'Entrez s\'il vous plaît',
'months' => Array(
'01'=>'Janvier',
'02'=>'Février',
'03'=>'Mars',
'04'=>'Avril',
'05'=>'Mai',
'06'=>'Juin',
'07'=>'Juillet',
'08'=>'Août',
'09'=>'Septembre',
'10'=>'Octobre',
'11'=>'Novembre',
'12'=>'Décembre'),
// phpMyEdit-report
'Make report' => 'Make report',
'Select fields' => 'Select fields',
'Records per screen' => 'Records per screen',
);
 
?>
/trunk/jrest/util/lang/PME.lang.ES.inc
New file
0,0 → 1,66
<?php
 
/*
* phpMyEdit language file
*
* language: spanish
* encoding: iso-8859-1
* date: 2003-02, 2003-04-22, 2004-04-04
* authors:
* Jorge Nadal <jornamon@ya.com>
* Eduardo Diaz <ediaz@pk25.com>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.ES.inc,v 1.6 2004-12-27 20:14:29 nepto Exp $ */
 
return Array(
'Add' =>'Agregar',
'Copy' =>'Copiar',
'Change' =>'Cambiar',
'Delete' =>'Suprimir',
'View' =>'Visualizar',
'Prev' =>'Anterior',
'Next' =>'Siguiente',
'First' =>'Primero',
'Last' =>'Último',
'Go to' =>'Ir a',
'Page' =>'Página',
'Records' =>'Registros',
'Save' =>'Grabar',
'More' =>'Más',
'Apply' =>'Aplicar',
'Cancel' =>'Cancelar',
'Search' =>'Buscar',
'Hide' =>'Ocultar',
'Clear' =>'Limpiar',
'Query' =>'Consultar',
'Current Query' =>'Consulta actual',
'Sorted By' =>'Ordenado por',
'ascending' =>'ascendente',
'descending' =>'descendente',
'hidden' =>'oculto',
'of' =>'de',
'record added' =>'Registro añadido',
'record changed'=>'Registro cambiado',
'record deleted'=>'Registro borrado',
'Please enter' =>'Por favor introduzca ',
'months' => Array(
'01'=>'Enero',
'02'=>'Febrero',
'03'=>'Marzo',
'04'=>'Abril',
'05'=>'Mayo',
'06'=>'Junio',
'07'=>'Julio',
'08'=>'Agosto',
'09'=>'Septiembre',
'10'=>'Octubre',
'11'=>'Noviembre',
'12'=>'Diciembre'),
// phpMyEdit-report
'Make report' => 'Realizar Informe',
'Select fields' => 'Seleccionar campos',
'Records per screen' => 'Registros por pantalla',
);
 
?>
/trunk/jrest/util/lang/PME.lang.ES-AR.inc
New file
0,0 → 1,59
<?php
 
/*
* phpMyEdit language file
*
* language: spanish (argentinian)
* encoding: iso-8859-1
* date: 2003-02-28, 2004-02-15
* author: Mariano Vassallo <mvassallo@ciudad.com.ar>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.ES-AR.inc,v 1.5 2004-12-27 20:14:29 nepto Exp $ */
 
return Array(
'Add' =>'Agregar',
'Copy' =>'Copiar',
'Change' =>'Cambiar',
'Delete' =>'Suprimir',
'View' =>'Visualización',
'Prev' =>'Anterior',
'Next' =>'Siguiente',
'First' =>'Primero',
'Last' =>'Ultimo',
'Go to' =>'Ir a',
'Page' =>'Paginación',
'Records' =>'Registros',
'Save' =>'Grabar',
'More' =>'Más',
'Apply' =>'Aplicar',
'Cancel' =>'Cancelar',
'Search' =>'Buscar',
'Hide' =>'Ocultar',
'Clear' =>'Limpiar',
'Query' =>'Consulta',
'of' =>'/', // intentionaly untranslated. Alternatve: "de"
'record added' =>'registro añadido',
'record changed'=>'registro cambiado',
'record deleted'=>'registro borrado',
'Please enter' =>'Por favor introduzca ',
'months' => Array(
'01'=>'Enero',
'02'=>'Febrero',
'03'=>'Marzo',
'04'=>'Abril',
'05'=>'Mayo',
'06'=>'Junio',
'07'=>'Julio',
'08'=>'Agosto',
'09'=>'Septiembre',
'10'=>'Octubre',
'11'=>'Noviembre',
'12'=>'Diciembre'),
// phpMyEdit-report
'Make report' => 'Hacer reporte',
'Select fields' => 'Seleccionar campos',
'Records per screen' => 'Registros por pantalla',
);
 
?>
/trunk/jrest/util/lang/PME.lang.SE.inc
New file
0,0 → 1,73
<?php
 
/*
* phpMyEdit language file
*
* language: swedish
* encoding: iso-8859-1
* date: 2004-01-21, 2004-02-07
* authors:
* Björn Hammarbäck <bjorn@hammarback.se>
* Stefan Lindmark <stefan@lindmark.net>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.SE.inc,v 1.4 2004-12-27 20:14:29 nepto Exp $ */
 
/*
* å = &aring;
* ä = &auml;
* ö = &ouml;
* Ä = &Auml;
*/
 
return Array(
'Add' =>'Lägg till',
'Copy' =>'Kopiera',
'Change' =>'Ändra',
'Delete' =>'Ta bort',
'View' =>'Visa detaljer',
'Prev' =>'Föregående',
'Next' =>'Nästa',
'First' =>'Första',
'Last' =>'Sista',
'Go to' =>'Gå till sida',
'Page' =>'Sida',
'Records' =>'Poster',
'Save' =>'Spara',
'More' =>'Mer',
'Apply' =>'Verkställ',
'Cancel' =>'Avbryt',
'Search' =>'Sök',
'Hide' =>'Dölj',
'Clear' =>'Rensa',
'Query' =>'Sök',
'Current Query' =>'Nuvarande fråga',
'Sorted By' =>'Sorterad efter',
'ascending' =>'stigande',
'descending' =>'fallande',
'hidden' =>'gömd',
'of' =>'av',
'record added' =>'post adderad',
'record changed' =>'post ändrad',
'record deleted' =>'post borttagen',
'Please enter' =>'Fyll i fältet',
'months' => Array(
'01'=>'Januari',
'02'=>'Februari',
'03'=>'Mars',
'04'=>'April',
'05'=>'Maj',
'06'=>'Juni',
'07'=>'Juli',
'08'=>'Augusti',
'09'=>'September',
'10'=>'Oktober',
'11'=>'November',
'12'=>'December'),
// phpMyEdit-report
'Make report' => 'Skapa rapport',
'Select fields' => 'Välj fält',
'Records per screen' => 'Poster per skärm',
);
?>
/trunk/jrest/util/lang/PME.lang.ET.inc
New file
0,0 → 1,64
<?php
 
/*
* phpMyEdit language file
*
* language: estonian
* encoding: any latin
* date: 2005-09-13
* author: Alexia Death <alexiadeath@hotmail.com>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.ET.inc,v 1.1 2005-09-14 13:40:19 nepto Exp $ */
 
return Array(
'Add' =>'Lisa',
'Copy' =>'Kopeeri',
'Change' =>'Muuda',
'Delete' =>'Kustuta',
'View' =>'Vaata',
'Prev' =>'Eelmine',
'Next' =>htmlentities('Järgmine'),
'First' =>'Esimene',
'Last' =>'Viimane',
'Go to' =>'Positsioon',
'Page' =>'Leht',
'Records' =>'Kirjed',
'Save' =>'Salvesta',
'More' =>htmlentities('Järgneb...'),
'Apply' =>'Rakenda muutused',
'Cancel' =>htmlentities('Tühista'),
'Search' =>'Otsi',
'Hide' =>'Peida',
'Clear' =>htmlentities('Tühjenda väljad'),
'Query' =>htmlentities('Päring'),
'Current Query' =>htmlentities('Hetke päring'),
'Sorted By' =>htmlentities('Sorteermisjärjekord'),
'ascending' =>'kahanevalt',
'descending' =>'kasvavalt',
'hidden' =>'peidetud',
'of' =>'/',
'record added' =>'kirje lisatud',
'record changed' =>'kirje muudetud',
'record deleted' =>'kirje kustutatud',
'Please enter' =>'Palun sisesta',
'months' => Array(
'01'=>'Jaanuar',
'02'=>'Veebruar',
'03'=>htmlentities('Märts'),
'04'=>'Aprill',
'05'=>'Mai',
'06'=>'Juuni',
'07'=>'Juuli',
'08'=>'August',
'09'=>'September',
'10'=>'Oktoober',
'11'=>'November',
'12'=>'Detsember'),
// phpMyEdit-report
'Make report' => 'Koosta raport',
'Select fields' => htmlentities('Vali väljad'),
'Records per screen' => 'Kirjeid lehe kohta',
);
 
?>
/trunk/jrest/util/lang/PME.lang.NL.inc
New file
0,0 → 1,68
<?php
 
/*
* phpMyEdit language file
*
* language: dutch (standard)
* encoding: iso-8859-1
* date: 2002-09-21, 2002-12-17, 2006-01-05
* authors:
* Paul Barends <pbarends@xs4all.nl>
* Erwin Janszen <Erwin.Janszen@mail.ing.nl>
* URL:
* http://platon.sk/projects/bug_view_advanced_page.php?f_bug_id=197
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.NL.inc,v 1.16 2006-01-05 04:45:22 nepto Exp $ */
 
return Array(
'Add' =>'Toevoegen',
'Copy' =>'Kopiëren',
'Change' =>'Bewerken',
'Delete' =>'Wissen',
'View' =>'Details',
'Prev' =>'Vorige',
'Next' =>'Volgende',
'First' =>'Eerste',
'Last' =>'Laatste',
'Go to' =>'Ga naar',
'Page' =>'Pagina',
'Records' =>'Rijen',
'Save' =>'Bewaren',
'More' =>'Meer',
'Apply' =>'Toepassen',
'Cancel' =>'Annuleren',
'Search' =>'Zoeken',
'Hide' =>'Verbergen',
'Clear' =>'Schonen', // 'Leeg maken',
'Query' =>'Selecteer', // 'Selectie maken',
'Current Query' =>'Huidige selectie',
'Sorted By' =>'Gesorteerd op',
'ascending' =>'oplopend',
'descending' =>'aflopend',
'hidden' =>'verborgen',
'of' =>'van',
'record added' =>'rij toegevoegd',
'record changed' =>'rij aangepast',
'record deleted' =>'rij gewist',
'Please enter' =>'Voer a.u.b. in:',
'months' => Array(
'01'=>'januari',
'02'=>'februari',
'03'=>'maart',
'04'=>'april',
'05'=>'mei',
'06'=>'juni',
'07'=>'juli',
'08'=>'augustus',
'09'=>'september',
'10'=>'october',
'11'=>'november',
'12'=>'december'),
// phpMyEdit-report
'Make report' => 'Maak rapport',
'Select fields' => 'Selecteer velden',
'Records per screen' => 'Rij per scherm',
);
 
?>
/trunk/jrest/util/lang/PME.lang.EU.inc
New file
0,0 → 1,64
<?php
 
/*
* phpMyEdit language file
*
* language: basque
* encoding: iso-8859-1
* date: 2004-05-11
* author: Ibon Igartua <ibon@zuhar.net>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.EU.inc,v 1.1 2004-05-17 10:53:06 nepto Exp $ */
 
return Array(
'Add' =>'Gehitu',
'Copy' =>'Kopiatu',
'Change' =>'Aldatu',
'Delete' =>'Ezabatu',
'View' =>'Ikusi',
'Prev' =>'Aurrekoa',
'Next' =>'Hurrengoa',
'First' =>'Lehena',
'Last' =>'Azkena',
'Go to' =>'Joan',
'Page' =>'Orrialdea',
'Records' =>'Erregistroak',
'Save' =>'Gorde',
'More' =>'Gehiago',
'Apply' =>'Aplikatu',
'Cancel' =>'Utzi',
'Search' =>'Bilatu',
'Hide' =>'Ezkutatu',
'Clear' =>'Garbitu',
'Query' =>'Kontsulta',
'Current Query' =>'Uneko Kontsulta',
'Sorted By' =>'Orden Irizpidea',
'ascending' =>'gorantz',
'descending' =>'beherantz',
'hidden' =>'ezkutukoa',
'of' =>'-',
'record added' =>'erregistroa gehituta',
'record changed'=>'erregistroa aldatuta',
'record deleted'=>'erregistroa ezabatuta',
'Please enter' =>'Mesedez, sartu ezazu ',
'months' => Array(
'01'=>'urtarrila',
'02'=>'otsaila',
'03'=>'martxoa',
'04'=>'apirila',
'05'=>'maiatza',
'06'=>'ekaina',
'07'=>'uztaila',
'08'=>'abuztua',
'09'=>'iraila',
'10'=>'urria',
'11'=>'azaroa',
'12'=>'abendua'),
// phpMyEdit-report
'Make report' => 'Txostena sortu',
'Select fields' => 'Eremuak aukertau',
'Records per screen' => 'Erregistroak orrialdeko',
);
 
?>
/trunk/jrest/util/lang/PME.lang.PL.inc
New file
0,0 → 1,60
<?php
 
/*
* phpMyEdit language file
*
* language: polish
* encoding: iso-8859-2
* date: 2002-10-01, 2003-06-30
* author: Piotr Walesiuk <p.walesiuk@bos.com.pl>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.PL.inc,v 1.9 2004-12-27 20:14:29 nepto Exp $ */
 
return Array(
'Add' =>'Dodaj',
'Copy' =>'Kopiuj',
'Change' =>'Zmieñ',
'Delete' =>'Usuñ',
'View' =>'Poka¿',
'Prev' =>'Wstecz',
'Next' =>'Dalej',
'First' =>'First', // untranslated
'Last' =>'Last', // untranslated
'Go to' =>'Go to', // untranslated
'Page' =>'Strona',
'Records' =>'Rekordy',
'Save' =>'Zapisz',
'More' =>'Wiêcej',
'Apply' =>'Zastosuj',
'Cancel' =>'Anuluj',
'Search' =>'Szukaj',
'Hide' =>'Ukryj',
'Clear' =>'Wyczy¶æ',
'Query' =>'Zapytanie',
'Current Query' =>'Aktualne zapytanie',
'Sorted By' =>'Posortowane wed³ug',
'ascending' =>'rosn±co',
'descending' =>'malej±co',
'hidden' =>'ukryte',
'of' =>'z',
'record added' =>'rekord dodany',
'record changed'=>'rekord zmieniony',
'record deleted'=>'rekord usuniêty',
'Please enter' =>'Proszê wprowadziæ',
'months' => Array(
'01'=>'Styczeñ',
'02'=>'Luty',
'03'=>'Marzec',
'04'=>'Kwiecieñ',
'05'=>'Maj',
'06'=>'Czerwiec',
'07'=>'Lipiec',
'08'=>'Sierpieñ',
'09'=>'Wrzesieñ',
'10'=>'Pa¼dziernik',
'11'=>'Listopad',
'12'=>'Grudzieñ')
);
 
?>
/trunk/jrest/util/lang/PME.lang.CZ.inc
New file
0,0 → 1,64
<?php
 
/*
* phpMyEdit language file
*
* language: czech
* encoding: iso-8859-2
* date: 2005-04-26
* author: Jan Cinert <ion_lord@seznam.cz>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.CZ.inc,v 1.1 2005-04-26 13:15:38 nepto Exp $ */
 
return Array(
'Add' =>'Pøidat',
'Copy' =>'Kopírovat',
'Change' =>'Zmìnit',
'Delete' =>'Smazat',
'View' =>'Zobrazit',
'Prev' =>'Pøedcházející',
'Next' =>'Následující',
'First' =>'První',
'Last' =>'Poslední',
'Go to' =>'Otevøít',
'Page' =>'Stránka',
'Records' =>'Záznamù',
'Save' =>'Ulo¾it',
'More' =>'Více',
'Apply' =>'Pou¾ít',
'Cancel' =>'Zru¹it',
'Search' =>'Hledat',
'Hide' =>'Skrýt',
'Clear' =>'Smazat',
'Query' =>'Dotaz',
'Current Query' =>'Stávající dotaz',
'Sorted By' =>'Uspoøádané podle',
'ascending' =>'vzestupnì',
'descending' =>'sestupnì',
'hidden' =>'skrytý',
'of' =>'z',
'record added' =>'pøidaný záznam',
'record changed'=>'zmìnìný záznam',
'record deleted'=>'smazaný záznam',
'Please enter' =>'Zadejte prosím',
'months' => Array(
'01'=>'Leden',
'02'=>'Únor',
'03'=>'Bøezen',
'04'=>'Duben',
'05'=>'Kvìten',
'06'=>'Èerve',
'07'=>'Èervenec',
'08'=>'Srpen',
'09'=>'Záøí',
'10'=>'Øíjen',
'11'=>'Listopad',
'12'=>'Prosinec'),
// phpMyEdit-report
'Make report' => 'Vytvoøit zprávu',
'Select fields' => 'Vybrat pole',
'Records per screen' => 'Poèet záznamù na stránce',
);
 
?>
/trunk/jrest/util/lang/PME.lang.IT.inc
New file
0,0 → 1,66
<?php
 
/*
* phpMyEdit language file
*
* language: italian (standard)
* encoding: iso-8859-1
* date: 2002-02, 2002-11-07, 2003-04-13, 2004-03-31
* authors:
* Dario <dartar@users.sourceforge.net>
* Keatch <raffaele.spangaro@eurika.net>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.IT.inc,v 1.15 2004-12-27 20:14:29 nepto Exp $ */
 
return Array(
'Add' =>'Aggiungi',
'Copy' =>'Copia',
'Change' =>'Modifica',
'Delete' =>'Cancella',
'View' =>'Visualizza',
'Prev' =>'Precedente',
'Next' =>'Seguente',
'First' =>'Prima',
'Last' =>'Ultima',
'Go to' =>'Vai a',
'Page' =>'Pagina',
'Records' =>'Voci',
'Save' =>'Salva',
'More' =>'Salva & Continua',
'Apply' =>'Applica',
'Cancel' =>'Annulla',
'Search' =>'Cerca',
'Hide' =>'Nascondi',
'Clear' =>'Svuota',
'Query' =>'Chiedi',
'Current Query' =>'Richiesta Corrente',
'Sorted By' =>'Ordinato per',
'ascending' =>'crescente',
'descending' =>'decrescente',
'hidden' =>'nascosto',
'of' =>'/',
'record added' =>'voce aggiunta',
'record changed'=>'voce modificata',
'record deleted'=>'voce eliminata',
'Please enter' =>'Si prega di riempire il campo: ',
'months' => Array(
'01'=>'Gennaio',
'02'=>'Febbraio',
'03'=>'Marzo',
'04'=>'Aprile',
'05'=>'Maggio',
'06'=>'Giugno',
'07'=>'Luglio',
'08'=>'Agosto',
'09'=>'Settembre',
'10'=>'Ottobre',
'11'=>'Novembre',
'12'=>'Dicembre'),
// phpMyEdit-report
'Make report' => 'Genera report',
'Select fields' => 'Seleziona campi',
'Records per screen' => 'Record per schermata',
);
 
?>
/trunk/jrest/util/lang/PME.lang.SK.inc
New file
0,0 → 1,64
<?php
 
/*
* phpMyEdit language file
*
* language: slovak
* encoding: iso-8859-2
* date: 2002-02-02, 2003-05-01
* author: Ondrej Jombik <nepto@php.net>
*/
 
/* $Platon: phpMyEdit/lang/PME.lang.SK.inc,v 1.12 2004-12-27 20:14:29 nepto Exp $ */
 
return Array(
'Add' =>'Prida»',
'Copy' =>'Kopírova»',
'Change' =>'Zmeni»',
'Delete' =>'Zmaza»',
'View' =>'Pozrie»',
'Prev' =>'Predchádzajúci',
'Next' =>'Ïal¹í',
'First' =>'Prvý',
'Last' =>'Posledný',
'Go to' =>'Choï na',
'Page' =>'Stránka',
'Records' =>'Záznamov',
'Save' =>'Ulo¾i»',
'More' =>'Viac',
'Apply' =>'Pou¾i»',
'Cancel' =>'Storno',
'Search' =>'Hµada»',
'Hide' =>'Skry»',
'Clear' =>'Zru¹i»',
'Query' =>'Vyhµada»',
'Current Query' =>'Aktuálny dotaz',
'Sorted By' =>'Usporiadané podµa',
'ascending' =>'vzostupne',
'descending' =>'zostupne',
'hidden' =>'skryté',
'of' =>'z',
'record added' =>'záznam pridaný',
'record changed'=>'záznam zmenený',
'record deleted'=>'záznam zmazaný',
'Please enter' =>'Prosím zadajte',
'months' => Array(
'01'=>'Január',
'02'=>'Február',
'03'=>'Marec',
'04'=>'Apríl',
'05'=>'Máj',
'06'=>'Jún',
'07'=>'Júl',
'08'=>'August',
'09'=>'September',
'10'=>'Október',
'11'=>'November',
'12'=>'December'),
// phpMyEdit-report
'Make report' => 'Vytvori» report',
'Select fields' => 'Vybra» ståpce',
'Records per screen' => 'Poèet záznamov na stránke',
);
 
?>
/trunk/jrest/util/images/pme-delete.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/jrest/util/images/pme-delete.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/jrest/util/images/pme-change.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/jrest/util/images/pme-change.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/jrest/util/images/pme-copy.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/jrest/util/images/pme-copy.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/jrest/util/images/pme-view.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/jrest/util/images/pme-view.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/jrest/util/images/alt/pme-change.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/jrest/util/images/alt/pme-change.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/jrest/util/images/alt/pme-copy.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/jrest/util/images/alt/pme-copy.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/jrest/util/images/alt/pme-view.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/jrest/util/images/alt/pme-view.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/jrest/util/images/alt/pme-delete.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/jrest/util/images/alt/pme-delete.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property