public function action_index($photo_id = NULL) { /* * load all of the Caption This photos that haven't expired */ $caption_photos = ORM::factory('captionthisphoto')->where('to', '>=', date('Y-m-d'))->find_all(); if ($photo_id != NULL) { $photo = ORM::factory('photo')->where('id', '=', $photo_id)->find(); /* * try to load the photo provided via the url */ if ($photo->loaded()) { /* * check to see if from date is before to date */ if (strtotime($_POST['to']) < strtotime($_POST['from'])) { Message::set(Message::ERROR, "From date must be before to date."); Request::instance()->redirect(Helper_Photos::get_photo_url($photo)); return; } /* * check to see if form was posted and has both of the dates */ if (!empty($_POST['from']) && !empty($_POST['to'])) { $from_date = date('Y-m-d', strtotime($_POST['from'])); $to_date = date('Y-m-d', strtotime($_POST['to'])); $check_dates = DB::select('*')->from('caption_this_photos')->where('from', 'BETWEEN', array($from_date, $to_date))->or_where('to', 'BETWEEN', array($from_date, $to_date))->order_by('from', 'ASC')->execute(); if ($check_dates->count() > 0) { Message::set(Message::ERROR, "There is already a Caption This photo in the period you selected."); } else { $caption_this_photo = ORM::factory('captionthisphoto'); $caption_this_photo->from = date("Y-m-d", strtotime($_POST['from'])); $caption_this_photo->to = date("Y-m-d", strtotime($_POST['to'])); $caption_this_photo->photo_id = $photo_id; $caption_this_photo->save(); /* * if the photo was saved, show a success message */ if ($caption_this_photo->saved()) { Message::set(Message::SUCCESS, "Photo successfully set as Caption This photo from " . $_POST['from'] . " to " . $_POST['to'] . "."); Request::instance()->redirect('admin/backtalk'); } else { Message::set(Message::ERROR, "A problem occured while trying to set photo as Caption This photo."); } } } else { Message::set(Message::ERROR, "You must select the date range for Caption This photo."); } } else { Message::set(Message::ERROR, "This photo doesn't exist."); } } $this->template->content = View::factory('admin/photos/caption'); $this->template->content->set(array('caption_photos' => $caption_photos)); $this->template->styles = array('public/js/vendor/datepicker/jquery-ui-1.8.5.custom.css' => 'screen'); $this->template->scripts = array('public/js/vendor/jquery-ui-1.8.5.custom.min.js'); $this->template->sidebar = Widget::factory()->add(Helper_Default::admin_sidebar()); }
/** * Ajax endpoint for gathering all photos of the day by timestamp. * * @return void * @author Stevie McComb */ public function action_getpotds() { $photos = Model_DailyPhoto::allPhotos($_POST['olderThan'], $_POST['newerThan']); $ret = array(); foreach ($photos as $photo) { $ret[] = (object) array("id" => $photo->id, "name" => $photo->name, "created" => $photo->created, "timestamp" => $photo->creationDate(), "url" => Helper_Photos::get_photo_url($photo), "imageSource" => addcslashes(Helper_Photos::get($photo, "medium"), "'")); } echo json_encode($ret); exit; }
/** * Send comment to moderation. * * @param string $comment_id * @return void * @author Brent Allen */ public function action_moderate($comment_id) { $comment_id = filter_var($comment_id, FILTER_SANITIZE_NUMBER_INT); $comment = ORM::factory("comment", $comment_id); if ($comment->loaded()) { if ($comment->isFlaggable()) { $comment->moderation_status_id = Model_Comment::REVIEW_STATUS; } $comment->save(); Message::set(Message::SUCCESS, 'You have successfully passed this message on to moderation.'); $this->request->redirect(Helper_Photos::get_photo_url($comment->photo)); } else { Message::set(Message::ERROR, "Could not find the message indicated."); $this->request->redirect("/"); } }
protected function formatPhoto($ar, Model_Photo $photo) { $tags = array(); foreach ($photo->tags->find_all() as $tag) { $tags[] = $tag->name; } $ar['tags'] = $tags; $ar['author'] = $photo->user->display_name; $ar['permalink'] = Kohana::config("myshot.siteURL") . Helper_Photos::get_photo_url($photo); foreach ($ar as $name => &$item) { if ($name == 'thumbnail' || $name == 'small' || $name == 'medium' || $name == 'large' || $name == 'original') { $item = Kohana::config("myshot.cdn") . $item; } switch ($name) { case 'name': $ar['title'] = $item; unset($ar['name']); break; case 'caption': $ar['description'] = $item; unset($ar['caption']); break; case 'created': $ar['date_uploaded'] = date('Y-m-d\\TH:i:s', strtotime($item)); unset($ar['created']); break; case 'category_id': $ar['category'] = ORM::factory("category", $item)->name; unset($ar['category_id']); break; case 'title': case 'description': case 'date_uploaded': break; default: break; } } $ar['image_url'] = $ar['medium']; unset($ar['moderation_status_id']); unset($ar['user_id']); unset($ar['order']); unset($ar['view_count']); return $ar; }
<div class="more"><?php echo html::anchor('trophies', 'See All Trophies'); ?> </div> Trophy Case</div> <div id="trophy_container"> <div class="previous_container"> <a href="#">Previous</a> </div> <div id="trophy_carousel"> <ul class="thumbs"> <?php foreach ($honors as $honor) { ?> <li><?php $honor->honor->type == "award" ? Helper_Game::outputHonorImageWithToolTip($honor->honor, Helper_Game::IMAGE_105, Helper_Photos::get_photo_url($honor->photo)) : Helper_Game::outputHonorImageWithToolTip($honor->honor, Helper_Game::IMAGE_105, Helper_Account::get_public_account_url($honor->user)); ?> </li> <?php } ?> </ul> </div> <div class="next_container"> <a href="#">Next</a> </div> </div> <?php } if ($homeSpot) {
<div class="activity"> <div class="activity_left"> <div class="avatar_thumb_container"> <div class="activity_thumb"> <?php $avatarImg = html::image(Helper_Account::get_avatar($user, "thumb")); echo html::anchor(Helper_Account::get_public_account_url($user), $avatarImg); ?> </div> </div> </div> <div class="activity_right"> <div class="activity_title"><span class="user"><?php echo html::anchor(Helper_Account::get_public_account_url($user), $user->display_name); ?> </span> left a comment on <span class="user"><?php echo html::anchor(Helper_Photos::get_photo_url($photo), $photo->user->display_name . "'s"); ?> </span> photo</div> <div class="activity_comment"><?php echo $comment->comment; ?> </div> <div class="timestamp"><?php echo Helper_Game::displayTime(strtotime($activity->time_stamp)); ?> </div> </div> <div class="clear"></div> </div>
echo " last"; } ?> "> <div class="thumb_container"> <div class="thumb"><?php echo html::image(Helper_Photos::get($photo, 'medium'), array('alt' => $photo->name)); ?> </div> <div class="frame"><?php echo html::anchor(Helper_Photos::get_photo_url($photo), $photo->name); ?> </div> </div> <h2><?php echo html::anchor(Helper_Photos::get_photo_url($photo), $photo->name); ?> </h2> <p><?php echo date('F d, Y', strtotime($photo->created)); ?> <br /> <?php echo Helper_Photos::get_comment_link($photo); ?> <br /> <?php echo Helper_Photos::get_rating_stars($photo); ?> </p> </div>
<?php } ?> <h2>Photos</h2> <div class="thumb_container"> <div class="previous_container"> <div><a href="#">Previous</a></div> </div> <div id="carousel"> <ul class="thumbs"> <?php foreach ($user_photos as $sub_photo) { ?> <li><?php echo html::anchor(Helper_Photos::get_photo_url($sub_photo), html::image(Helper_Photos::get($sub_photo, 'thumbnail'), array('alt' => $sub_photo->name))); ?> </li> <?php } ?> </ul> </div> <div class="next_container"> <a href="#">Next</a> </div> </div> <div class="rating"> <?php echo form::open('ratings/on/' . $photo->id, array('class' => 'rating_form')); ?>
<div class="thumb_container"> <div class="thumb" style="background-image: url('<?php echo addcslashes(Helper_Photos::get($photo, "medium"), "'"); ?> ');" ></div> <div class="frame"><a href="/<?php echo Helper_Photos::get_photo_url($photo); ?> "><?php echo $photo->name; ?> </a></div> </div> <div class="details-container"> <h2><a href="/<?php echo Helper_Photos::get_photo_url($photo); ?> "><?php echo $photo->name; ?> </a></h2> <p><?php echo $photo->creationDate(); ?> <br /> <?php echo Helper_Photos::get_comment_link($photo); ?> <br /> <?php echo Helper_Photos::get_rating_stars($photo);
<?php $photoURL = html::anchor(Kohana::config('myshot.siteURL') . Helper_Photos::get_photo_url($photo), Kohana::config('myshot.siteURL') . Helper_Photos::get_photo_url($photo)); $userURL = html::anchor(Kohana::config('myshot.siteURL') . Helper_Account::get_public_account_url($user), Kohana::config('myshot.siteURL') . Helper_Account::get_public_account_url($user)); ?> NG Staff, <br /> A user has removed one of their photos. Please note that viewing the photo is no longer possible. <br /><br /> User name: <?php echo $user->username; ?> <br /> Display name: <?php echo $user->display_name; ?> <br /> User Profile: <?php echo $userURL; ?> <br /> Photo Title: <?php echo $photo->name; ?> <br /> Created: <?php echo $photo->created; ?> <br /> Original Link* : <?php echo $photoURL; ?>
public static function get_previous_link($photo, array $order_array, $link = TRUE) { if (in_array($photo->id, $order_array)) { Helper_Arr::set_pointer($photo->id, $order_array); if (!prev($order_array)) { end($order_array); } $prev = current($order_array); } if ($link === TRUE) { $previous_photo = ORM::factory('photo')->find($prev); $ret = html::anchor(Helper_Photos::get_photo_url($previous_photo), 'Previous', array('class' => 'previous')); } else { $ret = ORM::factory('photo')->find($prev); } return $ret; }