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 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 multiedit_form($type, $array) { $methods = array('delete' => gTxt('delete')); if ($array) { return form(join('', $array) . eInput('category') . sInput('multiedit') . hInput('type', $type) . small(gTxt('with_selected')) . sp . selectInput('method', $methods, '', 1) . sp . fInput('submit', '', gTxt('go'), 'smallerbox'), 'margin-top:1em', "verify('" . gTxt('are_you_sure') . "')"); } return; }
function lista($message = '') { global $prefs; extract($prefs); $template = new template(); pagetop(gTxt('template'), $message); print "\n <style type='text/css'>\n .success { color: #009900; }\n .failure { color: #FF0000; }\n </style>\n\t\t\t\n <table cellpadding='0' cellspacing='0' border='0' id='list' align='center'>\n <tr>\n <td>\n "; $importlist = $template->getTemplateList(); print "\n <h1>Import Templates</h1>\n " . form(graf('Which template set would you like to import?' . selectInput('import_dir', $importlist, '', 1) . fInput('submit', 'go', 'Go', 'smallerbox') . eInput('template') . sInput('import'))); print "\n <h1>Export Templates</h1>\n " . form(graf('Name this export:' . fInput('text', 'export_dir', '') . fInput('submit', 'go', 'Go', 'smallerbox') . eInput('template') . sInput('export'))); print "\n </td>\n </tr>\n </table>\n "; }
function oui_prefs_custom_field_list($name, $val) { $custom_fields = safe_rows("name, val", 'txp_prefs', "name LIKE 'custom_%_set' AND val<>'' ORDER BY name"); if ($custom_fields) { $vals = array(); foreach ($custom_fields as $row) { $vals[$row['val']] = $row['val']; } return selectInput($name, $vals, $val, 'true'); } return gtxt('no_custom_fields_recorded'); }
function oui_prefs_section_list($name, $val) { $sections = safe_rows("name, title", 'txp_section', "name != 'default' ORDER BY title, name"); if ($sections) { $vals = array(); foreach ($sections as $row) { $vals[$row['name']] = $row['title']; } return selectInput($name, $vals, $val, 'true'); } return gtxt('no_sections_available'); }
function oui_prefs_article_list($name, $val) { $articles = safe_rows("title, id", 'textpattern', "title != 'default' ORDER BY id, title"); if ($articles) { $vals = array(); foreach ($articles as $row) { $vals[$row['id']] = $row['title']; } return selectInput($name, $vals, $val, 'true'); } return gtxt('no_articles_recorded'); }
function oui_prefs_style_list($name, $val) { $styles = safe_rows("name", 'txp_css', "name != 'default' ORDER BY name"); if ($styles) { $vals = array(); foreach ($styles as $row) { $vals[$row['name']] = $row['name']; } return selectInput($name, $vals, $val, 'true'); } return gtxt('no_styles_recorded'); }
function oui_prefs_file_list($name, $val) { $files = safe_rows("name, id", 'txp_image', "name != 'default' ORDER BY id, name"); if ($files) { $vals = array(); foreach ($files as $row) { $vals[$row['id']] = $row['name']; } return selectInput($name, $vals, $val, 'true'); } return gtxt('no_images_recorded'); }
/** * Generate a <select> element of installed languages. * * @param string $name The HTML name and ID to assign to the select control * @param string $val The currently active language identifier (en-gb, fr-fr, ...) * @return string HTML */ function languages($name, $val) { $installed_langs = safe_column("lang", 'txp_lang', "1 = 1 GROUP BY lang"); $vals = array(); foreach ($installed_langs as $lang) { $vals[$lang] = safe_field("data", 'txp_lang', "name = '" . doSlash($lang) . "' AND lang = '" . doSlash($lang) . "'"); if (trim($vals[$lang]) == '') { $vals[$lang] = $lang; } } asort($vals); reset($vals); return selectInput($name, $vals, $val, false, true, $name); }
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 reset_author_pass_form() { global $txp_user; $names = array(); $them = safe_rows_start('*', 'txp_users', "name != '" . doSlash($txp_user) . "'"); while ($a = nextRow($them)) { extract($a); $names[$name] = $RealName . ' (' . $name . ')'; } if ($names) { return '<div style="margin: 3em auto auto auto; text-align: center;">' . form(tag(gTxt('reset_author_password'), 'h3') . graf(gTxt('a_new_password_will_be_mailed')) . graf(selectInput('name', $names, '', 1) . fInput('submit', 'author_change_pass', gTxt('submit'), 'smallerbox') . eInput('admin') . sInput('author_change_pass'), ' style="text-align: center;"')) . '</div>'; } }
function pref_text($name, $val, $id = '') { $id = $id ? $id : $name; $vals = array(USE_TEXTILE => gTxt('use_textile'), CONVERT_LINEBREAKS => gTxt('convert_linebreaks'), LEAVE_TEXT_UNTOUCHED => gTxt('leave_text_untouched')); return selectInput($name, $vals, $val, '', '', $id); }
function doDiagnostics() { global $files, $txpcfg, $step; extract(get_prefs()); $urlparts = parse_url(hu); $mydomain = $urlparts['host']; $server_software = @$_SERVER['SERVER_SOFTWARE'] || @$_SERVER['HTTP_HOST'] ? @$_SERVER['SERVER_SOFTWARE'] ? @$_SERVER['SERVER_SOFTWARE'] : $_SERVER['HTTP_HOST'] : ''; $is_apache = ($server_software and stristr($server_software, 'Apache')) or is_callable('apache_get_version'); $real_doc_root = isset($_SERVER['DOCUMENT_ROOT']) ? realpath($_SERVER['DOCUMENT_ROOT']) : ''; // ini_get() returns string values passed via php_value as a string, not boolean $is_register_globals = (strcasecmp(ini_get('register_globals'), 'on') === 0 or ini_get('register_globals') === '1'); $fail = array('path_to_site_missing' => !isset($path_to_site) ? gTxt('path_to_site_missing') : '', 'dns_lookup_fails' => @gethostbyname($mydomain) == $mydomain ? gTxt('dns_lookup_fails') . cs . $mydomain : '', 'path_to_site_inacc' => !@is_dir($path_to_site) ? gTxt('path_to_site_inacc') . cs . $path_to_site : '', 'site_trailing_slash' => rtrim($siteurl, '/') != $siteurl ? gTxt('site_trailing_slash') . cs . $path_to_site : '', 'index_inaccessible' => (!@is_file($path_to_site . "/index.php") or !@is_readable($path_to_site . "/index.php")) ? "{$path_to_site}/index.php " . gTxt('is_inaccessible') : '', 'dir_not_writable' => trim((!@is_writable($path_to_site . '/' . $img_dir) ? str_replace('{dirtype}', gTxt('img_dir'), gTxt('dir_not_writable')) . ": {$path_to_site}/{$img_dir}\r\n" : '') . (!@is_writable($file_base_path) ? str_replace('{dirtype}', gTxt('file_base_path'), gTxt('dir_not_writable')) . ": {$file_base_path}\r\n" : '') . (!@is_writable($tempdir) ? str_replace('{dirtype}', gTxt('tempdir'), gTxt('dir_not_writable')) . ": {$tempdir}\r\n" : '')), 'cleanurl_only_apache' => ($permlink_mode != 'messy' and !$is_apache) ? gTxt('cleanurl_only_apache') : '', 'htaccess_missing' => ($permlink_mode != 'messy' and !@is_readable($path_to_site . '/.htaccess')) ? gTxt('htaccess_missing') : '', 'mod_rewrite_missing' => ($permlink_mode != 'messy' and is_callable('apache_get_modules') and !apache_module('mod_rewrite')) ? gTxt('mod_rewrite_missing') : '', 'file_uploads_disabled' => !ini_get('file_uploads') ? gTxt('file_uploads_disabled') : '', 'setup_still_exists' => @is_dir($txpcfg['txpath'] . DS . 'setup') ? $txpcfg['txpath'] . DS . "setup" . DS . ' ' . gTxt('still_exists') : '', 'no_temp_dir' => empty($tempdir) ? gTxt('no_temp_dir') : '', 'warn_mail_unavailable' => !is_callable('mail') ? gTxt('warn_mail_unavailable') : '', 'warn_register_globals_or_update' => $is_register_globals && (version_compare(phpversion(), '4.4.0', '<=') or version_compare(phpversion(), '5.0.0', '>=') and version_compare(phpversion(), '5.0.5', '<=')) ? gTxt('warn_register_globals_or_update') : ''); if ($permlink_mode != 'messy') { $rs = safe_column("name", "txp_section", "1"); foreach ($rs as $name) { if (@file_exists($path_to_site . '/' . $name)) { $fail['old_placeholder_exists'] = gTxt('old_placeholder') . ": {$path_to_site}/{$name}"; } } } $missing = array(); foreach ($files as $f) { if (!is_readable($txpcfg['txpath'] . $f)) { $missing[] = $txpcfg['txpath'] . $f; } } if ($missing) { $fail['missing_files'] = gTxt('missing_files') . cs . join(', ', $missing); } foreach ($fail as $k => $v) { if (empty($v)) { unset($fail[$k]); } } # Find the highest revision number $file_revs = array(); $rev = 0; foreach ($files as $f) { $lines = @file($txpcfg['txpath'] . $f); if ($lines) { foreach ($lines as $line) { if (preg_match('/^\\$LastChangedRevision: (\\w+) \\$/', $line, $match)) { $file_revs[$f] = $match[1]; if ($match[1] > $rev) { $rev = $match[1]; } } } } } echo pagetop(gTxt('tab_diagnostics'), ''), startTable('list'), tr(td(hed(gTxt('preflight_check'), 1))); if ($fail) { foreach ($fail as $help => $message) { echo tr(tda(nl2br($message) . popHelp($help), ' style="color:red;"')); } } else { echo tr(td(gTxt('all_checks_passed'))); } echo tr(td(hed(gTxt('diagnostic_info'), 1))); $fmt_date = '%Y-%m-%d %H:%M:%S'; $out = array('<textarea style="width:500px;height:300px;" readonly="readonly">', gTxt('txp_version') . cs . txp_version . ' (' . ($rev ? 'r' . $rev : 'unknown revision') . ')' . n, gTxt('last_update') . cs . gmstrftime($fmt_date, $dbupdatetime) . '/' . gmstrftime($fmt_date, @filemtime(txpath . '/update/_update.php')) . n, gTxt('document_root') . cs . @$_SERVER['DOCUMENT_ROOT'] . ($real_doc_root != @$_SERVER['DOCUMENT_ROOT'] ? ' (' . $real_doc_root . ')' : '') . n, '$path_to_site' . cs . $path_to_site . n, gTxt('txp_path') . cs . $txpcfg['txpath'] . n, gTxt('permlink_mode') . cs . $permlink_mode . n, ini_get('open_basedir') ? 'open_basedir: ' . ini_get('open_basedir') . n : '', ini_get('upload_tmp_dir') ? 'upload_tmp_dir: ' . ini_get('upload_tmp_dir') . n : '', gTxt('tempdir') . cs . $tempdir . n, gTxt('web_domain') . cs . $siteurl . n, getenv('TZ') ? 'TZ: ' . getenv('TZ') . n : '', gTxt('php_version') . cs . phpversion() . n, $is_register_globals ? gTxt('register_globals') . cs . $is_register_globals . n : '', gTxt('server_time') . cs . strftime('%Y-%m-%d %H:%M:%S') . n, 'MySQL' . cs . mysql_get_server_info() . n, gTxt('locale') . cs . $locale . n, isset($_SERVER['SERVER_SOFTWARE']) ? gTxt('server') . cs . $_SERVER['SERVER_SOFTWARE'] . n : '', is_callable('apache_get_version') ? gTxt('apache_version') . cs . apache_get_version() . n : '', $fail ? n . gTxt('preflight_check') . cs . n . ln . join("\n", $fail) . n . ln : '', is_readable($path_to_site . '/.htaccess') ? n . gTxt('htaccess_contents') . cs . n . ln . join('', file($path_to_site . '/.htaccess')) . n . ln : ''); if ($step == 'high') { $mysql_client_encoding = is_callable('mysql_client_encoding') ? mysql_client_encoding() : '-'; $out[] = n . 'Charset (default/config)' . cs . $mysql_client_encoding . '/' . @$txpcfg['dbcharset'] . n; $result = safe_query("SHOW variables like 'character_se%'"); while ($row = mysql_fetch_row($result)) { $out[] = $row[0] . cs . $row[1] . n; if ($row[0] == 'character_set_connection') { $conn_char = $row[1]; } } $table_names = array(PFX . 'textpattern'); $result = safe_query("SHOW TABLES LIKE '" . PFX . "txp\\_%'"); while ($row = mysql_fetch_row($result)) { $table_names[] = $row[0]; } $table_msg = array(); foreach ($table_names as $table) { $ctr = safe_query("SHOW CREATE TABLE " . $table . ""); if (!$ctr) { unset($table_names[$table]); continue; } $ctcharset = preg_replace('#^CREATE TABLE.*SET=([^ ]+)[^)]*$#is', '\\1', mysql_result($ctr, 0, 'Create Table')); if (isset($conn_char) && !stristr($ctcharset, 'CREATE') && $conn_char != $ctcharset) { $table_msg[] = "{$table} is {$ctcharset}"; } $ctr = safe_query("CHECK TABLE " . $table); if (in_array(mysql_result($ctr, 0, 'Msg_type'), array('error', 'warning'))) { $table_msg[] = $table . cs . mysql_result($ctr, 0, 'Msg_Text'); } } if ($table_msg == array()) { $table_msg = count($table_names) < 18 ? array('-') : array('OK'); } $out[] = count($table_names) . ' Tables' . cs . implode(', ', $table_msg) . n; $extns = get_loaded_extensions(); $extv = array(); foreach ($extns as $e) { $extv[] = $e . (phpversion($e) ? '/' . phpversion($e) : ''); } $out[] = n . gTxt('php_extensions') . cs . join(', ', $extv) . n; if (is_callable('apache_get_modules')) { $out[] = n . gTxt('apache_modules') . cs . join(', ', apache_get_modules()) . n . n; } foreach ($files as $f) { $rev = ''; $checksum = ''; if (is_callable('md5_file')) { $checksum = md5_file($txpcfg['txpath'] . $f); } if (isset($file_revs[$f])) { $rev = $file_revs[$f]; } $out[] = "{$f}" . cs . ($rev ? "r" . $rev : gTxt('unknown')) . ' (' . ($checksum ? $checksum : gTxt('unknown')) . ')' . n; } } $out[] = '</textarea>' . br; $dets = array('low' => gTxt('low'), 'high' => gTxt('high')); $out[] = form(eInput('diag') . n . gTxt('detail') . cs . selectInput('step', $dets, $step, 0, 1)); echo tr(td(join('', $out))), endTable(); }
function getTxpLogin() { $GLOBALS['textarray'] = setup_load_lang($_SESSION['lang']); global $txpcfg; echo n . '<div id="setup_container" class="txp-container">'; $problems = array(); if (!isset($txpcfg['db'])) { if (!is_readable(txpath . '/config.php')) { $problems[] = graf('<span class="error">' . setup_gTxt('config_php_not_found', array('{file}' => txpspecialchars(txpath . '/config.php')), 'raw') . '</span>'); } else { @(include txpath . '/config.php'); } } if (!isset($txpcfg) || $txpcfg['db'] != $_SESSION['ddb'] || $txpcfg['table_prefix'] != $_SESSION['dprefix']) { $problems[] = graf('<span class="error">' . setup_gTxt('config_php_does_not_match_input', 'raw') . '</span>'); echo txp_setup_progress_meter(2) . n . '<div class="txp-setup">' . n . join(n, $problems) . n . setup_config_contents() . n . '</div>' . n . '</div>'; exit; } // Default theme selector $core_themes = array('classic', 'remora', 'hive'); $themes = theme::names(); foreach ($themes as $t) { $theme = theme::factory($t); if ($theme) { $m = $theme->manifest(); $title = empty($m['title']) ? ucwords($theme->name) : $m['title']; $vals[$t] = in_array($t, $core_themes) ? setup_gTxt('core_theme', array('{theme}' => $title)) : $title; unset($theme); } } asort($vals, SORT_STRING); $theme_chooser = selectInput('theme', $vals, isset($_SESSION['theme']) ? txpspecialchars($_SESSION['theme']) : 'classic', '', '', '', 'setup_admin_theme'); echo txp_setup_progress_meter(3) . n . '<div class="txp-setup">'; echo '<form action="' . txpspecialchars($_SERVER['PHP_SELF']) . '" method="post">' . n . hed(setup_gTxt('creating_db_tables'), 2) . n . graf(setup_gTxt('about_to_create')) . n . graf('<span class="edit-label"><label for="setup_user_realname">' . setup_gTxt('your_full_name') . '</label></span>' . n . '<span class="edit-value">' . fInput('text', 'RealName', isset($_SESSION['realname']) ? txpspecialchars($_SESSION['realname']) : '', '', '', '', INPUT_REGULAR, '', 'setup_user_realname') . '</span>') . n . graf('<span class="edit-label"><label for="setup_user_login">' . setup_gTxt('setup_login') . '</label>' . sp . popHelp('setup_user_login') . '</span>' . n . '<span class="edit-value">' . fInput('text', 'name', isset($_SESSION['name']) ? txpspecialchars($_SESSION['name']) : '', '', '', '', INPUT_REGULAR, '', 'setup_user_login') . '</span>') . n . graf('<span class="edit-label"><label for="setup_user_pass">' . setup_gTxt('choose_password') . '</label>' . sp . popHelp('setup_user_pass') . '</span>' . n . '<span class="edit-value">' . fInput('text', 'pass', isset($_SESSION['pass']) ? txpspecialchars($_SESSION['pass']) : '', '', '', '', INPUT_REGULAR, '', 'setup_user_pass') . '</span>') . n . graf('<span class="edit-label"><label for="setup_user_email">' . setup_gTxt('your_email') . '</label></span>' . n . '<span class="edit-value">' . fInput('text', 'email', isset($_SESSION['email']) ? txpspecialchars($_SESSION['email']) : '', '', '', '', INPUT_REGULAR, '', 'setup_user_email') . '</span>') . n . hed(setup_gTxt('site_config'), 2) . n . graf('<span class="edit-label"><label for="setup_admin_theme">' . setup_gTxt('admin_theme') . '</label>' . sp . popHelp('theme_name') . '</span>' . n . '<span class="edit-value">' . $theme_chooser . '</span>') . n . graf(fInput('submit', 'Submit', setup_gTxt('next_step'), 'publish')) . n . sInput('createTxp') . n . '</form>' . n . '</div>' . n . '</div>'; }
function ign_resetUserPassForm() { global $myprivs, $ign_user_db; $them = safe_rows_start("*", $ign_user_db, "1"); while ($a = nextRow($them)) { $names[$a['name']] = $a['RealName'] . ' (' . $a['name'] . ')'; } if (!empty($names)) { return '<div align="center" style="margin-top:3em">' . form(tag(ign_gTxt('reset_user_password'), 'h3') . graf(gTxt('a_new_password_will_be_mailed')) . graf(selectInput("name", $names, '', 1) . fInput('submit', 'ign_changePass', gTxt('submit'), 'smallerbox') . eInput('ign_user_mgmt') . sInput('ign_userChangePass'), ' style="text-align:center"')) . '</div>'; } }
/** * Renders multi-edit form. * * @param int $page The page * @param string $sort The sorting value * @param string $dir The sorting direction * @param string $crit The search string * @param string $search_method The search method * @return string HTML */ function author_multiedit_form($page, $sort, $dir, $crit, $search_method) { $privileges = privs(); $users = safe_column('name', 'txp_users', '1=1'); $methods = array('changeprivilege' => array('label' => gTxt('changeprivilege'), 'html' => $privileges), 'resetpassword' => gTxt('resetpassword')); if (count($users) > 1) { $methods['delete'] = array('label' => gTxt('delete'), 'html' => tag(gTxt('assign_assets_to'), 'label', array('for' => 'assign_assets')) . selectInput('assign_assets', $users, '', true, '', 'assign_assets')); } return multi_edit($methods, 'admin', 'admin_multi_edit', $page, $sort, $dir, $crit, $search_method); }
function tag_file_download_link() { global $step, $endform, $tag_name, $permlink_mode; $atts = gpsa(array('filename', 'id')); extract($atts); $thing = gps('thing'); $type = gps('type'); $description = gps('description'); $types = array('textile' => 'Textile', 'textpattern' => 'Textpattern', 'xhtml' => 'XHTML'); $out = form(startTable('tagbuilder') . tr(tdcs(hed(gTxt('tag_' . $tag_name), 3), 2)) . tagRow('type', '' . selectInput('type', $types, $type ? $type : 'textpattern', true)) . tagRow('id', input_id($id)) . tagRow('filename', fInput('text', 'filename', $filename, 'edit', '', '', 25)) . tagRow('link_text', fInput('text', 'thing', $thing ? $thing : $filename, 'edit', '', '', 25)) . tagRow('description', '<textarea name="description" cols="22" rows="3">' . $description . '</textarea>') . $endform); if ($step == 'build') { $description = str_replace('&', '&', htmlspecialchars($description)); $url = $permlink_mode == 'messy' ? hu . 'index.php?s=file_download' . ($type == 'textile' ? '&' : a) . 'id=' . $id : hu . gTxt('file_download') . '/' . $id . ($filename ? '/' . $filename : ''); switch ($type) { case 'textile': $thing = $thing ? $thing : $filename; $description = $description ? ' (' . $description . ')' : ''; $out .= tdb('"' . $thing . $description . '":' . $url); break; case 'xhtml': $thing = $thing ? $thing : $filename; $description = $description ? ' title="' . $description . '"' : ''; $out .= tdb('<a href="' . $url . '"' . $description . '>' . $thing . '</a>'); break; case 'textpattern': default: $atts = array('id' => $id); $thing = $thing ? $thing : '<txp:file_download_name />'; $out .= tdb(tb($tag_name, $atts, $thing)); break; } } return $out; }
function event_multiedit_form($name, $methods = null, $page, $sort, $dir, $crit, $search_method) { $method = ps('edit_method'); if ($methods === NULL) { $methods = array('delete' => gTxt('delete')); } return '<label for="withselected">' . gTxt('with_selected') . '</label>' . sp . selectInput('edit_method', $methods, $method, 1, ' id="withselected" onchange="poweredit(this); return false;"') . n . eInput($name) . n . sInput($name . '_multi_edit') . n . hInput('page', $page) . ($sort ? n . hInput('sort', $sort) . n . hInput('dir', $dir) : '') . ($crit ? n . hInput('crit', $crit) . n . hInput('search_method', $search_method) : '') . n . fInput('submit', '', gTxt('go'), 'smallerbox'); }
function formTypes($type) { $types = array('' => '', 'article' => 'article', 'category' => 'category', 'comment' => 'comment', 'file' => 'file', 'link' => 'link', 'misc' => 'misc', 'section' => 'section'); return selectInput('type', $types, $type); }
function pagetop($pagetitle, $message = "") { global $css_mode, $siteurl, $sitename, $txp_user, $event; $area = gps('area'); $event = !$event ? 'article' : $event; $bm = gps('bm'); $privs = safe_field("privs", "txp_users", "name = '" . doSlash($txp_user) . "'"); $GLOBALS['privs'] = $privs; $areas = areas(); $area = false; foreach ($areas as $k => $v) { if (in_array($event, $v)) { $area = $k; break; } } if (gps('logout')) { $body_id = 'page-logout'; } elseif (!$txp_user) { $body_id = 'page-login'; } else { $body_id = 'page-' . $event; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo LANG; ?> " lang="<?php echo LANG; ?> " dir="<?php echo gTxt('lang_dir'); ?> "> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="robots" content="noindex, nofollow" /> <title>Txp › <?php echo htmlspecialchars($sitename); ?> › <?php echo escape_title($pagetitle); ?> </title> <link href="textpattern.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="textpattern.js"></script> <script type="text/javascript"> <!-- var cookieEnabled = checkCookies(); if (!cookieEnabled) { confirm('<?php echo trim(gTxt('cookies_must_be_enabled')); ?> '); } <?php $edit = array(); if ($event == 'list') { $rs = safe_column('name', 'txp_section', "name != 'default'"); $edit['section'] = $rs ? selectInput('Section', $rs, '', true) : ''; $rs = getTree('root', 'article'); $edit['category1'] = $rs ? treeSelectInput('Category1', $rs, '') : ''; $edit['category2'] = $rs ? treeSelectInput('Category2', $rs, '') : ''; $edit['comments'] = onoffRadio('Annotate', safe_field('val', 'txp_prefs', "name = 'comments_on_default'")); $edit['status'] = selectInput('Status', array(1 => gTxt('draft'), 2 => gTxt('hidden'), 3 => gTxt('pending'), 4 => gTxt('live'), 5 => gTxt('sticky')), '', true); $rs = safe_column('name', 'txp_users', "privs not in(0,6)"); $edit['author'] = $rs ? selectInput('AuthorID', $rs, '', true) : ''; } if (in_array($event, array('image', 'file', 'link'))) { $rs = getTree('root', $event); $edit['category'] = $rs ? treeSelectInput('category', $rs, '') : ''; } if ($event == 'plugin') { $edit['order'] = selectInput('order', array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9), 5, false); } if ($event == 'admin') { $edit['privilege'] = privs(); } // output JavaScript ?> function poweredit(elm) { var something = elm.options[elm.selectedIndex].value; // Add another chunk of HTML var pjs = document.getElementById('js'); if (pjs == null) { var br = document.createElement('br'); elm.parentNode.appendChild(br); pjs = document.createElement('P'); pjs.setAttribute('id','js'); elm.parentNode.appendChild(pjs); } if (pjs.style.display == 'none' || pjs.style.display == '') { pjs.style.display = 'block'; } if (something != '') { switch (something) { <?php foreach ($edit as $key => $val) { echo "case 'change" . $key . "':" . n . t . "pjs.innerHTML = '<span>" . str_replace(array("\n", '-'), array('', '-'), addslashes($val)) . "</span>';" . n . t . 'break;' . n . n; } ?> default: pjs.style.display = 'none'; break; } } return false; } addEvent(window, 'load', cleanSelects); --> </script> <script type="text/javascript" src="jquery.js"></script> <?php callback_event('admin_side', 'head_end'); ?> </head> <body id="<?php echo $body_id; ?> "> <?php callback_event('admin_side', 'pagetop'); ?> <table id="pagetop" cellpadding="0" cellspacing="0"> <tr id="branding"><td><h1 id="textpattern">Textpattern</h1></td><td id="navpop"><?php echo navPop(1); ?> </td></tr> <tr id="nav-primary"><td align="center" class="tabs" colspan="2"> <?php if (!$bm) { echo '<table cellpadding="0" cellspacing="0" align="center"><tr> <td valign="middle" style="width:368px"> ' . $message . '</td>', has_privs('tab.content') ? areatab(gTxt('tab_content'), 'content', 'article', $area) : '', has_privs('tab.presentation') ? areatab(gTxt('tab_presentation'), 'presentation', 'page', $area) : '', has_privs('tab.admin') ? areatab(gTxt('tab_admin'), 'admin', 'admin', $area) : '', (has_privs('tab.extensions') and !empty($areas['extensions'])) ? areatab(gTxt('tab_extensions'), 'extensions', array_shift($areas['extensions']), $area) : '', '<td class="tabdown"><a href="' . hu . '" class="plain" target="_blank">' . gTxt('tab_view_site') . '</a></td>', '</tr></table>'; $secondary = tabsort($area, $event); if ($secondary) { echo '</td></tr><tr id="nav-secondary"><td align="center" class="tabs" colspan="2"> <table cellpadding="0" cellspacing="0" align="center"><tr>', $secondary, '</tr></table>'; } } echo '</td></tr></table>'; callback_event('admin_side', 'pagetop_end'); }
/** * Renders a HTML <select> list of available public site markup schemes to adhere to. * * @param string $name HTML name and id of the widget * @param string $val Initial (or current) selected item * @return string HTML */ function doctypes($name, $val) { $vals = array('xhtml' => gTxt('XHTML'), 'html5' => gTxt('HTML5')); return selectInput($name, $vals, $val, '', '', $name); }
function form_pop($form, $id) { $arr = array(' '); $rs = safe_column('name', 'txp_form', "type = 'article' and name != 'default' order by name"); if ($rs) { return selectInput('override_form', $rs, $form, true, '', $id); } }
function section_multiedit_form($page, $sort, $dir, $crit, $search_method) { global $all_pages, $all_styles; $methods = array('changepage' => array('label' => gTxt('uses_page'), 'html' => selectInput('uses_page', $all_pages, '', false)), 'changecss' => array('label' => gTxt('uses_style'), 'html' => selectInput('css', $all_styles, '', false)), 'changeonfrontpage' => array('label' => gTxt('on_front_page'), 'html' => yesnoRadio('on_frontpage', 1)), 'changesyndicate' => array('label' => gTxt('syndicate'), 'html' => yesnoRadio('in_rss', 1)), 'changesearchable' => array('label' => gTxt('include_in_search'), 'html' => yesnoRadio('searchable', 1)), 'delete' => gTxt('delete')); return multi_edit($methods, 'section', 'section_multi_edit', $page, $sort, $dir, $crit, $search_method); }
function tag_file_download_size() { global $step, $endform, $name; $invars = gpsa(array('format', 'decimals')); $formats = array('b' => 'bytes', 'kb' => 'kilobytes', 'mb' => 'megabytes', 'gb' => 'gigabytes', 'tb' => 'terabytes', 'pb' => 'petabytes'); extract($invars); $decimals = !$decimals ? '2' : $decimals; $out = form(startTable('list') . tr(tdcs(hed(gTxt('tag_file_download_size'), 3), 2)) . tagRow('format', selectInput('format', $formats, $format, 1)) . tagRow('decimals', fInput('text', 'decimals', $decimals, 'edit', '', '', 4)) . $endform); $out .= $step == 'build' ? tdb(tb($name, $invars)) : ''; return $out; }
function form_pop($form) { $arr = array(' '); $rs = safe_column("name", "txp_form", "type='article' and name!='default'"); if ($rs) { return selectInput('override_form', $rs, $form, 1); } }
/** * Renders a <select> input containing all available sections. * * @param string $Section The selected option * @return string HTML * @access private */ function import_section_popup($Section) { $rs = safe_column("name", "txp_section", "name!='default'"); if ($rs) { return selectInput("import_section", $rs, $Section, 1, '', 'import_section'); } return false; }
function privs($priv = '') { global $levels; return selectInput('privs', $levels, $priv); }