stop trying to get count from query
darcs-hash:20081120123146-84dde-299808e2ed7a793a8240ab1c54e71b27f51307c4.gz
This commit is contained in:
		| @@ -97,7 +97,7 @@ class GalleryAction extends Action { | ||||
|  | ||||
| 		# XXX: memcached results | ||||
| 		 | ||||
| 		$cnt = $other->query('SELECT profile.* ' . | ||||
| 		$other->query('SELECT profile.* ' . | ||||
| 					  'FROM profile JOIN subscription ' . | ||||
| 					  'ON profile.id = subscription.' . $lst . ' ' . | ||||
| 					  'WHERE ' . $usr . ' = ' . $profile->id . ' ' . | ||||
| @@ -105,32 +105,41 @@ class GalleryAction extends Action { | ||||
| 					  'ORDER BY subscription.created DESC ' .  | ||||
| 					  $lim); | ||||
| 		 | ||||
| 		if ($cnt == 0) { | ||||
| 			common_element('p', 'error', _('Nobody to show!')); | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| 		if ($display == 'list') { | ||||
| 			$profile_list = new ProfileList($other); | ||||
| 			$profile_list->show_list(); | ||||
| 			$cnt = $profile_list->show_list(); | ||||
| 		} else { | ||||
| 			$this->icon_list($profile, $cnt); | ||||
| 			$cnt = $this->icon_list($other); | ||||
| 		} | ||||
|  | ||||
| 		# For building the pagination URLs | ||||
| 		 | ||||
| 		$args = array('nickname' => $profile->nickname); | ||||
| 		 | ||||
| 		if ($display != 'list') { | ||||
| 			$args['display'] = $display; | ||||
| 		} | ||||
| 		 | ||||
| 		common_pagination($page > 1, | ||||
| 						  $cnt > $per_page, | ||||
| 						  $page, | ||||
| 						  $this->trimmed('action'), | ||||
| 						  array('nickname' => $profile->nickname)); | ||||
| 						  $args); | ||||
| 	} | ||||
|  | ||||
| 	function icon_list($other, $subs_count) { | ||||
| 	function icon_list($other) { | ||||
| 		 | ||||
| 		common_element_start('ul', $this->div_class()); | ||||
|  | ||||
| 		for ($idx = 0; $idx < min($subs_count, AVATARS_PER_PAGE); $idx++) { | ||||
| 		$cnt = 0; | ||||
| 		 | ||||
| 			$other->fetch(); | ||||
| 		while ($other->fetch()) { | ||||
|  | ||||
| 			$cnt++; | ||||
| 			 | ||||
| 			if ($cnt > AVATARS_PER_PAGE) { | ||||
| 				break; | ||||
| 			} | ||||
| 			 | ||||
| 			common_element_start('li'); | ||||
|  | ||||
| @@ -158,6 +167,8 @@ class GalleryAction extends Action { | ||||
| 		} | ||||
| 			 | ||||
| 		common_element_end('ul'); | ||||
| 		 | ||||
| 		return $cnt; | ||||
| 	} | ||||
| 	 | ||||
| 	function gallery_type() { | ||||
|   | ||||
| @@ -45,6 +45,8 @@ class ProfileList { | ||||
| 		} | ||||
| 		 | ||||
| 		common_element_end('ul'); | ||||
| 		 | ||||
| 		return $cnt; | ||||
| 	} | ||||
| 	 | ||||
| 	function show() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user