Exemplo n.º 1
0
*   Routine:	example1.php
*   Created:	23/03/2009
*   Descrip:	Basic for usage.
*
*   Revision:	a
*   Rev. Date	23/03/2009
*   Descrip:	Created.
*/
namespace w34u\ssp;

// include libraries
require "../../sspadmin/includeheader.php";
$mainTemplate = new Template("Main Template", "exampleMain.tpl");
// form definition
// id name for the table is used for detection of submission and error messages
$form = new sfc\Form(SSP_Path(true), "tableNameForSql", "idNameforTable");
$form->tpl = $mainTemplate;
// main template to enclose the form, not required, form inserted into {content}
$form->tplf = "example1.tpl";
// display template for the form
$form->tda("miscTplData", "Some data for display on the form template, password is 'thingy'");
$form->fe("text", "firstElement", "First element, a text box");
$form->fep("required=true, dataType=text");
// element is required and is of data type text
$form->fe("password", "pasword", "enter a password");
$form->fep("required=true, dataType=password, load=false");
$form->addHidden("hiddenStuff", "Some hidden stuff", "text");
// hidden field
// check for submission
if ($form->processForm($_POST)) {
    // check for error
Exemplo n.º 2
0
$formLang->fep('deflt = ' . $session->lang);
$formLang->fe('check', 'localError', 'Errors local to fields', array(0, 1));
$formLang->fep('deflt = ' . $errorLocal);
if ($formLang->processForm($_POST)) {
    $session->lang = $formLang->getField('language');
    if ($formLang->getField('localError') == 1) {
        $errorLocal = true;
    } else {
        $errorLocal = false;
    }
    session_write_close();
    SSP_Divert(SSP_Path());
} else {
    $setLanguage = $formLang->create();
}
$form = new sfc\Form("testcheckData.php", "TestSaveTable", "testdataform");
$form->tplf = "testCheckData_" . $session->lang . ".tpl";
$form->tda('lang', $session->lang);
$form->tda('setLanguage', $setLanguage);
if ($errorLocal) {
    $form->tda('localErrors', 1);
}
$form->errorsLocal = $errorLocal;
$form->errorAutoFormDisplay = false;
$form->fe("text", "textType", "Text input", ">");
$form->fe("text", "passwordType", "Password input", ">");
$form->fep("dataType=password");
$form->fe("text", "domType", "Url input", ">");
$form->fep("dataType=dom");
$form->fe("text", "emailType", "Email input", ">");
$form->fep("dataType=email");
Exemplo n.º 3
0
*   +44 (0)1273 201344
*   +44 (0)7833 512221
*
*   Project:	SSP - w34u
*   Routine:	testSelectRadio.php
*   Created:	02-Mar-2012
*   Descrip:	Test select and radio buttons.
*
*   Revision:	a
*   Rev. Date	02-Mar-2012
*   Descrip:	Created.
*/
namespace w34u\ssp;

require "include.php";
$form = new sfc\Form('', 'noTable', 'testform');
$form->tplf = "testSelectRadio.tpl";
// data for selects and radio
$selectBasic = array(1 => "Option 1", 2 => "Option 2", 3 => "Option 3");
$form->fe("select", 'simpleSelect', "Simple Selection", $selectBasic);
$selectComplex = array(1 => "option 1", 2 => array("text" => "option 2", "class" => "option2Class"), 3 => new sfc\SelectOptions('Option 3'), 4 => new sfc\SelectOptions('Optgroup 4', 'optgroup', array(41 => "Option 41", 42 => "Option 42", 43 => "Option 43")), 5 => "Option 5");
$selectComplex[3]->addAttribute('class', 'option3Class');
$form->fe("select", "selectComplex", "Complex selection", $selectComplex);
//$form->fe("select", 'errorSimple', "Simple Selection", $selectBasic);
//$form->fe("select", "errorComplex", "Complex selection", $selectComplex);
//$form->fe("select", 'noSelect', "No selections", array());
$form->fe("radio", 'radioSelect', "Radio selections", $selectBasic);
$form->fep("deflt=1");
//$form->fe("radio", 'radioSelectError', "Radio error", $selectBasic);
//$form->setParam('validResults', array(1,2,3,4));
if ($form->processForm($_POST)) {
Exemplo n.º 4
0
 /**
  * Start recovery of a users password
  */
 public function startPasswordRecovery()
 {
     $form = new sfc\Form(SSP_Path(), "noTable", "startPasswordRecovery");
     $form->tplf = "passwordrecover.tpl";
     $form->tpl = $this->tpl(array("title" => "Password recovery"));
     $form->errorAutoFormDisplay = false;
     $form->tda("loginPath", $this->cfg->logonScript);
     $form->fe("text", "email", "Enter your registered email");
     $form->fep("required=true,width=30, dataType=email");
     $form->fe("submit", "submit", "Recover Password");
     $form->fep("elClass=SSPFormButton");
     if ($form->processForm($_POST)) {
         if (!$form->error) {
             // check for the email
             $fields = array("UserId", "UserEmail", "UserName", "UserPassword");
             $where["UserEmail"] = SSP_encrypt(trim($form->getField("email")));
             $row = $this->db->getf($this->cfg->userTable, $fields, $where, "SSP user admin: getting user info for password recovery");
             if ($this->db->numRows()) {
                 // found the email
                 $rowMisc = $this->db->get($this->cfg->userMiscTable, array("UserId" => $row->UserId), "Getting user name for password recovery");
                 if ($this->cfg->passwordRecovery == 0 or $this->cfg->encryptPassword) {
                     // use user change of password method
                     // Generate user response token
                     $token = SSP_ResponseToken($row->UserId, $this->cfg->recoverTime);
                     // generate email
                     if ($this->cfg->loginType == 1) {
                         // Supply user name if used for login
                         $content["UserName"] = $row["UserName"];
                     }
                     $content["link"] = $this->cfg->newPassword;
                     $content['token'] = $token;
                     $content["adminEmail"] = $this->cfg->adminEmail;
                     $email = new Email($this->cfg);
                     $email->noReplyEmail($content, "emailpasswordrecovery0.tpl", $row->UserEmail, $rowMisc->FirstName . " " . $rowMisc->FamilyName);
                 } else {
                     // email all info to the user
                     // generate email
                     if ($this->cfg->loginType == 1) {
                         // Supply user name if used for login
                         $content["UserName"] = $row["UserName"];
                     }
                     $content["UserPassword"] = $row["UserPassword"];
                     $content["adminEmail"] = $this->cfg->adminEmail;
                     $email = new Email($this->cfg);
                     $email->noReplyEmail($content, "emailpasswordrecovery1.tpl", $row->UserEmail, $rowMisc->FirstName . " " . $rowMisc->FamilyName);
                 }
                 $form->tda("sent");
                 $result = $form->create();
             } else {
                 // email not found
                 $form->tda("error");
                 $result = $form->create();
             }
         } else {
             $result = $form->create(true);
         }
     } else {
         // display form
         $result = $form->create();
     }
     return $result;
 }
Exemplo n.º 5
0
 public function __construct()
 {
     $this->generateDSN();
     $this->checkProperties();
     // build paths to scripts
     $this->pathSite = "http://" . $this->url . "/";
     $this->pathSiteHttps = "https://" . $this->url . "/";
     // set mutibyte encoding
     mb_internal_encoding($this->siteEncoding);
     if ($this->useSSL) {
         // absolute path for ssl
         $this->adminDir = $this->pathSiteHttps . $this->adminDir;
         $path = $this->pathSiteHttps;
     } else {
         $this->adminDir = $this->pathSite . $this->adminDir;
         $path = $this->pathSite;
     }
     $this->logonScript = $path . $this->logonScript;
     $this->logoffScript = $path . $this->logoffScript;
     $this->passwordRecover = $path . $this->passwordRecover;
     $this->newPassword = $path . $this->newPassword;
     $this->userAdminScript = $path . $this->userAdminScript;
     $this->totalAdminScript = $path . $this->totalAdminScript;
     $this->userCreation = $path . $this->userCreation;
     $this->userConfirm = $path . $this->userConfirm;
     $this->userLister = $path . $this->userLister;
     // configure debug
     if ($this->checkDebugIp) {
         if (SSP_paddIp($this->debugIP) === SSP_paddIp($_SERVER['REMOTE_ADDR'])) {
             $debug = true;
         } else {
             $debug = false;
         }
     } else {
         $debug = true;
     }
     $this->loginDebug = $this->loginDebug and $debug;
     $this->accessFaultDebug = $this->accessFaultDebug and $debug;
     $this->divertDebug = $this->divertDebug and $debug;
     $this->displaySqlFaults = $this->displaySqlFaults and $debug;
     date_default_timezone_set($this->siteTimezoneIdentifier);
     Protect::setTemplatePath(__DIR__ . $this->templateDir);
     // Translation configuration
     if ($this->translate) {
         // basic language setup
         // start debug mode
         if ($this->translateDebug) {
             Translate::debug();
         }
         // configure language translation object
         $SSP_lang = new Translate($this->lang, $this->translateLangs, __DIR__ . $this->translatePath);
         CheckData::addTranslation($SSP_lang);
         sfc\Form::addTranslation($SSP_lang);
         Protect::addTranslation($SSP_lang);
     }
     // set up pages not to be included in the history
     ProtectBase::addNoHistoryPage($this->logonScript);
     ProtectBase::addNoHistoryPage($this->logoffScript);
     ProtectBase::addNoHistoryPage($this->passwordRecover);
     ProtectBase::addNoHistoryPage($this->userConfirm);
     ProtectBase::addNoHistoryPage($this->newPassword);
     ProtectBase::addNoHistoryPage($this->userCreation);
     /**
      * Set up PHP initialisation parameters
      *
      * These can be ignored and set up in the php.ini if you have access
      *
      * if you need to change the parameters from the default,
      * simply uncomment the line and change the required paramater.
      */
     // specifies the name of the session which is used as cookie name. It should only contain alphanumeric characters.
     ini_set("session.name", $this->sessVarName);
     // defines the name of the handler which is used for storing and retrieving data associated with a session.
     // files - uses inbuilt php routines, only good for unix systems with small numbers of users
     // user - database using abstraction layer.
     ini_set("session.save_handler", "user");
     // specifies the number of seconds after which a session will be seen as 'garbage' and cleaned up. Will also clean up any other temporary tables.
     ini_set("session.gc_maxlifetime", $this->sessMaxLifetime);
     // 1440 = 24 minutes
     // defines the argument which is passed to the save handler. If you choose the default files handler, this is the path where the files are created. Put in directory your system can access, but not a user with a browser.
     ini_set("session.save_path", "/usr/local/tmp");
     // specifies the probability that the gc (garbage collection) routine is started on each request in percentage. You might want to lower this for busy sites.
     ini_set("session.gc_probability", "10");
     // defines the name of the handler which is used to serialize/deserialize data. Currently, a PHP internal format (name php) and WDDX is supported (name wddx). WDDX is only available, if PHP is compiled with WDDX support. Defaults to php.
     // ini_set("session.serialize_handler","php");
     // the lifetime of the cookie in seconds which is sent to the browser. The value 0 means "until the browser is closed."
     // ini_set("session.cookie_lifetime","0");
     // specifies path to set in session_cookie.
     ini_set("session.cookie_path", $this->cookiePath);
     // specifies the domain to set in session_cookie.
     ini_set("session.cookie_domain", $this->cookieDomain);
     if ($this->useSSL) {
         ini_set("session.cookie_secure", 1);
         ini_set('session.cookie_httponly', 1);
     }
 }
Exemplo n.º 6
0
 /**
  * Edit Miscellaneous data
  * @param bool $creating - creating a new user
  * @param bool $reDisplay - re-display after update
  * @return string/bool - edit screen or true on save and not re-display
  */
 public function userMisc($creating = false, $reDisplay = false)
 {
     // Form elements
     $form = new sfc\Form(SSP_Path(), $this->cfg->userMiscTable, "userMisc");
     $form->errorAutoFormDisplay = false;
     $mainContent = array();
     if ($creating) {
         $mainContent["title"] = "Miscellaneous information";
     } else {
         $mainContent["title"] = "Edit info";
     }
     $form->tpl = $this->tpl($mainContent, $creating);
     if ($this->subTpl != "") {
         $form->tplf = $this->subTpl;
     } else {
         $form->tplf = "changemisc.tpl";
     }
     $form->fe('text', "Title", "Title (Mr/Mrs/Mz/Dr/Prof.)");
     $form->fep("width=10");
     $form->fe('text', "FirstName", "First Name");
     $form->fep("width=30,required=true");
     $form->fe('text', "Initials", "Initials");
     $form->fep("width=5");
     $form->fe('text', "FamilyName", "Family  Name", 30);
     $form->fep("width=30,required=true");
     $form->fe('textarea', "Address", "Address");
     $form->fep("width=30,lines=5");
     $form->fe('text', "TownCity", "Town or City");
     $form->fep("width=20");
     $form->fe('text', "PostCode", "Post Code");
     $form->fep("width=10, maxLength=10, maxChar=10");
     $form->fe('text', "County", "County");
     $form->fep("width=30");
     if ($creating) {
         $form->fe("submit", "submit", "Next");
     } else {
         $form->fe("submit", "submit", "Save");
     }
     $return = '';
     if ($form->processForm($_POST)) {
         if (!$form->error) {
             // update database
             $query = $form->querySave(true);
             $where = array("UserId" => $this->id);
             $this->db->update($this->cfg->userMiscTable, $form->saveFields, $where, "SSP user admin: Saving misc member data");
             if ($reDisplay) {
                 $form->tda("saved");
                 $return = $form->create(true);
             } else {
                 $return = true;
             }
         } else {
             $return = $form->create(true);
         }
     } else {
         $query = $form->querySelect();
         $where = array("UserId" => $this->id);
         $dataUpdate = $this->db->get($this->cfg->userMiscTable, $where, "SSP user admin: Getting User Misc data for update");
         $form->data = get_object_vars($dataUpdate);
         $return = $form->create(true);
     }
     return $return;
 }
Exemplo n.º 7
0
Arquivo: test.php Projeto: julesbl/ssp
$session = new Protect();
$dataCheck = new CheckData();
$formLang = new sfc\Form(SSP_Path(), "noTable", "languageform");
$formLang->tplf = "testDatatypeLanguage.tpl";
$formLang->formSubmitVar = 'testLanguagechange';
$formLang->fe('select', 'language', 'Language', Protect::$tranlator->getLanguages());
$formLang->fep('deflt = ' . $session->lang);
$formLang->setParam('script', 'onChange="this.form.submit()"');
if ($formLang->processForm($_POST)) {
    $session->lang = $formLang->getField('language');
    session_write_close();
    SSP_Divert(SSP_Path());
} else {
    $setLanguage = $formLang->create();
}
$form = new sfc\Form(SSP_Path(), "noTable", "testDatatype");
$form->tplf = "testDatatype.tpl";
$form->tda('lang', $session->lang);
$form->tda('setLanguage', $setLanguage);
$form->fe("text", "data", "Data to be checked");
$form->fep("dataType = gen");
$dataType = array("text" => "text " . $dataCheck->dataTypes["text"]->validChars, "password" => "password " . $dataCheck->dataTypes["password"]->validChars, "date" => "date " . $dataCheck->dataTypes["date"]->validChars, "time" => "time " . $dataCheck->dataTypes["time"]->validChars, "phone" => "phone " . $dataCheck->dataTypes["phone"]->validChars, "int" => "int " . $dataCheck->dataTypes["int"]->validChars, "real" => "real " . $dataCheck->dataTypes["real"]->validChars, "hex" => "hex " . $dataCheck->dataTypes["hex"]->validChars, "oct" => "oct " . $dataCheck->dataTypes["oct"]->validChars, "bin" => "bin " . $dataCheck->dataTypes["bin"]->validChars, "email" => "email " . $dataCheck->dataTypes["email"]->validChars, "emailchk" => "emailchk " . $dataCheck->dataTypes["email"]->validChars, "dom" => "dom " . $dataCheck->dataTypes["dom"]->validChars, "domchk" => "domchk " . $dataCheck->dataTypes["dom"]->validChars, "lable" => "lable " . $dataCheck->dataTypes["lable"]->validChars, "gen" => "general data, no checking at all!");
$form->fe("select", "dataType", "Data type to check against", $dataType);
if ($form->processForm($_POST)) {
    if (!$form->error) {
        $error = $dataCheck->check($form->getField("dataType"), $form->getField("data"));
        $form->tda("errorNumber", $error);
        $form->tda("errorString", $dataCheck->errorMessage);
        echo $form->create(true);
    }
} else {
Exemplo n.º 8
0
        $form->output();
        return $form->output;
    }
    static function previewForm($formData)
    {
        $form = new Template($formData, "test1uploadpreview.tpl", false);
        $form->encode = false;
        $form->output();
        return $form->output;
    }
    static function modFile()
    {
        return "10";
    }
}
$form = new sfc\Form("test1upload.php", "TestSave", 'fred');
$form->templateRoutine = '\\w34u\\ssp\\TestForm::createForm';
$form->setPreview("\\w34u\\ssp\\Testform::previewForm");
$form->buildForm = false;
$form->fe("textarea", "textarea", "Testing text area box", "text area");
$form->fep("width=50,lines=10");
$validTypes = array(".jpg", ".gif", ".png");
$form->fe("file", "image1", "upload an image");
$form->fileObjects["image1"] = new sfc\File($form->elements["image1"], "images/", "images/", $validTypes, "102400", "\\w34u\\ssp\\TestForm::modFile");
$form->fileObjects["image1"]->setPreview("preview/", "preview/");
$form->fe("file", "image2", "upload another image");
$form->fileObjects["image2"] = new sfc\File($form->elements["image2"], "images/", "images/", $validTypes, "102400", "\\w34u\\ssp\\TestForm::modFile");
$form->fileObjects["image2"]->setPreview("preview/", "preview/");
$form->fe("submit", "submit1", "Submit Now");
$form->funcTokenMake = "SSP_FormToken";
$form->funcTokenCheck = "SSP_FormTokenCheck";
Exemplo n.º 9
0
    // simple test form class
    static function test($form)
    {
        if (strlen($form->getField("testtext")) < 3) {
            $form->addError("Checking routine does not like testtexts length");
        }
    }
    static function previewForm($formData)
    {
        $form = new Template($formData, "test2preview.tpl", false);
        $form->encode = false;
        $form->output();
        return $form->output;
    }
}
$form = new sfc\Form("test2.php", "TestSaveTable", "test2form");
$form->formCheck = '\\w34u\\ssp\\TestForm::test';
$form->tplf = "test2.tpl";
$form->setPreview("\\w34u\\ssp\\Testform::previewForm");
$form->fe("text", "testtext", "Testing input box", "test input");
$params = "dataType = text, elClass = boxClass, maxLength = 100, accessKey=a,tabIndex=10,style=border-width:10px, ldir=ltr,lang=en,width=100,required=true, minChar=3";
$form->fep($params);
$form->fe("password", "textpass", "Testing password box");
$form->fep("dataType = password,required=true,encap=true,textBefore=false");
$form->fe("textarea", "textarea", "Testing text area box", "text area");
$form->fep("width=50,lines=10");
$selectData = array("first" => "First Select", "second" => "Second one", "Mouse" => "It's a mouse");
$form->fe("select", "testSelect", "Testing dropdown", $selectData);
$form->fep("deflt=second");
$form->fe("select", "testMulti", "Testing Multi", $selectData);
$form->fep("lines=4");
Exemplo n.º 10
0
 /**
  * creates a template for admin page displays
  * @param array $contentMain the pages content
  * @param string $tpl alternative template name
  * @param bool $createMenu create the main menu
  * @param bool $suppressLangSelect - suppress the language selection dropdown
  * @return Template main template
  */
 function tpl($contentMain, $tpl = "", $createMenu = true, $suppressLangSelect = false)
 {
     // default to the main template if not other template not supplied
     if ($tpl != "") {
         $template = $tpl;
     } else {
         $template = $this->template;
     }
     // if the content suppied is just a string use it as the page title
     if (is_string($contentMain)) {
         $temp = $contentMain;
         $contentMain = array();
         $contentMain["title"] = $temp;
     }
     // build the page title from the supplied segments
     if (count($this->pageTitleSegments)) {
         if ($this->session->isTranslate()) {
             foreach ($this->pageTitleSegments as $key => $titlePart) {
                 $this->pageTitleSegments[$key] = $this->session->t($titlePart);
             }
         }
         $contentMain["title"] = $this->session->t($this->cfg->siteName) . $this->pageTitleSeperator . implode($this->pageTitleSeperator, $this->pageTitleSegments);
     } else {
         $contentMain["title"] = $this->session->t($this->cfg->siteName);
     }
     // add paths to various useful areas
     $contentMain["pathSite"] = $this->cfg->pathSite;
     $contentMain["pathAdmin"] = $this->cfg->adminDir;
     // create the language selection
     if ($this->cfg->translate and !$suppressLangSelect) {
         $formTemplate = array('<form action="{formAction}" method="post" id="languageSelectionform">', '{languageDropdown}', '{formHidden}', '</form>');
         $form = new sfc\Form(SSP_Path(true), 'notable', 'languageSelect');
         $form->translateDisable = true;
         $form->checkToken = false;
         $form->errorAutoFormDisplay = false;
         $form->formSubmitVar = 'languageSelectionformToken';
         $form->tplf = new Template("", $formTemplate);
         $languages = $this->session->getLanguages();
         $dropdownInformation = array();
         foreach ($languages as $lang => $languageInfo) {
             $dropdownInformation[$lang] = array('text' => $languageInfo['description'], 'dir' => $languageInfo['dir'], 'class' => 'lang_' . $lang, 'style' => 'background-image: url(/sspadmin/images/flag_' . $lang . '.png);');
         }
         $form->fe('select', 'languageDropdown', '', $dropdownInformation);
         $form->fep('deflt = ' . Protect::$tranlator->getLanguage());
         $form->setParam('script', 'onChange="this.form.submit()"');
         if ($form->processForm($_POST)) {
             if (!$form->error) {
                 $this->session->lang = $form->getField('languageDropdown');
                 session_write_close();
                 //echo 'code '. $_SESSION['SSP_currentLanguageCode'];
                 SSP_Divert(SSP_Path(true));
             }
         }
         $contentMain['languageSelectForm'] = $form->create();
     }
     if ($createMenu) {
         // generate main menu
         // highlight a main menu item
         if (isset($contentMain["mainSection"])) {
             $section = $contentMain["mainSection"];
         } else {
             $section = "";
         }
         $url = $_SERVER['REQUEST_URI'];
         $menu = new MenuGen();
         $menu->add($this->cfg->adminDir . 'useradmin/info/' . $this->session->userId, $this->session->t("User Details"), strpos($url, "useradmin") !== false);
         $menu->add($this->cfg->adminDir . 'adminusercreation', $this->session->t("New User"), strpos($url, "adminusercreation") !== false);
         $menu->add($this->cfg->userLister, $this->session->t("List Users"), $url === "/sspadmin/" or $url === '/sspadmin/filterChange' or $url === '/sspadmin/filterNormal' or $url === '/sspadmin/filterAdminPending');
         $menu->add($this->cfg->siteRoot, $this->session->t("Home"));
         $menu->add($this->cfg->logoffScript, $this->session->t("Log off"));
         $contentMain["mainMenu"] = $menu->cMenu();
     } else {
         $contentMain["mainMenu"] = "";
     }
     if (!isset($contentMain["menu"])) {
         $contentMain["menu"] = "";
     }
     if ($this->cfg->enableSetup === true) {
         $contentMain['showDisableSetupText'] = true;
     }
     $tpl = new Template($contentMain, $template, false);
     return $tpl;
 }
Exemplo n.º 11
0
 /**
  * Display the filter form to change the list
  * @return string - html to be displayed
  */
 public function displayFilterForm()
 {
     // display form to update filter values
     $form = new sfc\Form($this->cfg->userLister . '/filterChange', "noTable", "sspFilter");
     $form->tda("tpl", $this->tpl(array("title" => "Modify search criteria")));
     $form->tda("tplf", "userListerSearchForm.tpl");
     $form->templateRoutine = "\\w34u\\ssp\\UserLister::formFilterCreate";
     $form->tda("fields", $this->filter->filterFields);
     $form->fe("radio", "filterOr", "Select using", array(0 => "All", 1 => "Any"));
     $form->fep("dataType=int, deflt=" . $this->filter->filterOr);
     foreach ($this->filter->filterFields as $key => $value) {
         $form->fe("select", "filterField" . $key, "Search", $this->cfg->fieldsFilterList);
         $form->fep("deflt={$value}");
         $form->fe("text", "filterValue" . $key, "for");
         $form->fep("dataType=gen, deflt=" . $this->filter->filterValues[$key]);
     }
     $form->fe("submit", "addField", "Add Search field");
     $form->fe("select", "limit", "Results per page", $this->cfg->limits);
     $form->fep("dataType=int, deflt=" . $this->filter->limit);
     $accessList = array_merge(array("all" => "All Types"), $this->cfg->userAccessTypeDropdown);
     $form->fe("select", "userAccess", "Member Access", $accessList);
     $form->fep("dataType=password, deflt=" . $this->filter->userAccess);
     $form->fe("check", "filterOnFlags", "Filter using flags", array(0, 1));
     $form->fep("dataType=bin, deflt=" . $this->filter->filterOnFlags);
     $flagFilterOptions = array(0 => " false", 1 => " true", 2 => " ignore");
     $form->fe("radio", "userDisabled", "Users who have been disabled", $flagFilterOptions);
     $form->fep("dataType=int, deflt=" . $this->filter->userDisabled);
     $form->fe("radio", "userPending", "User who are waiting for external OK", $flagFilterOptions);
     $form->fep("dataType=int, deflt=" . $this->filter->userPending);
     $form->fe("radio", "userAdminPending", "User Admin Pending", $flagFilterOptions);
     $form->fep("dataType=int, deflt=" . $this->filter->userAdminPending);
     $form->fe("radio", "creationFinished", "User Properly created", $flagFilterOptions);
     $form->fep("dataType=int, deflt=" . $this->filter->creationFinished);
     $form->fe("radio", "userWaiting", "Waiting for user to respond to email", $flagFilterOptions);
     $form->fep("dataType=int, deflt=" . $this->filter->userWaiting);
     $form->fe("submit", "submit", "Search Now");
     $form->fe("submit", "newSearch", "Reset Search Criteria");
     if ($form->processForm($_POST)) {
         if (!$form->error) {
             $this->filter->filterOr = $form->getField("filterOr");
             foreach ($this->filter->filterFields as $key => $value) {
                 $this->filter->filterFields[$key] = $form->getField("filterField" . $key);
             }
             $this->filter->limit = $form->getField("limit");
             if (array_key_exists("addField", $form->data)) {
                 // add a new search field
                 $this->filter->addField();
                 SSP_Divert($this->cfg->userLister);
             } elseif (array_key_exists("newSearch", $form->data)) {
                 // clears the form and search parameters
                 $this->filter->newSearch();
                 SSP_Divert($this->cfg->userLister);
             } else {
                 // show list with new search
                 $this->filter->update($form->data, true);
                 SSP_Divert($this->cfg->userLister);
             }
         } else {
             return $form->create(true);
         }
     } else {
         return $form->create();
     }
 }
Exemplo n.º 12
0
 /**
  * Creates the login form
  * @param Template $tpl - template in which to wrap the form
  * @param bool $ignoreToken - dont use the timeout token
  * @return sfc\Form - form to be used to login
  */
 protected function loginScreenDefine($tpl, $ignoreToken)
 {
     // defines the login form
     $useMainTemplate = is_object($tpl);
     $form = new sfc\Form($this->cfg->logonScript, "noTable", "loginForm");
     $form->errorAutoFormDisplay = false;
     // disable checking of token for embedded login forms
     if ($ignoreToken) {
         $form->checkToken = false;
     }
     if ($useMainTemplate) {
         $form->tpl = $tpl;
     }
     $form->tplf = "logonpage.tpl";
     if ($this->cfg->loginType == 0) {
         // login using email
         $form->fe("text", "email", "Your email");
         $form->fep("required=true, dataType=email");
     } elseif ($this->cfg->loginType == 1) {
         // login using username
         $form->fe("text", "user", "Your user name");
         $form->fep("required=true");
     }
     $form->fe("password", "password", "Password");
     $form->fep("required=true, dataType=password, load=false, minChar=" . $this->cfg->minPassword);
     if ($this->rememberMe) {
         $form->fe("check", "rememberMe", "Remember me (do not tick this box on a public computer)", array(0, 1));
         $form->fep("textBefore=false, encap=true");
     }
     if (isset($_SESSION["SSP_LoginPageAddtionalContent"]) and is_array($_SESSION["SSP_LoginPageAddtionalContent"])) {
         $form = array_merge($form->tDataAdditional, $_SESSION["SSP_LoginPageAddtionalContent"]);
     }
     $form->tda("passwordRecoveryLink", $this->cfg->passwordRecover);
     $form->tda("siteHome", $this->cfg->pathSite);
     $form->tda("siteName", $this->cfg->siteName);
     $form->tda("joinSiteLink", $this->cfg->userCreation);
     return $form;
 }