$Id: form.php 2914 2008-06-25 22:45:11Z Shadowhand $
Author: Kohana Team
 function form($object)
 {
     $i18n = exponent_lang_loadFile('database/inbox_contactbanned.php');
     if (!defined('SYS_FORMS')) {
         require_once BASE . 'subsystems/forms.php';
     }
     exponent_forms_initialize();
     $form = new form();
     if (!defined('SYS_USERS')) {
         require_once BASE . 'subsystems/users.php';
     }
     $users = array();
     foreach (exponent_users_getAllUsers() as $u) {
         // Get the current user.
         $thisuser = $_SESSION['/']['user'];
         if ($u->is_acting_admin == 0 && $u->id != $thisuser->id) {
             $users[$u->id] = $u->firstname . ' ' . $u->lastname . ' (' . $u->username . ')';
         }
     }
     global $db;
     foreach ($db->selectObjects('inbox_contactbanned', 'owner=' . $thisuser->id) as $b) {
         unset($users[$b->user_id]);
     }
     $form->register('uid', $i18n['uid'], new dropdowncontrol(0, $users));
     $form->register('submit', '', new buttongroupcontrol($i18n['save'], '', $i18n['cancel']));
     return $form;
 }
Exemple #2
0
 protected function displayContent()
 {
     $html = '<p>' . nl2br($this->pageInfo['content']) . '</p>';
     $html = '<br/>';
     $html .= '<img src="images/image1.png" class="left">' . "\n";
     //instantiate the form
     include 'classes/formsClass.php';
     $form = new form($this->model);
     if (!isset($_POST['join'])) {
         //call sign up form in the form class
         $html .= $form->signUpForm();
         $html .= '<p>If you have an existing account, <a href="index.php?page=login"';
         $html .= $this->pageInfo['page'] == 'login' ? '' : '';
         $html .= '> LOGIN</a> here</p>' . "\n";
     } else {
         //run the validation function
         $result = $this->model->validateSignUp();
         if ($result) {
             $html .= $form->signUpForm($result, 'add');
         } else {
             //add new user
             $fail = $this->model->processSignUp();
             if ($fail) {
                 $html .= '<p>Sorry, something went wrong please contact us <a href="index.php?page=contact">here</a></p>';
             } else {
                 $html .= '<h3>Thanks for joining us!</h3>';
             }
         }
     }
     //if the user has not yet submitted the form show the form
     $html .= '</form>';
     $html .= '</div>';
     // Return HTML back to displayPage in viewClass
     return $html;
 }
Exemple #3
0
 function form_search_dns()
 {
     $form_search_dns = new form(array('FORM_NAME' => 'form_search_dns'));
     $form_search_dns->db_data('dns_zones.type, dns_zones.name, dns_zones.status');
     $form_search_dns->db_data_search();
     return $form_search_dns;
 }
 function form($object)
 {
     $i18n = exponent_lang_loadFile('datatypes/contact_contact.php');
     if (!defined('SYS_FORMS')) {
         require_once BASE . 'subsystems/forms.php';
     }
     exponent_forms_initialize();
     $type = 0;
     $default = 0;
     $form = new form();
     if (!isset($object->id)) {
         $object->user_id = 0;
         $object->addressbook_contact_id = 0;
         $object->email = '';
         $object->contact_info = '';
     } else {
         $form->meta('id', $object->id);
         if ($object->user_id != 0) {
             $type = 0;
             $default = $object->user_id;
         } else {
             $type = 1;
             $default = $object->email;
         }
     }
     $form->register('contact', $i18n['contact'], new contactcontrol($default, $type));
     $form->register('submit', '', new buttongroupcontrol($i18n['save'], '', $i18n['cancel']));
     return $form;
 }
Exemple #5
0
 public function CreateNew($input)
 {
     $header = "اضافه خبر جديد";
     include "views/form.php";
     $form = new form("index.php", "title");
     $form->addElement('Subject', "", "text", "عنوان الخير");
     $form->addImage('Image', "group", "صوره الخبر");
     global $db;
     $What = "*";
     $innerJoin = "";
     $db->select('groups', "", $limit = false, $order = false, $where_mode = "AND", $print_query = false, $What, $innerJoin);
     $result = $db->result_array();
     $groups = array("-1" => "الرئيسية");
     foreach ($result as $key) {
         //array_push($group,$key["Gname"]);
         $groups[$key["Gid"]] = $key["Gname"];
     }
     $form->addElement('GroupID', $groups, "select", "القبيله");
     $allowComments = array('1' => "نعم", '0' => "لا");
     $form->addElement('AllowComments', $allowComments, "select", "السماح بالتعليقات");
     $form->addElement('Description', "", "textarea", "تفاصيل الخبر");
     $form->addElement('i', "0", "hidden", "");
     $form->addElement('fn', "insert", "hidden", "");
     $form->addElement('c', "news", "hidden", "");
     $body = $form->RenderForm();
     //  $body="fields that will create the new group is here";
     include "views/single.php";
 }
 public function populate_from(form $f)
 {
     if ($f->submitted() && $f->verify()) {
         $this->name = $f['person_name']->value();
         $this->phonenumber = $f['person_phonenumber']->value();
     }
 }
 function form_zone()
 {
     global $db, $vars, $main;
     $form_zone = new form(array('FORM_NAME' => 'form_zone'));
     $form_zone->db_data('dns_zones.name, dns_zones.info, dns_zones_nameservers.nameserver_id, dns_zones.status');
     $form_zone->db_data_values("dns_zones", "id", get('zone'));
     $form_zone->db_data_pickup("dns_zones_nameservers.nameserver_id", "dns_nameservers", $db->get('dns_nameservers.id AS value, CONCAT(dns_nameservers.name, ".", nodes.name_ns, ".", "' . $vars['dns']['ns_zone'] . '") AS output', "dns_zones_nameservers, dns_nameservers, nodes", "dns_nameservers.node_id = nodes.id AND dns_nameservers.id = dns_zones_nameservers.nameserver_id AND dns_zones_nameservers.zone_id = '" . get('zone') . "'"), TRUE);
     $tmp = $db->get('users.email, users_nodes.owner', 'users, users_nodes, dns_zones', "users_nodes.user_id = users.id AND users_nodes.node_id = dns_zones.node_id AND dns_zones.id = '" . get("zone") . "'");
     foreach ((array) $tmp as $key => $value) {
         $form_zone->info['email_all'] .= $value['email'] . ', ';
         if ($value['owner'] == 'Y') {
             $form_zone->info['email_owner'] .= $value['email'] . ', ';
         }
     }
     $form_zone->info['email_all'] = substr($form_zone->info['email_all'], 0, -2);
     $form_zone->info['email_owner'] = substr($form_zone->info['email_owner'], 0, -2);
     $t = $db->get('nodes.id, nodes.name', 'nodes, dns_zones', "dns_zones.node_id = nodes.id AND dns_zones.id = '" . get('zone') . "'");
     $form_zone->info['node_name'] = $t[0]['name'];
     $form_zone->info['node_id'] = $t[0]['id'];
     $form_zone->info['hostmaster_username'] = $main->userdata->info['username'];
     $form_zone->info['hostmaster_name'] = $main->userdata->info['name'];
     $form_zone->info['hostmaster_surname'] = $main->userdata->info['surname'];
     $t = $db->get('type', 'dns_zones', "id = '" . get('zone') . "'");
     if ($t[0]['type'] == 'forward') {
         $form_zone->data[0]['value'] .= "." . $vars['dns']['root_zone'];
     }
     return $form_zone;
 }
Exemple #8
0
 public function showForm($mes)
 {
     $ns = e107::getRender();
     $frm = new form();
     $text = $frm->form_open('post', e_SELF);
     $text .= "<table class='table adminform'>";
     $text .= "<tr><td>" . LAN_RADIUS_01 . "</td><td>";
     $text .= $frm->form_text('radius_server', 35, vartrue($this->radius['radius_server']), 120);
     $text .= "</td></tr>\n";
     $text .= "<tr><td>" . LAN_RADIUS_02 . "</td><td>";
     $text .= $frm->form_text('radius_secret', 35, vartrue($this->radius['radius_secret']), 200);
     $text .= "</td></tr>\n";
     $tmp = $this->alt_auth_get_field_list('radius', $frm, $this->radius, FALSE);
     if ($tmp) {
         $text .= "<tr><td class='forumheader2' colspan='2'>" . LAN_ALT_27 . "</td></tr>\n" . $tmp;
         unset($tmp);
     }
     $text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
     // $text .= $frm -> form_button("submit", "update", LAN_ALT_2);
     $text .= e107::getForm()->admin_button('update', LAN_UPDATE, 'update');
     $text .= "</td></tr>\n";
     $text .= "</table>\n";
     $text .= $frm->form_close();
     $ns->tablerender(LAN_RADIUS_06, $mes->render() . $text);
     $ns->tablerender(LAN_ALT_40 . LAN_ALT_41, $this->alt_auth_test_form('radius', $frm));
 }
 public function add()
 {
     # Start the HTML
     $html = '';
     # Determine the recipients
     $recipients = array();
     $recipients[] = $this->settings['administratorEmail'];
     // Ensure this is first, i.e. the To: address
     foreach ($this->administrators as $administrator) {
         $recipients[] = $administrator['email'];
     }
     $recipients = array_unique($recipients);
     # Create a new form
     $form = new form(array('div' => 'lines form', 'displayRestrictions' => false, 'nullText' => '', 'formCompleteText' => $this->tick . ' Thank you for your submission. We will be in touch shortly.', 'autofocus' => true, 'databaseConnection' => $this->databaseConnection, 'picker' => true, 'usersAutocomplete' => false, 'rows' => 10, 'cols' => 70));
     $form->heading('', "<p>Proposed projects can be submitted using this form.</p>");
     $form->dataBinding(array('database' => $this->settings['database'], 'table' => $this->settings['table'], 'includeOnly' => $this->userIsAdministrator ? array() : array('name', 'client', 'description'), 'intelligence' => true, 'size' => 70, 'attributes' => $this->formDataBindingAttributes()));
     #!# Reply-to field needs to be fully-qualified with e-mail domain
     $form->setOutputEmail($recipients, $this->settings['administratorEmail'], $this->settings['applicationName'] . ': project submission', NULL, 'client');
     $form->setOutputScreen();
     if ($result = $form->process($html)) {
         # Set fixed fields
         $result['client'] = $this->user;
         # Insert into the database
         $this->databaseConnection->insert($this->settings['database'], $this->settings['table'], $result);
     }
     # Show the HTML
     echo $html;
 }
 function form($object)
 {
     if (!defined('SYS_FORMS')) {
         require_once BASE . 'subsystems/forms.php';
     }
     pathos_forms_initialize();
     $form = new form();
     if (!isset($object->id)) {
         $object->name = '';
         $object->lang = '';
         $object->charset = '';
         $object->author = '';
         $object->locale = '';
         $object->default_view = '';
     } else {
         $form->meta('id', $object->id);
     }
     $form->register('name', 'Name', new textcontrol($object->name));
     $form->register('author', 'Author(s)', new textcontrol($object->author));
     $form->register('lang', 'Lang Code', new textcontrol($object->lang, 5));
     $form->register('charset', 'Character Set', new textcontrol($object->charset, 15));
     $form->register('locale', 'Locale', new textcontrol($object->locale));
     $form->register('default_view', 'Default View Name', new textcontrol($object->default_view));
     $form->register('submit', '', new buttongroupcontrol('Save', '', 'Cancel'));
     return $form;
 }
 function form_getrange()
 {
     global $db;
     $form_getrange = new form(array('FORM_NAME' => 'form_getrange'));
     $form_getrange->db_data('ip_ranges.info');
     return $form_getrange;
 }
 function form($object)
 {
     if (!defined('SYS_FORMS')) {
         require_once BASE . 'subsystems/forms.php';
     }
     pathos_forms_initialize();
     $form = new form();
     if (!isset($object->id)) {
         $object->sort = 'asc_name';
     } else {
         switch ($object->orderhow) {
             case 0:
                 // ascending
                 $object->sort = 'asc_' . $object->orderby;
                 break;
             case 1:
                 // descending
                 $object->sort = 'desc_' . $object->orderby;
                 break;
             case 2:
                 // random
                 $object->sort = 'random_';
                 break;
             default:
                 $object->sort = 'asc_name';
                 break;
         }
         $form->meta('id', $object->id);
     }
     $order_options = array('random_' => 'Randomly', 'asc_name' => 'Alphabetical By Name', 'desc_name' => 'Reverse Alphabetical By Name');
     $form->register('orderby', 'Sorting', new dropdowncontrol($object->sort, $order_options));
     $form->register('submit', '', new buttongroupcontrol('Save', '', 'Cancel'));
     return $form;
 }
 public function updatesuggestselectfield($parameters = array())
 {
     $result = array();
     $view = new ui($this);
     if ($parameters['value'] != '') {
         $controller = $parameters['callbackcontroller'] . 'Controller';
         $function = $parameters['callbackfunction'];
         $extra = $parameters['extraparams'];
         $extralist = explode(',', $extra);
         $extraparams = array();
         foreach ($extralist as $extraparam) {
             list($key, $value) = explode('|', $extraparam);
             $extraparams[$key] = $value;
         }
         $theController = new $controller();
         $result = $theController->{$function}(rawurldecode($parameters['value']), $extraparams);
         $form = new form($parameters);
         list($id, $name) = explode('_', $parameters['id'], 2);
         $form->setId($id);
         $select = new selectField(str_replace('_text', '', $name), '', '', true);
         $form->addField($select);
         foreach ($result as $row) {
             $select->addOption(new selectoptionField($row, $row, false));
         }
         $view->assign('form', $form);
         $view->assign('field', $select);
         $this->response->assign(str_replace('_text', '', $parameters['id']) . '_container', 'innerHTML', $view->fetch('selectField.tpl'));
     } else {
         $form = new form($parameters);
         $select = new selectField($parameters['id'], '', '', true);
         $view->assign('form', $form);
         $view->assign('field', $select);
         $this->response->assign(str_replace('_text', '', $parameters['id']) . '_container', 'innerHTML', $view->fetch('selectField.tpl'));
     }
 }
Exemple #14
0
 function form_range()
 {
     global $construct, $db, $vars, $main;
     if (!$this->has_edit_access()) {
         $main->message->set_fromlang('info', 'no_privilege');
     }
     $form_range = new form(array('FORM_NAME' => 'form_range'));
     $form_range->db_data('ip_ranges.ip_start, ip_ranges.ip_end, ip_ranges.info, ip_ranges.status');
     #removed: ip_ranges.nodeid #bug
     $form_range->db_data_values("ip_ranges", "id", get('iprange'));
     $form_range->data[0]['value'] = long2ip($form_range->data[0]['value']);
     $form_range->data[1]['value'] = long2ip($form_range->data[1]['value']);
     $tmp = $db->get('users.email, users_nodes.owner', 'users, users_nodes, ip_ranges', "users_nodes.user_id = users.id AND users_nodes.node_id = ip_ranges.node_id AND ip_ranges.id = '" . get("iprange") . "'");
     $form_range->info['email_all'] = null;
     $form_range->info['email_owner'] = null;
     foreach ((array) $tmp as $key => $value) {
         $form_range->info['email_all'] .= $value['email'] . ', ';
         if ($value['owner'] == 'Y') {
             $form_range->info['email_owner'] .= $value['email'] . ', ';
         }
     }
     $form_range->info['email_all'] = isset($form_range->info['email_all']) ? substr($form_range->info['email_all'], 0, -2) : null;
     $form_range->info['email_owner'] = isset($form_range->info['email_owner']) ? substr($form_range->info['email_owner'], 0, -2) : null;
     $t = $db->get('nodes.id, nodes.name', 'nodes, ip_ranges', "ip_ranges.node_id = nodes.id AND ip_ranges.id = '" . get('iprange') . "'");
     $form_range->info['node_name'] = $t[0]['name'];
     $form_range->info['node_id'] = $t[0]['id'];
     $form_range->info['hostmaster_username'] = $main->userdata->info['username'];
     $form_range->info['hostmaster_name'] = $main->userdata->info['name'];
     $form_range->info['hostmaster_surname'] = $main->userdata->info['surname'];
     return $form_range;
 }
 function form_getrange_v6()
 {
     global $db;
     $form_getrange_v6 = new form(array('FORM_NAME' => 'form_getrange_v6'));
     $form_getrange_v6->db_data('ip_ranges_v6.info');
     return $form_getrange_v6;
 }
 function form($object)
 {
     pathos_lang_loadDictionary('modules', 'contactmodule');
     pathos_lang_loadDictionary('standard', 'core');
     if (!defined('SYS_FORMS')) {
         require_once BASE . 'subsystems/forms.php';
     }
     pathos_forms_initialize();
     $type = 0;
     $default = 0;
     $form = new form();
     if (!isset($object->id)) {
         $object->user_id = 0;
         $object->addressbook_contact_id = 0;
         $object->email = '';
         $object->contact_info = '';
     } else {
         $form->meta('id', $object->id);
         if ($object->user_id != 0) {
             $type = 0;
             $default = $object->user_id;
         } else {
             $type = 1;
             $default = $object->email;
         }
     }
     $form->register('contact', TR_CONTACTMODULE_CONTACT, new contactcontrol($default, $type));
     $form->register('submit', '', new buttongroupcontrol(TR_CORE_SAVE, '', TR_CORE_CANCEL));
     return $form;
 }
 function form_range()
 {
     global $construct, $db, $vars, $main;
     $form_range = new form(array('FORM_NAME' => 'form_range'));
     $form_range->db_data('ip_ranges.ip_start, ip_ranges.ip_end, ip_ranges.info, ip_ranges.status');
     $form_range->db_data_values("ip_ranges", "id", get('iprange'));
     $form_range->data[0]['value'] = long2ip($form_range->data[0]['value']);
     $form_range->data[1]['value'] = long2ip($form_range->data[1]['value']);
     $tmp = $db->get('users.email, users_nodes.owner', 'users, users_nodes, ip_ranges', "users_nodes.user_id = users.id AND users_nodes.node_id = ip_ranges.node_id AND ip_ranges.id = '" . get("iprange") . "'");
     if (!isset($form_range->info['email_all'])) {
         $form_range->info['email_all'] = '';
     }
     if (!isset($form_range->info['email_owner'])) {
         $form_range->info['email_owner'] = '';
     }
     foreach ((array) $tmp as $key => $value) {
         $form_range->info['email_all'] .= $value['email'] . ', ';
         if ($value['owner'] == 'Y') {
             $form_range->info['email_owner'] .= $value['email'] . ', ';
         }
     }
     $form_range->info['email_all'] = substr($form_range->info['email_all'], 0, -2);
     $form_range->info['email_owner'] = substr($form_range->info['email_owner'], 0, -2);
     $t = $db->get('nodes.id, nodes.name', 'nodes, ip_ranges', "ip_ranges.node_id = nodes.id AND ip_ranges.id = '" . get('iprange') . "'");
     $form_range->info['node_name'] = $t[0]['name'];
     $form_range->info['node_id'] = $t[0]['id'];
     $form_range->info['hostmaster_username'] = $main->userdata->info['username'];
     $form_range->info['hostmaster_name'] = $main->userdata->info['name'];
     $form_range->info['hostmaster_surname'] = $main->userdata->info['surname'];
     return $form_range;
 }
 function form_cname()
 {
     global $db, $vars;
     $form_cname = new form(array('FORM_NAME' => 'form_cname'));
     $form_cname->db_data('ip_cname.hostname, ip_cname.cname, ip_cname.info');
     $form_cname->db_data_values("ip_cname", "id", get('cname'));
     return $form_cname;
 }
 function form_search_users()
 {
     global $db;
     $form_search_nodes = new form(array('FORM_NAME' => 'form_search_users'));
     $form_search_nodes->db_data('users.username, users.surname, users.name, users.email, users.status, rights.type');
     $form_search_nodes->db_data_search();
     return $form_search_nodes;
 }
 function form_search_users()
 {
     global $db;
     $form_search_nodes = new form(array('FORM_NAME' => 'form_search_users'));
     $form_search_nodes->db_data('users.username');
     $form_search_nodes->db_data_search();
     return $form_search_nodes;
 }
Exemple #21
0
 function userForm($config_object = null, $user_data = null)
 {
     $form = new form();
     $htmlinfo = "You may place your order and pay with a check or money order.  If paying by check, your order will be held util we receive the check and it clears our bank account.  Money order orders will be processed upon our receipt of the money order.<br/><br/>";
     $form->register(uniqid(""), "", new htmlcontrol($htmlinfo));
     $form->register("cash_amount", "Cash Amount:", new textcontrol());
     return $form->toHTML();
 }
 function form_nameserver()
 {
     global $db, $vars;
     $form_nameserver = new form(array('FORM_NAME' => 'form_nameserver'));
     $form_nameserver->db_data('dns_nameservers.name' . (get('nameserver') == 'add' ? ", dns_nameservers.ip" : ""));
     $form_nameserver->db_data_values("dns_nameservers", "id", get('nameserver'));
     return $form_nameserver;
 }
Exemple #23
0
function meta_acpt_slide_options()
{
    $form = new form('slide', null);
    $form->image('image', array('label' => 'Image URL', 'help' => 'Upload an Image that is 940px by 350px for best results', 'button' => 'Add Your Slide'));
    $form->text('headline', array('label' => 'Headline'));
    $form->textarea('description', array('label' => 'Description'));
    $form->select('showText', array('Yes', 'No'), array('label' => 'Show Headline and Description'));
}
 function form_nameserver()
 {
     global $db, $vars;
     $form_nameserver = new form(array('FORM_NAME' => 'form_nameserver'));
     $form_nameserver->db_data('dns_nameservers.name, dns_nameservers.ip, dns_nameservers.status');
     $form_nameserver->db_data_values("dns_nameservers", "id", get('nameserver'));
     $form_nameserver->data[1]['value'] = long2ip($form_nameserver->data[1]['value']);
     return $form_nameserver;
 }
 function form_search_ranges()
 {
     global $construct, $db;
     $form_search_ranges = new form(array('FORM_NAME' => 'form_search_ranges'));
     $form_search_ranges->data = array("0" => array("Field" => "ip", "fullField" => "ip"));
     $form_search_ranges->db_data('areas.status, ip_ranges.delete_req');
     $form_search_ranges->db_data_search();
     return $form_search_ranges;
 }
 /**
  * Definitio of the settings form
  * @param form $mform
  */
 protected function specific_definition($mform)
 {
     // Section header title according to language file.
     $mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
     // Boolean to enable/disable geolocation.
     $mform->addElement('checkbox', 'config_geolocation', get_string('intuitel_allow_geolocation', 'block_intuitel'));
     $mform->setDefault('config_geolocation', true);
     $mform->setType('config_geolocation', PARAM_BOOL);
 }
 function form_search_nameservers()
 {
     global $db;
     $form_search_nameservers = new form(array('FORM_NAME' => 'form_search_nameservers'));
     $form_search_nameservers->data = array("0" => array("Field" => "ip", "fullField" => "dns_nameservers__ip"));
     $form_search_nameservers->db_data('dns_nameservers.status, nodes.id, nodes.name');
     $form_search_nameservers->db_data_search();
     return $form_search_nameservers;
 }
 function form_services()
 {
     global $db, $vars;
     $form_services = new form(array('FORM_NAME' => 'form_services'));
     $form_services->db_data('services.id, services.title, services.protocol, services.port');
     $form_services->db_data_values("services", "id", get('service'));
     $form_services->db_data_remove('services__id');
     return $form_services;
 }
 function form_search_services_edit()
 {
     global $db;
     $form_search_services_edit = new form(array('FORM_NAME' => 'form_search_services_edit'));
     $form_search_services_edit->db_data('nodes_services.service_id, nodes.id, nodes.name');
     $form_search_services_edit->db_data_enum('nodes_services.service_id', $db->get("id AS value, title AS output", "services", "", "", "title ASC"));
     $form_search_services_edit->db_data_search();
     return $form_search_services_edit;
 }
 function form_change_password()
 {
     global $main;
     $form_change_password = new form(array('FORM_NAME' => 'form_change_password'));
     $form_change_password->db_data('users.password, users.password');
     $form_change_password->data[1]['Field'] .= '_c';
     $form_change_password->data[1]['fullField'] .= '_c';
     return $form_change_password;
 }