idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
41,300 | public static function clean ( $ input ) { if ( is_array ( $ input ) ) { foreach ( $ input as $ idx => $ val ) { $ input [ $ idx ] = self :: clean ( $ val ) ; } return $ input ; } if ( ! is_string ( $ input ) || $ input == '' ) { return $ input ; } if ( function_exists ( 'mb_convert_encoding' ) ) { $ msch = mb_substitu... | Removes non - unicode characters from input . |
41,301 | private function check_host_login_exceptions ( ) { $ rcmail = rcmail :: get_instance ( ) ; $ hosts = $ rcmail -> config -> get ( 'password_hosts' ) ; if ( ! empty ( $ hosts ) && ! in_array ( $ _SESSION [ 'storage_host' ] , ( array ) $ hosts ) ) { return false ; } if ( $ exceptions = $ rcmail -> config -> get ( 'passwor... | Check if host and login is allowed to change the password false = not allowed true = not allowed |
41,302 | function startup ( $ args ) { if ( ! empty ( $ _SERVER [ 'REMOTE_USER' ] ) && ! empty ( $ _SERVER [ 'KRB5CCNAME' ] ) ) { if ( empty ( $ _SESSION [ 'user_id' ] ) ) { $ args [ 'action' ] = 'login' ; $ this -> redirect_query = $ _SERVER [ 'QUERY_STRING' ] ; } else { $ _SESSION [ 'password' ] = null ; } } return $ args ; } | Startup hook handler |
41,303 | function authenticate ( $ args ) { if ( ! empty ( $ _SERVER [ 'REMOTE_USER' ] ) && ! empty ( $ _SERVER [ 'KRB5CCNAME' ] ) ) { $ this -> load_config ( ) ; $ rcmail = rcmail :: get_instance ( ) ; $ host = $ rcmail -> config -> get ( 'krb_authentication_host' ) ; if ( is_string ( $ host ) && trim ( $ host ) !== '' && empt... | Authenticate hook handler |
41,304 | function storage_connect ( $ args ) { if ( ! empty ( $ _SERVER [ 'REMOTE_USER' ] ) && ! empty ( $ _SERVER [ 'KRB5CCNAME' ] ) ) { $ this -> load_config ( ) ; $ rcmail = rcmail :: get_instance ( ) ; $ context = $ rcmail -> config -> get ( 'krb_authentication_context' ) ; $ args [ 'gssapi_context' ] = $ context ? : 'imap/... | Storage_connect hook handler |
41,305 | public function anonymize ( $ contentId , array $ fields = [ ] , DateTime $ date = null ) { $ fieldsWithIds = $ this -> getFieldIds ( $ contentId , $ fields ) ; if ( ! empty ( $ fields ) && empty ( $ fieldsWithIds ) ) { return 0 ; } $ collections = $ this -> getCollections ( $ contentId , $ date ) ; foreach ( $ collect... | Anonymize collections by content id |
41,306 | protected function getFieldIds ( $ contentId , array $ fieldIdentifiers ) { $ ids = [ ] ; foreach ( $ fieldIdentifiers as $ identifier ) { try { $ ids [ ] = $ this -> contentTypeUtils -> getFieldId ( $ contentId , $ identifier ) ; } catch ( OutOfBoundsException $ e ) { continue ; } } return $ ids ; } | Map field id s to list of field identifiers |
41,307 | public function close ( ) { $ this -> connect_done = false ; $ this -> conn -> closeConnection ( ) ; if ( $ this -> mcache ) { $ this -> mcache -> close ( ) ; } } | Close IMAP connection . Usually done on script shutdown |
41,308 | public function check_connection ( ) { if ( ! $ this -> connect_done && ! empty ( $ this -> options [ 'user' ] ) ) { return $ this -> connect ( $ this -> options [ 'host' ] , $ this -> options [ 'user' ] , $ this -> options [ 'password' ] , $ this -> options [ 'port' ] , $ this -> options [ 'ssl' ] ) ; } return $ this ... | Check connection state connect if not connected . |
41,309 | public function get_response_code ( ) { switch ( $ this -> conn -> resultcode ) { case 'NOPERM' : return self :: NOPERM ; case 'READ-ONLY' : return self :: READONLY ; case 'TRYCREATE' : return self :: TRYCREATE ; case 'INUSE' : return self :: INUSE ; case 'OVERQUOTA' : return self :: OVERQUOTA ; case 'ALREADYEXISTS' : ... | Returns code of last command response |
41,310 | public function set_search_set ( $ set ) { $ set = ( array ) $ set ; $ this -> search_string = $ set [ 0 ] ; $ this -> search_set = $ set [ 1 ] ; $ this -> search_charset = $ set [ 2 ] ; $ this -> search_sort_field = $ set [ 3 ] ; $ this -> search_sorted = $ set [ 4 ] ; $ this -> search_threads = is_a ( $ this -> searc... | Save a search result for future message listing methods |
41,311 | public function get_search_set ( ) { if ( empty ( $ this -> search_set ) ) { return null ; } return array ( $ this -> search_string , $ this -> search_set , $ this -> search_charset , $ this -> search_sort_field , $ this -> search_sorted , ) ; } | Return the saved search set as hash array |
41,312 | public function get_capability ( $ cap ) { $ cap = strtoupper ( $ cap ) ; $ sess_key = "STORAGE_$cap" ; if ( ! isset ( $ _SESSION [ $ sess_key ] ) ) { if ( ! $ this -> check_connection ( ) ) { return false ; } $ _SESSION [ $ sess_key ] = $ this -> conn -> getCapability ( $ cap ) ; } return $ _SESSION [ $ sess_key ] ; } | Returns the IMAP server s capability . |
41,313 | public function check_permflag ( $ flag ) { $ flag = strtoupper ( $ flag ) ; $ perm_flags = $ this -> get_permflags ( $ this -> folder ) ; $ imap_flag = $ this -> conn -> flags [ $ flag ] ; return $ imap_flag && ! empty ( $ perm_flags ) && in_array_nocase ( $ imap_flag , $ perm_flags ) ; } | Checks the PERMANENTFLAGS capability of the current folder and returns true if the given flag is supported by the IMAP server |
41,314 | public function get_permflags ( $ folder ) { if ( ! strlen ( $ folder ) ) { return array ( ) ; } if ( ! $ this -> check_connection ( ) ) { return array ( ) ; } if ( $ this -> conn -> select ( $ folder ) ) { $ permflags = $ this -> conn -> data [ 'PERMANENTFLAGS' ] ; } else { return array ( ) ; } if ( ! is_array ( $ per... | Returns PERMANENTFLAGS of the specified folder |
41,315 | public function get_vendor ( ) { if ( $ _SESSION [ 'imap_vendor' ] !== null ) { return $ _SESSION [ 'imap_vendor' ] ; } $ config = rcube :: get_instance ( ) -> config ; $ imap_vendor = $ config -> get ( 'imap_vendor' ) ; if ( $ imap_vendor ) { return $ imap_vendor ; } if ( ! $ this -> check_connection ( ) ) { return ; ... | Returns IMAP server vendor name |
41,316 | public function count ( $ folder = '' , $ mode = 'ALL' , $ force = false , $ status = true ) { if ( ! strlen ( $ folder ) ) { $ folder = $ this -> folder ; } return $ this -> countmessages ( $ folder , $ mode , $ force , $ status ) ; } | Get message count for a specific folder |
41,317 | public function list_flags ( $ folder , $ uids , $ mod_seq = null ) { if ( ! strlen ( $ folder ) ) { $ folder = $ this -> folder ; } if ( ! $ this -> check_connection ( ) ) { return array ( ) ; } $ flags = $ this -> conn -> fetch ( $ folder , $ uids , true , array ( 'FLAGS' ) , $ mod_seq ) ; $ result = array ( ) ; if (... | Public method for listing message flags |
41,318 | public function list_messages ( $ folder = '' , $ page = NULL , $ sort_field = NULL , $ sort_order = NULL , $ slice = 0 ) { if ( ! strlen ( $ folder ) ) { $ folder = $ this -> folder ; } return $ this -> _list_messages ( $ folder , $ page , $ sort_field , $ sort_order , $ slice ) ; } | Public method for listing headers |
41,319 | protected function _list_messages ( $ folder = '' , $ page = NULL , $ sort_field = NULL , $ sort_order = NULL , $ slice = 0 ) { if ( ! strlen ( $ folder ) ) { return array ( ) ; } $ this -> set_sort_order ( $ sort_field , $ sort_order ) ; $ page = $ page ? $ page : $ this -> list_page ; if ( $ this -> search_string ) {... | protected method for listing message headers |
41,320 | protected function list_thread_messages ( $ folder , $ page , $ slice = 0 ) { if ( $ mcache = $ this -> get_mcache_engine ( ) ) { $ threads = $ mcache -> get_thread ( $ folder ) ; } else { $ threads = $ this -> threads ( $ folder ) ; } return $ this -> fetch_thread_headers ( $ folder , $ threads , $ page , $ slice ) ; ... | protected method for listing message headers using threads |
41,321 | function threads ( $ folder ) { if ( $ mcache = $ this -> get_mcache_engine ( ) ) { return $ mcache -> get_thread ( $ folder ) ; } if ( ! empty ( $ this -> icache [ 'threads' ] ) ) { if ( $ this -> icache [ 'threads' ] -> get_parameters ( 'MAILBOX' ) == $ folder ) { return $ this -> icache [ 'threads' ] ; } } $ result ... | Method for fetching threads data |
41,322 | function threads_direct ( $ folder ) { if ( ! $ this -> check_connection ( ) ) { return new rcube_result_thread ( ) ; } return $ this -> conn -> thread ( $ folder , $ this -> threading , $ this -> options [ 'skip_deleted' ] ? 'UNDELETED' : '' , true ) ; } | Method for direct fetching of threads data |
41,323 | protected function fetch_thread_headers ( $ folder , $ threads , $ page , $ slice = 0 ) { $ this -> sort_threads ( $ threads ) ; $ from = ( $ page - 1 ) * $ this -> page_size ; $ to = $ from + $ this -> page_size ; $ threads -> slice ( $ from , $ to - $ from ) ; if ( $ slice ) { $ threads -> slice ( - $ slice , $ slice... | protected method for fetching threaded messages headers |
41,324 | public function index ( $ folder = '' , $ sort_field = NULL , $ sort_order = NULL , $ no_threads = false , $ no_search = false ) { if ( ! $ no_threads && $ this -> threading ) { return $ this -> thread_index ( $ folder , $ sort_field , $ sort_order ) ; } $ this -> set_sort_order ( $ sort_field , $ sort_order ) ; if ( !... | Return sorted list of message UIDs |
41,325 | public function index_direct ( $ folder , $ sort_field = null , $ sort_order = null , $ search = null ) { if ( ! empty ( $ search ) ) { $ search = $ search -> get_compressed ( ) ; } if ( ! $ sort_field ) { if ( empty ( $ search ) && $ this -> options [ 'skip_deleted' ] && ! empty ( $ this -> icache [ 'undeleted_idx' ] ... | Return sorted list of message UIDs ignoring current search settings . Doesn t uses cache by default . |
41,326 | public function thread_index ( $ folder = '' , $ sort_field = NULL , $ sort_order = NULL ) { if ( ! strlen ( $ folder ) ) { $ folder = $ this -> folder ; } if ( $ this -> search_string && $ this -> search_threads && $ folder == $ this -> folder ) { $ threads = $ this -> search_set ; } else { $ threads = $ this -> threa... | Return index of threaded message UIDs |
41,327 | protected function sort_threads ( $ threads ) { if ( $ threads -> is_empty ( ) ) { return ; } if ( $ this -> threading != 'REFS' || ( $ this -> sort_field && $ this -> sort_field != 'date' ) ) { $ sortby = $ this -> sort_field ? $ this -> sort_field : 'date' ; $ index = $ this -> index ( $ this -> folder , $ sortby , $... | Sort threaded result using THREAD = REFS method if available . If not use any method and re - sort the result in THREAD = REFS way . |
41,328 | protected function search_index ( $ folder , $ criteria = 'ALL' , $ charset = NULL , $ sort_field = NULL ) { if ( ! $ this -> check_connection ( ) ) { if ( $ this -> threading ) { return new rcube_result_thread ( ) ; } else { return new rcube_result_index ( ) ; } } if ( $ this -> options [ 'skip_deleted' ] && ! preg_ma... | protected search method |
41,329 | public static function convert_criteria ( $ str , $ charset , $ dest_charset = 'US-ASCII' ) { if ( preg_match_all ( '/\{([0-9]+)\}\r\n/' , $ str , $ matches , PREG_OFFSET_CAPTURE ) ) { $ last = 0 ; $ res = '' ; foreach ( $ matches [ 1 ] as $ m ) { $ string_offset = $ m [ 1 ] + strlen ( $ m [ 0 ] ) + 4 ; $ string = subs... | Converts charset of search criteria string |
41,330 | public function refresh_search ( ) { if ( ! empty ( $ this -> search_string ) ) { $ this -> search ( is_object ( $ this -> search_set ) ? $ this -> search_set -> get_parameters ( 'MAILBOX' ) : '' , $ this -> search_string , $ this -> search_charset , $ this -> search_sort_field ) ; } return $ this -> get_search_set ( )... | Refresh saved search set |
41,331 | public function get_message_headers ( $ uid , $ folder = null , $ force = false ) { if ( preg_match ( '/^\d+-.+/' , $ uid ) ) { list ( $ uid , $ folder ) = explode ( '-' , $ uid , 2 ) ; } if ( ! strlen ( $ folder ) ) { $ folder = $ this -> folder ; } if ( ! $ force && $ uid && ( $ mcache = $ this -> get_mcache_engine (... | Return message headers object of a specific message |
41,332 | public function get_raw_headers ( $ uid , $ part = null ) { if ( ! $ this -> check_connection ( ) ) { return null ; } return $ this -> conn -> fetchPartHeader ( $ this -> folder , $ uid , true , $ part ) ; } | Returns the message headers as string |
41,333 | public function print_raw_body ( $ uid , $ formatted = true ) { if ( ! $ this -> check_connection ( ) ) { return ; } $ this -> conn -> handlePartBody ( $ this -> folder , $ uid , true , null , null , true , null , $ formatted ) ; } | Sends the whole message source to stdout |
41,334 | public function set_flag ( $ uids , $ flag , $ folder = null , $ skip_cache = false ) { if ( ! strlen ( $ folder ) ) { $ folder = $ this -> folder ; } if ( ! $ this -> check_connection ( ) ) { return false ; } $ flag = strtoupper ( $ flag ) ; list ( $ uids , $ all_mode ) = $ this -> parse_uids ( $ uids ) ; if ( strpos ... | Set message flag to one or several messages |
41,335 | public function move_message ( $ uids , $ to_mbox , $ from_mbox = '' ) { if ( ! strlen ( $ from_mbox ) ) { $ from_mbox = $ this -> folder ; } if ( $ to_mbox === $ from_mbox ) { return false ; } list ( $ uids , $ all_mode ) = $ this -> parse_uids ( $ uids ) ; if ( empty ( $ uids ) ) { return false ; } if ( ! $ this -> c... | Move a message from one folder to another |
41,336 | public function copy_message ( $ uids , $ to_mbox , $ from_mbox = '' ) { if ( ! strlen ( $ from_mbox ) ) { $ from_mbox = $ this -> folder ; } list ( $ uids , $ all_mode ) = $ this -> parse_uids ( $ uids ) ; if ( empty ( $ uids ) ) { return false ; } if ( ! $ this -> check_connection ( ) ) { return false ; } $ copied = ... | Copy a message from one folder to another |
41,337 | public function delete_message ( $ uids , $ folder = '' ) { if ( ! strlen ( $ folder ) ) { $ folder = $ this -> folder ; } list ( $ uids , $ all_mode ) = $ this -> parse_uids ( $ uids ) ; if ( empty ( $ uids ) ) { return false ; } if ( ! $ this -> check_connection ( ) ) { return false ; } $ deleted = $ this -> conn -> ... | Mark messages as deleted and expunge them |
41,338 | public function expunge_message ( $ uids , $ folder = null , $ clear_cache = true ) { if ( $ uids && $ this -> get_capability ( 'UIDPLUS' ) ) { list ( $ uids , $ all_mode ) = $ this -> parse_uids ( $ uids ) ; } else { $ uids = null ; } if ( ! strlen ( $ folder ) ) { $ folder = $ this -> folder ; } if ( ! $ this -> chec... | Send IMAP expunge command and clear cache |
41,339 | public function list_folders_subscribed ( $ root = '' , $ name = '*' , $ filter = null , $ rights = null , $ skip_sort = false ) { $ cache_key = $ root . ':' . $ name ; if ( ! empty ( $ filter ) ) { $ cache_key .= ':' . ( is_string ( $ filter ) ? $ filter : serialize ( $ filter ) ) ; } $ cache_key .= ':' . $ rights ; $... | Public method for listing subscribed folders . |
41,340 | protected function list_folders_update ( & $ result , $ type = null ) { $ namespace = $ this -> get_namespace ( ) ; $ search = array ( ) ; foreach ( ( array ) $ namespace as $ ns ) { if ( is_array ( $ ns ) ) { foreach ( $ ns as $ ns_data ) { if ( strlen ( $ ns_data [ 0 ] ) ) { $ search [ ] = $ ns_data [ 0 ] ; } } } } i... | Fix folders list by adding folders from other namespaces . Needed on some servers eg . Courier IMAP |
41,341 | protected function filter_rights ( $ a_folders , $ rights ) { $ regex = '/(' . $ rights . ')/' ; foreach ( $ a_folders as $ idx => $ folder ) { if ( $ this -> folder_namespace ( $ folder ) == 'personal' ) { continue ; } $ myrights = join ( '' , ( array ) $ this -> my_rights ( $ folder ) ) ; if ( $ myrights !== null && ... | Filter the given list of folders according to access rights |
41,342 | public function get_quota ( $ folder = null ) { if ( $ this -> get_capability ( 'QUOTA' ) && $ this -> check_connection ( ) ) { return $ this -> conn -> getQuota ( $ folder ) ; } return false ; } | Get mailbox quota information |
41,343 | public function create_folder ( $ folder , $ subscribe = false , $ type = null ) { if ( ! $ this -> check_connection ( ) ) { return false ; } $ result = $ this -> conn -> createFolder ( $ folder , $ type ? array ( "\\" . ucfirst ( $ type ) ) : null ) ; if ( $ result ) { $ this -> clear_cache ( 'mailboxes' , true ) ; if... | Create a new folder on the server and register it in local cache |
41,344 | public function rename_folder ( $ folder , $ new_name ) { if ( ! strlen ( $ new_name ) ) { return false ; } if ( ! $ this -> check_connection ( ) ) { return false ; } $ delm = $ this -> get_hierarchy_delimiter ( ) ; if ( ( strpos ( $ folder , '%' ) === false ) && ( strpos ( $ folder , '*' ) === false ) ) { $ a_subscrib... | Set a new name to an existing folder |
41,345 | public function get_special_folders ( $ forced = false ) { $ result = parent :: get_special_folders ( ) ; $ rcube = rcube :: get_instance ( ) ; if ( $ rcube -> config -> get ( 'lock_special_folders' ) ) { return $ result ; } if ( isset ( $ this -> icache [ 'special-use' ] ) ) { return array_merge ( $ result , $ this ->... | Detect special folder associations stored in storage backend |
41,346 | public function set_special_folders ( $ specials ) { if ( ! $ this -> get_capability ( 'SPECIAL-USE' ) || ! $ this -> get_capability ( 'METADATA' ) ) { return false ; } if ( ! $ this -> check_connection ( ) ) { return false ; } $ folders = $ this -> get_special_folders ( true ) ; $ old = ( array ) $ this -> icache [ 's... | Set special folder associations stored in storage backend |
41,347 | public function folder_exists ( $ folder , $ subscription = false ) { if ( $ folder == 'INBOX' ) { return true ; } $ key = $ subscription ? 'subscribed' : 'existing' ; if ( is_array ( $ this -> icache [ $ key ] ) && in_array ( $ folder , $ this -> icache [ $ key ] ) ) { return true ; } if ( ! $ this -> check_connection... | Checks if folder exists and is subscribed |
41,348 | public function folder_namespace ( $ folder ) { if ( $ folder == 'INBOX' ) { return 'personal' ; } foreach ( $ this -> namespace as $ type => $ namespace ) { if ( is_array ( $ namespace ) ) { foreach ( $ namespace as $ ns ) { if ( $ len = strlen ( $ ns [ 0 ] ) ) { if ( ( $ len > 1 && $ folder == substr ( $ ns [ 0 ] , 0... | Returns the namespace where the folder is in |
41,349 | public function mod_folder ( $ folder , $ mode = 'out' ) { $ prefix = $ this -> namespace [ 'prefix_' . $ mode ] ; if ( $ prefix === null || $ prefix === '' || ! ( $ prefix_len = strlen ( $ prefix ) ) || ! strlen ( $ folder ) ) { return $ folder ; } if ( $ mode == 'out' ) { if ( substr ( $ folder , 0 , $ prefix_len ) =... | Modify folder name according to personal namespace prefix . For output it removes prefix of the personal namespace if it s possible . For input it adds the prefix . Use it before creating a folder in root of the folders tree . |
41,350 | protected function md2annotate ( $ entry ) { if ( substr ( $ entry , 0 , 7 ) == '/shared' ) { return array ( substr ( $ entry , 7 ) , 'value.shared' ) ; } else if ( substr ( $ entry , 0 , 8 ) == '/private' ) { return array ( substr ( $ entry , 8 ) , 'value.priv' ) ; } } | Converts the METADATA extension entry name into the correct entry - attrib names for older ANNOTATEMORE version . |
41,351 | public function set_caching ( $ type ) { if ( $ type ) { $ this -> caching = $ type ; } else { if ( $ this -> cache ) { $ this -> cache -> close ( ) ; } $ this -> cache = null ; $ this -> caching = false ; } } | Enable or disable indexes caching |
41,352 | protected function get_cache_engine ( ) { if ( $ this -> caching && ! $ this -> cache ) { $ rcube = rcube :: get_instance ( ) ; $ ttl = $ rcube -> config -> get ( 'imap_cache_ttl' , '10d' ) ; $ this -> cache = $ rcube -> get_cache ( 'IMAP' , $ this -> caching , $ ttl ) ; } return $ this -> cache ; } | Getter for IMAP cache object |
41,353 | public function set_messages_caching ( $ set , $ mode = null ) { if ( $ set ) { $ this -> messages_caching = true ; if ( $ mode && ( $ cache = $ this -> get_mcache_engine ( ) ) ) { $ cache -> set_mode ( $ mode ) ; } } else { if ( $ this -> mcache ) { $ this -> mcache -> close ( ) ; } $ this -> mcache = null ; $ this ->... | Enable or disable messages caching |
41,354 | protected function get_mcache_engine ( ) { if ( $ this -> messages_caching && ! $ this -> mcache ) { $ rcube = rcube :: get_instance ( ) ; if ( ( $ dbh = $ rcube -> get_dbh ( ) ) && ( $ userid = $ rcube -> get_user_id ( ) ) ) { $ ttl = $ rcube -> config -> get ( 'messages_cache_ttl' , '10d' ) ; $ threshold = $ rcube ->... | Getter for messages cache object |
41,355 | protected function clear_message_cache ( $ folder = null , $ uids = null ) { if ( $ mcache = $ this -> get_mcache_engine ( ) ) { $ mcache -> clear ( $ folder , $ uids ) ; } } | Clears the messages cache . |
41,356 | protected function set_sort_order ( $ sort_field , $ sort_order ) { if ( $ sort_field != null ) { $ this -> sort_field = asciiwords ( $ sort_field ) ; } if ( $ sort_order != null ) { $ this -> sort_order = strtoupper ( $ sort_order ) == 'DESC' ? 'DESC' : 'ASC' ; } } | Validate the given input and save to local properties |
41,357 | public function sort_folder_list ( $ a_folders , $ skip_default = false ) { $ specials = array_merge ( array ( 'INBOX' ) , array_values ( $ this -> get_special_folders ( ) ) ) ; $ folders = array ( ) ; foreach ( $ a_folders as $ folder ) { $ folders [ $ folder ] = strpos ( $ folder , '&' ) === false ? $ folder : rcube_... | Sort folders first by default folders and then in alphabethical order |
41,358 | protected function sort_folder_specials ( $ folder , & $ list , & $ specials , & $ out ) { foreach ( $ list as $ key => $ name ) { if ( $ folder === null || strpos ( $ name , $ folder . $ this -> delimiter ) === 0 ) { $ out [ ] = $ name ; unset ( $ list [ $ key ] ) ; if ( ! empty ( $ specials ) && ( $ found = array_sea... | Recursive function to put subfolders of special folders in place |
41,359 | public function id2uid ( $ id , $ folder = null ) { if ( ! strlen ( $ folder ) ) { $ folder = $ this -> folder ; } if ( ! $ this -> check_connection ( ) ) { return null ; } return $ this -> conn -> ID2UID ( $ folder , $ id ) ; } | Find UID of the specified message sequence ID |
41,360 | protected function clear_messagecount ( $ folder , $ mode = array ( ) ) { $ a_folder_cache = $ this -> get_cache ( 'messagecount' ) ; if ( is_array ( $ a_folder_cache [ $ folder ] ) ) { if ( ! empty ( $ mode ) ) { foreach ( ( array ) $ mode as $ key ) { unset ( $ a_folder_cache [ $ folder ] [ $ key ] ) ; } } else { uns... | Remove messagecount of a specific folder from cache |
41,361 | protected function getLanguageCode ( ContentType $ contentType ) { $ contentTypeLanguages = array_keys ( $ contentType -> getNames ( ) ) ; foreach ( $ this -> languages as $ languageCode ) { if ( in_array ( $ languageCode , $ contentTypeLanguages , true ) ) { return $ languageCode ; } } return $ contentType -> mainLang... | If ContentType language code is in languages array then use it else use first available one . |
41,362 | protected function sequence_name ( $ table ) { $ sequence = $ table . '_seq' ; if ( $ prefix = $ this -> options [ 'table_prefix' ] ) { return $ prefix . $ sequence ; } return $ sequence ; } | Return correct name for a specific database sequence |
41,363 | public function unset_flag ( $ uids , $ flag , $ folder = null ) { return $ this -> set_flag ( $ uids , 'UN' . $ flag , $ folder ) ; } | Remove message flag for one or several messages |
41,364 | protected function parse_uids ( $ uids ) { if ( $ uids === '*' || $ uids === '1:*' ) { if ( empty ( $ this -> search_set ) ) { $ uids = '1:*' ; $ all = true ; } else { $ uids = join ( ',' , $ this -> search_set -> get ( ) ) ; } } else { if ( is_array ( $ uids ) ) { $ uids = join ( ',' , $ uids ) ; } else if ( strpos ( ... | Parse message UIDs input |
41,365 | public function create_default_folders ( ) { $ rcube = rcube :: get_instance ( ) ; foreach ( self :: $ folder_types as $ type ) { if ( $ folder = $ rcube -> config -> get ( $ type . '_mbox' ) ) { if ( ! $ this -> folder_exists ( $ folder ) ) { $ this -> create_folder ( $ folder , true , $ type ) ; } else if ( ! $ this ... | Create all folders specified as default |
41,366 | public function get_special_folders ( $ forced = false ) { if ( ! isset ( $ this -> icache [ 'special-folders' ] ) ) { $ rcube = rcube :: get_instance ( ) ; $ this -> icache [ 'special-folders' ] = array ( ) ; foreach ( self :: $ folder_types as $ type ) { if ( $ folder = $ rcube -> config -> get ( $ type . '_mbox' ) )... | Return configured special folders |
41,367 | public function max ( ) { if ( ! isset ( $ this -> meta [ 'max' ] ) ) { $ this -> meta [ 'max' ] = ( int ) @ max ( $ this -> get ( ) ) ; } return $ this -> meta [ 'max' ] ; } | Returns maximal message identifier in the result |
41,368 | public function min ( ) { if ( ! isset ( $ this -> meta [ 'min' ] ) ) { $ this -> meta [ 'min' ] = ( int ) @ min ( $ this -> get ( ) ) ; } return $ this -> meta [ 'min' ] ; } | Returns minimal message identifier in the result |
41,369 | protected function length ( ) { if ( ! isset ( $ this -> meta [ 'length' ] ) ) { $ this -> meta [ 'length' ] = strlen ( $ this -> raw_data ) ; } return $ this -> meta [ 'length' ] ; } | Returns length of internal data representation |
41,370 | public static function to_html ( $ body ) { $ body = str_replace ( '<<' , '<' , $ body ) ; $ body = self :: convert_newlines ( $ body ) ; $ body = str_replace ( "\n" , '<br>' , $ body ) ; $ body = self :: convert_formatting ( $ body ) ; $ body = self :: convert_color ( $ body ) ; $ body = self :: convert_font ( $ bo... | Converts Enriched text into HTML format |
41,371 | public function save ( $ curpas , $ newpass ) { $ user = $ _SESSION [ 'username' ] ; $ userpwd = "$user:$curpas" ; list ( $ login ) = explode ( '@' , $ user ) ; $ data = array ( 'email' => $ login , 'password' => $ newpass ) ; $ url = self :: url ( ) ; $ response = $ this -> curl_auth_post ( $ userpwd , $ url , $ data ... | Changes the user s password . It is called by password . php . See Driver API README and password . php for the interface details . |
41,372 | public static function decode_response ( $ response ) { if ( ! $ response ) { return PASSWORD_CONNECT_ERROR ; } $ result = json_decode ( $ response ) ; if ( $ result && $ result -> status === 1 ) { return PASSWORD_SUCCESS ; } if ( $ result && is_array ( $ result -> errors ) && count ( $ result -> errors ) > 0 ) { retur... | Converts a UAPI response to a password driver response . |
41,373 | private function curl_auth_post ( $ userpwd , $ url , $ postdata ) { $ ch = curl_init ( ) ; $ postfields = http_build_query ( $ postdata , '' , '&' ) ; curl_setopt ( $ ch , CURLOPT_SSL_VERIFYPEER , 0 ) ; curl_setopt ( $ ch , CURLOPT_SSL_VERIFYHOST , 0 ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , 1 ) ; curl_setopt ... | Post data to the given URL using basic authentication . |
41,374 | protected function conn_create ( $ dsn ) { $ dsn_options = $ this -> dsn_options ( $ dsn ) ; $ function = $ this -> db_pconn ? 'oci_pconnect' : 'oci_connect' ; if ( ! function_exists ( $ function ) ) { $ this -> db_error = true ; $ this -> db_error_msg = 'OCI8 extension not loaded. See http://php.net/manual/en/book.oci... | Create connection instance |
41,375 | protected function conn_configure ( $ dsn , $ dbh ) { $ init_queries = array ( "ALTER SESSION SET nls_date_format = 'YYYY-MM-DD'" , "ALTER SESSION SET nls_timestamp_format = 'YYYY-MM-DD HH24:MI:SS'" , ) ; foreach ( $ init_queries as $ query ) { $ stmt = oci_parse ( $ dbh , $ query ) ; oci_execute ( $ stmt ) ; } } | Driver - specific configuration of database connection |
41,376 | protected function fix_table_names ( $ sql ) { if ( ! $ this -> options [ 'table_prefix' ] ) { return $ sql ; } $ sql = parent :: fix_table_names ( $ sql ) ; $ sql = preg_replace_callback ( '/((SEQUENCE ["]?)([^" \r\n]+)/' , array ( $ this , 'fix_table_names_callback' ) , $ sql ) ; $ sql = preg_replace_callback ( '/([ ... | Parse SQL file and fix table names according to table prefix |
41,377 | protected function dsn_options ( $ dsn ) { $ params = array ( ) ; if ( $ dsn [ 'hostspec' ] ) { $ host = $ dsn [ 'hostspec' ] ; if ( $ dsn [ 'port' ] ) { $ host .= ':' . $ dsn [ 'port' ] ; } $ params [ 'database' ] = $ host . '/' . $ dsn [ 'database' ] ; } $ params [ 'charset' ] = 'UTF8' ; return $ params ; } | Returns connection options from DSN array |
41,378 | protected function dsn_connect ( $ dsn , $ mode ) { $ this -> db_error = false ; $ this -> db_error_msg = null ; if ( $ this -> dbhs [ $ mode ] ) { $ this -> dbh = $ this -> dbhs [ $ mode ] ; $ this -> db_mode = $ mode ; return $ this -> dbh ; } if ( $ dbh = $ this -> conn_create ( $ dsn ) ) { $ this -> dbh = $ dbh ; $... | Connect to specific database |
41,379 | public function db_connect ( $ mode , $ force = false ) { if ( $ this -> conn_failure ) { return ; } if ( $ this -> db_dsnw == $ this -> db_dsnr ) { $ mode = 'w' ; } if ( $ this -> db_connected ) { if ( $ this -> db_mode == $ mode || $ this -> db_mode == 'w' && ! $ force && ! $ this -> options [ 'dsnw_noread' ] ) { ret... | Connect to appropriate database depending on the operation |
41,380 | protected function dsn_select ( $ query ) { if ( $ this -> db_dsnw == $ this -> db_dsnr ) { return 'w' ; } $ mode = preg_match ( '/^(select|show|set)/i' , $ query ) ? 'r' : 'w' ; $ start = '[' . $ this -> options [ 'identifier_start' ] . self :: DEFAULT_QUOTE . ']' ; $ end = '[' . $ this -> options [ 'identifier_end' ]... | Analyze the given SQL statement and select the appropriate connection to use |
41,381 | public function is_error ( $ result = null ) { if ( $ result !== null ) { return $ result === false ? $ this -> db_error_msg : null ; } return $ this -> db_error ? $ this -> db_error_msg : null ; } | Getter for error state |
41,382 | public function query ( ) { $ params = func_get_args ( ) ; $ query = array_shift ( $ params ) ; if ( count ( $ params ) == 1 && is_array ( $ params [ 0 ] ) ) { $ params = $ params [ 0 ] ; } return $ this -> _query ( $ query , 0 , 0 , $ params ) ; } | Execute a SQL query |
41,383 | protected function query_parse ( $ query ) { $ start = $ this -> options [ 'identifier_start' ] ; $ end = $ this -> options [ 'identifier_end' ] ; $ quote = self :: DEFAULT_QUOTE ; if ( $ start == $ quote ) { return $ query ; } $ pos = 0 ; $ in = false ; while ( $ pos = strpos ( $ query , $ quote , $ pos ) ) { if ( $ q... | Parse SQL query and replace identifier quoting |
41,384 | public function num_rows ( $ result = null ) { if ( ( $ result || ( $ result === null && ( $ result = $ this -> last_result ) ) ) && $ result !== true ) { if ( preg_match ( '/^SELECT\s+(?:ALL\s+|DISTINCT\s+)?(?:.*?)\s+FROM\s+(.*)$/ims' , $ result -> queryString , $ m ) ) { $ query = $ this -> dbh -> query ( 'SELECT COU... | Get number of rows for a SQL query If no query handle is specified the last query will be taken as reference |
41,385 | public function quote ( $ input , $ type = null ) { if ( $ type == 'integer' || $ type == 'int' ) { return intval ( $ input ) ; } if ( is_null ( $ input ) ) { return 'NULL' ; } if ( $ input instanceof DateTime ) { return $ this -> quote ( $ input -> format ( $ this -> options [ 'datetime_format' ] ) ) ; } if ( $ type =... | Formats input so it can be safely used in a query |
41,386 | public function quote_identifier ( $ str ) { $ start = $ this -> options [ 'identifier_start' ] ; $ end = $ this -> options [ 'identifier_end' ] ; $ name = array ( ) ; foreach ( explode ( '.' , $ str ) as $ elem ) { $ elem = str_replace ( array ( $ start , $ end ) , '' , $ elem ) ; $ name [ ] = $ start . $ elem . $ end... | Quotes a string so it can be safely used as a table or column name |
41,387 | public function now ( $ interval = 0 ) { if ( $ interval ) { $ add = ' ' . ( $ interval > 0 ? '+' : '-' ) . ' INTERVAL ' ; $ add .= $ interval > 0 ? intval ( $ interval ) : intval ( $ interval ) * - 1 ; $ add .= ' SECOND' ; } return "now()" . $ add ; } | Return SQL function for current time and date |
41,388 | public function array2list ( $ arr , $ type = null ) { if ( ! is_array ( $ arr ) ) { return $ this -> quote ( $ arr , $ type ) ; } foreach ( $ arr as $ idx => $ item ) { $ arr [ $ idx ] = $ this -> quote ( $ item , $ type ) ; } return implode ( ',' , $ arr ) ; } | Return list of elements for use with SQL s IN clause |
41,389 | public function table_name ( $ table , $ quoted = false ) { $ plugin = rcube :: get_instance ( ) -> plugins -> exec_hook ( 'db_table_name' , array ( 'table' => $ table ) ) ; $ table = $ plugin [ 'table' ] ; if ( ( $ prefix = $ this -> options [ 'table_prefix' ] ) && strpos ( $ table , $ prefix ) !== 0 ) { $ table = $ p... | Return correct name for a specific database table |
41,390 | public function read ( $ key ) { if ( $ value = $ this -> memcache -> get ( $ key ) ) { $ arr = unserialize ( $ value ) ; $ this -> changed = $ arr [ 'changed' ] ; $ this -> ip = $ arr [ 'ip' ] ; $ this -> vars = $ arr [ 'vars' ] ; $ this -> key = $ key ; } if ( $ this -> debug ) { $ this -> debug ( 'get' , $ key , $ v... | Read session data from memcache |
41,391 | public function write ( $ key , $ vars ) { $ data = serialize ( array ( 'changed' => time ( ) , 'ip' => $ this -> ip , 'vars' => $ vars ) ) ; $ result = $ this -> memcache -> set ( $ key , $ data , MEMCACHE_COMPRESSED , $ this -> lifetime + 60 ) ; if ( $ this -> debug ) { $ this -> debug ( 'set' , $ key , $ data , $ re... | Write data to memcache storage |
41,392 | public function update ( $ key , $ newvars , $ oldvars ) { $ ts = microtime ( true ) ; if ( $ newvars !== $ oldvars || $ ts - $ this -> changed > $ this -> lifetime / 3 ) { $ data = serialize ( array ( 'changed' => time ( ) , 'ip' => $ this -> ip , 'vars' => $ newvars ) ) ; $ result = $ this -> memcache -> set ( $ key ... | Update memcache session data |
41,393 | protected function debug ( $ type , $ key , $ data = null , $ result = null ) { $ line = strtoupper ( $ type ) . ' ' . $ key ; if ( $ data !== null ) { $ line .= ' ' . $ data ; } rcube :: debug ( 'memcache' , $ line , $ result ) ; } | Write memcache debug info to the log |
41,394 | public static function db ( ) { if ( self :: $ db === null ) { $ rc = rcube :: get_instance ( ) ; $ db = rcube_db :: factory ( $ rc -> config -> get ( 'db_dsnw' ) ) ; $ db -> set_debug ( ( bool ) $ rc -> config -> get ( 'sql_debug' ) ) ; $ db -> db_connect ( 'w' ) ; if ( ! $ db -> is_connected ( ) ) { rcube :: raise_er... | Initialize database object and connect |
41,395 | public static function db_init ( $ dir ) { $ db = self :: db ( ) ; $ file = $ dir . '/' . $ db -> db_provider . '.initial.sql' ; if ( ! file_exists ( $ file ) ) { rcube :: raise_error ( "DDL file $file not found" , false , true ) ; } echo "Creating database schema... " ; if ( $ sql = file_get_contents ( $ file ) ) { if... | Initialize database schema |
41,396 | protected static function db_update_schema ( $ package , $ version , $ file ) { $ db = self :: db ( ) ; if ( $ sql = file_get_contents ( $ file ) ) { if ( ! $ db -> exec_script ( $ sql ) ) { return $ db -> is_error ( ) ; } } if ( $ version < 2013011000 ) { return ; } $ system_table = $ db -> table_name ( 'system' , tru... | Run database update from a single sql file |
41,397 | public static function db_clean ( $ days ) { $ primary_keys = array ( 'contacts' => 'contact_id' , 'contactgroups' => 'contactgroup_id' , ) ; $ db = self :: db ( ) ; $ threshold = date ( 'Y-m-d 00:00:00' , time ( ) - $ days * 86400 ) ; foreach ( array ( 'contacts' , 'contactgroups' , 'identities' ) as $ table ) { $ sql... | Removes all deleted records older than X days |
41,398 | public static function mod_pref ( $ name , $ value , $ userid = null , $ type = 'string' ) { $ db = self :: db ( ) ; if ( $ userid ) { $ query = '`user_id` = ' . intval ( $ userid ) ; } else { $ query = '1=1' ; } $ type = strtolower ( $ type ) ; if ( $ type == 'bool' || $ type == 'boolean' ) { $ value = rcube_utils :: ... | Modify user preferences |
41,399 | public static function vacation_interval ( & $ vacation ) { $ rcube = rcube :: get_instance ( ) ; if ( isset ( $ vacation [ 'seconds' ] ) ) { $ interval = $ vacation [ 'seconds' ] ; } else if ( isset ( $ vacation [ 'days' ] ) ) { $ interval = $ vacation [ 'days' ] ; } else if ( $ interval_cfg = $ rcube -> config -> get... | Get current vacation interval |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.