Example #1
0
File: s.php Project: t0n9/PHPscan
function getHtmlContext($url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, TRUE);
    //表示需要response header
    curl_setopt($ch, CURLOPT_NOBODY, FALSE);
    //表示需要response body
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_TIMEOUT, 120);
    $result = curl_exec($ch);
    global $header;
    if ($result) {
        $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
        $header = explode("\r\n", substr($result, 0, $headerSize));
        $body = substr($result, $headerSize);
    }
    if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == '200') {
        return $body;
    }
    if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == '302') {
        $location = getHeader("Location");
        if (strpos(getHeader("Location"), 'http://') == false) {
            $location = getHost($url) . $location;
        }
        return getHtmlContext($location);
    }
    return NULL;
}
 /**
  * 授权
  */
 public function getOpenID()
 {
     $weObj = new \System\lib\Wechat\Wechat($this->config("WEIXIN_CONFIG"));
     $this->weObj = $weObj;
     if (empty($_GET['code']) && empty($_GET['state'])) {
         $callback = getHostUrl();
         $reurl = $weObj->getOauthRedirect($callback, "1");
         redirect($reurl, 0, '正在发送验证中...');
         exit;
     } elseif (intval($_GET['state']) == 1) {
         $accessToken = $weObj->getOauthAccessToken();
         // 是否有用户记录
         $isUser = $this->table('user')->where(["openid" => $accessToken['openid'], 'is_on' => 1])->get(null, true);
         /*var_dump($isUser);exit();*/
         if ($isUser == null) {
             //没有此用户跳转至输入注册的页面
             header("LOCATION:" . getHost() . "/register.html");
         } else {
             $userID = $isUser['id'];
             $updateUser = $this->table('user')->where(['id' => $userID])->update(['last_login' => time(), 'last_ip' => ip2long(getClientIp())]);
             $_SESSION['userInfo'] = ['openid' => $isUser['openid'], 'userid' => $isUser['id'], 'nickname' => $isUser['nickname'], 'user_img' => $isUser['user_img']];
             //var_dump($_SESSION['userInfo']['openid']);exit();
             header("LOCATION:http://onebuy.ping-qu.com");
             //进入网站成功
             //用户取消授权
             //
             //$this->R('','90006');
         }
     }
 }
 function setUp()
 {
     /*
      * This test requires that the fossology test archive has been
      * loaded under the name fossarchive-T.tar.bz2 For now, the setup
      * will just verify the material is there?
      */
     global $URL;
     global $name;
     global $safeName;
     $name = 'fossI16L518.tar.bz2';
     $safeName = escapeDots($name);
     $this->host = getHost($URL);
     $this->Login();
     /* check for existense of archive */
     $page = $this->mybrowser->get($URL);
     $page = $this->mybrowser->clickLink('Browse');
     $this->assertTrue($this->myassertText($page, '/Browse/'), "verifyFossI16L518 FAILED! Could not find Browse menu\n");
     $page = $this->mybrowser->clickLink('Testing');
     $this->assertTrue($this->myassertText($page, '/Testing/'), "verifyFossI16L518 FAILED! Could not find Testing folder\n");
     $result = $this->myassertText($page, "/{$safeName}/");
     if (!$result) {
         exit(FALSE);
     }
 }
Example #4
0
 function getUrlfromDir($local_dir)
 {
     //-------------------------------
     $server_dir = getWebDir($local_dir);
     $server_scheme = getScheme();
     $server_host = getHost();
     return "{$server_scheme}://{$server_host}/{$server_dir}";
 }
Example #5
0
 public function agregateLogs($error, $data = null)
 {
     App::getServiceLog()->log($error, $data);
     $subject = 'Message subject ąśżźćę';
     $body = App::template('stopsupervisor', array('error' => $error, 'data' => $data, 'host' => getHost()));
     $message = Swift_Message::newInstance()->setSubject('webservice [' . getHost() . '] - error')->setFrom('*****@*****.**', 'webservice')->setTo(App::getConfig('swiftmailer.cron_log_errors'))->setBody($body, 'text/html')->addPart(strip_tags($body), 'text/plain');
     App::getServiceMailer()->send($message);
 }
Example #6
0
function get_source_domain($dname)
{
    $dname = getHost($dname);
    $dsub = substr($dname, 0, 4);
    if (strtolower($dsub) == "www.") {
        $dname = substr($dname, 4);
    }
    return $dname;
}
 function __construct($page, $url)
 {
     /* to do: check for http?  if not return null...)? */
     if (empty($page)) {
         return;
     }
     $this->page = $page;
     if (empty($url)) {
         return;
     }
     $this->host = getHost($url);
 }
Example #8
0
 public function raport()
 {
     $key = 'crontime';
     $limit = 8;
     $cache = App::getCache();
     $worker = App::getServiceWorker();
     $ltime = $cache->get($key);
     // poprzednie badanie
     //        niechginie($ltime);
     $ntime = date('Y-m-d H:i:s');
     // teraz
     $ltime or $ltime = $ntime;
     $cache->set($key, $ntime);
     //        nieginie($ltime);
     //        nieginie($worker->countErrorFromSince($ltime));
     //        niechginie($worker->getLastErrors($ltime));
     if ($num = $worker->countErrorFromSince($ltime)) {
         $body = App::template('cronraport', array('list' => $worker->getLastErrors($ltime, $limit), 'limit' => $limit, 'ltime' => $ltime, 'num' => $num, 'host' => getHost(), 'panel' => App::generate('admin', array(), $referenceType = true)));
         $message = Swift_Message::newInstance()->setSubject('webservice [' . getHost() . '] - error')->setFrom('*****@*****.**', 'webservice')->setTo($this->emails)->setBody($body, 'text/html')->addPart(strip_tags($body), 'text/plain');
         App::getServiceMailer()->send($message);
     }
 }
Example #9
0
 function setUp()
 {
     /*
      * This test requires that the fossology test archive has been
      * loaded under the name 3files.tar.bz2
      */
     global $URL;
     global $name;
     global $safeName;
     $name = 'RedHat.tar.gz';
     $safeName = escapeDots($name);
     $this->host = getHost($URL);
     //print "SetUp: host is:$this->host\n";
     $this->Login();
     /* check for existense of archive */
     $page = $this->mybrowser->get($URL);
     $page = $this->mybrowser->clickLink('Browse');
     $this->assertTrue($this->myassertText($page, '/Browse/'), "verifySimpletest FAILED! Could not find Browse menu\n");
     $page = $this->mybrowser->clickLink('Testing');
     $this->assertTrue($this->myassertText($page, "/{$safeName}/"), "verifySimpleTest FAILED! Could not find RedHat.tar upload\n");
     $result = $this->myassertText($page, "/{$name}/");
     //if(!($result)) { echo "WTF!\n"; exit(FALSE); }
 }
 function setUp()
 {
     /*
      * This test requires that the fossology test archive has been
      * loaded under the name 3files.tar.bz2
      */
     global $URL;
     global $name;
     global $safeName;
     $name = '3files.tar.bz2';
     $safeName = escapeDots($name);
     $this->host = getHost($URL);
     $this->Login();
     /* check for existense of archive */
     $page = $this->mybrowser->get($URL);
     $page = $this->mybrowser->clickLink('Browse');
     $this->assertTrue($this->myassertText($page, '/Browse/'), "verify3files FAILED! Could not find Browse menu\n");
     $page = $this->mybrowser->clickLink('Copyright');
     $this->assertTrue($this->myassertText($page, '/Copyright/'), "verify3files FAILED! Could not find copyright folder\n");
     $result = $this->myassertText($page, "/{$name}/");
     if (!$result) {
         exit(FALSE);
     }
 }
 function setUp()
 {
     /*
      * This test requires that the fossology test archive has been
      * loaded under the name fossDirsOnly.tar.bz2
      */
     global $URL;
     global $name;
     global $safeName;
     print "starting verifyFossDirsOnly-SetUp\n";
     $name = 'fossDirsOnly.tar.bz2';
     $safeName = escapeDots($name);
     $this->host = getHost($URL);
     $this->Login();
     /* check for existense of archive */
     $page = $this->mybrowser->get($URL);
     $page = $this->mybrowser->clickLink('Browse');
     $this->assertTrue($this->myassertText($page, '/Browse/'), "verifyDirsOnly FAILED! Could not find Browse menu\n");
     $result = $this->myassertText($page, "/{$safeName}/");
     if (!$result) {
         $this->fail("Failure, cannot find archive {$name}, Stopping test\n");
         exit(1);
     }
 }
Example #12
0
<?php

require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
$queryList = getSQLQuery(getPDO());
$menuList = getMenuListForProcOrder(getPDO(), $queryList["SELECT_MENU_FOR_PROCORDER"]);
$menuData = getProced(getPDO(), $menuList);
$threadList = getThreadListUrl($menuData["menu_url"], getDiFix(getPDO(), "threadListUrlSuffix", $menuData["kind"], $queryList["SELECT_DIFIX"]));
var_dump($menuData);
var_dump(getUa(getPDO(), $queryList["SELECT_UA"]));
var_dump(getHost($menuData["menu_url"]));
$html = threadSteal(getPDO(), "133.130.96.221", "threadSteal", $threadList, $queryList["INSERT_IP_ACCESS"], getUa(getPDO(), $queryList["SELECT_UA"]), getHost($menuData["menu_url"]));
var_dump($html);
Example #13
0
/**
 * Get the url of corresponding page. for gene network diagram.
 * @param type $pageName
 * @param type $idArr
 * @return string
 */
function getPageUrl($pageName, $idArr = array(1, 2, 3, 4))
{
    $host = getHost();
    $param = idArr2Str($idArr);
    switch ($pageName) {
        case "entirePathway":
            $preUrl = "/mccap-server/app/page/mapEntirePathway.php?id=";
            break;
        case "metaPathway":
            $preUrl = "/mccap-server/app/page/mapMetaPathway.php?id=";
            break;
        case "entireModule":
            $preUrl = "/mccap-server/app/page/mapEntireModule.php?id=";
            break;
        case "metaModule":
            $preUrl = "/mccap-server/app/page/mapMetaModule.php?id=";
            break;
        default:
            $preUrl = "/mccap-server/app/page/error.php";
            $param = "";
            break;
    }
    $url = $host . $preUrl . $param;
    return $url;
}
 /**
  * 获取关注回复
  */
 private function _getFollowReply()
 {
     if (!empty($this->userInfo)) {
         //活动回复
         if (!empty($user['parent'] && !empty($user['parent_share_type']) && !empty($user['activity_id']))) {
             //是否在进行活动
             $isActivity = $this->table('activity_share_' . $user['parent_share_type'])->where(['is_on' => 1, 'is_show' => 1])->get(['id', 'start_time', 'end_time'], true);
             if ($isActivity) {
                 if (time() > $isActivity['start_time'] && time() < $isActivity['end_time']) {
                     switch ($user['parent_share_type']) {
                         case 1:
                             $content = '欢迎关注广融在线!你已获得参与广融活动“邀好友送特权利率”活动的资格。马上<a href="' . getHost() . '/activity/activity_1_1.html?activity_id=' . $user['activity_id'] . '">点击这里</a>进行领取!';
                             break;
                         case 2:
                             //$content='欢迎关注广融在线!你可参加“投资送现金活动”。马上<a href="'.getHost().'/activity/activity_2_1.html?activity_id='.$user['activity_id'].'">点击这里</a>了解活动详情!';
                             $content = '对!骚年你没关注错 !' . "\r\n";
                             $content .= '这是稳拿8%~13%收益的赚钱平台!' . "\r\n";
                             $content .= '投资随投随取,快捷方便!' . "\r\n";
                             $content .= '收益完胜各大银行和各类宝宝!' . "\r\n";
                             $content .= '快来参与日赚百元计划“领100元红包”吧!' . "\r\n";
                             $content .= '红包有限!先到先得哦~' . "\r\n";
                             $content .= '<a href="' . getHost() . '/activity/activity_2_1.html?activity_id=' . $user['activity_id'] . '">点击领100元红包</a>';
                             break;
                     }
                 }
             }
         }
     }
     $followReply = $this->table("wechat_response")->where(array("type" => 2, 'is_on' => 1))->get(null, true);
     if (!$followReply) {
         return false;
     }
     if ($followReply['rsp_type'] == 0) {
         //文本回复
         $this->weObj->text($followReply['text'])->reply();
         exit;
     }
     if ($followReply['rsp_type'] == 1) {
         //图文回复(未实现)
         // $news_temp = $this->table("wechat_news")->where(array("id" => $followReply['news'], 'is_on' => 1))->order('sort_order asc')->get(null, true);
         $news_temp = $this->table("wechat_news")->where(array("id" => $followReply['news'], 'is_on' => 1))->get();
         //get()内不能
         // $this->weObj->text("text")->reply();exit;
         foreach ($news_temp as $a) {
             $news[] = array('Title' => $a['title'], 'Description' => $a['desc'], 'PicUrl' => $a['img_thumb_360'], 'Url' => empty($a['url']) ? empty($a['url']) ? $this->config('WEIXIN_ARTICLE_PATH') . $a['id'] : $a['url'] : $a['url']);
         }
         $this->weObj->news($news)->reply();
         exit;
     }
 }
Example #15
0
 public function getHostname()
 {
     return getHost();
 }
Example #16
0
     $encodiedThreadBaseHtml = threadSteal(getPDO(), $ip, "threadSteal", $threadList, $queryList["INSERT_IP_ACCESS"], getUa(getPDO(), $queryList["SELECT_UA"]), getHost($menuData["menu_url"]));
     $threadData = threadReArray(threadDataPregMatch($encodiedThreadBaseHtml, getDiRegex(getPDO(), "threadStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"])), $threadUrl, $censorList);
     threadInsert(getPDO(), $threadData, $menuData["id"], $menuData["kind"], $queryList["INSERT_THREAD"]);
     unset($threadData);
 }
 if ($isResSteal) {
     $threadData = getThreadData(getPDO(), $menuData["id"], $queryList["SELECT_THREAD"]);
     $i = 0;
     foreach ($threadData as $value) {
         if ($value["thread_now_res_no"] - $value["res_end"] < (int) $fixedList["updateWaiting"]) {
             continue;
         } else {
             timeWeit((int) $fixedList["weitTimeMin"], (int) $fixedList["weitTimeMax"]);
         }
         $ip = useIp(getPDO(), getUseIpMod(getPDO()));
         $encodiedResBaseHtml = resSteal(getPDO(), $ip, "resSteal", $value["thread_url"], $queryList["INSERT_IP_ACCESS"], getUa(getPDO(), $queryList["SELECT_UA"]), getHost($menuData["menu_url"]));
         if (!$encodiedResBaseHtml) {
             continue;
         }
         $isoldLog = threadIsOldLog($encodiedResBaseHtml, getDiRegex(getPDO(), "threadOldlogedRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]));
         if ($isoldLog) {
             threadUpdateTois_oldlog($value["thread_sha"], $prepareStForTUIO, $dbHandle);
         }
         $resData = getResArray(getDiRegex(getPDO(), "resStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]), $encodiedResBaseHtml, $value["thread_sha"]);
         if (!$resData) {
             continue;
         }
         $ankaerLinkProced = resBodyAnkaerLinkProc($resData, getDiRegex(getPDO(), "resBodyAnkaerLinkStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]));
         if ($menuData["kind"] === "open2ch.net") {
             $imgLinkProced = resBodyImgLinkProcO(getPDO(), $ankaerLinkProced, $value["thread_sha"], getDiRegex(getPDO(), "resBodyImgLinkStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]), $queryList["UPDATE_THREAD_IS_IMG"], $fixedList["imgDirUrl"], $menuData["kind"]);
         } else {
Example #17
0
 /**
  * 注销
  */
 public function logout()
 {
     session_destroy();
     header("LOCATION:" . getHost() . "/admin/login.html");
     //跳转到login登录
 }
Example #18
0
<?php

session_start();
/**
 *	Class for authenticating the site
 *	
 *	by Petri Laihonen 26.01.2014
 *	
 */
$provideResponse = false;
$respArry = array();
$salt = "æøæ|asdrSDRAG12556AWQ899REG1WqerG#¤%#%&¤#YWRGHåäG?Rq+oew£#»qwer";
$server = getHost();
debugLog("Server: " . $server);
// sanitize some
$_POST = sanitize($_POST);
// Database credentials
require_once "dbCredentials.php";
debugLog("Required includes are now with us");
if (!($dbConn = mysqli_connect($conn, $dbUser, $dbPass, $database))) {
    $response = array('status' => 'fail', 'message' => 'database connect error.');
    debugLog('Database Connection Failed. Error:' . mysqli_error());
    echo json_encode($response);
    exit;
}
if (!$_SESSION['userId']) {
    if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
        header('HTTP/1.0 401 Unauthorized');
        header('WWW-Authenticate: Basic realm="Management Access"');
        $displayLogin = 1;
        // header("Location: ".$server."/login.php");
Example #19
0
<?php

header("Location: " . getHost());
function getHost()
{
    $proto = empty($_SERVER['HTTPS']) ? "http://" : "https://";
    return $proto . $_SERVER['SERVER_NAME'];
}
Example #20
0
    if (isset($userInputNeeded['module'])) {
        $module = getModule();
    }
    if (isset($userInputNeeded['basePath'])) {
        $basePath = getBasePath($basePath);
    }
    if (isset($userInputNeeded['multisiteMode'])) {
        $multisiteMode = getMultisiteMode();
    }
    // Load supplemental multisite parameters:
    if ($multisiteMode == MULTISITE_HOST_BASED) {
        if ($opts->getOption('hostname')) {
            $host = $opts->getOption('hostname');
        } else {
            if ($interactive) {
                $host = getHost();
            }
        }
    }
}
// Make sure the override directory is initialized (using defaults or CLI
// parameters will not have initialized it yet; attempt to reinitialize it
// here is harmless if it was already initialized in interactive mode):
initializeOverrideDir($overrideDir, true);
// Normalize the module setting to remove whitespace:
$module = preg_replace('/\\s/', '', $module);
// Build the Windows start file in case we need it:
buildWindowsConfig($baseDir, $overrideDir, $module);
// Build the import configuration:
buildImportConfig($baseDir, $overrideDir, 'import.properties');
buildImportConfig($baseDir, $overrideDir, 'import_auth.properties');
Example #21
0
/**
 * Helper function for smarty_link()
 *
 * @see smarty_link()
 */
function _smarty_link_entry($params, &$smarty)
{
    global $PIVOTX;
    $vars = $smarty->get_template_vars();
    if (!empty($params['entry'])) {
        $params['uid'] = $params['entry'];
    } else {
        $params['uid'] = getDefault($params['uid'], $vars['entry']['uid']);
    }
    // Abort immediately if uid isn't set or there is no entry.
    if (empty($params['uid'])) {
        debug("Can't create entry link since uid isn't set.");
        return '';
    } elseif (!$PIVOTX['db']->entry_exists($params['uid'])) {
        debug("Can't create entry link since there is no entry with uid {$params['uid']}.");
        return '';
    }
    $text = getDefault($params['text'], "%title%");
    $title = getDefault($params['title'], "%title%");
    $link = makeFileLink($params['uid'], $params['weblog'], "");
    // Perhaps add the protocol and hostname, to create a full URL.
    if (!empty($params['fullurl'])) {
        $link = getHost() . $link;
    }
    if ($params['query'] != '') {
        if (strpos($link, "?") > 0) {
            $link .= '&amp;' . $params['query'];
        } else {
            $link .= '?' . $params['query'];
        }
    }
    if (!empty($params['hrefonly'])) {
        $output = $link;
    } else {
        if (isset($vars['entry']) && $vars['entry']['code'] == $params['uid']) {
            $entry = $vars['entry'];
        } else {
            $temp_db = new db(false);
            $entry = $temp_db->read_entry($params['uid']);
        }
        $text = str_replace('%title%', $entry['title'], $text);
        $text = str_replace('%subtitle%', $entry['subtitle'], $text);
        $text = formatDate($entry['date'], $text);
        $title = trim($title);
        if (!empty($title)) {
            $title = str_replace('%title%', $entry['title'], $title);
            $title = str_replace('%subtitle%', $entry['subtitle'], $title);
            $title = formatDate($entry['date'], $title);
        }
        $output = sprintf("<a href=\"%s\" title=\"%s\">%s</a>", $link, cleanAttributes($title), $text);
    }
    return $output;
}
Example #22
0
                    <p><?php 
    echo getComite($comite_proyecto[0]);
    ?>
</p>
                    <div class="row card-content-benefits">
                        <div class="col s6">
                            <h6 class="benefit-title">MEALS</h6>
                            <h5><strong><?php 
    echo getMeals($comite_proyecto[0]);
    ?>
</strong></h5>
                        </div>
                        <div class="col s6">
                            <h6 class="benefit-title">HOST</h6>
                            <h5><strong><?php 
    echo getHost($comite_proyecto[0]);
    ?>
</strong></h5>
                        </div>
                        <div class="col s6">
                            <h6 class="benefit-title">IPS</h6>
                            <h5><strong><?php 
    echo getIPS($comite_proyecto[0]);
    ?>
</strong></h5>
                        </div>
                        <div class="col s6">
                            <h6 class="benefit-title">LEAD</h6>
                            <h5><strong><?php 
    echo getLead($comite_proyecto[0]);
    ?>
Example #23
0
function formatItem($item, $number)
{
    global $conf;
    global $lang;
    global $smarty;
    static $date = 0;
    date_default_timezone_set("America/New_York");
    /*	if($item['date'] != $date) {
    		$date = $item['date'];
    		$timestamp = strtotime($date);
    		$pdate = strftime($lang['DATEFORMAT'],$timestamp);
    		print '<h1>'.$pdate.'</h1>';
    	}*/
    if (date('j', $item['timestamp']) != date('j', $date)) {
        $date = $item['timestamp'];
        $pdate = date("l F j, Y", $date);
        print '<h1>' . $pdate . '</h1>';
    }
    /*	$smarty->assign('conf', $conf);
    	$smarty->assign('lang', $lang);
    	$smarty->assign('iitem', md5($item['url']));
    	$smarty->assign('number', $number);
    	$smarty->assign('item', $item);
    	$smarty->assign('channelFavicon', channelFavicon($item['feedurl']));
    	$sources = array();
    	$sources['digg'] = ($conf['digg'] == 'true' && !stristr(getHost($item['url']),'digg'));
    	$sources['del.icio.us'] = ($conf['del.icio.us'] == 'true');
    	$sources['reddit'] = ($conf['reddit'] == 'true' && !stristr(getHost($item['feedurl']),'reddit'));
    	$sources['furl'] = ($conf['furl'] == 'true');
    	$sources['newsvine'] = ($conf['newsvine'] == 'true');
    	$smarty->assign('sources', $sources);
    
    	$smarty->display('item.tpl');*/
    print '<div class="feed">';
    //	print '<div class="item" id="IITEM-'.$item['id'].'">';
    //	print '<div class="item" id="IITEM-'.md5($item['url']).'">';
    if ($item['viewed']) {
        print '<div class="item read" id="' . $item['id'] . '">';
    } else {
        print '<div class="item" id="' . $item['id'] . '">';
    }
    print '<img src="' . channelFavicon($item['feedurl']) . '" width="16" height="16" class="icon" alt="" />';
    //	print '<span class="time">'.$item['time'].'</span> ';
    print '<span class="time">' . date('H:i', $item['timestamp']) . '</span> ';
    print '<span class="title" id="TITLE' . $number . '">';
    //print htmlspecialchars($item['title']);
    print $item['title'];
    print '</span> ';
    print '<span class="source">';
    if ($conf['new_window'] == 'true') {
        print '<a href="' . $item['url'] . '" target="_blank">&raquo;';
    } else {
        print '<a href="' . $item['url'] . '">&raquo;';
    }
    //	print htmlspecialchars($item['name']);
    print $item['name'];
    print '</a>';
    print "</span>\n";
    print '<div class="excerpt" id="ICONT' . $number . '">';
    //	$safehtml =& new safehtml();
    //	print $safehtml->parse($item['body']);
    $body = $item['body'];
    if ($conf['new_window'] == 'true') {
        $new_window_regex = '/<a href([^>]+)>/i';
        $new_window_replace = '<a href\\1 target="_blank">';
        $body = preg_replace($new_window_regex, $new_window_replace, $body);
    }
    print $body;
    print '<div class="integration">';
    if ($conf['digg'] == 'true' && !stristr(getHost($item['url']), 'digg')) {
        print '<a href="http://digg.com/submit?phase=3&amp;url=' . $item['url'] . '&amp;title=' . $item['title'] . '" target="_new"><img src="img/digg.gif" alt="" /> ' . $lang['digg'] . '</a> ';
    }
    if ($conf['del.icio.us'] == 'true') {
        print '<a href="http://del.icio.us/post?url=' . $item['url'] . '&amp;title=' . $item['title'] . '" target="_new"><img src="img/del.icio.us.gif" alt="" /> ' . $lang['delicious'] . '</a> ';
    }
    if ($conf['reddit'] == 'true' && !stristr(getHost($item['feedurl']), 'reddit')) {
        print '<a href="http://www.reddit.com/submit?url=' . $item['url'] . '&amp;title=' . $item['title'] . '" target="_new"><img src="img/reddit.png" alt="" /> ' . $lang['reddit'] . '</a> ';
    }
    if ($conf['furl'] == 'true') {
        print '<a href="javascript:furlPost(\'' . $item['url'] . '\',\'' . $item['title'] . '\');"><img src="img/furl.gif" alt="" /> ' . $lang['furl'] . '</a> ';
    }
    if ($conf['newsvine'] == 'true') {
        print '<a href="javascript:void(window.open(\'http://www.newsvine.com/_wine/save?u=' . $item['url'] . '&h=' . $item['title'] . '\',\'newsvine\',\'toolbar=no,width=590,height=480\'));"><img src="img/newsvine.gif" alt="" /> ' . $lang['newsvine'] . '</a> ';
    }
    print '</div>';
    print '</div>';
    print '</div>';
    print "</div>\n";
    //	flush();
}
Example #24
0
 /**
  * 用户信息
  * @param array $list  列表数据
  * @param array $data  标题数据
  * @return unknown
  */
 function PHPExcel($list, $data)
 {
     $this->vendor('Excel.PHPExcel');
     //创建PHPExcel对象
     $objPHPExcel = new \PHPExcel();
     //设置属性
     $objPHPExcel->getProperties()->setCreator('ctos')->setLastModifiedBy('ctos')->setTitle('Office 2007 XLSX Test Document')->setSubject('Office 2007 XLSX Test Document')->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.')->setKeywords('office 2007 openxml php')->setCategory('Test result file');
     //设置宽度
     $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(20);
     $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(20);
     $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(20);
     $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
     $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
     $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
     $objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(20);
     $objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(20);
     $objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(20);
     //设置高度
     $objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(22);
     $objPHPExcel->getActiveSheet()->getRowDimension('2')->setRowHeight(20);
     // 字体和样式
     $objPHPExcel->getActiveSheet()->getDefaultStyle()->getFont()->setSize(10);
     $objPHPExcel->getActiveSheet()->getStyle('A2:I2')->getFont()->setBold(true);
     $objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
     $objPHPExcel->getActiveSheet()->getStyle('A2:I2')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->getActiveSheet()->getStyle('A2:I2')->getBorders()->getAllBorders()->setBorderStyle(\PHPExcel_Style_Border::BORDER_THIN);
     // 设置水平居中
     $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->getActiveSheet()->getStyle('A')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->getActiveSheet()->getStyle('B')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->getActiveSheet()->getStyle('C')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->getActiveSheet()->getStyle('D')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->getActiveSheet()->getStyle('E')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->getActiveSheet()->getStyle('F')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->getActiveSheet()->getStyle('G')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->getActiveSheet()->getStyle('H')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->getActiveSheet()->getStyle('I')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     //  合并
     $objPHPExcel->getActiveSheet()->mergeCells('A1:I1');
     // 表头
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', $data['title'])->setCellValue('A2', $data['thematic_name'])->setCellValue('B2', $data['bill_sn'])->setCellValue('C2', $data['goods_name'])->setCellValue('D2', $data['goods_sn'])->setCellValue('E2', $data['code'])->setCellValue('F2', $data['price'])->setCellValue('G2', $data['nickname'])->setCellValue('H2', $data['phone'])->setCellValue('I2', $data['add_time']);
     // 内容
     for ($i = 0, $len = count($list); $i < $len; $i++) {
         //转换成字符串
         $objPHPExcel->getActiveSheet(0)->setCellValueExplicit('A' . ($i + 3), $list[$i]['thematic_name'], \PHPExcel_Cell_DataType::TYPE_STRING);
         $objPHPExcel->getActiveSheet(0)->setCellValue('B' . ($i + 3), $list[$i]['bill_sn']);
         $objPHPExcel->getActiveSheet(0)->setCellValue('C' . ($i + 3), $list[$i]['goods_name']);
         $objPHPExcel->getActiveSheet(0)->setCellValue('D' . ($i + 3), $list[$i]['goods_sn']);
         $objPHPExcel->getActiveSheet(0)->setCellValue('E' . ($i + 3), $list[$i]['code']);
         $objPHPExcel->getActiveSheet(0)->setCellValue('F' . ($i + 3), $list[$i]['price']);
         $objPHPExcel->getActiveSheet(0)->setCellValue('G' . ($i + 3), $list[$i]['nickname']);
         $objPHPExcel->getActiveSheet(0)->setCellValue('H' . ($i + 3), $list[$i]['phone']);
         $objPHPExcel->getActiveSheet(0)->setCellValue('I' . ($i + 3), $list[$i]['add_time']);
         $objPHPExcel->getActiveSheet()->getStyle('A' . ($i + 3) . ':I' . ($i + 3))->getAlignment()->setVertical(\PHPExcel_Style_Alignment::VERTICAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('A' . ($i + 3) . ':I' . ($i + 3))->getBorders()->getAllBorders()->setBorderStyle(\PHPExcel_Style_Border::BORDER_THIN);
         $objPHPExcel->getActiveSheet()->getRowDimension($i + 3)->setRowHeight(16);
     }
     // Rename sheet
     // 重命名工作表
     $objPHPExcel->getActiveSheet()->setTitle($data['title']);
     // Set active sheet index to the first sheet, so Excel opens this as the first sheet
     //设置活动工作表索引到第一个工作表,那么 Excel 就会打开这作为第一个工作表
     $objPHPExcel->setActiveSheetIndex(0);
     // 输出
     header('Content-Type: application/vnd.ms-excel');
     header('Content-Disposition: attachment;filename="' . $data['title'] . '.xls"');
     header('Cache-Control: max-age=0');
     $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     $objWriter->save('php://output');
     $name = time();
     $url = getHost();
     $url = $url . '/excel/' . $name . '.xls';
     $objWriter->save('./excel/' . $name . '.xls');
     return $url;
 }
 function ResolveHost()
 {
     $this->Host = getHost();
     if (!empty($this->Host) && $this->Host != $this->IP) {
         queryDB(true, "UPDATE `" . DB_PREFIX . DATABASE_VISITORS . "` SET `host`='" . @mysql_real_escape_string($this->Host) . "' WHERE `id`='" . @mysql_real_escape_string($this->UserId) . "' AND `visit_latest`=1;");
     }
 }
Example #26
0
require "config.php";
include '../config/config.general.php';
// ** business functions
require 'includes/business.class.php';
// ** database functions
include '../web/classes/database.class.php';
// ** localization functions
include '../web/classes/local.class.php';
// ** business functions
include '../web/classes/business.class.php';
// ** connect to database
include '../web/classes/connect.db.php';
// ** all database queries
include '../web/classes/db_queries.db.php';
// get and define referer
$ref = getHost($_SERVER['HTTP_REFERER']);
$_SESSION['referer'] = $_SESSION['referer'] != '' ? $_SESSION['referer'] : $ref;
// property id
if ($_GET['prp']) {
    $_SESSION['property'] = (int) $_GET['prp'];
} elseif ($_POST['prp']) {
    $_SESSION['property'] = (int) $_POST['prp'];
} elseif (!$_SESSION['property']) {
    $_SESSION['property'] = '1';
}
$_SESSION['propertyID'] = $_SESSION['property'];
//standard outlet for contact form
if ($_GET['outletID']) {
    $_SESSION['outletID'] = (int) $_GET['outletID'];
} else {
    if ($_SESSION['outletID'] != '') {
Example #27
0
function getAppUrl()
{
    $url = getHost() . getAppPath();
    return $url;
}
Example #28
0
 /**
  * 返回给前端页面json 
  * @param string|array $data
  * @param string $errcode
  * @param bool $helper   是否helper调用,如果true,则不返回json
  */
 protected function R($data = "", $errcode = '', $helper = false, $jumpUrl = '')
 {
     if (!empty($errcode)) {
         $this->errcode = $errcode;
     }
     if ($this->errcode == 0) {
         $errmsg = '请求成功!';
         $isImportant = 0;
     } else {
         if (empty(self::$errMap)) {
             $errMap = (require __ROOT__ . '/errorCode.php');
             self::$errMap = $errMap;
         }
         if (is_array(self::$errMap[$this->errcode])) {
             $errmsg = self::$errMap[$this->errcode][0];
             $isImportant = self::$errMap[$this->errcode][1];
             $defaultUrl = empty(self::$errMap[$this->errcode][2]) ? 0 : self::$errMap[$this->errcode][2];
             $jumpUrl = empty($jumpUrl) ? $defaultUrl : $jumpUrl;
         } else {
             $errmsg = self::$errMap[$this->errcode];
             $isImportant = 0;
             $jumpUrl = '';
         }
     }
     $returnData = ["errcode" => $this->errcode, "errmsg" => $errmsg, 'data' => $data, 'isImportant' => $isImportant, 'jumpUrl' => $jumpUrl];
     $isView = Router::$isView;
     $isViewMuti = Router::$isViewMuti;
     if (!$helper && $isView === false) {
         ajaxReturn($returnData, "JSON", JSON_UNESCAPED_UNICODE);
     } elseif (!$helper && $isView === true) {
         //错误跳转
         if ($returnData['errcode'] != 0 && $returnData['isImportant'] == 1) {
             redirect(getHost() . $jumpUrl);
         }
         if ($isViewMuti) {
             self::$viewDataTemp[self::$functionName] = $returnData;
         } else {
             self::$viewDataTemp = $returnData;
         }
         return;
     }
     return $returnData;
 }
Example #29
0
 private function _repoDBlogin($browser = NULL)
 {
     if (is_null($browser)) {
         $this->_browser();
     }
     global $URL;
     global $USER;
     global $PASSWORD;
     $page = NULL;
     $cookieValue = NULL;
     $host = getHost($URL);
     $this->assertTrue(is_object($this->mybrowser));
     $this->mybrowser->useCookies();
     $cookieValue = $this->mybrowser->getCookieValue($host, '/', 'Login');
     $this->mybrowser->setCookie('Login', $cookieValue, $host);
     $page = $this->mybrowser->get("{$URL}?mod=auth&nopopup=1");
     $this->assertTrue($page);
     /* Use the test configured user if none specified */
     if (!strlen($this->User)) {
         $this->setUser($USER);
     }
     // no check on the password, as it could be blank, just use it...It should
     // have been set (if there was one) in Login
     //echo "FTDB: user is:$this->User and Password:$this->Password\n";
     $this->assertTrue($this->mybrowser->setField('username', $this->User), "Fatal! could not set username field in login form for {$this->User}\n");
     $this->assertTrue($this->mybrowser->setField('password', $this->Password), "Fatal! could not set password field in login form for {$this->User}\n");
     $this->assertTrue($this->mybrowser->isSubmit('Login'));
     $page = $this->mybrowser->clickSubmit('Login');
     $this->assertTrue($page, "FATAL! did not get a valid page back from Login\n");
     //print "DB: _RDBL: After Login ****page is:$page\n";
     $page = $this->mybrowser->get("{$URL}?mod=Default");
     //$p = $this->__chopPage($page);
     //print "DB: _RDBL: After mod=Default ****page is:$page\n";
     $this->assertTrue($this->myassertText($page, "/User:<\\/small>\\s{$this->User}/"), "Did not find User:<\\/small> {$this->User}\nThe User may not be logged in\n");
     $this->mybrowser->setCookie('Login', $cookieValue, $host);
     $page = $this->mybrowser->getContent();
     $NumMatches = preg_match('/User Logged Out/', $page, $matches);
     $this->assertFalse($NumMatches, "User Logged out!, Login Failed! %s");
     return $cookieValue;
 }