Example #1
0
 /**
  * @covers Xoops\Form\Form::getAction
  */
 public function testGetAction()
 {
     $name = 'form_name';
     $this->object->setAction($name);
     $value = $this->object->getAction();
     $this->assertSame($name, $value);
 }
Example #2
0
 public function testFormAttributes()
 {
     $this->assertEquals(Form::METHOD_POST, $this->object->getMethod());
     $this->object->setMethod(Form::METHOD_GET);
     $this->assertEquals(Form::METHOD_GET, $this->object->getMethod());
     $this->assertEquals(null, $this->object->getAction());
     $this->object->setAction('/some/url');
     $this->assertEquals('/some/url', $this->object->getAction());
     $this->assertFalse($this->object->isMultipart());
     $this->object->setMultipart(true);
     $this->assertTrue($this->object->isMultipart());
     $this->assertInstanceOf('\\ArrayIterator', $this->object->getIterator());
 }
Example #3
0
 public function __construct($userId)
 {
     parent::__construct();
     $data = OW::getEventManager()->call("photo.entity_albums_find", array("entityType" => "user", "entityId" => $userId));
     $albums = empty($data["albums"]) ? array() : $data["albums"];
     $source = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_source", $userId);
     $this->assign("source", $source == "album" ? "album" : "all");
     $selectedAlbum = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_album", $userId);
     $form = new Form("pcGallerySettings");
     $form->setEmptyElementsErrorMessage(null);
     $form->setAction(OW::getRouter()->urlFor("PCGALLERY_CTRL_Gallery", "saveSettings"));
     $element = new HiddenField("userId");
     $element->setValue($userId);
     $form->addElement($element);
     $element = new Selectbox("album");
     $element->setHasInvitation(true);
     $element->setInvitation(OW::getLanguage()->text("pcgallery", "settings_album_invitation"));
     $validator = new PCGALLERY_AlbumValidator();
     $element->addValidator($validator);
     $albumsPhotoCount = array();
     foreach ($albums as $album) {
         $element->addOption($album["id"], $album["name"] . " ({$album["photoCount"]})");
         $albumsPhotoCount[$album["id"]] = $album["photoCount"];
         if ($album["id"] == $selectedAlbum) {
             $element->setValue($album["id"]);
         }
     }
     OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString('window.pcgallery_settingsAlbumCounts = {$albumsCount};', array("albumsCount" => $albumsPhotoCount)));
     $element->setLabel(OW::getLanguage()->text("pcgallery", "source_album_label"));
     $form->addElement($element);
     $submit = new Submit("save");
     $submit->setValue(OW::getLanguage()->text("pcgallery", "save_settings_btn_label"));
     $form->addElement($submit);
     $this->addForm($form);
 }
Example #4
0
 /**
  * Constructor.
  */
 public function __construct($ajax = false)
 {
     parent::__construct();
     $form = new Form('sign-in');
     $form->setAction("");
     $username = new TextField('identity');
     $username->setRequired(true);
     $username->setHasInvitation(true);
     $username->setInvitation(OW::getLanguage()->text('base', 'component_sign_in_login_invitation'));
     $form->addElement($username);
     $password = new PasswordField('password');
     $password->setHasInvitation(true);
     $password->setInvitation('password');
     $password->setRequired(true);
     $form->addElement($password);
     $remeberMe = new CheckboxField('remember');
     $remeberMe->setValue(true);
     $remeberMe->setLabel(OW::getLanguage()->text('base', 'sign_in_remember_me_label'));
     $form->addElement($remeberMe);
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('base', 'sign_in_submit_label'));
     $form->addElement($submit);
     $this->addForm($form);
     if ($ajax) {
         $form->setAjaxResetOnSuccess(false);
         $form->setAjax();
         $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_User', 'ajaxSignIn'));
         $form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){if(data.message){OW.info(data.message);}setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}');
         $this->assign('forgot_url', OW::getRouter()->urlForRoute('base_forgot_password'));
     }
     $this->assign('joinUrl', OW::getRouter()->urlForRoute('base_join'));
 }
    public function __construct()
    {
        parent::__construct();
        $language = OW::getLanguage();
        $serviceLang = BOL_LanguageService::getInstance();
        $addSectionForm = new Form('qst_add_section_form');
        $addSectionForm->setAjax();
        $addSectionForm->setAjaxResetOnSuccess(true);
        $addSectionForm->setAction(OW::getRouter()->urlFor("ADMIN_CTRL_Questions", "ajaxResponder"));
        $input = new HiddenField('command');
        $input->setValue('addSection');
        $addSectionForm->addElement($input);
        $qstSectionName = new TextField('section_name');
        $qstSectionName->addAttribute('class', 'ow_text');
        $qstSectionName->addAttribute('style', 'width: auto;');
        $qstSectionName->setRequired();
        $qstSectionName->setLabel($language->text('admin', 'questions_new_section_label'));
        $addSectionForm->addElement($qstSectionName);
        $this->addForm($addSectionForm);
        $addSectionForm->bindJsFunction('success', ' function (result) {
                if ( result.result )
                {
                    OW.info(result.message);
                }
                else
                {
                    OW.error(result.message);
                }

                window.location.reload();
            } ');
    }
Example #6
0
/**
 * The action that displays the entry insert form .
 *
 * @param PDO $pdo The PDO object.
 * @return Opt_View
 */
function action($pdo, $config)
{
    $view = new Opt_View('add.tpl');
    $view->title = 'Add new entry';
    $form = new Form($view);
    $form->setAction('index.php?action=add');
    $form->addField('author', 'required,min_len=3,max_len=30', 'The length must be between 3 and 30 characters.');
    $form->addField('email', 'required,email,min_len=3,max_len=100', 'The value must be a valid mail with maximum 100 characters long.');
    $form->addField('website', 'url,min_len=3,max_len=100', 'The value must be a valid URL with maximum 100 characters long.');
    $form->addField('body', 'required,min_len=3', 'The body must be at least 3 characters long.');
    if ($form->validate()) {
        $values = $form->getValues();
        $stmt = $pdo->prepare('INSERT INTO `entries` (`author`, `email`, `date`, `website`, `body`)
			VALUES(:author, :email, :date, :website, :body)');
        $stmt->bindValue(':author', $values['author'], PDO::PARAM_STR);
        $stmt->bindValue(':email', $values['email'], PDO::PARAM_STR);
        $stmt->bindValue(':date', time(), PDO::PARAM_INT);
        $stmt->bindValue(':website', $values['website'], PDO::PARAM_STR);
        $stmt->bindValue(':body', $values['body'], PDO::PARAM_STR);
        $stmt->execute();
        $view->setTemplate('message.tpl');
        $view->message = 'The entry has been successfully added!';
        $view->redirect = 'index.php?action=list';
    } else {
        // The form is an object, so we need to inform OPT about it.
        $view->form = $form;
        $view->setFormat('form', 'Objective');
    }
    return $view;
}
Example #7
0
 public function __construct(BASE_CommentsParams $params, $id, $formName)
 {
     parent::__construct();
     $language = OW::getLanguage();
     $form = new Form($formName);
     $textArea = new Textarea('commentText');
     $textArea->setHasInvitation(true);
     $textArea->setInvitation($language->text('base', 'comment_form_element_invitation_text'));
     $form->addElement($textArea);
     $hiddenEls = array('entityType' => $params->getEntityType(), 'entityId' => $params->getEntityId(), 'displayType' => $params->getDisplayType(), 'pluginKey' => $params->getPluginKey(), 'ownerId' => $params->getOwnerId(), 'cid' => $id, 'commentCountOnPage' => $params->getCommentCountOnPage(), 'isMobile' => 1);
     foreach ($hiddenEls as $name => $value) {
         $el = new HiddenField($name);
         $el->setValue($value);
         $form->addElement($el);
     }
     $submit = new Submit('comment-submit');
     $submit->setValue($language->text('base', 'comment_add_submit_label'));
     $form->addElement($submit);
     $form->setAjax(true);
     $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_Comments', 'addComment'));
     //        $form->bindJsFunction(Form::BIND_SUBMIT, "function(){ $('#comments-" . $id . " .comments-preloader').show();}");
     //        $form->bindJsFunction(Form::BIND_SUCCESS, "function(){ $('#comments-" . $id . " .comments-preloader').hide();}");
     $this->addForm($form);
     OW::getDocument()->addOnloadScript("window.owCommentCmps['{$id}'].initForm('" . $textArea->getId() . "', '" . $submit->getId() . "');");
     $this->assign('form', true);
     $this->assign('id', $id);
 }
Example #8
0
 private function loginForm()
 {
     $form = new Form();
     $form->setAction(Lib_Link::build('login/login'));
     $form->addText('userLogin', 'Jmeno:', 10)->addRule(Form::FILLED, 'Vloz svoje uzivatelske jmeno.');
     $form->addPassword('userPassword', 'Heslo:', 10)->addRule(Form::FILLED, 'Vloz tvoje heslo.')->addRule(Form::MIN_LENGTH, 'Heslo musi byt dlouhe minimalne %d znaku.', 3);
     $form->addSubmit('login', 'Prihlasit');
     return $form . '';
 }
Example #9
0
 public function __construct($entityType, $entityId, $displayType, $pluginKey, $ownerId, $commentCountOnPage, $id, $cmpContextId, $formName)
 {
     parent::__construct();
     $language = OW::getLanguage();
     //comment form init
     $form = new Form($formName);
     $textArea = new Textarea('commentText');
     $form->addElement($textArea);
     $entityTypeField = new HiddenField('entityType');
     $form->addElement($entityTypeField);
     $entityIdField = new HiddenField('entityId');
     $form->addElement($entityIdField);
     $displayTypeField = new HiddenField('displayType');
     $form->addElement($displayTypeField);
     $pluginKeyField = new HiddenField('pluginKey');
     $form->addElement($pluginKeyField);
     $ownerIdField = new HiddenField('ownerId');
     $form->addElement($ownerIdField);
     $attch = new HiddenField('attch');
     $form->addElement($attch);
     $cid = new HiddenField('cid');
     $form->addElement($cid);
     $commentsOnPageField = new HiddenField('commentCountOnPage');
     $form->addElement($commentsOnPageField);
     $submit = new Submit('comment-submit');
     $submit->setValue($language->text('base', 'comment_add_submit_label'));
     $form->addElement($submit);
     $form->getElement('entityType')->setValue($entityType);
     $form->getElement('entityId')->setValue($entityId);
     $form->getElement('displayType')->setValue($displayType);
     $form->getElement('pluginKey')->setValue($pluginKey);
     $form->getElement('ownerId')->setValue($ownerId);
     $form->getElement('cid')->setValue($id);
     $form->getElement('commentCountOnPage')->setValue($commentCountOnPage);
     $form->setAjax(true);
     $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_Comments', 'addComment'));
     $form->bindJsFunction(Form::BIND_SUBMIT, "function(){ \$('#comments-" . $id . " .comments-preloader').show();}");
     $form->bindJsFunction(Form::BIND_SUCCESS, "function(){ \$('#comments-" . $id . " .comments-preloader').hide();}");
     $this->addForm($form);
     if (BOL_TextFormatService::getInstance()->isCommentsRichMediaAllowed()) {
         $attachmentCmp = new BASE_CLASS_Attachment($id);
         $this->addComponent('attachment', $attachmentCmp);
     }
     OW::getDocument()->addOnloadScript("owCommentCmps['{$id}'].initForm('" . $form->getElement('commentText')->getId() . "', '" . $form->getElement('attch')->getId() . "');");
     $this->assign('form', true);
     $this->assign('id', $id);
     if (OW::getUser()->isAuthenticated()) {
         $currentUserInfo = BOL_AvatarService::getInstance()->getDataForUserAvatars(array(OW::getUser()->getId()));
         $this->assign('currentUserInfo', $currentUserInfo[OW::getUser()->getId()]);
     }
 }
Example #10
0
 public function index(array $params = array())
 {
     $config = OW::getConfig();
     $configs = $config->getValues('antibruteforce');
     $form = new Form('settings');
     $form->setAjax();
     $form->setAjaxResetOnSuccess(false);
     $form->setAction(OW::getRouter()->urlForRoute('antibruteforce.admin'));
     $form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if(data.result){OW.info("Settings successfuly saved");}else{OW.error("Parser error");}}');
     $auth = new CheckboxField('auth');
     $auth->setValue($configs['authentication']);
     $form->addElement($auth);
     $reg = new CheckboxField('reg');
     $reg->setValue($configs['registration']);
     $form->addElement($reg);
     $tryCount = new TextField('tryCount');
     $tryCount->setRequired();
     $tryCount->addValidator(new IntValidator(1));
     $tryCount->setValue($configs['try_count']);
     $form->addElement($tryCount);
     $expTime = new TextField('expTime');
     $expTime->setRequired();
     $expTime->setValue($configs['expire_time']);
     $expTime->addValidator(new IntValidator(1));
     $form->addElement($expTime);
     $title = new TextField('title');
     $title->setRequired();
     $title->setValue($configs['lock_title']);
     $form->addElement($title);
     $desc = new Textarea('desc');
     $desc->setValue($configs['lock_desc']);
     $form->addElement($desc);
     $submit = new Submit('save');
     $form->addElement($submit);
     $this->addForm($form);
     if (OW::getRequest()->isAjax()) {
         if ($form->isValid($_POST)) {
             $config->saveConfig('antibruteforce', 'authentication', $form->getElement('auth')->getValue());
             $config->saveConfig('antibruteforce', 'registration', $form->getElement('reg')->getValue());
             $config->saveConfig('antibruteforce', 'try_count', $form->getElement('tryCount')->getValue());
             $config->saveConfig('antibruteforce', 'expire_time', $form->getElement('expTime')->getValue());
             $config->saveConfig('antibruteforce', 'lock_title', strip_tags($form->getElement('title')->getValue()));
             $config->saveConfig('antibruteforce', 'lock_desc', strip_tags($form->getElement('desc')->getValue()));
             exit(json_encode(array('result' => true)));
         }
     }
 }
Example #11
0
 /**
  * Constructor.
  * 
  * @param array $itemsList
  */
 public function __construct($langId)
 {
     parent::__construct();
     $this->service = BOL_LanguageService::getInstance();
     if (empty($langId)) {
         $this->setVisible(false);
         return;
     }
     $languageDto = $this->service->findById($langId);
     if ($languageDto === null) {
         $this->setVisible(false);
         return;
     }
     $language = OW::getLanguage();
     $form = new Form('lang_edit');
     $form->setAjax();
     $form->setAction(OW::getRouter()->urlFor('ADMIN_CTRL_Languages', 'langEditFormResponder'));
     $form->setAjaxResetOnSuccess(false);
     $labelTextField = new TextField('label');
     $labelTextField->setLabel($language->text('admin', 'clone_form_lbl_label'));
     $labelTextField->setDescription($language->text('admin', 'clone_form_descr_label'));
     $labelTextField->setRequired();
     $labelTextField->setValue($languageDto->getLabel());
     $form->addElement($labelTextField);
     $tagTextField = new TextField('tag');
     $tagTextField->setLabel($language->text('admin', 'clone_form_lbl_tag'));
     $tagTextField->setDescription($language->text('admin', 'clone_form_descr_tag'));
     $tagTextField->setRequired();
     $tagTextField->setValue($languageDto->getTag());
     if ($languageDto->getTag() == 'en') {
         $tagTextField->addAttribute('disabled', 'disabled');
     }
     $form->addElement($tagTextField);
     $rtl = new CheckboxField('rtl');
     $rtl->setLabel($language->text('admin', 'lang_edit_form_rtl_label'));
     $rtl->setDescription($language->text('admin', 'lang_edit_form_rtl_desc'));
     $rtl->setValue((bool) $languageDto->getRtl());
     $form->addElement($rtl);
     $hiddenField = new HiddenField('langId');
     $hiddenField->setValue($languageDto->getId());
     $form->addElement($hiddenField);
     $submit = new Submit('submit');
     $submit->setValue($language->text('admin', 'btn_label_edit'));
     $form->addElement($submit);
     $form->bindJsFunction(Form::BIND_SUCCESS, "function(data){if(data.result){OW.info(data.message);setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}");
     $this->addForm($form);
 }
Example #12
0
    public function __construct($userId)
    {
        parent::__construct();
        $form = new Form("send_message_form");
        $form->setAjax(true);
        $form->setAjaxResetOnSuccess(true);
        $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_AjaxSendMessageToEmail', 'sendMessage'));
        $user = new HiddenField("userId");
        $user->setValue($userId);
        $form->addElement($user);
        $subject = new TextField('subject');
        $subject->setInvitation(OW::getLanguage()->text('base', 'subject'));
        $subject->setRequired(true);
        $form->addElement($subject);
        $textarea = new WysiwygTextarea("message");
        $textarea->setInvitation(OW::getLanguage()->text('base', 'message_invitation'));
        $requiredValidator = new WyswygRequiredValidator();
        $requiredValidator->setErrorMessage(OW::getLanguage()->text('base', 'message_empty'));
        $textarea->addValidator($requiredValidator);
        $form->addElement($textarea);
        $submit = new Submit('send');
        $submit->setLabel(OW::getLanguage()->text('base', 'send'));
        $form->addElement($submit);
        $form->bindJsFunction(Form::BIND_SUCCESS, ' function ( data ) {

            if ( data.result )
            {
                OW.info(data.message);
            }
            else
            {
                OW.error(data.message);
            }

            if ( OW.getActiveFloatBox() )
            {
                OW.getActiveFloatBox().close();
            }

        } ');
        $this->addForm($form);
    }
Example #13
0
 /**
  * @param integer $userId
  */
 public function __construct($userId)
 {
     parent::__construct();
     $user = BOL_UserService::getInstance()->findUserById((int) $userId);
     if (!OW::getUser()->isAuthorized('base') || $user === null) {
         $this->setVisible(false);
         return;
     }
     $aService = BOL_AuthorizationService::getInstance();
     $roleList = $aService->findNonGuestRoleList();
     $form = new Form('give-role');
     $form->setAjax(true);
     $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_User', 'updateUserRoles'));
     $hidden = new HiddenField('userId');
     $form->addElement($hidden->setValue($userId));
     $userRoles = $aService->findUserRoleList($user->getId());
     $userRolesIdList = array();
     foreach ($userRoles as $role) {
         $userRolesIdList[] = $role->getId();
     }
     $tplRoleList = array();
     /* @var $role BOL_AuthorizationRole */
     foreach ($roleList as $role) {
         $field = new CheckboxField('roles[' . $role->getId() . ']');
         $field->setLabel(OW::getLanguage()->text('base', 'authorization_role_' . $role->getName()));
         $field->setValue(in_array($role->getId(), $userRolesIdList));
         if (in_array($role->getId(), $userRolesIdList) && $role->getSortOrder() == 1) {
             $field->addAttribute('disabled', 'disabled');
         }
         $form->addElement($field);
         $tplRoleList[$role->sortOrder] = $role;
     }
     ksort($tplRoleList);
     $form->addElement(new Submit('submit'));
     OW::getDocument()->addOnloadScript("owForms['{$form->getName()}'].bind('success', function(data){\n                if( data.result ){\n                    if( data.result == 'success' ){\n                         window.baseChangeUserRoleFB.close();\n                         window.location.reload();\n                         //OW.info(data.message);\n                    }\n                    else if( data.result == 'error'){\n                        OW.error(data.message);\n                    }\n                }\n\t\t})");
     $this->addForm($form);
     $this->assign('list', $tplRoleList);
 }
Example #14
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $language = OW::getLanguage();
     $form = new Form('inite-friends');
     $emailList = new TagsInputField('emailList');
     $emailList->setRequired();
     $emailList->setDelimiterChars(array(',', ' '));
     $emailList->setInvitation($language->text('contactimporter', 'email_field_inv_message'));
     $emailList->setJsRegexp('/^(([^<>()[\\]\\.,;:\\s@\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\"]+)*)|(\\".+\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/');
     $form->addElement($emailList);
     $text = new Textarea('text');
     $text->setValue($language->text('contactimporter', 'email_invite_field_default_text'));
     $text->setHasInvitation(true);
     $form->addElement($text);
     $submit = new Submit('submit');
     $form->addElement($submit);
     $form->setAction(OW::getRouter()->urlFor('CONTACTIMPORTER_CTRL_Email', 'send'));
     $form->setAjax();
     $form->setAjaxResetOnSuccess(false);
     $form->bindJsFunction(Form::BIND_SUCCESS, "\n            function(data){                \n                if( data.success ){\n                    OW.info(data.message);\n                    owForms['inite-friends'].resetForm();\n                    window.ciMailFloatBox.close();\n                }\n                else{\n                    OW.error(data.message);\n                }\n              }");
     $this->addForm($form);
 }
$tab_array[] = array(gettext("Certificate Revocation"), false, "system_crlmanager.php");
display_top_tabs($tab_array);
// Load valid country codes
$dn_cc = array();
if (file_exists("/etc/ca_countries")) {
    $dn_cc_file = file("/etc/ca_countries");
    foreach ($dn_cc_file as $line) {
        if (preg_match('/^(\\S*)\\s(.*)$/', $line, $matches)) {
            $dn_cc[$matches[1]] = $matches[1];
        }
    }
}
if ($act == "new" || $_POST['save'] == gettext("Save") && $input_errors) {
    $form = new Form();
    if ($act == "csr" || $_POST['save'] == gettext("Update") && $input_errors) {
        $form->setAction('system_certmanager.php?act=csr');
        $section = new Form_Section('Complete Signing Request');
        if (isset($id) && $a_cert[$id]) {
            $form->addGlobal(new Form_Input('id', null, 'hidden', $id));
        }
        $section->addInput(new Form_Input('descr', 'Descriptive name', 'text', $pconfig['descr']));
        $section->addInput(new Form_Textarea('csr', 'Signing request data', $pconfig['csr']))->setReadonly()->setHelp('Copy the certificate signing data from here and ' . 'forward it to your certificate authority for signing.');
        $section->addInput(new Form_Textarea('cert', 'Final certificate data', $pconfig["cert"]))->setHelp('Paste the certificate received from your certificate authority here.');
        $form->add($section);
        print $form;
        include "foot.inc";
        exit;
    }
    $form->setAction('system_certmanager.php?act=edit');
    if (isset($userid) && $a_user) {
        $form->addGlobal(new Form_Input('userid', null, 'hidden', $userid));
Example #16
0
        $idUser = $req->fetch();
        $user = new User(0, "", "", "", "", "");
        $_SESSION["user"] = $user->getUserByID($idUser["idUser"]);
        header("Location: /Salon/Canal");
    } else {
        if ($req->rowCount() == 0) {
            $_SESSION["erreur"][] = "Les identifiant données sont invalide.";
            echo "Les identifiant données sont invalide.";
        } else {
            $_SESSION["erreur"][] = "Une erreur est survenu au seins de la base de données.";
            echo "Une erreur est survenu au seins de la base de données.";
        }
    }
    if (isset($_SESSION["erreur"])) {
        header("Location: /Erreur");
    }
}
?>


<?php 
$formConnexion = new Form("Connexion");
$formConnexion->setMethod("POST");
$formConnexion->setAction("/Portail/Connexion");
$pseudo = new Element("login", "Votre pseudo");
$password = new Element("password", "Mot de passe");
$password->setTypeElement("password");
$formConnexion->addElement($pseudo);
$formConnexion->addElement($password);
$formConnexion->submit("Entrez dans le Tchat");
echo $formConnexion->render();
Example #17
0
 public function passwordProtection()
 {
     $language = OW::getLanguage();
     $form = new Form('password_protection');
     $form->setAjax(true);
     $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_BaseDocument', 'passwordProtection'));
     $form->setAjaxDataType(Form::AJAX_DATA_TYPE_SCRIPT);
     $password = new PasswordField('password');
     $form->addElement($password);
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('base', 'password_protection_submit_label'));
     $form->addElement($submit);
     $this->addForm($form);
     if (OW::getRequest()->isAjax() && $form->isValid($_POST)) {
         $data = $form->getValues();
         $password = OW::getConfig()->getValue('base', 'guests_can_view_password');
         $cryptedPassword = crypt($data['password'], OW_PASSWORD_SALT);
         if (!empty($data['password']) && $cryptedPassword === $password) {
             setcookie('base_password_protection', UTIL_String::getRandomString(), time() + 86400 * 30, '/');
             echo "OW.info('" . OW::getLanguage()->text('base', 'password_protection_success_message') . "');window.location.reload();";
         } else {
             echo "OW.error('" . OW::getLanguage()->text('base', 'password_protection_error_message') . "');";
         }
         exit;
     }
     OW::getDocument()->setHeading($language->text('base', 'password_protection_text'));
     OW::getDocument()->getMasterPage()->setTemplate(OW::getThemeManager()->getMasterPageTemplate('mobile_blank'));
 }
	// On submit
	$('form').submit(function() {
		AllServers($('[name="servers[]"] option'), true);
		AllServers($('[name="serversdisabled[]"] option'), true);
	});

});
//]]>
</script>

<?php 
if ($input_errors) {
    print_input_errors($input_errors);
}
$form = new Form();
$form->setAction("load_balancer_pool_edit.php");
$section = new Form_Section('Add/Edit Load Balancer - Pool Entry');
$section->addInput(new Form_Input('name', 'Name', 'text', $pconfig['name']));
$section->addInput(new Form_Select('mode', 'Mode', $pconfig['mode'], array('loadbalance' => gettext('Load Balance'), 'failover' => gettext('Manual Failover'))));
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']));
$section->addInput(new Form_Input('port', 'Port', 'text', $pconfig['port']))->setHelp('This is the port the servers are listening on. A port alias listed in Firewall -> Aliases may also be specified here.');
$section->addInput(new Form_Input('retry', 'Retry', 'number', $pconfig['retry'], ['min' => '1', 'max' => '65536']))->setHelp('Optionally specify how many times to retry checking a server before declaring it down.');
$form->add($section);
$section = new Form_Section('Add Item to the Pool');
$monitorlist = array();
foreach ($config['load_balancer']['monitor_type'] as $monitor) {
    $monitorlist[$monitor['name']] = $monitor['name'];
}
if (count($config['load_balancer']['monitor_type'])) {
    $section->addInput(new Form_Select('monitor', 'Monitor', $pconfig['monitor'], $monitorlist));
} else {
</div>

<nav class="action-buttons">
	<a href="?act=new" class="btn btn-success btn-sm">
		<i class="fa fa-plus icon-embed-btn"></i>
		<?php 
    echo gettext("Add");
    ?>
	</a>
</nav>
<?php 
    include "foot.inc";
    exit;
}
$form = new Form();
$form->setAction('system_authservers.php?act=edit');
$form->addGlobal(new Form_Input('userid', null, 'hidden', $id));
$section = new Form_Section('Server Settings');
$section->addInput($input = new Form_Input('name', 'Descriptive name', 'text', $pconfig['name']));
$section->addInput($input = new Form_Select('type', 'Type', $pconfig['type'], $auth_server_types))->toggles();
$form->add($section);
// ==== LDAP settings =========================================================
$section = new Form_Section('LDAP Server Settings');
$section->addClass('toggle-ldap collapse');
if (!isset($pconfig['type']) || $pconfig['type'] == 'ldap') {
    $section->addClass('in');
}
$section->addInput(new Form_Input('ldap_host', 'Hostname or IP address', 'text', $pconfig['ldap_host']))->setHelp('NOTE: When using SSL, this hostname MUST match the Common Name ' . '(CN) of the LDAP server\'s SSL Certificate.');
$section->addInput(new Form_Input('ldap_port', 'Port value', 'number', $pconfig['ldap_port']));
$section->addInput(new Form_Select('ldap_urltype', 'Transport', $pconfig['ldap_urltype'], array_combine(array_keys($ldap_urltypes), array_keys($ldap_urltypes))));
if (empty($a_ca)) {
Example #20
0
 /**
  *
  * @param string $name
  * @return Form
  */
 public function getUserSettingsForm()
 {
     $form = new Form('im_user_settings_form');
     $form->setAjax(true);
     $form->setAction(OW::getRouter()->urlFor('AJAXIM_CTRL_Action', 'processUserSettingsForm'));
     $form->setAjaxResetOnSuccess(false);
     $form->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n            OW_InstantChat_App.setSoundEnabled(data.im_soundEnabled);\n        }");
     $findContact = new ImSearchField('im_find_contact');
     $findContact->setHasInvitation(true);
     $findContact->setInvitation(OW::getLanguage()->text('ajaxim', 'find_contact'));
     $form->addElement($findContact);
     $enableSound = new CheckboxField('im_enable_sound');
     $user_preference_enable_sound = BOL_PreferenceService::getInstance()->getPreferenceValue('ajaxim_user_settings_enable_sound', OW::getUser()->getId());
     $enableSound->setValue($user_preference_enable_sound);
     $enableSound->setLabel(OW::getLanguage()->text('ajaxim', 'enable_sound_label'));
     $form->addElement($enableSound);
     $userIdHidden = new HiddenField('user_id');
     $form->addElement($userIdHidden);
     return $form;
 }
Example #21
0
 /**
  * Generates edit group form
  * 
  * @param string $action
  * @return Form
  */
 private function generateEditGroupForm($action)
 {
     $form = new Form('edit-group-form');
     $form->setAction($action);
     $lang = OW::getLanguage();
     $groupName = new TextField('group-name');
     $groupName->setRequired(true);
     $sValidator = new StringValidator(1, 255);
     $sValidator->setErrorMessage($lang->text('forum', 'chars_limit_exceeded', array('limit' => 255)));
     $groupName->addValidator($sValidator);
     $form->addElement($groupName);
     $description = new Textarea('description');
     $description->setRequired(true);
     $sValidator = new StringValidator(1, 50000);
     $sValidator->setErrorMessage($lang->text('forum', 'chars_limit_exceeded', array('limit' => 50000)));
     $description->addValidator($sValidator);
     $form->addElement($description);
     $groupId = new HiddenField('group-id');
     $groupId->setRequired(true);
     $form->addElement($groupId);
     $isPrivate = new CheckboxField('is-private');
     $form->addElement($isPrivate);
     $roles = new CheckboxGroup('roles');
     $authService = BOL_AuthorizationService::getInstance();
     $roleList = $authService->getRoleList();
     $options = array();
     foreach ($roleList as $role) {
         $options[$role->id] = $authService->getRoleLabel($role->name);
     }
     $roles->addOptions($options);
     $roles->setColumnCount(2);
     $form->addElement($roles);
     $submit = new Submit('save');
     $submit->setValue($lang->text('forum', 'edit_group_btn'));
     $form->addElement($submit);
     $form->setAjax(true);
     return $form;
 }
Example #22
0
 * [since] 2010.09.22 -ok
 */
$inp_dir = new Input();
$inp_dir->setName('directory');
$inp_dir->setSize(50);
$inp_dir->setValue($result->directory);
$inp_ext = new Input();
$inp_ext->setName('extension');
$inp_ext->setSize(10);
$inp_ext->setValue($result->extension);
$inp_lines = new Input();
$inp_lines->setName('nr_rows');
$inp_lines->setSize(7);
$inp_lines->setValue($result->nr_rows);
$form = new Form();
$form->setAction('controller.php');
$form->build();
$table = new Table();
$table->build();
$tr = new Tr();
$tr->add('Directory : ');
$tr->add($inp_dir->dump());
$tr->add($cmd->dump());
$tr->build();
$tr = new Tr();
$tr->add('Extension : ');
$tr->add($inp_ext->dump());
$tr->build();
$tr = new Tr();
$tr->add('# records in view : ');
$tr->add($inp_lines->dump());
	});

	// ---------- On initial page load ------------------------------------------------------------

	updateType($('#type').val());
});

//]]>
</script>

<?php 
if ($input_errors) {
    print_input_errors($input_errors);
}
$form = new Form();
$form->setAction("load_balancer_monitor_edit.php");
$section = new Form_Section('Edit Load Balancer - Monitor Entry');
$section->addInput(new Form_Input('name', 'Name', 'text', $pconfig['name']));
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']));
$section->addInput(new Form_Select('type', 'Type', $pconfig['type'], $types));
$form->add($section);
$section = new Form_Section('HTTP Options');
$section->addClass('http');
$section->addInput(new Form_Input('http_options_path', 'Path', 'text', $pconfig['options']['path']));
$section->addInput(new Form_Input('http_options_host', 'Host', 'text', $pconfig['options']['host']))->setHelp('Hostname for Host: header if needed.');
$section->addInput(new Form_Select('http_options_code', 'HTTP Code', $pconfig['options']['code'], $rfc2616));
$form->add($section);
$section = new Form_Section('HTTPS Options');
$section->addClass('https');
$section->addInput(new Form_Input('https_options_path', 'Path', 'text', $pconfig['options']['path']));
$section->addInput(new Form_Input('https_options_host', 'Host', 'text', $pconfig['options']['host']))->setHelp('Hostname for Host: header if needed.');
Example #24
0
<?php

include "vue/rsc/part/avatar.php";
authentificationRequire();
if (isset($_SESSION["user"])) {
}
$user = $_SESSION["user"];
$formProfil = new Form("Vos informations");
$formProfil->setMethod("POST");
$formProfil->setAction("/controller/profil/profil.php");
/*
    $mail=new Element("mail",$user->getMail());
$mail->setLabel("Mail");

$birthdate = date('d/m/Y', strtotime(str_replace('-', '/', $user->getBirth())));
$birth=new Element("birth",$birthdate);
    $birth->setLabel("Date de naissance");
*/
$mail = new Element("mail", "mail");
$mail->setElement("Label");
$mail->setLabel("Adresse mail : " . $user->getMail());
$birthdate = date('d/m/Y', strtotime(str_replace('-', '/', $user->getBirth())));
$birth = new Element("birth", "birth");
$birth->setElement("Label");
$birth->setLabel("Date de naissance : {$birthdate}");
$phone = new Element("phone", $user->getPhoneNumber());
$phone->setLabel("Numéro de téléphone");
$country = new Element("country", $user->getCountry());
$country->setLabel("Pays");
$city = new Element("city", $user->getCity());
$city->setLabel("Ville");
Example #25
0
    public function getSearchBox()
    {
        static $id_count = 0;
        if ($id_count) {
            $id = 'search_list_' . $id_count;
        } else {
            $id = 'search_list';
            $id_count++;
        }
        $values = $this->getLinkValues();
        unset($values['pager_search']);
        unset($values['go']);
        $form = new \Form($id);
        $form->useGetMethod();
        $form->addClass('form-inline');
        $form->setAction('index.php');
        //$form->appendCSS('bootstrap');
        foreach ($values as $k => $v) {
            $form->addHidden($k, $v);
        }
        $input_array[] = '<div style="width: 300px">';
        $form->setOpen(false);
        $input_array[] = $form->printTag();
        $input_array[] = implode("\n", $form->getHiddens());
        $si = $form->addTextField('pager_c_search', $this->search);
        $si->addClass('pager_c_search');
        $si->addClass('form-control');
        $si->setPlaceholder(_('Search'));
        $input_array[] = '<div class="input-group">';
        $input_array[] = (string) $si;
        $input_array[] = '<span class="input-group-btn">';
        if ($this->search_button) {
            $sub = $form->addSubmit('submit', 'Go')->addClass('btn btn-success');
            $input_array[] = (string) $sub;
        }
        $input_array[] = <<<EOF
<input type="submit" onclick="\$(this).parents('form').find('input.pager_c_search').val('');" class="btn btn-info" value="Clear" />
EOF;
        $input_array[] = '</span>';
        $input_array[] = '</div>';
        $input_array[] = '</form></div>';
        return implode("\n", $input_array);
    }
Example #26
0
</div>

<nav class="action-buttons">
	<a href="?act=new" class="btn btn-success btn-sm">
		<i class="fa fa-plus icon-embed-btn"></i>
		<?php 
    echo gettext("Add");
    ?>
	</a>
</nav>
<?php 
    include 'foot.inc';
    exit;
}
$form = new Form();
$form->setAction('system_groupmanager.php?act=edit');
$form->addGlobal(new Form_Input('groupid', null, 'hidden', $id));
if (isset($id) && $a_group[$id]) {
    $form->addGlobal(new Form_Input('id', null, 'hidden', $id));
    $form->addGlobal(new Form_Input('gid', null, 'hidden', $pconfig['gid']));
}
$section = new Form_Section('Group Properties');
if ($_GET['act'] != "new") {
    $section->addInput(new Form_StaticText('Defined by', strtoupper($pconfig['gtype'])));
}
$section->addInput($input = new Form_Input('groupname', 'Group name', 'text', $pconfig['name']));
if ($pconfig['gtype'] == "system") {
    $input->setReadonly();
}
$section->addInput(new Form_Input('description', 'Description', 'text', $pconfig['description']))->setHelp('Group description, for your own information only');
$form->add($section);
Example #27
0
 /**
  * Generates move topic form.
  *
  * @param string $actionUrl
  * @param $groupSelect
  * @param $topicDto
  * @return Form
  */
 private function generateMoveTopicForm($actionUrl, $groupSelect, $topicDto)
 {
     $form = new Form('move-topic-form');
     $form->setAction($actionUrl);
     $topicIdField = new HiddenField('topic-id');
     $topicIdField->setValue($topicDto->id);
     $form->addElement($topicIdField);
     $group = new ForumSelectBox('group-id');
     $group->setOptions($groupSelect);
     $group->setValue($topicDto->groupId);
     $group->addAttribute("style", "width: 300px;");
     $group->setRequired(true);
     $form->addElement($group);
     $submit = new Submit('save');
     $submit->setValue(OW::getLanguage()->text('forum', 'move_topic_btn'));
     $form->addElement($submit);
     $form->setAjax(true);
     return $form;
 }
Example #28
0
 public function __construct($entityType, $entityId, $displayType, $pluginKey, $ownerId, $commentCountOnPage, $id, $cmpContextId, $formName)
 {
     parent::__construct();
     $language = OW::getLanguage();
     //comment form init
     $form = new Form($formName);
     $textArea = new Textarea('commentText');
     $form->addElement($textArea);
     $entityTypeField = new HiddenField('entityType');
     $form->addElement($entityTypeField);
     $entityIdField = new HiddenField('entityId');
     $form->addElement($entityIdField);
     $displayTypeField = new HiddenField('displayType');
     $form->addElement($displayTypeField);
     $pluginKeyField = new HiddenField('pluginKey');
     $form->addElement($pluginKeyField);
     $ownerIdField = new HiddenField('ownerId');
     $form->addElement($ownerIdField);
     $attch = new HiddenField('attch');
     $form->addElement($attch);
     $cid = new HiddenField('cid');
     $form->addElement($cid);
     $commentsOnPageField = new HiddenField('commentCountOnPage');
     $form->addElement($commentsOnPageField);
     $submit = new Submit('comment-submit');
     $submit->setValue($language->text('base', 'comment_add_submit_label'));
     $form->addElement($submit);
     $form->getElement('entityType')->setValue($entityType);
     $form->getElement('entityId')->setValue($entityId);
     $form->getElement('displayType')->setValue($displayType);
     $form->getElement('pluginKey')->setValue($pluginKey);
     $form->getElement('ownerId')->setValue($ownerId);
     $form->getElement('commentCountOnPage')->setValue($commentCountOnPage);
     $form->setAjax(true);
     $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_Comments', 'addComment'));
     $form->bindJsFunction(Form::BIND_SUBMIT, "function(){ \$('#comments-" . $id . " .comments-preloader').show();}");
     $form->bindJsFunction(Form::BIND_SUCCESS, "function(){ \$('#comments-" . $id . " .comments-preloader').hide();}");
     $this->addForm($form);
     $attachmentsId = null;
     if (BOL_TextFormatService::getInstance()->isCommentsRichMediaAllowed()) {
         $attachmentsId = $this->initAttachments();
         $attControlUniq = uniqid('attpControl');
         $js = UTIL_JsGenerator::newInstance()->newObject(array('ATTP.CORE.ObjectRegistry', $attControlUniq), 'ATTP.AttachmentsControl', array($cmpContextId, array('attachmentId' => $attachmentsId, 'attachmentInputId' => $attch->getId(), 'inputId' => $textArea->getId(), 'formName' => $form->getName())));
         ATTACHMENTS_Plugin::getInstance()->addJs($js);
     }
     OW::getDocument()->addOnloadScript("owCommentCmps['{$id}'].initForm('" . $form->getElement('commentText')->getId() . "', '" . $form->getElement('attch')->getId() . "');");
     OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString('
         owForms[{$formName}].bind("success", function(data) {
             var attachId = {$attcachmentId};
             if ( attachId && ATTP.CORE.ObjectRegistry[attachId] )
             {
                 ATTP.CORE.ObjectRegistry[attachId].reset();
             }
         });
     ', array('formName' => $form->getName(), 'attcachmentId' => $attachmentsId)));
     $this->assign('form', true);
     $this->assign('id', $id);
     if (OW::getUser()->isAuthenticated()) {
         $currentUserInfo = BOL_AvatarService::getInstance()->getDataForUserAvatars(array(OW::getUser()->getId()));
         $this->assign('currentUserInfo', $currentUserInfo[OW::getUser()->getId()]);
     }
 }
Example #29
0
 }
 $content = '';
 foreach ($data_array as $field => $value) {
     if ($field == 'title') {
         $title = $value;
     } else {
         $content .= "<p>{$field}: {$value}</p>";
     }
 }
 if ($type == 'product') {
     //display 'Add to Cart' button
     $form = new Form();
     $form->addInput('pid', '', $id, 'hidden');
     $form->addInput('qty', 'Quantity', 1, 'text', 2);
     $form->addInput('submit', null, 'Add to Cart', 'submit');
     $form->setAction('cart-add.php');
     $content .= $form->render();
     $content .= '<p><br/><a href="index.php">Back to shopping</a></p>';
 }
 if ($type == 'customer') {
     //display list of addresses
     $addresses = new AddressList($id);
     if (!empty($addresses)) {
         $content .= '<h3>Addresses</h3>';
         foreach ($addresses as $a) {
             $content .= '<div class="cust-address">';
             $content .= $a->getFullAddress();
             $content .= '</div>';
         }
     }
 }
Example #30
0
    //set up some content for the token:
    $token_str = '';
    //list items in cart
    foreach ($cart as $product) {
        $content .= '<div class="cart-item">';
        $content .= $product->product_name;
        $content .= ' $' . $product->price;
        $pid = $product->id;
        $quantity = $cart->getProductQuantity($product->id);
        $content .= ' x ' . $quantity . '= $' . $product->price * $quantity;
        $content .= " | <a href='profile.php?type=product&id={$pid}'>view</a> | ";
        $content .= "<a href='cart-remove.php?pid={$pid}'>remove</a>";
        $content .= '</div>';
        //add to token string
        $token_str .= $product->price;
    }
    //show total price
    $content .= '<p class="total">TOTAL: ';
    $content .= $cart->getFormattedTotal();
    $form = new Form();
    $form->setAction('checkout.php');
    $token = md5(time() . $token_str . $customer_id);
    //also add a salt? from file or db
    $_SESSION['form_token'] = $token;
    $form->addInput('token', '', $token, 'hidden');
    $form->addInput('submit', null, 'Check out', 'submit');
    $content .= $form->render();
    $content .= '<p class="back"><a href="index.php">Back to shopping</a></p>';
    //}
}
require_once 'template.php';