function my_get_title($len = 65) { if (!Registry::get('article')) { $title = site_name(); } else { $title = trim(Registry::prop('article', 'title')); } if (strlen($title) > $len) { $title = substr($title, 0, $len - 3) . '...'; } return preg_replace('/[\\n\\r\\t]+/', ' ', preg_replace('/\\s+/', ' ', $title)); }
function vapor_twitter_card() { $twitter = site_meta('twitter_account'); if ($twitter != '' || $twitter != NULL) { $title = article_id() ? article_title() : site_name(); $description = article_id() ? article_description() : site_description(); echo '<meta name="twitter:card" content="summary" /> <meta name="twitter:site" content="@' . str_replace('@', '', $twitter) . '" /> <meta name="twitter:title" content="' . $title . '" /> <meta name="twitter:description" content="' . $description . '" />'; } }
/** * 输出标题 * @param bool $out * @return mixed */ function pm_title($out = true) { $title = hook()->apply('pm_title_title', cfg()->get('theme', 'title')); $desc = hook()->apply('pm_title_title', cfg()->get('theme', 'desc')); if ($title === null) { $title = site_title(false); } if ($desc === null) { $desc = site_desc(false); } if (empty($desc)) { $out = hook()->apply('pm_title', $title); } else { $out = hook()->apply('pm_title', $title . " | " . site_name(false)); } if ($out) { echo $out; } return $out; }
<?php set_title(site_name() . ' - Galerie'); $smarty->assign('content_tpl', 'content/main/media');
<?php /** * @todo Un update major pentru clasament * @info Acesta functioneaza de minune, dar trebuie simplificat algoritmul **/ if (!defined('BASEPATH')) { exit('Nu poti accesa acest fisier direct.'); } set_title(site_name() . ' - Clasament jucatori'); $players = array(); $where = ''; $plain_args = Vars::get('plain_args'); $page = 1; if (preg_match('/page-([0-9]+)/i', $plain_args, $match)) { $page = (int) $match[1] > 0 ? $match[1] : 1; } $name = ''; if (preg_match('/name-([a-zA-Z|\\[\\]]+)/i', $plain_args, $match)) { $name = isset($match[1]) ? $DB->escape($match[1]) : ''; } $class = -1; if (preg_match('/class-(-?[0-9]+)/i', $plain_args, $match)) { $class = (int) $match[1] > -1 ? $match[1] : -1; } if (isset($_POST['classchoice']) || isset($_POST['characterchoice']) || $name != '') { $name = isset($_POST['characterchoice']) ? $_POST['characterchoice'] : $name; if ($name != '') { $where = "WHERE name LIKE '%" . $DB->escape($name) . "%'"; } $class = isset($_POST['classchoice']) ? $_POST['classchoice'] : $class;
<?php set_title(site_name() . ' - Imperii'); $smarty->assign('content_tpl', 'content/main/empires');
<?php if (!defined('BASEPATH')) { exit('Nu poti accesa acest fisier direct.'); } set_title(site_name() . ' - Administrare cont'); check_login(); assign('content_tpl', 'content/administration');
<?php check_login(); if (!defined('BASEPATH')) { exit('Nu poti accesa acest fisier direct.'); } set_title(site_name() . ' - Caracterele mele'); $data = $DB->query("SELECT * FROM " . PLAYER_DATABASE . ".player WHERE account_id = '" . $_SESSION['user_data']['id'] . "'"); $users = array(); $i = 0; while ($row = $DB->fetch($data)) { $users[$i]['id'] = $row['id']; $users[$i]['name'] = $row['name']; $users[$i]['level'] = $row['level']; $users[$i]['time'] = $row['playtime'] > 0 ? duration($row['playtime'] * 60) : 'nedeterminat'; $users[$i]['class'] = char_class($row['job']); $i++; } $smarty->assign('users', $users); assign('content_tpl', 'content/character');
<!DOCTYPE html> <?php header('Expires: ' . date('r', time() - 86400)); header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); header('Pragma: no-cache'); ?> <html lang="en"> <head> <meta charset="utf-8"> <?php $postfix = isset($meta_data['title']) ? ' - ' . $meta_data['title'] : ''; ?> <title><?php echo site_name() . $postfix; ?> </title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Stylesheets --> <?php echo $this->dynamic_load->load_files('header'); ?> <!-- HTML5 shim, for IE6-8 support of HTML5 elements --> <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <script> var urls = '<?php echo json_encode(array('base_url' => base_url(), 'backend_url' => backend_view(), 'assets' => array('base' => asset_url(), 'js' => asset_url('js'), 'css' => asset_url('css'), 'images' => asset_url('images')))); ?> ';
<?php if (!defined('BASEPATH')) { exit('Nu poti accesa acest fisier direct.'); } set_title(site_name() . ' - Logare'); $logged_in = false; $login_failed = false; if (isset($_SESSION['logged_in'])) { $logged_in = true; } if (!empty($_POST['username']) && !empty($_POST['password'])) { $DB = Mysql::init(); $username = $DB->escape($_POST['username']); $password = $DB->escape($_POST['password']); $captcha = isset($_POST['captcha']) ? $_POST['captcha'] : null; if (Session::read('login_attempts') > 3) { if (isset($_SESSION['security_code']) && $_SESSION['security_code'] != $captcha) { $login_failed = true; } } if (!$login_failed) { $data = $DB->select("*", ACCOUNT_DATABASE . ".account", "login LIKE '" . $username . "' AND password LIKE PASSWORD('" . $password . "')"); if (is_array($data)) { if ($data['status'] == 'BLOCK') { $smarty->assign('blocked_account', true); $smarty->assign('active', $data['active']); } else { $_SESSION['logged_in'] = true; $_SESSION['user_data'] = $data; $logged_in = true;
<?php if (!defined('BASEPATH')) { exit('Nu poti accesa acest fisier direct.'); } set_title(site_name() . ' - Descarcare'); assign('content_tpl', 'content/download');
<?php /** * @todo Un update major pentru clasament * @info Acesta functioneaza de minune, dar trebuie simplificat algoritmul **/ if (!defined('BASEPATH')) { exit('Nu poti accesa acest fisier direct.'); } set_title(site_name() . ' - Clasament bresle'); $players = array(); $where = ''; $plain_args = Vars::get('plain_args'); $page = 1; if (preg_match('/page-([0-9]+)/i', $plain_args, $match)) { $page = (int) $match[1] > 0 ? $match[1] : 1; } $name = ''; if (preg_match('/name-([a-zA-Z|\\[\\]]+)/i', $plain_args, $match)) { $name = isset($match[1]) ? $DB->escape($match[1]) : ''; } $empire = -1; if (preg_match('/empire-(-?[0-9]+)/i', $plain_args, $match)) { $empire = (int) $match[1] > -1 ? $match[1] : -1; } if (isset($_POST['empirechoice']) || isset($_POST['guildchoice']) || $name != '') { $name = isset($_POST['guildchoice']) ? $_POST['guildchoice'] : $name; if ($name != '') { $where = "WHERE name LIKE '%" . $DB->escape($name) . "%'"; } $empire = isset($_POST['empirechoice']) ? $_POST['empirechoice'] : $empire;
echo user_alert(sprintf($strThereAreXcontractsAssignedToThisPerson, $totalcontracts), E_USER_WARNING); } if ($totalincidents > 0 || $totalcontracts > 0) { echo "<form action='{$_SERVER['PHP_SELF']}' onsubmit=\"return confirm_action('{$strAreYouSureDelete}')\" method='post'>\n"; echo "<p align='center'>{$strBeforeDeleteContact}</p>"; $sql = "SELECT id, forenames, surname, siteid FROM `{$dbContacts}` ORDER BY surname ASC"; $result = mysql_query($sql); echo "<p align='center'>"; echo "<select name='newcontact'>"; if ($id == 0) { echo "<option selected='selected' value='0'>Select A Contact\n"; } while ($contacts = mysql_fetch_array($result)) { $site = ''; if ($contacts['siteid'] != '' && $contacts['siteid'] != 0) { $site = " of " . site_name($contacts['siteid']); } if ($contacts['id'] != $id) { echo "<option value=\"{$contacts['id']}\">"; echo htmlspecialchars($contacts['surname'] . ', ' . $contacts['forenames'] . $site); echo "</option>\n"; } } echo "</select><br />"; echo "<br />"; echo "<input type='hidden' name='id' value='{$id}' />"; echo "<input type='hidden' name='process' value='true' />"; echo "<input type='submit' value='{$strDelete}' />"; echo "</p>"; echo "</form>"; } else {
<?php if (!defined('BASEPATH')) { exit('Nu poti accesa acest fisier direct.'); } set_title(site_name() . ' - Cod stergere caractere'); check_login(); $step = 'request'; $data = $DB->select("id, login, email, social_id, socialid_token, socialid_expire", ACCOUNT_DATABASE . ".account", "`id`='" . $_SESSION['user_data']['id'] . "'"); if ($data['socialid_expire'] != 0) { $step = 'wait'; } else { if (isset($_POST['sendSocialcodeDisplayLink'])) { if (is_array($data)) { $token = sha1(microtime() . $data['email'] . rand(123151, 999999)); $expire = time() + 24 * 60 * 60; $ok = $DB->query("UPDATE " . ACCOUNT_DATABASE . ".account SET `socialid_token`='" . $token . "', `socialid_expire`='" . $expire . "' WHERE `id`='" . $data['id'] . "'"); if ($ok) { // trimitem email $arr = array('login' => $data['login'], 'token' => $token, 'site_name' => site_name(), 'site_url' => site_url()); $email_ses = email()->load('displaycode/displaycode'); $email_ses->assign($arr); $email_ses->set('noreply@' . rtrim(site_name(), '/'), '', $data['email'], 'Metin2 - Afiseaza codul'); $email_ses->send(); } } $step = 'sent'; } } assign('content_tpl', 'content/displaycode/' . $step);
<?php set_title(site_name() . ' - Comunitate'); $smarty->assign('content_tpl', 'content/main/community');
require 'core.php'; require APPLICATION_LIBPATH . 'functions.inc.php'; require APPLICATION_LIBPATH . 'auth.inc.php'; $title = "{$strInventory} - {$strSite}"; include APPLICATION_INCPATH . 'htmlheader.inc.php'; if (!$CONFIG['inventory_enabled']) { html_redirect('index.php', FALSE); exit; } if (is_numeric($_GET['id'])) { //View site inventory $siteid = $_GET['id']; if (!empty($_REQUEST['filter'])) { $filter = cleanvar($_REQUEST['filter']); } echo "<h2>" . icon('site', 32) . " " . site_name($siteid) . "</h2>"; echo "<p align='center'>"; echo "<a href='inventory_add.php?site={$siteid}'>"; echo icon('add', 16) . " {$strAddNew}</a> | "; echo "<a href='inventory.php'>" . icon('site', 16) . " {$strBackToSites}</a></p>"; $sql = "SELECT *, i.name AS name , i.id AS id, "; $sql .= "i.notes AS notes, "; $sql .= "i.active AS active "; $sql .= "FROM `{$dbInventory}` AS i, `{$dbSites}` AS s "; $sql .= "WHERE siteid='{$siteid}' "; $sql .= "AND siteid=s.id "; if (!empty($filter)) { $sql .= "AND type='{$filter}' "; } $sql .= "ORDER BY i.active DESC, "; $sql .= "i.modified DESC";
<?php if (!defined('BASEPATH')) { exit('Nu poti accesa acest fisier direct.'); } set_title(site_name() . ' - Meniu principal'); assign('content_tpl', 'content/main');
<nav class="container" role="navigation"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="<?php echo get_url(); ?> " title="返回 <?php site_title(); ?> 首页"><?php site_name(); ?> </a> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <?php admin_top_menu(); ?> </ul> </div> </nav> </header> <div class="container"> <div class="col-md-2"> <ul class="nav nav-pills nav-stacked">
<?php if (!defined('BASEPATH')) { exit('Nu poti accesa acest fisier direct.'); } set_title(site_name() . ' - Parola depozit'); $DB = Mysql::init(); check_login(); $step = 'request'; if (isset($_POST['sendStoragePassword'])) { $data = $DB->select("id, login, email", ACCOUNT_DATABASE . ".account", "`id`='" . $_SESSION['user_data']['id'] . "'"); if (is_array($data)) { $storage_pass = $DB->select('password', PLAYER_DATABASE . '.safebox', "`account_id`='" . $_SESSION['user_data']['id'] . "'"); if ($storage_pass == '') { $step = 'error'; } else { // trimitem email $arr = array('login' => $data['login'], 'password' => $storage_pass['password'], 'site_name' => site_name(), 'site_url' => site_url()); $email_ses = email()->load('passwordlost/storagepassword'); $email_ses->assign($arr); $email_ses->set('noreply@' . rtrim(site_name(), '/'), '', $data['email'], 'Metin2 - Parola Depozit'); $email_ses->send(); $step = 'sent'; } } } assign('content_tpl', 'content/storagepassword/' . $step);
<footer> <div class="container-wide"> <div class="row"> <div class="col-md-7"> <p><?php echo " © " . date("Y") . " " . site_name() . " - All rights reserved."; ?> Theme by <a href="http://alexbeals.com">Alex Beals</a>.</p> </div> <div class="col-md-5"> <nav> <ul class="nav navbar-nav navbar-right"> <li><a href="<?php echo rss_url(); ?> ">RSS</a></li> <li class="active"><a href="<?php echo base_url('admin'); ?> " title="Manage your site!">Admin area</a></li> <li class="active"><a href="<?php echo base_url(); ?> " title="Return to my website!">Home</a></li> </ul> </nav> </div> </div> </div> </footer>
} $step = 'step1'; $args = Vars::get('args'); $username = isset($args[1]) ? $DB->escape($args[1]) : ''; $token = isset($args[1]) ? $DB->escape($args[2]) : ''; $data = $DB->select("id, email, new_email, email_step", ACCOUNT_DATABASE . ".account", "`login` LIKE '" . $username . "' AND `email_token` LIKE '" . $token . "'"); if (is_array($data)) { $args[0] = isset($args[0]) ? $args[0] : 'cancel'; if ($args[0] == 'confirm' && $data['email_step'] == 2) { $ok = $DB->query("UPDATE " . ACCOUNT_DATABASE . ".account SET `email`='" . $data['new_email'] . "', `email_token`='', `email_expire`='', `new_email`='', `email_step`='0' WHERE `id`='" . $data['id'] . "'"); $step = 'confirmation_confirm'; } elseif ($args[0] == 'accept' && $data['email_step'] == 1) { $token = sha1(microtime() . $data['email'] . rand(123151, 999999)); $ok = $DB->query("UPDATE " . ACCOUNT_DATABASE . ".account SET `email_token`='" . $token . "', `email_step`='2' WHERE `id`='" . $data['id'] . "'"); if ($ok) { $arr = array('login' => $username, 'site_name' => site_name(), 'site_url' => site_url(), 'token' => $token); $email_ses = email()->load('emailchange/emailchange_accept'); $email_ses->assign($arr); $email_ses->set('noreply@' . rtrim(site_name(), '/'), '', $data['new_email'], 'Schimbare de email'); $email_ses->send(); $step = 'step2'; } $step = 'confirmation_accept'; } else { $ok = $DB->query("UPDATE " . ACCOUNT_DATABASE . ".account SET `email_token`='', `new_email`='', `email_step`='0', `email_expire`='0' WHERE `id`='" . $data['id'] . "'"); $step = 'confirmation_cancel'; } } else { $step = 'confirmation_error'; } assign('content_tpl', 'content/emailchange/' . $step);
echo $strNoRecords; } else { printf($strSorryNoRecordsMatchingX, "<em>{$search_string}</em>"); } echo "</p>\n"; } else { echo "<p align='center'>" . sprintf($strDisplayingXcontactMatchingY, mysql_num_rows($result), "<em>{$search_string}</em>") . "</p>"; echo "<table align='center'>\n <tr>\n <th>{$strName}</th>\n <th>{$strSite}</th>\n <th>{$strEmail}</th>\n <th>{$strTelephone}</th>\n <th>{$strFax}</th>\n <th>{$strAction}</th>\n </tr>"; $shade = 'shade1'; while ($results = mysql_fetch_array($result)) { if ($results['active'] == 'false') { $shade = 'expired'; } echo "<tr class='{$shade}'>"; echo "<td><a href='contact_details.php?id={$results['id']}'>{$results['surname']}, {$results['forenames']}</a></td>"; echo "<td><a href='site_details.php?id={$results['siteid']}'>" . site_name($results['siteid']) . "</a></td>"; echo "<td>{$results['email']}</td>"; echo "<td>"; if ($results["phone"] == '') { echo "<em>{$strNone}</em>"; } else { echo $results["phone"]; } echo "</td>"; echo "<td>"; if ($results["fax"] == '') { echo "<em>{$strNone}</em>"; } else { echo $results["fax"]; } echo "</td>";
} ?> )</td> <td width='150'><a href="javascript:incident_details_window('<?php echo $results["id"]; ?> ')"><?php echo $results["title"]; ?> </a></td> <td align='center' width='100'><?php echo $results['forenames'] . ' ' . $results['surname']; ?> </td> <td align='center' width='100'><?php echo site_name($results['siteid']); ?> </td> <td align='center' width='50'><?php echo $results['servicelevel'] . "<br />" . priority_name($results["priority"]); ?> </td> <td align='center' width='100'><?php echo user_realname($results['owner'], TRUE); ?> </td> <td align='center' width='150'><?php echo ldate($CONFIG['dateformat_datetime'], $results["opened"]); ?> </td> <td align='center' width='150'><?php
$html .= "<th>{$strName}</th>"; $html .= "<th>{$strSite}</th>"; $html .= "</tr>\n"; $customermatches = 0; while ($contactrow = mysql_fetch_array($result)) { $html .= "<tr class='shade2'>"; $site_incident_pool = db_read_column('freesupport', $dbSites, $contactrow['siteid']); if ($site_incident_pool > 0) { $html .= "<td><a href=\"{$_SERVER['PHP_SELF']}?action=incidentform&type=free&contactid=" . $contactrow['contactid'] . "&updateid={$updateid}&win={$win}\" onclick=\"return confirm_free();\">"; $html .= "{$strAddSiteSupportIncident}</a> ({$site_incident_pool})</td>"; $customermatches++; } else { $html .= "<td class='expired'>{$strZeroRemaining}</td>"; } $html .= '<td>' . $contactrow['forenames'] . ' ' . $contactrow['surname'] . '</td>'; $html .= '<td>' . site_name($contactrow['siteid']) . '</td>'; $html .= "</tr>\n"; } $html .= "</table>\n"; if ($customermatches > 0) { echo $html; } echo "<p align='center'><a href='contact_add.php?name=" . urlencode($search_string) . "&return=addincident'>{$strAddContact}</a></p>\n"; } else { echo "<h3>" . sprintf($strNoResultsFor, $strContacts) . "</h3>"; echo "<p align='center'><a href=\"contact_add.php?name=" . urlencode($search_string) . "&return=addincident\">{$strAddContact}</a></p>\n"; } include APPLICATION_INCPATH . 'htmlfooter.inc.php'; } } elseif ($action == 'incidentform') { // Display form to get details of the actual incident
$str .= "<td>{$strYes}</td>"; } else { $str .= "<td>{$strNo}</td>"; } $str .= "<td>{$CONFIG['currency_symbol']}" . number_format($obj->creditamount, 2) . "</td>"; $str .= "<td>{$CONFIG['currency_symbol']}" . number_format($obj->balance, 2) . "</td>"; $str .= "<td>{$CONFIG['currency_symbol']}" . number_format($awaitingapproval, 2) . "</td>"; $str .= "<td>{$CONFIG['currency_symbol']}" . number_format($reserved, 2) . "</td>"; $str .= "<td>{$CONFIG['currency_symbol']}" . number_format($actual, 2) . "</td>"; $str .= "<td>{$CONFIG['currency_symbol']}{$obj->unitrate}</td>"; $str .= "<td>{$unitsat1times}</td></tr>\n"; $lastsite = $obj->site; $lastproduct = $obj->product; } elseif ($display == 'csv') { if ($obj->site != $lastsite) { $str .= "\"" . site_name($obj->site) . "\","; $str .= "\"" . product_name($obj->product) . "\","; } else { $str .= ","; if ($obj->product != $lastproduct) { $str .= product_name($obj->product) . ","; } else { $str .= ","; } } $str .= "\"{$obj->cust_ref}\",\"{$obj->startdate}\",\"{$obj->enddate}\","; if ($obj->foc == 'yes') { $str .= "\"{$strYes}\","; } else { $str .= "\"{$strNo}\","; }
if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } if (mysql_num_rows($result) >= 1) { echo "<h3>{$strRelatedContracts}</h3>"; echo "<table align='center'>"; echo "<tr><th>{$strContract}</th><th>{$strSite}</th></tr>"; $shade = 'shade1'; while ($contract = mysql_fetch_object($result)) { if ($contract->term == 'yes' or $contract->expirydate < $now) { $shade = "expired"; } echo "<tr class='{$shade}'>"; echo "<td>" . icon('contract', 16) . " "; echo "<a href='contract_details.php?id={$contract->id}'>" . sprintf($strContractNum, $contract->id) . "</a></td>"; echo "<td>" . site_name($contract->site) . "</td>"; echo "</tr>\n"; if ($shade == 'shade1') { $shade = 'shade2'; } else { $shade = 'shade1'; } } echo "</table>\n"; } $sql = "SELECT * FROM `{$dbIncidents}` WHERE product={$product->id} ORDER BY id DESC"; $result = mysql_query($sql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } if (mysql_num_rows($result) >= 1) {
<?php set_title(site_name() . ' - Jocul'); $smarty->assign('content_tpl', 'content/main/thegame');
//$sqlTask .= "OR id={$tasks->origcolref} "; if (empty($orSQL)) { $orSQL = "("; } else { $orSQL .= " OR "; } $orSQL .= "id={$tasks->origcolref} "; } if (!empty($orSQL)) { $sqlTask .= "AND {$orSQL})"; } } $result = mysql_query($sqlTask); $show = 'incidents'; //$show = 'incidents'; echo "<h2>" . sprintf($strActivitiesForX, site_name($siteid)) . "</h2>"; } else { // Defaults if (empty($user) or $user == 'current') { $user = $sit[2]; } // If the user is passed as a username lookup the userid if (!is_numeric($user) and $user != 'current' and $user != 'all') { $usql = "SELECT id FROM `{$dbUsers}` WHERE username='******' LIMIT 1"; $uresult = mysql_query($usql); if (mysql_error()) { trigger_error(mysql_error(), E_USER_WARNING); } if (mysql_num_rows($uresult) >= 1) { list($user) = mysql_fetch_row($uresult); } else {
<div class="wrap"> <footer id="bottom"> <small>© <?php echo date('Y'); ?> <?php echo site_name(); ?> . All rights reserved.</small> <ul role="navigation"> <li><a href="<?php echo rss_url(); ?> ">RSS</a></li> <?php if (twitter_account()) { ?> <li><a href="<?php echo twitter_url(); ?> ">@<?php echo twitter_account(); ?> </a></li> <?php } ?> <li><a href="/" title="Return to my website.">Home</a></li> </ul>
/** * Function to display/generate the transactions table * @author Paul Heaney * @param int $serviceid - The service ID to show transactons for * @param Date $startdate - Date in format yyyy-mm-dd when you want to start the report from * @param Date $enddate - Date in format yyyy-mm-dd when you want to end the report, empty means today * @param int[] $sites - Array of sites to report on * @param String $display either csv or html * @param boolean $sitebreakdown - Breakdown per site * @param boolean $showfoc - Show free of charge as well (defaults to true); * @param boolean $includeawaitingapproval - Include transactions awaiting approval * @param boolean $includereserved - Include reserved transactions * @return String -either HTML or CSV */ function transactions_report($serviceid, $startdate, $enddate, $sites, $display, $sitebreakdown = TRUE, $showfoc = TRUE, $focaszero = FALSE, $includeawaitingapproval = TRUE, $includereserved = TRUE) { global $CONFIG; $csv_currency = html_entity_decode($CONFIG['currency_symbol'], ENT_NOQUOTES, "ISO-8859-15"); // Note using -15 as -1 doesnt support euro $sql = "SELECT DISTINCT t.*, m.site, p.foc, p.cust_ref, p.cust_ref_date, p.title, p.notes "; $sql .= "FROM `{$GLOBALS['dbTransactions']}` AS t, `{$GLOBALS['dbService']}` AS p, "; $sql .= "`{$GLOBALS['dbMaintenance']}` AS m, `{$GLOBALS['dbServiceLevels']}` AS sl, `{$GLOBALS['dbSites']}` AS s "; $sql .= "WHERE t.serviceid = p.serviceid AND p.contractid = m.id "; // AND t.date <= '{$enddateorig}' "; $sql .= "AND m.servicelevelid = sl.id AND sl.timed = 'yes' AND m.site = s.id "; //// $sql .= "AND t.date > p.lastbilled AND m.site = {$objsite->site} "; if ($serviceid > 0) { $sql .= "AND t.serviceid = {$serviceid} "; } if (!empty($startdate)) { $sql .= "AND t.dateupdated >= '{$startdate}' "; } if (!empty($enddate)) { $sql .= "AND t.dateupdated <= '{$enddate}' "; } $orsql[] = "t.transactionstatus = " . BILLING_APPROVED; if ($includeawaitingapproval) { $orsql[] = "t.transactionstatus = " . BILLING_AWAITINGAPPROVAL; } if ($includereserved) { $orsql[] = "t.transactionstatus = " . BILLING_RESERVED; } $o = implode(" OR ", $orsql); $sql .= "AND ({$o}) "; if (!$showfoc) { $sql .= "AND p.foc = 'no' "; } if (!empty($sites)) { $sitestr = ''; foreach ($sites as $s) { if (empty($sitestr)) { $sitestr .= "m.site = {$s} "; } else { $sitestr .= "OR m.site = {$s} "; } } $sql .= "AND {$sitestr} "; } if (!empty($site)) { $sql .= "AND m.site = {$site} "; } $sql .= "ORDER BY t.dateupdated, s.name "; $result = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); } if (mysql_num_rows($result) > 0) { $shade = 'shade1'; $total = 0; $totalcredit = 0; $totaldebit = 0; $details = ''; while ($transaction = mysql_fetch_object($result)) { if ($display == 'html') { if ($serviceid > 0 and empty($details)) { if (!empty($transaction->cust_ref)) { $details .= "<tr>"; $details .= "<th>{$GLOBALS['strCustomerReference']}</th><td>{$transaction->cust_ref}</td>"; if ($transaction->cust_ref_date != "1970-01-01") { $details .= "<th>{$GLOBALS['strCustomerReferenceDate']}</th><td>{$transaction->cust_ref_date}</td>"; } $details .= "</tr>"; } if (!empty($transaction->title)) { $details .= "<tr><th>{$GLOBALS['strTitle']}</th><td>{$transaction->title}</td></tr>"; } if (!empty($transaction->notes)) { $details .= "<tr><th>{$GLOBALS['strNotes']}</th><td>{$transaction->notes}</td></tr>"; } } $str = "<tr class='{$shade}'>"; $str .= "<td>{$transaction->dateupdated}</td>"; $str .= "<td>{$transaction->transactionid}</td>"; $str .= "<td>{$transaction->serviceid}</td>"; $str .= "<td>" . site_name($transaction->site) . "</td>"; $str .= "<td>{$transaction->description}</td>"; $str .= "<td>"; switch ($transaction->transactionstatus) { case BILLING_APPROVED: $str .= $GLOBALS['strApproved']; break; case BILLING_AWAITINGAPPROVAL: $str .= $GLOBALS['strAwaitingApproval']; break; case BILLING_RESERVED: $str .= $GLOBALS['strReserved']; break; } $str .= "</td>"; } elseif ($display == 'csv') { if ($serviceid > 0 and empty($details)) { if (!empty($transaction->cust_ref)) { $details .= "\"{$GLOBALS['strCustomerReference']}\",\"{$transaction->cust_ref}\","; if ($transaction->cust_ref_date != "1970-01-01") { $details .= "\"{$GLOBALS['strCustomerReferenceDate']}\",\"{$transaction->cust_ref_date}\","; } $details .= "\n"; } if (!empty($transaction->title)) { $details .= "\"{$GLOBALS['strTitle']}\",\"{$transaction->title}\"\n"; } if (!empty($transaction->notes)) { $details .= "\"{$GLOBALS['strNotes']}\",\"{$transaction->notes}\"\n"; } } $str = "\"{$transaction->dateupdated}\","; $str .= "\"{$transaction->transactionid}\","; $str .= "\"{$transaction->serviceid}\",\""; $str .= site_name($transaction->site) . "\","; $str .= "\"" . html_entity_decode($transaction->description) . "\","; $str .= "\""; switch ($transaction->transactionstatus) { case BILLING_APPROVED: $str .= $GLOBALS['strApproved']; break; case BILLING_AWAITINGAPPROVAL: $str .= $GLOBALS['strAwaitingApproval']; break; case BILLING_RESERVED: $str .= $GLOBALS['strReserved']; break; } $str .= "\","; } if ($focaszero and $transaction->foc == 'yes') { $transaction->amount = 0; } $total += $transaction->amount; if ($transaction->amount < 0) { $totaldebit += $transaction->amount; if ($display == 'html') { $str .= "<td></td><td>{$CONFIG['currency_symbol']}" . number_format($transaction->amount, 2) . "</td>"; } elseif ($display == 'csv') { $str .= ",\"{$csv_currency}" . number_format($transaction->amount, 2) . "\","; } } else { $totalcredit += $transaction->amount; if ($display == 'html') { $str .= "<td>{$CONFIG['currency_symbol']}" . number_format($transaction->amount, 2) . "</td><td></td>"; } elseif ($display == 'csv') { $str .= "\"{$csv_currency}" . number_format($transaction->amount, 2) . "\",,"; } } if ($display == 'html') { $str .= "</tr>"; } elseif ($display == 'csv') { $str .= "\n"; } if ($sitebreakdown == TRUE) { $table[$transaction->site]['site'] = site_name($transaction->site); $table[$transaction->site]['str'] .= $str; if ($transaction->amount < 0) { $table[$transaction->site]['debit'] += $transaction->amount; } else { $table[$transaction->site]['credit'] += $transaction->amount; } } else { $table .= $str; } } if ($sitebreakdown == TRUE) { foreach ($table as $e) { if ($display == 'html') { $text .= "<h3>{$e['site']}</h3>"; $text .= "<table align='center' width='60%'>"; //echo "<tr><th colspan='7'>{$e['site']}</th></tr>"; $text .= "<tr><th>{$GLOBALS['strDate']}</th><th>{$GLOBALS['strID']}</th><th>{$GLOBALS['strServiceID']}</th>"; $text .= "<th>{$GLOBALS['strSite']}</th><th>{$GLOBALS['strDescription']}</th><th>{$GLOBALS['strCredit']}</th><th>{$GLOBALS['strDebit']}</th></tr>"; $text .= $e['str']; $text .= "<tr><td colspan='5' align='right'>{$GLOBALS['strTotal']}</td>"; $text .= "<td>{$CONFIG['currency_symbol']}" . number_format($e['credit'], 2) . "</td>"; $text .= "<td>{$CONFIG['currency_symbol']}" . number_format($e['debit'], 2) . "</td></tr>"; $text .= "</table>"; } elseif ($display == 'csv') { $text .= "\"{$e['site']}\"\n\n"; $text .= "\"{$GLOBALS['strDate']}\",\"{$GLOBALS['strID']}\",\"{$GLOBALS['strServiceID']}\","; $text .= "\"{$GLOBALS['strSite']}\",\"{$GLOBALS['strDescription']}\",\"{$GLOBALS['strCredit']}\",\"{$GLOBALS['strDebit']}\"\n"; $text .= $e['str']; $text .= ",,,,{$GLOBALS['strTotal']},"; $text .= "\"{$csv_currency}" . number_format($e['credit'], 2) . "\",\""; $text .= "{$csv_currency}" . number_format($e['debit'], 2) . "\"\n"; } } } else { if ($display == 'html') { if (!empty($details)) { // Dont need to worry about this in the above section as sitebreakdown and serviceid are multually exclusive $text .= "<div><table align='center'>{$details}</table></div>"; } $text .= "<table align='center'>"; $text .= "<tr><th>{$GLOBALS['strDate']}</th><th>{$GLOBALS['strID']}</th><th>{$GLOBALS['strServiceID']}</th>"; $text .= "<th>{$GLOBALS['strSite']}</th>"; $text .= "<th>{$GLOBALS['strDescription']}</th><th>{$GLOBALS['strStatus']}</th><th>{$GLOBALS['strCredit']}</th><th>{$GLOBALS['strDebit']}</th></tr>"; $text .= $table; $text .= "<tfoot><tr><td colspan='6' align='right'>{$GLOBALS['strTOTALS']}</td>"; $text .= "<td>{$CONFIG['currency_symbol']}" . number_format($totalcredit, 2) . "</td>"; $text .= "<td>{$CONFIG['currency_symbol']}" . number_format($totaldebit, 2) . "</td></tr></tfoot>"; $text .= "</table>"; } elseif ($display == 'csv') { if (!empty($details)) { $text .= $details; } $text .= "\"{$GLOBALS['strDate']}\",\"{$GLOBALS['strID']}\",\"{$GLOBALS['strServiceID']}\","; $text .= "\"{$GLOBALS['strSite']}\","; $text .= "\"{$GLOBALS['strDescription']}\",\"{$GLOBALS['strStatus']}\",\"{$GLOBALS['strCredit']}\",\"{$GLOBALS['strDebit']}\"\n"; $text .= $table; $text .= ",,,,{$GLOBALS['strTOTALS']},"; $text .= "\"{$csv_currency}" . number_format($totalcredit, 2) . "\",\""; $text .= "{$csv_currency}" . number_format($totaldebit, 2) . "\"\n"; } } if ($shade == 'shade1') { $shade = 'shade2'; } else { $shade = 'shade1'; } } else { if ($display == 'html') { $text = "<p align='center'>{$GLOBALS['strNoTransactionsMatchYourSearch']}</p>"; } elseif ($display == 'csv') { $text = $GLOBALS['strNoTransactionsMatchYourSearch'] . "\n"; } } return $text; }