Esempio n. 1
0
 function _checkFile($directory, $file)
 {
     $f = "{$directory}/{$file}";
     if (is_dir($f) && ctype_digit($file)) {
         return 1;
     }
     if (fnmatch('entry*' . EXT, $file)) {
         $id = basename($file, EXT);
         $arr = entry_parse($id, true);
         echo "[POST] {$id} => {$arr['subject']}\n";
         $this->index->add($id, $arr);
         return 0;
     }
 }
 function main()
 {
     if ($this->nosuchcomment) {
         return PANEL_REDIRECT_DEFAULT;
     }
     $e = entry_parse($_REQUEST['entry']);
     if ($e) {
         $this->smarty->assign('entrysubject', $e['subject']);
     } else {
         return PANEL_REDIRECT_DEFAULT;
     }
     $comment = comment_parse($_REQUEST['entry'], $_REQUEST['comment']);
     if ($comment) {
         $this->smarty->assign('values', $comment);
         $this->smarty->append('values', array('ip_address' => $comment['ip-address']), true);
     } else {
         return PANEL_REDIRECT_DEFAULT;
     }
 }
Esempio n. 3
0
 function main()
 {
     global $fpdb;
     if (isset($_REQUEST['entry'])) {
         $id = $_REQUEST['entry'];
         if ($a = entry_parse($id)) {
         } else {
             $a = draft_parse($id);
         }
         if ($a) {
             if (THEME_LEGACY_MODE) {
                 theme_entry_filters($a, $id);
             }
             $this->smarty->assign('entry', $a);
             $this->smarty->assign('id', $id);
             return 0;
         }
     }
     return 1;
 }
Esempio n. 4
0
 function main()
 {
     global $lang;
     $id = $this->id;
     if (isset($_REQUEST['entry'])) {
         $arr = draft_parse($id);
         if (!$arr) {
             $arr = entry_parse($id);
         } else {
             $this->smarty->assign('draft', true);
         }
         // if entry does not exists
         if ($arr) {
             $this->_makePreview($arr, $id);
         }
     }
     $this->_getCatsFlags();
     add_filter('wp_title', array(&$this, 'makePageTitle'), 10, 2);
     if ($this->draft) {
         add_filter('admin_body_class', array(&$this, 'draft_class'));
     }
 }
Esempio n. 5
0
function entry_delete($id)
{
    if (!($f = entry_exists($id))) {
        return;
    }
    /*
    $d = bdb_idtofile($id,BDB_COMMENT);
    fs_delete_recursive("$d");
    
    // thanks to cimangi for noticing this
    $f = dirname($d) . '/view_counter' .EXT;
    fs_delete($f);
    
    
    $f = bdb_idtofile($id);
    */
    $d = entry_dir($id);
    fs_delete_recursive($d);
    $obj =& entry_init();
    $obj->delete($id, entry_parse($id));
    do_action('delete_post', $id);
    return fs_delete($f);
}
Esempio n. 6
0
 function &peekEntry()
 {
     global $post;
     $qp =& $this->params;
     $return = array(false, false);
     if ($this->counter < 0) {
         $this->prepare();
     }
     if ($this->pointer == $this->params->start + $this->params->count) {
         return $return;
     }
     if ($qp->id) {
         $idx = $this->main_idx;
         $key = entry_idtokey($qp->id);
         $v = $idx->getitem($key);
         if ($qp->fullparse) {
             $entry = isset($this->localcache[$qp->id]) ? $this->localcache[$qp->id] : entry_parse($qp->id);
             if ($entry && $qp->comments) {
                 $this->comments = new FPDB_CommentList($qp->id, comment_getlist($qp->id));
                 $entry['comments'] = $this->comments->getCount();
             }
             $post = $entry;
             if (!$entry) {
                 return $return;
             }
         } else {
             $entry = array('subject' => $v);
             $post = $entry;
         }
         $return = array($this->params->id, $entry);
         return $return;
     }
     if (!$this->walker) {
         $false = array(false, false);
         return $false;
     }
     // search first eligible post
     while ($this->walker->valid && $this->pointer < $qp->start) {
         $this->previd = $this->currentid;
         $key = $this->walker->current_key();
         $id = $this->currentid = entry_keytoid($key);
         if ($this->single) {
             $this->preventry = array('subject' => $this->walker->current_value());
         }
         $this->walker->next();
         $this->pointer++;
     }
     // if there is a secondary (not) idx
     if ($this->secondary_idx) {
         // skips posts until we find one which is not in the secondary idx
         while ($this->walker->valid && ($key = $this->walker->current_key()) && $this->secondary_idx->has_key($key)) {
             $this->walker->next();
             //$qp->count--;
         }
     }
     if (!$this->walker->valid) {
         $cont = false;
         return $cont;
     }
     // pointer == start
     $prevcurr = $this->currentid;
     $id = $this->currentid = entry_keytoid($this->walker->current_key());
     if ($id != $prevcurr) {
         $this->previd = $prevcurr;
     }
     if ($qp->fullparse && $this->counter <= 0) {
         // full parse: reads the whole array from file
         $cont = array();
         $cont = isset($this->localcache[$id]) ? $this->localcache[$id] : entry_parse($id);
     } else {
         // only title
         $cont = array('subject' => $this->walker->current_value(), 'date' => entry_idtotime($id));
     }
     if (!$cont) {
         $cont = false;
         return $cont;
     }
     if ($qp->comments) {
         $this->comments = new FPDB_CommentList($id, comment_getlist($id));
         $cont['comments'] = $this->comments->getCount();
     }
     $post = $cont;
     $post['id'] = $id;
     $var = array(&$id, &$cont);
     return $var;
 }