zikula / core

Zikula Core Framework
GNU Lesser General Public License v3.0
237 stars 66 forks source link

Undefinedajax.php not found error #576

Closed phaidon closed 11 years ago

phaidon commented 11 years ago

http://community.zikula.org/module-Forum-viewtopic-topic-59329-start-0.htm

It would be great if could fix this and release a new 1.2.x version.

phaidon commented 11 years ago

@drak

I create a new version where can I upload it? There is no 1.2 branch.

ghost commented 11 years ago

I would prefer to release a patch file rather than a new version. 1.2.x is EOL and not available officially for download anymore. If you can make a patch file patching the affected files, then we can put that up officially for download.

phaidon commented 11 years ago

The patch is made. Can I upload it somewhere?

ghost commented 11 years ago

Mail me it, I'll get it onto the right server.

phaidon commented 11 years ago

I already did. Here the code again:

diff -r 129/docs/CHANGELOG 1210/docs/CHANGELOG
0a1,4
> CHANGELOG - ZIKULA 1.2.10
> ------------------------
> Google Chrome 23 javascript document.location vars problem fixed.
> 
diff -r 129/includes/pnAPI.php 1210/includes/pnAPI.php
17c17
< define('PN_VERSION_NUM', '1.2.9');
---
> define('PN_VERSION_NUM', '1.2.10');
diff -r 129/install/functions.php 1210/install/functions.php
19c19
<     define('_PNINSTALLVER', '1.2.9');
---
>     define('_PNINSTALLVER', '1.2.10');
diff -r 129/install/sql/Zikula-mysql.sql 1210/install/sql/Zikula-mysql.sql
593c593
< INSERT INTO `z_module_vars` VALUES (79,'/PNConfig','Version_Num','s:5:\"1.2.9\";');
---
> INSERT INTO `z_module_vars` VALUES (79,'/PNConfig','Version_Num','s:6:\"1.2.10\";');
639c639
< INSERT INTO `z_module_vars` VALUES (125,'/PNConfig','updateversion','s:5:\"1.2.9\";');
---
> INSERT INTO `z_module_vars` VALUES (125,'/PNConfig','updateversion','s:6:\"1.2.10\";');
diff -r 129/javascript/ajax/pnajax.js 1210/javascript/ajax/pnajax.js
141c141
<             (typeof(document.location.ajaxtimeout)!='undefined' && document.location.ajaxtimeout!=0)  ? document.location.ajaxtimeout : 5000 // per default five seconds - can be changed in the settings
---
>             (typeof(Zikula.Config.ajaxtimeout)!='undefined' && Zikula.Config.ajaxtimeout!=0)  ? Zikula.Config.ajaxtimeout : 5000 // per default five seconds - can be changed in the settings
diff -r 129/modules/Profile/pnjavascript/profile.js 1210/modules/Profile/pnjavascript/profile.js
68c68
<         document.location.pnbaseURL+'ajax.php', 
---
>         Zikula.Config.baseURL+'ajax.php', 
110c110
<         document.location.pnbaseURL+'ajax.php', 
---
>         Zikula.Config.baseURL+'ajax.php', 
diff -r 129/modules/Profile/pnjavascript/showavatar.js 1210/modules/Profile/pnjavascript/showavatar.js
15c15
<         $('youravatardisplay').src = document.location.pnbaseURL + $('youravatarpath').innerHTML + '/' + $('prop_avatar').options[$('prop_avatar').selectedIndex].value;
---
>         $('youravatardisplay').src = Zikula.Config.baseURL + $('youravatarpath').innerHTML + '/' + $('prop_avatar').options[$('prop_avatar').selectedIndex].value;
diff -r 129/system/PageLock/pnjavascript/pagelock.js 1210/system/PageLock/pnjavascript/pagelock.js
59c59
<       document.location.pnbaseURL + "ajax.php",
---
>       Zikula.Config.baseURL + "ajax.php",
94c94
<       document.location.pnbaseURL + "ajax.php",
---
>       Zikula.Config.baseURL + "ajax.php",
diff -r 129/system/Permissions/pnjavascript/permissions.js 1210/system/Permissions/pnjavascript/permissions.js
20c20
<     window.open (document.location.entrypoint + "?module=Permissions&type=admin&func=viewinstanceinfo",
---
>     window.open (Zikula.Config.entrypoint + "?module=Permissions&type=admin&func=viewinstanceinfo",
diff -r 129/system/Permissions/pntemplates/componentinstance.js 1210/system/Permissions/pntemplates/componentinstance.js
4c4
<     window.open (document.location.entrypoint + "?module=Permissions&type=admin&func=viewinstanceinfo",
---
>     window.open (Zikula.Config.entrypoint + "?module=Permissions&type=admin&func=viewinstanceinfo",
diff -r 129/system/Theme/plugins/outputfilter.pagevars.php 1210/system/Theme/plugins/outputfilter.pagevars.php
117,118c117,118
<         // document.location.entrypoint: will be set to what is configured to be the entrypoint
<         // document.location.pnbaseURL: will point to the result of pnGetBaseURL();
---
>         // Zikula.Config.entrypoint: will be set to what is configured to be the entrypoint
>         // Zikula.Config.baseURL: will point to the result of pnGetBaseURL();
123c123
<         $return .= '/* <![CDATA[ */ document.location.entrypoint="' . pnConfigGetVar('entrypoint', 'index.php') . '"; document.location.pnbaseURL="' . pnGetBaseURL(). '"; ';
---
>         $return .= '/* <![CDATA[ */ var Zikula = {};Zikula.Config ={};Zikula.Config.entrypoint="' . pnConfigGetVar('entrypoint', 'index.php') . '"; Zikula.Config.pnbaseURL="' . pnGetBaseURL() . '";document.location.entrypoint=Zikula.Config.entrypoint; document.location.pnbaseURL=Zikula.Config.pnbaseURL; ';
127c127,128
<             $return .= 'document.location.ajaxtimeout=' . (int) DataUtil::formatForDisplay($ajaxtimeout). ';';
---
>             $return .= 'Zikula.Config.ajaxtimeout=' . (int) DataUtil::formatForDisplay($ajaxtimeout). ';';
>             $return .= 'document.location.ajaxtimeout=Zikula.Config.ajaxtimeout;';
diff -r 129/system/Theme/plugins/outputfilter.pagevars_notcombined.php 1210/system/Theme/plugins/outputfilter.pagevars_notcombined.php
82,83c82,83
<         // document.location.entrypoint: will be set to what is configured to be the entrypoint
<         // document.location.pnbaseURL: will point to the result of pnGetBaseURL();
---
>         // Zikula.Config.entrypoint: will be set to what is configured to be the entrypoint
>         // Zikula.Config.pnbaseURL: will point to the result of pnGetBaseURL();
88c88
<         $return .= '/* <![CDATA[ */ document.location.entrypoint="' . pnConfigGetVar('entrypoint', 'index.php') . '"; document.location.pnbaseURL="' . pnGetBaseURL() . '"; ';
---
>         $return .= '/* <![CDATA[ */ var Zikula = {};Zikula.Config ={};Zikula.Config.entrypoint="' . pnConfigGetVar('entrypoint', 'index.php') . '"; Zikula.Config.pnbaseURL="' . pnGetBaseURL() . '";document.location.entrypoint=Zikula.Config.entrypoint; document.location.pnbaseURL=Zikula.Config.pnbaseURL; ';
92c92,93
<             $return .= 'document.location.ajaxtimeout=' . (int) DataUtil::formatForDisplay($ajaxtimeout) . ';';
---
>             $return .= 'Zikula.Config.ajaxtimeout=' . (int) DataUtil::formatForDisplay($ajaxtimeout) . ';';
>             $return .= 'document.location.ajaxtimeout=Zikula.Config.ajaxtimeout;';
diff -r 129/system/Users/pnjavascript/users.js 1210/system/Users/pnjavascript/users.js
23c23
<         document.location.pnbaseURL + "ajax.php",
---
>         Zikula.Config.baseURL + "ajax.php",
158,160c158,160
<     Event.observe('modifyuser', 'click', function() { window.location.href=document.location.entrypoint + "?module=Users&type=admin&func=modify&uname=" + $F('username');}, false);
<     Event.observe('deleteuser', 'click', function() { window.location.href=document.location.entrypoint + "?module=Users&type=admin&func=deleteusers&uname=" + $F('username');}, false);
<     new Ajax.Autocompleter('username', 'username_choices', document.location.pnbaseURL + 'ajax.php?module=Users&func=getusers',
---
>     Event.observe('modifyuser', 'click', function() { window.location.href=Zikula.Config.entrypoint + "?module=Users&type=admin&func=modify&uname=" + $F('username');}, false);
>     Event.observe('deleteuser', 'click', function() { window.location.href=Zikula.Config.entrypoint + "?module=Users&type=admin&func=deleteusers&uname=" + $F('username');}, false);
>     new Ajax.Autocompleter('username', 'username_choices', document.Zikula.Config.baseURL + 'ajax.php?module=Users&func=getusers',
164,165c164,165
<                                 Event.observe('modifyuser', 'click', function() { window.location.href=document.location.entrypoint + "?module=Users&type=admin&func=modify&userid=" + $($(data).value).value;}, false);
<                                 Event.observe('deleteuser', 'click', function() { window.location.href=document.location.entrypoint + "?module=Users&type=admin&func=deleteusers&userid=" + $($(data).value).value;}, false);
---
>                                 Event.observe('modifyuser', 'click', function() { window.location.href=Zikula.Config.entrypoint + "?module=Users&type=admin&func=modify&userid=" + $($(data).value).value;}, false);
>                                 Event.observe('deleteuser', 'click', function() { window.location.href=Zikula.Config.entrypoint + "?module=Users&type=admin&func=deleteusers&userid=" + $($(data).value).value;}, false);
diff -r 129/upgrade.php 1210/upgrade.php
34c34
< define('_PNINSTALLVER', '1.2.9');
---
> define('_PNINSTALLVER', '1.2.10');
espaan commented 11 years ago

A followup on this would also be great. There are several forum topics where people have issues with Chrome not being able to use their existing websites based on 1.2.x. And a news article with the explanation and hte link to the patch once it is there would be very nice.

phaidon commented 11 years ago

And the problem is that the renaming to Undefinedajax.php does not solve the problem. Then the ajaxtimeout does not work correctly, like you can see on community.zikula.org

espaan commented 11 years ago

uhm yes ? I can't exactly follow what it means. Does the patch work or are there still problems?

phaidon commented 11 years ago

uhm yes ? I can't exactly follow what it means.

If you just rename ajax.php the path variable will work again. But the ajaxtimeout and entrypoint variable, which is used by several ajax functions, will stay undefined in chrome. The only solution which make all ajax vars available is to change the name of the variable (document.location.ajaxtimeout -> Zikula.Config.ajaxtimeout, ...)

Does the patch work or are there still problems?

Yes and it is bc. BC means in this case that modules without renamed document.location variables, will still work in firefox.

In addition to the patch you have to rename the document.location variables in your modules:

document.location.entrypoint => Zikula.Config.entrypoint document.location.ajaxtimeout => Zikula.Config.ajaxtimeout document.location.pnbaseURL => Zikula.Config.pnbaseURL

phaidon commented 11 years ago

There is now an unofficial fork: https://github.com/espaan/zikula12x