public function index()
 {
     $this->assign('LatestArticles', getLatest());
     $this->assign('categories', getCategory());
     $this->assign('allTags', getAllTags());
     $this->type = $this->_get('type');
     $this->typevalue = $this->_get('typevalue');
     $page = isset($_GET['page']) ? $_GET['page'] : 1;
     switch ($this->_get('type')) {
         case 'username':
             $this->UserName($this->_get('typevalue'), $page);
             break;
         case 'userid':
             $this->UserId($this->_get('typevalue'), $page);
             break;
         case 'tag':
             $this->Tag($this->_get('typevalue'), $page);
             break;
         case 'category':
             $this->Category($this->_get('typevalue'), $page);
             break;
         case 'search':
             $this->Search($this->_get('keywords'), $page);
             break;
         default:
             $this->error('出错了');
     }
     //模板输出
     $this->display('articlelist');
 }
 public function index()
 {
     $data = isset($_GET['page']) ? $_GET['page'] : 1;
     $this->show($data);
     $this->assign('LatestArticles', getLatest());
     $this->assign('categories', getCategory());
     $this->assign('allTags', getAllTags());
     $this->display();
 }
<?php

require_once 'func.inc.php';
getLatest();
Beispiel #4
0
        $text = "Seriously? You're seriously going to try and check the price on an exchange that went bankrupt? How do I even quote that... ? Try 'troll' instead";
        // technically, last price at gox was 135.69
        $arr = array('text' => $text, 'username' => $botname);
        // clearly the user is trolling us, so we end the script
        echo json_encode($arr);
        exit(0);
    } else {
        if ($exc == '!') {
            $text = "Commands are case sensitive. Use 'price <exchange>' format where <exchange> is bfx, bs, RBYe, okc. Use 'all' to get data from all exchanges in one response";
        } else {
            if ($exc == 'all') {
                $excDataArray = getLatest('btx');
                $text = formatOutput($excDataArray, "");
                $excDataArray = getLatest('polo');
                $text .= formatOutput($excDataArray, "");
            } else {
                $excDataArray = getLatest('btx');
                $text = formatOutput($excDataArray, "");
                $excDataArray = getLatest('polo');
                $text .= formatOutput($excDataArray, "");
            }
        }
    }
} else {
    $text = "Some type of error occured. DEBUG: " . $cmd . " length cmd = " . strlen($cmd);
    $botname = "ERROR";
}
// and now we package the return response we've selected above in the slack API format and encode it to json.
$arr = array('text' => $text, 'username' => $botname);
echo json_encode($arr);
exit(0);
Beispiel #5
0
                }
                if ($time > get_date(12, $year - 1, 1, 5, -1) && $time < get_date(3, $year, 1, 5, -1)) {
                    $daysUntil = days_until(date(DATE_RFC850, get_date(3, $year, 1, 5, -1)));
                    $nextQtrly = date(DATE_RFC850, get_date(3, $year, 1, 5, -1));
                }
                if ($time > get_date(3, $year, 1, 5, -1) && $time < get_date(6, $year, 1, 5, -1)) {
                    $daysUntil = days_until(date(DATE_RFC850, get_date(6, $year, 1, 5, -1)));
                    $nextQtrly = date(DATE_RFC850, get_date(6, $year, 1, 5, -1));
                }
                if ($time > get_date(6, $year, 1, 5, -1) && $time < get_date(9, $year, 1, 5, -1)) {
                    $daysUntil = days_until(date(DATE_RFC850, get_date(9, $year, 1, 5, -1)));
                    $nextQtrly = date(DATE_RFC850, get_date(9, $year, 1, 5, -1));
                }
                if ($time > get_date(9, $year, 1, 5, -1) && $time < get_date(12, $year, 1, 5, -1)) {
                    $daysUntil = days_until(date(DATE_RFC850, get_date(12, $year, 1, 5, -1)));
                    $nextQtrly = date(DATE_RFC850, get_date(12, $year, 1, 5, -1));
                }
                $excDataArray = getLatest('bfx');
                $newPrice = (1 + 0.0005999999999999999 * $daysUntil) * floatval($excDataArray["last"]);
                $text = "BFX Last: " . $excDataArray["last"] . ", Next Qtrly: " . $nextQtrly . ", Days Til that date: " . $daysUntil . ", Calculated: " . $newPrice;
            } else {
                $text = "Some type of error occured. DEBUG: " . $cmd . " length cmd = " . strlen($cmd);
                $botname = "ERROR";
            }
        }
    }
}
// and now we package the return response we've selected above in the slack API format and encode it to json.
$arr = array('text' => $text, 'username' => $botname);
echo json_encode($arr);
exit(0);
 /**
  * 修改文章
  */
 public function edit()
 {
     $this->assign('LatestArticles', getLatest());
     if ($this->checkAuthority()) {
         $cUser = session('LoginUser');
         $this->assign('categories', getCategoriesByUser($cUser['user_id']));
         $article = D('article');
         $data = $article->find($this->_get('id'));
         if ($data) {
             $data['article_content'] = stripcslashes($data['article_content']);
             //获取文章类别
             $cate = D('category');
             $catesql = 'select category_name from ' . C('DB_PREFIX') . 'category where category_id=' . $data['article_categoryId'];
             $art_cate = $cate->query($catesql);
             $data['article_category'] = $art_cate[0]['category_name'];
             $this->assign('article', $data);
             //获取文章tags
             $tag = M('tag');
             $arttag = M('article_tag');
             $art_tags = $arttag->where('article_id=' . $this->_get('id'))->select();
             if ($art_tags) {
                 $tags = '';
                 foreach ($art_tags as $art_tag) {
                     $realTag = $tag->where('tag_id=' . $art_tag['tag_id'])->select();
                     $tags = $tags . $realTag[0]['tag_name'] . ',';
                 }
                 $this->assign('tags', $tags);
             } else {
                 $this->assign('tags', '');
             }
             $this->assign('security_ticket', md5($_COOKIE['op_ticket']));
             //安全码
             $this->display('edit');
         } else {
             $this->error('抱歉,没找到资源');
         }
     } else {
         $this->error('请先登录', U('/login'));
     }
 }
Beispiel #7
0
<?php

require "hypem.class.php";
header("Content-Type: application/rss+xml");
echo '<?xml version="1.0" encoding="UTF-8"?>';
$hypes = getLatest();
?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
<channel>
<title>Today's Blog Music - Hypem</title>
<link>http://hypem.com/</link>
<description>latest mp3 blog tracks from all over</description>
<language>en</language>

<lastBuildDate><?php 
echo date('D, d M Y H:i:s');
?>
</lastBuildDate>
		<generator>happylinks</generator>
		<ttl>60</ttl>
		<image>
			<url>http://happylinks.nl/hypem/img/hypem.png</url>
			<title>Popular Blog Tracks - The Hype Machine</title>
			<link>http://hypem.com/</link>
		</image>
		<itunes:author>Hypem.com</itunes:author>
		<itunes:summary>Discover music blogs worth listening to. Create your own music stream with your favorite artists, blogs &amp; friends.</itunes:summary>
		<itunes:owner>
			<itunes:name>Hypem.com</itunes:name>
			<itunes:email>contact@hypem.com</itunes:email>
		</itunes:owner>
Beispiel #8
0
chdir(dirname(__FILE__));
include '../../cron/cword/get-cword.php';
include '../../cron/cword/email.php';
$email = '*****@*****.**';
try {
    ///- Set the flag to either cryptic (mon-fri) or prize (sat)
    $type = "cryptic";
    if (date("N") == 6) {
        $type = "prize";
    }
    ///- Only do this if it's not a Sunday
    if (date("N") != 7) {
        ///- Get most recent success
        $last = file_get_contents("../../public_html/cword/last");
        //Get latest from site
        $id = getLatest($type);
        if ($id == 0) {
            //ERROR
            //email that couldn't identify the crossword
            mg_send($email, 'Cron Job Running', 'Cant identify todays crossword - last one is: ' . $last);
            return;
        } else {
            if ($last > $id) {
                //ERROR
                //email last > today
                mg_send($email, 'Cron Job Running', 'LAST: ' . $last . ' is greater than TODAY:' . $id);
                return;
            } else {
                if ($last == $id) {
                    return;
                }
Beispiel #9
0
<?php

include "common.php";
$data = json_decode(file_get_contents("php://input"));
function getLatest($db)
{
    $exe = "SELECT * FROM matches ORDER BY date DESC LIMIT 50";
    $sth = $db->prepare($exe);
    $sth->execute();
    $res = $sth->fetchAll();
    return $res;
}
$res = getLatest($db);
echo json_encode($res);
Beispiel #10
0
require_once "includes/applicationVariables.php";
require_once "includes/DbManager.php";
require_once "includes/project.php";
require_once "includes/projectRequest.php";
require_once "includes/projectData.php";
//connect to DB
$dbManager = new DbManager();
if (isHTTP()) {
    if (isset($_POST["action"]) && !empty($_POST["action"])) {
        // Checks if action value exists
        $action = $_POST["action"];
        $length = $_POST["length"];
        switch ($action) {
            //Switch case for value of action
            case "latest":
                getLatest($length);
                break;
        }
    }
}
//Function to check if the request is an AJAX request
function isHTTP()
{
    return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
}
function getLatest($length)
{
    $return = $_POST;
    $projectRequest = new projectRequest();
    $projectRequest->howMany = $length;
    $projectCollection = Project::GetCollection($projectRequest);
Beispiel #11
0
<?php

include 'include.php';
isAllowed();
if (isset($_GET['page'])) {
    $content = getLatest($_GET['page']);
} else {
    $content = getLatest();
}
$content = $content->latest_feed;
$pages = getPages();
getHeader();
?>


<article>
	<!-- Contenu de la page -->
	<div class="contenu">
		<div class="contenu_static">
			<h2>Les dernières publications</h2>
			<section id="photos">
				<ul id="inedit">
					<?php 
foreach ($content as $k => $v) {
    ?>
						<li>
							<a href="afficherphoto.php?id=<?php 
    echo $v->id;
    ?>
"> 
							<img src="http://api-rest-youcef-m.c9.io<?php