예제 #1
0
파일: classes.php 프로젝트: ninionino/spg
 public function __construct($path, $name = 'root')
 {
     $this->path = fixpath($path);
     $this->name = $name;
     $this->depth = substr_count($this->path, '/') - 1;
     #if ($this->depth <= $GLOBALS['config']['max_depth']) {
     if ($name == 'root') {
         $this->fill();
     }
 }
예제 #2
0
 static function getPlayerGallery($player_id, $filed = 'img_std')
 {
     $rs = D()->from("player_gallery")->where("`player_id`=%d", $player_id)->select("`{$filed}`")->fetch_column("{$filed}");
     if (!empty($rs)) {
         foreach ($rs as &$it) {
             $it = fixpath($it);
         }
     }
     return $rs;
 }
예제 #3
0
파일: lib.php 프로젝트: LeonB/site
/**
 * Loads a serialized file, unserializes it, and returns it.
 *
 * If the file isn't readable (or doesn't exist) or reading it fails,
 * false is returned.
 *
 * @param string $filename
 * @param boolean $silent Set to true if you want an visible error.
 * @return mixed
 */
function loadSerialize($filename, $silent = false)
{
    $filename = fixpath($filename);
    if (!is_readable($filename)) {
        // If we're setting up PivotX, we can't set the paths before we initialise
        // the configuration and vice-versa. So, we just bail out if the paths aren't
        // set yet.
        if (empty($PIVOTX['paths']['pivotx_path'])) {
            return;
        }
        if (is_readable($PIVOTX['paths']['pivotx_path'] . $filename)) {
            $filename = $PIVOTX['paths']['pivotx_path'] . $filename;
        } else {
            $filename = "../" . $filename;
        }
    }
    if (!is_readable($filename)) {
        if ($silent) {
            return false;
        }
        $format = __("<p>The following file could not be read:</p>%s" . "<p>Try logging in with your ftp-client and make the file readable. " . "Else try to go <a href='javascript:history.go(-1)'>back</a> to the last page.</p>");
        $message = sprintf($format, '<pre>' . htmlspecialchars($filename) . '</pre>');
        renderErrorpage(__("File is not readable!"), $message);
    }
    $serialized_data = trim(implode("", file($filename)));
    $serialized_data = str_replace("<?php /* bolt */ die(); ?" . ">", "", $serialized_data);
    // new-style JSON-encoded data; detect automatically
    if (substr($serialized_data, 0, 5) === 'json:') {
        $serialized_data = substr($serialized_data, 5);
        $data = json_decode($serialized_data, true);
        return $data;
    }
    // old-style serialized data; to be phased out, but leaving intact for
    // backwards-compatibility
    @($data = unserialize($serialized_data));
    if (is_array($data)) {
        return $data;
    } else {
        $temp_serialized_data = preg_replace("/\r\n/", "\n", $serialized_data);
        if (@($data = unserialize($temp_serialized_data))) {
            return $data;
        } else {
            $temp_serialized_data = preg_replace("/\n/", "\r\n", $serialized_data);
            if (@($data = unserialize($temp_serialized_data))) {
                return $data;
            } else {
                return false;
            }
        }
    }
}
예제 #4
0
/**
 * Generates frontpage for a given weblog.
 */
function generate_frontpage($weblog)
{
    global $db, $Current_weblog, $Weblogs, $done_archives, $totalfiles, $Cfg, $Allow_RSS, $set_output_paths, $template_html;
    if (!isset($db)) {
        $db = new db();
    }
    // make a key for this page
    $archive_key = $weblog . "-front";
    // return, if this page has already been made.
    if (isset($done_archives[$archive_key]) && $done_archives[$archive_key]) {
        return;
    } else {
        $done_archives[$archive_key] = TRUE;
    }
    // switch to weblog's language
    LoadWeblogLanguage($Weblogs[$weblog]['language']);
    $template_html = load_template($Weblogs[$weblog]['front_template']);
    // Set current weblog (and keep old)
    $Current_weblog_orig = $Current_weblog;
    $Current_weblog = $weblog;
    if ($Weblogs[$weblog]['rss'] == 1 && $Allow_RSS) {
        start_rss();
    }
    // should be unset before each archive and frontpage..
    $set_output_paths = FALSE;
    if (!$template_html) {
        ErrorOut("Could not load template file: <i>{$template}</i> [does not exist]");
    } else {
        $output = "[[tick]]" . $template_html;
        $output = parse_step4($output);
        $output = tidy_html($output);
    }
    $filename = $Weblogs[$weblog]['front_path'] . $Weblogs[$weblog]['front_filename'];
    //make sure the directory exists
    makedir($Weblogs[$weblog]['front_path']);
    debug("Write frontpage file: {$filename}");
    if (strstr($filename, ".php")) {
        $output = prepend_spamblock_code($output);
    }
    write_file($filename, $output);
    $totalfiles++;
    debug("total_f: {$filename} - " . getcwd());
    // finish RSS
    if ($Weblogs[$weblog]['rss'] == 1 && $Allow_RSS) {
        finish_rss();
    }
    $weblogname = urlencode($Weblogs[$weblog]['name']);
    $filename = urlencode(fixpath($filename));
    // Reset current weblog (back to old)
    $Current_weblog = $Current_weblog_orig;
    return $filename;
}
예제 #5
0
 /**
  * 赛事活动页
  *
  * @param Request $request
  * @param Response $response
  */
 function detail(Request $request, Response $response)
 {
     $this->v->set_tplname('mod_match_detail');
     $this->nav_flag1 = 'match_detail';
     $nid = $request->arg(1);
     $isajax = $request->get('isajax', 0);
     $this->v->assign('the_nid', $nid)->assign("isajax", $isajax);
     if ($request->is_hashreq()) {
         $errmsg = '';
         //获取Node信息
         $ninfo = Node::getInfo($nid);
         if (empty($ninfo)) {
             $errmsg = "比赛不存在(nid={$nid})";
         } else {
             //获取页面参数
             $limit = 20;
             $page = $request->get('p', 0);
             $search = $request->get('s', '');
             $search = trim($search);
             $this->v->assign('search', $search);
             //检查周排名信息
             $stick = config_get('stick');
             // 是否置顶
             $see_weekinfo = [];
             if ($search == '') {
                 //搜索时不检查
                 $see_weekinfo = Match_Model::getRankWeekInfo($nid);
             }
             $stick_player_ids = [];
             $stick_player_list = [];
             //置顶参数者列表
             if ($stick && !empty($see_weekinfo)) {
                 array_push($stick_player_ids, $see_weekinfo['player_id1'], $see_weekinfo['player_id2']);
                 $stick_player_list = Match_Model::getPlayerList($nid, $stick_player_ids);
             }
             if (!$isajax) {
                 //更新访问次数
                 Node::addVisitCnt($nid);
                 //解析一些数据
                 $match_types = Node::getMatchTypes();
                 $ninfo['match_type_text'] = $match_types[$ninfo['match_type']];
                 //解析content_detail里面的[p]xxx[/p]
                 $content_parsed = Node::parseContentParagraph($ninfo['content_detail']);
                 $content_parsed_num = count($content_parsed);
                 $this->v->assign('content_parsed', $content_parsed);
                 $this->v->assign('content_parsed_num', $content_parsed_num);
                 $total_player_num = Match_Model::getPlayersNum($nid);
                 $this->v->assign('total_player_num', $total_player_num);
             }
             //检查是否启用记录的页码
             if (!$page) {
                 if ('' == $search) {
                     $page = isset($_SESSION['mark_pageno']) ? intval($_SESSION['mark_pageno']) : 1;
                 } else {
                     $page = 1;
                 }
             } else {
                 if ('' == $search) {
                     $_SESSION['mark_pageno'] = $page;
                 }
             }
             $start = ($page - 1) * $limit;
             $totalnum = 0;
             $maxpage = 1;
             $player_list = Match_Model::getPlayerList($nid, $search, $start, $limit, $totalnum, $maxpage, $stick_player_ids);
             $player_list = array_merge($stick_player_list, $player_list);
             //合并
             $player_list = Match_Model::parsePlayerList($player_list, $see_weekinfo);
             $this->v->assign('player_list', $player_list);
             $this->v->assign('player_num', count($player_list));
             $this->v->assign('curpage', $page);
             $this->v->assign('maxpage', $maxpage);
         }
         $this->v->assign('errmsg', $errmsg)->assign('ninfo', $ninfo);
         if ($isajax) {
             $this->v->filter_output_part();
         }
     } else {
         $ninfo = Node::getInfo($nid);
         if (!empty($ninfo)) {
             //SEO信息
             $seo = ['title' => $ninfo['title'], 'keyword' => $ninfo['keyword'], 'desc' => $ninfo['slogan']];
             $this->v->assign('seo', $seo);
         }
         //分享信息
         $share_info = ['title' => $ninfo['title'], 'desc' => $ninfo['slogan'], 'link' => U('match/' . $ninfo['nid'], '', true), 'pic' => fixpath($ninfo['thumb_url'])];
         $this->v->assign('share_info', $share_info);
     }
     $response->send($this->v);
 }
예제 #6
0
 static function getRankList($type, $start = 0, $limit = 20, array $extra = array(), &$hasmore = false)
 {
     $hasmore = false;
     if ($type == '') {
         $type = 'pass_rank';
     }
     if (!in_array($type, ['total_rank', 'pass_rank', 'nopass_rank', 'week_rank', 'most_vote', 'most_flower'])) {
         return [];
     }
     if (in_array($type, ['most_vote', 'most_flower']) && empty($extra['player_id'])) {
         return [];
     }
     $usecdn = C('env.usecdn');
     $result = [];
     $limit_true = $limit + 1;
     //多去一个为了判断是否还有下一页
     if ($type == 'most_vote' || $type == 'most_flower') {
         $sql = "SELECT a.`uid` AS user_id,m.nickname,m.logo,SUM(a.`inc`) AS action_amount,MAX(a.`timeline`) AS lasttime\n  \t\t\t\t    FROM `{action}` a INNER JOIN `{member}` m ON a.`player_id`=%d AND a.`action`='%s' AND a.`uid`=m.`uid`\n  \t\t\t\t    WHERE a.`uid` <> 10000\n  \t\t\t\t    GROUP BY user_id\n  \t\t\t\t    ORDER BY action_amount DESC\n  \t\t\t\t    LIMIT %d,%d";
         $result = D()->query($sql, $extra['player_id'], str_replace('most_', '', $type), $start, $limit_true)->fetch_array_all();
         if (count($result) > $limit) {
             $hasmore = true;
             array_pop($result);
             //去掉多出的一个
         }
     } elseif ($type == 'total_rank' || $type == 'pass_rank' || $type == 'nopass_rank') {
         $where_extra = '';
         $votefield = 'votecnt';
         if ($type == 'pass_rank') {
             $currstage = self::getCurrMatchStage($extra['match_id']);
             $where_extra = 'AND p.`stage`=' . $currstage;
             if ($currstage > 0) {
                 $votefield = 'votecnt' . $currstage;
             }
         } elseif ($type == 'nopass_rank') {
             $currstage = self::getCurrMatchStage($extra['match_id']);
             $where_extra = 'AND p.`stage`<' . $currstage;
         }
         $sql = "SELECT p.*,pg.img_thumb,pg.img_thumb_cdn\n  \t  \t\t    FROM `{player}` p INNER JOIN `{player_gallery}` pg ON p.cover_pic_id=pg.rid\n  \t  \t\t    WHERE p.`match_id`=%d {$where_extra} AND p.`status`='R'\n  \t  \t\t    ORDER BY p.{$votefield} DESC, p.player_id ASC\n  \t  \t\t    LIMIT %d,%d";
         $result = D()->query($sql, $extra['match_id'], $start, $limit_true)->fetch_array_all();
         if (!empty($result)) {
             if (count($result) > $limit) {
                 $hasmore = true;
                 array_pop($result);
                 //去掉多出的一个
             }
             $i = 1;
             $prevote = PHP_INT_MAX;
             $prerank = -1;
             $time_from = Node::getMatchStageTime($extra['match_id']);
             foreach ($result as &$it) {
                 //添加"排名"字段
                 if ($it[$votefield] < $prevote) {
                     $it['rankno'] = $start + $i;
                     $prerank = $it['rankno'];
                 } else {
                     $it['rankno'] = $prerank;
                 }
                 $prevote = $it[$votefield];
                 //$it['votecnt_single'] = Node::getActionNum($it['player_id'], 'vote', ($it['stage'] > 0 ? $time_from : 0));
                 $it['img_thumb'] = fixpath(2 == $usecdn && $it['img_thumb_cdn'] != '' ? $it['img_thumb_cdn'] : $it['img_thumb']);
                 $i++;
             }
         }
     } elseif ($type == 'week_rank') {
         $match_info = Node::getInfo($extra['match_id']);
         $now_dt = date('Y-m-d H:i:s');
         $sql = "SELECT * FROM `{rank_week}` WHERE `match_id`=%d ORDER BY `weekno` ASC";
         $result = D()->query($sql, $extra['match_id'])->fetch_array_all();
         $true_rs = [];
         foreach ($result as &$it) {
             $it['weekno_txt'] = '第' . Fn::to_cnnum($it['weekno']) . '周';
             if (!empty($it['player_id1']) && !empty($it['player_id2'])) {
                 $it['player1_dt'] = self::getPlayerInfo($it['player_id1']);
                 $it['player1_dt']['cover_pic'] = self::getPlayerCover($it['player_id1'], 'thumb');
                 $it['player2_dt'] = self::getPlayerInfo($it['player_id2']);
                 $it['player2_dt']['cover_pic'] = self::getPlayerCover($it['player_id2'], 'thumb');
             }
             array_push($true_rs, $it);
             if (empty($it['player_id1']) || empty($it['player_id2'])) {
                 break;
             }
         }
         $result = $true_rs;
     }
     return $result;
 }
예제 #7
0
파일: lib.php 프로젝트: pkdevboxy/site-v20
/**
 * Loads a serialized file, unserializes it, and returns it.
 *
 * If the file isn't readable (or doesn't exist) or reading it fails,
 * false is returned.
 *
 * @param string $filename
 * @param boolean $silent
 *            Set to true if you want an visible error.
 * @return mixed
 */
function loadSerialize($filename, $silent = false)
{
    $filename = fixpath($filename);
    if (!is_readable($filename)) {
        if ($silent) {
            return false;
        }
        $part = __('Try logging in with your ftp-client and make the file readable. ' . 'Else try to go <a>back</a> to the last page.');
        $message = '<p>' . __('The following file could not be read:') . '</p>' . '<pre>' . htmlspecialchars($filename) . '</pre>' . '<p>' . str_replace('<a>', '<a href="javascript:history.go(-1)">', $part) . '</p>';
        renderErrorpage(__('File is not readable!'), $message);
    }
    $serialized_data = trim(implode("", file($filename)));
    $serialized_data = str_replace("<?php /* bolt */ die(); ?" . ">", "", $serialized_data);
    // new-style JSON-encoded data; detect automatically
    if (substr($serialized_data, 0, 5) === 'json:') {
        $serialized_data = substr($serialized_data, 5);
        $data = json_decode($serialized_data, true);
        return $data;
    }
    // old-style serialized data; to be phased out, but leaving intact for
    // backwards-compatibility. Up until Bolt 1.5, we used to serialize certain
    // fields, so reading in those old records will still use the code below.
    @($data = unserialize($serialized_data));
    if (is_array($data)) {
        return $data;
    } else {
        $temp_serialized_data = preg_replace("/\r\n/", "\n", $serialized_data);
        if (@($data = unserialize($temp_serialized_data))) {
            return $data;
        } else {
            $temp_serialized_data = preg_replace("/\n/", "\r\n", $serialized_data);
            if (@($data = unserialize($temp_serialized_data))) {
                return $data;
            } else {
                return false;
            }
        }
    }
}
예제 #8
0
파일: index.php 프로젝트: ninionino/spg
    spg is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with spg; if not, write to the Free Software Foundation, Inc.,
    51 Franklin St, Fifth Floor,
    Boston, MA  02110-1301  USA
*/
// Define this so our children won't cry on contact
define('SPG_VERSION', 0.2);
// Move little piggies, move!
require 'include/config.php';
require 'include/classes.php';
// init our page gen timer now that we've loaded our classes
$timer = new pGenTimer();
// Do we have a requested album? If so, is it sanitized?
$cln_album = preg_match('/^\\/[0-9A-Za-z\\/\\-\\_]+$/', $_REQUEST['album']) ? $_REQUEST['album'] : '/';
// Setup root album, which starts a recursive name-calling scenario
$root_album = new Album($cln_album);
// Is the given template sanitized?
$cln_t = preg_match('/^[0-9A-Za-z\\-\\_]+$/', $_REQUEST['t']) ? $_REQUEST['t'] : $config['default_template'];
if (is_dir($config['templates_path'] . '/' . $cln_t) && file_exists($config['templates_path'] . '/' . $cln_t . '/album.php')) {
    $template['name'] = $cln_t;
    $template['path'] = fixpath($config['templates_path'] . '/' . $template['name']);
    require $template['path'] . 'album.php';
} else {
    print "template {$cln_t} was not found";
}
예제 #9
0
} else {
    $ping_weblogs = explode('|', urldecode($Pivot_Vars['weblogs']));
}
echo "<p>Now sending update-pings. This might take a while, so please be patient.<br />";
foreach ($ping_weblogs as $ping_weblog) {
    echo "<hr size='1' noshade='noshade' />";
    $ping_weblog = weblog_from_para($ping_weblog);
    $title = $Weblogs[$ping_weblog]['name'];
    $Current_weblog = $ping_weblog;
    $file = $Weblogs[$ping_weblog]['front_filename'];
    $logpath = $Weblogs[$ping_weblog]['front_path'];
    if (siteurl_isset()) {
        $url = $Weblogs[$ping_weblog]['siteurl'];
    } else {
        $url = $Paths['pivot_url'] . $logpath . $file;
        $url = gethost() . fixpath($url);
    }
    $url = str_replace("/index.php", "/", $url);
    $url = str_replace("/index.html", "/", $url);
    $servers = explode("\n", $Cfg['ping_urls']);
    echo "<p>url: {$url}<br /></p>";
    flush();
    foreach ($servers as $server) {
        $server = trim($server);
        if (strlen($server) > 3) {
            pingWeblogs($title, $url, $server);
            flush();
        }
    }
}
echo "<p><br /><b><a href='#' onclick='self.close();'>done</a></b></p>";
예제 #10
0
/**
 * Smarty tag to insert a link to a downloadable file.
 *
 * <pre>
 *  [[download:filename:icon:text:title]]
 * </pre>
 * @param string $filename
 * @param string $icon Insert a suitable icon if set to "icon"
 * @param string $text The text of the download link.
 * @param string $title The text of the title attribue of the link.
 */
function smarty_download($params)
{
    global $PIVOTX;
    $params = cleanParams($params);
    $filename = $params['file'];
    $icon = $params['icon'];
    $text = $params['text'];
    $title = cleanAttributes($params['title']);
    $org_filename = $filename;
    if (file_exists($PIVOTX['paths']['upload_base_path'] . $filename)) {
        $filename = fixpath($PIVOTX['paths']['upload_base_url'] . $filename);
        $ext = strtolower(getExtension($filename));
        $middle = '';
        // We don't have icons for _all_ filetypes, so we group some together..
        if (in_array($ext, array('gif', 'jpg', 'jpeg', 'png', 'psd', 'eps', 'bmp', 'tiff', 'ai'))) {
            $iconext = "image";
        } else {
            if (in_array($ext, array('doc', 'docx', 'rtf', 'dot', 'dotx', 'odt', 'ott', 'xps'))) {
                $iconext = "doc";
            } else {
                if (in_array($ext, array('mp3', 'aiff', 'ogg', 'wav'))) {
                    $iconext = "audio";
                } else {
                    if (in_array($ext, array('wmv', 'mpg', 'mov', 'swf', 'flv', 'avi', 'mp4'))) {
                        $iconext = "movie";
                    } else {
                        if (in_array($ext, array('zip', 'gz', 'tgz', 'rar', 'dmg', '7z'))) {
                            $iconext = "zip";
                        } else {
                            if (in_array($ext, array('ppt', 'pptx', 'pot', 'pps', 'ppsx', 'ppsm', 'odp', 'otp'))) {
                                $iconext = "ppt";
                            } else {
                                $iconext = $ext;
                            }
                        }
                    }
                }
            }
        }
        switch ($icon) {
            case 'icon':
                if (file_exists($PIVOTX['paths']['pivotx_path'] . 'pics/icon_' . $iconext . '.gif')) {
                    $image = fixpath($PIVOTX['paths']['pivotx_url'] . 'pics/icon_' . $iconext . '.gif');
                } else {
                    $image = fixpath($PIVOTX['paths']['pivotx_url'] . 'pics/icon_generic.gif');
                }
                if ('' != $image) {
                    $width = 0;
                    $height = 0;
                    list($width, $height) = @getimagesize($PIVOTX['paths']['host'] . $image);
                    $middle = '<img src="' . $image;
                    if (0 != $width) {
                        $middle .= '" width="' . $width;
                    }
                    if (0 != $height) {
                        $middle .= '" height="' . $height;
                    }
                    $middle .= '" alt="' . $title . '" class="icon" style="border:0; margin-bottom: -3px;" />';
                }
                $middle .= ' ' . $text;
                // all ok... leave
                break;
            case 'text':
                // fall through
            // fall through
            default:
                $middle = $text;
        }
        // Refuse to insert a download without a clickable link. Just use the
        // filename in this case..
        if (empty($middle)) {
            $middle = basename($filename);
        }
        $code = '<a href="' . $filename . '" title="' . $title . '" class="pivotx-download">' . $middle . '</a>';
    } else {
        debug("Rendering error: did not make a download link for '{$org_filename}'. File does not exist");
        $code = '<!-- error: did not make a download link for ' . $org_filename . '. File does not exist -->';
    }
    return $code;
}
예제 #11
0
파일: lib.php 프로젝트: viyancs/bolt
/**
 * Loads a serialized file, unserializes it, and returns it.
 *
 * If the file isn't readable (or doesn't exist) or reading it fails,
 * false is returned.
 *
 * @param string $filename
 * @param boolean $silent Set to true if you want an visible error.
 * @return mixed
 */
function loadSerialize($filename, $silent = false)
{
    $filename = fixpath($filename);
    if (!is_readable($filename)) {
        // If we're setting up PivotX, we can't set the paths before we initialise
        // the configuration and vice-versa. So, we just bail out if the paths aren't
        // set yet.
        if (empty($PIVOTX['paths']['pivotx_path'])) {
            return;
        }
        if (is_readable($PIVOTX['paths']['pivotx_path'] . $filename)) {
            $filename = $PIVOTX['paths']['pivotx_path'] . $filename;
        } else {
            $filename = "../" . $filename;
        }
    }
    if (!is_readable($filename)) {
        if ($silent) {
            return FALSE;
        }
        $message = sprintf(__("<p>The following file could not be read:</p>%s" . "<p>Try logging in with your ftp-client and make the file readable. " . "Else try to go <a href='javascript:history.go(-1)'>back</a> to the last page.</p>"), '<pre>' . htmlspecialchars($filename) . '</pre>');
        renderErrorpage(__("File is not readable!"), $message);
    }
    $serialized_data = trim(implode("", file($filename)));
    $serialized_data = str_replace("<?php /* bolt */ die(); ?>", "", $serialized_data);
    @($data = unserialize($serialized_data));
    if (is_array($data)) {
        return $data;
    } else {
        $temp_serialized_data = preg_replace("/\r\n/", "\n", $serialized_data);
        if (@($data = unserialize($temp_serialized_data))) {
            return $data;
        } else {
            $temp_serialized_data = preg_replace("/\n/", "\r\n", $serialized_data);
            if (@($data = unserialize($temp_serialized_data))) {
                return $data;
            } else {
                return FALSE;
            }
        }
    }
}
예제 #12
0
/**
 * Make the $Paths array, which is used in many places to figure out where files should be
 * read from or written to.
 *
 * @see fixpath()
 */
function Setpaths()
{
    global $Current_weblog, $Paths, $Cfg;
    $Paths['pivot_url'] = get_pivot_url();
    $Paths['cookie_url'] = fixPathSlash(str_replace('\\', '/', dirname($Paths['pivot_url'])));
    // We are setting $Paths['log_url'] in parse_step4 since it can't be
    // set before we know the weblog anyway.
    $Paths['host'] = "http://" . $_SERVER['HTTP_HOST'];
    if (realpath(__FILE__) == "") {
        $Paths['pivot_path'] = str_replace('\\', '/', dirname(realpath($_SERVER['SCRIPT_FILENAME'])) . "/");
    } else {
        $Paths['pivot_path'] = str_replace('\\', '/', dirname(realpath(__FILE__)) . "/");
    }
    $Paths['extensions_path'] = fixpath($Paths['pivot_path'] . '../' . $Cfg['extensions_path']);
    $Paths['extensions_url'] = fixpath($Paths['pivot_url'] . '../' . $Cfg['extensions_path']);
    $Paths['upload_path'] = fixpath($Paths['pivot_path'] . '../' . $Cfg['upload_path']);
    $Paths['upload_url'] = fixpath($Paths['pivot_url'] . '../' . $Cfg['upload_path']);
    if (file_exists($Paths['pivot_path'] . '../bbclone/')) {
        $Paths['bbclone_path'] = fixpath($Paths['pivot_path'] . '../bbclone/');
    } elseif (file_exists($Paths['pivot_path'] . '../../bbclone/')) {
        $Paths['bbclone_path'] = fixpath($Paths['pivot_path'] . '../../bbclone/');
    } else {
        $Paths['bbclone_path'] = "";
    }
    $Paths['templates_path'] = fixpath($Paths['pivot_path'] . 'templates/');
}
예제 #13
0
function snippet_blogapi_autodiscovery()
{
    global $Weblogs, $Current_weblog, $Paths;
    $filname = basename($Weblogs[$Current_weblog]['front_filename'], '.php');
    $filename = $Weblogs[$Current_weblog]['rss_path'] . 'rsd-' . $filname . '.xml';
    $rsdfilename = fixpath($Paths['pivot_dir'] . $filename);
    $rsdurl = fixpath($Paths['pivot_url'] . $filename);
    // Some desktop blogging tools (Flock at least) needs to know the host explicitly...
    $rsdurl = $Paths['host'] . $rsdurl;
    $blogurl = $Paths['host'] . snippet_home();
    $blogapiurl = $Paths['host'] . $Paths['pivot_url'] . 'metaweblog.php';
    $output = '<?xml version="1.0"?>
<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
    <service>
        <engineName>Pivot</engineName>
        <engineLink>http://pivotlog.net/</engineLink>
        <homePageLink>' . $blogurl . '</homePageLink>
        <apis>
            <api name="MetaWeblog" preferred="true"
                apiLink="' . $blogapiurl . '"
                blogID="' . $Current_weblog . '" />
        </apis>
    </service>
</rsd>';
    write_file($filename, $output);
    $output = '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . $rsdurl . '" />';
    return $output;
}
예제 #14
0
/**
 * Makes a link to an Atom or RSS feed.
 *
 *
 * @param string $type
 * @param array $params
 * @return string
 */
function makeFeedLink($type = 'rss', $params = array())
{
    global $PIVOTX;
    // Check if we should override our own Feed with a value from the
    // weblog config..
    $override_link = $type == "rss" ? $PIVOTX['weblogs']->get('', 'rss_url') : $PIVOTX['weblogs']->get('', 'atom_url');
    if (!empty($override_link)) {
        return $override_link;
    } else {
        // Else we process as usual..
        $link = $PIVOTX['paths']['host'] . fixpath($PIVOTX['paths']['site_url']);
        // Check if it is a category feed or weblog/site feed
        if (isset($params['category'])) {
            $prefix = getDefault($PIVOTX['config']->get('localised_category_prefix'), "category");
            if ($PIVOTX['config']->get('mod_rewrite') > 0) {
                $link .= $prefix . '/' . $params['category'] . '/' . $type;
            } else {
                $link .= "index.php?feed=" . $type . '&amp;c=' . $params['category'];
            }
        } else {
            if ($PIVOTX['config']->get('mod_rewrite') > 0) {
                $link .= $type;
            } else {
                $link .= "index.php?feed=" . $type;
            }
        }
        // Check if it is a special content feed.
        if (isset($params['content'])) {
            if ($PIVOTX['config']->get('mod_rewrite') > 0) {
                $link .= '/' . $params['content'];
            } else {
                $link .= "&amp;content=" . $params['content'];
            }
        } else {
            // If we have more than one weblog, add the w=weblogname parameter
            $weblog = $PIVOTX['weblogs']->getCurrent();
            if (paraWeblogNeeded($weblog)) {
                if ($PIVOTX['config']->get('mod_rewrite') > 0) {
                    // we treat it as an extra 'folder'
                    $link .= "/" . $weblog;
                } else {
                    $link .= "&amp;w=" . $weblog;
                }
            }
        }
        // Check if there's a hook set, and if so call it. This hook has no 'return' value.
        if ($PIVOTX['extensions'] && $PIVOTX['extensions']->hasHook('make_link#feed')) {
            $PIVOTX['extensions']->executeHook('make_link#feed', $link, array('type' => $type, 'append' => $append, 'w' => $weblog));
        }
        return $link;
    }
}
예제 #15
0
			}
		}
		else if (F.scrollDirection > 0) { //向下滑动(滚动条向上走),则需分情况处理
			if (this.y > -150 && this.y <= 0) {
				showtopbar($_mtop, true);
			}
			else {
				showtopbar($_mtop, false);
			}
		}
	});
});
</script>
<div class="match-thumb">
  <img src="<?php 
    echo fixpath($ninfo['thumb_url']);
    ?>
" alt="" />
  <div class="join"><a href="/match/<?php 
    echo $the_nid;
    ?>
/join" class="btn btn-block btn-purple">我要参赛</a></div>
</div>
  
<div class="block-page match-info">
<?php 
    if (0) {
        ?>
  <div class="row">比赛时间:<?php 
        echo $ninfo['match_type_text'];
        ?>
예제 #16
0
/**
 *  Saves a file, and outputs some feedback, if wanted.
 */
function write_file($filename, $output, $mode = 'w')
{
    global $Paths, $VerboseGenerate;
    if ($VerboseGenerate) {
        echo lang('general', 'write') . ": " . $filename . "<br />\n";
    }
    // open up..
    $opened = false;
    if ($fh = @fopen($filename, $mode)) {
        $opened = true;
    } else {
        if ($fh = @fopen(fixpath($Paths['pivot_path'] . $filename), 'w')) {
            $opened = true;
        }
    }
    // if opening failed it's no reason to continue
    if (!$opened) {
        debug("Unable to open (handle to) {$filename} - can not write to file");
        if ($VerboseGenerate) {
            echo lang('general', 'write_open_error') . ": " . $filename . "<br />\n";
        }
        return;
    }
    // wrrrriting!
    if (!fwrite($fh, $output)) {
        if ($VerboseGenerate) {
            echo lang('general', 'write_write_error') . ": " . $filename . "<br />\n";
        }
    }
    fclose($fh);
    chmod_file($filename);
}