本文整理汇总了PHP中FD::privacy方法的典型用法代码示例。如果您正苦于以下问题:PHP FD::privacy方法的具体用法?PHP FD::privacy怎么用?PHP FD::privacy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FD
的用法示例。
在下文中一共展示了FD::privacy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onPrepareStream
public function onPrepareStream(SocialStreamItem &$stream, $includePrivacy = true)
{
if ($stream->context != 'relationship') {
return;
}
$params = $this->getParams();
if (!$params->get('stream_approve', true)) {
return;
}
// Get the actor
$actor = $stream->actor;
// check if the actor is ESAD profile or not, if yes, we skip the rendering.
if (!$actor->hasCommunityAccess()) {
$stream->title = '';
return;
}
$my = FD::user();
$privacy = FD::privacy($my->id);
if ($includePrivacy && !$privacy->validate('core.view', $stream->contextId, 'relationship', $stream->actor->id)) {
return;
}
$stream->color = '#DC554F';
$stream->fonticon = 'ies-heart';
$stream->label = FD::_('APP_USER_RELATIONSHIP_STREAM_TOOLTIP', true);
$stream->display = SOCIAL_STREAM_DISPLAY_FULL;
$registry = FD::registry($stream->params);
$this->set('type', $registry->get('type'));
$this->set('actor', $stream->actor);
$this->set('target', $stream->targets[0]);
$stream->title = parent::display('streams/' . $stream->verb . '.title');
if ($includePrivacy) {
$stream->privacy = $privacy->form($stream->contextId, 'relationship', $stream->actor->id, 'core.view', false, $stream->uid);
}
return true;
}
示例2: display
/**
* Displays the application output in the canvas.
*
* @since 1.0
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($userId = null, $docType = null)
{
// Require user to be logged in
FD::requireLogin();
$id = JRequest::getVar('schedule_id');
// Get the user that's being accessed.
$user = FD::user($userId);
$calendar = FD::table('Calendar');
$calendar->load($id);
if (!$calendar->id || !$id) {
FD::info()->set(false, JText::_('APP_CALENDAR_CANVAS_INVALID_SCHEDULE_ID'), SOCIAL_MSG_ERROR);
return $this->redirect(FD::profile(array('id' => $user->getAlias()), false));
}
$my = FD::user();
$privacy = FD::privacy($my->id);
$result = $privacy->validate('apps.calendar', $calendar->id, 'view', $user->id);
if (!$result) {
FD::info()->set(false, JText::_('APP_CALENDAR_NO_ACCESS'), SOCIAL_MSG_ERROR);
JFactory::getApplication()->redirect(FRoute::dashboard());
}
FD::page()->title($calendar->title);
// Render the comments and likes
$likes = FD::likes();
$likes->get($id, 'calendar', 'create', SOCIAL_APPS_GROUP_USER);
// Apply comments on the stream
$comments = FD::comments($id, 'calendar', 'create', SOCIAL_APPS_GROUP_USER, array('url' => FRoute::albums(array('layout' => 'item', 'id' => $id))));
$params = $this->app->getParams();
$this->set('params', $params);
$this->set('likes', $likes);
$this->set('comments', $comments);
$this->set('calendar', $calendar);
$this->set('user', $user);
echo parent::display('canvas/item/default');
}
示例3: profileHeaderB
public function profileHeaderB($key, $user, $field)
{
// Get the data
$data = $field->data;
if (!$data) {
return;
}
$my = FD::user();
$privacyLib = FD::privacy($my->id);
if (!$privacyLib->validate('core.view', $field->id, SOCIAL_TYPE_FIELD, $user->id)) {
return;
}
$obj = FD::makeObject($data);
$theme = FD::themes();
$hide = true;
foreach ($obj as $k => &$v) {
$v = $theme->html('string.escape', $v);
if (!empty($v)) {
$hide = false;
}
}
if ($hide) {
return true;
}
$params = $field->getParams();
// Convert country to full text
if (!empty($obj->country)) {
$obj->country_code = $obj->country;
$obj->country = SocialFieldsUserAddressHelper::getCountryName($obj->country, $params->get('data_source'));
}
$theme->set('value', $obj);
$theme->set('params', $field->getParams());
echo $theme->output('fields/user/address/widgets/display');
}
示例4: sidebarBottom
/**
* Displays the dashboard widget
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function sidebarBottom()
{
// Get the app params
$params = $this->app->getParams();
$key = $params->get('dashboard_show_uniquekey', 'BIRTHDAY');
$displayYear = $params->get('dashboard_show_birthday', 1);
// Get current logged in user
$my = FD::user();
$birthdays = $this->getUpcomingBirthdays($key, $my->id);
$ids = array();
$dateToday = FD::date()->toFormat('md');
$today = array();
$otherDays = array();
// Hide app when there's no upcoming birthdays
if (!$birthdays) {
return;
}
$my = FD::user();
$privacy = FD::privacy($my->id);
if ($birthdays) {
foreach ($birthdays as $birthday) {
$ids[] = $birthday->uid;
}
// Preload list of users
FD::user($ids);
foreach ($birthdays as $birthday) {
$obj = new stdClass();
$obj->user = FD::user($birthday->uid);
$obj->birthday = $birthday->displayday;
//Checking to display year here
if ($displayYear) {
$dateFormat = JText::_('COM_EASYSOCIAL_DATE_DMY');
//check birtday the year privacy
if (!$privacy->validate('field.birthday', $birthday->field_id, 'year', $birthday->uid)) {
$dateFormat = JText::_('COM_EASYSOCIAL_DATE_DM');
}
} else {
$dateFormat = JText::_('COM_EASYSOCIAL_DATE_DM');
}
$obj->display = FD::date($obj->birthday)->format($dateFormat);
if ($birthday->day == $dateToday) {
$today[] = $obj;
} else {
$otherDays[] = $obj;
}
}
}
$this->set('ids', $ids);
$this->set('birthdays', $birthdays);
$this->set('today', $today);
$this->set('otherDays', $otherDays);
echo parent::display('widgets/upcoming.birthday');
}
示例5: profileHeaderD
public function profileHeaderD($key, $user, $field)
{
// Get the data
$data = $field->data;
if (!$data) {
return;
}
$my = FD::user();
$privacyLib = FD::privacy($my->id);
if (!$privacyLib->validate('core.view', $field->id, SOCIAL_TYPE_FIELD, $user->id)) {
return;
}
// If there's no http:// or https:// , automatically append http://
if (stristr($data, 'http://') === false && stristr($data, 'https://') === false) {
$data = 'http://' . $data;
}
$theme = FD::themes();
$theme->set('value', $data);
$theme->set('params', $field->getParams());
echo $theme->output('fields/user/url/widgets/display');
}
示例6: onStreamCountValidation
/**
* Triggered to validate the stream item whether should put the item as valid count or not.
*
* @since 1.2
* @access public
* @param jos_social_stream, boolean
* @return 0 or 1
*/
public function onStreamCountValidation(&$item, $includePrivacy = true)
{
// If this is not it's context, we don't want to do anything here.
if ($item->context_type != 'feeds') {
return false;
}
$item->cnt = 1;
if ($includePrivacy) {
$uid = $item->id;
$my = FD::user();
$privacy = FD::privacy($my->id);
$sModel = FD::model('Stream');
$aItem = $sModel->getActivityItem($item->id, 'uid');
if ($aItem) {
$uid = $aItem[0]->id;
if (!$privacy->validate('core.view', $uid, SOCIAL_TYPE_ACTIVITY, $item->actor_id)) {
$item->cnt = 0;
}
}
}
return true;
}
示例7: update
/**
* to update privacy on an object by current logged in user
*
* @since 1.0
* @access public
* @param
* @return string
*/
public function update()
{
FD::checkToken();
FD::requireLogin();
$my = FD::user();
// get data from form post.
$uid = JRequest::getInt('uid');
$utype = JRequest::getVar('utype');
$value = JRequest::getVar('value');
$pid = JRequest::getVar('pid');
$customIds = JRequest::getVar('custom', '');
$streamid = JRequest::getVar('streamid', '');
$view = FD::view('Privacy', false);
// If id is invalid, throw an error.
if (!$uid) {
//Internal error logging.
FD::logError(__FILE__, __LINE__, 'Privacy Log: Unable to update privacy on item because id provided is invalid.');
$view->setError(JText::_('COM_EASYSOCIAL_ERROR_UNABLE_TO_LOCATE_ID'));
return $view->call(__FUNCTION__);
}
$model = FD::model('Privacy');
$state = $model->update($my->id, $pid, $uid, $utype, $value, $customIds);
// If there's an error, log this down.
if (!$state) {
//Internal error logging.
FD::logError(__FILE__, __LINE__, 'Privacy Log: Unable to update privacy on item because model returned the error, ' . $model->getError());
$view->setError($model->getError());
return $view->call(__FUNCTION__);
}
// lets check if there is stream id presented or not. if yes, means we need to update
// privacy access in stream too.
if ($streamid) {
$access = FD::privacy()->toValue($value);
$stream = FD::stream();
$stream->updateAccess($streamid, $access, $customIds);
}
return $view->call(__FUNCTION__);
}
示例8: onIndexerSearch
/**
* return formated string from the fields value
*
* @since 1.0
* @access public
* @param userfielddata
* @return array array of objects with two attribute, ffriend_id, score
*
* @author Jason Rey <jasonrey@stackideas.com>
*/
public function onIndexerSearch($itemCreatorId, $keywords, $userFieldData)
{
if (!$this->field->searchable) {
return false;
}
$data = trim($userFieldData);
$content = '';
if (JString::stristr($data, $keywords) !== false) {
$content = $data;
}
if ($content) {
$my = FD::user();
$privacyLib = FD::privacy($my->id);
if (!$privacyLib->validate('core.view', $this->field->id, SOCIAL_TYPE_FIELD, $itemCreatorId)) {
return -1;
} else {
// okay this mean the user can view this fields. let hightlight the content.
// building the pattern for regex replace
$searchworda = preg_replace('#\\xE3\\x80\\x80#s', ' ', $keywords);
$searchwords = preg_split("/\\s+/u", $searchworda);
$needle = $searchwords[0];
$searchwords = array_unique($searchwords);
$pattern = '#(';
$x = 0;
foreach ($searchwords as $k => $hlword) {
$pattern .= $x == 0 ? '' : '|';
$pattern .= preg_quote($hlword, '#');
$x++;
}
$pattern .= ')#iu';
$content = preg_replace($pattern, '<span class="search-highlight">\\0</span>', $content);
$content = JText::sprintf('PLG_FIELDS_JOOMLA_EMAIL_SEARCH_RESULT', $content);
}
}
if ($content) {
return $content;
} else {
return false;
}
}
示例9: html
/**
* Get's the content in html form.
*
* @since 1.0
* @access public
* @param bool Determine whether or not to show the current status.
* @return
*/
public function html($showCurrentStory = true)
{
$my = FD::user();
// Let's test if the current viewer is allowed to view this profile.
if ($this->requirePrivacy()) {
if ($this->target && $my->id != $this->target) {
$privacy = FD::privacy($my->id);
$state = $privacy->validate('profiles.post.status', $this->target, SOCIAL_TYPE_USER);
if (!$state) {
return '';
}
}
}
// Prepare the story.
$this->prepare();
// Determines if the story form should be expanded by default.
$expanded = false;
if (!empty($this->content)) {
$expanded = true;
}
// Get moods
$gender = $my->getGenderLang();
$moods = $this->getMoods($gender);
$theme = FD::get('Themes');
$theme->set('moods', $moods);
$theme->set('expanded', $expanded);
$theme->set('story', $this);
$output = $theme->output('site/story/default');
return $output;
}
示例10: setPrivacy
public function setPrivacy($privacy, $customPrivacy)
{
$lib = FD::privacy();
$lib->add('albums.view', $this->album->id, 'albums', $privacy, null, $customPrivacy);
}
示例11:
?>
-date" name="<?php
echo $inputName;
?>
[date]" value="<?php
echo $date;
?>
" data-field-datetime-value />
<?php
if ($yearPrivacy) {
?>
<div class="data-field-datetime-yearprivacy mt-10">
<div class="es-privacy pull-right">
<?php
echo FD::privacy()->form($field->id, 'year', $this->my->id, 'field.birthday');
?>
</div>
<h4 class="es-title"><?php
echo JText::_('PLG_FIELDS_BIRTHDAY_YEAR_PRIVACY_TITLE');
?>
</h4>
<div class="fd-small">
<?php
echo JText::_('PLG_FIELDS_BIRTHDAY_YEAR_PRIVACY_INFO');
?>
</div>
</div>
<?php
}
?>
示例12: savePrivacy
/**
* Save user's privacy.
*
* @since 1.0
* @access public
*/
public function savePrivacy()
{
// Check for request forgeries.
FD::checkToken();
// Ensure that the user is registered
FD::requireLogin();
// Get the current view.
$view = $this->getCurrentView();
// current logged in user
$my = FD::user();
// $resetMap = array( 'story.view', 'photos.view', 'albums.view', 'core.view' );
$privacyLib = FD::privacy();
//$resetMap = call_user_func_array( array( $privacyLib , 'getResetMap' ) );
$resetMap = $privacyLib->getResetMap();
$post = JRequest::get('POST');
$privacy = $post['privacy'];
$ids = $post['privacyID'];
$curValues = $post['privacyOld'];
$customIds = $post['privacyCustom'];
$requireReset = isset($post['privacyReset']) ? true : false;
$data = array();
if (count($privacy)) {
foreach ($privacy as $group => $items) {
foreach ($items as $rule => $val) {
$id = $ids[$group][$rule];
$custom = $customIds[$group][$rule];
$curVal = $curValues[$group][$rule];
$customUsers = array();
if (!empty($custom)) {
$tmp = explode(',', $custom);
foreach ($tmp as $tid) {
if (!empty($tid)) {
$customUsers[] = $tid;
}
}
}
$id = explode('_', $id);
$obj = new stdClass();
$obj->id = $id[0];
$obj->mapid = $id[1];
$obj->value = $val;
$obj->custom = $customUsers;
$obj->reset = false;
//check if require to reset or not.
$gr = strtolower($group . '.' . $rule);
if ($requireReset && in_array($gr, $resetMap)) {
$obj->reset = true;
}
$data[] = $obj;
}
}
}
// Set the privacy for this user
if (count($data) > 0) {
$privacyModel = FD::model('Privacy');
$state = $privacyModel->updatePrivacy($my->id, $data, SOCIAL_PRIVACY_TYPE_USER);
if ($state !== true) {
$view->setMessage($state, SOCIAL_MSG_ERROR);
return $view->call(__FUNCTION__);
}
}
// @points: privacy.update
// Assign points when user updates their privacy
$points = FD::points();
$points->assign('privacy.update', 'com_easysocial', $my->id);
//index user access in finder
$my->syncIndex();
$view->setMessage(JText::_('COM_EASYSOCIAL_PRIVACY_UPDATED_SUCESSFULLY'), SOCIAL_MSG_SUCCESS);
return $view->call(__FUNCTION__);
}
示例13: str_replace
this.parent.close();
}
}
</bindings>
<title><?php
echo $calendar->get('title');
?>
</title>
<content>
<h2><?php
echo $calendar->get('title');
?>
</h2>
<div class="pull-right">
<?php
echo FD::privacy()->form($calendar->id, 'view', $calendar->user_id, 'apps.calendar');
?>
</div>
<div class="event-time" style="color: #ccc;">
<?php
echo $calendar->getStartDate()->format($timeformat);
?>
- <?php
echo $calendar->getEndDate()->format($timeformat);
?>
</div>
<hr />
<p class="mt-20"><?php
echo str_replace("\n", '<br />', $calendar->get('description'));
?>
示例14: onPrepareActivityLog
/**
* Responsible to generate the activity logs.
*
* @since 1.0
* @access public
* @param object $params A standard object with key / value binding.
*
* @return none
*/
public function onPrepareActivityLog(SocialStreamItem &$item, $includePrivacy = true)
{
if ($item->context != 'links') {
return;
}
//get story object, in this case, is the stream_item
$tbl = FD::table('StreamItem');
$tbl->load($item->uid);
// item->uid is now streamitem.id
$uid = $tbl->uid;
//get story object, in this case, is the stream_item
$my = FD::user();
$privacy = FD::privacy($my->id);
$actor = $item->actor;
$target = count($item->targets) > 0 ? $item->targets[0] : '';
$assets = $item->getAssets($uid);
if (empty($assets)) {
return;
}
$assets = $assets[0];
$this->set('assets', $assets);
$this->set('actor', $actor);
$this->set('target', $target);
$this->set('stream', $item);
$item->display = SOCIAL_STREAM_DISPLAY_MINI;
$item->title = parent::display('logs/' . $item->verb);
return true;
}
示例15: defined
<?php
/**
* @package EasySocial
* @copyright Copyright (C) 2010 - 2014 Stack Ideas Sdn Bhd. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* EasySocial is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined('_JEXEC') or die('Unauthorized Access');
?>
<div class="es-privacy pull-right">
<?php
echo FD::privacy()->form($field->id, SOCIAL_TYPE_FIELD, $user->id, 'field.' . $element, isset($html) ? $html : false);
?>
</div>