Esempio n. 1
0
 public function action_favorites($user = null)
 {
     if ($user === NULL) {
         Message::set(Message::NOTICE, 'User does not exist!');
         Request::instance()->redirect('/');
     } else {
         if (is_numeric($user)) {
             $account = ORM::factory('user')->where('id', '=', $user)->find();
         } else {
             $account = ORM::factory('user')->where('vanity_url', '=', $user)->find();
         }
         if ($account->loaded()) {
             if (!Helper_Account::is_approved($account)) {
                 Message::set(Message::NOTICE, 'User has not been approved!');
                 Request::instance()->redirect('/');
             }
         } else {
             Message::set(Message::NOTICE, 'User does not exist!');
             Request::instance()->redirect('/');
         }
     }
     if (!isset($account)) {
         Message::set(Message::NOTICE, 'User does not exist!');
         Request::instance()->redirect('/');
     }
     $this->template->content = View::factory("profile/favorites");
     $this->template->content->user = $account;
     $this->template->content->reel = Reel::factory($account->favorite_photos);
     $this->template->top = View::factory('profile/topper');
     $this->template->top->user = $account;
     $this->template->top->owner = $this->user;
     $this->template->top->photos = $account->viewablePhotos()->order_by(DB::expr('RAND()'))->limit(30)->find_all();
 }
Esempio n. 2
0
 public function action_save()
 {
     if (!$this->user->loaded()) {
         Message::set(Message::ERROR, "You must be logged in to create a slideshow.");
         $this->request->redirect("/");
         return;
     }
     if (!Helper_Account::is_approved()) {
         Message::set(Message::ERROR, "You must be approved to create a slideshow.");
         $this->request->redirect("/");
         return;
     }
     $slideshow = Model_Slideshow::getLastIncomplete($this->user);
     if ($slideshow->photos->find_all()->count() < 3) {
         Message::set(Message::ERROR, "You must have at least three images in your slideshow.");
         $this->request->redirect("slideshow/builder");
         return;
     }
     if ($slideshow->music_id == null || $slideshow->music_id == 0) {
         Message::set(Message::ERROR, "You must select music for your slideshow.");
         $this->request->redirect("slideshow/builder");
         return;
     }
     $slideshow->complete = 1;
     $slideshow->created = date("Y-m-d H:i:s");
     $slideshow->save();
     $this->request->redirect($slideshow->getLink());
 }
Esempio n. 3
0
 public function action_index($id)
 {
     $page = Model_Page::getBySlug($id, false);
     if (!$page || !$page->isPublished() && !Helper_Account::is_admin(Auth::instance()->get_user())) {
         $this->template->content = View::factory("errors/index");
         return;
     }
     $this->template->content = View::factory("page/index")->set("page", $page);
     $this->template->sidebar = Widget::factory()->add(Helper_Default::sidebar());
 }
Esempio n. 4
0
 public function action_remove($wid)
 {
     if (Helper_Account::is_admin(Auth::instance()->get_user())) {
         $wid = filter_var($wid, FILTER_SANITIZE_NUMBER_INT);
         $watcher = ORM::factory("WatchPhotographer", $wid);
         if ($watcher->loaded()) {
             $watcher->delete();
         }
     }
     $this->request->redirect("admin/watcher");
 }
Esempio n. 5
0
 public function action_index($id)
 {
     $gallery = Model_Gallery::getBySlug($id, false);
     if (!$gallery || !$gallery->isPublished() && !Helper_Account::is_admin(Auth::instance()->get_user())) {
         $this->template->content = View::factory("errors/index");
         return;
     }
     $this->template->content = View::factory("gallery/index")->set("gallery", $gallery);
     $this->template->content->reel = Reel::factory($gallery->photos);
     $this->template->sidebar = Widget::factory()->add(Helper_Default::sidebar());
 }
Esempio n. 6
0
 public function action_remove($wid)
 {
     if (Helper_Account::is_admin(Auth::instance()->get_user())) {
         $wid = filter_var($wid, FILTER_SANITIZE_NUMBER_INT);
         $potd = ORM::factory("DailyPhoto", $wid);
         if ($potd->loaded()) {
             $potd->delete();
         }
     }
     $this->request->redirect("admin/potd");
 }
Esempio n. 7
0
 private function determine_status()
 {
     if ($user = Auth::instance()->get_user()) {
         if (Helper_Account::is_approved()) {
             return 'accountstatus/registered';
         } elseif ($user->loaded()) {
             return 'accountstatus/pending';
         } else {
             return 'accountstatus/login';
         }
     } else {
         return 'accountstatus/login';
     }
 }
Esempio n. 8
0
 /**
  * Add caption on photo.
  *
  * @param string $photo_id 
  * @return void
  * @author Vladimir Kokovic
  */
 public function action_on($photo_id)
 {
     if (Helper_Account::is_approved()) {
         $caption = ORM::factory('caption');
         $caption->user_id = $this->user->id;
         $caption->caption = Arr::get($_POST, 'caption');
         $caption->photo_id = $photo_id;
         if ($caption->check()) {
             $caption->save();
             Message::set(Message::SUCCESS, 'You have successfully captioned this photo! It is currently waiting approval.');
             //Helper_Game::logEvent(Helper_Game::CAPTION, $this->user->id, $photo_id, array("caption" => $caption->caption));
             Request::instance()->redirect('photos/caption/' . $photo_id);
         } else {
             Message::set(Message::ERROR, $caption->validate()->errors('caption'));
         }
     }
 }
Esempio n. 9
0
 /**
  * Add comment on photo.
  *
  * @param string $photo_id 
  * @return void
  * @author Merrick Christensen
  */
 public function action_on($photo_id)
 {
     if (Helper_Account::is_approved()) {
         $comment = ORM::factory('comment');
         $comment->user_id = $this->user->id;
         $comment->comment = Arr::get($_POST, 'comment');
         $comment->photo_id = $photo_id;
         $comment->created = Date('Y-m-d H:i:s');
         if ($comment->check()) {
             $comment->save();
             Message::set(Message::SUCCESS, 'You have successfully commented on this photo! It is currently waiting approval.');
             Helper_Game::logEvent(Helper_Game::COMMENT, $this->user->id, array("comment" => $comment->id, "photo" => $photo_id));
             Request::instance()->redirect('photos/view/' . $photo_id);
         } else {
             Message::set(Message::ERROR, $comment->validate()->errors('comment'));
         }
     }
 }
Esempio n. 10
0
 public function action_rotate($degrees, $photo_id)
 {
     if (Helper_Account::is_admin($this->user)) {
         $photo = ORM::factory('photo')->where('id', '=', $photo_id)->find();
     } else {
         $photo = ORM::factory('photo')->where('user_id', '=', $this->user->id)->where('id', '=', $photo_id)->find();
     }
     if (!$photo->loaded()) {
         Message::set(Message::NOTICE, 'This photo does not exist, try uploading one!');
         Request::instance()->redirect('photos/upload');
     }
     $image = Image::factory(Kohana::config('myshot.basePath') . $photo->original);
     $image->rotate($degrees)->save();
     $photo->width = $image->width;
     $photo->height = $image->height;
     $photo_controller = new Controller_Photos(Request::instance());
     $large_image = $photo_controller->create_large(Kohana::config('myshot.basePath') . $photo->original, $photo);
     sleep(1);
     $photo_controller->create_medium($large_image, $photo);
     Request::instance()->redirect('canvas/photos/' . $photo_id);
 }
Esempio n. 11
0
 public function action_keys()
 {
     $total_other = 0;
     $total_user = 0;
     $keys = ORM::factory('key')->where("type", "=", "approve")->where("type", "=", "remove")->where("type", "=", "reset")->find_all();
     foreach ($keys as $key) {
         if (strtotime($key->created) < strtotime($this->interval)) {
             if (Helper_Account::is_approved($key->user)) {
                 // Just kill the key, it wasn't bound to approval.
                 $key->delete();
                 $total_other += 1;
             } else {
                 // Due to InnoDB the key will be deleted via cascade.
                 $key->user->delete();
                 $total_user += 1;
             }
         }
     }
     echo "Total reset and remove keys deleted: {$total_other}\n";
     echo "Total pending users deleted: {$total_user}\n";
     $total = $total_other + $total_user;
     echo "Total keys removed: {$total} \n";
 }
Esempio n. 12
0
<h1>Photographers to Watch</h1>
<div id="profile-container">
<?php 
foreach ($watchers as $watcher) {
    if ($watcher->user->loaded()) {
        ?>
	<div class="profile">
		<?php 
        echo HTML::anchor(Helper_Account::get_public_account_url($watcher->user), HTML::image(Helper_Account::get_avatar($watcher->user, 'medium')));
        echo new Element("p", date("M d, Y", strtotime($watcher->from)) . " - " . date("M d, Y", strtotime($watcher->to)), array("class" => "date-stamp"));
        if ($watcher->isFuture()) {
            echo HTML::anchor("admin/watcher/edit/{$watcher->id}", "change date", array("class" => "watcher-control edit"));
            echo HTML::anchor("admin/watcher/remove/{$watcher->id}", "remove", array("class" => "watcher-control delete"));
        }
        ?>
	</div>
	<?php 
    }
}
?>
</div>
Esempio n. 13
0
 public function action_delete()
 {
     $this->auto_render = false;
     $send_email = $_POST['sendEmail'];
     $photo_id = $_POST['photoID'];
     $photo = ORM::factory('photo')->where('id', '=', $photo_id)->find();
     $user = ORM::factory('user')->where('id', '=', $photo->user_id)->find();
     if (Helper_Account::is_admin()) {
         $photo = ORM::factory('photo')->where('id', '=', $photo_id)->find();
     } else {
         $photo = ORM::factory('photo')->where('id', '=', $photo_id)->where('user_id', '=', $this->user->id)->find();
     }
     if ($photo->loaded()) {
         if (Helper_Account::is_admin()) {
             if ($send_email != 'undefined' && $send_email == 'true') {
                 $reason = $_POST['emailComment'];
                 $additional_text = $_POST['otherText'];
                 if ($reason == 'other') {
                     $additional_text = $_POST['otherText'];
                 } else {
                     $additional_text = $reason;
                 }
                 $email_text = Helper_SendEmail::generate_email($photo->user_id, 'photo', $additional_text);
                 //creative variable naming ftw!
                 $post_office = Library_Notification::factory();
                 $letter_body = $email_text;
                 $letter = Library_Notification::new_message()->setSubject('NG Kids My Shot - Photo removed!')->setFrom(Kohana::config('email.from'))->setTo(array($user->email => 'Guardian of ' . $user->display_name))->setBody($letter_body, 'text/html');
                 $post_office->add_message($letter);
                 $post_office->send_messages();
             }
         } else {
             $email_text = View::factory("email/userremoved")->set("user", $user)->set("photo", $photo);
             $post_office = Library_Notification::factory();
             $letter_body = $email_text->render();
             $letter = Library_Notification::new_message()->setSubject('NG Kids My Shot - Photo removed by user')->setFrom(Kohana::config('email.from'))->setTo(Kohana::config('email.ng_staff'))->setBody($letter_body, 'text/html');
             $post_office->add_message($letter);
             $post_office->send_messages();
         }
         $photo_owner_id = $photo->user_id;
         //remove photo approval action here
         //-------------------
         $gameUser = Helper_Game::getUser($photo->user_id);
         $gameUser->removeItem($photo->id);
         $photo->delete();
         echo $photo_owner_id;
     }
 }
Esempio n. 14
0
    echo date('F d, Y', strtotime($awaiting_comment->created));
    ?>
</span></p>
				<p>
					<?php 
    echo $awaiting_comment->comment;
    ?>
				</p>
			</div>
		</div> <!-- END comment_container -->
		<?php 
}
?>
	</div> <!-- END comments -->
	<?php 
if (Helper_Account::is_approved()) {
    ?>
	<div class="add_a_comment">
		<?php 
    echo form::open('/photos/view/' . $photo->id);
    ?>
			<div class="title">
				<h2>Add a comment</h2>
				<div class="max_characters counter"></div>
			</div>
			<?php 
    echo form::textarea('comment', Arr::get($_POST, 'comment'), array('data-max' => '600', 'class' => 'word_count'));
    ?>
			<input type="submit" value="" class="submit" />
		<?php 
    echo form::close();
Esempio n. 15
0
<div id="edit-watcher">
<?php 
echo HTML::image(Helper_Account::get_avatar($watcher->user, 'medium'));
echo new Element("span", $watcher->user->display_name);
?>
	<div>
		<div class="content">
			<?php 
echo form::open('admin/watcher/update/' . $watcher->id, array('method' => 'post'));
echo form::label("from", "From: ");
echo form::input("from", date("m/d/Y", strtotime($watcher->from)), array("id" => "from", "name" => "from"));
echo form::label("to", "To: ");
echo form::input("to", date("m/d/Y", strtotime($watcher->to)), array("id" => "to", "name" => "to"));
echo form::submit("submit_dates", "Update", array('class' => 'ptw-submit'));
echo form::close();
?>

		</div>
	</div>
</div>
Esempio n. 16
0
<br /><br />
			
			<h3>Set User as Admin:</h3>
			<?php 
echo form::checkbox('admin_user', '1', Arr::get($_POST, 'admin_user', Helper_Account::is_admin($user)), array("id" => "confirm"));
?>
 Yes
            
            <h3>Set User as NG Staff:</h3>
      		<?php 
echo form::checkbox('ngstaff_user', '1', Arr::get($_POST, 'ngstaff_user', Helper_Account::is_ngstaff($user)), array("id" => "ngstaff_confirm"));
?>
 Yes

			<?php 
if (!Helper_Account::is_approved($user)) {
    echo new Element("div", HTML::anchor("admin/users/approve/" . $user->id, "Force Parent Approval"), array("style" => "margin-top:15px;"));
}
?>
		</div> <!-- END: title -->
		<div class="title_bottom"></div>
		<div class="submit_container">
			<ul class="buttons">
				<li><?php 
echo form::submit('submit', '', array('class' => 'save'));
?>
</li>
			</ul>
		</div>
	<?php 
echo form::close();
Esempio n. 17
0
if (count($following)) {
    ?>

    <div id="following" class="widget">
        <h2>Your Favorite Photographers</h2>
        <div class="thumb-window">
            <div class="thumbs" data-user-id="<?php 
    echo $loggedInUser->id;
    ?>
">
                <?php 
    foreach ($following as $follow) {
        $fuser = ORM::factory('user', $follow->user_id);
        if ($fuser->loaded()) {
            $avatarImg = html::image(Helper_Account::get_avatar($fuser, "thumbnail"));
            echo html::anchor(Helper_Account::get_public_account_url($fuser), $avatarImg, array("class" => "user-thumb", "data-game-id" => $follow->id));
        }
    }
    ?>
            </div>
        </div>
        <div class="controls">
            <?php 
    echo HTML::anchor("/", "See all", array("class" => "see-all"));
    ?>
            <div class="pagination">

            </div>
        </div>
    </div>
	<script>
Esempio n. 18
0
<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>
Esempio n. 19
0
<?php

if (!empty($watcher) && $watcher->user->loaded()) {
    ?>
<div id="photographer-to-watch">
    <h2>PHOTOGRAPHER TO WATCH</h2>
    <div class="photographer" style="background-image: url('<?php 
    echo addcslashes(Helper_Photos::get($photo, "medium"), "'");
    ?>
')">
        <?php 
    echo HTML::anchor(Helper_Account::get_public_account_url($watcher->user), $watcher->user->display_name, array("class" => "invisi-link"));
    ?>
        <div class="details-container">
            <?php 
    echo HTML::image(Helper_Account::get_avatar($watcher->user, "thumbnail"));
    echo new Element("p", HTML::anchor(Helper_Account::get_public_account_url($watcher->user), $watcher->user->display_name));
    echo new Element("p", "{$numPhotos} photos posted");
    ?>
        </div>
    </div>
    <p><a href="/photos/watch" class="see-all-photographers-link">Past Photographers to Watch</a></p>
</div>
<?php 
}
Esempio n. 20
0
 /**
  * Edit My Account
  *
  * @return void
  * @author Merrick Christensen
  */
 public function action_edit()
 {
     $this->template->content = View::factory('account/edit');
     $this->template->content->user = $this->user;
     $this->template->scripts = array('public/js/vendor/word-count.js', 'public/js/account/vanity_preview.js');
     $this->template->content->set(array('tv_shows' => Helper_Favorite::get_available_answers(1), 'musical_artists' => Helper_Favorite::get_available_answers(2), 'movies' => Helper_Favorite::get_available_answers(3), 'foods' => Helper_Favorite::get_available_answers(4), 'colors' => Helper_Favorite::get_available_answers(5), 'animals' => Helper_Favorite::get_available_answers(6), 'sports' => Helper_Favorite::get_available_answers(7), 'video_games' => Helper_Favorite::get_available_answers(8), 'school_subjects' => Helper_Favorite::get_available_answers(9), 'seasons' => Helper_Favorite::get_available_answers(10), 'app' => Helper_Favorite::get_available_answers(11), 'book' => Helper_Favorite::get_available_answers(12)));
     $this->template->sidebar = Widget::factory()->add(Helper_Default::sidebar());
     if ($_POST) {
         $original_post = $_POST;
         $user = $this->user;
         $post = $user->validate_create_edit($_POST);
         if ($post->check()) {
             /* If the user wants to change the display name */
             if ($user->display_name != $post['display_name']) {
                 /* Set new display name if it isn't in use already */
                 if (Helper_Account::display_name_exists($post['display_name'])) {
                     Message::set(MESSAGE::ERROR, array('Display name already in use!', 'The display name you entered (' . $post['display_name'] . ') is already in use, please choose another one. Reverting to your previous display name (' . $user->display_name . ').'));
                 } else {
                     //$user->display_name = $post['display_name']; //as of 3.0 user may no longer update their display name.
                 }
             }
             $user->gender = $post['gender'];
             $user->vanity_url = $post['vanity_url'];
             $user->newsletter = $post['newsletter'];
             $user->save();
             $this->add_favorites($original_post);
             Message::set(Message::SUCCESS, 'Successfully edited!');
             Request::instance()->redirect('profile');
         } else {
             Message::set(Message::ERROR, $post->errors('user'));
         }
     }
 }
Esempio n. 21
0
	            <th><h3>Email</h3></th>
	            <th><h3>Username</h3></th>
	            <th><h3>Admin</h3></th>
	            <th class="nosort" id="edit"><h3>Edit</h3></th>
	            <th class="nosort" id="delete"><h3>Delete</h3></th>
                <th class="nosort" id="flag"><h3>Flag</h3></th>
	        </tr>
	    </thead>
	    <tbody>
	    	<?php 
foreach ($users as $user) {
    $admin = Helper_Account::is_admin($user);
    ?>
	        <tr>
	            <td><?php 
    echo Helper_Account::get_public_account_link($user);
    ?>
</td>
	            <td><?php 
    echo $user->email;
    ?>
</td>
	            <td><?php 
    echo $user->username;
    ?>
</td>
	            <td id="edit">
	            	<?php 
    if ($admin) {
        echo HTML::image('public/js/vendor/tinytable/images/accept.png', array('alt' => '1'));
    } else {
Esempio n. 22
0
    echo date('F d, Y', strtotime($awaiting_caption->created));
    ?>
</span></p>
				<p class="caption">
					<?php 
    echo $awaiting_caption->caption;
    ?>
				</p>
			</div>
		</div> <!-- END comment_container -->
		<?php 
}
?>
	</div> <!-- END comments -->
	<?php 
if (Helper_Account::is_approved() && $caption_this_photo->isActive) {
    ?>
	<div class="add_a_comment">
		<?php 
    echo form::open('/backtalk/submit/' . $photo->id);
    ?>
			<div class="title">
				<h2>Add a Back Talk</h2>
				<div class="max_characters counter"></div>
			</div>
			<?php 
    echo form::textarea('caption', Arr::get($_POST, 'caption'), array('data-max' => '40', 'class' => 'word_count'));
    ?>
			<input type="submit" value="" class="submit" />
		<?php 
    echo form::close();
Esempio n. 23
0
foreach ($slideshow->getOrderedPhotos() as $photo) {
    ?>
				<div class="slide">
					<?php 
    echo html::image(Helper_Photos::get($photo, 'medium'), array('alt' => $photo->name));
    ?>
				</div>
				<?php 
}
?>
			</div>
		</div>
		<div class="cap">
			<div class="text">
				<p>Slideshow by: <?php 
echo "<a href=\"/" . Helper_Account::get_public_account_url($user) . "\">" . substr($user->display_name, 0, 7) . (strlen($user->display_name) > 7 ? "&#8230;" : "") . "</a>";
?>
</a></p>
			</div>

			<div class="controls">
				<audio preload>
					<source src="<?php 
echo $slideshow->music->mp3;
?>
" />
					<source src="<?php 
echo $slideshow->music->ogg;
?>
" />
				</audio>
Esempio n. 24
0
		<div class="cap">
			<div class="text">
				<p>Photo by: <?php 
echo Helper_Account::get_public_account_link($photo->user);
?>
</p>
                <p>Username: <?php 
echo Helper_Account::get_account_username($photo->user);
?>
</p>
                <p>Age: <?php 
echo Helper_Account::get_account_age($photo->user);
?>
</p>
                <p>E-Mail: <?php 
echo Helper_Account::get_account_email($photo->user);
?>
</p> 
                <p><?php 
echo Helper_Photos::get_original_photo_dimensions($photo);
?>
</p>
			</div>
			<div class="controls">
				<p><?php 
echo date('F d, Y', strtotime($photo->created));
?>
</p>
			</div>
		</div>
	</div> <!-- END photo_container -->
Esempio n. 25
0
<div class="detail_container">
	<div class="photo_container">
		<div class="photo">
			<div class="inner">
				<div class="photo_img">
					<?php 
echo html::image(Helper_Photos::get($photo, 'medium'));
?>
				</div>
			</div>
		</div>
	</div> <!-- END photo_container -->
	<div class="submit_container">
        <?php 
if (Helper_Account::is_admin()) {
    $photo_mail_options = Helper_SendEmail::get_photo_options();
    ?>
            
                    <?php 
    echo form::open('admin/photos/send_email/' . $photo->user_id, array('method' => 'post'));
    ?>
                    <div class="title">
                      <p><strong>Email User: </strong><?php 
    echo form::checkbox('send_email' . $photo->id, 'send_email' . $photo->id, false, array("id" => "send_email" . $photo->id, "class" => "send_email_option"));
    ?>
 <label for="<?php 
    echo 'send_email' . $photo->id;
    ?>
">Yes</label></p>                                     
                    </div>
                    <div id="email_options">
Esempio n. 26
0
 /**
  * Edit a user
  *
  * @return void
  * @author Will Robertson
  */
 public function action_edit($user_id = null)
 {
     $user = ORM::factory('user')->where('id', '=', $user_id)->find();
     /* Load the view. */
     $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', 'public/js/vendor/word-count.js', 'public/js/account/vanity_preview.js');
     $content = $this->template->content = View::factory('admin/users/edit');
     $this->template->sidebar = Widget::factory()->add(Helper_Default::admin_sidebar());
     if ($user->loaded()) {
         $this->template->content->set(array('user' => $user));
     } else {
         Message::set(Message::NOTICE, "This user does not exist.");
         Request::instance()->redirect('admin/users');
     }
     if ($_POST) {
         /* Do they want to make this user an admin? */
         $set_admin_user = Arr::get($_POST, 'admin_user');
         /* Do they want to make this user a NG Staff member? */
         $set_ngstaff_user = Arr::get($_POST, 'ngstaff_user');
         /* Load the validation rules, filters etc.*/
         $post = $user->validate_update($_POST);
         /* If the post data validates using the rules setup in the user model. */
         if ($post->check()) {
             $admin_role = new Model_Role(array('name' => 'admin'));
             $ngstaff_role = new Model_Role(array('name' => 'ngstaff'));
             if ($set_admin_user) {
                 if (!Helper_Account::is_admin($user)) {
                     $user->add('roles', $admin_role);
                 }
             } else {
                 $user->remove('roles', $admin_role);
             }
             if ($set_ngstaff_user) {
                 if (!Helper_Account::is_ngstaff($user)) {
                     $user->add('roles', $ngstaff_role);
                 }
             } else {
                 $user->remove('roles', $ngstaff_role);
             }
             /* Affects the sanitized vars to the user object. */
             $user->email = $post['email'];
             $user->username = $post['username'];
             /* If the user wants to change the display name */
             if ($user->display_name != $post['display_name']) {
                 /* Set new display name if it isn't in use already */
                 if (Helper_Account::display_name_exists($post['display_name'])) {
                     echo 'problem';
                     Message::set(MESSAGE::ERROR, array('Display name already in use!', 'The display name you entered (' . $post['display_name'] . ') is already in use, please choose another one. Reverting to your previous display name (' . $user->display_name . ').'));
                 } else {
                     $user->display_name = $post['display_name'];
                 }
             }
             $user->birthdate = $post['birthdate'];
             $user->gender = $post['gender'];
             $user->vanity_url = $post['vanity_url'];
             /* Create the account. */
             $user->save();
             /* Redirect to users edit page. */
             Request::instance()->redirect('admin/users');
         } else {
             /* Get errors for display in view. */
             Message::set(Message::ERROR, $post->errors("user"));
         }
     }
 }
Esempio n. 27
0
">
				<div class="photographer" style="background-image: url('<?php 
    echo addcslashes(Helper_Photos::get($photographer->photos->find(), "medium"), "'");
    ?>
')">
					<a href="/profile/<?php 
    echo $photographer->getVanity();
    ?>
" class="invisi-link"><?php 
    echo $photographer->display_name;
    ?>
</a>
					<div class="details-container">
						<?php 
    echo HTML::image(Helper_Account::get_avatar($photographer, "thumbnail"));
    echo new Element("p", HTML::anchor(Helper_Account::get_public_account_url($photographer), $photographer->display_name));
    echo new Element("p", $photographer->photos->count_all() . " photos posted");
    ?>
					</div>
				</div>
			</div>
			<?php 
    /*<div class="photo <?php if ($i % 2 == 0) { echo 'last'; } ?>">
    			<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="/<?= Helper_Photos::get_photo_url($photo); ?>"><?= $photo->name; ?></a></div>
    			</div>
    			<div class="details-container">
    				<h2><a href="/<?= Helper_Photos::get_photo_url($photo); ?>"><?= $photo->name; ?></a></h2>
    				<p><?= $photo->creationDate(); ?><br />
    				<?php echo Helper_Photos::get_comment_link($photo); ?><br />
Esempio n. 28
0
<div id="form_container">
	<?php 
echo form::open('photos/upload', array('enctype' => 'multipart/form-data'));
?>
		<div class="main_top"></div>
		<div class="inner_wrapper">
			<div class="title">
				<div class="avatar">
					<div class="avatar_inner"><?php 
echo HTML::image(Helper_Account::get_avatar($user, 'thumbnail'));
?>
</div>
				</div>
				<div class="text">
					<h2>Hi, <?php 
echo $user->display_name;
?>
!</h2>
				</div>
			</div> <!-- END: title -->
			<div class="title_bottom"></div>
			<div class="box">
				<div class="box_top"></div>
				<div class="box_inner">
					<table>
						<tr>
							<td class="step"><?php 
echo HTML::image('public/images/layout/icon-one.png');
?>
</td>
							<td class="text">
Esempio n. 29
0
<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) {
Esempio n. 30
0
<?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;
?>