/** * 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; }
* @license General Public Licence http://www.opensource-socialnetwork.org/licence * @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 settings didn't exist then create settings * * @access private */ if (empty($upgrade_settings->setting_id)) { $insert['into'] = 'ossn_site_settings'; $insert['names'] = array('name', 'value'); $insert['values'] = array('upgrades', ''); $database->insert($insert); } /** * Fixed the relationship table type from int to varchat * * @access private */ $database->statement("ALTER TABLE `ossn_relationships`\n CHANGE `type` `type` VARCHAR( 20 ) \n\t\t\t\t\t CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ;"); $database->execute(); /** * Fix character settings for settings table * * @access private */ $database->statement("ALTER TABLE `ossn_site_settings` \n DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;"); $database->execute(); /** * Register a OssnBlock component * * @access private */ $database->statement("INSERT `ossn_components` (`com_id`, `active`) \n VALUES('OssnBlock', '0')"); $database->execute();
/** * OpenSource-SocialNetwork * * @package (Informatikon.com).ossn * @author OSSN Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://opensource-socialnetwork.com/licence * @link http://www.opensource-socialnetwork.com/licence */ $database = new OssnDatabase(); /** * Fix duplicate username in database * * @access private */ $database->statement("SELECT DISTINCT username, count(username) as \n\t\t\t\t times FROM `ossn_users` GROUP BY username HAVING \n\t\t\t\t count(username) > 1"); $database->execute(); $data = $database->fetch(true); foreach ($data as $meta) { $duplicates[] = $meta->username; $database->statement("SELECT * FROM `ossn_users` \n\t\t\t\t\t\t\t WHERE(username='******');"); $database->execute(); $users = $database->fetch(true); //no need to fix first username unset($users->{0}); $increment = 0; foreach ($users as $user) { $databasen = $increment + 1; $databaseusername = $user->username . '' . $databasen; $database->statement("UPDATE `ossn_users` SET \n\t\t\t\t\t\t\t\t username='******' \n\t\t\t\t\t\t\t\t WHERE(guid='{$user->guid}');"); $database->execute();
/** * OpenSource-SocialNetwork * * @package (Informatikon.com).ossn * @author OSSN Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://opensource-socialnetwork.com/licence * @link http://www.opensource-socialnetwork.com/licence */ $database = new OssnDatabase(); $Component = new OssnComponents(); /** * Fix typo in database table */ $database->statement("ALTER TABLE `ossn_entities` \n\t\t\t\t\t CHANGE `premission` `permission` INT( 1 ) NOT NULL ;"); $database->execute(); /** * Change component name size */ $database->statement("ALTER TABLE `ossn_components` \n\t\t\t\t\t CHANGE `com_id` `com_id` TEXT CHARACTER SET utf8 \n\t\t\t\t\t COLLATE utf8_general_ci NOT NULL ;"); $database->execute(); /** * Add OssnEmbed and OssnInvite Component */ $Component->ENABLE('OssnEmbed'); $Component->ENABLE('OssnInvite'); /** * Update processed updates in database so user cannot upgrade again and again. * * @access private
* If settings didn't exist then create settings * * @access private */ if (empty($upgrade_settings->setting_id)) { $insert['into'] = 'siteayarlari'; $insert['names'] = array('name', 'value'); $insert['values'] = array('upgrades', ''); $database->insert($insert); } /** * Fixed the relationship table type from int to varchat * * @access private */ $database->statement("ALTER TABLE `arkadasliklar`\n CHANGE `type` `type` VARCHAR( 20 ) \n\t\t\t\t\t CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ;"); $database->execute(); /** * Fix character settings for settings table * * @access private */ $database->statement("ALTER TABLE `siteayarlari`\n DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;"); $database->execute(); /** * Register a OssnBlock component * * @access private */ $database->statement("INSERT `bilesenler` (`com_id`, `active`)\n VALUES('OssnBlock', '0')"); $database->execute();
/** * 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; }