function login($username = null, $status = null, &$auth = null) { global $msg, $auth, $is_post; $welcome = $auth->checkAuth() ? 'login_success' : 'login_welcome'; $welcome = $msg[$welcome]; if ($is_post && !$auth->checkAuth()) { $welcome = $msg['login_failed'] . ' ' . $welcome; } $ret .= '<h1>' . $msg['login'] . '</h1>' . LF; if (!$auth->checkAuth()) { $ret .= sprintf('<p>%1$s</p>' . LF, $msg['login_beta']); } $ret .= sprintf('<p>%1$s</p>' . LF, $welcome); if (!$auth->checkAuth()) { $form = new form('login_form', null, './?mod=user&action=login'); $form->setup($msg); $form->addElement('text', 'username', $msg['username']); $form->addElement('password', 'password', $msg['password']); $form->addElement('submit', null, $msg['login']); $form->addRule('username', sprintf($msg['required_alert'], $msg['username']), 'required', null, 'client'); $form->addRule('password', sprintf($msg['required_alert'], $msg['password']), 'required', null, 'client'); $ret .= $form->toHtml(); } return $ret; }
/** * */ function show_form() { $form = new form('entry_form', null, './?mod=comment'); $form->setup($this->msg); $form->addElement('text', 'sender_name', $this->msg['comment_sender'], array('size' => 40, 'maxlength' => '255')); $form->addElement('text', 'sender_email', $this->msg['comment_email'], array('size' => 40, 'maxlength' => '255')); $form->addElement('textarea', 'comment_text', $this->msg['comment_text'], array('rows' => 10, 'style' => 'width: 100%')); $form->addElement('submit', 'save', $this->msg['submit']); $form->addRule('sender_name', sprintf($this->msg['required_alert'], $this->msg['comment_sender']), 'required', null, 'client'); $form->addRule('sender_email', sprintf($this->msg['required_alert'], $this->msg['comment_email']), 'required', null, 'client'); $form->addRule('sender_email', $this->msg['email_invalid'], 'email', null, 'client'); $form->addRule('comment_text', sprintf($this->msg['required_alert'], $this->msg['comment_text']), 'required', null, 'client'); $msg = $this->msg[$this->status == 0 ? 'comment_welcome' : 'comment_sent']; $ret .= sprintf('<p>%1$s</p>' . LF, $msg); if ($this->status == 0) { $ret .= $form->toHtml(); } return $ret; }
private function process() { $this->commonProcess(); $config = services::getService('config'); $lang = services::getService('lang'); $params = services::getService('pageParams'); $pool = new pools(); $pool->get($params->getParam('pool_id')); $this->pool = $pool; if ($pool->isMember($this->user->id)) { $thread = new forumThreads(); $thread->id = $params->getParam('thread'); $thread->find(); $thread->fetch(); // new/change entry if ($params->getParam('action') == 'new_entry') { // formular $form = new form('forum_entry'); $form->addElement('textarea', 'entrytext', $lang->getMsg('home_news_text'), array('rows' => 15, 'cols' => 70)); $form->addElement('hidden', 'action', 'new_entry'); $form->addElement('hidden', 'pool_id', $pool->id); $form->addElement('hidden', 'thread', $thread->id); $form->addElement('submit', 'entrysubmit', $lang->getMsg('home_news_submit')); $form->addRule('entrytext', $lang->getMsg('showpool_forum_text_required'), 'required'); // write entry if ($form->validate()) { $new_entry = new forumEntries(); $new_entry->thread_id = $thread->id; $new_entry->text = $form->exportValue('entrytext'); $new_entry->user_id = $this->user->id; $new_entry->date = time(); $threads = clone $thread; $threads->act_date = $new_entry->date; $thread->delete(); $threads->insert(); $new_entry->insert(); $this->switchPage('threadbrowser&pool_id=' . $pool->id . '&thread=' . $threads->id . '&msg=msg_forum_entry_made'); } $this->form = $form; } // build forum-tabledata $this->thread = $thread; // fetch entries $entries = new forumEntries(); $entries->thread_id = $thread->id; $entries->find(); while ($entries->fetch()) { $entries->fetchUser(); $this->entries[$entries->id] = clone $entries; } } else { $this->switchPage('showpool&pool_id=' . $pool->id . '&msg=msg_nice_try'); } }
$textinput->fldType = 'password'; $textinput->size = 15; $textinput->extra = ' autocomplete="off"'; if ($howcreated == 'LDAP') { $textinput->extra .= ' disabled="disabled"'; } $table->addCell($label->show()); $table->addCell(' '); $table->addCell($textinput->show()); $table->endRow(); $form->addToForm($table->show()); $button = new button('submitform', $this->objLanguage->languageText('mod_useradmin_updatedetails', 'useradmin', 'Update Details')); $button->setToSubmit(); // $button->setOnClick('validateForm()'); $form->addToForm('<p>' . $button->show() . '</p>'); $form->addRule('useradmin_firstname', $this->objLanguage->languageText('mod_userdetails_enterfirstname', 'userdetails'), 'required'); $form->addRule('useradmin_surname', $this->objLanguage->languageText('mod_userdetails_entersurname', 'userdetails'), 'required'); $form->addRule('useradmin_email', $this->objLanguage->languageText('mod_userdetails_enteremailaddress', 'userdetails'), 'required'); $form->addRule('useradmin_email', $this->objLanguage->languageText('mod_userdetails_entervalidemailaddress', 'userdetails'), 'email'); echo $form->show(); echo '</div>'; echo '<div><div style="width:25%; float: left; padding: 5px;">'; echo '<h3>' . $this->objLanguage->languageText('phrase_userimage', 'userdetails') . ':</h3>'; $objModule = $this->getObject('modules', 'modulecatalogue'); $changeimageform = new form('changeimage', $this->uri(array('action' => 'changeimage'))); $changeimageform->addToForm($useridinput->show()); if ($objModule->checkIfRegistered('filemanager')) { $objSelectFile = $this->getObject('selectimage', 'filemanager'); $objSelectFile->name = 'imageselect'; $objSelectFile->restrictFileList = array('jpg', 'gif', 'png', 'jpeg', 'bmp'); $changeimageform->addToForm($objSelectFile->show());
$header->str = $this->objLanguage->languageText('mod_filemanager_editquota', 'filemanager', 'Edit Quota') . ': '; if (substr($quota['path'], 0, 7) == 'context') { $header->str .= ucfirst($this->objLanguage->code2Txt('mod_filemanager_contextfilesof', 'filemanager', NULL, '[-context-] Files of')) . ' ' . $this->objContext->getTitle(substr($quota['path'], 8)); $defaultQuota = $this->objQuotas->getDefaultContextQuota(); } else { $header->str .= $this->objLanguage->languageText('mod_filemanager_userfilesof', 'filemanager', 'User files of') . ' ' . $this->objUser->fullName(substr($quota['path'], 6)); $defaultQuota = $this->objQuotas->getDefaultUserQuota(); } echo $header->show(); $form = new form('updatequota', $this->uri(array('action' => 'updatequota'))); $hiddeninput = new hiddeninput('id', $quota['id']); $form->addToForm($hiddeninput->show()); $radio = new radio('quotatype'); $radio->addOption('Y', $this->objLanguage->languageText('mod_filemanager_usedefaultquotaof', 'filemanager', 'Use Default Quota of') . ' ' . $defaultQuota . ' MB'); $radio->addOption('N', $this->objLanguage->languageText('mod_filemanager_usecustomquota', 'filemanager', 'Use Custom Quota')); $radio->setBreakSpace('<br />'); $radio->setSelected($quota['usedefault']); $form->addToForm($radio->show()); $customQuota = new textinput('customquota'); $customQuota->size = 5; if ($quota['usedefault'] == 'Y') { $customQuota->value = $defaultQuota; } else { $customQuota->value = $quota['quota']; } $form->addToForm(': ' . $customQuota->show() . ' MB'); $button = new button('confirm', $this->objLanguage->languageText('mod_filemanager_updatequota', 'filemanager', 'Update Quota')); $button->setToSubmit(); $form->addToForm('<br /><br />' . $button->show()); $form->addRule('customquota', $this->objLanguage->languageText('mod_filemanager_validatenumber', 'filemanager', 'Please enter a number for the custom quota'), 'numeric'); echo $form->show();
$table->addCell($usernameLabel->show(), 100); $table->addCell($username->show()); $table->endRow(); $table->startRow(); $table->addCell($emailLabel->show()); $table->addCell($email->show()); $table->endRow(); $table->startRow(); $table->addCell(' '); $table->addCell(' '); $table->endRow(); $table->startRow(); $redrawButton = new button('redraw', 'Redraw', 'redraw();'); $table->addCell($captchaLabel->show()); $table->addCell(stripslashes($this->objLanguage->languageText('mod_security_explaincaptcha', 'security', 'To prevent abuse, please enter the code as shown below. If you are unable to view the code, click on "Redraw" for a new one.')) . '<br /><div id="captchaDiv">' . $objCaptcha->show() . '</div>' . $captcha->show() . ' <a href="javascript:redraw();">' . $this->objLanguage->languageText('word_redraw', 'security', 'Redraw') . '</a>'); $table->endRow(); $form->addToForm($table->show()); $button = new button('submitform', $this->objLanguage->languageText('mod_security_sendmenewpassword', 'security', 'Send me a new password')); $button->setToSubmit(); $form->addToForm('<p><br />' . $button->show() . '</p>'); $form->addRule('request_username', 'Please enter your username', 'required'); //$form->addRule('request_email', 'Not a valid Email', 'email'); $form->addRule('request_email', 'Please enter your emailaddress', 'required'); $form->addRule('request_captcha', 'Please enter the code in the image', 'required'); echo $form->show(); //$this->setLayoutTemplate(NULL); //$this->setVar('pageSuppressXML', TRUE); //echo '<div id="captchaDiv">'.$objCaptcha->show().'</div>'.$redrawButton->show(); echo '<p>' . $this->objLanguage->languageText('word_note', 'security', 'Note') . ': '; echo $this->objLanguage->languageText('mod_security_passworddoesntworkldap', 'security', 'This does not work for accounts that use Network Identification. For assistance in this regard, please contact your System Administrator'); echo ' (' . $this->objConfig->getsiteEmail() . ')</p>';
//Create an element for the hidden text input $objElement = new textinput("id"); //Set the value to the primary keyid if (isset($id)) { $objElement->setValue($id); } //Set the field type to hidden for the primary key $objElement->fldType = "hidden"; //Add the hidden PK field to the form $objForm->addToForm($objElement->show()); //Create label for input of category $catLabel = new label($this->objLanguage->languageText("word_category"), "input_category"); //Create an element for the input of category $objCat = new textinput("category"); $catMiss = $this->objLanguage->languageText('mod_storycategory_catmiss', "storycategoryadmin"); $objForm->addRule('category', $catMiss, 'required'); //Set the value of the element to $category if (isset($category)) { $objCat->setValue($category); } //Create label for the input of title $titLabel = new label($this->objLanguage->languageText("word_title"), "input_title"); //Create an element for the input of title $objTit = new textinput("title"); $titMiss = $this->objLanguage->languageText('mod_storycategory_titmiss', "storycategoryadmin"); $objForm->addRule('title', $titMiss, 'required'); //Set the width $objTit->size = 70; //Set the value of the element to $title if (isset($title)) { $objTit->setValue($title);
private function process() { $this->commonProcess(); $config = services::getService('config'); $lang = services::getService('lang'); $params = services::getService('pageParams'); $mail = services::getService('mail'); $categories = services::getService('cats'); $pool = new pools(); if ($pool->get($params->getParam('pool_id'))) { // become member if ($params->getParam('action') == 'become_member') { if ($params->getParam('become_member_submit') || $pool->is_public) { $new_membership = new poolsUser(); $new_membership->user_id = $this->user->id; $new_membership->pool_id = $pool->id; if (!$pool->is_public) { $new_membership->wait = 1; } else { $new_membership->res_to_free = 1; $new_membership->wait = 0; } if ($params->getParam('become_member_comments')) { $new_membership->comments = $params->getParam('become_member_comments'); } $new_membership->insert(); // compose E-Mails if (!$pool->is_public) { $tos = $pool->getAdmins(); foreach ($tos as $to) { $mail->send('new_member', $to, $pool, $this->user, $new_membership->comments); } } else { $this->switchPage('mysite&new_pool=' . $pool->id); } } else { $this->become_member_form = true; } } // are you waiting? if ($pool->isWaiting($this->user->id)) { $this->user_is_waiting = true; } // loose membership if ($params->getParam('action') == 'no_member') { // the last admin can't leave the pool if (!$pool->isLastAdmin($this->user->id)) { $pool->removeMember($this->user->id); $this->addMsg('msg_leave_pool'); } else { $this->addMsg('msg_leave_pool_last_admin'); } } // build tabledata if ($pool->isMember($this->user->id)) { $showcats = $categories->getChildren(0); foreach ($showcats as $cat_id => $cat_name) { $show_res = new resFetcher(); $show_res->_cat = $cat_id; $show_res->_pools = array($pool->id); $rescounter = $show_res->count(); if ($rescounter > 0) { $this->cats[$cat_id] = array("name" => $cat_name, "count" => $rescounter); } } $allcount = 0; foreach ($this->cats as $cat) { $allcount += $cat['count']; } $this->cats[0] = array("name" => $lang->getMsg('cat_all'), "count" => $allcount); } else { if (!$pool->isMember($this->user->id, true)) { $this->not_member = true; } $res_counter = new poolsResources(); $res_counter->pool_id = $pool->id; $this->res_counter = 0; $res_counter->find(); while ($res_counter->fetch()) { ++$this->res_counter; } } // build forum-tabledata if ($pool->isMember($this->user->id)) { // new/change entry if ($params->getParam('action') == 'new_entry') { // formular $form = new form('forum_entry'); $form->addElement('text', 'entryheader', $lang->getMsg('showpool_forum_headline'), array('size' => 30, 'maxlength' => 100)); $form->addElement('textarea', 'entrytext', $lang->getMsg('home_news_text'), array('rows' => 15, 'cols' => 70)); $form->addElement('hidden', 'action', 'new_entry'); $form->addElement('hidden', 'pool_id', $pool->id); $form->addElement('hidden', 'thread', $thread->id); $form->addElement('submit', 'entrysubmit', $lang->getMsg('home_news_submit')); $form->addRule('entryheader', $lang->getMsg('showpool_forum_headline_required'), 'required'); $form->addRule('entrytext', $lang->getMsg('showpool_forum_text_required'), 'required'); // write entry if ($form->validate()) { $new_thread = new forumThreads(); $new_thread->pool_id = $pool->id; $new_thread->title = $form->exportValue('entryheader'); $new_thread->act_date = time(); $new_thread->insert(); $new_thread->find(true); $new_entry = new forumEntries(); $new_entry->thread_id = $new_thread->id; $new_entry->text = $form->exportValue('entrytext'); $new_entry->user_id = $this->user->id; $new_entry->date = $new_thread->act_date; $new_entry->insert(); $this->switchPage('showpool&pool_id=' . $pool->id . '&msg=msg_forum_entry_made'); } $this->form = $form; } $showthreads = new forumThreads(); $showthreads->pool_id = $pool->id; $showthreads->find(); while ($showthreads->fetch()) { $showthreads->fetchLastEntry(); $showthreads->last_entry->fetchUser(); $this->threads[] = array("id" => $showthreads->id, "title" => $showthreads->title, "act_date" => date('j. n. y, H:i', $showthreads->last_entry->date) . ' ' . $lang->getMsg('showpool_forum_lastentry_by') . ' ' . '<a href="./index.php?page=showmember&pool_id=' . $pool->id . '&showmember=' . $showthreads->last_entry->user->id . '">' . $showthreads->last_entry->user->name . '</a>'); } } // build userlist if ($pool->id != 1) { // assotiativ array with object and detail-flag if ($pool->isMember($this->user->id)) { $members = array(); $pool_users = new poolsUser(); $pool_users->pool_id = $pool->id; $pool_users->wait = 0; if ($pool_users->find()) { $detail_id = $params->getParam('showmember'); $count = 1; while ($pool_users->fetch()) { if ($pool_users->user_id != $this->user->id) { $pool_users->fetchUser(); $member = array("obj" => $pool_users->user, "detail" => $pool_users->user->id == $detail_id, "count" => $count, "admin" => $pool->isAdmin($pool_users->user->id)); if ($pool_users->user->name != "") { $members[] = $member; } ++$count; } } $this->members = $members; } } } $this->pool = $pool; } else { $this->switchPage('mysite'); } }
/** * Return HTML code of change password form */ function change_password_form() { if ($this->auth->checkAuth()) { // welcome message $msg = $this->msg['pwd_welcome']; if ($this->status == PROCESS_FAILED) { $msg = $this->msg['pwd_chg_failed'] . ' ' . $msg; } if ($this->status == PROCESS_SUCCEED) { $msg = $this->msg['pwd_chg_succeed']; } $ret .= sprintf('<h1>' . $this->msg['change_pwd'] . '</h1>') . LF; $ret .= sprintf('<p>' . $msg . '</p>') . LF; // form if ($this->status != PROCESS_SUCCEED) { $form = new form('change_password_form', null, './?mod=user&action=password'); $form->setup($this->msg); $form->addElement('password', 'pwd_current', $this->msg['pwd_current']); $form->addElement('password', 'pwd_new', $this->msg['pwd_new']); $form->addElement('password', 'pwd_retype', $this->msg['pwd_retype']); $form->addElement('submit', null, $this->msg['submit']); $form->addRule('pwd_current', sprintf($this->msg['required_alert'], $this->msg['pwd_current']), 'required', null, 'client'); $form->addRule('pwd_new', sprintf($this->msg['required_alert'], $this->msg['pwd_new']), 'required', null, 'client'); $form->addRule('pwd_retype', sprintf($this->msg['required_alert'], $this->msg['pwd_retype']), 'required', null, 'client'); $form->addRule(array('pwd_new', 'pwd_retype'), $this->msg['pwd_nomatch'], 'compare', null, 'client'); $ret .= $form->toHtml(); } return $ret; } return $ret; }
} $emailAlert = new checkbox('emailalertopt', $this->objLanguage->languageText('mod_contextadmin_emailalertwhat', 'contextadmin', 'Send email alerts'), true); // this will checked if ($mode == 'add' && is_array($fixup)) { $emailAlert->setChecked($fixup['alerts']); } elseif ($mode == 'add') { $emailAlert->setChecked('0'); } else { if ($mode == 'edit') { $emailAlert->setChecked($context['alerts']); } } $table->startRow(); $table->addCell($this->objLanguage->languageText('mod_contextadmin_emailalert', 'contextadmin', 'Alerts')); $table->addCell($emailAlert->show()); $table->endRow(); $button = new button('savecontext', $this->objLanguage->languageText('mod_contextadmin_gotonextstep', 'contextadmin', 'Go to Next Step')); $button->cssId = 'savebutton'; $button->setToSubmit(); //$table_ = $table->show(); //if ($objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'true') { // $table_ .= $access->show(); //} $form->addToForm($table->show() . '<p><br />' . $button->show() . '</p>'); $hiddenInput = new hiddeninput('mode', $mode); $form->addToForm($hiddenInput->show()); if ($mode == 'add') { $form->addRule('contextcode', $this->objLanguage->code2Txt('mod_contextadmin_pleaseentercontextcode', 'contextadmin', NULL, 'Please enter a [-context-] code'), 'required'); } $form->addRule('title', $this->objLanguage->languageText('mod_contextadmin_pleaseentertitle', 'contextadmin', 'Please enter a title'), 'required'); echo $form->show();
if ($action != 'translate') { $parentId = ""; } } $objFmTable->endRow(); //Create a dropdown for the category selector $objCat = new dropdown('category_selector'); $objCat->extra = " onchange=\"document.forms['storyinput'].category.value=document.forms['storyinput'].category_selector.value;\""; $objCat->addOption("", "Clear input"); $objCat->addFromDB($car, 'title', 'category', $category); //Add a row for the category $objFmTable->startRow(); $objFmTable->addCell($objLanguage->languageText("word_category") . ": ", NULL, "top", "right"); $objTextInput = new textinput('category', $category); $objTextInput->extra = 'readonly="READONLY"'; $objForm->addRule('category', $objLanguage->languageText("mod_stories_val_catnotnull", "stories"), 'required'); $objFmTable->addCell($objTextInput->show() . " " . $objCat->show(), NULL, "top", "left"); $objFmTable->endRow(); //Add a row for the language $objFmTable->startRow(); $objFmTable->addCell($objLanguage->languageText("word_language") . ": ", NULL, "top", "right"); $objTextInput = new textinput('language', $language); $objTextInput->extra = 'readonly="READONLY"'; $objForm->addRule(array('name' => 'language', 'length' => 2), $objLanguage->languageText("mod_stories_val_lang2chargt", "stories"), 'maxlength'); $objForm->addRule('language', $objLanguage->languageText("mod_stories_val_langnotnull", "stories"), 'required'); //Create a dropdown for the language selector $objCat = new dropdown('language_selector'); $objCat->extra = " onchange=\"document.forms['storyinput'].language.value=document.forms['storyinput'].language_selector.value;\""; $objCat->addOption("", "Clear input"); $objLangList = $this->newObject('languagecode', 'language'); $objCat->selected = $language;
/** * 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(); } }
/** * Short description for function * * Long description (if any) ... * * @return void * @access public */ function valFormShow() { //I am not using multilingualized text for the examples $objForm = new form('testform'); $objForm->setAction($this->uri(array('action' => 'valform'), 'htmlelements')); $objForm->setDisplayType(2); $name = new textinput('name'); $name->label = 'Name(must be filled out)'; $objForm->addRule('name', 'Please enter your name', 'required'); $surname = new textinput('surname'); $surname->label = 'Surname (must be less than 15 characters)'; $objForm->addRule(array('name' => 'surname', 'length' => 15), 'Your surname is too long', 'maxlength'); $email = new textinput('email'); $email->label = 'Email (must be a valid email address)'; $objForm->addRule('email', 'Not a valid Email', 'email'); $pwd = new textinput('pwd'); $pwd->label = 'Password '; $pwd->fldType = 'password'; $pwd2 = new textinput('pwd2'); $pwd2->label = 'Retype password (must be the same as "Password" case sensitive)'; $pwd2->fldType = 'password'; $objForm->addRule(array('pwd', 'pwd2'), 'Password did not match', 'compare'); $age = new textinput('age'); $age->label = 'Age (must be older than 18)'; $objForm->addRule(array('name' => 'age', 'minnumber' => 18), 'You have to be older than 18', 'minnumber'); $colour = new textinput('colour'); $colour->label = 'Favourate Colour (must be between 3 and 15 characters inclusive)'; $objForm->addRule(array('name' => 'colour', 'lower' => 3, 'upper' => 10), 'must be between 3 and 10 characters inclusive', 'rangelength'); $sentence = new textinput('sentence'); $sentence->label = 'Sentence (must contain no punctuation) not working yet'; $car = new textinput('car'); $car->label = 'Favourate Car (must contain only alphabetic characters)'; $objForm->addRule('car', 'Must contain letters of the alphabet', 'letteronly'); $monitor = new textinput('monitor'); $monitor->label = 'Favourate Monitor (must contain only alphanumeric characters)'; $objForm->addRule('monitor', 'Must contain letters of the alphabet and valid numbers', 'alphanumeric'); $birthday = new textinput('birthday'); $birthday->label = 'Birthday (mm/dd/yyy) not working yet'; $sex = new radio('sex_radio'); $sex->addOption('m', 'Male'); $sex->addOption('f', 'Female'); $sex->addOption('n', 'Seaweed'); //$objForm->addRule('sex_radio','Please select your sex','select'); $save = new button('save'); $save->setToSubmit(); $save->setValue('Save'); $objForm->addToForm($name); $objForm->addToForm($surname); $objForm->addToForm($email); $objForm->addToForm($pwd); $objForm->addToForm($pwd2); $objForm->addToForm($age); $objForm->addToForm($sentence); $objForm->addToForm($colour); $objForm->addToForm($car); $objForm->addToForm($monitor); $objForm->addToForm($birthday); //$objForm->addToForm($sex); $objForm->addToForm($save); $this->setVar('left', ""); $this->setVar('right', ''); $this->setVar('content', $objForm->show()); $this->setVar('bottom', ''); }
/** * Get context edit form * @return string * */ public function getEditContextForm($contextCode = NULL) { if (empty($contextCode)) { $contextCode = $this->_objDBContext->getContextCode(); } $context = $this->_objDBContext->getRow('contextcode', $contextCode); $objH = new htmlheading(); $objForm = new form(); $inpContextCode = new textinput(); $inpMenuText = new textinput(); $inpTitle = new textinput(); $inpButton = new button(); $objIcon = $this->newObject('geticon', 'htmlelements'); $dropAccess = new dropdown(); //$radioStatus = new radio(); $objStartDate = $this->newObject('datepicker', 'htmlelements'); $objFinishDate = $this->newObject('datepicker', 'htmlelements'); $objIcon->setIcon('help'); $objH->str = $this->_objLanguage->languageText("mod_context_step", 'context') . ' 1: ' . $this->_objLanguage->languageText("mod_context_addcontext", 'context'); $objH->type = 3; //setup the form $objForm->name = 'addfrm'; $objForm->action = $this->uri(array('action' => 'saveedit')); $objForm->extra = 'class="f-wrap-1"'; $objForm->displayType = 3; //contextcode $inpContextCode->name = 'contextcode'; $inpContextCode->id = 'contextcode'; $inpContextCode->value = ''; $inpContextCode->cssClass = 'f-name'; //title $inpTitle->name = 'title'; $inpTitle->id = 'title'; $inpTitle->value = $context['title']; $inpTitle->cssClass = 'f-name'; //menu text $inpMenuText->value = $context['menutext']; $inpMenuText->name = 'menutext'; $inpMenuText->id = 'menutext'; $inpMenuText->cssClass = 'f-name'; //status $dropAccess->name = 'status'; $dropAccess->addOption('Published', $this->_objLanguage->languageText("mod_context_published", 'context')); $dropAccess->addOption('Unpublished', $this->_objLanguage->languageText("mod_context_unpublished", 'context')); $dropAccess->setSelected(trim($context['status'])); //access $checked = $context['access'] == 'Public' ? ' checked = "checked" ' : ''; $drop = '<fieldset class="f-radio-wrap"> <b>' . $this->_objLanguage->languageText("mod_context_access", 'context') . ':</b> <fieldset> <label for="Public"> <input id="Public" type="radio" name="access" ' . $checked . ' value="Public" class="f-radio" tabindex="8" /> ' . $this->_objLanguage->languageText("mod_context_public", 'context') . ' <span class="caption"> - ' . $this->_objLanguage->code2Txt("mod_context_publichelp", 'context', array('context' => 'Course')) . '</span></label>'; $checked = $context['access'] == 'Open' ? ' checked = "checked" ' : ''; $drop .= '<label for="Open"> <input id="Open" type="radio" name="access" ' . $checked . ' value="Open" class="f-radio" tabindex="9" /> ' . $this->_objLanguage->languageText("mod_context_open", 'context') . ' <span class="caption"> - ' . $this->_objLanguage->code2Txt("mod_context_openhelp", 'context', array('context' => 'Course')) . '</span></label>'; $checked = $context['access'] == 'Private' ? ' checked = "checked" ' : ''; $drop .= ' <label for="Private"> <input id="Private" type="radio" name="access" ' . $checked . ' value="Private" class="f-radio" tabindex="10" /> ' . $this->_objLanguage->languageText("mod_context_private", 'context') . ' <span class="caption"> - ' . $this->_objLanguage->code2Txt("mod_context_privatehelp", 'context', array('context' => 'course')) . '</span></label> </fieldset> </fieldset>'; //start date $objStartDate->name = 'startdate'; $objStartDate->value = $context['startdate']; //finish date $objFinishDate->name = 'finishdate'; $objFinishDate->value = $context['finishdate']; //button $inpButton->setToSubmit(); $inpButton->cssClass = 'f-submit'; $inpButton->value = ucwords($this->_objLanguage->languageText("word_save")); //validation $objForm->addRule('menutext', $this->_objLanguage->languageText("mod_contextadmin_err_requiremenutext", 'contextadmin'), 'required!'); $objForm->addRule('title', $this->_objLanguage->languageText("mod_contextadmin_err_requiretitle", 'contextadmin'), 'required!'); $objForm->addToForm('<div class="req"><b>*</b>' . $this->_objLanguage->languageText("mod_context_required", 'context') . '</div>'); $objForm->addToForm('<fieldset>'); $objForm->addToForm('<label for="contextcode"><b><span class="req">*</span>' . ucwords($this->_objLanguage->code2Txt("mod_context_contextcode", 'context', array('context' => 'Course'))) . ':</b> <span class="highlight">'); $objForm->addToForm($this->_objDBContext->getContextCode() . '</span><br /></label>'); $objForm->addToForm('<label for="title"><b><span class="req">*</span>' . $this->_objLanguage->languageText("word_title") . ':</b>'); $objForm->addToForm($inpTitle->show() . '<br /></label>'); $objForm->addToForm('<label for="menutext"><b><span class="req">*</span>' . $this->_objLanguage->languageText("mod_context_menutext", 'context') . ':</b>'); $objForm->addToForm($inpMenuText->show() . '<br /></label>'); $objForm->addToForm('<label for="access"><b><span class="req">*</span>' . $this->_objLanguage->languageText("mod_context_status", 'context') . ':</b>'); $objForm->addToForm($dropAccess->show() . '<br /></label>'); $objForm->addToForm($drop); $objForm->addToForm('<label> <br/></label>'); $objForm->addToForm('<br/><div class="f-submit-wrap">' . $inpButton->show() . '</div></fieldset>'); return $objForm->show() . '<br/>'; }
/** * */ function show_form() { $query = 'SELECT a.* FROM glossary a WHERE a.glo_uid = ' . $this->db->quote($_GET['uid']); $this->entry = $this->db->get_row($query); $is_new = is_array($this->entry) ? 0 : 1; $form = new form('entry_form', null, './' . $this->get_url_param()); $form->setup($this->msg); $form->addElement('text', 'original', $this->msg['en'], array('size' => 40, 'maxlength' => '255')); $form->addElement('text', 'phrase', $this->msg['id'], array('size' => 40, 'maxlength' => '255')); $form->addElement('select', 'discipline', $this->msg['discipline'], $this->db->get_row_assoc('SELECT * FROM discipline ORDER BY discipline_name', 'discipline', 'discipline_name')); $form->addElement('select', 'ref_source', $this->msg['ref_source'], $this->db->get_row_assoc('SELECT * FROM ref_source WHERE glossary = 1', 'ref_source', 'ref_source_name')); $form->addElement('text', 'wpen', $this->msg['wpen'], array('size' => 40, 'maxlength' => '255')); $form->addElement('text', 'wpid', $this->msg['wpid'], array('size' => 40, 'maxlength' => '255')); $form->addElement('hidden', 'glo_uid'); $form->addElement('hidden', 'is_new', $is_new); $form->addElement('submit', 'save', $this->msg['save']); $form->addRule('phrase', sprintf($this->msg['required_alert'], $this->msg['id']), 'required', null, 'client'); $form->addRule('original', sprintf($this->msg['required_alert'], $this->msg['en']), 'required', null, 'client'); $form->addRule('discipline', sprintf($this->msg['required_alert'], $this->msg['discipline']), 'required', null, 'client'); $form->addRule('ref_source', sprintf($this->msg['required_alert'], $this->msg['ref_source']), 'required', null, 'client'); $form->setDefaults($this->entry); $ret .= sprintf('<h1>%1$s</h1>' . LF, ($is_new ? $this->msg['new'] : $this->msg['edit']) . ' - ' . $this->msg['glossary']); $ret .= $form->toHtml(); return $ret; }
/** * Method to generate an edit context settings form * @param array $context Current Context Settings * @return str */ public function editContextForm($context) { $header = new htmlheading(); $header->type = 1; $header->str = $this->objLanguage->languageText('word_edit', 'system', 'Edit') . ': ' . $context['title']; $str = $header->show(); $title = new textinput('title'); $title->size = 50; if ($context != NULL) { $title->value = htmlentities($context['title']); } $titleLabel = new label($this->objLanguage->languageText('word_title', 'system', 'Title'), 'input_title'); $status = new dropdown('status'); //$status->setBreakSpace('<br />'); $status->addOption('Published', $this->objLanguage->languageText('word_published', 'system', 'Published')); $status->addOption('Unpublished', $this->objLanguage->languageText('word_unpublished', 'system', 'Unpublished')); if ($context != NULL) { $status->setSelected($context['status']); } if ($this->objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'true') { if (is_null($context)) { $access_ = 'Private'; } else { $access_ = $context['access']; } $access = new hiddeninput('access', $access_); } else { $access = new radio('access'); $access->setBreakSpace('<br />'); $access->addOption('Public', '<strong>' . $this->objLanguage->languageText('word_public', 'system', 'Public') . '</strong> - <span class="caption">' . ucfirst($this->objLanguage->code2Txt('mod_context_publiccontextdescription', 'context', NULL, '[-context-] can be accessed by all users, including anonymous users')) . '</span>'); $access->addOption('Open', '<strong>' . $this->objLanguage->languageText('word_open', 'system', 'Open') . '</strong> - <span class="caption">' . ucfirst($this->objLanguage->code2Txt('mod_context_opencontextdescription', 'context', NULL, '[-context-] can be accessed by all users that are logged in')) . '</span>'); $access->addOption('Private', '<strong>' . $this->objLanguage->languageText('word_private', 'system', 'Private') . '</strong> - <span class="caption">' . $this->objLanguage->code2Txt('mod_context_privatecontextdescription', 'context', NULL, 'Only [-context-] members can enter the [-context-]') . '<span class="caption">'); if ($context != NULL) { $access->setSelected($context['access']); } else { $access->setSelected('Public'); } } $table = $this->newObject('htmltable', 'htmlelements'); if ($context != NULL) { $table->startRow(); $table->addCell(ucwords($this->objLanguage->code2Txt('mod_context_contextcode', 'context', NULL, '[-context-] Code')) . ':', 100); $table->addCell('<strong>' . $context['contextcode'] . '</strong>'); $table->endRow(); } else { $code = new textinput('contextcode'); $codeLabel = new label(ucwords($this->objLanguage->code2Txt('mod_context_contextcode', 'context', NULL, '[-context-] Code')), 'input_contextcode'); $table->startRow(); $table->addCell($codeLabel->show(), 100); $table->addCell($code->show() . ' <span id="contextcodemessage"></span>'); $table->endRow(); } $table->startRow(); $table->addCell($titleLabel->show() . ':'); $table->addCell($title->show()); $table->endRow(); $table->startRow(); $table->addCell(' '); $table->addCell(' '); $table->endRow(); $table->startRow(); $table->addCell($this->objLanguage->languageText('word_status', 'system', 'Status') . ':'); $table->addCell($status->show()); $table->endRow(); if ($this->objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'false') { $table->startRow(); $table->addCell($this->objLanguage->languageText('word_access', 'system', 'Access') . ':'); $table->addCell($access->show()); $table->endRow(); } $alerts = explode("|", $context['alerts']); $emailAlert = new checkbox('emailalertopt', $this->objLanguage->languageText('mod_contextadmin_emailalert', 'contextadmin', 'Email alerts'), $alerts[0] == 'e' || $alerts[0] == '1'); // this will checked //$alerts=array(); //$emailchecked=; //$emailAlert->setChecked(FALSE); //if($emailchecked) { // $emailAlert->setChecked($emailchecked); //} $table->startRow(); $table->addCell($this->objLanguage->languageText('mod_contextadmin_emailalert', 'contextadmin', 'Alerts')); $table->addCell($emailAlert->show()); $table->endRow(); $objSelectImage = $this->getObject('selectimage', 'filemanager'); $objSelectImage->context = TRUE; $table2 = $this->newObject('htmltable', 'htmlelements'); $table2->startRow(); $table2->addCell($table->show(), 600, NULL, NULL, NULL, 'colspan="2"'); $table2->addCell($objSelectImage->show()); $table2->endRow(); $table2->startRow(); $table2->addCell(' '); $table2->addCell(' '); $table2->addCell(' '); $table2->endRow(); $table2->startRow(); $table2->addCell(ucwords($this->objLanguage->code2Txt('mod_context_aboutcontext', 'context', NULL, 'About [-context-]')) . ':', 100); $htmlEditor = $this->newObject('htmlarea', 'htmlelements'); $htmlEditor->name = 'about'; $htmlEditor->toolbarSet = 'advanced'; if ($context != NULL) { $htmlEditor->value = $context['about']; } $table2->addCell($htmlEditor->show(), NULL, NULL, NULL, NULL, 'colspan="2"'); $table2->endRow(); $table2->startRow(); $table2->addCell(' '); $table2->addCell(' '); $table2->addCell(' '); $table2->endRow(); $table2->startRow(); $table2->addCell(' ', 100); if ($context == NULL) { $button = new button('savecontext', $formButton); } else { $button = new button('savecontext', ucwords($this->objLanguage->code2Txt('mod_context_updatecontext', 'context', NULL, 'Update [-context-]'))); } $button->setToSubmit(); $table2->addCell($button->show(), NULL, NULL, NULL, NULL, 'colspan="2"'); $table2->endRow(); $form = new form('createcontext', $this->uri(array('action' => $this->formAction), $this->formModule)); $form->addToForm($table2->show()); if ($this->objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'true') { $form->addToForm($access->show()); } if ($context != NULL) { $hiddenInput = new hiddeninput('contextcode', $context['contextcode']); $form->addToForm($hiddenInput->show()); } $form->addRule('title', $this->objLanguage->code2Txt('mod_context_entertitleofcontext', 'context', NULL, 'Please enter the title of your [-context-]'), 'required'); $str .= $form->show(); return $str; }
$devmsg = nl2br($devmsg); $usrmsg = nl2br($usrmsg); $blurb = $this->objLanguage->languagetext("mod_errors_blurb", "errors"); //$midcol .= $blurb; $midcol .= $objFeatureBox->show($this->objLanguage->languagetext("mod_errors_usrtitle", "errors"), $usrmsg); //'<div class="featurebox">' . nl2br($usrmsg) . '</div>'; $midcol .= $objFeatureBox->show($this->objLanguage->languagetext("mod_errors_devtitle", "errors"), $devmsg); //'<div class="featurebox">' . nl2br($devmsg) . '</div>'; //$logfile = htmlentities(file_get_contents('error_log/system_errors.log')); //$midcol .= $objFeatureBox->show($this->objLanguage->languagetext("mod_errors_logfiletitle", "errors"), $logfile); // CAPTCHA $objCaptcha = $this->getObject('captcha', 'utilities'); $captcha = new textinput('request_captcha'); $captchaLabel = NULL; // new label($this->objLanguage->languageText('phrase_verifyrequest', 'security', 'Verify Request'), 'input_request_captcha'); $cap = stripslashes($this->objLanguage->languageText('mod_security_explaincaptcha', 'security', 'To prevent abuse, please enter the code as shown below. If you are unable to view the code, click on "Redraw" for a new one.')) . '<br /><div id="captchaDiv">' . $objCaptcha->show() . '</div>' . $captcha->show() . ' <a href="javascript:redraw();">' . $this->objLanguage->languageText('word_redraw', 'security', 'Redraw') . '</a>'; //create the form $objForm->displayType = 4; $objForm->addToFormEx($objLanguage->languageText('mod_errors_submiterrs', 'errors')); $objForm->addToFormEx($objTextArea->show()); $objForm->addToFormEx($captchaLabel, $cap); $objForm->addToFormEx($objHiddenInput->show()); $objForm->addToFormEx($objHiddenInput2->show()); $objForm->addRule('request_captcha', $this->objLanguage->languageText("mod_blogcomments_captchaval", 'blogcomments'), 'required'); $this->objButton =& new button($objLanguage->languageText('word_sendtodevs', 'errors')); $this->objButton->setValue($objLanguage->languageText('word_sendtodevs', 'errors')); $this->objButton->setToSubmit(); $objForm->addToFormEx($this->objButton->show()); $midcol .= $objFeatureBox->show($this->objLanguage->languagetext("mod_errors_mailadmins", "errors"), $objForm->show()); $cssLayout->setMiddleColumnContent($midcol); echo $cssLayout->show();
/** * */ function show_form() { $url_pattern = '/^http(s?):\\/\\/([\\w-]+\\.)+[\\w-]+(\\/[\\w-\\.\\/\\?\\+%&=]*)?$/'; $form = new form('entry_form', null, './?mod=comment'); $form->setup($this->msg); $form->addElement('text', 'sender_name', $this->msg['comment_sender'], array('size' => 40, 'maxlength' => '255')); $form->addElement('text', 'sender_email', $this->msg['comment_email'], array('size' => 40, 'maxlength' => '255')); $form->addElement('text', 'url', $this->msg['url'], array('size' => 40, 'maxlength' => '255')); $form->addElement('textarea', 'comment_text', $this->msg['comment_text'], array('rows' => 10, 'style' => 'width: 100%')); $form->addElement('submit', 'save', $this->msg['submit']); $form->addRule('sender_name', sprintf($this->msg['required_alert'], $this->msg['comment_sender']), 'required', null, 'client'); $form->addRule('sender_email', sprintf($this->msg['required_alert'], $this->msg['comment_email']), 'required', null, 'client'); $form->addRule('sender_email', $this->msg['email_invalid'], 'email', null, 'client'); $form->addRule('url', $this->msg['url_invalid'], 'regex', $url_pattern, 'client'); $form->addRule('comment_text', sprintf($this->msg['required_alert'], $this->msg['comment_text']), 'required', null, 'client'); $form->setDefaults(array('url' => 'http://')); $msg = $this->msg[$this->status == 0 ? 'comment_welcome' : 'comment_sent']; $ret .= sprintf('<p>%1$s</p>' . LF, $msg); if ($this->status == 0) { $ret .= $form->toHtml(); } return $ret; }
/** * Show form */ function show_form() { global $_GET; $phrase = $this->get_phrase(); $is_new = $phrase ? 0 : 1; $url = './?mod=dictionary&action=form&phrase=' . ($phrase ? $_GET['phrase'] : '') . ''; if ($is_new) { $phrase['phrase'] = $_GET['phrase']; } $form = new form('phrase_form', null, $url); $form->setup($this->msg); // main elements $form->addElement('text', 'phrase', $this->msg['phrase'], array('size' => 40, 'maxlength' => '255')); $form->addElement('select', 'lex_class', $this->msg['lex_class'], $this->db->get_row_assoc('SELECT * FROM lexical_class', 'lex_class', 'lex_class_name')); $form->addElement('select', 'ref_source', $this->msg['ref_source'], $this->db->get_row_assoc('SELECT * FROM ref_source WHERE dictionary = 1', 'ref_source', 'ref_source_name')); $form->addElement('select', 'phrase_type', $this->msg['phrase_type'], $this->db->get_row_assoc('SELECT * FROM phrase_type ORDER BY sort_order', 'phrase_type', 'phrase_type_name')); $form->addElement('select', 'roget_class', $this->msg['roget_class'], $this->db->get_row_assoc('SELECT *, CONCAT(roget_class, \' - \', roget_name) roget_class_name FROM roget_class', 'roget_class', 'roget_class_name')); $form->addElement('text', 'etymology', $this->msg['etymology'], array('size' => 40, 'maxlength' => '255')); $form->addElement('text', 'pronounciation', $this->msg['pronounciation'], array('size' => 40, 'maxlength' => '255')); $form->addElement('text', 'actual_phrase', $this->msg['actual_phrase'], array('size' => 40, 'maxlength' => '255')); $form->addElement('text', 'info', $this->msg['info'], array('size' => 40, 'maxlength' => '255')); $form->addElement('text', 'notes', $this->msg['notes'], array('size' => 40, 'maxlength' => '255')); $form->addElement('submit', 'save', $this->msg['save']); $form->addRule('phrase', sprintf($this->msg['required_alert'], $this->msg['phrase']), 'required', null, 'client'); $form->addRule('phrase_type', sprintf($this->msg['required_alert'], $this->msg['phrase_type']), 'required', null, 'client'); $form->addRule('lex_class', sprintf($this->msg['required_alert'], $this->msg['lex_class']), 'required', null, 'client'); $form->setDefaults($phrase); $ret .= $form->begin_form(); $title = !$is_new ? $phrase['phrase'] : ($_GET['phrase'] ? $_GET['phrase'] : $this->msg['new_flag']); $template = '<tr><td>%1$s:</td><td>%2$s</td></tr>' . LF; // header $ret .= '<script src="js/jquery.js"></script>' . LF; $ret .= '<script src="js/common.js"></script>' . LF; $ret .= sprintf('<h1>%1$s</h1>' . LF, $title); $actions = array('cancel' => array('url' => './?mod=dictionary' . ($is_new ? '' : '&action=view&phrase=' . $_GET['phrase']))); $ret .= $this->get_action_buttons($actions); $ret .= '<table width="100%">' . LF; $ret .= '<tr valign="top">' . LF; $ret .= '<td width="50%">' . LF; $ret .= '<table>' . LF; $ret .= sprintf($template, $this->msg['phrase'], $form->get_element('phrase')); $ret .= sprintf($template, $this->msg['actual_phrase'], $form->get_element('actual_phrase')); $ret .= sprintf($template, $this->msg['phrase_type'], $form->get_element('phrase_type')); $ret .= sprintf($template, $this->msg['lex_class'], $form->get_element('lex_class')); $ret .= sprintf($template, $this->msg['info'], $form->get_element('info')); $ret .= '</table>' . LF; $ret .= '</td><td width="50%">' . LF; $ret .= '<table>' . LF; $ret .= sprintf($template, $this->msg['pronounciation'], $form->get_element('pronounciation')); $ret .= sprintf($template, $this->msg['etymology'], $form->get_element('etymology')); $ret .= sprintf($template, $this->msg['ref_source'], $form->get_element('ref_source')); $ret .= sprintf($template, $this->msg['roget_class'], $form->get_element('roget_class')); $ret .= sprintf($template, $this->msg['notes'], $form->get_element('notes')); $ret .= '</table>' . LF; $ret .= '</td>' . LF; $ret .= '</tr>' . LF; $ret .= '</table>' . LF; // definition $ret .= $this->show_sub_form(&$form, &$phrase, array('def_uid' => array('type' => 'hidden'), 'def_num' => array('type' => 'text', 'width' => '1%', 'option1' => array('size' => 1, 'maxlength' => 5)), 'lex_class' => array('type' => 'text', 'width' => '1%', 'option1' => array('size' => 1, 'maxlength' => 5)), 'discipline' => array('type' => 'text', 'width' => '1%', 'option1' => array('size' => 5, 'maxlength' => 15)), 'see' => array('type' => 'text', 'width' => '5%', 'option1' => array('size' => 8, 'maxlength' => 255)), 'def_text' => array('type' => 'text', 'width' => '50%', 'option1' => array('size' => 50, 'maxlength' => 255, 'style' => 'width:100%')), 'sample' => array('type' => 'text', 'width' => '50%', 'option1' => array('size' => 50, 'maxlength' => 255, 'style' => 'width:100%'))), 'definition', 'definition', 'definition', 'def_count'); // reference $ret .= $this->show_sub_form(&$form, &$phrase, array('ext_uid' => array('type' => 'hidden'), 'url' => array('type' => 'text', 'width' => '50%', 'option1' => array('size' => 50, 'maxlength' => 255, 'style' => 'width:100%')), 'label' => array('type' => 'text', 'width' => '50%', 'option1' => array('size' => 50, 'maxlength' => 255, 'style' => 'width:100%'))), 'external_ref', 'external_ref', 'reference', 'ext_count'); // relation $ret .= $this->show_sub_form(&$form, &$phrase, array('rel_uid' => array('type' => 'hidden'), 'rel_type' => array('type' => 'select', 'width' => '1%', 'option1' => $this->db->get_row_assoc('SELECT * FROM relation_type', 'rel_type', 'rel_type_name')), 'related_phrase' => array('type' => 'text', 'width' => '99%', 'option1' => array('size' => 50, 'maxlength' => 255, 'style' => 'width:100%'))), 'relation', 'thesaurus', 'all_relation', 'rel_count'); // end $ret .= '<input name="is_new" type="hidden" value="' . $is_new . '" />' . LF; $ret .= sprintf('<p>%1$s</p>', $form->get_element('save')); $ret .= $form->end_form(); // kbbi $ret .= sprintf('<h3>%1$s</h3>' . LF, $this->msg['kbbi_ref']); $this->kbbi = new kbbi($this->msg, &$this->db); $ret .= $this->kbbi->query($_GET['phrase'], 1) . '</b></i>' . LF; //var_dump($form->toArray()); //die(); return $ret; }
$objFeatureBox = $this->newObject('featurebox', 'navigation'); // Set columns to 2 $cssLayout->setNumColumns(2); $leftMenu = NULL; $rightSideColumn = NULL; $leftCol = NULL; $middleColumn = NULL; $leftCol .= $objSideBar->show(); $this->loadClass('href', 'htmlelements'); $this->loadClass('label', 'htmlelements'); $this->loadClass('textinput', 'htmlelements'); $this->loadClass('textarea', 'htmlelements'); $this->objUser = $this->getObject('user', 'security'); $cform = new form('addserver', $this->uri(array('action' => 'addserver'))); //add rules $cform->addRule('ip', $this->objLanguage->languageText("mod_cache_phrase_ipreq", "cache"), 'required'); $cform->addRule('port', $this->objLanguage->languageText("mod_cache_phrase_portreq", "cache"), 'required'); // $cform->addRule('port', $this->objLanguage->languageText("mod_cache_phrase_portnumreq", "cache") , 'numeric'); //start a fieldset $cfieldset = $this->getObject('fieldset', 'htmlelements'); $cadd = $this->newObject('htmltable', 'htmlelements'); $cadd->cellpadding = 3; //IP textfield $cadd->startRow(); $ciplabel = new label($this->objLanguage->languageText('mod_cache_ip', 'cache') . ':', 'input_ip'); $ip = new textinput('ip'); $ip->extra = ' style="width:50%;" '; if (isset($cache['ip'])) { $ip->setValue(htmlentities($cache['ip'], ENT_QUOTES)); } $cadd->addCell($ciplabel->show());
$this->setLayoutTemplate = NULL; $this->loadClass('form', 'htmlelements'); $this->loadClass('textinput', 'htmlelements'); $this->loadClass('label', 'htmlelements'); $this->loadClass('htmlheading', 'htmlelements'); $this->loadClass('htmlarea', 'htmlelements'); $required = '<span class="warning"> * ' . $this->objLanguage->languageText('word_required', 'system', 'Required') . '</span>'; $headerinv = new htmlheading(); $headerinv->type = 1; $headerinv->str = $this->objLanguage->languageText('phrase_invitemate', 'userregistration') . ' ' . $this->objConfig->getSitename(); $middleColumnContent = NULL; $middleColumnContent .= $headerinv->show(); // start the form $form = new form('invite', $this->uri(array('action' => 'sendinvite'))); // add some rules $form->addRule('friend_firstname', $this->objLanguage->languageText("mod_userregistration_needfriendname", "userregistration"), 'required'); $form->addRule('friend_email', $this->objLanguage->languageText("mod_userregistration_needfriendemail", "userregistration"), 'email'); // form elements // friend name $table = $this->newObject('htmltable', 'htmlelements'); $table->startRow(); $friendname = new textinput('friend_firstname'); $friendnameLabel = new label($this->objLanguage->languageText('friendname', 'userregistration') . ' ', 'input_friendname'); $table->addCell($friendnameLabel->show(), 150, NULL, 'right'); $table->addCell(' ', 5); $table->addCell($friendname->show() . $required); $table->endRow(); // surname $table->startRow(); $friendsurname = new textinput('friend_surname'); $friendsurnameLabel = new label($this->objLanguage->languageText('friendsurname', 'userregistration') . ' ', 'input_friendsurname');
/** * */ function show_form() { $query = 'SELECT a.* FROM abbr_entry a WHERE a.abbr_idx = ' . $this->db->quote($_GET['uid']); $this->entry = $this->db->get_row($query); $is_new = is_array($this->entry) ? 0 : 1; $form = new form('entry_form', null, './' . $this->get_url_param()); $form->setup($this->msg); $form->addElement('text', 'abbr_key', $this->msg['abbr_acr'], array('size' => 20, 'maxlength' => '20')); $form->addElement('text', 'abbr_id', $this->msg['abbr_id'], array('size' => 40, 'maxlength' => '4000')); $form->addElement('text', 'abbr_en', $this->msg['abbr_en'], array('size' => 40, 'maxlength' => '4000')); $form->addElement('text', 'abbr_type', $this->msg['phrase_type'], array('size' => 20, 'maxlength' => '255')); $form->addElement('text', 'lang', $this->msg['lang'], array('size' => 20, 'maxlength' => '255')); $form->addElement('text', 'redirect_to', $this->msg['actual_phrase'], array('size' => 20, 'maxlength' => '255')); $form->addElement('text', 'source', $this->msg['ref_source'], array('size' => 20, 'maxlength' => '255')); $form->addElement('text', 'url', $this->msg['url'], array('size' => 40, 'maxlength' => '255')); $form->addElement('textarea', 'notes', $this->msg['notes'], array('style' => 'width:100%')); $form->addElement('hidden', 'abbr_idx'); $form->addElement('hidden', 'is_new', $is_new); $form->addElement('submit', 'save', $this->msg['save']); $form->addRule('abbr_key', sprintf($this->msg['required_alert'], $this->msg['abbr_key']), 'required', null, 'client'); $form->setDefaults($this->entry); $ret .= sprintf('<h1>%1$s</h1>' . LF, ($is_new ? $this->msg['new'] : $this->msg['edit']) . ' - ' . $this->msg['abbr']); $ret .= $form->toHtml(); return $ret; }