Pastoid

public function act

The page you are looking at now is at this URL: http://pastoid.com/aq9

This paste was last updated on March 5, 2009 at 12:44 pm.

php coderaw

	public function act_display_archives()
	{
		if ( ! empty( Controller::get_handler()->handler_vars['year'] ) ) {
			$year= intval( Controller::get_handler()->handler_vars['year'] );
			$this->assign( 'year', $year );
		}
		else {
			$year= intval( date('Y') );
			$this->assign( 'year', $year );
		}
		$collections= array();
		foreach ( array( 1=>'winter', 4=>'spring', 7=>'summer', 10=>'autumn' ) as $month => $season ) {
			$wheres= array();
			$params= array();
			$wheres[]= 'content_type= ?';
			$params[]= Post::type('entry');
			$wheres[]= 'status= ?';
			$params[]= Post::status('published');
 
			$query= 'SELECT * FROM ' . DB::table('posts');
 
			$start_month = new HabariDateTime;
			$end_month = new HabariDateTime;
 
			$start_month->set_date($year, $month, 1);
			$end_month->set_date($year, $month+3, 0)->set_time(12, 59, 59);
 
			$wheres[]= 'pubdate BETWEEN ? AND ?';
			$params[]= $start_month->sql;
			$params[]= $end_month->sql;
 
			$query.= ' WHERE ' . implode( " \nAND\n ", $wheres );
			$query.= ' ORDER BY pubdate ASC';
 
			$posts= DB::get_results( $query, $params, 'Post' );
 
			$collection= new stdClass;
			$collection->posts= $posts;
			$collection->start_month= $start_month;
			$collection->end_month= $end_month;
			$collection->description= $collection->start_month->format('F jS') . ' to ' . $collection->end_month->format('F jS');
			$collection->name= ucfirst( $season ) . ' ' . $year;
			$collection->image= file_exists( HABARI_PATH . '/user/themes/simpla/images/' . $season . '_' . $year . '.png' ) ? $season . '_' . $year . '.png' : $season . '.png';
			$collection->posts_count= count($collection->posts);
 
			$collections[$season]= $collection;
		}
		$this->assign( 'collections', $collections );
 
		$years= DB::get_results( 'SELECT DISTINCT YEAR(FROM_UNIXTIME(pubdate)) AS year from habari__posts ORDER BY year DESC', array(), 'QueryRecord' );
		$this->assign( 'collection_years', $years );
 
		$this->set_title( $year . ' Archives - ' . Options::get( 'title' ) );
		$this->display( 'entry.archives' );
	}

Toggle wordwrap

Referring DomainHits
Unknown Referer 127
www.mibbit.com 5
search.live.com 2
Is this paste spam?
<Hide