$objFieldset->legend = $fieldsetLabel; $objFieldset->contents = "<table><tr><td align=\"right\">" . $catLabel->show() . ": </td><td>" . $objCat->show() . "</td></tr>" . "<tr><td align=\"right\">" . $titLabel->show() . ": </td><td>" . $objTit->show() . "</td></tr></table>"; //Add the fieldset to the form $objForm->addToForm($objFieldset->show()); // Create an instance of the button object $this->loadClass('button', 'htmlelements'); // Create a submit button $objElement = new button('submit'); $objElement->setIconClass("save"); // Set the button type to submit $objElement->setToSubmit(); // Use the language object to add the word save $objElement->setValue(' ' . $this->objLanguage->languageText("word_save") . ' '); // Create cancel button $objCancel = new button('cancel'); $objCancel->setIconClass("cancel"); $objCancel->setOnClick("window.location='" . $this->uri(NULL) . "';"); $objCancel->setValue(' ' . $this->objLanguage->languageText("mod_storycategoryadmin_cancel", "storycategoryadmin") . ' '); // Add the button to the form $objForm->addToForm('<br/>' . $objElement->show() . " " . $objCancel->show()); //Add the heading to the layer $this->objH = $this->getObject('htmlheading', 'htmlelements'); $this->objH->type = 1; //Heading <h1> $this->objH->str = $objLanguage->code2txt("mod_storycategoryadmin_title", "storycategoryadmin"); $rightSideColumn = $this->objH->show(); $rightSideColumn .= $objForm->show(); // Add Left column $cssLayout->setLeftColumnContent($leftSideColumn); // Add Right Column $cssLayout->setMiddleColumnContent($rightSideColumn);
/** * Method to generate a context search form */ public function searchForm() { $this->loadClass('form', 'htmlelements'); $this->loadClass('textinput', 'htmlelements'); $this->loadClass('button', 'htmlelements'); $this->loadClass('hiddeninput', 'htmlelements'); $form = new form('contextsearch', $this->uri(array('action' => 'search'), 'context')); $form->method = 'GET'; $module = new hiddeninput('module', 'context'); $action = new hiddeninput('action', 'search'); $form->addToForm($module->show() . $action->show()); $textinput = new textinput('search', $this->getParam('search')); $button = new button('searchButton', ucwords($this->objLanguage->code2Txt('mod_context_searchcontext', 'context', NULL, 'Search [-context-]'))); $button->setIconClass("search"); $button->setToSubmit(); $form->addToForm('<p align="center">' . $textinput->show() . '<br />' . $button->show() . '</p>'); return $form->show(); }
/** * * Render a login box * * @param string $module The module we are in or will go to * @param boolean $ajaxLogin Whether or not to do ajax login * @return string The login box * @access public * */ public function renderLoginBox($module = NULL, $ajaxLogin = FALSE) { try { // Determine if we need to use https $useHTTPS = $this->objSysConfig->getValue('MOD_SECURITY_HTTPS', 'security'); // Set the formaction depending on whether it is going to use ajax or not. if (!$ajaxLogin) { // Set the action for the login form depending on if there is a module or not. if ($module != NULL) { $formAction = $this->uri(array('action' => 'login', 'mod' => $module), 'security'); } else { $formAction = $this->uri(array('action' => 'login'), 'login'); } if ($useHTTPS == '1' || $useHTTPS == 'TRUE') { $formAction = str_replace("http:", "https:", $formAction); } } else { // We want an ajax login. $formAction = 'javascript:void(0);'; } // Create a Form object. $objForm = new form('loginform', $formAction); $objFields = new fieldset(); $objFields->setLegend(' '); //--Create an element for the username $objInput = new textinput('username', '', 'text', '15'); $objInput->extra = 'maxlength="255"'; $objInput->setCss('required minlength(2)'); $objLabel = new label($this->objLanguage->languageText('word_username') . ': ', 'input_username'); //Add the username box to the form $objFields->addContent($objLabel->show() . '<br />'); $objFields->addContent($objInput->show() . '<br />'); //--- Create an element for the password $objInput = new textinput('password', '', 'password', '15'); $objInput->extra = 'maxlength="255"'; $objInput->setCss('required'); $objLabel = new label($this->objLanguage->languageText('word_password') . ': ', 'input_password'); $objFields->addContent($objLabel->show() . '<br />'); $objFields->addContent($objInput->show()); //--- Create an element for the network login radio $objElement = new checkbox("useLdap"); $objElement->setCSS("transparentbgnb"); $objElement->label = $this->objLanguage->languageText("phrase_networkid") . ' '; $ldap = ''; $objSysConfig = $this->getObject('dbsysconfig', 'sysconfig'); $showLDAPCheckBox = $objSysConfig->getValue('show_ldap_checkbox', 'security'); // Get a nonce $objNonce = $this->getObject('nonce', 'login'); $nonce = $objNonce->storeNonce(); // Create a hidden field for the nonce $objNonce = new hiddeninput('nonce', $nonce); $objNonce->extra = ' id=\'nonce\''; $nonce = $objNonce->show(); //----------------------------------------------------------------------------------------Checking this is a violation of the principle of chain of responsiblity @todo fix it if ($this->objConfig->getuseLDAP() && $showLDAPCheckBox == 'true') { $ldap .= $objElement->label . ' ' . $objElement->show(); } //--- Create an element for the remember me checkbox $objRElement = new checkbox("remember"); $objRElement->setCSS("transparentbgnb noborder"); $objRElement->label = $this->objLanguage->languageText("phrase_rememberme", "security"); $rem = $objRElement->show() . "<br />"; //--- Create a submit button $objButton = new button('submit', $this->objLanguage->languageText("word_login")); // Add the login icon $objButton->setIconClass("user"); // Set the button type to submit $objButton->setToSubmit(); // Give the button an ID for jQuery to grab. $objButton->setId('loginButton'); // Add the button to the form ----------------------------------------------------------- Note LDAP breaks the COR pattern $objFields->addContent($ldap . '<br />' . $nonce . $rem . "<div class='loginbuttonwrap'>" . $objButton->show() . '</div>'); $helpText = strtoupper($this->objLanguage->languageText('word_help', 'system')); $helpIcon = $this->objHelp->show('register', 'useradmin', $helpText); $resetLink = new Link($this->uri(array('action' => 'needpassword'), 'security')); $resetLink->link = $this->objLanguage->languageText('mod_security_forgotpassword'); // the help link $p = '<br/>' . $resetLink->show() . '<br />' . $helpIcon; $objFields->addContent($p); $objForm->addToForm($objFields->show()); return '<div id="login_block_wrapper">' . $objForm->show() . '</div>'; } catch (Exception $e) { customException::cleanUp(); } }
/** * Method to render a login box * @returns string */ public function renderLoginBox($module = NULL) { try { //set the action for the login form if ($module != NULL) { $formAction = $this->objEngine->uri(array('action' => 'login', 'mod' => $module), 'security'); } else { $formAction = $this->objEngine->uri(array('action' => 'login'), 'security'); } $useHTTPS = $this->objSysConfig->getValue('MOD_SECURITY_HTTPS', 'security'); if ($useHTTPS == '1') { $formAction = str_replace("http:", "https:", $formAction); } //Load up the various HTML classes $this->loadClass('button', 'htmlelements'); $this->loadClass('textinput', 'htmlelements'); $this->loadClass('checkbox', 'htmlelements'); $this->loadClass('link', 'htmlelements'); $this->loadClass('label', 'htmlelements'); $this->loadClass('fieldset', 'htmlelements'); $objBox = $this->newObject('alertbox', 'htmlelements'); $objIcon = $this->getObject('geticon', 'htmlelements'); // prepare the link for the oAuth providers $box = $this->oauthDisp(); $fb = $this->fbButton(); //fbConnect(); // Create a Form object $objForm = new form('loginform', $formAction); $objFields = new fieldset(); $objFields->setLegend(' '); //--Create an element for the username $objInput = new textinput('username', '', 'text', '15'); $objInput->extra = 'maxlength="255" placeholder="' . $this->objLanguage->languageText('word_username', 'system') . '"'; $objLabel = new label($this->objLanguage->languageText('word_username') . ': ', 'input_username'); //Add validation for username $objForm->addRule('username', $this->objLanguage->languageText("mod_login_unrequired", 'security', 'Please enter a username. A username is required in order to login.'), 'required'); //Add the username box to the form $this->objIcon->setIcon('user'); $objFields->addContent($this->objIcon->show()); $objFields->addContent($objInput->show() . '<br />'); //$objForm->addToForm(); //--- Create an element for the password $objInput = new textinput('password', '', 'password', '15'); $objInput->extra = 'maxlength="255" placeholder="' . $this->objLanguage->languageText('word_password', 'system') . '"'; $objLabel = new label($this->objLanguage->languageText('word_password') . ': ', 'input_password'); //Add the password box to the form //$objForm->addToForm(); $this->objIcon->setIcon('key'); $objFields->addContent($this->objIcon->show()); // $objFields->addContent($objLabel->show() . '<br />'); $objFields->addContent($objInput->show()); //--- Create an element for the network login radio $objElement = new checkbox("useLdap"); $objElement->setCSS("transparentbgnb"); $objElement->label = $this->objLanguage->languageText("phrase_networkid") . ' '; $ldap = ''; $objSysConfig = $this->getObject('dbsysconfig', 'sysconfig'); $showLDAPCheckBox = $objSysConfig->getValue('show_ldap_checkbox', 'security'); if ($this->objConfig->getuseLDAP() && $showLDAPCheckBox == 'true') { $ldap .= $objElement->label . ' ' . $objElement->show(); } //--- Create an element for the remember me checkbox $objRElement = new checkbox("remember"); $objRElement->setCSS("transparentbgnb noborder"); $objRElement->label = $this->objLanguage->languageText("phrase_rememberme", "security"); $rem = $objRElement->show() . "<br />"; //--- Create a submit button $objButton = new button('submit', $this->objLanguage->languageText("word_login")); // Add the login icon $objButton->setIconClass("user"); // Set the button type to submit $objButton->setToSubmit(); // Add the button to the form // openid / google /yahoo login // Open ID login code. $showOpenIdLogin = $objSysConfig->getValue('show_openidconnect_auth', 'security'); $openidlink = ""; if ($showOpenIdLogin == 'true') { // OpenId auth page is used for Google and Yahoo $objAltConfig = $this->getObject('altconfig', 'config'); $siteRoot = $objAltConfig->getSiteRoot(); $OPENID_AUTH_PAGE = $this->uri(array("action" => "openidconnect"), "security"); // Google icon $gIcon = $this->newObject('geticon', 'htmlelements'); $gIcon->setIcon('google'); $gIcon->alt = "Google ID"; $gIcon->extra = ' name="but_google" id="but_google2" onload="" '; // Facebook icon $fIcon = $this->newObject('geticon', 'htmlelements'); $fIcon->setIcon('facebook'); $fIcon->alt = "FB ID"; $fIcon->extra = ' name="but_fb" id="but_fb" onload="" '; $FB_AUTH_PAGE = $this->uri(array("action" => "initfacebooklogin", 'auth_site' => 'facebook'), "security"); // Yahoo icon $yIcon = $this->newObject('geticon', 'htmlelements'); $yIcon->setIcon('yahoo'); $yIcon->alt = "Yahoo ID"; $yIcon->extra = ' name="but_yahoo" id="but_yahoo" onload="" '; //Twitter icon $tIcon = $this->newObject('geticon', 'htmlelements'); $tIcon->setIcon('twitter', 'png'); $tIcon->alt = "TWITTER ID"; $tIcon->extra = ' name="but_twitter" id="but_twitter" onload="" '; $TWITTER_AUTH_PAGE = $this->uri(array("action" => "dotwitterlogin", 'auth_site' => 'twitter'), "security"); $TWITTER_AUTH_PAGE = str_replace("&", "&", $TWITTER_AUTH_PAGE); $openidloginlink = new link($this->uri(array("action" => "openidconnect"), "security")); $openidloginlink->link = '<h3>' . $this->objLanguage->languageText('mod_security_oauthheading', 'security') . '</h3>'; $sitePath = $objAltConfig->getSitePath(); // A google login icon linked to OpenID login with gooogle id. $googleTD = '<a href="' . $OPENID_AUTH_PAGE . '&auth_site=google" target="_top">' . $gIcon->show() . '</a>'; // A Yahoo login icon linked to OpenId login with Yahoo ID. $yahooTD = '<a href="' . $OPENID_AUTH_PAGE . '&auth_site=yahoo" target="_top">' . $yIcon->show() . '</a>'; // Facebook login icon with link to login page. $fbTD = '<a href="' . $FB_AUTH_PAGE . '" target="_top">' . $fIcon->show() . '</a>'; // Twitter login icon with link to login page. $twitterTD = '<a href="' . $TWITTER_AUTH_PAGE . '" target="_top">' . $tIcon->show() . '</a>'; //$twitterTD = NULL; <--- uncomment for commit until TWITTER AUTH is fixed // Explanation text for the textbox and Choose button $explainBox = '<div class="oid_explain">' . $this->objLanguage->languageText('mod_security_openidexplainbox', 'security') . '</div>'; // Title for the fieldset. $title = '<h3>' . $this->objLanguage->languageText('mod_security_openidlogintitle', 'security') . '</h3>'; $allowOpenIdForm = FALSE; if ($allowOpenIdForm) { // Allow login via any Open ID url, use mainly for testing. $openIdForm = new form('openlogiidnform', $this->uri(array("action" => "openidconnect", "auth_site" => "openid"))); $objInput = new textinput('openIDField', '', 'text', '30'); $objInput->extra = 'maxlength="255"'; $openIdForm->addToForm($explainBox . $objInput->show()); // The login via provided open ID URL button $openIdButton = new button('submit', $this->objLanguage->languageText("mod_security_openidlogin", 'security')); // Add the login icon $openIdButton->setIconClass("user"); // Set the button type to submit $openIdButton->setToSubmit(); $openIdForm->addToForm($openIdButton->show()); $opForm = '<hr/><br/>' . $openIdForm->show(); } else { $opForm = NULL; } $openIdFields = new fieldset(); $openIdFields->setLegend('<h3>' . $title . '</h3>'); $openIdFields->addContent($this->objLanguage->languageText('mod_security_oidliinstr', 'security', 'Login with one of the accounts indicated by the icons below')); $openIdFields->addContent('<hr>'); $openIdFields->addContent($fbTD . ' ' . $twitterTD . ' ' . $googleTD . ' ' . $yahooTD . ' ' . $opForm); $openidlink = '<div class="openidlogin">' . $openIdFields->show() . "</div>"; } $objFields->addContent($ldap . '<br />' . $rem . $box . "<div class='loginbuttonwrap'>" . $objButton->show() . '</div>' . $fb); $notice = $this->objLanguage->languageText('mod_security_forgotpassword'); $helpText = strtoupper($this->objLanguage->languageText('mod_security_helpmelogin', 'security', 'Yes, please help me to login')); $resetLink = new Link($this->uri(array('action' => 'needpassword'), 'security')); $resetLink->link = $helpText; // the help link $p = '<br />' . $notice . '<br/>' . $resetLink->show() . '<br />'; $objFields->addContent($p); $objForm->addToForm($objFields->show()); return $objForm->show() . $openidlink; } catch (Exception $e) { customException::cleanUp(); } }
} $notice = "<span class='error'>{$output}</span>"; } $this->unsetSession('output'); } $objForm =& new form('batchform', $this->uri(array('action' => $actiontotake, 'cat' => $activeCat), 'modulecatalogue')); $objForm->displayType = 3; $objForm->addToForm($notice); $objForm->addToForm($top); $objForm->addToForm($objTable->show()); $objForm->addToForm($bot); $searchForm = new form('searchform', $this->uri(array('action' => 'search', 'cat' => 'all'), 'modulecatalogue')); $searchForm->displayType = 3; $srchStr = new textinput('srchstr', $this->getParam('srchstr'), null, '21'); $srchButton = new button('search'); $srchButton->setIconClass("search"); $srchButton->setValue($this->objLanguage->languageText('word_search')); $srchButton->setToSubmit(); $srchType = new dropdown('srchtype'); $srchType->addOption('name', $this->objLanguage->languageText('mod_modulecatalogue_modname', 'modulecatalogue')); $srchType->addOption('description', $this->objLanguage->languageText('mod_modulecatalogue_description', 'modulecatalogue')); $srchType->addOption('both', $this->objLanguage->languageText('word_all')); $srchType->addOption('tags', $this->objLanguage->languageText('mod_modulecatalogue_tags', 'modulecatalogue')); $srchType->setSelected($this->getParam('srchtype')); $srch = $srchType->show() . $srchButton->show(); $hTable = $this->newObject('htmltable', 'htmlelements'); $hTable->startRow(); $hTable->addCell($objH->show(), null, null, 'left'); $hTable->addCell($srchStr->show(), null, 'bottom', 'right'); $hTable->endRow(); $hTable->startRow();
/** * * Method to generate a form for a site-wide search * * @param boolean $compact whether or not to use the compact search form for small screens. * @return str Search Form * @access public * */ public function show($compact = FALSE) { //checking if configuration exist-By Emmanuel Natalis if (strtoupper($this->objConfig->getenable_searchBox()) == 'TRUE' && $this->objModules->checkIfRegistered('search')) { $slabel = new label($this->objLanguage->languageText('phrase_sitesearch', 'search', 'Site Search') . ':', 'input_search'); $sform = new form('query', $this->uri(NULL, 'search')); //$sform->addRule('searchterm', $this->objLanguage->languageText("mod_blog_phrase_searchtermreq", "blog") , 'required'); $query = new textinput('search'); $query->size = 15; $objSButton = new button($this->objLanguage->languageText('word_go', 'system')); // Add the search icon $objSButton->setIconClass("search"); //$this->objSButton->setValue($this->objLanguage->languageText('mod_skin_find', 'skin')); $objSButton->setValue('Find'); $objSButton->setToSubmit(); if ($compact) { $sform->addToForm($slabel->show() . ' ' . $objSButton->show() . '<br /> ' . $query->show()); } else { $sform->addToForm($slabel->show() . ' ' . $query->show() . ' ' . $objSButton->show()); } $sform = '<div id="search">' . $sform->show() . '</div>'; return $sform; } else { return NULL; } }