Ejemplo n.º 1
0
Archivo: art.php Proyecto: 4otaku/draw
	public function postprocess () {
		parent::postprocess();
		
		list(
			$this->data['weight'], 
			$this->data['weight_type']
		) = Transform_String::round_bytes($this->data['weight']);
	}
Ejemplo n.º 2
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;
	}
Ejemplo n.º 3
0
	public function postprocess () {

		if (!empty($this->data['meta']) && is_array($this->data['meta'])) {
			
			$singluar = Config::template('singular');
			$plural = Config::template('plural');			
			
			$this->data['base'] = '/'.$this->data['item_type'].'/';
			$this->data['base'] .= $this->data['area'] == 'main'? '' : $this->data['area'].'/';

			$this->data['meta_header'] = array();

			foreach ($this->data['meta'] as $type => $items) {
				
				if (count($items) < 2 && array_key_exists($type, $singluar)) {
					$this->data['meta_header'][$type] = $singluar[$type];
					
				} elseif (array_key_exists($type, $plural)) {
					$this->data['meta_header'][$type] = $plural[$type];
				}

				if ($type == 'tag') {
					foreach ($items as $tag) {
						if (!empty($tag['variants'])) {
							$this->data['have_tag_variants'] = true;
							break;
						}
					}
				}
			}
		}

		if (!empty($this->data['date'])) {
						
			$this->data['date'] = Database::date_to_unix($this->data['date']);
			
			$this->data['precise_date'] = Transform_String::rudate($this->data['date'], true);
			$this->data['date'] = Transform_String::rudate($this->data['date']);
		}
	}