Ejemplo n.º 1
0
/**
* getArticles
*   Returns an associative array with the sort key and the article handle.
* @param integer $limit  The number of elements to return
* @param integer $start  Where to start. DEFAULT: 0
* @param string  $sort   How to sort. Currently only mtime and title are supported. DEFAULT: mtime
* @return array
**/
function getArticles($limit, $start = 0, $sort = 'mtime')
{
    global $BASEPATH;
    include_once $BASEPATH . 'config.php';
    $dir = dir($GLOBALS['CONFIG']['data']);
    $result = array();
    while (($entry = $dir->read()) !== false) {
        if (preg_match('/^title_([a-zA-Z0-9]+).html$/', $entry, $matches)) {
            switch ($sort) {
                case 'title':
                    $result[getArticleTitle($matches[1])] = $matches[1];
                    break;
                default:
                    $result[getArticlePublished($matches[1])] = $matches[1];
            }
        }
    }
    if (in_array($sort, array('mtime'))) {
        krsort($result);
    } else {
        ksort($result);
    }
    return array_slice($result, $start, $limit);
}
Ejemplo n.º 2
0
$start = $page * $limit - $limit;
$pagelink = new paging($page, $totalrows, $limit, $paging, $scroll, $scrollnumber);
$j = $start + 1;
for ($i = $start; $i < $start + $limit; $i++) {
    if ($my_articles[$i]->articleID) {
        $i % 2 == 0 ? $bgcolor = "" : ($bgcolor = "#F5F5F5");
        $row_data .= '<tr class="tdhover" id= "tdata" bgcolor = "' . $bgcolor . '">';
        $row_data .= '<td>';
        $row_data .= $j++;
        $row_data .= '</td>';
        $row_data .= '<td>';
        $row_data .= '<input type="checkbox" name="cid[]" id="cb' . $i . '" value="' . $my_articles[$i]->articleID . '" onClick="isChecked(this.checked);"/>';
        $row_data .= '</td>';
        $row_data .= '<td>';
        $row_data .= '<a href="' . VIEW_ARTICLE_URL . $my_articles[$i]->articleID . '">';
        $title = getArticleTitle($my_articles[$i]->articleID);
        $row_data .= '&nbsp;' . $title;
        $row_data .= '</a>';
        $row_data .= '</td>';
        $row_data .= '<td class="blue2">';
        $category_name = getCategory_name($my_articles[$i]->articleID);
        $row_data .= '&nbsp;' . $category_name;
        $row_data .= '</td>';
        $row_data .= '<td ';
        switch ($my_articles[$i]->stageID) {
            case 1:
                // draft
                $row_data .= 'class="black">';
                break;
            case 2:
                //writing
Ejemplo n.º 3
0
}
$fullname = getUser_info($userID, 'fullname');
$position = $usertype;
$month = $_SESSION['month'];
$year = $_SESSION['year'];
$publisher_articles_reports = $_SESSION['report_published_articles'];
for ($i = 0; $i < count($publisher_articles_reports); $i++) {
    if ($publisher_articles_reports[$i]->articleID) {
        $i % 2 == 0 ? $bgcolor = "" : ($bgcolor = "#F5F5F5");
        $row_data .= '<tr class="tdhover" id= "tdata" bgcolor = "' . $bgcolor . '">';
        $row_data .= '<td>';
        $row_data .= $i + 1;
        $row_data .= '</td>';
        $row_data .= '<td>';
        $row_data .= '<a href="' . VIEW_ARTICLE_URL . $publisher_articles_reports[$i]->articleID . '">';
        $title = getArticleTitle($publisher_articles_reports[$i]->articleID);
        $row_data .= '&nbsp;' . $title;
        $row_data .= '</a>';
        $row_data .= '</td>';
        $row_data .= '<td class="blue2">';
        $category_name = getCategory_name($publisher_articles_reports[$i]->articleID);
        $row_data .= $category_name;
        $row_data .= '</td>';
        $row_data .= '<td>';
        $category_name = getFrontpage_type($publisher_articles_reports[$i]->articleID);
        $row_data .= '&nbsp;' . $category_name;
        $row_data .= '</td>';
        $row_data .= '<td>';
        $row_data .= getArticle_authors_info($publisher_articles_reports[$i]->articleID, 'fullname');
        $row_data .= '</td>';
        $row_data .= '<td>';
            <div id="innercontentarea">
                <h1>Daily Page views (in realtime)</h1>
                <table class="articles" cellspacing="0" cellpadding="0">
                    <thead>
                        <tr>
                            <th>Article</th>
                            <th>Viewed</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php 
foreach ($objects->sort(array('count' => -1)) as $obj) {
    ?>
                        <tr>
                            <td><?php 
    echo getArticleTitle((string) $obj['article_id']);
    ?>
</td>
                            <td><?php 
    echo $obj['count'];
    ?>
</td>
                        </tr>
                        <?php 
}
?>
                    </tbody>
                </table>
            </div>
        </div>
    </body>
                    <h1>Most viewed articles (Last 7 days)</h1>
                    <table class="articles" cellspacing="0" cellpadding="0">
                        <thead>
                            <tr>
                                <th width="50%">Article</th>
                                <th width="25%">Page views</th>
                                <th width="*">Avg response time</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php 
foreach ($results->sort(array('value.count' => -1)) as $result) {
    ?>
                            <tr>
                                <td><?php 
    echo getArticleTitle($result['_id']);
    ?>
</td>
                                <td ><?php 
    echo $result['value']['count'];
    ?>
</td>
                                <td><?php 
    echo sprintf('%f ms', $result['value']['avg_resp_time']);
    ?>
</td>
                            </tr>
                            <?php 
}
?>
                        </tbody>
Ejemplo n.º 6
0
    $usertype = $_SESSION['usertype'];
}
$fullname = getUser_info($userID, 'fullname');
$position = $usertype;
$month = $_SESSION['month'];
$year = $_SESSION['year'];
$writer_articles_reports = $_SESSION['report_writer_articles'];
for ($i = 0; $i < count($writer_articles_reports) - 1; $i++) {
    if ($writer_articles_reports[$i]->articleID) {
        $i % 2 == 0 ? $bgcolor = "" : ($bgcolor = "#F5F5F5");
        $row_data .= '<tr class="tdhover" id= "tdata" bgcolor = "' . $bgcolor . '">';
        $row_data .= '<td>';
        $row_data .= $i + 1;
        $row_data .= '</td>';
        $row_data .= '<td>';
        $title = getArticleTitle($writer_articles_reports[$i]->articleID);
        $row_data .= '&nbsp;' . $title;
        $row_data .= '</td>';
        $row_data .= '<td class="blue2">';
        $category_name = getCategory_info($writer_articles_reports[$i]->categoryID, 'category_name');
        $row_data .= '&nbsp;' . $category_name;
        $row_data .= '</td>';
        $row_data .= '<td ';
        $status = getArticle_version_info($writer_articles_reports[$i]->articleID, 'status');
        switch ($status) {
            case 'revise':
                $row_data .= 'class="blue">';
                break;
            case 'rejected':
                $row_data .= 'class="red">';
                break;
Ejemplo n.º 7
0
    <link rel="stylesheet" href="style.css" type="text/css" media="screen" charset="utf-8" />
</head>
<body>
<h1><img src="images/knewsticker.png"> TinyNews<a></h1>
<div align="right"><?php 
echo getArticleCount();
?>
 articles <a href="rss.php">RSS Feed</a></div>
<?php 
foreach (getArticles(10) as $key => $article) {
    ?>
    <div class="title"><a href="article.php/<?php 
    echo prepareTitle(getArticleTitle($article));
    ?>
"><?php 
    echo getArticleTitle($article);
    ?>
</a></div>
    <div class="published">Published: <?php 
    echo date("F d Y H:i:s", getArticlePublished($article));
    ?>
</div>
    <div class="intro"><?php 
    echo getArticleIntro($article);
    ?>
</div>
<?php 
}
?>
<hr/>
<div align="center">
Ejemplo n.º 8
0
        <th width="15%">Publishing date</td>
        <th width="75%">Title</th>
        <th width="10%">Action</th>
    </tr>
<?php 
foreach (getArticles(50) as $article) {
    ?>
    <tr>
        <td>
            <?php 
    echo date("F d Y H:i:s", getArticlePublished($article));
    ?>
        </td>
        <td>
            <?php 
    $title = getArticleTitle($article);
    echo $title ? $title : '(Untitled)';
    ?>
        </td>
        <td align="center">
            <a href="?action=edit&article=<?php 
    echo $article;
    ?>
"><img src="images/edit.png" width=16 height=16 alt="edit" /></a>
            <a href="?action=delete&article=<?php 
    echo $article;
    ?>
"><img src="images/delete.png" width=16 height=16 alt="delete" /></a>
        </td>
    </tr>
<?php 
Ejemplo n.º 9
0
echo $CONFIG['site']['url'];
?>
</link>
<copyright>W&amp;C Information Consultants CC</copyright>
<?php 
foreach (getArticles(10) as $key => $article) {
    ?>
    <item>
        <title><?php 
    echo htmlentities(strip_tags(getArticleTitle($article)));
    ?>
</title>
        <description><?php 
    echo htmlentities(strip_tags(getArticleIntro($article), 'ENT_QUOTES'));
    ?>
</description>
        <link><?php 
    echo $CONFIG['site']['url'] . 'article.php/' . prepareTitle(getArticleTitle($article));
    ?>
</link>
        <pubDate><?php 
    echo strftime("%a, %d %b %Y %T %Z", getArticlePublished($article));
    ?>
</pubDate>
     </item>
<?php 
}
?>
</channel>
</rss>
Ejemplo n.º 10
0
    $usertype = $_SESSION['usertype'];
}
$fullname = getUser_info($userID, 'fullname');
$position = $usertype;
$month = $_SESSION['month'];
$year = $_SESSION['year'];
$editor_articles_reports = $_SESSION['report_editor_articles'];
for ($i = 0; $i < count($editor_articles_reports); $i++) {
    if ($editor_articles_reports[$i]->articleID) {
        $i % 2 == 0 ? $bgcolor = "" : ($bgcolor = "#F5F5F5");
        $row_data .= '<tr class="tdhover" id= "tdata" bgcolor = "' . $bgcolor . '">';
        $row_data .= '<td>';
        $row_data .= $i + 1;
        $row_data .= '</td>';
        $row_data .= '<td class="blue">';
        $title = getArticleTitle($editor_articles_reports[$i]->articleID);
        $row_data .= '&nbsp;' . $title;
        $row_data .= '</td>';
        $row_data .= '<td class="blue2">';
        $category_name = getCategory_name($editor_articles_reports[$i]->articleID);
        $row_data .= $category_name;
        $row_data .= '</td>';
        $row_data .= '<td>';
        $row_data .= getArticle_authors_info($editor_articles_reports[$i]->articleID, 'fullname');
        $row_data .= '</td>';
        $row_data .= '<td ';
        switch ($editor_articles_reports[$i]->status) {
            case 'revise':
                $row_data .= 'class="blue">';
                break;
            case 'rejected':