Пример #1
0
    header('HTTP/1.0 403 Forbidden');
    exit('This script is only accessible from localhost.');
}
?>
<!DOCTYPE html>
<!--
Description:
This page is a simple command-based manager tool for admin.
-->
<html>
    <head>
        <title>Grosona</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <?php 
$token = $grosona->getSystemQuerier()->getToken();
$loginUri = $grosona->getFacebookQuerier()->getLoginUrl();
echo '<script>var checkTokenUri = "https://developers.facebook.com/tools/debug/accesstoken?q=' . $token . '";</script>';
echo '<script>var loginUri = "' . $loginUri . '";</script>';
echo '<script>var __grosona_appId = "' . $grosona->getConfig()['fbAppId'] . '";</script>';
echo "<script>var __grosona_status = JSON.parse('" . json_encode($grosona->getStatus()) . "');</script>";
?>
        <meta name = "description" content ="admin">
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
        <style>
            .display {
                resize : none;
                width: 100%;
                height: 650px;
            }
            input {
                width: 100%;
$grosona = new Grosona\GrosonaDriver();
$config = Grosona\Config::getConfig();
$dba = new Grosona\Comm\DatabaseAccessor($config['dbServerName'], $config['dbUserName'], $config['dbPassword'], $config['dbName'], $config['groupId'], 0, new Grosona\Utility\Logger($config['logFile'], ''));
$funct = filter_input(INPUT_GET, 'f');
if ('get' === $funct) {
    $fids = $dba->queryAssoc("SELECT `feed_id` FROM `grosona__images` WHERE `image_path`='aa' ORDER BY RAND() LIMIT 1");
    while ($fids) {
        $fid = $fids[0]['feed_id'];
        $syntax = "/{$fid}?fields=id, from, message, type, created_time, updated_time, attachments";
        $query = new Grosona\FacebookQuery();
        $query->setProperty(SYNTAX, $syntax);
        $query->setProperty(ITERATE_COUNT, 0);
        $query->setProperty(TYPE, TYPE_FEED);
        $query->setProperty(FEED_ID, $fid);
        $query->setProperty(CONTINUED_INDEX, 0);
        $grosona->getFacebookQuerier()->setQuery($query);
        $result = $grosona->getFacebookQuerier()->execute();
        if ($result) {
            $feed = $result->toAssoc();
            foreach ($feed['imageSet'] as $imgInfo) {
                $grosona->getFeedQuerier()->updateImage($imgInfo);
            }
        }
        $fids = $dba->queryAssoc("SELECT `feed_id` FROM `grosona__images` WHERE `image_path`='aa' ORDER BY RAND() LIMIT 1");
    }
} else {
    if ('check' === $funct) {
        $result = $dba->query("SELECT * FROM `grosona__images` WHERE `image_path`='uncheck' ORDER BY RAND() LIMIT 50000");
        while ($row = $result->fetch_assoc()) {
            $iid = $row['image_id'];
            if (is_readable(__DIR__ . "/../storage/img/{$iid}.jpg")) {
Пример #3
0
  `item_description` varchar(1024) DEFAULT NULL,
  `item_note` varchar(1024) DEFAULT NULL,
  `item_global` varchar(1024) DEFAULT NULL,
  `feed_id` varchar(64) NOT NULL,
  PRIMARY KEY (`item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
$mysqli->query('ALTER TABLE xdb__items ADD FOREIGN KEY (feed_id) REFERENCES grosona__feeds (feed_id);');
$mysqli->query('CREATE TABLE IF NOT EXISTS `xdb__subscriptions` (
  `subscription_id` int(11) NOT NULL AUTO_INCREMENT,
  `token` varchar(1024) NOT NULL,
  PRIMARY KEY (`subscription_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
$mysqli->query('CREATE TABLE IF NOT EXISTS `xdb__user_subscription_relation` (
  `subscription_id` int(11) NOT NULL,
  `user_id` varchar(64) NOT NULL,
  PRIMARY KEY (`subscription_id`, `user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
$mysqli->query('ALTER TABLE xdb__user_subscription_relation ADD FOREIGN KEY (subscription_id) REFERENCES xdb__subscriptions (subscription_id);');
$mysqli->query('ALTER TABLE xdb__user_subscription_relation ADD FOREIGN KEY (user_id) REFERENCES grosona__users (user_id);');
$mysqli->query('CREATE TABLE IF NOT EXISTS `xdb__notifiers` (
  `notifier_id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` varchar(64) NOT NULL,
  `uri` varchar(256) NOT NULL,
  PRIMARY KEY (`notifier_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
$mysqli->query('ALTER TABLE xdb__notifiers ADD FOREIGN KEY (user_id) REFERENCES grosona__users (user_id);');
session_start();
$grosona = new Grosona\GrosonaDriver();
$grosona->getSystemQuerier()->setSystemHealthy(true);
header("Location: " . $grosona->getFacebookQuerier()->getLoginUrl());