Changeset 20
- Timestamp:
- Nov 17, 2005 3:00:00 AM (19 years ago)
- Location:
- trunk
- Files:
-
- 28 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/module_maker/form_template.cli.php
r19 r20 65 65 <td class="right"><label for="$field"<\x3fphp \$fv->err('$field', ' class="error"') \x3f>><\x3fphp echo _("$title"); \x3f></label></td> 66 66 <td valign="top"> 67 <select name="$field" class=" formselect">67 <select name="$field" class="small"> 68 68 <\x3fphp printSelectForm('<##>_tbl', "CONCAT(<##>_id, '—', <##>)", '$field', \$frm['$field'], true, 'ORDER BY $field DESC'); \x3f> 69 69 </select> … … 75 75 76 76 // File upload. 77 if (preg_match('/file /i', $field)) {78 $output[$field] = <<<E_O_F 79 <tr> 80 <td class="right"><label for="$field"<\x3fphp \$fv->err('$field', ' class="error"') \x3f>><\x3fphp echo _("$title"); \x3f></label></td> 81 <td valign="top"> 82 <input type="file" name="$field" value="<\x3fphp echo \$_FILES['$field']['name']; \x3f>"/>83 <\x3fphp if ( getFormData('op') == 'edit' || getFormData('op') == 'update') { \x3f>84 <div class="help"><\x3fphp printf(_("The current file < strong>%s</strong> will be overwritten if a new file is selected for upload."), \$frm['$field']) \x3f></div>77 if (preg_match('/file|image/i', $field)) { 78 $output[$field] = <<<E_O_F 79 <tr> 80 <td class="right"><label for="$field"<\x3fphp \$fv->err('$field', ' class="error"') \x3f>><\x3fphp echo _("$title"); \x3f></label></td> 81 <td valign="top"> 82 <input type="file" name="$field" /> 83 <\x3fphp if ('' != \$upload->getFilenameGlob(getFormData('$primary_key_field') . '_*') && getFormData('op') == 'edit' || getFormData('op') == 'update') { \x3f> 84 <div class="help"><\x3fphp printf(_("The current file <a href=\"%s/%2\$s\"><strong>%2\$s</strong></a> will be deleted if a new file is selected for upload."), '/_db_files/<##>', \$upload->getFilenameGlob(getFormData('$primary_key_field') . '_*')) \x3f></div> 85 85 <\x3fphp } \x3f> 86 <div class="help"><\x3fphp printf(_("File to upload must have one of the following file-name extensions: %s."), join(', ', \$upload-> valid_file_extensions)) \x3f></div>86 <div class="help"><\x3fphp printf(_("File to upload must have one of the following file-name extensions: %s."), join(', ', \$upload->getParam('valid_file_extensions'))) \x3f></div> 87 87 </td> 88 88 </tr> … … 97 97 <td class="right"><label for="$field"<\x3fphp \$fv->err('$field', ' class="error"') \x3f>><\x3fphp echo _("$title"); \x3f></label></td> 98 98 <td valign="top"> 99 <input type="password" class=" forminputtext" size="50" name="$field" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>">99 <input type="password" class="medium" size="50" name="$field" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" /> 100 100 </td> 101 101 </tr> … … 138 138 <td> </td> 139 139 <td> 140 <input type="checkbox" name="$field" <\x3fphp frmChecked(!empty(\$frm['$field'])) \x3f> ><label><\x3fphp echo _("$title"); \x3f></label>140 <input type="checkbox" name="$field" <\x3fphp frmChecked(!empty(\$frm['$field'])) \x3f> /><label><\x3fphp echo _("$title"); \x3f></label> 141 141 </td> 142 142 </tr> … … 157 157 <td class="right"><label for="$field"<\x3fphp \$fv->err('$field', ' class="error"') \x3f>><\x3fphp echo _("$title"); \x3f></label></td> 158 158 <td valign="top"> 159 <textarea class=" text" cols="75" rows="4" name="$field"><\x3fphp echo oTxt(\$frm['$field']); \x3f></textarea>159 <textarea class="large" cols="75" rows="4" name="$field"><\x3fphp echo oTxt(\$frm['$field']); \x3f></textarea> 160 160 </td> 161 161 </tr> … … 196 196 <td class="right"><label for="$field"<\x3fphp \$fv->err('$field', ' class="error"') \x3f>><\x3fphp echo _("$title"); \x3f></label></td> 197 197 <td valign="top"> 198 <input type="text" class=" text" size="50" name="$field" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>">198 <input type="text" class="medium" size="50" name="$field" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" /> 199 199 </td> 200 200 </tr> -
trunk/bin/module_maker/list_template.cli.php
r19 r20 112 112 <br /> 113 113 114 <input type="text" class=" forminputtext" size="20" name="search_query" value="<\x3fphp echo getFormData('search_query'); \x3f>" title="<\x3fphp echo oTxt(_("Fields searched: <##>.")); \x3f>" />114 <input type="text" class="small" size="20" name="search_query" value="<\x3fphp echo getFormData('search_query'); \x3f>" title="<\x3fphp echo oTxt(_("Fields searched: <##>.")); \x3f>" /> 115 115 <select name="filter_<##>"> 116 116 <\x3fphp // printSelectForm('<##>_tbl', "CONCAT(<##>_id, '—', city, '—', title)", '<##>_id', getFormData('filter_<##>'), array('Any <##>'), 'ORDER BY <##> ASC'); \x3f> -
trunk/bin/module_maker/module.cli.php
r19 r20 56 56 57 57 // Names 58 $module_title = ucwords( $module_name_plural);59 $item_title = ucwords( $module_name_singular);60 $module_name_upper = strtoupper( $module_name_plural);58 $module_title = ucwords(str_replace('_', ' ', $module_name_plural)); 59 $item_title = ucwords(str_replace('_', ' ', $module_name_singular)); 60 $module_name_upper = strtoupper(str_replace('_', ' ', $module_name_plural)); 61 61 62 62 // Admin files … … 76 76 // Only after we've defined essential files can we clean. 77 77 if ('clean' == $op) { 78 cleanFiles(); 78 echo "Beginning file cleanup\n"; 79 trashFile("$admin_dir/$admin_script"); 80 trashFile("$admin_tpl_dir/$admin_list_template"); 81 trashFile("$admin_tpl_dir/$admin_form_template"); 82 trashFile("$public_dir/$public_script"); 83 trashFile("$public_tpl_dir/$public_list_template"); 84 trashFile("$public_tpl_dir/$public_detail_template"); 85 echo "End file cleanup\n"; 79 86 die; 80 87 } … … 140 147 141 148 // Loop through columns 142 $ multipart_form_required= false;149 $upload_file_capability = false; 143 150 $headers = array(); 144 151 $public_list_page_vars = array(); … … 160 167 161 168 // Our form will require type="multipart/form-data". 162 if (preg_match('/file /i', $field)) {163 $ multipart_form_required= true;169 if (preg_match('/file|image/i', $field)) { 170 $upload_file_capability = true; 164 171 } 165 172 … … 184 191 185 192 186 // -------------VARS------------- 193 // Search-replace variables ---------------------------------- 194 195 // Admin script file upload replacement routines... 196 197 $search['admin_form_tag_init'] = '/%ADMIN_FORM_TAG_INIT%/'; 198 $replace['admin_form_tag_init'] = "<form method=\"post\" action=\"<\x3fphp echo \$_SERVER['PHP_SELF']; \x3f>\">"; 199 $search['admin_upload_include'] = '/%ADMIN_UPLOAD_INCLUDE%/'; 200 $replace['admin_upload_include'] = ''; 201 $search['admin_upload_config'] = '/%ADMIN_UPLOAD_CONFIG%/'; 202 $replace['admin_upload_config'] = ''; 203 $search['admin_upload_init'] = '/%ADMIN_UPLOAD_INIT%/'; 204 $replace['admin_upload_init'] = ''; 205 $search['admin_upload_del'] = '/%ADMIN_UPLOAD_DEL%/'; 206 $replace['admin_upload_del'] = ''; 207 $search['admin_upload_insert'] = '/%ADMIN_UPLOAD_INSERT%/'; 208 $replace['admin_upload_insert'] = ''; 209 $search['admin_upload_insert2'] = '/%ADMIN_UPLOAD_INSERT2%/'; 210 $replace['admin_upload_insert2'] = ''; 211 $search['admin_upload_update'] = '/%ADMIN_UPLOAD_UPDATE%/'; 212 $replace['admin_upload_update'] = ''; 213 214 if ($upload_file_capability) { 215 $replace['admin_form_tag_init'] = "<form enctype=\"multipart/form-data\" method=\"post\" action=\"<\x3fphp echo \$_SERVER['PHP_SELF']; \x3f>\">\n<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"<##>\" />"; 216 217 $replace['admin_upload_include'] = "require_once 'codebase/lib/Upload.inc.php';\n"; 218 219 $replace['admin_upload_config'] = <<<E_O_F 220 221 // This module has file upload capability. 222 \$upload = new Upload(); 223 \$upload->setParam(array( 224 'upload_path' => COMMON_BASE . '/html/_db_files/<##>', 225 'dest_file_perms' => 0666, 226 'allow_overwriting' => false, 227 'valid_file_extensions' => array('jpg', 'gif', 'png', 'jpeg'), 228 )); 229 230 E_O_F; 231 232 $replace['admin_upload_init'] = <<<E_O_F 233 234 // Copy uploaded image name into form data. 235 \$_POST['<##>'] = isset(\$_FILES['<##>']) ? \$_FILES['<##>']['name'] : ''; 236 237 238 E_O_F; 239 240 $replace['admin_upload_del'] = <<<E_O_F 241 242 // Delete file. 243 if ('' != \$upload->getFilenameGlob(getFormData('%PRIMARY_KEY%') . '_*')) { 244 \$upload->deleteFile(\$upload->getFilenameGlob(getFormData('%PRIMARY_KEY%') . '_*')); 245 } 246 E_O_F; 247 248 $replace['admin_upload_insert'] = <<<E_O_F 249 250 // Upload file. 251 if (!\$new_files = \$upload->process('<##>')) { 252 // Upload failed. Reload form, displaying errors. 253 \$frm =& addRecordForm(); 254 \$frm = array_merge(\$frm, getFormData()); 255 \$nav->addPage(_("Add %ITEM_TITLE%")); 256 \$main_template = '%ADMIN_FORM_TEMPLATE%'; 257 break; 258 } 259 E_O_F; 260 261 $replace['admin_upload_insert2'] = <<<E_O_F 262 263 // Record inserted successfuly. Now we know the primary key, prepend to filename. 264 \$upload->moveFile(\$new_files[0]['name'], \$%PRIMARY_KEY% . '_' . \$new_files[0]['name']); 265 E_O_F; 266 267 $replace['admin_upload_update'] = <<<E_O_F 268 269 // Upload new file. 270 if (getFormData('<##>')) { 271 if (\$upload->process('<##>', getFormData('%PRIMARY_KEY%') . '_' . getFormData('<##>'))) { 272 // Upload success. Delete old file. 273 if ('' != \$upload->getFilenameGlob(getFormData('%PRIMARY_KEY%') . '_*')) { 274 \$upload->deleteFile(\$upload->getFilenameGlob(getFormData('%PRIMARY_KEY%') . '_*')); 275 } 276 } else { 277 // Upload failed. Reload form, displaying errors. 278 \$frm =& editRecordForm(getFormData('%PRIMARY_KEY%')); 279 \$frm = array_merge(\$frm, getFormData()); 280 \$nav->addPage(_("Edit %ITEM_TITLE%")); 281 \$main_template = '%ADMIN_FORM_TEMPLATE%'; 282 break; 283 } 284 } 285 E_O_F; 286 } // End if. 287 187 288 188 289 // Simple... … … 242 343 $replace['search_fields'] = join(", ", $headers); 243 344 244 $search['admin_form_tag_init'] = '/%ADMIN_FORM_TAG_INIT%/';245 if ($multipart_form_required) {246 $replace['admin_form_tag_init'] = "<form enctype=\"multipart/form-data\" method=\"post\" action=\"<\x3fphp echo \$_SERVER['PHP_SELF']; \x3f>\">\n<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"12000000\">";247 } else {248 $replace['admin_form_tag_init'] = "<form method=\"post\" action=\"<\x3fphp echo \$_SERVER['PHP_SELF']; \x3f>\">";249 }250 345 251 346 … … 419 514 *****************************************************************************/ 420 515 421 /** 422 * Removes existing modules files. Danger! 423 */ 424 function cleanFiles() 516 function trashFile($file_path_name) 425 517 { 426 518 global $user_trash_folder; 427 global $admin_dir; 428 global $admin_script; 429 global $admin_tpl_dir; 430 global $admin_list_template; 431 global $admin_form_template; 432 global $public_dir; 433 global $public_script; 434 global $public_tpl_dir; 435 global $public_detail_template; 436 global $public_list_template; 519 static $file_prefix; 437 520 438 echo "Beginning file cleanup\n"; 439 521 if (!isset($file_prefix)) { 522 $file_prefix = time(); 523 } else { 524 $file_prefix++; 525 } 526 527 // Make user trash folder. 440 528 if (!dir($user_trash_folder)) { 441 529 mkdir($user_trash_folder); … … 447 535 } 448 536 449 if (file_exists("$admin_dir/$admin_script")) { 450 rename("$admin_dir/$admin_script", "$user_trash_folder/$admin_script" . '_' . md5(microtime())); 451 printf("Moved to trash: %s\n", "$admin_dir/$admin_script"); 537 // Move file to trash. 538 if (file_exists($file_path_name)) { 539 rename($file_path_name, sprintf('%s/%s_%s', $user_trash_folder, $file_prefix, basename($file_path_name))); 540 printf("Moved to trash: %s -> %s\n", $file_path_name, sprintf('%s/%s_%s', $user_trash_folder, $file_prefix, basename($file_path_name))); 452 541 } else { 453 printf("File not found: %s\n", "$admin_dir/$admin_script"); 454 } 455 456 if (file_exists("$admin_tpl_dir/$admin_list_template")) { 457 rename("$admin_tpl_dir/$admin_list_template", "$user_trash_folder/$admin_list_template" . '_' . md5(microtime())); 458 printf("Moved to trash: %s\n", "$admin_tpl_dir/$admin_list_template"); 459 } else { 460 printf("File not found: %s\n", "$admin_tpl_dir/$admin_list_template"); 461 } 462 463 if (file_exists("$admin_tpl_dir/$admin_form_template")) { 464 rename("$admin_tpl_dir/$admin_form_template", "$user_trash_folder/$admin_form_template" . '_' . md5(microtime())); 465 printf("Moved to trash: %s\n", "$admin_tpl_dir/$admin_form_template"); 466 } else { 467 printf("File not found: %s\n", "$admin_tpl_dir/$admin_form_template"); 468 } 469 470 if (file_exists("$public_dir/$public_script")) { 471 rename("$public_dir/$public_script", "$user_trash_folder/$public_script" . '_' . md5(microtime())); 472 printf("Moved to trash: %s\n", "$public_dir/$public_script"); 473 } else { 474 printf("File not found: %s\n", "$public_dir/$public_script"); 475 } 476 477 if (file_exists("$public_tpl_dir/$public_list_template")) { 478 rename("$public_tpl_dir/$public_list_template", "$user_trash_folder/$public_list_template" . '_' . md5(microtime())); 479 printf("Moved to trash: %s\n", "$public_tpl_dir/$public_list_template"); 480 } else { 481 printf("File not found: %s\n", "$public_tpl_dir/$public_list_template"); 482 } 483 484 if (file_exists("$public_tpl_dir/$public_detail_template")) { 485 rename("$public_tpl_dir/$public_detail_template", "$user_trash_folder/$public_detail_template" . '_' . md5(microtime())); 486 printf("Moved to trash: %s\n", "$public_tpl_dir/$public_detail_template"); 487 } else { 488 printf("File not found: %s\n", "$public_tpl_dir/$public_detail_template"); 489 } 490 491 echo "End file cleanup\n"; 542 printf("File not found: %s\n", $file_path_name); 543 } 492 544 } 493 545 -
trunk/bin/module_maker/skel/adm_form.ihtml
r19 r20 3 3 %ADMIN_FORM_TAG_INIT% 4 4 <?php App::printHiddenSession(); ?> 5 <input type="hidden" name="op" value="<?php echo $frm['new_op']; ?>" >6 <input type="hidden" name="%PRIMARY_KEY%" value="<?php echo $frm['%PRIMARY_KEY%']; ?>" >5 <input type="hidden" name="op" value="<?php echo $frm['new_op']; ?>" /> 6 <input type="hidden" name="%PRIMARY_KEY%" value="<?php echo $frm['%PRIMARY_KEY%']; ?>" /> 7 7 8 8 <table> -
trunk/bin/module_maker/skel/adm_list.ihtml
r19 r20 1 1 2 2 <?php $fv->printErrorMessages(); ?> 3 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method=" post">3 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get"> 4 4 <?php App::printHiddenSession(false); ?> 5 5 … … 8 8 <br /> 9 9 10 <input type="text" class=" forminputtext" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" title="<?php echo oTxt(_("Fields searched:%SEARCH_FIELDS%.")); ?>" />10 <input type="text" class="small" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" title="<?php echo oTxt(_("Fields searched: <##> %SEARCH_FIELDS%.")); ?>" /> 11 11 <select name="filter_<##>"> 12 12 <?php // printSelectForm('<##>_tbl', "CONCAT(<##>_id, '—', city, '—', title)", '<##>_id', getFormData('filter_<##>'), array('Any <##>'), 'ORDER BY <##> ASC'); ?> … … 14 14 <input type="submit" name="list" value="<?php echo _("Search"); ?>" /> 15 15 </div> 16 </form> 16 17 18 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> 19 <?php App::printHiddenSession(); ?> 17 20 <?php include 'list_info.ihtml'; ?> 18 19 21 <table class="list"> 20 22 <tr> … … 26 28 <?php for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items > 0; $i++) { ?> 27 29 <tr> 28 <td class="padleft nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i][' ______RECORD_NAME______'])) ?>" 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>29 <td class="padleft nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i][' ______RECORD_NAME______'])) ?>" 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="padleft 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="padleft 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 32 %ADM_LIST_ROWS% 31 <td class="padleft nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i][' ______RECORD_NAME______'])) ?>" 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]['______RECORD_NAME______'])) ?>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a> </td>33 <td class="padleft 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> 32 34 </tr> 33 35 <?php } ?> -
trunk/bin/module_maker/skel/admin.php
r19 r20 21 21 require_once 'codebase/lib/RecordLock.inc.php'; 22 22 require_once 'codebase/lib/RecordVersion.inc.php'; 23 23 %ADMIN_UPLOAD_INCLUDE% 24 24 25 25 /****************************************************************************** … … 40 40 $page->setPageNumber(getFormData('page_number')); 41 41 42 // Search limiters retain their values between page requests. 43 App::carryQuery('search_query'); 44 App::carryQuery('filter_<##>'); 45 %ADMIN_UPLOAD_CONFIG% 42 46 /****************************************************************************** 43 47 * MAIN 44 48 *****************************************************************************/ 45 49 %ADMIN_UPLOAD_INIT% 46 50 // We may want to use the add/edit interface from another script, so this 47 51 // allows us to remember which page we came from so we can go back there. 48 if (getFormData('boomerang', false) ) {52 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) { 49 53 App::setBoomerangURL($_SERVER['HTTP_REFERER'], '%NAME_PLURAL%'); 50 54 } … … 76 80 case 'del' : 77 81 // $auth->requireAccessClearance(ZONE_ADMIN_%NAME_UPPER%_FUNC_DELETE); 78 deleteRecord(getFormData('%PRIMARY_KEY%')); 82 deleteRecord(getFormData('%PRIMARY_KEY%'));%ADMIN_UPLOAD_DEL% 79 83 if (App::validBoomerangURL('%NAME_PLURAL%')) { 80 84 // Display boomerang page. … … 96 100 $nav->addPage(_("Add %ITEM_TITLE%")); 97 101 $main_template = '%ADMIN_FORM_TEMPLATE%'; 98 } else { 99 $%PRIMARY_KEY% = insertRecord(getFormData()); 102 } else {%ADMIN_UPLOAD_INSERT% 103 $%PRIMARY_KEY% = insertRecord(getFormData());%ADMIN_UPLOAD_INSERT2% 100 104 if (getFormdata('repeat', false)) { 101 105 // Display function again. … … 134 138 $nav->addPage(_("Edit %ITEM_TITLE%")); 135 139 $main_template = '%ADMIN_FORM_TEMPLATE%'; 136 } else { 140 } else {%ADMIN_UPLOAD_UPDATE% 137 141 updateRecord(getFormData()); 138 142 if (getFormdata('repeat', false)) { … … 277 281 278 282 // Create version. 279 $version = new RecordVersion($GLOBALS['auth']);283 $version = RecordVersion::getInstance($GLOBALS['auth']); 280 284 $version->create('%DB_TBL%', '%PRIMARY_KEY%', $last_insert_id, $frm['<##>']); 281 285 … … 300 304 301 305 // Create version. 302 $version = new RecordVersion($GLOBALS['auth']);306 $version = RecordVersion::getInstance($GLOBALS['auth']); 303 307 $version->create('%DB_TBL%', '%PRIMARY_KEY%', $frm['%PRIMARY_KEY%'], $frm['<##>']); 304 308 … … 403 407 foreach ($ranks as $id => $new_rank) { 404 408 if ('' == trim($new_rank) || !is_numeric($new_rank) || $new_rank > 2147483646) { 405 // Unspecified entries rec ieve a sort order of 1000.406 $new_rank = 1000 ;409 // Unspecified entries receive a sort order of 10000. 410 $new_rank = 10000; 407 411 $unspecified_counter++; 408 412 } … … 416 420 App::raiseMsg(_("Records have been reordered with the new rank."), MSG_SUCCESS, __FILE__, __LINE__); 417 421 if ($unspecified_counter > 0) { 418 App::raiseMsg(sprintf(_("%s items with unspecified ranks were automatically assigned a rank of 1000 ."), $unspecified_counter), MSG_NOTICE, __FILE__, __LINE__);422 App::raiseMsg(sprintf(_("%s items with unspecified ranks were automatically assigned a rank of 10000."), $unspecified_counter), MSG_NOTICE, __FILE__, __LINE__); 419 423 } 420 424 } -
trunk/css/admin.inc.css
r19 r20 44 44 /* The following are here in addition to in utilities.inc.css only because I want the font size 70%. Is there a more general way to do this? There currently are NO font-size specifications in utilities.inc.css or codebase.inc.css. That seems safest, but requires that they are redefined anyways (like here for eg). Have you figured out how to do font sizes correctly? */ 45 45 46 /* Why does having a form change the presentation of the page? Don't do that. */ 47 form 48 { 49 margin: 0; 50 } 51 46 52 form label 47 53 { 48 54 font-size: 70%; 49 max-width: 2 0em;55 max-width: 25em; 50 56 /* BEAU: I added class="right" to the <TD> to make them align right as they were before. Do you know a better way? */ 51 57 /*float: right;*/ … … 216 222 { 217 223 vertical-align: top; 218 padding -right: 6px;224 padding: 8px 6px 0 0 ; 219 225 } 220 226 -
trunk/css/utilities.inc.css
r19 r20 15 15 { 16 16 color: #000; 17 margin: 0 4px0 0;17 margin: 0 0.5em 0 0; 18 18 padding: 0; 19 19 } … … 23 23 { 24 24 font-weight: bold; 25 margin: 1px; 26 } 27 28 /* BEAU: Should be in EMs? Also, sometimes it is nice to have the select menu be only the width as its contents. How to override this? */ 29 select 30 { 31 width: 250px; 32 margin: 4px 4px 0 0; 25 margin: 0.5em; 33 26 } 34 27 35 28 input 36 29 { 37 margin: 4px 4px0 0;30 margin: 0.5em 0.5em 0 0; 38 31 } 39 32 … … 46 39 BEAU: I want more text box widths! I find need for boxes that fit 5em, 10em, 20em, and 40em widths. These should be in EMs so text can resize and still fit. Since it is useful to apply a width to other form elements to have them similar sizes (not always a text box, such as <select multiple>) I propose renaming them to "input.tiny", "input.small", "input.medium", "input.large", and "input.half" (not sure how you would do "half" in EMs however. 47 40 */ 48 input.t ext, textarea.text41 input.tiny, textarea.tiny 49 42 { 50 width: 250px;43 width: 5em; 51 44 } 52 45 53 input. textsmall, textarea.textsmall46 input.small, textarea.small 54 47 { 55 width: 150px;48 width: 10em; 56 49 } 57 50 58 input. texthalf, textarea.texthalf51 input.medium, textarea.medium 59 52 { 60 width: 121px; 61 /* 125 minus 4 to account for the 4px padding on the right */ 53 width: 20.5em; 54 } 55 56 input.large, textarea.large 57 { 58 width: 41.5em; 62 59 } 63 60 … … 67 64 } 68 65 69 /* BEAU: Again, here, "small", "medium", "large" denominations make sense. But how to diferentiate width from height? */ 70 textarea.twoliner 66 textarea.twolines 71 67 { 72 68 height: 3em; 73 69 } 74 70 75 textarea. paragraphs71 textarea.short 76 72 { 77 height: 20em; 73 height: 8em; 74 } 75 76 textarea.tall 77 { 78 height: 25em; 79 } 80 81 textarea.fullscreen 82 { 83 height: 40em; 84 } 85 86 /* BEAU: Should be in EMs? Also, sometimes it is nice to have the select menu be only the width as its contents. How to override this? */ 87 select.small 88 { 89 width: 10em; 90 } 91 92 select.medium 93 { 94 width: 20.5em; 78 95 } 79 96 -
trunk/docs/coding_standards.txt
r19 r20 296 296 value in HTML, the parameter name is the value. For example: 297 297 298 <input type="checkbox" checked="checked" >298 <input type="checkbox" checked="checked" /> 299 299 <select name="example"> 300 300 <option selected="selected" value="1">Example</option> -
trunk/lib/App.inc.php
r19 r20 29 29 // Instance of database object. 30 30 var $db; 31 32 // Array of query arguments will be carried persistently between requests. 33 var $_carry_queries = array(); 31 34 32 35 // Hash of global application parameters. … … 47 50 'ssl_enabled' => false, 48 51 49 // Character set for page output. Set in the Content-Type header and anHTML <meta content-type> tag.52 // Character set for page output. Used in the Content-Type header and the HTML <meta content-type> tag. 50 53 'character_set' => 'utf-8', 51 54 … … 534 537 535 538 /** 539 * Sets which query arguments will be carried persistently between requests. 540 * Values in the _carry_queries array will be copied to URLs (via oHREF()) and 541 * to hidden input values (via printHiddenSession()). 542 * 543 * @access public 544 * @param string $query_key The key of the query argument to save. 545 * @author Quinn Comendant <quinn@strangecode.com> 546 * @since 14 Nov 2005 19:24:52 547 */ 548 function carryQuery($query_key) 549 { 550 if (!isset($this) || !is_a($this, 'App')) { 551 $this =& App::getInstance(); 552 } 553 554 // If not already set, and there is a non-empty value provided in the request... 555 if (!isset($this->_carry_queries[$query_key]) && getFormData($query_key, false)) { 556 // Copy the value of the specified query argument into the _carry_queries array. 557 $this->_carry_queries[$query_key] = getFormData($query_key); 558 } 559 } 560 561 /** 536 562 * Outputs a fully qualified URL with a query of all the used (ie: not empty) 537 563 * keys and values, including optional queries. This allows simple printing of 538 564 * links without needing to know which queries to add to it. If cookies are not 539 565 * used, the session id will be propogated in the URL. 540 *541 * @global string $carry_queries An array of keys to define which values to542 * carry through from the POST or GET.543 * $carry_queries = array('qry'); for example.544 566 * 545 567 * @param string $url The initial url … … 565 587 return false; 566 588 } 567 568 static $_using_trans_sid; 569 global $carry_queries; 570 571 // Save the trans_sid setting. 572 if (!isset($_using_trans_sid)) { 573 $_using_trans_sid = ini_get('session.use_trans_sid'); 574 } 575 576 // Initialize the carried queries. 577 if (!isset($carry_queries['_carry_queries_init'])) { 578 if (!is_array($carry_queries)) { 579 $carry_queries = array($carry_queries); 580 } 581 $tmp = $carry_queries; 582 $carry_queries = array(); 583 foreach ($tmp as $key) { 584 if (!empty($key) && getFormData($key, false)) { 585 $carry_queries[$key] = getFormData($key); 586 } 587 } 588 $carry_queries['_carry_queries_init'] = true; 589 } 590 591 // Get any additional query arguments to add to the $carry_queries array. 592 // If FALSE is a function argument, DO NOT carry the queries. 589 590 // Get any provided query arguments to include in the final URL. 591 // If FALSE is a provided here, DO NOT carry the queries. 593 592 $do_carry_queries = true; 594 593 $one_time_carry_queries = array(); … … 611 610 } 612 611 } 613 612 614 613 // Get the first delimiter that is needed in the url. 615 614 $delim = preg_match('/\?/', $url) ? ini_get('arg_separator.output') : '?'; … … 617 616 $q = ''; 618 617 if ($do_carry_queries) { 619 // Join the perm and temp carry_queries and filter out the _carry_queries_init element for the final query args.620 $query_args = array_diff_assoc(urlEncodeArray(array_merge($carry_queries, $one_time_carry_queries)), array('_carry_queries_init' => true));618 // Join the global _carry_queries and local one_time_carry_queries. 619 $query_args = urlEncodeArray(array_merge($this->_carry_queries, $one_time_carry_queries)); 621 620 foreach ($query_args as $key=>$val) { 622 621 // Check value is set and value does not already exist in the url. … … 648 647 && 649 648 ( 650 ! $_using_trans_sid649 !ini_get('session.use_trans_sid') 651 650 || preg_match('!^(http|https)://!i', $url) 652 651 ) … … 668 667 * as hidden form elements for GET_VARS that might be in use. 669 668 * 670 * @global string $carry_queries An array of keys to define which values to671 * carry through from the POST or GET.672 * $carry_queries = array('qry'); for example673 *674 669 * @param mixed $carry_args Additional url arguments to carry in the query, 675 670 * or FALSE to prevent carrying queries. Can be any of the following formats: … … 679 674 */ 680 675 function printHiddenSession($carry_args=null) 681 { 676 { 682 677 if (!isset($this) || !is_a($this, 'App')) { 683 678 $this =& App::getInstance(); … … 687 682 return false; 688 683 } 689 690 static $_using_trans_sid; 691 global $carry_queries; 692 693 // Save the trans_sid setting. 694 if (!isset($_using_trans_sid)) { 695 $_using_trans_sid = ini_get('session.use_trans_sid'); 696 } 697 698 // Initialize the carried queries. 699 if (!isset($carry_queries['_carry_queries_init'])) { 700 if (!is_array($carry_queries)) { 701 $carry_queries = array($carry_queries); 702 } 703 $tmp = $carry_queries; 704 $carry_queries = array(); 705 foreach ($tmp as $key) { 706 if (!empty($key) && getFormData($key, false)) { 707 $carry_queries[$key] = getFormData($key); 708 } 709 } 710 $carry_queries['_carry_queries_init'] = true; 711 } 712 713 // Get any additional query names to add to the $carry_queries array 714 // that are found as function arguments. 715 // If FALSE is a function argument, DO NOT carry the queries. 684 685 // Get any provided query arguments to include in the final hidden form data. 686 // If FALSE is a provided here, DO NOT carry the queries. 716 687 $do_carry_queries = true; 717 688 $one_time_carry_queries = array(); … … 737 708 // For each existing POST value, we create a hidden input to carry it through a form. 738 709 if ($do_carry_queries) { 739 // Join the perm and temp carry_queries and filter out the _carry_queries_init element for the final query args. 740 $query_args = array_diff_assoc(urlEncodeArray(array_merge($carry_queries, $one_time_carry_queries)), array('_carry_queries_init' => true)); 710 // Join the global _carry_queries and local one_time_carry_queries. 711 // urlencode is not used here, not for form data! 712 $query_args = array_merge($this->_carry_queries, $one_time_carry_queries); 741 713 foreach ($query_args as $key=>$val) { 742 714 echo '<input type="hidden" name="' . $key . '" value="' . $val . '" />'; … … 745 717 746 718 // Include the SID if cookies are disabled. 747 if (!isset($_COOKIE[session_name()]) && ! $_using_trans_sid) {719 if (!isset($_COOKIE[session_name()]) && !ini_get('session.use_trans_sid')) { 748 720 echo '<input type="hidden" name="' . session_name() . '" value="' . session_id() . '" />'; 749 721 } -
trunk/lib/PayPal.inc.php
r19 r20 188 188 if (!in_array($key, array('button_url', 'link_url', 'submit_img', 'submit_text'))) { 189 189 ?> 190 <input type="hidden" name="<?php echo $key; ?>" value="<?php echo $val; ?>" >190 <input type="hidden" name="<?php echo $key; ?>" value="<?php echo $val; ?>" /> 191 191 <?php 192 192 } … … 194 194 } 195 195 ?> 196 <input type="image" src="<?php echo $this->_buttons[$name]['options']['submit_img']; ?>" border="0" name="submit" alt="<?php echo $this->_buttons[$name]['options']['submit_text']; ?>" >196 <input type="image" src="<?php echo $this->_buttons[$name]['options']['submit_img']; ?>" border="0" name="submit" alt="<?php echo $this->_buttons[$name]['options']['submit_text']; ?>" /> 197 197 </form> 198 198 <?php -
trunk/lib/RecordLock.inc.php
r19 r20 345 345 <?php if ($this->getSecondsElapsed() > $this->getParam('timeout')) { ?> 346 346 <p><?php printf(_("You can forcibly unlock the record if you believe the editing session has expired. You might want to confirm with %s before doing this."), $this->getEditor()) ?></p> 347 <input type="submit" class="formsubmitbutton" name="unlock" value="<?php echo _("Unlock"); ?>" >347 <input type="submit" class="formsubmitbutton" name="unlock" value="<?php echo _("Unlock"); ?>" /> 348 348 <?php } ?> 349 349 350 <input type="submit" class="formsubmitbutton" name="cancel" value="<?php echo _("Cancel"); ?>" >350 <input type="submit" class="formsubmitbutton" name="cancel" value="<?php echo _("Cancel"); ?>" /> 351 351 </form> 352 352 <?php -
trunk/lib/RecordVersion.inc.php
r19 r20 40 40 { 41 41 static $instances = array(); 42 43 if (!is_a($auth_object, 'Auth_SQL')) {44 trigger_error('Constructor not provided a valid Auth_SQL object.', E_USER_ERROR);45 }46 42 47 43 if (!isset($instances[$auth_object->getVal('auth_name')])) { … … 60 56 { 61 57 if (!is_a($auth_object, 'Auth_SQL')) { 62 trigger_error('Passed argument is nota valid Auth_SQL object.', E_USER_ERROR);58 trigger_error('Constructor not provided a valid Auth_SQL object.', E_USER_ERROR); 63 59 } 64 60 -
trunk/lib/SortOrder.inc.php
r19 r20 15 15 * 16 16 * @author Quinn Comendant <quinn@strangecode.com> 17 * @version 1.6 17 * @version 1.6.1 18 18 */ 19 19 require_once dirname(__FILE__) . '/App.inc.php'; … … 26 26 var $sort_by; 27 27 var $order; 28 var $asc_widget ;29 var $desc_widget ;28 var $asc_widget = '<img src="/admin/_widgets/sort_ascending.gif" alt="" width="11" height="7" border="0">'; 29 var $desc_widget = '<img src="/admin/_widgets/sort_descending.gif" alt="" width="11" height="7" border="0">'; 30 30 var $default_sort; 31 31 var $default_order; … … 41 41 function SortOrder($default_sort = '', $default_order = '') 42 42 { 43 $this->asc_widget = '<img src="/_widgets/sort_ascending.gif" alt="" width="11" height="7" border="0">';44 $this->desc_widget = '<img src="/_widgets/sort_descending.gif" alt="" width="11" height="7" border="0">';45 46 43 $this->setDefault($default_sort, $default_order); 47 44 … … 146 143 } 147 144 148 if (!empty($this->_columns[strtolower($this->sort_by)][strtolower( strtolower($this->order))])) {149 return ' ORDER BY ' . addslashes($this->_columns[strtolower($this->sort_by)][strtolower( strtolower($this->order))]);145 if (!empty($this->_columns[strtolower($this->sort_by)][strtolower($this->order)])) { 146 return ' ORDER BY ' . addslashes($this->_columns[strtolower($this->sort_by)][strtolower($this->order)]); 150 147 } else { 151 148 App::logMsg(sprintf('Could not find SQL to sort by %s %s.', $this->sort_by, $this->order), LOG_WARNING, __FILE__, __LINE__); -
trunk/lib/SpellCheck.inc.php
r19 r20 346 346 ?> 347 347 </select> 348 <input type="text" name="spelling_corrections[<?php echo $form_name ?>][<?php echo $i ?>]" value="<?php echo $original_word ?>" size="20" >348 <input type="text" name="spelling_corrections[<?php echo $form_name ?>][<?php echo $i ?>]" value="<?php echo $original_word ?>" size="20" /> 349 349 <?php if ($this->_use_personal_wordlist) { ?> 350 350 <input name="save_to_personal_wordlist[]" type="checkbox" value="<?php echo $i ?>" /><?php echo _("Learn spelling") ?> -
trunk/lib/Upload.inc.php
r19 r20 3 3 * Upload.inc.php 4 4 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information 5 */ 6 7 /** 5 * 8 6 * The Upload class provides an interface to deal with http uploaded files. 9 7 * 10 8 * @author Quinn Comendant <quinn@strangecode.com> 11 9 * @requires App.inc.php 12 * @version 1. 010 * @version 1.2 13 11 */ 14 12 … … 19 17 // General object parameters. 20 18 var $_params = array( 19 20 // Display message with raiseMsg? 21 21 'display_messages' => true, 22 23 // Existing files will be overwritten when there is a name conflict? 22 24 'allow_overwriting' => false, 25 26 // The filesystem path to the final upload directory. 27 'upload_path' => null, 28 29 // The file permissions of the uploaded files. Remember, files will be owned by the web server user. 30 'dest_file_perms' => 0600, 31 32 // Require file to have one of the following file extentions. 33 'valid_file_extensions' => array('jpg', 'jpeg', 'gif', 'png', 'pdf', 'txt', 'text', 'html', 'htm'), 23 34 ); 24 25 // Disk path where new image(s) will be uploaded.26 var $upload_directory_path = null;27 35 28 36 // Array of files with errors. 29 37 var $errors = array(); 30 31 // Array of acceptable file extensions (lowercase). 32 var $valid_file_extensions = array('jpg', 'jpeg', 'gif', 'png', 'pdf', 'txt', 'text', 'html', 'htm'); 33 34 // The uploaded files will normally be owned by user 'apache'. Set world-read/write 35 // if the website admin needs to read/delete these files. 36 var $dest_file_perms = 0600; 37 38 38 39 // Array of file extensions and corresponding mime-types. 39 40 var $mime_extension_map = array( … … 223 224 { 224 225 if (isset($params) && is_array($params)) { 226 227 // Enforce valid upload_path parameter. 228 if (isset($params['upload_path'])) { 229 $params['upload_path'] = realpath($params['upload_path']); 230 // Must be directory. 231 if (!is_dir($params['upload_path'])) { 232 App::logMsg(sprintf('Upload directory invalid: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__); 233 trigger_error(sprintf('Upload directory invalid: %s', $params['upload_path']), E_USER_ERROR); 234 } 235 // Must be writable. 236 if (!is_writable($params['upload_path'])) { 237 App::logMsg(sprintf('Upload directory not writable: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__); 238 trigger_error(sprintf('Upload directory not writable: %s', $params['upload_path']), E_USER_ERROR); 239 } 240 // Set the default upload path, stripping any extra slashes if needed. 241 $params['upload_path'] = preg_replace('!/+$!', '', $params['upload_path']); 242 } 243 225 244 // Merge new parameters with old overriding only those passed. 226 245 $this->_params = array_merge($this->_params, $params); … … 250 269 * 251 270 */ 252 function setUploadPath($path)253 {254 $path = realpath($path);255 256 if (!is_dir($path)) {257 App::logMsg(sprintf('Upload directory invalid: %s', $path), LOG_ERR, __FILE__, __LINE__);258 }259 if (!is_writable($path)) {260 App::logMsg(sprintf('Upload directory not writable: %s', $path), LOG_ERR, __FILE__, __LINE__);261 }262 263 // Set the default upload path, stripping any extra slashes if needed.264 $this->upload_directory_path = preg_replace('!/+$!', '', $path);265 }266 267 /**268 *269 */270 271 function process($form_name, $custom_file_name=null) 271 272 { 272 273 // Ensure we have a upload directory. 273 if (! isset($this->upload_directory_path)) {274 if (!$this->getParam('upload_path')) { 274 275 App::logMsg(sprintf('Upload directory not set before processing.'), LOG_ERR, __FILE__, __LINE__); 275 276 $this->raiseMsg(_("There was a problem with the file upload. Please try again later."), MSG_ERR, __FILE__, __LINE__); … … 364 365 365 366 // Check to be sure the file has a valid file extension. 366 if (!in_array(strtolower($this->getFilenameExtension($files['name'][$i])), $this-> valid_file_extensions)) {367 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading: it is an unrecognized type. Files must have one of the following file extensions: %s."), $files['name'][$i], join(', ', $this-> valid_file_extensions)), MSG_ERR, __FILE__, __LINE__);367 if (!in_array(strtolower($this->getFilenameExtension($files['name'][$i])), $this->getParam('valid_file_extensions'))) { 368 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading: it is an unrecognized type. Files must have one of the following file extensions: %s."), $files['name'][$i], join(', ', $this->getParam('valid_file_extensions'))), MSG_ERR, __FILE__, __LINE__); 368 369 App::logMsg(sprintf(_("The uploaded file %s has an unrecognized file extension."), $files['name'][$i]), LOG_WARNING, __FILE__, __LINE__); 369 370 $this->errors[] = $files['name'][$i]; … … 417 418 418 419 // Set the path and file name. 419 $file_path_name = $this-> upload_directory_path. '/' . $file_name;420 $file_path_name = $this->getParam('upload_path') . '/' . $file_name; 420 421 421 422 // Move the file to the final place. 422 423 if (move_uploaded_file($files['tmp_name'][$i], $file_path_name)) { 423 chmod($file_path_name, $this-> dest_file_perms);424 chmod($file_path_name, $this->getParam('dest_file_perms')); 424 425 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> uploaded successfully."), $files['name'][$i]), MSG_SUCCESS, __FILE__, __LINE__); 425 426 if (!isset($custom_file_name) && $files['name'][$i] != $file_name) { … … 449 450 { 450 451 // Ensure we have a upload directory. 451 if (! isset($this->upload_directory_path)) {452 if (!$this->getParam('upload_path')) { 452 453 App::logMsg(sprintf('Upload directory not set before processing.'), LOG_ERR, __FILE__, __LINE__); 453 454 return false; 454 455 } 455 456 456 $file_path_name = $this-> upload_directory_path. '/' . $file_name;457 $file_path_name = $this->getParam('upload_path') . '/' . $file_name; 457 458 458 459 if (!is_file($file_path_name)) { … … 474 475 { 475 476 // Ensure we have an upload directory. 476 if (! isset($this->upload_directory_path)) {477 if (!$this->getParam('upload_path')) { 477 478 App::logMsg(sprintf('Upload directory not set before processing.'), LOG_ERR, __FILE__, __LINE__); 478 479 return false; 479 480 } 480 481 481 $old_file_path_name = $this-> upload_directory_path. '/' . $old_name;482 $new_file_path_name = $this-> upload_directory_path. '/' . $new_name;482 $old_file_path_name = $this->getParam('upload_path') . '/' . $old_name; 483 $new_file_path_name = $this->getParam('upload_path') . '/' . $new_name; 483 484 if (file_exists($old_file_path_name)) { 484 if (!rename($old_file_path_name, $new_file_path_name)) { 485 if (rename($old_file_path_name, $new_file_path_name)) { 486 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> has been renamed to <strong>%s</strong>."), basename($old_file_path_name), basename($new_file_path_name)), MSG_NOTICE, __FILE__, __LINE__); 487 App::logMsg(sprintf('File renamed from %s to %s', $old_file_path_name, $new_file_path_name), LOG_DEBUG, __FILE__, __LINE__); 488 } else { 485 489 $this->raiseMsg(sprintf(_("Error renaming file to %s"), $new_file_path_name), MSG_ERR, __FILE__, __LINE__); 486 490 App::logMsg(sprintf(_("Error renaming file to %s"), $new_file_path_name), LOG_ERR, __FILE__, __LINE__); … … 500 504 { 501 505 // Ensure we have a upload directory. 502 if (! isset($this->upload_directory_path)) {506 if (!$this->getParam('upload_path')) { 503 507 App::logMsg(sprintf('Upload directory not set before processing.'), LOG_ERR, __FILE__, __LINE__); 504 508 return false; 505 509 } 506 510 507 return file_exists($this->upload_directory_path . '/' . $file_name); 511 return file_exists($this->getParam('upload_path') . '/' . $file_name); 512 } 513 514 /** 515 * Get filename by glob pattern. Searches a directory for an image that matches the 516 * specified glob pattern and returns the filename of the first file found. 517 * 518 * @access public 519 * @param string $pattern Pattern to match filename. 520 * @return string filename on success, empty string on failure. 521 * @author Quinn Comendant <quinn@strangecode.com> 522 * @since 15 Nov 2005 20:55:22 523 */ 524 function getFilenameGlob($pattern) 525 { 526 $file_list = glob(sprintf('%s/%s', $this->getParam('upload_path'), $pattern)); 527 if (isset($file_list[0])) { 528 return basename($file_list[0]); 529 } else { 530 return ''; 531 } 508 532 } 509 533 -
trunk/lib/Utilities.inc.php
r19 r20 298 298 } 299 299 } else { 300 // We've come to the last dimention of the array, save the "array" and it 's value.300 // We've come to the last dimention of the array, save the "array" and its value. 301 301 $args[$prefix] = urlencode($data); 302 302 } -
trunk/services/admins.php
r19 r20 53 53 $page->setPageNumber(getFormData('page_number')); 54 54 55 // Search limiters retain their values between page requests. 56 App::carryQuery('search_query'); 57 55 58 56 59 /****************************************************************************** … … 60 63 // We may want to use the add/edit interface from another script, so this 61 64 // allows us to remember which page we came from so we can go back there. 62 if (getFormData('boomerang', false) ) {65 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) { 63 66 App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'admins'); 64 67 } … … 380 383 381 384 // Create version. 382 $version = new RecordVersion($GLOBALS['auth']);385 $version = RecordVersion::getInstance($GLOBALS['auth']); 383 386 $version->create('admin_tbl', 'admin_id', $last_insert_id, $frm['username']); 384 387 … … 420 423 421 424 // Create version. 422 $version = new RecordVersion($GLOBALS['auth']);425 $version = RecordVersion::getInstance($GLOBALS['auth']); 423 426 $version->create('admin_tbl', 'admin_id', $frm['admin_id'], $frm['username']); 424 427 … … 450 453 "; 451 454 } 452 }453 454 if (getFormData('search_query', false)) {455 // Search query.456 $where_clause = $search_where_clause;457 }458 if (getFormData('filter_admin_user_type', false)) {459 // Limit by filter.460 $where_clause .= (empty($where_clause) ? 'WHERE' : 'AND') . " user_type = '" . addslashes(getFormData('filter_admin_user_type')) . "'";461 455 } 462 456 -
trunk/services/lock.php
r19 r20 11 11 App::sslOn(); 12 12 13 if (getFormData('boomerang', false) ) {13 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) { 14 14 // We remember which page we came from so we can go back there. 15 15 $boom_url = strpos(getFormData('boomerang'), '/') !== false ? getFormData('boomerang') : $_SERVER['HTTP_REFERER']; -
trunk/services/login.php
r19 r20 5 5 */ 6 6 7 if (getFormData('boomerang', false) ) {7 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) { 8 8 // We remember which page we came from so we can go back there. 9 9 App::setBoomerangURL($_SERVER['HTTP_REFERER']); -
trunk/services/password.php
r19 r20 1 1 <?php 2 2 /** 3 * passw d.php3 * password.php 4 4 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information 5 5 */ … … 25 25 *****************************************************************************/ 26 26 27 if (getFormData('boomerang', false) ) {27 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) { 28 28 // We remember which page we came from so we can go back there. 29 App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'admin_passw d');29 App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'admin_password'); 30 30 } 31 31 App::sslOn(); … … 57 57 App::logMsg(sprintf(_("Password change successful for %s"), $auth->getVal('username')), LOG_INFO, __FILE__, __LINE__); 58 58 App::raiseMsg(sprintf(_("Password change successful for %s"), $auth->getVal('username')), MSG_SUCCESS, __FILE__, __LINE__); 59 App::dieBoomerangURL('admin_passw d');59 App::dieBoomerangURL('admin_password'); 60 60 } 61 61 break; … … 64 64 // Templates. 65 65 include 'header.ihtml'; 66 include 'codebase/services/templates/passw d.ihtml';66 include 'codebase/services/templates/password.ihtml'; 67 67 include 'footer.ihtml'; 68 68 -
trunk/services/templates/admin_form.ihtml
r19 r20 3 3 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> 4 4 <?php App::printHiddenSession(); ?> 5 <input type="hidden" name="op" value="<?php echo $frm['new_op']; ?>" >6 <input type="hidden" name="admin_id" value="<?php echo $frm['admin_id']; ?>" >7 <input type="hidden" name="old_username" value="<?php echo $frm['old_username']; ?>" >5 <input type="hidden" name="op" value="<?php echo $frm['new_op']; ?>" /> 6 <input type="hidden" name="admin_id" value="<?php echo $frm['admin_id']; ?>" /> 7 <input type="hidden" name="old_username" value="<?php echo $frm['old_username']; ?>" /> 8 8 9 9 <table> … … 13 13 </tr> 14 14 <tr> 15 <td class=" formlabel" align="right" valign="top"<?php $fv->err('username', ' class="error"') ?>><?php echo _("Username"); ?></td>15 <td class="right"><label for="username"<?php $fv->err('username', ' class="error"') ?>><?php echo _("Username"); ?></label></td> 16 16 <td valign="top"> 17 <input type="text" class=" forminputtext" size="50" name="username" value="<?php echo oTxt($frm['username']); ?>">17 <input type="text" class="small" size="50" name="username" value="<?php echo oTxt($frm['username']); ?>" /> 18 18 </td> 19 19 </tr> 20 20 <tr> 21 <td class=" formlabel" align="right" valign="top"<?php $fv->err('userpass', ' class="error"') ?>><?php echo _("Password"); ?></td>21 <td class="right"><label for="userpass"<?php $fv->err('userpass', ' class="error"') ?>><?php echo _("Password"); ?></label></td> 22 22 <td valign="top"> 23 <input type="password" class=" forminputtext" size="50" name="userpass" value="<?php echo oTxt($frm['userpass']); ?>">23 <input type="password" class="small" size="50" name="userpass" value="<?php echo oTxt($frm['userpass']); ?>" /> 24 24 </td> 25 25 </tr> 26 26 <tr> 27 <td class=" formlabel" align="right" valign="top"<?php $fv->err('first_name', ' class="error"') ?>><?php echo _("First name"); ?></td>27 <td class="right"><label for="first_name"<?php $fv->err('first_name', ' class="error"') ?>><?php echo _("First name"); ?></label></td> 28 28 <td valign="top"> 29 <input type="text" class=" forminputtext" size="50" name="first_name" value="<?php echo oTxt($frm['first_name']); ?>">29 <input type="text" class="small" size="50" name="first_name" value="<?php echo oTxt($frm['first_name']); ?>" /> 30 30 </td> 31 31 </tr> 32 32 <tr> 33 <td class=" formlabel" align="right" valign="top"<?php $fv->err('last_name', ' class="error"') ?>><?php echo _("Last name"); ?></td>33 <td class="right"><label for="last_name"<?php $fv->err('last_name', ' class="error"') ?>><?php echo _("Last name"); ?></label></td> 34 34 <td valign="top"> 35 <input type="text" class=" forminputtext" size="50" name="last_name" value="<?php echo oTxt($frm['last_name']); ?>">35 <input type="text" class="small" size="50" name="last_name" value="<?php echo oTxt($frm['last_name']); ?>" /> 36 36 </td> 37 37 </tr> 38 38 <tr> 39 <td class=" formlabel" align="right" valign="top"<?php $fv->err('email', ' class="error"') ?>><?php echo _("Email"); ?></td>39 <td class="right"><label for="email"<?php $fv->err('email', ' class="error"') ?>><?php echo _("Email"); ?></label></td> 40 40 <td valign="top"> 41 <input type="text" class=" forminputtext" size="50" name="email" value="<?php echo oTxt($frm['email']); ?>">41 <input type="text" class="medium" size="50" name="email" value="<?php echo oTxt($frm['email']); ?>" /> 42 42 </td> 43 43 </tr> 44 44 <tr> 45 <td class=" formlabel" align="right" valign="top"<?php $fv->err('user_type', ' class="error"') ?>><?php echo _("User type"); ?></td>45 <td class="right"><label for="user_type"<?php $fv->err('user_type', ' class="error"') ?>><?php echo _("User type"); ?></label></td> 46 46 <td valign="top"> 47 <select name="user_type" >47 <select name="user_type" class="small"> 48 48 <?php printSetSelectForm('admin_tbl', 'user_type', $frm['user_type'], true); ?> 49 49 </select> -
trunk/services/templates/admin_list.ihtml
r19 r20 2 2 <?php $fv->printErrorMessages(); ?> 3 3 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> 4 <?php $carry_queries = array('search_query', 'filter_admin_user_type'); ?>5 4 <?php App::printHiddenSession(false); ?> 6 5 <div id="commandbox"> … … 8 7 <br /> 9 8 10 <input type="text" class="forminputtext" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" title="<?php echo oTxt(_("Fields searched: Admin id, Username, Userpass, First name, Last name, Email, User type, Login abuse exempt, Blocked, Blocked reason, Abuse warning level, Seconds online, Last login datetime, Last access datetime, Last login ip, Added by user id, Modified by user id, Added datetime, Modified datetime.")); ?>" /> 11 <!-- 12 <select name="filter_<##>"> 13 <?php // printSelectForm('<##>_tbl', "CONCAT(<##>_id, '—', city, '—', title)", '<##>_id', getFormData('filter_<##>'), array('Any <##>'), 'ORDER BY <##> ASC'); ?> 14 </select> 15 --> 9 <input type="text" class="small" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" title="<?php echo oTxt(_("Fields searched: Admin id, Username, Userpass, First name, Last name, Email, User type, Login abuse exempt, Blocked, Blocked reason, Abuse warning level, Seconds online, Last login datetime, Last access datetime, Last login ip, Added by user id, Modified by user id, Added datetime, Modified datetime.")); ?>" /> 16 10 <input type="submit" name="list" value="<?php echo _("Search"); ?>" /> 17 11 </div> -
trunk/services/templates/lock.ihtml
r19 r20 18 18 <?php if ($lock->getSecondsElapsed() > $lock->timeout) { ?> 19 19 <p><?php printf(_("You can force unlock the record if you believe the editing session has expired. You might want to confirm with before doing this."), $lock->getEditor()) ?></p> 20 <input type="submit" class="formsubmitbutton" name="unlock" value="<?php echo _("Unlock"); ?>" >20 <input type="submit" class="formsubmitbutton" name="unlock" value="<?php echo _("Unlock"); ?>" /> 21 21 <?php } ?> 22 22 23 <input type="submit" class="formsubmitbutton" name="cancel" value="<?php echo _("Cancel"); ?>" >23 <input type="submit" class="formsubmitbutton" name="cancel" value="<?php echo _("Cancel"); ?>" /> 24 24 </form> -
trunk/services/templates/log_list.ihtml
r19 r20 30 30 </table> 31 31 <?php } ?> 32 <input type="text" class=" forminputtext" size="20" name="search_query" value="<?php echo oTxt(getFormData('search_query')); ?>" title="<?php echo _("All lines in currently viewed log file are searched."); ?>" />32 <input type="text" class="small" size="20" name="search_query" value="<?php echo oTxt(getFormData('search_query')); ?>" title="<?php echo _("All lines in currently viewed log file are searched."); ?>" /> 33 33 <input type="checkbox" name="search_grep"<?php frmChecked(getFormData('search_grep')) ?> /><span class="commandtext"><?php echo _("Use Grep"); ?></span> 34 34 <input type="submit" name="list" value="<?php echo _("Search"); ?>" class="formsubmitbutton" /> -
trunk/services/templates/login_form.ihtml
r19 r20 1 1 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> 2 2 <?php App::printHiddenSession() ?> 3 <table border="0" cellspacing="0" cellpadding="4">3 <table> 4 4 <tr> 5 <td class="formlabel" align="right" valign="top"><?php echo _("Username"); ?></td> 6 <td valign="top"><input type="text" class="forminputtext" size="25" name="username" value="<?php echo oTxt($frm['username']); ?>"></td> 5 <td class="right"><label for="username"><?php echo _("Username"); ?></label></td> 6 <td valign="top"> 7 <input type="text" class="medium" size="20" name="username" value="<?php echo oTxt($frm['username']); ?>" /> 8 </td> 7 9 </tr> 8 10 <tr> 9 <td class="formlabel" align="right" valign="top"><?php echo _("Password"); ?></td> 10 <td valign="top"><input type="password" class="forminputtext" size="25" name="password" value="<?php echo oTxt($frm['password']); ?>"></td> 11 <td class="right"><label for="password"><?php echo _("Password"); ?></label></td> 12 <td valign="top"> 13 <input type="password" class="medium" size="20" name="password" value="<?php echo oTxt($frm['password']); ?>" /> 14 </td> 11 15 </tr> 12 16 <tr> 13 <td class="formlabel" align="right" valign="top"> </td>14 <td valign="top">< br /><input type="submit" class="formsubmitbutton" value="<?php echo _("Login"); ?>"></td>17 <td> </td> 18 <td valign="top"><input type="submit" value="<?php echo _("Login"); ?>" /></td> 15 19 </tr> 16 20 </table> -
trunk/services/templates/password.ihtml
r19 r20 3 3 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> 4 4 <?php App::printHiddenSession() ?> 5 <input type="hidden" name="op" value="update_password" >6 <table border="0" cellspacing="0" cellpadding="4">5 <input type="hidden" name="op" value="update_password" /> 6 <table> 7 7 <tr> 8 <td class="formlabel" align="right" valign="top"<?php $fv->err('oldpassword', ' class="error"') ?>><?php echo _("Old password"); ?></td> 9 <td valign="top"><input type="password" class="forminputtext" size="25" name="oldpassword" /></td> 8 <td class="right"><label for="oldpassword"<?php $fv->err('oldpassword', ' class="error"') ?>><?php echo _("Old password"); ?></label></td> 9 <td valign="top"> 10 <input type="text" class="medium" size="50" name="oldpassword" /> 11 </td> 10 12 </tr> 11 13 <tr> 12 <td class="formlabel" align="right" valign="top"<?php $fv->err('newpassword', ' class="error"') ?>><?php echo _("New password"); ?></td> 13 <td valign="top"><input type="password" class="forminputtext" size="25" name="newpassword" /></td> 14 <td class="right"><label for="newpassword"<?php $fv->err('newpassword', ' class="error"') ?>><?php echo _("New password"); ?></label></td> 15 <td valign="top"> 16 <input type="password" class="medium" size="50" name="newpassword" /> 17 </td> 14 18 </tr> 15 19 <tr> 16 <td class="formlabel" align="right" valign="top"<?php $fv->err('newpassword2', ' class="error"') ?>><?php echo _("New password again"); ?></td> 17 <td valign="top"><input type="password" class="forminputtext" size="25" name="newpassword2" /></td> 20 <td class="right"><label for="newpassword2"<?php $fv->err('newpassword2', ' class="error"') ?>><?php echo _("New password again"); ?></label></td> 21 <td valign="top"> 22 <input type="password" class="medium" size="50" name="newpassword2" /> 23 </td> 18 24 </tr> 19 25 <tr> 20 <td class="formlabel" align="right" valign="top"> </td>21 <td valign="top">< br /><input type="submit" class="formsubmitbutton" value="<?php echo _("Change password"); ?>" /></td>26 <td> </td> 27 <td valign="top"><input type="submit" value="<?php echo _("Change password"); ?>" /></td> 22 28 </tr> 23 29 </table> -
trunk/services/templates/versions_list.ihtml
r19 r20 1 1 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> 2 2 <?php App::printHiddenSession() ?> 3 <input type="submit" class="formsubmitbutton" name="op" value="<?php echo _("Cancel"); ?>" >3 <input type="submit" class="formsubmitbutton" name="op" value="<?php echo _("Cancel"); ?>" /> 4 4 <table class="list" border="0" cellspacing="0" cellpadding="4"> 5 5 <tr> … … 31 31 </table> 32 32 <div class="help"><?php printf(_("When there are more than %s versions, those over %s days old are deleted."), $version->record_version_min_qty, $version->record_version_min_days); ?></div> 33 <input type="submit" class="formsubmitbutton" name="op" value="<?php echo _("Cancel"); ?>" >33 <input type="submit" class="formsubmitbutton" name="op" value="<?php echo _("Cancel"); ?>" /> 34 34 </form> -
trunk/services/versions.php
r19 r20 17 17 *****************************************************************************/ 18 18 19 $version = new RecordVersion($GLOBALS['auth']);19 $version = RecordVersion::getInstance($GLOBALS['auth']); 20 20 21 // These values must be kept across requests. 22 $carry_queries = array('record_table', 'record_key', 'record_val', 'version_title'); 21 // Query arguments to retain their values between page requests. 22 App::carryQuery('record_table'); 23 App::carryQuery('record_key'); 24 App::carryQuery('record_val'); 25 App::carryQuery('version_title'); 23 26 24 27 // Titles and navigation header. … … 41 44 } 42 45 43 if (getFormData('boomerang', false) ) {46 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) { 44 47 // We remember which page we came from so we can go back there. 45 48 App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'versions');
Note: See TracChangeset
for help on using the changeset viewer.