idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
49,100
public function emptyDatabase ( Request $ request , $ databox_id ) { $ msg = $ this -> app -> trans ( 'An error occurred' ) ; $ success = false ; $ taskCreated = false ; try { $ databox = $ this -> findDataboxById ( $ databox_id ) ; foreach ( $ databox -> get_collections ( ) as $ collection ) { if ( $ collection -> get...
Empty a databox
49,101
public function progressBarInfos ( Request $ request , $ databox_id ) { if ( ! $ request -> isXmlHttpRequest ( ) || 'json' !== $ request -> getRequestFormat ( ) ) { $ this -> app -> abort ( 400 , $ this -> app -> trans ( 'Bad request format, only JSON is allowed' ) ) ; } $ appbox = $ this -> getApplicationBox ( ) ; $ r...
Get number of indexed items for a databox
49,102
public function getReorder ( $ databox_id ) { $ acl = $ this -> getAclForUser ( ) ; return $ this -> render ( 'admin/collection/reorder.html.twig' , [ 'collections' => $ acl -> get_granted_base ( [ ] , [ $ databox_id ] ) , ] ) ; }
Display page for reorder collections on a databox
49,103
public function setReorder ( Request $ request , $ databox_id ) { try { foreach ( $ request -> request -> get ( 'order' , [ ] ) as $ data ) { $ collection = \ collection :: getByBaseId ( $ this -> app , $ data [ 'id' ] ) ; $ collection -> set_ord ( $ data [ 'offset' ] ) ; } $ success = true ; } catch ( \ Exception $ e ...
Apply collection reorder changes
49,104
public function getDetails ( Request $ request , $ databox_id ) { $ databox = $ this -> findDataboxById ( $ databox_id ) ; $ details = [ ] ; $ total = [ 'total_subdefs' => 0 , 'total_size' => 0 ] ; foreach ( $ databox -> get_record_details ( $ request -> query -> get ( 'sort' ) ) as $ collName => $ colDetails ) { $ det...
Display page to get some details on a appbox
49,105
public function set_label ( $ code , $ value ) { if ( ! array_key_exists ( $ code , $ this -> labels ) ) { throw new InvalidArgumentException ( sprintf ( 'Code %s is not defined' , $ code ) ) ; } $ this -> labels [ $ code ] = $ value ; return $ this ; }
Sets a localized label for the field .
49,106
public function get_label ( $ code ) { if ( ! array_key_exists ( $ code , $ this -> labels ) ) { throw new InvalidArgumentException ( sprintf ( 'Code %s is not defined' , $ code ) ) ; } return isset ( $ this -> labels [ $ code ] ) && '' !== $ this -> labels [ $ code ] ? $ this -> labels [ $ code ] : $ this -> name ; }
Gets a localized label for the field .
49,107
public static function loadClassFromTagName ( $ tagName , $ throwException = true ) { $ tagName = str_ireplace ( '/rdf:rdf/rdf:description/' , '' , $ tagName ) ; if ( '' === trim ( $ tagName ) ) { return new NoSource ( ) ; } try { return TagFactory :: getFromTagname ( $ tagName ) ; } catch ( TagUnknown $ exception ) { ...
Get a PHPExiftool Tag from tagName
49,108
private function computeAccess ( $ and , $ xor , $ bit ) { $ xorBit = \ databox_status :: bitIsSet ( $ xor , $ bit ) ; $ andBit = \ databox_status :: bitIsSet ( $ and , $ bit ) ; if ( ! $ xorBit && ! $ andBit ) { return self :: FLAG_ALLOW_BOTH ; } if ( $ xorBit && $ andBit ) { return self :: FLAG_SET_ONLY ; } return se...
Truth table for status rights
49,109
public function call ( $ method , $ args = [ ] , $ access_token = null ) { $ headers = [ 'Content-Type: application/json' ] ; $ payload = json_encode ( [ 'call' => $ method , 'args' => $ args , ] ) ; $ status_code = null ; try { $ result = json_decode ( $ this -> oauthRequest ( $ this -> apiEndpointUrl , $ payload , $ ...
Call a remote method .
49,110
public function sendFile ( $ filePath , $ oauth_token ) { $ result = $ this -> call ( 'file.upload' , [ ] , $ oauth_token ) ; $ timeout = $ this -> timeout ; $ this -> timeout = null ; $ result = json_decode ( $ this -> httpRequest ( $ result [ 'upload_url' ] , [ 'file' => '@' . $ filePath ] ) , true ) ; $ this -> time...
Upload a file on the Dailymotion servers and generate an URL to be used with API methods .
49,111
public function findUserListLike ( User $ user , $ name ) { $ dql = 'SELECT l FROM Phraseanet:UsrList l JOIN l.owners o WHERE o.user = :usr_id AND l.name LIKE :name' ; $ params = [ 'usr_id' => $ user -> getId ( ) , 'name' => $ name . '%' ] ; $ query = $ this -> _em -> createQuery ( $ dql ) ; $ q...
Search for a UsrList like with a given value for a user
49,112
public function getWrongEmailUsers ( ) { if ( version_compare ( $ this -> appbox -> get_version ( ) , '3.9' , '>=' ) ) { return [ ] ; } $ builder = $ this -> appbox -> get_connection ( ) -> createQueryBuilder ( ) ; $ stmt = $ builder -> select ( 'u.usr_mail' , 'u.usr_id' , 'u.last_conn' , 'u.usr_login' ) -> from ( $ th...
Returns users with duplicated emails
49,113
public function get_grouping_head ( ) { if ( ! $ this -> is_single_grouping ( ) ) throw new \ Exception ( 'Cannot use ' . __METHOD__ . ' here' ) ; foreach ( $ this -> get_elements ( ) as $ record ) { return $ record ; } }
When action on a single grouping returns the image of himself
49,114
protected function createBlankDom ( ) { $ dom = new \ DOMDocument ( ) ; $ dom -> preserveWhiteSpace = false ; $ dom -> formatOutput = true ; return $ dom ; }
Returns a new blank DOM document .
49,115
public function deleteApp ( Request $ request , ApiApplication $ application ) { $ this -> assertJsonRequestFormat ( $ request ) ; $ this -> getApiApplicationManipulator ( ) -> delete ( $ application ) ; return $ this -> app -> json ( [ 'success' => true ] ) ; }
Delete application .
49,116
public function renewAppCallback ( Request $ request , ApiApplication $ application ) { $ this -> assertJsonRequestFormat ( $ request ) ; try { $ this -> getApiApplicationManipulator ( ) -> setRedirectUri ( $ application , $ request -> request -> get ( "callback" ) ) ; } catch ( InvalidArgumentException $ e ) { return ...
Change application callback .
49,117
public function renewAppWebhook ( Request $ request , ApiApplication $ application ) { $ this -> assertJsonRequestFormat ( $ request ) ; if ( null !== $ request -> request -> get ( "webhook" ) ) { $ this -> getApiApplicationManipulator ( ) -> setWebhookUrl ( $ application , $ request -> request -> get ( "webhook" ) ) ;...
Change application webhook
49,118
public function newApp ( Request $ request ) { if ( $ request -> request -> get ( 'type' ) === ApiApplication :: DESKTOP_TYPE ) { $ form = new \ API_OAuth2_Form_DevAppDesktop ( $ request ) ; } else { $ form = new \ API_OAuth2_Form_DevAppInternet ( $ request ) ; } $ violations = $ this -> getValidator ( ) -> validate ( ...
Create a new developer applications
49,119
public function getApp ( ApiApplication $ application ) { $ user = $ this -> getAuthenticatedUser ( ) ; $ account = $ this -> getApiAccountRepository ( ) -> findByUserAndApplication ( $ user , $ application ) ; $ token = $ account ? $ this -> getApiOAuthTokenRepository ( ) -> findDeveloperToken ( $ account ) : null ; i...
Gets application information .
49,120
public static function create ( Application $ app , ReceiverInterface $ receiver , EmitterInterface $ emitter = null , $ message = null , $ url = null , \ DateTime $ expiration = null ) { $ mail = new static ( $ app , $ receiver , $ emitter , $ message ) ; $ mail -> setButtonUrl ( $ url ) ; $ mail -> setExpiration ( $ ...
Creates a new Mail
49,121
public function remove ( $ property ) { if ( ! array_key_exists ( $ property , $ this -> data ) ) { throw new InvalidArgumentException ( sprintf ( 'Property %s does not exist' , $ property ) ) ; } $ value = $ this -> data [ $ property ] ; unset ( $ this -> data [ $ property ] ) ; return $ value ; }
Removes the property
49,122
protected function tableExists ( $ tableName ) { $ rs = $ this -> getEntityManager ( ) -> getConnection ( ) -> fetchAll ( 'SHOW TABLE STATUS' ) ; foreach ( $ rs as $ row ) { if ( $ tableName === $ row [ 'Name' ] ) { return true ; } } return false ; }
Tells whether the table exists or not .
49,123
public function groupByDataboxIdAndCollectionId ( ) { $ groups = [ ] ; foreach ( $ this -> references as $ index => $ reference ) { $ databoxId = $ reference -> getDataboxId ( ) ; $ group = isset ( $ groups [ $ databoxId ] ) ? $ groups [ $ databoxId ] : [ ] ; $ group [ $ reference -> getCollectionId ( ) ] = $ index ; $...
Returns an array of array with actual index as leaf value .
49,124
public function queryAnswerTrain ( Request $ request ) { if ( null === $ optionsSerial = $ request -> get ( 'options_serial' ) ) { $ this -> app -> abort ( 400 , 'Search engine options are missing' ) ; } try { $ options = SearchEngineOptions :: hydrate ( $ this -> app , $ optionsSerial ) ; } catch ( \ Exception $ e ) {...
Get a preview answer train
49,125
public function getSession ( $ cookieValue ) { $ session = $ this -> repository -> findOneBy ( [ 'token' => $ cookieValue ] ) ; if ( ! $ session ) { return false ; } $ string = sprintf ( '%s_%s' , $ this -> browser -> getBrowser ( ) , $ this -> browser -> getPlatform ( ) ) ; if ( ! $ this -> encoder -> isPasswordValid ...
Returns a Session give a cookie value
49,126
private function ensureSymlink ( $ pathFile ) { if ( false === $ this -> symlinker -> hasSymlink ( $ pathFile ) ) { $ this -> symlinker -> symlink ( $ pathFile ) ; } }
Creates a link if it does not exists
49,127
public function writeLazaret ( File $ file ) { $ lazaretPathname = $ this -> booker -> bookFile ( $ file -> getOriginalName ( ) ) ; $ this -> filesystem -> copy ( $ file -> getFile ( ) -> getRealPath ( ) , $ lazaretPathname , true ) ; $ lazaretPathnameThumb = $ this -> booker -> bookFile ( $ file -> getOriginalName ( )...
Write a file in storage and mark it lazaret
49,128
public function editRecordSharing ( Request $ request , $ base_id , $ record_id ) { $ record = new \ record_adapter ( $ this -> app , \ phrasea :: sbasFromBas ( $ this -> app , $ base_id ) , $ record_id ) ; $ subdefName = ( string ) $ request -> request -> get ( 'name' ) ; $ state = $ request -> request -> get ( 'state...
Edit a record share state
49,129
public function findConceptsBulk ( array $ terms , $ lang = null , $ filter = null , $ strict = false ) { $ this -> logger -> debug ( sprintf ( 'Finding linked concepts in bulk for %d terms' , count ( $ terms ) ) ) ; $ filters = is_array ( $ filter ) ? $ filter : array_fill_keys ( array_keys ( $ terms ) , $ filter ) ; ...
Find concepts linked to a bulk of Terms
49,130
public function findConcepts ( $ term , $ lang = null , Filter $ filter = null , $ strict = false ) { return $ strict ? $ this -> findConceptsStrict ( $ term , $ lang , $ filter ) : $ this -> findConceptsFuzzy ( $ term , $ lang , $ filter ) ; }
Find concepts linked to the provided Term
49,131
public function register ( ) { $ guesser = MimeTypeGuesser :: getInstance ( ) ; $ guesser -> register ( new RawImageMimeTypeGuesser ( ) ) ; $ guesser -> register ( new PostScriptMimeTypeGuesser ( ) ) ; $ guesser -> register ( new AudioMimeTypeGuesser ( ) ) ; $ guesser -> register ( new VideoMimeTypeGuesser ( ) ) ; $ gu...
Registers mime type guessers given the configuration
49,132
public function deliverFile ( $ file , $ filename = null , $ disposition = DeliverDataInterface :: DISPOSITION_INLINE , $ mimeType = null , $ cacheDuration = null ) { return $ this -> getDeliverer ( ) -> deliverFile ( $ file , $ filename , $ disposition , $ mimeType , $ cacheDuration ) ; }
Returns a HTTP Response ready to deliver a binary file
49,133
protected function getDataboxTimeEstimation ( \ databox $ databox ) { $ sql = 'SELECT r.coll_id, r.type, r.record_id, s.path, s.file, r.xml FROM record r, subdef s WHERE ISNULL(uuid) AND s.record_id = r.record_id AND s.name="document" A...
Return the number of record which does not have a UUID
49,134
protected function getNullUUIDs ( \ databox $ databox ) { $ sql = 'SELECT r.coll_id, r.type, r.record_id, s.path, s.file, r.xml FROM record r, subdef s WHERE ISNULL(uuid) AND s.record_id = r.record_id AND s.name="document" AND parent_re...
Return a maximum of 100 recods without UUIDs
49,135
protected function updateRecordUUID ( \ databox $ databox , array $ record ) { $ pathfile = \ p4string :: addEndSlash ( $ record [ 'path' ] ) . $ record [ 'file' ] ; $ uuid = Uuid :: uuid4 ( ) ; try { $ media = $ this -> app -> getMediaFromUri ( $ pathfile ) ; $ collection = \ collection :: getByCollectionId ( $ this -...
Update a record with a UUID
49,136
public function findSubdefsByRecordReferenceFromCollection ( $ records , array $ names = null ) { $ subdefs = $ this -> reduceRecordReferenceCollection ( $ records , function ( array & $ carry , array $ subdefs , array $ references ) { $ subdefsByRecordId = [ ] ; foreach ( $ subdefs as $ subdef ) { $ recordId = $ subde...
Returns all available subdefs grouped by each record reference and by its name
49,137
public function deliver ( MailInterface $ mail , $ readReceipt = false , array $ attachments = null ) { if ( ! $ mail -> getReceiver ( ) ) { throw new LogicException ( 'You must provide a receiver for a mail notification' ) ; } $ message = \ Swift_Message :: newInstance ( $ this -> prefix . $ mail -> getSubject ( ) , $...
Delivers an email
49,138
private static function fetchData ( databox $ databox , array $ subdefIds ) { $ found = [ ] ; $ missing = [ ] ; foreach ( $ subdefIds as $ index => $ subdefId ) { try { $ data = self :: doGetDataFromCache ( $ databox , $ subdefId ) ; } catch ( Exception $ exception ) { $ data = false ; } if ( is_array ( $ data ) ) { $ ...
Returns present data in storage with same indexes but different order
49,139
public function getRawData ( ) { return [ 'ord' => $ this -> ord , 'viewname' => $ this -> viewname , 'label_en' => $ this -> labels [ 'en' ] , 'label_fr' => $ this -> labels [ 'fr' ] , 'label_de' => $ this -> labels [ 'de' ] , 'label_nl' => $ this -> labels [ 'nl' ] , ] ; }
Return an array that can be used to restore databox .
49,140
private function hasFeedBackup ( Application $ app ) { $ rsm = ( new ResultSetMapping ( ) ) -> addScalarResult ( 'Name' , 'Name' ) ; $ backup = false ; foreach ( $ app [ 'orm.em' ] -> createNativeQuery ( 'SHOW TABLE STATUS' , $ rsm ) -> getResult ( ) as $ row ) { if ( 'feeds_backup' === $ row [ 'Name' ] ) { $ backup = ...
Checks whether feeds_backup tables exists .
49,141
public function validateToken ( $ token ) { if ( is_string ( $ token ) ) { $ token = $ this -> decodeToken ( $ token ) ; } if ( ! isset ( $ token -> sdef ) || ! is_array ( $ token -> sdef ) || count ( $ token -> sdef ) !== 3 ) { throw new BadRequestHttpException ( 'sdef should be a sub-definition identifier.' ) ; } lis...
Validate token and returns triplet containing sbas_id record_id and subdef .
49,142
public function flushAll ( ) { foreach ( $ this -> drivers as $ driver ) { $ driver -> flushAll ( ) ; } $ this -> registry = [ ] ; $ this -> save ( ) ; return $ this ; }
Flushes all registered cache
49,143
protected function buildImageSubdef ( SimpleXMLElement $ sd ) { $ image = new Image ( $ this -> translator ) ; if ( $ sd -> icodec ) { $ image -> setOptionValue ( Image :: OPTION_ICODEC , ( string ) $ sd -> icodec ) ; } if ( $ sd -> size ) { $ image -> setOptionValue ( Image :: OPTION_SIZE , ( int ) $ sd -> size ) ; } ...
Build Image Subdef object depending the SimpleXMLElement
49,144
protected function buildAudioSubdef ( SimpleXMLElement $ sd ) { $ audio = new Audio ( $ this -> translator ) ; if ( $ sd -> acodec ) { $ audio -> setOptionValue ( Audio :: OPTION_ACODEC , ( string ) $ sd -> acodec ) ; } if ( $ sd -> audiobitrate ) { $ audio -> setOptionValue ( Audio :: OPTION_AUDIOBITRATE , ( int ) $ s...
Build Audio Subdef object depending the SimpleXMLElement
49,145
protected function buildVideoSubdef ( SimpleXMLElement $ sd ) { $ video = new Video ( $ this -> translator ) ; if ( $ sd -> size ) { $ video -> setOptionValue ( Video :: OPTION_SIZE , ( int ) $ sd -> size ) ; } if ( $ sd -> acodec ) { $ video -> setOptionValue ( Video :: OPTION_ACODEC , ( string ) $ sd -> acodec ) ; } ...
Build Video Subdef object depending the SimpleXMLElement
49,146
protected function buildGifSubdef ( SimpleXMLElement $ sd ) { $ gif = new Gif ( $ this -> translator ) ; if ( $ sd -> size ) { $ gif -> setOptionValue ( Gif :: OPTION_SIZE , ( int ) $ sd -> size ) ; } if ( $ sd -> delay ) { $ gif -> setOptionValue ( Gif :: OPTION_DELAY , ( int ) $ sd -> delay ) ; } return $ gif ; }
Build GIF Subdef object depending the SimpleXMLElement
49,147
public function getAvailableSubdefTypes ( ) { $ subdefTypes = [ ] ; $ availableDevices = [ self :: DEVICE_ALL , self :: DEVICE_HANDHELD , self :: DEVICE_PRINT , self :: DEVICE_PROJECTION , self :: DEVICE_SCREEN , self :: DEVICE_TV , ] ; if ( isset ( self :: $ mediaTypeToSubdefTypes [ $ this -> subdef_group -> getType (...
Get an array of Alchemy \ Phrasea \ Media \ Subdef \ Subdef available for the current Media Type
49,148
public function is_restricted_download ( $ base_id ) { $ this -> load_rights_bas ( ) ; if ( ! $ this -> has_access_to_base ( $ base_id ) ) { return false ; } return $ this -> _rights_bas [ $ base_id ] [ self :: RESTRICT_DWNLD ] ; }
Return true if user is restricted in download on the collection
49,149
public function remaining_download ( $ base_id ) { $ this -> load_rights_bas ( ) ; if ( ! $ this -> has_access_to_base ( $ base_id ) ) { return false ; } return ( int ) $ this -> _rights_bas [ $ base_id ] [ 'remain_dwnld' ] ; }
Return the number of remaining downloads on the collection
49,150
public function remove_remaining ( $ base_id , $ n = 1 ) { $ this -> load_rights_bas ( ) ; if ( ! $ this -> has_access_to_base ( $ base_id ) ) { return false ; } $ this -> _rights_bas [ $ base_id ] [ 'remain_dwnld' ] = max ( 0 , $ this -> _rights_bas [ $ base_id ] [ 'remain_dwnld' ] - ( int ) $ n ) ; return $ this ; }
Remove n download from the remainings
49,151
public function has_right ( $ right ) { $ this -> load_global_rights ( ) ; if ( ! isset ( $ this -> _global_rights [ $ right ] ) ) { throw new Exception ( 'This right does not exists' ) ; } return $ this -> _global_rights [ $ right ] ; }
Check if the user has the right on at least one collection
49,152
public function has_right_on_sbas ( $ sbas_id , $ right ) { $ this -> load_rights_sbas ( ) ; if ( ! isset ( $ this -> _rights_sbas [ $ sbas_id ] ) ) { return false ; } if ( ! isset ( $ this -> _rights_sbas [ $ sbas_id ] [ $ right ] ) ) { throw new Exception ( 'This right does not exists' ) ; } if ( $ this -> _rights_sb...
Check if the user has the required right on a database
49,153
public function get_mask_and ( $ base_id ) { $ this -> load_rights_bas ( ) ; if ( ! $ this -> has_access_to_base ( $ base_id ) ) { return false ; } return $ this -> _rights_bas [ $ base_id ] [ 'mask_and' ] ; }
Retrieve mask AND for user on specified base_id
49,154
public function get_mask_xor ( $ base_id ) { $ this -> load_rights_bas ( ) ; if ( ! $ this -> has_access_to_base ( $ base_id ) ) { return false ; } return $ this -> _rights_bas [ $ base_id ] [ 'mask_xor' ] ; }
Retrieve mask XOR for user on specified base_id
49,155
public function has_access_to_base ( $ base_id ) { $ this -> load_rights_bas ( ) ; return ( isset ( $ this -> _rights_bas [ $ base_id ] ) && $ this -> _rights_bas [ $ base_id ] [ self :: ACTIF ] === true ) ; }
Return true if access to base_id is granted
49,156
public function get_granted_base ( Array $ rights = [ ] , array $ sbas_ids = null ) { $ this -> load_rights_bas ( ) ; $ ret = [ ] ; foreach ( $ this -> app -> getDataboxes ( ) as $ databox ) { if ( $ sbas_ids && ! in_array ( $ databox -> get_sbas_id ( ) , $ sbas_ids ) ) { continue ; } foreach ( $ databox -> get_collect...
Return an array of base_id which are granted with optionnal filter by rights
49,157
protected function load_hd_grant ( ) { if ( $ this -> _rights_records_preview ) { return $ this ; } try { $ tmp_rights = $ this -> get_data_from_cache ( self :: CACHE_RIGHTS_RECORDS ) ; $ this -> _rights_records_preview = $ tmp_rights [ 'preview' ] ; $ this -> _rights_records_document = $ tmp_rights [ 'document' ] ; re...
Load if needed the elements which have a HD grant
49,158
protected function load_rights_sbas ( ) { if ( $ this -> _rights_sbas && $ this -> _global_rights ) { return $ this ; } try { $ global_rights = $ this -> get_data_from_cache ( self :: CACHE_GLOBAL_RIGHTS ) ; if ( ! is_array ( $ global_rights ) ) { throw new Exception ( 'global rights were not properly retrieved' ) ; } ...
Loads rights of specified user for all sbas
49,159
protected function load_global_rights ( ) { $ this -> load_rights_bas ( ) ; $ this -> load_rights_sbas ( ) ; $ this -> _global_rights [ self :: TASKMANAGER ] = $ this -> is_admin ( ) ; return $ this ; }
Loads global rights for user
49,160
public function has_access_to_module ( $ module_name ) { switch ( $ module_name ) { case 'admin' : return ( ( $ this -> has_right ( self :: BAS_MODIFY_STRUCT ) || $ this -> has_right ( self :: COLL_MODIFY_STRUCT ) || $ this -> has_right ( self :: BAS_MANAGE ) || $ this -> has_right ( self :: COLL_MANAGE ) || $ this -> ...
Return whether or not the acces to the specified module is OK
49,161
public function getOrderMasterCollectionsBaseIds ( ) { $ sql = "SELECT base_id FROM basusr WHERE order_master='1' AND usr_id= :usr_id" ; $ result = $ this -> app -> getApplicationBox ( ) -> get_connection ( ) -> executeQuery ( $ sql , [ ':usr_id' => $ this -> user -> getId ( ) ] ) -> fetchAll ( \ PDO :: FETCH_ASSOC ) ;...
Returns base ids on which user is order master
49,162
public function get_order_master_collections ( ) { $ baseIds = $ this -> getOrderMasterCollectionsBaseIds ( ) ; $ collectionReferences = $ this -> app [ 'repo.collection-references' ] -> findHavingOrderMaster ( $ baseIds ) ; $ groups = new CollectionReferenceCollection ( $ collectionReferences ) ; $ collections = [ ] ;...
Returns an array of collections on which the user is order master
49,163
public function set_order_master ( \ collection $ collection , $ bool ) { $ sql = "UPDATE basusr SET order_master = :master WHERE usr_id = :usr_id AND base_id = :base_id" ; $ stmt = $ this -> app -> getApplicationBox ( ) -> get_connection ( ) -> prepare ( $ sql ) ; $ stmt -> execute ( [ ':master' => $ bool ? 1 : 0 , ':...
Sets the user as order_master on a collection
49,164
public function shareRecord ( $ base_id , $ record_id ) { $ record = new \ record_adapter ( $ this -> app , \ phrasea :: sbasFromBas ( $ this -> app , $ base_id ) , $ record_id ) ; $ subdefs = $ record -> get_subdefs ( ) ; $ databoxSubdefs = $ record -> getDatabox ( ) -> get_subdef_structure ( ) -> getSubdefGroup ( $ r...
Share a record
49,165
public function getGranted ( ) { $ databoxes = [ ] ; foreach ( $ this -> acl -> get_granted_base ( [ \ ACL :: CANREPORT ] ) as $ collection ) { $ sbas_id = $ collection -> get_sbas_id ( ) ; if ( ! isset ( $ databoxes [ $ sbas_id ] ) ) { $ databoxes [ $ sbas_id ] = [ 'id' => $ sbas_id , 'name' => $ collection -> get_dat...
return bases allowed for reporting grouped by databox
49,166
public function getAllForUser ( \ ACL $ userACL , array $ restrictions = [ ] ) { $ base_ids = array_keys ( $ userACL -> get_granted_base ( ) ) ; $ qb = $ this -> createQueryBuilder ( 'f' ) ; $ qb -> where ( $ qb -> expr ( ) -> isNull ( 'f.baseId' ) ) -> orWhere ( $ qb -> expr ( ) -> eq ( 'f.public' , $ qb -> expr ( ) -...
Returns all the feeds a user can access .
49,167
public function createMode ( $ throwException = false , $ forceMode = false ) { if ( false === $ this -> enabled && true !== $ forceMode ) { return new NullMode ( ) ; } switch ( $ this -> type ) { case 'apache' : case 'apache2' : return new Apache ( $ this -> mapping ) ; case 'nginx' : return new Nginx ( $ this -> mapp...
Returns a new instance of H264Interface .
49,168
public function update ( User $ user , $ flush = true ) { $ this -> objectManager -> persist ( $ user ) ; if ( $ flush ) { $ this -> objectManager -> flush ( ) ; } }
Updates an user .
49,169
private function cleanSettings ( User $ user ) { foreach ( $ user -> getNotificationSettings ( ) as $ userNotificationSetting ) { $ this -> objectManager -> remove ( $ userNotificationSetting ) ; } $ user -> getNotificationSettings ( ) -> clear ( ) ; foreach ( $ user -> getSettings ( ) as $ userSetting ) { $ this -> ob...
Removes user settings .
49,170
private function cleanQueries ( User $ user ) { foreach ( $ user -> getQueries ( ) as $ userQuery ) { $ this -> objectManager -> remove ( $ userQuery ) ; } $ user -> getQueries ( ) -> clear ( ) ; }
Removes user queries .
49,171
private function cleanFtpCredentials ( User $ user ) { if ( null !== $ credential = $ user -> getFtpCredential ( ) ) { $ this -> objectManager -> remove ( $ credential ) ; } }
Removes user ftp credentials .
49,172
private function cleanFtpExports ( User $ user ) { $ elements = $ this -> objectManager -> getRepository ( 'Phraseanet:FtpExport' ) -> findBy ( [ 'user' => $ user ] ) ; foreach ( $ elements as $ element ) { $ this -> objectManager -> remove ( $ element ) ; } }
Removes user ftp export .
49,173
private function cleanAuthProvider ( User $ user ) { $ providers = $ this -> objectManager -> getRepository ( 'Phraseanet:UsrAuthProvider' ) -> findBy ( [ 'user' => $ user ] ) ; foreach ( $ providers as $ provider ) { $ this -> objectManager -> remove ( $ provider ) ; } }
Removes user providers .
49,174
private function cleanProperties ( User $ user ) { $ sql = 'DELETE FROM `edit_presets` WHERE usr_id = :usr_id' ; $ stmt = $ this -> appboxConnection -> prepare ( $ sql ) ; $ stmt -> execute ( [ ':usr_id' => $ user -> getId ( ) ] ) ; $ stmt -> closeCursor ( ) ; $ this -> cleanSettings ( $ user ) ; $ this -> cleanTokens ...
Removes all user s properties .
49,175
private function cleanRights ( User $ user ) { foreach ( [ 'DELETE FROM `basusr` WHERE usr_id = :usr_id' , 'DELETE FROM `sbasusr` WHERE usr_id = :usr_id' , ] as $ sql ) { $ stmt = $ this -> appboxConnection -> prepare ( $ sql ) ; $ stmt -> execute ( [ ':usr_id' => $ user -> getId ( ) ] ) ; $ stmt -> closeCursor ( ) ; }...
Removes all user s rights .
49,176
public function isDataboxAvailable ( \ databox $ databox ) { if ( ! $ this -> isRestricted ( ) ) { return true ; } return in_array ( $ databox -> get_sbas_id ( ) , $ this -> availableDataboxes , true ) ; }
Returns true if a databox is available given a configuration .
49,177
public function isCollectionAvailable ( \ collection $ collection ) { if ( ! $ this -> isRestricted ( ) ) { return true ; } $ availableCollections = isset ( $ this -> availableCollections [ $ collection -> get_sbas_id ( ) ] ) ? $ this -> availableCollections [ $ collection -> get_sbas_id ( ) ] : [ ] ; return in_array (...
Returns true if a collection is available given a configuration .
49,178
public function createResponse ( ) { $ response = $ this -> format ( ) ; $ response -> headers -> set ( 'content-type' , $ this -> getContentType ( ) ) ; $ response -> setStatusCode ( $ this -> getStatusCode ( ) ) ; $ response -> setCharset ( 'UTF-8' ) ; return $ response ; }
Creates a Symfony Response
49,179
private function setData ( array $ data = null ) { if ( null === $ data || count ( $ data ) === 0 ) { $ data = new \ stdClass ( ) ; } $ this -> data = $ data ; return $ this ; }
Sets data to the response .
49,180
private function format ( ) { $ request_uri = sprintf ( '%s %s' , $ this -> request -> getMethod ( ) , $ this -> request -> getBasePath ( ) . $ this -> request -> getPathInfo ( ) ) ; $ ret = [ 'meta' => [ 'api_version' => $ this -> getVersion ( ) , 'request' => $ request_uri , 'response_time' => $ this -> responseTime ...
Formats the data and return serialized string
49,181
public function createRegistration ( User $ user , \ collection $ collection ) { $ registration = new Registration ( ) ; $ registration -> setUser ( $ user ) ; $ registration -> setCollection ( $ collection ) ; $ this -> em -> persist ( $ registration ) ; $ this -> em -> flush ( ) ; return $ registration ; }
Creates a new registration .
49,182
public function rejectRegistration ( Registration $ registration ) { $ registration -> setPending ( false ) ; $ registration -> setRejected ( true ) ; $ this -> em -> persist ( $ registration ) ; $ this -> em -> flush ( ) ; }
Rejects a registration .
49,183
public function acceptRegistration ( Registration $ registration , $ grantHd = false , $ grantWatermark = false ) { $ user = $ registration -> getUser ( ) ; $ collection = $ registration -> getCollection ( $ this -> app ) ; $ this -> aclProvider -> get ( $ user ) -> give_access_to_sbas ( [ $ collection -> get_sbas_id (...
Accepts a registration .
49,184
public function deleteUserRegistrations ( User $ user , array $ collections ) { $ qb = $ this -> repository -> createQueryBuilder ( 'd' ) ; $ qb -> delete ( 'Phraseanet:Registration' , 'd' ) ; $ qb -> where ( $ qb -> expr ( ) -> eq ( 'd.user' , ':user' ) ) ; $ qb -> setParameter ( ':user' , $ user -> getId ( ) ) ; if (...
Deletes registration for given user .
49,185
public function deleteOldRegistrations ( ) { $ qb = $ this -> repository -> createQueryBuilder ( 'd' ) ; $ qb -> delete ( 'Phraseanet:Registration' , 'd' ) ; $ qb -> where ( $ qb -> expr ( ) -> lt ( 'd.created' , ':date' ) ) ; $ qb -> setParameter ( ':date' , new \ DateTime ( '-1 month' ) ) ; $ qb -> getQuery ( ) -> ex...
Deletes old registrations .
49,186
public function deleteRegistrationsOnCollection ( \ collection $ collection ) { $ qb = $ this -> repository -> createQueryBuilder ( 'd' ) ; $ qb -> delete ( 'Phraseanet:Registration' , 'd' ) ; $ qb -> where ( $ qb -> expr ( ) -> eq ( 'd.baseId' , ':base' ) ) ; $ qb -> setParameter ( ':base' , $ collection -> get_base_i...
Deletes registrations on given collection .
49,187
public function remove_file ( ) { if ( $ this -> is_physically_present ( ) && is_writable ( $ this -> getRealPath ( ) ) ) { unlink ( $ this -> getRealPath ( ) ) ; $ this -> delete_data_from_cache ( ) ; $ permalink = $ this -> get_permalink ( ) ; if ( $ permalink instanceof media_Permalink_Adapter ) { $ permalink -> del...
Removes the file associated to a subdef
49,188
public function delete ( ) { $ this -> remove_file ( ) ; $ connection = $ this -> getDataboxConnection ( ) ; $ connection -> executeUpdate ( 'DELETE FROM permalinks WHERE subdef_id = :subdef_id' , [ 'subdef_id' => $ this -> subdef_id ] ) ; self :: getMediaSubdefRepository ( $ this -> app , $ this -> record -> getDatabo...
delete this subdef
49,189
protected function markPhysicallyUnavailable ( ) { $ this -> is_physically_present = false ; $ this -> mime = 'image/png' ; $ this -> width = 256 ; $ this -> height = 256 ; $ this -> file = $ this -> getSubstituteFilename ( ) ; $ this -> etag = null ; $ this -> path = $ this -> app [ 'root.path' ] . '/www/assets/common...
Find a substitution file for a subdef
49,190
public function getDataboxSubdef ( ) { return $ this -> record -> getDatabox ( ) -> get_subdef_structure ( ) -> get_subdef ( $ this -> record -> getType ( ) , $ this -> get_name ( ) ) ; }
Return the databox subdef corresponding to the subdef
49,191
public function readTechnicalDatas ( MediaVorus $ mediavorus ) { if ( ! $ this -> is_physically_present ( ) ) { return [ ] ; } $ media = $ mediavorus -> guess ( $ this -> getRealPath ( ) ) ; $ datas = [ ] ; $ techDatas = self :: getTechnicalFieldsList ( ) ; foreach ( $ techDatas as $ tc_name => $ techData ) { if ( arra...
Read the technical datas of the file . Returns an empty array for non physical present files
49,192
public static function getTechnicalFieldsList ( ) { if ( empty ( self :: $ technicalFieldsList ) ) { self :: $ technicalFieldsList = [ self :: TC_DATA_WIDTH => [ 'method' => 'getWidth' , 'type' => 'integer' , 'analyzable' => false ] , self :: TC_DATA_HEIGHT => [ 'method' => 'getHeight' , 'type' => 'integer' , 'analyzab...
Return list of technical data and their attributes
49,193
public function isRegistrationEnabled ( ) { foreach ( $ this -> appbox -> get_databoxes ( ) as $ databox ) { foreach ( $ databox -> get_collections ( ) as $ collection ) { if ( $ collection -> isRegistrationEnabled ( ) ) { return true ; } } } return false ; }
Tells whether registration is enabled or not .
49,194
public function getRegistrationSummary ( User $ user = null ) { $ data = $ userData = [ ] ; if ( null !== $ user ) { $ userData = $ this -> repository -> getRegistrationsSummaryForUser ( $ user ) ; } foreach ( $ this -> appbox -> get_databoxes ( ) as $ databox ) { $ data [ $ databox -> get_sbas_id ( ) ] = [ 'registrati...
Gets information about registration configuration and registration status if a user id is provided .
49,195
private function userHasRequestedARegistrationOnCollection ( \ collection $ collection , $ userData ) { if ( null === $ userRegistration = igorw \ get_in ( $ userData , [ $ collection -> get_sbas_id ( ) , $ collection -> get_base_id ( ) ] ) ) { return false ; } return ! is_null ( $ userRegistration [ 'active' ] ) ; }
Tells whether user has ever requested a registration on collection or not .
49,196
public function get_category_list ( ) { $ cat = [ ] ; $ url_cat = sprintf ( '%s?hl=%s' , self :: CATEGORY_URL , $ this -> get_locale ( ) ) ; if ( false === $ cxml = simplexml_load_file ( $ url_cat ) ) { throw new Bridge_Exception_ApiConnectorRequestFailed ( 'Failed to retrive youtube categories' ) ; } $ cxml -> registe...
get available youtube categories as an array
49,197
public static function create ( Application $ app ) { $ conf = $ app [ 'conf' ] -> get ( 'xsendfile' ) ; $ mapping = [ ] ; if ( isset ( $ conf [ 'mapping' ] ) ) { $ mapping = $ conf [ 'mapping' ] ; } return new self ( $ app [ 'monolog' ] , $ conf [ 'enabled' ] , $ conf [ 'type' ] , $ mapping ) ; }
Creates a new instance of XSendFile Factory according to the application configuration .
49,198
public function getMode ( $ throwException = false , $ forceMode = false ) { if ( false === $ this -> enabled && true !== $ forceMode ) { return new NullMode ( ) ; } switch ( $ this -> type ) { case 'nginx' : case 'sendfile' : case 'xaccel' : case 'xaccelredirect' : case 'x-accel' : case 'x-accel-redirect' : if ( 2 >= ...
Returns a new instance of ModeInterface .
49,199
public static function create ( LoggerInterface $ logger , array $ options = [ ] ) { $ context = new \ ZMQContext ( ) ; $ socket = $ context -> getSocket ( \ ZMQ :: SOCKET_REQ ) ; $ socket -> setSockOpt ( \ ZMQ :: SOCKOPT_LINGER , $ options [ 'linger' ] ) ; $ socket -> connect ( sprintf ( '%s://%s:%s' , $ options [ 'pr...
Creates a Notifier .