encryption object.

@param $id
@param $action
@param string $options
@return string|null
961392
protected function o_encryption($id, $action, $options = '')
    {
        switch ($action) {
            case 'new':
                // make the new object
                $this->objects[$id] = array('t' => 'encryption', 'info' => $options);
                $this->arc4_objnum = $id;
                break;

            case 'keys':
                // figure out the additional parameters required
                $pad = chr(0x28) . chr(0xBF) . chr(0x4E) . chr(0x5E) . chr(0x4E) . chr(0x75) . chr(0x8A) . chr(0x41)
                    . chr(0x64) . chr(0x00) . chr(0x4E) . chr(0x56) . chr(0xFF) . chr(0xFA) . chr(0x01) . chr(0x08)
                    . chr(0x2E) . chr(0x2E) . chr(0x00) . chr(0xB6) . chr(0xD0) . chr(0x68) . chr(0x3E) . chr(0x80)
                    . chr(0x2F) . chr(0x0C) . chr(0xA9) . chr(0xFE) . chr(0x64) . chr(0x53) . chr(0x69) . chr(0x7A);

                $info = $this->objects[$id]['info'];

                $len = mb_strlen($info['owner'], '8bit');

                if ($len > 32) {
                    $owner = substr($info['owner'], 0, 32);
                } else {
                    if ($len < 32) {
                        $owner = $info['owner'] . substr($pad, 0, 32 - $len);
                    } else {
                        $owner = $info['owner'];
                    }
                }

                $len = mb_strlen($info['user'], '8bit');
                if ($len > 32) {
                    $user = substr($info['user'], 0, 32);
                } else {
                    if ($len < 32) {
                        $user = $info['user'] . substr($pad, 0, 32 - $len);
                    } else {
                        $user = $info['user'];
                    }
                }

                $tmp = $this->md5_16($owner);
                $okey = substr($tmp, 0, 5);
                $this->ARC4_init($okey);
                $ovalue = $this->ARC4($user);
                $this->objects[$id]['info']['O'] = $ovalue;

                // now make the u value, phew.
                $tmp = $this->md5_16(
                    $user . $ovalue . chr($info['p']) . chr(255) . chr(255) . chr(255) . hex2bin($this->fileIdentifier)
                );

                $ukey = substr($tmp, 0, 5);
                $this->ARC4_init($ukey);
                $this->encryptionKey = $ukey;
                $this->encrypted = true;
                $uvalue = $this->ARC4($pad);
                $this->objects[$id]['info']['U'] = $uvalue;
                // initialize the arc4 array
                break;

            case 'out':
                $o = &$this->objects[$id];

                $res = "\n$id 0 obj\n<<";
                $res .= "\n/Filter /Standard";
                $res .= "\n/V 1";
                $res .= "\n/R 2";
                $res .= "\n/O (" . $this->filterText($o['info']['O'], false, false) . ')';
                $res .= "\n/U (" . $this->filterText($o['info']['U'], false, false) . ')';
                // and the p-value needs to be converted to account for the twos-complement approach
                $o['info']['p'] = (($o['info']['p'] ^ 255) + 1) * -1;
                $res .= "\n/P " . ($o['info']['p']);
                $res .= "\n>>\nendobj";

                return $res;
        }

        return null;
    }
1037386
public static function map($actions=array(), $options=array())
    {
        if (empty($actions)) {
            return null;
        }

        $out   = array();
        $count = 0;
        $len   = count($actions);

        foreach ($actions as $label => $mixed) {

            $count++;

            $action = new Item($label, $mixed);

            if ($count == 1) {
                $action->isFirst = true;
            }

            if ($count == $len) {
                $action->isLast = true;
            }

            $out[] = $action;

        }

        return $out;
    }
777274
public function write($id , $data) {
    $crypto = $this->psl['crypt/crypto'];
    $store  = $this->psl['store'];

    /* Encrypt session. */
    try {
      $crypto->_algo = $this->cryptAlgo;
      $crypto->_mode = $this->cryptMode;
      $encrypted = $crypto->encrypt($data, $this->secret);

      /* Destroy old session. */
      if($this->newID != $this->currID) {
        $this->destroy($this->currID);
      }

      /* Write new session, with new ID. */
      return $store->write('session', $this->newID, $encrypted);
    } catch (\phpSec\Exception $e) {
      return false;
    }
  }
1198665
public static function retrieve($userId, $id, $options = null)
    {
        return self::_userBasedRetrieve($userId, $id, $options);
    }
116297
public function read($id, array $options = [], Closure $callback = null) {
        return $this->select()
            ->where($this->getPrimaryKey(), $id)
            ->bindCallback($callback)
            ->first($options);
    }
279038
private function executeAction($id, array $options)
    {
        $action = $this->adapter->post(sprintf('%s/floating_ips/%s/actions', $this->endpoint, $id), $options);

        $action = json_decode($action);

        return new ActionEntity($action->action);
    }
743980
public function remove($action, $id = null)
    {
        /** @var $query \eZ\Publish\Core\Persistence\Database\DeleteQuery */
        $query = $this->dbHandler->createDeleteQuery();
        $query->deleteFrom(
            $this->dbHandler->quoteTable($this->table)
        )->where(
            $query->expr->eq(
                $this->dbHandler->quoteColumn('action'),
                $query->bindValue($action, null, \PDO::PARAM_STR)
            )
        );

        if ($id !== null) {
            $query->where(
                $query->expr->lAnd(
                    $query->expr->eq(
                        $this->dbHandler->quoteColumn('is_alias'),
                        $query->bindValue(0, null, \PDO::PARAM_INT)
                    ),
                    $query->expr->eq(
                        $this->dbHandler->quoteColumn('id'),
                        $query->bindValue($id, null, \PDO::PARAM_INT)
                    )
                )
            );
        }

        $query->prepare()->execute();
    }
376950
public function handle($action, $id)
    {
        $tempFile = $this->tempStorage->get($id);

        if (!$tempFile) {
            return null;
        }

        return $this->handleTempFile($action, $tempFile);
    }
498005
public static function cancel($id, $options = null)
    {
        $url = static::classUrl().'/'.$id;
        $params = array('status' => 'canceled');
        return static::_directRequest('put', $url, $params, $options);
    }
291709
function o_viewerPreferences( $id, $action, $options = '' )
    {
        if ( $action != 'new' )
        {
            $o =& $this->objects[$id];
        }
        switch ( $action )
        {
        case 'new':
            $this->objects[$id] = array( 't' => 'viewerPreferences', 'info' => array() );
            break;
        case 'add':
            foreach ( $options as $k => $v )
            {
                switch ( $k )
                {
                case 'HideToolbar':
                case 'HideMenubar':
                case 'HideWindowUI':
                case 'FitWindow':
                case 'CenterWindow':
                case 'NonFullScreenPageMode':
                case 'Direction':
                    $o['info'][$k] = $v;
                    break;
                }
            }break;
        case 'out':
            $res = "\n" . $id . " 0 obj\n" . '<< ';
            foreach($o['info'] as $k=>$v)
            {
                $res .= "\n/" . $k . ' ' . $v;
            }
            $res .= "\n>>\n";
            return $res;
            break;
        }
    }
968500
public function putStatus($id, $action)
    {
        try
        {
            $this->users->updateThrottleStatus($id,$action);
            return Redirect::route('cpanel.users.index')
                ->with('success', Lang::get('cpanel::throttle.success',array('action' => $action)));

        }
        catch (UserNotFoundException $e)
        {
            return Redirect::route('cpanel.users.index')
                ->with('error', $e->getMessage());
        }
        catch (\BadMethodCallException $e)
        {
            return Redirect::route('cpanel.users.index')
                ->with('error', "This method is not suported [{$action}]");
        }
    }
723569
public function trackTransaction($id, array $options = [])
	{
		$options['id'] = $id;
		$this->trackEcommerce(self::ECOMMERCE_TRANSACTION, $options);
	}
937740
public function findByEncryptedId($id, $field = 'id') 
	{
	    $hashids = $this->getServiceLocator()->get('neobazaar.service.hashid');
	    $id = $hashids->decrypt($id);
	    $id = is_array($id) ? reset($id) : $id;
	    
        $options = array(); 
        $qb = $this->_em->createQueryBuilder();
        $qb->select(array('a'));
        $qb->from($this->getEntityName(), 'a');
        $qb->where($qb->expr()->eq('a.' . $field, ':value'));
        $qb->setParameter('value', $id);
        $result = $qb->getQuery()->getResult();
        
        return reset($result);
	}
1269034
public function getDocument($collection, $id, array $options = [])
    {
        $this->setOptions($options);
        $doc = new Document($this->client, $this->database, $collection);
        $doc->setHeaders($this->getHeaders());
        $rs = $doc->get($id);
        $this->checkResponse($rs);
        unset($rs['_curl_info']);

        return $rs;
    }
543810
public static function delete($id, $options = [])
    {
        $url = static::classUrl() . '/' . $id;
        return static::_directRequest('delete', $url, null, $options);
    }
1223080
public static function update($id, $params = [], $options = [])
    {
        $url = static::classUrl() . '/' . $id;
        return static::_directRequest('put', $url, $params, $options);
    }
675919
public function update($id, $data, array $options = []) {
        return $this->query(Query::UPDATE)
            ->where($this->getPrimaryKey(), $id)
            ->save($data, $options);
    }