示例#1
0
文件: _events.php 项目: nopticon/mag
 public function __construct()
 {
     parent::__construct();
     $this->_m(array('view' => w(), 'star' => w(), 'attend' => w(), 'tag' => w(), 'acp' => w('edit')));
     $this->auth(false);
     $g = getdate();
     $d = explode(' ', gmdate('j n Y', _localtime()));
     $v_week = $d[0] + (7 - ($g['wday'] - 1)) - (!$g['wday'] ? 7 : 0);
     $this->day['midnight'] = _timestamp($d[1], $d[0], $d[2]);
     $this->day['week'] = _timestamp($d[1], $v_week, $d[2]);
     $this->day['midnight_one'] = $this->day['midnight'] + 86400;
     $this->day['midnight_two'] = $this->day['midnight'] + 86400 * 2;
 }
示例#2
0
文件: project.php 项目: nopticon/mag
    protected function _analytics_store()
    {
        global $bio, $core;
        list($h, $d, $m, $y) = explode(' ', gmdate('G j n Y', _localtime()));
        $sql = 'SELECT *
			FROM _stats
			WHERE stat_page = ?
				AND stat_hour = ?
				AND stat_day = ?
				AND stat_month = ?
				AND stat_year = ?';
        if ($stat = sql_fieldrow(sql_filter($sql, $bio->page, $h, $d, $m, $y))) {
            $field_stat = $bio->v('auth_member') ? 'member' : 'guest';
            $sql = 'UPDATE _stats SET stat_' . $field_stat . ' = stat_' . $field_stat . ' + 1
				WHERE stat_id = ?';
            $sql = sql_filter($sql, $stat->stat_id);
            sql_run($sql);
        } else {
            if ($bio->v('auth_member')) {
                $sql_insert = array();
            } else {
                $sql_insert = array();
            }
            sql_put('_stats', $sql_insert);
        }
        return;
    }