- Timestamp:
- Jun 3, 2006 7:47:48 PM (18 years ago)
- Location:
- trunk/bin
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/file_importer.php
r111 r136 7 7 8 8 require realpath(dirname(__FILE__) . '/..') . '/config/cli_config.inc.php'; 9 10 $app =& App::getInstance(); 11 $db =& DB::getInstance(); 12 9 13 10 14 // Test arguments. … … 31 35 preg_match('/BALANCE:\s*\$([\.\d]+)/', $file_text, $amt); 32 36 $file_date = date('Y-m-d', strtotime(preg_replace('|[^_]*_|', '', basename($file)))); 33 // DB::query("37 // $db->query(" 34 38 // INSERT INTO invoice_tbl ( 35 39 // client_id, … … 43 47 // added_datetime 44 48 // ) VALUES ( 45 // '" . DB::escapeString(0) . "',46 // '" . DB::escapeString('hosting') . "',47 // '" . DB::escapeString($file_date) . "',48 // '" . DB::escapeString($amt[1]) . "',49 // '" . DB::escapeString('Paid') . "',50 // '" . DB::escapeString('') . "',51 // '" . DB::escapeString($file_text) . "',52 // '" . DB::escapeString($file_date) . "',49 // '" . $db->escapeString(0) . "', 50 // '" . $db->escapeString('hosting') . "', 51 // '" . $db->escapeString($file_date) . "', 52 // '" . $db->escapeString($amt[1]) . "', 53 // '" . $db->escapeString('Paid') . "', 54 // '" . $db->escapeString('') . "', 55 // '" . $db->escapeString($file_text) . "', 56 // '" . $db->escapeString($file_date) . "', 53 57 // NOW() 54 58 // ) … … 56 60 57 61 } else { 58 App::logMsg('Could not open file: ' . $file, LOG_INFO, __FILE__, __LINE__);62 $app->logMsg('Could not open file: ' . $file, LOG_INFO, __FILE__, __LINE__); 59 63 } 60 64 } 61 App::logMsg('Proccessing complete: ' . $file_count . ' files total.', LOG_INFO, __FILE__, __LINE__);65 $app->logMsg('Proccessing complete: ' . $file_count . ' files total.', LOG_INFO, __FILE__, __LINE__); 62 66 } else { 63 App::logMsg('No files available in that directory.', LOG_INFO, __FILE__, __LINE__);67 $app->logMsg('No files available in that directory.', LOG_INFO, __FILE__, __LINE__); 64 68 } 65 69 -
trunk/bin/module_maker/_config.inc.php
r19 r136 30 30 31 31 $app =& App::getInstance('module_maker'); 32 33 32 $app->setParam(array( 34 33 'site_name' => 'Module Maker', … … 43 42 'log_screen_priority' => LOG_DEBUG, 44 43 )); 45 46 44 require_once 'global/db_auth.inc.php'; 47 45 46 // Start application-based functionality: database, session, environment, ini setup, etc. 47 // Most configuration parameters must be set before starting the App. 48 48 $app->start(); 49 49 50 // Global DB object. Automatically preconfigured by $app->start(). 51 $db =& DB::getInstance(); 52 53 50 54 ?> -
trunk/bin/module_maker/form_template.cli.php
r121 r136 17 17 18 18 // Get DB tables. 19 $qid = DB::query("SHOW TABLES");19 $qid = $db->query("SHOW TABLES"); 20 20 while (list($row) = mysql_fetch_row($qid)) { 21 21 $tables[] = $row; … … 24 24 // Make sure requested table is in database. 25 25 if (!in_array($db_tbl, $tables)) { 26 die(sprintf("%s Warning: %s does not exist in database %s. Please select one of: \n\n%s\n\n", basename($_SERVER['argv'][0]), $db_tbl, App::getParam('db_name'), join("\n", $tables)));26 die(sprintf("%s Warning: %s does not exist in database %s. Please select one of: \n\n%s\n\n", basename($_SERVER['argv'][0]), $db_tbl, $app->getParam('db_name'), join("\n", $tables))); 27 27 } 28 28 29 29 // Get DB table column info. 30 $qid = DB::query("DESCRIBE " . DB::escapeString($db_tbl));30 $qid = $db->query("DESCRIBE " . $db->escapeString($db_tbl)); 31 31 while ($row = mysql_fetch_row($qid)) { 32 32 $cols[] = $row; … … 65 65 <label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label> 66 66 <select name="$field" id="$field" class="sc-small"><\x3fphp printSelectForm('<##>_tbl', "CONCAT(<##>_id, '—', <##>)", '$field', \$frm['$field'], true, 'ORDER BY $field ASC'); \x3f></select> 67 <span class="commanditem commandtext"><a href="<\x3fphp echo App::oHREF('<##>.php?op=add&boomerang=true'); \x3f>" onClick="javascript:return confirm('<\x3fphp echo _("Notice: You are about to leave this form page and any changes you may have made without saving will be lost."); \x3f>')"><\x3fphp echo _("Add <##>") \x3f></a></span>67 <span class="commanditem commandtext"><a href="<\x3fphp echo \$app->oHREF('<##>.php?op=add&boomerang=true'); \x3f>" onClick="javascript:return confirm('<\x3fphp echo _("Notice: You are about to leave this form page and any changes you may have made without saving will be lost."); \x3f>')"><\x3fphp echo _("Add <##>") \x3f></a></span> 68 68 <\x3fphp if ('' != \$frm['<##>_id']) { \x3f> 69 <span class="commanditem commandtext"><a href="<\x3fphp echo App::oHREF('<##>.php?op=edit&boomerang=true&<##>_id=' . \$frm['<##>_id']); \x3f>" onClick="javascript:return confirm('<\x3fphp echo _("Notice: You are about to leave this form page and any changes you may have made without saving will be lost."); \x3f>')"><\x3fphp echo sprintf(_("Edit <##> <em>%s</em>"), \$frm['<##>']) \x3f></a></span>69 <span class="commanditem commandtext"><a href="<\x3fphp echo \$app->oHREF('<##>.php?op=edit&boomerang=true&<##>_id=' . \$frm['<##>_id']); \x3f>" onClick="javascript:return confirm('<\x3fphp echo _("Notice: You are about to leave this form page and any changes you may have made without saving will be lost."); \x3f>')"><\x3fphp echo sprintf(_("Edit <##> <em>%s</em>"), \$frm['<##>']) \x3f></a></span> 70 70 <\x3fphp } \x3f> 71 71 E_O_F; -
trunk/bin/module_maker/list_template.cli.php
r121 r136 30 30 31 31 // Get DB tables. 32 $qid = DB::query("SHOW TABLES");32 $qid = $db->query("SHOW TABLES"); 33 33 while (list($row) = mysql_fetch_row($qid)) { 34 34 $tables[] = $row; … … 37 37 // Make sure requested table is in database. 38 38 if (!in_array($db_tbl, $tables)) { 39 die(sprintf("%s Warning: %s does not exist in database %s. Please select one of: \n\n%s\n\n", basename($_SERVER['argv'][0]), $db_tbl, App::getParam('db_name'), join("\n", $tables)));39 die(sprintf("%s Warning: %s does not exist in database %s. Please select one of: \n\n%s\n\n", basename($_SERVER['argv'][0]), $db_tbl, $app->getParam('db_name'), join("\n", $tables))); 40 40 } 41 41 42 42 // Get DB table column info. 43 $qid = DB::query("DESCRIBE " . DB::escapeString($db_tbl));43 $qid = $db->query("DESCRIBE " . $db->escapeString($db_tbl)); 44 44 while ($row = mysql_fetch_row($qid)) { 45 45 $cols[] = $row; … … 80 80 $listrows[] = "<\x3fphp echo strlen(\$list[\$i]['$field'])<50 \x3f oTxt(\$list[\$i]['$field'], true) : oTxt(trim(substr(\$list[\$i]['$field'], 0, 50)) . '...'); \x3f>"; 81 81 } else if (preg_match('/.*(begin|start).*date.*/i', $field)) { 82 $listrows[] = "<\x3fphp echo '0000-00-00' == \$list[\$i]['$field'] ? '' : date( App::getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>";82 $listrows[] = "<\x3fphp echo '0000-00-00' == \$list[\$i]['$field'] ? '' : date(\$app->getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>"; 83 83 } else if (preg_match('/.*(end|expire).*date.*/i', $field)) { 84 $listrows[] = "<\x3fphp echo '9999-12-31' == \$list[\$i]['$field'] ? '' : date( App::getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>";84 $listrows[] = "<\x3fphp echo '9999-12-31' == \$list[\$i]['$field'] ? '' : date(\$app->getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>"; 85 85 } else if (preg_match('/datetime/i', $type)) { 86 $listrows[] = "<\x3fphp echo '0000-00-00 00:00:00' == \$list[\$i]['$field'] ? '' : date( App::getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>";86 $listrows[] = "<\x3fphp echo '0000-00-00 00:00:00' == \$list[\$i]['$field'] ? '' : date(\$app->getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>"; 87 87 } else if (preg_match('/date/i', $type)) { 88 $listrows[] = "<\x3fphp echo '0000-00-00' == \$list[\$i]['$field'] ? '' : date( App::getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>";88 $listrows[] = "<\x3fphp echo '0000-00-00' == \$list[\$i]['$field'] ? '' : date(\$app->getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>"; 89 89 } else if (preg_match('/(amount|_rate)/i', $field)) { 90 90 $listrows[] = "<\x3fphp printf('$%01.2f', \$list[\$i]['$field']); \x3f>"; … … 110 110 <div id="commandbox"> 111 111 <form action="<\x3fphp echo \$_SERVER['PHP_SELF']; \x3f>" method="get"> 112 <\x3fphp App::printHiddenSession(false); \x3f>113 <span class="sc-nowrap commandtext"><a href="<\x3fphp echo App::oHREF(\$_SERVER['PHP_SELF'] . '?op=add'); \x3f>"><\x3fphp echo _("Add <##>"); \x3f></a></span>112 <\x3fphp \$app->printHiddenSession(false); \x3f> 113 <span class="sc-nowrap commandtext"><a href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . '?op=add'); \x3f>"><\x3fphp echo _("Add <##>"); \x3f></a></span> 114 114 <br /> 115 115 … … 149 149 <\x3fphp for (\$i = 0; \$i <= \$page->last_item - \$page->first_item && \$page->total_items > 0; \$i++) { \x3f> 150 150 <tr> 151 <td class="sc-nowrap"><a title="<\x3fphp printf(_("Edit %s"), oTxt(\$list[\$i]['<##>'])) \x3f>" href="<\x3fphp echo App::oHREF(\$_SERVER['PHP_SELF'] . '?op=edit&$primary_key=' . \$list[\$i]['$primary_key']); \x3f>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a> </td>152 <td class="sc-nowrap"><a title="<\x3fphp printf(_("Versions of %s"), oTxt(\$list[\$i]['<##>'])) \x3f>" href="<\x3fphp echo App::oHREF("/admin/versions.php?record_table=$db_tbl&record_key=$primary_key&boomerang=true&record_val=" . \$list[\$i]['$primary_key']); \x3f>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> </td>151 <td class="sc-nowrap"><a title="<\x3fphp printf(_("Edit %s"), oTxt(\$list[\$i]['<##>'])) \x3f>" href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . '?op=edit&$primary_key=' . \$list[\$i]['$primary_key']); \x3f>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a> </td> 152 <td class="sc-nowrap"><a title="<\x3fphp printf(_("Versions of %s"), oTxt(\$list[\$i]['<##>'])) \x3f>" href="<\x3fphp echo \$app->oHREF("/admin/versions.php?record_table=$db_tbl&record_key=$primary_key&boomerang=true&record_val=" . \$list[\$i]['$primary_key']); \x3f>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> </td> 153 153 154 154 E_O_F; … … 164 164 165 165 echo isset($op) ? '' : <<<E_O_F 166 <td class="sc-nowrap" align="right"><a title="<\x3fphp printf(_("Delete %s"), oTxt(\$list[\$i]['<##>'])) \x3f>" href="<\x3fphp echo App::oHREF(\$_SERVER['PHP_SELF'] . "?op=del&$primary_key=" . \$list[\$i]['$primary_key']); \x3f>" onClick="javascript:return confirm('<\x3fphp printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt(\$list[\$i]['<##>'])) \x3f>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a> </td>166 <td class="sc-nowrap" align="right"><a title="<\x3fphp printf(_("Delete %s"), oTxt(\$list[\$i]['<##>'])) \x3f>" href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . "?op=del&$primary_key=" . \$list[\$i]['$primary_key']); \x3f>" onClick="javascript:return confirm('<\x3fphp printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt(\$list[\$i]['<##>'])) \x3f>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a> </td> 167 167 </tr> 168 168 <\x3fphp } \x3f> -
trunk/bin/module_maker/module.cli.php
r119 r136 129 129 130 130 // Get DB tables. 131 $qid = DB::query("SHOW TABLES");131 $qid = $db->query("SHOW TABLES"); 132 132 while (list($row) = mysql_fetch_row($qid)) { 133 133 $tables[] = $row; … … 136 136 // Make sure requested table is in database. 137 137 if (!in_array($db_tbl, $tables)) { 138 die(sprintf("%s Warning: %s does not exist in database %s. Please select one of: \n\n%s\n\n", basename($_SERVER['argv'][0]), $db_tbl, App::getParam('db_name'), join("\n", $tables)));138 die(sprintf("%s Warning: %s does not exist in database %s. Please select one of: \n\n%s\n\n", basename($_SERVER['argv'][0]), $db_tbl, $app->getParam('db_name'), join("\n", $tables))); 139 139 } 140 140 141 141 // Ensure requested table contains columns. 142 142 // Get DB table column info. 143 $qid = DB::query("DESCRIBE " . DB::escapeString($db_tbl));143 $qid = $db->query("DESCRIBE " . $db->escapeString($db_tbl)); 144 144 while ($row = mysql_fetch_row($qid)) { 145 145 $cols[] = $row; … … 266 266 // If file upload errors, redirect to edit operation for the inserted record. 267 267 if (\$upload->anyErrors() || false === \$new_file) { 268 App::dieURL(\$_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . \$%PRIMARY_KEY%);268 \$app->dieURL(\$_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . \$%PRIMARY_KEY%); 269 269 } 270 270 E_O_F; … … 300 300 301 301 $search['date'] = '/%DATE%/'; 302 $replace['date'] = date( App::getParam('date_format'));302 $replace['date'] = date($app->getParam('date_format')); 303 303 304 304 $search['name_plural'] = '/%NAME_PLURAL%/'; -
trunk/bin/module_maker/skel/adm_form.ihtml
r51 r136 2 2 3 3 %ADMIN_FORM_TAG_INIT% 4 <?php App::printHiddenSession(); ?>4 <?php $app->printHiddenSession(); ?> 5 5 <input type="hidden" name="op" value="<?php echo $frm['new_op']; ?>" /> 6 6 <input type="hidden" name="%PRIMARY_KEY%" value="<?php echo $frm['%PRIMARY_KEY%']; ?>" /> -
trunk/bin/module_maker/skel/adm_list.ihtml
r124 r136 4 4 <div id="commandbox"> 5 5 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get"> 6 <?php App::printHiddenSession(false); ?>7 <span class="sc-nowrap commandtext"><a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=add'); ?>"><?php echo _("Add %ITEM_TITLE%"); ?></a></span>6 <?php $app->printHiddenSession(false); ?> 7 <span class="sc-nowrap commandtext"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=add'); ?>"><?php echo _("Add %ITEM_TITLE%"); ?></a></span> 8 8 <br /> 9 9 … … 17 17 18 18 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> 19 <?php App::printHiddenSession(); ?>19 <?php $app->printHiddenSession(); ?> 20 20 <?php include 'list_info.ihtml'; ?> 21 21 <table class="list"> … … 28 28 <?php for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items > 0; $i++) { ?> 29 29 <tr> 30 <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['<##>'])) ?>" href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a> </td>31 <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['<##>'])) ?>" href="<?php echo App::oHREF('/admin/versions.php?record_table=%DB_TBL%&record_key=%PRIMARY_KEY%&boomerang=true&record_val=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> </td>30 <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['<##>'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a> </td> 31 <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['<##>'])) ?>" href="<?php echo $app->oHREF('/admin/versions.php?record_table=%DB_TBL%&record_key=%PRIMARY_KEY%&boomerang=true&record_val=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> </td> 32 32 %ADM_LIST_ROWS% 33 <td class="sc-padleft sc-nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['<##>'])) ?>" href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . "?op=del&%PRIMARY_KEY%=" . $list[$i]['%PRIMARY_KEY%']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt($list[$i]['<##>'])) ?>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a> </td>33 <td class="sc-padleft sc-nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['<##>'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . "?op=del&%PRIMARY_KEY%=" . $list[$i]['%PRIMARY_KEY%']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt($list[$i]['<##>'])) ?>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a> </td> 34 34 </tr> 35 35 <?php } ?> -
trunk/bin/module_maker/skel/admin.php
r111 r136 11 11 $auth->requireLogin(); 12 12 // $auth->requireAccessClearance(ZONE_ADMIN_%NAME_UPPER%); 13 App::sslOn();13 $app->sslOn(); 14 14 15 15 require_once 'codebase/lib/PageNumbers.inc.php'; … … 33 33 $fv = new FormValidator(); 34 34 35 $cache =& SessionCache::getInstance(); 36 35 37 %SORT_ORDER% 36 38 … … 41 43 42 44 // Search limiters retain their values between page requests. 43 App::carryQuery('search_query');44 App::carryQuery('filter_<##>');45 $app->carryQuery('search_query'); 46 $app->carryQuery('filter_<##>'); 45 47 %ADMIN_UPLOAD_CONFIG% 46 48 /****************************************************************************** … … 51 53 // allows us to remember which page we came from so we can go back there. 52 54 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) { 53 App::setBoomerangURL($_SERVER['HTTP_REFERER'], '%NAME_PLURAL%');55 $app->setBoomerangURL($_SERVER['HTTP_REFERER'], '%NAME_PLURAL%'); 54 56 } 55 57 56 58 if (getFormData('break_list_cache', false)) { 57 59 // Break the cache because we are changing the list data. 58 SessionCache::breakCache($_SERVER['PHP_SELF']);60 $cache->delete($_SERVER['PHP_SELF']); 59 61 } 60 62 … … 81 83 // $auth->requireAccessClearance(ZONE_ADMIN_%NAME_UPPER%_FUNC_DELETE); 82 84 deleteRecord(getFormData('%PRIMARY_KEY%'));%ADMIN_UPLOAD_DEL% 83 if ( App::validBoomerangURL('%NAME_PLURAL%')) {85 if ($app->validBoomerangURL('%NAME_PLURAL%')) { 84 86 // Display boomerang page. 85 App::dieBoomerangURL('%NAME_PLURAL%');87 $app->dieBoomerangURL('%NAME_PLURAL%'); 86 88 } 87 89 // Display default page. 88 App::dieURL($_SERVER['PHP_SELF']);90 $app->dieURL($_SERVER['PHP_SELF']); 89 91 break; 90 92 … … 92 94 // $auth->requireAccessClearance(ZONE_ADMIN_%NAME_UPPER%_FUNC_ADD); 93 95 if (getFormdata('cancel', false)) { 94 if ( App::validBoomerangURL('%NAME_PLURAL%')) {96 if ($app->validBoomerangURL('%NAME_PLURAL%')) { 95 97 // Display boomerang page. 96 App::dieBoomerangURL('%NAME_PLURAL%');98 $app->dieBoomerangURL('%NAME_PLURAL%'); 97 99 } 98 100 // Display default page. 99 App::dieURL($_SERVER['PHP_SELF']);101 $app->dieURL($_SERVER['PHP_SELF']); 100 102 } 101 103 validateInput(); … … 109 111 if (getFormdata('repeat', false)) { 110 112 // Display function again. 111 App::dieURL($_SERVER['PHP_SELF'] . '?op=add');112 } else if ( App::validBoomerangURL('%NAME_PLURAL%')) {113 $app->dieURL($_SERVER['PHP_SELF'] . '?op=add'); 114 } else if ($app->validBoomerangURL('%NAME_PLURAL%')) { 113 115 // Display boomerang page. 114 App::dieBoomerangURL('%NAME_PLURAL%');116 $app->dieBoomerangURL('%NAME_PLURAL%'); 115 117 } 116 118 // Display default page. 117 App::dieURL($_SERVER['PHP_SELF']);119 $app->dieURL($_SERVER['PHP_SELF']); 118 120 } 119 121 break; … … 122 124 // $auth->requireAccessClearance(ZONE_ADMIN_%NAME_UPPER%_FUNC_EDIT); 123 125 if (getFormdata('reset', false)) { 124 App::raiseMsg(_("Saved values have been reloaded."), MSG_NOTICE, __FILE__, __LINE__);125 App::dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . getFormData('%PRIMARY_KEY%'));126 $app->raiseMsg(_("Saved values have been reloaded."), MSG_NOTICE, __FILE__, __LINE__); 127 $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . getFormData('%PRIMARY_KEY%')); 126 128 } 127 129 if (getFormdata('cancel', false)) { … … 129 131 $lock->select('%DB_TBL%', '%PRIMARY_KEY%', getFormData('%PRIMARY_KEY%')); 130 132 $lock->remove(); 131 if ( App::validBoomerangURL('%NAME_PLURAL%')) {133 if ($app->validBoomerangURL('%NAME_PLURAL%')) { 132 134 // Display boomerang page. 133 App::dieBoomerangURL('%NAME_PLURAL%');135 $app->dieBoomerangURL('%NAME_PLURAL%'); 134 136 } 135 137 // Display default page. 136 App::dieURL($_SERVER['PHP_SELF']);138 $app->dieURL($_SERVER['PHP_SELF']); 137 139 } 138 140 validateInput(); … … 146 148 if (getFormdata('repeat', false)) { 147 149 // Display edit function with next available ID. 148 $qid = DB::query("SELECT %PRIMARY_KEY% FROM %DB_TBL% WHERE %PRIMARY_KEY% > '" . DB::escapeString(getFormData('%PRIMARY_KEY%')) . "' ORDER BY %PRIMARY_KEY% ASC LIMIT 1");150 $qid = $db->query("SELECT %PRIMARY_KEY% FROM %DB_TBL% WHERE %PRIMARY_KEY% > '" . $db->escapeString(getFormData('%PRIMARY_KEY%')) . "' ORDER BY %PRIMARY_KEY% ASC LIMIT 1"); 149 151 if (list($next_id) = mysql_fetch_row($qid)) { 150 App::dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $next_id);152 $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $next_id); 151 153 } else { 152 App::raiseMsg(_("Cannot edit next, the end of the list was reached"), MSG_NOTICE, __FILE__, __LINE__);154 $app->raiseMsg(_("Cannot edit next, the end of the list was reached"), MSG_NOTICE, __FILE__, __LINE__); 153 155 } 154 } else if ( App::validBoomerangURL('%NAME_PLURAL%')) {156 } else if ($app->validBoomerangURL('%NAME_PLURAL%')) { 155 157 // Display boomerang page. 156 App::dieBoomerangURL('%NAME_PLURAL%');158 $app->dieBoomerangURL('%NAME_PLURAL%'); 157 159 } 158 160 // Display default page. 159 App::dieURL($_SERVER['PHP_SELF']);161 $app->dieURL($_SERVER['PHP_SELF']); 160 162 } 161 163 break; … … 164 166 // $auth->requireAccessClearance(ZONE_ADMIN_PROGRAMS_FUNC_REORDER); 165 167 updateRank(getFormData('rank')); 166 App::dieURL($_SERVER['PHP_SELF']);168 $app->dieURL($_SERVER['PHP_SELF']); 167 169 break; 168 170 … … 207 209 { 208 210 global $lock; 209 211 $db =& DB::getInstance(); 212 210 213 $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id); 211 214 if ($lock->isLocked() && !$lock->isMine()) { … … 214 217 215 218 // Get the information for the form. 216 $qid = DB::query("219 $qid = $db->query(" 217 220 SELECT * 218 221 FROM %DB_TBL% 219 WHERE %PRIMARY_KEY% = '" . DB::escapeString($id) . "'222 WHERE %PRIMARY_KEY% = '" . $db->escapeString($id) . "' 220 223 "); 221 224 if (!$frm = mysql_fetch_assoc($qid)) { 222 App::logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__);223 App::raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);224 App::dieBoomerangURL();225 $app->logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__); 226 $app->raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__); 227 $app->dieBoomerangURL(); 225 228 } 226 229 … … 246 249 { 247 250 global $lock; 248 251 $db =& DB::getInstance(); 252 $cache =& SessionCache::getInstance(); 253 249 254 $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id); 250 255 if ($lock->isLocked() && !$lock->isMine()) { … … 253 258 254 259 // Break the cache because we are changing the list data. 255 SessionCache::breakCache($_SERVER['PHP_SELF']);260 $cache->delete($_SERVER['PHP_SELF']); 256 261 257 262 // Get the information for this object. 258 $qid = DB::query("263 $qid = $db->query(" 259 264 SELECT <##> 260 265 FROM %DB_TBL% 261 WHERE %PRIMARY_KEY% = '" . DB::escapeString($id) . "'266 WHERE %PRIMARY_KEY% = '" . $db->escapeString($id) . "' 262 267 "); 263 268 if (! list($name) = mysql_fetch_row($qid)) { 264 App::logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__);265 App::raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);266 App::dieBoomerangURL();269 $app->logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__); 270 $app->raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__); 271 $app->dieBoomerangURL(); 267 272 } 268 273 269 274 // Delete the record. 270 DB::query("DELETE FROM %DB_TBL% WHERE %PRIMARY_KEY% = '" . DB::escapeString($id) . "'");271 272 App::raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been deleted."), $name), MSG_SUCCESS, __FILE__, __LINE__);275 $db->query("DELETE FROM %DB_TBL% WHERE %PRIMARY_KEY% = '" . $db->escapeString($id) . "'"); 276 277 $app->raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been deleted."), $name), MSG_SUCCESS, __FILE__, __LINE__); 273 278 274 279 // Unlock record. … … 279 284 { 280 285 global $auth; 281 286 $db =& DB::getInstance(); 287 $cache =& SessionCache::getInstance(); 288 282 289 // Break the cache because we are changing the list data. 283 SessionCache::breakCache($_SERVER['PHP_SELF']);290 $cache->delete($_SERVER['PHP_SELF']); 284 291 285 292 %INSERT% 286 $last_insert_id = mysql_insert_id( DB::getDBH());293 $last_insert_id = mysql_insert_id($db->getDBH()); 287 294 288 295 // Create version. … … 290 297 $version->create('%DB_TBL%', '%PRIMARY_KEY%', $last_insert_id, $frm['<##>']); 291 298 292 App::raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been added."), $frm['<##>']), MSG_SUCCESS, __FILE__, __LINE__);299 $app->raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been added."), $frm['<##>']), MSG_SUCCESS, __FILE__, __LINE__); 293 300 294 301 return $last_insert_id; … … 297 304 function updateRecord($frm) 298 305 { 299 global $auth, $lock; 300 306 global $auth, $lock; 307 $app =& App::getInstance(); 308 $cache =& SessionCache::getInstance(); 309 301 310 $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $frm['%PRIMARY_KEY%']); 302 311 if ($lock->isLocked() && !$lock->isMine()) { … … 305 314 306 315 // Break the cache because we are changing the list data. 307 SessionCache::breakCache($_SERVER['PHP_SELF']);316 $cache->delete($_SERVER['PHP_SELF']); 308 317 309 318 %UPDATE% … … 313 322 $version->create('%DB_TBL%', '%PRIMARY_KEY%', $frm['%PRIMARY_KEY%'], $frm['<##>']); 314 323 315 App::raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been updated."), $frm['<##>']), MSG_SUCCESS, __FILE__, __LINE__);324 $app->raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been updated."), $frm['<##>']), MSG_SUCCESS, __FILE__, __LINE__); 316 325 317 326 // Unlock record. … … 323 332 global $page; 324 333 global $so; 325 334 $db =& DB::getInstance(); 335 $prefs =& Prefs::getInstance(); 336 $cache =& SessionCache::getInstance(); 337 326 338 $where_clause = ''; 327 339 … … 336 348 if (getFormData('filter_<##>', false)) { 337 349 // Limit by filter. 338 $where_clause .= (empty($where_clause) ? 'WHERE' : 'AND') . " <##> = '" . DB::escapeString(getFormData('filter_<##>')) . "'";350 $where_clause .= (empty($where_clause) ? 'WHERE' : 'AND') . " <##> = '" . $db->escapeString(getFormData('filter_<##>')) . "'"; 339 351 } 340 352 341 353 // Count the total number of records so we can do something about the page numbers. 342 $qid = DB::query("354 $qid = $db->query(" 343 355 SELECT COUNT(*) 344 356 FROM %DB_TBL% … … 371 383 // without knowing the hash. 372 384 $cache_hash = md5($sql . '|' . $page->total_items); 373 if ( Prefs::getValue('cache_hash', $_SERVER['PHP_SELF']) != $cache_hash) {374 SessionCache::breakCache($_SERVER['PHP_SELF']);375 Prefs::setValue('cache_hash', $cache_hash, $_SERVER['PHP_SELF']);376 } 377 378 if ( SessionCache::isCached($_SERVER['PHP_SELF'])) {385 if ($prefs->get('cache_hash', $_SERVER['PHP_SELF']) != $cache_hash) { 386 $cache->delete($_SERVER['PHP_SELF']); 387 $prefs->set('cache_hash', $cache_hash, $_SERVER['PHP_SELF']); 388 } 389 390 if ($cache->exists($_SERVER['PHP_SELF'])) { 379 391 // Get the cached results. 380 $list = SessionCache::getCache($_SERVER['PHP_SELF']);392 $list = $cache->get($_SERVER['PHP_SELF']); 381 393 } else { 382 394 // If the list is not already cached, query now. 383 $qid = DB::query($sql);395 $qid = $db->query($sql); 384 396 // Fill an array with the items for this page. 385 397 while ($row = mysql_fetch_assoc($qid)) { … … 389 401 if (isset($list) && !empty($list)) { 390 402 // Cache the results. 391 SessionCache::putCache($list, $_SERVER['PHP_SELF']);403 $cache->set($list, $_SERVER['PHP_SELF']); 392 404 } 393 405 } … … 398 410 function updateRank($ranks) 399 411 { 412 $db =& DB::getInstance(); 413 $cache =& SessionCache::getInstance(); 414 400 415 if (!is_array($ranks)) { 401 App::logMsg('Saving rank failed, data posted is not an array: ' . $ranks, LOG_ERR, __FILE__, __LINE__);416 $app->logMsg('Saving rank failed, data posted is not an array: ' . $ranks, LOG_ERR, __FILE__, __LINE__); 402 417 return false; 403 418 } 404 419 405 420 // Break the cache because we are changing the list data. 406 SessionCache::breakCache($_SERVER['PHP_SELF']);421 $cache->delete($_SERVER['PHP_SELF']); 407 422 408 423 // Count the ranks with invalid numbers … … 416 431 $unspecified_counter++; 417 432 } 418 DB::query("433 $db->query(" 419 434 UPDATE %DB_TBL% SET 420 rank = '" . DB::escapeString($new_rank) . "'421 WHERE %PRIMARY_KEY% = '" . DB::escapeString($id) . "'435 rank = '" . $db->escapeString($new_rank) . "' 436 WHERE %PRIMARY_KEY% = '" . $db->escapeString($id) . "' 422 437 "); 423 438 } 424 439 425 App::raiseMsg(_("Records have been reordered with the new rank."), MSG_SUCCESS, __FILE__, __LINE__);440 $app->raiseMsg(_("Records have been reordered with the new rank."), MSG_SUCCESS, __FILE__, __LINE__); 426 441 if ($unspecified_counter > 0) { 427 App::raiseMsg(sprintf(_("%s items with unspecified ranks were automatically assigned a rank of 10000."), $unspecified_counter), MSG_NOTICE, __FILE__, __LINE__);442 $app->raiseMsg(sprintf(_("%s items with unspecified ranks were automatically assigned a rank of 10000."), $unspecified_counter), MSG_NOTICE, __FILE__, __LINE__); 428 443 } 429 444 } -
trunk/bin/module_maker/skel/public.ihtml
r1 r136 1 1 <p><?php echo nl2br(fancyTxt(oTxt($item['content'], true))); ?></p> 2 <p><em><?php echo sprintf(_("Published %s"), date( App::getParam('date_format'), strtotime($item['<##>']))); ?></em></p>2 <p><em><?php echo sprintf(_("Published %s"), date($app->getParam('date_format'), strtotime($item['<##>']))); ?></em></p> 3 3 4 4 <!-- -
trunk/bin/module_maker/skel/public.php
r111 r136 34 34 35 35 // Get requested record. 36 $qid = DB::query("36 $qid = $db->query(" 37 37 SELECT * FROM %DB_TBL% 38 WHERE %PRIMARY_KEY% = '" . DB::escapeString(getFormData('%PRIMARY_KEY%')) . "'38 WHERE %PRIMARY_KEY% = '" . $db->escapeString(getFormData('%PRIMARY_KEY%')) . "' 39 39 AND publish = 'true' 40 40 <##>AND (publish_date <= CURDATE() OR publish_date = '0000-00-00') … … 42 42 "); 43 43 if (!$item = mysql_fetch_assoc($qid)) { 44 App::raiseMsg(_("Sorry that %ITEM_TITLE% could not be found"), MSG_WARNING, __FILE__, __LINE__);45 App::dieBoomerangURL();44 $app->raiseMsg(_("Sorry that %ITEM_TITLE% could not be found"), MSG_WARNING, __FILE__, __LINE__); 45 $app->dieBoomerangURL(); 46 46 } 47 47 48 48 // Update the hit counter for this record. 49 DB::query("49 $db->query(" 50 50 UPDATE %DB_TBL% 51 51 SET hit_count = hit_count + 1 52 WHERE %PRIMARY_KEY% = '" . DB::escapeString(getFormData('%PRIMARY_KEY%')) . "'52 WHERE %PRIMARY_KEY% = '" . $db->escapeString(getFormData('%PRIMARY_KEY%')) . "' 53 53 "); 54 54 … … 61 61 // Get the DEFAULT list. 62 62 $%NAME_SINGULAR%_list = array(); 63 $qid = DB::query("63 $qid = $db->query(" 64 64 SELECT * 65 65 FROM %DB_TBL% … … 79 79 // Get the FEATURED list. 80 80 $featured_list = array(); 81 $qid = DB::query("81 $qid = $db->query(" 82 82 SELECT * 83 83 FROM %DB_TBL% … … 92 92 // Get the POPULAR list. 93 93 $popular_list = array(); 94 $qid = DB::query("94 $qid = $db->query(" 95 95 SELECT * 96 96 FROM %DB_TBL% … … 104 104 // Get the RECENT list. 105 105 $recent_list = array(); 106 $qid = DB::query("106 $qid = $db->query(" 107 107 SELECT * 108 108 FROM %DB_TBL% -
trunk/bin/module_maker/skel/public_list.ihtml
r42 r136 5 5 ?> 6 6 <?php if (strlen(trim($%NAME_SINGULAR%_list[$i]['content'])) > 0) { // Link only if content is available. ?> 7 <h4><a href="<?php echo App::oHREF('/%PUBLIC_SCRIPT%?%PRIMARY_KEY%=' . $%NAME_SINGULAR%_list[$i]['%PRIMARY_KEY%']); ?>"><?php echo fancyTxt(oTxt($%NAME_SINGULAR%_list[$i]['title'])); ?></a></h4>7 <h4><a href="<?php echo $app->oHREF('/%PUBLIC_SCRIPT%?%PRIMARY_KEY%=' . $%NAME_SINGULAR%_list[$i]['%PRIMARY_KEY%']); ?>"><?php echo fancyTxt(oTxt($%NAME_SINGULAR%_list[$i]['title'])); ?></a></h4> 8 8 <?php } else { ?> 9 9 <h4><?php echo fancyTxt(oTxt($%NAME_SINGULAR%_list[$i]['title'])); ?></h4> 10 10 <?php } ?> 11 11 <p> 12 <em><?php echo date( App::getParam('date_format'), strtotime($%NAME_SINGULAR%_list[$i]['<##>'])); ?></em> — <?php echo nl2br(fancyTxt(oTxt($%NAME_SINGULAR%_list[$i]['summary'], true))); ?>12 <em><?php echo date($app->getParam('date_format'), strtotime($%NAME_SINGULAR%_list[$i]['<##>'])); ?></em> — <?php echo nl2br(fancyTxt(oTxt($%NAME_SINGULAR%_list[$i]['summary'], true))); ?> 13 13 14 14 <?php if (strlen(trim($%NAME_SINGULAR%_list[$i]['content'])) > 0) { // Link only if content is available. ?> 15 <br /><a href="<?php echo App::oHREF('/%PUBLIC_SCRIPT%?%PRIMARY_KEY%=' . $%NAME_SINGULAR%_list[$i]['%PRIMARY_KEY%']); ?>"><?php echo _("Read more"); ?></a>15 <br /><a href="<?php echo $app->oHREF('/%PUBLIC_SCRIPT%?%PRIMARY_KEY%=' . $%NAME_SINGULAR%_list[$i]['%PRIMARY_KEY%']); ?>"><?php echo _("Read more"); ?></a> 16 16 <?php } ?> 17 17 </p> … … 32 32 <?php 33 33 foreach ($featured_list as $item) { 34 ?><h4><a href="<?php echo App::oHREF('/%PUBLIC_SCRIPT%?%PRIMARY_KEY%=' . $item['%PRIMARY_KEY%']); ?>"><?php echo fancyTxt(oTxt($item['title'])); ?></a></h4><?php34 ?><h4><a href="<?php echo $app->oHREF('/%PUBLIC_SCRIPT%?%PRIMARY_KEY%=' . $item['%PRIMARY_KEY%']); ?>"><?php echo fancyTxt(oTxt($item['title'])); ?></a></h4><?php 35 35 } 36 36 } … … 44 44 <?php 45 45 foreach ($popular_list as $item) { 46 ?><h4><a href="<?php echo App::oHREF('/%PUBLIC_SCRIPT%?%PRIMARY_KEY%=' . $item['%PRIMARY_KEY%']); ?>"><?php echo fancyTxt(oTxt($item['title'])); ?></a> </h4><?php46 ?><h4><a href="<?php echo $app->oHREF('/%PUBLIC_SCRIPT%?%PRIMARY_KEY%=' . $item['%PRIMARY_KEY%']); ?>"><?php echo fancyTxt(oTxt($item['title'])); ?></a> </h4><?php 47 47 } 48 48 } … … 56 56 <?php 57 57 foreach ($recent_list as $item) { 58 ?><h4><a href="<?php echo App::oHREF('/%PUBLIC_SCRIPT%?%PRIMARY_KEY%=' . $item['%PRIMARY_KEY%']); ?>"><?php echo fancyTxt(oTxt($item['title'])); ?></a> </h4><?php58 ?><h4><a href="<?php echo $app->oHREF('/%PUBLIC_SCRIPT%?%PRIMARY_KEY%=' . $item['%PRIMARY_KEY%']); ?>"><?php echo fancyTxt(oTxt($item['title'])); ?></a> </h4><?php 59 59 } 60 60 } -
trunk/bin/module_maker/sql.cli.php
r111 r136 30 30 31 31 // Get DB tables. 32 $qid = DB::query("SHOW TABLES");32 $qid = $db->query("SHOW TABLES"); 33 33 while (list($row) = mysql_fetch_row($qid)) { 34 34 $tables[] = $row; … … 37 37 // Make sure requested table is in database. 38 38 if (!in_array($db_tbl, $tables)) { 39 die(sprintf("%s Warning: %s does not exist in database %s. Please select one of: \n\n%s\n\n", basename($_SERVER['argv'][0]), $db_tbl, App::getParam('db_name'), join("\n", $tables)));39 die(sprintf("%s Warning: %s does not exist in database %s. Please select one of: \n\n%s\n\n", basename($_SERVER['argv'][0]), $db_tbl, $app->getParam('db_name'), join("\n", $tables))); 40 40 } 41 41 … … 46 46 47 47 // Get DB table column info. 48 $qid = DB::query("DESCRIBE " . DB::escapeString($db_tbl));48 $qid = $db->query("DESCRIBE " . $db->escapeString($db_tbl)); 49 49 while ($row = mysql_fetch_row($qid)) { 50 50 $cols[] = $row; … … 76 76 } else if ('added_by_user_id' == $field || 'modified_by_user_id' == $field) { 77 77 // Toggle types. 78 $c[$field] = "'\" . DB::escapeString(\$auth->getVal('user_id')) . \"'";78 $c[$field] = "'\" . \$db->escapeString(\$auth->getVal('user_id')) . \"'"; 79 79 } else if ('added_datetime' == $field || 'modified_datetime' == $field) { 80 80 // DB record insertion datetime. … … 82 82 } else { 83 83 // Default. Just insert data. 84 $c[$field] = "'\" . DB::escapeString(\$frm['$field']) . \"'";84 $c[$field] = "'\" . \$db->escapeString(\$frm['$field']) . \"'"; 85 85 } 86 86 } … … 107 107 echo <<<E_O_F 108 108 // Insert record data. 109 DB::query("109 \$db->query(" 110 110 INSERT INTO $db_tbl ( 111 111 $db_keys … … 133 133 echo <<<E_O_F 134 134 // Update record data. 135 DB::query("135 \$db->query(" 136 136 UPDATE $db_tbl SET$key_eq_val 137 WHERE $primary_key = '" . DB::escapeString(\$frm['$primary_key']) . "'137 WHERE $primary_key = '" . \$db->escapeString(\$frm['$primary_key']) . "' 138 138 "); 139 139 E_O_F; … … 148 148 $delim = 'WHERE'; 149 149 if (!empty($primary_key)) { 150 $where_clause = " $delim $primary_key = '\" . DB::escapeString(\$frm['$primary_key']) . \"'\n";150 $where_clause = " $delim $primary_key = '\" . \$db->escapeString(\$frm['$primary_key']) . \"'\n"; 151 151 $delim = 'AND'; 152 152 } … … 155 155 continue; 156 156 } 157 $where_clause .= " $delim $k = '\" . DB::escapeString(\$frm['$k']) . \"'\n";157 $where_clause .= " $delim $k = '\" . \$db->escapeString(\$frm['$k']) . \"'\n"; 158 158 $delim = 'AND'; 159 159 } 160 160 echo <<<E_O_F 161 161 // Delete record data. 162 DB::query("162 \$db->query(" 163 163 DELETE FROM $db_tbl 164 164 $where_clause "); … … 183 183 if (!isset($op) || 'search' == $op) { 184 184 $search_skip_columns = array('added_datetime', 'added_by_user_id', 'modified_datetime', 'modified_by_user_id', 'publish', 'featured'); 185 $search_columns = $db_tbl . '.' . join(" LIKE '%\" . DB::escapeString(\$qry_words[\$i]) . \"%'\n OR $db_tbl.", array_diff(array_keys($c), $search_skip_columns));185 $search_columns = $db_tbl . '.' . join(" LIKE '%\" . \$db->escapeString(\$qry_words[\$i]) . \"%'\n OR $db_tbl.", array_diff(array_keys($c), $search_skip_columns)); 186 186 echo <<<E_O_F 187 187 \$where_clause .= (empty(\$where_clause) ? 'WHERE' : 'AND') . " 188 188 ( 189 $search_columns LIKE '%" . DB::escapeString(\$qry_words[\$i]) . "%'189 $search_columns LIKE '%" . \$db->escapeString(\$qry_words[\$i]) . "%' 190 190 ) 191 191 "; -
trunk/bin/module_maker/validation.cli.php
r111 r136 17 17 18 18 // Get DB tables. 19 $qid = DB::query("SHOW TABLES");19 $qid = $db->query("SHOW TABLES"); 20 20 while (list($row) = mysql_fetch_row($qid)) { 21 21 $tables[] = $row; … … 24 24 // Make sure requested table is in database. 25 25 if (!in_array($db_tbl, $tables)) { 26 die(sprintf("%s Warning: %s does not exist in database %s. Please select one of: \n\n%s\n\n", basename($_SERVER['argv'][0]), $db_tbl, App::getParam('db_name'), join("\n", $tables)));26 die(sprintf("%s Warning: %s does not exist in database %s. Please select one of: \n\n%s\n\n", basename($_SERVER['argv'][0]), $db_tbl, $app->getParam('db_name'), join("\n", $tables))); 27 27 } 28 28 29 29 // Get DB table column info. 30 $qid = DB::query("DESCRIBE " . DB::escapeString($db_tbl));30 $qid = $db->query("DESCRIBE " . $db->escapeString($db_tbl)); 31 31 while ($row = mysql_fetch_row($qid)) { 32 32 $cols[] = $row; … … 277 277 // natsort($o); 278 278 279 // Remove last empty element. 280 if ('' == end($o)) { 281 array_pop($o); 282 } 283 279 284 echo "function validateInput() 280 285 { 281 286 global \$fv; 282 287 283 "; 284 echo join("\n ", $o); 285 echo " 288 " . join("\n ", $o) . " 286 289 }"; 287 290 ?>
Note: See TracChangeset
for help on using the changeset viewer.