/**
 * Notification View for liking annotation
 *
 * @return voud;
 * @access private
 */
function ossn_like_annotation($hook, $type, $return, $params)
{
    $notif = $params;
    $baseurl = ossn_site_url();
    $user = ossn_user_by_guid($notif->poster_guid);
    $user->fullname = "<strong>{$user->fullname}</strong>";
    $img = "<div class='notification-image'><img src='{$baseurl}/avatar/{$user->username}/small' /></div>";
    if (preg_match('/like/i', $notif->type)) {
        $type = 'like';
        $database = new OssnDatabase();
        $database->statement("SELECT * FROM kullaniciveriler WHERE(guid='{$notif->subject_guid}')");
        $database->execute();
        $result = $database->fetch();
        $url = ossn_site_url("post/view/{$notif->subject_guid}#comments-item-{$notif->item_guid}");
        if ($result->subtype == 'file:ossn:aphoto') {
            $url = ossn_site_url("photos/view/{$notif->subject_guid}#comments-item-{$notif->item_guid}");
        }
    }
    $type = "<div class='ossn-notification-icon-{$type}'></div>";
    if ($notif->viewed !== NULL) {
        $viewed = '';
    } elseif ($notif->viewed == NULL) {
        $viewed = 'class="ossn-notification-unviewed"';
    }
    $notification_read = "{$baseurl}notification/read/{$notif->guid}?notification=" . urlencode($url);
    return "<a href='{$notification_read}'>\n\t       <li {$viewed}> {$img} \n\t\t   <div class='notfi-meta'> {$type}\n\t\t   <div class='data'>" . ossn_print("ossn:notifications:{$notif->type}", array($user->fullname)) . '</div>
		   </div></li>';
}
 /**
  * Get user group posts guids
  *
  * @param integer $userguid Guid of user
  *
  * @return array;
  */
 public static function getUserGroupPostsGuids($userguid)
 {
     if (empty($userguid)) {
         return false;
     }
     $statement = "SELECT * FROM ossn_entities, ossn_entities_metadata WHERE(\n\t\t\t\t  ossn_entities_metadata.guid = ossn_entities.guid \n\t\t\t\t  AND  ossn_entities.subtype='poster_guid'\n\t\t\t\t  AND type = 'object'\n\t\t\t\t  AND value = '{$userguid}'\n\t\t\t\t  );";
     $database = new OssnDatabase();
     $database->statement($statement);
     $database->execute();
     $objects = $database->fetch(true);
     if ($objects) {
         foreach ($objects as $object) {
             $guids[] = $object->owner_guid;
         }
         asort($guids);
         return $guids;
     }
     return false;
 }
 * @link      http://www.opensource-socialnetwork.org/licence
 */
//This upgrade might timeout, so set no time limit
set_time_limit(0);
//Please see: Things , should be provided in 3.x #421
$database = new OssnDatabase();
//delete a notification that have incorrect owner_guid
//1.) Remove old like:post:group:wall notification type
//2.) Remove old comments:post:group:wall type
$vars['from'] = 'ossn_notifications';
$vars['wheres'] = array("type = 'like:post:group:wall' OR type='comments:post:group:wall'");
$database->delete($vars);
//add new column to users table
//3.) Add time_created to ossn_users table
$database->statement("ALTER TABLE `ossn_users` ADD `time_created` INT(11) NOT NULL AFTER `activation`;");
$database->execute();
//ossn_object description text to longtext and title to text #459
//5.) ossn_object description text to longtext and title to text #459
$database->statement("ALTER TABLE `ossn_object` CHANGE `title` `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, \n\t\t\t\t\t CHANGE `description` `description` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;");
$database->execute();
//add last_cache and site_version in settings
$database->statement("INSERT INTO `ossn_site_settings` (`name`) VALUES ('last_cache')");
$database->execute();
$database->statement("INSERT INTO `ossn_site_settings` (`name`) VALUES ('site_version')");
$database->execute();
//update user time_created cloumn from user entites
$users = ossn_get_entities(array('type' => 'user', 'subtype' => 'gender', 'page_limit' => false));
if ($users) {
    unset($vars);
    foreach ($users as $user) {
        if (isset($user->owner_guid) && empty($user->owner_guid)) {
 /**
  * Get user group posts guids
  *
  * @param (int) $userguid Guid of user
  *
  * @return array;
  */
 public static function getUserGroupPostsGuids($userguid)
 {
     if (empty($userguid)) {
         return false;
     }
     $statement = "SELECT * FROM kullaniciveriler, kullanicivericerik WHERE(\n\t\t\t\t  kullanicivericerik.guid = kullaniciveriler.guid\n\t\t\t\t  AND  kullaniciveriler.subtype='poster_guid'\n\t\t\t\t  AND type = 'object'\n\t\t\t\t  AND value = '{$userguid}'\n\t\t\t\t  );";
     $database = new OssnDatabase();
     $database->statement($statement);
     $database->execute();
     $objects = $database->fetch(true);
     if ($objects) {
         foreach ($objects as $object) {
             $guids[] = $object->owner_guid;
         }
         asort($guids);
         return $guids;
     }
     return false;
 }