Example #1
0
if ($twitter_tag != '0' && !empty($twitter_tag)) {
    $since_id = $last_post_id != '0' && !empty($last_post_id) ? '&since_id=' . $last_post_id : '';
    $http = curl_init();
    curl_setopt($http, CURLOPT_URL, 'http://search.twitter.com/search.json?q=%23' . $twitter_tag . '&result_type=recent&rpp=100' . $since_id);
    curl_setopt($http, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($http, CURLOPT_HEADER, FALSE);
    $twitter = curl_exec($http);
    curl_close($http);
    $twitter = json_decode($twitter, true);
    $posts_id = array();
    foreach ($twitter['results'] as $twit) {
        $posts_id[] = $twit['id_str'];
        if ($tmpu = $network->get_user_by_twitter_username($twit['from_user'])) {
            $p = null;
            $p = new newpost();
            $p->set_api_id(get_app_id('twitter'));
            $tmpu->info = $tmpu;
            $tmpu->is_logged = TRUE;
            $p->set_user_advanced($network, $tmpu);
            $p->set_message(preg_replace('/#' . $twitter_tag . '/iu', '', $twit['text']));
            $p->save();
        }
    }
    if (count($posts_id) > 0) {
        if (is_64bit()) {
            $max_post_id = max($posts_id);
        } else {
            $numb = new bigcompare();
            //$numb->try_new_candidate(1234);
            //$numb->try_new_candidate(1234);
            $numb->try_new_candidate_by_array($posts_id);
Example #2
0
<?php 
include 'wp-content/language/lang_chooser.php';
//Loads the language-file
?>


<?php 
global $request;
?>

<?php 
if (get_app_id()) {
    ?>

  <?php 
    $profile = get_profile(get_app_id());
    if ($profile->id == get_profile_id()) {
        if (in_array('settings', $request->activeroute->patterns)) {
            render_partial('admin');
        }
    }
    //  echo '<script type="text/javascript" src="'.$request->url_for(array('resource'=>'pages','action'=>'block.js')).'"></script>';   }
    ?>

  <?php 
    if (!in_array('settings', $request->activeroute->patterns)) {
        ?>

  <?php 
        if (isset($request->params['nickname'])) {
            ?>
Example #3
0
function app_installer_json(&$vars)
{
    extract($vars);
    if (!class_exists('Services_JSON')) {
        lib_include('json');
    }
    $json = new Services_JSON();
    $apps_list = array();
    if (isset($GLOBALS['PATH']['apps'])) {
        foreach ($GLOBALS['PATH']['apps'] as $k => $v) {
            if ($k != 'omb') {
                $apps_list[$k] = $k;
            }
        }
    }
    // apps_list = physical apps on this host
    $sources = environment('remote_sources');
    $remote_list = array();
    // remote_list = all not-installed apps on remote sources
    foreach ($sources as $name => $url) {
        $url = "http://" . $url . "&p=" . urlencode($request->uri);
        $curl = curl_init($url);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($curl, CURLOPT_HEADER, false);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        $result = false;
        $result = curl_exec($curl);
        if ($result) {
            $data = mb_unserialize($result);
            foreach ($data as $appname => $appdata) {
                $remote_list[$appname] = $appname;
            }
        }
        curl_close($curl);
    }
    $i = $Identity->find(get_app_id());
    while ($s = $i->NextChild('settings')) {
        if ($s->name == 'app' && in_array($s->value, $apps_list)) {
            $apps_list = drop_array_element($apps_list, $s->value);
        }
    }
    $i = $Identity->find(get_app_id());
    while ($s = $i->NextChild('settings')) {
        if ($s->name == 'app' && in_array($s->value, $remote_list)) {
            $remote_list = drop_array_element($remote_list, $s->value);
        }
    }
    $all_apps = array_merge($apps_list, $remote_list);
    header("Content-Type: application/javascript");
    print $json->encode($all_apps);
    exit;
}
Example #4
0
function profile_setting($name)
{
    global $db;
    $Setting =& $db->model('Setting');
    $sett = $Setting->find_by(array('name' => $name, 'profile_id' => get_app_id()));
    if ($sett) {
        return $sett->value;
    }
    return false;
}
Example #5
0
     if (!$oauth_client->check_access_type('rw')) {
         if (!isset($_POST['suppress_response_codes'])) {
             header('HTTP/1.1 403 Forbidden');
         } else {
             echo generate_error($api_session->format, 'You have no permission for this action.', $_SERVER['REQUEST_URI'], $api_session->callback);
         }
         exit;
     }
 } elseif ($api_session->bauth_status) {
     if (isset($_POST['source'])) {
         $app_id = detect_app($_POST['source']);
     } else {
         $app_id = detect_app();
     }
     if (!is_numeric($app_id)) {
         $app_id = get_app_id($app_id);
     }
 }
 $to_id = find_user_id($api_session->resource_option);
 if (!$to_id) {
     if (!isset($_POST['suppress_response_codes'])) {
         header('HTTP/1.1 404 Not Found');
     } else {
         echo generate_error($api_session->format, 'Invalid user credentials.', $_SERVER['REQUEST_URI'], $api_session->callback);
     }
     exit;
 }
 $sender_name = $user->info->username;
 $temp = $network->get_user_by_id($to_id);
 $recipient_name = $temp->username;
 unset($temp);
Example #6
0
function followgrid()
{
    require 'wp-content/language/lang_chooser.php';
    //Loads the language-file
    global $db, $request;
    if ($request->action != 'index') {
        return;
    }
    $Subscription = $db->model('Subscription');
    $Identity = $db->model('Identity');
    $Subscription->set_limit(36);
    $Subscription->find_by('subscriber', get_app_id());
    $follist = array();
    $count = 0;
    while ($subscriber = $Subscription->MoveNext()) {
        $i = $Identity->find($subscriber->subscribed);
        $follist[] = array('avatar' => profile_get_avatar($i, 'small'), 'profile_url' => $i->profile_url, 'nickname' => $i->nickname);
    }
    for ($i = 0; $i < 6; $i++) {
        for ($j = 0; $j < 6; $j++) {
            if (isset($follist[$count])) {
                echo '<a href="' . $follist[$count]['profile_url'] . '"><img src="' . $follist[$count]['avatar'] . '" alt="' . $follist[$count]['nickname'] . '" /></a>';
                $count++;
            } else {
                echo '<p></p>';
            }
        }
        echo '<br />';
    }
    if (count($follist) == 36) {
        echo '<a href="' . $request->url_for(array("resource" => $request->params['nickname'])) . "/subscriptions" . '">View All...</a>';
        echo '<br />';
        echo '<br />';
    }
    if (isset($request->params['nickname'])) {
        echo '
    <p class="liother">
    <a class="rss" href="' . $request->url_for(array('resource' => 'posts', 'byid' => get_app_id(), 'page' => 1)) . '.rss">' . $txt['sidebar_rss1'] . ' ' . $request->params['nickname'] . $txt['sidebar_rss2'] . '</a>
    </p>';
    }
}
/**
 * Sets the apdex thresholds.
 */
function set_thresholds($app_apdex_threshold, $end_user_apdex_threshold, $enable_real_user_monitoring)
{
    $nr_connection_info = get_nr_connection_info(PANTHEON_ENVIRONMENT);
    if (empty($nr_connection_info)) {
        echo "Unable to get New Relic connection info\n";
        return;
    }
    $api_key = $nr_connection_info['api_key'];
    $app_name = $nr_connection_info['app_name'];
    $app_id = get_app_id($api_key, $app_name);
    echo "===== Setting New Relic Values for the App '{$app_name}' =====\n";
    echo "Application Apdex Threshold: {$app_apdex_threshold}\n";
    echo "End User Apdex Threshold: {$end_user_apdex_threshold}\n";
    echo "Enable Real User Monitoring: {$enable_real_user_monitoring}\n";
    $url = 'https://api.newrelic.com/v2/applications/' . $app_id . '.json';
    $settings = ['application' => ['name' => $app_name, 'settings' => ['app_apdex_threshold' => $app_apdex_threshold, 'end_user_apdex_threshold' => $end_user_apdex_threshold, 'enable_real_user_monitoring' => $enable_real_user_monitoring]]];
    $data_json = json_encode($settings);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
    $headers = ['X-API-KEY:' . $api_key, 'Content-Type: application/json'];
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    $result = curl_exec($ch);
    if (curl_errno($ch)) {
        echo 'Error:' . curl_error($ch);
    }
    curl_close($ch);
    echo "===== Finished Setting New Relic Values =====\n";
}