Index: phpdoc/kr/functions/bzip2.xml +++ phpdoc/kr/functions/bzip2.xml Bzip2 Compression Functions Bzip2 This module uses the functions of the bzip2 library by Julian Seward to transparently read and write bzip2 (.bz2) compressed files. bzip2 support in PHP is not enabled by default. You will need to use the --with-bz2[=DIR] configuration option when compiling php to enable bzip2 support. This module requires bzip2/libbzip2 version >= 1.0.x. Small code example This example opens a temporary file and writes a test string to it, then prints out the contents of the file. Small bzip2 Example <?php $filename = "/tmp/testfile.bz2"; $str = "This is a test string.\n"; // open file for writing $bz = bzopen($filename, "w"); // write string to file bzwrite($bz, $str); // close file bzclose($bz); // open file for reading $bz = bzopen($filename, "r"); // read 10 characters print bzread($bz, 10); // output until end of the file (or the next 1024 char) and close it. print bzread($bz); bzclose($bz); ?> bzclose Close a bzip2 file pointer Description int bzclose int bz Closes the bzip2 file referenced by the pointer bz. Returns true on success and false on failure. The file pointer must be valid, and must point to a file successfully opened by bzopen. See also bzopen. bzcompress Compress a string into bzip2 encoded data Description string bzcompress string source int blocksize int workfactor bzcompress compresses the source string and returns it as bzip2 encoded data. The optional parameter blocksize specifies the blocksize used during compression and should be a number from 1 to 9 with 9 giving the best compression, but using more resources to do so. blocksize defaults to 4. The optional parameter workfactor controls how the compression phase behaves when presented with worst case, highly repetitive, input data. The value can be between 0 and 250 with 0 being a special case and 30 being the default value. Regardless of the workfactor, the generated output is the same. <function>bzcompress</function> Example $str = "sample data"; $bzstr = bzcompress($str, 9); See also bzdecompress. bzdecompress Decompresses bzip2 encoded data Description string bzdecompress string source int small bzdecompress decompresses the source string containing bzip2 encoded data and returns it. If the optional parameter small is true, an alternative decompression algorithm will be used which uses less memory (the maximum memory requirement drops to around 2300K) but works at roughly half the speed. See the bzip2 documentation for more information about this feature. <function>bzdecompress</function> $str = $bzdecompress($bzstr); See also bzcompress. bzerrno Returns a bzip2 error number Description int bzerrno int bz Returns the error number of any bzip2 error returned by the file pointer bz. See also bzerror and bzerrstr. bzerror Returns the bzip2 error number and error string in an array Description array bzerror int bz Returns the error number and error string, in an associative array, of any bzip2 error returned by the file pointer bz. <function>bzerror</function> Example $error = bzerror($bz); echo $error["errno"]; echo $error["errstr"]; See also bzerrno and bzerrstr. bzerrstr Returns a bzip2 error string Description string bzerrstr int bz Returns the error string of any bzip2 error returned by the file pointer bz. See also bzerrno and bzerror. bzflush Force a write of all buffered data Description int bzflush int bz Forces a write of all buffered bzip2 data for the file pointer bz. Returns true on success, false on failure. See also bzread and bzwrite. bzopen Open a bzip2 compressed file Description int bzopen string filename string mode Opens a bzip2 (.bz2) file for reading or writing. filename is the name of the file to open. mode is similar to the fopen function (`r' for read, `w' for write, etc.). If the open fails, the function returns false, otherwise it returns a pointer to the newly opened file. <function>bzopen</function> Example $bz = bzopen("/tmp/foo.bz2", "r"); See also bzclose. bzread Binary safe bzip2 file read Description string bzread int bz int length bzread reads up to length bytes from the bzip2 file pointer referenced by bz. Reading stops when length (uncompressed) bytes have been read or EOF is reached, whichever comes first. If the optional parameter length is not specified, bzread will read 1024 (uncompressed) bytes at a time. <function>bzread</function> Example $bz = bzopen("/tmp/foo.bz2", "r"); $str = bzread($bz, 2048); echo $str; See also bzwrite and bzopen. bzwrite Binary safe bzip2 file write Description int bzwrite int bz string data int length bzwrite writes the contents of the string data to the bzip2 file stream pointed to by bz. If the optional length argument is given, writing will stop after length (uncompressed) bytes have been written or the end of string is reached, whichever comes first. <function>bzwrite</function> Example $str = "uncompressed data"; $bz = bzopen("/tmp/foo.bz2", "w"); bzwrite($bz, $str, strlen($str)); See also bzread and bzopen. Index: phpdoc/kr/functions/ctype.xml +++ phpdoc/kr/functions/ctype.xml Character type functions ctype These functions check whether a character or string falls into a certain character class according to the i current locale. When called with an integer argument theese functions behave exactly like their C counterparts. When called with a string argument they will check every character in the string and will only return true if every character in the string matches the requested criteria. Passing anything else but a string or integer will return false immediately. These functions are new as of PHP 4.0.4 and might change their name in the near future. Suggestions are to change them to ctype_issomething instead of ctype_somthing or even to make them part of ext/standard and use their original C-names, although this would possibly lead to further confusion regarding the isset vs. is_sometype problem. ctype_alnum Check for alphanumeric character(s) Description bool ctype_alnum string c See also setlocale. ctype_alpha Check for alphabetic character(s) Description bool ctype_alpha string c ctype_cntrl Check for control character(s) Description bool ctype_cntrl string c ctype_digit Check for numeric character(s) Description bool ctype_digit string c ctype_lower Check for lowercase character(s) Description bool ctype_lower string c ctype_graph Check for any printable character(s) except space Description bool ctype_graph string c ctype_print Check for printable character(s) Description bool ctype_print string c ctype_punct Check for any printable character which is not whitespace or an alphanumeric character Description bool ctype_punct string c ctype_space Check for whitespace character(s) Description bool ctype_space string c ctype_upper Check for uppercase character(s) Description bool ctype_upper string c ctype_xdigit Check for character(s) representing a hexadecimal digit Description bool ctype_xdigit string c Index: phpdoc/kr/functions/mnogosearch.xml +++ phpdoc/kr/functions/mnogosearch.xml mnoGoSearch Functions mnoGoSearch These functions allow you to access mnoGoSearch (former UdmSearch) free search engine. In order to have these functions available, you must compile php with mnogosearch support by using the option. If you use this option without specifying the path to mnogosearch, php will look for mnogosearch under /usr/local/mnogosearch path by default. If you installed mnogosearch at other path you should specify it: . mnoGoSearch is a full-featured search engine software for intranet and internet servers, distributed under the GNU license. mnoGoSearch has number of unique features, which makes it appropriate for a wide range of application from search within your site to a specialized search system such as cooking recipes or newspaper search, ftp archive search, news articles search, etc. It offers full-text indexing and searching for HTML, PDF, and text documents. mnoGoSearch consists of two parts. The first is an indexing mechanism (indexer). The purpose of indexer is to walk through HTTP, FTP, NEWS servers or local files, recursively grabbing all the documents and storing meta-data about that documents in a SQL database in a smart and effective manner. After every document is referenced by its corresponding URL, meta-data collected by indexer is used later in a search process. The search is performed via Web interface. C CGI, PHP and Perl search front ends are included. php contains built-in mysql access library, which can be used to access mysql. It is known that mnoGoSearch is not compatible with this built-in library and can work only with generic mysql libraries. Thus, if you use mnoGoSearch with mysql, during php configuration you have to indicate directory of mysql installation, that was used during mnoGoSearch configuration, i.e. for example: You need at least 3.1.10 version of mnoGoSearch installed to use these functions. More information about mnoGoSearch can be found at &url.mnogo;. udm_alloc_agent Allocate mnoGoSearch session Description int udm_alloc_agent string dbaddr string dbmode udm_alloc_agent returns mnogosearch agent identifier on success, FALSE on error. This function creates a session with database parameters. dbaddr - URL-style database description. Options (type, host, database name, port, user and password) to connect to SQL database. Do not matter for built-in text files support. Format: DBAddr DBType:[//[DBUser[:DBPass]@]DBHost[:DBPort]]/DBName/ Currently supported DBType values are: mysql, pgsql, msql, solid, mssql, oracle, ibase. Actually, it does not matter for native libraries support. But ODBC users should specify one of supported values. If your database type is not supported, you may use "unknown" instead. dbmode - You may select SQL database mode of words storage. When "single" is specified, all words are stored in the same table. If "multi" is selected, words will be located in different tables depending of their lengths. "multi" mode is usually faster but requires more tables in database. If "crc" mode is selected, mnoGoSearch will store 32 bit integer word IDs calculated by CRC32 algorythm instead of words. This mode requres less disk space and it is faster comparing with "single" and "multi" modes. "crc-multi" uses the same storage structure with the "crc" mode, but also stores words in different tables depending on words lengths like "multi" mode. Format: DBMode single/multi/crc/crc-multi dbaddr and dbmode must match those used during indexing. In fact this function does not open connection to database and thus does not check entered login and password. Actual connection to database and login/password verification is done by udm_find. udm_set_agent_param Set mnoGoSearch agent session parameters Description int udm_set_agent_param int agent int var string val udm_set_agent_param returns TRUE on success, FALSE on error. Defines mnoGoSearch session parameters. The following parameters and their values are available: UDM_PARAM_PAGE_NUM - used to choose search results page number (results are returned by pages beginning from 0, with UDM_PARAM_PAGE_SIZE results per page). UDM_PARAM_PAGE_SIZE - number of search results displayed on one page. UDM_PARAM_SEARCH_MODE - search mode. The following values available: UDM_MODE_ALL - search for all words; UDM_MODE_ANY - search for any word; UDM_MODE_PHRASE - phrase search; UDM_MODE_BOOL - boolean search. See udm_find for details on boolean search. UDM_PARAM_CACHE_MODE - turns on or off search result cache mode. When enabled, the search engine will store search results to disk. In case a similar search is performed later, the engine will take results from the cache for faster performance. Available values: UDM_CACHE_ENABLED, UDM_CACHE_DISABLED. UDM_PARAM_TRACK_MODE - turns on or off trackquery mode. Since version 3.1.2 mnoGoSearch has a query tracking support. Note that tracking is implemented in SQL version only and not available in built-in database. To use tracking, you have to create tables for tracking support. For MySQL, use create/mysql/track.txt. When doing a search, front-end uses those tables to store query words, a number of found documents and current UNIX timestamp in seconds. Available values: UDM_TRACK_ENABLED, UDM_TRACK_DISABLED. UDM_PARAM_PHRASE_MODE - defines whether index database using phrases ("phrase" parameter in indexer.conf). Possible values: UDM_PHRASE_ENABLED and UDM_PHRASE_DISABLED. Please note, that if phrase search is enabled (UDM_PHRASE_ENABLED), it is still possible to do search in any mode (ANY, ALL, BOOL or PHRASE). In 3.1.10 version of mnoGoSearch phrase search is supported only in sql and buuilt-in database modes, while beginning with 3.1.11 phrases are supported in cachemode as well. Examples of phrase search: "Arizona desert" - This query returns all indexed documents that contain "Arizona desert" as a phrase. Notice that you need to put double quotes around the phrase UDM_PARAM_CHARSET - defines local charset. Available values: set of charsets supported by mnoGoSearch, e.g. koi8-r, cp1251, ... UDM_PARAM_STOPFILE - Defines name and path to stopwords file. (There is a small difference with mnoGoSearch - while in mnoGoSearch if relative path or no path entered, it looks for this file in relation to UDM_CONF_DIR, the module looks for the file in relation to current path, i.e. to the path where the php script is executed.) UDM_PARAM_STOPTABLE - Load stop words from the given SQL table. You may use several StopwordTable commands. This command has no effect when compiled without SQL database support. UDM_PARAM_WEIGHT_FACTOR - represents weight factors for specific document parts. Currently body, title, keywords, description, url are supported. To activate this feature please use degrees of 2 in *Weight commands of the indexer.conf. Let's imagine that we have these weights: URLWeight 1 BodyWeight 2 TitleWeight 4 KeywordWeight 8 DescWeight 16 As far as indexer uses bit OR operation for word weights when some word presents several time in the same document, it is possible at search time to detect word appearance in different document parts. Word which appears only in the body will have 00000010 argegate weight (in binary notation). Word used in all document parts will have 00011111 aggregate weight. This parameter's value is a string of hex digits ABCDE. Each digit is a factor for corresponding bit in word weight. For the given above weights configuration: E is a factor for weight 1 (URL Weight bit) D is a factor for weight 2 (BodyWeight bit) C is a factor for weight 4 (TitleWeight bit) B is a factor for weight 8 (KeywordWeight bit) A is a factor for weight 16 (DescWeight bit) Examples: UDM_PARAM_WEIGHT_FACTOR=00001 will search through URLs only. UDM_PARAM_WEIGHT_FACTOR=00100 will search through Titles only. UDM_PARAM_WEIGHT_FACTOR=11100 will search through Title,Keywords,Desctription but not through URL and Body. UDM_PARAM_WEIGHT_FACTOR=F9421 will search through: Description with factor 15 (F hex) Keywords with factor 9 Title with factor 4 Body with factor 2 URL with factor 1 If UDM_PARAM_WEIGHT_FACTOR variable is ommited, original weight value is taken to sort results. For a given above weight configuration it means that document description has a most big weight 16. UDM_PARAM_WORD_MATCH - word match. You may use this parameter to choose word match type. This feature works only in "single" and "multi" modes using SQL based and built-in database. It does not work in cachemode and other modes since they use word CRC and do not support substring search. Available values: UDM_MATCH_BEGIN - word beginning match; UDM_MATCH_END - word ending match; UDM_MATCH_WORD - whole word match; UDM_MATCH_SUBSTR - word substring match. UDM_PARAM_MIN_WORD_LEN - defines minimal word length. Any word shorter this limit is considered to be a stopword. Please note that this paraneter value is inclusive, i.e. if UDM_PARAM_MIN_WORD_LEN=3, a word 3 characters long will not be considered a stopword, while a word 2 characters long will be. Default value is 1. UDM_PARAM_ISPELL_PREFIXES - Possible values: UDM_PREFIXES_ENABLED and UDM_PREFIXES_DISABLED, that respectively enable or disable using prefixes. E.g. if a word "tested" is in search query, also words like "test", "testing", etc. Only suffixes are supported by default. Prefixes usually change word meanings, for example if somebody is searching for the word "tested" one hardly wants "untested" to be found. Prefixes support may also be found useful for site's spelling checking purposes. In order to enable ispell, you have to load ispell data with udm_load_ispell_data. udm_add_search_limit Add various search limits Description int udm_add_search_limit int agent int var string val udm_add_search_limit returns TRUE on success, FALSE on error. Adds search restrictions. agent - a link to Agent, received after call to udm_alloc_agent. var - defines parameter, indicating limit. val - defines value of the current parameter. Possible var values: UDM_LIMIT_URL - defines document URL limitations to limit search through subsection of database. It supports SQL % and _ LIKE wildcards, where % matches any number of characters, even zero characters, and _ matches exactly one character. E.g. http://my.domain.__/catalog may stand for http://my.domain.ru/catalog and http://my.domain.ua/catalog. UDM_LIMIT_TAG - defines site TAG limitations. In indexer-conf you can assign specific TAGs to various sites and parts of a site. Tags in mnoGoSearch 3.1.x are lines, that may contain metasymbols % and _. Metasymbols allow searching among groups of tags. E.g. there are links with tags ABCD and ABCE, and search restriction is by ABC_ - the search will be made among both of the tags. UDM_LIMIT_LANG - defines document language limitations. UDM_LIMIT_CAT - defines document category limitations. Categories are similar to tag feature, but nested. So you can have one category inside another and so on. You have to use two characters for each level. Use a hex number going from 0-F or a 36 base number going from 0-Z. Therefore a top-level category like 'Auto' would be 01. If it has a subcategory like 'Ford', then it would be 01 (the parent category) and then 'Ford' which we will give 01. Put those together and you get 0101. If 'Auto' had another subcategory named 'VW', then it's id would be 01 because it belongs to the 'Ford' category and then 02 because it's the next category. So it's id would be 0102. If VW had a sub category called 'Engine' then it's id would start at 01 again and it would get the 'VW' id 02 and 'Auto' id of 01, making it 010201. If you want to search for sites under that category then you pass it cat=010201 in the url. UDM_LIMIT_DATE - defines limitation by date document was modified. Format of parameter value: a string with first character < or >, then with no space - date in unixtime format, for example: Udm_Add_Search_Limit($udm,UDM_LIMIT_DATE,"<908012006"); If > character is used, then search will be restricted to those documents having modification date greater than entered. If <, then smaller. udm_clear_search_limits Clear all mnoGoSearch search restrictions Description int udm_clear_search_limits int agent udm_clear_search_limits resets defined search limitations and returns TRUE. udm_find Perform search Description int udm_find int agent string query udm_find returns result link identifier on success, FALSE on error. The search itself. The first argument - session, the next one - query itself. To find something just type words you want to find and press SUBMIT button. For example, "mysql odbc". You should not use quotes " in query, they are written here only to divide a query from other text. mnoGoSearch will find all documents that contain word "mysql" and/or word "odbc". Best documents having bigger weights will be displayed first. If you use search mode ALL, search will return documents that contain both (or more) words you entered. In case you use mode ANY, the search will return list of documents that contain any of the words you entered. If you want more advanced results you may use query language. You should select "bool" match mode in the search from. mnoGoSearch understands the following boolean operators: & - logical AND. For example, "mysql & odbc". mnoGoSearch will find any URLs that contain both "mysql" and "odbc". | - logical OR. For example "mysql|odbc". mnoGoSearch will find any URLs, that contain word "mysql" or word "odbc". ~ - logical NOT. For example "mysql & ~odbc". mnoGoSearch will find URLs that contain word "mysql" and do not contain word "odbc" at the same time. Note that ~ just excludes given word from results. Query "~odbc" will find nothing! () - group command to compose more complex queries. For example "(mysql | msql) & ~postgres". Query language is simple and powerful at the same time. Just consider query as usual boolean expression. udm_get_res_param Get mnoGoSearch result parameters Description string udm_get_res_param int res int param udm_get_res_param returns result parameter value on success, FALSE on error. res - a link to result identifier, received after call to udm_find. param - parameter identifier, may have the following values: UDM_PARAM_NUM_ROWS - number of received found links on the current page. It is equal to UDM_PARAM_PAGE_SIZE for all search pages, on the last page - the rest of links. UDM_PARAM_FOUND - total number of results matching the query. UDM_PARAM_WORDINFO - information on the words found. E.g. search for "a good book" will return "a: stopword, good:5637, book: 120" UDM_PARAM_SEARCHTIME - search time in seconds. UDM_PARAM_FIRST_DOC - the number of the first document displayed on current page. UDM_PARAM_LAST_DOC - the number of the last document displayed on current page. udm_get_res_field Fetch mnoGoSearch result field Description string udm_get_res_field int res int row int field udm_get_res_field returns result field value on success, FALSE on error. res - a link to result identifier, received after call to udm_find. row - the number of the link on the current page. May have values from 0 to UDM_PARAM_NUM_ROWS. field - field identifier, may have the following values: UDM_FIELD_URL - document URL field UDM_FIELD_CONTENT - document Content-type field (for example, text/html). UDM_FIELD_TITLE - document title field. UDM_FIELD_KEYWORDS - document keywords field (from META KEYWORDS tag). UDM_FIELD_DESC - document description field (from META DESCRIPTION tag). UDM_FIELD_TEXT - document body text (the first couple of lines to give an idea of what the document is about). UDM_FIELD_SIZE - document size. UDM_FIELD_URLID - unique URL ID of the link. UDM_FIELD_RATING - page rating (as calculated by mnoGoSearch). UDM_FIELD_MODIFIED - last-modified field in unixtime format. UDM_FIELD_ORDER - the number of the current document in set of found documents. UDM_FIELD_CRC - document CRC. udm_load_ispell_data Load ispell data Description int udm_load_ispell_data int agent int var string val1 string val2 int flag udm_load_ispell_data loads ispell data. Returns TRUE on success, FALSE on error. agent - agent link identifier, received after call to udm_alloc_agent. var - parameter, indicating the source for ispell data. May have the following values: It is recommended to load ispell data from files, since in mnogosearch 3.1.10 it is the fastest. In later versions it is planned to optimize loading in UDM_ISPELL_TYPE_DB mode as well, so you just try several modes to find the best for you. UDM_ISPELL_TYPE_DB - indicates that ispell data should be loaded from SQL. In this case, parameters val1 and val2 are ignored and should be left blank. flag should be equal to 1. flag indicates that after loading ispell data from defined source it sould be sorted (it is necessary for correct functioning of ispell). In case of loading ispell data from files there may be several calls to udm_load_ispell_data, and there is no sense to sort data after every call, but only after the last one. Since in db mode all the data is loaded by one call, this parameter should have the value 1. In this mode in case of error, e.g. if ispell tables are absent, the function will return FALSE and code and error message will be accessible through udm_error and udm_errno. Example: if (! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_DB,'','',1)) { printf("Error #%d: '%s'\n",Udm_Errno($udm),Udm_Error($udm)); exit; } UDM_ISPELL_TYPE_AFFIX - indicates that ispell data should be loaded from file and initiates loading affixes file. In this case val1 defines double letter language code for which affixes are loaded, and val2 - file path. Please note, that if a relative path entered, the module looks for the file not in UDM_CONF_DIR, but in relation to current path, i.e. to the path where the script is executed. In case of error in this mode, e.g. if file is absent, the function will return FALSE, and an error message will be displayed. Error message text cannot be accessed through udm_error and udm_errno, since those functions can only return messages associated with SQL. Please, see flag parameter description in UDM_ISPELL_TYPE_DB. Example: if ((! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_AFFIX,'en','/opt/ispell/en.aff',0)) || (! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_AFFIX,'ru','/opt/ispell/ru.aff',0)) || (! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_SPELL,'en','/opt/ispell/en.dict',0)) || (! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_SPELL,'ru','/opt/ispell/ru.dict',1))) { exit; } flag is equal to 1 only in the last call. UDM_ISPELL_TYPE_SPELL - indicates that ispell data should be loaded from file and initiates loading of ispell dictionary file. In this case val1 defines double letter language code for which affixes are loaded, and val2 - file path. Please note, that if a relative path entered, the module looks for the file not in UDM_CONF_DIR, but in relation to current path, i.e. to the path where the script is executed. In case of error in this mode, e.g. if file is absent, the function will return FALSE, and an error message will be displayed. Error message text cannot be accessed through udm_error and udm_errno, since those functions can only return messages associated with SQL. Please, see flag parameter description in UDM_ISPELL_TYPE_DB. Example: if ((! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_AFFIX,'en','/opt/ispell/en.aff',0)) || (! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_AFFIX,'ru','/opt/ispell/ru.aff',0)) || (! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_SPELL,'en','/opt/ispell/en.dict',0)) || (! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_SPELL,'ru','/opt/ispell/ru.dict',1))) { exit; } flag is equal to 1 only in the last call. udm_free_ispell_data Free memory allocated for ispell data Description int udm_free_ispell_data int agent udm_free_ispell_data always returns TRUE. agent - agent link identifier, received after call to udm_alloc_agent. In mnoGoSearch 3.1.10 this function is not yet implemented, it is added for compatibility with future versions and does not perform anything yet. udm_free_res Free mnoGoSearch result Description int udm_free_res int res udm_free_res returns TRUE on success, FALSE on error. res - a link to result identifier, received after call to udm_find. Freeing up memory allocated for results. udm_free_agent Free mnoGoSearch session Description int udm_free_agent int agent udm_free_agent returns TRUE on success, FALSE on error. agent - link to agent identifier, received after call to udm_alloc_agent. Freeing up memory allocated for agent session. udm_errno Get mnoGoSearch error number Description int udm_errno int agent udm_errno returns mnoGoSearch error number, zero if no error. agent - link to agent identifier, received after call to udm_alloc_agent. Receiving numeric agent error code. udm_error Get mnoGoSearch error message Description string udm_error int agent udm_error returns mnoGoSearch error message, empty string if no error. agent - link to agent identifier, received after call to udm_alloc_agent. Receiving agent error message.