public function __construct($controller, $id) { $settings = \Bh\Lib\Setup::getSettings(); if ($settings['EnableRegistration'] || $controller->getCurrentUser()) { parent::__construct($controller, 'User', $id); } else { $this->form = 'Registration disabled'; } }
$vals['filename'] .= '.html'; } if (!preg_match('/\\.html$/', $vals['helpfile'])) { $vals['helpfile'] .= '.html'; } $vals['body'] = '<h1>' . $vals['title'] . '</h1>' . NEWLINEx2 . $vals['body']; if (!file_overwrite(site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/' . $vals['lang'] . '/' . $vals['filename'], $vals['body'])) { echo '<p>Error: Unable to write to the file. Please verify your file and folder permissions.</p>'; return; } if ($vals['helpfile'] != $vals['filename']) { // erase old file, this is a rename $res = @unlink(site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/' . $vals['lang'] . '/' . $vals['helpfile']); if (!$res) { echo '<p>Error: Unable to remove the old file. Please verify your file and folder permissions.</p>'; return; } } header('Location: ' . site_prefix() . '/index/appdoc-helpdoc-action?appname=' . $vals['appname'] . '&lang=' . $vals['lang']); exit; } } $GLOBALS['_helpdoc'] = new StdClass(); global $cgi, $_helpdoc; loader_import('help.Help'); $_helpdoc->body = @join('', @file('inc/app/' . $cgi->appname . '/docs/' . $cgi->lang . '/' . $cgi->helpfile . '.html')); $_helpdoc->title = help_get_title($_helpdoc->body, $cgi->helpfile); $_helpdoc->body = preg_replace('/<h[1-6][^>]*>([^<]+)<\\/h[1-6]>[\\r\\n]*/i', '', $_helpdoc->body, 1); page_title(intl_get('Editing Help File') . ': ' . $cgi->title); $form = new EditForm(); echo $form->run();
function mainEdit($get) { //function mainEdit($recno, $uuid, $package, $profil, $copy=TRUE) { $recno = isset($get['recno']) && $get['recno'] != '' ? htmlspecialchars($get['recno']) : -1; $uuid = isset($get['uuid']) && $get['uuid'] != '' ? htmlspecialchars($get['uuid']) : ''; if ($recno == -1 && $uuid == '' && isset($get['id'])) { $uuid = $get['id'] != '' ? htmlspecialchars($get['id']) : ''; } $package = isset($get['package']) && $get['package'] != '' ? htmlspecialchars($get['package']) : ''; $profil = isset($get['profil']) && $get['profil'] != '' ? htmlspecialchars($get['profil']) : ''; $copy = isset($get['copy']) && $get['copy'] == FALSE ? FALSE : TRUE; $rs = array(); $rs['akce'] = 'error'; $rs['ok'] = FALSE; $rs['report'] = ''; $rs['data'] = ''; $md_record = new MdRecord(); if ($uuid != '') { if ($copy === FALSE) { $md_record->setTableMode('tmp'); } $record = $md_record->getMd('uuid', $uuid); if ($record['report'] != 'ok') { $rs['report'] = $record['report']; require PHPINC_DIR . '/templates/404_record.php'; return $rs; } if ($record['right'] != 'w') { $rs['report'] = 'Not rights'; require PHPINC_DIR . '/templates/403.php'; return $rs; } $recno = $record['md']['RECNO']; } if ($recno > -1) { $recnoSession = getEditValueFromSession($recno, 'recno', 'recnoTmp'); if ($recnoSession != '' && $recnoSession != -1) { $copy = FALSE; if ($profil == '') { $profil = getEditValueFromSession($recno, 'recno', 'profil'); } if ($package == '') { $package = getEditValueFromSession($recno, 'recno', 'package'); } $recno = $recnoSession; } if ($copy === TRUE) { $pom = $md_record->copyRecordToTmp($recno); $recnoTmp = $pom['recno_tmp']; setEditId2Session('recno', $recno); setEditId2Session('recnoTmp', $recnoTmp); setUrlEdit2Session(); } else { $recnoTmp = $recno; } if ($recnoTmp == -1) { $rs['report'] = $pom['report']; require PHPINC_DIR . '/templates/403.php'; return $rs; } if ($package == '' && $profil == '') { $package = 1; $profil = START_PROFIL; } $md_record->setTableMode('tmp'); //echo $profil; FIXME? $record = $md_record->getMdValues($recnoTmp, $value_lang = 'xxx', $profil, $package); if ($record['report'] != 'ok' || $record['user_right'] != 'w') { Debugger::log('[micka_main_lib.mainEdit] ' . "Recno={$recnoTmp}, " . $record['report'], 'ERROR'); $rs['report'] = $record['report']; require PHPINC_DIR . '/templates/403.php'; return $rs; } $rs['publisher'] = $record['publisher']; $rs['saver'] = $record['saver']; $rs['hierarchy'] = array_key_exists('hierarchy', $record) ? $record['hierarchy'] : ''; $rs['data']['md']['RECNO'] = $recnoTmp; $rs['data']['md']['MD_STANDARD'] = $record['md']['MD_STANDARD']; $rs['data']['md']['LANG'] = $record['md']['LANG']; $rs['data']['md']['TITLE'] = $record['md']['TITLE']; $rs['data']['md']['UUID'] = $record['md']['UUID']; $rs['data']['md']['PXML'] = $record['md']['PXML']; $rs['data']['md']['DATA_TYPE'] = $record['md']['DATA_TYPE']; $rs['data']['md']['VIEW_GROUP'] = $record['md']['VIEW_GROUP']; $rs['data']['md']['EDIT_GROUP'] = $record['md']['EDIT_GROUP']; if ($record['md']['MD_STANDARD'] == 0 || $record['md']['MD_STANDARD'] == 10) { foreach ($record['md_values'] as $value) { if ($value['MD_ID'] == 11 || $value['MD_ID'] == 5063) { if ($value['LANG'] == MICKA_LANG) { $rs['data']['md']['TITLE'] = $value['MD_VALUE']; break; } } } } if (isset($record['template']) && $record['template'] != '') { // micka LITE $rs['data']['md']['PXML'] = $record['md']['PXML']; $rs['akce'] = 'lite'; $rs['template'] = $record['template']; $rs['profil'] = $record['profil']; $rs['ok'] = TRUE; return $rs; } $rs['data']['package'] = $record['md_value_package']; if ($record['md_value_profil'] == -1 && $record['md']['MD_STANDARD'] == 0) { $rs['data']['profil'] = 0; } elseif ($record['md_value_profil'] == -1 && $record['md']['MD_STANDARD'] == 10) { $rs['data']['profil'] = 100; } else { $rs['data']['profil'] = $record['md_value_profil']; } $rs['data']['keywords_uri'] = $md_record->getKeywordsUri($recnoTmp); require PHPPRG_DIR . '/MdEditForm.php'; $form = new EditForm(); $rs['data']['md_values'] = $form->getEditForm($record['md']['MD_STANDARD'], $recnoTmp, $record['md']['LANG'], $record['md_value_profil'], $record['md_value_package'], $record['md_values']); $rs['data']['md_values_end'] = $form->getEditFormEnd(); $rs['akce'] = 'edit'; return $rs; } else { Debugger::log('[micka_main_lib.mainEdit] ' . 'Not complete input!', 'ERROR'); $rs['report'] = 'Not complete input!'; require PHPINC_DIR . '/templates/404_record.php'; return $rs; } }
$form = new EditForm($lang->get("r_editfolder"), "i_folderproperties.gif"); $cond = $form->setPK("categories", "CATEGORY_ID"); $form->add(new TextInput($lang->get("r_foldername"), "categories", "CATEGORY_NAME", $cond, "type:text,width:200,size:32", "MANDATORY")); $form->add(new FolderDropdown($lang->get("r_parent"), "categories", "PARENT_CATEGORY_ID", $cond)); $form->add(new Hidden("pnode", $pnode)); $form->add(new Hidden("action", $lang->get("edit_folder"))); $page->add($form); $handled = true; $forward = doc(); } else if ($action == $lang->get("edit_access") && $auth->checkAccessToFunction("ED_FOLDER_ACL")) { $go = "UPDATE"; $oid = $pnode; $page_action = "UPDATE"; $title = getDBCell("categories", "CATEGORY_NAME", "CATEGORY_ID = " . $pnode); // used by ACLPanel. // Build breadcrumb $aclPanel = new EditForm($lang->get("edit_access")); if ($pnode == "") $pnode = "0"; $str = pathToRootFolder($pnode); $aclPanel->add(new Label("lbl", $str, "informationheader", 2)); $aclPanel->add(new Hidden("action", $lang->get("edit_access"))); $aclid = $pnode; $aclType = "folder"; include $c["path"] . "api/userinterface/panels/acl_panel.inc.php"; $aclPanel->add(new Hidden("pnode", $pnode)); $page->add($aclPanel);
<?php require_once "../../config.inc.php"; $auth = new auth("ANALYSE_RATINGS"); $page_action = "update"; $go = "update"; $page = new Page("Rating Results"); $form = new EditForm($lang->get("rateres", "Rate Results")); $interval = array(); $count = countRows("pgn_rating", "RATINGID", "COMMENT <>''"); $steps = $count / 50; for ($i = 0; $i < $steps; $i++) { $interval[$i][0] = $i * 50 . " - " . (($i + 1) * 50 - 1); $interval[$i][1] = $i; } $form->add(new Label("lbl", $lang->get("display", "Display"), "standard")); $form->add(new Select("display", $interval, "standardlight", value("display"), 1)); $grid = new NXGrid("grid", 3); $grid->setRatio(array(150, 350, 100)); $grid->addRow(array(new Label("lbl", "<b>" . $lang->get("page", "Page") . "</b>"), new Label("lbl", "<b>" . $lang->get("comment", "Comment") . "</b>"), new Label("lbl", "<b>" . $lang->get("date", "Date") . "</b>"))); $thisInterval = value("interval"); $sql = "SELECT SOURCEID, COMMENT, TIMESTAMP FROM pgn_rating WHERE COMMENT <> '' ORDER BY TIMESTAMP DESC"; $query = new query($db, $sql); while ($query->getrow()) { $grid->addRow(array(new Label("lbl", resolvePageToLink($query->field("SOURCEID"))), new Label("lbl", str_replace('\\\\', '\\', $query->field("COMMENT"))), new Label("lbl", formatDBTimestamp($query->field('TIMESTAMP'))))); } $query->free(); $form->add($grid); $page->add($form); $page->draw();
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA **********************************************************************/ $go = "UPDATE"; require_once "../../config.inc.php"; $auth = new auth("PLUGIN_CONTROL"); $page = new page("Install Plugin"); $filter = new Filter("modules", "MODULE_ID"); $filter->addRule($lang->get("name"), "MODULE_NAME", "MODULE_NAME"); $filter->icon = "li_plugin.gif"; $filter->type_name = "Plugins"; $filter->newLabel = $lang->get('install_pgn', 'Install a plugin'); $filtermenu = new Filtermenu($lang->get("pg_title"), $filter); $filtermenu->tipp = $lang->get("help_pgn", "Plug-ins allow you to enhance N/X beyond its standard features. Typically, plug-ins are used to create new objects types in addition to the two standard object types text and image."); //$oid = value("oid", "NUMERIC", ''); if ($pagestate->insert) { $form = new EditForm($lang->get("pg_install"), "i_plugin.gif"); $form->addToTopText($lang->get("pg_installdesc") . "<br><br>"); $form->add(new Label("lbl", $lang->get("pg_choose"), "standard")); $form->add(new Dropdown("filenameselect", getPluginFileList(), "standard")); $form->add(new Hidden("go", "CREATE")); $form->add(new Hidden("action", "install")); } if (!$pagestate->insert || value("action") == "install" || value("action") == "uninstall") { $form = new StdEDForm($lang->get("pgn_info", "Plugin information")); if (value("action") == "install") { $oid = install(); $page_state = "start"; } includePGNSource($oid); $modRef = createPGNRef($oid, 0); if ($modRef->helpfile != "") {
/** * Create a form for smart translation and return the form reference. * */ function createSmartTranslateForm() { global $c, $page_action, $specialID, $page_state; $page_action = 'UPDATE'; if (value('tsaving', '', '') != 'yes') $page_state = ''; $oldvalues = value('oldfields', '', '0'); if ($oldvalues != '0') { $commas2 = $oldvalues; $commas = "'" . str_replace(",", "','", $oldvalues) . "'"; } else { $commas = implode(',', $this->smarttranslator); $commas2 = str_replace("'", '', $commas); } $tform = new EditForm('N/X Smarttranslator', '', 'smarttranslator'); $oid = $c["smarttranslate"]; $items = createDBCArray('internal_resources', 'RESID', "LANGID='".$oid."' AND UPPER(RESID) IN (".$commas.")", 'ORDER BY RESID ASC'); for ($i = 0; $i < count($items); $i++) { $specialID = $items[$i]; $tform->add(new Label("lbl", "<b>Translate: </b>" . getDBCell("internal_resources", "VALUE", "RESID='" . $items[$i] . "' AND LANGID='EN'"), "standardlight", 2)); $tform->add(new TextInput($items[$i], "internal_resources", "VALUE", "RESID='" . $items[$i] . "' AND LANGID='$oid'", "type:textarea,size:2,width:400")); $tform->add(new TextInput("Tooltip".$items[$i], "internal_resources", "TOOLTIP", "RESID='" . $items[$i] . "' AND LANGID='$oid'", "type:textarea,size:2,width:400")); $tform->add(new Spacer(2)); } $tform->add(new Hidden('oldfields', $commas2)); $tform->add(new Hidden('tsaving', 'yes')); return $tform; }
<?php include_once '../../../_includes/framework.php'; require_login(); $id = @$_POST['id']; $id or die("<p>Error, no attendee id.</p>"); $attendee = Attendee::find($id); $attendee or die("<p>No attendee with (ID={$id})"); $return_url = @$_POST['return_url'] ?: "/admin/index.php"; $form = new EditForm($_POST); if ($form->valid()) { $form->save(); # Kind of a bad hack but it works. ?> <script> window.location = "<?php echo $return_url; ?> "; </script> <?php } else { include "../forms/edit-form.php"; }
<?php include_once '../../../_includes/framework.php'; require_login(); if (!isset($form)) { $id = @$_GET['id']; $id or die("<p>Error, no attendee id.</p>"); $form = new EditForm(["id" => $id]); } $badge_types = BadgeType::all(); $reg_levels = RegistrationLevel::all(); $tshirt_sizes = TShirtSize::all(); $payment_types = PaymentType::all(); $vendors = Vendor::all(); $adult_badge = null; if (!empty(@$form->params["adult_badge_number"])) { $adult_badge = Attendee::find_by_badge_number($form->params["adult_badge_number"]); } ?> <input type="hidden" name="id" value="<?php echo $id; ?> "> <div class="text-center <?php if ($form->attendee->canceled) { ?> canceled<?php } ?> ">
<? /********************************************************************** * @module Application **********************************************************************/ require_once "../../config.inc.php"; $auth = new auth("ANY"); $page = new page("User Administration"); $page->setJS("md5"); // get user id from session id. $oid = getDBCell("user_session", "USER_ID", "SESSION_ID='$auth->session'"); // restrict operations to update, do not alow insert $page_action = "UPDATE"; $go = "UPDATE"; $form = new EditForm($lang->get("user_profile"), "i_myprofile.gif"); $form->submitButtonAction = "if (document.form1.users_PASSWORD_1.value != '') document.form1.users_PASSWORD_1.value = document.form1.users_PASSWORD_2.value = hex_md5(document.form1.users_PASSWORD_1.value);"; $cond = "USER_ID = $oid"; $form->add(new TextInput($lang->get("full_name"), "users", "FULL_NAME", $cond, "type:text,width:200,size:32", "MANDATORY")); $form->add(new PasswordInput($lang->get("password"), "users", "PASSWORD", $cond, "type:text,width:200,size:32", "MANDATORY")); $form->add(new TextInput($lang->get("user_email"), "users", "EMAIL", $cond, "type:text,width:200,size:64", "MANDATORY")); $form->add(new SelectOneInput($lang->get("user_bl"), "users", "LANGID", "internal_resources_languages", "NAME", "LANGID", "1", $cond, "type:dropdown", "MANDATORY", "TEXT")); $page->add($form); $page->draw(); $db->close(); ?>
$tempbox->setJSPayload("onClick='toggle(\"templ\");'"); $form->add($tempbox); $show = ' style="display:none;" '; $form->add(new IDWrapper("templ", new TextInput($lang->get("template", "Template"), "cluster_templates", "TEMPLATE", $cond, "type:textarea,width:400,size:20") ,"embedded", $show,2)); $form->add(new Hidden("action", "newobject")); $form->add(new NonDisplayedValueOnInsert("cluster_templates", "CATEGORY_ID", $cond, $pnode, "NUMBER")); $form->add(new NonDisplayedValueOnInsert("cluster_templates", "DELETED", $cond, 0, "NUMBER")); $form->forbidDelete(true); $form->forbidUpdate(true); $page->add($form); // edit the properties of an object. } else if ($action == "objectprop" && $aclf->checkAccessToFunction("ED_CL_TEMP_PROPS")) { $form = new EditForm($lang->get("clt_properties"), "i_scheme.gif"); $cond = $form->setPK("cluster_templates", "CLT_ID"); $form->headerlink = crHeaderLink($lang->get('ed_clt'), "modules/clustertemplate/clustertemplates.php?sid=$sid&oid=".value("oid", "NUMERIC")."&action=editobject"); $oname = new TextInput($lang->get("clt_name"), "cluster_templates", "NAME", $cond, "type:text,width:300,size:32", "MANDATORY&UNIQUE"); $oname->setFilter("CATEGORY_ID = $pnode"); $form->add($oname); $form->add(new SelectOneInput($lang->get("metatemplate"), "cluster_templates", "MT_ID", "meta_templates", "NAME", "MT_ID", "INTERNAL=0 AND VERSION=0", $cond, "type:dropdown,width:300", "MANDATORY")); $form->add(new FolderDropdown($lang->get("r_parent"), "cluster_templates", "CATEGORY_ID", $cond)); $form->add(new TextInput($lang->get("description"), "cluster_templates", "DESCRIPTION", $cond, "type:textarea,width:300,size:3", "")); $tempbox = new CheckboxTxtInput($lang->get("is_compound","Compound Cluster with own Layout" ), "cluster_templates", "CLT_TYPE_ID", $cond, "1", "0"); $tempbox->setJSPayload("onClick='toggle(\"templ\");'"); $form->add($tempbox); $show = ' style="display:block;" '; if (getDBCell("cluster_templates", "CLT_TYPE_ID", $cond) == 0) { $show = ' style="display:none;" ';
public function makeForm($post_data = array()) { $_SESSION['text'] = array(); $_SESSION['pass'] = array(); $_SESSION['radio'] = array(); $_SESSION['checkbox'] = array(); $_SESSION['textarea'] = array(); // echo "<pre>"; // print_r($post_data); $table_name = $post_data['data']['common']['table_name']; if (!empty($post_data['data']['text'])) { $text_data = $this->makeText($post_data['data']['text']); } if (!empty($post_data['data']['pass'])) { $pass_data = $this->makePass($post_data['data']['pass']); } if (!empty($post_data['data']['radio'])) { $radio_data = $this->makeRadio($post_data['data']['radio']); } if (!empty($post_data['data']['checkbox'])) { $check_data = $this->makeCheck($post_data['data']['checkbox']); } if (!empty($post_data['data']['select'])) { $select_data = $this->makeSelect($post_data['data']['select']); } if (!empty($post_data['data']['textarea'])) { $textarea_data = $this->makeTextarea($post_data['data']['textarea']); } // print_r($_SESSION); $insert_query = $this->makeQuery(); foreach ($insert_query as $f => $v) { $fieldNames .= $f . ","; $fieldValues .= "'" . $v . "',"; $post_values .= " {$v} = " . "\$" . "_POST['{$f}'];\n "; } $post_values; $fieldNames = substr($fieldNames, 0, -1) . ",created,modified"; $fieldValues = substr($fieldValues, 0, -1) . ",now(),now()"; $db_connections = "<?php \n\t\t\t\$" . "db_host='';\n\t\t\t\$" . "db_username='';\n\t\t\t\$" . "db_pass='';\n\t\t\t\$" . "db_name='';\n\t\t\tif(isset(\$" . "_POST['submit']) && \$" . "_SERVER['REQUEST_METHOD'] == 'POST'){\n\t\t"; $qry = " \$" . "query = \"INSERT INTO {$table_name} ({$fieldNames}) VALUES ({$fieldValues})\";\n\t\t\t\tmysql_query(\$" . "query); \n\t\t\t\tif(mysql_affected_rows() > '0') {\n\t\t\t\t\techo 'successfully inserted';\n\t\t\t\t} else {\n\t\t\t\t\techo 'Not inserted successfully';\n\t\t\t\t}\n\t\t\t} \n ?>"; $form_start = "<html>\n<body>\n<form name='' action='<?php echo htmlspecialchars(\$" . "_SERVER['PHP_SELF']);?>' method='post'>\n"; $buttons = "\n<input type='submit' value='Submit' name='submit' id='submit'>\n<input type='reset' value='Cancel' name='reset' id='reset'>"; $form_end = "\n</form>\n</body>\n</html>"; $data = $db_connections . $post_values . $qry . "\n" . $form_start . " " . $text_data . "\n " . $pass_data . $radio_data . $check_data . $select_data . $textarea_data . $buttons . $form_end; $dir_path = USER_FLD_PATH . $_SESSION['user_id'] . "/" . DATE . "/"; if (!file_exists($dir_path)) { mkdir($dir_path, 0700, true); } if ($post_data['data']['common']['file_name'] == '') { $filename = date('dmyHis'); } else { $filename = $post_data['data']['common']['file_name']; } $file = $filename . ".php"; $download_file = $dir_path . $file; file_put_contents($download_file, $data); $fileNamesList[$file] = $file; $editForm = new EditForm(); $editFormData = $editForm->makeForm($post_data); $editFile = "edit_" . $filename . ".php"; $edit_download_file = $dir_path . $editFile; file_put_contents($edit_download_file, $editFormData); $fileNamesList[$editFile] = $editFile; // Save created filenames in downloads table. $userId = $_SESSION['user_id']; $created = DATE_TIME; foreach ($fileNamesList as $fileName) { $records .= "('{$userId}','{$fileName}', '{$created}'),"; } $records = substr($records, 0, -1); $user->user_created_files($records); $a['file'] = $file; $a['status'] = 1; return $a; }
$posi = getDBCell("sitemap", "POSITION", "MENU_ID = $mid"); $delhandler->addDBAction("UPDATE sitemap SET POSITION = (POSITION-1) WHERE POSITION > $posi AND PARENT_ID = $mid"); $delhandler->addDBAction("UPDATE sitemap SET DELETED = 1 WHERE MENU_ID = $mid"); } $title = getDBCell("sitemap", "NAME", "MENU_ID = $mid"); $form = new CommitForm($lang->get("sp_delete"). " $title", "i_purge.gif"); $form->addToTopText($lang->get("sp_delmes")); $form->addCheck("deleteobject", $lang->get("sp_delete"), $delhandler); $form->add(new ActionField($lang->get("delete_page"))); $form->add(new Hidden("oid", $oid)); $page->add($form); } } else if (value("pnode", "NUMERIC") == "0" && $oid ==0 && $auth->userName == "Administrator") { $go="UPDATE"; $form = new EditForm($lang->get("node_access", "Set access for site root"), ""); $aclPanel = new Container; $aclid = "1"; $aclType = "page"; $title = $name[0]; include $c["path"] . "api/userinterface/panels/acl_panel.inc.php"; $aclPanel->add(new Hidden("mid", $mid)); $aclPanel->add(new Hidden("oid", $spid)); $aclPanel->add(new Hidden("view", $view)); $aclPanel->add(new Hidden("processing", "yes")); $form->add($aclPanel); $page->add($form); } else if ($action != "0" || value("view") != "0") { if ($action =="") $action = value("acstate"); $page_action = "UPDATE";