Exemplo n.º 1
0
    public function home()
    {
        global $bio, $core, $style;
        /*
        $sql = 'SELECT *
        	FROM _bio_auth
        	WHERE auth_assoc = ?
        		AND auth_bio = ?';
        if (!_fieldrow(sql_filter($sql, $_bio->bio_id, $bio->v('bio_id'))))
        {
        	// TODO: Admin notification if not authed
        	_fatal();
        }
        */
        //
        //
        $sql = 'SELECT bio_id, bio_alias, bio_name, bio_avatar, bio_avatar_up
			FROM _bio b, _followers f
			WHERE f.follower_local = ?
				AND f.follower_active = ?
				AND f.follower_remote = b.bio_id
			ORDER BY f.follower_top
			LIMIT ??';
        $followers = sql_rowset(sql_filter($sql, $_bio->bio_id, 1, $_bio->bio_top_follow));
        foreach ($followers as $i => $row) {
            if (!$i) {
                _style('followers');
            }
            _style('followers.row', array());
        }
        /*
        SELECT *
        FROM _bio_relation r, _bio_modules m, _bio_publish p
        WHERE r.relation_alias = ?
        	AND r.relation_id = m.module_relation
        	AND p.publish_module = m.module_id
        */
        switch ($v->tab) {
            case 'home':
                $sql = 'SELECT *
					FROM _bio_timeline
					WHERE timeline_bio = ?
					ORDER BY timeline_time DESC
					LIMIT ??, ??';
                $posts = sql_rowset(sql_filter($sql));
                break;
            default:
                $sql = 'SELECT *
					FROM _bio_timeline
					WHERE timeline_bio = ?
						AND timeline_module = ?
					ORDER BY timeline_time DESC
					LIMIT ??, ??';
                $posts = sql_rowset(sql_filter($sql));
                break;
        }
        $sql = 'SELECT relation_id
			FROM _bio_relation r, _bio_modules m, _bio_publish p
			WHERE p.publish_local = ?
				AND r.relation_alias = ?
				AND r.relation_id = m.module_relation
				AND p.publish_module = m.module_id
			ORDER BY p.publish_time DESC';
        $publish = sql_rowset(sql_filter($sql, $_bio->bio_id, $v->tab));
        foreach ($posts as $i => $row) {
            if (!$i) {
                _style('timeline');
            }
            $module = 'module_' . $row->module_alias;
            if (@method_exists($this, $module)) {
                $this->{$module}($_bio, $row);
            }
            //
            $style->set_filenames(array('module' => 'modules/' . $row->module_alias . '.htm'));
            $style->assign_var_from_handle('S_MODULE', 'module');
            _style('modules.row', _style_var('S_MODULE'));
        }
        return;
    }
Exemplo n.º 2
0
function _style_handler($f)
{
    global $style;
    $style->set_filenames(array('tmp' => $f));
    $style->assign_var_from_handle('S_TMP', 'tmp');
    return _style_var('S_TMP');
}