function timestamp($date, $override = TRUE)
{
    $return = "<span class='time' data-toggle='tooltip' title='" . date(DATE_FORMAT, strtotime($date)) . "'>";
    if ($override) {
        $return .= date(DATE_FORMAT, strtotime($date));
    } else {
        $return .= relativeTime($date);
    }
    $return .= "</span>";
    return $return;
}
Пример #2
0
function formatTweet($tweet, $dt)
{
    //strtotime()函数将任何英文文本的日期时间描述解析为unix时间戳
    if (is_string($dt)) {
        $dt = strtotime($dt);
    }
    //stripslashes()函数删除由addslashes()函数添加的反斜杠,该函数可用于清理从数据库或html表单中获取的数据,该函数返回已删除反斜杠的字符串
    $tweet = htmlspecialchars(stripslashes($tweet));
    //htmlspecialchars()函数把预定义的字符转换为html实体
    return '
	<li>
	<a href="#"><img class="avatar" src="img/avatar.jpg" width="48" height="48" alt="avatar" /></a>
	<div class="tweetTxt">
	<strong><a href="#">demo</a></strong> ' . preg_replace('/((?:http|https|ftp):\\/\\/(?:[A-Z0-9][A-Z0-9_-]*(?:\\.[A-Z0-9][A-Z0-9_-]*)+):?(\\d+)?\\/?[^\\s\\"\']+)/i', '<a href="$1" rel="nofollow" target="blank">$1</a>', $tweet) . '
	<div class="date">' . relativeTime($dt) . '</div>
	</div>
	<div class="clear"></div>
	</li>';
}
Пример #3
0
        echo "<span class='label label-{$label}'>" . T("label.{$label}") . "</span> ";
    }
}
echo "</span> ";
// Output controls which apply to this conversation.
echo "<span class='controls'>";
// If we're highlighting search terms (i.e. if we did a fulltext search), then output a "show matching posts" link.
if (ET::$session->get("highlight")) {
    echo " <a href='" . URL($conversationURL . "/?search=" . urlencode($data["fulltextString"])) . "' class='showMatchingPosts'>" . T("Show matching posts") . "</a>";
}
echo "</span>";
?>
</div>
<div class='col-channel'><?php 
$channel = $data["channelInfo"][$conversation["channelId"]];
echo "<a href='" . URL(searchURL("", $channel["slug"])) . "' class='channel channel-{$conversation["channelId"]}' data-channel='{$channel["slug"]}'>{$channel["title"]}</a>";
?>
</div>
<div class='col-replies'><?php 
echo "<span>" . Ts("%s reply", "%s replies", $conversation["replies"]) . "</span>";
// Output an "unread indicator", showing the number of unread posts.
if (ET::$session->user and $conversation["unread"]) {
    echo " <a href='" . URL("conversation/markAsRead/" . $conversation["conversationId"] . "?token=" . ET::$session->token . "&return=" . urlencode(ET::$controller->selfURL)) . "' class='unreadIndicator' title='" . T("Mark as read") . "'>" . $conversation["unread"] . " new</a> ";
}
?>
</div>
<div class='col-lastPost'><?php 
echo "<span class='action'>" . avatar(array("memberId" => $conversation["lastPostMemberId"], "avatarFormat" => $conversation["lastPostMemberAvatarFormat"], "email" => $conversation["lastPostMemberEmail"]), "thumb"), " ", sprintf(T("%s posted %s"), "<span class='lastPostMember name'>" . memberLink($conversation["lastPostMemberId"], $conversation["lastPostMember"]) . "</span>", "<a href='" . URL($conversationURL . "/unread") . "' class='lastPostTime'>" . relativeTime($conversation["lastPostTime"], true) . "</a>"), "</span>";
?>
</div>
</li>
Пример #4
0
<?php 
echo number_format($statistics["conversationsParticipated"]);
?>
<a href='<?php 
echo URL(searchURL("#contributor:" . $member["username"]));
?>
' class='control-search'><?php 
echo T("Search");
?>
</a>
</div></li>

<li><label><?php 
echo T("First posted");
?>
</label> <div><?php 
echo ucfirst(relativeTime($statistics["firstPosted"]));
?>
</div></li>

<li><label><?php 
echo T("Joined");
?>
</label> <div><?php 
echo ucfirst(relativeTime($statistics["joinTime"]));
?>
</div></li>

</ul>

</div>
 /**
  * Format post data into an array which can be used to display the post template view (conversation/post).
  *
  * @param array $post The post data.
  * @param array $conversation The details of the conversation which the post is in.
  * @return array A formatted array which can be used in the post template view.
  */
 public function formatPostForTemplate($post, $conversation)
 {
     $canEdit = ET::postModel()->canEditPost($post, $conversation);
     $avatar = avatar($post);
     // Construct the post array for use in the post view (conversation/post).
     $formatted = array("id" => "p" . $post["postId"], "title" => memberLink($post["memberId"], $post["username"]), "avatar" => (!$post["deleteTime"] and $avatar) ? "<a href='" . URL(memberURL($post["memberId"], $post["username"])) . "'>{$avatar}</a>" : false, "class" => $post["deleteTime"] ? array("deleted") : array(), "info" => array(), "controls" => array(), "body" => !$post["deleteTime"] ? $this->displayPost($post["content"]) : false, "footer" => array(), "data" => array("id" => $post["postId"], "memberid" => $post["memberId"]));
     $date = smartTime($post["time"], true);
     // Add the date/time to the post info as a permalink.
     $formatted["info"][] = "<a href='" . URL(postURL($post["postId"])) . "' class='time' title='" . _strftime(T("date.full"), $post["time"]) . "' data-timestamp='" . $post["time"] . "'>" . (!empty($conversation["searching"]) ? T("Show in context") : $date) . "</a>";
     // If the post isn't deleted, add a lot of stuff!
     if (!$post["deleteTime"]) {
         // Add the user's online status / last action next to their name.
         if (empty($post["preferences"]["hideOnline"])) {
             $lastAction = ET::memberModel()->getLastActionInfo($post["lastActionTime"], $post["lastActionDetail"]);
             if ($lastAction[0]) {
                 $lastAction[0] = " (" . sanitizeHTML($lastAction[0]) . ")";
             }
             if ($lastAction) {
                 array_unshift($formatted["info"], "<" . (!empty($lastAction[1]) ? "a href='{$lastAction[1]}'" : "span") . " class='online' title='" . T("Online") . "{$lastAction[0]}'><i class='icon-circle'></i></" . (!empty($lastAction[1]) ? "a" : "span") . ">");
             }
         }
         // Show the user's group type.
         $formatted["info"][] = "<span class='group'>" . memberGroup($post["account"], $post["groups"]) . "</span>";
         $formatted["class"][] = "group-" . $post["account"];
         foreach ($post["groups"] as $k => $v) {
             if ($k) {
                 $formatted["class"][] = "group-" . $k;
             }
         }
         // If the post has been edited, show the time and by whom next to the controls.
         if ($post["editMemberId"]) {
             $formatted["controls"][] = "<span class='editedBy'>" . sprintf(T("Edited %s by %s"), "<span title='" . _strftime(T("date.full"), $post["editTime"]) . "' data-timestamp='" . $post["editTime"] . "'>" . relativeTime($post["editTime"], true) . "</span>", memberLink($post["editMemberId"], $post["editMemberName"])) . "</span>";
         }
         // If the user can reply, add a quote control.
         if ($conversation["canReply"]) {
             $formatted["controls"][] = "<a href='" . URL(conversationURL($conversation["conversationId"], $conversation["title"]) . "/?quote=" . $post["postId"] . "#reply") . "' title='" . T("Quote") . "' class='control-quote'><i class='icon-quote-left'></i></a>";
         }
         // If the user can edit the post, add edit/delete controls.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/editPost/" . $post["postId"]) . "' title='" . T("Edit") . "' class='control-edit'><i class='icon-edit'></i></a>";
             $formatted["controls"][] = "<a href='" . URL("conversation/deletePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Delete") . "' class='control-delete'><i class='icon-remove'></i></a>";
         } elseif (!$conversation["locked"] && !ET::$session->isSuspended() && $post["memberId"] == ET::$session->userId && (!$post["deleteMemberId"] || $post["deleteMemberId"] == ET::$session->userId) && C("esoTalk.conversation.editPostTimeLimit") == "reply") {
             $formatted["controls"][] = "<span title='" . sanitizeHTML(T("message.cannotEditSinceReply")) . "' class='control-edit disabled'><i class='icon-edit'></i></span>";
             $formatted["controls"][] = "<span title='" . sanitizeHTML(T("message.cannotEditSinceReply")) . "' class='control-delete disabled'><i class='icon-remove'></i></span>";
         }
     } else {
         // Add the "deleted by" information.
         if ($post["deleteMemberId"]) {
             $formatted["controls"][] = "<span>" . sprintf(T("Deleted %s by %s"), "<span title='" . _strftime(T("date.full"), $post["deleteTime"]) . "' data-timestamp='" . $post["deleteTime"] . "'>" . relativeTime($post["deleteTime"], true) . "</span>", memberLink($post["deleteMemberId"], $post["deleteMemberName"])) . "</span>";
         }
         // If the user can edit the post, add a restore control.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/restorePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Restore") . "' class='control-restore'><i class='icon-reply'></i></a>";
         }
     }
     $this->trigger("formatPostForTemplate", array(&$formatted, $post, $conversation));
     return $formatted;
 }
Пример #6
0
    function checkPost($post, $user)
    {
        $user = urldecode($user);
        $this->curProfile = $user;
        $this->postID = $post;
        /**
         *POST ALL POST 
         **/
        $this->dbHandle->setRquery("SELECT * FROM amistiUser WHERE uName=?", array($this->curProfile));
        $res = $this->dbHandle->getRquery();
        $this->postUser = $res[0]['fName'] . " " . $res[0]['sName'];
        // get the post details
        $this->postUserName = $res[0]['uName'];
        $this->profileID = $res[0]['userID'];
        //GET OR SET PROFILE IMAGE
        $this->dbHandle->setRquery("SELECT * FROM amistiProfilePic WHERE userID=? AND profilePicCurrent=?", array($this->profileID, 1));
        $profilePicRes = $this->dbHandle->getRquery();
        $this->postUserIcon = getImgPath($profilePicRes[0]['profileImgPath']);
        $this->dbHandle->setRquery("SELECT * FROM amistiPost  INNER JOIN amistiUser ON amistiPost.userID = amistiUser.userID\n\t                    WHERE amistiPost.postID=? ", array($this->postID));
        // GET POST
        $results = $this->dbHandle->getRquery();
        if (count($results) > 0) {
            //get post results and iterate
            for ($x = 0; $x < count($results); $x++) {
                // get user data from table user
                //POPULATE THE VARIABLES
                $this->postID = $results[$x]['postID'];
                $this->postText = $results[$x]['postText'];
                $this->postTime = $results[$x]['postTime'];
                $this->postUserID = $results[$x]['userID'];
                if ($results[$x]['postShow'] == 1) {
                    //----check if the postShow is equal 1 ie show to public
                    //get user icon
                    $uIcon = empty($this->postUserIcon) || $this->postUserIcon == "" ? "./libs/libImages/icons/Man.png" : $this->postUserIcon;
                    ?>
    
    <!-- Center Content Class -->
    
    <div class="CC" id="POST_<?php 
                    echo $this->postID;
                    ?>
" > 
      
      <!-- Edit or menu point -->
      <div class="ccPoint">...</div>
     
      <!-- Poster icon/photo -->
      <div class="ccIcon"><a href="/?user=<?php 
                    echo $this->postUserName;
                    ?>
&post=<?php 
                    echo $this->postID;
                    ?>
"> <img src="<?php 
                    echo $uIcon;
                    ?>
" alt="<?php 
                    echo $this->postUser;
                    ?>
"> </a> </div>
      
      <!-- Poster data , place and time -->
      <div class=" ccUData">
        <h2>		<a href="/?user=<?php 
                    echo $this->postUserName;
                    ?>
"> 
	  <?php 
                    echo $this->postUser;
                    ?>
 
      </a>
       </h2>
       
        <ul>
          <li> <?php 
                    echo relativeTime($this->postTime);
                    ?>
 </li>
          <li>&middot;</li>
          <li class="locationIcon"> location not set</li> <!--- POST LOCATION SETTING HERE --------- -->
        </ul>
      </div>
      
  
  <div class="ccPointMenus"><!-- POP UP MENU --->
       
      <?php 
                    if ($this->curProfile == $_SESSION['uName']) {
                        //IF THE CURRENT PROFILE VIEWER IS THE SAME AS THE OWNER
                        ?>
  
       <li>
       <div class="postHidePost" ><strong>Show/Hide</strong><br>show or hide post from public</div>
       </li>
       
       <li>
       <div class="postEditPost"><strong>Edit</strong><br>edit this post</div>
       </li>
       
       <li>
        <div class="postLocationPost"><strong>Set Location</strong><br>add location to post</div>
        </li>
       
        <li>
         <div class="postDeletePost"><strong>Delete</strong><br>delete this post</div>
         </li>
         
        <?php 
                    } else {
                        ?>
        
		  <li>
          <div class="postReportPost"><strong>Report</strong><br>report this post</div>
          </li>
          
		 <?php 
                    }
                    ?>
     
       </div>
       
  
  <!-- inner for multumedis --->
  <?php 
                    //CHECK IF POST HAD IMAGES IN THE AMISTI PIC TABLE
                    $this->dbHandle->setRquery("SELECT * FROM amistiPic WHERE postID=? and userID=?  ORDER BY picTime DESC", array($this->postID, $res[0]['userID']));
                    $picImageRes = $this->dbHandle->getRQuery();
                    $countPics = count($picImageRes);
                    if (count($picImageRes) > 0) {
                        // check if post contain media in the database
                        if ($countPics == 1) {
                            ?>
      <div class="ccInnerM">
      

		 <?php 
                            list($xx, $yy) = getimagesize($picImageRes[0]['picBigImgPath']);
                            // get Image size for One img view
                            ?>
  
        
             <a href="/photos?user=<?php 
                            echo $this->postUserName;
                            ?>
&PN=1&imgID=<?php 
                            echo $picImageRes[0]['picID'];
                            ?>
&PVB=true&album=postImages" class="photoViewBig">
               
      <div class="ccInnerM1" 
      style="background-image:url('<?php 
                            echo getImgPath($picImageRes[0]['picBigImgPath']);
                            ?>
');
      background-size:<?php 
                            echo $xx > "600" ? "600px" : "auto";
                            ?>
 <?php 
                            echo $yy > "400" ? "400px" : "auto";
                            ?>
;">
     </div> 
      </a>
      </div>
      <?php 
                        } elseif ($countPics == 2) {
                            //show 2 pics
                            $picDS2;
                            for ($picC2 = 0; $picC2 < $countPics; $picC2++) {
                                $picName2 = $this->postUserName;
                                $picImageID = $picImageRes[$picC2]['picID'];
                                $picImagePath = getImgPath($picImageRes[$picC2]['picBigImgPath']);
                                $picDS2 .= "\n   \n      <a href=/photos?user={$picName2}&PN=1&imgID={$picImageID}&PVB=true&album=postImages class=photoViewBig>\n      <span class=ccInnerM2 style=background-image:url({$picImagePath})> </span>\n      </a>";
                            }
                            ?>
 <div class="ccInnerM"> <?php 
                            echo $picDS2;
                            ?>
</div><?php 
                            // echo 2 image out
                        } elseif ($countPics == 3) {
                            // show 3 pics
                            $pic2 = 0;
                            $picDS;
                            for ($picC2 = 0; $picC2 < $countPics; $picC2++) {
                                $picName2 = $this->postUserName;
                                $picImageID = $picImageRes[$picC2]['picID'];
                                $picImagePath = getImgPath($picImageRes[$picC2]['picBigImgPath']);
                                if ($picC2 == 0) {
                                    $picDS3 .= "\n   \n      <a href=/photos?user={$picName2}&PN=1&imgID={$picImageID}&PVB=true&album=postImages class=photoViewBig>\n      <span class=ccInnerM2 style=background-image:url({$picImagePath})> </span>\n      </a>";
                                } else {
                                    $picDS3 .= "\n   \n      <a href=/photos?user={$picName2}&PN=1&imgID={$picImageID}&PVB=true&album=postImages class=photoViewBig>\n      <span class=ccInnerM3 style=background-image:url({$picImagePath})> </span>\n      </a>";
                                }
                            }
                            ?>
 <div class="ccInnerM"> <?php 
                            echo $picDS3;
                            ?>
</div><?php 
                            // echo 3 immage out
                        } elseif ($countPics == 4) {
                            //CHECK FOR $ IMAGES
                            $picDS4;
                            for ($xPic = 0; $xPic < $countPics; $xPic++) {
                                // Show 4 Pics
                                $picName2 = $this->postUserName;
                                $picImageID = $picImageRes[$xPic]['picID'];
                                $picImagePath = getImgPath($picImageRes[$xPic]['picBigImgPath']);
                                $picDS4 .= "\n   \n      <a href=/photos?user={$picName2}&PN=1&imgID={$picImageID}&PVB=true&album=postImages class=photoViewBig>\n      <span class=ccInnerM3 style=background-image:url({$picImagePath})> </span>\n      </a>";
                            }
                            ?>
 <div class="ccInnerM"> <?php 
                            echo $picDS4;
                            ?>
</div><?php 
                            //ECHO 4 IMAGES
                        }
                    } else {
                        ?>
 <div class="ccInnerM"></div><?php 
                        //empty ccInnerM box to keep the shape
                    }
                    if (!empty($this->postText)) {
                        // check for post texts by the poster
                        ?>
        
        
  <!-- post message -->
  <div class="ccInnerT"> <?php 
                        echo $this->postText;
                        ?>
 </div>
  <?php 
                    } else {
                        ?>
  
            <!-- post message -->
  <div class="ccInnerT">  </div>
  
  <?php 
                    }
                    ?>
 <!-- holder for love and comment count / show more on click -->
 <div class="ccLoveAndCommentHolder"> 
 
  <!-- add APPROVE -->
  <span class="ccApproveIt">
    <?php 
                    $this->dbHandle->setRquery("SELECT * FROM amistiApprove WHERE approveItemID=?", array($this->postID));
                    $appRes = $this->dbHandle->getRquery();
                    $checkUp = false;
                    if (isset($_SESSION['logIn'])) {
                        for ($xAp = 0; $xAp < count($appRes); $xAp++) {
                            if ($appRes[$xAp]['userID'] == $_SESSION['userID']) {
                                $checkUp = true;
                                echo "<strong>Approve</strong>";
                            }
                        }
                        if (!$checkUp) {
                            echo "approve";
                        }
                    } else {
                        echo "approve";
                    }
                    $this->approveCount = count($this->dbHandle->getRquery());
                    ?>
  </span>
  
 <div class="ccCommentMidDot">&middot;</div>
  
 <!-- cc comment count and show more comment -->
 <span class="ccCommentShowMoreCount">
 <?php 
                    //CHECK IF THERE IS POST COMMEMTS FOR THE POST
                    $this->dbHandle->setRquery("SELECT * from amistiComment INNER JOIN amistiUser ON amistiComment.userID = amistiUser.userID\n\t                       WHERE amistiComment.commentItemID=?", array($this->postID));
                    $this->commentRes = $this->dbHandle->getRquery();
                    $this->commentCount = count($this->commentRes);
                    // comment count here
                    echo $this->commentCount > 0 ? $this->commentCount > 1 ? $this->commentCount . " comments" : $this->commentCount . " comment" : "0 comment";
                    ?>
 
 </span> 
  </div>
  

  
  
  
  <!-- post container -->
  <div  class="ccPostCon"> 
  
     <!-- number of people approved box -->
     <div class="ccNumberPeopleApproved">
     <!--<div class="messageIcon"> ami</div>-->
     
     <div class ="ccNPAShowNotice">
     <?php 
                    $yYou;
                    $this->dbHandle->setRquery("SELECT * FROM amistiApprove INNER JOIN amistiUser ON\n\t\t\t                           amistiApprove.userID = amistiUser.userID WHERE amistiApprove.approveItemID=?", array($this->postID));
                    $appRes = $this->dbHandle->getRquery();
                    for ($appC = 0; $appC < count($appRes); $appC++) {
                        if ($appRes[$appC]['userID'] == $_SESSION['userID']) {
                            $yYou = "You ";
                        }
                    }
                    $aproveSub = count($appRes);
                    if (count($appRes) == 0) {
                        //show nothing
                    } else {
                        if ($aproveSub == 1 && !empty($yYou)) {
                            echo "You approve this..";
                        } elseif ($aproveSub >= 0 && empty($yYou)) {
                            if ($aproveSub == 1) {
                                ?>
								  <a href="/user=<?php 
                                echo $this->postUserName;
                                ?>
&post=<?php 
                                echo $this->postID;
                                ?>
"><?php 
                                echo $aproveSub;
                                ?>
 person</a> approve this.
                                 <?php 
                            } else {
                                ?>
								  <a href="/?user=<?php 
                                echo $this->postUserName;
                                ?>
&post=<?php 
                                echo $this->postID;
                                ?>
"><?php 
                                echo $aproveSub;
                                ?>
  others</a> approve this.
                                   <?php 
                            }
                        } elseif ($aproveSub > 1 && !empty($yYou)) {
                            if ($aproveSub == 2) {
                                $aproveSub = $aproveSub - 1;
                                ?>
								    You and <a href="/?user=<?php 
                                echo $this->postUserName;
                                ?>
&post=<?php 
                                echo $this->postID;
                                ?>
"><?php 
                                echo $aproveSub;
                                ?>
 other</a> approve this.
                                   <?php 
                            } else {
                                ?>
								  You and <a href="/?user=<?php 
                                echo $this->postUserName;
                                ?>
&post=<?php 
                                echo $this->postID;
                                ?>
"><?php 
                                echo $aproveSub - 1;
                                ?>
 others</a> approve this.
											<?php 
                            }
                        }
                    }
                    $yYou = '';
                    ?>
     
     </div>
     </div>
     
     
    <?php 
                    $this->getComments();
                    //Get comment
                    ?>
</div>

<?php 
                } else {
                    if ($_SESSION['userID'] == $this->postID) {
                        //show post with z-index 0.5, work latter
                    }
                }
            }
        } else {
            //ECHO POST DOES NOT EXIST
        }
    }
Пример #7
0
/**
 * Get a smart human-friendly string for a date.
 *
 * @param int $then UNIX timestamp of the time to work out how much time has passed since.
 * @param bool $precise Whether or not to return "x minutes/seconds", or just "a few minutes".
 * @return string A human-friendly time string.
 *
 * @package esoTalk
 */
function smartTime($then, $precise = false)
{
    // Work out how many seconds it has been since $then.
    $ago = time() - $then;
    // If the time was within the last 48 hours, show a relative time (eg. 2 hours ago.)
    if ($ago >= 0 and $ago < 48 * 60 * 60) {
        return relativeTime($then, $precise);
    } elseif ($ago < 180 * 24 * 60 * 60) {
        return strftime("%b %e", $then);
    } else {
        return strftime(($precise ? "%e " : "") . "%b %Y", $then);
    }
}
Пример #8
0
</div>
</div>
<div class='body'>
<ul class='form stats'>
<li><label><?php 
echo $language["Last active"];
?>
</label> <div><?php 
echo relativeTime($this->member["lastSeen"]);
?>
</div></li>
<li><label><?php 
echo $language["First posted"];
?>
</label> <div><?php 
echo relativeTime($this->member["firstPosted"]);
?>
</div></li>

<li><label><?php 
echo $language["Post count"];
?>
</label> <div><?php 
echo number_format($this->member["postCount"]);
if ($this->member["postCount"] > 0) {
    ?>
 <small>(<?php 
    $postsPerDay = round(min(max(0, $this->member["postCount"] / ((time() - $this->member["firstPosted"]) / 60 / 60 / 24)), $this->member["postCount"]));
    if ($postsPerDay == 1) {
        echo $language["post per day"];
    } else {
Пример #9
0
        $fOp->setRquery("DELETE FROM amistiApprove WHERE approveItemID=?", array($postDelPostID));
        $fOp->setRquery("DELETE FROM amistiComment WHERE commentItemID=?", array($postDelPostID));
        $json = array("op" => "OK");
        echo json_encode($json);
    }
}
//CHECK POST
if ($_GET['checkPost'] == true) {
    $fOp->setRquery("SELECT * FROM amistiPost WHERE userID=? AND postPost=?", array($_SESSION['curUserID'], 1));
    $res = $fOp->getRquery();
    if (count($res) > 0) {
        $json = array("op" => "true");
    } else {
        $json = array("op" => "false");
    }
    echo json_encode($json);
}
//NEW AUTO TIME POST
if ($_GET['timeC'] == true) {
    $timeID = $_GET['timeID'];
    $fOp->setRquery("SELECT * FROM amistiPost WHERE postID=?", array($timeID));
    $cc = $fOp->getRquery();
    $title = date('l, M d, Y @ h:ia', $cc[0]['postTime']);
    $time = relativeTime($cc[0]['postTime']);
    $json = array("nTime" => $time, "title" => $title);
    echo json_encode($json);
}
?>


Пример #10
0
function sideComments($i)
{
    $allD;
    $photoFileOP = new sysFilesOperations();
    $id = getPostID($i);
    //Get comments
    $photoFileOP->setRquery("SELECT * FROM amistiComment WHERE commentItemID=?", array($id)) or die('ERROR 2 ');
    $idRes = $photoFileOP->getRquery();
    if (count($idRes) > 0) {
        for ($x = 0; $x < count($idRes); $x++) {
            //set DIV ID
            $comID = $idRes[$x]['commentID'];
            $allD .= "<div class=\"ccShowCommentInner \" id=\"com_{$comID}\">";
            //GET USER ICON
            $photoFileOP->setRquery("SELECT * FROM amistiProfilePic WHERE userID=? AND profilePicCurrent=?", array($idRes[$x]['userID'], 1));
            $uRes = $photoFileOP->getRquery();
            $uIcon = count($uRes) == 0 ? "/libs/libImages/icons/Man.png " : str_replace("/home/richieking1978/public_html", "", $uRes[0]['profileImgPath']);
            $photoFileOP->setRquery("SELECT * FROM amistiUser WHERE userID=?", array($idRes[$x]['userID'])) or die('ERROR 3 ');
            $mainURes = $photoFileOP->getRquery();
            // set user Icon
            $fullname = $mainURes[0]['fName'] . " " . $mainURes[0]['sName'];
            $uiD = $mainURes[0]['userID'];
            $comTex = $idRes[$x]['commentText'];
            $uName = $mainURes[0]['uName'];
            $allD .= "<a href=\"/{$uName}\">\n\t\t\t\t\t\t <div class=\"ccShowCommentUIcon showUserPopUpPic\" style=\"background-image:url({$uIcon} )\"></div>\n\t\t\t\t\t\t </a>\n\t\t\t\t\t\t <div class=\"ccShowCommentTextAllCon\"> \n\t\t\t\t\t\t <div class=\"ccShowCommentText \"> \n\t\t\t\t\t\t <a href=\"/{$uName}\" class=\"showUserPopUpName\">\n\t\t\t\t\t\t {$fullname}\n\t\t\t\t\t\t </a> \n\t\t\t\t\t\t {$comTex}\n\t\t\t\t\t\t </div> ";
            if (isset($_SESSION['logIn'])) {
                $allD .= "<div class=\"ccShowCommentMenuDHR\">...</div>\n\t\t\t\t   \n\t\t\t\t\t\t <div class=\"ccCommentMenu allPhotoComMenuResize\">\n\t\t\t\t\t\t <div class=\"ccCommentMenuArrowTop\"></div>\n\t\t\t\t\t\t <div class=\"ccCommentMenuData\" >";
                if ($_SESSION['userID'] == $_SESSION['curUserID']) {
                    if ($_SESSION['userID'] == $idRes[$x]['userID']) {
                        $allD .= "<li class=\"comEdit\"> Edit...</li>\n\t\t\t\t\t\t  <li class=\"comDelete\"> Delete...</li>";
                    } else {
                        $allD .= "<li class=\"comDelete\"> Remove...</li>\n   \t\t\t\t\t\t  <li class=\"comReport\"> Report...</li>";
                    }
                } elseif ($idRes[$x]['userID'] == $_SESSION['userID']) {
                    $allD .= "<li class=\"comEdit\"> Edit...</li>\n\t\t\t\t\t\t  <li class=\"comDelete\"> Delete...</li>";
                } else {
                    $allD .= "<li class=\"comReport\"> Report...</li>";
                }
                $allD .= "</div>\n\t\t\t\t\t          <span class=\"ccCommentMenuArrowBot\"></span>\n\t\t\t\t\t\t\t  </div> ";
            }
            //set DOWN BOX FOR DATE AND APPROVE
            $time = relativeTime($idRes[$x]['commentTime']);
            $allD .= "<div  class=\"ccCommentTLLCBoxMain \">\n\t\t\t\t\t\t\t   <div class=\"ccCommentTime\"> {$time} </div>\n\t\t\t\t\t\t\t\t<div class=\"ccCommentMidDot\">&middot;</div>\n\t\t\t\t\t\t\t\t<div class=\"ccCommentApprove\">";
            $photoFileOP->setRquery("SELECT * FROM amistiApprove WHERE approveItemID=?", array($idRes[$x]['commentID'])) or die('ERROR 4 ');
            $appRes = $photoFileOP->getRquery();
            $appCountN = count($appRes) == 0 ? "" : count($appRes);
            $foundYes;
            if (isset($_SESSION['logIn'])) {
                for ($cA = 0; $cA < count($appRes); $cA++) {
                    if ($appRes[$cA]['userID'] == $_SESSION['userID']) {
                        $foundYes = true;
                    }
                }
                if ($foundYes) {
                    $allD .= "<a href=\"#\">Approve</a> " . $appCountN;
                } else {
                    $allD .= " <a href=\"#\">approve</a> " . $appCountN;
                }
                $foundYes = false;
            } else {
                $allD .= "<a href=\"#\">approve</a>" . $appCountN;
            }
            // $allD .= "</div>";
            // Close Divs
            $allD .= "</div>\n\t\t\t\t \t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t   </div>";
        }
    }
    return $allD;
}
 /**
  * 投稿単位(post)の出力用編集メソッド
  * Format post data into an array which can be used to display the post template view (conversation/post).
  *
  * @param array $post The post data.
  * @param array $conversation The details of the conversation which the post is in.
  * @return array A formatted array which can be used in the post template view.
  */
 protected function formatPostForTemplate($post, $conversation)
 {
     $canEdit = ET::postModel()->canEditPost($post, $conversation);
     $avatar = avatar($post);
     // Construct the post array for use in the post view (conversation/post).
     // title: SWCユーザ名を表示するように設定対応
     // purl: 追加。SNSボタンリンク用に投稿単位の絶対urlを設定
     // likeCnt: 追加。いいねボタンのカウント数設定
     // mainPostFlg: 追加。テーマのメイン投稿(最初の投稿)フラグ
     $formatted = array("id" => "p" . $post["postId"], "conversationId" => $post["conversationId"], "title" => memberLink($post["memberId"], $post["username"]), "avatar" => (!$post["deleteMemberId"] and $avatar) ? "<a href='" . URL(memberURL($post["memberId"], $post["username"])) . "'>{$avatar}</a>" : false, "class" => $post["deleteMemberId"] ? array("deleted") : array(), "info" => array(), "controls" => array(), "body" => !$post["deleteMemberId"] ? $this->displayPost($post["content"]) : false, "footer" => array(), "purl" => URL(postURL($post["postId"]), TRUE), "likeCnt" => $post["likeCnt"], "mainPostFlg" => $post["mainPostFlg"], "data" => array("id" => $post["postId"], "memberid" => $post["memberId"]));
     // いいね済みフラグ
     $formatted["liked"] = $post["likeActivityId"] ? 1 : "";
     //	$date = smartTime($post["time"], true);
     $date = SwcUtils::getStrfTime($post["time"], T("date.short"));
     // Add the date/time to the post info as a permalink.
     $formatted["info"][] = "<a href='" . URL(postURL($post["postId"])) . "' class='time' title='" . strftime(T("date.full"), $post["time"]) . "'>" . (!empty($conversation["searching"]) ? T("Show in context") : $date) . "</a>";
     // If the post isn't deleted, add a lot of stuff!
     if (!$post["deleteMemberId"]) {
         // Add the user's online status / last action next to their name.
         //		if (empty($post["preferences"]["hideOnline"])) {
         //			$lastAction = ET::memberModel()->getLastActionInfo($post["lastActionTime"], $post["lastActionDetail"]);
         //			if ($lastAction[0]) $lastAction[0] = " (".sanitizeHTML($lastAction[0]).")";
         //			if ($lastAction) array_unshift($formatted["info"], "<".(!empty($lastAction[1]) ? "a href='{$lastAction[1]}'" : "span")." class='online' title='".T("Online")."{$lastAction[0]}'><i class='icon-circle'></i></".(!empty($lastAction[1]) ? "a" : "span").">");
         //		}
         // Show the user's group type.
         //		$formatted["info"][] = "<span class='group'>".memberGroup($post["account"], $post["groups"])."</span>";
         $formatted["class"][] = "group-" . $post["account"];
         foreach ($post["groups"] as $k => $v) {
             if ($k) {
                 $formatted["class"][] = "group-" . $k;
             }
         }
         // If the post has been edited, show the time and by whom next to the controls.
         if ($post["editMemberId"]) {
             $formatted["controls"][] = "<span class='editedBy'>" . sprintf(T("Edited %s by %s"), "<span title='" . strftime(T("date.full"), $post["editTime"]) . "'>" . relativeTime($post["editTime"], true) . "</span>", name($post["editMemberName"])) . "</span>";
         }
         // If the user can reply, add a quote control.
         if ($conversation["canReply"]) {
             $formatted["controls"][] = "<a href='" . URL(conversationURL($conversation["conversationId"], $conversation["title"]) . "/?quote=" . $post["postId"] . "#reply") . "' title='" . T("Quote") . "' class='control-quote'><i class='icon-quote-left'></i></a>";
         }
         // If the user can edit the post, add edit/delete controls.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/editPost/" . $post["postId"]) . "' title='" . T("Edit") . "' class='control-edit'><i class='icon-edit'></i></a>";
             $formatted["controls"][] = "<a href='" . URL("conversation/deletePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Delete") . "' class='control-delete'><i class='icon-remove'></i></a>";
         }
     } else {
         // Add the "deleted by" information.
         if ($post["deleteMemberId"]) {
             $formatted["controls"][] = "<span>" . sprintf(T("Deleted %s by %s"), "<span title='" . strftime(T("date.full"), $post["deleteTime"]) . "'>" . relativeTime($post["deleteTime"], true) . "</span>", name($post["deleteMemberName"])) . "</span>";
         }
         // If the user can edit the post, add a restore control.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/restorePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Restore") . "' class='control-restore'><i class='icon-reply'></i></a>";
         }
     }
     $this->trigger("formatPostForTemplate", array(&$formatted, $post, $conversation));
     return $formatted;
 }
Пример #12
0
\t</div>\t
EOF;
    }
} else {
    foreach ($results_travelers as $k => $v) {
        $user = @getUser($v['user']);
        $user['first'] = generateUserLink($v['user']);
        $pic = getUserPicture($user['facebookid']);
        $v['from'] = "<a href='https://maps.google.com/?q={$v['from']}' target='_blank'>" . strtoupper($v['from']) . "</a>";
        $v['to'] = "<a href='https://maps.google.com/?q={$v['to']}' target='_blank'>" . strtoupper($v['to']) . "</a>";
        $v['date'] = convertDateTime($v['date'], false) . " - " . dateToRelative($v['date'], false);
        $tmp3 = empty($v['size']) ? "" : "";
        $tmp4 = empty($v['weight']) ? "" : "";
        // luggage type: <span class="glyphicon glyphicon-briefcase"></span>
        // info: <span class="glyphicon glyphicon-info-sign"></span>
        $tmp5 = "Created " . relativeTime($v['update']);
        $HTML[] = <<<EOF
\t<div class="search-element">
\t\t<div class="search-profile">
\t\t\t<img src="{$pic}">
\t\t</div>
\t\t<div class="search-description">
\t\t\t{$v['description']}
\t\t</div>
\t\t<div class="search-details">
\t\t\t<span class="glyphicon glyphicon-user"></span> {$user['first']}
\t\t\t<br>
\t\t\t<span class="glyphicon glyphicon-map-marker"></span>FROM <b>{$v['from']}</b> TO <b>{$v['to']}</b>
\t\t\t<br>
\t\t\t<span class="glyphicon glyphicon-time"></span> {$v['date']} 
\t\t\t<br>
Пример #13
0
        continue;
    }
    $i++;
    $travel_plans = $db->travel_plans;
    $travel = $travel_plans->findOne(array("_id" => new MongoId($v['travel'])));
    $tmp = "travel plan";
    if (isset($travel['requester'])) {
        $tmp = "product request";
    }
    $date = convertDate($travel['date']);
    if ($v['which'] == 0) {
        $pic = generateUserPicture($v['user1'], "chat-picture");
    } else {
        $pic = generateUserPicture($v['user2'], "chat-picture");
    }
    $time = relativeTime($v['update']);
    $HTML[] = <<<EOF
\t\t<div class="request-chat">
\t\t{$pic}
\t\t{$v['message']}<br>
\t\t<small>{$time} &middot; <a href="?travel_plan/view/{$v['travel']}">go to {$tmp} @ {$travel['from']} &gt; {$travel['to']} ({$date})</a></small>
\t\t</div>
EOF;
}
if ($i == 0) {
    $HTML[] = <<<EOF
\t\t<div class="request-chat">
\t\t\tNo entries found
\t\t</div>
EOF;
}
Пример #14
0
function tz_parse_cache_feed($usernames, $limit)
{
    $username_for_feed = str_replace(" ", "+OR+from%3A", $usernames);
    $feed = "http://search.twitter.com/search.atom?q=from%3A" . $username_for_feed . "&rpp=" . $limit;
    $usernames_for_file = str_replace(" ", "-", $usernames);
    $cache_file = dirname(__FILE__) . '/cache/' . $usernames_for_file . '-twitter-cache';
    $last = filemtime($cache_file);
    $now = time();
    $interval = 600;
    // ten minutes
    // check the cache file
    if (!$last || $now - $last > $interval) {
        // cache file doesn't exist, or is old, so refresh it
        $cache_rss = file_get_contents($feed);
        if (!$cache_rss) {
            // we didn't get anything back from twitter
            echo "<!-- ERROR: Twitter feed was blank! Using cache file. -->";
        } else {
            // we got good results from twitter
            echo "<!-- SUCCESS: Twitter feed used to update cache file -->";
            $cache_static = fopen($cache_file, 'wb');
            fwrite($cache_static, serialize($cache_rss));
            fclose($cache_static);
        }
        // read from the cache file
        $rss = @unserialize(file_get_contents($cache_file));
    } else {
        // cache file is fresh enough, so read from it
        echo "<!-- SUCCESS: Cache file was recent enough to read from -->";
        $rss = @unserialize(file_get_contents($cache_file));
    }
    // clean up and output the twitter feed
    $feed = str_replace("&amp;", "&", $rss);
    $feed = str_replace("&lt;", "<", $feed);
    $feed = str_replace("&gt;", ">", $feed);
    $clean = explode("<entry>", $feed);
    $clean = str_replace("&quot;", "'", $clean);
    $clean = str_replace("&apos;", "'", $clean);
    $amount = count($clean) - 1;
    if ($amount) {
        // are there any tweets?
        ?>
    <div id="twitter_div" class="clearfix">
          <ul id="twitter_update_list"> 
    <?php 
        for ($i = 1; $i <= $amount; $i++) {
            $entry_close = explode("</entry>", $clean[$i]);
            $clean_content_1 = explode("<content type=\"html\">", $entry_close[0]);
            $clean_content = explode("</content>", $clean_content_1[1]);
            $clean_name_2 = explode("<name>", $entry_close[0]);
            $clean_name_1 = explode("(", $clean_name_2[1]);
            $clean_name = explode(")</name>", $clean_name_1[1]);
            $clean_user = explode(" (", $clean_name_2[1]);
            $clean_lower_user = strtolower($clean_user[0]);
            $clean_uri_1 = explode("<uri>", $entry_close[0]);
            $clean_uri = explode("</uri>", $clean_uri_1[1]);
            $clean_time_1 = explode("<published>", $entry_close[0]);
            $clean_time = explode("</published>", $clean_time_1[1]);
            $unix_time = strtotime($clean_time[0]);
            $pretty_time = relativeTime($unix_time);
            ?>

                    <li><span><?php 
            echo $clean_content[0];
            ?>
</span> <small><a href="<?php 
            echo $clean_uri[0];
            ?>
"><?php 
            echo $pretty_time;
            ?>
</a></small></li>
			<?php 
        }
        ?>
    	</ul>
        
    </div>
    <?php 
    } else {
        ?>
        <div id="twitter_div" class="clearfix">
            <ul id="twitter_update_list">
                <li><span>Twitter should be here, but it's not. Get over it.</span></li>
            </ul>
        </div>
        <?php 
    }
}
Пример #15
0
/**
 * Show twitter updates
 * @param $username = twitter username
 * @param $number = how much data should display
 *
 * return lists
 */
function _wip_display_tweets($username, $number)
{
    if (file_exists(ABSPATH . WPINC . '/class-simplepie.php')) {
        require_once ABSPATH . WPINC . '/class-simplepie.php';
    } else {
        return __('You are not using latest WordPress version! Please update your WordPress!', 'wip');
        break;
    }
    $upload = wp_upload_dir();
    $cachefile = $upload['basedir'] . '/' . $username . '-' . $number;
    wp_mkdir_p($cachefile);
    $cached_time = 300;
    $tweet_url = 'http://search.twitter.com/search.atom?q=from:' . $username;
    $feed = new SimplePie($tweet_url, $cachefile, $cached_time);
    $result = "";
    if ($feed && !is_wp_error($feed)) {
        $result = '
			<ul class="builder_latest_tweet">' . "\n";
        foreach ($feed->get_items(0, $number) as $item) {
            $time = strtotime($item->get_date('Y-m-d H:i:s'));
            if (abs(time() - $time) < 86400) {
                $time = human_time_diff($time) . ' ago';
            } else {
                $time = relativeTime($item->get_date('Y-m-d H:i:s'));
            }
            $t_link = $item->get_permalink();
            if (is_ssl()) {
                $t_link = preg_replace('|^http://|', 'https://', $t_link);
            }
            $_desc = $item->get_description();
            if (is_ssl()) {
                $_desc = preg_replace('/http[s]*:/', 'https:', $_desc);
            }
            $result .= '<li>' . "\n";
            $result .= '<span class="twitter-text">' . $_desc . '</span>';
            // Display date/time
            $result .= '<span class="twitter-date"><a href="' . $t_link . '" target="_blank">' . $time . '</a></span>';
            $result .= '</li>' . "\n";
        }
        $result .= '</ul>' . "\n";
    } else {
        $result = __('Twitter seems too busy, cannot connect to twitter right now! Please try again later!', 'wip');
    }
    return $result;
}
Пример #16
0
    if ($nzbFile->getExtension() != "gz") {
        continue;
    }
    $newFileName = $nzb->getNZBPath(str_replace(".nzb.gz", "", $nzbFile->getBasename()), $newLevel, true);
    if ($newFileName != $nzbFile) {
        rename($nzbFile, $newFileName);
        chmod($newFileName, 0777);
    }
    $iFilesProcessed++;
    if ($iFilesProcessed % 100 == 0) {
        $consoleTools->overWrite("Reorganized {$iFilesProcessed}");
    }
}
$pdo->ping(true);
$pdo->queryExec(sprintf("UPDATE settings SET value = %s WHERE setting = 'nzbsplitlevel'", $argv[1]));
$consoleTools->overWrite("Processed {$iFilesProcessed} nzbs in " . relativeTime($time) . "\n");
function relativeTime($_time)
{
    $d = array();
    $d[0] = array(1, "sec");
    $d[1] = array(60, "min");
    $d[2] = array(3600, "hr");
    $d[3] = array(86400, "day");
    $d[4] = array(31104000, "yr");
    $w = array();
    $return = "";
    $now = TIME();
    $diff = $now - $_time;
    $secondsLeft = $diff;
    for ($i = 4; $i > -1; $i--) {
        $w[$i] = intval($secondsLeft / $d[$i][0]);
Пример #17
0
    }
    //$thisPostTime = relativeTime($post["time"]);
    $thisPostTime = SwcUtils::getStrfTime($post["time"]);
    // 年月日日時として表示
    $mainFlg = $post["mainPostFlg"];
    ?>
<li data-index='<?php 
    echo date("Y", $post["time"]) . date("m", $post["time"]);
    ?>
'>
<?php 
    if ($mainFlg) {
        $this->renderView("conversation/tagsPath", array("tags" => $this->data["tags"]));
    }
    // If the post before this one has a different relative time string to this one, output a 'time marker'.
    if (!isset($prevPost["time"]) or relativeTime($prevPost["time"]) != $thisPostTime) {
        ?>
<div class='timeMarker'<?php 
        if ($thisPostTime == T("just now")) {
            ?>
 data-now='1'<?php 
        }
        ?>
><?php 
        echo $thisPostTime;
        ?>
</div>
<?php 
    }
    $this->renderView("conversation/post", array("post" => $formattedPost));
    ?>
Пример #18
0
function aggregator($client)
{
    $aggregator = \arc\lambda::prototype();
    $aggregator->renderItem = function ($item) {
        if ($item->enclosure['url']) {
            $img = h::a(['href' => $item->link->nodeValue], h::img(['src' => $item->enclosure['url'], 'alt' => '']));
        } else {
            $img = '';
        }
        $pubDate = h::time(relativeTime(strtotime(current($item->xpath('.//pubDate|.//dc:date')))));
        return h::article(['class' => 'white-panel'], $img, h::h2(h::a(['href' => $item->link->nodeValue], $item->title->nodeValue)), $pubDate, h::p(['class' => 'description'], h::raw(strip_tags($item->description->nodeValue))));
    };
    $aggregator->renderItems = function ($items) {
        $itemsString = '';
        if (count($items)) {
            foreach ($items as $item) {
                $itemsString .= $this->renderItem($item);
            }
        } else {
            $itemsString = h::div(['class' => 'warning'], 'No articles in this feed.');
        }
        return h::raw($itemsString);
    };
    $aggregator->renderFeeds = function ($feeds) {
        return implode(array_map(function ($feed, $index) {
            return h::div(['class' => 'feed'], h::h2($feed->channel->title->nodeValue), h::form(['class' => 'remove', 'method' => 'POST'], h::button(['name' => 'removeFeed', 'value' => $index], 'Remove')), h::a(['href' => $feed->channel->link->nodeValue], $feed->channel->link->nodeValue));
        }, $feeds, array_keys($feeds)));
    };
    $aggregator->getPubDate = function ($item) {
        return strtotime(current($item->xpath('.//pubDate|.//dc:date')));
    };
    $aggregator->getItems = function ($feeds) {
        $allitems = call_user_func_array('array_merge', array_map(function ($rss) {
            return array_map(function ($item) use($rss) {
                $item->appendChild($rss->channel->cloneNode());
                return $item;
            }, $rss->getElementsByTagName('item'));
        }, $feeds));
        usort($allitems, function ($a, $b) {
            return $this->getPubDate($a) < $this->getPubDate($b);
        });
        return $allitems;
    };
    $aggregator->getFeed = function ($url) use($client) {
        $feed = $client->get($url);
        try {
            $rss = \arc\xml::parse($feed);
        } catch (\Exception $e) {
            $rss = \arc\html::parse($feed);
        }
        $rss->registerXPathNamespace('dc', 'http://purl.org/dc/elements/1.1/');
        return $rss;
    };
    $aggregator->render = function ($feeds) {
        $feeds = array_map(function ($feed) {
            return $this->getFeed($feed);
        }, $feeds);
        $items = $this->getItems($feeds);
        return h::section(['class' => 'items'], h::raw($this->renderItems($items))) . h::section(['class' => 'feeds'], h::raw($this->renderFeeds($feeds)));
    };
    return $aggregator;
}
Пример #19
0
        ?>
" > <?php 
        echo $comentario["u_nombre"];
        ?>
</a> 
                        <?php 
        echo $lang_por_dice . ": ";
        ?>
                        <?php 
        echo enlazarURLs($comentario["contenido"]);
        ?>
                    </p>
            <div id= "time" class="msg_datos ">
                <div class="fecha">
                    <?php 
        echo relativeTime($comentario['fecha'], $rt_fecha_sin_formato, $rt_periodos, $rt_tiempo, $rt_plurales);
        ?>
                </div>
            </div>
        </div>
        <div class="clear"></div>
    </div>
    <?php 
    }
}
?>
        </div>
        <script type="text/javascript">

            $("#n_comentarios").html("<?php 
echo $n_comentarios;
Пример #20
0
 /**
  * Searches the Twitter API for recent tweets about the passed in search string. More importantly formats the resulting tweets 
  * in order to meet the display requirements with valid HTML. Still need to include CSS rules in client code. This solution is based on:
  * http://oikos.org.uk/2013/02/tech-notes-displaying-twitter-statuses-using-api-v1-1-and-oath/
  *
  * You also need to possibly includ the Twitter javascript call somewhere to use this method and resulting HTML code. Read the Twitter 
  * documentation: https://dev.twitter.com/terms/display-requirements
  *
  * @param search string 
  *
  * @return null 
  */
 public function displayRecentTweetsFor($searchString)
 {
     // Another method handles the searching but displaying the results just the way Twitter wants is work, hence this method
     $tweets = $this->searchTwitterFor($searchString);
     // Now I have to loop through the results and display them as per the standard.
     if (count($tweets->statuses) > 0) {
         print '<div class="tweets">';
         foreach ($tweets->statuses as $this_tweet) {
             // Following Ross's example I'm close to meeting the display requirements. Timestamp may be incorrectly formatted.
             // Do I need little logos for Reply, Retweet, and Favourite?
             // https://dev.twitter.com/terms/display-requirements
             print '<div class="tweet-container">';
             print '<a class="tweet-user-avatar" href="https://twitter.com/intent/user?user_id=' . $this_tweet->user->id_str . '">';
             print '<img width="32" height="32" src="' . $this_tweet->user->profile_image_url . '" /></a>';
             print '<p class="tweet-user-names">';
             print '<a class="tweet-display-name" href="https://twitter.com/intent/user?user_id=' . $this_tweet->user->id_str . '">';
             print $this_tweet->user->name . '</a>';
             print '<a class="tweet-account-name" href="https://twitter.com/intent/user?user_id=' . $this_tweet->user->id_str . '">';
             print '@' . $this_tweet->user->screen_name . '</a></p>';
             print '<a href="https://twitter.com/' . $this_tweet->user->screen_name . '" class="twitter-follow-button" data-show-count="false" data-dnt="true">Follow @' . $this_tweet->user->name . '</a>';
             print '<div class="tweet-text">';
             print linkify_tweet($this_tweet->text, $this_tweet);
             print '</div>';
             print '<div class="tweet-time">';
             print '<a href="http://twitter.com/' . $this_tweet->user->screen_name . '/status/' . $this_tweet->id_str . '">';
             print relativeTime(strtotime($this_tweet->created_at));
             // Couldn't I just print the time string?
             print '</a></div>';
             print '<div class="tweet-intents">';
             // Web Intents aren't working perfectly or at least I have no little images. Could switch to UL LI and unique bullet
             // Complete with fancy CSS roll over Eric Meyer style.
             // Extra attributes in tag remove:
             /*
             class="intent-reply" title="Reply to this Tweet" 
             class="intent-retweet" title="Retweet this Tweet" 
             class="intent-favorite" title="Favourite this Tweet" 
             */
             print '<a href="https://twitter.com/intent/tweet?in_reply_to=' . $this_tweet->id_str . '">Reply</a>';
             print '<a href="https://twitter.com/intent/retweet?tweet_id=' . $this_tweet->id_str . '">Retweet</a>';
             print '<a href="https://twitter.com/intent/favorite?tweet_id=' . $this_tweet->id_str . '">Favourite</a>';
             print '</div></div>';
         }
         print '</div>';
     }
     // Don't need to return anything not even null in PHP apparently, I really am not a PHP guy, I don't know best practices at all.
 }
        <div class="mu_msg_texto_pu">
            <p>
                <a href="contenido_perfil_usuario_modal.php?nombre_usuario=<?php 
echo $mensaje["usuario_publica"];
?>
" class ="link_nombre" title ="<?php 
echo $mensaje["usuario_publica"];
?>
" ><?php 
echo $mensaje["nombre_usuario_publica"];
?>
</a> <?php 
echo " " . $lang_mural_usuario_ver_msj_dice;
?>
: <?php 
echo enlazarURLs($mensaje["mensaje"]);
?>
            </p>
        </div>        
        <div class="mu_msg_datos_pu">
            <?php 
echo relativeTime($mensaje["fecha"], $rt_fecha_sin_formato, $rt_periodos, $rt_tiempo, $rt_plurales);
?>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function(){
    });
</script>
Пример #22
0
// Output the email if the viewer is an admin.
if (ET::$session->isAdmin()) {
    ?>
<p class='subText'><?php 
    echo sanitizeHTML($member["email"]);
    ?>
</p><?php 
}
?>

<p id='memberGroup' class='subText'><?php 
echo memberGroup($member["account"], $member["groups"], true);
?>
</p>
<p id='memberLastActive' class='subText'><?php 
printf(T("Last active %s"), "<span title='" . date(T("date.full"), $member["lastActionTime"]) . "'>" . relativeTime($member["lastActionTime"], true) . "</span>");
?>
</p>

</div>

<?php 
// Output the member actions menu.
if ($data["actions"]->count()) {
    ?>
<ul id='memberActions'>
<?php 
    echo $data["actions"]->getContents();
    ?>
</ul>
<?php 
    public function generate_indexs_pesan_admin($id_param, $limit, $offset)
    {
        $hasil = "";
        $page = $offset;
        if (!$page) {
            $offset = 0;
        } else {
            $offset = $page;
        }
        $where['id_member'] = $id_param;
        $tot_hal = $this->db->query("select * from dlmbg_pesan_admin a left join dlmbg_member b on a.id_pengirim=b.id_member where a.id_pengirim='" . $id_param . "' order by waktu DESC");
        $config['base_url'] = base_url() . 'user/pesan_admin/index/';
        $config['total_rows'] = $tot_hal->num_rows();
        $config['per_page'] = $limit;
        $config['uri_segment'] = 4;
        $config['first_link'] = 'First';
        $config['last_link'] = 'Last';
        $config['next_link'] = 'Next';
        $config['prev_link'] = 'Prev';
        $this->pagination->initialize($config);
        $w = $this->db->query("select * from dlmbg_pesan_admin a left join dlmbg_member b on a.id_pengirim=b.id_member where a.id_pengirim='" . $id_param . "' order by waktu DESC LIMIT " . $offset . "," . $limit . "");
        $i = 0;
        foreach ($w->result() as $h) {
            $gbr = "no-image.png";
            $nama = "Administrator";
            if ($h->gambar != "") {
                if ($h->admin == 1) {
                    $gbr = "admin.jpg";
                    $nama = "Administrator";
                } else {
                    $gbr = $h->gambar;
                    $nama = $h->nama;
                }
            } else {
                if ($h->admin == 1) {
                    $gbr = "admin.jpg";
                    $nama = "Administrator";
                } else {
                    $gbr = "no-image.png";
                    $nama = $h->nama;
                }
            }
            $hasil .= '<table width="100%" border="0" cellspacing="0" cellpadding="10" bgcolor="#ECF5CF">
				<tr>
				  <td width="520">
				  <div class="border-photo-profil2" style="float:left; margin-right:10px;"><div class="hide-photo-profil-medium2"><img src="' . base_url() . 'asset/images/member/thumb/' . $gbr . '" width="60" /></div></div>
				  <span class="date-txt2">' . generate_tanggal($h->waktu) . ' - ' . $nama;
            $hasil .= '<br />
				  <strong><span class="h2-black">' . strip_tags($h->isi) . '</span></strong>
				  <div class="cleaner_h0"></div>
				  </td>
				  <td align="right"><span class="date-txt3">' . relativeTime($h->waktu) . '&nbsp;&nbsp;</span></td>
				</tr>
				<tr>
      		</table>
			<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#ECF5CF">
				<td>
            		<div class="line-grey"></div>
				</td>
				</tr>
			</table>';
        }
        $hasil .= '<div class="cleaner_h20"></div>';
        $hasil .= $this->pagination->create_links();
        return $hasil;
    }
Пример #24
0
     
   <!-- Right arrow shall be included in the ajax -->
   <div id="allPhotoRightArrow">
   <a href="../libs/aAjaxClass/photoAjax.php?user={$curU}&PN={$nChkN}&imgID={$nextID}&PVB=true&album={$album}"></a>
    </div>
TO;
                break;
            }
        }
        $comInfo = sideComments($pID);
        $approve = getApprove($pID);
        $appPeople = getPeopleApprove($pID);
        $comCount = getCommentCount($pID);
        $pPostID = "post_" . getPostID($pID);
        $title = date('l, M d, Y @ h:ia', $PVBRes[0]['picTime']);
        $time = relativeTime($PVBRes[0]['picTime']);
        /**/
        $allData = ["op" => "YES", "pic" => $photoPic, "picTime" => $time, "com" => $comInfo, "approve" => $approve, "peopleAprove" => $appPeople, "comCount" => $comCount, "postID" => $pPostID, "albumN" => $album, "title" => $title];
        echo json_encode($allData);
        //print_r($allData);
    }
}
//ADD NEW ALBUM TO THE PHOTO ADD
if ($_GET['newAlbum'] == true) {
    $ab = [];
    $fabulm = false;
    $albumName = urldecode($_GET['albumName']);
    //check if its the first album
    $photoFileOP->setRquery("SELECT * FROM amistiFolder WHERE folderName !=? AND userID=?", array("postImages", $_SESSION['userID']));
    $fabulm = $photoFileOP->getRquery();
    if (!count($fabulm) > 0) {
Пример #25
0
// Output the email if the viewer is an admin.
if (ET::$session->isAdmin()) {
    ?>
<p class='subText'><?php 
    echo sanitizeHTML($member["email"]);
    ?>
</p><?php 
}
?>

<p id='memberGroup' class='subText'><?php 
echo memberGroup($member["account"], $member["groups"], true);
?>
</p>
<p id='memberLastActive' class='subText'><?php 
printf(T("Last active %s"), empty($member["preferences"]["hideOnline"]) ? "<span title='" . date(T("date.full"), $member["lastActionTime"]) . "'>" . relativeTime($member["lastActionTime"], true) . "</span>" : "[" . T("hidden") . "]");
?>
</p>

</div>

<?php 
// Output the member actions menu.
if ($data["actions"]->count()) {
    ?>
<ul id='memberActions'>
<?php 
    echo $data["actions"]->getContents();
    ?>
</ul>
<?php 
Пример #26
0
/**
 * timeStamp
 *
 * Returns the HTML for a relative timestamp with a 'title' attribute that
 * gives the actual time.
 *
 * @param $date (string) The date in question
 *
 * @return (string) (HTML) The HTML with the relative timestamp visible and the
 * actual date added as a title attribute
 *
 */
function timestamp($date)
{
    if (defined('DATE_FORMAT')) {
        $format = 'l jS \\of F Y h:i:s A';
    } else {
        $format = DATE_FORMAT;
    }
    return "<span class='time' data-toggle='tooltip' title='" . date($format, strtotime($date)) . "'>" . relativeTime($date) . "</span>";
}
        echo $_mensajes_en_respuesta[$j]["usuario"];
        ?>
" ><?php 
        echo $_mensajes_en_respuesta[$j]["nombre"];
        ?>
</a>
                                    <?php 
        echo $lang_bitacora_dice . ": " . enlazarURLs($_mensajes_en_respuesta[$j]["mensaje"]);
        ?>
                                </p>
                                <div id= "time" class="respuesta_msg_datos" id="eliminar_respuesta<?php 
        echo $_mensajes_en_respuesta[$j]["id_mensaje_respuesta"];
        ?>
">
                                <?php 
        echo relativeTime($_mensajes_en_respuesta[$j]["fecha"], $rt_fecha_sin_formato, $rt_periodos, $rt_tiempo, $rt_plurales);
        ?>
                            </div>
                            </div>
                            
                            <br/>
                            <div class="eliminar_respuesta_br" id="eliminar_br<?php 
        echo $_mensajes_en_respuesta[$j]["id_mensaje_respuesta"];
        ?>
">
                             <?php 
        if ($es_profesor_responsable) {
            ?>
                                <button  class="boton_eliminar_msj" onclick="javascript:eliminarRespuesta(<?php 
            echo $_mensajes_en_respuesta[$j]["id_mensaje_respuesta"];
            ?>
Пример #28
0
                    $nzbsperhour = number_format(round($nzbCount / $seconds * 3600), 0);
                    exit($pdo->log->header("\nProcessed " . number_format($nzbCount) . " nzbs in " . relativeTime($time) . "\nAveraged " . $nzbsperhour . " imports per hour from " . $path));
                }
                @unlink($nzbFile);
            } else {
                $pdo->queryExec(sprintf("DELETE FROM releases WHERE guid = %s AND postdate = %s AND size = %d", $pdo->escapeString($relguid), $pdo->escapeString($totalsize)));
                echo $pdo->log->error("\nFailed copying NZB, deleting release from DB.\n");
                @unlink($nzbFile);
                flush();
                $importfailed = true;
            }
            $consoleTools->overWritePrimary('Imported ' . "[" . number_format($nzbSkipped) . "] " . number_format($nzbCount) . " NZBs (" . $nzbsperhour . "iph) in " . relativeTime($time));
        }
    }
}
exit($pdo->log->header("\nRunning Time: " . relativeTime($time) . "\n" . "Processed:    " . number_format($nzbCount + $nzbSkipped) . "\n" . "Imported:     " . number_format($nzbCount) . "\n" . "Duplicates:   " . number_format($nzbSkipped)));
/**
 * Compress an imported NZB and store it inside the nzbfiles folder.
 *
 * @param string $relguid    The guid of the release.
 * @param string $nzb        String containing the imported NZB.
 * @param NZB    $NZB
 * @param object $pdo
 *
 * @return bool
 *
 */
function copyNZBforImport($relguid, $nzb, $NZB, $pdo)
{
    $path = $NZB->getNZBPath($relguid, 0, true);
    $fp = gzopen($path, 'w5');
Пример #29
0
    echo "<a href='" . URL("conversation/markAsRead/" . $conversation["conversationId"] . "?token=" . ET::$session->token . "&return=" . urlencode(ET::$controller->selfURL)) . "' class='unreadIndicator' title='" . T("Mark as read") . "'>" . $conversation["unread"] . "</a> ";
}
// Output controls which apply to this conversation.
echo "<span class='controls'>";
// A Jump to last/unread link, depending on the user and the unread state.
if (ET::$session->user and $conversation["unread"]) {
    echo "<a href='" . URL($conversationURL . "/unread") . "' class='jumpToUnread'>" . T("Jump to unread") . "</a>";
} else {
    echo "<a href='" . URL($conversationURL . "/last") . "' class='jumpToLast'>" . T("Jump to last") . "</a>";
}
// If we're highlighting search terms (i.e. if we did a fulltext search), then output a "show matching posts" link.
if (ET::$session->get("highlight")) {
    echo " <a href='" . URL($conversationURL . "/?search=" . urlencode($data["fulltextString"])) . "' class='showMatchingPosts'>" . T("Show matching posts") . "</a>";
}
echo "</span>";
?>
</div>
<div class='col-channel'><?php 
$channel = $data["channelInfo"][$conversation["channelId"]];
echo "<a href='" . URL(searchURL("", $channel["slug"])) . "' class='channel channel-{$conversation["channelId"]}' data-channel='{$channel["slug"]}'>{$channel["title"]}</a>";
?>
</div>
<div class='col-lastPost'><?php 
echo "<span class='action'>" . avatar($conversation["lastPostMemberId"], $conversation["lastPostMemberAvatarFormat"], "thumb"), " ", sprintf(T("%s posted %s"), "<span class='lastPostMember name'>" . memberLink($conversation["lastPostMemberId"], $conversation["lastPostMember"]) . "</span>", "<span class='lastPostTime'>" . relativeTime($conversation["lastPostTime"], true) . "</span>"), "</span>";
?>
</div>
<div class='col-replies'><?php 
echo "<span>" . Ts("%s reply", "%s replies", $conversation["replies"]) . "</span>";
?>
</div>
</li>
Пример #30
0
function sl_send_love($from_username, $from_nickname, $from_id, $company_id, $to, $for, $check_spam = true, $private = false, $firstlove = false)
{
    $from = !empty($from_nickname) ? $from_nickname : $from_username;
    if ($check_spam && sl_is_spam($from_username, $for)) {
        return false;
    }
    $newUser = false;
    $query = "SELECT id, nickname, phone, confirm_phone, country, provider, send_love_via_email FROM " . USERS . " WHERE username = '******'";
    $res = mysql_query($query);
    if (!$res || mysql_num_rows($res) == 0) {
        // user could not be found, check if we allow to send love outside instance
        if (SEND_LOVE_OUTSIDE_INSTANCE === false && $firstlove === false) {
            return false;
        }
        $newUser = true;
    } else {
        $row = mysql_fetch_assoc($res);
        $nickname = !empty($row['nickname']) ? $row['nickname'] : $to;
        $loveinbox = $row['send_love_via_email'];
        $phone = $row['phone'];
        $confirmsms = $row['confirm_phone'];
        $country = $row['country'];
        $provider = $row['provider'];
    }
    // Send a normal email message
    $token = urlencode(sha1(SALT . "{$company_id}/{$from_id}/0"));
    // available templates:
    // love_email_old - for registered users
    // love_template_new - for new users
    // love_email_old_private, love_email_new_private - private versions
    $privateString = '';
    if ($private == true) {
        $privateString = '_private';
    }
    $status = 'old';
    $summary = getLastMonthLoveSummary($to);
    $loveReceived = 0;
    if ($summary) {
        $loveReceived = $summary['love_received'];
    }
    $statsHtml = '';
    $statsPlain = '';
    if ($loveReceived > 1) {
        // This person has received love in the past. Show the details
        $message = "Your last few loves: ";
        $statsHtml .= "<br/>" . $message;
        $statsPlain .= "\n" . $message;
        $query = "SELECT TIMESTAMPDIFF(SECOND,NOW(),at) as delta, CASE when usr.nickname is null then lv.giver else usr.nickname END as sender, lv.why " . " FROM " . LOVE . " lv " . " LEFT OUTER JOIN " . USERS . " as usr ON (lv.giver = usr.username) " . " WHERE lv.receiver = '" . addslashes($to) . "' ORDER BY lv.at desc limit 3";
        $result = mysql_query($query);
        $detail = array();
        $count = $result ? mysql_num_rows($result) : 0;
        if ($count > 0) {
            while ($row = mysql_fetch_array($result)) {
                $time = relativeTime($row['delta'], 1);
                $message = $row['sender'] . ", " . $time . " : " . $row['why'];
                $statsHtml .= "<br/>&nbsp;&nbsp;&nbsp;&nbsp;" . $message;
                $statsPlain .= "\n    " . $message;
            }
            $statsHtml .= "<br/>";
            $statsPlain .= "\n";
        }
        $message = "In the last 30 days, " . $summary['senders'] . " people have sent you love " . $loveReceived . " times.";
        $statsHtml .= "<br/><br.>" . $message;
        $statsPlain .= "\n\n" . $message;
    }
    if ($newUser) {
        $url = "http://www.lovemachineinc.com/trial/";
        $status = 'new';
    } else {
        $url = SECURE_SERVER_URL . "tofor.php";
    }
    //Allow disabling of inbound email love in case of spamming (can later be expanded to allow signed/tokened messages or private addresses)
    if ($loveinbox !== 'N') {
        //$statsHtml .= "<br/>Now! Send Love via Email: ".LOVEMAIL."<br/>Subject: $nickname {$row['why']}<br/> Subject: ".$nickname." ".$for."<br/>";
        //$statsPlain .= "\nNow! Send Love via Email: ".LOVEMAIL."\n Subject: $nickname {$row['why']}\n Subject: ".$nickname." ".$for."\n";
    }
    sendTemplateEmail($to, "love_email_{$status}" . $privateString, array('sender_nickname' => $from, 'for' => $for, 'url' => $url, 'stats_html' => $statsHtml, 'stats_plain' => $statsPlain));
    // check if we are set up to send sms
    if (!empty($phone) && empty($confirmsms) && !empty($country) && !empty($provider)) {
        global $provider_list;
        // Send an SMS message
        if (!empty($provider) && !empty($provider_list[$country][$provider])) {
            if ($provider[0] != '+') {
                $smsaddr = str_replace('{n}', $phone, $provider_list[$country][$provider]);
            } else {
                $smsaddr = substr($provider, 1);
            }
            $sms = "Love from {$from}: {$for}";
            if ($private == true) {
                $sms .= ' (sent quietly)';
            }
            send_authmail(array('sender' => 'smsuser', 'server' => 'gmail-ssl'), $smsaddr, '', $sms, '');
        }
    }
    return true;
}