Ejemplo n.º 1
0
 public function Load()
 {
     parent::$PAGE_TITLE = __(CHANGE_PASSWD);
     $form = new Form($this, "Form_change_passwd");
     if (extension_loaded('openssl')) {
         //$form->setEncryptObject(new EncryptDataWspObject("change wsp password", 2048));
     }
     $table = new Table();
     $table->addRow();
     $this->edt_old_passwd = new Password($form, "wsp_old_password");
     $this->edt_old_passwd->setFocus();
     $live_validation = new LiveValidation();
     $live_validation->addValidatePresence()->setFieldName(__(OLD_PASSWD));
     $table->addRowColumns(__(OLD_PASSWD) . " : ", $this->edt_old_passwd->setLiveValidation($live_validation))->setStyle("color:black;");
     $this->edt_new_passwd = new Password($form, "wsp_new_password");
     $live_validation = new LiveValidation();
     $live_validation->addValidatePresence()->setFieldName(__(NEW_PASSWD));
     $table->addRowColumns(__(NEW_PASSWD) . " : ", $this->edt_new_passwd->setLiveValidation($live_validation))->setStyle("color:black;");
     $this->edt_confirm_passwd = new Password($form, "wsp_confirm_password");
     $live_validation = new LiveValidation();
     $live_validation->addValidatePresence()->setFieldName(__(CONFIRM_PASSWD));
     $live_validation->addValidateConfirmation("wsp_new_password");
     $table->addRowColumns(__(CONFIRM_PASSWD) . " : ", $this->edt_confirm_passwd->setLiveValidation($live_validation))->setStyle("color:black;");
     $table->addRow();
     $this->validate_btn = new Button($form);
     $this->validate_btn->setValue(__(CHANGE_PASSWD))->onClick("onChangePasswd")->setAjaxEvent();
     $table->addRow($this->validate_btn)->setColspan(2)->setAlign(RowTable::ALIGN_CENTER);
     $table->addRow();
     $form->setContent($table);
     $table = new Table();
     $table->setWidth("100%");
     $table->addRow($form, RowTable::ALIGN_CENTER);
     $this->render = $table;
 }
 public function Load()
 {
     parent::$PAGE_TITLE = __(CONFIGURE_BANNED_VISITORS);
     if (!defined('MAX_BAD_URL_BEFORE_BANNED')) {
         define("MAX_BAD_URL_BEFORE_BANNED", 4);
     }
     $this->array_wsp_banned_users = WspBannedVisitors::getBannedVisitors();
     $this->table_ban = new Table();
     $this->table_ban->setId("table_ban")->activateAdvanceTable()->activatePagination()->activateSort(2, "desc")->setWidth(500);
     $this->table_ban->addRowColumns("IP", __(LAST_ACCESS), __(DURATION), __(AUTHORIZE))->setHeaderClass(0);
     $ban_vistors_obj = new Object("<br/><br/>", $this->table_ban, "<br/><br/>");
     $ban_ip_table = new Table();
     $form = new Form($this);
     $this->ip_edt = new TextBox($form);
     $validation = new LiveValidation();
     $validation->addValidatePresence();
     $this->ip_edt->setLiveValidation($validation);
     $this->duration_edt = new TextBox($form);
     $this->duration_edt->setValue(0);
     $validation = new LiveValidation();
     $validation->addValidatePresence()->addValidateNumericality(true);
     $this->duration_edt->setLiveValidation($validation);
     $ip_btn = new Button($form);
     $ip_btn->setValue(__(BAN_IP))->onClick("onBannedIP")->setAjaxEvent();
     $ban_ip_table->addRowColumns("IP : ", $this->ip_edt);
     $ban_ip_table->addRowColumns(__(DURATION) . " : ", $this->duration_edt);
     $form->setContent(new Object($ban_ip_table, $ip_btn));
     $ban_vistors_obj->add($form, "<br/><br/>");
     $this->render = new AdminTemplateForm($this, $ban_vistors_obj);
 }
Ejemplo n.º 3
0
 public function Load()
 {
     parent::$PAGE_TITLE = __(CONFIGURE_DATABASE);
     $this->includeJsAndCssFromObjectToPage("ComboBox(\$this)");
     // Admin
     $this->form = new Form($this);
     $table_form = new Table();
     $table_form->addRow();
     $this->edtHost = new TextBox($this->form);
     $this->edtHost->setValue(DB_HOST);
     $edtHostValidation = new LiveValidation();
     $table_form->addRowColumns(__(EDT_HOST) . ":&nbsp;", $this->edtHost->setLiveValidation($edtHostValidation->addValidatePresence()->setFieldName(__(EDT_HOST))));
     $this->edtPort = new TextBox($this->form);
     $this->edtPort->setValue(DB_PORT);
     $edtPortValidation = new LiveValidation();
     $table_form->addRowColumns(__(EDT_PORT) . ":&nbsp;", $this->edtPort->setLiveValidation($edtPortValidation->addValidateNumericality(true)->setFieldName(__(EDT_PORT))));
     $this->edtRoot = new TextBox($this->form);
     $this->edtRoot->setValue(DB_ROOT);
     $edtRootValidation = new LiveValidation();
     $table_form->addRowColumns(__(EDT_ROOT) . ":&nbsp;", $this->edtRoot->setLiveValidation($edtRootValidation->addValidatePresence()->setFieldName(__(EDT_ROOT))));
     $this->edtPassword = new Password($this->form);
     $this->edtPassword->setValue(DB_PASSWORD);
     $table_form->addRowColumns(__(EDT_PASSWORD) . ":&nbsp;", $this->edtPassword);
     $this->edtDatabase = new TextBox($this->form);
     $this->edtDatabase->setValue(DB_DATABASE);
     $table_form->addRowColumns(__(EDT_DATABASE) . ":&nbsp;", $this->edtDatabase);
     $table_form->addRow();
     $this->btnValidate = new Button($this->form);
     $this->btnValidate->setValue(__(BTN_VALIDATE))->onClick("configureDatabase")->setAjaxEvent();
     $table_form->addRowColumns($this->btnValidate)->setColumnColspan(1, 2)->setColumnAlign(1, RowTable::ALIGN_CENTER);
     $table_form->addRow();
     $table_form->addRow();
     $this->form->setContent($table_form);
     $this->render = new AdminTemplateForm($this, $this->form);
     // generate database object part
     $this->objCreateDbClass = new Object();
     $this->objCreateDbClass->setId("idCreateDbClass");
     $table_form->addRow($this->objCreateDbClass)->setColspan(2);
     $table_gen = new Table();
     $table_gen->addRow(__(GENERATE_DATABASE_OBJECTS))->setColspan(2);
     $table_gen->addRow();
     $this->cmb_databases = new ComboBox($this->form);
     $this->cmb_databases->onChange("configureGenDbObject")->setAjaxEvent();
     $table_gen->addRowColumns(__(DATABASES) . ":&nbsp;", $this->cmb_databases);
     $this->cmb_tables = new ComboBox($this->form);
     $table_gen->addRowColumns(__(TABLES) . ":&nbsp;", $this->cmb_tables);
     $table_gen->addRow();
     $btnGenObject = new Button($this->form);
     $btnGenObject->setValue(__(GENERATE_OBJECTS))->onClick("generateDbObject")->setAjaxEvent();
     $table_gen->addRow($btnGenObject)->setColspan(2);
     $table_gen->addRow();
     $this->objCreateDbClass->add($table_gen);
     // database list
     if ($this->testDbConnexion(null)) {
         $this->loadAllDatabases();
         $this->configureGenDbObject(null);
     }
 }
Ejemplo n.º 4
0
 public function Load()
 {
     parent::$PAGE_TITLE = __(CONFIGURE_USERS);
     $config_users_obj = new Object("<br/>");
     $this->result_obj = new Object();
     $this->result_obj->setId("page_result_area");
     $config_users_obj->add($this->result_obj);
     $this->users_table_obj = new Object();
     $this->users_table_obj->setId("users_table_obj");
     $config_users_obj->add($this->users_table_obj, "<br/><br/>");
     $user_table = new Table();
     $form = new Form($this);
     if (extension_loaded('openssl')) {
         $form->setEncryptObject(new EncryptDataWspObject());
     }
     $this->edt_login = new TextBox($form);
     $validation = new LiveValidation();
     $user_table->addRowColumns(__(LOGIN) . ":&nbsp;", $this->edt_login->setLiveValidation($validation->addValidatePresence()));
     $this->cmb_rights = new ComboBox($form);
     $this->cmb_rights->addItem(Page::RIGHTS_ADMINISTRATOR, "Administrator");
     $this->cmb_rights->addItem(Page::RIGHTS_MODERATOR, "Moderator");
     $this->cmb_rights->addItem(Page::RIGHTS_TRANSLATOR, "Translator");
     $this->cmb_rights->addItem(Page::RIGHTS_DEVELOPER, "Developer");
     $this->cmb_rights->addItem(Page::RIGHTS_AUTH_USER, "Authentificated user");
     $this->cmb_rights->addItem(Page::RIGHTS_GUEST, "Guest");
     $user_table->addRowColumns(__(RIGHTS) . ":&nbsp;", $this->cmb_rights);
     $this->edt_old_password = new Password($form);
     $validation = new LiveValidation();
     $this->old_passwd_row = $user_table->addRowColumns(__(OLD_PASSWORD) . ":&nbsp;", $this->edt_old_password->setLiveValidation($validation->addValidatePresence()->setFieldName(__(OLD_PASSWORD))));
     $this->old_passwd_row->setId("old_passwd_row");
     $this->edt_password = new Password($form);
     $validation = new LiveValidation();
     $user_table->addRowColumns(__(PASSWORD) . ":&nbsp;", $this->edt_password->setLiveValidation($validation->addValidatePresence()->setFieldName(__(PASSWORD))));
     $this->edt_confirm_passwd = new Password($form);
     $live_validation = new LiveValidation();
     $live_validation->addValidatePresence()->setFieldName(__(CONFIRM_PASSWD));
     $live_validation->addValidateConfirmation($this->edt_password->getId());
     $user_table->addRowColumns(__(CONFIRM_PASSWD) . " :&nbsp;", $this->edt_confirm_passwd->setLiveValidation($live_validation))->setStyle("color:black;");
     $user_table->addRow();
     $this->validate_btn = new Button($form);
     $this->validate_btn->setValue(__(ADD))->onClick("addWspUser")->setAjaxEvent()->disableAjaxWaitMessage()->assignEnterKey();
     $this->modify_btn = new Button($form);
     $this->modify_btn->setValue(__(SAVE))->onClick("changeWspUser")->setAjaxEvent()->disableAjaxWaitMessage()->assignEnterKey();
     $this->cancel_btn = new Button($this);
     $this->cancel_btn->setValue(__(CANCEL))->onClick("refresh")->setAjaxEvent()->disableAjaxWaitMessage();
     $modif_btn_table = new Table();
     $modif_btn_table->addRowColumns($this->validate_btn, "&nbsp;", $this->modify_btn, "&nbsp;", $this->cancel_btn);
     $user_table->addRow($modif_btn_table)->setColspan(2)->setAlign(RowTable::ALIGN_CENTER);
     $config_users_obj->add($form->setContent($user_table), "<br/><br/>");
     $this->render = new AdminTemplateForm($this, $config_users_obj);
 }
Ejemplo n.º 5
0
 public function Load()
 {
     parent::$PAGE_TITLE = __(CONFIGURE_SMTP);
     // Admin
     $form = new Form($this);
     $table_form = new Table();
     $table_form->addRow();
     $this->edtHost = new TextBox($form);
     $this->edtHost->setValue(SMTP_HOST);
     $edtHostValidation = new LiveValidation();
     $table_form->addRowColumns(__(EDT_HOST) . ":&nbsp;", $this->edtHost->setLiveValidation($edtHostValidation->addValidatePresence()->setFieldName(__(EDT_HOST))), "&nbsp;(ssl://smtp.gmail.com)");
     $this->edtPort = new TextBox($form);
     $this->edtPort->setValue(SMTP_PORT);
     $edtPortValidation = new LiveValidation();
     $table_form->addRowColumns(__(EDT_PORT) . ":&nbsp;", $this->edtPort->setLiveValidation($edtPortValidation->addValidateNumericality(true)->setFieldName(__(EDT_PORT))), "&nbsp;(465)");
     $this->edtName = new TextBox($form);
     $this->edtName->setValue(utf8encode(SMTP_NAME));
     $edtNameValidation = new LiveValidation();
     $table_form->addRowColumns(__(EDT_NAME) . ":&nbsp;", $this->edtName->setLiveValidation($edtNameValidation->addValidatePresence()->setFieldName(__(EDT_NAME))), "&nbsp;(Robert Francis)");
     $this->edtMail = new TextBox($form);
     $this->edtMail->setValue(SMTP_MAIL);
     $edtMailValidation = new LiveValidation();
     $table_form->addRowColumns(__(EDT_MAIL) . ":&nbsp;", $this->edtMail->setLiveValidation($edtMailValidation->addValidatePresence()->addValidateEmail()->setFieldName(__(EDT_MAIL))), "&nbsp;(robert.francis@gmail.com)");
     $this->cmbAuth = new ComboBox($form);
     $this->cmbAuth->addItem("false", __(DESACTIVATE), SMTP_AUTH == false ? true : false)->addItem("true", __(ACTIVATE), SMTP_AUTH == true ? true : false)->setWidth(143)->onChange("changeCmbAuth")->setAjaxEvent()->disableAjaxWaitMessage();
     $table_form->addRowColumns(__(CMB_AUTH) . ":&nbsp;", $this->cmbAuth, "&nbsp;(" . __(ACTIVATE) . ")");
     $this->edtUser = new TextBox($form);
     $this->edtUser->setValue(SMTP_USER);
     if (SMTP_AUTH == false) {
         $this->edtUser->disable();
     }
     $table_form->addRowColumns(__(EDT_USER) . ":&nbsp;", $this->edtUser, "&nbsp;(robert.francis@gmail.com)");
     $this->edtPassword = new Password($form);
     $this->edtPassword->setValue(SMTP_PASS);
     if (SMTP_AUTH == false) {
         $this->edtPassword->disable();
     }
     $table_form->addRowColumns(__(EDT_PASS) . ":&nbsp;", $this->edtPassword, "&nbsp;(*********)");
     $table_form->addRow();
     $btnValidate = new Button($form);
     $btnValidate->setValue(__(BTN_VALIDATE))->onClick("configureSmtp")->setAjaxEvent();
     $table_form->addRowColumns($btnValidate)->setColumnColspan(1, 3)->setColumnAlign(1, RowTable::ALIGN_CENTER);
     $table_form->addRow();
     $form->setContent($table_form);
     $this->render = new AdminTemplateForm($this, $form);
 }
Ejemplo n.º 6
0
 /**
  * Constructor ContactForm
  * @param Page $page_object 
  * @param string $send_method 
  * @param string $table_style 
  */
 function __construct($page_object, $send_method, $table_style = '')
 {
     parent::__construct();
     if (!isset($page_object) || !isset($send_method)) {
         throw new NewException("2 arguments for " . get_class($this) . "::__construct() are mandatory", 0, getDebugBacktrace(1));
     }
     if (gettype($page_object) != "object" || !is_subclass_of($page_object, "Page")) {
         throw new NewException("Argument page_object for " . get_class($this) . "::__construct() error", 0, getDebugBacktrace(1));
     }
     $this->page_object = $page_object;
     $this->mail_to = SMTP_MAIL;
     $this->mail_to_name = SMTP_NAME;
     $table_main = new Table();
     $table_main->setClass($table_style);
     $form = new Form($this->page_object);
     $name = new TextBox($form, "contact_name");
     $name_validation = new LiveValidation();
     $name->setLiveValidation($name_validation->addValidatePresence()->setFieldName(__(CONTACTFORM_NAME)));
     $table_main->addRowColumns(__(CONTACTFORM_NAME) . ":&nbsp;", $name->setFocus())->setColumnWidth(2, "100%");
     $email = new TextBox($form, "contact_email");
     $email_validation = new LiveValidation();
     $email->setLiveValidation($email_validation->addValidateEmail()->addValidatePresence()->setFieldName(__(CONTACTFORM_EMAIL)));
     $table_main->addRowColumns(__(CONTACTFORM_EMAIL) . ":&nbsp;", $email);
     $subject = new TextBox($form, "contact_subject");
     $subject_validation = new LiveValidation();
     $subject->setLiveValidation($subject_validation->addValidatePresence()->setFieldName(__(CONTACTFORM_SUBJECT)));
     $table_main->addRowColumns(__(CONTACTFORM_SUBJECT) . ":&nbsp;", $subject);
     $table_main->addRow();
     $editor = new Editor($form, "contact_message");
     $editor_validation = new LiveValidation();
     $editor->setLiveValidation($editor_validation->addValidatePresence()->setFieldName(__(CONTACTFORM_MESSAGE)));
     $editor->setToolbar(Editor::TOOLBAR_SIMPLE);
     $table_main->addRow(new Object(__(CONTACTFORM_MESSAGE) . ": ", "<br/>", $editor))->setColspan(3)->setAlign(RowTable::ALIGN_LEFT);
     $table_main->addRow();
     $this->captcha = new Captcha($form, "contact_captcha");
     $table_main->addRow($this->captcha)->setColspan(3);
     $table_main->addRow();
     $this->send_button = new Button($form, "contact_send", "", __(CONTACTFORM_SEND));
     $this->send_button->assignEnterKey()->onClick($send_method)->setAjaxEvent();
     $table_main->addRow($this->send_button)->setColspan(3);
     $table_main->addRow();
     $form->setContent($table_main);
     $this->render = $form;
 }
Ejemplo n.º 7
0
 /**
  * Method prepareFieldsArray
  * @access public
  * @param mixed $properties [default value: array(]
  * @return mixed
  * @since 1.2.1
  */
 public function prepareFieldsArray($properties = array())
 {
     $this->fields_array = array();
     $list_attribute = $this->database_object->getDbTableAttributes();
     $list_attribute_type = $this->database_object->getDbTableAttributesType();
     $auto_increment_id = $this->database_object->getDbTableAutoIncrement();
     // Add properties to apply on all fields
     if (isset($properties[ModelViewMapper::PROPERTIES_ALL]) && is_array($properties[ModelViewMapper::PROPERTIES_ALL])) {
         $apply_all_array = $properties[ModelViewMapper::PROPERTIES_ALL];
         foreach ($apply_all_array as $property_name => $property_value) {
             for ($i = 0; $i < sizeof($list_attribute); $i++) {
                 $property[$property_name] = $property_value;
                 if (isset($properties[$list_attribute[$i]])) {
                     // Handle child override of global property
                     if (!isset($properties[$list_attribute[$i]][$property_name])) {
                         $properties[$list_attribute[$i]] = array_merge($properties[$list_attribute[$i]], $property);
                     }
                 } else {
                     $properties[$list_attribute[$i]] = $property;
                 }
             }
         }
     }
     // check foreign keys
     $db_table_foreign_keys = $this->database_object->getDbTableForeignKeys();
     foreach ($db_table_foreign_keys as $fk_attribute => $value) {
         if (isset($properties[$fk_attribute])) {
             $fk_property = $properties[$fk_attribute];
             if (isset($fk_property["fk_attribute"])) {
                 // create combobox
                 $cmb = new ComboBox($this->form_or_page);
                 // get foreign key data
                 $query = "select distinct " . $value["column"] . " as id, " . $fk_property["fk_attribute"] . " as value from " . $value["table"];
                 if (isset($fk_property["fk_where"])) {
                     $query .= " where " . $fk_property["fk_where"];
                 }
                 if (isset($fk_property["fk_orderby"])) {
                     $query .= " order by " . $fk_property["fk_orderby"];
                 }
                 $stmt = DataBase::getInstance()->prepareStatement($query);
                 $row = DataBase::getInstance()->stmtBindAssoc($stmt, $row);
                 while ($stmt->fetch()) {
                     $cmb->addItem(utf8encode($row['id']), utf8encode($row['value']));
                 }
                 // add combo box in properties
                 $value['cmb_obj'] = $cmb;
                 $properties[$fk_attribute] = array_merge($properties[$fk_attribute], $value);
             }
         }
     }
     foreach ($list_attribute as $i => $attribute) {
         $wspobject = "TextBox";
         $attribute_properties = array();
         if (is_array($properties[$attribute])) {
             $attribute_properties = $properties[$attribute];
         }
         if (isset($attribute_properties["display"]) && $attribute_properties["display"] == false) {
             continue;
         }
         $is_update_ok = true;
         if (isset($attribute_properties["update"]) && $attribute_properties["update"] == false) {
             $is_update_ok = false;
         }
         $method = "get" . $this->getFormatValue($attribute);
         $value = call_user_func_array(array($this->database_model_object, $method), array());
         if ($attribute != $auto_increment_id && $is_update_ok) {
             // get property cmb_obj
             if (isset($attribute_properties['cmb_obj'])) {
                 $field = $attribute_properties['cmb_obj'];
             } else {
                 if (isset($attribute_properties["wspobject"]) && $attribute_properties["wspobject"] != "") {
                     $wspobject = $attribute_properties["wspobject"];
                 } else {
                     if ($list_attribute_type[$i] == "datetime") {
                         $wspobject = "Calendar";
                     } else {
                         if ($list_attribute_type[$i] == "boolean") {
                             $wspobject = "CheckBox";
                         }
                     }
                 }
                 if ($wspobject == "Calendar") {
                     $field = new Calendar($this->form_or_page);
                 } else {
                     if ($wspobject == "CheckBox") {
                         $field = new CheckBox($this->form_or_page);
                     } else {
                         if ($wspobject == "TextArea") {
                             $field = new TextArea($this->form_or_page);
                         } else {
                             if ($wspobject == "Editor") {
                                 $field = new Editor($this->form_or_page);
                                 if (isset($attribute_properties["editor_param"]) && $attribute_properties["editor_param"] != "") {
                                     $field->setToolbar($attribute_properties["editor_param"]);
                                 }
                             } else {
                                 if ($wspobject == "ComboBox") {
                                     $field = new ComboBox($this->form_or_page);
                                     if (isset($attribute_properties["combobox_values"])) {
                                         if (is_array($attribute_properties["combobox_values"])) {
                                             for ($j = 0; $j < sizeof($attribute_properties["combobox_values"]); $j++) {
                                                 $field->addItem($attribute_properties["combobox_values"][$j]['value'], $attribute_properties["combobox_values"][$j]['text']);
                                             }
                                         } else {
                                             throw new NewException(get_class($this) . "->prepareFieldsArray() error: the property combobox_values need to be an array.", 0, getDebugBacktrace(1));
                                         }
                                     }
                                 } else {
                                     $field = new TextBox($this->form_or_page);
                                     if ($list_attribute_type[$i] == "integer" || $list_attribute_type[$i] == "double") {
                                         $field->setWidth(70);
                                     }
                                     if (in_array($attribute, $key_attributes)) {
                                         $lv = new LiveValidation();
                                         $field->setLiveValidation($lv->addValidatePresence());
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             // Handle Checkbox case that only support value as "on" or "off"
             if (get_class($field) == "CheckBox") {
                 if ($value == "1") {
                     $field->setValue("on");
                 } else {
                     $field->setValue("off");
                 }
             } else {
                 if (get_class($field) == "Calendar") {
                     $field->setValue($value);
                 } else {
                     $field->setValue(utf8encode($value));
                 }
             }
             if (isset($attribute_properties["width"]) && method_exists($field, "setWidth")) {
                 $field->setWidth($attribute_properties["width"]);
             }
             if (isset($attribute_properties["height"]) && method_exists($field, "setHeight")) {
                 $field->setHeight($attribute_properties["height"]);
             }
             if (isset($attribute_properties["class"]) && method_exists($field, "setClass")) {
                 $field->setClass($attribute_properties["class"]);
             }
             if (isset($attribute_properties["style"]) && method_exists($field, "setStyle")) {
                 $field->setStyle($attribute_properties["style"]);
             }
             if (isset($attribute_properties["disable"])) {
                 if ($attribute_properties["disable"] == true && method_exists($field, "disable")) {
                     $field->disable();
                 } else {
                     if ($attribute_properties["disable"] == false && method_exists($field, "enable")) {
                         $field->enable();
                     }
                 }
             }
             if (get_class($field) != "Calendar") {
                 if (isset($attribute_properties["strip_tags"]) && $attribute_properties["strip_tags"] == true && method_exists($field, "setStripTags")) {
                     if (isset($attribute_properties["allowable_tags"])) {
                         $field->setStripTags($attribute_properties["allowable_tags"]);
                     } else {
                         $field->setStripTags("");
                         // no tag allowed
                     }
                 }
             }
         } else {
             if (isset($attribute_properties['cmb_obj'])) {
                 $field_tmp = $attribute_properties['cmb_obj'];
                 $field_tmp->setValue($value);
                 $value = $field_tmp->getText();
             }
             if (get_class($value) == "DateTime") {
                 $value = $value->format("Y-m-d");
             }
             $field = new Object(utf8encode($value));
         }
         $this->fields_array[$attribute] = $field;
     }
     return $this->fields_array;
 }
Ejemplo n.º 8
0
 /**
  * Method createDbAttributeObject
  * @access private
  * @param mixed $row 
  * @param mixed $list_attribute 
  * @param mixed $list_attribute_type 
  * @param mixed $i 
  * @param mixed $ind 
  * @param mixed $key_attributes 
  * @return mixed
  * @since 1.1.6
  */
 private function createDbAttributeObject($row, $list_attribute, $list_attribute_type, $i, $ind, $key_attributes)
 {
     // get property cmb_obj (created by method loadFromSqlDataView)
     if (isset($this->from_sql_data_view_properties[$list_attribute[$i]]['cmb_obj'])) {
         $input_obj_tmp = $this->from_sql_data_view_properties[$list_attribute[$i]]['cmb_obj'];
         $input_obj = clone $input_obj_tmp;
         $input_obj->setName($this->id . "_input_" . $list_attribute[$i] . "_ind_" . $ind);
         $register_objects = WebSitePhpObject::getRegisterObjects();
         $register_objects[] = $input_obj;
         $_SESSION['websitephp_register_object'] = $register_objects;
     } else {
         $wspobject = "TextBox";
         $attribute_properties = array();
         if (is_array($this->from_sql_data_view_properties[$list_attribute[$i]])) {
             $attribute_properties = $this->from_sql_data_view_properties[$list_attribute[$i]];
         }
         if (isset($attribute_properties["wspobject"]) && $attribute_properties["wspobject"] != "") {
             $wspobject = $attribute_properties["wspobject"];
         } else {
             if ($list_attribute_type[$i] == "datetime") {
                 $wspobject = "Calendar";
             } else {
                 if ($list_attribute_type[$i] == "boolean") {
                     $wspobject = "CheckBox";
                 }
             }
         }
         if ($wspobject == "Calendar") {
             $input_obj = new Calendar($this->table_form_object, $this->id . "_input_" . $list_attribute[$i] . "_ind_" . $ind);
         } else {
             if ($wspobject == "CheckBox") {
                 $input_obj = new CheckBox($this->table_form_object, $this->id . "_input_" . $list_attribute[$i] . "_ind_" . $ind);
             } else {
                 if ($wspobject == "TextArea") {
                     $input_obj = new TextArea($this->table_form_object, $object_id);
                 } else {
                     if ($wspobject == "Editor") {
                         $input_obj = new Editor($this->table_form_object, $object_id);
                         if (isset($attribute_properties["editor_param"]) && $attribute_properties["editor_param"] != "") {
                             $input_obj->setToolbar($attribute_properties["editor_param"]);
                         }
                     } else {
                         if ($wspobject == "ComboBox") {
                             $input_obj = new ComboBox($this->table_form_object, $object_id);
                             if (isset($attribute_properties["combobox_values"])) {
                                 if (is_array($attribute_properties["combobox_values"])) {
                                     for ($j = 0; $j < sizeof($attribute_properties["combobox_values"]); $j++) {
                                         $input_obj->addItem($attribute_properties["combobox_values"][$j]['value'], $attribute_properties["combobox_values"][$j]['text']);
                                     }
                                 } else {
                                     throw new NewException(get_class($this) . "->loadFromSqlDataView() error: the property combobox_values need to be an array.", 0, getDebugBacktrace(1));
                                 }
                             }
                         } else {
                             $input_obj = new TextBox($this->table_form_object, $this->id . "_input_" . $list_attribute[$i] . "_ind_" . $ind);
                             if ($list_attribute_type[$i] == "integer" || $list_attribute_type[$i] == "double") {
                                 $input_obj->setWidth(70);
                             }
                             if (in_array($list_attribute[$i], $key_attributes)) {
                                 $lv = new LiveValidation();
                                 $input_obj->setLiveValidation($lv->addValidatePresence());
                             }
                         }
                     }
                 }
             }
         }
     }
     // get properties width and strip_tags
     if (is_array($this->from_sql_data_view_properties[$list_attribute[$i]])) {
         $attribute_properties = $this->from_sql_data_view_properties[$list_attribute[$i]];
         if (isset($attribute_properties["width"]) && method_exists($input_obj, "setWidth")) {
             $input_obj->setWidth($attribute_properties["width"]);
         }
         if (isset($attribute_properties["height"]) && method_exists($input_obj, "setHeight")) {
             $input_obj->setHeight($attribute_properties["height"]);
         }
         if (isset($attribute_properties["class"]) && method_exists($input_obj, "setClass")) {
             $input_obj->setClass($attribute_properties["class"]);
         }
         if (isset($attribute_properties["style"]) && method_exists($input_obj, "setStyle")) {
             $input_obj->setStyle($attribute_properties["style"]);
         }
         if (isset($attribute_properties["disable"])) {
             if ($attribute_properties["disable"] == true && method_exists($input_obj, "disable")) {
                 $input_obj->disable();
             } else {
                 if ($attribute_properties["disable"] == false && method_exists($input_obj, "enable")) {
                     $input_obj->enable();
                 }
             }
         }
         if (get_class($input_obj) != "Calendar") {
             if (isset($attribute_properties["strip_tags"]) && $attribute_properties["strip_tags"] == true && method_exists($input_obj, "setStripTags")) {
                 if (isset($attribute_properties["allowable_tags"])) {
                     $input_obj->setStripTags($attribute_properties["allowable_tags"]);
                 } else {
                     $input_obj->setStripTags("");
                     // no tag allowed
                 }
             }
         }
     }
     if ($row != null) {
         // get property db_attribute
         $field_value = $row->getValue($list_attribute[$i]);
         if (isset($this->from_sql_data_view_properties[$list_attribute[$i]]["db_attribute"])) {
             $db_attribute = $this->from_sql_data_view_properties[$list_attribute[$i]]["db_attribute"];
             $field_value = $row->getValue($db_attribute);
         }
         $input_obj->onChange("onChangeTableFromSqlDataView")->setAjaxEvent()->disableAjaxWaitMessage();
         if (get_class($input_obj) == "TextBox") {
             $input_obj->onKeyUpJs("if (\$(this)[0].defaultValue != \$(this).val()) { \$('#" . $this->id . "_img_" . $ind . "_cancel_" . $list_attribute[$i] . "').hide(); } else { \$('#" . $this->id . "_img_" . $ind . "_cancel_" . $list_attribute[$i] . "').show(); }");
         }
         if ($list_attribute_type[$i] == "boolean") {
             if (!$input_obj->isChanged()) {
                 $input_obj->setValue($field_value == true ? "on" : "off");
             }
         } else {
             if (gettype($field_value) == "object") {
                 $input_obj->setValue($field_value);
             } else {
                 $input_obj->setValue(utf8encode($field_value));
             }
         }
     }
     return $input_obj;
 }
Ejemplo n.º 9
0
 public function Load()
 {
     parent::$PAGE_TITLE = __(CONFIGURE_SITE);
     // Admin
     $this->form = new Form($this);
     $table_form = new Table();
     $table_form->addRow();
     $this->edtName = new TextBox($this->form, "edtName");
     $this->edtName->setValue(__(SITE_NAME))->setWidth(300);
     $this->edtName->onChange("changeSiteName")->setAjaxEvent()->disableAjaxWaitMessage();
     $edtValidation = new LiveValidation();
     $table_form->addRowColumns(__(EDT_NAME) . ":&nbsp;", $this->edtName->setLiveValidation($edtValidation->addValidatePresence()->setFieldName(__(EDT_NAME))));
     $this->edtDesc = new Editor($this->form, "edtDesc");
     $this->edtDesc->setValue(__(SITE_DESC));
     $this->edtDesc->setToolbar(Editor::TOOLBAR_NONE)->setWidth(290)->setHeight(100);
     $edtValidation = new LiveValidation();
     $table_form->addRowColumns(__(EDT_DESC) . ":&nbsp;", $this->edtDesc->setLiveValidation($edtValidation->addValidatePresence()->setFieldName(__(EDT_DESC))));
     $this->edtKey = new TextBox($this->form, "edtKey");
     $this->edtKey->setValue(__(SITE_KEYS))->setWidth(300);
     $edtValidation = new LiveValidation();
     $table_form->addRowColumns(__(EDT_KEY) . ":&nbsp;", $this->edtKey->setLiveValidation($edtValidation->addValidatePresence()->setFieldName(__(EDT_KEY))));
     $table_form->addRow();
     $this->cmbRating = new ComboBox($this->form, "cmbRating");
     $this->cmbRating->addItem("general", "general", SITE_RATING == "general" ? true : false)->addItem("mature", "mature", SITE_RATING == "mature" ? true : false)->addItem("restricted", "restricted", SITE_RATING == "restricted" ? true : false)->addItem("14years", "14years", SITE_RATING == "14years" ? true : false)->setWidth(143);
     $table_form->addRowColumns(__(CMB_RATING) . ":&nbsp;", $this->cmbRating);
     $this->edtAuthor = new TextBox($this->form, "edtAuthor");
     $this->edtAuthor->setValue(__(SITE_AUTHOR));
     $edtValidation = new LiveValidation();
     $table_form->addRowColumns(__(EDT_AUTHOR) . ":&nbsp;", $this->edtAuthor->setLiveValidation($edtValidation->addValidatePresence()->setFieldName(__(EDT_AUTHOR))));
     $this->cmbLanguage = new ComboBox($this->form, "cmbLanguage");
     $this->cmbLanguage->addItem("en", __(ENGLISH), SITE_DEFAULT_LANG == "en" ? true : false, "wsp/img/lang/en.png")->addItem("fr", __(FRENCH), SITE_DEFAULT_LANG == "fr" ? true : false, "wsp/img/lang/fr.png");
     //->addItem("de", __(GERMAN), (SITE_DEFAULT_LANG=="de")?true:false, "wsp/img/lang/de.png")->addItem("es", __(SPANISH), (SITE_DEFAULT_LANG=="es")?true:false, "wsp/img/lang/es.png")
     $this->cmbLanguage->setWidth(143);
     $table_form->addRowColumns(__(CMB_LANGUAGE) . ":&nbsp;", $this->cmbLanguage);
     $table_form->addRow();
     $this->cmbSiteType = new ComboBox($this->form, "cmbSiteType");
     $this->cmbSiteType->addItem("", "&nbsp;", SITE_META_OPENGRAPH_TYPE == "" ? true : false);
     $this->cmbSiteType->addItem("activity", "activity", SITE_META_OPENGRAPH_TYPE == "activity" ? true : false);
     $this->cmbSiteType->addItem("sport", "sport", SITE_META_OPENGRAPH_TYPE == "sport" ? true : false);
     $this->cmbSiteType->addItem("bar", "bar", SITE_META_OPENGRAPH_TYPE == "bar" ? true : false);
     $this->cmbSiteType->addItem("company", "company", SITE_META_OPENGRAPH_TYPE == "company" ? true : false);
     $this->cmbSiteType->addItem("cafe", "cafe", SITE_META_OPENGRAPH_TYPE == "cafe" ? true : false);
     $this->cmbSiteType->addItem("hotel", "hotel", SITE_META_OPENGRAPH_TYPE == "hotel" ? true : false);
     $this->cmbSiteType->addItem("restaurant", "restaurant", SITE_META_OPENGRAPH_TYPE == "restaurant" ? true : false);
     $this->cmbSiteType->addItem("cause", "cause", SITE_META_OPENGRAPH_TYPE == "cause" ? true : false);
     $this->cmbSiteType->addItem("sports_league", "sports league", SITE_META_OPENGRAPH_TYPE == "sports_league" ? true : false);
     $this->cmbSiteType->addItem("sports_team", "sports team", SITE_META_OPENGRAPH_TYPE == "sports_team" ? true : false);
     $this->cmbSiteType->addItem("band", "band", SITE_META_OPENGRAPH_TYPE == "band" ? true : false);
     $this->cmbSiteType->addItem("government", "government", SITE_META_OPENGRAPH_TYPE == "government" ? true : false);
     $this->cmbSiteType->addItem("non_profit", "non profit", SITE_META_OPENGRAPH_TYPE == "non_profit" ? true : false);
     $this->cmbSiteType->addItem("school", "school", SITE_META_OPENGRAPH_TYPE == "school" ? true : false);
     $this->cmbSiteType->addItem("university", "university", SITE_META_OPENGRAPH_TYPE == "university" ? true : false);
     $this->cmbSiteType->addItem("actor", "actor", SITE_META_OPENGRAPH_TYPE == "actor" ? true : false);
     $this->cmbSiteType->addItem("athlete", "athlete", SITE_META_OPENGRAPH_TYPE == "athlete" ? true : false);
     $this->cmbSiteType->addItem("author", "author", SITE_META_OPENGRAPH_TYPE == "author" ? true : false);
     $this->cmbSiteType->addItem("director", "director", SITE_META_OPENGRAPH_TYPE == "director" ? true : false);
     $this->cmbSiteType->addItem("musician", "musician", SITE_META_OPENGRAPH_TYPE == "musician" ? true : false);
     $this->cmbSiteType->addItem("politician", "politician", SITE_META_OPENGRAPH_TYPE == "politician" ? true : false);
     $this->cmbSiteType->addItem("profile", "profile", SITE_META_OPENGRAPH_TYPE == "profile" ? true : false);
     $this->cmbSiteType->addItem("public_figure", "public figure", SITE_META_OPENGRAPH_TYPE == "public_figure" ? true : false);
     $this->cmbSiteType->addItem("city", "city", SITE_META_OPENGRAPH_TYPE == "city" ? true : false);
     $this->cmbSiteType->addItem("country", "country", SITE_META_OPENGRAPH_TYPE == "country" ? true : false);
     $this->cmbSiteType->addItem("landmark", "landmark", SITE_META_OPENGRAPH_TYPE == "landmark" ? true : false);
     $this->cmbSiteType->addItem("state_province", "state province", SITE_META_OPENGRAPH_TYPE == "state_province" ? true : false);
     $this->cmbSiteType->addItem("album", "album", SITE_META_OPENGRAPH_TYPE == "album" ? true : false);
     $this->cmbSiteType->addItem("book", "book", SITE_META_OPENGRAPH_TYPE == "book" ? true : false);
     $this->cmbSiteType->addItem("drink", "drink", SITE_META_OPENGRAPH_TYPE == "drink" ? true : false);
     $this->cmbSiteType->addItem("food", "food", SITE_META_OPENGRAPH_TYPE == "food" ? true : false);
     $this->cmbSiteType->addItem("game", "game", SITE_META_OPENGRAPH_TYPE == "game" ? true : false);
     $this->cmbSiteType->addItem("movie", "movie", SITE_META_OPENGRAPH_TYPE == "movie" ? true : false);
     $this->cmbSiteType->addItem("product", "product", SITE_META_OPENGRAPH_TYPE == "product" ? true : false);
     $this->cmbSiteType->addItem("song", "song", SITE_META_OPENGRAPH_TYPE == "song" ? true : false);
     $this->cmbSiteType->addItem("tv_show", "tv show", SITE_META_OPENGRAPH_TYPE == "tv_show" ? true : false);
     $this->cmbSiteType->addItem("article", "article", SITE_META_OPENGRAPH_TYPE == "article" ? true : false);
     $this->cmbSiteType->addItem("blog", "blog", SITE_META_OPENGRAPH_TYPE == "blog" ? true : false);
     $this->cmbSiteType->addItem("website", "website", SITE_META_OPENGRAPH_TYPE == "website" ? true : false);
     $this->cmbSiteType->setWidth(143);
     $table_form->addRowColumns(__(CMB_SITE_TYPE) . ":&nbsp;", $this->cmbSiteType);
     $this->edtSiteImage = new TextBox($this->form, "edtSiteImage");
     $this->edtSiteImage->setValue(SITE_META_OPENGRAPH_IMAGE)->setWidth(300);
     $table_form->addRowColumns(__(EDT_SITE_IMAGE) . ":&nbsp;", $this->edtSiteImage);
     $table_form->addRow();
     $this->edtSiteIphoneImage57 = new TextBox($this->form, "edtSiteIphoneImage57");
     $this->edtSiteIphoneImage57->setValue(SITE_META_IPHONE_IMAGE_57PX)->setWidth(300);
     $table_form->addRowColumns(__(EDT_SITE_IPHONE_IMAGE_57PX) . ":&nbsp;", $this->edtSiteIphoneImage57);
     $this->edtSiteIphoneImage72 = new TextBox($this->form, "edtSiteIphoneImage72");
     $this->edtSiteIphoneImage72->setValue(SITE_META_IPHONE_IMAGE_72PX)->setWidth(300);
     $table_form->addRowColumns(__(EDT_SITE_IPHONE_IMAGE_72PX) . ":&nbsp;", $this->edtSiteIphoneImage72);
     $this->edtSiteIphoneImage114 = new TextBox($this->form, "edtSiteIphoneImage114");
     $this->edtSiteIphoneImage114->setValue(SITE_META_IPHONE_IMAGE_114PX)->setWidth(300);
     $table_form->addRowColumns(__(EDT_SITE_IPHONE_IMAGE_114PX) . ":&nbsp;", $this->edtSiteIphoneImage114);
     if (!defined("SITE_META_IPHONE_IMAGE_152PX")) {
         define("SITE_META_IPHONE_IMAGE_152PX", "");
     }
     $this->edtSiteIphoneImage152 = new TextBox($this->form, "edtSiteIphoneImage152");
     $this->edtSiteIphoneImage152->setValue(SITE_META_IPHONE_IMAGE_152PX)->setWidth(300);
     $table_form->addRowColumns(__(EDT_SITE_IPHONE_IMAGE_152PX) . ":&nbsp;", $this->edtSiteIphoneImage152);
     $table_form->addRow();
     $this->edtGoogleTracker = new TextBox($this->form, "edtGoogleTracker");
     $this->edtGoogleTracker->setValue(GOOGLE_CODE_TRACKER);
     $table_form->addRowColumns(__(EDT_GOOGLE_CODE_TRACKER) . ":&nbsp;", $this->edtGoogleTracker);
     /*$this->edtGoogleMapKey = new TextBox($this->form, "edtGoogleMapKey");
     		$this->edtGoogleMapKey->setValue(GOOGLE_MAP_KEY);
     		$table_form->addRowColumns(__(EDT_GOOGLE_MAP_KEY).":&nbsp;", $this->edtGoogleMapKey);*/
     $table_form->addRow();
     $this->cmbMetaRobots = new ComboBox($this->form, "cmbMetaRobots");
     $this->cmbMetaRobots->addItem("index, follow", "index, follow", SITE_META_ROBOTS == "index, follow" ? true : false);
     $this->cmbMetaRobots->addItem("noindex, follow", "noindex, follow", SITE_META_ROBOTS == "noindex, follow" ? true : false);
     $this->cmbMetaRobots->addItem("index, nofollow", "index, nofollow", SITE_META_ROBOTS == "index, nofollow" ? true : false);
     $this->cmbMetaRobots->addItem("noindex, nofollow", "noindex, nofollow", SITE_META_ROBOTS == "noindex, nofollow" ? true : false);
     $this->cmbMetaRobots->setWidth(143);
     $table_form->addRowColumns(__(CMB_META_ROBOTS) . ":&nbsp;", $this->cmbMetaRobots);
     $this->cmbMetaGooglebot = new ComboBox($this->form, "cmbMetaGooglebot");
     $this->cmbMetaGooglebot->addItem("", "&nbsp;", SITE_META_GOOGLEBOTS == "" ? true : false);
     $this->cmbMetaGooglebot->addItem("archive", "archive", SITE_META_ROBOTS == "archive" ? true : false);
     $this->cmbMetaGooglebot->addItem("noarchive", "noarchive", SITE_META_ROBOTS == "noarchive" ? true : false);
     $this->cmbMetaGooglebot->setWidth(143);
     $table_form->addRowColumns(__(CMB_META_GOOGLEBOTS) . ":&nbsp;", $this->cmbMetaGooglebot);
     $this->edtRevisitAfter = new TextBox($this->form, "edtRevisitAfter");
     $this->edtRevisitAfter->setValue(SITE_META_REVISIT_AFTER)->setWidth(80);
     $edtValidation = new LiveValidation();
     $table_form->addRowColumns(__(EDT_REVISIT_AFTER) . ":&nbsp;", new Object($this->edtRevisitAfter->setLiveValidation($edtValidation->addValidatePresence()->addValidateNumericality(true)->setFieldName(__(EDT_REVISIT_AFTER))), "&nbsp;" . __(DAYS)));
     $table_form->addRow();
     $this->btnValidateF1 = new Button($this->form, "btnValidateF1");
     $this->btnValidateF1->setValue(__(BTN_VALIDATE))->onClick("configureSite")->setAjaxEvent();
     $table_form->addRowColumns($this->btnValidateF1)->setColumnColspan(1, 3)->setColumnAlign(1, RowTable::ALIGN_CENTER);
     $this->form->setContent($table_form);
     // advance tab
     $this->form2 = new Form($this);
     $table_form2 = new Table();
     $table_form2->addRow();
     $this->cmbJQueryVersion = new ComboBox($this->form2, "cmbJQueryVersion");
     $this->cmbJQueryVersion->setWidth(143);
     $table_form2->addRowColumns(__(CMB_JQUERY_VERSION) . ":&nbsp;", $this->cmbJQueryVersion);
     $this->cmbJQueryUIVersion = new ComboBox($this->form2, "cmbJQueryUIVersion");
     $this->cmbJQueryUIVersion->setWidth(143);
     $table_form2->addRowColumns(__(CMB_JQUERY_UI_VERSION) . ":&nbsp;", $this->cmbJQueryUIVersion);
     $jquery_dir = SITE_DIRECTORY . "/wsp/js/jquery/";
     $files = scandir($jquery_dir, 0);
     for ($i = 0; $i < sizeof($files); $i++) {
         $file = $files[$i];
         if (is_file($jquery_dir . $file)) {
             $version = str_replace("jquery-", "", str_replace(".min.js", "", $file));
             if (is_numeric(str_replace(".", "", $version))) {
                 $this->cmbJQueryVersion->addItem($version, $version, JQUERY_VERSION == $version ? true : false);
             } else {
                 if (substr($version, 0, 3) == "ui-" && substr($version, strlen($version) - 7, strlen($version)) == ".custom") {
                     $version = str_replace("ui-", "", str_replace(".custom", "", $version));
                     $this->cmbJQueryUIVersion->addItem($version, $version, JQUERY_UI_VERSION == $version ? true : false);
                 }
             }
         }
     }
     $this->cmbJqueryLocal = new ComboBox($this->form2, "cmbJqueryLocal");
     $this->cmbJqueryLocal->addItem("true", "true", JQUERY_LOAD_LOCAL == true ? true : false);
     $this->cmbJqueryLocal->addItem("false", "false", JQUERY_LOAD_LOCAL == false ? true : false);
     $this->cmbJqueryLocal->setWidth(143);
     $table_form2->addRowColumns(__(CMB_JQUERY_LOAD_LOCAL) . ":&nbsp;", $this->cmbJqueryLocal);
     $table_form2->addRow();
     $this->edtDefaultTimezone = new TextBox($this->form2, "edtDefaultTimezone");
     $this->edtDefaultTimezone->setValue(DEFAULT_TIMEZONE);
     $edtValidation = new LiveValidation();
     $table_form2->addRowColumns(__(EDT_DEFAULT_TIMEZONE) . ":&nbsp;", $this->edtDefaultTimezone->setLiveValidation($edtValidation->addValidatePresence()->setFieldName(__(EDT_DEFAULT_TIMEZONE))));
     $table_form2->addRow();
     $this->edtMaxSessionTime = new TextBox($this->form2, "edtMaxSessionTime");
     $this->edtMaxSessionTime->setValue(MAX_SESSION_TIME)->setWidth(80);
     $edtValidation = new LiveValidation();
     $table_form2->addRowColumns(__(EDT_MAX_SESSION_TIME) . ":&nbsp;", new Object($this->edtMaxSessionTime->setLiveValidation($edtValidation->addValidatePresence()->addValidateNumericality(true)->setFieldName(__(EDT_MAX_SESSION_TIME))), "&nbsp;" . __(SECONDS)));
     $table_form2->addRow();
     $this->cmbCachingAllPage = new ComboBox($this->form2, "cmbCachingAllPage");
     $this->cmbCachingAllPage->addItem("true", "true", CACHING_ALL_PAGES == true ? true : false);
     $this->cmbCachingAllPage->addItem("false", "false", CACHING_ALL_PAGES == false ? true : false);
     $this->cmbCachingAllPage->onChange("changeCachingAllPage")->setAjaxEvent()->disableAjaxWaitMessage();
     $this->cmbCachingAllPage->setWidth(143);
     $table_form2->addRowColumns(__(CMB_CACHING_ALL_PAGES) . ":&nbsp;", $this->cmbCachingAllPage);
     $this->edtCacheTime = new TextBox($this->form2, "edtCacheTime");
     $this->edtCacheTime->setValue(CACHE_TIME)->setWidth(80);
     if (CACHING_ALL_PAGES == false) {
         $this->edtCacheTime->disable();
         $this->edtCacheTime->setValue("");
     }
     $edtValidation = new LiveValidation();
     $table_form2->addRowColumns(__(EDT_CACHE_TIME) . ":&nbsp;", new Object($this->edtCacheTime->setLiveValidation($edtValidation->addValidatePresence()->addValidateNumericality(true)->setFieldName(__(EDT_CACHE_TIME))), "&nbsp;" . __(SECONDS)));
     /*if (!defined("LITE_PHP_BROWSCAP")) {
     			define("LITE_PHP_BROWSCAP", true);
     		}
     		$this->cmbBrowscap = new ComboBox($this->form2, "cmbBrowscap");
     		$this->cmbBrowscap->addItem("true", "true", (LITE_PHP_BROWSCAP==true)?true:false);
     		$this->cmbBrowscap->addItem("false", "false", (LITE_PHP_BROWSCAP==false)?true:false);
     		$this->cmbBrowscap->setWidth(143);
     		$table_form2->addRowColumns(__(CMB_LITE_PHP_BROWSCAP).":&nbsp;", $this->cmbBrowscap);
     		$table_form2->addRowColumns("&nbsp;", __(LITE_PHP_BROWSCAP_EXPLANATION));*/
     /*$this->cmbJsCompression = new ComboBox($this->form);
     		$this->cmbJsCompression->addItem("NONE", "NONE", (JS_COMPRESSION_TYPE=="NONE")?true:false);
     		$this->cmbJsCompression->addItem("GOOGLE_WS", "GOOGLE_WS", (JS_COMPRESSION_TYPE=="GOOGLE_WS")?true:false);
     		$this->cmbJsCompression->addItem("LOCAL", "LOCAL", (JS_COMPRESSION_TYPE=="LOCAL")?true:false);
     		$this->cmbJsCompression->setWidth(143);
     		$table_form->addRowColumns(__(CMB_JS_COMPRESSION_TYPE).":&nbsp;", $this->cmbJsCompression);*/
     $table_form2->addRow();
     $this->cmbDebug = new ComboBox($this->form2, "cmbDebug");
     $this->cmbDebug->addItem("true", "true", DEBUG == true ? true : false);
     $this->cmbDebug->addItem("false", "false", DEBUG == false ? true : false);
     $this->cmbDebug->setWidth(143);
     $table_form2->addRowColumns(__(CMB_DEBUG) . ":&nbsp;", $this->cmbDebug);
     $table_form2->addRow();
     if (!defined("SEND_ERROR_BY_MAIL")) {
         define(SEND_ERROR_BY_MAIL, false);
     }
     $this->cmbSendErrorByMail = new ComboBox($this->form2, "cmbSendErrorByMail");
     $this->cmbSendErrorByMail->addItem("true", "true", SEND_ERROR_BY_MAIL == true ? true : false);
     $this->cmbSendErrorByMail->addItem("false", "false", SEND_ERROR_BY_MAIL == false ? true : false);
     $this->cmbSendErrorByMail->setWidth(143);
     $this->cmbSendErrorByMail->onChange("changeSendErrorByMail")->setAjaxEvent()->disableAjaxWaitMessage();
     $table_form2->addRowColumns(__(CMB_SEND_ERROR_BY_MAIL) . ":&nbsp;", $this->cmbSendErrorByMail);
     $this->edtSendErrorByMailTo = new TextBox($this->form2, "edtSendErrorByMailTo");
     $this->edtSendErrorByMailTo->setWidth(143)->setValue(defined("SEND_ERROR_BY_MAIL_TO") ? SEND_ERROR_BY_MAIL_TO : "");
     if (SEND_ERROR_BY_MAIL == false) {
         $this->edtSendErrorByMailTo->disable();
     }
     $edtValidation = new LiveValidation();
     $this->edtSendErrorByMailTo->setLiveValidation($edtValidation->addValidateEmail()->setFieldName(__(EDT_SEND_ERROR_BY_MAIL_TO)));
     $table_form2->addRowColumns(__(EDT_SEND_ERROR_BY_MAIL_TO) . ":&nbsp;", new Object($this->edtSendErrorByMailTo, "&nbsp;", __(SEND_ERROR_BY_MAIL_CMT)));
     if (!defined("SEND_JS_ERROR_BY_MAIL")) {
         define(SEND_JS_ERROR_BY_MAIL, false);
     }
     $this->cmbSendJsErrorByMail = new ComboBox($this->form2, "cmbSendJsErrorByMail");
     $this->cmbSendJsErrorByMail->addItem("true", "true", SEND_JS_ERROR_BY_MAIL == true ? true : false);
     $this->cmbSendJsErrorByMail->addItem("false", "false", SEND_JS_ERROR_BY_MAIL == false ? true : false);
     $this->cmbSendJsErrorByMail->setWidth(143);
     $table_form2->addRowColumns(__(CMB_SEND_JS_ERROR_BY_MAIL) . ":&nbsp;", $this->cmbSendJsErrorByMail);
     if (defined("SEND_BY_MAIL_FILE_EX")) {
         $this->array_files_ex = explode(',', SEND_BY_MAIL_FILE_EX);
     } else {
         $this->array_files_ex = array();
     }
     $this->hidden_nb_exclude_files = new Hidden($this->form2, "hidden_nb_exclude_files");
     if ($this->hidden_nb_exclude_files->getValue() == "") {
         if (sizeof($this->array_files_ex) > 0) {
             $this->hidden_nb_exclude_files->setValue(sizeof($this->array_files_ex) + 1);
         } else {
             $this->hidden_nb_exclude_files->setValue($this->nb_min_exclude_files);
         }
     }
     $table_form2->addRowColumns("", $this->hidden_nb_exclude_files);
     $this->exclude_files_table = new Table();
     $this->exclude_files_table->setId("exclude_files_table_id");
     $this->nb_empty_exclude_files = 0;
     $this->edt_exclude_files = array();
     for ($i = 1; $i <= $this->hidden_nb_exclude_files->getValue(); $i++) {
         $edt_exclude_files = $this->createExcludedFile();
         if (trim($edt_exclude_files->getValue()) == "") {
             if ($this->edt_exclude_files_focus == null) {
                 $this->edt_exclude_files_focus = $edt_exclude_files;
             }
             $this->nb_empty_exclude_files++;
         }
     }
     $table_form2->addRowColumns(__(EDT_SEND_BY_MAIL_FILE_EX) . ":&nbsp;<br/><i><font size=1>" . __(EDT_SEND_BY_MAIL_FILE_EX_CMT) . "</font></i>", $this->exclude_files_table)->setValign(RowTable::VALIGN_TOP);
     $this->changeSendErrorByMail();
     $table_form2->addRow();
     $this->edtMaxBadUrlBeforeBan = new TextBox($this->form2, "edtMaxBadUrlBeforeBan");
     $this->edtMaxBadUrlBeforeBan->setWidth(143)->setValue(MAX_BAD_URL_BEFORE_BANNED);
     $edtValidation = new LiveValidation();
     $this->edtMaxBadUrlBeforeBan->setLiveValidation($edtValidation->addValidatePresence()->addValidateNumericality()->setFieldName(__(EDT_MAX_BAD_URL_BEFORE_BANNED)));
     $table_form2->addRowColumns(__(EDT_MAX_BAD_URL_BEFORE_BANNED) . ":&nbsp;", $this->edtMaxBadUrlBeforeBan);
     $table_form2->addRow();
     if (!defined("SEND_ADMIN_CONNECT_BY_MAIL")) {
         define(SEND_ADMIN_CONNECT_BY_MAIL, false);
     }
     $this->cmbSendAdminConnectByMail = new ComboBox($this->form2, "cmbSendAdminConnectByMail");
     $this->cmbSendAdminConnectByMail->addItem("true", "true", SEND_ADMIN_CONNECT_BY_MAIL == true ? true : false);
     $this->cmbSendAdminConnectByMail->addItem("false", "false", SEND_ADMIN_CONNECT_BY_MAIL == false ? true : false);
     $this->cmbSendAdminConnectByMail->setWidth(143);
     $this->cmbSendAdminConnectByMail->onChange("changeSendAdminConnectByMail")->setAjaxEvent()->disableAjaxWaitMessage();
     $table_form2->addRowColumns(__(CMB_SEND_ADMIN_CONNECT_BY_MAIL) . ":&nbsp;", $this->cmbSendAdminConnectByMail);
     $this->edtSendAdminConnectByMailTo = new TextBox($this->form2, "edtSendAdminConnectByMailTo");
     $this->edtSendAdminConnectByMailTo->setWidth(143)->setValue(defined("SEND_ADMIN_CONNECT_BY_MAIL_TO") ? SEND_ADMIN_CONNECT_BY_MAIL_TO : "");
     if (SEND_ADMIN_CONNECT_BY_MAIL == false) {
         $this->edtSendAdminConnectByMailTo->disable();
     }
     $edtValidation = new LiveValidation();
     $this->edtSendAdminConnectByMailTo->setLiveValidation($edtValidation->addValidateEmail()->setFieldName(__(EDT_SEND_ADMIN_CONNECT_BY_MAIL_TO)));
     $table_form2->addRowColumns(__(EDT_SEND_ADMIN_CONNECT_BY_MAIL_TO) . ":&nbsp;", new Object($this->edtSendAdminConnectByMailTo, "&nbsp;", __(SEND_ADMIN_CONNECT_BY_MAIL_CMT)));
     $table_form2->addRow();
     $this->edtCdnServer = new TextBox($this->form2, "edtCdnServer");
     if (!defined("CDN_SERVER") || CDN_SERVER == "") {
         $this->edtCdnServer->setValue("http://");
     } else {
         $this->edtCdnServer->setValue(CDN_SERVER);
     }
     $table_form2->addRowColumns(__(EDT_CDN_SERVER) . ":&nbsp;", $this->edtCdnServer->setWidth(300));
     $table_form2->addRowColumns("&nbsp;", __(CDN_SERVER_CMT));
     $this->edtForceServerName = new TextBox($this->form2, "edtForceServerName");
     if (FORCE_SERVER_NAME == "") {
         $this->edtForceServerName->setValue("http://");
     } else {
         $this->edtForceServerName->setValue(FORCE_SERVER_NAME);
     }
     $table_form2->addRowColumns(__(EDT_FORCE_SERVER_NAME) . ":&nbsp;", $this->edtForceServerName->setWidth(300));
     $table_form2->addRowColumns("&nbsp;", __(PROBLEM_WITH_REDIRECT));
     $table_form2->addRow();
     $this->btnValidateF2 = new Button($this->form2, "btnValidateF2");
     $this->btnValidateF2->setValue(__(BTN_VALIDATE))->onClick("configureSite")->setAjaxEvent();
     $table_form2->addRowColumns($this->btnValidateF2)->setColumnColspan(1, 3)->setColumnAlign(1, RowTable::ALIGN_CENTER);
     $table_form2->addRow();
     $this->form2->setContent($table_form2);
     $tabs = new Tabs("tabs_id");
     $tabs->addTab(__(TAB_SITE), $this->form);
     $tabs->addTab(__(TAB_ADVANCE), $this->form2);
     $this->render = new AdminTemplateForm($this, $tabs);
 }