A way in fiddler to replace a parameter before submiting the answer to the server - fiddler

I tried to write in the CustomRules.js in OnBeforeResponse method:
if(oSession.PathAndQuery.StartsWith("/feed/predata/1-1-"))
{
oSession["PathAndQuery"] = oSession.PathAndQuery.Replace("false","1");
}
The full PathAndQuery looks like that
/feed/predata/1-1-false-2.dat
When i try to save the file I get an error sound without a messagebox to show me where the error is.
I also tried this code:
oSession.PathAndQuery = oSession.PathAndQuery.Replace("false","1");
What is the correct way to perform this action?
Thanks in advance,
Oz.

If you're trying to change the request, you need to put your code in the OnBeforeRequest method.
Also,
oSession["PathAndQuery"]
doesn't do anything you want it to. Use this instead:
oSession.PathAndQuery = oSession.PathAndQuery.Replace("false","1");

Related

trying to access Thunderbird-tabmail does not work

I want to open a new tab with a gloda conversation from inside calendar code.
I receive an error from error console:
window not defined (or document not defined), depending on which of the two I use to Access tabmail:
let tabmail = window.document.getElementById("tabmail");
let tabmail = document.getElementById("tabmail");
The code works fine if the js file is included in an overlay xul-file.
But I want to use it outside of xul in my code.
Somewhere in my calendar code (in my 'addevent'), the same code throws the error.
This code is originally called from a rightclick on an email, but several layers deep into calendar code.
In MDN, I read that window is global? So what do I Need to do to add an tab?
This part works if tabmail is properly referenced:
tabmail.openTab("glodaList", {
collection: queryCollection,
message: aCollection.items[0],
title: tabTitle,
background: false
});
So how do I get a reference for tabmail?
Any help is appreciated.
after trying and looking through code for really some time before posting, it took only ca. 20 minutes to accidentally find the solution after submitting the question..
While browsing mailutils on mxr for something else, I found the solution in some function:
mail3PaneWindow = Services.wm.getMostRecentWindow("mail:3pane");
if (mail3PaneWindow) var tabmail = mail3PaneWindow.document.getElementById("tabmail");

Redirect to last page when overlay comment-form is used

I've got a view (phase4) with some custom content type content in it, where the users may comment on.
When the users want to comment, the comment form should appear in a modal form. I solved this by using the admin overlay.
Adding following function to my custom module:
function phase2_admin_paths_alter(&$paths) {
$paths['comment/reply/*'] = TRUE;
}
and using following link:
Comment
to open the comment form in a modal way. So far so good... but....
How do I redirect the user back to the page, the user was coming from.
I know that I have to overwrite the #action of the form in the template_form_FORMID_alter, like
$form['#action'] = $lasturl;
but how do I get the last url, so that it is reusable (so hardcoding the url isn't an option)?
My first idea was that I transfer the last url by adding it to the url as a $_GET-parameter, but it looks like this:
www.example.com/phase4#overlay=comment/reply/161%3Furl%3Dphase4
I also tried it with drupal_get_destination(), but either with no success, because of the tranformation of the "?" and the "=" in the url.
Are there other ways to find out where the user was coming from?
Note: phase4 isn't the alias of node 161. Phase 4 is a view, where node 161 is an element of.
Cheers
Tom
You have to use the drupal_get_destination() function with l() function to create such links.
$destination = drupal_get_destination(); // Store current path
Comment

can any one tell me how to access my parsed xml object

i have this parsed object
$xmlObj = new SimpleXMLElement($XMLToParse, LIBXML_DOTTED_VERSION, FALSE, "http://SOME/schema/universal_v17_0");
that has the stucture like this inside it
<universal:UniversalR LocatorCode="somecode" Version="2" Status="Active">
<common_v17_0:Book Key="some" TravelerType="some">
so i can access the first element(its attributes) like this $VariableX=$xmlObj->UniversalR->attributes();//then $VariableX["Status"];
but when i want access his child i cant $tm=$xmlObj->UniversalR->Book->attributes();
it doesnt want to enter probably because of the different namespace...can any one help me . THX
I found something here http://blog.sherifmansour.com/?p=302
foreach ($xmlObj->UniversalRecord as $entry){
$namespaces = $entry->getNameSpaces(true);
$cmm = $entry->->children($namespaces['common_v17_0']);
$aa=$cmm->Book->attributes();
echo $aa["TravelerType"]."ddddd";
}
That should do it :)
$tm=$xmlObj->UniversalRecord->Book->attributes(); is this typo (UniversalRecord instead of UniversalR) only present in this post or is it also present in your code?
(I'd have liked to post this as a comment.. but it looks like i'm not allowed to, or am too stupid to find the button. :/)

Which file contains function of core/session in magento?

I need to customize other's code,
so I found they used
Mage::getSingleton('core/session')->getMyCustomBlockInfo();
in Order.php file for custom order email
so I can't find this function getMyCustomBlockInfo();
Can anyone tell me where this function reside?
Thanks
those are magic functions get() and set() and you are asking a session variable there that is set as
Mage::getSingleton('core/session')->setMyCustomBlockInfo();
somewhere in your code. If you use terminal you can easily find by making a following grep:
grep '>setMyCustomBlockInfo(' . -rsni
and it will list the files where your variable is set to session.
example :
Mage::getModel('catalog/product'); //or
Mage::getSingleton('catalog/product');
the code must be in '../app/core/Mage/Catalog/Model/Product.php' file
then
Mage::getSingleton('core/session');
the code must be in '../app/core/Mage/Core/Model/Session.php' file
because the class Mage_Core_Model_Session's parent::parent is Varien_Object, then you can do all magic functions and you can ->getData() to see the Data inside.
Mage::getSingleton('core/session')->getData();
on your problem when go call ->getData() you can see data : [my_custom_block_info]
you can set it with call
Mage::getSingleton('core/session')->setMyCustomBlockInfo('what');
Mage::getSingleton('core/session')->getMyCustomBlockInfo();
// will return 'what'

Zend Framework - ZFDebug - Log - Log Custom Errors

When using ZFDebug, is it possible to add custom messages to the 'Log' tab?
So you could use something like:
$this->log('Error: Couldn't find the user');
Has anyone managed to achieve this?
I have never used ZFDebug before and wasn't aware of it. Your post piqued my interest, so I installed it and have been trying to achieve what you want to do. I will probably add it to my dev toolbox as I use ZF a lot.
You can achieve what you want by using the mark() method of ZFDebug_Controller_Plugin_Debug_Plugin_Log which takes two arguments. The first is the message you want to send and the second is a boolean which, when set to true (default is false), will send your message to the 'log' tab.
The following code worked for me:-
$debug = Zend_Controller_Front::getInstance()
->getPlugin('ZFDebug_Controller_Plugin_Debug');
$logger = $debug->getPlugin('log');
$logger->mark('Logging a message now', true);
Or to use your example (with the syntax error fixed :) )
$logger->mark("Error: Couldn't find the user", true);
As you can see this produced the desired output:-
Not quite as simple as you wanted, I know, but it's close and you could always wrap it in a function.