Example #1
0
    $ret .= 'Whole query: ' . $query;
} else {
    if (mysql_num_rows($result) == 0) {
        $ret .= "<br/><font style=\"font-size: 1.3em;\">You have no messages.</font>\n";
    } else {
        // populate table
        $i = 0;
        while ($row = mysql_fetch_assoc($result)) {
            $id = $row['id'];
            $name = $row['name'];
            // Get picture
            $pic = $row['pic'];
            $new = $row['new'];
            $bg_style = $new == 1 ? 'newmsg' : '';
            $text = htmlspecialchars($row["msg"]);
            $text = put_links($text);
            $ret .= "<form method=\"post\">\n";
            $ret .= "<input type=\"hidden\" name=\"action\" value=\"1\">\n";
            $ret .= "<input type=\"hidden\" name=\"id\" value=\"" . $id . "\">\n";
            $ret .= "<input type=\"hidden\" name=\"to\" value=\"" . $row['from_uri'] . "\">\n";
            $ret .= "<input type=\"hidden\" name=\"name\" value=\"" . $name . "\">\n";
            $ret .= "<table>\n";
            $ret .= "<tr class=\"" . $bg_style . "\"><td colspan=\"2\"><hr class=\"hr-msg\" /><br/></td></tr>\n";
            $ret .= "<tr valign=\"top\" class=\"" . $bg_style . "\">\n";
            $ret .= "   <td width=\"80\" align=\"center\">\n";
            $ret .= "       <a href=\"view?webid=" . urlencode($row['from_uri']) . "\" target=\"_blank\"><img title=\"" . $name . "\" alt=\"" . $name . "\" width=\"48\" src=\"" . $pic . "\" style=\"padding: 0px 0px 10px;\" /></a>\n";
            $ret .= "   </td>\n";
            $ret .= "   <td>";
            $ret .= "       <table>\n";
            $ret .= "       <tr valign=\"top\">\n";
            $ret .= "           <td><b><a href=\"view?webid=" . urlencode($row['from_uri']) . "\" target=\"_blank\" style=\"font-color: black;\">" . $name . "</a></b> <small style=\"color: grey;\">" . date('Y-m-d H:i:s', $row['date']) . "</small></td>\n";
Example #2
0
            <div id="content">
                <?php 
include $this->section('flash');
?>
                <?php 
include_once $this->page();
?>
            </div>
            <div id="footer">
                <?php 
if (isset($metaAuthor)) {
    echo '&copy;' . date('Y') . ' ' . $metaAuthor;
}
?>
            </div>
            <?php 
if (DEBUG_ENABLED) {
    include $this->section('debug');
}
?>
        </div>
<!-- Javascript --><?php 
if (isset($jscripts)) {
    put_links($jscripts, $this, 'jscript', 'link_jscript');
}
// TODO: else {warning}
?>

    </body>
</html>
Example #3
0
 if (isset($_REQUEST['activity'])) {
     $ret .= "on <a href=\"wall.php?user="******"\" target=\"_blank\" style=\"font-color: black;\">";
     $ret .= $to_name . "'s Wall ";
     $ret .= "</a>";
 }
 // time of post
 $ret .= "<font color=\"grey\">";
 $ret .= "<span id=\"date_" . $row['id'] . "\">";
 $ret .= "<script type=\"text/javascript\">\$('#date_" . $row['id'] . "').text(moment(" . $timestamp . ").from());</script>";
 $ret .= "</span></font>\n";
 $ret .= "</td>\n";
 $ret .= "</tr>\n";
 // message
 $ret .= "<tr class=\"wall-post\">\n";
 $ret .= "<td class=\"wall-post\"><pre id=\"message_" . $row['id'] . "\"><span property=\"sioc:Post\" id=\"message_text_" . $row['id'] . "\">\n";
 $ret .= put_links($msg);
 $ret .= "</span></pre></td>\n";
 $ret .= "</tr>\n";
 // show options only if we are the source of the post
 $ret .= "<tr class=\"wall-post\">\n";
 $ret .= "<td class=\"wall-post\"><small>";
 if (isset($_SESSION['webid']) && ($_SESSION['webid'] == $row['from_uri'] || $_SESSION['webid'] == $row['to_uri'] && isset($_REQUEST['user']) && $_REQUEST['user'] != 'local')) {
     $add = '?user='******'message_text_" . $row['id'] . "', 'wall.php" . $add . "', '" . $row['id'] . "')\" style=\"cursor: pointer;\">Edit</a>";
     // add option to delete post
     $ret .= " <a href=\"wall.php" . $add . "&del=" . $row['id'] . "\">Delete</a>\n";
 }
 // show vote counters and buttons for logged users
 $ret .= add_vote_buttons($row['id']);
 $ret .= "</small></td>\n";
Example #4
0
 function load($count = 20, $offset = 0, $activity = False)
 {
     $posts = '';
     $this->offset = $offset;
     // display news feed for a certain user
     if ($_SESSION['webid'] && $activity == True) {
         $webids = sparql_get_people_im_friend_of($_SESSION['webid'], SPARQL_ENDPOINT);
         // Prepare the activity stream SQL query only if the user has friends (foaf:knows)
         if (sizeof($webids) > 0) {
             $query = 'SELECT * FROM pingback_messages WHERE to_hash IS NOT NULL AND wall=\'1\' AND (';
             foreach ($webids as $key => $from) {
                 $add = $key > 0 ? ' OR' : '';
                 $query .= $add . " from_uri='" . mysql_real_escape_string($from) . "'";
             }
             $query .= ' OR from_uri="' . mysql_real_escape_string($_SESSION['webid']) . '") ORDER by date DESC LIMIT ' . $count;
             // Contains the offset value for fetching wall messages
             if (isset($this->offset)) {
                 $query .= ' OFFSET ' . mysql_real_escape_string($this->offset);
             }
             $result = mysql_query($query);
             if (!$result) {
                 return 'Unable to connect to the database! Cannot display Activity Stream.';
             } else {
                 $rows = mysql_num_rows($result);
             }
         }
     } else {
         // get the last $count messages for a user
         $query = 'SELECT * FROM pingback_messages WHERE ' . 'to_hash=\'' . mysql_real_escape_string($this->owner) . '\' ' . 'AND wall=\'1\' ' . 'ORDER by date DESC ' . 'LIMIT ' . $count;
         // Contains the offset value for fetching wall messages
         if (isset($this->offset)) {
             $query .= ' OFFSET ' . mysql_real_escape_string($this->offset);
         }
         $result = mysql_query($query);
         if (!$result) {
             return 'Unable to connect to the database! Cannot display wall posts.';
         } else {
             $rows = mysql_num_rows($result);
         }
     }
     $posts .= '<!-- query=' . htmlentities($query) . ' -->';
     if ($rows == 0) {
         // There are no messages on the wall
         $posts .= "<p><font style=\"font-size: 1.3em;\">There are no messages.</font></p>\n";
         mysql_free_result($result);
     } else {
         // update offset value
         $this->offset = $this->offset + $count;
         // populate table
         $i = 0;
         while ($row = mysql_fetch_assoc($result)) {
             // get name
             $name = $row['name'];
             // get picture
             $pic = $row['pic'];
             // get the date and multiply by 1000 for milliseconds, otherwise moment.js breaks
             $timestamp = $row['date'] * 1000;
             // to whom it is addressed
             if (strlen($row['to_uri']) > 0) {
                 $to_person = new MyProfile($row['to_uri'], $base_uri, SPARQL_ENDPOINT);
                 $to_person->load();
                 $to_name = $to_person->get_name();
             } else {
                 $to_name = 'MyProfile';
             }
             $msg = htmlentities($row['msg']);
             // replace WebIDs with actual names and links to the WebID
             $msg = preg_replace_callback("/&lt;(.*)&gt;/Ui", "preg_get_handle_by_webid", $msg);
             // store everything in this table
             $posts .= "<a class=\"anchor\" name=\"post_" . $row['id'] . "\"></a>\n";
             $posts .= "<div class=\"wall-box shadow r3 clearfix\">\n";
             $posts .= "<table border=\"0\" class=\"wall-message\" >\n";
             $posts .= "<tr valign=\"top\">\n";
             $posts .= "<td align=\"left\" class=\"speaker\">\n";
             // image
             $posts .= "<a class=\"avatar-link\" href=\"view?webid=" . urlencode($row['from_uri']) . "\" target=\"_blank\">";
             $posts .= " <img title=\"" . $name . "\" alt=\"" . $name . "\" width=\"50\" src=\"" . $pic . "\" class=\"r5 image\" />";
             $posts .= "</a>\n";
             $posts .= "</td>\n";
             $posts .= "<td>";
             $posts .= "<table border=\"0\">\n";
             $posts .= "<tr valign=\"top\">\n";
             $posts .= "<td>\n";
             // author's name
             $posts .= "<b><a href=\"view?webid=" . urlencode($row['from_uri']) . "\" target=\"_blank\" style=\"font-color: black;\">";
             $posts .= "   <span>" . $name . "</span>";
             $posts .= "</a></b> wrote ";
             // activity stream
             if ($activity == True) {
                 $posts .= "on <a href=\"wall?user="******"\" target=\"_blank\" style=\"font-color: black;\">";
                 $posts .= $to_name . "'s Wall ";
                 $posts .= "</a>";
             }
             // time of post
             $posts .= "<font color=\"grey\">";
             $posts .= "<span id=\"date_" . $row['id'] . "\">";
             $posts .= "<script type=\"text/javascript\">\$('#date_" . $row['id'] . "').text(moment(" . $timestamp . ").from());</script>";
             $posts .= "</span></font>\n";
             $posts .= "<span class=\"pull-right\"><a href=\"#post_" . $row['id'] . "\">Link to this post.</a></span>\n";
             $posts .= "</td>\n";
             $posts .= "</tr>\n";
             // message
             $posts .= "<tr>\n";
             $posts .= "<td><div id=\"message_" . $row['id'] . "\"><pre class=\"wall-message\" id=\"message_text_" . $row['id'] . "\">\n";
             $posts .= put_links($msg);
             /*
                   $ret .= put_links(preg_replace('/(.*?)(<.*?>|$)/se', 'html_entity_decode("$1").htmlentities("$2")', $row['msg'])); 
             */
             $posts .= "</pre></div></td>\n";
             $posts .= "</tr>\n";
             // show options only if we are the source of the post
             $posts .= "<tr>\n";
             $posts .= "<td class=\"options\">";
             if ($_SESSION['webid'] && ($_SESSION['webid'] == $row['from_uri'] || $_SESSION['webid'] == $row['to_uri'] && $this->owner && $this->owner != 'local')) {
                 $add = '?user='******'message_text_" . $row['id'] . "', 'wall" . $add . "', '" . $row['id'] . "')\" style=\"cursor: pointer;\">Edit</a>";
                 // add option to delete post
                 $posts .= " | <a href=\"wall" . $add . "&del=" . $row['id'] . "\">Delete</a>\n";
             }
             // show vote counters and buttons for logged users
             $posts .= "<div class=\"options-vote\">" . add_vote_buttons($row['id']) . "</div>\n";
             $posts .= "</td>\n";
             $posts .= "</tr>\n";
             $posts .= "</table>\n";
             $posts .= "</td>\n";
             $posts .= "</tr>\n";
             $posts .= "</table>\n";
             $posts .= "</div>\n";
             $i++;
         }
         mysql_free_result($result);
     }
     if ($rows >= $count) {
         $posts .= "<input type=\"button\" class=\"r5 btn loadmore\" id=\"more_" . $row['id'] . "\" value=\"Load more\" onclick=\"loadWall('wall', 'more_" . $row['id'] . "', '20', '" . $this->offset . "', '{$this->owner}', '" . $activity . "')\" />\n";
     }
     return $posts;
 }