public function printItemBody($id) { global $dbh; $return = '<section> <h2>Expenses</h2> <div class="sectionData"> <table class="dataTable stripe row-border"> <thead> <tr> <th class="dateTimeHeader textLeft">Time</th> <th class="textLeft">Order</th> <th class="textLeft">Employee</th> </tr> </thead> <tbody>'; $sth = $dbh->prepare('SELECT expenseID, employeeID, date FROM expenses WHERE supplierID = :supplierID AND active = 1'); $sth->execute([':supplierID' => $id]); while ($row = $sth->fetch()) { $return .= '<tr><td data-sort="' . $row['date'] . '">' . formatDateTime($row['date']) . '</td>'; $return .= '<td>' . getLinkedName('expense', $row['expenseID']) . '</td>'; $return .= '<td>' . getLinkedName('employee', $row['employeeID']) . '</td></tr>'; } $return .= '</tbody> </table> </div> </section>'; return $return; }
function message_box() { global $prefix, $MAIN_CFG, $currentlang, $db, $userinfo; require_once CORE_PATH . 'nbbcode.php'; $query = $MAIN_CFG['global']['multilingual'] ? "AND (mlanguage='{$currentlang}' OR mlanguage='')" : ''; if (!is_admin()) { if (is_user()) { $query .= ' AND view!=2 AND view!=3'; } else { $query .= ' AND (view=0 OR view=3)'; } } $result = $db->sql_query('SELECT mid, title, content, date, expire, view FROM ' . $prefix . "_message WHERE active='1' {$query} ORDER BY date DESC"); while (list($mid, $title, $content, $date, $expire, $view) = $db->sql_fetchrow($result)) { $content = decode_bb_all($content, 1, true); if (!empty($title) && !empty($content)) { $output = ''; if ($view == 0) { $output = _MVIEWALL; } elseif ($view == 1) { $output = _MVIEWUSERS; } elseif ($view == 2) { $output = _MVIEWADMIN; } elseif ($view == 3) { $output = _MVIEWANON; } elseif ($view > 3 && (in_group($view - 3) || is_admin())) { // <= phpBB User Groups Integration $view = $view - 3; if (!in_group($view)) { list($output) = $db->sql_ufetchrow("SELECT group_name FROM " . $prefix . "_bbgroups WHERE group_id='{$view}'", SQL_NUM); } else { $output = in_group($view); } } if ($output != '') { $remain = ''; if (can_admin()) { if ($expire == 0) { $remain = _UNLIMITED; } else { $etime = ($date + $expire - time()) / 3600; $etime = intval($etime); $remain = $etime < 1 ? _EXPIRELESSHOUR : _EXPIREIN . " {$etime} " . _HOURS; } } global $cpgtpl; $cpgtpl->assign_block_vars('messageblock', array('S_TITLE' => $title, 'S_CONTENT' => $content, 'S_OUTPUT' => $output, 'S_DATE' => _POSTEDON . ' ' . formatDateTime($date, _DATESTRING2), 'S_REMAIN' => $remain, 'S_EDIT' => _EDIT, 'U_EDITMSG' => URL::admin('messages&edit=' . $mid))); } if ($expire != 0) { if ($date + $expire < time()) { $db->sql_query("UPDATE " . $prefix . "_message SET active='0' WHERE mid='{$mid}'"); } } } } $db->sql_freeresult($result); }
function __toString() { $str = $this->comment; $u = $this->w->Auth->getUser($this->creator_id); if ($u) { $str .= "<br>By <i>" . $u->getFullName() . ",</i>"; } $str .= "<i>" . formatDateTime($this->dt_created) . "</i>"; return $str; }
function get_ban_type($type) { if ($type < 0) { return _FOREVER; } if ($type > 0) { return formatDateTime($type, _DATESTRING); } return ''; }
public static function backup($database, $tables, $filename, $structure = true, $data = true, $drop = true, $compress = true, $full = false) { if (!is_array($tables) || empty($tables)) { trigger_error('No tables to backup', E_USER_WARNING); return false; } $crlf = "\n"; $esc = SQL_LAYER == 'postgresql' ? '--' : '#'; # doing some DOS-CRLF magic... # this looks better under WinX if (preg_match('#[^(]*\\((.*)\\)[^)]*#', $_SERVER['HTTP_USER_AGENT'], $regs)) { if (false !== stripos($regs[1], 'Win')) { $crlf = "\r\n"; } } if (GZIPSUPPORT) { while (ob_end_clean()) { } header('Content-Encoding: '); } else { $compress = false; } if ($compress) { $filename .= '.gz'; header("Content-Type: application/x-gzip; name=\"{$filename}\""); } else { header("Content-Type: text/x-delimtext; name=\"{$filename}\""); } header("Content-disposition: attachment; filename={$filename}"); DBCtrl::output("{$esc} ========================================================{$crlf}" . "{$esc}{$crlf}" . "{$esc} Database : {$database}{$crlf}" . "{$esc} " . _ON . " " . formatDateTime(time(), _DATESTRING) . " !{$crlf}" . "{$esc}{$crlf}" . "{$esc} ========================================================{$crlf}" . "{$crlf}", $compress); set_time_limit(0); if (SQL_LAYER == 'mysql') { $database = "`{$database}`"; } foreach ($tables as $table) { if ($structure) { DBCtrl::output("{$crlf}{$esc}{$crlf}" . "{$esc} Table structure for table '{$table}'{$crlf}" . "{$esc}{$crlf}{$crlf}", $compress); DBCtrl::output(SQLCtrl::get_table_struct($database, $table, $crlf, $drop) . ";{$crlf}{$crlf}", $compress); } if ($data) { DBCtrl::output("{$crlf}{$esc}{$crlf}" . "{$esc} Dumping data for table '{$table}'{$crlf}" . "{$esc}{$crlf}{$crlf}", $compress); SQLCtrl::get_table_content($database, $table, $crlf, false, true, $compress); } } if ($compress) { DBCtrl::output('', true, true); } exit; }
public function printAttachments($type, $id) { global $dbh; global $SETTINGS; $return = ''; $allowsAttachments = in_array($type, ['employee', 'order', 'expense']); //anything that has an attachment, show it with a delete option $sth = $dbh->prepare('SELECT attachmentID, employeeID, uploadTime, name, extension FROM attachments WHERE type = :type AND id = :id'); $sth->execute([':type' => $type, ':id' => $id]); $result = $sth->fetchAll(); $hasAttachments = count($result) > 0 ? true : false; //if type currently allows attachments OR already has attachments, build the section if ($allowsAttachments || $hasAttachments) { $addStr = $allowsAttachments == true ? 'class="controlAdd addEnabled" href="#"' : 'class="controlAdd addDisabled" href="#" title="This item type is not currently configured to allow attachments."'; $return = '<section> <h2>Attachments</h2> <div class="sectionData"> <div class="customAddLink" id="addAttachment"><a ' . $addStr . '>Add Attachment</a></div> <table class="attachmentTable" style="width:100%;"> <thead> <tr> <th class="textLeft">Attachment</th> <th class="textLeft">Added By</th> <th class="textLeft">Uploaded</th> <th></th> </tr> </thead> <tbody>'; if ($hasAttachments) { foreach ($result as $row) { $return .= '<tr><td><a href="attachment.php?id=' . $row['attachmentID'] . '">' . $row['name'] . '.' . $row['extension'] . '</a></td>'; $return .= '<td>' . getLinkedName('employee', $row['employeeID']) . '</td>'; $return .= '<td>' . formatDateTime($row['uploadTime']) . '</td>'; $return .= '<td class="textCenter"><a class="controlDelete deleteEnabled" href="#" data-id="' . $row['attachmentID'] . '"></a></td></tr>'; } } $return .= '</tbody> </table> </div> </section>'; } return $return; }
public function afterFind($results, $primary = false) { foreach ($results as $key => $val) { if (isset($val[$this->alias]['date_joined']) && $val[$this->alias]['date_joined'] != '0000-00-00 00:00:00') { $results[$key][$this->alias]['date_joined'] = formatDate($val[$this->alias]['date_joined']); } if (isset($val[$this->alias]['last_login']) && $val[$this->alias]['last_login'] != '0000-00-00 00:00:00') { $results[$key][$this->alias]['last_login'] = formatDateTime($val[$this->alias]['last_login']); } else { $results[$key][$this->alias]['last_login'] = __('Never'); } // if (isset($val[$this->alias]['active'])){ // $states = $this->stateOptions(); // $results[$key][$this->alias]['active'] = $states[$results[$key][$this->alias]['active']]; // } } return $results; }
function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$joined, &$profile_img, &$profile, &$search_img, &$search, &$pm_img, &$pm, &$email_img, &$email, &$www_img, &$www) { global $lang, $images, $board_config, $MAIN_CFG; static $ranksrow; if (!is_array($ranksrow)) { global $db; $ranksrow = $db->sql_ufetchrowset("SELECT * FROM " . RANKS_TABLE . " ORDER BY rank_special, rank_min", SQL_ASSOC); } $from = !empty($row['user_from']) ? $row['user_from'] : ' '; $joined = formatDateTime($row['user_regdate'], _DATESTRING2); $posts = $row['user_posts'] ? $row['user_posts'] : 0; $email_img = $email = ''; for ($j = 0; $j < count($ranksrow); $j++) { if ($row['user_rank'] && $row['user_rank'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special'] || !$row['user_rank'] && $row['user_posts'] >= $ranksrow[$j]['rank_min'] && !$ranksrow[$j]['rank_special']) { $email = $ranksrow[$j]['rank_title']; $email_img = $ranksrow[$j]['rank_image'] ? '<img src="' . $ranksrow[$j]['rank_image'] . '" alt="' . $email . '" title="' . $email . '" style="border:0;" />' : ''; } } $temp_url = URL::index("Your_Account&profile=" . $row['user_id']); $profile_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_profile'] . '" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" /></a>'; $profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>'; if (is_user() && is_active('Private_Messages')) { $temp_url = URL::index("Private_Messages&mode=post&" . POST_USERS_URL . "=" . $row['user_id']); $pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" style="border:0;" /></a>'; $pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>'; } else { $pm = $pm_img = ''; } if ($row['user_website'] == 'http:///' || $row['user_website'] == 'http://') { $row['user_website'] = ''; } if ($row['user_website'] != '' && substr($row['user_website'], 0, 7) != 'http://') { $row['user_website'] = 'http://' . $row['user_website']; } $www_img = $row['user_website'] ? '<a href="' . $row['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" style="border:0;" /></a>' : ''; $www = $row['user_website'] ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $lang['Visit_website'] . '</a>' : ''; $temp_url = URL::index("Forums&file=search&search_author=" . urlencode($row['user_id']) . "&showresults=posts"); $search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['Search_user_posts'] . '" title="' . $lang['Search_user_posts'] . '" style="border:0;" /></a>'; $search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>'; return; }
function listfeed_ALL(Web &$w) { $w->Report->navigation($w, "Feeds"); // get all feeds $feeds = $w->Report->getFeeds(); // prepare table headings $line = array(array("Feed", "Report", "Description", "Created", "")); // if feeds exists and i am suitably authorised, list them if ($feeds && ($w->Auth->user()->hasRole("report_editor") || $w->Auth->user()->hasRole("report_admin"))) { foreach ($feeds as $feed) { // get report data $rep = $w->Report->getReportInfo($feed->report_id); // display the details if ($rep) { $line[] = array($feed->title, $rep->title, $feed->description, formatDateTime($feed->dt_created), Html::b(WEBROOT . "/report/editfeed/" . $feed->id, " View ") . Html::b(WEBROOT . "/report/deletefeed/" . $feed->id, " Delete ", "Are you sure you wish to DELETE this feed?")); } } } else { // no feeds and/or no access $line[] = array("No feeds to list", "", "", "", ""); } // display results $w->ctx("feedlist", Html::table($line, null, "tablesorter", true)); }
} // Messages $result = $db->sql_query('SELECT * FROM ' . $prefix . "_shoutblock ORDER BY id DESC LIMIT {$conf['number']}"); $bgcolor = $conf['color2']; while ($row = $db->sql_fetchrow($result)) { $bgcolor = $bgcolor != $conf['color1'] ? $conf['color1'] : $conf['color2']; $content .= '<div style="background-color:' . $bgcolor . ';" class="content">'; $row[2] = set_smilies($row[2]); $content .= '<a href="' . getlink('Your_Account&profile=' . $row[1]) . "\"><b>{$row['1']}:</b></a>"; $content .= " {$row['2']}<br />"; if ($conf['date']) { $content .= formatDateTime($row[3], '%d-%b-%Y '); } // date if ($conf['time']) { $content .= formatDateTime($row[3], '%H:%M:%S'); } // time $content .= '</div>'; } $content .= '</div>'; // bottom half if (!$conf['anonymouspost'] && !is_user()) { $content .= '<div style="text-align:center;"><a href="' . getlink('Shoutblock') . '">' . _SSHOUTHISTORY . '</a><br />' . _SREGSHOUT . '<br /><a href="' . getlink('Your_Account') . '">' . _SLOGIN . '</a></div>'; } else { $content .= '<table width="100%" border="0" cellspacing="0" cellpadding="1">'; $content .= '<form id="form1" method="post" action="' . getlink('Shoutblock') . '">'; $content .= '<tr><td align="center" colspan="2"><a href="' . getlink('Shoutblock') . '">' . _SSHOUTHISTORY . '</a><br />'; if ($conf['delyourlastpost'] && !is_user()) { $content .= 'Name: <input type="text" name="uid" size="10" maxlength="30" /><br />'; }
function NewDownloadsDate() { global $downloadsprefix, $db, $module_name; $selectdate = intval($_GET['selectdate']); $dateDB = date("d-M-Y", $selectdate); $dateView = date("F d, Y", $selectdate); include "header.php"; downl_menu_tpl(1); echo '<br />'; OpenTable(); $newdownloadDB = Date("Y-m-d", $selectdate); $totaldownloads = $db->sql_numrows($db->sql_query("SELECT * FROM " . $downloadsprefix . "_downloads WHERE date LIKE '%{$newdownloadDB}%'")); echo "<font class=\"option\"><b>{$dateView} - {$totaldownloads} " . _NEWDOWNLOADS . "</b></font>" . "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"10\" border=\"0\"><tr><td><font class=\"content\">"; $sql = "SELECT lid, cid, title, description, date, hits, url, downloadratingsummary, totalvotes, totalcomments, filesize, version, homepage FROM " . $downloadsprefix . "_downloads WHERE date LIKE '%{$newdownloadDB}%' ORDER BY title ASC"; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $lid = $row['lid']; $cid = $row['cid']; $title = $row['title']; $description = $row['description']; $time = $row['date']; $hits = $row['hits']; $url = $row['url']; $downloadratingsummary = $row['downloadratingsummary']; $totalvotes = $row['totalvotes']; $totalcomments = $row['totalcomments']; $filesize = $row['filesize']; $version = $row['version']; $homepage = $row['homepage']; $downloadratingsummary = number_format($downloadratingsummary, $mainvotedecimal); if (can_admin('downloads')) { if (eregi("http", $url)) { echo "<a href=\"" . adminlink("{$module_name}&mode=DownloadsModDownload&lid={$lid}") . "\"><img src=\"modules/{$module_name}/images/icon30.gif\" border=\"0\" alt=\"" . _EDIT . "\"></a>"; } else { echo "<a href=\"" . adminlink("{$module_name}&mode=DownloadsModDownload&lid={$lid}") . "\"><img src=\"modules/{$module_name}/images/download.gif\" border=\"0\" alt=\"" . _EDIT . "\"></a>"; } } else { if (eregi("http", $url)) { echo "<img src=\"modules/{$module_name}/images/icon30.gif\" border=\"0\" alt=\"\">"; } else { echo "<img src=\"modules/{$module_name}/images/download.gif\" border=\"0\" alt=\"\">"; } } echo " <a href=\"" . getlink("&d_op=getit&lid={$lid}") . "\" class=\"title\">{$title}</a>"; $datetime = formatDateTime($time . ' 00:00:00', _DATESTRING3); newdownloadgraphic($datetime); popgraphic($hits); detecteditorial($lid, 1); echo "<br /><b>" . _DESCRIPTION . ":</b> {$description}<br />"; echo "<b>" . _VERSION . ":</b> {$version} <b>" . _FILESIZE . ":</b> " . CoolSize($filesize) . "<br />"; echo "<b>" . _ADDEDON . ":</b> <b>{$datetime}</b> <b>" . _UDOWNLOADS . ":</b> {$hits}"; $transfertitle = str_replace(" ", "_", $title); /* voting & comments stats */ $votestring = $totalvotes == 1 ? _VOTE : _VOTES; if ($downloadratingsummary != "0" || $downloadratingsummary != "0.0") { echo " <b>" . _RATING . ":</b> {$downloadratingsummary} ({$totalvotes} {$votestring})"; } echo '<br />'; $sql2 = "SELECT title FROM " . $downloadsprefix . "_categories WHERE cid='{$cid}'"; $result2 = $db->sql_query($sql2); $row2 = $db->sql_fetchrow($result2); $ctitle = $row2[title]; $ctitle = getparent($cid, $ctitle); echo "<B>" . _CATEGORY . ":</B> <A HREF=\"" . getlink("&d_op=viewdownload&cid={$cid}") . "\">{$ctitle}</A><br />"; if ($homepage != "") { echo "<br /><a href=\"{$homepage}\" target=\"new\">" . _HOMEPAGE . "</a> | "; } echo "<a href=\"" . getlink("&d_op=ratedownload&lid={$lid}") . "\">" . _RATERESOURCE . "</a>"; if (is_user()) { echo " | <a href=\"" . getlink("&d_op=brokendownload&lid={$lid}") . "\">" . _REPORTBROKEN . "</a>"; } echo " | <a href=\"" . getlink("&d_op=viewdownloaddetails&lid={$lid}") . "\">" . _DETAILS . "</a>"; if ($totalcomments != 0) { echo " | <a href=\"" . getlink("&d_op=viewdownloadcomments&lid={$lid}") . "\">" . _SCOMMENTS . " ({$totalcomments})</a>"; } detecteditorial($lid, 0); echo "<br /><br />"; } echo "</font></td></tr></table>"; CloseTable(); include "footer.php"; }
} # $listingelement = '<!--'.$msg['id'].'-->'.stripslashes($messagedata["campaigntitle"]); if ($msg['status'] == 'draft') { $editlink = PageUrl2('send&id=' . $msg['id']); } $ls->addElement($listingelement, $editlink); $ls->setClass($listingelement, 'row1'); $uniqueviews = Sql_Fetch_Row_Query("select count(userid) from {$tables['usermessage']} where viewed is not null and status = 'sent' and messageid = " . $msg['id']); $clicks = Sql_Fetch_Row_Query("select sum(clicked) from {$tables['linktrack_ml']} where messageid = " . $msg['id']); # $clicks = array(0); /* foreach ($messagedata as $key => $val) { $ls->addColumn($listingelement,$key,$val); } */ $ls->addColumn($listingelement, $GLOBALS['I18N']->get('Entered'), formatDateTime($msg['entered'])); $_GET['id'] = $msg['id']; $statusdiv = '<div id="messagestatus' . $msg['id'] . '">'; include 'actions/msgstatus.php'; $statusdiv .= $status; $statusdiv .= '</div>'; $GLOBALS['pagefooter']['statusupdate' . $msg['id']] = '<script type="text/javascript"> updateMessages.push(' . $msg['id'] . ');</script>'; $GLOBALS['pagefooter']['statusupdate'] = '<script type="text/javascript">window.setInterval("messagesStatusUpdate()",5000);</script>'; if ($msg['status'] == 'sent') { $statusdiv = $GLOBALS['I18N']->get('Sent') . ': ' . $msg['sent']; } $ls->addColumn($listingelement, $GLOBALS['I18N']->get('Status'), $statusdiv); if ($msg['status'] != 'draft') { # $ls->addColumn($listingelement,$GLOBALS['I18N']->get("total"), $msg['astext'] + $msg['ashtml'] + $msg['astextandhtml'] + $msg['aspdf'] + $msg['astextandpdf']); # $ls->addColumn($listingelement,$GLOBALS['I18N']->get("text"), $msg['astext']);
/** * @param $string * @param string $tag * @param string $format * @param null $timezone * @return mixed */ function replaceDates($string, $tag = '%%', $format = DATE_W3C, $timezone = null) { return preg_replace_callback('/' . preg_quote($tag) . '(.*?)' . preg_quote($tag) . '/', function ($matches) use($format, $timezone) { return formatDateTime($matches[1], $format, $timezone); }, $string); }
date_default_timezone_set('UTC'); include 'functions.php'; include 'credentials.php'; $pass = $_POST['pass']; if ($pass != APPPASSWORD) { die('Password Incorrect'); } include 'db_connect.php'; $id = $_POST['id']; $heading = $_POST['heading']; $entry = $_POST['entry']; $entrycontent = $_POST['entrycontent']; $now = $_POST['now']; $seconds = $now; $query = "SELECT * from entries WHERE id=" . $id; $res = $con->query($query); $row = mysqli_fetch_array($res, MYSQLI_ASSOC); // die(date("Y-m-d H:i:s", $seconds)); $handle = fopen("entries/" . $id . ".entry", 'w+') or die("Unable to open file!"); $str = fread($handle, filesize($id . ".entry")); if (htmlspecialchars($heading, ENT_QUOTES) == $row['heading'] && $entry == $str) { die('Last Updated ' . formatDateTime(strtotime($row['updated']))); } fwrite($handle, $entry) or die("Unable to write to file!"); fclose($handle); $query = "UPDATE entries SET heading = '" . htmlspecialchars($heading, ENT_QUOTES) . "', entry = '" . htmlspecialchars($entrycontent, ENT_QUOTES) . "', created = created, updated = '" . date("Y-m-d H:i:s", $seconds) . "' WHERE id=" . $id; if ($con->query($query)) { echo die('Last Updated ' . formatDateTime(strtotime(date("Y-m-d H:i:s", $seconds)))); } else { echo mysqli_error($con); }
</tr> </thead> <tbody> <?php function formatDateTime($dt) { return $dt->format('j-M-Y') . "<br/>" . $dt->format('g:iA'); } foreach ($soldiers as $s) { $userid = $s->id; $name = $s->name; $email = $s->email; $phone = $s->phone; $notes = $s->notes; $joindate = formatDateTime($s->joindate); $updatedate = formatDateTime($s->updatedate); $notesclass = ''; if (!is_null($notes)) { $notes = htmlentities($notes); $notesclass = 'hasnotes'; } $notgivenhtml = ''; foreach ($s->stops_notgiven as $st) { $notgivenhtml .= getStopHtml($st, 'not-given'); } $givenhtml = ''; foreach ($s->stops_given as $st) { $givenhtml .= getStopHtml($st, 'no-tasks'); } echo <<<SOLDIER_ROW <tr data-userid='{$userid}'>
function endtimelog_ALL(Web &$w) { // get time log $log = $w->Task->getTimeLogEntry($_REQUEST['logid']); // get the task $task = $w->Task->getTask($_REQUEST["taskid"]); $tasktitle = $task->title; if ($log) { // set log end. used in comment $log->dt_end = date("Y-m-d G:i"); // set comment $comment = "Time Log Entry: " . $w->Task->getUserById($log->user_id) . " - " . formatDateTime($log->dt_start) . " to " . formatDateTime($log->dt_end); if ($_REQUEST['comments'] != "") { $comment .= " - Comments: " . htmlspecialchars($_REQUEST['comments']); } // add comment $comm = new TaskComment($w); $comm->obj_table = $task->getDbTableName(); $comm->obj_id = $_REQUEST["taskid"]; $comm->comment = $comment; $comm->insert(); // add to context for notifications post listener $w->ctx("TaskComment", $comm); $w->ctx("TaskEvent", "time_log"); // update time log entry $log->dt_end = date("Y-m-d G:i"); $log->comment_id = $comm->id; $log->update(); } // if 'Save Comment' display current entry and restart time log if ($_REQUEST['restart'] == "yes") { // create page $html = "<html><head><title>Task Time Log - " . $task->title . "</title>" . "<style type=\"text/css\">" . "body { background-color: #8ad228; }" . "td { background-color: #ffffff; color: #000000; font-family: verdana, arial; font-weight: bold; font-size: .8em; }" . "td.startend { background-color: #d2efab; color: #000000; font-family: verdana, arial; font-weight: bold; font-size: .9em; }" . "td.timelog { background-color: #75ba4d; color: #000000; font-family: verdana, arial; font-weight: bold; font-size: .9em; }" . "td.tasktitle { background-color: #9fea72; color: #000000; font-family: verdana, arial; font-weight: bold; font-size: .8em; }" . "a { text-decoration: none; } " . "a:hover { color: #ffffff; } " . "</style>" . "<script language=\"javascript\">" . "function reStart() {" . "\tlocation.href = \"/task/starttimelog/" . $_REQUEST["taskid"] . "\";" . "}" . "var c = setTimeout('reStart()',2000);" . "</script></head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>" . "<table cellpadding=2 cellspacing=2 border=0 width=100%>" . "<tr align=center><td colspan=2 class=timelog>Task Time Log</td></tr>" . "<tr align=center><td colspan=2 class=tasktitle><a title=\"View Task\" href=\"javascript: goTask();\">" . $tasktitle . "</a></td></tr>" . "<tr align=center><td width=50% class=startend>Start</td><td width=50% class=startend>Stop</td></tr>" . "<tr align=center><td>" . date("g:i a", $log->dt_start) . "</td><td>" . date("g:i a", strtotime($log->dt_end)) . "</td></tr>" . "<tr align=center><td colspan=2 class=timelog> </td></tr>" . "<tr><td colspan=2 class=startend>Comments</td></tr>" . "<tr><td colspan=2>" . str_replace("\n", "<br>", $_POST['comments']) . "</td></tr>" . "</table>" . "</body></html>"; } else { $html = "<html><head>" . "<script language=\"javascript\">" . "self.close();" . "</script></head></html>"; } // output page $w->setLayout(null); $w->out($html); }
max(um.viewed) as lastview, count(um.viewed) as viewcount, abs(unix_timestamp(um.entered) - unix_timestamp(um.viewed)) as responsetime from %s um, %s user, %s msg where um.messageid = %d and um.messageid = msg.id and um.userid = user.id and um.status = "sent" and um.viewed is not null %s group by userid %s', $GLOBALS['tables']['usermessage'], $GLOBALS['tables']['user'], $GLOBALS['tables']['message'], $id, $subselect, $limit)); $summary = array(); while ($row = Sql_Fetch_Array($req)) { if ($download) { ## with download, the 50 per page limit is not there. set_time_limit(60); $element = $row['email']; } else { $element = shortenTextDisplay($row['email'], 15); } $ls->addElement($element, PageUrl2('userhistory&id=' . $row['userid'])); $ls->setClass($element, 'row1'); $ls->addRow($element, '<div class="listingsmall gray">' . $GLOBALS['I18N']->get('sent') . ': ' . formatDateTime($row['sent'], 1) . '</div>', ''); if ($row['viewcount'] > 1) { $ls->addColumn($element, $GLOBALS['I18N']->get('firstview'), formatDateTime($row['firstview'], 1)); $ls->addColumn($element, $GLOBALS['I18N']->get('lastview'), formatDateTime($row['lastview'])); $ls->addColumn($element, $GLOBALS['I18N']->get('views'), $row['viewcount']); } else { $ls->addColumn($element, $GLOBALS['I18N']->get('firstview'), formatDateTime($row['firstview'], 1)); $ls->addColumn($element, $GLOBALS['I18N']->get('responsetime'), secs2time($row['responsetime'])); } } if ($download) { ob_end_clean(); print $ls->tabDelimited(); } else { print $ls->display(); }
*/ if ($_POST['action'] == 'history') { $return = ['status' => 'success', 'html' => '']; $limit = (int) $_POST['limit']; //cast as int because we can't use a placeholder for LIMIT $limit = $limit < 0 || $limit > 10000 ? 10000 : $limit; $sth = $dbh->prepare('SELECT * FROM changes WHERE type = :type AND id = :id ORDER BY changeTime DESC LIMIT ' . $limit); $sth->execute([':type' => $_POST['type'], ':id' => $_POST['id']]); $result = $sth->fetchAll(); $parsed = parseHistory($_POST['type'], $result); foreach ($parsed as $row) { $return['html'] .= '<tr><td data-sort="' . $row['changeTime'] . '">' . formatDateTime($row['changeTime']) . '</td>'; $return['html'] .= '<td>' . getLinkedName('employee', $row['employeeID']) . '</td>'; $return['html'] .= '<td>' . $row['data'] . '</td></tr>'; } echo json_encode($return); } /* Function: addAttachment Inputs: Outputs: */ if ($_POST['action'] == 'addAttachment') { $return = ['status' => 'fail']; if ($_FILES['uploadFile']['error'] == 0) { $pos = strrpos($_FILES['uploadFile']['name'], '.'); $name = $pos !== false ? substr($_FILES['uploadFile']['name'], 0, $pos) : $_FILES['uploadFile']['name'];
$db->sql_freeresult($result_a); } $sql = 'SELECT s.*, sc.title AS cattitle, t.topicimage, t.topictext FROM ' . $prefix . '_stories AS s LEFT JOIN ' . $prefix . '_stories_cat AS sc ON (sc.catid=s.catid) LEFT JOIN ' . $prefix . '_topics t ON t.topicid=s.topic WHERE '; $sql .= $catid > 0 ? "s.catid='{$catid}' {$querylang} ORDER BY" : "{$qdb} {$querylang} ORDER BY display_order DESC,"; $result = $db->sql_query($sql . ' sid DESC LIMIT ' . $storynum . ' OFFSET ' . $offset); // $sql .= ($catid > 0) ? "s.catid='$catid' $querylang ORDER BY sid DESC" : "$qdb $querylang ORDER BY display_order DESC, time DESC"; // $result = $db->sql_query($sql.' LIMIT '.$storynum.' OFFSET 0'); require_once 'includes/nbbcode.php'; while ($row = $db->sql_fetchrow($result, SQL_ASSOC)) { $title = $row['title']; $row['hometext'] = decode_bb_all($row['hometext'], 1, true); $morecount = strlen($row['bodytext']); $comments = $row['comments']; $datetime = formatDateTime($row['time'], _DATESTRING); $story_link = '<a href="' . URL::index('News&file=article&sid=' . $row['sid']) . '">'; $morelink = $commentlink = $catlink = ''; if ($morecount > 0 || $comments > 0) { $morelink .= $story_link . '<b>' . _READMORE . '</b></a>'; if ($morecount > 0) { $morelink .= ' (' . filesize_to_human($morecount) . ') | '; } else { $morelink .= ' | '; } } if ($row['acomm']) { if ($comments == 0) { $commentlink = $story_link . _COMMENTSQ . '</a> | '; } elseif ($comments == 1) { $commentlink = $story_link . $comments . ' ' . _COMMENT . '</a> | ';
<div align="left"> <a href="<?php echo $recWebsite['WEBSITE_URL']; ?> "><?php echo $recWebsite['WEBSITE_URL']; ?> </a></div> </td> <td></td> <td> <?php if ($rowHCIAD = getHighestClickthroughsSentInADayForSeller($pageId)) { ?> <div align="left"> On the <?php echo formatDateTime($rowHCIAD['CLICK_DATE'], 'dS F Y'); ?> , <strong><?php echo $recWebsite['WEBSITE_NAME']; ?> </strong> sent <strong><?php echo $rowHCIAD['C']; ?> </strong> users to one advertiser.</div> <?php } ?> </td> </tr> <tr> <td> </td>
} $result = $db->sql_query('SELECT s.*, c.title as cattitle, t.topicimage, t.topictext FROM ' . $prefix . '_stories s LEFT JOIN ' . $prefix . '_stories_cat c ON c.catid=s.catid LEFT JOIN ' . $prefix . '_topics t ON t.topicid=s.topic WHERE s.sid=' . $sid); if ($db->sql_numrows($result) != 1) { URL::redirect(URL::index()); } $story = $db->sql_fetchrow($result); $db->sql_freeresult($result); $db->sql_query('UPDATE ' . $prefix . '_stories SET counter=counter+1 WHERE sid=' . $sid); $pagetitle .= _NewsLANG . ' ' . _BC_DELIM . ' ' . $story['title']; require_once 'includes/nbbcode.php'; $datetime = formatDateTime($story['time'], _DATESTRING); $hometext = decode_bb_all($story['hometext'], 1, true); $bodytext = decode_bb_all($story['bodytext'], 1, true); $notes = decode_bb_all($story['notes'], 1, true); if ($story['catid'] > 0) { $story['title'] = '<a href="' . URL::index('&catid=' . $story['catid']) . '"><span class="storycat">' . $story['cattitle'] . '</span></a>: ' . $story['title']; } $code_lang = get_langcode($language); $story['topicimage'] = $story['topicimage'] != '' ? $story['topicimage'] : 'AllTopics.gif'; $story['informant'] = $story['informant'] != '' ? '<a href="' . URL::index('Your_Account&profile=' . $story['informant']) . "\">{$story['informant']}</a>" : _ANONYMOUS; $cpgtpl->assign_vars(array('IMG_TOPIC' => (file_exists("themes/{$CPG_SESS['theme']}/images/topics/" . $story['topicimage']) ? "themes/{$CPG_SESS['theme']}/" : '') . 'images/topics/' . $story['topicimage'], 'NEWS_ADMIN' => can_admin('News') ? '<a href="' . URL::admin('&edit=' . $sid) . '">' . _EDIT . '</a> | <a href="' . URL::admin('&del=' . $sid) . '">' . _DELETE . '</a>' : '', 'S_AUTHOR' => $story['aid'], 'S_INFORMANT' => $story['informant'], 'S_NOTE' => _NOTE, 'S_NOTES' => $notes, 'S_POSTEDBY' => _POSTEDBY, 'S_STORY' => $hometext, 'S_STORYEXT' => $bodytext, 'S_ON' => _ON, 'S_TEXTCOLOR1' => $textcolor1, 'S_TEXTCOLOR2' => $textcolor2, 'S_TIME' => " {$datetime} ", 'S_READS' => "({$story['counter']} " . _READS . ")", 'S_TITLE' => $story['title'], 'S_TOPIC' => $story['topictext'], 'S_WRITES' => _WRITES, 'S_SID' => $sid, 'U_NEWTOPIC' => URL::index('&topic=' . $story['topic']))); // Show Associated topics $assoc = ''; if ($story['associated'] != '') { if (substr($story['associated'], -1) == '-') { $story['associated'] = substr($story['associated'], 0, -1);
$length = 5; //number of thumbs $title_length = 15; //length of title below thumb // marquee info at http://www.faqs.org/docs/htmltut/_MARQUEE.html $body_length = 50; //length of body of comment to show $auth_length = 10; //length of author name to show $content = '<a name="scroller"></a><marquee loop="1" behavior="scroll" direction="up" height="150" scrollamount="1" scrolldelay="1" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'><p style="text-align:center;">'; // END USER DEFINEABLES $result = $db->sql_query("SELECT p.pid, p.title, filepath, filename, msg_author, msg_date, msg_body FROM (" . $cpg_prefix . "comments as c, " . $cpg_prefix . "pictures AS p) INNER JOIN " . $cpg_prefix . "albums AS a ON (p.aid = a.aid AND " . VIS_GROUPS . ") WHERE c.pid=p.pid AND approved=1 ORDER BY msg_date DESC LIMIT {$length}"); $pic = 0; $thumb_title = $date = $author = $messagebody = ''; while ($row = $db->sql_fetchrow($result)) { if ($CONFIG['seo_alts'] == 0) { $thumb_title = $row['filename']; } else { if ($row['title'] != '') { $thumb_title = $row['title']; } else { $thumb_title = substr($row['filename'], 0, -4); } } $date = formatDateTime($row['msg_date'], LASTCOM_DATE_FMT); $author = $row["msg_author"]; $messagebody = $row["msg_body"]; $content .= '<a href="' . URL::index($cpg_dir . '&file=displayimage&meta=lastcom&cat=0&pos=' . $pic) . '"><img src="' . get_pic_url($row, 'thumb') . '" style="border:0;" alt="' . $thumb_title . '" title="' . $thumb_title . '" /><br />' . truncate_stringblocks($author, $auth_length) . '</a> <br />' . truncate_stringblocks($messagebody, $body_length) . '<br />(' . $date . ')<br /><br />'; $pic++; } $content .= '</p></marquee><p style="text-align:center;"><a href="' . URL::index($cpg_dir) . '">' . _coppermineLANG . '</a></p>';
LEFT JOIN ' . $user_prefix . '_users u ON (u.user_id = p.poster_id) WHERE t.forum_id=f.forum_id' . $query_restriction . ' ORDER BY t.topic_last_post_id DESC LIMIT ' . $count); //Check if at least one Topic exists and say if isn't if ($db->sql_numrows($result) < 1) { $content = _ERROR; return trigger_error('There are no forum posts', E_USER_NOTICE); } else { $tracking_topics = isset($CPG_SESS['Forums']['track_topics']) ? $CPG_SESS['Forums']['track_topics'] : array(); $tracking_forums = isset($CPG_SESS['Forums']['track_forums']) ? $CPG_SESS['Forums']['track_forums'] : array(); while ($row = $db->sql_fetchrow($result)) { $topic_id = $row['topic_id']; $forum_id = $row['forum_id']; $post_date = MB::tolower(formatDateTime($row['post_time'], '%d. %b')); $post_time = formatDateTime($row['post_time'], '%T'); $post_time_ago = getTimeAgo($row['post_time'], dfTime()); $new_post = 0; if (is_user() && $row['post_time'] > $userinfo['user_lastvisit'] && (!empty($tracking_topics) || !empty($tracking_forums) || isset($CPG_SESS['Forums']['track_all']))) { $new_post = 1; if (!empty($tracking_topics[$topic_id]) && $tracking_topics[$topic_id] > $row['post_time'] || !empty($tracking_forums[$forum_id]) && $tracking_forums[$forum_id] > $row['post_time'] || isset($CPG_SESS['Forums']['track_all']) && $CPG_SESS['Forums']['track_all'] > $row['post_time']) { $new_post = 0; } } $cpgtpl->assign_block_vars('topic', array('LAST_POST_LINK' => getlink('Forums&file=viewtopic&p=' . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id']), 'TOPIC_TITLE' => $row['topic_title'], 'TOPIC_REPLIES' => $row['topic_replies'], 'LAST_POST_USERNAME' => $row['username'], 'USER_LINK' => getlink('Your_Account&profile=' . $row['user_id']), 'LAST_POST_DATE' => $post_date, 'LAST_POST_TIME' => $post_time, 'LAST_POST_TIME_AGO' => $post_time_ago, 'S_NEW_POST' => $new_post, 'FORUM_NAME' => $row['forum_name'])); } $cpgtpl->assign_var('FORUMS_URL', getlink('Forums')); } //Uncomment this, if you need translated strings: /* $cpgtpl->assign_vars(array(
$listingelement = '<!--' . $msg['id'] . '-->' . stripslashes($msg["subject"]); if ($msg['status'] == 'draft') { $editlink = PageUrl2("send&id=" . $msg["id"]); } $ls->addElement($listingelement, $editlink); $ls->setClass($listingelement, 'row1'); $uniqueviews = Sql_Fetch_Row_Query("select count(userid) from {$tables["usermessage"]} where viewed is not null and status = 'sent' and messageid = " . $msg["id"]); $clicks = Sql_Fetch_Row_Query("select sum(clicked) from {$tables["linktrack_ml"]} where messageid = " . $msg["id"]); # $clicks = array(0); $messagedata = loadMessageData($msg['id']); /* foreach ($messagedata as $key => $val) { $ls->addColumn($listingelement,$key,$val); } */ $ls->addColumn($listingelement, $GLOBALS['I18N']->get("Entered"), formatDateTime($msg["entered"])); $_GET['id'] = $msg['id']; $statusdiv = '<div id="messagestatus' . $msg['id'] . '">'; include 'actions/msgstatus.php'; $statusdiv .= $status; $statusdiv .= '</div>'; $GLOBALS['pagefooter']['statusupdate' . $msg['id']] = '<script type="text/javascript"> updateMessages.push(' . $msg['id'] . ');</script>'; $GLOBALS['pagefooter']['statusupdate'] = '<script type="text/javascript">window.setInterval("messagesStatusUpdate()",5000);</script>'; if ($msg['status'] == 'sent') { $statusdiv = $GLOBALS['I18N']->get("Sent") . ": " . $msg['sent']; } $ls->addColumn($listingelement, $GLOBALS['I18N']->get("Status"), $statusdiv); if ($msg['status'] != 'draft') { # $ls->addColumn($listingelement,$GLOBALS['I18N']->get("total"), $msg['astext'] + $msg['ashtml'] + $msg['astextandhtml'] + $msg['aspdf'] + $msg['astextandpdf']); # $ls->addColumn($listingelement,$GLOBALS['I18N']->get("text"), $msg['astext']);
$resptime = 0; $totalresp = 0; while ($msg = Sql_Fetch_Array($msgs)) { $ls->addElement($msg["messageid"], PageURL2("message", $GLOBALS['I18N']->get('view'), "id=" . $msg["messageid"])); if (defined('CLICKTRACK') && CLICKTRACK) { $clicksreq = Sql_Fetch_Row_Query(sprintf('select sum(clicked) as numclicks from %s where userid = %s and messageid = %s', $GLOBALS['tables']['linktrack_uml_click'], $user['id'], $msg['messageid'])); $clicks = sprintf('%d', $clicksreq[0]); if ($clicks) { $ls->addColumn($msg["messageid"], $GLOBALS['I18N']->get('clicks'), PageLink2('userclicks&userid=' . $user['id'] . '&msgid=' . $msg['messageid'], $clicks)); } else { $ls->addColumn($msg["messageid"], $GLOBALS['I18N']->get('clicks'), 0); } } $ls->addColumn($msg["messageid"], $GLOBALS['I18N']->get('sent'), formatDateTime($msg["entered"], 1)); if (!$msg['notviewed']) { $ls->addColumn($msg["messageid"], $GLOBALS['I18N']->get('viewed'), formatDateTime($msg["viewed"], 1)); $ls->addColumn($msg["messageid"], $GLOBALS['I18N']->get('responsetime'), $msg['responsetime']); $resptime += $msg['responsetime']; $totalresp += 1; } if (!empty($bounces[$msg["messageid"]])) { $ls->addColumn($msg["messageid"], $GLOBALS['I18N']->get('bounce'), $bounces[$msg["messageid"]]); } } if ($totalresp) { $avgresp = sprintf('%d', $resptime / $totalresp); $ls->addElement($GLOBALS['I18N']->get('average')); $ls->setClass($GLOBALS['I18N']->get('average'), 'row1'); $ls->addColumn($GLOBALS['I18N']->get('average'), $GLOBALS['I18N']->get('responsetime'), $avgresp); } }
CPG Dragonfly™ CMS ******************************************** Copyright © 2004 - 2005 by CPG-Nuke Dev Team http://www.dragonflycms.com Dragonfly is released under the terms and conditions of the GNU GPL version 2 or any later version $Source: /cvs/modules/Blogs/blocks/block-Blogs.php,v $ $Revision: 1.3 $ $Author: phoenix $ $Date: 2007/09/20 09:34:46 $ **********************************************/ if (!defined('CPG_NUKE')) { exit; } get_lang('blogs'); global $db, $prefix, $userinfo; $entries = 7; //entries to show $content = ''; $result = $db->sql_query("SELECT id, aid, title, timestamp FROM " . $prefix . "_blogs WHERE private='0' OR aid='" . $userinfo['username'] . "' ORDER BY timestamp DESC LIMIT {$entries}"); if ($db->sql_numrows($result)) { $content .= '<div style="text-align:left;">' . _B_FRESH . '<br />'; while (list($blog_id, $blog_author, $blog_title, $blog_timestamp) = $db->sql_fetchrow($result)) { $content .= '<a title="' . formatDateTime($blog_timestamp, _DATESTRING2) . '" href="' . getlink('Blogs&mode=display&id=' . $blog_id) . '"><b>•</b> ' . $blog_title . '</a><br />'; } $content .= '</div>'; } $db->sql_freeresult($result); $content .= '<p style="text-align:center;"><a href="' . getlink('Blogs&mode=add') . '">' . _B_STARTBLOGGING . '</a></p>';
function categorynewdownloadgraphic($cat) { global $downloadsprefix, $db, $module_name; $newresult = $db->sql_query("SELECT date FROM " . $downloadsprefix . "_downloads WHERE cid={$cat} order by date desc limit 0,1"); list($time) = $db->sql_fetchrow($newresult); echo ' '; $datetime = formatDateTime($time . ' 00:00:00', _DATESTRING3); $count = 0; while ($count <= 7) { $daysold = date("d-M-Y", gmtime() - 86400 * $count); if ($daysold == $datetime) { if ($count <= 1) { echo "<img src=\"modules/{$module_name}/images/new_1.gif\" alt=\"" . _DCATNEWTODAY . "\" />"; } if ($count <= 3 && $count > 1) { echo "<img src=\"modules/{$module_name}/images/new_3.gif\" alt=\"" . _DCATLAST3DAYS . "\" />"; } if ($count <= 7 && $count > 3) { echo "<img src=\"modules/{$module_name}/images/new_7.gif\" alt=\"" . _DCATTHISWEEK . "\" />"; } } $count++; } }
function edit_GET($w) { $p = $w->pathMatch("id"); $task = !empty($p["id"]) ? $w->Task->getTask($p["id"]) : new Task($w); if (!empty($task->id) && !$task->canView($w->Auth->user())) { $w->error("You do not have permission to edit this Task", "/task/tasklist"); } // Get a list of the taskgroups and filter by what can be used $taskgroups = array_filter($w->Task->getTaskGroups(), function ($taskgroup) { return $taskgroup->getCanICreate(); }); $tasktypes = array(); $priority = array(); $members = array(); // Try and prefetch the taskgroup by given id $taskgroup = null; $taskgroup_id = $w->request("gid"); if (!empty($taskgroup_id) || !empty($task->task_group_id)) { $taskgroup = $w->Task->getTaskGroup(!empty($task->task_group_id) ? $task->task_group_id : $taskgroup_id); if (!empty($taskgroup->id)) { $tasktypes = $w->Task->getTaskTypes($taskgroup->task_group_type); $priority = $w->Task->getTaskPriority($taskgroup->task_group_type); $members = $w->Task->getMembersBeAssigned($taskgroup->id); sort($members); } } // Create form $form = array(!empty($p["id"]) ? "Edit task" : "Create a new task" => array(array(!empty($p["id"]) ? array("Task Group", "text", "-task_group_id_text", $taskgroup->title) : array("Task Group", "autocomplete", "task_group_id", !empty($task->task_group_id) ? $task->task_group_id : $taskgroup_id, $taskgroups), !empty($p["id"]) ? array("Task Type", "select", "-task_type", $task->task_type, $tasktypes) : array("Task Type", "select", "task_type", $task->task_type, $tasktypes)), array(array("Task Title", "text", "title", $task->title), array("Status", "select", "status", $task->status, $task->getTaskGroupStatus())), array(array("Priority", "select", "priority", $task->priority, $priority), array("Date Due", "date", "dt_due", formatDate($task->dt_due)), !empty($taskgroup) && $taskgroup->getCanIAssign() ? array("Assigned To", "select", "assignee_id", $task->assignee_id, $members) : array("Assigned To", "select", "-assignee_id", $task->assignee_id, $members)), array(array("Description", "textarea", "description", $task->description)))); if (empty($p['id'])) { History::add("New Task"); } else { History::add("Task: {$task->title}"); } $w->ctx("task", $task); $w->ctx("form", Html::multiColForm($form, $w->localUrl("/task/edit/{$task->id}"), "POST", "Save", "edit_form")); ////////////////////////// // Build time log table // ////////////////////////// $timelog = $task->getTimeLog(); $total_seconds = 0; $table_header = array("Assignee", "Start", "Period (hours)", "Comment", "Actions"); $table_data = array(); if (!empty($timelog)) { // for each entry display, calculate period and display total time on task foreach ($timelog as $log) { // get time difference, start to end $seconds = $log->dt_end - $log->dt_start; $period = $w->Task->getFormatPeriod($seconds); $comment = $w->Comment->getComment($log->comment_id); $comment = !empty($comment) ? $comment->comment : ""; $table_row = array($w->Task->getUserById($log->user_id), formatDateTime($log->dt_start), $period, !empty($comment) ? $w->Comment->renderComment($comment) : ""); // Build list of buttons $buttons = ''; if ($log->is_suspect == "0") { $total_seconds += $seconds; $buttons .= Html::box($w->localUrl("/task/addtime/" . $task->id . "/" . $log->id), " Edit ", true); } if ($w->Task->getIsOwner($task->task_group_id, $w->Auth->user()->id)) { $buttons .= Html::b($w->localUrl("/task/suspecttime/" . $task->id . "/" . $log->id), empty($log->is_suspect) || $log->is_suspect == "0" ? "Review" : "Accept"); } $buttons .= Html::b($w->localUrl("/task/deletetime/" . $task->id . "/" . $log->id), "Delete", "Are you sure you wish to DELETE this Time Log Entry?"); $table_row[] = $buttons; $table_data[] = $table_row; } $table_data[] = array("<b>Total</b>", "", "<b>" . $w->Task->getFormatPeriod($total_seconds) . "</b>", "", ""); } // display the task time log $w->ctx("timelog", Html::table($table_data, null, "tablesorter", $table_header)); /////////////////// // Notifications // /////////////////// $notify = null; // If I am assignee, creator or task group owner, I can get notifications for this task if (!empty($task->id) && $task->getCanINotify()) { // get User set notifications for this Task $notify = $w->Task->getTaskUserNotify($w->Auth->user()->id, $task->id); if (empty($notify)) { $logged_in_user_id = $w->Auth->user()->id; // Get my role in this task group $me = $w->Task->getMemberGroupById($task->task_group_id, $logged_in_user_id); $type = ""; if ($task->assignee_id == $logged_in_user_id) { $type = "assignee"; } else { if ($task->getTaskCreatorId() == $logged_in_user_id) { $type = "creator"; } else { if ($w->Task->getIsOwner($task->task_group_id, $logged_in_user_id)) { $type = "other"; } } } if (!empty($type) && !empty($me)) { $notify = $w->Task->getTaskGroupUserNotifyType($logged_in_user_id, $task->task_group_id, strtolower($me->role), $type); } } // create form. if still no 'notify' all boxes are unchecked $form = array("Notification Events" => array(array(array("", "hidden", "task_creation", "0")), array(array("Task Details Update", "checkbox", "task_details", !empty($notify->task_details) ? $notify->task_details : null), array("Comments Added", "checkbox", "task_comments", !empty($notify->task_comments) ? $notify->task_comments : null)), array(array("Time Log Entry", "checkbox", "time_log", !empty($notify->time_log) ? $notify->time_log : null), array("Task Data Updated", "checkbox", "task_data", !empty($notify->task_data) ? $notify->task_data : null)), array(array("Documents Added", "checkbox", "task_documents", !empty($notify->task_documents) ? $notify->task_documents : null)))); $w->ctx("tasknotify", Html::multiColForm($form, $w->localUrl("/task/updateusertasknotify/" . $task->id), "POST")); } }
function viewtask_GET(Web &$w) { $p = $w->pathMatch("id"); // declare delete button $btndelete = ""; // get relevant object for viewing a task given input task ID $task = $w->Task->getTask($p['id']); $w->ctx("task", $task); $taskdata = $w->Task->getTaskData($p['id']); $group = $w->Task->getTaskGroup($task->task_group_id); $w->Task->navigation($w, "View Task: " . $task->title); // if task is deleted, say as much and return to task list if ($task->is_deleted != 0) { $w->msg("This Task has been deleted", "/task/tasklist/"); } elseif ($task->getCanIView()) { History::add("Task: {$task->title}"); // tab: Task Details // if I can assign tasks, provide dropdown of group members else display current assignee. // my role in group Vs group can_assign value if ($task->getCanIAssign()) { $members = $task ? $w->Task->getMembersBeAssigned($task->task_group_id) : $w->Auth->getUsers(); sort($members); $assign = array("Assigned To", "select", "assignee_id", $task->assignee_id, $members); } else { $assigned = $task->assignee_id == "0" ? "Not Assigned" : $w->Task->getUserById($task->assignee_id); $assign = array("Assigned To", "static", "assignee_id", $assigned); } // changing type = dymanically loading of relevant form fields ... problem when presenting on single page. // array("Task Type","select","task_type",$task->task_type,$task->getTaskGroupTypes()), // check a due date exists $dtdue = $task->dt_due == "0000-00-00 00:00:00" || $task->dt_due == "" ? "" : date('d/m/Y', $task->dt_due); // Guests can view but not edit // See if i am assignee or creator, if yes provide editable form, else provide static display $btndelete = ""; if ($task->getCanIEdit()) { $btndelete = Html::b(WEBROOT . "/task/deletetask/" . $task->id, " Delete Task ", "Are you should you with to DELETE this task?"); // if task is closed and Task Group type says cannot be reopened, display static status if ($task->getisTaskClosed() && !$task->getTaskReopen()) { $status = array("Status", "static", "status", $task->status); } else { $status = array("Status", "select", "status", $task->status, $task->getTaskGroupStatus()); } $f = array(array("Task Details", "section"), array("Title", "text", "title", $task->title), array("Created By", "static", "creator", $task->getTaskCreatorName()), array("Task Group", "static", "tg", $task->getTaskGroupTypeTitle()), array("Task Type", "static", "task_type", $task->getTypeTitle()), array("Description", "static", "tdesc", $task->getTypeDescription()), $status, array("Priority", "select", "priority", $task->priority, $task->getTaskGroupPriority()), array("Date Due", "date", "dt_due", $dtdue), array("Description", "textarea", "description", $task->description, "80", "15"), $assign); } else { $f = array(array("Task Details", "section"), array("Title", "static", "title", $task->title), array("Created By", "static", "creator", $task->getTaskCreatorName()), array("Task Group", "static", "tg", $task->getTaskGroupTypeTitle()), array("Task Type", "static", "task_type", $task->getTypeTitle()), array("Description", "static", "tdesc", $task->getTypeDescription()), array("Status", "static", "status", $task->status), array("Priority", "static", "priority", $task->priority), array("Date Due", "static", "dt_due", $dtdue), array("Description", "static", "description", str_replace("\r\n", "<br>", $task->description)), $assign); } // got additional form fields for this task type $form = $w->Task->getFormFieldsByTask($task->task_type, $group); // if there are additional form fields, display them if ($form) { // string match form fields with task data by key // can then push db:value into form field for display foreach ($form as $x) { if ($x[1] == "section") { array_push($f, $x); } if ($taskdata) { foreach ($taskdata as $td) { $key = $td->key; $value = $td->value; // Guests can view but not edit // See if i am a guest, if yes provide static display, else provide editable form if (!$task->getCanIEdit()) { $x[1] = "static"; } if ($key == $x[2]) { $x[3] = $value; array_push($f, $x); } } } else { if ($x[1] != "section") { array_push($f, $x); } } } } // create form $form = Html::form($f, $w->localUrl("/task/updatetask/" . $task->id), "POST", " Update "); // create 'start time log' button $buttontimelog = ""; if ($task->assignee_id == $w->Auth->user()->id) { $buttontimelog = new \Html\Button(); $buttontimelog->href("/task/starttimelog/{$task->id}")->setClass("startTime button small")->text("Start Time Log"); // $btntimelog = "<button class=\"startTime\" href=\"/task/starttimelog/".$task->id."\"> Start Time Log </button>"; } // display variables $w->ctx("btntimelog", !empty($buttontimelog) ? $buttontimelog->__toString() : ""); $w->ctx("btndelete", $btndelete); $w->ctx("viewtask", $form); $w->ctx("extradetails", $task->displayExtraDetails()); // tab: time log // provide button to add time entry $addtime = ""; if ($task->assignee_id == $w->Auth->user()->id) { $addtime = Html::box(WEBROOT . "/task/addtime/" . $task->id, " Add Time Log entry ", true); } $w->ctx("addtime", $addtime); // get time log for task $timelog = $task->getTimeLog(); // set total period $totseconds = 0; // set headings $line = array(array("Assignee", "Start", "End", "Period (hours)", "Comment", "")); // if log exists, display ... if ($timelog) { // for each entry display, calculate period and display total time on task foreach ($timelog as $log) { // get time difference, start to end $seconds = $log->dt_end - $log->dt_start; $period = $w->Task->getFormatPeriod($seconds); // if suspect, label button, style period, remove edit button if ($log->is_suspect == "1") { $label = " Accept "; $period = "(" . $period . ")"; $bedit = ""; } // if accepted, label button, tally period, include edit button if ($log->is_suspect == "0") { $label = " Review "; $totseconds += $seconds; $bedit = Html::box($w->localUrl("/task/addtime/" . $task->id . "/" . $log->id), " Edit ", true); } // ony Task Group owner gets to reject/accept time log entries $bsuspect = $w->Task->getIsOwner($task->task_group_id, $_SESSION['user_id']) ? Html::b($w->localUrl("/task/suspecttime/" . $task->id . "/" . $log->id), $label) : ""; $line[] = array($w->Task->getUserById($log->user_id), $w->Task->getUserById($log->creator_id), formatDateTime($log->dt_start), formatDateTime($log->dt_end), $period, !empty($w->Comment->getComment($log->comment_id)) ? $w->Comment->getComment($log->comment_id)->comment : "", $bedit . Html::b($w->localUrl("/task/deletetime/" . $task->id . "/" . $log->id), " Delete ", "Are you sure you wish to DELETE this Time Log Entry?") . $bsuspect . Html::box($w->localUrl("/task/popComment/" . $task->id . "/" . $log->comment_id), " Comment ", true)); } $line[] = array("", "", "", "<b>Total</b>", "<b>" . $w->Task->getFormatPeriod($totseconds) . "</b>", ""); } else { $line[] = array("No time log entries have been made", "", "", "", "", ""); } // display the task time log $w->ctx("timelog", Html::table($line, null, "tablesorter", true)); // tab: notifications // if i am assignee, creator or task group owner, i can get notifications for this task if ($task->getCanINotify()) { // get User set notifications for this Task $notify = $w->Task->getTaskUserNotify($_SESSION['user_id'], $task->id); if ($notify) { $task_creation = $notify->task_creation; $task_details = $notify->task_details; $task_comments = $notify->task_comments; $time_log = $notify->time_log; $task_documents = $notify->task_documents; } else { // need my role in group $me = $w->Task->getMemberGroupById($task->task_group_id, $_SESSION['user_id']); // get task creator ID $creator_id = $task->getTaskCreatorId(); // which am i? $assignee = $task->assignee_id == $_SESSION['user_id'] ? true : false; $creator = $creator_id == $_SESSION['user_id'] ? true : false; $owner = $w->Task->getIsOwner($task->task_group_id, $_SESSION['user_id']); // get single type given this is specific to a single Task if ($assignee) { $type = "assignee"; } elseif ($creator) { $type = "creator"; } elseif ($owner) { $type = "other"; } $role = strtolower($me->role); if ($type) { // for type, check the User defined notification table $notify = $w->Task->getTaskGroupUserNotifyType($_SESSION['user_id'], $task->task_group_id, $role, $type); // get list of notification flags if ($notify) { if ($notify->value == "1") { $task_creation = $notify->task_creation; $task_details = $notify->task_details; $task_comments = $notify->task_comments; $time_log = $notify->time_log; $task_documents = $notify->task_documents; $task_pages = $notify->task_pages; } } } } // create form. if still no 'notify' all boxes are unchecked $f = array(array("For which Task Events should you receive Notification?", "section")); $f[] = array("", "hidden", "task_creation", "0"); $f[] = array("Task Details Update", "checkbox", "task_details", !empty($task_details) ? $task_details : null); $f[] = array("Comments Added", "checkbox", "task_comments", !empty($task_comments) ? $task_comments : null); $f[] = array("Time Log Entry", "checkbox", "time_log", !empty($time_log) ? $time_log : null); $f[] = array("Task Data Updated", "checkbox", "task_data", !empty($task_data) ? $task_data : null); $f[] = array("Documents Added", "checkbox", "task_documents", !empty($task_documents) ? $task_documents : null); $form = Html::form($f, $w->localUrl("/task/updateusertasknotify/" . $task->id), "POST", "Save"); // display $w->ctx("tasknotify", $form); } } else { // if i cannot view task details, return to task list with error message // for display get my role in the group, the group owners, the group title and the minimum membership required to view a task $me = $w->Task->getMemberGroupById($task->task_group_id, $_SESSION['user_id']); $myrole = !$me ? "Not a Member" : $me->role; $owners = $w->Task->getTaskGroupOwners($task->task_group_id); // get owners names for display $strOwners = ""; foreach ($owners as $owner) { $strOwners .= $w->Task->getUserById($owner->user_id) . ", "; } $strOwners = rtrim($strOwners, ", "); $form = "You must be at least a <b>" . $group->can_view . "</b> of the Task Group: <b>" . strtoupper($group->title) . "</b>, to view tasks in this group.<p>Your current Membership Level: <b>" . $myrole . "</b><p>Please appeal to the group owner(s): <b>" . $strOwners . "</b> for promotion."; $w->error($form, "/task/tasklist"); } }
function action_updateTagCache() { global $config; doPrint("starting tag cache update..."); print formatDateTime() . "\n"; $data = getData(); $data["lastTagUpdate"] = time(); storeData($data); $oldTags = array(); foreach (file($config["tagCache"]) as $tag) { $tag = trim($tag); $tagArray = explode(";-;", $tag); if (!isset($tagArray[0]) or count($tagArray) != 8) { doPrint("removed invalid entry in tagcache: " . count($tagArray)); doPrint($tagArray); } else { $oldTags[$tagArray[0]] = $tagArray; } } doPrint("got old tag cache"); $tagCache = array(); $files = getFilesForDirectory($config["searchPath"]); $new = 0; $old = 0; $updates = 0; $fp = fopen($config["tagCache"], "w+") or die("cannot open tagCache File for writing"); foreach ($files as $file) { #if(substr($file, -5) == '.flac') { # continue; #} $scan = 0; $newTime = filemtime($config["searchPath"] . "/" . $file); if (!isset($oldTags[$file])) { #doPrint("file is new: ".$file); $scan = 1; $new++; } elseif ($newTime != $oldTags[$file][7]) { #doPrint("file changed and needs update: ".$file); $scan = 1; $updates++; } else { #doPrint("file unchanged: ".$file); $old++; } if (!$scan and isset($oldTags[$file])) { $fileinfo = $oldTags[$file]; } else { $fileinfo = getTag($config["searchPath"] . "/" . $file); array_push($fileinfo, $newTime); array_unshift($fileinfo, $file); } fwrite($fp, join(";-;", $fileinfo) . "\n"); } $data = getData(); $data["lastTagUpdate"] = time(); storeData($data); fclose($fp); print "wrote tag cache\n"; print formatDateTime() . "\n"; doPrint("finished tag cache update..."); doPrint("new: " . $new); doPrint("update: " . $updates); doPrint("old: " . $old); }