Example #1
0
 public function catLink($output)
 {
     if (app_param('view') == 'category') {
         $id = categoryInfo('id');
     } else {
         $id = articleInfo('category');
     }
     $result = FQuery("menu", "link LIKE '?app=article&view=category&id={$id}&type=%' AND home != 1", "id");
     return $result;
 }
Example #2
0
<?php

/**
* @version		1.5.0
* @package		Fiyo CMS
* @copyright	Copyright (C) 2012 Fiyo CMS.
* @license		GNU/GPL, see LICENSE.txt
* @description	
**/
define('_FINDEX_', 1);
require_once '../../../system/jscore.php';
$db = new FQuery();
$db->connect();
$online = angka(FQuery('statistic_online'));
$total = angka(FQuery('statistic'));
$dtf = date('Y-m-d 00:00:00');
$today = angka(FQuery('statistic', "time >= '{$dtf}'", "", "", "time ASC"));
$dtf = date('Y-m-d 00:00:00', strtotime("-1 Months"));
$month = angka(FQuery('statistic', "time >= '{$dtf}'", "", "", "time ASC"));
$timer = time() - 300;
$db->delete(FDBPrefix . 'statistic_online', "time < {$timer}");
echo "\n{ \"today\":\"{$today}\" , \"month\":\"{$month}\", \"total\":\"{$total}\", \"online\":\"{$online}\" }";
Example #3
0
<form method="post" id="comment" action="#comments">
	<div><label><span>Name *</span><div>
		<input type='text' name='name' value ="<?php 
    echo @$name;
    ?>
" class="input required"></label></div>
	</div>
	<div><label><span>Email *</span><div>
		<input class="input required email" type='text' name='email' value ="<?php 
    echo @$email;
    ?>
"></label></div>
	</div>
	<div><label><span>AddOns Rate * </span><div>
	<?php 
    if (FQuery('pdf_comment', "USER_ID = " . USER_ID . " AND file_id = {$id}") == 0) {
        ?>
		<select name="rate" class="rate">
			<option value='5'>-----</option>
			<option value='4'>----*</option>
			<option value='3'>---**</option>
			<option value='2'>--***</option>
			<option value='1'>-****</option>
		</select>
		<?php 
    } else {
        echo You_already_rate;
    }
    ?>
		</div>
	</div>
Example #4
0
     $no++;
 }
 if ($cat) {
     $catn = "{$catx}";
 } else {
     $catn = "";
 }
 $filter = "date >= {$start}";
 $archveQuery = $db->select(FDBPrefix . "article", "*,DATE_FORMAT(date,'%m') as m,DATE_FORMAT(date,'%M') as mo,DATE_FORMAT(date,'%d-%b') as month,DATE_FORMAT(date,'%Y') as y", " {$filter} AND {$catn}", "category ASC");
 $no = $x = 0;
 while ($archveRow = mysql_fetch_array($archveQuery)) {
     $link = "?app=article&view=item&id={$archveRow['id']}";
     $link = make_permalink($link);
     if ($archveRow['date'] >= $start and $archveRow['date'] <= $end) {
         $catname = oneQuery('article_category', 'id', "{$archveRow['category']}", 'name');
         $s = FQuery('article', "category = {$archveRow['category']} AND status = 1");
         if (isset($m) and $m != $archveRow['category']) {
             echo "</ul></li></ul>";
         }
         if (@$m != $archveRow['category']) {
             $open = '';
             if (app_param('app') == 'article' and (app_param('view') == 'category' or app_param('view') == 'item')) {
                 if (articleInfo('category') == "{$archveRow['category']}") {
                     $open = " open";
                 }
             }
             echo "\n\t\t\t\t<ul class='mod-article-archive'>\n\t\t\t\t\t<li class='archive-head'><a class='archive-head-a'>{$catname}  ({$s})</a>\n\t\t\t\t<ul class='archive-list{$open}'>";
         }
         if ($archveRow['status'] == 1) {
             $active = '';
             if (app_param('app') == 'article' and app_param('view') == 'item') {
Example #5
0
 if (defined('SEF_URL')) {
     $link = make_permalink($link);
 } else {
     if (defined('Page_ID')) {
         $_GET[id] = Page_ID;
     }
     $link = "{$link}&pid=" . Page_ID;
     $link = "http://" . FUrl . $link;
 }
 if ($archveRow['date'] >= $start and $archveRow['date'] <= $end) {
     $s = 0;
     $cats = explode(",", "{$cat}");
     $coma = substr_count("{$cat}", ",");
     $catx = $cato = '';
     foreach ($cats as $p) {
         $s += FQuery('article', "date LIKE '%{$archveRow['y']}-{$archveRow['m']}%' AND status = 1 AND category = {$p}");
     }
     if (isset($m) and $m != $archveRow['m']) {
         echo "</ul></li></ul>";
     }
     if (@$m != $archveRow['m']) {
         $open = '';
         if (app_param('app') == 'article' and app_param('view') == 'item') {
             if (substr(articleInfo('date'), 0, 7) == "{$archveRow['y']}-{$archveRow['m']}") {
                 $open = " open";
             }
         }
         echo "\n\t\t\t\t<ul class='mod-article-archive'>\n\t\t\t\t\t<li class='archive-head'><a class='archive-head-a'>{$archveRow['mo']} {$archveRow['y']} ({$s})</a>\n\t\t\t\t<ul class='archive-list{$open}'>";
     }
     if ($archveRow['status'] == 1) {
         $active = '';
Example #6
0
 function category($id, $menuId, $fp = null)
 {
     //validation page type
     $categoryName = $categoryDesc = null;
     $label = app_param('label');
     if ($id > 0) {
         $flag = FQuery("pustaka_category", "id={$id}", '', 1);
     } else {
         if (!empty($label)) {
             $label = app_param('label');
             $label = str_replace("-", " ", $label);
             $label = "AND tags LIKE '%" . $label . "%' ";
         }
         $flag = true;
     }
     //if page type is valid
     if ($flag) {
         $db = new FQuery();
         $db->connect();
         /************** Parameter Page ***************/
         $per_page = 10;
         $categoryId = $id;
         if (empty($param)) {
             $show_panel = 1;
             $per_page = 10;
         }
         if (url_param('feed') == 'rss') {
             $per_page = 10;
             $pages = url_param('page');
             if ($pages != null) {
                 $link = str_replace("?page={$pages}", "", getUrl());
                 redirect("{$link}?feed=rss");
             }
         }
         if (isset($label)) {
             $per_page = 10;
         }
         if (empty($per_page)) {
             $per_page = 10;
         }
         //$fp is default page
         if (!isset($fp) and !isset($label)) {
             $categoryName = oneQuery('pustaka_category', 'id', $categoryId, 'name');
             $categoryDesc = oneQuery('pustaka_category', 'id', $categoryId, 'description');
         }
         $level_access = Level_Access;
         //$if category id is not found
         if (!$categoryId and !isset($fp) and !isset($label)) {
             echo pustaka_Page_Notfound;
         } else {
             if (isset($categoryName)) {
                 $whereCat = "AND category = {$categoryId}";
             } else {
                 $whereCat = null;
             }
             //call paging class
             loadPaging();
             $paging = new paging();
             $rowsPerPage = $per_page;
             //paging results
             $result = $paging->pagerQuery(FDBPrefix . 'pustaka_file', "*", "status=1 {$whereCat} {$label}", 'id DESC', $rowsPerPage);
             $no = 0;
             //count rows
             $jml = mysql_affected_rows();
             while ($qr = mysql_fetch_array($result)) {
                 /********** File Author ***********/
                 $author = $qr['author'];
                 /********** File Category ***********/
                 $catlink = categoryLink($qr['category']);
                 $category = oneQuery('pustaka_category', 'id', $qr['category'], 'name');
                 $category = "<a href='{$catlink}' title='See more {$category}'>{$category}</a>";
                 /********** pdf Link ***********/
                 $flink = "?app=pdf&view=item&id={$qr['id']}";
                 $link = make_permalink($flink, Page_ID);
                 $title = "<a href='{$link}'>{$qr['title']}</a>";
                 /********** File Labels ***********/
                 $labels = labelToLink($qr['tags']);
                 /********** File Compability ***********/
                 $this->perrows = $jml;
                 $this->show_panel = $show_panel;
                 $this->category[$no] = $category;
                 $this->catlink[$no] = $catlink;
                 $this->author[$no] = $author;
                 $this->title[$no] = $title;
                 $this->link[$no] = $link;
                 $this->labels[$no] = $labels;
                 $this->date[$no] = $qr['year'];
                 $this->hits[$no] = $qr['hits'];
                 $this->desc[$no] = $qr['description'];
                 if (url_param('feed') == 'rss' and url_param('feed') == 'rss' or app_param('label')) {
                     $this->description[$no] = $qr['description'];
                 }
                 if (defined('SEF_URL')) {
                     $link = link_paging('?');
                 } else {
                     if (checkhomepage()) {
                         $link = "?";
                     } else {
                         $link = "?app=pdf&view=category&id={$categoryId}";
                         $link = make_permalink($link, Page_ID);
                         $link = $link . "&";
                     }
                 }
                 $no++;
             }
             if ($no == 0) {
                 echo "<h1 style='margin:20px auto'>Pustaka Kosong !!!!</h1>";
             }
             //start paging links
             $db->select(FDBPrefix . 'pustaka_file', '*', "status=1 {$whereCat}  {$level_access}");
             $jml = mysql_affected_rows();
             if ($jml > $rowsPerPage) {
                 $pagelink = $paging->createPaging($link);
             } else {
                 $pagelink = null;
             }
             //send paging var relsult
             $this->pglink = $pagelink;
             //if parameter found rss page
             if (url_param('feed') == 'rss' and url_param('feed') == 'rss' or app_param('label')) {
                 $this->catName = $categoryName;
                 $this->catDesc = $categoryDesc;
             }
         }
     } else {
         pustaka_Page_Notfound;
     }
 }
Example #7
0
    $d13 = 13;
    $d14 = 14;
}
$uniqueVisitor = $allVisitor = $newVisitor = $dateList = '';
for ($x = $d13; $x >= 0; $x--) {
    $dateList .= "'" . date("d M y", strtotime("-{$x} days")) . "'";
    if ($x != 0) {
        $dateList .= ",";
    }
}
for ($x = $d13; $x >= 0; $x--) {
    $dtf = date('Y-m-d 00:00:00', strtotime("-{$x} days"));
    $z = $x - 1;
    $dts = date('Y-m-d 00:00:00', strtotime("-{$z} days"));
    $v = FQuery('statistic', "time BETWEEN '{$dtf}' AND '{$dts}'", "", "", "time ASC");
    $v = FQuery('statistic', "time BETWEEN '{$dtf}' AND '{$dts}'", "", "", "time ASC");
    if (empty($v)) {
        $allVisitor .= 0;
    } else {
        $allVisitor .= $v;
    }
    if ($x != 0) {
        $allVisitor .= ",";
    }
}
$z = 0;
for ($x = $d14; $x >= 0; $x--) {
    $ytf = date('Y-m-d 00:00:00', strtotime("-{$x} days"));
    $t = $x - 1;
    $dtf = date('Y-m-d 00:00:00', strtotime("-{$t} days"));
    $db = new FQuery();
Example #8
0
function check_permalink($field, $value, $output = null, $like = null)
{
    if (empty($like)) {
        $link = FQuery("permalink", "{$field} = '{$value}'", $output);
    } else {
        $link = FQuery("permalink", "{$field} LIKE '%{$value}%'", $output);
    }
    if (empty($value) or empty($link)) {
        $link = false;
    } else {
        if (empty($output) and $link > 0) {
            $link = true;
        }
    }
    return $link;
}
Example #9
0
function subsmenu($parent_id, $sub = null)
{
    $db = new FQuery();
    $db->connect();
    if ($sub == 'apps') {
        $short = 'name ASC';
    } else {
        $short = 'short ASC';
    }
    $level = Level_Access;
    $menus = $db->select(FDBPrefix . "menu", "*", "parent_id={$parent_id} AND status=1 {$level}", "{$short}");
    $sum = mysql_affected_rows();
    $no = 1;
    if (mysql_num_rows($menus) > 0) {
        echo "<ul class=\"sub-menu collapse\" id='nav-{$parent_id}'>";
        while ($menu = mysql_fetch_array($menus)) {
            $link = @$menu['link'];
            $link = @$menu['link'];
            $subtitle = '';
            $app = $menu['sub_name'];
            $a = "";
            $l = substr(getUrl(), strpos(getUrl(), "?app="));
            if ($l == $link) {
                $a = " active";
            }
            if (empty($menu['class'])) {
                $menu['class'] = 'icon-double-angle-right';
            }
            if ($menu['home'] == 0) {
                if ($menu['app'] == "sperator") {
                    echo "<li class=\"{$a}\"><a href='#'><i class=\"{$menu['class']}\" style=\"{$menu['style']}\"></i> {$menu['name']}</a>";
                    subsmenu($menu['id']);
                    echo "</li>";
                } else {
                    if ($menu['app'] == "link") {
                        echo "<li class=\"{$a}\"><a href=\"{$link}\"><i class=\"{$menu['class']}\" style=\"{$menu['style']}\"></i> {$menu['name']}</a>";
                        subsmenu($menu['id']);
                        echo "</li>";
                    } else {
                        if (empty($menu['link'])) {
                            $menu['link'] = "#";
                        }
                        echo "<li class=\"{$a}\"><a href=\"{$link}\"><i class=\"{$menu['class']}\" style=\"{$menu['style']}\"></i> {$menu['name']}</a>";
                        subsmenu($menu['id']);
                        echo "</li>";
                    }
                }
            }
            if ($app = 'menu' and $link == '?app=menu&view=add') {
                $level = Level_Access;
                $sql2 = $db->select(FDBPrefix . 'menu_category', "*", "id > 0  {$level}");
                $sum = mysql_num_rows($sql2);
                $no = 1;
                while ($menu = mysql_fetch_array($sql2)) {
                    $sump = FQuery("menu", "category='{$menu['category']}' AND home=1");
                    $summ = FQuery("menu", "category='{$menu['category']}'");
                    if ($sump) {
                        $sump = "<span class='label label-danger home-label'>home</span>";
                    } else {
                        $sump = "";
                    }
                    echo "<li class='list-menu menu-{$menu['category']}'><a class='link' href='?app=menu&cat={$menu['category']}'><i class='icon-list-alt'></i>{$menu['title']}<span class='label label-primary'>{$summ}</span>{$sump}</a></li>";
                    $no++;
                }
            }
        }
        echo "</ul>";
    }
}
Example #10
0
function redirect_link()
{
    if (!checkHomePage()) {
        $app = app_param('app');
        if (SEF_URL) {
            if (_Page == 1) {
                if (strpos(getUrl(), "&page=")) {
                    redirect(str_replace("&page=" . _Page, "", getUrl()));
                }
            }
            if (empty($app)) {
                //redirect for 404 page
                $link = str_replace(FUrl, "", getUrl());
                $linl = strlen($link);
                $max = 0;
                while ($linl) {
                    if (substr($link, $linl - 1) == "/") {
                        $link = substr($link, 0, $linl - 1);
                    }
                    $got = FQuery("permalink", "permalink LIKE '{$link}%'");
                    $linl = strlen($link);
                    if ($linl < 4 or $max == 20) {
                        $fail_url = getUrl();
                        break;
                    } else {
                        if ($got) {
                            $link = FQuery("permalink", "permalink LIKE '{$link}%'", "permalink");
                            break;
                        }
                    }
                    $link = substr($link, 0, $linl - 1);
                    $max++;
                }
                if ($got and !isset($fail_url)) {
                    redirect(FUrl . $link);
                }
            } else {
                if (!empty($app)) {
                    // nothing :D
                } else {
                    if (SEF_EXT == 0 or SEF_EXT == '') {
                        $sum = strlen(getUrl());
                        $rev = strrev(getUrl());
                        if (!strpos(getUrl(), '?')) {
                            $pos = substr(getUrl(), $sum - 1);
                            if ($pos == "/") {
                                redirect(substr(getUrl(), 0, $sum - 1));
                            }
                        }
                    }
                }
            }
        } else {
            $direct = check_permalink('link', $_SERVER['REQUEST_URI'], 'permalink');
            $xurl = 'http://' . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
            $gurl = str_replace(FUrl, '', $xurl);
            $strt = strlen($gurl);
            $x = 1;
            while ($strt) {
                $val = substr($gurl, 0, $strt);
                if (check_permalink('permalink', $val, 'link')) {
                    if (str_replace($val . SEF_EXT, '', $xurl) != FUrl) {
                        if (_Page == 0) {
                            break;
                        }
                    }
                }
                $strt -= 1;
                $x++;
            }
            $url = check_permalink('permalink', $val, 'link');
            $pid = check_permalink('permalink', $val, 'pid');
            //echo FUrl.$url;//redirect(FUrl.$url.SEF_EXT);
        }
    } else {
        if (isset($_GET['page']) and _Page == 1) {
            redirect(FUrl);
        }
    }
}
Example #11
0
 function category($id, $fp = null)
 {
     $db = new FQuery();
     $db->connect();
     $param = oneQuery('menu', 'id', Page_ID, 'parameter');
     $show_panel = mod_param('show_name', $param);
     $read_more = mod_param('read_more', $param);
     $per_page = mod_param('per_page', $param);
     $this->sname = mod_param('show_name', $param);
     $this->sgroup = mod_param('show_group', $param);
     $this->sgender = mod_param('show_gender', $param);
     $this->saddress = mod_param('show_address', $param);
     $this->semail = mod_param('show_email', $param);
     $this->sjob = mod_param('show_job', $param);
     $this->slinks = mod_param('show_links', $param);
     $this->sphone = mod_param('show_phone', $param);
     $this->sphoto = $sphoto = mod_param('show_photo', $param);
     $groupId = app_param('id');
     $whereCat = "AND group_id = {$id}";
     $sql = $db->select(FDBPrefix . 'contact', '*', 'status = 1 AND group_id=' . $id);
     $qr = @mysql_fetch_array($sql);
     if (empty($qr['id'])) {
         echo "<h3>Opps, Contact group is empty!";
     } else {
         loadPaging();
         $paging = new paging();
         $rowsPerPage = $per_page;
         $result = $paging->pagerQuery(FDBPrefix . 'contact', "*", "status=1 {$whereCat}", 'id ASC', $rowsPerPage);
         $no = 0;
         $sum = mysql_affected_rows();
         while ($qr = mysql_fetch_array($result)) {
             $group = oneQuery('contact_group', 'id', $qr['group_id'], 'name');
             $vlink = "?app=contact&view=person&id={$qr['id']}";
             $link = make_permalink($vlink, Page_ID);
             $title = "<a href=\"{$link}\">{$qr['name']}</a>";
             if (empty($read_more)) {
                 $read_more = "read more...";
             }
             $readmore = "<a href=\"{$link}\"class='readmore'>{$read_more}</a>";
             $comment = FQuery('comment', "link='{$vlink}'AND status=1");
             $name = "<a href='{$link}'>{$qr['name']}</a>";
             if ($sphoto == 1 and !empty($qr['photo'])) {
                 $photo = "<img src=\"{$qr['photo']}\" width=\"150px\">";
             }
             if (!empty($qr['email'])) {
                 $email = "<a href='mailto:{$qr['email']}' title=\"send mail to {$qr['name']}\">{$qr['email']}</a>";
             } else {
                 $email = "";
             }
             if (!empty($qr['photo'])) {
                 $photo = "<img src='{$qr['photo']}' title=\"{$qr['name']}'s contact photo\" />";
             }
             if (!empty($qr['tw'])) {
                 $tw = " <a href='http://twitter.com/{$qr['tw']}' title=\"follow {$qr['name']} on twitter\" target='_blank'><img src='" . FUrl . "apps/app_contact/theme/images/tw.png'></a>";
             }
             if (!empty($qr['fb'])) {
                 $fb = " <a href='http://facebook.com/{$qr['fb']}' title=\"find {$qr['name']} on facebook\" target='_blank'><img src='" . FUrl . "apps/app_contact/theme/images/fb.png'></a>";
             }
             if (!empty($qr['web'])) {
                 $web = " <a href='http://{$qr['web']}' title=\"visit {$qr['name']}'s website\" target='_blank'><img src='" . FUrl . "apps/app_contact/theme/images/web.png'></a>";
             }
             if (!empty($qr['ym'])) {
                 $ym = " <a href='ymsgr:sendIM?{$qr['ym']}' title=\"chat with {$qr['name']} via YahooMasangger\"><img src='" . FUrl . "apps/app_contact/theme/images/ym.png'></a>";
             }
             if (isset($ym) or isset($fb) or isset($tw) or isset($web)) {
                 $links = $ym . $fb . $tw . $web;
             } else {
                 $links = '';
             }
             $this->perrows = $sum;
             $this->name[$no] = $name;
             $this->photo[$no] = $photo;
             $this->group[$no] = $group;
             $this->gender[$no] = $qr['gender'];
             $this->address[$no] = $qr['city'] . ", " . $qr['country'];
             $this->email[$no] = @$qr['email'];
             $this->job[$no] = $qr['job'];
             $this->links[$no] = $links;
             $this->phone[$no] = $qr['phone'];
             $this->fax[$no] = $qr['fax'];
             $this->per_page = $per_page;
             $ym = $fb = $tw = $web = null;
             //reset $link variable;
             if (defined('SEF_URL')) {
                 $link = link_paging('?');
             } else {
                 $link = "?app=contact&view=group&id={$groupId}";
                 $link = make_permalink($link, Page_ID);
                 $link = $link . "&";
             }
             $no++;
         }
         $db->select(FDBPrefix . 'contact', '*', "status=1 {$whereCat}");
         $jml = mysql_affected_rows();
         if ($jml > $rowsPerPage) {
             $pagelink = $paging->createPaging($link);
         } else {
             $pagelink = null;
         }
         $this->pagelink = $pagelink;
     }
 }
Example #12
0
function valday($date)
{
    return FQuery('statistic', "time BETWEEN  '{$date} 00:00:00' AND  '{$date} 23:59:59'");
}
Example #13
0
 function item($q, $menuId)
 {
     /* Call new FQuery */
     $db = new FQuery();
     $db->connect();
     /* Set Access_Level */
     $accessLevel = Level_Access;
     $q = str_replace("'", "", $q);
     $q = str_replace("/", "", $q);
     $q = str_replace("\\", "", $q);
     $q = str_replace('"', "", $q);
     $q = str_replace('  ', " ", $q);
     if (empty($q)) {
         $q = $_SESSION['search'];
     }
     /* Call new paging */
     loadPaging();
     $paging = new paging();
     $rowsPerPage = 10;
     $keyword = trim($q);
     //remove space before and after
     $article = explode_query($q, 'article');
     $title = explode_query($q, 'title');
     $author = explode_query($q, 'author');
     $tag = explode_query($q, 'tags');
     $condition = "{$article} {$title} {$author} {$tag}";
     $user = FQuery('user', "`name` LIKE  '%{$q}%'", 'id');
     /* Check total article by query */
     FQuery('article', "status=1 AND (`author_id` ='{$user}' {$condition}) {$accessLevel}");
     $total = mysql_affected_rows();
     /* paging query */
     $result = $paging->pagerQuery(FDBPrefix . 'article', "*,DATE_FORMAT(date,'%d %M %Y') as date,DATE_FORMAT(date,'%Y-%m-%d %H:%i:%s') as order_date", "status=1 AND (`author_id` ='{$user}' {$condition}) \n\t\t{$accessLevel}", 'order_date DESC', $rowsPerPage);
     $no = 0;
     $jml = mysql_affected_rows();
     while ($qr = mysql_fetch_array($result)) {
         //category
         $category = oneQuery('article_category', 'id', $qr['category'], 'name');
         $catlink = make_permalink("?app=article&view=category&id={$qr['category']}");
         //autho
         if (!empty($qr['author_id'])) {
             if (!empty($qr['author'])) {
                 $author = $qr['author'];
             } else {
                 $author = oneQuery('user', 'id', $qr['author_id'], 'name');
             }
         } else {
             $author = "Administrator";
         }
         $strpos = 0;
         $article = stripTags($qr['article']);
         $article2 = strtolower($article);
         $strpos = strpos("{$article2}", "{$q}");
         $query = str_replace(", ", ",", $q);
         $query = str_replace(" ,", ",", $q);
         $query = trim($query);
         if (strpos($query, ",")) {
             $query = explode(",", $query);
         } else {
             $query = explode(" ", $q);
         }
         $i = 0;
         $z = '';
         $y = '';
         foreach ($query as $v) {
             $y[$i] = $v;
             $i++;
         }
         for ($n = $i * $i - 1; $n >= 0; $n--) {
         }
         if ($strpos >= 40) {
             $strpos = $strpos - 40;
             $article2 = substr("{$article2}", $strpos);
             $strpos2 = strpos("{$article2}", " ");
             $article = substr("{$article}", $strpos + $strpos2);
             $article = "..." . $article;
         }
         $article = cutWords($article, 35);
         $article .= "...";
         $link = "?app=article&view=item&id={$qr['id']}";
         $link = make_permalink($link, Page_ID);
         $qr['title'] = search_match($qr['title'], $q);
         $article = search_match($article, $q);
         $author = search_match($author, $q);
         $category = search_match($category, $q);
         $title = "<a href=\"{$link}\">{$qr['title']}</a>";
         $readmore = null;
         $this->category[$no] = $category;
         $this->catlink[$no] = $catlink;
         $this->readmore[$no] = $readmore;
         $this->author[$no] = $author;
         $this->title[$no] = $title;
         $this->date[$no] = $qr['date'];
         $this->article[$no] = $article;
         $this->perrows = $jml;
         $this->total = $total;
         if (defined('SEF_URL')) {
             $link = link_paging('?');
         } else {
             $link = "?app=article&view=category&id={$categoryId}";
             $link = make_permalink($link, Page_ID);
             $link = $link . "&";
         }
         $no++;
     }
     FQuery('article', "status=1 AND (`author_id` ='{$user}' {$condition}) {$accessLevel}");
     $jml = mysql_affected_rows();
     if ($jml > $rowsPerPage) {
         $pagelink = $paging->createPaging($link);
     } else {
         $pagelink = null;
     }
     if (strpos(getUrl(), '?q')) {
         $pagelink = str_replace("?page=", "&page=", $pagelink);
     }
     $this->pglink = $pagelink;
 }
Example #14
0
}
?>
					</select>
				</td>
			</tr>	
	
					
			<tr class="item" >
				<td class="row-title">Article</td>
				<td>
					<input type="hidden" value="?app=article&view=item&id=<?php 
echo $id;
?>
" id="pgs" size="20" readonly /> 
					<input type="text" value="<?php 
echo FQuery('article', "id  = {$aId}", 'title', 'hide');
?>
" id="pg" size="20" style="width: 70%" required readonly />
					<a class="btn btn-primary btn-grad popup" data-toggle="modal" href="#selectArticle" rel="width:940;height:400"><?php 
echo Select;
?>
</a>
			</tr>		
			<tr class="image" >
				<td class="row-title">Images Width</td>
				<td>
					<input type="number" class='spinner numeric' min="1" max="999" style="width: 50px" name="param4" value="<?php 
echo $imgW;
?>
" id="imgW" /> px
					</td>
Example #15
0
 function category($type, $id = null, $format = null)
 {
     $link = null;
     /* Set global parameter */
     $show_panel = menu_param('show_panel', Page_ID);
     $show_rss = menu_param('show_rss', Page_ID);
     $read_more = menu_param('read_more', Page_ID);
     $per_page = menu_param('per_page', Page_ID);
     $intro = menu_param('intro', Page_ID);
     if (empty($intro)) {
         $intro = $per_page;
     }
     /* Set Access_Level */
     $accessLevel = Level_Access;
     if ($type == 'archives') {
         $where = "status=1";
     } else {
         if ($type == 'category') {
             $catName = categoryInfo('name', $id);
             $catDesc = categoryInfo('description', $id);
             $catLink = categoryLink($id);
             $where = "status=1 AND category = {$id}";
         } else {
             if ($type == 'featured') {
                 $where = "status=1 AND featured = 1";
             } else {
                 if ($type == 'tag') {
                     if (empty($per_page)) {
                         $per_page = 10;
                     }
                     $tag = app_param('tag');
                     $tag = str_replace("-", " ", $tag);
                     $where = "status=1 AND tags LIKE '%" . $tag . "%'";
                 }
             }
         }
     }
     if (_FEED_ == 'rss') {
         $per_page = 20;
         $pages = url_param('page');
         if ($pages != null) {
             $link = str_replace("?page={$pages}", "", getUrl());
             redirect("{$link}?feed=rss");
         }
     }
     loadPaging();
     $paging = new paging();
     $result = $paging->pagerQuery(FDBPrefix . 'article', "*,\n\t\tDATE_FORMAT(date,'%d %M %Y') as date,\n\t\tDATE_FORMAT(date,'%Y-%m-%d %H:%i:%s') as order_date,\n\t\tDATE_FORMAT(date,'%a, %m %d %Y %H:%i:%s') as time,\n\t\tDATE_FORMAT(date,'%d') as f,\n\t\tDATE_FORMAT(date,'%D') as d,\n\t\tDATE_FORMAT(date,'%b') as b,\n\t\tDATE_FORMAT(date,'%a') as a,\n\t\tDATE_FORMAT(date,'%W') as D,\n\t\tDATE_FORMAT(date,'%m') as n,\n\t\tDATE_FORMAT(date,'%M') as m,\n\t\tDATE_FORMAT(date,'%y') as y,\n\t\tDATE_FORMAT(date,'%Y') as Y,\n\t\tDATE_FORMAT(date,'%h') as h,\n\t\tDATE_FORMAT(date,'%H') as H,\n\t\tDATE_FORMAT(date,'%p') as p,\n\t\tDATE_FORMAT(date,'%i') as i,\n\t\tDATE_FORMAT(date,'%s') as s", "{$where} {$accessLevel}", 'order_date DESC', $per_page);
     $no = 0;
     $perrows = mysql_affected_rows();
     while ($qr = mysql_fetch_array($result)) {
         /* Category Details */
         $catLinks = categoryLink($qr['category']);
         $category = categoryInfo('name', $qr['category']);
         $catHref = "<a href='{$catLinks}'>{$category}</a>";
         /* Author */
         if (empty($qr['author'])) {
             $author = userInfo('name', 1);
         } else {
             $author = $qr['author'];
         }
         /* Article Links */
         $link = "?app=article&amp;view=item&amp;id={$qr['id']}";
         $vlink = str_replace("&amp;", "&", $link);
         $vlink = make_permalink($vlink);
         /* Article Title */
         $title = "<a href='{$vlink}'>{$qr['title']}</a>";
         $link = make_permalink($link);
         /* Article Tags */
         $tags = tagToLink($qr['tags']);
         /* Article Content */
         $article = $qr['article'];
         if (checkLocalhost()) {
             $article = str_replace(FLocal . "media/", "media/", $article);
             $article = str_replace("/media/", FUrl . "media/", $article);
         }
         $comment = null;
         /* Article Comments */
         $comm = FQuery('comment', "link='{$link}'AND status=1");
         if (FQuery('apps', "folder='app_comment'")) {
             $comment = "<a class='send-comment' href='{$link}#comment'>";
             if ($comm > 1) {
                 $comment .= "<span>{$comm}</span> " . Comments;
             }
             if ($comm == 1) {
                 $comment .= "<span>{$comm}</span> " . Comment;
             }
             if ($comm < 1) {
                 $comment .= Send_Comment;
             }
             $comment .= "</a>";
         }
         $scomment = mod_param('show_comment', articleInfo('parameter', $qr['id']));
         if (!$scomment) {
             $comment = '';
         }
         /* Read More */
         if (empty($read_more)) {
             $read_more = Readmore;
         }
         $readmore = "<a href='{$link}' class='readmore'>{$read_more}</a> {$comment}";
         /* Intro limit (read more) */
         $content = $article;
         /* Blog Style */
         if ($format == 'blog' or $type == 'tag' or $format == 'list') {
             $image = articleImage($content);
             $image = str_replace("/media", "/media/.thumbs", $image);
             $imgH = menu_param('imgH', Page_ID);
             $imgW = menu_param('imgW', Page_ID);
             $this->image[$no] = $image;
             $this->imgH = $imgH;
             $this->imgW = $imgW;
             $content = preg_replace("/<img[^>]+\\>/i", "", $content);
         }
         $content = articleIntro($content);
         $panel = menu_param('panel_format', Page_ID);
         $fpanel = "#" . menu_param('panel_format', Page_ID);
         $dpanel = str_replace('%rel', "", $fpanel);
         if (empty($panel) or !strpos($dpanel, '%')) {
             if (siteConfig('lang') == 'id') {
                 $panel = "<b>%A</b> &#183; %f %m %Y &#183; %c";
             } else {
                 $panel = "%m, %f %Y &#183; <b>%A</b> &#183; %c";
             }
         }
         $panel = str_replace('%A', $author, $panel);
         $panel = str_replace('%c', "{$catHref}", $panel);
         $panel = str_replace('%h', $qr['hits'], $panel);
         $timeRel = dateRelative($qr['H'], $qr['i'], $qr['s'], $qr['n'], $qr['f'], $qr['Y']);
         if ($timeRel and strpos($fpanel, '%rel')) {
             $panel = str_replace(', ', "", $panel);
             $panel = str_replace('%d', "", $panel);
             $panel = str_replace('%f', "{$timeRel}", $panel);
             $panel = str_replace('%m', "", $panel);
             $panel = str_replace('%n', "", $panel);
             $panel = str_replace('%y', "", $panel);
             $panel = str_replace('%Y', "", $panel);
             $panel = str_replace('%H', "", $panel);
             $panel = str_replace('%h', "", $panel);
             $panel = str_replace('%i', "", $panel);
             $panel = str_replace('%s', "", $panel);
             $panel = str_replace('%p', "", $panel);
             if (strlen($panel) < 3) {
                 $panel = $timeRel;
             }
         } else {
             if (siteConfig('lang') == 'id') {
                 $panel = str_replace('%f', $qr['f'], $panel);
             } else {
                 $panel = str_replace('%f', $qr['d'], $panel);
             }
             $panel = str_replace("%rel", $panel, $panel);
             $panel = str_replace('%d', $qr['d'], $panel);
             $panel = str_replace('%a', $qr['a'], $panel);
             $panel = str_replace('%b', $qr['b'], $panel);
             $panel = str_replace('%m', $qr['m'], $panel);
             $panel = str_replace('%n', $qr['n'], $panel);
             $panel = str_replace('%y', $qr['y'], $panel);
             $panel = str_replace('%Y', $qr['Y'], $panel);
             $panel = str_replace('%H', $qr['H'], $panel);
             $panel = str_replace('%h', $qr['h'], $panel);
             $panel = str_replace('%i', $qr['i'], $panel);
             $panel = str_replace('%s', $qr['s'], $panel);
             $panel = str_replace('%p', $qr['p'], $panel);
         }
         $panel = str_replace('*', "", $panel);
         /* RSS Feed */
         $this->perrows = $perrows;
         $this->intro = $intro;
         $this->show_rss = $show_rss;
         $this->show_panel = $show_panel;
         $this->panel[$no] = $panel;
         $this->category[$no] = $category;
         $this->catlink[$no] = $catLinks;
         $this->readmore[$no] = $readmore;
         $this->comment[$no] = $comment;
         $this->author[$no] = $author;
         $this->title[$no] = $title;
         $this->link[$no] = $link;
         $this->tags[$no] = $tags;
         $this->ftime[$no] = $qr['time'];
         $this->hits[$no] = $qr['hits'];
         $this->desc[$no] = clearXMLString("{$content}");
         $this->ftitle[$no] = clearXMLString($qr['title']);
         $this->content[$no] = $content;
         if (defined('SEF_URL')) {
             $link = link_paging('?');
             if (strpos(getUrl(), '&') > 0) {
                 $link = link_paging('&');
             }
         } else {
             if (checkhomepage()) {
                 $link = "?";
             } else {
                 if (!url_param('id')) {
                     $tag = app_param('tag');
                     $link = "?app=article&tag={$tag}";
                     $link = make_permalink($link, Page_ID);
                     $link = $link . "&amp;";
                 } else {
                     $link = "?app=article&view=category&id={$categoryId}";
                     $link = make_permalink($link, Page_ID);
                     $link = $link . "&amp;";
                 }
             }
         }
         $no++;
     }
     // pageLink
     $this->pglink = $paging->createPaging($link);
     // rssLink
     if ($type == 'tag') {
         $tag = str_replace(" ", "-", $tag);
         $rssLink = "?app=article&tag={$tag}&feed=rss";
     } else {
         if ($type == 'category') {
             $rssLink = "?app=article&view=category&id={$id}&feed=rss";
         } else {
             $rssLink = "?app=article&view=archives&feed=rss";
         }
     }
     if (_FEED_ == 'rss') {
         $rssLink = make_permalink($rssLink);
         $this->rssTitle = @clearXMLString(SiteTitle);
         $categoryLink = @clearXMLString($rssLink);
         $categoryLink = str_replace(".xml", "", $categoryLink);
         $this->rssLink = $categoryLink;
         $this->rssDesc = @$categoryDesc;
     } else {
         $this->rssLink = make_permalink($rssLink);
     }
 }