예제 #1
0
파일: view.php 프로젝트: robbat2/rats
                $s = $tableName . '.' . $wherecol . ' LIKE ' . MySQL_quote($wheredata);
                break;
            case 'gnuregex':
                $s = $tableName . '.' . $wherecol . ' REGEX ' . MySQL_quote($wheredata);
                break;
        }
        $newwhere .= $s;
    } else {
        $newwhere = $wherecurrent;
    }
    if ($newwhere != '') {
        $where = ' WHERE ' . $newwhere;
    } else {
        $where = '';
    }
    $query = $tableData[$tableName]['_view_sql_final'] . $where . $orderby;
    if (dodbg(2)) {
        echo "Query: " . $query;
    }
    $headtmp = array_subkey($tableData[$tableName], 'longname');
    $head = array();
    foreach ($headtmp as $key => $value) {
        if ($key[0] != '_') {
            $head[$key] = $value;
        }
    }
    drawTableTopSQL($tableData[$tableName], $newwhere, $tableName);
    drawTableSQL($head, $query, TRUE, $tableName, $tablePerm['edit'], $tablePerm['delete']);
}
include './footer.inc.php';
/* vim: set ft=php expandtab shiftwidth=4 softtabstop=4 tabstop=4: */
예제 #2
0
파일: _events.php 프로젝트: nopticon/mag
    public function home()
    {
        global $core;
        // all today tomorrow week future
        $v = $this->__(array('f', 'p' => 0));
        if (!($event_type = $core->cache_load('events_type'))) {
            $sql = 'SELECT type_id, type_alias
				FROM _events_type
				ORDER BY type_order';
            $event_type = $core->cache_store('events_type', _rowset($sql, 'type_alias', 'type_id'));
        }
        if ($v['f'] && !isset($event_type[$v['f']])) {
            _fatal();
        }
        $sql = 'SELECT *
			FROM _events
			ORDER BY event_date ASC';
        $list = _rowset($sql);
        $events = w();
        foreach ($list as $row) {
            $type = $this->_when($row['event_date'], $row['event_images']);
            $events[$type][] = $row;
        }
        unset($list);
        if ($v['f']) {
            $events = array($v['f'] => $events[$v['f']]);
        }
        foreach ($events as $k => $z) {
            switch ($k) {
                case '':
                    break;
            }
        }
        // Gallery
        if (isset($events['gallery'])) {
            @krsort($events['gallery']);
            if (!($events['gallery'] = array_slice($events['gallery'], $v['g'], $core->v('gallery_pages')))) {
                _fatal();
            }
            $sql = 'SELECT *
				FROM _events_images
				WHERE event_id IN (??)
				ORDER BY RAND()';
            $i_random = _rowset(sql_filter($sql, _implode(',', array_subkey($events['gallery'], 'event_id'))), 'event_id', 'image');
            foreach ($events['gallery'] as $i => $row) {
                if (!$i) {
                    _style('gallery', _pagination(_link($this->m()), 'g:%d', count($events['gallery']), $core->v('gallery_pages'), $v['g']));
                }
                _style('gallery.row', array('URL' => _link($this->m(), $row['event_alias']), 'TITLE' => $row['event_subject'], 'IMAGE' => _lib(w(LIB_EVENT . ' thumbnail ' . $row['event_id']), $i_random[$row['event_id']], 'jpg'), 'TIME' => _format_date($row['event_date'], _lang('DATE_FORMAT'))));
            }
            unset($events['gallery']);
        }
        if (is_ghost()) {
            return;
        }
        $attend_event = $attend_id = w();
        foreach ($events as $row) {
            foreach ($row as $row2) {
                $attend_id = array_merge($attend_id, array_subkey($row2, 'event_id'));
            }
        }
        if (count($attend_id)) {
            if ($bio->v('auth_member')) {
                $sql = 'SELECT attend_event, attend_option
					FROM _events_attend
					WHERE attend_event IN (??)
						AND attend_uid = ?';
                $attend_event = _rowset(sql_filter($sql, _implode(',', $attend_id), $bio->v('bio_id')), 'attend_event', 'attend_option');
            }
            $sql = 'SELECT *, COUNT(a.attend_uid) AS attendees
				FROM _events_attend_type t, _events_attend a
				WHERE a.attend_event IN (??)
					AND a.attend_option = t.type_id
				ORDER BY type_order';
            $types = _rowset(sql_filter($sql, _implode(',', $attend_id)), 'attend_event', false, true);
        }
        $i = 0;
        foreach ($events as $type => $type_row) {
            if (!$i) {
                _style('future');
            }
            _style('future.type', array('L_TITLE' => _lang('EVENTS_' . $event_type[$type])));
            foreach ($type_row as $row) {
                _style('future.type.row', array('URL' => _link($this->m(), $row['event_alias']), 'TITLE' => $row['event_subject'], 'DATE' => _format_date($row['event_date']), 'THUMBNAIL' => _lib(w(LIB_EVENT . ' preview'), $row['event_id'], 'jpg'), 'ATTEND_YES' => $row['event_attend_yes'], 'ATTEND_NO' => $row['event_attend_no'], 'U_ATTEND' => _link($this->m(), array($row['event_alias'], 'x1' => 'attend')), 'V_ATTEND' => isset($attend_event[$row['event_id']]) ? $attend_event[$row['event_id']] : -1));
            }
            $i++;
        }
        $this->monetize();
        _style('suggest', array('URL' => _link('suggest', 'event')));
        return;
    }
예제 #3
0
파일: _bio.php 프로젝트: nopticon/mag
    protected function _account_home()
    {
        global $bio, $core;
        if (_button()) {
            $sql = 'SELECT *
				FROM _bio_fields
				ORDER BY field_alias';
            $fields = _rowset($sql, 'field_alias');
            $v = $this->__(array_merge(w('address password password_verify gender' . _implode(' ', array_subkey($fields, 'field_alias'))), array('timezone' => 0, 'birthday' => array(0))));
            $field_error = array('address' => 'NO_ADDRESS', 'password' => 'NO_PASSWORD', 'password_verify' => 'NO_PASSWORD_VERIFY');
            foreach ($v as $k => $vv) {
                if (!f($vv)) {
                    $this->error('#');
                }
            }
            if (is_ghost() && $this->errors()) {
                $this->e('!');
            }
            redirect(_link('my', 'page'));
        }
        return;
        /*
        if (_button())
        {
        	if (!$this->errrors())
        	{
        		$avatar_changed = (isset($this->data['old_avatar'])) ? true : false;
        		
        		// Update DB if something was changed
        		if (sizeof($sql_update))
        		{
        			if (isset($sql_update['bio_avatar']))
        			{
        				if (f($bio->v('bio_avatar')))
        				{
        					@unlink('..' . $core->v('avatar_path') . $bio->v('bio_avatar'));
        				}
        				@rename($this->data['old_avatar'], '..' . $core->v('avatar_path') . $sql_update['bio_avatar']);
        			}
        		}
        		
        		// Redirect to userpage
        	}
        } // IF submit
        
        // Selects
        $this->ss_build('dateformat', 'timezone', 'gender', 'birthday', 'topic_order', 'mark_items');
        
        // Vars
        $sv = array(
        	'AVATAR_MAXSIZE' => $core->v('avatar_filesize'),
        	'L_AVATAR_EXPLAIN' => sprintf(_lang('AVATAR_EXPLAIN'), $core->v('avatar_max_width'), $core->v('avatar_max_height'))
        )
        + $this->fields_fvars();
        */
    }
예제 #4
0
파일: _ext.php 프로젝트: nopticon/npt
    protected function _artists_home()
    {
        // TODO: Add sorting methods by genre, country & more.
        $v = $this->__(w('by'));
        switch ($v->by) {
            case 'genre':
                // TODO: Add query
                $sql = 'SELECT b.bio_id, b.bio_alias, b.bio_name, b.bio_avatar, b.bio_avatar_up
					FROM _bio b, _bio_type t
					WHERE t.type_alias = ?
						AND b.bio_type = t.type_id
					ORDER BY b.bio_name';
                $artists = sql_rowset(sql_filter($sql, 'artist'));
                break;
            default:
                $allow_by = array('country' => 'c.country_name');
                $s_country = isset($allow_by[$v->by]) ? $allow_by[$v->by] . ',' : '';
                $sql = 'SELECT b.bio_id, b.bio_alias, b.bio_name, b.bio_avatar, b.bio_avatar_up
					FROM _bio b, _bio_type t, _countries c
					WHERE t.type_alias = ?
						AND b.bio_type = t.type_id
						AND b.bio_country = c.country_id
					ORDER BY ?? b.bio_name';
                $artists = sql_rowset(sql_filter($sql, 'artist', $s_country));
                break;
        }
        // Genres
        $sql = 'SELECT g.genre_alias, g.genre_name, r.relation_artist
			FROM _genres g, _genres_relation r
			WHERE g.genre_id = r.relation_genre
				AND r.relation_artist IN (??)
			ORDER BY g.genre_name';
        $genres = sql_rowset(sql_filter($sql, _implode(',', array_subkey($artists, 'bio_id'))), 'relation_artist', false, true);
        $i = 0;
        foreach ($artists as $row) {
            $first_letter = $row->bio_alias[0];
            if (f($v->sort) && $first_letter != $v->sort) {
                continue;
            }
            if (!$i) {
                _style('artists');
            }
            _style('artists.row', _vs(array('URL' => _link_bio($row->bio_alias), 'NAME' => $row->bio_name, 'IMAGE' => _avatar($row), 'GENRE' => _implode(', ', $genres[$row->bio_id])), 'v'));
            $i++;
        }
        if (!$i) {
            _style('artists_none');
        }
        return;
    }