本文整理汇总了PHP中ossn_get_userdata函数的典型用法代码示例。如果您正苦于以下问题:PHP ossn_get_userdata函数的具体用法?PHP ossn_get_userdata怎么用?PHP ossn_get_userdata使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ossn_get_userdata函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
/**
* Upload component
*
* @requires component package file,
*
* @return bool;
*/
public function upload()
{
$archive = new ZipArchive();
$data_dir = ossn_get_userdata('tmp/components');
if (!is_dir($data_dir)) {
mkdir($data_dir, 0755, true);
}
$zip = $_FILES['com_file'];
$newfile = "{$data_dir}/{$zip['name']}";
if (move_uploaded_file($zip['tmp_name'], $newfile)) {
if ($archive->open($newfile) === TRUE) {
$archive->extractTo($data_dir);
//make community components works on installer #394
$validate = $archive->statIndex(0);
$validate = str_replace('/', '', $validate['name']);
$archive->close();
if (is_dir("{$data_dir}/{$validate}") && is_file("{$data_dir}/{$validate}/ossn_com.php") && is_file("{$data_dir}/{$validate}/ossn_com.xml")) {
$archive->open($newfile);
$archive->extractTo(ossn_route()->com);
$archive->close();
$this->newCom($validate);
OssnFile::DeleteDir($data_dir);
return true;
}
}
}
return false;
}
示例2: upload
/**
* Upload component
*
* @requires component package file,
*
* @return bool;
*/
public function upload()
{
$archive = new ZipArchive();
$data_dir = ossn_get_userdata('tmp/components');
if (!is_dir($data_dir)) {
mkdir($data_dir, 0755, true);
}
$zip = $_FILES['com_file'];
$newfile = "{$data_dir}/{$zip['name']}";
if (move_uploaded_file($zip['tmp_name'], $newfile)) {
if ($archive->open($newfile) === TRUE) {
$archive->extractTo($data_dir);
$archive->close();
$validate = pathinfo($zip['name'], PATHINFO_FILENAME);
if (is_file("{$data_dir}/{$validate}/ossn_com.php") && is_file("{$data_dir}/{$validate}/ossn_com.xml")) {
$archive->open($newfile);
$archive->extractTo(ossn_route()->com);
$archive->close();
$this->newCom($validate);
OssnFile::DeleteDir($data_dir);
return true;
}
}
}
return false;
}
示例3: upload
/**
* Upload component
*
* Requires component package file,
*
* @return boolean
*/
public function upload()
{
$archive = new ZipArchive();
$data_dir = ossn_get_userdata('tmp/themes');
if (!is_dir($data_dir)) {
mkdir($data_dir, 0755, true);
}
$file = new OssnFile();
$file->setFile('theme_file');
$file->setExtension(array('zip'));
$zip = $file->file;
$newfile = "{$data_dir}/{$zip['name']}";
if (move_uploaded_file($zip['tmp_name'], $newfile)) {
if ($archive->open($newfile) === TRUE) {
$archive->extractTo($data_dir);
$archive->close();
$validate = pathinfo($zip['name'], PATHINFO_FILENAME);
if (is_file("{$data_dir}/{$validate}/ossn_theme.php") && is_file("{$data_dir}/{$validate}/ossn_theme.xml")) {
$archive->open($newfile);
$archive->extractTo(ossn_route()->themes);
$archive->close();
OssnFile::DeleteDir($data_dir);
return true;
}
}
}
return false;
}
示例4: ossn_ad_image
/**
* 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);
}
}
示例5: upload
/**
* Upload component
*
* Requires component package file,
*
* @return boolean
*/
public function upload()
{
$archive = new ZipArchive();
$data_dir = ossn_get_userdata('tmp/components');
if (!is_dir($data_dir)) {
mkdir($data_dir, 0755, true);
}
$zip = $_FILES['com_file'];
$newfile = "{$data_dir}/{$zip['name']}";
if (move_uploaded_file($zip['tmp_name'], $newfile)) {
if ($archive->open($newfile) === TRUE) {
$translit = OssnTranslit::urlize($zip['name']);
//make community components works on installer #394
//Component installer problems with certain zip - archives #420
$archive->extractTo($data_dir . '/' . $translit);
$dirctory = scandir($data_dir . '/' . $translit, 1);
$dirctory = $dirctory[0];
$files = $data_dir . '/' . $translit . '/' . $dirctory . '/';
$archive->close();
if (is_dir($files) && is_file("{$files}ossn_com.php") && is_file("{$files}ossn_com.xml")) {
$ossn_com_xml = simplexml_load_file("{$files}ossn_com.xml");
//need to check id , since ossn v3.x
if (isset($ossn_com_xml->id) && !empty($ossn_com_xml->id)) {
//move to components directory
if (OssnFile::moveFiles($files, ossn_route()->com . $ossn_com_xml->id . '/')) {
//add new component to system
$this->newCom($ossn_com_xml->id);
//why it shows success even if the component is not updated #510
OssnFile::DeleteDir($data_dir);
return true;
}
}
}
}
}
return false;
}
示例6: addFile
/**
* addFile
* Add file to database
*
* @param (object)->owner_guid guid of owner , the file belongs to
* @param (object)->type owner type,
* @param (object)->subtype file type
*
* @return (bool)
*/
public function addFile()
{
if (isset($this->file) && !empty($this->file) && !empty($this->owner_guid) && !empty($this->subtype) && !empty($this->type)) {
if (preg_match('/image/i', $this->file['type'])) {
$this->mime = $this->MimeTypeImages();
$this->newfilename = md5($this->file['name'] . rand() . time()) . '.' . $this->mime[$this->file['type']];
$this->newfile = $this->path . $this->newfilename;
$this->dir = ossn_get_userdata("{$this->type}/{$this->owner_guid}/{$this->path}");
if (!is_dir(ossn_get_userdata($this->dir))) {
mkdir($this->dir, 0755, true);
}
$this->subtype = "file:{$this->subtype}";
$this->value = $this->newfile;
if ($this->add()) {
$image = ossn_resize_image($this->file['tmp_name'], 2048, 2048);
file_put_contents("{$this->dir}{$this->newfilename}", $image);
return true;
}
}
//normal types goes here
//version 1.x
//dev $arsalanshah
}
}
示例7: deleteAnnotation
/**
* 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;
}
示例8: ossn_comment_page
/**
* Comment page for viewing comment photos
*
* @access private;
*/
function ossn_comment_page($pages)
{
$page = $pages[0];
switch ($page) {
case 'image':
if (!empty($pages[1]) && !empty($pages[2])) {
$file = ossn_get_userdata("annotation/{$pages[1]}/comment/photo/{$pages[2]}");
header('Content-Type: image/jpeg');
if (is_file($file)) {
echo ossn_resize_image($file, 300, 300);
} else {
ossn_error_page();
}
} else {
ossn_error_page();
}
break;
case 'attachment':
header('Content-Type: application/json');
if (isset($_FILES['file']['tmp_name']) && ossn_isLoggedin()) {
$file = $_FILES['file']['tmp_name'];
$unique = time() . '-' . substr(md5(time()), 0, 6) . '.jpg';
$newfile = ossn_get_userdata("tmp/photos/{$unique}");
$dir = ossn_get_userdata("tmp/photos/");
if (!is_dir($dir)) {
mkdir($dir, 0755, true);
}
if (move_uploaded_file($file, $newfile)) {
$file = base64_encode(ossn_string_encrypt($newfile));
echo json_encode(array('file' => base64_encode($file), 'type' => 1));
exit;
}
}
echo json_encode(array('type' => 0));
break;
case 'staticimage':
$image = base64_decode(input('image'));
if (!empty($image)) {
$file = ossn_string_decrypt(base64_decode($image));
header('content-type: image/jpeg');
$file = rtrim(ossn_validate_filepath($file), '/');
if (is_file($file)) {
echo file_get_contents($file);
} else {
ossn_error_page();
}
} else {
ossn_error_page();
}
break;
}
}
示例9: ossn_groups_page
/**
* Groups page handler
*
* Pages:
* groups/
* groups/add ( ajax )
* @return mixdata;
* @access private
*/
function ossn_groups_page($pages)
{
$page = $pages[0];
if (empty($page)) {
return false;
}
switch ($page) {
case 'add':
$params = array('action' => ossn_site_url() . 'action/group/add', 'component' => 'OssnGroups', 'class' => 'ossn-form');
$form = ossn_view_form('add', $params, false);
echo ossn_plugin_view('output/ossnbox', array('title' => ossn_print('add:group'), 'contents' => $form, 'callback' => '#ossn-group-submit'));
break;
case 'cover':
if (isset($pages[1]) && !empty($pages[1])) {
$File = new OssnFile();
$File->file_id = $pages[1];
$File = $File->fetchFile();
$etag = $File->guid . $File->time_created;
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == "\"{$etag}\"") {
header("HTTP/1.1 304 Not Modified");
exit;
}
if (isset($File->guid)) {
$Cover = ossn_get_userdata("object/{$File->owner_guid}/{$File->value}");
$filesize = filesize($Cover);
header("Content-type: image/jpeg");
header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', strtotime("+6 months")), true);
header("Pragma: public");
header("Cache-Control: public");
header("Content-Length: {$filesize}");
header("ETag: \"{$etag}\"");
readfile($Cover);
return;
} else {
ossn_error_page();
}
}
break;
default:
echo ossn_error_page();
break;
}
}
示例10: deleteUser
/**
* 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;
}
示例11: deleteObject
/**
* 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;
}
示例12: deleteAlbumPhoto
/**
* Delete profile photo
*
* @params = $this->photoid Id of photo
*
* @return bool;
*/
public function deleteAlbumPhoto()
{
if (isset($this->photoid)) {
$this->file_id = $this->photoid;
$this->entity = new OssnEntities();
$file = $this->fetchFile();
$source = ossn_get_userdata("object/{$file->owner_guid}/{$file->value}");
//delete croped photos
unlink($source);
foreach (ossn_photos_sizes() as $size => $dimensions) {
$filename = str_replace('album/photos/', '', $file->value);
$filename = ossn_get_userdata("object/{$file->owner_guid}/album/photos/{$size}_{$filename}");
unlink($filename);
}
//delete photo from database
if ($this->deleteEntity($file->guid)) {
$params['photo'] = get_object_vars($file);
ossn_trigger_callback('delete', 'album:photo', $params);
return true;
}
}
return false;
}
示例13: deleteObject
/**
* 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;
}
示例14: addFile
/**
* addFile
* Add file to database
*
* @param integer $object->owner_guid Guid of owner , the file belongs to
* @param string $object->type Owner type,
* @param string $object->subtype file type
*
* @return boolean
*/
public function addFile()
{
if (isset($this->file) && !empty($this->file) && !empty($this->owner_guid) && !empty($this->subtype) && !empty($this->type)) {
$this->extensions = $this->allowedFileExtensions();
$this->extension = $this->getFileExtension($this->file['name']);
//change user file extension to lower case #153
$this->extension = strtolower($this->extension);
if ($this->typeAllowed()) {
$this->newfilename = md5($this->file['name'] . rand() . time()) . '.' . $this->extension;
$this->newfile = $this->path . $this->newfilename;
$this->dir = ossn_get_userdata("{$this->type}/{$this->owner_guid}/{$this->path}");
if (!is_dir(ossn_get_userdata($this->dir))) {
mkdir($this->dir, 0755, true);
}
$this->subtype = "file:{$this->subtype}";
$this->value = $this->newfile;
if ($this->add()) {
$filecontents = file_get_contents($this->file['tmp_name']);
if (preg_match('/image/i', $this->file['type'])) {
//allow devs to change default size , see #528
$image_res = array('width' => 2048, 'height' => 2048);
$image_res = ossn_call_hook('file', 'image:resolution', $this, $image_res);
//compress image before save
$filecontents = ossn_resize_image($this->file['tmp_name'], $image_res['width'], $image_res['height']);
}
file_put_contents("{$this->dir}{$this->newfilename}", $filecontents);
return true;
}
}
}
return false;
}
示例15: ossn_post_page
/**
* OssnWall post page handlers
*
* @param array $pages List of pages
*
* @return false|mixed data
* @access private
*/
function ossn_post_page($pages)
{
$page = $pages[0];
if (empty($page)) {
return false;
}
switch ($page) {
case 'view':
$title = ossn_print('post:view');
$wall = new OssnWall();
$post = $pages[1];
$post = $wall->GetPost($post);
if (empty($post->guid) || empty($pages[1])) {
ossn_error_page();
}
$params['post'] = $post;
$contents = array('content' => ossn_plugin_view('wall/pages/view', $params));
$content = ossn_set_page_layout('newsfeed', $contents);
echo ossn_view_page($title, $content);
break;
case 'photo':
if (isset($pages[1]) && isset($pages[2])) {
$name = str_replace(array('.jpg', '.jpeg', 'gif'), '', $pages[2]);
$etag = $pages[1] . $name;
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == "\"{$etag}\"") {
header("HTTP/1.1 304 Not Modified");
exit;
}
$image = ossn_get_userdata("object/{$pages[1]}/ossnwall/images/{$pages[2]}");
//get image file else show error page
if (is_file($image)) {
//Image cache on wall post #529
$filesize = filesize($image);
header("Content-type: image/jpeg");
header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', strtotime("+6 months")), true);
header("Pragma: public");
header("Cache-Control: public");
header("Content-Length: {$filesize}");
header("ETag: \"{$etag}\"");
readfile($image);
return;
} else {
ossn_error_page();
}
}
break;
case 'privacy':
if (ossn_is_xhr()) {
$params = array('title' => ossn_print('privacy'), 'contents' => ossn_plugin_view('wall/privacy'), 'callback' => '#ossn-wall-privacy');
echo ossn_plugin_view('output/ossnbox', $params);
}
break;
case 'refresh_home':
echo ossn_plugin_view('wall/siteactivity');
break;
default:
ossn_error_page();
break;
}
}