Example #1
0
function plugin_epoch_inline()
{
    $value = func_get_args();
    $args = func_num_args();
    if ($args > 3) {
        return '&epoch(utime[,class]);';
    }
    $array = explode(',', $value[0]);
    $format = Time::format($array[0]);
    $passaage = Time::passage($array[0]);
    $class = !empty($array[1]) ? $array[1] : 'epoch';
    $ret = '<time datetime="' . get_date('c', $value[0]) . '" class="' . $class . '" title="' . $passaage . '">' . $format . '</time>';
    if (!empty($value[1])) {
        $erapse = MUTIME - $value[0];
        if ($erapse < 432000) {
            $ret .= ' <span class="';
            if ($erapse < 86400) {
                $ret .= 'new1';
            } else {
                $ret .= 'new5';
            }
            $ret .= '">New</span>';
        }
    }
    return $ret;
}
Example #2
0
function set_timezone($lang = '')
{
    return Time::setTimeZone($lang);
}
Example #3
0
function plugin_edit_honeypot()
{
    if (isset($vars['ajax'])) {
        $headers = Header::getHeaders('application/json');
        Header::writeResponse($headers, 200, Json::encode(array('posted' => false, 'message' => 'Sorry your post has been prohibited.', 'taketime' => Time::getTakeTime())));
        exit;
    }
    // SPAM Logging
    Utility::dump();
    // Same as "Cancel" action
    return plugin_edit_cancel();
}
Example #4
0
 /**
  * エラーメッセージを表示
  * @param string $msg エラーメッセージ
  * @param string $title エラーのタイトル
  * @param int $http_code 出力するヘッダー
  */
 public static function dieMessage($msg = '', $error_title = '', $http_code = Response::STATUS_CODE_200)
 {
     global $_string, $_title, $_button, $vars;
     // エラーメッセージの内容
     if (!isset($vars['ajax'])) {
         $body[] = '<p>[ ';
         if (isset($vars['page']) && !empty($vars['page'])) {
             $body[] = '<a href="' . Factory::Wiki($vars['page'])->uri() . '">' . $_button['back'] . '</a> | ';
             $body[] = '<a href="' . Router::get_cmd_uri('edit', $vars['page']) . '">' . $_button['try_edit'] . '</a> | ';
         }
         $body[] = '<a href="' . Router::get_cmd_uri() . '">' . $_button['return_home'] . '</a> ]</p>';
     }
     $body[] = '<p class="alert alert-warning"><span class="fa fa-ban"></span> <strong>' . $_title['error'] . '</strong>';
     $body[] = PKWK_WARNING !== true || empty($msg) ? $msg = $_string['error_msg'] : $msg;
     $body[] = '</p>';
     if (DEBUG) {
         $body[] = '<div class="panel panel-info">';
         $body[] = '<div class="panel-heading"><span class="fa fa-info-circle"></span> Back Trace</div>';
         $body[] = '<div class="panel-body">';
         $body[] = '<ol>';
         foreach (debug_backtrace() as $k => $v) {
             if ($k < 2) {
                 continue;
             }
             array_walk($v['args'], function ($item, $key) {
                 $item = var_export($item, true);
             });
             $body[] = '<li>' . (isset($v['file']) ? $v['file'] : '?') . '(<var>' . (isset($v['line']) ? $v['line'] : '?') . '</var>):<br /><code>' . (isset($v['class']) ? '<strong>' . $v['class'] . '</strong>-&gt;' : '') . $v['function'] . '(<var>' . implode(', ', $v['args']) . '</var>)</code></li>' . "\n";
         }
         $body[] = '</ol>';
         $body[] = '</div>';
         $body[] = '</div>';
     }
     if (empty($error_title)) {
         $error_title = $_title['error'];
     }
     if (isset($vars['ajax'])) {
         $headers = Header::getHeaders('application/json');
         Header::writeResponse($headers, $http_code, Json::encode(array('posted' => false, 'title' => $error_title, 'body' => join("\n", $body), 'taketime' => Time::getTakeTime())));
     } else {
         new Render($error_title, join("\n", $body), $http_code);
         die(join("\n", $body));
     }
     die;
 }
Example #5
0
<?php

// PukiWiki Plus! - Yet another WikiWikiWeb clone.
// $Id: rules.ini.php,v 1.10.5 2007/06/10 02:08:40 miko Exp $
// Copyright (C)
//   2005-2007 Customized/Patched by Miko.Hoshina
//   2003-2007 PukiWiki Developers Team
//   2001-2002 Originally written by yu-ji
// License: GPL v2 or (at your option) any later version
//
use PukiWiki\Time;
use PukiWiki\Utility;
global $vars, $date_format, $time_format;
/**
 * フィルタルール
 *
 *  正規表現で記述してください。?(){}-*./+\$^|など
 *  は \? のようにクォートしてください。
 *  前後に必ず / を含めてください。行頭指定は ^ を頭に。
 *  行末指定は $ を後ろに。
*/
return array('filter' => array("^(TITLE):(.*)\$" => "", "#tboff(.*)\$" => "", "#skin(.*)\$" => ""), 'datetime' => array('&amp;_now;' => '&epoch{' . time() . '};', '&amp;_date;' => Time::getZoneTimeDate($date_format), '&amp;_time;' => Time::getZoneTimeDate($time_format)), 'str' => array('&now;' => '\\&epoch\\{' . time() . '\\};', '&date;' => Time::getZoneTimeDate($date_format), '&time;' => Time::getZoneTimeDate($time_format), '&page;' => isset($vars['page']) ? Utility::getPageNameShort($vars['page']) : null, '&fpage;' => isset($vars['page']) ? $vars['page'] : null, '&t;' => "\t"));
/* End of file rules.ini.php */
/* Location: ./wiki-common/rules.ini.php */
Example #6
0
 /**
  * 更新日時
  */
 public function getDate()
 {
     return Time::getZoneTimeDate('Y/m/d H:i:s', $this->fileinfo->getMTime());
 }
Example #7
0
function plugin_backup_get_list($page)
{
    global $_backup_messages, $vars, $_button;
    $retval = array();
    $retval[] = '<p><a class="btn btn-secondary" href="' . Router::get_page_uri($page) . '">' . $_button['back'] . '</a></p>';
    $backup = Factory::Backup($page);
    $backups = $backup->get();
    if (empty($backups)) {
        $retval[] = '<p class="alert alert-info">' . str_replace('$1', make_pagelink($page), $_backup_messages['msg_nobackup']) . '</p>';
        return join('', $retval);
    } else {
        $retval[] = '<form action="' . Router::get_script_uri() . '" method="get" class="backup_select_form">';
        $retval[] = '<input type="hidden" name="cmd" value="backup" />';
        $retval[] = '<input type="hidden" name="page" value="' . Utility::htmlsc($page) . '" />';
        $age = isset($vars['age']) ? (int) $vars['age'] : null;
        $action = isset($vars['action']) && empty($vars['action']) ? $vars['action'] : 'diff';
        $actions = array('nowdiff' => $_backup_messages['msg_nowdiff'], 'diff' => $_backup_messages['msg_diff'], 'visaldiff' => $_backup_messages['msg_visualdiff'], 'source' => $_backup_messages['msg_source'], 'delete' => $_backup_messages['msg_delete'], 'rollback' => $_backup_messages['msg_rollback']);
        if (IS_MOBILE) {
            $retval[] = '<select name="age">';
            foreach ($backups as $backup_age => $data) {
                $time = isset($data['real']) ? $data['real'] : isset($data['time']) ? $data['time'] : '';
                $retval[] = '<option value="' . $backup_age . '"' . ($backup_age === $age ? ' selected="selected"' : '') . '>' . Time::format($time, false) . '</option>';
            }
            $retval[] = '</select>';
        } else {
            $retval[] = '<div class="panel panel-default">';
            $retval[] = '<div class="panel-heading">';
        }
        foreach ($actions as $val => $act_name) {
            $retval[] = '<label class="radio-inline">';
            $retval[] = '<input type="radio" name="action" value="' . $val . '"' . ($val === $action ? ' checked="checked"' : '') . ' />' . $act_name;
            $retval[] = '</label>';
        }
        if (IS_MOBILE) {
            $retval[] = '</fieldset>';
            $retval[] = '<input type="submit" value="' . $_backup_messages['btn_jump'] . '" />';
        } else {
            $retval[] = '<input type="submit"  class="btn btn-info" value="' . $_backup_messages['btn_jump'] . '" />';
            $retval[] = '</div>';
            $retval[] = '<div class="panel-body list_pages">';
            $retval[] = '<ol>';
            foreach ($backups as $backup_age => $data) {
                $time = isset($data['real']) ? $data['real'] : isset($data['time']) ? $data['time'] : '';
                $retval[] = '<li><input type="radio" name="age" value="' . $backup_age . '" id="r_' . $backup_age . '"' . ($backup_age === $age ? ' checked="checked"' : '') . ' /><label for="r_' . $backup_age . '">' . Time::format($time, false) . '</label>' . (!Auth::check_role('safemode') ? '<input type="checkbox" name="selectages[]" value="' . $backup_age . '" />' : '') . '</li>';
            }
            $retval[] = '</ol>';
            $retval[] = '</div>';
        }
    }
    $retval[] = '</form>';
    /*
    	$backups = _backup_file_exists($page) ? get_backup($page) : array();
    	if (empty($backups)) {
    		$retval[1] .= '   <li>' . str_replace('$1', make_pagelink($page), $_backup_messages['msg_nobackup']) . '</li>';
    		return join('', $retval);
    	}
    	$_anchor_from = $_anchor_to   = '';
    	$safemode = Auth::check_role('safemode');
    	foreach ($backups as $age=>$data) {
    		if (! PLUGIN_BACKUP_DISABLE_BACKUP_RENDERING) {
    			$_anchor_from = '<a href="' . get_cmd_uri('backup', $page, null, array('age'=>$age)) . '">';
    			$_anchor_to   = '</a>';
    		}
    		if (isset($data['real'])) {
    			$time = $data['real'];
    		}else if(isset($data['time'])){
    			$time = $data['time'];
    		}else{
    			$time = '';
    		}
    		$retval[1] .= '<li>';
    		if (! $safemode) {
    			$retval[1] .= '<input type="checkbox" name="selectages[]" value="'.$age.'" />';
    		}
    		$retval[1] .= $_anchor_from . format_date($time, TRUE) . $_anchor_to;
    
    		if (! $safemode) {
    			$retval[1] .= ' <nav class="navibar" style="display:inline;"><ul>';
    			$retval[1] .= '<li><a href="'. get_cmd_uri('backup', $page, null, array('action'=>'diff', 'age'=>$age)). '">' . $_backup_messages['msg_diff'] . '</a></li>';
    			$retval[1] .= '<li><a href="'. get_cmd_uri('backup', $page, null, array('action'=>'nowdiff', 'age'=>$age)). '">' . $_backup_messages['msg_nowdiff'] . '</a></li>';
    			$retval[1] .= '<li><a href="'. get_cmd_uri('backup', $page, null, array('action'=>'visualdiff', 'age'=>$age)). '">' . $_backup_messages['msg_visualdiff'] . '</a></li>';
    			$retval[1] .= '<li><a href="'. get_cmd_uri('backup', $page, null, array('action'=>'source', 'age'=>$age)). '">' . $_backup_messages['msg_source'] . '</a></li>';
    			if (PLUGIN_BACKUP_USE_ROLLBACK) {
    				$retval[1] .= '<li><a href="'. get_cmd_uri('backup', $page, null, array('action'=>'rollback', 'age'=>$age)). '">' . $_backup_messages['msg_rollback'] . '</a></li>';
    			}
    			$retval[1] .= '</ul></nav>';
    		}
    
    		$retval[1] .= '</li>'."\n";
    	}
    */
    return join("\n", $retval);
}
Example #8
0
 /**
  * ページ生成時間
  */
 private function getProcessTime()
 {
     // http://pukiwiki.sourceforge.jp/dev/?BugTrack2%2F251
     return sprintf('%01.03f', Time::getMicroTime() - $_SERVER['REQUEST_TIME']);
 }
Example #9
0
 /**
  * ファイルの経過時間を取得
  * @return string
  */
 public function passage()
 {
     return Time::passage($this->time());
 }
Example #10
0
function plugin_calendar_convert()
{
    global $vars, $post, $get, $_labels;
    //global $_calendar_plugin_edit, $_calendar_plugin_empty;
    global $_calendar_msg;
    if (!isset($vars['page'])) {
        return '';
    }
    /* from Plus! */
    $today_view = TRUE;
    $today_args = 'view';
    $date_str = Time::getZoneTimeDate('Ym');
    $base = Utility::stripBracket($vars['page']);
    $today_view = TRUE;
    if (func_num_args() > 0) {
        $args = func_get_args();
        foreach ($args as $arg) {
            if (is_numeric($arg) && strlen($arg) == 6) {
                $date_str = $arg;
            } else {
                if ($arg == 'off') {
                    $today_view = FALSE;
                } else {
                    if ($arg == 'past' || $arg == 'pastex' || $arg == 'future' || $arg == 'futureex' || $arg == 'view' || $arg == 'viewex') {
                        /* from Plus! */
                        $today_args = $arg;
                    } else {
                        $base = Utility::stripBracket($arg);
                    }
                }
            }
        }
    }
    if ($base == '*') {
        $base = '';
        $prefix = '';
    } else {
        $prefix = $base . '/';
    }
    $s_base = Utility::htmlsc($base);
    $s_prefix = Utility::htmlsc($prefix);
    $yr = substr($date_str, 0, 4);
    $mon = substr($date_str, 4, 2);
    if ($yr != get_date('Y') || $mon != get_date('m')) {
        $now_day = 1;
        $other_month = 1;
    } else {
        $now_day = get_date('d');
        $other_month = 0;
    }
    $today = getdate(mktime(0, 0, 0, $mon, $now_day, $yr));
    $m_num = $today['mon'];
    $d_num = $today['mday'];
    $year = $today['year'];
    $f_today = getdate(mktime(0, 0, 0, $m_num, 1, $year));
    $wday = $f_today['wday'];
    $day = 1;
    $m_name = Time::format($today[0], false, $_calendar_msg['_calendar_title_format']);
    $y = substr($date_str, 0, 4) + 0;
    $m = substr($date_str, 4, 2) + 0;
    $format = '%04d%02d';
    $prev_link = Router::get_cmd_uri('calendar', '', '', array('file' => $base, 'mode' => $today_args, 'date' => $m == 1 ? sprintf($format, $y - 1, 12) : sprintf($format, $y, $m - 1)));
    $next_link = Router::get_cmd_uri('calendar', '', '', array('file' => $base, 'mode' => $today_args, 'date' => $m == 12 ? sprintf($format, $y + 1, 1) : sprintf($format, $y, $m + 1)));
    $this_date_str = sprintf($format, $y, $m);
    $page_YM = sprintf('%04d-%02d', $y, $m);
    $ret = '';
    if ($today_view === TRUE) {
        $ret .= '<div class="clearfix">' . "\n" . '<div class="style_calendar_viewer">' . "\n";
        // カレンダーのdivタグ($today_view有効時のみ出力)
    }
    $ret .= <<<EOD
<table class="table table-bordered style_calendar" summary="calendar" data-sortable="false">
\t<thead>
\t\t<tr>
\t\t\t<td class="style_calendar_top" colspan="7">
\t\t\t\t<nav>
\t\t\t\t\t<ul class="style_calendar_navi">
\t\t\t\t\t\t<li class="style_calendar_prev"><a href="{$prev_link}">&lt;&lt;</a></li>
\t\t\t\t\t\t<li class="style_calendar_title"><strong>{$m_name}</strong></li>
\t\t\t\t\t\t<li class="style_calendar_next"><a href="{$next_link}">&gt;&gt;</a></li>
\t\t\t\t\t</ul>
\t\t\t\t</nav>
EOD;
    if ($vars['cmd'] == 'calendar' || $vars['cmd'] == 'calendar_viewer') {
        $base_link = Factory::Wiki($base)->uri();
    } else {
        $base_link = Router::get_cmd_uri('calendar', '', '', array('file' => $base, 'mode' => $today_args, 'date' => sprintf($format, $y, $m)));
    }
    if ($prefix) {
        $ret .= "\n" . '				[<a href="' . $base_link . '">' . $s_base . '</a>]';
    }
    $ret .= "\n" . '			</td>' . "\n" . '		</tr>' . "\n" . '	</thead>' . "\n" . '	<tbody>' . "\n" . '		<tr>' . "\n";
    for ($i = 0; $i < 7; $i++) {
        if ($i == 0) {
            $class = 'week_sun';
        } else {
            if ($i == 6) {
                $class = 'week_sat';
            } else {
                $class = 'week_day';
            }
        }
        $ret .= '			<th class="style_calendar_week"><abbr title="' . $_labels['week'][$i][1] . '" class="' . $class . '">' . $_labels['week'][$i][0] . '</abbr></th>' . "\n";
    }
    unset($i, $class);
    $ret .= '		</tr>' . "\n" . '		<tr>' . "\n";
    // Blank
    for ($i = 0; $i < $wday; $i++) {
        $ret .= '			<td class="blank-cell"></td>' . "\n";
    }
    while (checkdate($m_num, $day, $year)) {
        $dt = sprintf(PLUGIN_CALENDAR_PAGENAME_FORMAT, $year, $m_num, $day);
        $page = $prefix . $dt;
        $s_page = Utility::htmlsc($page);
        $wiki = Factory::Wiki($page);
        if ($wday == 0 && $day > 1) {
            $ret .= '		</tr>' . "\n" . '		<tr>' . "\n";
        }
        /* from Plus! */
        $h_today = PublicHolidayFactory::factory('JP', $year, $m_num, $day);
        $hday = $h_today['rc'];
        $style = 'style_calendar_day';
        // Weekday
        if (!$other_month && $day == $today['mday'] && $m_num == $today['mon'] && $year == $today['year']) {
            // Today
            $style = 'style_calendar_today';
        } else {
            if ($hday !== 0) {
                // Holiday
                $style = 'style_calendar_holiday';
            } else {
                if ($wday == 0) {
                    // Sunday
                    $style = 'style_calendar_sun';
                } else {
                    if ($wday == 6) {
                        // Saturday
                        $style = 'style_calendar_sat';
                    }
                }
            }
        }
        if ($wiki->has()) {
            $link = '<a href="' . $wiki->uri() . '" title="' . $s_page . '"><strong>' . $day . '</strong></a>';
        } else {
            if (PKWK_READONLY) {
                $link = $day;
            } else {
                $link = '<a href="' . $wiki->uri('edit', array('refer' => $base)) . '" title="' . $s_page . '" rel="nofollow">' . $day . '</a>';
            }
        }
        $ret .= '<td class="style_td ' . $style . '">' . $link . '</td>' . "\n";
        ++$day;
        $wday = ++$wday % 7;
    }
    if ($wday > 0) {
        while ($wday++ < 7) {
            // Blank
            $ret .= '<td class="style_td_blank"></td>' . "\n";
        }
    }
    $ret .= '</tr>' . "\n" . '</tbody>' . "\n" . '</table>' . "\n";
    if ($today_view) {
        $ret .= '</div>' . "\n";
        // カレンダーのdivタグを閉じる
        $ret .= '<section class="style_calendar_post">' . "\n";
        if ($today_args == '') {
            $str = '<article id="' . $tpage . '" class="style_calendar_post">' . "\n";
            $tpage = $prefix . sprintf(PLUGIN_CALENDAR_PANENAME_FORMAT, $today['year'], $today['mon'], $today['mday']);
            $t_wiki = Factory::Wiki($tpage);
            if ($t_wiki->has()) {
                $_page = $vars['page'];
                $get['page'] = $post['page'] = $vars['page'] = $tpage;
                preg_replace('/^#navi/', '/\\/\\/#navi/', $source);
                $str .= $t_wiki->render();
                $str .= '<hr /><a href="' . $t_wiki->uri('edit', $tpage) . '">' . $_calendar_msg['_edit'] . '</a>';
                $get['page'] = $post['page'] = $vars['page'] = $_page;
            } else {
                $str .= sprintf($_calendar_msg['_empty'], make_pagelink($prefix . sprintf(PLUGIN_CALENDAR_PANENAME_FORMAT, $today['year'], $today['mon'], $today['mday'])));
            }
            $str .= '</article>' . "\n";
        } else {
            $aryargs = array(rawurldecode($base), $page_YM, $today_args);
            if (exist_plugin('calendar_viewer')) {
                T_bindtextdomain('calendar_viewer', LANG_DIR);
                T_textdomain('calendar_viewer');
                $str = call_user_func_array('plugin_calendar_viewer_convert', $aryargs);
                T_textdomain('calendar');
            }
        }
        $ret .= $str . "\n";
        $ret .= '</section>' . "\n";
        $ret .= '</div>' . "\n";
    }
    return $ret;
}
Example #11
0
function plugin_popular_getlist($view, $max = PLUGIN_POPULAR_DEFAULT, $except)
{
    static $localtime;
    if (!isset($localtime)) {
        list($zone, $zonetime) = Time::setTimeZone(DEFAULT_LANG);
        $localtime = UTIME + $zonetime;
    }
    $today = gmdate('Y/m/d', $localtime);
    // $yesterday = gmdate('Y/m/d', strtotime('yesterday', $localtime));
    $yesterday = gmdate('Y/m/d', gmmktime(0, 0, 0, gmdate('m', $localtime), gmdate('d', $localtime) - 1, gmdate('Y', $localtime)));
    $counters = array();
    foreach (Listing::pages() as $page) {
        if (!empty($except) && preg_match("/" . $except . "/", $page)) {
            continue;
        }
        $wiki = Factory::Wiki($page);
        if (!$wiki->isReadable() || $wiki->isHidden() || !$wiki->isValied()) {
            continue;
        }
        //$count_file = COUNTER_DIR . str_replace('.txt','.count', $file);
        $count_file = COUNTER_DIR . Utility::encode($page) . '.count';
        if (file_exists($count_file)) {
            $array = file($count_file);
            $count = rtrim($array[0]);
            $date = rtrim($array[1]);
            $today_count = rtrim($array[2]);
            $yesterday_count = rtrim($array[3]);
            $counters['_' . $page] = 0;
            if ($view == 'today' or $view == 'recent') {
                // $pageが数値に見える(たとえばencode('BBS')=424253)とき、
                // array_splice()によってキー値が変更されてしまうのを防ぐ
                // ため、キーに '_' を連結する
                if ($today == $date) {
                    $counters['_' . $page] = $today_count;
                }
            }
            if ($view == 'yesterday' or $view == 'recent') {
                if ($today == $date) {
                    $counters['_' . $page] += $yesterday_count;
                } elseif ($yesterday == $date) {
                    $counters['_' . $page] += $today_count;
                }
            }
            if ($view == 'total') {
                $counters['_' . $page] = $count;
            }
            if ($counters['_' . $page] == 0) {
                unset($counters['_' . $page]);
            }
        }
    }
    asort($counters, SORT_NUMERIC);
    // BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5
    $counters = array_reverse($counters, TRUE);
    // with array_splice()
    if ($max && $max != 0) {
        $counters = array_splice($counters, '0', $max);
    }
    return $counters;
}
Example #12
0
function plugin_referer_body($data)
{
    global $_referer_msg;
    global $referer;
    $config_referer = plugin_referer_get_config();
    // 構成定義ファイル読込
    $IgnoreHost = array_merge($config_referer['spam'], $config_referer['misc']);
    $sort_last = '0d';
    $sort_1st = '1d';
    $sort_ctr = '2d';
    usort($data, function ($a, $b) {
        return $b[0] - $a[0];
    });
    $arrow_last = $_referer_msg['msg_Chr_darr'];
    $sort_last = '0a';
    $body = array();
    $body[] = '<table summary="Referer" class="table table-bordered referer_table" data-pagenate="true">';
    $body[] = '<thead>';
    $body[] = '<tr>';
    $body[] = '<th>' . $_referer_msg['msg_Hed_LastUpdate'] . '</th>';
    $body[] = '<th>' . $_referer_msg['msg_Hed_1stDate'] . '</th>';
    $body[] = '<th style="text-align:right">' . $_referer_msg['msg_Hed_RefCounter'] . '</th>';
    $body[] = '<th>' . $_referer_msg['msg_Hed_Referer'] . '</th>';
    $body[] = '</tr>';
    $body[] = '</thead>';
    $body[] = '<tbody>';
    $ctr = 0;
    foreach ($data as $x) {
        // 'scheme', 'host', 'port', 'user', 'pass', 'path', 'query', 'fragment'
        // 0:最終更新日時, 1:初回登録日時, 2:参照カウンタ, 3:Referer ヘッダ, 4:利用可否フラグ(1は有効)
        list($ltime, $stime, $count, $url) = $x;
        $uri = isset($url) ? parse_url($url) : null;
        if (strpos($uri['host'], '.') == '') {
            continue;
        }
        // ホスト名にピリオドが1つもない
        if (plugin_referer_ignore_check($uri['host'])) {
            continue;
        }
        $sw = 0;
        foreach ($IgnoreHost as $y) {
            if (strpos($uri['host'], $y) !== FALSE) {
                $sw = 1;
                continue;
            }
        }
        if ($sw) {
            continue;
        }
        if ($count < 0) {
            continue;
        }
        // 項目不正の場合の対応
        // カウンタが数値ではない場合は、表示を抑止
        if (!is_numeric($count)) {
            continue;
        }
        $sw_ignore = plugin_referer_ignore_check($url);
        if ($sw_ignore && $referer > 1) {
            continue;
        }
        // 非ASCIIキャラクタ(だけ)をURLエンコードしておく BugTrack/440
        //$e_url = htmlsc(preg_replace('/([" \x80-\xff]+)/e', 'rawurlencode("$1")', $url));
        $e_url = preg_replace_callback('([" \\x80-\\xff]+)', function ($m) {
            return isset($m[1]) ? rawurlencode($m[1]) : null;
        }, $url);
        $s_url = mb_convert_encoding(rawurldecode($url), SOURCE_ENCODING);
        $s_url = Utility::htmlsc(mb_strimwidth($s_url, 0, REFERE_TITLE_LENGTH, '...'));
        $lpass = Time::passage($ltime);
        // 最終更新日時からの経過時間
        $spass = Time::passage($stime);
        // 初回登録日時からの経過時間
        $ldate = Time::getZoneTimeDate($_referer_msg['msg_Fmt_Date'], $ltime);
        // 最終更新日時文字列
        $sdate = Time::getZoneTimeDate($_referer_msg['msg_Fmt_Date'], $stime);
        // 初回登録日時文字列
        $body[] = '<tr>';
        $body[] = '<td>' . $ldate . ' (' . $lpass . ')</td>';
        $body[] = $count == 1 ? '<td>N/A</td>' : '<td>' . $sdate . ' (' . $spass . ')</td>';
        $body[] = '<td style="text-align:right;">' . $count . '</td>';
        // 適用不可データのときはアンカーをつけない
        $body[] = $sw_ignore ? '<td>' . $s_url . '</td>' : '<td><a href="' . $e_url . '" rel="nofollow noreferer external">' . $s_url . '</a></td>';
        $body[] = '</tr>';
        $ctr++;
    }
    $body[] = '</tbody>';
    $body[] = '</table>';
    if ($ctr === 0) {
        return '<p class="alert alert-warning">' . $_referer_msg['msg_no_data'] . '</p>';
    }
    return join("\n", $body);
}
Example #13
0
 function format_cell($timestamp)
 {
     return Time::passage($timestamp, FALSE);
 }
Example #14
0
        mkdir($dir);
        chmod($dir, 0755);
    }
    if (!is_writable($dir)) {
        $die[] = sprintf($_string['not_writable'], $dir);
    }
}
unset($d, $dir);
/////////////////////////////////////////////////
// QUERY_STRINGを取得
$vars = Utility::parseArguments();
// ここの処理はそのうち全部書き直し
/////////////////////////////////////////////////
// 初期設定(その他のグローバル変数)
// 現在時刻
$now = Time::format(UTIME);
//////////////////////////////////////////////////
// ajaxではない場合
// スキンデーター読み込み
defined('IS_MOBILE') or define('IS_MOBILE', false);
if (IS_MOBILE === true) {
    define('SKIN_FILE', 'mobile');
} else {
    define('SKIN_FILE', PLUS_THEME);
}
/*
if ( isset($auth_api['facebook']) ){
	if (extension_loaded('curl')){
		$fb = new FaceBook($auth_api['facebook']);
		// FaceBook Integration
		$fb_user = $fb->getUser();