Example #1
0
 /**
  * 
  * @return void
  */
 public function contact()
 {
     $this->loadModel('content');
     Loader::library('Form');
     $data = array();
     if (Input::post()) {
         Form::rule('name', 'trim|required|alpha|maxLength:100');
         Form::rule('email', 'trim|required|validEmail|maxLength:100');
         Form::rule('message', 'trim|required|maxLength:5000');
         Form::rule('captcha', 'trim|required|numeric|verifyCaptcha');
         if (Form::run() === TRUE) {
             $sendData = array('name' => Input::post('name'), 'email' => Input::post('email'), 'message' => Input::post('message'));
             $data = $this->mContent->sendMessage($sendData);
         } else {
             $data = array('success' => FALSE, 'result' => Form::errors());
         }
     }
     $data['sidebarLayout'] = View::render('content/vSidebar', array('page' => 'contact'), TRUE);
     Layout::title('Contact');
     Layout::desc('Contact us.');
     Layout::view('content/vContact', $data);
 }
Example #2
0
    $form->run();
} elseif ($mode == 'edit') {
    $typeid = cleanvar($_REQUEST['typeid']);
    $sql = "SELECT typename FROM `{$dbSiteTypes}` WHERE typeid = {$typeid}";
    $result = mysql_query($sql);
    if (mysql_error()) {
        trigger_error(mysql_error(), E_USER_WARNING);
    }
    if (mysql_num_rows($result) > 0) {
        list($typename) = mysql_fetch_array($result);
    }
    $form = new Form("sitetypes", $strEdit, $dbSiteTypes, "update", $strEditSiteType);
    $form->setReturnURLFailure($_SERVER['PHP_SELF']);
    $form->setReturnURLSuccess($_SERVER['PHP_SELF']);
    $c1 = new Cell();
    $c1->setIsHeader(TRUE);
    $c1->addComponent(new Label($strSiteType));
    $c2 = new Cell();
    $c2->addComponent(new SingleLineEntry("typename", 10, "typename", $typename));
    $r = new Row();
    $r->addComponent($c1);
    $r->addComponent($c2);
    $form->addRow($r);
    $hr = new HiddenRow();
    $hr->addComponent(new HiddenEntry("mode", "", "edit"));
    $hr->addComponent(new HiddenEntry("typeid", "", $typeid));
    $form->addRow($hr);
    $form->setKey("typeid", $typeid);
    $form->run();
}
include APPLICATION_INCPATH . 'htmlfooter.inc.php';