Esempio n. 1
0
 function comment_indexer($id)
 {
     $f = bdb_idtofile($id, BDB_COMMENT);
     //todo change
     $this->_directory = $f;
     parent::fs_filelister();
     //substr(bdb_idtofile($id), -strlen(EXT));
 }
Esempio n. 2
0
/**
 * function bdb_parse_entry
 *
 * <p>Parses the entry file passed as parameter; returns an associative array
 * of the file content</p>
 * Tipically, entry arrays are usually made of these keys
 * - VERSION	:	SimplePHPBlog or compatible blogs' version identifier string
 * - SUBJECT 	:	Subject of the entry
 * - CONTENT	:	Content of the entry
 * - DATE		:	UNIX filestamp to format by {@link date_format()}.
 * 
 * comments usually provide also 
 * - NAME 	:	author name
 * - EMAIL	:	author email (if any)
 * - URL	:	author website url (if any)
 *
 * A common usage of the function could be
 * <code>
 * <?php
 * $entry = bdb_parse_entry(bdb_filetoid($myid));
 * ?>
 * </code>
 *
 * @param string $file filepath of the blogdb entry
 * @return string
 *
 * @todo validate returned id
 */
function bdb_parse_entry($id, $type = null)
{
    if (file_exists($id)) {
        $file = $id;
    } else {
        $file = bdb_idtofile($id, $type);
    }
    if (file_exists($file)) {
        $contents = io_load_file($file);
        // TODO: here we must add compatibility to encoding conversion!
        // if "dumb" (legacy :D) mode is enabled (set to true in default.php, then we set parsing
        // to ignore array key case (defaults to true i.e. check them to be uppercase or failing otherwise
        $entry = utils_kexplode($contents, '|', !DUMB_MODE_ENABLED);
        return $entry;
    } else {
        return false;
    }
}