Changeset 413
- Timestamp:
- Oct 2, 2012 1:57:05 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/module_maker/module.cli.php
r412 r413 136 136 } 137 137 138 // Ensure essential directories exist. 139 if (!is_dir("$admin_dir")) { 140 die(basename($_SERVER['argv'][0]) . " Error: admin_dir '$admin_dir' directory not found.\n"); 141 } 142 if (!is_dir("$admin_tpl_dir")) { 143 die(basename($_SERVER['argv'][0]) . " Error: admin_tpl_dir '$admin_tpl_dir' directory not found.\n"); 144 } 145 if (!is_dir("$public_dir")) { 146 die(basename($_SERVER['argv'][0]) . " Error: public_dir '$public_dir' directory not found.\n"); 147 } 148 if (!is_dir("$public_tpl_dir")) { 149 die(basename($_SERVER['argv'][0]) . " Error: public_tpl_dir '$public_tpl_dir' directory not found.\n"); 138 if (!isset($_SERVER['argv'][4]) || 'var' != $_SERVER['argv'][4]) { 139 // Ensure essential directories exist, except for 'var' op. 140 if (!is_dir("$admin_dir")) { 141 die(basename($_SERVER['argv'][0]) . " Error: admin_dir '$admin_dir' directory not found.\n"); 142 } 143 if (!is_dir("$admin_tpl_dir")) { 144 die(basename($_SERVER['argv'][0]) . " Error: admin_tpl_dir '$admin_tpl_dir' directory not found.\n"); 145 } 146 if (!is_dir("$public_dir")) { 147 die(basename($_SERVER['argv'][0]) . " Error: public_dir '$public_dir' directory not found.\n"); 148 } 149 if (!is_dir("$public_tpl_dir")) { 150 die(basename($_SERVER['argv'][0]) . " Error: public_tpl_dir '$public_tpl_dir' directory not found.\n"); 151 } 150 152 } 151 153 -
trunk/docs/examples/contact_form/contact.php
r396 r413 51 51 if (!empty($_POST)) { 52 52 // Validate submitted data. 53 $fv->notEmpty('name', sprintf(_("%s cannot be blank."), _("Name"))); 54 $fv->stringLength('name', 0, 255, sprintf(_("%s must be %d-to-%d characters in length."), _("Name"), 0, 255)); 55 56 $fv->notEmpty('email', sprintf(_("%s cannot be blank."), _("Email"))); 57 $fv->stringLength('email', 0, 255, sprintf(_("%s must be %d-to-%d characters in length."), _("Email"), 0, 255)); 58 $fv->validateEmail('email'); 59 60 $fv->notEmpty('message', sprintf(_("%s cannot be blank."), _("Message"))); 61 $fv->stringLength('message', 0, 32000, sprintf(_("%s must be %d-to-%d characters in length."), _("Message"), 0, 32000)); 62 53 validateInput(); 63 54 if ($fv->anyErrors()) { 64 55 // Re-populate form values with the user data so they can make corrections. … … 68 59 $email = new Email(array( 69 60 'to' => $email_to, 70 'from' => sprintf('%s <%s>', $frm['name'], $frm['email']),61 'from' => sprintf('%s <%s>', getFormData('name'), getFormData('email')), 71 62 'subject' => 'Contact form email', 72 63 )); 73 64 $email->setTemplate('contact.eml'); 74 65 $email->replace(array( 75 'name' => $frm['name'],76 'email' => $frm['email'],77 'message' => $frm['question'],66 'name' => getFormData('name'), 67 'email' => getFormData('email'), 68 'message' => getFormData('message'), 78 69 )); 79 70 // Send email! … … 113 104 } 114 105 106 function validateInput() 107 { 108 global $fv; 109 110 $fv->notEmpty('name', sprintf(_("%s cannot be blank."), _("Name"))); 111 $fv->stringLength('name', 0, 255, sprintf(_("%s must be %d-to-%d characters in length."), _("Name"), 0, 255)); 112 113 $fv->notEmpty('email', sprintf(_("%s cannot be blank."), _("Email"))); 114 $fv->stringLength('email', 0, 255, sprintf(_("%s must be %d-to-%d characters in length."), _("Email"), 0, 255)); 115 $fv->validateEmail('email'); 116 117 $fv->notEmpty('message', sprintf(_("%s cannot be blank."), _("Message"))); 118 $fv->stringLength('message', 0, 32000, sprintf(_("%s must be %d-to-%d characters in length."), _("Message"), 0, 32000)); 119 } 120 115 121 ?> -
trunk/lib/App.inc.php
r410 r413 492 492 * Prints the HTML for displaying raised messages. 493 493 * 494 * @param string $above Additional message to print above error messages (e.g. "Oops!"). 495 * @param string $below Additional message to print below error messages (e.g. "Please fix and resubmit"). 496 * @param string $print_gotohash_js Print a line of javascript that scrolls the browser window down to view any error messages. 497 * @param string $hash The #hashtag to scroll to. 494 498 * @access public 495 499 * @author Quinn Comendant <quinn@strangecode.com> 496 500 * @since 15 Jul 2005 01:39:14 497 501 */ 498 function printRaisedMessages( )502 function printRaisedMessages($above='', $below='', $print_gotohash_js=false, $hash='sc-msg') 499 503 { 500 504 if (!$this->running) { … … 506 510 if (!empty($messages)) { 507 511 ?><div id="sc-msg" class="sc-msg"><?php 512 if ('' != $above) { 513 ?><div class="sc-above"><?php echo oTxt($above); ?></div><?php 514 } 508 515 foreach ($messages as $m) { 509 516 if (error_reporting() > 0 && $this->getParam('display_errors') && isset($m['file']) && isset($m['line'])) { … … 530 537 } 531 538 } 539 if ('' != $below) { 540 ?><div class="sc-below"><?php echo oTxt($below); ?></div><?php 541 } 532 542 ?></div><?php 543 if ($print_gotohash_js) { 544 ?> 545 <script type="text/javascript"> 546 /* <![CDATA[ */ 547 window.location.hash = '#<?php echo urlencode($hash); ?>'; 548 /* ]]> */ 549 </script> 550 <?php 551 } 533 552 } 534 553 $this->clearRaisedMessages(); -
trunk/lib/FormValidator.inc.php
r396 r413 176 176 * @param string $above Additional message to print above error messages (e.g. "Oops!"). 177 177 * @param string $below Additional message to print below error messages (e.g. "Please fix and resubmit"). 178 * @param string $print_gotohash_js Print a line of javascript that scrolls the browser window down to view any error messages. 179 * @param string $hash The #hashtag to scroll to. 178 180 * @access public 179 181 * @author Quinn Comendant <quinn@strangecode.com> 180 182 * @since 15 Jul 2005 01:39:14 181 183 */ 182 function printErrorMessages($above='', $below='' )184 function printErrorMessages($above='', $below='', $print_gotohash_js=false, $hash='sc-msg-formvalidator') 183 185 { 184 186 $app =& App::getInstance(); … … 217 219 } 218 220 ?></div><?php 221 if ($print_gotohash_js) { 222 ?> 223 <script type="text/javascript"> 224 /* <![CDATA[ */ 225 window.location.hash = '#<?php echo urlencode($hash); ?>'; 226 /* ]]> */ 227 </script> 228 <?php 229 } 219 230 } 220 231 }
Note: See TracChangeset
for help on using the changeset viewer.