1
tdldp
Re: Strange did you say strange....
  • 2004/2/4 21:29

  • tdldp

  • Just popping in

  • Posts: 9

  • Since: 2002/3/13


Tks a lot dave, indeed it was the problem with my scripting...

what a poor developper i make ;)

Tdldp



2
tdldp
Re: Strange did you say strange....
  • 2004/2/4 9:37

  • tdldp

  • Just popping in

  • Posts: 9

  • Since: 2002/3/13


I don't know what i did, but that f..... darn script finally works...

I do Get storage in the format desired...

But here i have a more general question...

Once stored 2A or anything else in database field dept, i can't retrieve information as soon as i have 2A or 2B (only 2 that i have btw) in my sql query:

SELECT * FROM `cef_users` WHERE dept = 2A;

although i can retrieve all information for any other departement : 02 , 44, etc... this one gives me following error :

#1054 - Unknown column '2A' in 'where clause'


An idea ???

Tdldp



3
tdldp
Re: Xoops Kernel / user.php functions.... Devs i need you ;)
  • 2004/2/4 8:16

  • tdldp

  • Just popping in

  • Posts: 9

  • Since: 2002/3/13


Thks for your answer mithrandir, i appreciated it and it help me a round... But here it goes :

turning on debug gave me this :

page register.php

Notice: Undefined variable: dept in /www/include/registerform.php on line 83

Notice: Undefined variable: type in /www/include/registerform.php on line 84

These lines correspond in registerform.php at :

$reg_form->addElement(new XoopsFormSelectDept(_US_DEPT, "dept", $dept));
$reg_form->addElement(new XoopsFormSelectType(_US_TYPECHASSE, "type", $type));

XoopsFormSelectDept and Type are 2 scripts of my composition which were inspired from FormSelectCountry :
here is coding :

[/quote]
/**
* lists of values
*/
include_once XOOPS_ROOT_PATH."/class/xoopslists.php";

/**
* Parent
*/
include_once XOOPS_ROOT_PATH."/class/xoopsform/formselect.php";

/**
* A select field with types
*
* @package kernel
* @subpackage form
*
* @author Tdldp
* @copyright
*/
class XoopsFormSelectDept extends XoopsFormSelect
{
/**
* Constructor
*
* @param string $caption Caption
* @param string $name "name" attribute
* @param mixed $value Pre-selected value (or array of them).
* Legal are all 2-letter country codes (in capitals).
* @param int $size Number or rows. "1" makes a drop-down-list
*/
function XoopsFormSelectDept($caption, $name, $value=null, $size=1)
{
$this->XoopsFormSelect($caption, $name, $value, $size);
$this->addOptionArray(XoopsLists::getDeptList());
}
}
[/quote]

here is extract from xoopslist corresponding at select list :
Quote:

function &getTypeList()
{
$type_list = array (
"1" => "Chasse Petit Gibier Sedentaire",
"2" => "Chasse du Grand Gibier",
"3" => "Chasse du Gibier d'eau",
"4" => "Chasse Petit Gibier Migrateur",
"5" => "Chasse à Courre",
"6" => "Chasse à L'arc",
);
asort($type_list);
reset($type_list);
return $type_list;
}

function &getDeptList()
{
$db =& Database::getInstance();
$myts =& MyTextSanitizer::getInstance();
$sql = "SELECT dept, intitule FROM ".$db->prefix("departements")." ORDER BY dept";
$result = $db->query($sql);
$dept_list = array();
while ( $myrow = $db->fetchArray($result) ) {
$dept_list[$myrow['dept']] = $myts->makeTboxData4Show($myrow['intitule']);
}
return $dept_list;
}


I have correcly defined these 2 files in Xoopsformloader :
include_once XOOPS_ROOT_PATH."/class/xoopsform/formselectType.php";
include_once XOOPS_ROOT_PATH."/class/xoopsform/formselectDept.php";

Finally in Kernel / User.php i added this :

$this->initVar('dept', XOBJ_DTYPE_INT, 0, false);

and lower :
function dept()
{
return $this->getVar("dept");
}

Not forgetting :

$sql = sprintf("INSERT INTO %s (uid, uname, name, email, url, user_avatar, user_regdate, user_icq, user_from, user_sig, user_viewemail, actkey, user_aim, user_yim, user_msnm, pass, posts, attachsig, rank, level, theme, timezone_offset, last_login, umode, uorder, notify_method, notify_mode, user_occ, bio, user_intrest, user_mailok, date, ip, prenom, dept, type, mailing, valide) VALUES (%u, %s, %s, %s, %s, %s, %u, %s, %s, %s, %u, %s, %s, %s, %s, %s, %u, %u, %u, %u, %s, %.2f, %u, %s, %u, %u, %u, %s, %s, %s, %u, %u, %u, %s, %u, %u, %u, %u)", $this->db->prefix('users'), $uid, $this->db->quoteString($uname), $this->db->quoteString($name), $this->db->quoteString($email), $this->db->quoteString($url), $this->db->quoteString($user_avatar), time(), $this->db->quoteString($user_icq), $this->db->quoteString($user_from), $this->db->quoteString($user_sig), $user_viewemail, $this->db->quoteString($actkey), $this->db->quoteString($user_aim), $this->db->quoteString($user_yim), $this->db->quoteString($user_msnm), $this->db->quoteString($pass), $posts, $attachsig, $rank, $level, $this->db->quoteString($theme), $timezone_offset, 0, $this->db->quoteString($umode), $uorder, $notify_method, $notify_mode, $this->db->quoteString($user_occ), $this->db->quoteString($bio), $this->db->quoteString($user_intrest), $user_mailok, $this->db->quoteString($date), $this->db->quoteString($ip), $this->db->quoteString($prenom), $dept, $type, $mailing, $valide);
} else {
$sql = sprintf("UPDATE %s SET uname = %s, name = %s, email = %s, url = %s, user_avatar = %s, user_icq = %s, user_from = %s, user_sig = %s, user_viewemail = %u, user_aim = %s, user_yim = %s, user_msnm = %s, posts = %d, pass = %s, attachsig = %u, rank = %u, level= %u, theme = %s, timezone_offset = %.2f, umode = %s, last_login = %u, uorder = %u, notify_method = %u, notify_mode = %u, user_occ = %s, bio = %s, user_intrest = %s, user_mailok = %u, date = %s, ip = %s, prenom = %s, dept = %s, type = %u, mailing = %u, valide = %u WHERE uid = %u", $this->db->prefix('users'), $this->db->quoteString($uname), $this->db->quoteString($name), $this->db->quoteString($email), $this->db->quoteString($url), $this->db->quoteString($user_avatar), $this->db->quoteString($user_icq), $this->db->quoteString($user_from), $this->db->quoteString($user_sig), $user_viewemail, $this->db->quoteString($user_aim), $this->db->quoteString($user_yim), $this->db->quoteString($user_msnm), $posts, $this->db->quoteString($pass), $attachsig, $rank, $level, $this->db->quoteString($theme), $timezone_offset, $this->db->quoteString($umode), $last_login, $uorder, $notify_method, $notify_mode, $this->db->quoteString($user_occ), $this->db->quoteString($bio), $this->db->quoteString($user_intrest), $user_mailok, $this->db->quoteString($date), $this->db->quoteString($ip), $this->db->quoteString($prenom), $dept, $type, $mailing, $valide, $uid);

As precised storage of $dept in database has attribute "Char(2)"

When switching to Dept to XobJ_Dtype_TXTBOX, i get no changes, that is to say departements are still stored under 1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 2 instead of 01, 02, 03, 04, 05, 06, 07, 08, 09, 2A, 2B...

When switching function dept to :
function dept($format="S")
{
return $this->getVar("dept", $format);
}

And sql insert and update to :
Insert ...dept...VALUES...%s....$this->db->quoteString($dept)...

Update ...SET...dept = %s...WHERE...$this->db->quoteString($dept)...

I get errors
Any idea on how solving this problem ???

Thks for any help
Tdldp



4
tdldp
Xoops Kernel / user.php functions.... Devs i need you ;)
  • 2004/2/2 9:05

  • tdldp

  • Just popping in

  • Posts: 9

  • Since: 2002/3/13


hi all,

Trying to understand how kernel / user.php works (i am having problems storing new fields on database in xoops_user tables)

I was wondering how the :

$this->initVar('Var_name', XOBJ_DTYPE_XXXXX, null, false);

worked...

I'd like to know what are the different XXXXX type accepted by XOOPS (Else the INT,TXTBOX,TXTAREA,OTHER)

My problem is the following. When storing departement data, i can have to store : 01, 02, 03, 04, 05, 06, 07, 08, 09, 2A, 2B in database. Yet these always appear like this in database :
1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 2

Everything goes on well until storage in database (hidden vars are correct) So i guess it comes from the :
$this->initVar('dept', XOBJ_DTYPE_INT, 0, false);
Thing. But if i modify it, (putting TXTBOX, or OTHER) i get suddenly blank page out of xoops...

What must i do ???
Thanls for you help
Tdldp



5
tdldp
Re: [ PB V2 ] Adding user data to DB fields within activation key process
  • 2004/1/20 16:11

  • tdldp

  • Just popping in

  • Posts: 9

  • Since: 2002/3/13


UP it goes.... No one can give me an advice ??? i've been trying myself allday on code, and havent found solution yet ...

PLease devs, do answer my question on defining those Xobjtype... it could help me a bit....



6
tdldp
Re: [ PB V2 ] Adding user data to DB fields within activation key process
  • 2004/1/20 8:41

  • tdldp

  • Just popping in

  • Posts: 9

  • Since: 2002/3/13


i have managed to obtain partial success in my requirements....

Valide is updated correctly.... from 0 to 1...
Date is updated on DB, but wrong date is inserted
IP is updated on DB but only the first part of adress (xx.XX.XX.XX only xx is inserted)

I have placed variable controls in activate function, which provide me the right data, but this data is not inserted in Database correctly
script is now the following :

function activateUser(&$user)
{
if ($user->getVar('level') != 0) {
return true;
}
$user->setVar('level', 1);
$user->setVar('valide', 1);
$ip_text = getenv(REMOTE_ADDR);
$dateus = date("Y-m-d");
$heure = date("H:i:s");
$lejour = "$dateus "."$heure";
echo "Variable date :".$lejour;
echo "Variable ip :".$ip_text;
$user->setVar('date', $lejour);
$user->setVar('ip', $ip_text);
return $this->_uHandler->insert($user, true);
}


I am wondering if the problem doesn't come from he kernel/user.php definitions :

I use for ip and date :

$this->initVar('date', XOBJ_DTYPE_OTHER, 0, false);
$this->initVar('ip', XOBJ_DTYPE_TXTBOX, 0, false, 64);


and i wonder if these are the right ones...

By the way i have not found any documentation on these XOBJ_DTYPE_XXX things... In particular, what are the different types accepted, and what are their variables...

If any of you can bring me help, it would be grandly appreciated... And if devs could answer my XOBJ question, i'd appreciate...

Tdldp



7
tdldp
[ PB V2 ] Adding user data to DB fields within activation key process
  • 2004/1/19 10:57

  • tdldp

  • Just popping in

  • Posts: 9

  • Since: 2002/3/13


Hi all, i am meeting a problem using XOOPS for a future company site.

I wish at the activation stage (for memory, a mail has been sent to user, with an activation key link), that some data gets added to the xoops_user table in 3 fields.

I have noticed that in kernel/member.php, the activation process updates the "level" field, making it pass from 0 (not activated) to 1 (activated)
At this update, i wish that the following fields get updated invisibly for the user :
- date field, activated date in datetime format 0000-00-00 00:00:00
- ip field : ip adress at activation process
- valide field, value 1 in replacement of 0.

I have modified the validate function in kernel/member.php so that it looks like this :

Quote:

function activateUser(&$user)
{
$dateus = date("Y-m-d");
$heure = date("H:i:s");
$lejour = "$dateus "."$heure";
if ($user->getVar('level') != 0) {
return true;
}
$user->setVar('level', 1);

if ($user->getVar('valide') != 0) {
return true;
}
$user->setVar('valide', 1);

if ($user->getVar('date') != 0) {
return true;
}
$user->setVar('date', $lejour);

if ($user->getVar('ip') != 0) {
return true;
}
$user->setVar('ip', $REMOTE_ADDR);
return $this->_uHandler->insert($user, true);
}

And here is old file
Quote:

function activateUser(&$user)
{
if ($user->getVar('level') != 0) {
return true;
}
$user->setVar('level', 1);
return $this->_uHandler->insert($user, true);
}



Apparently it doesn't work and i can't see why.
For update security i also modified Kernel/user.php the function insert as follows :

Quote:

function insert(&$user, $force = false)
{
if (get_class($user) != 'xoopsuser') {
return false;
}
if (!$user->isDirty()) {
return true;
}
if (!$user->cleanVars()) {
return false;
}
foreach ($user->cleanVars as $k => $v) {
${$k} = $v;
}
// RMV-NOTIFY
// Added two fields, notify_method, notify_mode
if ($user->isNew()) {
$uid = $this->db->genId($this->db->prefix('users').'_uid_seq');
$sql = sprintf("INSERT INTO %s (uid, uname, name, email, url, user_avatar, user_regdate, user_icq, user_from, user_sig, user_viewemail, actkey, user_aim, user_yim, user_msnm, pass, posts, attachsig, rank, level, theme, timezone_offset, last_login, umode, uorder, notify_method, notify_mode, user_occ, bio, user_intrest, user_mailok, date, ip, prenom, dept, type, mailing, valide) VALUES (%u, %s, %s, %s, %s, %s, %u, %s, %s, %s, %u, %s, %s, %s, %s, %s, %u, %u, %u, %u, %s, %.2f, %u, %s, %u, %u, %u, %s, %s, %s, %u, %u, %u, %s, %u, %u, %u, %u)", $this->db->prefix('users'), $uid, $this->db->quoteString($uname), $this->db->quoteString($name), $this->db->quoteString($email), $this->db->quoteString($url), $this->db->quoteString($user_avatar), time(), $this->db->quoteString($user_icq), $this->db->quoteString($user_from), $this->db->quoteString($user_sig), $user_viewemail, $this->db->quoteString($actkey), $this->db->quoteString($user_aim), $this->db->quoteString($user_yim), $this->db->quoteString($user_msnm), $this->db->quoteString($pass), $posts, $attachsig, $rank, $level, $this->db->quoteString($theme), $timezone_offset, 0, $this->db->quoteString($umode), $uorder, $notify_method, $notify_mode, $this->db->quoteString($user_occ), $this->db->quoteString($bio), $this->db->quoteString($user_intrest), $user_mailok, $date, $ip, $this->db->quoteString($prenom), $dept, $type, $mailing, $valide);
} else {
$sql = sprintf("UPDATE %s SET uname = %s, name = %s, email = %s, url = %s, user_avatar = %s, user_icq = %s, user_from = %s, user_sig = %s, user_viewemail = %u, user_aim = %s, user_yim = %s, user_msnm = %s, posts = %d, pass = %s, attachsig = %u, rank = %u, level= %u, theme = %s, timezone_offset = %.2f, umode = %s, last_login = %u, uorder = %u, notify_method = %u, notify_mode = %u, user_occ = %s, bio = %s, user_intrest = %s, user_mailok = %u, date = %u, ip = %u, prenom = %s, dept = %u, type = %u, mailing = %u, valide = %u WHERE uid = %u", $this->db->prefix('users'), $this->db->quoteString($uname), $this->db->quoteString($name), $this->db->quoteString($email), $this->db->quoteString($url), $this->db->quoteString($user_avatar), $this->db->quoteString($user_icq), $this->db->quoteString($user_from), $this->db->quoteString($user_sig), $user_viewemail, $this->db->quoteString($user_aim), $this->db->quoteString($user_yim), $this->db->quoteString($user_msnm), $posts, $this->db->quoteString($pass), $attachsig, $rank, $level, $this->db->quoteString($theme), $timezone_offset, $this->db->quoteString($umode), $last_login, $uorder, $notify_method, $notify_mode, $this->db->quoteString($user_occ), $this->db->quoteString($bio), $this->db->quoteString($user_intrest), $user_mailok, $date, $ip, $this->db->quoteString($prenom), $dept, $type, $mailing, $valide, $uid);
}
if (false != $force) {
$result = $this->db->queryF($sql);
} else {
$result = $this->db->query($sql);
}
if (!$result) {
return false;
}
if (empty($uid)) {
$uid = $this->db->getInsertId();
}
$user->assignVar('uid', $uid);
return true;
}




I am not searching a full made solution, if people has an idea of the problem i am facing, any help will be appreciated

Thanks
Tdldp



8
tdldp
[RESOLVED] Kernel / User.php
  • 2004/1/16 8:51

  • tdldp

  • Just popping in

  • Posts: 9

  • Since: 2002/3/13


EDITED :

I managed to resolve my problem with help of the french community...
Sorry to have bothered...


Tdldp

PS : There really should be something done on the personnalisation of that register.php for further versions... I imagine how hard it must be for a complete novice who wishes to personnalise those forms, where to start from, where to go ... I have read that it is being implemented to version 2.6 but it won't be a luxury...



9
tdldp
Mailuser sending report not functioning
  • 2004/1/5 10:27

  • tdldp

  • Just popping in

  • Posts: 9

  • Since: 2002/3/13


Hi all, don't know if this is a bug or site related problem, that is why i submit this thread. I haven't found answer to my questions in the search zone.

Site on which is running xoops, has 1900 members, has been patiently upgraded from 1.3.5 to 2.0.3 first and today completely moved to 2.0.5.1

On using mailuser in admin/system, i have the following problem :

mail to user report is not functionning correctly.
When sending mail to Admins / Co-admins groups (2 groups selected) or when sending mails to members, i have the _mail_mailgood and _mail_pmgood message that appears normally but should also appear the username to whom mail or pm has been sent. Here is what i get in the admin / coadmins group select case (in french)
Quote:

e-mail envoyé à :
PM envoyé à :
e-mail envoyé à :
PM envoyé à :
e-mail envoyé à :
PM envoyé à :
e-mail envoyé à :
PM envoyé à :
e-mail envoyé à :
PM envoyé à :

In the class/xoopsmailer.php i have found the variables :
Quote:

if ( $this->isMail ) {
if ( !$this->sendMail($user->getVar("email"), $subject, $text, $headers) ) {
if ($debug) {
$this->errors[] = sprintf(_MAIL_SENDMAILNG, $user->getVar("uname"));
}
} else {
if ($debug) {
$this->success[] = sprintf(_MAIL_MAILGOOD, $user->getVar("uname"));
}
}
}
// send private message
if ( $this->isPM ) {
if ( !$this->sendPM($user->getVar("uid"), $subject, $text) ) {
if ($debug) {
$this->errors[] = sprintf(_MAIL_SENDPMNG, $user->getVar("uname"));
}
} else {
if ($debug) {
$this->success[] = sprintf(_MAIL_PMGOOD, $user->getVar("uname"));
}
}
}


which normally should bring up the username following the mailgood sentence...

Why is it not working ???
Is this a bug ???

Thanks for answer




TopTop



Login

Who's Online

241 user(s) are online (160 user(s) are browsing Support Forums)


Members: 0


Guests: 241


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits