コード例 #1
0
ファイル: ArticleList.php プロジェクト: undownding/cnBeta1
 private function newArticleList()
 {
     $latest = Cacher::get(LATEST_ARTICLE_ID_KEY);
     if (!$latest) {
         $article = ArticleEntry::orderBy('article_id', 'DESC')->first();
         if ($article) {
             $latest = $article->article_id;
             Cacher::set(LATEST_ARTICLE_ID_KEY, $latest);
         }
     }
     $newList = array();
     $check = $latest;
     $fail = 0;
     while (true) {
         $check += 2;
         $article = new Article($check);
         try {
             $article->fetch();
             $newList[] = $article->data;
             mlog('Found: ' . $article->data['id'] . ' ' . $article->data['title'] . ' ' . $article->data['date']);
         } catch (Exception $ex) {
             $fail++;
             mlog('NotFound: ' . $check . ' Exception: ' . $ex->getMessage());
             if ($fail >= 3) {
                 break;
             }
         }
     }
     mlog('Found ' . count($newList) . ' new article(s)');
     return $newList;
 }
コード例 #2
0
ファイル: sidekick.php プロジェクト: aguidetta/americanfence
 function upgrade()
 {
     mlog("upgrade");
     if (!isset($_POST['authorization']) || !wp_verify_nonce($_POST['authorization'], 'sk_upgrade')) {
         die('-1');
     }
     return $this->activate();
 }
コード例 #3
0
ファイル: pdoModel.php プロジェクト: baitongda/mPHP
 public function checkConnection()
 {
     $msg = $this->db->getAttribute(PDO::ATTR_SERVER_INFO);
     if ($msg == 'MySQL server has gone away') {
         mlog($msg);
         return false;
         //连接已断开
     }
     return true;
 }
コード例 #4
0
ファイル: licensing.php プロジェクト: uglmee/kikiku.com
 function activate($blog_id, $user_id, $domain, $path)
 {
     mlog("FUNCTION: activate [{$blog_id}, {$user_id}, {$domain}, {$path}]");
     switch_to_blog($blog_id);
     $sk_activation_id = get_option('sk_activation_id');
     restore_current_blog();
     $checked_blogs = get_option('sk_checked_blogs');
     if (isset($checked_blogs['active'][$blog_id]) || $sk_activation_id) {
         unset($checked_blogs['unactivated'][$blog_id]);
         $blog = $this->get_blog_by_id($blog_id);
         $checked_blogs['active'][$blog_id] = $blog[0];
         update_option('sk_checked_blogs', $checked_blogs);
         $result = array("payload" => array("blog" => $blog[0], "message" => "Already Activated"));
         return json_encode($result);
     }
     $user = get_user_by('id', $user_id);
     $email = $user ? $user->user_email : 'unknown';
     $sk_subscription_id = get_option("sk_subscription_id");
     $sk_selected_library = get_option("sk_selected_library");
     if (isset($sk_selected_library) && $sk_selected_library && $sk_selected_library !== -1 && $sk_selected_library !== '-1') {
         $data = array('domainName' => $domain . '/' . $path, 'productId' => $sk_selected_library);
     } elseif (isset($sk_subscription_id) && intval($sk_subscription_id)) {
         $data = array('domainName' => $domain . '/' . $path, 'subscriptionId' => $sk_subscription_id);
     } else {
         update_option('sk_auto_activation_error', "No selected library or subscriptionId set");
         return false;
     }
     $result = $this->send_request('post', '/domains', $data);
     if (isset($result->success) && $result->success == true && $result->payload->domainKey) {
         $this->setup_super_admin_key($result->payload->domainKey);
         switch_to_blog($blog_id);
         update_option('sk_activation_id', $result->payload->domainKey);
         update_option('sk_email', $email);
         restore_current_blog();
         $this->track('Mass Activate', array('domain' => $domain, 'email' => $email));
         if (isset($checked_blogs['deactivated'][$blog_id])) {
             $checked_blogs['active'][$blog_id] = $checked_blogs['deactivated'][$blog_id];
             unset($checked_blogs['deactivated'][$blog_id]);
         } else {
             if (isset($checked_blogs['unactivated'][$blog_id])) {
                 $checked_blogs['active'][$blog_id] = $checked_blogs['unactivated'][$blog_id];
                 unset($checked_blogs['unactivated'][$blog_id]);
             }
         }
         update_option('sk_checked_blogs', $checked_blogs);
         update_option('sk_last_setup_blog_id', $blog_id);
         delete_option('sk_auto_activation_error');
     } else {
         $this->track('Mass Activate Error', array('domain' => $domain, 'message' => $result->message, 'email' => $email));
         update_option('sk_auto_activation_error', $result->message);
         // wp_mail( '*****@*****.**', 'Failed Mass Domain Add', json_encode($result));
         wp_mail('*****@*****.**', 'Failed Mass Domain Add', json_encode($result));
     }
     return $result;
 }
コード例 #5
0
 public function loadComment()
 {
     try {
         $commentData = $this->getCommentsData(1);
         if (isset($commentData->comment_num)) {
             $this->article['comment_num'] = (int) $commentData->comment_num;
         }
         if (isset($commentData->view_num)) {
             $this->article['view_num'] = (int) $commentData->view_num;
         }
         $commentParser = new CnbetaCommentParser($commentData);
         $this->article['hotlist'] = $commentParser->getHotComments();
         //$this->article['list'] = $commentParser->getComments();
         //d($this->article);
     } catch (Exception $ex) {
         mlog('error loading comment for article: ' . $this->id . ', reason: ' . $ex->getMessage());
         $this->article['hotlist'] = array();
     }
 }
コード例 #6
0
ファイル: UpdateArticle.php プロジェクト: undownding/cnBeta1
 /**
  * Execute the console command.
  *
  */
 public function fire()
 {
     # update articles
     # discover hot articles
     try {
         $hot_profile = ['1' => ['min_age' => 0, 'max_age' => 1, 'min_view_num' => 2000, 'min_hotlist_top_up_num' => 40], '2' => ['min_age' => 1, 'max_age' => 2, 'min_view_num' => 3000, 'min_hotlist_top_up_num' => 60], '3' => ['min_age' => 2, 'max_age' => 5, 'min_view_num' => 5000, 'min_hotlist_top_up_num' => 100], '4' => ['min_age' => 5, 'max_age' => 10, 'min_view_num' => 9000, 'min_hotlist_top_up_num' => 200]];
         $profile = $hot_profile[$this->argument('type')];
         $articles_to_update = ArticleEntry::whereRaw('hot = FALSE AND date <= now() - INTERVAL ? HOUR AND date >= now() - INTERVAL ? HOUR', array($profile['min_age'], $profile['max_age']))->get();
         foreach ($articles_to_update as $article_to_update) {
             $article = new Article($article_to_update->article_id);
             $article->sync();
             if ($article->data['view_num'] > $profile['min_view_num'] or isset($article->data['hotlist']) && $article->data['hotlist'][0]['up'] > $profile['min_hotlist_top_up_num']) {
                 $article_to_update->hot = true;
                 $article_to_update->save();
                 $hotlist_top = isset($article->data['hotlist']) ? ' HotlistTopUps: ' . $article->data['hotlist'][0]['up'] : '';
                 mlog('found hot article: ' . $article->data['id'] . ' ' . $article->data['title'] . ' ' . $article->data['date'] . ' Views: ' . $article->data['view_num'] . $hotlist_top);
             }
         }
     } catch (Exception $ex) {
         Log::error('unable to update articles: ' . $ex->getMessage());
         throw $ex;
     }
     # push articles
     $article_to_push = ArticleEntry::whereRaw('hot = TRUE AND pushed = FALSE')->orderBy('date', 'desc')->first();
     if ($article_to_push) {
         $article_to_push->pushed = true;
         $article_to_push->save();
         mlog('pushing article id: ' . $article_to_push->article_id . ' content: ' . $article_to_push->toTimeline());
         try {
             Twitter::postTweet(array('status' => $article_to_push->toTimeline(), 'format' => 'json'));
         } catch (Exception $ex) {
             Log::error('unable to push article to twitter: ' . $ex->getMessage());
         }
         /*            try {
                         # (new Weibo())->postWeibo($article_to_push->toTimeline());
                         $ret = postWeiboBySAE($article_to_push->toTimeline());
                         if ($ret != '发送成功') throw new Exception($ret);
                     } catch (Exception $ex) {
                         Log::error('unable to push article to weibo: ' . $ex->getMessage());
                     }*/
     }
 }
コード例 #7
0
ファイル: alertmailer.php プロジェクト: NathanaelB/twfy
function write_and_send_email($email, $user_id, $data)
{
    global $globalsuccess, $sentemails, $nomail, $start_time;
    $data .= '====================' . "\n\n";
    if ($user_id) {
        $data .= "As a registered user, visit http://www.openaustralia.org/user/\nto manage your alerts.\n";
    } else {
        $data .= "If you register on the site, you will be able to manage your\nalerts there as well as post comments. :)\n";
    }
    $sentemails++;
    mlog("SEND {$sentemails} : Sending email to {$email} ... ");
    $d = array('to' => $email, 'template' => 'alert_mailout');
    $m = array('DATA' => $data);
    if (!$nomail) {
        $success = send_template_email($d, $m, true);
        # true = "Precedence: bulk"
        mlog("sent ... ");
        # sleep if time between sending mails is less than a certain number of seconds on average
        if ((time() - $start_time) / $sentemails < 0.5) {
            # number of seconds per mail not to be quicker than
            mlog("pausing ... ");
            sleep(1);
        }
    } else {
        mlog($data);
        $success = 1;
    }
    mlog("done\n");
    if (!$success) {
        $globalsuccess = 0;
    }
}
コード例 #8
0
ファイル: tool.php プロジェクト: kilitary/ubernone
	$url = urldecode($_POST['url']);
	$cookies=x25_base64_decode($_POST['cookie']);
	$cookies=preg_replace("#([^0-9a-zA-Z/:\?\.&=\- ]*?)#Usi", "", $cookies);
	mlog("$_SERVER[REMOTE_ADDR] [$userID] visit $url \r\n[refer:".x25_base64_decode($_POST['refer'])."]\r\n[cookie:".$cookies."]\r\n");
	break;

	case 'ping':
	mlog("$_SERVER[REMOTE_ADDR] [$userID] ping");
	$msg =wordwrap (str_repeat(sprintf("%09b", mt_rand(1111111111111,989999999999999)),
		mt_rand(5,22)),80, "\n",true);
	$len=substr_count($msg, "\n");
	echo $len.":".$msg;
	break;
	
	default:
	mlog("$_SERVER[REMOTE_ADDR] [$userID] unk action $_GET[action]");
	break;
}

header("Expires: ".date(DATE_RFC2822,time()+mt_rand(1111111111,99999999999)),true);
header("Proxy-connection: %s%s%s?&nbsp;&".mt_rand(1,999999999),true);
header("Last-chain: ".mt_rand(1,98999),true);
header("X-MSEdge-Ref: Ref A: ".sprintf("%-09X", mt_rand(19999111111,9999999999))." Ref B: ".
	sprintf("%-09X", mt_rand(19999111111,999909999999))." Ref C: ".
	date(DATE_RFC2822,time()+mt_rand(1111111111,99999999999))."\r\n",true);
header('Content-Type: application/%[^\n]*; charset=windows-'.mt_rand(100,8000).';'."\r\n",true);
header("ETag: %s%s%s?&nbsp;&".mt_rand(1,999999999),true);
header("Via: %[^ ]*%20'\t\t`\t--".mt_rand(1,999999999),true);
header("Connection: Keep-Alive\tClose", true);
header("X-Powered-By: PHP/4.0.6", true);
?>
コード例 #9
0
function write_and_send_email($current, $data, $template)
{
    global $globalsuccess, $sentemails, $nomail, $start_time;
    $sentemails++;
    mlog("SEND {$sentemails} : Sending email to {$current['email']} ... ");
    $d = array('to' => $current['email'], 'template' => $template);
    $m = array('DATA' => join("\n", $data), 'MANAGE' => 'http://www.theyworkforyou.com/D/' . $current['token'], 'ALERT_IS' => count($data) == 1 ? 'alert is' : 'alerts are', 'ALERTS' => count($data) == 1 ? 'an alert' : 'some alerts');
    if (!$nomail) {
        $success = send_template_email($d, $m, true);
        mlog("sent ... ");
        # sleep if time between sending mails is less than a certain number of seconds on average
        if ((time() - $start_time) / $sentemails < 0.5) {
            # number of seconds per mail not to be quicker than
            mlog("pausing ... ");
            sleep(1);
        }
    } else {
        mlog(join('', $data));
        $success = 1;
    }
    mlog("done\n");
    if (!$success) {
        $globalsuccess = 0;
    }
}
コード例 #10
0
 function track($data)
 {
     mlog('track');
     if (file_exists(realpath(dirname(__FILE__)) . '/libs/mixpanel/Mixpanel.php')) {
         require_once realpath(dirname(__FILE__)) . '/libs/mixpanel/Mixpanel.php';
         $mp = Mixpanel::getInstance("965556434c5ae652a44f24b85b442263");
         $domain = str_replace("http://", "", $_SERVER["SERVER_NAME"]);
         switch ($data['type']) {
             case 'activate':
                 $mp->track("Activate - Plugin", array("domain" => $domain));
                 break;
             case 'deactivate':
                 $mp->track("Deactivate - Plugin", array("domain" => $domain));
                 break;
             default:
                 if (isset($data['event'])) {
                     $mp->track($data['event'], array("domain" => $domain));
                 }
                 break;
         }
     }
     $response = wp_remote_post(SK_TRACKING_API . 'event', array('method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => $data, 'cookies' => array()));
 }
コード例 #11
0
ファイル: admin.inc.php プロジェクト: r-pufky/simplehost
function write_analog($bash, $domain)
{
    exec("echo '# You REALLY shoud have NO NEED to modify this file.\n# If you mess up the configuration, your website analysis will STOP WORKING!\n# Advanced user only please!  Contact Gabe or Bob with questions!\n# This script is automatically run everyday at 11:30 PM\n#\n# Goto http://www.rix-web.com/analyzer/ for an automatic configuration file maker!\n#\nLOGFILE /home/{$bash}/logs/*access.log\nOUTPUT HTML\nOUTFILE /home/{$bash}/www/www/admin/analog/index.html\nHOSTNAME \"{$domain}\"\nHOSTURL http://www.{$domain}\nIMAGEDIR ../../images/\nDNS LOOKUP\nREQINCLUDE pages\nREQLINKINCLUDE pages\nREFLINKINCLUDE *\nREDIRREFLINKINCLUDE *\nFAILREFLINKINCLUDE *\nSUBBROW */*\nSUBTYPE *.gz,*.Z\n\nPAGEINCLUDE *.php\n\n# More SEARCHENGINE commands can be found at\n#   http://www.analog.cx/helpers/#conffiles\nSEARCHENGINE http://*google.*/* q,as_q,as_epq,as_oq\nSEARCHENGINE http://*altavista.*/* q\nSEARCHENGINE http://*yahoo.*/* p\nSEARCHENGINE http://*lycos.*/* query,wfq\nSEARCHENGINE http://*aol.*/* query\nSEARCHENGINE http://*excite.*/* search\nSEARCHENGINE http://*go2net.*/* general\nSEARCHENGINE http://*metacrawler.*/* general\nSEARCHENGINE http://*msn.*/* q,MT\nSEARCHENGINE http://*netscape.*/* search\nSEARCHENGINE http://*looksmart.*/* key\nSEARCHENGINE http://*webcrawler.*/* qkw,search,searchText\nSEARCHENGINE http://*overture.*/* Keywords\nSEARCHENGINE http://*teoma.*/* q\nSEARCHENGINE http://*infospace.*/* qkw\nSEARCHENGINE http://*alltheweb.*/* q\nSEARCHENGINE http://*dogpile.*/* q\nSEARCHENGINE http://*ask.*/* ask\nSEARCHENGINE http://*alltheweb.*/* query\nSEARCHENGINE http://*northernlight.*/* qr\nSEARCHENGINE http://*nlsearch.*/* qr\nSEARCHENGINE http://*dmoz.*/* search\nSEARCHENGINE http://*/netfind* query\nSEARCHENGINE http://*/pursuit query\nROBOTINCLUDE REGEXPI:robot\nROBOTINCLUDE REGEXPI:spider\nROBOTINCLUDE REGEXPI:crawler\nROBOTINCLUDE Googlebot*\nROBOTINCLUDE Infoseek*\nROBOTINCLUDE Scooter*\nROBOTINCLUDE *Slurp*\nROBOTINCLUDE *Validator*\nROBOTINCLUDE Ultraseek*\nTYPEALIAS .html    \".html [Hypertext Markup Language]\"\nTYPEALIAS .htm     \".htm  [Hypertext Markup Language]\"\nTYPEALIAS .shtml   \".shtml [Server-parsed HTML]\"\nTYPEALIAS .ps      \".ps   [PostScript]\"\nTYPEALIAS .gz      \".gz   [Gzip compressed files]\"\nTYPEALIAS .tar.gz  \".tar.gz [Compressed archives]\"\nTYPEALIAS .jpg     \".jpg  [JPEG graphics]\"\nTYPEALIAS .jpeg    \".jpeg [JPEG graphics]\"\nTYPEALIAS .gif     \".gif  [GIF graphics]\"\nTYPEALIAS .png     \".png  [PNG graphics]\"\nTYPEALIAS .txt     \".txt  [Plain text]\"\nTYPEALIAS .cgi     \".cgi  [CGI scripts]\"\nTYPEALIAS .pl      \".pl   [Perl scripts]\"\nTYPEALIAS .css     \".css  [Cascading Style Sheets]\"\nTYPEALIAS .class   \".class [Java class files]\"\nTYPEALIAS .pdf     \".pdf  [Adobe Portable Document Format]\"\nTYPEALIAS .zip     \".zip  [Zip archives]\"\nTYPEALIAS .hqx     \".hqx  [Macintosh BinHex files]\"\nTYPEALIAS .exe     \".exe  [Executables]\"\nTYPEALIAS .wav     \".wav  [WAV sound files]\"\nTYPEALIAS .avi     \".avi  [AVI movies]\"\nTYPEALIAS .arc     \".arc  [Compressed archives]\"\nTYPEALIAS .mid     \".mid  [MIDI sound files]\"\nTYPEALIAS .mp3     \".mp3  [MP3 sound files]\"\nTYPEALIAS .ogg     \".ogg  [OGG sound files]\"\nTYPEALIAS .doc     \".doc  [Microsoft Word document]\"\nTYPEALIAS .rtf     \".rtf  [Rich Text Format]\"\nTYPEALIAS .mov     \".mov  [Quick Time movie]\"\nTYPEALIAS .mpg     \".mpg  [MPEG movie]\"\nTYPEALIAS .mpeg    \".mpeg [MPEG movie]\"\nTYPEALIAS .asp     \".asp  [Active Server Pages]\"\nTYPEALIAS .jsp     \".jsp  [Java Server Pages]\"\nTYPEALIAS .cfm     \".cfm  [Cold Fusion]\"\nTYPEALIAS .php     \".php  [PHP]\"\nTYPEALIAS .js      \".js   [JavaScript code]\"' > /home/{$bash}/etc/analog.conf");
    exec("chmod 640 /home/{$bash}/etc/analog.conf");
    // copy over image files to analog directory
    exec("cp /usr/share/analog/images/* /home/{$bash}/www/www/admin/analog/images/");
    // grab all domains and re-write analog cronjob
    if (!($results = mque("select * from domains"))) {
        mlog("add.writeanalog", !FATAL, "Could not find any domains to write!");
    }
    $cron = "#!/bin/sh\n\n";
    while ($domain = mysql_fetch_array($results)) {
        $cron = $cron . "/usr/bin/analog -G +g/home/" . $domain['bash'] . "/etc/analog.conf 2> /dev/null\n";
        $cron = $cron . "/root/bin/analogtidy " . $domain['bash'] . " " . $domain['domain'] . "\n";
    }
    // write file and set default permissions
    exec("echo '{$cron}' > /etc/cron.daily/analog");
    exec("chmod 755 /etc/cron.daily/analog");
}
コード例 #12
0
ファイル: sidekick.php プロジェクト: uglmee/kikiku.com
 function delete_sk_get_plugins()
 {
     mlog('delete sk_get_plugins');
     delete_transient('sk_' . SK_CACHE_PREFIX . '_get_plugins');
 }
コード例 #13
0
function write_and_send_email($current, $data, $template)
{
    global $globalsuccess, $sentemails, $nomail, $start_time;
    $data .= '====================';
    $sentemails++;
    mlog("SEND {$sentemails} : Sending email to {$current['email']} ... ");
    $d = array('to' => $current['email'], 'template' => $template);
    $m = array('DATA' => $data, 'MANAGE' => 'http://www.theyworkforyou.com/D/' . $current['token']);
    if (!$nomail) {
        $success = send_template_email($d, $m, true, true);
        # true = "Precedence: bulk", want bounces
        mlog("sent ... ");
        # sleep if time between sending mails is less than a certain number of seconds on average
        if ((time() - $start_time) / $sentemails < 0.5) {
            # number of seconds per mail not to be quicker than
            mlog("pausing ... ");
            sleep(1);
        }
    } else {
        mlog($data);
        $success = 1;
    }
    mlog("done\n");
    if (!$success) {
        $globalsuccess = 0;
    }
}
コード例 #14
0
ファイル: Weibo.php プロジェクト: undownding/cnBeta1
 public function login()
 {
     $weibo_account = file(ACCOUNT_FILE);
     $username = $weibo_account[0];
     $password = $weibo_account[1];
     $url = 'http://login.sina.com.cn/sso/prelogin.php?entry=weibo&callback=sinaSSOController.preloginCallBack&su=&rsakt=mod&client=ssologin.js(v1.4.5)&_=' . sys_microtime();
     $temp = web_get($url, null, null);
     $data = jsonp_decode_object($temp);
     $servertime = $data['servertime'];
     $nonce = $data['nonce'];
     $pubkey = $data['pubkey'];
     $rsakv = $data['rsakv'];
     $message = $servertime . "\t" . $nonce . "\n" . $password;
     $ciphertext = rsa_encrypt($message, "010001", $pubkey);
     $ciphertext_web_safe = bin2hex($ciphertext);
     $data = array('entry' => 'weibo', 'gateway' => '1', 'from' => '', 'savestate' => '7', 'userticket' => '1', 'ssosimplelogin' => '1', 'vsnf' => '1', 'vsnval' => '', 'su' => base64_encode($username), 'service' => 'miniblog', 'servertime' => $servertime, 'nonce' => $nonce, 'pwencode' => 'rsa2', 'sp' => $ciphertext_web_safe, 'encoding' => 'UTF-8', 'url' => 'http://weibo.com/ajaxlogin.php?framelogin=1&callback=parent.sinaSSOController.feedBackUrlCallBack', 'returntype' => 'META', 'rsakv' => $rsakv);
     $temp = web_post('http://login.sina.com.cn/sso/login.php?client=ssologin.js(v1.4.5)', $data, null, null);
     preg_match('/replace\\(\'(.*?)\'\\)/', $temp, $matchs);
     if (empty($matchs)) {
         throw new Exception('weibo login failed with return content: ' . $temp);
     }
     $url = $matchs[1];
     $temp = web_get($url, null, null);
     mlog(json_encode($temp));
     /*
     preg_match('/"uniqueid":"(\d+)"/', $temp, $matchs);
     $userid =  $matchs[1];
     */
 }
コード例 #15
0
ファイル: licensing.php プロジェクト: adncha/musikTherapy
 function send_request($type, $end_point, $data = null, $second_attempt = null)
 {
     mlog("FUNCTION: send_request [{$type}] -> {$end_point}");
     $url = SK_API . $end_point;
     $sk_token = get_transient('sk_token');
     if (!$sk_token && $end_point !== '/login') {
         $this->login();
         $sk_token = get_transient('sk_token');
     }
     $headers = array('Content-Type' => 'application/json');
     if ($sk_token && $end_point !== '/login') {
         $headers['Authorization'] = $sk_token;
     }
     $args = array('timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => $headers);
     if (isset($type) && $type == 'post') {
         $args['method'] = 'POST';
         $args['body'] = json_encode($data);
     } else {
         if (isset($type) && $type == 'get') {
             $args['method'] = 'GET';
             $args['body'] = $data;
         } else {
             if (isset($type) && $type == 'delete') {
                 $args['method'] = 'DELETE';
                 $url .= '?' . http_build_query($data);
             }
         }
     }
     $result = wp_remote_post($url, $args);
     if ($end_point == '/login' && $result['response']['message'] == 'Unauthorized') {
         // If tried to login and is unauthorized return;
         update_option('sk_auto_activation_error', $result->message);
         delete_transient('sk_token');
         return array('error' => $result->message);
     }
     if ($result['response']['message'] == 'Unauthorized' && !$second_attempt) {
         // var_dump('Getting rid of token and trying again');
         delete_transient('sk_token');
         $this->login();
         return $this->send_request($type, $end_point, $data, true);
     }
     return json_decode($result['body']);
 }
コード例 #16
0
ファイル: bee_index.php プロジェクト: alex-k/velotur
chdir(dirname(__DIR__));
if (getenv('PHPBEE_DEBUG') !== FALSE && !defined('DEBUG')) {
    define('DEBUG', getenv('PHPBEE_DEBUG'));
}
if (!defined('PHPBEE_VAR_DIR')) {
    if (getenv('PHPBEE_VAR_DIR') !== FALSE) {
        define('PHPBEE_VAR_DIR', getenv('PHPBEE_VAR_DIR'));
    } else {
        define('PHPBEE_VAR_DIR', '/tmp/velotur/var/');
    }
}
require_once 'vendor/phpbee/phpbee/libs/config.lib.php';
$gs_node_id = 1;
$cfg = gs_config::get_instance();
mlog('1');
$init = new gs_init('auto');
cfg_set('tpl_data_dir', array(cfg('tpl_data_dir'), realpath(cfg('root_dir') . '../html')));
$init->init(LOAD_CORE);
$init->load_modules();
include_once 'classes/base.php';
include_once 'classes/Users_class.php';
include_once 'classes/Guides_class.php';
session_start();
if (stripos($_SERVER['REQUEST_URI'], '/admin') === 0) {
    if (isset($_SESSION['guide'])) {
        $guide = $_SESSION['guide'];
        $tpl = gs_tpl::get_instance();
        $tpl->assign('Guide', get_object_vars($guide));
    } else {
        header('Location: /admin/');