function fetchSome($dir, $mode, $limit, $sort) { $fileArray = array(); if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && !is_dir($dir . '/' . $file)) { $fileData = file_get_contents($dir . '/' . $file, NULL, NULL, 0, 1000); // This reads the first 1000 chars for speed. // Pulls details from .org file header. $regex = '/^#\\+\\w*:(.*)/m'; preg_match_all($regex, $fileData, $matches); $date = trim($matches[1][2]); $timestamp = cleanDate($date); $file = $timestamp . '-' . $file; $fileArray[] = $file; } } if ($sort == 'sort') { rsort($fileArray, SORT_NUMERIC); } if ($sort == 'shuffle') { shuffle($fileArray); } if ($limit > '0') { $fileArray = array_slice($fileArray, 0, $limit); } foreach ($fileArray as $file) { $file = ltrim($file, substr($file, 0, 11)); // -----[ LIST ]----- // Fetches list of articles. if ($mode == 'list') { $filePath = $dir . '/' . $file; $urlPath = '/' . $dir . '/' . substr($file, 0, -4) . '/'; if (is_file($filePath)) { $fileData = file_get_contents($filePath, NULL, NULL, 0, 1000); // This reads the first 1000 chars for speed. // Pulls details from .org file header. $regex = '/^#\\+\\w*:(.*)/m'; preg_match_all($regex, $fileData, $matches); $title = trim($matches[1][0]); $link = '<a href="' . $urlPath . '" title="' . $title . '">' . $title . '</a>'; $content = '<li>' . $link . '</li>'; } print $content; } // -----[ ABSTRACT ]----- // Fetches abstracts of articles. if ($mode == 'abstract') { $filePath = $dir . '/' . $file; $urlPath = '/' . $dir . '/' . substr($file, 0, -4) . '/'; if (is_file($filePath)) { $fileData = file_get_contents($filePath, NULL, NULL, 0, 1000); // This reads the first 1000 chars for speed. // Pulls details from .org file header. $regex = '/^#\\+\\w*:(.*)/m'; preg_match_all($regex, $fileData, $matches); $title = trim($matches[1][0]); $author = trim($matches[1][1]); $date = trim($matches[1][2]); $dateTime = date('c', cleanDate($date)); $dateNice = date('F d, Y', cleanDate($date)); $description = trim($matches[1][3]); $link = '<a rel="bookmark" href="' . $urlPath . '" title="' . $title . '">' . $title . '</a>'; $content = '<div class="content"><article><header><h3>' . $dateNice . '</h3><h1>' . $link . '</h1></header><p>' . $description . '</p></article></div>'; } print $content; } // -----[ FEED ]----- // Fetches articles to produce XML feed. if ($mode == 'feed') { $filePath = $dir . '/' . $file; $urlPath = '/' . $dir . '/' . substr($file, 0, -4) . '/'; if (is_file($filePath)) { $fileData = file_get_contents($filePath, NULL, NULL, 0, 1000); // This reads the first 1000 chars for speed. // Pulls details from .org file header. $regex = '/^#\\+\\w*:(.*)/m'; preg_match_all($regex, $fileData, $matches); $title = trim($matches[1][0]); $author = trim($matches[1][1]); $date = trim($matches[1][2]); $date = date('c', cleanDate($date)); $description = trim($matches[1][3]); $absoluteLink = 'http://' . SITEURL . $urlPath . ''; $tagDate = date('Y-m-d', strtotime($date)); $tag = 'tag:' . SITEURL . ',' . $tagDate . ':' . $urlPath; $content = '<entry><title>' . $title . '</title><link href="' . $absoluteLink . '" /><id>' . $tag . '</id><updated>' . $date . '</updated><published>' . $date . '</published><summary>' . $description . '</summary></entry>'; } print $content; } } closedir($handle); } // End: "if($handle...)". }
<?php include "../includes/mysql.php"; include "../includes/functions.php"; include "../includes/sessions.php"; if (isset($_POST['uid'])) { $uid = $_POST['uid']; $chk = mysql_query("SELECT f.*, u.fname, u.lname, u.pic FROM feed f, user u WHERE f.user_id = '{$uid}' AND u.id = f.user_id ORDER BY f.id DESC") or die(mysql_error()); if (mysql_num_rows($chk) > 0) { while ($a = mysql_fetch_array($chk)) { $fid = $a['id']; $pname = $a['fname'] . ' ' . $a['lname']; $ppic = $a['pic']; $feed = tolink($a['feed']); $time = cleanDate($a['time']); ?> <div class="feed"> <div class="fleft"><img src="<?php echo $ppic; ?> "></div> <div class="fright"> <div class="fname"><?php echo $pname; ?> </div> <div class="fpost"><?php echo $feed; ?> </div> <div class="ftime"><?php
function dateInitialTreatment() { return cleanDate($this->billing_options['date_initial_treatment']); }
function json_sumDetCair() { $db_function = new db_function(); $lnc = $_GET['lnc']; $jns = $_GET['jns']; $page = $_GET['page']; $limit = $_GET['rows']; $sidx = $_GET['sidx']; $sord = $_GET['sord']; $tgl = $_GET['tgl']; if ($limit == "") { $limit = 10; } $tgl_update = $tgl . " 23:59:59"; $sql = "select trail.noaplikasi,trail.namadebitur,trail.no_rekg_pinjaman,trail.tgl_pk ,trail.tgl_cair_tahap_fondasi,trail.tgl_cair_tahap_topping,trail.tgl_cair_tahap_bast,trail.tgl_cair_tahap_dok \n from debitur join debitur_trail trail on debitur.no_rekg_pinjaman=trail.no_rekg_pinjaman\n join (\n select max(tgl_update) tgl_update,no_rekg_pinjaman from debitur_trail where tgl_update <= '{$tgl_update}' group by no_rekg_pinjaman) bb\n on trail.no_rekg_pinjaman=bb.no_rekg_pinjaman and trail.tgl_update=bb.tgl_update\n where 1=1 and trail.skim_pencairan='PARTIAL DROW DOWN' and trail.skim_pks in('KAVLING BANGUN','INDENT') :paramwhere: group by trail.lnc"; if (isset($_GET['searchValue']) && trim($_GET['searchValue']) != "") { $sql .= " and " . $_GET['searchBy'] . " like '%" . $_GET['searchValue'] . "%' "; } switch ($jns) { case "debitur": $sql = str_replace(":paramwhere:", "and trail.progress <>'' ", $sql); break; case "pondasi": $sql = str_replace(":paramwhere:", "and trail.progress='BELUM SELESAI' and trail.tgl_cair_tahap_fondasi in(null,'','0000-00-00') ", $sql); break; case "topping": $sql = str_replace(":paramwhere:", "and trail.progress='BELUM SELESAI' and trail.tgl_cair_tahap_fondasi >'0000-00-00' and trail.tgl_cair_tahap_topping in(null,'','0000-00-00') ", $sql); break; case "bast": $sql = str_replace(":paramwhere:", "and trail.progress='BELUM SELESAI' and trail.tgl_cair_tahap_topping >'0000-00-00' and trail.tgl_cair_tahap_bast in(null,'','0000-00-00') ", $sql); break; case "dokumen": $sql = str_replace(":paramwhere:", "and trail.progress='BELUM SELESAI' and trail.tgl_cair_tahap_bast >'0000-00-00' and trail.tgl_cair_tahap_dok in(null,'','0000-00-00') ", $sql); break; case "inprogress": $sql = str_replace(":paramwhere:", "and trail.progress='SELESAI' ", $sql); break; case "selesai": $sql .= "AND progress='SELESAI'"; break; } $sqlCount = "select count(*) from ({$sql}) test"; $count = $db_function->selectOnefield($sqlCount); if ($count > 0 && $limit > 0) { $total_pages = ceil($count / $limit); } else { $total_pages = 0; } if ($page > $total_pages) { $page = $total_pages; } $start = $limit * $page - $limit; if ($start < 0) { $start = 0; } $sqlDt = "select * from ({$sql})temp LIMIT {$start} , {$limit}"; $query = $db_function->selectAllRows($sqlDt); $responce['page'] = $page; $responce['total'] = $total_pages; $responce['records'] = $count; $i = 0; foreach ($query as $row) { $row['tgl_pk'] = balikTgl($row['tgl_pk']); $row['tgl_cair_tahap_fondasi'] = cleanDate(balikTgl($row['tgl_cair_tahap_fondasi'])); $row['tgl_cair_tahap_topping'] = cleanDate(balikTgl($row['tgl_cair_tahap_topping'])); $row['tgl_cair_tahap_bast'] = cleanDate(balikTgl($row['tgl_cair_tahap_bast'])); $row['tgl_cair_tahap_dok'] = cleanDate(balikTgl($row['tgl_cair_tahap_dok'])); $responce['rows'][$i]['id'] = $i; $responce['rows'][$i]['cell'] = $row; $i++; } echo json_encode($responce); exit; }