Пример #1
0
 public function action_reject()
 {
     $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 ($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 rejected!')->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();
         $photo->delete();
         Message::set(Message::SUCCESS, 'Email successfully sent and photo rejected.');
     } else {
         $photo->delete();
         Message::set(Message::SUCCESS, 'Photo successfully rejected.');
     }
     //stop loading the template and just return
     die;
 }
Пример #2
0
 public function action_reject()
 {
     $this->auto_render = false;
     $send_email = $_POST['sendEmail'];
     $comment_id = $_POST['commentID'];
     $comment = ORM::factory('comment')->where('id', '=', $comment_id)->find();
     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($comment->user_id, 'comment', $additional_text);
         $user = ORM::factory('user')->where('id', '=', $comment->user_id)->find();
         //creative variable naming ftw!
         $post_office = Library_Notification::factory();
         $letter_body = $email_text;
         $letter = Library_Notification::new_message()->setSubject('NG Kids My Shot - Comment rejected!')->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();
         $comment->delete();
         //Message::set(Message::SUCCESS, 'Email successfully sent and comment rejected.');
     } else {
         $comment->delete();
         //Message::set(Message::SUCCESS, 'Comment successfully rejected');
     }
     echo "rejected";
 }
Пример #3
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;
     }
 }
Пример #4
0
<h1><?php 
echo $user->display_name;
?>
's Photos</h1>
	<?php 
if ($loggedin) {
    if (!$user_owns_page && !$isaFan) {
        //echo html::anchor("/account/addfan/".$user->id, "+Fan", array('class' => 'fan_btn'));
    } else {
        if (!$user_owns_page) {
            //echo html::anchor("/account/removefan/".$user->id, "-Fan", array('class' => 'unfan_btn'));
        }
    }
}
$comment_mail_options = Helper_SendEmail::get_comment_options();
if (Helper_Account::is_admin()) {
    ?>
<div id="caption_this_overlay" class="overlay_popup">
  <div class="header">
    <h2>Back Talk</h2>
  </div>
  <div class="content">
    <p style="padding-bottom: 10px;">

	</p>
    <?php 
    echo form::open('admin/backtalk/' . $photo->id, array('method' => 'post'));
    ?>
	<?php 
    echo form::label("from", "From: ");
    ?>
Пример #5
0
    ?>
		<p><strong>Tags:</strong> <?php 
    echo Helper_Tags::print_tags($tags);
    ?>
</p>
		<?php 
}
?>
		<p><strong>Category:</strong> <?php 
echo html::anchor('categories/' . $photo->category->id, $photo->category->name);
?>
</p>

	    	
                    <?php 
$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, true, 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">
Пример #6
0
          <h2>NG Comments</h2>
          <div class="max_characters counter"></div>
        </div>
          <?php 
echo form::hidden('avatar_id', $avatar->id);
?>
        <?php 
echo form::textarea('ng_comment', Helper_NGComment::load_comment($avatar->id, 'avatar'), array('data-max' => '1000', 'class' => 'word_count'));
?>
        <input type="submit" value="Save NG Comment" class="submit_ng_comment" />
      <?php 
echo form::close();
?>
            
                    <?php 
$avatar_mail_options = Helper_SendEmail::get_avatar_options();
?>
            
                    <?php 
echo form::open('admin/avatars/send_email/' . $avatar->user_id, array('method' => 'post'));
?>
                    <div class="title">
                      <p><strong>Email User: </strong><?php 
echo form::checkbox('send_email' . $avatar->id, 'send_email' . $avatar->id, FALSE, array("id" => "send_email" . $avatar->id, "class" => "send_email_option"));
?>
 Yes</p>                                     
                    </div>
                    <div id="email_options">
	                    <?php 
foreach ($avatar_mail_options as $option) {
    ?>