/**
 * 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>';
}
/**
 * Delete group relations if user is deleted
 *
 * @param  (object) $group Group Entity
 *
 * @return bool
 */
function ossn_delete_group_relations($group)
{
    if ($group) {
        $delete = new OssnDatabase();
        $params['from'] = 'ossn_relationships';
        //delete group member requests if group deleted
        $params['wheres'] = array("relation_from='{$group->guid}' AND type='group:join:approve' OR", "relation_to='{$group->guid}' AND type='group:join'");
        if ($delete->delete($params)) {
            return true;
        }
    }
    return false;
}
function ossn_disable_cache()
{
    $database = new OssnDatabase();
    $params['table'] = 'siteayarlari';
    $params['names'] = array('value');
    $params['values'] = array(0);
    $params['wheres'] = array("setting_id='4'");
    if ($database->update($params)) {
        OssnFile::DeleteDir(ossn_route()->cache);
        return true;
    }
    return false;
}
 /**
  * Delete component
  *
  * @return boolean
  */
 public function delete($com)
 {
     if (in_array($com, $this->requiredComponents())) {
         return false;
     }
     $component = $this->getbyName($com);
     if (!$component) {
         return false;
     }
     $params = array();
     $params['from'] = "ossn_components";
     $params['wheres'] = array("com_id='{$com}'");
     if (parent::delete($params)) {
         //Delete component settings upon its deletion #538
         $entities = new OssnEntities();
         $entities->deleteByOwnerGuid($component->id, 'component');
         //delete component directory
         OssnFile::DeleteDir(ossn_route()->com . "{$com}/");
         return true;
     }
     return false;
 }
Example #5
0
 /**
  * Delete component
  *
  * @return boolean
  */
 public function delete($com)
 {
     if (in_array($com, $this->requiredComponents())) {
         return false;
     }
     $params = array();
     $params['from'] = "ossn_components";
     $params['wheres'] = array("com_id='{$com}'");
     if (parent::delete($params)) {
         OssnFile::DeleteDir(ossn_route()->com . "{$com}/");
         return true;
     }
     return false;
 }
/** 
 * Update processed upgrades
 *
 * @param integer $upgrade New release
 *
 * @return boolean
 */
function ossn_update_upgraded_files($upgrade)
{
    if (empty($upgrade)) {
        return false;
    }
    $database = new OssnDatabase();
    $upgrade_json = array_merge(ossn_get_upgraded_files(), array($upgrade));
    $upgrade_json = json_encode($upgrade_json);
    $update = array();
    $update['table'] = 'ossn_site_settings';
    $update['names'] = array('value');
    $update['values'] = array($upgrade_json);
    $update['wheres'] = array("name='upgrades'");
    if ($database->update($update)) {
        return true;
    } else {
        return false;
    }
}
Example #7
0
<?php

/**
 * Open Source Social Network
 *
 * @package   (Informatikon.com).ossn
 * @author    OSSN Core Team <*****@*****.**>
 * @copyright 2014 iNFORMATIKON TECHNOLOGIES
 * @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')");
<?php

$database = new OssnDatabase();
/**
 * Check if the upgrades settings exist or not
 *
 * @access private
 */
$fetch['from'] = 'siteayarlari';
$fetch['wheres'] = array("name='upgrades'");
$upgrade_settings = $database->select($fetch);
/**
 * 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
Example #9
0
<?php

/**
 * Open Source Social Network
 *
 * @package   (Informatikon.com).ossn
 * @author    OSSN Core Team <*****@*****.**>
 * @copyright 2014 iNFORMATIKON TECHNOLOGIES
 * @license   General Public Licence http://www.opensource-socialnetwork.org/licence
 * @link      http://www.opensource-socialnetwork.org/licence
 */
$settings = new OssnDatabase();
$sitename = input('sitename');
$owneremail = input('owneremail');
$sitelang = input('sitelang');
$notification_email = input('notification_email');
$errors = input('errors');
if (empty($sitename) || empty($owneremail) || empty($sitelang) || empty($errors)) {
    redirect(REF);
}
ossn_site_setting_update('site_name', $sitename, 2);
ossn_site_setting_update('lang', $sitelang, 3);
ossn_site_setting_update('owner_email', $owneremail, 5);
ossn_site_setting_update('notification_email', $notification_email, 6);
//update errors settings
$update['table'] = 'ossn_site_settings';
$update['names'] = array('value');
$update['values'] = array($errors);
$update['wheres'] = array("name='display_errors'");
$settings->update($update);
ossn_trigger_message(ossn_print('settings:saved'), 'success');
<?php

/**
 *    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;
Example #11
0
<?php

/**
 * Open Source Social Network
 *
 * @package   (Informatikon.com).ossn
 * @author    OSSN Core Team <*****@*****.**>
 * @copyright 2014 iNFORMATIKON TECHNOLOGIES
 * @license   General Public Licence http://www.opensource-socialnetwork.org/licence
 * @link      http://www.opensource-socialnetwork.org/licence
 */
$component = new OssnComponents();
$database = new OssnDatabase();
/**
 * Add OssnPoke Component
 *
 * @access private
 */
$component->newCom('OssnPoke');
/**
 * Delete invalid notification from system (group like)
 *
 * @access private
 */
$delete['from'] = 'ossn_notifications';
$delete['wheres'] = array("type='like:post:group:wall'");
$database->delete($delete);
/**
 * Update processed updates in database so user cannot upgrade again and again.
 *
 * @access private
Example #12
0
<?php

/**
 * Open Source Social Network
 *
 * @package   (Informatikon.com).ossn
 * @author    OSSN Core Team <*****@*****.**>
 * @copyright 2014 iNFORMATIKON TECHNOLOGIES
 * @license   General Public Licence http://www.opensource-socialnetwork.org/licence
 * @link      http://www.opensource-socialnetwork.org/licence
 */
$database = new OssnDatabase();
//regenerate .htaccess file
ossn_generate_server_config('apache');
/**
 * Update processed updates in database so user cannot upgrade again and again.
 *
 * can we make this script short? 
 */
$upgrade_json = array_merge(ossn_get_upgraded_files(), array($upgrade));
$upgrade_json = json_encode($upgrade_json);
$update = array();
$update['table'] = 'ossn_site_settings';
$update['names'] = array('value');
$update['values'] = array($upgrade_json);
$update['wheres'] = array("name='upgrades'");
$upgrade = str_replace('.php', '', $upgrade);
if ($database->update($update) && ossn_update_db_version('3.2')) {
    ossn_trigger_message(ossn_print('upgrade:success', array($upgrade)), 'success');
} else {
    ossn_trigger_message(ossn_print('upgrade:failed', array($upgrade)), 'error');
<?php

/**
 * 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.
 *
Example #14
0
<?php

/**
 * Open Source Social Network
 *
 * @package   (Informatikon.com).ossn
 * @author    OSSN Core Team <*****@*****.**>
 * @copyright 2014 iNFORMATIKON TECHNOLOGIES
 * @license   General Public Licence http://www.opensource-socialnetwork.org/licence
 * @link      http://www.opensource-socialnetwork.org/licence
 */
$component = new OssnComponents();
$database = new OssnDatabase();
/**
 * Add OssnChat Component
 *
 * @access private
 */
$component->ENABLE('OssnChat');
/**
 * Update processed updates in database so user cannot upgrade again and again.
 *
 * @access private
 */
$upgrade_json = array_merge(ossn_get_upgraded_files(), array($upgrade));
$upgrade_json = json_encode($upgrade_json);
$update['table'] = 'ossn_site_settings';
$update['names'] = array('value');
$update['values'] = array($upgrade_json);
$update['wheres'] = array("name='upgrades'");
$upgrade = str_replace('.php', '', $upgrade);
Example #15
0
<?php

/**
 * Open Source Social Network
 *
 * @package   (Informatikon.com).ossn
 * @author    OSSN Core Team <*****@*****.**>
 * @copyright 2014 iNFORMATIKON TECHNOLOGIES
 * @license   General Public Licence http://www.opensource-socialnetwork.org/licence
 * @link      http://www.opensource-socialnetwork.org/licence
 */
$database = new OssnDatabase();
/**
 * Check if the site errors settings exists or not
 *
 * @access private
 */
$fetch['from'] = 'ossn_site_settings';
$fetch['wheres'] = array("name='display_errors'");
$siterror_settings = $database->select($fetch);
/**
 * If settings didn't exist then create settings
 *
 * @access private
 */
if (empty($siterror_settings->setting_id)) {
    $insert['into'] = 'ossn_site_settings';
    $insert['names'] = array('name', 'value');
    $insert['values'] = array('display_errors', 'off');
    $database->insert($insert);
}
Example #16
0
 /**
  * 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;
 }
Example #17
0
<?php

/**
 * Open Source Social Network
 *
 * @package   (Informatikon.com).ossn
 * @author    OSSN Core Team <*****@*****.**>
 * @copyright 2014 iNFORMATIKON TECHNOLOGIES
 * @license   General Public Licence http://www.opensource-socialnetwork.org/licence
 * @link      http://www.opensource-socialnetwork.org/licence
 */
$database = new OssnDatabase();
/**
 * Check if the upgrades settings exist or not
 *
 * @access private
 */
$fetch['from'] = 'ossn_site_settings';
$fetch['wheres'] = array("name='upgrades'");
$upgrade_settings = $database->select($fetch);
/**
 * 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);
}
Example #18
0
            ossn_trigger_message(ossn_print('fields:require'), 'error');
            redirect(REF);
        }
    }
}
$password = input('password');
$types = array('normal', 'admin');
if (!in_array($user['type'], $types)) {
    ossn_trigger_message(ossn_print('account:create:error:admin'), 'error');
    redirect(REF);
}
$user['birthdate'] = "{$user['bdd']}/{$user['bdm']}/{$user['bdy']}";
$OssnUser = new OssnUser();
$OssnUser->password = $password;
$OssnUser->email = $user['email'];
$OssnDatabase = new OssnDatabase();
$params['table'] = 'ossn_users';
$params['wheres'] = array("guid='{$entity->guid}'");
$params['names'] = array('first_name', 'last_name', 'email', 'type');
$params['values'] = array($user['firstname'], $user['lastname'], $user['email'], $user['type']);
//check if email is not in user
if ($entity->email !== input('email')) {
    if ($OssnUser->isOssnEmail()) {
        ossn_trigger_message(ossn_print('email:inuse'), 'error');
        redirect(REF);
    }
}
//check if email is valid email
if (!$OssnUser->isEmail()) {
    ossn_trigger_message(ossn_print('email:invalid'), 'error');
    redirect(REF);
 /**
  * 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;
 }