From 4c113a6b8204cb0c446d0d7f1272f8995fd78378 Mon Sep 17 00:00:00 2001 From: niekt0 Date: Wed, 2 Mar 2011 00:18:21 +0100 Subject: [PATCH] fixing broken vectors --- doc/TODO | 7 ++++--- wwwroot/backend/mysql/backend.inc | 13 +++++++------ wwwroot/inc/eventz/verify.inc | 9 +++------ 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/doc/TODO b/doc/TODO index ddbef0f..65fa20a 100644 --- a/doc/TODO +++ b/doc/TODO @@ -58,9 +58,6 @@ - Make PATH_INFO not changing contents of $_GET[] (it should affect some other variable instead - requires complex rewrite) - Switch completely to Base36 (Templates, Links, don't change $_GET[], queries should convert between base10 in db and base36 in kyberia automatically, etc...) -- (IMHO we should use SHA1 or stronger algorithm instead of MD5 for storing passwords) - (I've implemented this partially. We can now login using various hash algorithms, it's backward compatible, but we still need to edit registration/password changing to use SHA1 when updating passwords in DB) - - Rename all files&directories that should not be rewrited to PATH_INFO to start with "_" (and if they should be also ignored by git they should start with "-") (Rename images to _images - and fix hardcoded stuff...) @@ -74,3 +71,7 @@ (Mark all nodes that should become part of distribution of kyberia software) (Delete unused tables) (Replace duplicit tables with VIEWs) + +- Image uploading not working (?) + +- put "setParent" everywhere diff --git a/wwwroot/backend/mysql/backend.inc b/wwwroot/backend/mysql/backend.inc index f8cd6a3..b3b8770 100644 --- a/wwwroot/backend/mysql/backend.inc +++ b/wwwroot/backend/mysql/backend.inc @@ -307,18 +307,19 @@ node_parent='$node_handle' order by node_created $orderby LIMIT $offset,$limit"; // Simple internal function to set node parrent -function setParent($params) { +function setParent($node_id,$parent_id) { global $db,$node,$error,$error_messages; - $parent_id=$params['node_parent']; - $node_id=$params['node_id']; if (!is_numeric($parent_id)) { return false; } - $q="select node_vector from nodes where node_id='$parent_id'"; - $parent_vector=$db->query($q); - $new_vector=$parent_vector.str_pad($node_id,VECTOR_CHARS,"0",STR_PAD_LEFT); + $q="select node_vector from nodes where node_id='$parent_id'"; + $set=$db->query($q); + $set->next(); + $parent_vector=$set->getString('node_vector'); + $new_vector=$parent_vector.str_pad($node_id,VECTOR_CHARS,"0",STR_PAD_LEFT); + $q="update nodes set node_parent='$parent_id',node_vector='".$new_vector." ' where node_id='$node_id'"; $db->query($q); diff --git a/wwwroot/inc/eventz/verify.inc b/wwwroot/inc/eventz/verify.inc index 6abf4bc..7593708 100644 --- a/wwwroot/inc/eventz/verify.inc +++ b/wwwroot/inc/eventz/verify.inc @@ -30,13 +30,10 @@ if($uvercode!=$vercode) { // ouch!! this is gonna be dirty!!!!! will be revised later:-) // XXX hardcoded, rewrite -$q="update nodes set node_parent=".REGISTRATION_REQUEST_NODE.", node_vector='000001010473807402091448$userid' where node_id='$userid'"; -$db->update($q); - +//$q="update nodes set node_parent=".REGISTRATION_REQUEST_NODE.", node_vector='000001010473807402091448$userid' where node_id='$userid'"; +//$db->update($q); -// $params['node_parent']=REGISTRATION_REQUEST_NODE; -// $params['node_id']=$userid; -// nodes::setParent($params); +nodes::setParent($userid,REGISTRATION_REQUEST_NODE); $q="update nodes set node_children_count=node_children_count+1 where node_id=".REGISTRATION_REQUEST_NODE; -- 2.30.2