Exemplo n.º 1
0
 protected function generate_contact_form()
 {
     FB::log("Wrong class.");
     try {
         // Create a new form object and set submission properties
         $form = new Form();
         $form->page = $this->url0;
         $form->action = 'contact-form';
         $form->form_id = 'contact-form';
         $form->legend = 'Contact ' . SITE_NAME;
         // Set up input information
         $form->input_arr = array(array('name' => 'cf_n', 'class' => 'input-text', 'label' => 'Name'), array('name' => 'cf_e', 'class' => 'input-text', 'label' => 'Email'), array('name' => 'cf_p', 'class' => 'input-text', 'label' => 'Phone'), array('type' => 'textarea', 'name' => 'cf_m', 'class' => 'input-textarea', 'label' => 'Message'), array('type' => 'submit', 'class' => 'input-submit', 'name' => 'cf_s', 'value' => 'Send Message'));
         return $form;
     } catch (Exception $e) {
         Error::logException($e);
     }
 }
Exemplo n.º 2
0
 public function input()
 {
     // Add the new input to the input array after sanitizing
     try {
         // Get the arguments passed to the method
         $args = func_get_args();
         // If the arguments were passed in an array, execute accordingly
         if (is_array($args[0])) {
             $this->_inputs[] = new Input($args[0]);
             return;
         } else {
             list($typ, $lab, $val, $nam, $id, $cls) = $args;
             $this->_inputs[] = new Input($typ, $lab, $val, $nam, $id, $cls);
         }
     } catch (Exception $e) {
         Error::logException($e);
     }
 }
Exemplo n.º 3
0
 public function display_admin()
 {
     try {
         // Load form values
         $this->get_entry_by_id((int) $_POST['entry_id']);
         // Create a new form object and set submission properties
         $form = new Form();
         $form->form_id = 'ecms-edit-form';
         $form->page = $this->url0;
         $form->action = 'entry-write';
         $form->entry_id = (int) $_POST['entry_id'];
         // Make the entry values available to the form if they exist
         $form->entry = isset($this->entries[0]) ? $this->entries[0] : array();
         // Set up input information
         $form->input_arr = array(array('name' => 'title', 'class' => 'input-text', 'label' => 'Entry Title'), array('type' => 'file', 'name' => 'image', 'class' => 'input-text', 'label' => 'Main Image'), array('name' => 'caption', 'class' => 'input-text', 'label' => 'Main Image Caption'), array('type' => 'textarea', 'class' => 'input-textarea', 'name' => 'entry', 'label' => 'Entry Body'), array('name' => 'tags', 'class' => 'input-text', 'label' => 'Tags'), array('type' => 'textarea', 'class' => 'input-textarea', 'name' => 'excerpt', 'label' => 'Excerpt (Meta Description)'), array('name' => 'slug', 'class' => 'input-text', 'label' => 'URL Slug for This Entry'), array('type' => 'submit', 'class' => 'input-submit', 'name' => 'form-submit', 'value' => 'Save Entry'));
         return $form;
     } catch (Exception $e) {
         Error::logException($e);
     }
 }
Exemplo n.º 4
0
 private function _verify_user_form()
 {
     // Load the account to be verified
     $sql = "SELECT\n                    `user_id`, `email`\n                FROM `" . DB_NAME . "`.`" . DB_PREFIX . "users`\n                WHERE `vcode`=:vcode\n                AND `active`=0\n                LIMIT 1";
     try {
         $stmt = $this->db->prepare($sql);
         $stmt->bindParam(':vcode', $this->url2, PDO::PARAM_INT);
         $stmt->execute();
         $result = $stmt->fetch(PDO::FETCH_OBJ);
         FB::log($result);
         $stmt->closeCursor();
     } catch (Exception $e) {
         ECMS_Error::log_exception($e);
     }
     if (isset($result->email)) {
         $this->_sdata->error = '0000';
     } else {
         $this->_sdata->error = '0005';
     }
     try {
         // Create a new form object and set submission properties
         $form = new Form();
         $form->legend = 'Activate Your Account';
         $form->page = $this->url0;
         $form->action = 'user-verify';
         // Load the error message if one exists
         if (isset($this->_sdata->error) && $this->_sdata->error !== '0000') {
             $form->notice = '<p class="form-error">' . $this->_get_error_message() . '</p>';
             // Load temporary form values
             $form->entry = isset($this->_sdata->temp) ? $this->_sdata->temp : new stdClass();
         } else {
             FB::log('Verifying the account for ' . $result->email);
         }
         // Set up input information
         $form->input_arr = array(array('name' => 'username', 'label' => 'Choose a Username (8-20 characters using ' . 'only a-z, 0-9, -, and _)', 'class' => 'input-text'), array('name' => 'display', 'label' => 'Choose a Display Name (the name shown on ' . 'entries posted by you, i.e. "John Doe")', 'class' => 'input-text'), array('name' => 'password', 'label' => 'Choose a Password', 'type' => 'password', 'id' => 'choose-password', 'class' => 'input-text'), array('name' => 'verify-password', 'label' => 'Verify Your Password', 'type' => 'password', 'id' => 'verify-password', 'class' => 'input-text'), array('name' => 'vcode', 'type' => 'hidden', 'value' => SIV::clean_output($this->url2, FALSE, FALSE)), array('type' => 'submit', 'name' => 'form-submit', 'value' => 'Activate', 'class' => 'input-submit'));
         return $form;
     } catch (Exception $e) {
         Error::logException($e);
     }
 }
Exemplo n.º 5
0
 public function display_menu_form($page_id = NULL)
 {
     try {
         // Create a new form object and set submission properties
         $form = new Form();
         $form->legend = empty($page_id) ? "Create a Menu Page" : "Edit a Menu Page";
         $form->page = 'menu';
         $form->action = 'menu-update';
         $form->entry_id = $page_id;
         // Load form values
         $form->entry = $this->get_page_data_by_id($page_id);
         $available_types = $this->_get_available_page_types();
         // Set up input information
         $form->input_arr = array(array('name' => 'page_name', 'label' => 'Display Name'), array('name' => 'page_slug', 'label' => 'Slug (Web Address)', 'tooltip' => 'This can be either relative (page-slug) or ' . 'absolute (http://example.com/)'), array('type' => 'select', 'name' => 'type', 'label' => 'Class Type', 'options' => $available_types), array('name' => 'menu_order', 'label' => 'Order'), array('name' => 'show_full', 'label' => 'Show Entry Full Page?'), array('name' => 'hide_in_menu', 'label' => 'Hide From the Menu?'), array('name' => 'parent_id', 'label' => 'Make this a submenu of what page?'), array('name' => 'extra', 'label' => 'Extra'), array('type' => 'submit', 'name' => 'form-submit', 'value' => 'Save Entry'), array('type' => 'hidden', 'name' => 'page_id', 'value' => $page_id));
         echo $form;
     } catch (Exception $e) {
         Error::logException($e);
     }
 }