Exemplo n.º 1
0
function acl()
{
	global $config_q;
	if (!can_access())
	{
		header("HTTP/1.0 404 Not Found");
		header("Location: ".$config_q["baseurl"]); 
	}
}
Exemplo n.º 2
0
 function ajax()
 {
     global $user, $tenjin, $config_q;
     if ($_GET["vote_for"] == 1) {
         echo quote::vote_for(array("quote_id" => $_GET["q_id"], "user_id" => $user->data["user_id"], "ip" => $_SERVER['REMOTE_ADDR']));
     } else {
         if ($_GET["vote_against"] == 1) {
             echo quote::vote_against(array("quote_id" => $_GET["q_id"], "user_id" => $user->data["user_id"], "ip" => $_SERVER['REMOTE_ADDR']));
             /*
             $cv = new vote(array(
             	"quote_id" => $_GET["q_id"],
             	"user_id" => $user->data["user_id"],
             	"ip" => $_SERVER['REMOTE_ADDR'],
             ));
             $cv->vote_for();
             */
         }
     }
     if ($_GET["get_quote_for_facebook"] == 1) {
         echo ajax::get_quote_for_facebook($_GET["q_id"]);
     }
     if ($_GET["get_quotes_for_facebook"] == 1) {
         quote::get_random_quotes_for_facebook();
         die;
     }
     /* a strange kind of acl but ok
     			from here on you have to have permissions
     		*/
     if (!can_access()) {
         return true;
     }
     if ($_GET["dialog__add_quote"] == 1) {
         $tenjin_template = $config_q["template_dir"] . '/dialog__add_quote.phtml';
         $output = $tenjin->render($tenjin_template, $context);
         echo $output;
     } elseif ($_GET["get_tags"] == 1) {
         /*$this->format_tags_as_links(array(
         			"tags" => $_POST["tags"],
         		));*/
     } elseif ($_GET["format_tags_as_links"] == 1) {
         $tag = new tag();
         echo $tag->format_tags_as_links($_POST["tags"]);
     } elseif ($_GET["set_tags"] == 1) {
         $this->set_tags(array("tags" => $_POST["tags"], "q_id" => $_POST["q_id"]));
     } elseif ($_GET["get_quote"] == 1) {
         echo "get_quote";
     } elseif ($_GET["set_quote"] == 1) {
         echo "set_quote";
     } elseif ($_GET["get_category"] == 1) {
         $this->get_category(array("category_id" => $_POST["category_id"], "q_id" => $_POST["q_id"]));
     } elseif ($_GET["set_category"] == 1) {
         $this->set_category(array("category_id" => $_POST["category_id"], "q_id" => $_POST["q_id"]));
     }
 }
 /**
  * Return objects by array of object - object relations
  *
  * @param array $relations
  * @param boolean $exclude_private Exclude private objects
  * @return array
  */
 static function getObjectsByRelations($relations, $originalObject, $exclude_private = false)
 {
     if (!is_array($relations)) {
         return null;
     }
     $objects = array();
     foreach ($relations as $relation) {
         $object = $relation->getOtherObject($originalObject);
         if (!$object || !can_access(logged_user(), $object, ACCESS_LEVEL_READ)) {
             continue;
         }
         if ($object instanceof ProjectDataObject) {
             if (!($exclude_private && $object->isPrivate())) {
                 $objects[] = $object;
             }
         } else {
             $objects[] = $object;
         }
     }
     // if
     return count($objects) ? $objects : null;
 }
 /**
  * Return entries related to specific object
  *
  * If $include_private is set to true private entries will be included in result. If $include_silent is set to true
  * logs marked as silent will also be included. $limit and $offset are there to control the range of the result,
  * usually we don't want to pull the entire log but just the few most recent entries. If NULL they will be ignored
  *
  * @param ApplicationDataObject $object
  * @param boolean $include_private
  * @param boolean $include_silent
  * @param integer $limit
  * @param integer $offset
  * @return array
  */
 static function getObjectLogs($object, $include_private = false, $include_silent = false, $limit = null, $offset = null)
 {
     $private_filter = $include_private ? 1 : 0;
     $silent_filter = $include_silent ? 1 : 0;
     if (get_class($object->manager()) == 'Users') {
         $private_filter = $include_private ? 1 : 0;
         $silent_filter = $include_silent ? 1 : 0;
         $userCond = " AND `taken_by_id` = " . $object->getId();
         if (isset($project_ids) && $project_ids != null) {
             $conditions = array('`is_private` <= ? AND `is_silent` <= ? AND ' . self::getWorkspaceString($project_ids) . $userCond, $private_filter, $silent_filter);
         } else {
             $conditions = array('`is_private` <= ? AND `is_silent` <= ?' . $userCond, $private_filter, $silent_filter);
         }
         // if
         return self::findAll(array('conditions' => $conditions, 'order' => '`created_on` DESC', 'limit' => $limit, 'offset' => $offset));
         // findAll
     } else {
         $logs = self::findAll(array('conditions' => array('`is_private` <= ? AND `is_silent` <= ? AND `rel_object_id` = (?) AND `rel_object_manager` = (?) OR `is_private` <= ? AND `is_silent` <= ? AND `rel_object_id`IN (SELECT `id` FROM ' . Comments::instance()->getTableName(true) . ' WHERE `rel_object_id` = (?) AND `rel_object_manager` = (?)) AND `rel_object_manager` = "Comments"', $private_filter, $silent_filter, $object->getId(), get_class($object->manager()), $private_filter, $silent_filter, $object->getId(), get_class($object->manager())), 'order' => '`created_on` DESC', 'limit' => $limit, 'offset' => $offset));
         // findAll
     }
     $next_offset = $offset + $limit;
     do {
         // Look for objects that user cannot see
         $removed = 0;
         foreach ($logs as $k => $log) {
             if ($log->getAction() == 'link') {
                 $id = explode(":", $log->getLogData());
                 $lobj = get_object_by_manager_and_id($id[1], $id[0]);
                 if (!$lobj instanceof ApplicationDataObject || !can_access(logged_user(), $lobj, ACCESS_LEVEL_READ)) {
                     $removed++;
                     unset($logs[$k]);
                 }
             }
         }
         // Get more objects to substitute the removed ones
         if ($limit && $removed > 0) {
             $other_logs = self::findAll(array('conditions' => array('`is_private` <= ? AND `is_silent` <= ? AND `rel_object_id` = (?) AND `rel_object_manager` = (?) OR `is_private` <= ? AND `is_silent` <= ? AND `rel_object_id`IN (SELECT `id` FROM ' . Comments::instance()->getTableName(true) . ' WHERE `rel_object_id` = (?) AND `rel_object_manager` = (?)) AND `rel_object_manager` = "Comments"', $private_filter, $silent_filter, $object->getId(), get_class($object->manager()), $private_filter, $silent_filter, $object->getId(), get_class($object->manager())), 'order' => '`created_on` DESC', 'limit' => $next_offset + $removed, 'offset' => $next_offset));
             // findAll
             $logs = array_merge($logs, $other_logs);
             $next_offset += $removed;
             if (count($logs) > $limit) {
                 $logs = array_slice($logs, 0, $limit);
             }
         }
     } while ($removed > 0);
     return $logs;
 }
Exemplo n.º 5
0
     //if
 }
 // if
 $otherInvitationsTable = '';
 if (!$event->isNew()) {
     $otherInvitations = EventInvitations::findAll(array('conditions' => 'event_id = ' . $event->getId()));
     if (isset($otherInvitations) && is_array($otherInvitations)) {
         $otherInvitationsTable .= '<div class="coInputMainBlock adminMainBlock" style="width:70%;">';
         $otherInvitationsTable .= '<table style="width:100%;"><col width="50%" /><col width="50%" />';
         $otherInvitationsTable .= '<tr><th><b>' . lang('name') . '</b></th><th><b>' . lang('participate') . '</b></th></tr>';
         $isAlt = false;
         $cant = 0;
         foreach ($otherInvitations as $inv) {
             $inv_user = Contacts::findById($inv->getContactId());
             if ($inv_user instanceof Contact) {
                 if (can_access($inv_user, $event->getMembers(), ProjectEvents::instance()->getObjectTypeId(), ACCESS_LEVEL_READ)) {
                     if (!SystemPermissions::userHasSystemPermission(logged_user(), 'can_update_other_users_invitations')) {
                         // only show status
                         $state_desc = lang('pending response');
                         if ($inv->getInvitationState() == 1) {
                             $state_desc = lang('yes');
                         } else {
                             if ($inv->getInvitationState() == 2) {
                                 $state_desc = lang('no');
                             } else {
                                 if ($inv->getInvitationState() == 3) {
                                     $state_desc = lang('maybe');
                                 }
                             }
                         }
                         $otherInvitationsTable .= '<tr' . ($isAlt ? ' class="altRow"' : '') . '><td>' . clean($inv_user->getObjectName()) . '</td><td>' . $state_desc . '</td></tr>';
Exemplo n.º 6
0
 /**
  * Send event notification to the list of users ($people)
  *
  * @param ProjectEvent $event Event
  * @param array $people
  * @return boolean
  * @throws NotifierConnectionError
  */
 static function notifEvent(ProjectEvent $object, $people, $notification, $sender)
 {
     if (!is_array($people) || !count($people) || !$sender instanceof Contact) {
         return;
         // nothing here...
     }
     // if
     $name = $object->getObjectName();
     $type = $object->getObjectTypeName();
     $typename = lang($object->getObjectTypeName());
     tpl_assign('object', $object);
     tpl_assign('title', $name);
     tpl_assign('description', escape_html_whitespace(convert_to_links(clean($object->getDescription()))));
     //descripction
     //context
     $contexts = array();
     $members = $object->getMembers();
     if (count($members) > 0) {
         foreach ($members as $member) {
             $dim = $member->getDimension();
             if ($dim->getIsManageable()) {
                 if ($dim->getCode() == "customer_project" || $dim->getCode() == "customers") {
                     $obj_type = ObjectTypes::findById($member->getObjectTypeId());
                     if ($obj_type instanceof ObjectType) {
                         $contexts[$dim->getCode()][$obj_type->getName()][] = '<span style="' . get_workspace_css_properties($member->getMemberColor()) . '">' . $member->getName() . '</span>';
                     }
                 } else {
                     $contexts[$dim->getCode()][] = '<span style="' . get_workspace_css_properties($member->getMemberColor()) . '">' . $member->getName() . '</span>';
                 }
             }
         }
     }
     tpl_assign('contexts', $contexts);
     //folders
     $attachments = array();
     try {
         $content = FileRepository::getBackend()->getFileContent(owner_company()->getPictureFile());
         if ($content) {
             $file_path = ROOT . "/tmp/logo_empresa.png";
             $handle = fopen($file_path, 'wb');
             if ($handle) {
                 fwrite($handle, $content);
                 fclose($handle);
                 $attachments['logo'] = array('cid' => gen_id() . substr($sender->getEmailAddress(), strpos($sender->getEmailAddress(), '@')), 'path' => $file_path, 'type' => 'image/png', 'disposition' => 'inline', 'name' => 'logo_empresa.png');
             }
         }
     } catch (FileNotInRepositoryError $e) {
         unset($attachments['logo']);
     }
     tpl_assign('attachments', $attachments);
     // attachments
     //invitations
     $invitations = EventInvitations::findAll(array('conditions' => 'event_id = ' . $object->getId()));
     if (isset($invitations) && is_array($invitations)) {
         $guests = "";
         $send_link = array();
         foreach ($invitations as $inv) {
             $inv_user = Contacts::findById($inv->getContactId());
             if ($inv_user instanceof Contact) {
                 if (can_access($inv_user, $object->getMembers(), ProjectEvents::instance()->getObjectTypeId(), ACCESS_LEVEL_READ)) {
                     $state_desc = lang('pending response');
                     if ($inv->getInvitationState() == 1) {
                         $state_desc = lang('yes');
                     } else {
                         if ($inv->getInvitationState() == 2) {
                             $state_desc = lang('no');
                         } else {
                             if ($inv->getInvitationState() == 3) {
                                 $state_desc = lang('maybe');
                             }
                         }
                     }
                     $guests .= '<div style="line-height: 20px; clear:both;">';
                     $guests .= '<div style="width: 35%;line-height: 20px; float: left;">' . clean($inv_user->getObjectName()) . '</div>';
                     $guests .= '<div style="line-height: 20px; float: left;">' . $state_desc . '</div></div>';
                 }
                 if ($inv->getInvitationState() == 0) {
                     $send_link[] = $inv_user->getId();
                 }
             }
         }
     }
     tpl_assign('guests', $guests);
     // invitations
     $emails = array();
     foreach ($people as $user) {
         if ($user->getId() != $sender->getId() && !$user->getDisabled()) {
             // send notification on user's locale and with user info
             $locale = $user->getLocale();
             Localization::instance()->loadSettings($locale, ROOT . '/language');
             //ALL SUBSCRIBERS
             if ($object->getSubscribers()) {
                 $subscribers = $object->getSubscribers();
                 $string_subscriber = '';
                 $total_s = count($subscribers);
                 $c = 0;
                 foreach ($subscribers as $subscriber) {
                     $c++;
                     if ($c == $total_s && $total_s > 1) {
                         $string_subscriber .= lang('and');
                     } else {
                         if ($c > 1) {
                             $string_subscriber .= ", ";
                         }
                     }
                     $string_subscriber .= $subscriber->getFirstName();
                     if ($subscriber->getSurname() != "") {
                         $string_subscriber .= " " . $subscriber->getSurname();
                     }
                 }
                 tpl_assign('subscribers', $string_subscriber);
                 // subscribers
             }
             //start
             if ($object->getStart() instanceof DateTimeValue) {
                 $date = Localization::instance()->formatDescriptiveDate($object->getStart(), $user->getTimezone());
                 $time = Localization::instance()->formatTime($object->getStart(), $user->getTimezone());
                 tpl_assign('start', $date);
                 //start
                 if ($object->getTypeId() != 2) {
                     tpl_assign('time', $time);
                     //time
                 }
             }
             if ($object->getTypeId() != 2) {
                 //duration
                 if ($object->getDuration() instanceof DateTimeValue) {
                     $durtime = $object->getDuration()->getTimestamp() - $object->getStart()->getTimestamp();
                     $durhr = $durtime / 3600 % 24;
                     //seconds per hour
                     tpl_assign('duration', $durhr . " hs");
                     //duration
                 }
             } else {
                 tpl_assign('duration', lang('all day event'));
                 //duration
             }
             $links = array();
             if (in_array($user->getId(), $send_link)) {
                 $links = array(array('img' => get_image_url("/16x16/complete.png"), 'text' => lang('accept invitation'), 'url' => get_url('event', 'change_invitation_state', array('at' => 1, 'e' => $object->getId(), 'u' => $user->getId()))), array('img' => get_image_url("/16x16/del.png"), 'text' => lang('reject invitation'), 'url' => get_url('event', 'change_invitation_state', array('at' => 2, 'e' => $object->getId(), 'u' => $user->getId()))));
                 $description_title = lang("new notification event invitation", $object->getObjectName(), $sender->getObjectName());
                 $subject_mail = lang("new notification event", $name, $sender->getObjectName());
             } else {
                 $description_title = lang("{$notification} notification event desc", $object->getObjectName(), $sender->getObjectName());
                 $subject_mail = lang("{$notification} notification {$type}", $name, $typename);
             }
             tpl_assign('links', $links);
             tpl_assign('description_title', $description_title);
             //description_title
             $toemail = $user->getEmailAddress();
             if (!$toemail) {
                 continue;
             }
             $emails[] = array("to" => array(self::prepareEmailAddress($toemail, $user->getObjectName())), "from" => self::prepareEmailAddress($sender->getEmailAddress(), $sender->getObjectName()), "subject" => $subject = $subject_mail, "body" => tpl_fetch(get_template_path('general', 'notifier')), "attachments" => $attachments);
         }
     }
     // foreach
     $locale = logged_user() instanceof Contact ? logged_user()->getLocale() : DEFAULT_LOCALIZATION;
     Localization::instance()->loadSettings($locale, ROOT . '/language');
     self::queueEmails($emails);
 }
Exemplo n.º 7
0
/**
 * Return true is $user has $access_level (R/W) over $object
 *
 * @param User $user
 * @param ApplicationDataObject $object
 * @param int $access_level // 1 = read ; 2 = write
 * @return unknown
 */
function can_access(User $user, ApplicationDataObject $object, $access_level)
{
    try {
        if (!$object instanceof ApplicationDataObject) {
            throw new Exception(lang('object dnx'));
        }
        $hookargs = array("user" => $user, "object" => $object, "access_level" => $access_level);
        $ret = null;
        Hook::fire('can_access', $hookargs, $ret);
        if (is_bool($ret)) {
            return $ret;
        }
        if ($object instanceof Comment) {
            return can_access($user, $object->getObject(), $access_level);
        }
        if ($user->isGuest() && $access_level == ACCESS_LEVEL_WRITE) {
            return false;
        }
        if ($object instanceof ProjectFileRevision) {
            return can_access($user, $object->getFile(), $access_level);
        }
        if ($object->columnExists('project_id')) {
            $user_id = $user->getId();
            if (!$object instanceof ProjectContact && $object->getCreatedById() == $user_id) {
                return true;
            }
            // the user is the creator of the object
            if ($object instanceof ProjectDataObject && $object->getProject() instanceof Project && $object->getProject()->getId() == $user->getPersonalProjectId()) {
                return true;
            }
            // The object belongs to the user's personal project
            $perms = ObjectUserPermissions::getAllPermissionsByObject($object, $user->getId());
            if ($perms && is_array($perms)) {
                //if the permissions for the user in the object are specially set
                return has_access_level($perms[0], $access_level);
            }
            $group_ids = GroupUsers::getGroupsCSVsByUser($user_id);
            if ($group_ids && $group_ids != '') {
                //user belongs to at least one group
                $perms = ObjectUserPermissions::getAllPermissionsByObject($object, $group_ids);
                if ($perms) {
                    foreach ($perms as $perm) {
                        if (has_access_level($perm, $access_level)) {
                            return true;
                        }
                        //there is one group permission that allows the user to access
                    }
                }
            }
            if ($object instanceof ProjectDataObject && $object->getProject()) {
                //if the object has a project assigned to it
                $proj_perm = ProjectUsers::findOne(array('conditions' => array('user_id = ? AND project_id = ? ', $user_id, $object->getProject()->getId())));
                if ($proj_perm && can_manage_type(get_class($object->manager()), $proj_perm, $access_level)) {
                    return true;
                    // if user has permissions over type of object in the project
                }
                if ($group_ids && $group_ids != '') {
                    //user belongs to at least one group
                    $proj_perms = ProjectUsers::findAll(array('conditions' => array('project_id = ' . $object->getProject()->getId() . ' AND user_id in (' . $group_ids . ')')));
                    if ($proj_perms) {
                        foreach ($proj_perms as $perm) {
                            if (can_manage_type(get_class($object->manager()), $perm, $access_level)) {
                                return true;
                            }
                            // if any group has permissions over type of object in the project
                        }
                    }
                }
            }
        } else {
            // handle object in multiple workspaces
            $user_id = $user->getId();
            if ($object->getCreatedById() == $user_id) {
                return true;
                // the user is the creator of the object
            }
            if ($object instanceof MailContent) {
                $acc = MailAccounts::findById($object->getAccountId());
                if (!$acc instanceof MailAccount) {
                    return false;
                    // it's an email with no account and not created by the user
                } else {
                    if ($access_level == ACCESS_LEVEL_READ && $acc->canView($user) || $access_level == ACCESS_LEVEL_WRITE && $acc->canDelete($user)) {
                        return true;
                    }
                }
            }
            $perms = ObjectUserPermissions::getAllPermissionsByObject($object, $user->getId());
            if ($perms && is_array($perms)) {
                //if the permissions for the user in the object are specially set
                return has_access_level($perms[0], $access_level);
            }
            $group_ids = GroupUsers::getGroupsCSVsByUser($user_id);
            if ($group_ids && $group_ids != '') {
                //user belongs to at least one group
                $perms = ObjectUserPermissions::getAllPermissionsByObject($object, $group_ids);
                if ($perms) {
                    foreach ($perms as $perm) {
                        if (has_access_level($perm, $access_level)) {
                            return true;
                            //there is one group permission that allows the user to access
                        }
                    }
                }
            }
            if ($object instanceof ProjectDataObject) {
                $ws = $object->getWorkspaces();
                foreach ($ws as $w) {
                    // if the object has a project assigned to it
                    $proj_perm = ProjectUsers::findOne(array('conditions' => array('user_id = ? AND project_id = ? ', $user_id, $w->getId())));
                    if ($proj_perm && can_manage_type(get_class($object->manager()), $proj_perm, $access_level)) {
                        return true;
                        // if user has permissions over type of object in the project
                    }
                    if ($group_ids && $group_ids != '') {
                        //user belongs to at least one group
                        $proj_perms = ProjectUsers::findAll(array('conditions' => array('project_id = ' . $w->getId() . ' AND user_id in (' . $group_ids . ')')));
                        if ($proj_perms) {
                            foreach ($proj_perms as $perm) {
                                if (can_manage_type(get_class($object->manager()), $perm, $access_level)) {
                                    return true;
                                }
                                // if any group has permissions over type of object in the project
                            }
                        }
                    }
                }
            }
        }
    } catch (Exception $e) {
        tpl_assign('error', $e);
        return false;
    }
    return false;
}
Exemplo n.º 8
0
	/**
	 * Return entries related to specific object
	 *
	 * If $include_private is set to true private entries will be included in result. If $include_silent is set to true
	 * logs marked as silent will also be included. $limit and $offset are there to control the range of the result,
	 * usually we don't want to pull the entire log but just the few most recent entries. If NULL they will be ignored
	 *
	 * @param ApplicationDataObject $object
	 * @param boolean $include_private
	 * @param boolean $include_silent
	 * @param integer $limit
	 * @param integer $offset
	 * @return array
	 */
	static function getObjectLogs($object, $include_private = false, $include_silent = false, $limit = null, $offset = null) {
		$private_filter = $include_private ? 1 : 0;
		$silent_filter = $include_silent ? 1 : 0;		
		
		// User History
		if ($object instanceof Contact && $object->isUser()){		
			$private_filter = $include_private ? 1 : 0;
			$silent_filter = $include_silent ? 1 : 0;		
			$userCond = " AND `taken_by_id` = " . $object->getId();
			
			$conditions =  array(
				'`is_private` <= ? AND `is_silent` <= ? '.$userCond, 
				$private_filter, 
				$silent_filter); 
				
			return self::findAll(array(
				'conditions' => $conditions,
				'order' => '`created_on` DESC',
				'limit' => $limit,
				'offset' => $offset,
			)); // findAll				
		} else {	
			$logs = self::findAll(array(
                            'conditions' => array('`is_private` <= ? AND `is_silent` <= ? AND `rel_object_id` = (?) OR `is_private` <= ? AND `is_silent` <= ? AND (`rel_object_id`IN (SELECT `object_id` FROM '.Comments::instance()->getTableName(true).' WHERE `rel_object_id` = (?)) OR `rel_object_id`IN (SELECT `object_id` FROM '.Timeslots::instance()->getTableName(true).' WHERE `rel_object_id` = (?)))', $private_filter, $silent_filter, $object->getId(),$private_filter, $silent_filter, $object->getId(), $object->getId()),
                            'order' => '`created_on` DESC',
                            'limit' => $limit,
                            'offset' => $offset,
			)); // findAll
		}
		
		$next_offset = $offset + $limit;
		do {
			// Look for objects that user cannot see
			$removed = 0;
			foreach ($logs as $k => $log) {
				if ($log->getAction() == 'link') {
					$id = explode(":", $log->getLogData());
					$lobj = Objects::findObject($id[1]);
					if (!$lobj instanceof ApplicationDataObject || !can_access(logged_user(), $lobj->getMembers(), $lobj->getObjectTypeId(), ACCESS_LEVEL_READ)) {
						$removed++;
						unset($logs[$k]);
					}
				}
			}
			// Get more objects to substitute the removed ones
			if ($limit && $removed > 0) {
				$other_logs = self::findAll(array(
			        'conditions' => array('`is_private` <= ? AND `is_silent` <= ? AND `rel_object_id` = (?) OR `is_private` <= ? AND `is_silent` <= ? AND (`rel_object_id`IN (SELECT `id` FROM '.Comments::instance()->getTableName(true).' WHERE `rel_object_id` = (?)) AND `rel_object_id`IN (SELECT `object_id` FROM '.Timeslots::instance()->getTableName(true).' WHERE `rel_object_id` = (?)))', $private_filter, $silent_filter, $object->getId(),$private_filter, $silent_filter, $object->getId(), $object->getId()),
			        'order' => '`created_on` DESC',
			        'limit' => $next_offset + $removed,
			        'offset' => $next_offset,
				)); // findAll
				$logs = array_merge($logs, $other_logs);
				$next_offset += $removed;
				if (count($logs) > $limit) $logs = array_slice($logs, 0, $limit);
			}
		} while ($removed > 0);
		
		return $logs;
	} // getObjectLogs
Exemplo n.º 9
0
/**
 * Return true is $user can delete an $object. False otherwise.
 *
 * @param Contact $user
 * @param array $members
 * @param $object_type_id
 * @return boolean
 */
function can_delete(Contact $user, $members, $object_type_id)
{
    if ($user->isGuest()) {
        return false;
    }
    return can_access($user, $members, $object_type_id, ACCESS_LEVEL_DELETE);
}
Exemplo n.º 10
0
     //if
 }
 // if
 $otherInvitationsTable = '';
 if (!$event->isNew()) {
     $otherInvitations = EventInvitations::findAll(array('conditions' => 'event_id = ' . $event->getId()));
     if (isset($otherInvitations) && is_array($otherInvitations)) {
         $otherInvitationsTable .= '<div class="coInputMainBlock adminMainBlock" style="width:70%;">';
         $otherInvitationsTable .= '<table style="width:100%;"><col width="50%" /><col width="50%" />';
         $otherInvitationsTable .= '<tr><th><b>' . lang('name') . '</b></th><th><b>' . lang('participate') . '</b></th></tr>';
         $isAlt = false;
         $cant = 0;
         foreach ($otherInvitations as $inv) {
             $inv_user = Users::findById($inv->getUserId());
             if ($inv_user instanceof User) {
                 if (can_access($inv_user, $event, ACCESS_LEVEL_READ)) {
                     $state_desc = lang('pending response');
                     if ($inv->getInvitationState() == 1) {
                         $state_desc = lang('yes');
                     } else {
                         if ($inv->getInvitationState() == 2) {
                             $state_desc = lang('no');
                         } else {
                             if ($inv->getInvitationState() == 3) {
                                 $state_desc = lang('maybe');
                             }
                         }
                     }
                     $otherInvitationsTable .= '<tr' . ($isAlt ? ' class="altRow"' : '') . '><td>' . clean($inv_user->getDisplayName()) . '</td><td>' . $state_desc . '</td></tr>';
                     $isAlt = !$isAlt;
                     $cant++;
Exemplo n.º 11
0
<?php if( rcp_is_active() ) :
	echo "<legend>Mes packs VOD</legend>";
		if (can_access($post_id = 7293)) :
			echo "<a href = 'http://www.davidcosta.fr/categorie/vod/pack-premium/' class='not-btn more-link' > Pack premium </a ><br />";
		elseif (can_access($post_id = 7292)) :
			echo "<a href = 'http://www.davidcosta.fr/categorie/vod/pack-poids-de-corps/' class='not-btn more-link' > Pack poids du corps </a ><br />";
		elseif (can_access($post_id = 6762)) :
			echo "<a href = 'http://www.davidcosta.fr/categorie/vod/pack-haut-du-corps/' class='not-btn more-link' > Pack haut du corps </a ><br />";
		elseif (can_access($post_id = 6760)) :
			echo "<a href = 'http://www.davidcosta.fr/categorie/vod/pack-bas-du-corps/' class='not-btn more-link' > Pack bas du corps </a ><br />";
		elseif (can_access($post_id = 5701)) :
			echo "<a href = 'http://www.davidcosta.fr/categorie/vod/pack-abdos-et-gainage/' class='not-btn more-link' > Pack abdos et gainage </a ><br />";
		elseif (can_access($post_id = 7225)) :
			echo "<a href = 'http://www.davidcosta.fr/categorie/vod/pack-special-bras/' class='not-btn more-link' > Pack spécial bras </a ><br />";
		elseif (can_access($post_id = 7294)) :
			echo "<a href = 'http://www.davidcosta.fr/categorie/vod/pack-strong-is-the-new-sexy/' class='not-btn more-link' > Pack strong is the new sexy </a ><br />";
		else :
		endif;
	endif;
;?>



<?php wc_get_template( 'myaccount/my-address.php' ); ?>


<?php if( defined('NEW_FB_LOGIN') && NEW_FB_LOGIN == 1 && function_exists('new_fb_is_user_connected') && new_fb_is_user_connected() && function_exists('new_fb_unlink_button')): ?>
    <div class="facebook-unlink"> <?php echo '<a href="' . new_fb_login_url() . '&action=unlink&redirect=' . new_fb_curPageURL() . '">'.__('Unlink Account', 'yit').'</a>'; ?></div>
<?php endif; ?>