function view_stats() { if (!privs()) { die; } $ou = $_GET["ou"]; $users = new usersMenus(); sql_domain($ou); $sql = "SELECT COUNT( ID ) AS tcount, DATE_FORMAT( time_stamp, '%m-%d' ) AS tday\nFROM smtp_logs\nWHERE {$GLOBALS["SQL_DOMAINS"]}\nAND time_stamp > DATE_ADD( NOW( ) , INTERVAL -7\nDAY )\nGROUP BY DATE_FORMAT( time_stamp, '%m-%d' )"; $q = new mysql(); //echo $sql; $g = new artica_graphs($fileName, 60); $results = $q->QUERY_SQL($sql, "artica_events"); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $g->ydata[] = $ligne["tcount"]; $g->xdata[] = $ligne["tday"]; } //print_r($g->ydata); $fileName = "/usr/share/artica-postfix/ressources/logs/web/{$ou}-stats-7.png"; $g->title = "Inbound messages"; $g->x_title = "messages number"; $g->y_title = "days-month"; $g->width = 700; $g->filename = $fileName; $g->line_green(); echo "<img src='ressources/logs/web/{$ou}-stats-7.png'>"; }
function corrupt() { $users = new usersMenus(); $tpl = new templates(); if (privs()) { $error = $tpl->_ENGINE_parse_body("{ERROR_NO_PRIVS}"); echo "<H3>{$error}<H3>"; die; } $users = new usersMenus(); $corrupt = $users->POSTFIX_QUEUE["corrupt"]; $tpl = new templates(); $title = $tpl->_ENGINE_parse_body("{APP_POSTFIX}"); $warning = $tpl->_ENGINE_parse_body("{$corrupt} {corrupt} mails\\n {corrupt_queue_confirm}", "postfix.index.php"); $pourc = 0; $table = Status(0); $color = "#5DD13D"; $html = "<H1>{APP_POSTFIX}: {$corrupt} {corrupt} eMail(s)</H1>\n\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td width=1%><span id='wait'><img src='img/wait.gif'></span>\n\t\t</td>\n\t\t<td width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t<td>\n\t\t\t\t<div style='width:100%;background-color:white;padding-left:0px;border:1px solid {$color}'>\n\t\t\t\t\t<div id='progression_postfix'>\n\t\t\t\t\t\t<div style='width:{$pourc}%;text-align:center;color:white;padding-top:3px;padding-bottom:3px;background-color:{$color}'>\n\t\t\t\t\t\t\t<strong style='color:#BCF3D6;font-size:12px;font-weight:bold'>{$pourc}%</strong></center>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\t\t\n\t\t</td>\n\t</tr>\n\t</table>\n\t<br>\n\t" . RoundedLightWhite("<div id='textlogs' style='width:99%;height:120px;overflow:auto'></div>") . ""; echo $tpl->_ENGINE_parse_body($html, "postfix.index.php"); }
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'); }
function new_author_form() { return form(hed(gTxt('add_new_author'), 3, ' style="margin-top: 2em; text-align: center;"') . graf(gTxt('a_message_will_be_sent_with_login'), ' style="text-align: center;"') . startTable('edit') . tr(fLabelCell('real_name') . fInputCell('RealName')) . tr(fLabelCell('login_name') . fInputCell('name')) . tr(fLabelCell('email') . fInputCell('email')) . tr(fLabelCell('privileges') . td(privs() . sp . popHelp('about_privileges'))) . tr(td() . td(fInput('submit', '', gTxt('save'), 'publish') . sp . popHelp('add_new_author'))) . endTable() . eInput('admin') . sInput('author_save_new')); }
/** * 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 author_form() { global $step, $txp_user; $vars = array('user_id', 'name', 'RealName', 'email', 'privs'); extract(gpsa($vars)); if ($user_id && $step == 'author_edit') { $user_id = assert_int($user_id); extract(safe_row('*', 'txp_users', "user_id = {$user_id}")); } if ($step == 'author_save' or $step == 'author_save_new') { foreach ($vars as $var) { ${$var} = ''; } } $caption = gTxt($step == 'author_edit' ? 'edit_author' : 'add_new_author'); return form(hed($caption, 3, ' style="text-align: center;"') . startTable('edit') . tr(fLabelCell('login_name') . ($user_id && $step == 'author_edit' ? td(strong($name)) : fInputCell('name', $name))) . tr(fLabelCell('real_name') . fInputCell('RealName', $RealName)) . tr(fLabelCell('email') . fInputCell('email', $email)) . tr(fLabelCell('privileges') . td(($txp_user != $name ? privs($privs) : hInput('privs', $privs) . strong(get_priv_level($privs))) . sp . popHelp('about_privileges'))) . tr(td() . td(fInput('submit', '', gTxt('save'), 'publish') . ($user_id ? '' : sp . popHelp('add_new_author')))) . endTable() . eInput('admin') . ($user_id ? hInput('user_id', $user_id) . sInput('author_save') : sInput('author_save_new'))); }
function pagetop($pagetitle, $message = "") { global $siteurl, $sitename, $txp_user, $event, $step, $app_mode, $theme; if ($app_mode == 'async') { return; } $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-' . htmlspecialchars($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> <script src="jquery.js" type="text/javascript"></script> <?php echo script_js('var textpattern = {event: "' . htmlspecialchars($event) . '", step: "' . htmlspecialchars($step) . '"};'); ?> <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) order by name asc"); $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, '') : ''; $rs = safe_column('name', 'txp_users', "privs not in(0,6) order by name asc"); $edit['author'] = $rs ? selectInput('author', $rs, '', true) : ''; } 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(); $rs = safe_column('name', 'txp_users', '1=1'); $edit_assign_assets = $rs ? selectInput('assign_assets', $rs, '', true) : ''; } // 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('', '-'), str_replace('</', '<\\/', addslashes($val))) . "<\\/span>';" . n . t . 'break;' . n . n; } if (isset($edit_assign_assets)) { echo "case 'delete':" . n . t . "pjs.innerHTML = '<label for=\"assign_assets\">" . addslashes(gTxt('assign_assets_to')) . "</label><span>" . str_replace(array("\n", '-'), array('', '-'), str_replace('</', '<\\/', addslashes($edit_assign_assets))) . "<\\/span>';" . n . t . 'break;' . n . n; } ?> default: pjs.style.display = 'none'; break; } } return false; } addEvent(window, 'load', cleanSelects); --> </script> <?php echo $theme->html_head(); callback_event('admin_side', 'head_end'); ?> </head> <body id="<?php echo $body_id; ?> " class="<?php echo $area; ?> "> <?php callback_event('admin_side', 'pagetop'); $theme->set_state($area, $event, $bm, $message); echo pluggable_ui('admin_side', 'header', $theme->header()); callback_event('admin_side', 'pagetop_end'); }
function new_author_form() { $out = array(hed(gTxt('add_new_author'), 3, ' align="center" style="margin-top:2em"'), graf(gTxt('a_message_will_be_sent_with_login'), ' align="center"'), startTable('edit'), tr(fLabelCell('real_name') . fInputCell('RealName')), tr(fLabelCell('login_name') . fInputCell('name')), tr(fLabelCell('email') . fInputCell('email')), tr(fLabelCell('privileges') . td(privs() . popHelp('about_privileges'))), tr(td() . td(fInput('submit', '', gTxt('save'), 'publish') . popHelp('add_new_author'))), endTable(), eInput('admin') . sInput('author_save_new')); return form(join('', $out)); }
function author_multiedit_form($page, $sort, $dir, $crit, $search_method) { $privileges = privs(); $rs = safe_column('name', 'txp_users', '1=1'); $assign_assets = $rs ? '<label for="assign_assets">' . gTxt('assign_assets_to') . '</label>' . n . selectInput('assign_assets', $rs, '', true, '', 'assign_assets') : ''; $methods = array('changeprivilege' => array('label' => gTxt('changeprivilege'), 'html' => $privileges), 'resetpassword' => gTxt('resetpassword'), 'delete' => array('label' => gTxt('delete'), 'html' => $assign_assets)); if (safe_count('txp_users', '1=1') <= 1) { unset($methods['delete']); } // Sorry guy, you're last. return multi_edit($methods, 'admin', 'admin_multi_edit', $page, $sort, $dir, $crit, $search_method); }