reverting awful mess in fp-includes
This commit is contained in:
parent
a1176756a4
commit
744e16a9bb
@ -224,7 +224,7 @@ class pairs {
|
||||
function &slice($offset, $count=null) {
|
||||
if (is_null($count)) $count = $this->count;
|
||||
|
||||
$a = new pairs(
|
||||
$a =& new pairs(
|
||||
array_slice($this->a, $offset, $count),
|
||||
array_slice($this->b, $offset, $count)
|
||||
);
|
||||
@ -562,14 +562,14 @@ class BPlusTree_Node {
|
||||
function &getclone($position) {
|
||||
|
||||
if ($this->fifo) {
|
||||
$dict = $this->fifo->fifo_dict;
|
||||
$dict =& $this->fifo->fifo_dict;
|
||||
if (isset($dict[$position])) {
|
||||
return $dict[$position];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$o = new BPlusTree_Node(
|
||||
$o =& new BPlusTree_Node(
|
||||
$this->flag,
|
||||
$this->size,
|
||||
$this->keylen,
|
||||
@ -636,7 +636,7 @@ class BPlusTree_Node {
|
||||
$this->indices[0] = $position;
|
||||
} else {
|
||||
// there are nodes
|
||||
$keys = $this->keys;
|
||||
$keys =& $this->keys;
|
||||
// is the key there already?
|
||||
if (in_array($key, $keys)) {
|
||||
if (array_search($key, $keys) < $validkeys)
|
||||
@ -653,7 +653,7 @@ class BPlusTree_Node {
|
||||
#array_splice($keys, $last, 1);
|
||||
|
||||
// store the index
|
||||
$indices = $this->indices;
|
||||
$indices =& $this->indices;
|
||||
#echo "inserting $position before ", var_dump($indices,1), "\n";
|
||||
array_splice($indices, $place+1, 0, $position);
|
||||
unset($indices[$last+1]);
|
||||
@ -680,8 +680,8 @@ class BPlusTree_Node {
|
||||
}
|
||||
|
||||
$validkeys = $this->validkeys;
|
||||
$indices = $this->indices;
|
||||
$keys = $this->keys;
|
||||
$indices =& $this->indices;
|
||||
$keys =& $this->keys;
|
||||
if (is_null($key)) {
|
||||
$place = 0;
|
||||
$indexplace = 0;
|
||||
@ -751,7 +751,7 @@ class BPlusTree_Node {
|
||||
* @returns object {@link pairs}
|
||||
*/
|
||||
function &_pairs($a, $b) {
|
||||
$x = new pairs($a,$b);
|
||||
$x =& new pairs($a,$b);
|
||||
return $x;
|
||||
|
||||
}
|
||||
@ -805,12 +805,12 @@ class BPlusTree_Node {
|
||||
|
||||
// fifo
|
||||
|
||||
$fifo = $this->fifo;
|
||||
$fifo =& $this->fifo;
|
||||
if ($fifo) {
|
||||
$ff = $fifo->fifo;
|
||||
$fd = $fifo->fifo_dict;
|
||||
$ff =& $fifo->fifo;
|
||||
$fd =& $fifo->fifo_dict;
|
||||
if (isset($fd[$place])) {
|
||||
$node = $fd[$place];
|
||||
$node =& $fd[$place];
|
||||
#unset($ff[$place]);
|
||||
$idx = array_search($node, $ff, true);
|
||||
array_splice($ff, $idx, 1);
|
||||
@ -819,8 +819,8 @@ class BPlusTree_Node {
|
||||
}
|
||||
}
|
||||
|
||||
$node = $this->getclone($place);
|
||||
$node = $node->materialize();
|
||||
$node =& $this->getclone($place);
|
||||
$node =& $node->materialize();
|
||||
return $node;
|
||||
}
|
||||
|
||||
@ -839,8 +839,8 @@ class BPlusTree_Node {
|
||||
if ($place == BPT_NULLSEEK)
|
||||
return null;
|
||||
else {
|
||||
$node = $this->getclone($place);
|
||||
$node = $node->materialize();
|
||||
$node =& $this->getclone($place);
|
||||
$node =& $node->materialize();
|
||||
return $node;
|
||||
}
|
||||
|
||||
@ -855,8 +855,8 @@ class BPlusTree_Node {
|
||||
if ($place == BPT_NULLSEEK)
|
||||
return null;
|
||||
else {
|
||||
$node = $this->getclone($place);
|
||||
$node = $node->materialize();
|
||||
$node =& $this->getclone($place);
|
||||
$node =& $node->materialize();
|
||||
return $node;
|
||||
}
|
||||
|
||||
@ -878,8 +878,8 @@ class BPlusTree_Node {
|
||||
trigger_error("cannot get next for non-leaf ($key)", E_USER_ERROR);
|
||||
}
|
||||
$validkeys = $this->validkeys;
|
||||
$indices = $this->indices;
|
||||
$keys = $this->keys;
|
||||
$indices =& $this->indices;
|
||||
$keys =& $this->keys;
|
||||
|
||||
if ($validkeys<=0) { // empty
|
||||
// first entry
|
||||
@ -934,8 +934,8 @@ class BPlusTree_Node {
|
||||
*/
|
||||
function put_all_values($keys_indices) {
|
||||
$this->clear();
|
||||
$indices = $this->indices;
|
||||
$keys = $this->keys;
|
||||
$indices =& $this->indices;
|
||||
$keys =& $this->keys;
|
||||
$length = $this->validkeys = $keys_indices->count;#count($keys_indices);
|
||||
if ($length > $this->size)
|
||||
trigger_error("bad length $length", E_USER_ERROR);
|
||||
@ -959,8 +959,8 @@ class BPlusTree_Node {
|
||||
|
||||
function put_all_positions($first_position, $keys_positions) {
|
||||
$this->clear();
|
||||
$indices = $this->indices;
|
||||
$keys = $this->keys;
|
||||
$indices =& $this->indices;
|
||||
$keys =& $this->keys;
|
||||
$length = $this->validkeys = $keys_positions->count;#count($keys_positions);
|
||||
if ($length > $this->size) {
|
||||
trigger_error("bad length $length", E_USER_ERROR);
|
||||
@ -1012,9 +1012,9 @@ class BPlusTree_Node {
|
||||
trigger_error('cannot make leaf neighbour for non-leaf');
|
||||
|
||||
// create clone
|
||||
$neighbour = $this->getclone($position);
|
||||
$neighbour =& $this->getclone($position);
|
||||
$size = $this->size;
|
||||
$indices = $this->indices;
|
||||
$indices =& $this->indices;
|
||||
|
||||
// linking siblings
|
||||
$neighbour->indices[$size] = $indices[$size];
|
||||
@ -1087,8 +1087,8 @@ class BPlusTree_Node {
|
||||
* @param string $key target key
|
||||
*/
|
||||
function delvalue($key) {
|
||||
$keys = $this->keys;
|
||||
$indices = $this->indices;
|
||||
$keys =& $this->keys;
|
||||
$indices =& $this->indices;
|
||||
if (!in_array($key, $keys)) {
|
||||
d($keys);
|
||||
trigger_error ("missing key, can't delete", E_USER_ERROR);
|
||||
@ -1168,7 +1168,7 @@ class BPlusTree_Node {
|
||||
fseek($file, 0, SEEK_END);
|
||||
$position = ftell($file);
|
||||
d("ALLOCATING SPACE...");
|
||||
$thenode = $this->getclone($position);
|
||||
$thenode =& $this->getclone($position);
|
||||
$thenode->store();
|
||||
return array(&$thenode, BPT_NULLSEEK);
|
||||
} else {
|
||||
@ -1210,9 +1210,9 @@ class BPlusTree_Node {
|
||||
if (is_null($position))
|
||||
trigger_error("position cannot be null",E_USER_ERROR);
|
||||
|
||||
$fifo = $this->fifo;
|
||||
$fifo =& $this->fifo;
|
||||
if (!$force && $fifo) {
|
||||
$fd = $fifo->fifo_dict;
|
||||
$fd =& $fifo->fifo_dict;
|
||||
if (isset($fd[$this->position]) && $fd[$position] === $this) {
|
||||
$this->dirty = true;
|
||||
return; // defer processing
|
||||
@ -1245,11 +1245,11 @@ class BPlusTree_Node {
|
||||
$position = $this->position;
|
||||
|
||||
if ($this->fifo) {
|
||||
$fifo = $this->fifo;
|
||||
$dict = $fifo->fifo_dict;
|
||||
$ff = $fifo->fifo;
|
||||
$fifo =& $this->fifo;
|
||||
$dict =& $fifo->fifo_dict;
|
||||
$ff =& $fifo->fifo;
|
||||
if (isset($dict[$position])) {
|
||||
$node = $dict[$position];
|
||||
$node =& $dict[$position];
|
||||
if ($node !== $ff[0]) {
|
||||
$nidx = array_search($node, $ff, true);
|
||||
unset($ff[$nidx]);
|
||||
@ -1359,8 +1359,8 @@ class BPlusTree_Node {
|
||||
echo "free->", $this->position, "\n";
|
||||
$nextp = $this->indices[0];
|
||||
if ($nextp!=BPT_NULLSEEK) {
|
||||
$next = $this->getclone($nextp);
|
||||
$next = $next->materialize();
|
||||
$next =& $this->getclone($nextp);
|
||||
$next =& $next->materialize();
|
||||
$next->dump();
|
||||
} else {
|
||||
echo "!last\n";
|
||||
@ -1386,8 +1386,8 @@ class BPlusTree_Node {
|
||||
while(list(,$i) = each($this->indices)) {
|
||||
if ($i!=BPT_NULLSEEK) {
|
||||
// interior
|
||||
$n = $this->getclone($i);
|
||||
$n = $n->materialize();
|
||||
$n =& $this->getclone($i);
|
||||
$n =& $n->materialize();
|
||||
$n->dump($nextindent);
|
||||
} else {
|
||||
//leaf
|
||||
@ -1404,18 +1404,18 @@ class BPlusTree_Node {
|
||||
* adds this node to fifo
|
||||
*/
|
||||
function add_to_fifo() {
|
||||
$fifo = $this->fifo;
|
||||
$ff = $fifo->fifo;
|
||||
$dict = $fifo->fifo_dict;
|
||||
$fifo =& $this->fifo;
|
||||
$ff =& $fifo->fifo;
|
||||
$dict =& $fifo->fifo_dict;
|
||||
|
||||
$position = $this->position;
|
||||
if(isset($dict[$position])) {
|
||||
$old = $dict[$position];
|
||||
$old =& $dict[$position];
|
||||
unset($dict[$position]);
|
||||
# ff.remove(old)
|
||||
array_splice($ff, array_search($old, $ff, true), 1);
|
||||
}
|
||||
$dict[$this->position] = $this;
|
||||
$dict[$this->position] =& $this;
|
||||
array_splice($ff, 0, 0, array(&$this));
|
||||
if (count($ff)>$this->fifo->fifosize) {
|
||||
$lastidx = count($ff)-1;
|
||||
@ -1546,7 +1546,7 @@ class BPlusTree {
|
||||
$includeupper =null
|
||||
) {
|
||||
|
||||
$o = new BPlusWalker($this, $keylower, $includelower, $keyupper, $includeupper);
|
||||
$o =& new BPlusWalker($this, $keylower, $includelower, $keyupper, $includeupper);
|
||||
return $o;
|
||||
|
||||
}
|
||||
@ -1594,7 +1594,7 @@ class BPlusTree {
|
||||
$file = $this->file;
|
||||
fseek($file, 0, SEEK_END);
|
||||
$this->root_seek = ftell($file);
|
||||
$this->root = new BplusTree_Node(
|
||||
$this->root =& new BplusTree_Node(
|
||||
BPT_FLAG_LEAFANDROOT,
|
||||
$this->nodesize, $this->keylen, $this->root_seek, $file
|
||||
);
|
||||
@ -1609,14 +1609,14 @@ class BPlusTree {
|
||||
$file = $this->file;
|
||||
if ($this->get_parameters()===false)
|
||||
return false;
|
||||
$this->root = new BplusTree_Node(
|
||||
$this->root =& new BplusTree_Node(
|
||||
BPT_FLAG_LEAFANDROOT,
|
||||
$this->nodesize,
|
||||
$this->keylen,
|
||||
$this->root_seek,
|
||||
$file
|
||||
);
|
||||
$this->root = $this->root->materialize();
|
||||
$this->root =& $this->root->materialize();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1749,7 +1749,7 @@ class BPlusTree {
|
||||
}
|
||||
|
||||
|
||||
$node = $node->getnode($nodekey);
|
||||
$node =& $node->getnode($nodekey);
|
||||
}
|
||||
|
||||
return $node->getvalue($key, $loose);
|
||||
@ -1781,7 +1781,7 @@ class BPlusTree {
|
||||
if (!is_numeric($val))
|
||||
trigger_error("Second parameter must be numeric", E_USER_ERROR);
|
||||
$curr_length = $this->length;
|
||||
$root = $this->root;
|
||||
$root =& $this->root;
|
||||
if (is_null($root)) trigger_error("not open", E_USER_ERROR);
|
||||
if (!is_string($key)) trigger_error("$key must be string", E_USER_ERROR);
|
||||
if (strlen($key)>$this->keylen)
|
||||
@ -1817,7 +1817,7 @@ class BPlusTree {
|
||||
$newroot->clear();
|
||||
$newroot->putfirstindex($root->position);
|
||||
$newroot->putnode($leftmost, $node);
|
||||
$this->root = $newroot;
|
||||
$this->root =& $newroot;
|
||||
$this->root_seek = $newroot->position;
|
||||
$newroot->store();
|
||||
$root->store();
|
||||
@ -1850,7 +1850,7 @@ class BPlusTree {
|
||||
|
||||
function set($key, $val, &$node) {
|
||||
//{{{
|
||||
$keys = $node->keys;
|
||||
$keys =& $node->keys;
|
||||
$validkeys = $node->validkeys;
|
||||
if (($node->flag & BPT_FLAG_INTERIOR) == BPT_FLAG_INTERIOR) {
|
||||
d("NON LEAF: FIND DESCENDANT");
|
||||
@ -1949,7 +1949,7 @@ class BPlusTree {
|
||||
array(&$this, 'update_freelist')
|
||||
);
|
||||
d("CREATE NEW NEIGHBOUR");
|
||||
$newnode = $node->newneighbour($newnode->position);
|
||||
$newnode =& $node->newneighbour($newnode->position);
|
||||
$newnode->flag = BPT_FLAG_LEAF;
|
||||
$newleftmost = $this->divide_entries(0, $node, $newnode, $ki);
|
||||
$node->store();
|
||||
@ -1995,7 +1995,7 @@ class BPlusTree {
|
||||
if (($node->flag & BPT_FLAG_INTERIOR) == BPT_FLAG_INTERIOR) {
|
||||
// non-leaf
|
||||
|
||||
$keys = $node->keys;
|
||||
$keys =& $node->keys;
|
||||
$validkeys =$node->validkeys;
|
||||
$place = BPT_bisect($keys, $key, 0, $validkeys);
|
||||
|
||||
@ -2018,7 +2018,7 @@ class BPlusTree {
|
||||
}
|
||||
|
||||
// get child node
|
||||
$nextnode = $node->getnode($nodekey);
|
||||
$nextnode =& $node->getnode($nodekey);
|
||||
|
||||
// RECURSION! remove from nextnode;
|
||||
// returns new leftmost if changed, otherwise null,
|
||||
@ -2049,17 +2049,17 @@ class BPlusTree {
|
||||
|
||||
if ($place >= $validkeys) {
|
||||
// final node in row, get previous
|
||||
$rightnode = $nextnode;
|
||||
$rightnode =& $nextnode;
|
||||
$rightkey = $nodekey;
|
||||
if ($validkeys<=1) {
|
||||
$leftkey = null;
|
||||
} else {
|
||||
$leftkey = $keys[$place-2];
|
||||
}
|
||||
$leftnode = $node->getnode($leftkey);
|
||||
$leftnode =& $node->getnode($leftkey);
|
||||
} else {
|
||||
// non-final, get next
|
||||
$leftnode = $nextnode;
|
||||
$leftnode =& $nextnode;
|
||||
$leftkey = $nodekey;
|
||||
|
||||
if ($index == 0) {
|
||||
@ -2075,7 +2075,7 @@ class BPlusTree {
|
||||
|
||||
#$ki = array_merge($leftki, $rightki);
|
||||
$leftki->append($rightki);
|
||||
$ki = $leftki;
|
||||
$ki =& $leftki;
|
||||
|
||||
#array_splice ($leftki, count($leftki), 0, $rightki);
|
||||
|
||||
@ -2287,8 +2287,8 @@ class BPlusTree {
|
||||
}
|
||||
|
||||
|
||||
$this->root = $root->getnode(null);
|
||||
$newroot = $this->root;
|
||||
$this->root =& $root->getnode(null);
|
||||
$newroot =& $this->root;
|
||||
$this->root_seek = $newroot->position;
|
||||
$this->free = $root->free($this->free);
|
||||
$this->reset_header();
|
||||
@ -2312,7 +2312,7 @@ class BPlusTree {
|
||||
}
|
||||
|
||||
function _dump() {
|
||||
$free = $this->root->getclone($this->free);
|
||||
$free =& $this->root->getclone($this->free);
|
||||
for ($i=$this->headersize;
|
||||
!feof($this->file);
|
||||
fseek($this->file, $i), $i+=$free->storage) {
|
||||
@ -2329,8 +2329,8 @@ class BPlusTree {
|
||||
function dump() {
|
||||
$this->root->dump() ;
|
||||
if ($this->free != BPT_NULLSEEK) {
|
||||
$free = $this->root->getclone($this->free);
|
||||
$free = $free->materialize();
|
||||
$free =& $this->root->getclone($this->free);
|
||||
$free =& $free->materialize();
|
||||
$free->dump();
|
||||
}
|
||||
}
|
||||
@ -2354,7 +2354,7 @@ class BPlusWalker {
|
||||
$keyupper=null,
|
||||
$includeupper=null){
|
||||
|
||||
$this->tree = $tree;
|
||||
$this->tree =& $tree;
|
||||
$this->keylower = $keylower;
|
||||
$this->includelower = $includelower;
|
||||
$this->keyupper = $keyupper;
|
||||
@ -2380,11 +2380,11 @@ class BPlusWalker {
|
||||
}
|
||||
}
|
||||
|
||||
$node = $node->getnode($nkey);
|
||||
$node =& $node->getnode($nkey);
|
||||
}
|
||||
|
||||
$this->startnode = $node;
|
||||
$this->node = $node;
|
||||
$this->startnode =& $node;
|
||||
$this->node =& $node;
|
||||
|
||||
$this->node_index = null;
|
||||
$this->valid = 0;
|
||||
@ -2393,10 +2393,10 @@ class BPlusWalker {
|
||||
}
|
||||
|
||||
function first() {
|
||||
$this->node = $this->startnode;
|
||||
$node = $this->node;
|
||||
$this->node =& $this->startnode;
|
||||
$node =& $this->node;
|
||||
|
||||
$keys = $node->keys;
|
||||
$keys =& $node->keys;
|
||||
$keylower = $this->keylower;
|
||||
$keyupper = $this->keyupper;
|
||||
$validkeys= $node->validkeys;
|
||||
@ -2435,9 +2435,9 @@ class BPlusWalker {
|
||||
$this->keylower = $testk;
|
||||
|
||||
} else {
|
||||
$next = $node->nextneighbour();
|
||||
$next =& $node->nextneighbour();
|
||||
if (!is_null($next)) {
|
||||
$this->startnode = $next;
|
||||
$this->startnode =& $next;
|
||||
$this->first();
|
||||
return;
|
||||
} else {
|
||||
@ -2476,15 +2476,15 @@ class BPlusWalker {
|
||||
|
||||
function next() {
|
||||
$nextp = $this->node_index+1;
|
||||
$node = $this->node;
|
||||
$node =& $this->node;
|
||||
if ($nextp>=$node->validkeys) {
|
||||
$next = $node->nextneighbour();
|
||||
$next =& $node->nextneighbour();
|
||||
if (is_null($next)) {
|
||||
$this->valid = 0;
|
||||
return;
|
||||
}
|
||||
$this->node = $next;
|
||||
$node = $next;
|
||||
$this->node =& $next;
|
||||
$node =& $next;
|
||||
$nextp = 0;
|
||||
}
|
||||
if($node->validkeys <= $nextp) {
|
||||
@ -2593,7 +2593,7 @@ class SBPlusTree extends BPlusTree {
|
||||
$keyupper =null,
|
||||
$includeupper =null
|
||||
) {
|
||||
$o = new SBPlusWalker($this, $keylower, $includelower, $keyupper, $includeupper);
|
||||
$o =& new SBPlusWalker($this, $keylower, $includelower, $keyupper, $includeupper);
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
@ -2611,14 +2611,6 @@ class caching_SBPT extends SBPlusTree {
|
||||
|
||||
var $cache = array();
|
||||
|
||||
|
||||
function caching_SBPT($infile, $stringfile,
|
||||
$maxstring = 256,
|
||||
$pos=null, $nodesize=null, $keylen=null) {
|
||||
$this->SBPlusTree($infile, $stringfile, $maxstring, $pos, $nodesize, $keylen);
|
||||
}
|
||||
|
||||
|
||||
function getitem(&$key, $loose=false) {
|
||||
if (isset($cache[$key]))
|
||||
return $cache[$key];
|
||||
|
@ -21,7 +21,7 @@
|
||||
trigger_error ("Can't find index '{$this->_cachefile}'", E_USER_ERROR);
|
||||
}
|
||||
|
||||
$this->_tree = new caching_SBPT(
|
||||
$this->_tree =& new caching_SBPT(
|
||||
fopen($this->_cachefile.'.dat', 'rb'),
|
||||
fopen(INDEX_DIR.'index.strings.dat', 'rb'),
|
||||
256,
|
||||
@ -84,7 +84,7 @@
|
||||
|
||||
function delete($entryid) {
|
||||
trigger_error('Cannot delete from a cache', E_USER_ERROR) ;
|
||||
$cache = $this->_list;
|
||||
$cache =& $this->_list;
|
||||
unset($cache[$entryid]); // if id found, it is deleted
|
||||
|
||||
return $this->save();
|
||||
|
@ -39,7 +39,7 @@
|
||||
* @see bdb_idtofile()
|
||||
*/
|
||||
function comment_getlist($id) {
|
||||
$obj = new comment_indexer($id); //todo change syntax
|
||||
$obj =& new comment_indexer($id); //todo change syntax
|
||||
return $obj->getList();
|
||||
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
||||
function &draft_init() {
|
||||
global $draftdb;
|
||||
if (!isset($draftdb))
|
||||
$draftdb = new draft_indexer;
|
||||
$draftdb =& new draft_indexer;
|
||||
return $draftdb;
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
static $list = array();
|
||||
|
||||
if (!$list) {
|
||||
$obj = draft_init();
|
||||
$obj =& draft_init();
|
||||
$list = $obj->getList();
|
||||
krsort($list);
|
||||
}
|
||||
@ -95,7 +95,7 @@
|
||||
fs_delete($ed.EXT);
|
||||
|
||||
// remove from normal flow
|
||||
$o = entry_init();
|
||||
$o =& entry_init();
|
||||
$o->delete($id, null);
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@
|
||||
if (!file_exists($f))
|
||||
return false;
|
||||
|
||||
//$draftdb = draft_init();
|
||||
//$draftdb =& draft_init();
|
||||
//$draftdb->delete($id);
|
||||
fs_delete_recursive($dir);
|
||||
|
||||
@ -198,7 +198,7 @@
|
||||
'id'=>''
|
||||
)
|
||||
);
|
||||
$arr = $smarty->get_template_vars('draft_list');
|
||||
$arr =& $smarty->get_template_vars('draft_list');
|
||||
|
||||
list($id, $subject)=each($arr);
|
||||
|
||||
|
@ -87,7 +87,7 @@
|
||||
$mode = 'r+b';
|
||||
else $mode = 'w+b';
|
||||
|
||||
$this->indices[$cat] = new BPlusTree(
|
||||
$this->indices[$cat] =& new BPlusTree(
|
||||
fopen($f, $mode),
|
||||
$this->_offset,
|
||||
$this->_chunksize,
|
||||
@ -104,7 +104,7 @@
|
||||
$key = entry_idtokey($id);
|
||||
$val = $entry['subject'];
|
||||
|
||||
$main = $this->get_index();
|
||||
$main =& $this->get_index();
|
||||
$seek = null;
|
||||
|
||||
// title must not be updated, let's get the offset value from has_key
|
||||
@ -121,7 +121,7 @@
|
||||
if (isset($entry['categories']) && is_array($entry['categories'])) {
|
||||
foreach ($entry['categories'] as $cat) {
|
||||
if (!is_numeric($cat)) continue;
|
||||
$this_index = $this->get_index($cat);
|
||||
$this_index =& $this->get_index($cat);
|
||||
$this_index->setitem($key, $seek);
|
||||
}
|
||||
}
|
||||
@ -131,7 +131,7 @@
|
||||
foreach($del as $cat) {
|
||||
// echo 'DEL '. $cat,"\n";
|
||||
if (!is_numeric($cat)) continue;
|
||||
$this_index = $this->get_index($cat);
|
||||
$this_index =& $this->get_index($cat);
|
||||
$this_index->delitem($key);
|
||||
}
|
||||
}
|
||||
@ -143,14 +143,14 @@
|
||||
function delete($id, $entry) {
|
||||
$key = entry_idtokey($id);
|
||||
|
||||
$main = $this->get_index();
|
||||
$main =& $this->get_index();
|
||||
$main->delitem($key);
|
||||
|
||||
|
||||
if (isset($entry['categories']) && is_array($entry['categories'])) {
|
||||
foreach ($entry['categories'] as $cat) {
|
||||
if (!is_numeric($cat)) continue;
|
||||
$this_index = $this->get_index($cat);
|
||||
$this_index =& $this->get_index($cat);
|
||||
if ($this_index->has_key($key))
|
||||
$this_index->delitem($key);
|
||||
}
|
||||
@ -345,7 +345,7 @@
|
||||
static $entry_index = null;
|
||||
|
||||
if (is_null($entry_index))
|
||||
$entry_index= new entry_index;
|
||||
$entry_index=& new entry_index;
|
||||
|
||||
return $entry_index;
|
||||
|
||||
@ -358,7 +358,7 @@
|
||||
if (!file_exists($F)) {
|
||||
$o = false;
|
||||
} else {
|
||||
$o = new entry_cached_index($id_cat);
|
||||
$o =& new entry_cached_index($id_cat);
|
||||
}
|
||||
|
||||
return $o;
|
||||
@ -423,7 +423,7 @@
|
||||
|
||||
trigger_error('function deprecated', E_USER_ERROR);
|
||||
|
||||
$obj = entry_init();
|
||||
$obj =& entry_init();
|
||||
|
||||
$entry_arr = $obj->getList();
|
||||
|
||||
@ -503,7 +503,7 @@
|
||||
*/
|
||||
|
||||
function &entry_get_comments($id, &$count) {
|
||||
$obj = new comment_indexer($id);
|
||||
$obj =& new comment_indexer($id);
|
||||
|
||||
$count = count($obj->getList());
|
||||
|
||||
@ -797,7 +797,7 @@
|
||||
print_r($all_cats);
|
||||
*/
|
||||
|
||||
$INDEX = entry_init();
|
||||
$INDEX =& entry_init();
|
||||
$ok = ($update_index) ? $INDEX->add($id, $entry, $delete_cats, $update_title) : true;
|
||||
|
||||
// PHASE 4 : index updated; let's move back the entry
|
||||
@ -861,7 +861,7 @@
|
||||
$d = entry_dir($id);
|
||||
fs_delete_recursive($d);
|
||||
|
||||
$obj = entry_init();
|
||||
$obj =& entry_init();
|
||||
$obj->delete($id, entry_parse($id));
|
||||
|
||||
do_action('delete_post', $id);
|
||||
@ -870,7 +870,7 @@
|
||||
}
|
||||
|
||||
function entry_purge_cache() {
|
||||
$obj = entry_init();
|
||||
$obj =& entry_init();
|
||||
$obj->purge();
|
||||
}
|
||||
//add_action('init',
|
||||
|
@ -260,7 +260,7 @@
|
||||
function fs_delete_recursive($path) {
|
||||
if (file_exists($path)) {
|
||||
|
||||
$obj = new fs_pathlister($path);
|
||||
$obj =& new fs_pathlister($path);
|
||||
$list = ($obj->getList());
|
||||
|
||||
unset($obj);
|
||||
|
@ -148,14 +148,14 @@
|
||||
global $current_query;
|
||||
|
||||
|
||||
$this->params = new FPDB_QueryParams($params);
|
||||
$this->params =& new FPDB_QueryParams($params);
|
||||
$this->ID = $ID;
|
||||
|
||||
if ($this->params->id || $this->params->random) {
|
||||
$this->single = true;
|
||||
}
|
||||
|
||||
$GLOBALS['current_query'] = $this;
|
||||
$GLOBALS['current_query'] =& $this;
|
||||
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@
|
||||
|
||||
$fpdb->init();
|
||||
|
||||
$entry_index = $fpdb->get_index($this->params->category);
|
||||
$entry_index =& $fpdb->get_index($this->params->category);
|
||||
|
||||
$this->counter++;
|
||||
|
||||
@ -198,7 +198,7 @@
|
||||
if (!$this->params->id)
|
||||
trigger_error("FPDB: no ID found for query {$this->ID}", E_USER_ERROR);
|
||||
|
||||
$qp = $this->params;
|
||||
$qp =& $this->params;
|
||||
|
||||
$time = entry_idtotime($qp->id);
|
||||
|
||||
@ -222,7 +222,7 @@
|
||||
// also, if $prevkey != $newkey then $prevkey := $newkey
|
||||
|
||||
|
||||
$this->walker = $entry_index->walker($prevkey, 2, null, null);
|
||||
$this->walker =& $entry_index->walker($prevkey, 2, null, null);
|
||||
|
||||
// since we're searching for $prevkey, i.e. a key preceding the target $id
|
||||
// in the sequence, if $prevkey becomes equal to $key then it means
|
||||
@ -242,7 +242,7 @@
|
||||
function _prepare_list(&$entry_index) {
|
||||
|
||||
|
||||
$qp = $this->params;
|
||||
$qp =& $this->params;
|
||||
|
||||
$entry_num = 0;
|
||||
|
||||
@ -253,18 +253,18 @@
|
||||
#$this->local_list = array_keys($entry_index);
|
||||
|
||||
$index_count = $entry_index->length();
|
||||
$this->walker = $entry_index->walker($firstid=null);
|
||||
$this->walker =& $entry_index->walker($firstid=null);
|
||||
|
||||
} else {
|
||||
// notice this won't work with cats (for now)
|
||||
|
||||
$obj = new entry_archives($qp->y, $qp->m, $qp->d);
|
||||
$obj =& new entry_archives($qp->y, $qp->m, $qp->d);
|
||||
|
||||
$filteredkeys = $obj->getList();
|
||||
$index_count = $obj->getCount();
|
||||
|
||||
if ($filteredkeys)
|
||||
$this->walker = $entry_index->walker(
|
||||
$this->walker =& $entry_index->walker(
|
||||
entry_idtokey($filteredkeys[0]), true,
|
||||
entry_idtokey($filteredkeys[$index_count-1]), true
|
||||
);
|
||||
@ -294,7 +294,7 @@
|
||||
/*
|
||||
stuff for cats, have a look
|
||||
|
||||
$this->local_list = $tmp;
|
||||
$this->local_list =& $tmp;
|
||||
|
||||
if ($qp->start + $qp->count > $i) {
|
||||
$qp->count = $i - $qp->start;
|
||||
@ -305,7 +305,7 @@
|
||||
|
||||
// not so great implementation... doesn't work well
|
||||
function _get_random_id(&$entry_index) {
|
||||
$qp = $this->params;
|
||||
$qp =& $this->params;
|
||||
$now = time();
|
||||
|
||||
$first = '999999999999';
|
||||
@ -329,7 +329,7 @@
|
||||
function hasMore() {
|
||||
|
||||
|
||||
$GLOBALS['current_query'] = $this;
|
||||
$GLOBALS['current_query'] =& $this;
|
||||
|
||||
|
||||
if ($this->counter < 0)
|
||||
@ -347,7 +347,7 @@
|
||||
return $false;
|
||||
}
|
||||
|
||||
$qp = $this->params;
|
||||
$qp =& $this->params;
|
||||
|
||||
|
||||
if ($this->counter < 0)
|
||||
@ -403,7 +403,7 @@
|
||||
}
|
||||
|
||||
if ($qp->comments) {
|
||||
$this->comments = new FPDB_CommentList($id, comment_getlist($id));
|
||||
$this->comments =& new FPDB_CommentList($id, comment_getlist($id));
|
||||
$cont['comments'] = $this->comments->getCount();
|
||||
}
|
||||
|
||||
@ -420,7 +420,7 @@
|
||||
if (!$this->hasMore())
|
||||
return false;
|
||||
|
||||
$var = $this->peekEntry();
|
||||
$var =& $this->peekEntry();
|
||||
$this->lastentry = $var;
|
||||
|
||||
$this->walker->next();
|
||||
@ -581,9 +581,9 @@
|
||||
|
||||
function init() {
|
||||
#if (!$this->_indexer) {
|
||||
#$this->_indexer = new entry_indexer();
|
||||
#$this->_indexer =& new entry_indexer();
|
||||
$this->_categories = entry_categories_get();
|
||||
#$obj = $this->_indexer;
|
||||
#$obj =& $this->_indexer;
|
||||
#$this->entry_index = $obj->getList();
|
||||
|
||||
|
||||
@ -592,7 +592,7 @@
|
||||
|
||||
function &get_index($cat_id = 0) {
|
||||
if (!isset($this->_indexer[$cat_id])) {
|
||||
$this->_indexer[$cat_id] = entry_cached_index($cat_id);
|
||||
$this->_indexer[$cat_id] =& entry_cached_index($cat_id);
|
||||
}
|
||||
return $this->_indexer[$cat_id];
|
||||
}
|
||||
@ -653,7 +653,7 @@
|
||||
static $queryId=-1;
|
||||
$queryId++;
|
||||
|
||||
$this->queries[$queryId] = new FPDB_Query($params, $queryId);
|
||||
$this->queries[$queryId] =& new FPDB_Query($params, $queryId);
|
||||
|
||||
|
||||
$this->init();
|
||||
@ -666,7 +666,7 @@
|
||||
function doquery($queryId=0) {
|
||||
|
||||
if (isset($this->queries[$queryId])) {
|
||||
$q = $this->queries[$queryId];
|
||||
$q =& $this->queries[$queryId];
|
||||
} else {
|
||||
return false;
|
||||
trigger_error("FPDB: no such query ID ($queryId)", E_USER_WARNING);
|
||||
@ -688,7 +688,7 @@
|
||||
function &getQuery($queryId=0) {
|
||||
$o = null;
|
||||
if (isset($this->queries[$queryId]))
|
||||
$o = $this->queries[$queryId];
|
||||
$o =& $this->queries[$queryId];
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
@ -785,15 +785,15 @@
|
||||
return $content;
|
||||
}
|
||||
|
||||
$q = $fpdb->getQuery();
|
||||
$q =& $fpdb->getQuery();
|
||||
|
||||
if($repeat=$q->hasMore()) {
|
||||
|
||||
|
||||
$couplet = $q->getEntry() ;
|
||||
$couplet =& $q->getEntry() ;
|
||||
|
||||
$id = $couplet[0];
|
||||
$entry = $couplet[1];
|
||||
$id =& $couplet[0];
|
||||
$entry =& $couplet[1];
|
||||
|
||||
if (THEME_LEGACY_MODE) {
|
||||
$entry = theme_entry_filters($entry, $id);
|
||||
@ -835,14 +835,14 @@
|
||||
)
|
||||
);
|
||||
|
||||
$q = $fpdb->getQuery();
|
||||
$q =& $fpdb->getQuery();
|
||||
|
||||
if($repeat=$q->comments->hasMore()) {
|
||||
|
||||
$couplet = $q->comments->getComment();
|
||||
$couplet =& $q->comments->getComment();
|
||||
|
||||
$id = $couplet[0];
|
||||
$comment = $couplet[1];
|
||||
$id =& $couplet[0];
|
||||
$comment =& $couplet[1];
|
||||
|
||||
|
||||
foreach($comment as $k=>$v) {
|
||||
@ -870,7 +870,7 @@
|
||||
function smarty_block_comments($params, $content, &$smarty, &$repeat) {
|
||||
global $fpdb;
|
||||
|
||||
$q = $fpdb->getQuery();
|
||||
$q =& $fpdb->getQuery();
|
||||
$show = $q->comments->getCount();
|
||||
$smarty->assign('entryid', $q->comments->entryid);
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
// checks if we already loaded this lang file
|
||||
$vals = explode('.', $postfix); // my.file.name ---> my, file, name
|
||||
$old_lang = $GLOBALS['lang'];
|
||||
$old_lang =& $GLOBALS['lang'];
|
||||
|
||||
if (!$old_lang)
|
||||
$old_lang = array();
|
||||
@ -118,7 +118,7 @@
|
||||
}
|
||||
|
||||
function lang_list() {
|
||||
$obj = new lang_indexer();
|
||||
$obj =& new lang_indexer();
|
||||
return $obj->getList();
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
function getEnableds($checkonly) {
|
||||
|
||||
$lang = $GLOBALS['lang'];
|
||||
$lang =& $GLOBALS['lang'];
|
||||
$errors = array();
|
||||
|
||||
if (!file_exists($this->_enabledlist))
|
||||
@ -59,7 +59,7 @@
|
||||
// this is done during init process
|
||||
// all the plugin are loaded
|
||||
|
||||
$pluginlister = new plugin_indexer;
|
||||
$pluginlister =& new plugin_indexer;
|
||||
$enab = $pluginlister->getEnableds($check);
|
||||
|
||||
include_once (INCLUDES_DIR . 'core.wp-pluggable-funcs.php');
|
||||
@ -70,7 +70,7 @@
|
||||
|
||||
function plugin_get($id=null){
|
||||
|
||||
$pluginlister = new plugin_indexer;
|
||||
$pluginlister =& new plugin_indexer;
|
||||
return $pluginlister->getList();
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
function static_getlist() {
|
||||
|
||||
$obj = new static_indexer;
|
||||
$obj =& new static_indexer;
|
||||
$list = $obj->getList();
|
||||
return $list;
|
||||
|
||||
|
@ -154,12 +154,12 @@
|
||||
system_unregister_globals();
|
||||
system_prepare_iis();
|
||||
|
||||
$GLOBALS['fpdb'] = new FPDB;
|
||||
$GLOBALS['fpdb'] =& new FPDB;
|
||||
|
||||
$GLOBALS['fp_widgets'] = new widget_indexer;
|
||||
$GLOBALS['fp_widgets'] =& new widget_indexer;
|
||||
|
||||
$GLOBALS['smarty'] = $GLOBALS['_FP_SMARTY'];
|
||||
$smarty = $GLOBALS['smarty'];
|
||||
$GLOBALS['smarty'] =& $GLOBALS['_FP_SMARTY'];
|
||||
$smarty =& $GLOBALS['smarty'];
|
||||
|
||||
$GLOBALS['fp_config'] = config_load();
|
||||
|
||||
@ -169,9 +169,9 @@
|
||||
|
||||
ob_start();
|
||||
|
||||
$GLOBALS['theme'] = theme_loadsettings();
|
||||
$GLOBALS['theme'] =& theme_loadsettings();
|
||||
|
||||
$GLOBALS['lang'] = lang_load();
|
||||
$GLOBALS['lang'] =& lang_load();
|
||||
|
||||
|
||||
plugin_loadall();
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
|
||||
function user_list(){
|
||||
$obj = new user_lister;
|
||||
$obj =& new user_lister;
|
||||
if ($users = $obj->getList()) {
|
||||
return $entry_arr;
|
||||
} else return false;
|
||||
|
@ -366,36 +366,6 @@ ERR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class utils_array_walker {
|
||||
|
||||
var $_array;
|
||||
var $valid;
|
||||
|
||||
function utils_array_walker(&$array) {
|
||||
if (!is_array($array) || empty($array))
|
||||
$this->valid = false;
|
||||
$this->_array =& $array;
|
||||
$this->first();
|
||||
}
|
||||
function first() {
|
||||
return reset($this->_array);
|
||||
}
|
||||
function current_key() {
|
||||
return key($this->_array);
|
||||
}
|
||||
function current_value() {
|
||||
return current($this->_array);
|
||||
}
|
||||
function current() {
|
||||
return array($this->current_key(),$this->current_value());
|
||||
}
|
||||
function next() {
|
||||
$v = next($this->_array);
|
||||
$this->valid = (bool) $v;
|
||||
return $v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function fplog($str) {
|
||||
|
@ -6,8 +6,8 @@
|
||||
require_once INCLUDES_DIR.'core.utils.php';
|
||||
utils_checksmarty();
|
||||
require(SMARTY_DIR . 'Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
$_FP_SMARTY = $smarty;
|
||||
$smarty =& new Smarty;
|
||||
$_FP_SMARTY =& $smarty;
|
||||
|
||||
|
||||
// WordPress plugin system
|
||||
@ -42,7 +42,7 @@
|
||||
require_once INCLUDES_DIR.'core.cookie.php';
|
||||
require_once INCLUDES_DIR.'core.system.php';
|
||||
require_once INCLUDES_DIR.'core.theme.php';
|
||||
# require_once INCLUDES_DIR.'core.layout.php';
|
||||
require_once INCLUDES_DIR.'core.layout.php';
|
||||
require_once INCLUDES_DIR.'core.users.php';
|
||||
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user