function section_list($message = '') { pagetop(gTxt('sections'), $message); global $url_mode, $txpac, $wlink; $out[] = tr(tdcs(strong(gTxt('section_head')) . popHelp('section_category'), 3)); $out[] = tr(tdcs(form(fInput('text', 'name', '', 'edit', '', '', 10) . fInput('submit', '', gTxt('Create'), 'smallerbox') . eInput('section') . sInput('section_create')), 3)); $pageslist = safe_column("name", "txp_page", "1"); $styleslist = safe_column("name", "txp_css", "1"); $rs = safe_rows("*", "txp_section", "name!='' order by name"); if ($rs) { foreach ($rs as $a) { extract($a); if ($name == 'default') { continue; } if ($url_mode) { $wlink = !check_sections($name) ? sp . wLink('section', 'missing_section_file', 'name', $name) : ''; } $deletelink = dLink('section', 'section_delete', 'name', $name, '', 'type', 'section'); $form = startTable('edit') . stackRows(fLabelCell(gTxt('section_name') . ':') . fInputCell('name', $name, 1, 20), fLabelCell(gTxt('uses_page') . ':') . td(selectInput('page', $pageslist, $page) . popHelp('section_uses_page'), '', 'noline'), fLabelCell(gTxt('uses_style') . ':') . td(selectInput('css', $styleslist, $css) . popHelp('section_uses_css'), '', 'noline'), fLabelCell(gTxt('selected_by_default') . '?') . td(yesnoradio('is_default', $is_default) . popHelp('section_is_default'), '', 'noline'), fLabelCell(gTxt('on_front_page') . '?') . td(yesnoradio('on_frontpage', $on_frontpage) . popHelp('section_on_frontpage'), '', 'noline'), fLabelCell(gTxt('syndicate') . '?') . td(yesnoradio('in_rss', $in_rss) . popHelp('section_syndicate'), '', 'noline'), fLabelCell(gTxt('include_in_search') . '?') . td(yesnoradio('searchable', $searchable) . popHelp('section_searchable'), '', 'noline'), tda(fInput('submit', '', gTxt('save_button'), 'smallerbox'), ' colspan="2" style="border:0"')) . endTable() . eInput('section') . sInput('section_save') . hInput('old_name', $name); $form = form($form); $out[] = tr(td($name . $wlink) . td($form) . td($deletelink)); } } echo startTable('list') . join('', $out) . endTable(); }
function sec_section_list($message = '') { pagetop(gTxt('sections'), $message); global $wlink; $pageslist = safe_column("name", "txp_page", "1=1"); $styleslist = safe_column("name", "txp_css", "1=1"); $out[] = tr(tdcs(strong(gTxt('section_head')) . popHelp('section_category'), 3)); $out[] = tr(tdcs(form(fInput('text', 'name', '', 'edit', '', '', 10) . fInput('submit', '', gTxt('Create'), 'smallerbox') . eInput('section') . sInput('section_create')), 3)); $defrow = safe_row("page, css", "txp_section", "name like 'default'"); $out[] = form(tr(td(gTxt('default')) . td(startTable('edit', 'left', '') . tr(fLabelCell(gTxt('uses_page') . ':') . td(selectInput('page', $pageslist, $defrow['page']) . popHelp('section_uses_page'), '', 'noline')) . tr(fLabelCell(gTxt('uses_style') . ':') . td(selectInput('css', $styleslist, $defrow['css']) . popHelp('section_uses_css'), '', 'noline')) . tr(tda(fInput('submit', '', gTxt('save_button'), 'smallerbox'), ' colspan="2" style="border:0"')) . endTable()) . td()) . eInput('section') . sInput('section_save') . hInput('name', 'default')); $rs = safe_rows_start("*", "txp_section", "name!='' order by name"); if ($rs) { while ($a = nextRow($rs)) { extract($a); if ($name == 'default') { continue; } $deletelink = dLink('section', 'section_delete', 'name', $name, '', 'type', 'section'); $form = startTable('edit') . stackRows(fLabelCell(gTxt('section_name') . ':') . fInputCell('name', $name, 1, 20), fLabelCell(gTxt('section_longtitle') . ':') . fInputCell('title', $title, 1, 20), fLabelCell(gTxt('uses_page') . ':') . td(selectInput('page', $pageslist, $page) . popHelp('section_uses_page'), '', 'noline'), fLabelCell(gTxt('uses_style') . ':') . td(selectInput('css', $styleslist, $css) . popHelp('section_uses_css'), '', 'noline'), fLabelCell(gTxt('selected_by_default') . '?') . td(yesnoradio('is_default', $is_default) . popHelp('section_is_default'), '', 'noline'), fLabelCell(gTxt('on_front_page') . '?') . td(yesnoradio('on_frontpage', $on_frontpage) . popHelp('section_on_frontpage'), '', 'noline'), fLabelCell(gTxt('syndicate') . '?') . td(yesnoradio('in_rss', $in_rss) . popHelp('section_syndicate'), '', 'noline'), fLabelCell(gTxt('include_in_search') . '?') . td(yesnoradio('searchable', $searchable) . popHelp('section_searchable'), '', 'noline'), tda(fInput('submit', '', gTxt('save_button'), 'smallerbox'), ' colspan="2" style="border:0"')) . endTable() . eInput('section') . sInput('section_save') . hInput('old_name', $name); $form = form($form); $out[] = tr(td($name) . td($form) . td($deletelink)); } } echo startTable('list') . join('', $out) . endTable(); }
function doLoginForm($message) { global $txpcfg; include $txpcfg['txpath'] . '/lib/txplib_head.php'; pagetop('log in'); echo form(startTable('edit') . tr(td() . td(graf($message))) . tr(fLabelCell('name') . fInputCell('p_userid')) . tr(fLabelCell('password') . td(fInput('password', 'p_password', '', 'edit'))) . tr(td() . td(graf(checkbox('stay', 1, 1) . gTxt('stay_logged_in') . popHelp('remember_login')))) . tr(fLabelCell('') . td(fInput('submit', '', gTxt('log_in_button'), 'publish'))) . endTable()); exit("</div></body></html>"); }
function doLoginForm($message) { global $txpcfg; include txpath . '/lib/txplib_head.php'; pagetop(gTxt('login')); $stay = !(cs('txp_nostay') == 1); echo form(startTable('edit') . n . n . tr(n . td() . td(graf($message))) . n . n . tr(n . fLabelCell('name', '', 'name') . n . fInputCell('p_userid', '', 1, '', '', 'name')) . n . n . tr(n . fLabelCell('password', '', 'password') . n . td(fInput('password', 'p_password', '', 'edit', '', '', '', 2, 'password'))) . n . n . tr(n . td() . td(graf(checkbox('stay', 1, $stay, 3, 'stay') . '<label for="stay">' . gTxt('stay_logged_in') . '</label>' . sp . popHelp('remember_login')))) . n . n . tr(n . td() . td(fInput('submit', '', gTxt('log_in_button'), 'publish', '', '', '', 4))) . endTable() . (gps('event') ? eInput(gps('event')) : '')) . n . '</div>' . n . n . '</body>' . n . '</html>'; exit(0); }
function doLoginForm($message) { global $txpcfg; include txpath . '/lib/txplib_head.php'; pagetop(gTxt('login')); $stay = (cs('txp_login') and !gps('logout') ? 1 : 0); $reset = gps('reset'); list($name) = split(',', cs('txp_login')); echo form(startTable('edit') . n . n . tr(n . td() . td(graf($message))) . n . n . tr(n . fLabelCell('name', '', 'name') . n . fInputCell('p_userid', $name, 1, '', '', 'name')) . ($reset ? '' : n . n . tr(n . fLabelCell('password', '', 'password') . n . td(fInput('password', 'p_password', '', 'edit', '', '', '', 2, 'password')))) . ($reset ? '' : n . n . tr(n . td() . td(graf(checkbox('stay', 1, $stay, 3, 'stay') . '<label for="stay">' . gTxt('stay_logged_in') . '</label>' . sp . popHelp('remember_login'))))) . n . n . tr(n . td() . td(($reset ? hInput('p_reset', 1) : '') . fInput('submit', '', gTxt($reset ? 'password_reset_button' : 'log_in_button'), 'publish', '', '', '', 4) . ($reset ? '' : graf('<a href="?reset=1">' . gTxt('password_forgotten') . '</a>')))) . endTable() . (gps('event') ? eInput(gps('event')) : '')) . n . '</body>' . n . '</html>'; exit(0); }
function discuss_edit() { $discussid = gps('discussid'); extract(safe_row("*", "txp_discuss", "discussid='{$discussid}'")); $ta = '<textarea name="message" cols="60" rows="15">' . htmlspecialchars($message) . '</textarea>'; if (fetch('ip', 'txp_discuss_ipban', 'ip', $ip)) { $banstep = 'ipban_unban'; $bantext = gTxt('unban'); } else { $banstep = 'ipban_add'; $bantext = gTxt('ban'); } $banlink = '[<a href="?event=discuss' . a . 'step=' . $banstep . a . 'ip=' . $ip . a . 'name=' . urlencode($name) . a . 'discussid=' . $discussid . '">' . $bantext . '</a>]'; pagetop(gTxt('edit_comment')); echo form(startTable('edit') . stackRows(fLabelCell('name') . fInputCell('name', $name), fLabelCell('email') . fInputCell('email', $email), fLabelCell('website') . fInputCell('web', $web), td() . td($ta), fLabelCell('visible') . td(checkbox('visible', 1, $visible)), fLabelCell('IP') . td($ip . sp . $banlink), td() . td(fInput('submit', 'step', gTxt('save'), 'publish')), hInput("discussid", $discussid) . hInput('ip', $ip) . eInput('discuss') . sInput('discuss_save')) . endTable()); }
function sec_section_list($message = '') { global $wlink; pagetop(gTxt('sections'), $message); $default = safe_row('page, css', 'txp_section', "name = 'default'"); $pages = safe_column('name', 'txp_page', "1 = 1"); $styles = safe_column('name', 'txp_css', "1 = 1"); echo n . n . startTable('list') . n . n . tr(tda(n . n . hed(gTxt('section_head') . sp . popHelp('section_category'), 1) . n . n . form(fInput('text', 'name', '', 'edit', '', '', 10) . fInput('submit', '', gTxt('create'), 'smallerbox') . eInput('section') . sInput('section_create')), ' colspan="3"')) . n . n . tr(td(gTxt('default')) . td(form('<table>' . tr(fLabelCell(gTxt('uses_page') . ':') . td(selectInput('page', $pages, $default['page']) . sp . popHelp('section_uses_page'), '', 'noline')) . tr(fLabelCell(gTxt('uses_style') . ':') . td(selectInput('css', $styles, $default['css']) . sp . popHelp('section_uses_css'), '', 'noline')) . tr(tda(fInput('submit', '', gTxt('save_button'), 'smallerbox') . eInput('section') . sInput('section_save') . hInput('name', 'default'), ' colspan="2" class="noline"')) . endTable())) . td()); $rs = safe_rows_start('*', 'txp_section', "name != 'default' order by name"); if ($rs) { while ($a = nextRow($rs)) { extract($a); echo n . n . tr(n . td($name) . n . td(form('<table>' . n . n . tr(fLabelCell(gTxt('section_name') . ':') . fInputCell('name', $name, 1, 20)) . n . n . tr(fLabelCell(gTxt('section_longtitle') . ':') . fInputCell('title', $title, 1, 20)) . n . n . tr(fLabelCell(gTxt('uses_page') . ':') . td(selectInput('page', $pages, $page) . sp . popHelp('section_uses_page'), '', 'noline')) . n . n . tr(fLabelCell(gTxt('uses_style') . ':') . td(selectInput('css', $styles, $css) . sp . popHelp('section_uses_css'), '', 'noline')) . n . n . tr(fLabelCell(gTxt('selected_by_default')) . td(yesnoradio('is_default', $is_default, '', $name) . sp . popHelp('section_is_default'), '', 'noline')) . n . n . tr(fLabelCell(gTxt('on_front_page')) . td(yesnoradio('on_frontpage', $on_frontpage, '', $name) . sp . popHelp('section_on_frontpage'), '', 'noline')) . n . n . tr(fLabelCell(gTxt('syndicate')) . td(yesnoradio('in_rss', $in_rss, '', $name) . sp . popHelp('section_syndicate'), '', 'noline')) . n . n . tr(fLabelCell(gTxt('include_in_search')) . td(yesnoradio('searchable', $searchable, '', $name) . sp . popHelp('section_searchable'), '', 'noline')) . n . n . tr(tda(fInput('submit', '', gTxt('save_button'), 'smallerbox') . eInput('section') . sInput('section_save') . hInput('old_name', $name), ' colspan="2" class="noline"')) . endTable(), '', '', 'post', '', 'section-' . $name)) . td(dLink('section', 'section_delete', 'name', $name, '', 'type', 'section')), " id=\"section-{$name}\""); } } echo n . n . endTable(); }
function sec_section_list($message = '') { global $wlink; pagetop(gTxt('sections'), $message); $default = safe_row('page, css', 'txp_section', "name = 'default'"); $home = safe_row('page, css', 'txp_section', "name = 'home'"); $pages = safe_column('name', 'txp_page', "1 = 1"); $styles = safe_column('name', 'txp_css', "1 = 1"); echo n . n . startTable('list') . n . n . tr(tda(n . n . hed(gTxt('section_head') . sp . popHelp('section_category'), 1) . n . n . form(fInput('text', 'name', '', 'edit', '', '', 10) . fInput('submit', '', gTxt('create'), 'smallerbox') . eInput('section') . sInput('section_create')), ' colspan="3"')) . n . n . tr(tda(gTxt('home'), ' onclick="toggleDisplay(\'section_home\'); return false;"') . td(form('<table id="section_home">' . tr(fLabelCell(gTxt('uses_page') . ':') . td(selectInput('page', $pages, $home['page']) . sp . popHelp('section_uses_page'), '', 'noline')) . tr(fLabelCell(gTxt('uses_style') . ':') . td(selectInput('css', $styles, $home['css']) . sp . popHelp('section_uses_css'), '', 'noline')) . pluggable_ui('section_ui', 'extend_detail_form', '', $home) . tr(tda(fInput('submit', '', gTxt('save_button'), 'smallerbox') . eInput('section') . sInput('section_save') . hInput('name', 'home'), ' colspan="2" class="noline"')) . endTable())) . td()) . n . n . tr(tda(gTxt('default'), ' onclick="toggleDisplay(\'section_default\'); return false;"') . td(form('<table id="section_default">' . tr(fLabelCell(gTxt('uses_page') . ':') . td(selectInput('page', $pages, $default['page']) . sp . popHelp('section_uses_page'), '', 'noline')) . tr(fLabelCell(gTxt('uses_style') . ':') . td(selectInput('css', $styles, $default['css']) . sp . popHelp('section_uses_css'), '', 'noline')) . pluggable_ui('section_ui', 'extend_detail_form', '', $default) . tr(tda(fInput('submit', '', gTxt('save_button'), 'smallerbox') . eInput('section') . sInput('section_save') . hInput('name', 'default'), ' colspan="2" class="noline"')) . endTable())) . td()); $rs = safe_rows_start('*', 'txp_section', "name != 'default' AND name != 'home' order by name"); if ($rs) { while ($a = nextRow($rs)) { extract($a); echo n . n . tr(n . tda($name, ' onclick="toggleDisplay(\'section_' . $name . '\'); return false;"') . n . td(form('<table id="section_' . $name . '">' . n . n . tr(fLabelCell(gTxt('section_name') . ':') . fInputCell('name', $name, 1, 20)) . n . n . tr(fLabelCell(gTxt('section_longtitle') . ':') . fInputCell('title', $title, 1, 20)) . n . n . tr(fLabelCell(gTxt('uses_page') . ':') . td(selectInput('page', $pages, $page) . sp . popHelp('section_uses_page'), '', 'noline')) . n . n . tr(fLabelCell(gTxt('uses_style') . ':') . td(selectInput('css', $styles, $css) . sp . popHelp('section_uses_css'), '', 'noline')) . n . n . tr(fLabelCell(gTxt('selected_by_default')) . td(yesnoradio('is_default', $is_default, '', $name) . sp . popHelp('section_is_default'), '', 'noline')) . n . n . tr(fLabelCell(gTxt('on_front_page')) . td(yesnoradio('on_frontpage', $on_frontpage, '', $name) . sp . popHelp('section_on_frontpage'), '', 'noline')) . n . n . tr(fLabelCell(gTxt('syndicate')) . td(yesnoradio('in_rss', $in_rss, '', $name) . sp . popHelp('section_syndicate'), '', 'noline')) . n . n . tr(fLabelCell(gTxt('include_in_search')) . td(yesnoradio('searchable', $searchable, '', $name) . sp . popHelp('section_searchable'), '', 'noline')) . n . n . tr(fLabelCell(gTxt('section_descr') . ':') . fTextCell('descr', $descr, 1, 4, 20)) . n . n . tr(fLabelCell(gTxt('section_metakey') . ':') . fInputCell('metakey', $metakey, 1, 20)) . n . n . tr(fLabelCell(gTxt('section_metadesc') . ':') . fTextCell('metadesc', $metadesc, 1, 4, 20)) . pluggable_ui('section_ui', 'extend_detail_form', '', $a) . n . n . tr(tda(fInput('submit', '', gTxt('save_button'), 'smallerbox') . eInput('section') . sInput('section_save') . hInput('old_name', $name), ' colspan="2" class="noline"')) . endTable(), '', '', 'post', '', 'section-' . $name)) . td(dLink('section', 'section_delete', 'name', $name, '', 'type', 'section')), " id=\"section-{$name}\" class=\"jsection\" "); } } echo n . n . endTable(); }
function sec_section_list($message = '') { global $wlink, $event; pagetop(gTxt('sections'), $message); $default = safe_row('page, css', 'txp_section', "name = 'default'"); $pages = safe_column('name', 'txp_page', "1 = 1"); $styles = safe_column('name', 'txp_css', "1 = 1"); echo n . '<div id="' . $event . '_container" class="txp-container txp-list">'; echo n . n . startTable('list') . n . n . tr(tda(n . n . hed(gTxt('section_head') . sp . popHelp('section_category'), 2) . n . '<div id="' . $event . '_control" class="txp-control-panel">' . n . n . form(fInput('text', 'name', '', 'edit', '', '', 10) . fInput('submit', '', gTxt('create'), 'smallerbox') . eInput('section') . sInput('section_create'), '', '', 'post', 'edit-form', '', 'section_create') . n . '</div>', ' colspan="3"')) . n . n . tr(td(gTxt('default'), '', 'label') . td(form('<table>' . tr(fLabelCell(gTxt('uses_page') . ':') . td(selectInput('page', $pages, $default['page']) . sp . popHelp('section_uses_page'), '', 'noline'), ' class="uses-page"') . tr(fLabelCell(gTxt('uses_style') . ':') . td(selectInput('css', $styles, $default['css']) . sp . popHelp('section_uses_css'), '', 'noline'), ' class="uses-style"') . pluggable_ui('section_ui', 'extend_detail_form', '', $default) . tr(tda(fInput('submit', '', gTxt('save_button'), 'smallerbox') . eInput('section') . sInput('section_save') . hInput('name', 'default'), ' colspan="2" class="noline"')) . endTable())) . td(), ' class="section default"'); $rs = safe_rows_start('*', 'txp_section', "name != 'default' order by name"); if ($rs) { $ctr = 1; while ($a = nextRow($rs)) { extract($a); echo n . n . tr(n . td($name, '', 'label') . n . td(form('<table>' . n . n . tr(fLabelCell(gTxt('section_name') . ':') . fInputCell('name', $name, 1, 20), ' class="name"') . n . n . tr(fLabelCell(gTxt('section_longtitle') . ':') . fInputCell('title', $title, 1, 20), ' class="title"') . n . n . tr(fLabelCell(gTxt('uses_page') . ':') . td(selectInput('page', $pages, $page) . sp . popHelp('section_uses_page'), '', 'noline'), ' class="uses-page"') . n . n . tr(fLabelCell(gTxt('uses_style') . ':') . td(selectInput('css', $styles, $css) . sp . popHelp('section_uses_css'), '', 'noline'), ' class="uses-style"') . n . n . tr(fLabelCell(gTxt('selected_by_default')) . td(yesnoradio('is_default', $is_default, '', $name) . sp . popHelp('section_is_default'), '', 'noline'), ' class="option is-default"') . n . n . tr(fLabelCell(gTxt('on_front_page')) . td(yesnoradio('on_frontpage', $on_frontpage, '', $name) . sp . popHelp('section_on_frontpage'), '', 'noline'), ' class="option on-frontpage"') . n . n . tr(fLabelCell(gTxt('syndicate')) . td(yesnoradio('in_rss', $in_rss, '', $name) . sp . popHelp('section_syndicate'), '', 'noline'), ' class="option in-rss"') . n . n . tr(fLabelCell(gTxt('include_in_search')) . td(yesnoradio('searchable', $searchable, '', $name) . sp . popHelp('section_searchable'), '', 'noline'), ' class="option is-searchable"') . pluggable_ui('section_ui', 'extend_detail_form', '', $a) . n . n . tr(tda(fInput('submit', '', gTxt('save_button'), 'smallerbox') . eInput('section') . sInput('section_save') . hInput('old_name', $name), ' colspan="2" class="noline"')) . endTable(), '', '', 'post', '', 'section-' . $name), '', 'main') . td(dLink('section', 'section_delete', 'name', $name, '', 'type', 'section'), '', 'actions'), ' id="section-' . $name . '" class="section ' . ($ctr % 2 == 0 ? 'even' : 'odd') . '"'); $ctr++; } } echo n . n . endTable() . '</div>'; }
function link_edit($message = "") { global $vars, $step; extract(gpsa($vars)); pagetop(gTxt('edit_links', $message)); $id = gps('id'); if ($id && $step == 'link_edit') { extract(safe_row("*", "txp_link", "id = {$id}")); } if ($step == 'link_save' or $step == 'link_post') { foreach ($vars as $var) { ${$var} = ''; } } $textarea = '<textarea name="description" cols="40" rows="7" tabindex="4">' . $description . '</textarea>'; $selects = linkcategory_popup($category); $editlink = ' [' . eLink('category', 'list', '', '', gTxt('edit')) . ']'; $out = startTable('edit') . tr(fLabelCell('title') . fInputCell('linkname', $linkname, 1, 30)) . tr(fLabelCell('sort_value') . fInputCell('linksort', $linksort, 2, 15)) . tr(fLabelCell('url', 'link_url') . fInputCell('url', $url, 3, 30)) . tr(fLabelCell('link_category', 'link_category') . td($selects . $editlink)) . tr(fLabelCell('description', 'link_description') . tda($textarea, ' valign="top"')) . tr(td() . td(fInput("submit", '', gTxt('save'), "publish"))) . endTable() . eInput('link') . sInput($step == 'link_edit' ? 'link_save' : 'link_post') . hInput('id', $id); echo form($out); echo link_list(); }
function link_edit($message = '') { global $vars, $event, $step, $txp_user; pagetop(gTxt('edit_links'), $message); echo '<div id="' . $event . '_container" class="txp-container">'; extract(gpsa($vars)); $rs = array(); if ($id && $step == 'link_edit') { $id = assert_int($id); $rs = safe_row('*', 'txp_link', "id = {$id}"); if ($rs) { extract($rs); if (!has_privs('link.edit') && !($author == $txp_user && has_privs('link.edit.own'))) { link_list(gTxt('restricted_area')); return; } } } if ($step == 'link_save' or $step == 'link_post') { foreach ($vars as $var) { ${$var} = ''; } } if (has_privs('link.edit') || has_privs('link.edit.own')) { echo '<div class="txp-edit">' . form(startTable('edit', '', 'edit-pane') . tr(fLabelCell('title', '', 'link-title') . fInputCell('linkname', $linkname, 1, 30, '', 'link-title'), ' class="name"') . tr(fLabelCell('sort_value', '', 'link-sort') . fInputCell('linksort', $linksort, 2, 15, '', 'link-sort'), ' class="sort"') . tr(fLabelCell('url', 'link_url', 'link-url') . fInputCell('url', $url, 3, 30, '', 'link-url'), ' class="url"') . tr(fLabelCell('link_category', 'link_category', 'link-category') . td(linkcategory_popup($category) . ' [' . eLink('category', 'list', '', '', gTxt('edit')) . ']'), ' class="category"') . tr(tda('<label for="link-description">' . gTxt('description') . '</label>' . sp . popHelp('link_description'), ' style="text-align: right; vertical-align: top;"') . td('<textarea id="link-description" name="description" cols="40" rows="7" tabindex="4">' . htmlspecialchars($description) . '</textarea>'), ' class="description text"') . pluggable_ui('link_ui', 'extend_detail_form', '', $rs) . tr(td() . td(fInput('submit', '', gTxt('save'), 'publish'))) . endTable() . eInput('link') . ($id ? sInput('link_save') . hInput('id', $id) : sInput('link_post')) . hInput('search_method', gps('search_method')) . hInput('crit', gps('crit')), 'margin-bottom: 25px;', '', 'post', 'edit-form', '', 'link_details') . '</div>'; } link_list(); echo '</div>'; }
function cat_event_category_edit($evname) { pagetop(gTxt('categories')); $id = assert_int(gps('id')); $parent = doSlash(gps('parent')); $row = safe_row("*", "txp_category", "id={$id}"); if ($row) { extract($row); $out = stackRows(fLabelCell($evname . '_category_name') . fInputCell('name', $name, 1, 20), fLabelCell('parent') . td(cat_parent_pop($parent, $evname, $id)), fLabelCell($evname . '_category_title') . fInputCell('title', $title, 1, 30), pluggable_ui('category_ui', 'extend_detail_form', '', $row), hInput('id', $id), tdcs(fInput('submit', '', gTxt('save_button'), 'smallerbox'), 2)); } $out .= eInput('category') . sInput('cat_' . $evname . '_save') . hInput('old_name', $name); echo '<div id="category_container" class="txp-container txp-edit">' . form(startTable('edit', '', 'edit-pane') . $out . endTable(), '', '', 'post', 'edit-form') . '</div>'; }
function getTxpLogin() { $carry = isPost('carry'); extract(postDecode($carry)); $GLOBALS['textarray'] = setup_load_lang($lang); echo '<form action="setup.php" method="post">', startTable('edit'), tr(tda(graf(gTxt('thanks')) . graf(gTxt('about_to_create')), ' width="400" colspan="2" align="center"')), tr(fLabelCell(gTxt('your_full_name')) . fInputCell('RealName')), tr(fLabelCell(gTxt('setup_login')) . fInputCell('name')), tr(fLabelCell(gTxt('choose_password')) . fInputCell('pass')), tr(fLabelCell(gTxt('your_email')) . fInputCell('email')), tr(td() . td(fInput('submit', 'Submit', gTxt('next'), 'publish'))), endTable(), sInput('createTxp'), hInput('carry', $carry), '</form>'; }
function edit_view() { $id = assert_int(gps('id')); $type = ps('type'); $row = safe_row('*', 'txp_category', "id = {$id}"); if ($row) { extract($row); echo form(n . startTable('edit') . stackRows(n . tdcs(n . hed(gTxt($type . '_category'), 1), 2), fLabelCell('name') . fInputCell('name', $name, 1, 20), fLabelCell('parent') . n . td($this->cat_parent_pop('parent', $type, $id, $parent)), fLabelCell('title') . fInputCell('title', $title, 1, 30), n . tdcs(fInput('submit', '', gTxt('save_button'), 'smallerbox'), 2)) . endTable() . n . eInput('category') . n . sInput('edit') . n . hInput('id', $id) . n . hInput('old_name', $name) . n . hInput('type', $type)); } }
function author_form() { global $step, $txp_user; $vars = array('user_id', 'name', 'RealName', 'email', 'privs'); extract(gpsa($vars)); if ($user_id && $step == 'author_edit') { $user_id = assert_int($user_id); extract(safe_row('*', 'txp_users', "user_id = {$user_id}")); } if ($step == 'author_save' or $step == 'author_save_new') { foreach ($vars as $var) { ${$var} = ''; } } $caption = gTxt($step == 'author_edit' ? 'edit_author' : 'add_new_author'); return form(hed($caption, 3, ' style="text-align: center;"') . startTable('edit') . tr(fLabelCell('login_name') . ($user_id && $step == 'author_edit' ? td(strong($name)) : fInputCell('name', $name))) . tr(fLabelCell('real_name') . fInputCell('RealName', $RealName)) . tr(fLabelCell('email') . fInputCell('email', $email)) . tr(fLabelCell('privileges') . td(($txp_user != $name ? privs($privs) : hInput('privs', $privs) . strong(get_priv_level($privs))) . sp . popHelp('about_privileges'))) . tr(td() . td(fInput('submit', '', gTxt('save'), 'publish') . ($user_id ? '' : sp . popHelp('add_new_author')))) . endTable() . eInput('admin') . ($user_id ? hInput('user_id', $user_id) . sInput('author_save') : sInput('author_save_new'))); }
function new_author_form() { $out = array(hed(gTxt('add_new_author'), 3, ' align="center"'), startTable('edit'), tr(fLabelCell('real_name') . fInputCell('RealName')), tr(fLabelCell('login_name') . fInputCell('name')), tr(fLabelCell('email') . fInputCell('email')), tr(fLabelCell('privileges') . td(privs() . popHelp('about_privileges'))), tr(td() . td(fInput('submit', '', gTxt('save'), 'publish') . popHelp('add_new_author'))), endTable(), eInput('admin') . sInput('author_save_new')); return form(join('', $out)); }
function new_author_form() { return form(hed(gTxt('add_new_author'), 3, ' style="margin-top: 2em; text-align: center;"') . graf(gTxt('a_message_will_be_sent_with_login'), ' style="text-align: center;"') . startTable('edit') . tr(fLabelCell('real_name') . fInputCell('RealName')) . tr(fLabelCell('login_name') . fInputCell('name')) . tr(fLabelCell('email') . fInputCell('email')) . tr(fLabelCell('privileges') . td(privs() . sp . popHelp('about_privileges'))) . tr(td() . td(fInput('submit', '', gTxt('save'), 'publish') . sp . popHelp('add_new_author'))) . endTable() . eInput('admin') . sInput('author_save_new')); }
function thumb_ui($id, $rs) { global $prefs, $sort, $dir, $page, $search_method, $crit; extract($prefs); return tr(td(pluggable_ui('image_ui', 'thumbnail_create', form(graf(gTxt('create_thumbnail'), ' class="label"') . startTable('thumbnail_alter', 'left', '', 1) . tr(fLabelCell(gTxt('thumb_width'), '', 'width') . fInputCell('width', @$thumb_w, 1, 4, '', 'width') . fLabelCell(gTxt('thumb_height'), '', 'height') . fInputCell('height', @$thumb_h, 1, 4, '', 'height') . fLabelCell(gTxt('keep_square_pixels'), '', 'crop') . tda(checkbox('crop', 1, @$thumb_crop, '', 'crop'), ' class="noline"') . tda(fInput('submit', '', gTxt('Create'), 'smallerbox'), ' class="noline"'), ' class="thumbnail-alter-controls"') . n . hInput('id', $id) . n . eInput('image') . n . sInput('thumbnail_create') . n . hInput('sort', $sort) . n . hInput('dir', $dir) . n . hInput('page', $page) . n . hInput('search_method', $search_method) . n . hInput('crit', $crit) . endTable(), '', '', 'post', 'edit-form', '', 'thumbnail_alter_form'), $rs)), ' class="thumbnail-alter"'); }
function image_edit() { pagetop(gTxt('categories')); $name = gps('name'); extract(safe_row("*", "txp_category", "name='{$name}' and type='image'")); $out = tr(fLabelCell(gTxt('image_category_name') . ':') . fInputCell('name', $name, 1, 20)) . tr(fLabelCell('parent') . td(parent_pop($parent, 'image'))) . tr(tdcs(fInput('submit', '', gTxt('save_button'), 'smallerbox'), 2)); $out .= eInput('category') . sInput('image_save') . hInput('old_name', $name); echo form(startTable('edit') . $out . endTable()); }
/** * Render single preference row * @param array $pref preference array * @return string <tr> containing the preference */ private function render_pref($id, $pref) { $value = $this->get_pref($id); $id = $this->prefix($id); // render label $out = fLabelCell(gTxt($pref['label']), '', $id); // render field switch ($pref['type']) { case 2: $out .= td(selectInput($id, array(gTxt('None') => '', 'EXIF' => 'exif', 'IPTC' => 'iptc'), $value)); break; case 1: $out .= td(yesnoRadio($id, $value)); break; default: $out .= fInputCell($id, $value, '', 20, '', $id); break; } // render help $out .= td(gTxt($pref['descr'])); // render save return tr($out); }
function cat_event_category_edit($evname) { pagetop(gTxt('categories')); $id = assert_int(gps('id')); $parent = doSlash(gps('parent')); $row = safe_row("*", "txp_category", "id={$id}"); if ($row) { extract($row); $out = stackRows(fLabelCell($evname . '_category_name') . fInputCell('name', $name, 1, 20), fLabelCell('parent') . td(cat_parent_pop($parent, $evname, $id)), fLabelCell($evname . '_category_title') . fInputCell('title', $title, 1, 30), hInput('id', $id), tdcs(fInput('submit', '', gTxt('save_button'), 'smallerbox'), 2)); } $out .= eInput('category') . sInput('cat_' . $evname . '_save') . hInput('old_name', $name); echo form(startTable('edit') . $out . endTable()); }
function section_detail_partial($thesection) { static $pages, $styles; if (empty($pages)) { $pages = safe_column('name', 'txp_page', "1 = 1"); $styles = safe_column('name', 'txp_css', "1 = 1"); } extract($thesection); $default_section = $name == 'default'; $out = '<table>' . ($default_section ? '' : n . n . tr(fLabelCell(gTxt('section_name') . ':') . fInputCell('name', $name, 1, 20), ' class="name"')) . ($default_section ? '' : n . n . tr(fLabelCell(gTxt('section_longtitle') . ':') . fInputCell('title', $title, 1, 20), ' class="title"')) . n . n . tr(fLabelCell(gTxt('uses_page') . ':') . td(selectInput('page', $pages, $page) . sp . popHelp('section_uses_page'), '', 'noline'), ' class="uses-page"') . n . n . tr(fLabelCell(gTxt('uses_style') . ':') . td(selectInput('css', $styles, $css) . sp . popHelp('section_uses_css'), '', 'noline'), ' class="uses-style"') . ($default_section ? '' : n . n . tr(fLabelCell(gTxt('selected_by_default')) . td(yesnoradio('is_default', $is_default, '', $name) . sp . popHelp('section_is_default'), '', 'noline'), ' class="option is-default"')) . ($default_section ? '' : n . n . tr(fLabelCell(gTxt('on_front_page')) . td(yesnoradio('on_frontpage', $on_frontpage, '', $name) . sp . popHelp('section_on_frontpage'), '', 'noline'), ' class="option on-frontpage"')) . ($default_section ? '' : n . n . tr(fLabelCell(gTxt('syndicate')) . td(yesnoradio('in_rss', $in_rss, '', $name) . sp . popHelp('section_syndicate'), '', 'noline'), ' class="option in-rss"')) . ($default_section ? '' : n . n . tr(fLabelCell(gTxt('include_in_search')) . td(yesnoradio('searchable', $searchable, '', $name) . sp . popHelp('section_searchable'), '', 'noline'), ' class="option is-searchable"')) . pluggable_ui('section_ui', 'extend_detail_form', '', $thesection) . n . n . tr(tda(fInput('submit', '', gTxt('save_button'), 'smallerbox') . eInput('section') . sInput('section_save') . ($default_section ? hInput('name', $name) : hInput('old_name', $name)), ' colspan="2" class="noline"')) . endTable(); // TODO: AJAX form submission // return form($out,'', 'postForm(this);', 'post', 'async', 'section-'.$name, 'section-form-'.$name); return form($out, '', '', 'post', '', 'section-' . $name, 'section-form-' . $name); }
function discuss_edit() { $discussid = gps('discussid'); extract(safe_row("*", "txp_discuss", "discussid='{$discussid}'")); $ta = '<textarea name="message" cols="60" rows="15">' . preg_replace(array('/</', '/>/'), array('<', '>'), $message) . '</textarea>'; if (fetch('ip', 'txp_discuss_ipban', 'ip', $ip)) { $banstep = 'ipban_unban'; $bantext = gTxt('unban'); } else { $banstep = 'ipban_add'; $bantext = gTxt('ban'); } $banlink = '[<a href="?event=discuss' . a . 'step=' . $banstep . a . 'ip=' . $ip . a . 'name=' . urlencode($name) . a . 'discussid=' . $discussid . '">' . $bantext . '</a>]'; pagetop(gTxt('edit_comment')); echo form(startTable('edit') . stackRows(fLabelCell('name') . fInputCell('name', $name), fLabelCell('email') . fInputCell('email', $email), fLabelCell('website') . fInputCell('web', $web), td() . td($ta), fLabelCell('visible') . td(selectInput('visible', array(VISIBLE => gTxt('visible'), SPAM => gTxt('spam'), MODERATE => gTxt('unmoderated')), $visible, false)), fLabelCell('IP') . td($ip . sp . $banlink), td() . td(fInput('submit', 'step', gTxt('save'), 'publish')), hInput("discussid", $discussid) . hInput('ip', $ip) . hInput('parentid', $parentid) . eInput('discuss') . sInput('discuss_save')) . endTable()); }
function getTxpLogin() { $carry = $this->postDecode(ps('carry')); $this->vars =& $carry; extract($carry); $GLOBALS['textarray'] = $this->_load_lang(); @(include txpath . '/config.php'); # next fragment is duplicated on previous method: refactoring! if (!isset($txpcfg) || $txpcfg['db'] != $carry['ddb'] || $txpcfg['txpath'] != $carry['txpath']) { $this->_step_view = graf(strong(gTxt('before_you_proceed')) . ', ' . gTxt('create_config', array('{txpath}' => txpath))) . '<textarea name="config" cols="40" rows="5" style="width: 400px; height: 200px;">' . $this->makeConfig($carry) . '</textarea>' . '<form action="' . $this->rel_siteurl . '/textpattern/setup/install.php" method="post">' . fInput('submit', 'submit', gTxt('did_it'), 'smallbox') . sInput('getTxpLogin') . hInput('carry', $this->postEncode($carry)) . '</form>'; return; } #$this->_step_view = '<form action="'.$this->rel_siteurl.'/textpattern/setup/index.php" method="post">'. $this->_step_view = '<form action="' . $this->rel_siteurl . '/textpattern/setup/install.php" method="post">' . startTable('edit') . tr(tda(graf(gTxt('thanks')) . graf(gTxt('about_to_create')), ' width="400" colspan="2" align="center"')) . tr(fLabelCell(gTxt('your_full_name')) . fInputCell('RealName')) . tr(fLabelCell(gTxt('setup_login')) . fInputCell('name')) . tr(fLabelCell(gTxt('choose_password')) . fInputCell('pass')) . tr(fLabelCell(gTxt('your_email')) . fInputCell('email')) . tr(td() . td(fInput('submit', 'Submit', gTxt('next'), 'publish'))) . endTable() . sInput('createTxp') . hInput('carry', $this->postEncode($carry)) . '</form>'; }
function link_edit($message = '') { global $vars, $step; pagetop(gTxt('edit_links'), $message); extract(gpsa($vars)); $rs = array(); if ($id && $step == 'link_edit') { $id = assert_int($id); $rs = safe_row('*', 'txp_link', "id = {$id}"); extract($rs); } if ($step == 'link_save' or $step == 'link_post') { foreach ($vars as $var) { ${$var} = ''; } } echo form(startTable('edit') . tr(fLabelCell('title', '', 'link-title') . fInputCell('linkname', $linkname, 1, 30, '', 'link-title')) . tr(fLabelCell('sort_value', '', 'link-sort') . fInputCell('linksort', $linksort, 2, 15, '', 'link-sort')) . tr(fLabelCell('url', 'link_url', 'link-url') . fInputCell('url', $url, 3, 30, '', 'link-url')) . tr(fLabelCell('link_category', 'link_category', 'link-category') . td(linkcategory_popup($category) . ' [' . eLink('category', 'list', '', '', gTxt('edit')) . ']')) . tr(tda('<label for="link-description">' . gTxt('description') . '</label>' . sp . popHelp('link_description'), ' style="text-align: right; vertical-align: top;"') . td('<textarea id="link-description" name="description" cols="40" rows="7" tabindex="4">' . htmlspecialchars($description) . '</textarea>')) . pluggable_ui('link_ui', 'extend_detail_form', '', $rs) . tr(td() . td(fInput('submit', '', gTxt('save'), 'publish'))) . endTable() . eInput('link') . ($id ? sInput('link_save') . hInput('id', $id) : sInput('link_post')) . hInput('search_method', gps('search_method')) . hInput('crit', gps('crit')), 'margin-bottom: 25px;'); echo link_list(); }
function thumb_ui($id) { global $prefs; extract($prefs); return tr(td(form(graf(gTxt('create_thumbnail')) . startTable('', 'left', '', 1) . tr(fLabelCell(gTxt('thumb_width') . ':') . fInputCell('width', '', 1, 4) . fLabelCell(gTxt('thumb_height') . ':') . fInputCell('height', '', 1, 4) . fLabelCell(gTxt('keep_square_pixels') . ':') . tda(checkbox2('crop', ''), ' class="noline"') . tda(fInput('submit', '', gTxt('Create'), 'smallerbox'), ' class="noline"')) . hInput('id', $id) . eInput('image') . sInput('thumbnail_create') . endTable()))); }
function ign_new_user_form() { $out = array(hed(ign_gTxt('add_new_user'), 3, ' align="center" style="margin-top:2em"'), graf(ign_gTxt('a_message_will_be_sent_with_login'), ' align="center"'), startTable('edit'), tr(fLabelCell('real_name') . fInputCell('RealName')), tr(fLabelCell('login_name') . fInputCell('name')), tr(fLabelCell('email') . fInputCell('email')), tr(fLabelCell('privileges') . td(ign_privList() . popHelp('about_privileges'))), tr(td() . td(fInput('submit', '', gTxt('save'), 'publish') . popHelp('add_new_user'))), endTable(), eInput('ign_user_mgmt') . sInput('ign_userSaveNew')); return form(join('', $out)); }
function getTxpLogin() { $carry = isPost('carry'); extract(postDecode($carry)); echo '<form action="setup.php" method="post">', startTable('edit'), tr(tda(graf('Thank you.') . graf('You are about to create and populate database tables.'), ' width="400" colspan="2" align="center"')), tr(fLabelCell('Your full name') . fInputCell('RealName')), tr(fLabelCell('Choose a login name (basic characters and spaces only please)') . fInputCell('name')), tr(fLabelCell('Choose a password') . fInputCell('pass')), tr(fLabelCell('Your email address') . fInputCell('email')), tr(td() . td(fInput('submit', 'Submit', 'Next', 'publish'))), endTable(), sInput('createTxp'), hInput('carry', $carry), '</form>'; }
function getTxpLogin() { $carry = postDecode(ps('carry')); extract($carry); $GLOBALS['textarray'] = setup_load_lang($lang); @(include txpath . '/config.php'); if (!isset($txpcfg) || $txpcfg['db'] != $ddb || $txpcfg['table_prefix'] != $dprefix) { echo graf(strong(gTxt('before_you_proceed')) . ', ' . gTxt('create_config', array('{txpath}' => txpath))), '<textarea style="width:400px;height:200px" name="config" rows="1" cols="1">', makeConfig($carry), '</textarea>', '<form action="' . $GLOBALS['rel_siteurl'] . '/textpattern/setup/index.php" method="post">', fInput('submit', 'submit', gTxt('did_it'), 'smallbox'), sInput('getTxpLogin'), hInput('carry', postEncode($carry)), '</form>'; return; } echo '<form action="' . $GLOBALS['rel_siteurl'] . '/textpattern/setup/index.php" method="post">', startTable('edit'), tr(tda(graf(gTxt('thanks')) . graf(gTxt('about_to_create')), ' width="400" colspan="2" align="center"')), tr(fLabelCell(gTxt('your_full_name')) . fInputCell('RealName')), tr(fLabelCell(gTxt('setup_login')) . fInputCell('name')), tr(fLabelCell(gTxt('choose_password')) . fInputCell('pass')), tr(fLabelCell(gTxt('your_email')) . fInputCell('email')), tr(td() . td(fInput('submit', 'Submit', gTxt('next'), 'publish'))), endTable(), sInput('createTxp'), hInput('lang', htmlspecialchars($lang)), hInput('siteurl', htmlspecialchars($siteurl)), '</form>'; }
function discuss_edit() { pagetop(gTxt('edit_comment')); extract(gpsa(array('discussid', 'sort', 'dir', 'page', 'crit', 'search_method'))); $discussid = assert_int($discussid); $rs = safe_row('*, unix_timestamp(posted) as uPosted', 'txp_discuss', "discussid = {$discussid}"); if ($rs) { extract($rs); $message = htmlspecialchars($message); if (fetch('ip', 'txp_discuss_ipban', 'ip', $ip)) { $ban_step = 'ipban_unban'; $ban_text = gTxt('unban'); } else { $ban_step = 'ipban_add'; $ban_text = gTxt('ban'); } $ban_link = '[<a href="?event=discuss' . a . 'step=' . $ban_step . a . 'ip=' . $ip . a . 'name=' . urlencode($name) . a . 'discussid=' . $discussid . '">' . $ban_text . '</a>]'; echo form(startTable('edit') . stackRows(fLabelCell('name') . fInputCell('name', $name), fLabelCell('IP') . td("{$ip} {$ban_link}"), fLabelCell('email') . fInputCell('email', $email), fLabelCell('website') . fInputCell('web', $web), fLabelCell('date') . td(safe_strftime('%d %b %Y %X', $uPosted)), tda(gTxt('message')) . td('<textarea name="message" cols="60" rows="15">' . $message . '</textarea>'), fLabelCell('status') . td(selectInput('visible', array(VISIBLE => gTxt('visible'), SPAM => gTxt('spam'), MODERATE => gTxt('unmoderated')), $visible, false)), td() . td(fInput('submit', 'step', gTxt('save'), 'publish')), hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('crit', $crit) . hInput('search_method', $search_method) . hInput('discussid', $discussid) . hInput('parentid', $parentid) . hInput('ip', $ip) . eInput('discuss') . sInput('discuss_save')) . endTable()); } else { echo graf(gTxt('comment_not_found'), ' class="indicator"'); } }