Exemple #1
0
 public function Load()
 {
     parent::$PAGE_TITLE = __(ERROR_USER_BANNED) . " - " . __(SITE_NAME);
     parent::$PAGE_META_ROBOTS = "noindex, nofollow";
     $can_use_captacha = true;
     if (WspBannedVisitors::isBannedIp($this->getRemoteIP())) {
         $last_access = new DateTime(WspBannedVisitors::getBannedIpLastAccess($this->getRemoteIP()));
         $duration = WspBannedVisitors::getBannedIpDuration($this->getRemoteIP());
         $dte_ban = $last_access->modify("+" . $duration . " seconds");
         if ($dte_ban > new DateTime()) {
             $can_use_captacha = false;
         }
     }
     $obj_error_msg = new Object(new Picture("wsp/img/warning.png", 48, 48, 0, "absmidlle"), "<br/><br/>");
     $obj_error_msg->add(new Label(__(ERROR_USER_BANNED_MSG_1), true), "<br/>");
     if ($can_use_captacha) {
         $obj_error_msg->add(new Label(__(ERROR_USER_BANNED_MSG_2), true), "<br/><br/>");
         $this->captcha_error_obj = new Object();
         $form = new Form($this);
         $this->captcha = new Captcha($form);
         $this->captcha->setFocus();
         $unblock_btn = new Button($form);
         $unblock_btn->setValue(__(ERROR_USER_BUTTON))->onClick("onClickUnblock");
         $form->setContent(new Object($this->captcha, "<br/>", $unblock_btn));
         $obj_error_msg->add($this->captcha_error_obj, "<br/>", $form);
     }
     $obj_error_msg->add("<br/><br/>", __(MAIN_PAGE_GO_BACK), new Link(BASE_URL, Link::TARGET_NONE, __(SITE_NAME)));
     $this->render = new ErrorTemplate($obj_error_msg, __(ERROR_USER_BANNED));
 }
 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);
 }
Exemple #3
0
 public function Load()
 {
     $this->setTimeout(0);
     if ($this->getExtractLastWspVersion()) {
         $congratulation_pic = new Picture("img/wsp-admin/button_ok_64.png", 64, 64);
         $this->render = new Object($congratulation_pic, "<br/>", __(UPDATE_FRAMEWORK_COMPLETE_OK, "WebSite-PHP"));
     } else {
         $error_pic = new Picture("img/wsp-admin/button_not_ok_64.png", 64, 64);
         $this->render = new Object($error_pic, "<br/>", __(UPDATE_FRAMEWORK_COMPLETE_NOT_OK, "WebSite-PHP"));
     }
     $button_ok = new Button($this);
     $button_ok->setValue("OK");
     $button_ok->onClickJs(DialogBox::closeAll() . "location.href=location.href;");
     $this->render->add("<br/><br/>", $button_ok);
     $this->render->setAlign(Object::ALIGN_CENTER);
 }
Exemple #4
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);
 }
 public function Load()
 {
     unset($_SESSION['user_browscap_version']);
     if ($this->updateBrowscapFile()) {
         $congratulation_pic = new Picture("img/wsp-admin/button_ok_64.png", 64, 64);
         $this->render = new Object($congratulation_pic, "<br/>", __(UPDATE_FRAMEWORK_COMPLETE_OK, "Browscap.ini"));
     } else {
         $error_pic = new Picture("img/wsp-admin/button_not_ok_64.png", 64, 64);
         $this->render = new Object($error_pic, "<br/>", __(UPDATE_FRAMEWORK_COMPLETE_NOT_OK, "Browscap.ini"));
     }
     $button_ok = new Button($this);
     $button_ok->setValue("OK");
     $button_ok->onClickJs(DialogBox::closeAll() . "location.href=location.href;");
     $this->render->add("<br/><br/>", $button_ok);
     $this->render->setAlign(Object::ALIGN_CENTER);
     // refresh the page
     $this->addObject(new JavaScript("setTimeout('location.href=location.href;', 1000);"));
 }
Exemple #6
0
 public function updateRequest(array $params)
 {
     $this->checkXP();
     $pluginDto = $this->getPluginDtoByKey($params);
     $language = OW::getLanguage();
     $remotePluginInfo = (array) $this->pluginService->getItemInfoForUpdate($pluginDto->getKey(), $pluginDto->getDeveloperKey());
     if (empty($remotePluginInfo) || !empty($remotePluginInfo['error'])) {
         $this->assign('mode', 'error');
         $this->assign('text', $language->text('admin', 'plugin_update_request_error'));
         $this->assign('returnUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'index'));
     } else {
         if ((bool) $remotePluginInfo['freeware']) {
             $this->assign('mode', 'free');
             $this->assign('text', $language->text('admin', 'free_plugin_request_text', array('oldVersion' => $pluginDto->getBuild(), 'newVersion' => $remotePluginInfo['build'], 'name' => $pluginDto->getTitle())));
             $this->assign('redirectUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'update', $params));
             $this->assign('returnUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'index'));
         } else {
             if ($pluginDto->getLicenseKey() != null) {
                 $result = $this->pluginService->checkLicenseKey($pluginDto->getKey(), $pluginDto->getDeveloperKey(), $pluginDto->getLicenseKey());
                 if ($result === true) {
                     $params['licenseKey'] = $pluginDto->getLicenseKey();
                     $this->redirect(OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'update', $params));
                     return;
                 }
             }
             $this->assign('text', $language->text('admin', 'com_plugin_request_text', array('oldVersion' => $pluginDto->getBuild(), 'newVersion' => $remotePluginInfo['build'], 'name' => $pluginDto->getTitle())));
             $form = new Form('license-key');
             $licenseKey = new TextField('key');
             $licenseKey->setValue($pluginDto->getLicenseKey());
             $licenseKey->setRequired();
             $licenseKey->setLabel($language->text('admin', 'com_plugin_request_key_label'));
             $form->addElement($licenseKey);
             $submit = new Submit('submit');
             $submit->setValue($language->text('admin', 'license_form_submit_label'));
             $form->addElement($submit);
             $button = new Button('button');
             $button->setValue($language->text('admin', 'license_form_leave_label'));
             $button->addAttribute('onclick', "window.location='" . OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'index') . "'");
             $form->addElement($button);
             $this->addForm($form);
             if (OW::getRequest()->isPost()) {
                 if ($form->isValid($_POST)) {
                     $data = $form->getValues();
                     $params['licenseKey'] = $data['key'];
                     $result = $this->pluginService->checkLicenseKey($pluginDto->getKey(), $pluginDto->getDeveloperKey(), $data['key']);
                     if ($result === true) {
                         $pluginDto->setLicenseKey($data['key']);
                         BOL_PluginService::getInstance()->savePlugin($pluginDto);
                         $this->redirect(OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'update', $params));
                     } else {
                         OW::getFeedback()->error($language->text('admin', 'plugins_manage_invalid_license_key_error_message'));
                         $this->redirect();
                     }
                 }
             }
         }
     }
 }
 /**
  * Overwrite the value property according to given type
  */
 private function overwriteValue()
 {
     $typeNumber = (int) preg_replace('$type$', '', $this->getType());
     $constName = 'PLUGIN_EVENT_TYPESETBUTTONS_SQUOTES' . $typeNumber . '_BUTTON';
     parent::setValue(constant($constName));
 }
Exemple #8
0
 /**
  * Set the button text
  *
  * @param  string    $text  Button text
  * @access public
  */
 function setButtonText($text)
 {
     $this->_buttonText = $text;
     $this->_button->setValue($text);
 }
Exemple #9
0
 public function updateRequest(array $params)
 {
     $this->checkXP();
     $themeDto = $this->getThemeDtoByName($params);
     $language = OW::getLanguage();
     $remoteThemeInfo = (array) $this->themeService->getThemeInfoForUpdate($themeDto->getName(), $themeDto->getDeveloperKey());
     if (empty($remoteThemeInfo) || !empty($remoteThemeInfo['error'])) {
         $this->assign('mode', 'error');
         $this->assign('text', $language->text('admin', 'theme_update_request_error'));
         $this->assign('returnUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Themes', 'chooseTheme'));
     } else {
         if ((bool) $remoteThemeInfo['freeware']) {
             $this->assign('mode', 'free');
             $this->assign('text', $language->text('admin', 'free_theme_request_text', array('oldVersion' => $themeDto->getBuild(), 'newVersion' => $remoteThemeInfo['build'], 'name' => $themeDto->getTitle())));
             $this->assign('redirectUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Themes', 'update', $params));
             $this->assign('returnUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Themes', 'chooseTheme'));
         } else {
             if ($remoteThemeInfo['build'] === null) {
                 $query = "UPDATE `" . OW_DB_PREFIX . "base_theme` SET `update` = 0 WHERE `name` = :name";
                 OW::getDbo()->query($query, array('name' => $params['name']));
                 $this->assign('mode', 'error');
                 $this->assign('text', $language->text('admin', 'theme_update_not_available_error'));
                 $this->assign('returnUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Themes', 'chooseTheme'));
             } else {
                 $this->assign('text', $language->text('admin', 'com_theme_request_text', array('oldVersion' => $themeDto->getBuild(), 'newVersion' => $remoteThemeInfo['build'], 'name' => $themeDto->getTitle())));
                 $form = new Form('license-key');
                 $licenseKey = new TextField('key');
                 $licenseKey->setValue($themeDto->getLicenseKey());
                 $licenseKey->setRequired();
                 $licenseKey->setLabel($language->text('admin', 'com_theme_request_name_label'));
                 $form->addElement($licenseKey);
                 $submit = new Submit('submit');
                 $submit->setValue($language->text('admin', 'license_form_submit_label'));
                 $form->addElement($submit);
                 $button = new Button('button');
                 $button->setValue($language->text('admin', 'license_form_leave_label'));
                 $button->addAttribute('onclick', "window.location='" . OW::getRouter()->urlFor('ADMIN_CTRL_Themes', 'chooseTheme') . "'");
                 $form->addElement($button);
                 $this->addForm($form);
                 if (OW::getRequest()->isPost()) {
                     if ($form->isValid($_POST)) {
                         $data = $form->getValues();
                         $params['licenseKey'] = $data['key'];
                         $result = $this->themeService->checkLicenseKey($themeDto->getName(), $themeDto->getDeveloperKey(), $data['key']);
                         if ($result === true) {
                             $this->redirect(OW::getRouter()->urlFor('ADMIN_CTRL_Themes', 'update', $params));
                         } else {
                             OW::getFeedback()->error($language->text('admin', 'themes_manage_invalid_license_key_error_message'));
                             $this->redirect();
                         }
                     }
                 }
             }
         }
     }
 }
 public function Load()
 {
     parent::$PAGE_TITLE = __(MANAGE_TRANSLATIONS);
     $content = new Object();
     // Search in all translation files the labels
     // Features :
     // - get the list of the labels for a page / language
     // - display for each label if there is a translation in all the language of the website
     // - enter a new label
     // - update a label
     // - delete a label
     $translate_table = new Table();
     $translate_table->setDefaultValign(RowTable::VALIGN_TOP);
     if (!isset($_GET['language'])) {
         $_GET['language'] = $this->getLanguage();
     }
     $this->form = new Form($this);
     $this->form->setAction($this->getCurrentURLWithoutParameters() . "?language=" . $_GET['language']);
     $this->hdn_old_file = new Hidden($this->form, "hdn_old_file");
     $content->add($this->hdn_old_file);
     $tree = new TreeView("wsp_lang_files");
     $array_path = explode("/", $this->getRootWspDirectory());
     $root = new TreeViewFolder($array_path[sizeof($array_path) - 1]);
     $tree_page_items = new TreeViewItems();
     $dir = $this->getRootWspDirectory() . "/lang/" . $_GET['language'] . "/";
     $array_files = $this->loadFiles($dir, '', $_GET['language']);
     foreach ($array_files as $key => $value) {
         $tree_page_type = new TreeViewFolder($key);
         $tree_page_type->expand();
         $tree_page_items->add($tree_page_type);
         $tree_items = new TreeViewItems();
         $array_folder = array();
         for ($i = 0; $i < sizeof($value); $i++) {
             $file = $value[$i];
             $expand = false;
             if ($file == $_GET['file']) {
                 $expand = true;
             }
             $array_path = explode('/', $file);
             $file_name = $array_path[sizeof($array_path) - 1];
             $array_path[sizeof($array_path) - 1] = null;
             $folder = implode('/', $array_path);
             if ($folder == "") {
                 $parent_tree_items = $tree_items;
             } else {
                 if (isset($array_folder[$folder])) {
                     $parent_tree_items = $array_folder[$folder];
                     $tree_folder = $parent_tree_items->getTreeViewItemParent();
                     if (!$tree_folder->isExpand()) {
                         if ($expand) {
                             $tree_folder->expand();
                         } else {
                             $tree_folder->collapse();
                         }
                     }
                 } else {
                     $tree_folder = new TreeViewFolder($folder);
                     if ($expand) {
                         $tree_folder->expand();
                     } else {
                         $tree_folder->collapse();
                     }
                     $tree_items->add($tree_folder);
                     $parent_tree_items = new TreeViewItems();
                     $tree_folder->setTreeViewItems($parent_tree_items);
                     $array_folder[$folder] = $parent_tree_items;
                 }
             }
             $file_link = new Button($this->form);
             $file_name_label = new Label($file_name);
             $file_name_label->setId("file_label_" . str_replace("/", "_slashsep_", str_replace(".", "_", str_replace("-", "_", $file))));
             $this->array_files_label[$file] = $file_name_label;
             $file_link->setValue($file_name_label)->setIsLink();
             $file_link->onClick("loadTranslation", $file, $this->hdn_old_file, $_GET['language'], 1)->setAjaxEvent();
             $tree_file = new TreeViewFile($file_link);
             $parent_tree_items->add($tree_file);
         }
         $tree_page_type->setTreeViewItems($tree_items);
     }
     $root->setTreeViewItems($tree_page_items);
     $root_items = new TreeViewItems();
     $root_items->add($root);
     $tree->setTreeViewItems($root_items);
     $language_selector = new Object();
     $array_lang_dir = scandir($this->getRootWspDirectory() . "/lang", 0);
     for ($i = 0; $i < sizeof($array_lang_dir); $i++) {
         if (is_dir($this->getRootWspDirectory() . "/lang/" . $array_lang_dir[$i]) && $array_lang_dir[$i] != "" && $array_lang_dir[$i] != "." && $array_lang_dir[$i] != ".." && $array_lang_dir[$i] != ".svn" && strlen($array_lang_dir[$i]) == 2) {
             $lang_link = $this->getCurrentURLWithoutParameters() . "?language=" . $array_lang_dir[$i];
             $language_link = new Link($lang_link, Link::TARGET_NONE, new Picture("wsp/img/lang/" . $array_lang_dir[$i] . ".png", 24, 24, 0, Picture::ALIGN_ABSMIDDLE));
             if ($array_lang_dir[$i] == $_GET['language']) {
                 $language_link->setStyle("border:1px solid red;padding-bottom: 4px;");
             }
             $language_link->setId("lang_link_" . $array_lang_dir[$i]);
             $this->array_lang_link[] = $language_link;
             $language_selector->add($language_link);
         }
     }
     $lang_tree_obj = new Object($language_selector, "<br/>");
     $tree_obj = new Object($tree);
     $tree_obj->setAlign(Object::ALIGN_LEFT)->setWidth(200)->setHeight(608)->setMaxHeight(608);
     $lang_tree_obj->add($tree_obj);
     // create translate area with all translation labels and sortable
     $this->translate_area = new Object();
     $this->translate_area->setWidth(600)->setHeight(620)->setStyle("border:1px solid gray;overflow:auto;padding:5px;");
     $this->translate_area->emptyObject()->setId("translate_area");
     $this->sort_label_event = new SortableEvent($this->form);
     $this->sort_label_event->onSort("onSort", "");
     $this->sort_label_event->setAjaxEvent()->disableAjaxWaitMessage();
     $this->translate_area->setSortable(true, $this->sort_label_event);
     $translate_table->addRowColumns($lang_tree_obj, $this->translate_area);
     $translate_table->addRow();
     $this->btn_save = new Button($this->form);
     $this->btn_save->setValue(__(BTN_SAVE))->onClick("save", "")->setAjaxEvent();
     $this->btn_save->forceSpanTag();
     if (Page::getInstance("wsp-admin/manage/manage-pages")->userHaveRights()) {
         $this->btn_page = new Button($this);
         $this->btn_page->setValue(__(BTN_PHP_PAGE))->forceSpanTag()->disable();
     }
     $this->btn_add_label = new Button($this);
     $this->btn_add_label->setValue(__(ADD_LABEL))->onClick("addLabel", "")->setAjaxEvent();
     $this->btn_add_label->forceSpanTag();
     $translate_table->addRow(new Object($this->btn_page, "&nbsp;", $this->btn_add_label, "&nbsp;", $this->btn_save))->setColspan(2);
     $translate_table->addRow();
     $this->form->setContent($translate_table);
     // Create a link to the page
     // TODO
     $this->render = new AdminTemplateForm($this, $content->add($this->form));
     if ($this->btn_save->isClicked() || $this->sort_label_event->isSorted() || $this->btn_add_label->isClicked()) {
         // do nothing, translation load is done by the callback function
     } else {
         if (isset($_GET['file'])) {
             $this->loadTranslation(null, $_GET['file'], "", $_GET['language']);
             if (isset($_GET['saved'])) {
                 alert(__(FILE_SAVED, $_GET['file']));
             }
         } else {
             if (!$this->isAjaxPage()) {
                 $this->loadTranslation(null, "all.inc.php", "", $_GET['language']);
             }
         }
     }
     // Create addLabel form
     $this->form_add_label = new Form($this);
     $this->form_add_label->setAction($this->getCurrentURLWithoutParameters() . "?language=" . $_GET['language']);
     $table_add_label = new Table();
     $this->add_label_label_name = new TextBox($this->form_add_label, "add_label_label_name");
     $this->add_label_label_name->setWidth(200);
     $table_add_label->addRowColumns(__(LABEL_NAME) . ":&nbsp;", $this->add_label_label_name);
     $this->add_label_label_value = new TextArea($this->form_add_label, "add_label_label_value");
     $this->add_label_label_value->setAutoHeight()->setWidth(200);
     $table_add_label->addRowColumns(__(LABEL_VALUE) . ":&nbsp;", $this->add_label_label_value);
     $this->btn_create_label = new Button($this->form_add_label, "btn_create_label");
     $this->btn_create_label->setValue(__(ADD_LABEL))->setAjaxEvent();
     $table_add_label->addRowColumns($this->btn_create_label)->setColspan(2)->setAlign(RowTable::ALIGN_CENTER);
     $this->form_add_label->setContent($table_add_label);
 }
Exemple #11
0
 public function Load()
 {
     parent::$PAGE_TITLE = __(MANAGE_PAGES);
     $content = new Object();
     // Search all php files in the folder pages with the synstax "class * extends Page"
     $code_editor_table = new Table();
     $code_editor_table->setDefaultValign(RowTable::VALIGN_TOP);
     $form = new Form($this);
     $this->hdn_old_file = new Hidden($this);
     $content->add($this->hdn_old_file);
     $tree = new TreeView("wsp_files");
     $array_path = explode("/", $this->getRootWspDirectory());
     $root = new TreeViewFolder($array_path[sizeof($array_path) - 1]);
     $tree_page_items = new TreeViewItems();
     $dir = $this->getRootWspDirectory() . "/pages/";
     $array_files = $this->loadFiles($dir);
     foreach ($array_files as $key => $value) {
         $tree_page_type = new TreeViewFolder($key);
         if ($key == "Page classes") {
             $tree_page_type->expand();
         } else {
             $tree_page_type->collapse();
         }
         $tree_page_items->add($tree_page_type);
         $tree_items = new TreeViewItems();
         $array_folder = array();
         for ($i = 0; $i < sizeof($value); $i++) {
             $file = $value[$i];
             $array_path = explode('/', $file);
             $file_name = $array_path[sizeof($array_path) - 1];
             $array_path[sizeof($array_path) - 1] = null;
             $folder = implode('/', $array_path);
             if ($folder == "") {
                 $parent_tree_items = $tree_items;
             } else {
                 if (isset($array_folder[$folder])) {
                     $parent_tree_items = $array_folder[$folder];
                 } else {
                     $tree_folder = new TreeViewFolder($folder);
                     $tree_folder->collapse();
                     $tree_items->add($tree_folder);
                     $parent_tree_items = new TreeViewItems();
                     $tree_folder->setTreeViewItems($parent_tree_items);
                     $array_folder[$folder] = $parent_tree_items;
                 }
             }
             $file_link = new Button($this);
             $file_name_label = new Label($file_name);
             $file_name_label->setId("file_label_" . str_replace("/", "_slashsep_", str_replace(".", "_", str_replace("-", "_", $file))));
             $this->array_files_label[$file] = $file_name_label;
             $file_link->setValue($file_name_label)->setIsLink();
             $file_link->onClick("loadFile", $file, $this->hdn_old_file)->setAjaxEvent();
             $tree_file = new TreeViewFile($file_link);
             $parent_tree_items->add($tree_file);
         }
         $tree_page_type->setTreeViewItems($tree_items);
     }
     $root->setTreeViewItems($tree_page_items);
     $root_items = new TreeViewItems();
     $root_items->add($root);
     $tree->setTreeViewItems($root_items);
     $tree_obj = new Object($tree);
     $tree_obj->setAlign(Object::ALIGN_LEFT)->setWidth(220)->setHeight(630)->setMaxHeight(630);
     $this->code_editor = new TextArea($form);
     $this->code_editor->setWidth(600)->setHeight(620)->allowTabulation()->activateSourceCodeEdit("php")->noWrap();
     $code_editor_table->addRowColumns($tree_obj, $this->code_editor);
     $this->btn_save = new Button($form);
     $this->btn_save->setValue(__(BTN_SAVE))->setAjaxEvent()->hide();
     $this->btn_save->forceSpanTag();
     if (Page::getInstance("wsp-admin/manage/manage-translations")->userHaveRights()) {
         $this->tranlate_links_obj = new Object(__(MANAGE_TRANSLATIONS) . ": ");
         $this->tranlate_links_obj->setId("tranlate_links_obj");
     }
     $code_editor_table->addRow(new Object($this->tranlate_links_obj, "&nbsp;", $this->btn_save))->setColspan(2);
     $code_editor_table->addRow();
     $form->setContent($code_editor_table);
     // Create a link to the labels of this page
     // TODO
     $this->render = new AdminTemplateForm($this, $content->add($form));
     if (isset($_GET['file'])) {
         $this->loadFile(null, $_GET['file'], "");
     } else {
         if (!$this->isAjaxPage()) {
             $this->loadFile(null, "home.php", "");
         }
     }
 }
 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);
     }
 }
Exemple #13
0
 public function createExamples($ind)
 {
     $table_box = new Table();
     $table_box->setWidth(250)->setDefaultAlign(RowTable::ALIGN_LEFT);
     $table_box->addRow();
     $body_obj = new Object();
     $body_obj->setAlign(Object::ALIGN_CENTER);
     //->setId("id_body_obj")->setStyle("padding:5px;background:".$this->background_body->getValue().";");
     $text_obj = new Object(__(TEXT_ON_BODY));
     $body_obj->add($text_obj->setId("id_body_text"), "<br/>");
     $link_obj = new Object(new Link("javascript:void(0);", Link::TARGET_BLANK, __(LINK_ON_BODY)));
     $body_obj->add($link_obj->setId("id_body_link"), "<br/>");
     $body_obj->add($this->text_link_note_obj, "<br/>");
     $table_box->addRow($body_obj);
     $table_box->addRow();
     $table_box->addRow();
     $button_1 = new Button($this);
     $button_1->setWidth(245);
     $table_box->addRow($button_1->setValue("Button [style jquery]"));
     $table_box->addRow();
     $tabs = new Tabs("tab-sample");
     $tabs->addTab("Tab1", "");
     $tabs->addTab("Tab2", "");
     $tabs->addTab("Tab3", "");
     $table_box->addRow($tabs);
     $table_box->addRow();
     $table_box->addRow();
     $table_box->addRow();
     $table_box->addRow();
     $table_box->addRow();
     $dialogbox = new DialogBox(__(DIALOGBOX_TITLE), __(DIALOGBOX_CONTENT));
     $dialogbox->setWidth(245)->activateOneInstance()->setPosition("");
     $dialogbox_link = new Object(new Link($dialogbox, Link::TARGET_NONE, __(VIEW_DIALOGBOX)));
     $table_box->addRow($dialogbox_link->setId("id_dialogbox_link"));
     $dialogbox->setPositionX("\$('#" . $dialogbox_link->getId() . "').position().left-f_scrollLeft()");
     $dialogbox->setPositionY("\$('#" . $dialogbox_link->getId() . "').position().top-f_scrollTop()-70");
     $this->addObject(clone $dialogbox);
     $table_box->addRow();
     $table_box->addRow();
     $table_box->addRow();
     $table_box->addRow();
     $table_box->addRow();
     $table_box->addRow();
     $style1_box_text = new Box("text", false, $this->current_style_val, $this->current_style_val, "", "box_text_" . $this->current_style_val, 245);
     if ($this->background_picture_1->getValue() != "") {
         $style1_box_text->forceBoxWithPicture(true, $this->border_table_1->getValue());
     } else {
         $style1_box_text->forceBoxWithPicture(false);
     }
     $table_box->addRow($style1_box_text->setContent("Box Object [<a href=\"javascript:void(0);\">style " . $this->current_style_val . "</a>]"));
     $style1_box = new Box("link", false, $this->current_style_val, $this->current_style_val, "javascript:void(0);", "box_" . $this->current_style_val, 245);
     if ($this->background_picture_1->getValue() != "") {
         $style1_box->forceBoxWithPicture(true, $this->border_table_1->getValue());
     } else {
         $style1_box->forceBoxWithPicture(false);
     }
     $style1_box->setShadow(true);
     $table_box->addRow($style1_box->setContent("Box Object [<a href=\"javascript:void(0);\">style " . $this->current_style_val . "</a>]"));
     $style1_box = new RoundBox($this->current_style_val, "round_box_" . $this->current_style_val, 245);
     $style1_box->setShadow(true);
     if ($this->background_picture_1->getValue() != "") {
         $style1_box->forceBoxWithPicture(true, $this->border_table_1->getValue());
     } else {
         $style1_box->forceBoxWithPicture(false);
     }
     $table_box->addRow($style1_box->setContent("RoundBox Object<br/>[style " . $this->current_style_val . "]"));
     $table_box->addRow();
     if (!defined('DEFINE_STYLE_BORDER_TABLE_' . $this->current_style_val)) {
         define('DEFINE_STYLE_BORDER_TABLE_' . $this->current_style_val, $this->border_table_1->getValue());
     }
     $table = new Table();
     $table->setId("table_sample")->setWidth(245);
     $table->addRowColumns("header1", "header2", "header3")->setHeaderClass($this->current_style_val);
     $table->addRowColumns("cel 1-1", "cel 1-2", "cel 1-3")->setId("table_tr_sample")->setBorderPredefinedStyle($this->current_style_val)->setAlign(RowTable::ALIGN_CENTER);
     $table_box->addRow($table);
     return $table_box;
 }
Exemple #14
0
 /**
  * Generic action to get the license key for items.
  */
 public function checkItemLicense()
 {
     $params = $_GET;
     $language = OW::getLanguage();
     $params[BOL_StorageService::URI_VAR_LICENSE_CHECK_COMPLETE] = 0;
     $params[BOL_StorageService::URI_VAR_LICENSE_CHECK_RESULT] = 0;
     if (empty($params[BOL_StorageService::URI_VAR_KEY]) || empty($params[BOL_StorageService::URI_VAR_ITEM_TYPE]) || empty($params[BOL_StorageService::URI_VAR_DEV_KEY])) {
         $errMsg = $language->text("admin", "check_license_invalid_params_err_msg");
         OW::getFeedback()->error($errMsg);
         $this->redirectToBackUri($params);
         $this->assign("message", $errMsg);
         return;
     }
     $key = trim($params[BOL_StorageService::URI_VAR_KEY]);
     $devKey = trim($params[BOL_StorageService::URI_VAR_DEV_KEY]);
     $type = trim($params[BOL_StorageService::URI_VAR_ITEM_TYPE]);
     $data = $this->storageService->getItemInfoForUpdate($key, $devKey);
     if (!$data) {
         $this->assign("backButton", true);
         $errMsg = $language->text("admin", "check_license_invalid_server_responce_err_msg");
         OW::getFeedback()->error($errMsg);
         $this->redirectToBackUri($params);
         $this->assign("message", $errMsg);
         return;
     }
     // if item is freeware reset check ts and redirect to back uri
     if ((bool) $data[BOL_StorageService::URI_VAR_FREEWARE]) {
         $params[BOL_StorageService::URI_VAR_LICENSE_CHECK_COMPLETE] = 1;
         $params[BOL_StorageService::URI_VAR_LICENSE_CHECK_RESULT] = 1;
         $params[BOL_StorageService::URI_VAR_FREEWARE] = 1;
         $this->assign("message", $language->text("admin", "check_license_item_is_free_msg"));
         $dto = $this->storageService->findStoreItem($key, $devKey, $params[BOL_StorageService::URI_VAR_ITEM_TYPE]);
         if ($dto != null) {
             $dto->setLicenseCheckTimestamp(null);
             $this->storageService->saveStoreItem($dto);
         }
         $this->redirectToBackUri($params);
         return;
     }
     $this->assign("text", $language->text("admin", "license_request_text", array("type" => $type, "title" => $data["title"])));
     $form = new Form("license-key");
     $licenseKey = new TextField("key");
     $licenseKey->setRequired();
     $licenseKey->setLabel($language->text("admin", "com_plugin_request_key_label"));
     $form->addElement($licenseKey);
     $submit = new Submit("submit");
     $submit->setValue($language->text("admin", "license_form_button_label"));
     $form->addElement($submit);
     if (isset($params["back-button-uri"])) {
         $button = new Button("button");
         $button->setValue($language->text("admin", "license_form_back_label"));
         $redirectUrl = UTIL_HtmlTag::escapeJs(OW_URL_HOME . urldecode($params["back-button-uri"]));
         $button->addAttribute("onclick", "window.location='{$redirectUrl}'");
         $form->addElement($button);
         $this->assign("backButton", true);
     }
     $this->addForm($form);
     if (OW::getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             $licenseKey = $data["key"];
             $result = $this->storageService->checkLicenseKey($key, $devKey, $licenseKey);
             $params[BOL_StorageService::URI_VAR_LICENSE_CHECK_COMPLETE] = 1;
             if ($result) {
                 $params[BOL_StorageService::URI_VAR_LICENSE_CHECK_RESULT] = 1;
                 $params[BOL_StorageService::URI_VAR_LICENSE_KEY] = urlencode($licenseKey);
                 $dto = $this->storageService->findStoreItem($key, $devKey, $params[BOL_StorageService::URI_VAR_ITEM_TYPE]);
                 if ($dto != null) {
                     $dto->setLicenseKey($licenseKey);
                     $dto->setLicenseCheckTimestamp(null);
                     $this->storageService->saveStoreItem($dto);
                 }
                 OW::getFeedback()->info($language->text("admin", "plugins_manage_license_key_check_success"));
                 $this->redirectToBackUri($params);
                 $this->redirect();
             } else {
                 OW::getFeedback()->error($language->text('admin', 'plugins_manage_invalid_license_key_error_message'));
                 $this->redirect();
             }
         }
     }
 }