コード例 #1
0
 /**
  * Reposition cover
  *
  * @params $guid: User guid
  *         $top : Position from top
  *         $left: Position from left
  *
  * @return bool;
  */
 public function repositionCOVER($guid, $top, $left)
 {
     $user = ossn_user_by_guid($guid);
     if (!isset($user->cover_position) && empty($user->cover_position)) {
         $position = array($top, $left);
         $fields = new OssnEntities();
         $fields->owner_guid = $guid;
         $fields->type = 'user';
         $fields->subtype = 'cover_position';
         $fields->value = json_encode($position);
         if ($fields->add()) {
             return true;
         }
     } else {
         $this->statement("SELECT * FROM ossn_entities WHERE(\n\t\t\t\t             owner_guid='{$guid}' AND \n\t\t\t\t             type='user' AND \n\t\t\t\t             subtype='cover_position');");
         $this->execute();
         $entity = $this->fetch();
         $entity_id = $entity->guid;
         $position = array($top, $left);
         $fields = new OssnEntities();
         $fields->owner_id = $guid;
         $fields->guid = $entity_id;
         $fields->type = 'user';
         $fields->subtype = 'cover_position';
         $fields->value = json_encode($position);
         if ($fields->updateEntity()) {
             return true;
         }
     }
     return false;
 }
コード例 #2
0
/**
 * Ossn Add Entity
 *
 * @param array $params search data
 * @param string $params['type'] Entity type
 * @param string $params['subtype'] Entity subtype
 * @param string $params['value'] Entity Value
 * @param string $params['owner_guid'] Owner guid
 * @param string $params['permission'] Permission (access of entity)
 * @param string $params['active'] 1 or 0 Does your entity is active?
 *
 * @return bool
 */
function ossn_add_entity(array $params)
{
    $entity = new OssnEntities();
    $entity->type = $params['type'];
    $entity->owner_guid = $params['owner_guid'];
    $entity->value = $params['value'];
    if (isset($params['subtype'])) {
        $entity->subtype = $params['subtype'];
    }
    if (isset($params['permission'])) {
        $entity->entity_permission = $params['value'];
    }
    if (isset($params['active'])) {
        $entity->active = $params['active'];
    }
    if ($entity->add()) {
        return true;
    }
    return false;
}
コード例 #3
0
 /**
  * Set component settings
  *
  * setSettings should have array() to accept values #434
  *
  * @param  string $component Component id
  * @param  array vars Setting (two-dem array)
  *
  * @return boolean
  */
 public function setSettings($component, array $vars = array())
 {
     $settings = self::getComSettings($component);
     $guid = $this->getbyName($component)->getID();
     $entity = new OssnEntities();
     if (empty($guid)) {
         return false;
     }
     foreach ($vars as $name => $value) {
         if ($settings && !$settings->isParam($name)) {
             $entity->owner_guid = $guid;
             $entity->type = 'component';
             $entity->subtype = $name;
             $entity->value = $value;
             $entity->add();
         } else {
             $entity->owner_guid = $guid;
             $entity->type = 'component';
             $entity->data->{$name} = $value;
             $entity->save();
         }
     }
     return true;
 }
コード例 #4
0
<?php

$guid = input('guid');
$user = ossn_user_by_guid($guid);
if ($user->isAdmin()) {
    $userverifed = "ADMIN";
} else {
    $userverifed = input('verified');
}
if (isset($guid)) {
    $OssnEntities = new OssnEntities();
    $OssnEntities->type = 'user';
    $OssnEntities->subtype = 'verified';
    $OssnEntities->permission = OSSN_PUBLIC;
    $OssnEntities->value = $userverifed;
    $OssnEntities->owner_guid = $guid;
    if ($OssnEntities->add()) {
        ossn_trigger_message('user verified');
        redirect(REF);
    } else {
        ossn_trigger_message('user not  verified');
        redirect(REF);
    }
} else {
    ossn_trigger_message('Please Enter the value ', 'error');
}