Editing entry in ecto changes dates

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
electroteque
Regular
Posts: 58
Joined: Tue Jan 17, 2006 2:13 am

Editing entry in ecto changes dates

Post by electroteque »

Hi there, using ecto and editing entries is still fucking up the dates, even upon changing the date in the edit window, once i click publish the current date is still being used,

this is being sent as

<member>
<name>dateCreated</name>
<value><dateTime.iso8601>20060326T09:06:03Z</dateTime.iso8601></value>
</member>


this is in the response code

<member><name>dateCreated</name>
<value><dateTime.iso8601>20060327T00:12:03</dateTime.iso8601></value>
</member>

Can someone please fix this reoccuring bug ?

Alos this happens when it tries to set the post category

<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>mt.setPostCategories</methodName>
<params>
<param>
<value><string>53</string></value>
</param>
<param>
<value><string>admin</string></value>
</param>
<param>
<value><string>******</string></value>
</param>
<param>
<value><array><data>
<value><struct>
<member>
<name>categoryId</name>
<value><string>1</string></value>
</member>
<member>
<name>isPrimary</name>
<value><boolean>1</boolean></value>
</member>
</struct></value>
<value><struct>
<member>
<name>categoryId</name>
<value><string>5</string></value>
</member>
<member>
<name>isPrimary</name>
<value><boolean>0</boolean></value>
</member>
</struct></value>
</data></array></value>
</param>
</params>
</methodCall>

Response:
<br />
<b>Warning</b>: mysql_real_escape_string() expects parameter 1 to be string, array given in <b>/Volumes/FIREWIRE/www/dev/weblog/include/db/mysql.inc.php</b> on line <b>203</b><br />
<br />
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at /Volumes/FIREWIRE/www/dev/weblog/include/db/mysql.inc.php:203) in <b>/Volumes/FIREWIRE/www/dev/weblog/plugins/serendipity_event_xmlrpc/PEAR/XML/RPC/Server.php</b> on line <b>398</b><br />
<br />
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at /Volumes/FIREWIRE/www/dev/weblog/include/db/mysql.inc.php:203) in <b>/Volumes/FIREWIRE/www/dev/weblog/plugins/serendipity_event_xmlrpc/PEAR/XML/RPC/Server.php</b> on line <b>398</b><br />
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Editing entry in ecto changes dates

Post by garvinhicking »

Hi!

Would you be able to tell me the full request and response markup? Because I actually don't know where this could happen; we use the central XML_RPC_iso8601_encode() method to deal with timestamps. And actually I can see no code where serendipity touches the timestamp after entry creation...?

About the issue of category setting, thanks for your request snippet. I'll try to debug that and report back. I'm currently having a flu, so I'll check with that later this week.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
electroteque
Regular
Posts: 58
Joined: Tue Jan 17, 2006 2:13 am

Post by electroteque »

Ok, ill try and var dump what gets sent, it should hopefully display in ecto's console ?? Or do you want me to send you the request and response xml ?
electroteque
Regular
Posts: 58
Joined: Tue Jan 17, 2006 2:13 am

Post by electroteque »

Fatal error: Smarty error: [in file:/www/dev/weblog/templates/default/entries.tpl line 20]: [plugin] (secure mode) modifier 'escape' is not allowed (core.load_plugins.php, line 118) in /Volumes/FIREWIRE/www/classes/PEAR/Smarty/libs/Smarty.class.php on line 1095

Garvin it looks like I am trapped using the bundled libs, i install what was required and all my libs are up to date. Is there no other way to use my default pear library ?
electroteque
Regular
Posts: 58
Joined: Tue Jan 17, 2006 2:13 am

Post by electroteque »

Fatal error: Smarty error: [in file:/www/dev/weblog/templates/default/entries.tpl line 20]: [plugin] (secure mode) modifier 'escape' is not allowed (core.load_plugins.php, line 118) in /Volumes/FIREWIRE/www/classes/PEAR/Smarty/libs/Smarty.class.php on line 1095

Garvin it looks like I am trapped using the bundled libs, i install what was required and all my libs are up to date. Is there no other way to use my default pear library ?
electroteque
Regular
Posts: 58
Joined: Tue Jan 17, 2006 2:13 am

Post by electroteque »

Ok here is the array key for what ecto sends as the timestamp

["dateCreated"]=>
string(18) "20060326T14:53:00Z"

Now looking in the updertEntry function

if (!is_numeric($entry['timestamp'])) {
$entry['timestamp'] = time();
}

as there is no timestamp key its always adding the current time !
electroteque
Regular
Posts: 58
Joined: Tue Jan 17, 2006 2:13 am

Post by electroteque »

I fixed the timestamp in the backend, ecto is now sending the right timestamp

["timestamp"]=>
string(10) "1143367612"

I echoes the update string it returns timestamp='1143367612'

Timestamp still gets updated to 1143414240

Here is the return array

["timestamp"]=>
string(10) "1143415733"

To prevent this warning

<b>Warning</b>: mysql_real_escape_string() expects parameter 1 to be string, array given in <b>/Volumes/FIREWIRE/www/dev/weblog/include/db/mysql.inc.php</b> on line <b>203</b><br />

function serendipity_db_escape_string($string) {
global $serendipity;

if (!is_array($string)) {
if (is_resource($serendipity['dbConn']) && function_exists('mysql_real_escape_string')) {
return mysql_real_escape_string($string, $serendipity['dbConn']);
} else {
return mysql_escape_string($string);
}
}
}
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Thanks, I'll look into this once I get better.

The modifier problem smarty tells you can happen if you did not extract all plugins of the smarty directory and the escape plugin cannot be found in the smarty dir

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
electroteque
Regular
Posts: 58
Joined: Tue Jan 17, 2006 2:13 am

Post by electroteque »

Hi I moved over the bundled smarty library to my pear directory and still the same or similar problem

Fatal error: Smarty error: [in file:/www/dev/weblog/templates/default/entries.tpl line 20]: [plugin] (secure mode) modifier 'escape' is not allowed (core.load_plugins.php, line 118) in /Volumes/FIREWIRE/www/classes/PEAR/Smarty/libs/Smarty.class.php on line 1088
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Maybe include/functions_smarty.inc.php, serendipity_smarty_init() looks for smarty still in bundled directory not in PEAR, because Smarty is not PEAR. Maybe it sets paths different than to PEAR and thus does not find it.

Just a few ideas. As I mentioned, I'm not able to investigate this unless I get a bit better here :)
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
electroteque
Regular
Posts: 58
Joined: Tue Jan 17, 2006 2:13 am

Post by electroteque »

Umm its using the include path to my pear directory isnt it ? Its the default include path, it happens to be that so ive put Smarty in there, so obviouslly this use pear setting doesnt work ? What am i suppose to do, does it mean the plugins will use my pear directory instead ?
electroteque
Regular
Posts: 58
Joined: Tue Jan 17, 2006 2:13 am

Post by electroteque »

Thats incorrect

@define('SMARTY_DIR', S9Y_PEAR_PATH . 'Smarty/libs/');
require_once SMARTY_DIR . 'Smarty.class.php';
die(SMARTY_DIR . 'Smarty.class.php');

Smarty/libs/Smarty.class.php

Im loading the bundled smarty library from my default include path as when u turn the use pear config on it doesnt set the S9Y_PEAR_PATH constant, thats what it seems to do here, something else it happening here.
electroteque
Regular
Posts: 58
Joined: Tue Jan 17, 2006 2:13 am

Post by electroteque »

Its got something to do with an escape modifier , i dont know smarty, i use pear flexy so dont understand this.
electroteque
Regular
Posts: 58
Joined: Tue Jan 17, 2006 2:13 am

Post by electroteque »

example

{$entry_category.category_name|@escape}

says its not implemented ?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Check if Smarty/libs/plugins/modifier.escape.php exists, is fully readable and has no PHP parse errors
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply