$parts = explode('@', $userid); if ($userid && count($parts) !== 2) { $err = 'Invalid User ID'; } else { if ($userid) { $username = $parts[0]; $domain = 'http://' . $parts[1]; switch ($action) { // Return instance info in JSON format case 'poke': returnJSON($username, $domain); break; // Redirect to the instance's posting page // Redirect to the instance's posting page case 'share': share($username, $domain, $title, $url); break; } } } /** * $_GET wrapper * * Just to get rid of warnings when value isn't in array */ function m_get($param) { return isset($_GET[$param]) ? $_GET[$param] : null; } /** * curl wrapper
if (!varset($_COOKIE['e107_certified'])) { cookie('e107_certified', $certVal, time() + 3600 * 24 * 30); } else { $_COOKIE['e107_certified'] = $certVal; } $_POST['language'] = key($_POST['ziplang']); // If no session data, scan before zipping. if (!isset($_SESSION['lancheck'][$_POST['language']]['total']) || $_SESSION['lancheck'][$_POST['language']]['total'] != '0') { $_POST['language_sel'] = $_POST['ziplang']; $lck->check_all('norender'); unset($_POST['language_sel']); } $status = zip_up_lang($_POST['language']); if ($status['error'] == FALSE) { $text = $status['message'] . "<br />"; $text .= share($status['file']); $mes->addSuccess($text); //$ns->tablerender(LAN_CREATED, $text ); } else { $mes->addError($status['message']); //$ns->tablerender(LAN_CREATED_FAILED, $status['message']); } echo $mes->render(); } function find_locale($language) { if (!is_readable(e_LANGUAGEDIR . $language . "/" . $language . ".php")) { return FALSE; } $code = file_get_contents(e_LANGUAGEDIR . $language . "/" . $language . ".php"); $tmp = explode("\n", $code);
<?php function share(Closure $closure) { //返回闭包函数,且返回的函数执行之后返回内容不是null则最多执行一次,重复执行跟第一次执行的内容一样 return function ($container) use($closure) { //闭包返回的内容,共享 static $object; if (is_null($object)) { //已经执行过,则不再执行 $object = $closure($container); } return $object; }; } //返回一个闭包函数 $abc = share(function ($app) { echo 'hello ' . $app . PHP_EOL; return 'ok ' . $app . PHP_EOL; }); //var_dump($abc); echo $abc("world"); //调用闭包函数,输出 hello world ok world echo $abc("jelly"); // 输出 ok world
// split labels (in case there're more than one they're comma separated) $labels = explode(",", $labels); // FIRST OF ALL CHECK IF THE LABEL MATCHES if (findLabel($requestedLabel, $labels)) { // These 2 variables are used on both cases $title = trim($article->find('.title', 0)->plaintext); $shareTitle = "[Japón] " . $title; $postUrl = "http://www.nestoralvaro.com/japon/showPost.php?postId=" . $remainingPosts; $time_day = $article->find('.time-day', 0)->plaintext; $time_month = $article->find('.time-month', 0)->plaintext; $time_year = $article->find('.time-year', 0)->plaintext; $oldPosts .= "<div class='oldPost'>"; $oldPosts .= "<a href='" . $postUrl . "' target='_blank' >"; $oldPosts .= "[" . $time_year . "-" . $time_month . "-" . $time_day . "]"; $oldPosts .= "<span class='oldTitle'>" . $title . "</span>"; $oldPosts .= "</a>"; // invoke "share" function to show all places to share $oldPosts .= share($shareTitle, $postUrl); $oldPosts .= "</div>"; } $remainingPosts--; } $oldPosts .= "</div><!-- \\olderPosts -->"; ?> <?php echo $oldPosts; include "bottom.php"; ?>
/** * @param $language * @return array|string */ function zipLang($language) { $mes = e107::getMessage(); $certVal = isset($_POST['contribute_pack']) ? 1 : 0; if (!varset($_COOKIE['e107_certified'])) { cookie('e107_certified', $certVal, time() + 3600 * 24 * 30); } else { $_COOKIE['e107_certified'] = $certVal; } // $_POST['language'] = key($_POST['ziplang']); // If no session data, scan before zipping. if (!isset($_SESSION['lancheck'][$language]['total']) || $_SESSION['lancheck'][$language]['total'] != '0') { $this->check_all('norender', $language); } $status = $this->makeLanguagePack($language); if ($status['error'] == FALSE) { $text = $status['message'] . "<br />"; $text .= share($status['file']); $mes->addSuccess($text); //$ns->tablerender(LAN_CREATED, $text ); } else { $mes->addError($status['message']); //$ns->tablerender(LAN_CREATED_FAILED, $status['message']); } return array('text' => $mes->render(), 'caption' => ''); }
<?php include "simplehtmldom_1_5/simple_html_dom.php"; include "share.php"; // Create DOM from URL $html = file_get_html('all.php'); $allPosts = $html->find('.post'); $fullLength = sizeof($allPosts); $requestedPost = $_GET["postId"]; // Loop through all posts foreach ($allPosts as $article) { // Just get "$requestedPost" post if ($fullLength == $requestedPost) { $title = trim($article->find('.title', 0)->plaintext); $shareTitle = "[Japón] " . $title; $postUrl = "showPost.php?postId=" . $requestedPost; // Show social $sharePart = $article->find('.share', 0)->innertext = share($shareTitle, $postUrl); echo $article; } $fullLength--; }
?> </b> <?php display_date(); ?> </p> </div> <div class="right-part social-media"> <?php $summary = ''; if (has_excerpt()) { $summary = get_the_excerpt(); } else { $summary = wp_trim_words(get_the_content(), 50); } share(get_the_permalink(), get_the_title(), $summary); ?> </div> </div> <?php if (has_post_thumbnail()) { $attachment_id = get_post_thumbnail_id(); $attachment_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true); if (empty($attachment_alt)) { $attachment_alt = get_post($attachment_id)->post_title; } $size = 'thumb'; $attachment_array = wp_get_attachment_image_src($attachment_id, $size); $attachment_src = $attachment_array[0]; ?> <div class="img-container">
<?php /** * share functions * * @author Roffun * @copyright Copyright (C) Roffun | https://github.com/Roffun/share * @license BSD */ defined('COT_CODE') or die('Wrong URL'); require_once cot_langfile('share', 'plug'); function share() { global $cfg; if ($cfg['jquery']) { $t = new XTemplate(cot_tplfile('share', 'plug')); if ($cfg['plugin']['share']['sh_counter']) { $t->assign(array('SHARE_GP_COUNTER' => '<q data-counter="gp"></q>', 'SHARE_VK_COUNTER' => '<q data-counter="vk"></q>', 'SHARE_FB_COUNTER' => '<q data-counter="fb"></q>', 'SHARE_MR_COUNTER' => '<q data-counter="mr"></q>', 'SHARE_LI_COUNTER' => '<q data-counter="li"></q>', 'SHARE_OK_COUNTER' => '<q data-counter="ok"></q>', 'SHARE_TM_COUNTER' => '<q data-counter="tm"></q>', 'SHARE_PT_COUNTER' => '<q data-counter="pt"></q>', 'SHARE_RD_COUNTER' => '<q data-counter="rd"></q>', 'SHARE_SU_COUNTER' => '<q data-counter="su"></q>', 'SHARE_PO_COUNTER' => '<q data-counter="po"></q>', 'SHARE_BF_COUNTER' => '<q data-counter="bf"></q>', 'SHARE_XI_COUNTER' => '<q data-counter="xi"></q>')); } $t->assign(array('SHARE_MESSAGERS' => $cfg['plugin']['share']['sh_messagers'], 'SHARE_SIZE' => 'sh-' . $cfg['plugin']['share']['sh_size'])); $t->parse('MAIN'); return $t->text('MAIN'); } } $share = share();
alert_error('未选择用户', false); } if (!loginFromDatabase($_SESSION['uid'])) { alert_error('cookie失效,或者百度封了IP!', false); } if (isset($_POST['submit']) && $_POST['submit'] == '创建' && isset($_POST['type'])) { if ($_POST['type'] == 0 && strlen($_POST['code']) != 4) { echo '<h1>错误:提取码位数不对。请输入4个半角字符,或者1个全角字符和1个半角字符的组合。</h1>'; } else { if ($_POST['type'] < 0 || $_POST['type'] > 2) { echo '<h1>错误:无效参数</h1>'; } else { if ($_POST['type'] == 0) { $result = share($_POST['fid'], $_POST['code'], true); } elseif ($_POST['type'] == 1) { $result = share($_POST['fid'], '无', true); } elseif ($_POST['type'] == 2) { alert_error('暂不支持此种分享的创建!', false); } if (!$result) { alert_error('分享创建失败!', false); } die; } } } else { if (!isset($_SERVER['QUERY_STRING']) || !isset($_SESSION['file_can_add'][$_SERVER['QUERY_STRING']])) { alert_error('请勿直接访问本页。', '../browse.php'); } } echo "<h2>创建分享</h2>";
share($qt); $query = "SELECT insys,COUNT(insys) as count FROM musage WHERE seen >= NOW() - INTERVAL " . $interval . " AND client = 1 AND insys NOT LIKE 'HASH(0x%' " . $where . " GROUP BY insys ORDER BY count DESC"; $insys = $db->fetch_table($query); share($insys); $query = "SELECT outsys,COUNT(outsys) as count FROM musage WHERE seen >= NOW() - INTERVAL " . $interval . " AND client = 1 AND outsys NOT LIKE 'HASH(0x%' " . $where . " GROUP BY outsys ORDER BY count DESC"; $outsys = $db->fetch_table($query); share($outsys); $query = "SELECT is64,COUNT(is64) as count FROM musage WHERE seen >= NOW() - INTERVAL " . $interval . " AND client = 1 " . $where . " GROUP BY is64 ORDER BY count DESC"; $is64 = $db->fetch_table($query); share($is64); $query = "SELECT country,COUNT(country) as count FROM musage WHERE seen >= NOW() - INTERVAL " . $interval . " AND client = 1 " . $where . " GROUP BY country HAVING count > 4 ORDER BY count DESC"; $geo = $db->fetch_table($query); share($geo); $query = "SELECT lcd,COUNT(lcd) as count FROM musage WHERE seen >= NOW() - INTERVAL " . $interval . " AND client = 1 " . $where . " GROUP BY lcd ORDER BY count DESC"; $lcd = $db->fetch_table($query); share($lcd); #echo var_dump($err); ?> <html> <head> <link rel="stylesheet" type="text/css" media="screen" href="style.css" /> <title>Usage statistics for Mumble - Raw data</title> </head> <body> <div style="height:1.6em; border-bottom:0.1em solid black;"> <a class="menu menu_shown"> Raw data
echo '<p>当前设置的MD5列表:<br />'; foreach ($current_md5 as $v) { echo $v . '<br />'; } echo '默认将使用第一个,将在文件被温馨提示时自动切换到下一个。</p>'; die; } } else { if (!$md5['info'][0]['isdir'] && isset($_POST['no_share']) && $_POST['no_share'] > 0) { if ($enable_direct_link && $_POST['no_share'] == '2') { $_POST['link'] = '/s/notallow'; } else { $_POST['link'] = '/s/fakelink'; } } elseif ($_POST['link'] == '') { $_POST['link'] = substr(share($_POST['fid'], $_POST['code'], true), 20); if (!$_POST['link']) { alert_error('分享创建失败!', 'browse.php'); } } elseif (substr($_POST['link'], 0, 20) == 'http://pan.baidu.com') { $_POST['link'] = substr($_POST['link'], 20); } elseif (substr($_POST['link'], 0, 13) == 'pan.baidu.com') { $_POST['link'] = substr($_POST['link'], 13); } else { $_POST['link'] = false; echo '<h1>错误:地址输入有误。</h1>'; } if ($_POST['link']) { $mysql->prepare('insert into watchlist values(null,?,?,?,0,?,?,0)')->execute(array($_POST['fid'], $_POST['filename'], $_POST['link'], $_POST['code'], $uid)); $id = $mysql->lastInsertId(); wlog('在文件浏览页添加记录:用户名:' . $username . ',文件完整路径:' . $_POST['filename'] . ',文件fs_id:' . $_POST['fid'] . ',文件访问地址为:' . $jumper . $id);
//分片太多啦 } if ($need_rename) { $toSend = '/api/filemanager?channel=chunlei&clienttype=0&web=1&opera=rename&bdstoken=' . $token . '&channel=chunlei&clienttype=0&web=1&app_id=250528'; $toPost = 'filelist=%5B%7B%22path%22%3A%22' . urlencode($path) . '%22%2C%22newname%22%3A%22' . urlencode($newname) . '%22%7D%5D'; $req = request("http://pan.baidu.com{$toSend}", $ua, $res['cookie'], $toPost); $json = json_decode(trim($req['body'])); if (isset($json->errno) && $json->errno !== 0) { echo '<h1>补档娘更名失败错误代码:' . $json->errno . '</h1>'; wlog('记录ID ' . $_SERVER['QUERY_STRING'] . '重命名失败', 2); $mysql->exec('update watchlist set failed=1 where id=' . $_SERVER['QUERY_STRING']); die; } $mysql->prepare('update watchlist set name=? where id=?')->execute(array($newfullpath, $res['id'])); } $result = share($res['fid'], $res['pass']); if (!$result) { echo '<h1>补档娘分享失败</h1>'; wlog('记录ID ' . $_SERVER['QUERY_STRING'] . '补档失败:分享失败', 2); $mysql->exec('update watchlist set failed=1 where id=' . $_SERVER['QUERY_STRING']); die; } echo '<script>alert("您访问的文件已经失效,但是我们进行了自动补档,提取码不变。\\n本文件已自动补档' . ($res['count'] + 1) . '次,本次补档方式:' . ($need_rename ? '重命名' : (isset($change_md5) ? '救活温馨提示' : '更换MD5')) . '补档");window.location="' . $result . ($res['pass'] !== '0' ? '#' . $res['pass'] : '') . '";</script>'; echo '若没有自动跳转, <a href="' . $check['url'] . ($res['pass'] !== '0' ? '#' . $res['pass'] : '') . '">点我手动跳转</a>。'; $result = substr($result, 20); $mysql->prepare('update watchlist set count=count+1,link=? where id=?')->execute(array($result, $res['id'])); wlog('记录ID ' . $_SERVER['QUERY_STRING'] . '补档成功'); $mysql->exec('update watchlist set failed=0 where id=' . $_SERVER['QUERY_STRING']); } } } else {
// Load the social helper to help create the links below $CI->load->helper('social'); // only write the javascript one time so we create a static variable echo social_popup_js(); ?> <!-- Share Area --> <div class="post_share"> <a href="<?php echo share('twitter', $post); ?> " class="social_twitter popup" target="_blank">Twitter</a> <a href="<?php echo share('facebook', $post); ?> " class="social_twitter popup" target="_blank">Facebook</a> <a href="<?php echo share('googleplus', $post); ?> " class="social_twitter popup" target="_blank">Googleplus</a> <a href="<?php echo share('linkedin', $post); ?> " class="social_twitter popup" target="_blank">LinkedIn</a> <a href="<?php echo share('email', $post); ?> " class="social_twitter">Email</a> </div>