コード例 #1
0
ファイル: cron.php プロジェクト: kohlhofer/Mindmeto
     $bot->sendUpcomingReminders();
     break;
 case 'email':
     $bot->collectNewFollowers();
     break;
 case 'dm':
     $bot->collectNewDMs();
     break;
 case 'replies':
     $bot->collectNewReplies();
     break;
 case 'ticker':
     /* Fetch the latest reminder data, convert it to a JSON object
        and then save it to a cache */
     $reminder = new Reminder();
     $options = new OptionsHandler();
     $reminderData = array();
     $lastId = $options->getValue('last_ticker_id');
     $latestPublicReminders = $reminder->fetchLatestPublic($lastId);
     if ($latestPublicReminders) {
         $i = 0;
         $latestId = $lastId;
         while ($reminderData = $latestPublicReminders->getRow()) {
             if ($i == 0) {
                 $latestId = $reminderData['reminder_id'];
             }
             $reminderData[$i] = $reminderData;
             $i++;
         }
     }
     $json = fopen(MINDMETO_ROOT . 'cache/ticker.json', 'w');
コード例 #2
0
require_once 'PHP/firebasephp/firebaseLib.php';
//extendedexception files, Will add more over time.
require_once 'PHP/extendedexception/errorcodeininput.php';
require_once 'PHP/extendedexception/erroremptyinput.php';
require_once 'PHP/extendedexception/errorusernameexist.php';
require_once 'PHP/extendedexception/errorpasswordnomatch.php';
require_once 'PHP/extendedexception/errorwrongcredentials.php';
require_once 'PHP/extendedexception/erroroverlayingerror.php';
require_once 'PHP/extendedexception/errorwhitespaceusername.php';
//class the firebase database
$firebase = new \firebase\FirebaseLib('https://frontpagecustom.firebaseio.com/', 'hKaHrJbh6NSCLXWjrBtqgCvepeYB6fF0dviia05D');
$DataBase = new DataBase($firebase);
$SessionModel = new SessionModel();
$LoginModel = new LoginModel($SessionModel, $DataBase);
$RegisterModel = new RegisterModel($SessionModel, $DataBase);
$OptionsModel = new OptionsModel($SessionModel, $DataBase);
$MainModel = new MainModel($SessionModel);
$MainView = new MainView();
$OptionsView = new OptionsView();
$LoginView = new LoginView();
$RegisterView = new RegisterView();
$RegisterHandler = new RegisterHandler($RegisterView, $RegisterModel);
$LoginHandler = new LoginHandler($LoginView, $LoginModel, $DataBase);
$OptionsHandler = new OptionsHandler($OptionsView, $OptionsModel);
$MainHandler = new MainHandler($MainView, $MainModel);
$ViewHandler = new ViewHandler();
$LoginToken = $LoginHandler->login();
$RegisterHandler->register();
$OptionsHandler->options();
$MainHandler->logout();
$ViewHandler->render($LoginToken, $DataBase, $RegisterView, $LoginView, $OptionsView, $MainView);
コード例 #3
0
ファイル: bot.php プロジェクト: kohlhofer/Mindmeto
 function collectNewDMs()
 {
     global $db;
     $options = new OptionsHandler();
     $currentLastId = trim($options->getValue('last_dm_id'));
     try {
         if ($currentLastId > 0) {
             $data = array('since_id' => $currentLastId, 'count' => '200');
         } else {
             $data = array('count' => '200');
         }
         $updates = $this->twitterOAuth->OAuthRequest('https://twitter.com/direct_messages.json', $data, 'GET');
     } catch (Exception $e) {
         if (strlen($e->getMessage()) > 0) {
             die("There was a problem grabbing MindMeTo's DMs (" . $e->getMessage() . ")");
         } else {
             die;
         }
     }
     $updatesJSON = json_decode($updates);
     if (count($updatesJSON) > 0) {
         $lastId = $this->parseTweets("dm", $updatesJSON, $currentLastId);
         $options->setValue('last_dm_id', $lastId);
     }
 }