function github_verify_asset($verifications_json) { $pid = get_pid($verifications_json); if (!$pid) { return false; } // $gist_content = parse_gist(get_gist_no_oauth($pid)); $gist_content = parse_gist(get_gist_with_oauth($pid)); $expected_content = get_expected_text($verifications_json); $check = $gist_content == $expected_content ? TRUE : FALSE; // Eyal, I think we should log the following msg // $msg = ($check ? 'Asset is verified': 'Asset verification failed. Expected ['.$expected_content.'] but got ['.$gist_content.']'); // echo "<br/>msg: [".$msg."]"; return $check; }
function fb_verify_asset_with_token($verifications_json, $token) { $uidx = get_uid($verifications_json); $pidx = get_pid($verifications_json); if (!$pidx || !$uidx) { return false; } $postx = get_post_with_token($uidx, $pidx, $token); $post_contentx = parse_post($postx); $expected_contentx = get_expected_text($verifications_json); $check = $post_contentx == $expected_contentx ? TRUE : FALSE; // Eyal, I think we should log the following msg if (!$check) { $msg = $check ? 'Asset is verified' : 'Asset verification failed. Expected [' . $expected_contentx . '] but got [' . $post_contentx . ']'; echo "<br/>msg: [" . $msg . "]"; } return $check; }
private function cron_type($type) { $msg = self::getmsg($this->bduss[0], $type); $db_pid = get_pid($type); set_pid($msg[0]['post_id'], $type); foreach ($msg as $k) { $content = ''; $this->rand_bduss(); $this->getkwdata($k['fname']); if ($db_pid == $k['post_id']) { break; } if (@stristr($this->setting[3], $k['replyer']['name_show']) === false && @stristr($this->setting[4], $k['fname']) === false) { if ($this->setting[5] == 1) { if ($this->kwdata['user_info']['is_sign_in'] == 0) { $this->likekw($k['fname']); set_log($this->signkw($k['fname'])); } } if ($k['is_floor'] == 1) { $pid = $this->floorpid($k['thread_id'], $k['post_id']); $content = "回复 {$k['replyer']['name_show']} :"; } else { $pid = $k['post_id']; } $content .= talk($k['content'], $this->un, $this->setting[1], $this->setting[2]) . $this->setting[6]; $res = $this->reply($k['thread_id'], $pid, $k['fname'], $content); echo "在{$k['fname']}吧贴号{$k['thread_id']}{$res}"; set_log("在{$k['fname']}吧贴号{$k['thread_id']}{$res}"); // 回帖间隔 sleep(3); } } }
<?php include '../test_helper.php'; include APP_ROOT . 'facebook/verify_post.php'; // include APP_ROOT.'facebook/get_access_token.php'; // mimicking json from eyal $verified_json = load_json('verified'); $unverified_json = load_json('unverified'); $fake_networks_json = load_json('fake_networks'); $user2_json = load_json('user2'); $user3_json = load_json('user3'); $pid = get_pid($verified_json); $uid = get_uid($verified_json); // $accesstoken = fetch_access_token(TOKEN_FILE); $post = get_post($uid, $pid); $ct = json_decode($post, TRUE)['created_time']; $er = json_decode($post, TRUE)['error']['message']; // $user_post = get_post('100010281887017','486051034905643'); // TESTS // $var_test = ()? PASS:FAIL; $verified_test = fb_verify_asset($verified_json) == 1 ? PASS : FAIL; $unverified_test = fb_verify_asset($unverified_json) != 1 ? PASS : FAIL; $fake_networks_test = fb_verify_asset($fake_networks_json) != 1 ? PASS : FAIL; $another_user_test = fb_verify_asset($user2_json) == 1 ? PASS : FAIL; $third_user_test = fb_verify_asset($user3_json) == 1 ? PASS : FAIL; $another_token_test = fb_verify_asset_with_token($verified_json, FB_APP_TOKEN_2) == 1 ? PASS : FAIL; $pid_test = $pid == 486035954907151.0 ? PASS : FAIL; $uid_test = $uid == 1232952150 ? PASS : FAIL; $expected_text = preg_match("/LJEC6Q2h9JKNvZqEC87TbEXvxm4br1uivb2QX/", get_expected_text($verified_json)) ? PASS : FAIL; // 2015-10-06T08:28:06+0000 $getpost_test = strlen($ct) == 24 ? PASS : FAIL;
function get_submenu($id) { if (isset($this->id)) { if (get_pid($_GET['id']) == $id || $_GET['id'] == $id) { $submenu = ''; $row = $this->db->fetch_array($this->db->query("SELECT count(*) FROM " . TABLE_SITEMENU . " WHERE pid='" . $id . "' && deleted = 0 && visible = 0")); if ($row['0'] > 0) { $parent_rows = $this->get_subcats($id); $submenu .= '<ul class="submenu">'; foreach ($parent_rows as $row) { $submenu .= '<li><a href="' . $this->link($row['id']) . '">' . $row['title'] . ' ' . get_pid($row['id']) . '</a></li>'; } $submenu .= '</ul>'; } return $submenu; } } }
function get_pid($cid) { $pid = $GLOBALS['db']->getOne("SELECT parent_id FROM " . $GLOBALS['ecs']->table('category') . " WHERE cat_id = " . $cid); if ($pid > 0) { $cid = get_pid($pid); } return $cid; }