| version 1.48, 2008/05/19 09:09:12 |
version 1.49, 2008/07/29 15:56:17 |
|
|
| * http://platon.sk/projects/Metafox/ |
* http://platon.sk/projects/Metafox/ |
| */ |
*/ |
| |
|
| /* $Platon: Metafox/db.inc.php,v 1.47 2008-05-01 14:37:50 nepto Exp $ */ |
/* $Platon: Metafox/db.inc.php,v 1.48 2008-05-19 09:09:12 nepto Exp $ */ |
| |
|
| /* |
/* |
| * updates: 23/5/2001, 29/7/2001, 11/10/2001, 2/11/2001, 11/1/2002, 23/7/2002 |
* updates: 23/5/2001, 29/7/2001, 11/10/2001, 2/11/2001, 11/1/2002, 23/7/2002 |
| Line 686 function ezin_update_author($data) /* {{ |
|
| Line 686 function ezin_update_author($data) /* {{ |
|
| $password = $data['password']; |
$password = $data['password']; |
| $data = ezin_db_escape($data); |
$data = ezin_db_escape($data); |
| |
|
| // users update (password only) |
|
| if (strlen($password) > 0) { |
|
| $query = sprintf('UPDATE %s SET password="%s" WHERE username="%s"', |
|
| $ezin_sys['db']['tables']['users'], md5($data['password']), $data['username']); |
|
| $result = @mysql_query($query, $ezin_db_handle) |
|
| or ezin_db_error('ezin_update_author() [1]'); |
|
| } |
|
| // author_id |
// author_id |
| $query = sprintf('SELECT author_id FROM %s WHERE username = "%s"', |
$query = sprintf('SELECT id,author_id FROM %s WHERE username = "%s"', |
| $ezin_sys['db']['tables']['users'], $data['username']); |
$ezin_sys['db']['tables']['users'], $data['username']); |
| $result = @mysql_query($query, $ezin_db_handle) |
$result = @mysql_query($query, $ezin_db_handle) |
| or ezin_db_error('ezin_update_author() [2]'); |
or ezin_db_error('ezin_update_author() [2]'); |
| if (($row = @mysql_fetch_array($result, MYSQL_NUM)) == false) |
if (($row = @mysql_fetch_array($result, MYSQL_NUM)) == false) |
| $row = array(); |
$row = array(); |
| @mysql_free_result($result); |
@mysql_free_result($result); |
| $author_id = intval($row[0]); |
$user_id = intval($row[0]); |
| |
$author_id = intval($row[1]); |
| |
// users update (password only) |
| |
if (strlen($password) > 0) { |
| |
$query = sprintf('UPDATE %s SET password="%s", changed_by="%s", changed_id=%d, changed_dt=SYSDATE()' |
| |
.' WHERE username="%s"', $ezin_sys['db']['tables']['users'], |
| |
md5($data['password']), $data['username'], $user_id, $data['username']); |
| |
$result = @mysql_query($query, $ezin_db_handle) |
| |
or ezin_db_error('ezin_update_author() [1]'); |
| |
} |
| // users update |
// users update |
| $query = sprintf('UPDATE %s SET name="%s",email="%s",homepage="%s",description="%s" WHERE id=%d', |
$query = sprintf('UPDATE %s SET name="%s", email="%s", homepage="%s", description="%s",' |
| $ezin_sys['db']['tables']['authors'], $data['name'], $data['email'], $data['homepage'], |
.'changed_by="%s", changed_id=%d, changed_dt=SYSDATE() WHERE id=%d', |
| $data['description'], $author_id); |
$ezin_sys['db']['tables']['authors'], $data['name'], $data['email'], |
| |
$data['homepage'], $data['description'], $data['username'], $user_id, $author_id); |
| $result = @mysql_query($query, $ezin_db_handle) |
$result = @mysql_query($query, $ezin_db_handle) |
| or ezin_db_error('ezin_update_author() [3]'); |
or ezin_db_error('ezin_update_author() [3]'); |
| return true; |
return true; |
| Line 720 function ezin_insert_author($data) /* {{ |
|
| Line 723 function ezin_insert_author($data) /* {{ |
|
| |
|
| // authors INSERT |
// authors INSERT |
| $query = sprintf('INSERT INTO %s' |
$query = sprintf('INSERT INTO %s' |
| .' (type,name,email,homepage,description)' |
.' (type,name,email,homepage,description,created_by,created_dt)' |
| .' VALUES ("external","%s","%s","%s","%s")', |
.' VALUES ("external","%s","%s","%s","%s","%s",SYSDATE())', |
| $ezin_sys['db']['tables']['authors'], |
$ezin_sys['db']['tables']['authors'], |
| $data['name'], $data['email'], $data['homepage'], $data['description']); |
$data['name'], $data['email'], $data['homepage'], $data['description'], $data['username']); |
| $result = @mysql_query($query, $ezin_db_handle) |
$result = @mysql_query($query, $ezin_db_handle) |
| or ezin_db_error('ezin_insert_author() [1]'); |
or ezin_db_error('ezin_insert_author() [1]'); |
| // author_id |
// author_id |
| Line 736 function ezin_insert_author($data) /* {{ |
|
| Line 739 function ezin_insert_author($data) /* {{ |
|
| $author_id = intval($row[0]); |
$author_id = intval($row[0]); |
| // users INSERT |
// users INSERT |
| $query = sprintf('INSERT INTO %s' |
$query = sprintf('INSERT INTO %s' |
| .' (username,password,author_id,role_id)' |
.' (username,password,author_id,role_id,created_by,created_dt)' |
| .' VALUES ("%s","%s",%d,%d)', |
.' VALUES ("%s","%s",%d,%d,"%s",SYSDATE())', |
| $ezin_sys['db']['tables']['users'], |
$ezin_sys['db']['tables']['users'], |
| $data['username'], md5($data['password']), |
$data['username'], md5($data['password']), |
| $author_id, $ezin_cfg['user_create_role_id']); |
$author_id, $ezin_cfg['user_create_role_id'],$data['username']); |
| $result = @mysql_query($query, $ezin_db_handle) |
$result = @mysql_query($query, $ezin_db_handle) |
| or ezin_db_error('ezin_insert_author() [3]'); |
or ezin_db_error('ezin_insert_author() [3]'); |
| return true; |
return true; |