Exemplo n.º 1
0
	public function pixlr ($query) {
		$info = Globals::user_info();
		if (empty($info['username'])) {
			$info = Database::get_full_row('user', 0);
		}
		
		$this->user_id = $info['id'];
		$alias = Meta_Author::get_alias_by_name($info['username']);
		
		$image_data = file_get_contents($query['image']);
		
		$this->save($image_data, $alias);		
		
		$this->redirect_address = '/gallery/author/'.$alias.'/';
	}
Exemplo n.º 2
0
	protected function test_rights ($query) {
		if ($query['type'] == 'art') {
			
			$params = array(
				$query['id'],
				Globals::user_info('id')
			);
			
			return Database::get_field('art', 'id', 'id = ? and user_id = ?', $params);
		}
		
		if ($query['type'] == 'author') {
			
			$user = Meta_Author::get_data_by_alias((array) $query['id']);
			if (empty($user)) {
				return false;
			}
			
			$user = current($user);
			
			return (Globals::user_info('username') == $user['name']);
		}		
	}
Exemplo n.º 3
0
	public function main ($query) {

		$this->items = Globals::user_info();
	}
Exemplo n.º 4
0
	public function description ($query) {
		
		$params = array();
		
		if (isset($query['meta']) && $query['meta'] == 'author' && isset($query['alias'])) {
			$params['type'] = 'author';
			$params['id'] = $query['alias'];
		} elseif (isset($query['id'])) {
			$params['type'] = 'art';
			$params['id'] = $query['id'];			
		} else {
			return;
		}
		
		$text = Database::get_row(
			'description', 
			array('text', 'pretty_text'),
			'type = ? and description_id = ?', 
			$params
		);
		
		if (!empty($text)) {
			$params = array_merge($params, $text);
		}
		
		if ($params['type'] == 'author') {
			$user = Meta_Author::get_data_by_alias((array) $params['id']);
			$user = current($user);
			$params['username'] = $user['name'];
		} else {
			$params['data'] = Database::get_full_row('art', $query['id']);
			$params['username'] = Database::get_field('user', 'username', $params['data']['user_id']);
			$params['alias'] = Meta_Author::get_alias_by_name($params['username']);
			$params['data']['weight'] = Transform_File::weight($params['data']['weight']);
			$params['data']['date'] = Transform_String::rudate(Database::date_to_unix($params['data']['date']));
		}
		
		$params['can_edit'] = ($params['username'] == Globals::user_info('username'));
		
		return $params;
	}
Exemplo n.º 5
0
	public function main () {
		
		return Globals::user_info();
	}