function getRecord($conn, $id) { if ($id != 0) { $stmt = $conn->prepare('SELECT `from`, `fromAmount`, `fromCurrency`, `to`, `toAmount`, `toCurrency`, `text`, `location`, `date`, `reference` FROM `record` WHERE `id` = ?'); $stmt->bind_param('i', $id); if (!$stmt->execute()) { header('X-Error: ' . 'Query error, ' . $stmt->error); http_response_code(500); die; } $data = $stmt->get_result()->fetch_assoc(); $stmt->close(); } else { $tz = new DateTimeZone('Europe/London'); $offset = getTimezone($conn); $date = new DateTime(null, $tz); $date->modify('+' . $offset . ' hours'); $data = (object) ['from' => '現金-錢包', 'fromAmount' => 0, 'fromCurrency' => 'TWD', 'to' => '現金-錢包', 'toAmount' => null, 'toCurrency' => null, 'text' => '', 'location' => '', 'date' => $date->format('Y-m-d'), 'reference' => null]; } return $data; }
<?php //error_reporting(E_ALL); include 'timezone-list.php'; // Gets the timezone offset from client to UTC and compares it to // timezone list included. $clientoffset = $_POST['timezone']; $sign = $clientoffset >= 0 ? '-' : '+'; $hour = $clientoffset / 60; $minute = $clientoffset % 60; $offsetinhours = sprintf("%s%02d:%02d", $sign, $hour, $minute); $timezone = getTimezone($offsetinhours); date_default_timezone_set($timezone); // Checks for DST and return H - 1 if it is. if (date('I')) { echo (int) date("H") - 1 . date(':i:s A'); } else { echo date('H:i:s A'); }
/** * displayLatestMessageBoardPosts * * @param int $memberId * * @return void */ function displayLatestMessageBoardPosts($memberId) { $memberId = (int) $memberId; $sql = "SELECT t.`id`, `subject`, `date`, `post` \n FROM `fcms_board_posts` AS p, `fcms_board_threads` AS t, `fcms_users` AS u \n WHERE t.`id` = p.`thread` \n AND p.`user` = u.`id` \n AND u.`id` = ?\n ORDER BY `date` DESC \n LIMIT 0, 5"; $rows = $this->fcmsDatabase->getRows($sql, $memberId); if ($rows === false) { $this->fcmsError->displayError(); return; } if (count($rows) <= 0) { return; } echo ' <h2>' . T_('Latest Posts') . '</h2>'; $tzOffset = getTimezone($memberId); foreach ($rows as $row) { $date = fixDate(T_('F j, Y, g:i a'), $tzOffset, $row['date']); $subject = $row['subject']; $post = removeBBCode($row['post']); $post = cleanOutput($post); $pos = strpos($subject, '#ANOUNCE#'); if ($pos !== false) { $subject = substr($subject, 9, strlen($subject) - 9); } $subject = cleanOutput($subject); echo ' <p> <a href="messageboard.php?thread=' . $row['id'] . '">' . $subject . '</a> <span class="date">' . $date . '</span><br/> ' . $post . ' </p>'; } }
$relative_url[] = $piece; } } $relative_url[] = ''; $relative_url = implode('/', $relative_url); define('APP_REL_URL', $relative_url); $tpl->assign('phpversion', phpversion()); $tpl->assign('core', array('rel_url' => $relative_url, 'app_title' => APP_NAME)); if (@$_SERVER['HTTPS'] == 'on') { $ssl_mode = 'enabled'; } else { $ssl_mode = 'disabled'; } $tpl->assign('ssl_mode', $ssl_mode); $tpl->assign('zones', Date_Helper::getTimezoneList()); $tpl->assign('default_timezone', getTimezone()); $tpl->assign('default_weekday', getFirstWeekday()); $tpl->setTemplate('setup.tpl.html'); $tpl->displayTemplate(false); /** * Checks for $file for write permission. * * IMPORTANT: if the file does not exist, an empty file is created. */ function checkPermissions($file, $desc, $is_directory = false) { clearstatcache(); if (!file_exists($file)) { if (!$is_directory) { // try to create the file ourselves then $fp = @fopen($file, 'w');
/** * displaySentPrivateMessage () * * @return void */ function displaySentPrivateMessage() { $id = (int) $_GET['sent']; $this->displayHeader(); $sql = "SELECT p.`id`, `to`, `from`, `title`, `msg`, `date`, `read`, u.`avatar`, u.`gravatar`\n FROM `fcms_privatemsg` AS p\n LEFT JOIN `fcms_users` AS u ON p.`to` = u.`id`\n WHERE p.`id` = ?\n AND `from` = ?"; $r = $this->fcmsDatabase->getRow($sql, array($id, $this->fcmsUser->id)); if ($r === false) { $this->fcmsError->displayError(); $this->displayFooter(); return; } if (empty($r)) { echo ' <p class="error-alert"> ' . T_('The PM you are trying to view either doesn\'t exist or you don\'t have permission to view it.') . ' </p>'; $this->displayFooter(); return; } $tzOffset = getTimezone($this->fcmsUser->id); $date = fixDate(T_('n/j/Y g:i a'), $tzOffset, $r['date']); $avatarPath = getAvatarPath($r['avatar'], $r['gravatar']); $to = getUserDisplayName($r['to']); echo ' <div id="pm_msg"> <div class="user"> <img src="' . $avatarPath . '" alt="' . $to . '" title="' . $to . '"/> <h3>' . cleanOutput($r['title']) . '</h3> <b>' . sprintf(T_('to %s'), $to) . '</b> <span>' . $date . '</span> </div> <p> ' . parse($r['msg']) . ' </p> </div>'; $this->displayFooter(); }
<?php error_reporting(0); $dir=dirname(__FILE__).DIRECTORY_SEPARATOR; if(isset($_REQUEST)){ include "CONNECTION.php"; include "GET_USERSTAMP.php"; include "COMMON.php"; date_default_timezone_set('Asia/Singapore'); $timeZoneFormat=getTimezone(); $USERSTAMP=$UserStamp; $parentfolder=get_parentfolder_id(); if($_REQUEST["option"]=="DATE") { $date=$_REQUEST['date_change']; $ure_date=date('Y-m-d',strtotime($date)); $uld_id=mysqli_query($con,"select ULD_ID from USER_LOGIN_DETAILS where ULD_LOGINID='$USERSTAMP'"); while($row=mysqli_fetch_array($uld_id)){ $ure_uld_id=$row["ULD_ID"]; } $sql="SELECT * FROM USER_ADMIN_REPORT_DETAILS WHERE ULD_ID='$ure_uld_id' AND UARD_DATE='$ure_date'"; $sql_result= mysqli_query($con,$sql); $row=mysqli_num_rows($sql_result); $x=$row; if($x > 0) { $flag=1; } else{
/** * displaySchedulerPage * * @return void */ function displaySchedulerPage() { $this->displayHeader(); if (isset($_SESSION['schedule_edit'])) { displayOkMessage(); unset($_SESSION['schedule_edit']); } $this->fcmsAlert->displayScheduler($this->fcmsUser->id); // Check job running status $sql = "SELECT `value` AS 'running_job'\n FROM `fcms_config`\n WHERE `name` = 'running_job'"; $status = $this->fcmsDatabase->getRow($sql); if ($status === false) { $this->fcmsError->displayError(); $this->displayFooter(); return; } if ($status['running_job'] > 0) { echo ' <div class="alert-message block-message warning"> <h2>' . T_('A scheduled job is currently running.') . '</h2> <p>' . T_('Most jobs take less than an hour to complete, if the last successfull run for a scheduled job below is over an hour ago, their may be a problem with the current job.') . '</p> <p>' . T_('To debug this job:') . '</p> <ol> <li>' . T_('Turn on debugging.') . '</li> <li>' . T_('Reset the running job flag.') . '</p> </ol> <p> <a class="btn small" href="?running_job=off">' . T_('Set running job flag to off.') . '</a> ' . T_('(only if you know what you are doing)') . ' </p> </div>'; } // Get schedules $sql = "SELECT `id`, `type`, `repeat`, `lastrun`, `status`\n FROM `fcms_schedule`"; $rows = $this->fcmsDatabase->getRows($sql); if ($rows === false) { $this->fcmsError->displayError(); $this->displayFooter(); return; } echo ' <form id="scheduler-frm" action="scheduler.php" method="post"> <table class="sortable"> <thead> <tr> <th>' . T_('ID') . '</th> <th>' . T_('Type') . '</th> <th>' . T_('Frequency') . '</th> <th>' . T_('Last Run') . '</th> <th>' . T_('Status') . '</th> <th class="nosort"></th> </tr> </thead> <tbody>'; // This shouldn't happen if (count($rows) <= 0) { echo ' <tr> <td colspan="6" style="text-align:center"> <p>' . T_('No schedules found.') . ' <a href="?restore=schedules">' . T_('Restore missing schedules.') . '</a></p> </td> </tr> </tbody> </table> </form>'; $this->displayFooter(); return; } $onOff = array('1' => T_('On'), '0' => T_('Off')); $frequency = array('hourly' => T_('Hourly'), 'daily' => T_('Daily')); $setupCron = ''; foreach ($rows as $row) { $id = cleanOutput($row['id']); $type = cleanOutput($row['type']); $lastrun = cleanOutput($row['lastrun']); $statusOptions = buildHtmlSelectOptions($onOff, $row['status']); $repeatOptions = buildHtmlSelectOptions($frequency, $row['repeat']); $status = '<span class="label important">' . T_('Off') . '</span>'; if ($row['status'] == 1) { $status = '<span class="label success">' . T_('On') . '</span>'; } if ($lastrun == '0000-00-00 00:00:00') { $lastrun = '<i>' . T_('never') . '</i>'; } else { $tzOffset = getTimezone($this->fcmsUser->id); $lastrun = fixDate('Y-m-d h:i:s', $tzOffset, $lastrun); } $cronFreq = $row['repeat'] == 'daily' ? '0 0 * * *' : '0 * * * *'; $setupCron .= '<pre class="cron-example">' . $cronFreq . ' php -q ' . ROOT . 'cron.php job_type=' . $type . '</pre>'; echo ' <tr> <td> ' . $id . ' <input type="hidden" name="id[]" id="id" value="' . $id . '"> </td> <td>' . $type . '</td> <td> <select name="repeat[]" id="schedule_status" class="span4"> ' . $repeatOptions . ' </select> </td> <td>' . $lastrun . '</td> <td> <select name="status[]" id="schedule_status" class="span2"> ' . $statusOptions . ' </select> </td> <td>' . $status . '</td> </tr>'; } echo ' </tbody> </table> <div class="actions"> <input class="btn primary" type="submit" name="save" id="save" value="' . T_('Save Changes') . '"/> </div> </form> <p> </p> <h2>' . T_('Set up Cron') . '</h2> <p>' . T_('Set up a new crontab for each of the following commands.') . '</p> ' . $setupCron; $this->displayFooter(); }
<body> <?php $active_page = "today_run"; include "navigation.php"; ?> <div class="container theme-showcase" role="main"> <div class="page-header"> <h1>今日累積記錄 <a href="add.php"><i class="fa fa-plus"></i></a></h1> </div> <?php $conn = myUtf8Db($db_servername, $db_username, $db_password, $db_name); if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } $timezone = getTimezone($conn); $stmt = $conn->prepare("SELECT `from`, `fromCurrency` FROM `record` WHERE `date` = DATE(DATE_SUB(NOW(), INTERVAL -? HOUR)) GROUP BY `from`, `fromCurrency` ORDER BY `createTime` ASC"); $stmt->bind_param('i', $timezone); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows <= 0) { echo "<p class=\"lead\">No Data</p>"; } else { while ($row = $result->fetch_assoc()) { $stmt2 = $conn->prepare("CALL `查詢 001 指定類別貨幣 歷史 n日內累計`(1 , ?, ?, ?)"); $stmt2->bind_param('ssi', $row["from"], $row["fromCurrency"], $timezone); $stmt2->execute(); $result2 = $stmt2->get_result(); if (!$result2) { echo "Error:" . $stmt2->error . " <br/>"; } else {
<?php require "../config.php"; header('Content-Type: application/json; charset=utf-8'); $conn = myUtf8Db($db_servername, $db_username, $db_password, $db_name); if (!$conn) { header('X-Error: ' . 'Database connection error, ' . mysqli_connect_error()); http_response_code(500); die; } echo '{'; $tz = new DateTimeZone('Europe/London'); $offset = getTimezone($conn); $server_date = new DateTime(null, $tz); $app_date = new DateTime(null, $tz); $app_date->modify('+' . $offset . ' hours'); echo '"current_date":"' . $app_date->format('Y-m-d') . '"'; echo ',"current_time":"' . $app_date->format('H:i:s') . '"'; echo ',"server_date":"' . $server_date->format('Y-m-d') . '"'; echo ',"server_time":"' . $server_date->format('H:i:s') . '"'; echo '}'; $conn->close();
/** * displayMembers * * @return void */ function displayMembers() { $this->displayHeader(); $order = isset($_GET['order']) ? $_GET['order'] : 'alphabetical'; $tzOffset = getTimezone($this->fcmsUser->id); $validOrderTypes = array('alphabetical' => 'ORDER BY u.`fname`', 'age' => 'ORDER BY u.`dob_year`, u.`dob_month`, u.`dob_day`', 'participation' => '', 'activity' => 'ORDER BY u.`activity` DESC', 'joined' => 'ORDER BY u.`joindate` DESC'); if (!array_key_exists($order, $validOrderTypes)) { echo ' <div class="error-alert">' . T_('Invalid Order.') . '</div>'; $this->displayFooter(); return; } $sql = "SELECT u.`id`, u.`activity`, u.`joindate`, u.`fname`, u.`lname`, u.`sex`, \n u.`dob_year`, u.`dob_month`, u.`dob_day`, u.`username`, u.`avatar`, u.`gravatar`\n FROM `fcms_users` AS u\n WHERE u.`phpass` != 'NONMEMBER'\n AND u.`phpass` != 'PRIVATE'\n OR (\n u.`phpass` IS NULL\n AND u.`password` != 'NONMEMBER'\n AND u.`password` != 'PRIVATE'\n )\n " . $validOrderTypes[$order]; $rows = $this->fcmsDatabase->getRows($sql); if ($rows === false) { $this->fcmsError->displayError(); $this->displayFooter(); return; } foreach ($rows as $row) { $row['points'] = getUserParticipationPoints($row['id']); $memberData[] = $row; } // Sort by participation if ($order == 'participation') { foreach ($memberData as $k => $v) { $b[$k] = strtolower($v['points']); } asort($b); foreach ($b as $key => $val) { $c[] = $memberData[$key]; } $memberData = array_reverse($c); } // Get Additional header columns $header = ''; $colspan = 4; if ($order == 'age') { $header = '<td>' . T_('Age') . '</td><td>' . T_('Birthday') . '</td>'; $colspan++; } elseif ($order == 'participation') { $header = '<td>' . T_('Participation Points') . '</td>'; } elseif ($order == 'activity') { $header = '<td>' . T_('Last Seen') . '</td>'; } elseif ($order == 'joined') { $header = '<td>' . T_('Joined') . '</td>'; } echo ' <table cellspacing="0" cellpadding="0"> <thead> <th colspan="' . $colspan . '"></th> </thead> <tbody> <tr class="header"> <td></td> <td>' . T_('Name') . '</td> <td>' . T_('Username') . '</td> ' . $header . ' </tr>'; foreach ($memberData as $row) { $display = ''; // Age if ($order == 'age') { $age = getAge($row['dob_year'], $row['dob_month'], $row['dob_day']); // Don't show users with an unknown age if ($age === '...') { continue; } $display = '<td>' . sprintf(T_('%s years old'), $age) . '</td>'; $display .= '<td>' . $row['dob_year'] . '-' . $row['dob_month'] . '-' . $row['dob_day'] . '</td>'; } elseif ($order == 'participation') { $display = '<td>' . $row['points'] . '</td>'; } elseif ($order == 'activity') { $display = '<td></td>'; if ($row['activity'] != '0000-00-00 00:00:00') { $display = '<td>' . fixDate(T_('M. j, Y (g:i a)'), $tzOffset, $row['activity']) . '</td>'; } } elseif ($order == 'joined') { $display = '<td>' . fixDate(T_('M. j, Y'), $tzOffset, $row['joindate']) . '</td>'; } // Display members echo ' <tr> <td> <a class="avatar" href="profile.php?member=' . (int) $row['id'] . '"> <img alt="avatar" src="' . getCurrentAvatar($row['id']) . '"/> </a> </td> <td> <a class="avatar" href="profile.php?member=' . (int) $row['id'] . '"> ' . cleanOutput($row['fname']) . ' ' . cleanOutput($row['lname']) . ' </a> </td> <td>' . cleanOutput($row['username']) . '</td> ' . $display . ' </tr>'; } echo ' </tbody> </table>'; $this->displayFooter(); }