function discuss_list($message = '') { pagetop(gTxt('list_discussions'), $message); extract(doSlash(gpsa(array('page', 'crit')))); extract(get_prefs()); $total = safe_count('txp_discuss', "1=1"); $limit = max(@$comment_list_pageby, 25); $numPages = ceil($total / $limit); $page = !$page ? 1 : $page; $offset = ($page - 1) * $limit; $nav[] = $page > 1 ? PrevNextLink("discuss", $page - 1, gTxt('prev'), 'prev') : ''; $nav[] = sp . small($page . '/' . $numPages) . sp; $nav[] = $page != $numPages ? PrevNextLink("discuss", $page + 1, gTxt('next'), 'next') : ''; $criteria = $crit ? "message like '%{$crit}%'" : '1=1'; $rs = safe_rows_start("*, unix_timestamp(posted) as uPosted", "txp_discuss", "{$criteria} order by posted desc limit {$offset}, {$limit}"); echo pageby_form('discuss', $comment_list_pageby); if ($rs) { echo '<form action="index.php" method="post" name="longform" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">', startTable('list'), assHead('date', 'name', 'message', 'parent', ''); while ($a = nextRow($rs)) { extract($a); $dmessage = $visible == SPAM ? short_preview($message) : $message; $date = "" . date("M d, g:ia", $uPosted + tz_offset()) . ""; $editlink = eLink('discuss', 'discuss_edit', 'discussid', $discussid, $date); $cbox = fInput('checkbox', 'selected[]', $discussid); $tq = fetch('Title', 'textpattern', 'ID', $parentid); $parent = !$tq ? gTxt('article_deleted') : $tq; echo assRow(array($editlink => 100, $name => 100, $dmessage => 250, $parent => 100, $cbox => 20), ' class="' . ($visible == VISIBLE ? 'visible' : ($visible == SPAM ? 'spam' : 'moderate')) . '"'); } echo tr(tda(select_buttons() . discuss_multiedit_form(), ' colspan="5" style="text-align:right;border:0px"')); echo endTable() . '</form>'; echo startTable('edit'), tr(td(form(fInput('text', 'crit', '', 'edit') . fInput('submit', 'search', gTxt('search'), 'smallbox') . eInput("discuss") . sInput("list"))) . td(graf(join('', $nav)))) . tr(tda(graf('<a href="index.php?event=discuss' . a . 'step=ipban_list">' . gTxt('list_banned_ips') . '</a>'), ' colspan="2" align="center" valign="middle"')), endTable(); } else { echo graf(gTxt('no_comments_recorded'), ' align="center"'); } }
public static function prime() { tiny(); small(); medium(); large(); huge(); }
function page_edit($message = '') { global $step; pagetop(gTxt('edit_pages'), $message); extract(gpsa(array('name', 'div'))); $name = (!$name or $step == 'page_delete') ? 'default' : $name; $divline = $step == "div_edit" ? graf(gTxt('you_are_editing_div') . sp . strong($div)) : ''; echo startTable('edit') . tr(td() . td(graf(gTxt('you_are_editing_page') . sp . strong($name)) . $divline) . td()) . tr(tda(hed(gTxt('useful_tags'), 2) . graf(gTxt('page_article_hed') . br . small(taglinks('page_article')), ' class="column"') . graf(gTxt('page_article_nav_hed') . br . small(taglinks('page_article_nav')), ' class="column"') . graf(gTxt('page_nav_hed') . br . small(taglinks('page_nav')), ' class="column"') . graf(gTxt('page_xml_hed') . br . small(taglinks('page_xml')), ' class="column"') . graf(gTxt('page_misc_hed') . br . small(taglinks('page_misc')), ' class="column"') . graf(gTxt('page_file_hed') . br . small(taglinks('page_file')), ' class="column"')) . tda(page_edit_form($name), ' class="column"') . tda(hed(gTxt('all_pages'), 2) . page_list($name), ' class="column"')) . endTable(); }
function getDbInfo() { $temp_txpath = dirname(__FILE__); $temp_doc_root = $_SERVER['DOCUMENT_ROOT']; echo '<form action="setup.php" method="post">', '<table id="setup" cellpadding="0" cellspacing="0" border="0">', tr(tda(hed('Welcome to Textpattern', 3) . graf('Inevitably, we need a few details.', ' style="margin-bottom:3em"') . hed('MySQL', 3) . graf('Note that the database you specify must exist; Textpattern won’t create it for you.'), ' width="400" height="50" colspan="4", align="left"')), tr(fLabelCell('MySQL login') . fInputCell('duser', '', 1) . fLabelCell('MySQL password') . fInputCell('dpass', '', 2)), tr(fLabelCell('MySQL server') . fInputCell('dhost', '', 3) . fLabelCell('MySQL database') . fInputCell('ddb', '', 4)), tr(fLabelCell('Table prefix') . fInputCell('dprefix', '', 5) . tdcs(small('(Use ONLY for multiple installations in one database)'), 2)), tr(tdcs(' ', 4)), tr(tdcs(hed('Site Paths', 3) . graf('Please confirm the following paths to your site root and to the Textpattern directory.'), 4)), tr(fLabelCell('Full path to server\'s web root') . tdcs(fInput('text', 'doc_root', $temp_doc_root, 'edit', '', '', 40) . popHelp('doc_root'), 3)), tr(fLabelCell('Full path to Textpattern') . tdcs(fInput('text', 'txpath', $temp_txpath, 'edit', '', '', 40) . popHelp('full_path'), 3)); echo tr(td() . td(fInput('submit', 'Submit', 'Next', 'publish')) . td() . td()); echo endTable(), sInput('printConfig'), '</form>'; }
function log_list() { pagetop(gTxt('visitor_logs')); extract(get_prefs()); safe_delete("txp_log", "`time` < date_sub(now(),interval " . $expire_logs_after . " day)"); safe_optimize("txp_log"); safe_repair("txp_log"); $page = gps('page'); $total = getCount('txp_log', "1"); $limit = 50; $numPages = ceil($total / $limit); $page = !$page ? 1 : $page; $offset = ($page - 1) * $limit; $nav[] = $page > 1 ? PrevNextLink("log", $page - 1, gTxt('prev'), 'prev') : ''; $nav[] = sp . small($page . '/' . $numPages) . sp; $nav[] = $page != $numPages ? PrevNextLink("log", $page + 1, gTxt('next'), 'next') : ''; $rs = safe_rows_start("*, unix_timestamp(time) as stamp", "txp_log", "1 order by time desc limit {$offset},{$limit}"); if ($rs) { echo startTable('list'), assHead('time', 'host', 'page', 'referrer'); $stamp = ''; while ($a = nextRow($rs)) { extract($a); if ($refer) { $referprint = preg_replace("/^www\\./", "", chunk(htmlspecialchars($refer), 50)); $referprint = '<a href="http://' . htmlspecialchars($refer) . '">' . $referprint . '</a>'; } else { $referprint = ' '; } $pageprint = preg_replace('/\\/$/', '', htmlspecialchars(substr($page, 1))); $pageprint = $pageprint == '' ? '' : '<a href="' . htmlspecialchars($page) . '" target="_blank">' . chunk($pageprint, 50) . '</a>'; if ($method == 'POST') { $pageprint = '<b>' . $pageprint . '</b>'; } $fstamp = date("n/j g:i a", $stamp + tz_offset()); $hostprint = chunk($host, 40); echo tr(td($fstamp) . td($hostprint) . td($pageprint) . td($referprint)); unset($refer, $referprint, $page, $pageprint); } echo '<tr><td colspan="4" align="right" style="padding:10px">', join('', $nav), "</td></tr>", endTable(); } else { echo graf(gTxt('no_refers_recorded'), ' align="center"'); } }
function getDbInfo() { $lang = isPost('lang'); $GLOBALS['textarray'] = setup_load_lang($lang); @(include './config.php'); if (!empty($txpcfg['db'])) { exit(graf(gTxt('already_installed'))); } $temp_txpath = dirname(__FILE__); if (@$_SERVER['SCRIPT_NAME'] && (@$_SERVER['SERVER_NAME'] || @$_SERVER['HTTP_HOST'])) { $guess_siteurl = @$_SERVER['SERVER_NAME'] ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST']; $guess_siteurl .= rtrim(dirname(dirname($_SERVER['SCRIPT_NAME'])), '/'); } else { $guess_siteurl = 'mysite.com'; } echo '<form action="setup.php" method="post">', '<table id="setup" cellpadding="0" cellspacing="0" border="0">', tr(tda(hed(gTxt('welcome_to_textpattern'), 3) . graf(gTxt('need_details'), ' style="margin-bottom:3em"') . hed('MySQL', 3) . graf(gTxt('db_must_exist')), ' width="400" height="50" colspan="4" align="left"')), tr(fLabelCell(gTxt('mysql_login')) . fInputCell('duser', '', 1) . fLabelCell(gTxt('mysql_password')) . fInputCell('dpass', '', 2)), tr(fLabelCell(gTxt('mysql_server')) . fInputCell('dhost', '', 3) . fLabelCell(gTxt('mysql_database')) . fInputCell('ddb', '', 4)), tr(fLabelCell(gTxt('table_prefix')) . fInputCell('dprefix', '', 5) . tdcs(small(gTxt('prefix_warning')), 2)), tr(tdcs(' ', 4)), tr(tdcs(hed(gTxt('site_path'), 3) . graf(gTxt('confirm_site_path')), 4)), tr(fLabelCell(gTxt('full_path_to_txp')) . tdcs(fInput('text', 'txpath', $temp_txpath, 'edit', '', '', 40) . popHelp('full_path'), 3)), tr(tdcs(' ', 4)), tr(tdcs(hed(gTxt('site_url'), 3) . graf(gTxt('please_enter_url')), 4)), tr(fLabelCell('http://') . tdcs(fInput('text', 'siteurl', $guess_siteurl, 'edit', '', '', 40) . popHelp('site_url'), 3)); echo tr(td() . td(fInput('submit', 'Submit', gTxt('next'), 'publish')) . td() . td()); echo endTable(), hInput('lang', $lang), sInput('printConfig'), '</form>'; }
function getDbInfo() { $GLOBALS['textarray'] = setup_load_lang(ps('lang')); @(include txpath . '/config.php'); if (!empty($txpcfg['db'])) { exit(graf(gTxt('already_installed', array('{txpath}' => txpath)))); } if (@$_SERVER['SCRIPT_NAME'] && (@$_SERVER['SERVER_NAME'] || @$_SERVER['HTTP_HOST'])) { $guess_siteurl = @$_SERVER['HTTP_HOST'] ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']; $guess_siteurl .= $GLOBALS['rel_siteurl']; } else { $guess_siteurl = 'mysite.com'; } echo '<form action="' . $GLOBALS['rel_siteurl'] . '/textpattern/setup/index.php" method="post">', '<table id="setup" cellpadding="0" cellspacing="0" border="0">', tr(tda(hed(gTxt('welcome_to_textpattern'), 3) . graf(gTxt('need_details'), ' style="margin-bottom:3em"') . hed('MySQL', 3) . graf(gTxt('db_must_exist')), ' width="400" height="50" colspan="4" align="left"')), tr(fLabelCell(gTxt('mysql_login')) . fInputCell('duser', '', 1) . fLabelCell(gTxt('mysql_password')) . fInputCell('dpass', '', 2)), tr(fLabelCell(gTxt('mysql_server')) . fInputCell('dhost', 'localhost', 3) . fLabelCell(gTxt('mysql_database')) . fInputCell('ddb', '', 4)), tr(fLabelCell(gTxt('table_prefix')) . fInputCell('dprefix', '', 5) . tdcs(small(gTxt('prefix_warning')), 2)), tr(tdcs(' ', 4)), tr(tdcs(hed(gTxt('site_url'), 3) . graf(gTxt('please_enter_url')), 4)), tr(fLabelCell('http://') . tdcs(fInput('text', 'siteurl', $guess_siteurl, 'edit', '', '', 40) . popHelp('siteurl'), 3)); if (!is_callable('mail')) { echo tr(tdcs(gTxt('warn_mail_unavailable'), 3, null, '" style="color:red;text-align:center')); } echo tr(td() . td(fInput('submit', 'Submit', gTxt('next'), 'publish')) . td() . td()); echo endTable(), hInput('lang', LANG), sInput('printConfig'), '</form>'; }
function form_list($curname) { global $step; $out[] = startTable('list'); $out[] = tr(tda(sLink('form', 'form_create', gTxt('create_new_form')), ' colspan="3" style="height:30px"')); $out[] = assHead('form', 'type', ''); $methods = array('delete' => 'delete'); $rs = safe_rows("*", "txp_form", "1 order by name"); if ($rs) { foreach ($rs as $a) { extract($a); $editlink = $curname != $name ? eLink('form', 'form_edit', 'name', $name, $name) : $name; $modbox = $name != 'comments' && $name != 'comment_form' && $name != 'default' && $name != 'Links' ? '<input type="checkbox" name="selected_forms[]" value="' . $name . '" />' : sp; $out[] = tr(td($editlink) . td(small($type)) . td($modbox)); } $out[] = endTable(); $out[] = eInput('form') . sInput('form_multi_edit'); $out[] = graf(selectInput('method', $methods, '', 1) . sp . gTxt('selected') . sp . fInput('submit', 'form_multi_edit', gTxt('go'), 'smallerbox'), ' align="right"'); return form(join('', $out), '', "verify('" . gTxt('are_you_sure') . "')"); } }
function form_list($curname) { global $step, $essential_forms; $out[] = startTable('list'); $out[] = tr(tda(sLink('form', 'form_create', gTxt('create_new_form')), ' colspan="3" style="height:30px"')); $out[] = assHead('form', 'type', ''); $methods = array('delete' => gTxt('delete')); $rs = safe_rows_start("*", "txp_form", "1 order by type asc, name asc"); if ($rs) { while ($a = nextRow($rs)) { extract($a); $editlink = $curname != $name ? eLink('form', 'form_edit', 'name', $name, $name) : htmlspecialchars($name); $modbox = !in_array($name, $essential_forms) ? '<input type="checkbox" name="selected_forms[]" value="' . $name . '" />' : sp; $out[] = tr(td($editlink) . td(small($type)) . td($modbox)); } $out[] = endTable(); $out[] = eInput('form') . sInput('form_multi_edit'); $out[] = graf(selectInput('edit_method', $methods, '', 1) . sp . gTxt('selected') . sp . fInput('submit', 'form_multi_edit', gTxt('go'), 'smallerbox'), ' align="right"'); return form(join('', $out), '', "verify('" . gTxt('are_you_sure') . "')"); } }
function image_list($message = '') { global $txpcfg, $extensions, $path_from_root, $img_dir; $pfr = $path_from_root; extract($txpcfg); extract(get_prefs()); pagetop(gTxt('image'), $message); echo pageby_form('image', $article_list_pageby); echo startTable('list'), tr(tda(upload_form(gTxt('upload_file'), gTxt('upload'), 'image_insert'), ' colspan="4" style="border:0"')), tr(hCell(ucfirst(gTxt('name'))) . hCell(gTxt('image_category')) . hCell(gTxt('tags')) . hCell(gTxt('author')) . hCell(gTxt('thumbnail')) . hCell()); $page = gps('page'); $total = getCount('txp_image', "1"); $limit = 15; $numPages = ceil($total / $limit); $page = !$page ? 1 : $page; $offset = ($page - 1) * $limit; $nav[] = $page > 1 ? PrevNextLink("image", $page - 1, gTxt('prev'), 'prev') : ''; $nav[] = sp . small($page . '/' . $numPages) . sp; $nav[] = $page != $numPages ? PrevNextLink("image", $page + 1, gTxt('next'), 'next') : ''; $rs = safe_rows("*", "txp_image", "1 order by category,name limit {$offset},{$limit}"); if ($rs) { foreach ($rs as $a) { extract($a); $thumbnail = $thumbnail ? '<img src="' . $pfr . $img_dir . '/' . $id . 't' . $ext . '" />' : gTxt('no'); $elink = eLink('image', 'image_edit', 'id', $id, $name); $txtilelink = '<a target="_blank" href="?event=tag' . a . 'name=image' . a . 'id=' . $id . a . 'ext=' . $ext . a . 'alt=' . $alt . a . 'h=' . $h . a . 'w=' . $w . a . 'type=textile" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">Textile</a>'; $txplink = '<a target="_blank" href="?event=tag' . a . 'name=image' . a . 'id=' . $id . a . 'type=textpattern" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">Textpattern</a>'; $xhtmlink = '<a target="_blank" href="?event=tag' . a . 'name=image' . a . 'id=' . $id . a . 'ext=' . $ext . a . 'h=' . $h . a . 'w=' . $w . a . 'type=xhtml" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">XHTML</a>'; $dlink = dLink('image', 'image_delete', 'id', $id); echo tr(td($elink) . td($category) . td($txtilelink . ' / ' . $txplink . ' / ' . $xhtmlink) . td($author) . td($thumbnail) . td($dlink, 10)); } echo tr(tdcs(graf(join('', $nav)), 4)); } echo endTable(); $imgdir = $doc_root . $path_from_root . $img_dir; if (!is_dir($imgdir) or !is_writeable($imgdir)) { echo graf(str_replace("{imgdir}", $imgdir, gTxt('img_dir_not_writeable')), ' style="text-align:center;color:red"'); } }
function link_list($message = "") { global $step, $link_list_pageby; extract(get_prefs()); $page = gps('page'); $total = getCount('txp_link', "1"); $limit = $link_list_pageby; $numPages = ceil($total / $limit); $page = !$page ? 1 : $page; $offset = ($page - 1) * $limit; $sort = gps('sort'); $dir = gps('dir'); $sort = $sort ? $sort : 'linksort'; $dir = $dir ? $dir : 'asc'; if ($dir == "desc") { $dir = "asc"; } else { $dir = "desc"; } $nav[] = $page > 1 ? PrevNextLink("link", $page - 1, gTxt('prev'), 'prev') : ''; $nav[] = sp . small($page . '/' . $numPages) . sp; $nav[] = $page != $numPages ? PrevNextLink("link", $page + 1, gTxt('next'), 'next') : ''; $rs = safe_rows("*", "txp_link", "1 order by {$sort} {$dir} limit {$offset},{$limit}"); if ($rs) { echo '<form action="index.php" method="post" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">', startTable('list'), tr(column_head('link_name', 'linksort', 'link', 1, $dir) . column_head('description', 'description', 'link', 1, $dir) . column_head('link_category', 'category', 'link', 1, $dir) . td()); foreach ($rs as $a) { extract($a); $elink = eLink('link', 'link_edit', 'id', $id, $linkname); $cbox = fInput('checkbox', 'selected[]', $id); echo tr(td($elink) . td($description) . td($category) . td($cbox)); } echo tr(tda(link_multiedit_form(), ' colspan="4" style="border:0px;text-align:right"')); echo endTable(), '</form>'; echo pageby_form('link', $link_list_pageby); echo graf(join('', $nav), ' align="center"'); } }
function list_nav_form($page, $numPages, $sort, $dir) { $nav[] = $page > 1 ? PrevNextLink("list", $page - 1, gTxt('prev'), 'prev', $sort, $dir) : ''; $nav[] = sp . small($page . '/' . $numPages) . sp; $nav[] = $page != $numPages ? PrevNextLink("list", $page + 1, gTxt('next'), 'next', $sort, $dir) : ''; if ($nav) { return graf(join('', $nav), ' align="center"'); } }
function cat_event_category_list($event) { $out = n . n . hed(gTxt($event . '_head') . sp . popHelp($event . '_category'), 3) . form(fInput('text', 'title', '', 'edit', '', '', 20) . fInput('submit', '', gTxt('Create'), 'smallerbox') . eInput('category') . sInput('cat_' . $event . '_create'), '', '', 'post', 'action-create ' . $event); $rs = getTree('root', $event); if ($rs) { $total_count = array(); if ($event == 'article') { $rs2 = safe_rows_start('Category1, count(*) as num', 'textpattern', "1 = 1 group by Category1"); while ($a = nextRow($rs2)) { $name = $a['Category1']; $num = $a['num']; $total_count[$name] = $num; } $rs2 = safe_rows_start('Category2, count(*) as num', 'textpattern', "1 = 1 group by Category2"); while ($a = nextRow($rs2)) { $name = $a['Category2']; $num = $a['num']; if (isset($total_count[$name])) { $total_count[$name] += $num; } else { $total_count[$name] = $num; } } } else { switch ($event) { case 'link': $rs2 = safe_rows_start('category, count(*) as num', 'txp_link', "1 group by category"); break; case 'image': $rs2 = safe_rows_start('category, count(*) as num', 'txp_image', "1 group by category"); break; case 'file': $rs2 = safe_rows_start('category, count(*) as num', 'txp_file', "1 group by category"); break; } while ($a = nextRow($rs2)) { $name = $a['category']; $num = $a['num']; $total_count[$name] = $num; } } $items = array(); $ctr = 1; foreach ($rs as $a) { extract($a); // format count switch ($event) { case 'article': $url = 'index.php?event=list' . a . 'search_method=categories' . a . 'crit=' . $name; break; case 'link': $url = 'index.php?event=link' . a . 'search_method=category' . a . 'crit=' . $name; break; case 'image': $url = 'index.php?event=image' . a . 'search_method=category' . a . 'crit=' . $name; break; case 'file': $url = 'index.php?event=file' . a . 'search_method=category' . a . 'crit=' . $name; break; } $count = isset($total_count[$name]) ? '(' . href($total_count[$name], $url) . ')' : '(0)'; if (empty($title)) { $edit_link = '<em>' . eLink('category', 'cat_' . $event . '_edit', 'id', $id, gTxt('untitled')) . '</em>'; } else { $edit_link = eLink('category', 'cat_' . $event . '_edit', 'id', $id, $title); } $items[] = graf(checkbox('selected[]', $id, 0) . sp . str_repeat(sp . sp, $level * 2) . $edit_link . sp . small($count), ' class="' . ($ctr % 2 == 0 ? 'even' : 'odd') . ' level-' . $level . '"'); $ctr++; } if ($items) { $out .= cat_article_multiedit_form($event, $items); } } else { $out .= graf(gTxt('no_categories_exist')); } return $out; }
function render_article_table() { $event = $this->parent->event; # # Pager calculations... # extract(get_prefs()); # Need to do this to keep the articles/page count in sync. extract(gpsa(array('page'))); $total = MLPArticles::get_total(); $limit = max(@$article_list_pageby, 15); list($page, $offset, $numPages) = pager($total, $limit, $page); # # User permissions... # $can_delete = has_privs('article.delete'); $can_clone = has_privs('l10n.clone'); # # Init language related vars... # $langs = MLPLanguageHandler::get_site_langs(); $full_lang_count = count($langs); $default_lang = MLPLanguageHandler::get_site_default_lang(); # # Render the filter/search form... # $o[] = $this->_render_filter_form($page); # # Start the table... # $o[] = startTable('l10n_articles_table', '', '', '5px'); $o[] = '<caption><strong>' . gTxt('l10n-renditions') . '</strong></caption>'; $rendition_counts = $this->get_rendition_counts(); # # Setup the colgroup/thead... # $colgroup[] = n . t . '<col id="id" />'; $thead[] = tag(gTxt('articles'), 'th', ' class="id"'); foreach ($langs as $lang) { $colgroup[] = n . t . '<col id="' . $lang . '" />'; $name = MLPLanguageHandler::get_native_name_of_lang($lang); $clone_all_link = ''; if (@$rendition_counts[$lang] < $total) { $clone_all_link = '<a href="' . $this->parent->url(array('page' => $page, 'step' => 'start_clone_all_from', 'target_lang' => $lang), true) . '" class="clone_all-link" title="' . gTxt('l10n-clone_all_from', array('{lang}' => $name)) . '"><img src="txp_img/l10n_clone_all.png" /></a>'; } # # Default language markup -- if needed. # if ($lang === $default_lang) { $name .= br . gTxt('default'); } else { $name .= ' ' . $clone_all_link; } $thead[] = hCell($name); $counts[$lang] = 0; } $o[] = n . tag(join('', $colgroup), 'colgroup'); $o[] = n . tr(join('', $thead)); $counts['article'] = 0; # Initialise the article count. $w = ''; # Var for td width -- set empty to skip its inclusion / other val overrides css. $body = array(); # # Process the articles table... # # Use values from the pager to grab the right sections of the table. # $articles = MLPArticles::get_articles('1=1', 'ID DESC', $offset, $limit); if (count($articles)) { while ($article = nextRow($articles)) { $num_visible = 0; # Holds a count of visible (=Sticky/Live) translations of this article. $trclass = ''; # Class for the row (=article) $cells = array(); # List of table cells (=translations) in this row $sections = array(); # Holds a list of the unique sections used by translations in this article. # # Pull out the article (NB: Not translation!)... # extract($article); $members = unserialize($members); $n_translations_expected = count($members); # # Pull the translations for this article from the master translations table # (that is, from the textpattern table)... # $translations = safe_rows('*', 'textpattern', L10N_COL_GROUP . "={$ID}"); $n_translations = count($translations); $n_valid_translations = 0; # # Index the translations for later use... # $index = array(); $tr_statuses = array(); $tr_sections = array(); $tr_authors = array(); for ($i = 0; $i < $n_translations; $i++) { $lang = $translations[$i][L10N_COL_LANG]; if (in_array($lang, $langs)) { $n_valid_translations++; $index[$lang] = $i; # # Record the sections/status/authors for possible filtering... # $tr_sections[$lang] = $translations[$i]['Section']; $tr_statuses[$lang] = $translations[$i]['Status']; $tr_authors[$lang] = $translations[$i]['AuthorID']; } else { continue; } # # Check that the translation is recorded in the article members! # if (!array_key_exists($lang, $members)) { $this->parent->message = gTxt('l10n-missing_rendition', array('{id}' => $ID)); $members[$lang] = (int) $translations[$i]['ID']; MLPArticles::_update_article($ID, $names, $members); $n_valid_translations++; } else { $master_id = (int) $translations[$i]['ID']; $rend_id = (int) $members[$lang]; if ($master_id != $members[$lang]) { //echo br , "Found incorrect rendition ID $rend_id in article table. Replacing with ID $master_id."; $members[$lang] = $master_id; MLPArticles::_update_article($ID, $names, $members); $n_valid_translations++; } } } # # Are all expected translations present? # $all_translations_present = $n_valid_translations === $full_lang_count; # # Apply filters... # $res = $this->_apply_filter('match_section', $tr_sections, $tr_sections); $res = $this->_apply_filter('match_author', $tr_authors, $res); $res = $this->_apply_filter('match_status', $tr_statuses, $res); if (empty($res)) { continue; } # # This article has at least one translation that passes the filter so increment the article count... # $counts['article'] += 1; # # Compose the leading (article) cell... # if ($can_delete) { $delete_art_link = '<a href="' . $this->parent->url(array('page' => $page, 'step' => 'delete_article', 'article' => $ID), true) . '" title="' . gTxt('delete') . ' ' . gTxt('article') . '" class="clone-link" onclick="return verify(\'' . doSlash(gTxt('confirm_delete_popup')) . '\')"><img src="txp_img/l10n_delete.png" /></a>'; } else { $delete_art_link = ''; } $cells[] = td($delete_art_link . $ID . br . htmlspecialchars($names), '', 'id'); # # Compose the rest of the row - one cell per translation... # foreach ($langs as $lang) { if (!array_key_exists($lang, $members)) { if ($lang === $default_lang) { $cells[] = td(gTxt('default') . gTxt('l10n-missing'), $w, 'warning'); } else { $cells[] = td('', $w, 'empty'); } } else { # # Ok, there is a translation for this language so... # $tdclass = ''; $msg = ''; $id = $members[$lang]; # # Get the details for this translation # $i = $index[$lang]; $details = $translations[$i]; $author = $details['AuthorID']; $status_no = $details['Status']; if ($status_no >= 4) { $num_visible++; } $tdclass .= 'status_' . $status_no; $status = !empty($status_no) ? $this->statuses[$status_no] : ''; if (empty($details['Title'])) { $title = '<em>' . eLink('article', 'edit', 'ID', $id, gTxt('untitled')) . '</em>'; } else { $title = eLink('article', 'edit', 'ID', $id, $details['Title']); } # # Check for consistency with the group data... # Deprecated? if ($details[L10N_COL_LANG] != $lang) { $tdclass .= 'warning'; $msg = br . strong(gTxt('l10n-warn_lang_mismatch')) . br . "Art[{$lang}] : tsl[{$details[L10N_COL_LANG]}]"; } # # Grab the section and check for consistency across the row... # $section = $details['Section']; $sections[$section] = $ID; # # Make a clone link if possible... # if (!$can_clone or $all_translations_present) { $clone_link = ''; } else { $clone_link = '<a href="' . $this->parent->url(array('page' => $page, 'step' => 'start_clone', 'rendition' => $id, 'article' => $ID), true) . '" class="clone-link" title="' . gTxt('l10n-clone') . '"><img src="txp_img/l10n_clone.png" /></a>'; } # # Make the delete link... # if ($can_delete) { $delete_trans_link = '<a href="' . $this->parent->url(array('page' => $page, 'step' => 'delete_rendition', 'rendition' => $id), true) . '" title="' . gTxt('delete') . '" class="delete-link" onclick="return verify(\'' . doSlash(gTxt('confirm_delete_popup')) . '\')"><img src="txp_img/l10n_delete.png" /></a>'; } else { $delete_trans_link = ''; } $content = $delete_trans_link . strong($title) . br . small($section . ' — ' . $author) . $msg . $clone_link; $cells[] = td($content, $w, trim($tdclass)); $counts[$lang] += 1; } } # # Tag articles which are fully visible or have warnings... # if (count($sections) != 1) { $trclass .= ' warning'; $cells[0] = td($ID . br . gTxt('l10n-warn_section_mismatch'), $w, 'id'); } else { if ($num_visible == $full_lang_count) { $trclass .= ' fully_visible'; } } $trclass .= 0 == ($counts['article'] & 0x1) ? '' : ' odd'; $trclass = trim($trclass); if (!empty($trclass)) { $trclass = ' class="' . $trclass . '"'; } $css_id = ' id="article_' . $ID . '"'; $body[] = n . tr(n . join('', $cells), $css_id . $trclass); } } # # Show the counts for the page... # $show_legend = '1' == $this->pref('l10n-show_legends') ? true : false; if ($show_legend) { $cells = array(); $cells[] = td($counts['article'], '', 'id count'); foreach ($langs as $lang) { $cells[] = td($counts[$lang], '', 'count'); } $body[] = n . tr(n . join('', $cells)); # # Show the table legend... # $cells = array(); $l[] = $this->add_legend_item('status_1', $this->statuses[1]); $l[] = $this->add_legend_item('status_2', $this->statuses[2] . '/' . gTxt('none')); $l[] = $this->add_legend_item('status_3', $this->statuses[3]); $l[] = $this->add_legend_item('status_4', $this->statuses[4]); $l[] = $this->add_legend_item('status_5', $this->statuses[5]); $l[] = br . br; $l[] = $this->add_legend_item('fully_visible', gTxt('l10n-legend_fully_visible')); $l[] = $this->add_legend_item('warning', gTxt('l10n-legend_warning')); if ($can_delete or $can_clone) { $l[] = br . br; } if ($can_delete) { $l[] = t . tag('<img src="txp_img/l10n_delete.png" />', 'dt') . n; $l[] = t . tag(gTxt('delete'), 'dd') . n; } if ($can_clone) { $l[] = t . tag('<img src="txp_img/l10n_clone.png" />', 'dt') . n; $l[] = t . tag(gTxt('l10n-clone'), 'dd') . n; } $l = tag(n . join('', $l), 'dl'); $cells[] = tdcs($l, $full_lang_count + 1, '', 'legend'); $body[] = n . tr(n . join('', $cells)); } $o[] = tag(join('', $body), 'tbody'); $o[] = endTable(); $o[] = n . nav_form($event, $page, $numPages, '', '', '', ''); $o[] = n . pageby_form($event, max(@$article_list_pageby, 15)); echo join('', $o); }
public function subscription_form($model, $action = "", $handle = false, $show_name_field = true, $extra1 = false, $extra2 = false, $image_submit = false) { if (!$handle) { $handle = "all_sections"; } $form = '<div id="subscription-form"> <form action="' . $action . '" method="post" class="form_container">' . hidden_field($model, "handle", array('value' => $handle)) . hidden_field($model, "status", array('value' => 1)) . '<fieldset>'; if ($show_name_field) { $form .= large(text_field($model, "name", array(), "Name <span class='mandatory'>*</span>")) . form_divider(); } $form .= large(text_field($model, "email", array(), "Email <span class='mandatory'>*</span>")); if ($extra1) { $form .= form_divider() . large(text_field($model, "extra1", array(), $extra1)); } if ($extra2) { $form .= form_divider() . large(text_field($model, "extra2", array(), $extra2)); } $form .= form_divider() . '<span id="mandatory">* Compulsory fields</span>'; if ($image_submit) { $form .= image_submit_tag($image_submit, array('alt' => "submit button", "title" => "Submit")); } else { $form .= small(submit_field($model, "Subscribe")); } $form .= '</fieldset> </form> </div>'; return $form; }
function comment($c, $mod) { $vb = comm_vote_buttons($c); $title = strong("\t(" . ($c["votes"] > 0 ? "+" : "") . $c["votes"] . ") " . $c["username"], "comm-title", "comm-title-" . $c["comm_id"]); $time = small("(" . $c["time"] . ")", "comm-time", "comm-time-" . $c["comm_id"]); $text = div(par($c["status"] == "DELETED" ? "[DELETED]" : $c["text"], "comm-text comm-text-deleted", "comm-text-" . $c["comm_id"]), "well"); if ($c["status"] != "DELETED") { // reply button $reply = a("", "btn btn-xs btn-link comm-reply"); $reply["data"] = "reply"; $reply["attribs"]["data-toggle"] = "modal"; $reply["attribs"]["data-target"] = "#new-comm"; $reply["attribs"]["value"] = $c["comm_id"]; // report button $rept = a("", "btn btn-xs btn-link comm-report"); $rept["data"] = "report"; $rept["attribs"]["data-toggle"] = "modal"; $rept["attribs"]["data-target"] = "#report-comm"; $rept["attribs"]["value"] = $c["comm_id"]; $rept["attribs"]["style"] = "float:right;"; // delete button $del = a("", "btn btn-xs btn-link comm-del"); $del["data"] = "delete"; $del["attribs"]["data-toggle"] = "modal"; $del["attribs"]["data-target"] = "#del-comm"; $del["attribs"]["value"] = $c["comm_id"]; $del["attribs"]["style"] = "float:right;"; // add buttons $text["children"][] = hr(); $text["children"][] = $reply; $text["children"][] = $mod ? $del : $rept; } $final = div($vb, "well" . ($c["anc_id"] != $c["comm_id"] ? " col-sm-offset-1" : "")); $final["children"][] = $title; $final["children"][] = $time; $final["children"][] = $text; return $final; }
function getDbInfo() { $lang = $this->vars['lang'] = ps('lang'); $GLOBALS['textarray'] = $this->_load_lang(); @(include txpath . '/config.php'); # this should be on the top most method of the controller! if (!empty($txpcfg['db'])) { $this->setup_error(gTxt('already_installed', array('{txpath}' => txpath))); } $temp_txpath = txpath; if (@$_SERVER['SCRIPT_NAME'] && (@$_SERVER['SERVER_NAME'] || @$_SERVER['HTTP_HOST'])) { $guess_siteurl = @$_SERVER['HTTP_HOST'] ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']; $guess_siteurl .= $this->rel_siteurl; } else { $guess_siteurl = 'mysite.com'; } #$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">' . '<table id="setup" cellpadding="0" cellspacing="0" border="0">' . tr(tda(hed(gTxt('welcome_to_textpattern'), 3) . graf(gTxt('need_details'), ' style="margin-bottom:3em"') . hed(gTxt('database'), 3) . graf(gTxt('db_must_exist')), ' width="400" height="50" colspan="4" align="left"')) . tr(fLabelCell(gTxt('setup_db_login')) . fInputCell('duser', '', 1) . fLabelCell(gTxt('setup_db_password')) . fInputCell('dpass', '', 2)) . tr(fLabelCell(gTxt('setup_db_server')) . fInputCell('dhost', 'localhost', 3) . fLabelCell(gTxt('setup_db_database')) . fInputCell('ddb', '', 4)) . tr(fLabelCell(gTxt('table_prefix')) . fInputCell('dprefix', '', 5) . tdcs(small(gTxt('prefix_warning')), 2)) . tr(fLabelCell(gTxt('database_engines')) . td($this->_availableDBDrivers()) . tdcs(' ', 2)) . tr(tdcs(' ', 4)) . tr(tdcs(hed(gTxt('site_path'), 3) . graf(gTxt('confirm_site_path')), 4)) . tr(fLabelCell(gTxt('full_path_to_txp')) . tdcs(fInput('text', 'txpath', $temp_txpath, 'edit', '', '', 40) . popHelp('full_path'), 3)) . tr(tdcs(' ', 4)) . tr(tdcs(hed(gTxt('site_url'), 3) . graf(gTxt('please_enter_url')), 4)) . tr(fLabelCell('http://') . tdcs(fInput('text', 'siteurl', $guess_siteurl, 'edit', '', '', 40) . popHelp('siteurl'), 3)); if (!is_callable('mail')) { $this->_step_view .= tr(tdcs(gTxt('warn_mail_unavailable'), 3, null, '" style="color:red;text-align:center')); } $this->_step_view .= tr(td() . td(fInput('submit', 'Submit', gTxt('next'), 'publish')) . td() . td()); $this->_step_view .= endTable() . hInput('lang', $lang) . sInput('printConfig') . '</form>'; }
function nav_form($event, $page, $numPages, $sort, $dir, $crit, $method) { if (function_exists('nav_form')) { return nav_form($event, $page, $numPages, $sort, $dir, $crit, $method); } // This is basically stolen from the 4.0.3 version of includes/txp_list.php // - list_nav_form() for 4.0.3 compatibitly $nav[] = $page > 1 ? PrevNextLink($event, $page - 1, gTxt('prev'), 'prev', $sort, $dir) : ''; $nav[] = sp . small($page . '/' . $numPages) . sp; $nav[] = $page != $numPages ? PrevNextLink($event, $page + 1, gTxt('next'), 'next', $sort, $dir) : ''; return $nav ? graf(join('', $nav), ' align="center"') : ''; }
function zem_event_cat_tab_multiedit_form($items) { $methods = array('delete' => gTxt('delete')); echo n . form(join('', $items) . n . eInput('zem_event_cats') . n . sInput('multi') . small(gTxt('with_selected')) . sp . selectInput('edit_method', $methods, '', 1) . sp . fInput('submit', '', gTxt('go'), 'smallerbox'), 'margin-top: 1em', "verify('" . gTxt('are_you_sure') . "')"); }
public function getFiles($type) { if ($type === "images") { $HTML = openUl("i-add-upload", "add-upload"); } elseif ($type === "documents") { $HTML = openUl("d-add-upload", "add-upload"); } $path = POST($this->px . "Dirbase") ? POST($this->px . "Dirbase") : $this->path; $path = POST($this->px . "Make") ? POST($this->px . "Dir") . slug(POST($this->px . "Dirname")) : $path; $files = $this->getPath($path); if (is_array($files)) { for ($i = 0; $i <= count($files) - 1; $i++) { if ($type === "images") { $img = '\'<img src=\\\'' . _webURL . _sh . $path . $files[$i] . '\\\' alt=\\\'' . $files[$i] . '\\\' />\''; if ($i < 9) { $num = "0" . ($i + 1); } else { $num = $i + 1; } unset($attributes); $attributes = array("name" => $this->px . "Library[]", "value" => $path . $files[$i]); $attrs = array("onclick" => "javascript:insertHTML({$img});", "class" => "pointer", "title" => __(_("Insert Image"))); $HTML .= li(formCheckbox($attributes) . " " . small($num) . a(span("tiny-image tiny-search", " "), _webURL . _sh . $path . $files[$i], FALSE, array("title" => __(_("Preview image")))) . a(span("tiny-image tiny-add", " ") . $files[$i], FALSE, FALSE, $attrs)); } elseif ($type == "documents") { $file = $this->Files->getFileInformation($files[$i]); $img = '\'<a href=\\\'' . _webURL . _sh . $path . $files[$i] . '\\\' title=\\\'' . $files[$i] . '\\\'><img src=\\\'' . $file["icon"][0] . '\\\' alt=\\\'' . $files[$i] . '\\\' /></a>\''; if ($i < 9) { $num = "0" . ($i + 1); } else { $num = $i + 1; } $attributes = array("name" => $this->px . "Library[]", "value" => $path . $files[$i]); unset($attrs); $attrs = array("title" => __(_("Insert file")), "class" => "pointer", "onclick" => "javascript:insertHTML({$img});"); $span = span("tiny-image tiny-file", " "); $HTML .= li(formCheckbox($attributes) . " " . small($num) . a($span, _webURL . _sh . $path . $files[$i], FALSE, array("title" => __(_("Download file")))) . a(span("tiny-image tiny-add", " ") . $files[$i], FALSE, FALSE, $attrs)); } } $HTML .= closeUl(); } return $HTML; }
function category_list($type) { $out = n . n . hed(gTxt($type . '_head') . sp . popHelp($type . '_category'), 3) . form(fInput('text', 'title', '', 'edit', '', '', 20) . fInput('submit', '', gTxt('Create'), 'smallerbox') . eInput('category') . sInput('create') . hInput('type', $type)); $rs = tree_get('txp_category', NULL, "parent != 0 and type='" . doSlash($type) . "'"); if ($rs) { $total_count = array(); if ($type == 'article') { $rs2 = safe_rows_start('Category1, count(*) as num', 'textpattern', "1 = 1 group by Category1"); while ($a = nextRow($rs2)) { $name = $a['Category1']; $num = $a['num']; $total_count[$name] = $num; } $rs2 = safe_rows_start('Category2, count(*) as num', 'textpattern', "1 = 1 group by Category2"); while ($a = nextRow($rs2)) { $name = $a['Category2']; $num = $a['num']; if (isset($total_count[$name])) { $total_count[$name] += $num; } else { $total_count[$name] = $num; } } } else { if ($type == 'link') { $rs2 = safe_rows_start('category, count(*) as num', 'txp_link', "1 group by category"); } elseif ($type == 'image') { $rs2 = safe_rows_start('category, count(*) as num', 'txp_image', "1 group by category"); } elseif ($type == 'file') { $rs2 = safe_rows_start('category, count(*) as num', 'txp_file', "1 group by category"); } if (!empty($rs2)) { while ($a = nextRow($rs2)) { $name = $a['category']; $num = $a['num']; $total_count[$name] = $num; } } } $items = array(); foreach ($rs as $a) { extract($a); if ($type == 'article') { $url = 'index.php?event=list' . a . 'search_method=categories' . a . 'crit=' . $name; } elseif ($type == 'link') { $url = 'index.php?event=link' . a . 'search_method=category' . a . 'crit=' . $name; } elseif ($type == 'image') { $url = 'index.php?event=image' . a . 'search_method=category' . a . 'crit=' . $name; } elseif ($type == 'file') { $url = 'index.php?event=file' . a . 'search_method=category' . a . 'crit=' . $name; } else { $url = ''; } $count = ''; if ($url) { $count = isset($total_count[$name]) ? '(' . href($total_count[$name], $url) . ')' : '(0)'; } if (empty($title)) { $edit_link = '<em>' . eLink('category', 'edit', 'id', $id, gTxt('untitled'), 'type', $type) . '</em>'; } else { $edit_link = eLink('category', 'edit', 'id', $id, $title, 'type', $type); } $items[] = graf(checkbox('selected[]', $id, 0) . sp . str_repeat(sp . sp, $level * 2) . $edit_link . sp . small($count)); } if ($items) { $out .= $this->multiedit_form($type, $items); } } else { $out .= graf(gTxt('no_categories_exist')); } return $out; }
function article_multiedit_form($area, $array) { $methods = array('delete' => 'delete'); if ($array) { return form(join('', $array) . eInput('category') . sInput('category_multiedit') . hInput('type', $area) . small(gTxt('with_selected')) . sp . selectInput('method', $methods, '', 1) . sp . fInput('submit', '', gTxt('go'), 'smallerbox'), 'margin-top:1em', "verify('" . gTxt('are_you_sure') . "')"); } return; }
<?php return Snil(form(array('action' => '/report', 'method' => 'post'), Sc('address'), h1(small('Currently: '), Sd('address'), br(), Snil(Sc('sweep', true), small('That street is swept: '), Sd('sweep'), ' ', Sif(Sc('inaccurate', true), '(inaccurate)'), Sif(Sc('inaccurate', false), small(small(input(array('type' => 'submit', 'value' => 'Report as inaccurate', 'class' => 'link')))))), Sif(Sc('sweep', false), Sc('impossible', true), small('This address was impossible to geocode')), Sif(Sc('sweep', false), Sc('impossible', false), small('Street sweeping information will be available shortly ', small(a(array('href' => '/home'), 'Refresh')))))), form(array('action' => Sd('URL'), 'method' => 'post'), p(label(array('for' => 'address'), 'My car is at...'), br(), input(array('id' => 'address', 'name' => 'address', 'type' => 'text', 'value' => Sd('new_address'), 'class' => 'text stretch')), br(), 'Only the closest street number and the street name, please.', br(), small('Don’t choose a corner address because SF GIS might return inaccurate street sweeping data. Make sure you use the proper side of the street so we can accurately predict the street sweeping schedule.')), p(input(array('type' => 'submit', 'value' => 'Update', 'class' => 'button')))), Sif(Sc('need_confirm_sms'), h2('Confirm your cell phone number for SMS'), form(array('action' => '/confirm/sms', 'method' => 'post'), p(label(array('for' => 'code'), 'SMS confirmation code:'), br(), input(array('id' => 'code', 'name' => 'code', 'type' => 'text', 'class' => 'text stretch')), br(), small('Enter the code sent to your cell phone to have reminders sent to your phone.')), p(input(array('type' => 'submit', 'value' => 'Confirm', 'class' => 'button'))))));
function file_list($message = '') { global $txpcfg, $extensions, $file_base_path; extract($txpcfg); extract(get_prefs()); pagetop(gTxt('file'), $message); $page = gps('page'); $total = getCount('txp_file', "1=1"); $limit = max(@$file_list_pageby, 25); $numPages = ceil($total / $limit); $page = !$page ? 1 : $page; $offset = ($page - 1) * $limit; $sort = gps('sort'); $dir = gps('dir'); $sort = $sort ? $sort : 'filename'; $dir = $dir ? $dir : 'desc'; if ($dir == "desc") { $dir = "asc"; } else { $dir = "desc"; } $existing_files = get_filenames(); echo startTable('list'), tr(tda(file_upload_form(gTxt('upload_file'), 'upload', 'file_insert'), ' colspan="4" style="border:0"')), count($existing_files) > 0 ? tr(tda(form(graf(gTxt('existing_file') . sp . selectInput('filename', $existing_files, "", 1) . sp . fInput('submit', '', gTxt('Create'), 'smallerbox') . sp . eInput('file') . sInput('file_create'))), ' colspan="4" style="border:0"')) : '', tr(column_head('Id', 'id', 'file', 1, $dir) . column_head('file_name', 'filename', 'file', 1, $dir) . td(gTxt('status')) . td(gTxt('tags')) . column_head('file_category', 'category', 'file', 1, $dir) . column_head('description', 'description', 'file', 1, $dir) . column_head('downloads', 'downloads', 'file', 1, $dir) . td()); $nav[] = $page > 1 ? PrevNextLink("file", $page - 1, gTxt('prev'), 'prev') : ''; $nav[] = sp . small($page . '/' . $numPages) . sp; $nav[] = $page != $numPages ? PrevNextLink("file", $page + 1, gTxt('next'), 'next') : ''; $rs = safe_rows_start("*", "txp_file", "1=1 order by {$sort} {$dir} limit {$offset}, {$limit}"); if ($rs) { while ($a = nextRow($rs)) { extract($a); // does the downloads column exist? if (!isset($downloads)) { // nope, add it safe_alter("txp_file", "ADD downloads INT DEFAULT '0' NOT NULL"); $downloads = 0; } else { if (empty($downloads)) { $downloads = '0'; } } $elink = eLink('file', 'file_edit', 'id', $id, $filename); $dlink = dLink('file', 'file_delete', 'id', $id); //Add tags helper $txtilelink = '<a target="_blank" href="?event=tag' . a . 'name=file' . a . 'id=' . $id . a . 'description=' . urlencode($description) . a . 'filename=' . urlencode($filename) . a . 'type=textile" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">Textile</a>'; $txplink = '<a target="_blank" href="?event=tag' . a . 'name=file' . a . 'id=' . $id . a . 'description=' . urlencode($description) . a . 'filename=' . urlencode($filename) . a . 'type=textpattern" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">Textpattern</a>'; $xhtmlink = '<a target="_blank" href="?event=tag' . a . 'name=file' . a . 'id=' . $id . a . 'description=' . urlencode($description) . a . 'filename=' . urlencode($filename) . a . 'type=xhtml" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">XHTML</a>'; $file_exists = file_exists(build_file_path($file_base_path, $filename)); $missing = '<span style="color:'; $missing .= $file_exists ? 'green' : 'red'; $missing .= '">'; $missing .= $file_exists ? gTxt('file_status_ok') : gTxt('file_status_missing'); $missing .= '</span>'; $downloadlink = $file_exists ? make_download_link($id, $filename, $id) : $id; echo tr(td($downloadlink) . td($elink) . td($missing) . td($txtilelink . ' / ' . $txplink . ' / ' . $xhtmlink) . td($category, 90) . td($description, 150) . td($downloads == '0' ? " 0" : $downloads, 20) . td($dlink, 10)); } echo tr(tdcs(graf(join('', $nav)), 4)); } echo endTable(); echo pageby_form('file', $file_list_pageby); if (!is_dir($file_base_path) or !is_writeable($file_base_path)) { echo graf(str_replace("{filedir}", $file_base_path, gTxt('file_dir_not_writeable')), ' style="text-align:center;color:red"'); } }
function event_category_list($evname) { global $prefs; if ($evname == 'article') { $headspan = $prefs['show_article_category_count'] ? 3 : 2; } $o = hed(gTxt($evname . '_head') . popHelp($evname . '_category'), 3); $o .= form(fInput('text', 'name', '', 'edit', '', '', 10) . fInput('submit', '', gTxt('Create'), 'smallerbox') . eInput('category') . sInput($evname . '_create')); $rs = getTree('root', $evname); if ($rs) { foreach ($rs as $a) { extract($a); if ($name == 'root') { continue; } //Stuff for articles only if ($evname == 'article' && $prefs['show_article_category_count']) { $sname = doSlash($name); $count = sp . small(safe_count("textpattern", "((Category1='{$sname}') or (Category2='{$sname}'))")); } else { $count = ''; } $cbox = checkbox('selected[]', $id, 0); $editlink = eLink('category', $evname . '_edit', 'id', $id, $title); $items[] = graf($cbox . sp . str_repeat(sp, max(0, $level - 1) * 2) . $editlink . $count); } if (!empty($items)) { $o .= article_multiedit_form($evname, $items); } } return $o; }
{ $res = mb_strtolower($b); echo $res; } function match($c, $find) { $res = preg_match($find, $c); echo $find . "is found" . $res . "times"; } $b = 'как си днес бе, момче'; $d = 'how are you today'; $e = 'how'; echo "големи - "; big($b); echo "<p>малки - "; small('ДОБРЕ ДЕ ДОБРЕ,ДОБРЕ'); echo "</p>"; if (empty($_GET['check'])) { echo "<p>Check if some word is in entered text bellow:"; echo "<form action='probba16.php' method='get'>"; echo "<p>Enter the text</p>"; echo "<input type='text' name='check' placeholder='enter some text...'>"; echo "<p>Enter the word you want to check if is there : </p>"; echo "<p><input type='text' name='check_word' placeholder='enter the word...'></p>"; echo "<input type='submit' name='submit' value='go'>"; echo "</form>"; } else { $word = $_GET['check_word']; match($_GET['check'], "/{$word}/"); echo "</p>"; }
function required() { return small(translate('required')); }
public function summary_orders() { $today = $this->site_model->get_db_now(null, true); $args = array(); $args["DATE(trans_sales.datetime)"] = $today; $orders = array(); $ords = $this->cashier_model->get_trans_sales(null, $args); $types = unserialize(SALE_TYPES); $set = $this->cashier_model->get_pos_settings(); if (count($set) > 0) { $types = array(); $ids = explode(',', $set->controls); foreach ($ids as $value) { $text = explode('=>', $value); if ($text[0] == 1) { $types[] = 'dinein'; } elseif ($text[0] == 7) { $types[] = 'drivethru'; } else { $types[] = $text[1]; } } } $status = array('Open' => 'blue', 'Settled' => 'green', 'Cancel' => 'yellow', 'Void' => 'red'); foreach ($types as $typ) { $open = 0; $settled = 0; $cancel = 0; $void = 0; foreach ($ords as $res) { if (strtolower($res->type) == strtolower($typ)) { if ($res->type_id == 10) { if ($res->trans_ref != "" && $res->inactive == 0) { $settled += $res->total_amount; } elseif ($res->trans_ref == "") { if ($res->inactive == 0) { $open += $res->total_amount; } else { $cancel += $res->total_amount; } } } else { $void += $res->total_amount; } } } $orders[$typ] = array('label' => $typ, 'open' => $open, 'settled' => $settled, 'cancel' => $cancel, 'void' => $void); } $shift_sales = array(); foreach ($ords as $res) { if ($res->type_id == 10) { if ($res->trans_ref != "" && $res->inactive == 0) { if (isset($shift_sales[$res->shift_id])) { $shift_sales[$res->shift_id] += $res->total_amount; } else { $shift_sales[$res->shift_id] = $res->total_amount; } } } } $shifts = array(); foreach ($shift_sales as $shift_id => $total) { if (!in_array($shift_id, $shifts)) { $shifts[] = $shift_id; } } $shs = array(); if (count($shifts) > 0) { $select = "shifts.shift_id,users.username,users.fname,users.mname,users.lname,users.suffix"; $joinTables['users'] = array('content' => 'shifts.user_id = users.id'); $sh = $this->site_model->get_tbl('shifts', array('shift_id' => $shifts), array(), $joinTables, true, $select); foreach ($sh as $res) { // $shs[$res->shift_id] = array('label'=>$res->fname." ".$res->mname." ".$res->lname." ".$res->suffix,'value'=>numInt($shift_sales[$res->shift_id]) ); $shs[$res->shift_id] = array('label' => $res->username, 'value' => numInt($shift_sales[$res->shift_id])); } } if (count($shs) == 0) { $shs[] = array('label' => 'No Sales Found', 'value' => numInt(0)); } $total_trans = 0; $stat = array(); $total_sales = 0; foreach ($orders as $type => $opt) { foreach ($opt as $txt => $val) { if ($txt != 'label') { if (isset($stat[strtolower($txt)])) { $stat[strtolower($txt)] += $val; } else { $stat[strtolower($txt)] = $val; } $total_trans += $val; if ($txt == 'open' || $txt == 'settled') { $total_sales += $val; } } } } // <div class="row"> // <div class="col-xs-4 text-center" style="border-right: 1px solid #f4f4f4"> // <input type="text" class="knob" data-readonly="true" value="80" data-width="60" data-height="60" data-fgColor="#f56954"/> // <div class="knob-label">CPU</div> // </div><!-- ./col --> // <div class="col-xs-4 text-center" style="border-right: 1px solid #f4f4f4"> // <input type="text" class="knob" data-readonly="true" value="50" data-width="60" data-height="60" data-fgColor="#00a65a"/> // <div class="knob-label">Disk</div> // </div><!-- ./col --> // <div class="col-xs-4 text-center"> // <input type="text" class="knob" data-readonly="true" value="30" data-width="60" data-height="60" data-fgColor="#3c8dbc"/> // <div class="knob-label">RAM</div> // </div><!-- ./col --> // </div><!-- /.row --> $this->make->sDivRow(); foreach ($status as $txt => $color) { $this->make->sDivCol(6, 'center'); if ($total_trans == 0 || $stat[strtolower($txt)] == 0) { $percent = 0; } else { $percent = $stat[strtolower($txt)] / $total_trans * 100; } $this->make->append(' <div class="knob-label">' . $txt . '</div> <input type="text" class="knob" data-readonly="true" value="' . num($percent, 0) . '" data-skin="tron" data-thickness="0.2" data-angleArc="250" data-angleOffset="-125" data-width="100" data-height="100" data-fgColor="' . $color . '"/> <div class="knob-label">' . small(num($stat[strtolower($txt)]) . "/" . num($total_trans)) . '</div> '); $this->make->eDivCol(); // $this->make->sDiv(array('class'=>'clearfix')); // $this->make->span($txt,array('class'=>'pull-left')); // $this->make->span(small( num($stat[strtolower($txt)]) ."/".num($total_trans) ),array('class'=>'pull-right')); // $this->make->eDiv(); // $this->make->sDiv(array('style'=>'margin-bottom:10px;')); // $this->make->progressBar($total_trans,$stat[strtolower($txt)],null,0,$color,array()); // $this->make->eDiv(); } $this->make->eDivRow(); $code = $this->make->code(); echo json_encode(array("orders" => $orders, 'shift_sales' => $shs, 'types' => $types, 'code' => $code)); }
function jmc_nav_form($event, $step, $filters) { $nav[] = $filters['page'] > 1 ? jmc_PrevNextLink($event, $step, $filters['page'] - 1, gTxt('prev'), 'prev', $filters['sort'], $filters['dir']) : ''; $nav[] = sp . small($filters['page'] . '/' . $filters['pages']) . sp; $nav[] = $filters['page'] != $filters['pages'] ? jmc_PrevNextLink($event, $step, $filters['page'] + 1, gTxt('next'), 'next', $filters['sort'], $filters['dir']) : ''; if ($nav) { return graf(join('', $nav), ' align="center"'); } }