SH404 for SetRedirect url from controller in joomla - joomla1.5

I am writing a custom sh404 file for a custom component in joomla. I have written some of the redirecting urls by using setRedirect function. But it is not redirecting to SH404 URL.
What I have given is:
$link = JURI::base().'index.php?option=com_camassistant&controller=rfp&task=editrfp&var=copy&rfpid='.$insert_id.'&Itemid='.$_REQUEST['Itemid'] ;
$this->setRedirect( $link,$msg );
Can you please say how can I give $link to change SH404 automatically?
Thanks in advance
Sateesh

I didn't get it properly.
If you do something like:
JError::raiseError(404, 'Not Found');

Related

Integrate solvemedia captcha using perl

I would like to know how do I insert solvemedia captcha with my script. I did install the module from their site (https://portal.solvemedia.com/media/download/WWW-SolveMedia-1.1.tar.gz) but don't know where to add this (their instructions):
Once the plugin is installed, you can start making calls to the Solve Media API.
Display the Widget
To display the Solve Media widget on one of your forms, instantiate the SolveMedia class, supplying it with your API keys. Then call the get_html function. You can find your API keys at My account:
use WWW::SolveMedia;
my $c = WWW::SolveMedia->new( 'my challenge key',
'my verification key',
'my hash key' );
# output widget
print $c->get_html();
Process Answer
You can check the user's response by calling SolveMedia.check_answer(...).
# check answer
my $result = $c->check_answer( $ENV{REMOTE_ADDR}, $challenge, $response );
if( $result->{is_valid} ){
print "Yay!";
}else{
print "Dang it :-(\n";
print "Error: ".$result->{error};
}
And this is where I get stuck, cos I don't have a clue how/where to insert that code. If anyone of you is willing to help, please respond. I'm willing to pay a few bucks.
You create the new object, and either save the results of get_html into a variable which you then stick into some web page, or you print it inline.
You put the Perl code in the subroutines that generate the pages that you want the captcha to appear.
and you put the call to process in the code that process the submission of the form on the page that you printed the captcha into.

Drupal 7, form submit: Display result of a query?

Using the form api, I'm to display the result of some processing after a post is sent by a form.
So I implement the module_name_submit(...) method:
function cmis_views_block_view($delta = '') {
$cmisview = cmis_views_load($delta);
$block['content'] = cmis_views_info($cmisview);
return $block;
}
The processing is very simple. The call happens properly and I would like to display the $block on screen.
Returning this doesn't help. Maybe a redirect could help, but I'm looking first for something equivalent to drupal_set_message() but that dispays html in the page.
Any leads welcome :-)
Thanks,
J.
You probably need to use $form_state['redirect']
Put the content in a session variable, redirect to that page and have a custom block output that specific variable in the $content

Codeigniter - How to get and change uri segement then redirect?

In my web application I have a url that looks like the following:
http://mydomain.com/search/index/list/for-sale/london/0/0/0/0
I would like to use the uri class and redirect to change $this->uri->segment(3); to map and then redirect.
So that once redirected and the segment has been changed the url would look like:
/search/index/map/for-sale/london/0/0/0/0
How would I go about doing this?
It may need some extra checks, but this would be a simple approach:
$segment_to_replace = "/".$this->uri->segment(3)."/";
$new_url = str_replace ($segment_to_replace, "/map/", current_url());
redirect ($new_url);

How can I check my post data in Zend?

I am a beginner and I am creating some forms to be posted into MySQL using Zend, and I am in the process of debugging but I don't really know how to debug anything using Zend. I want to submit the form and see if my custom forms are concatenating the data properly before it goes into MySQL, so I want to catch the post data to see a few things. How can I do this?
The Default route for zend framework application looks like the following
http://www.name.tld/$controller/$action/$param1/$value1/.../$paramX/$valueX
So all $_GET-Parameters simply get contenated onto the url in the above manner /param/value
Let's say you are within IndexController and indexAction() in here you call a form. Now there's possible two things happening:
You do not define a Form-Action, then you will send the form back to IndexController:indexAction()
You define a Form action via $form->setAction('/index/process') in that case you would end up at IndexController:processAction()
The way to access the Params is already defined above. Whereas $this->_getParam() equals $this->getRequest()->getParam() and $this->_getAllParams() equals $this->getRequest->getParams()
The right way yo check data of Zend Stuff is using Zend_Debug as #vascowhite has pointed out. If you want to see the final Query-String (in case you're manually building queries), then you can simply put in the insert variable into Zend_Debug::dump()
you can use $this->_getAllParams();.
For example: var_dump($this->_getAllParams()); die; will output all the parameters ZF received and halt the execution of the script. To be used in your receiving Action.
Also, $this->_getParam("param name"); will get a specific parameter from the request.
The easiest way to check variables in Zend Framework is to use Zend_Debug::dump($variable); so you can do this:-
Zend_Debug::dump($_POST);
Zend framework is built on the top of the PHP . so you can use var_dump($_POST) to check the post variables.
ZF has provided its own functions to get all the post variables.. Zend_Debug::dump($this->getRequest()->getPost())
or specifically for one variable.. you can use Zend_Debug::dump($this->getRequest()->getPost($key))
You can check post data by using zend
$request->isPost()
and for retrieving post data
$request->getPost()
For example
if ($request->isPost()) {
$postData = $request->getPost();
Zend_Debug::dump($postData );
}

Redirect with Mason 1.0

I am using Mason 1.0 and want to redirect the page to another URL.
Is there any way to redirect?
Alternatively...
I have written following code in dbhandler which is giving error, stating that $r is undefined. Can you please help.
$r->method('GET');
$r->headers_in->unset('Content-length');
$r->content_type('text/html');
$r->header_out('Location' => $newPageURL);
$m->abort(301);
I cannot use $m->redirect as it is not avalible to me.
I am referring to this link http://www.masonhq.com/htmlmason/wiki/FAQ:HTTPAndHTML on the section "How do I do an external redirect?"
$r->status(302);
$r->headers_out()->add("Location", "http://google.com");
return 302;
Looks like $m->clear_buffer is missing before your first call.
It's required so it wipes out any response generated before you reach your redirection.