Changeset 22
- Timestamp:
- Nov 23, 2005 9:29:33 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/module_maker/form_template.cli.php
r21 r22 64 64 <tr> 65 65 <td class="right"><label for="$field"<\x3fphp \$fv->err('$field', ' class="error"') \x3f>><\x3fphp echo _("$title"); \x3f></label></td> 66 <td valign="top">66 <td> 67 67 <select name="$field" class="small"> 68 <\x3fphp printSelectForm('<##>_tbl', "CONCAT(<##>_id, '—', <##>)", '$field', \$frm['$field'], true, 'ORDER BY $field DESC'); \x3f>68 <\x3fphp printSelectForm('<##>_tbl', "CONCAT(<##>_id, '—', <##>)", '$field', \$frm['$field'], true, 'ORDER BY $field ASC'); \x3f> 69 69 </select> 70 <span class="commandtext"> 71 <span class="commanditem"><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> 72 <\x3fphp if ('' != \$frm['<##>_id']) { \x3f> 73 <span class="commanditem"><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> 74 <\x3fphp } \x3f> 75 </span> 70 76 </td> 71 77 </tr> … … 79 85 <tr> 80 86 <td class="right"><label for="$field"<\x3fphp \$fv->err('$field', ' class="error"') \x3f>><\x3fphp echo _("$title"); \x3f></label></td> 81 <td valign="top">87 <td> 82 88 <input type="file" name="$field" /> 83 89 <\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>90 <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 91 <\x3fphp } \x3f> 86 92 <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> … … 96 102 <tr> 97 103 <td class="right"><label for="$field"<\x3fphp \$fv->err('$field', ' class="error"') \x3f>><\x3fphp echo _("$title"); \x3f></label></td> 98 <td valign="top">104 <td> 99 105 <input type="password" class="medium" size="50" name="$field" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" /> 100 106 </td> … … 111 117 <tr> 112 118 <td class="right"><label for="$field"<\x3fphp \$fv->err('$field', ' class="error"') \x3f>><\x3fphp echo _("$title"); \x3f></label></td> 113 <td valign="top">119 <td> 114 120 <select name="$field"> 115 121 <\x3fphp printSetSelectForm('$db_tbl', '$field', \$frm['$field'], true); \x3f> … … 125 131 <tr> 126 132 <td class="right"><label for="$field"<\x3fphp \$fv->err('$field', ' class="error"') \x3f>><\x3fphp echo _("$title"); \x3f></label></td> 127 <td valign="top">133 <td> 128 134 <\x3fphp printSetCheckboxes('$db_tbl', '$field', \$frm['$field'], 1) \x3f> 129 135 </td> … … 156 162 <tr> 157 163 <td class="right"><label for="$field"<\x3fphp \$fv->err('$field', ' class="error"') \x3f>><\x3fphp echo _("$title"); \x3f></label></td> 158 <td valign="top">164 <td> 159 165 <textarea class="large" cols="75" rows="4" name="$field"><\x3fphp echo oTxt(\$frm['$field']); \x3f></textarea> 160 166 </td> … … 195 201 <tr> 196 202 <td class="right"><label for="$field"<\x3fphp \$fv->err('$field', ' class="error"') \x3f>><\x3fphp echo _("$title"); \x3f></label></td> 197 <td valign="top">203 <td> 198 204 <input type="text" class="medium" size="50" name="$field" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" /> 199 205 </td> -
trunk/bin/module_maker/module.cli.php
r21 r22 207 207 $search['admin_upload_insert'] = '/%ADMIN_UPLOAD_INSERT%/'; 208 208 $replace['admin_upload_insert'] = ''; 209 $search['admin_upload_insert2'] = '/%ADMIN_UPLOAD_INSERT2%/';210 $replace['admin_upload_insert2'] = '';211 209 $search['admin_upload_update'] = '/%ADMIN_UPLOAD_UPDATE%/'; 212 210 $replace['admin_upload_update'] = ''; 213 211 214 212 if ($upload_file_capability) { 213 // Form arguments 215 214 $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 215 216 // Include statement. 217 217 $replace['admin_upload_include'] = "require_once 'codebase/lib/Upload.inc.php';\n"; 218 218 219 // Config 219 220 $replace['admin_upload_config'] = <<<E_O_F 220 221 … … 230 231 E_O_F; 231 232 233 // Main init. 232 234 $replace['admin_upload_init'] = <<<E_O_F 233 235 … … 238 240 E_O_F; 239 241 242 // Delete. 240 243 $replace['admin_upload_del'] = <<<E_O_F 241 244 … … 246 249 E_O_F; 247 250 251 // Insert 1. 248 252 $replace['admin_upload_insert'] = <<<E_O_F 249 253 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; 254 // Upload files with prepended primary key. 255 \$new_file = \$upload->process('<##>', \$%PRIMARY_KEY% . '_' . getFormData('<##>')); 256 257 // If file upload errors, redirect to edit operation for the inserted record. 258 if (\$upload->anyErrors() || false === \$new_file) { 259 App::dieURL(\$_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . \$%PRIMARY_KEY%); 258 260 } 259 261 E_O_F; 260 262 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 263 // Update. 267 264 $replace['admin_upload_update'] = <<<E_O_F 268 265 269 // Upload new file .266 // Upload new files. 270 267 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. 268 // Get old file names for deletion. 269 \$old_file = \$upload->getFilenameGlob(getFormData('%PRIMARY_KEY%') . '_*'); 270 // Process new file upload with prepended primary key. 271 \$new_file = \$upload->process('<##>', getFormData('%PRIMARY_KEY%') . '_' . getFormData('<##>')); 272 if (false === \$new_file || \$upload->anyErrors()) { 273 // Upload failed. Reload form. Display errors. 278 274 \$frm =& editRecordForm(getFormData('%PRIMARY_KEY%')); 279 275 \$frm = array_merge(\$frm, getFormData()); … … 281 277 \$main_template = '%ADMIN_FORM_TEMPLATE%'; 282 278 break; 283 } 279 } else { 280 // Upload succeeded. Delete old files. 281 if ('' != \$old_file && \$old_file != \$new_file[0]['name']) { 282 \$upload->deleteFile(\$old_file); 283 } 284 } 284 285 } 285 286 E_O_F; 286 } // End if.287 } // End upload_file_capability. 287 288 288 289 -
trunk/bin/module_maker/skel/adm_form.ihtml
r21 r22 9 9 <tr> 10 10 <td> </td> 11 <td valign="top"><?php printSubmitButtons($frm['submit_buttons']); ?></td>11 <td><?php printSubmitButtons($frm['submit_buttons']); ?></td> 12 12 </tr> 13 13 %ADM_FORM_TABLE_ROWS% 14 14 <tr> 15 15 <td> </td> 16 <td valign="top"><?php printSubmitButtons($frm['submit_buttons']); ?></td>16 <td><?php printSubmitButtons($frm['submit_buttons']); ?></td> 17 17 </tr> 18 18 </table> -
trunk/bin/module_maker/skel/admin.php
r21 r22 92 92 // $auth->requireAccessClearance(ZONE_ADMIN_%NAME_UPPER%_FUNC_ADD); 93 93 if (getFormdata('cancel', false)) { 94 if (App::validBoomerangURL('%NAME_PLURAL%')) { 95 // Display boomerang page. 96 App::dieBoomerangURL('%NAME_PLURAL%'); 97 } 98 // Display default page. 94 99 App::dieURL($_SERVER['PHP_SELF']); 95 100 } … … 100 105 $nav->addPage(_("Add %ITEM_TITLE%")); 101 106 $main_template = '%ADMIN_FORM_TEMPLATE%'; 102 } else { %ADMIN_UPLOAD_INSERT%103 $%PRIMARY_KEY% = insertRecord(getFormData());%ADMIN_UPLOAD_INSERT 2%107 } else { 108 $%PRIMARY_KEY% = insertRecord(getFormData());%ADMIN_UPLOAD_INSERT% 104 109 if (getFormdata('repeat', false)) { 105 110 // Display function again. … … 122 127 if (getFormdata('cancel', false)) { 123 128 // Remove lock 124 $lock =& RecordLock::getInstance($GLOBALS['auth']);125 129 $lock->select('%DB_TBL%', '%PRIMARY_KEY%', getFormData('%PRIMARY_KEY%')); 126 130 $lock->remove(); … … 202 206 function &editRecordForm($id) 203 207 { 204 $lock =& RecordLock::getInstance($GLOBALS['auth']); 208 global $lock; 209 205 210 $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id); 206 211 if ($lock->isLocked() && !$lock->isMine()) { … … 240 245 function deleteRecord($id) 241 246 { 242 $lock =& RecordLock::getInstance($GLOBALS['auth']); 247 global $lock; 248 243 249 $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id); 244 250 if ($lock->isLocked() && !$lock->isMine()) { … … 291 297 function updateRecord($frm) 292 298 { 293 global $auth; 294 295 $lock =& RecordLock::getInstance($GLOBALS['auth']); 299 global $auth, $lock; 300 296 301 $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $frm['%PRIMARY_KEY%']); 297 302 if ($lock->isLocked() && !$lock->isMine()) { -
trunk/css/admin.inc.css
r21 r22 230 230 { 231 231 vertical-align: top; 232 padding: 8px 6px 0 0 232 padding: 8px 6px 0 0; 233 233 } 234 234 -
trunk/css/utilities.inc.css
r21 r22 10 10 11 11 /* BEAU: I format my CSS using BBEdit's Markup->CSS->Format command. Would you like to use that as well so our code looks consistant? */ 12 13 12 /*_____________________ FORMS ____________________*/ 14 13 input, select, input.submit 15 14 { 16 17 18 15 color: #000; 16 margin: 0 0.5em 0 0; 17 padding: 0; 19 18 } 20 19 … … 22 21 input.submit 23 22 { 24 25 23 font-weight: bold; 24 margin: 0.5em; 26 25 } 27 26 28 27 input 29 28 { 30 29 margin: 0.5em 0.5em 0 0; 31 30 } 32 31 33 32 form table select, form table input 34 33 { 35 34 margin-top: 0; 36 35 } 37 36 … … 39 38 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. 40 39 */ 41 input.tiny, textarea.tiny 40 41 input.tiny, textarea.tiny, select.tiny 42 42 { 43 43 width: 4.75em; 44 44 } 45 45 46 input.small, textarea.small 46 input.small, textarea.small, select.small 47 47 { 48 48 width: 10em; 49 49 } 50 50 51 input.medium, textarea.medium 51 input.medium, textarea.medium, select.medium 52 52 { 53 53 width: 20.5em; 54 54 } 55 55 56 input.large, textarea.large 56 input.large, textarea.large, select.large 57 57 { 58 58 width: 41.5em; 59 59 } 60 60 61 textarea 61 textarea.twolines, select.twolines 62 62 { 63 height: 8em;63 height: 3em; 64 64 } 65 65 66 textarea. twolines66 textarea.short, select.short 67 67 { 68 height: 3em;68 height: 8em; 69 69 } 70 70 71 textarea. short71 textarea.tall, select.tall 72 72 { 73 height: 8em;73 height: 25em; 74 74 } 75 75 76 textarea. tall76 textarea.fullscreen, select.fullscreen 77 77 { 78 height: 25em; 79 } 80 81 textarea.fullscreen 82 { 83 height: 40em; 78 height: 40em; 84 79 } 85 80 … … 97 92 form label 98 93 { 99 100 94 padding: 7px 0px 0px 0px; 95 font-weight: bold; 101 96 } 102 97 103 98 /* BEAU: We need a .formtext substitute...something like a label tag but not bold! */ 104 105 99 /*_____________________ COMMANDS ____________________*/ 106 100 #commandbox 107 101 { 108 109 110 111 102 padding: 5px; 103 margin: 0 0 .5em 0; 104 border: black 1px dotted; 105 background-color: #DDD; 112 106 } 113 107 114 108 .commanditem 115 109 { 116 117 110 margin: 0 10px 0 0; 111 white-space: nowrap; 118 112 } 119 113 120 114 .commandtext 121 115 { 122 116 padding-right: 1em; 123 117 } 124 118 125 119 .command_left 126 120 { 127 float:left; 128 121 float: left; 122 white-space: nowrap; 129 123 } 130 124 131 125 .command_right 132 126 { 133 134 135 136 float:right; 127 position: relative; 128 visibility: visible; 129 white-space: nowrap; 130 float: right; 137 131 } 138 132 … … 140 134 .nowrap 141 135 { 142 136 white-space: nowrap; 143 137 } 144 138 145 139 .clearboth 146 140 { 147 141 clear: both; 148 142 } 149 143 150 144 .center 151 145 { 152 146 text-align: center; 153 147 } 154 148 155 149 .right 156 150 { 157 151 text-align: right; 158 152 } 159 153 160 154 .padright 161 155 { 162 156 padding: 0 10px 0 0; 163 157 } 164 158 165 159 .padleft 166 160 { 167 161 padding: 0 0 0 10px; 168 162 } 169 163 170 164 .help 171 165 { 172 color: #999;173 166 color: #666; 167 font-weight: normal; 174 168 } 175 169 176 170 .monospaced 177 171 { 178 179 172 font-family: monaco, courier; 173 font-weight: normal; 180 174 } -
trunk/lib/App.inc.php
r21 r22 152 152 } 153 153 154 if (!isset($_SESSION[$this->app])) {155 $_SESSION[$this->app] = array();156 }157 158 154 // Initialize default parameters. 159 155 $this->_params = array_merge($this->_params, $this->_param_defaults); … … 296 292 session_name($this->getParam('session_name')); 297 293 298 // Start the session. Access session data using: $_SESSION['...']294 // Start the session. 299 295 session_start(); 296 297 if (!isset($_SESSION[$this->app])) { 298 // Access session data using: $_SESSION['...']. 299 // Initialize here _after_ session has started. 300 $_SESSION[$this->app] = array( 301 'messages' => array(), 302 'boomerang' => array('url'), 303 ); 304 } 300 305 } 301 306 … … 374 379 375 380 if (!in_array($type, array(MSG_NOTICE, MSG_SUCCESS, MSG_WARNING, MSG_ERR))) { 376 App::logMsg(sprintf('Invalid MSG_* type: %s', $type), LOG_DEBUG, __FILE__, __LINE__);381 $this->logMsg(sprintf('Invalid MSG_* type: %s', $type), LOG_DEBUG, __FILE__, __LINE__); 377 382 } 378 383 } … … 752 757 if (preg_match('!^/!', $url)) { 753 758 // If relative URL is given, prepend correct local hostname. 754 $my_url = parse_url($_SERVER['SCRIPT_URI']); 755 $url = sprintf('%s://%s%s', $my_url['scheme'], $my_url['host'], $url); 756 } 757 759 $scheme = 'on' == getenv('HTTPS') ? 'https' : 'http'; 760 $host = getenv('HTTP_HOST'); 761 $url = sprintf('%s://%s%s', $scheme, $host, $url); 762 } 763 758 764 $url = $this->oHREF($url, $carry_args, $always_include_sid); 759 765 … … 787 793 if (isset($id) && isset($_SESSION[$this->app]['boomerang']['url'][$id])) { 788 794 $url = $_SESSION[$this->app]['boomerang']['url'][$id]; 795 $this->logMsg(sprintf('dieBoomerangURL(%s) found: %s', $id, $url), LOG_DEBUG, __FILE__, __LINE__); 789 796 } else { 790 797 $url = end($_SESSION[$this->app]['boomerang']['url']); 791 } 792 } else if (!refererIsMe() && !preg_match('/admin_common/', getenv('SCRIPT_NAME'))) { 798 $this->logMsg(sprintf('dieBoomerangURL(%s) using: %s', $id, $url), LOG_DEBUG, __FILE__, __LINE__); 799 } 800 // Delete stored boomerang. 801 $this->deleteBoomerangURL($id); 802 } else if (!refererIsMe()) { 793 803 // Ensure that the redirecting page is not also the referrer. 794 // admin_common is an alias of 'admin', which confuses this function. Just here for local testing.795 804 $url = getenv('HTTP_REFERER'); 805 $this->logMsg(sprintf('dieBoomerangURL(%s) using referrer: %s', $id, $url), LOG_DEBUG, __FILE__, __LINE__); 796 806 } else { 797 $url = ''; 798 } 799 800 $this->logMsg(sprintf('dieBoomerangURL: %s', $url), LOG_DEBUG, __FILE__, __LINE__); 801 802 // Delete stored boomerang. 803 $this->deleteBoomerangURL($id); 807 // If URL is not specified, use the redirect_home_url. 808 $url = $this->getParam('redirect_home_url'); 809 $this->logMsg(sprintf('dieBoomerangURL(%s) not found, using redirect_home_url: %s', $id, $url), LOG_DEBUG, __FILE__, __LINE__); 810 } 811 804 812 805 813 // A redirection will never happen immediatly twice. … … 825 833 return false; 826 834 } 827 828 835 // A redirection will never happen immediatly after setting the boomerangURL. 829 836 // Set the time so ensure this doesn't happen. See App::validBoomerangURL for more. 830 837 831 if ( isset($url)&& is_string($url)) {838 if ('' != $url && is_string($url)) { 832 839 // Delete any boomerang request keys in the query string. 833 840 $url = preg_replace('/boomerang=[\w]+/', '', $url); 834 841 835 if (is _array($_SESSION[$this->app]['boomerang']['url']) && !empty($_SESSION[$this->app]['boomerang']['url'])) {842 if (isset($_SESSION[$this->app]['boomerang']['url']) && is_array($_SESSION[$this->app]['boomerang']['url']) && !empty($_SESSION[$this->app]['boomerang']['url'])) { 836 843 // If the URL currently exists in the boomerang array, delete. 837 844 while ($existing_key = array_search($url, $_SESSION[$this->app]['boomerang']['url'])) { … … 845 852 $_SESSION[$this->app]['boomerang']['url'][] = $url; 846 853 } 847 $this->logMsg(sprintf('setBoomerangURL : %s', $url), LOG_DEBUG, __FILE__, __LINE__);854 $this->logMsg(sprintf('setBoomerangURL(%s): %s', $id, $url), LOG_DEBUG, __FILE__, __LINE__); 848 855 return true; 849 856 } else { 857 $this->logMsg(sprintf('setBoomerangURL(%s) is empty!', $id, $url), LOG_NOTICE, __FILE__, __LINE__); 850 858 return false; 851 859 } … … 895 903 } 896 904 905 $this->logMsg(sprintf('deleteBoomerangURL(%s): %s', $id, $this->getBoomerangURL($id)), LOG_DEBUG, __FILE__, __LINE__); 906 897 907 if (isset($id) && isset($_SESSION[$this->app]['boomerang']['url'][$id])) { 898 908 unset($_SESSION[$this->app]['boomerang']['url'][$id]); … … 927 937 $boomerang_time = isset($_SESSION[$this->app]['boomerang']['time']) ? $_SESSION[$this->app]['boomerang']['time'] : 0; 928 938 939 $url = ''; 929 940 if (isset($id) && isset($_SESSION[$this->app]['boomerang']['url'][$id])) { 930 941 $url = $_SESSION[$this->app]['boomerang']['url'][$id]; … … 934 945 } 935 946 936 $this->logMsg(sprintf('validBoomerangURL testing url: %s', $url), LOG_DEBUG, __FILE__, __LINE__); 937 if (empty($url)) { 947 $this->logMsg(sprintf('validBoomerangURL(%s) testing: %s', $id, $url), LOG_DEBUG, __FILE__, __LINE__); 948 949 if ('' == $url) { 950 $this->logMsg(sprintf('validBoomerangURL(%s) not valid, empty!', $id), LOG_NOTICE, __FILE__, __LINE__); 938 951 return false; 939 952 } 940 953 if ($url == absoluteMe()) { 941 954 // The URL we are directing to is the current page. 942 $this->logMsg(sprintf(' Boomerang URL not valid, same as absoluteMe: %s', $url), LOG_WARNING, __FILE__, __LINE__);955 $this->logMsg(sprintf('validBoomerangURL(%s) not valid, same as absoluteMe: %s', $id, $url), LOG_NOTICE, __FILE__, __LINE__); 943 956 return false; 944 957 } 945 958 if ($boomerang_time >= (time() - 2)) { 946 959 // Last boomerang direction was more than 2 seconds ago. 947 $this->logMsg(sprintf(' Boomerang URL not valid, boomerang_time too short: %s', time() - $boomerang_time), LOG_WARNING, __FILE__, __LINE__);948 return false; 949 } 950 951 $this->logMsg(sprintf('validBoomerangURL found: %s', $url), LOG_DEBUG, __FILE__, __LINE__);960 $this->logMsg(sprintf('validBoomerangURL(%s) not valid, boomerang_time too short: %s', $id, time() - $boomerang_time), LOG_NOTICE, __FILE__, __LINE__); 961 return false; 962 } 963 964 $this->logMsg(sprintf('validBoomerangURL(%s) is valid: %s', $id, $url), LOG_DEBUG, __FILE__, __LINE__); 952 965 return true; 953 966 } -
trunk/lib/FormValidator.inc.php
r21 r22 433 433 $phone = getFormData($form_name); 434 434 435 $this->checkRegex($form_name, '/^[0-9 +().-]*$/', true, sprintf(_("The phone number <strong>%s</strong> is not valid."), $phone));436 $this->stringLength($form_name, 0, 25, sprintf(_("The phone number <strong>%s</strong> is too long"), $phone));435 return $this->checkRegex($form_name, '/^[0-9 +().-]*$/', true, sprintf(_("The phone number <strong>%s</strong> is not valid."), $phone)) 436 && $this->stringLength($form_name, 0, 25, sprintf(_("The phone number <strong>%s</strong> is too long"), $phone)); 437 437 } 438 438 -
trunk/lib/Nav.inc.php
r21 r22 148 148 149 149 if ($this->getFeature('title', $page_id)) { 150 return oTxt($this->pages[$page_id]['title'] , true);150 return oTxt($this->pages[$page_id]['title']); 151 151 } else { 152 152 return false; -
trunk/lib/PEdit.inc.php
r21 r22 163 163 ?> 164 164 <tr> 165 <td valign="top"nowrap="nowrap"><p><?php echo date('r', $v['unixtime']); ?></p></td>166 <td valign="top"nowrap="nowrap"><p> <?php printf(_("%s bytes"), $v['filesize']); ?></p></td>167 <td valign="top"nowrap="nowrap"><p> [<a href="<?php echo App::oHREF(dirname($_SERVER['PHP_SELF']) . (preg_match('!/$!', dirname($_SERVER['PHP_SELF'])) ? '' : '/') . $v['filename']); ?>" target="_blank"><?php echo _("view"); ?></a>]</p></td>168 <td valign="top"nowrap="nowrap"><p> [<a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=Restore&with_file=' . $v['filename'] . '&file_hash=' . md5('frog_guts' . $this->_filename)); ?>"><?php echo _("restore"); ?></a>]</p></td>165 <td nowrap="nowrap"><p><?php echo date('r', $v['unixtime']); ?></p></td> 166 <td nowrap="nowrap"><p> <?php printf(_("%s bytes"), $v['filesize']); ?></p></td> 167 <td nowrap="nowrap"><p> [<a href="<?php echo App::oHREF(dirname($_SERVER['PHP_SELF']) . (preg_match('!/$!', dirname($_SERVER['PHP_SELF'])) ? '' : '/') . $v['filename']); ?>" target="_blank"><?php echo _("view"); ?></a>]</p></td> 168 <td nowrap="nowrap"><p> [<a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=Restore&with_file=' . $v['filename'] . '&file_hash=' . md5('frog_guts' . $this->_filename)); ?>"><?php echo _("restore"); ?></a>]</p></td> 169 169 </tr> 170 170 <?php … … 237 237 ?> 238 238 <table border="0" cellspacing="0" cellpadding="2"><tr> 239 <td valign="top"><input type="hidden" name="data[<?php echo $name; ?>]" value="off" /><input type="checkbox" name="data[<?php echo $name; ?>]" <?php echo $checked; ?>/></td>240 <td valign="top"><?php echo oTxt($this->_data[$name]['corresponding_text']); ?></td>239 <td><input type="hidden" name="data[<?php echo $name; ?>]" value="off" /><input type="checkbox" name="data[<?php echo $name; ?>]" <?php echo $checked; ?>/></td> 240 <td><?php echo oTxt($this->_data[$name]['corresponding_text']); ?></td> 241 241 </tr></table> 242 242 <?php -
trunk/lib/RecordLock.inc.php
r21 r22 33 33 { 34 34 static $instances = array(); 35 36 if (!is_a($auth_object, 'Auth_SQL')) {37 trigger_error('Constructor not provided a valid Auth_SQL object.', E_USER_ERROR);38 }39 35 40 36 if (!isset($instances[$auth_object->getVal('auth_name')])) { … … 52 48 function RecordLock($auth_object) 53 49 { 50 if (!is_a($auth_object, 'Auth_SQL')) { 51 trigger_error('Constructor not provided a valid Auth_SQL object.', E_USER_ERROR); 52 } 53 54 54 $this->_auth = $auth_object; 55 55 … … 168 168 } 169 169 if ($this->data = mysql_fetch_assoc($qid)) { 170 App::logMsg(sprintf('Found locked record: %s %s %s', $record_table_or_lock_id, $record_key, $record_val), LOG_DEBUG, __FILE__, __LINE__); 170 App::logMsg(sprintf('Selecting %slocked record: %s %s %s', ($this->data['set_by_admin_id'] == $this->_auth->getVal('user_id') ? 'self-' : ''), $record_table_or_lock_id, $record_key, $record_val), LOG_DEBUG, __FILE__, __LINE__); 171 /// FIX ME: What if admin set lock, but public user is current lock user? 171 172 $this->data['editor'] = $this->_auth->getUsername($this->data['set_by_admin_id']); 172 173 return true; … … 275 276 WHERE lock_id = '" . addslashes($this->data['lock_id']) . "' 276 277 "); 278 279 App::logMsg(sprintf('Removing lock: %s', $this->data['lock_id']), LOG_DEBUG, __FILE__, __LINE__); 277 280 } 278 281 -
trunk/lib/Upload.inc.php
r21 r22 30 30 'dest_file_perms' => 0600, 31 31 32 // Require file to have one of the following file extentions.32 // Require file to have one of the following file name extentions. 33 33 'valid_file_extensions' => array('jpg', 'jpeg', 'gif', 'png', 'pdf', 'txt', 'text', 'html', 'htm'), 34 34 ); … … 37 37 var $errors = array(); 38 38 39 // Array of file extensions and corresponding mime-types.39 // Array of file name extensions and corresponding mime-types. 40 40 var $mime_extension_map = array( 41 41 'Z' => 'application/x-compress', … … 278 278 } 279 279 280 // Ensure the file form element specified actually exists. 280 281 if (!isset($_FILES[$form_name])) { 281 App::logMsg(sprintf(_("Form element %s not posted."), $form_name), LOG_ERR, __FILE__, __LINE__);282 $this->raiseMsg(_("There was a problem with the file upload. Please try again ."), MSG_ERR, __FILE__, __LINE__);282 App::logMsg(sprintf(_("Form element %s does not exist."), $form_name), LOG_ERR, __FILE__, __LINE__); 283 $this->raiseMsg(_("There was a problem with the file upload. Please try again later."), MSG_ERR, __FILE__, __LINE__); 283 284 return false; 284 285 } … … 314 315 } 315 316 316 // Check The php upload error messages. 317 if (UPLOAD_ERR_INI_SIZE === $files['error'][$i]) { 318 if ($this->getParam('display_messages')) { 319 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading: it exceeds the maximum allowed upload file size of %s."), $files['name'][$i], ini_get('upload_max_filesize')), MSG_ERR, __FILE__, __LINE__); 320 } 321 App::logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_INI_SIZE (currently %s)."), $files['error'][$i], $files['name'][$i], ini_get('upload_max_filesize')), LOG_ERR, __FILE__, __LINE__); 322 $this->errors[] = $files['name'][$i]; 323 continue; 324 } 325 if (UPLOAD_ERR_FORM_SIZE === $files['error'][$i]) { 326 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading: it exceeds the maximum allowed upload file size of %s."), $files['name'][$i], $_POST['MAX_FILE_SIZE']), MSG_ERR, __FILE__, __LINE__); 327 App::logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_FORM_SIZE (currently %s)."), $files['error'][$i], $files['name'][$i], $_POST['MAX_FILE_SIZE']), LOG_ERR, __FILE__, __LINE__); 328 $this->errors[] = $files['name'][$i]; 329 continue; 330 } 331 if (UPLOAD_ERR_PARTIAL === $files['error'][$i]) { 332 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading: it was only partially uploaded."), $files['name'][$i]), MSG_ERR, __FILE__, __LINE__); 333 App::logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_PARTIAL."), $files['error'][$i], $files['name'][$i]), LOG_ERR, __FILE__, __LINE__); 334 $this->errors[] = $files['name'][$i]; 335 continue; 336 } 337 if (UPLOAD_ERR_NO_FILE === $files['error'][$i]) { 338 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading: no file was uploaded."), $files['name'][$i]), MSG_ERR, __FILE__, __LINE__); 339 App::logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_NO_FILE."), $files['error'][$i], $files['name'][$i]), LOG_ERR, __FILE__, __LINE__); 340 $this->errors[] = $files['name'][$i]; 341 continue; 342 } 343 if (UPLOAD_ERR_NO_TMP_DIR === $files['error'][$i]) { 344 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading: temporary upload directory missing."), $files['name'][$i]), MSG_ERR, __FILE__, __LINE__); 345 App::logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_NO_TMP_DIR."), $files['error'][$i], $files['name'][$i]), LOG_ERR, __FILE__, __LINE__); 346 $this->errors[] = $files['name'][$i]; 347 continue; 348 } 349 350 // Check to be sure it's an uploaded file. 351 if (!is_uploaded_file($files['tmp_name'][$i])) { 352 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading."), $files['name'][$i]), MSG_ERR, __FILE__, __LINE__); 353 App::logMsg(sprintf(_("The file %s failed is_uploaded_file."), $files['name'][$i]), LOG_ERR, __FILE__, __LINE__); 354 $this->errors[] = $files['name'][$i]; 355 continue; 356 } 357 358 // Check to be sure the file is not empty. 359 if ($files['size'][$i] < 1) { 360 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading: it contains zero bytes."), $files['name'][$i]), MSG_ERR, __FILE__, __LINE__); 361 App::logMsg(sprintf(_("The uploaded file %s contains zero bytes."), $files['name'][$i]), LOG_ERR, __FILE__, __LINE__); 362 $this->errors[] = $files['name'][$i]; 363 continue; 364 } 365 366 // Check to be sure the file has a valid file extension. 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__); 369 App::logMsg(sprintf(_("The uploaded file %s has an unrecognized file extension."), $files['name'][$i]), LOG_WARNING, __FILE__, __LINE__); 370 $this->errors[] = $files['name'][$i]; 371 continue; 372 } 373 374 // Check to be sure the file has a unique file name. 375 if (!$this->getParam('allow_overwriting') && $this->exists($files['name'][$i])) { 376 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading: a file with that name already exists."), $files['name'][$i]), MSG_ERR, __FILE__, __LINE__); 377 App::logMsg(sprintf(_("The uploaded file %s doesn't have a unique filename."), $files['name'][$i]), LOG_WARNING, __FILE__, __LINE__); 378 $this->errors[] = $files['name'][$i]; 379 continue; 380 } 381 382 // Determine file name. 317 // Determine final file name. 383 318 if ($num == 1) { 384 319 // Single upload. … … 420 355 $file_path_name = $this->getParam('upload_path') . '/' . $file_name; 421 356 357 358 // Check The php upload error messages. 359 if (UPLOAD_ERR_INI_SIZE === $files['error'][$i]) { 360 if ($this->getParam('display_messages')) { 361 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading: it exceeds the maximum allowed upload file size of %s."), $file_name, ini_get('upload_max_filesize')), MSG_ERR, __FILE__, __LINE__); 362 } 363 App::logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_INI_SIZE (currently %s)."), $files['error'][$i], $file_name, ini_get('upload_max_filesize')), LOG_ERR, __FILE__, __LINE__); 364 $this->errors[] = $file_name; 365 continue; 366 } 367 if (UPLOAD_ERR_FORM_SIZE === $files['error'][$i]) { 368 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading: it exceeds the maximum allowed upload file size of %s."), $file_name, $_POST['MAX_FILE_SIZE']), MSG_ERR, __FILE__, __LINE__); 369 App::logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_FORM_SIZE (currently %s)."), $files['error'][$i], $file_name, $_POST['MAX_FILE_SIZE']), LOG_ERR, __FILE__, __LINE__); 370 $this->errors[] = $file_name; 371 continue; 372 } 373 if (UPLOAD_ERR_PARTIAL === $files['error'][$i]) { 374 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading: it was only partially uploaded."), $file_name), MSG_ERR, __FILE__, __LINE__); 375 App::logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_PARTIAL."), $files['error'][$i], $file_name), LOG_ERR, __FILE__, __LINE__); 376 $this->errors[] = $file_name; 377 continue; 378 } 379 if (UPLOAD_ERR_NO_FILE === $files['error'][$i]) { 380 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading: no file was uploaded."), $file_name), MSG_ERR, __FILE__, __LINE__); 381 App::logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_NO_FILE."), $files['error'][$i], $file_name), LOG_ERR, __FILE__, __LINE__); 382 $this->errors[] = $file_name; 383 continue; 384 } 385 if (UPLOAD_ERR_NO_TMP_DIR === $files['error'][$i]) { 386 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading: temporary upload directory missing."), $file_name), MSG_ERR, __FILE__, __LINE__); 387 App::logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_NO_TMP_DIR."), $files['error'][$i], $file_name), LOG_ERR, __FILE__, __LINE__); 388 $this->errors[] = $file_name; 389 continue; 390 } 391 392 // Check to be sure it's an uploaded file. 393 if (!is_uploaded_file($files['tmp_name'][$i])) { 394 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading."), $file_name), MSG_ERR, __FILE__, __LINE__); 395 App::logMsg(sprintf(_("The file %s failed is_uploaded_file."), $file_name), LOG_ERR, __FILE__, __LINE__); 396 $this->errors[] = $file_name; 397 continue; 398 } 399 400 // Check to be sure the file is not empty. 401 if ($files['size'][$i] < 1) { 402 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading: it contains zero bytes."), $file_name), MSG_ERR, __FILE__, __LINE__); 403 App::logMsg(sprintf(_("The uploaded file %s contains zero bytes."), $file_name), LOG_ERR, __FILE__, __LINE__); 404 $this->errors[] = $file_name; 405 continue; 406 } 407 408 // Check to be sure the file has a valid file name extension. 409 if (!in_array(strtolower($this->getFilenameExtension($file_name)), $this->getParam('valid_file_extensions'))) { 410 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading: it is an unrecognized type. Files must have one of the following file name extensions: %s."), $file_name, join(', ', $this->getParam('valid_file_extensions'))), MSG_ERR, __FILE__, __LINE__); 411 App::logMsg(sprintf(_("The uploaded file %s has an unrecognized file name extension."), $file_name), LOG_WARNING, __FILE__, __LINE__); 412 $this->errors[] = $file_name; 413 continue; 414 } 415 416 // Check to be sure the file has a unique file name. 417 if (!$this->getParam('allow_overwriting') && $this->exists($file_name)) { 418 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading: a file with that name already exists."), $file_name), MSG_ERR, __FILE__, __LINE__); 419 App::logMsg(sprintf(_("The uploaded file %s doesn't have a unique filename."), $file_name), LOG_WARNING, __FILE__, __LINE__); 420 $this->errors[] = $file_name; 421 continue; 422 } 423 422 424 // Move the file to the final place. 423 425 if (move_uploaded_file($files['tmp_name'][$i], $file_path_name)) { 424 426 chmod($file_path_name, $this->getParam('dest_file_perms')); 425 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> uploaded successfully."), $file s['name'][$i]), MSG_SUCCESS, __FILE__, __LINE__);427 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> uploaded successfully."), $file_name), MSG_SUCCESS, __FILE__, __LINE__); 426 428 if (!isset($custom_file_name) && $files['name'][$i] != $file_name) { 427 429 // Notify user if uploaded file name was modified (unless a custom file name will be used anyways). … … 435 437 continue; 436 438 } else { 437 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading."), $file s['name'][$i]), MSG_ERR, __FILE__, __LINE__);439 $this->raiseMsg(sprintf(_("The file <strong>%s</strong> failed uploading."), $file_name), MSG_ERR, __FILE__, __LINE__); 438 440 App::logMsg(sprintf(_("Moving file failed: %s -> %s"), $files['tmp_name'][$i], $file_path_name), LOG_ALERT, __FILE__, __LINE__); 439 $this->errors[] = $files['name'][$i]; 440 continue; 441 } 442 } 443 return (sizeof($new_file_names) > 0) ? $new_file_names : false; 441 $this->errors[] = $file_name; 442 continue; 443 } 444 } 445 446 // Return names of files uploaded (or empty array when none processed). 447 return $new_file_names; 444 448 } 445 449 … … 543 547 * 544 548 */ 549 function anyErrors() 550 { 551 return sizeof($this->errors) > 0; 552 } 553 554 /** 555 * 556 */ 545 557 function cleanFileName($file_name) 546 558 { … … 560 572 { 561 573 preg_match('/.*?\.(\w+)$/i', $file_name, $ext); 562 return $ext[1];574 return isset($ext[1]) ? $ext[1] : ''; 563 575 } 564 576 -
trunk/lib/Utilities.inc.php
r21 r22 532 532 * @access public 533 533 * @param string $val The string to sign. 534 * @param string $ key(Optional) A text key to use for computing the signature.534 * @param string $seed_key (Optional) A text key to use for computing the signature. 535 535 * @return string The original value with a signature appended. 536 536 */ 537 function addSignature($val, $ key=null)537 function addSignature($val, $seed_key=null) 538 538 { 539 539 if ('' == $val) { … … 541 541 } 542 542 543 if (!isset($ key)) {544 $ key = App::getParam('signing_key');545 } 546 547 return $val . '-' . substr(md5($val . $ key), 0, 18);543 if (!isset($seed_key)) { 544 $seed_key = App::getParam('signing_key'); 545 } 546 547 return $val . '-' . substr(md5($val . $seed_key), 0, 18); 548 548 } 549 549 … … 566 566 * @access public 567 567 * @param string $signed_val A value with appended signature. 568 * @param string $ key(Optional) A text key to use for computing the signature.568 * @param string $seed_key (Optional) A text key to use for computing the signature. 569 569 * @return bool True if the signature matches the var. 570 570 */ 571 function verifySignature($signed_val, $ key=null)571 function verifySignature($signed_val, $seed_key=null) 572 572 { 573 573 // Strip the value from the signed value. 574 $val = substr($signed_val, 0, strrpos($signed_val, '-'));574 $val = removeSignature($signed_val); 575 575 // If the signed value matches the original signed value we consider the value safe. 576 if ($signed_val == addSignature($val, $ key)) {576 if ($signed_val == addSignature($val, $seed_key)) { 577 577 // Signature verified. 578 578 return true; -
trunk/services/admins.php
r21 r22 101 101 case 'insert' : 102 102 if (getFormdata('cancel', false)) { 103 if (App::validBoomerangURL('admins')) { 104 // Display boomerang page. 105 App::dieBoomerangURL('admins'); 106 } 107 // Display default page. 103 108 App::dieURL($_SERVER['PHP_SELF']); 104 109 } … … 130 135 if (getFormdata('cancel', false)) { 131 136 // Remove lock 132 $lock =& RecordLock::getInstance($GLOBALS['auth']);133 137 $lock->select('admin_tbl', 'admin_id', getFormData('admin_id')); 134 138 $lock->remove(); … … 252 256 function &editRecordForm($id) 253 257 { 254 $lock =& RecordLock::getInstance($GLOBALS['auth']); 258 global $lock; 259 255 260 $lock->select('admin_tbl', 'admin_id', $id); 256 261 if ($lock->isLocked() && !$lock->isMine()) { … … 305 310 function deleteRecord($id) 306 311 { 307 global $auth; 308 309 $lock =& RecordLock::getInstance($GLOBALS['auth']); 312 global $auth, $lock; 313 310 314 $lock->select('admin_tbl', 'admin_id', $id); 311 315 if ($lock->isLocked() && !$lock->isMine()) { … … 392 396 function updateRecord($frm) 393 397 { 394 global $auth; 395 396 $lock =& RecordLock::getInstance($GLOBALS['auth']); 398 global $auth, $lock; 399 397 400 $lock->select('admin_tbl', 'admin_id', $frm['admin_id']); 398 401 if ($lock->isLocked() && !$lock->isMine()) { -
trunk/services/lock.php
r21 r22 11 11 App::sslOn(); 12 12 13 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) {13 if (getFormData('boomerang', false)) { 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']; 16 16 App::setBoomerangURL($boom_url, 'lock'); 17 App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'cancel-lock'); 17 18 } 18 19 19 $lock =& RecordLock::getInstance($GLOBALS['auth']); 20 if (!isset($lock) || !is_a($lock, 'RecordLock')) { 21 $lock =& RecordLock::getInstance($auth); 22 } 20 23 $lock->select(getFormData('lock_id')); 21 24 … … 31 34 App::dieBoomerangURL('lock'); 32 35 } else if (getFormData('cancel', false)) { 33 App::dieBoomerangURL('lock'); 36 // Since the boomerang URL will go back to the locked record, and the record was not unlocked, we must delete the boomerang URL otherwise we'll come back here. 37 App::deleteBoomerangURL('lock'); 38 App::dieBoomerangURL('cancel-lock'); 34 39 } 35 40 -
trunk/services/logout.php
r21 r22 8 8 9 9 // Delete this admin's record locks. 10 $lock =& RecordLock::getInstance($GLOBALS['auth']); 10 if (!isset($lock) || !is_a($lock, 'RecordLock')) { 11 $lock =& RecordLock::getInstance($auth); 12 } 11 13 $lock->removeAll($auth->getVal('user_id')); 12 14 -
trunk/services/logs.php
r21 r22 8 8 9 9 $auth->requireLogin(); 10 $auth->requireAccessClearance(ZONE_ADMIN_APPLOG);10 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG); 11 11 App::sslOn(); 12 12 … … 55 55 switch (getFormData('op')) { 56 56 case 'delete' : 57 $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET);57 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET); 58 58 deleteLog(Prefs::getValue('log_file', 'logs_module')); 59 59 Prefs::setValue('log_file', App::getParam('log_filename'), 'logs_module'); … … 67 67 68 68 case 'clear' : 69 $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET);69 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET); 70 70 clearLog(Prefs::getValue('log_file', 'logs_module')); 71 71 if (App::validBoomerangURL('app_log')) { … … 78 78 79 79 case 'archive' : 80 $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET);80 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET); 81 81 if (archiveLog(Prefs::getValue('log_file', 'logs_module'))) { 82 82 // Now flush current log. -
trunk/services/templates/admin_form.ihtml
r21 r22 10 10 <tr> 11 11 <td> </td> 12 <td valign="top"><?php printSubmitButtons($frm['submit_buttons']); ?></td>12 <td><?php printSubmitButtons($frm['submit_buttons']); ?></td> 13 13 </tr> 14 14 <tr> 15 15 <td class="right"><label for="username"<?php $fv->err('username', ' class="error"') ?>><?php echo _("Username"); ?></label></td> 16 <td valign="top">16 <td> 17 17 <input type="text" class="small" size="50" name="username" value="<?php echo oTxt($frm['username']); ?>" /> 18 18 </td> … … 20 20 <tr> 21 21 <td class="right"><label for="userpass"<?php $fv->err('userpass', ' class="error"') ?>><?php echo _("Password"); ?></label></td> 22 <td valign="top">22 <td> 23 23 <input type="password" class="small" size="50" name="userpass" value="<?php echo oTxt($frm['userpass']); ?>" /> 24 24 </td> … … 26 26 <tr> 27 27 <td class="right"><label for="first_name"<?php $fv->err('first_name', ' class="error"') ?>><?php echo _("First name"); ?></label></td> 28 <td valign="top">28 <td> 29 29 <input type="text" class="small" size="50" name="first_name" value="<?php echo oTxt($frm['first_name']); ?>" /> 30 30 </td> … … 32 32 <tr> 33 33 <td class="right"><label for="last_name"<?php $fv->err('last_name', ' class="error"') ?>><?php echo _("Last name"); ?></label></td> 34 <td valign="top">34 <td> 35 35 <input type="text" class="small" size="50" name="last_name" value="<?php echo oTxt($frm['last_name']); ?>" /> 36 36 </td> … … 38 38 <tr> 39 39 <td class="right"><label for="email"<?php $fv->err('email', ' class="error"') ?>><?php echo _("Email"); ?></label></td> 40 <td valign="top">40 <td> 41 41 <input type="text" class="medium" size="50" name="email" value="<?php echo oTxt($frm['email']); ?>" /> 42 42 </td> … … 44 44 <tr> 45 45 <td class="right"><label for="user_type"<?php $fv->err('user_type', ' class="error"') ?>><?php echo _("User type"); ?></label></td> 46 <td valign="top">46 <td> 47 47 <select name="user_type" class="small"> 48 48 <?php printSetSelectForm('admin_tbl', 'user_type', $frm['user_type'], true); ?> … … 52 52 <tr> 53 53 <td> </td> 54 <td valign="top"><?php printSubmitButtons($frm['submit_buttons']); ?></td>54 <td><?php printSubmitButtons($frm['submit_buttons']); ?></td> 55 55 </tr> 56 56 </table> -
trunk/services/templates/lock.ihtml
r21 r22 1 1 <?php 2 if (!is_a($lock )) {2 if (!is_a($lock, 'RecordLock')) { 3 3 return null; 4 4 } -
trunk/services/templates/login_form.ihtml
r21 r22 4 4 <tr> 5 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']); ?>" />6 <td> 7 <input type="text" class="small" size="20" name="username" value="<?php echo oTxt($frm['username']); ?>" /> 8 8 </td> 9 9 </tr> 10 10 <tr> 11 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']); ?>" />12 <td> 13 <input type="password" class="small" size="20" name="password" value="<?php echo oTxt($frm['password']); ?>" /> 14 14 </td> 15 15 </tr> 16 16 <tr> 17 17 <td> </td> 18 <td valign="top"><input type="submit" value="<?php echo _("Login"); ?>" /></td>18 <td><input type="submit" value="<?php echo _("Login"); ?>" /></td> 19 19 </tr> 20 20 </table> -
trunk/services/templates/password.ihtml
r21 r22 7 7 <tr> 8 8 <td class="right"><label for="oldpassword"<?php $fv->err('oldpassword', ' class="error"') ?>><?php echo _("Old password"); ?></label></td> 9 <td valign="top">9 <td> 10 10 <input type="text" class="medium" size="50" name="oldpassword" /> 11 11 </td> … … 13 13 <tr> 14 14 <td class="right"><label for="newpassword"<?php $fv->err('newpassword', ' class="error"') ?>><?php echo _("New password"); ?></label></td> 15 <td valign="top">15 <td> 16 16 <input type="password" class="medium" size="50" name="newpassword" /> 17 17 </td> … … 19 19 <tr> 20 20 <td class="right"><label for="newpassword2"<?php $fv->err('newpassword2', ' class="error"') ?>><?php echo _("New password again"); ?></label></td> 21 <td valign="top">21 <td> 22 22 <input type="password" class="medium" size="50" name="newpassword2" /> 23 23 </td> … … 25 25 <tr> 26 26 <td> </td> 27 <td valign="top"><input type="submit" value="<?php echo _("Change password"); ?>" /></td>27 <td><input type="submit" value="<?php echo _("Change password"); ?>" /></td> 28 28 </tr> 29 29 </table> -
trunk/services/versions.php
r21 r22 75 75 76 76 case 'restore' : 77 $lock =& RecordLock::getInstance($GLOBALS['auth']); 77 if (!isset($lock) || !is_a($lock, 'RecordLock')) { 78 $lock =& RecordLock::getInstance($auth); 79 } 78 80 $lock->select($record_table, $record_key, $record_val); 79 81 if ($lock->isLocked() && !$lock->isMine()) {
Note: See TracChangeset
for help on using the changeset viewer.