/** * Post Comment * * @params $subject_id: Id of item on which user comment * $guid: User id * $comment: Comment * $type: Post or Entity * * @return bool; */ public function PostComment($subject_id, $guid, $comment, $type = 'post') { if ($subject_id < 1 || $guid < 1 || empty($comment)) { return false; } $this->subject_guid = $subject_id; $this->owner_guid = $guid; $this->type = "comments:{$type}"; $this->value = $comment; if ($this->addAnnotation()) { if (isset($this->comment_image)) { $image = base64_decode($this->comment_image); $file = ossn_string_decrypt(base64_decode($image)); $file_path = rtrim(ossn_validate_filepath($file), '/'); $_FILES['attachment'] = array('name' => $file_path, 'tmp_name' => $file_path, 'type' => 'image/jpeg', 'size' => filesize($file_path), 'error' => UPLOAD_ERR_OK); $file = new OssnFile(); $file->type = 'annotation'; $file->subtype = 'comment:photo'; $file->setFile('attachment'); $file->setPath('comment/photo/'); $file->owner_guid = $this->getAnnotationId(); if ($file->owner_guid !== 0) { $file->addFile(); unlink($file_path); unset($_FILES['attachment']); } } return true; } return false; }
/** * Get ad image * * @return image; * @access public */ function ossn_ad_image($guid) { $photo = new OssnFile(); $photo->owner_guid = $guid; $photo->type = 'object'; $photo->subtype = 'ossnads'; $photos = $photo->getFiles(); if (isset($photos->{0}->value) && !empty($photos->{0}->value)) { $datadir = ossn_get_userdata("object/{$guid}/{$photos->{0}->value}"); return file_get_contents($datadir); } }
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; }
/** * Delete theme * * @return boolean */ public function deletetheme($theme) { if (OssnFile::DeleteDir(ossn_route()->themes . "{$theme}/")) { return true; } return false; }
/** * 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; }
/** * Delete Annotation * * @params $annotation = annotation_id * * @return bool; */ public function deleteAnnotation($annotation) { self::initAttributes(); if ($this->deleteByOwnerGuid($annotation, 'annotation')) { $this->statement("DELETE FROM yorumlar WHERE(id='{$annotation}')"); if ($this->execute()) { $data = ossn_get_userdata("annotation/{$annotation}/"); if (is_dir($data)) { OssnFile::DeleteDir($data); rmdir($data); } $params['annotation'] = $annotation; ossn_trigger_callback('annotation', 'delete', $params); return true; } } return false; }
/** * Delete object; * * @param integer $object Object guid * * @return boolean */ public function deleteObject($object) { self::initAttributes(); if (isset($this->guid)) { $object = $this->guid; } //delete entites of (this) object if ($this->deleteByOwnerGuid($object, 'object')) { $data = ossn_get_userdata("object/{$object}/"); if (is_dir($data)) { OssnFile::DeleteDir($data); } } $delete['from'] = 'ossn_object'; $delete['wheres'] = array("guid='{$object}'"); if ($this->delete($delete)) { return true; } return false; }
/** * Delete user from syste, * * @return boolean */ public function deleteUser() { self::initAttributes(); if (!empty($this->guid) && !empty($this->username)) { $params['from'] = 'ossn_users'; $params['wheres'] = array("guid='{$this->guid}'"); if ($this->delete($params)) { //delete user files $datadir = ossn_get_userdata("user/{$this->guid}/"); if (is_dir($datadir)) { OssnFile::DeleteDir($datadir); //From of v2.0 DeleteDir delete directory also #138 //rmdir($datadir); } //delete user entites also $this->deleteByOwnerGuid($this->guid, 'user'); //delete annotations $this->OssnAnnotation->owner_guid = $this->guid; $this->OssnAnnotation->deleteAnnotationByOwner($this->guid); //trigger callback so other components can be notified when user deleted. //should delete relationships ossn_delete_user_relations($this); $vars['entity'] = $this; ossn_trigger_callback('user', 'delete', $vars); return true; } } return false; }
function get_cover_photo($guid) { $photo = new OssnFile(); $photo->owner_guid = $guid; $photo->type = 'user'; $photo->subtype = 'profile:cover'; $photos = $photo->getFiles(); if (isset($photos->{0}->value)) { $datadir = ossn_get_userdata("user/{$guid}/{$photos->{0}->value}"); return file_get_contents($datadir); } else { redirect('components/OssnProfile/images/transparent.png'); } }
<?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 */ $file = new OssnFile(); $file->owner_guid = ossn_loggedin_user()->guid; $file->type = 'user'; $file->subtype = 'profile:photo'; $file->setFile('userphoto'); $file->setPath('profile/photo/'); if ($file->addFile()) { $resize = $file->getFiles(); if (isset($resize->{0}->value)) { $guid = ossn_loggedin_user()->guid; $datadir = ossn_get_userdata("user/{$guid}/{$resize->{0}->value}"); $file_name = str_replace('profile/photo/', '', $resize->{0}->value); $sizes = ossn_user_image_sizes(); foreach ($sizes as $size => $params) { $params = explode('x', $params); $width = $params[1]; $height = $params[0]; $resized = ossn_resize_image($datadir, $width, $height, true); file_put_contents(ossn_get_userdata("user/{$guid}/profile/photo/{$size}_{$file_name}"), $resized); }
/** * Get user default profile photo guid * * @return bool */ function get_profile_photo_guid($guid) { $photo = new OssnFile(); $photo->owner_guid = $guid; $photo->type = 'user'; $photo->subtype = 'profile:photo'; $photos = $photo->getFiles(); if (isset($photos->{0}->guid)) { return $photos->{0}->guid; } return false; }
/** * Delete component * * @return bool; */ public function deletecom($com) { if (in_array($com, $this->requiredComponents())) { return false; } $this->statement("DELETE FROM ossn_components WHERE(com_id='{$com}');"); if ($this->execute()) { OssnFile::DeleteDir(ossn_route()->com . "{$com}/"); return true; } return false; }
<?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 */ $file = new OssnFile(); $file->owner_guid = ossn_loggedin_user()->guid; $file->type = 'user'; $file->subtype = 'profile:cover'; $file->setFile('coverphoto'); $file->setPath('profile/cover/'); if ($file->addFile()) { $newcover = $file->getFiles(); $ossnprofile = new OssnProfile(); $ossnprofile->ResetCoverPostition($file->owner_guid); $ossnprofile->addPhotoWallPost($file->owner_guid, $newcover->{0}->guid, 'cover:photo'); echo 1; } else { echo 0; }
/** * Get user default cover photo * * @return string|null data; */ function get_cover_photo($guid, $params = array()) { $photo = new OssnFile(); $photo->owner_guid = $guid; $photo->type = 'user'; $photo->subtype = 'profile:cover'; $photos = $photo->getFiles(); if (isset($photos->{0}->value)) { if (!empty($params[1]) && $params[1] == 1) { $datadir = ossn_get_userdata("user/{$guid}/{$photos->{0}->value}"); echo ossn_resize_image($datadir, 170, 170, true); } else { $datadir = ossn_get_userdata("user/{$guid}/{$photos->{0}->value}"); return file_get_contents($datadir); } } else { redirect('components/OssnProfile/images/transparent.png'); } }
<?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 */ $file = new OssnFile(); $file->owner_guid = ossn_loggedin_user()->guid; $file->type = 'user'; $file->subtype = 'profile:cover'; $file->setFile('coverphoto'); $file->setPath('profile/cover/'); if ($file->addFile()) { $ossnprofile = new OssnProfile(); $ossnprofile->ResetCoverPostition($file->owner_guid); echo 1; } else { echo 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 */ $profile = new OssnProfile(); $file = new OssnFile(); $user = ossn_loggedin_user(); $file->owner_guid = $user->guid; $file->type = 'user'; $file->subtype = 'profile:photo'; $file->setFile('userphoto'); $file->setPath('profile/photo/'); $file->setExtension(array('jpg', 'png', 'jpeg', 'gif')); if ($file->addFile()) { //update user icon time, this time has nothing to do with photo entity time $user->data->icon_time = time(); $user->save(); //get a all user photo files $resize = $file->getFiles(); //add a wall post for photo update $profile->addPhotoWallPost($file->owner_guid, $resize->{0}->guid); if (isset($resize->{0}->value)) { $guid = $user->guid; $datadir = ossn_get_userdata("user/{$guid}/{$resize->{0}->value}");
<?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 */ $file = new OssnFile(); $file->owner_guid = ossn_loggedin_user()->guid; $file->type = 'user'; $file->subtype = 'profile:cover'; $file->setFile('coverphoto'); $file->setPath('profile/cover/'); $file->setExtension(array('jpg', 'png', 'jpeg', 'gif')); if ($file->addFile()) { $newcover = $file->getFiles(); $ossnprofile = new OssnProfile(); $ossnprofile->ResetCoverPostition($file->owner_guid); $ossnprofile->addPhotoWallPost($file->owner_guid, $newcover->{0}->guid, 'cover:photo'); echo 1; } else { echo 0; }
/** * Get user profile photos album * * @params = $user User guid * * @return object; */ public function GetUserProfilePhotos($user) { $photos = new OssnFile(); $photos->owner_guid = $user; $photos->type = 'user'; $photos->subtype = 'profile:photo'; $photos->order_by = 'guid DESC'; return $photos->getFiles(); }
/** * Delete object; * * @params = $object => object guid * * @return bool; */ public function deleteObject($object) { //delete entites of (this) object if ($this->deleteByOwnerGuid($object, 'object')) { $data = ossn_get_userdata("object/{$object}/"); if (is_dir($data)) { OssnFile::DeleteDir($data); rmdir($data); } } $this->statement("DELETE FROM paylasimlar WHERE(guid='{$object}')"); if ($this->execute()) { return true; } return false; }