CRM-10693 - change PRINT_JSON constant from '6' to 'json' for readability
[civicrm-core.git] / CRM / Core / Controller.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.4 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27
28 /**
29 * This class acts as our base controller class and adds additional
30 * functionality and smarts to the base QFC. Specifically we create
31 * our own action classes and handle the transitions ourselves by
32 * simulating a state machine. We also create direct jump links to any
33 * page that can be used universally.
34 *
35 * This concept has been discussed on the PEAR list and the QFC FAQ
36 * goes into a few details. Please check
37 * http://pear.php.net/manual/en/package.html.html-quickform-controller.faq.php
38 * for other useful tips and suggestions
39 *
40 * @package CRM
41 * @copyright CiviCRM LLC (c) 2004-2013
42 * $Id$
43 *
44 */
45
46 require_once 'HTML/QuickForm/Controller.php';
47 require_once 'HTML/QuickForm/Action/Direct.php';
48
49 class CRM_Core_Controller extends HTML_QuickForm_Controller {
50
51 /**
52 * the title associated with this controller
53 *
54 * @var string
55 */
56 protected $_title;
57
58 /**
59 * The key associated with this controller
60 *
61 * @var string
62 */
63 public $_key;
64
65 /**
66 * the name of the session scope where values are stored
67 *
68 * @var object
69 */
70 protected $_scope;
71
72 /**
73 * the state machine associated with this controller
74 *
75 * @var object
76 */
77 protected $_stateMachine;
78
79 /**
80 * Is this object being embedded in another object. If
81 * so the display routine needs to not do any work. (The
82 * parent object takes care of the display)
83 *
84 * @var boolean
85 */
86 protected $_embedded = FALSE;
87
88 /**
89 * After entire form execution complete,
90 * do we want to skip control redirection.
91 * Default - It get redirect to user context.
92 *
93 * Useful when we run form in non civicrm context
94 * and we need to transfer control back.(eg. drupal)
95 *
96 * @var boolean
97 */
98 protected $_skipRedirection = FALSE;
99
100 /**
101 * Are we in print mode? if so we need to modify the display
102 * functionality to do a minimal display :)
103 *
104 * @var boolean
105 */
106 public $_print = 0;
107
108 /**
109 * Should we generate a qfKey, true by default
110 *
111 * @var boolean
112 */
113 public $_generateQFKey = TRUE;
114
115 /**
116 * QF response type
117 */
118 public $_QFResponseType = 'html';
119
120 /**
121 * cache the smarty template for efficiency reasons
122 *
123 * @var CRM_Core_Smarty
124 */
125 static protected $_template;
126
127 /**
128 * cache the session for efficiency reasons
129 *
130 * @var CRM_Core_Session
131 */
132 static protected $_session;
133
134 /**
135 * The parent of this form if embedded
136 *
137 * @var object
138 */
139 protected $_parent = NULL;
140
141 /**
142 * The destination if set will override the destination the code wants to send it to
143 *
144 * @var string;
145 */
146 public $_destination = NULL;
147
148 /**
149 * The entry url for a top level form or wizard. Typically the URL with a reset=1
150 * used to redirect back to when we land into some session wierdness
151 *
152 * @var string
153 */
154 public $_entryURL = NULL;
155
156 /**
157 * All CRM single or multi page pages should inherit from this class.
158 *
159 * @param string title descriptive title of the controller
160 * @param boolean whether controller is modal
161 * @param string scope name of session if we want unique scope, used only by Controller_Simple
162 * @param boolean addSequence should we add a unique sequence number to the end of the key
163 * @param boolean ignoreKey should we not set a qfKey for this controller (for standalone forms)
164 *
165 * @access public
166 *
167 * @return void
168 *
169 */
170 function __construct(
171 $title = NULL,
172 $modal = TRUE,
173 $mode = NULL,
174 $scope = NULL,
175 $addSequence = FALSE,
176 $ignoreKey = FALSE
177 ) {
178 // this has to true for multiple tab session fix
179 $addSequence = TRUE;
180
181 // let the constructor initialize this, should happen only once
182 if (!isset(self::$_template)) {
183 self::$_template = CRM_Core_Smarty::singleton();
184 self::$_session = CRM_Core_Session::singleton();
185 }
186
187 // lets try to get it from the session and/or the request vars
188 // we do this early on in case there is a fatal error in retrieving the
189 // key and/or session
190 $this->_entryURL = CRM_Utils_Request::retrieve(
191 'entryURL',
192 'String',
193 $this,
194 FALSE,
195 NULL,
196 $_REQUEST
197 );
198
199 // add a unique validable key to the name
200 $name = CRM_Utils_System::getClassName($this);
201 if ($name == 'CRM_Core_Controller_Simple' && !empty($scope)) {
202 // use form name if we have, since its a lot better and
203 // definitely different for different forms
204 $name = $scope;
205 }
206 $name = $name . '_' . $this->key($name, $addSequence, $ignoreKey);
207 $this->_title = $title;
208 if ($scope) {
209 $this->_scope = $scope;
210 }
211 else {
212 $this->_scope = CRM_Utils_System::getClassName($this);
213 }
214 $this->_scope = $this->_scope . '_' . $this->_key;
215
216 // only use the civicrm cache if we have a valid key
217 // else we clash with other users CRM-7059
218 if (!empty($this->_key)) {
219 CRM_Core_Session::registerAndRetrieveSessionObjects(array(
220 "_{$name}_container",
221 array('CiviCRM', $this->_scope),
222 ));
223 }
224
225 $this->HTML_QuickForm_Controller($name, $modal);
226
227 $snippet = CRM_Utils_Array::value('snippet', $_REQUEST);
228 if ($snippet) {
229 if ($snippet == 3) {
230 $this->_print = CRM_Core_Smarty::PRINT_PDF;
231 }
232 elseif ($snippet == 4) {
233 // this is used to embed fragments of a form
234 $this->_print = CRM_Core_Smarty::PRINT_NOFORM;
235 self::$_template->assign('suppressForm', TRUE);
236 $this->_generateQFKey = FALSE;
237 }
238 elseif ($snippet == 5) {
239 // this is used for popups and inlined ajax forms
240 // also used for the various tabs via TabHeader
241 $this->_print = CRM_Core_Smarty::PRINT_NOFORM;
242 }
243 // Respond with JSON if in AJAX context (also support legacy value '6')
244 elseif (in_array($snippet, array(CRM_Core_Smarty::PRINT_JSON, 6))) {
245 $this->_print = CRM_Core_Smarty::PRINT_JSON;
246 $this->_QFResponseType = 'json';
247 }
248 else {
249 $this->_print = CRM_Core_Smarty::PRINT_SNIPPET;
250 }
251 }
252
253 // if the request has a reset value, initialize the controller session
254 if (CRM_Utils_Array::value('reset', $_GET)) {
255 $this->reset();
256
257 // in this case we'll also cache the url as a hidden form variable, this allows us to
258 // redirect in case the session has disappeared on us
259 $this->_entryURL = CRM_Utils_System::makeURL(NULL, TRUE, FALSE, NULL, TRUE);
260 $this->set('entryURL', $this->_entryURL);
261 }
262
263 // set the key in the session
264 // do this at the end so we have initialized the object
265 // and created the scope etc
266 $this->set('qfKey', $this->_key);
267
268
269 // also retrieve and store destination in session
270 $this->_destination = CRM_Utils_Request::retrieve(
271 'civicrmDestination',
272 'String',
273 $this,
274 FALSE,
275 NULL,
276 $_REQUEST
277 );
278 }
279
280 function fini() {
281 CRM_Core_BAO_Cache::storeSessionToCache(array(
282 "_{$this->_name}_container",
283 array('CiviCRM', $this->_scope),
284 ),
285 TRUE
286 );
287 }
288
289 function key($name, $addSequence = FALSE, $ignoreKey = FALSE) {
290 $config = CRM_Core_Config::singleton();
291
292 if (
293 $ignoreKey ||
294 (isset($config->keyDisable) && $config->keyDisable)
295 ) {
296 return NULL;
297 }
298
299 $key = CRM_Utils_Array::value('qfKey', $_REQUEST, NULL);
300 if (!$key && $_SERVER['REQUEST_METHOD'] === 'GET') {
301 $key = CRM_Core_Key::get($name, $addSequence);
302 }
303 else {
304 $key = CRM_Core_Key::validate($key, $name, $addSequence);
305 }
306
307 if (!$key) {
308 $this->invalidKey();
309 }
310
311 $this->_key = $key;
312
313 return $key;
314 }
315
316 /**
317 * Process the request, overrides the default QFC run method
318 * This routine actually checks if the QFC is modal and if it
319 * is the first invalid page, if so it call the requested action
320 * if not, it calls the display action on the first invalid page
321 * avoids the issue of users hitting the back button and getting
322 * a broken page
323 *
324 * This run is basically a composition of the original run and the
325 * jump action
326 *
327 */
328 function run() {
329 // the names of the action and page should be saved
330 // note that this is split into two, because some versions of
331 // php 5.x core dump on the triple assignment :)
332 $this->_actionName = $this->getActionName();
333 list($pageName, $action) = $this->_actionName;
334
335 if ($this->isModal()) {
336 if (!$this->isValid($pageName)) {
337 $pageName = $this->findInvalid();
338 $action = 'display';
339 }
340 }
341
342 // note that based on action, control might not come back!!
343 // e.g. if action is a valid JUMP, u basically do a redirect
344 // to the appropriate place
345 $this->wizardHeader($pageName);
346 return $this->_pages[$pageName]->handle($action);
347 }
348
349 function validate() {
350 $this->_actionName = $this->getActionName();
351 list($pageName, $action) = $this->_actionName;
352
353 $page = &$this->_pages[$pageName];
354
355 $data = &$this->container();
356 $this->applyDefaults($pageName);
357 $page->isFormBuilt() or $page->buildForm();
358 // We use defaults and constants as if they were submitted
359 $data['values'][$pageName] = $page->exportValues();
360 $page->loadValues($data['values'][$pageName]);
361 // Is the page now valid?
362 if (TRUE === ($data['valid'][$pageName] = $page->validate())) {
363 return TRUE;
364 }
365 return $page->_errors;
366 }
367
368 /**
369 * Helper function to add all the needed default actions. Note that the framework
370 * redefines all of the default QFC actions
371 *
372 * @param string directory to store all the uploaded files
373 * @param array names for the various upload buttons (note u can have more than 1 upload)
374 *
375 * @access private
376 *
377 * @return void
378 *
379 */
380 function addActions($uploadDirectory = NULL, $uploadNames = NULL) {
381 $names = array(
382 'display' => 'CRM_Core_QuickForm_Action_Display',
383 'next' => 'CRM_Core_QuickForm_Action_Next',
384 'back' => 'CRM_Core_QuickForm_Action_Back',
385 'process' => 'CRM_Core_QuickForm_Action_Process',
386 'cancel' => 'CRM_Core_QuickForm_Action_Cancel',
387 'refresh' => 'CRM_Core_QuickForm_Action_Refresh',
388 'reload' => 'CRM_Core_QuickForm_Action_Reload',
389 'done' => 'CRM_Core_QuickForm_Action_Done',
390 'jump' => 'CRM_Core_QuickForm_Action_Jump',
391 'submit' => 'CRM_Core_QuickForm_Action_Submit',
392 );
393
394 foreach ($names as $name => $classPath) {
395 $action = new $classPath($this->_stateMachine);
396 $this->addAction($name, $action);
397 }
398
399 $this->addUploadAction($uploadDirectory, $uploadNames);
400 }
401
402 /**
403 * getter method for stateMachine
404 *
405 * @return object
406 * @access public
407 */
408 function getStateMachine() {
409 return $this->_stateMachine;
410 }
411
412 /**
413 * setter method for stateMachine
414 *
415 * @param object a stateMachineObject
416 *
417 * @return void
418 * @access public
419 */
420 function setStateMachine($stateMachine) {
421 $this->_stateMachine = $stateMachine;
422 }
423
424 /**
425 * add pages to the controller. Note that the controller does not really care
426 * the order in which the pages are added
427 *
428 * @param object $stateMachine the state machine object
429 * @param int $action the mode in which the state machine is operating
430 * typicaly this will be add/view/edit
431 *
432 * @return void
433 * @access public
434 *
435 */
436 function addPages(&$stateMachine, $action = CRM_Core_Action::NONE) {
437 $pages = $stateMachine->getPages();
438 foreach ($pages as $name => $value) {
439 $className = CRM_Utils_Array::value('className', $value, $name);
440 $title = CRM_Utils_Array::value('title', $value);
441 $options = CRM_Utils_Array::value('options', $value);
442 $stateName = CRM_Utils_String::getClassName($className);
443 if (CRM_Utils_Array::value('className', $value)) {
444 $formName = $name;
445 }
446 else {
447 $formName = CRM_Utils_String::getClassName($name);
448 }
449
450 $ext = CRM_Extension_System::singleton()->getMapper();
451 if ($ext->isExtensionClass($className)) {
452 require_once ($ext->classToPath($className));
453 }
454 else {
455 require_once (str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php');
456 }
457 $$stateName = new $className($stateMachine->find($className), $action, 'post', $formName);
458 if ($title) {
459 $$stateName->setTitle($title);
460 }
461 if ($options) {
462 $$stateName->setOptions($options);
463 }
464 $this->addPage($$stateName);
465 $this->addAction($stateName, new HTML_QuickForm_Action_Direct());
466
467 //CRM-6342 -we need kill the reference here,
468 //as we have deprecated reference object creation.
469 unset($$stateName);
470 }
471 }
472
473 /**
474 * QFC does not provide native support to have different 'submit' buttons.
475 * We introduce this notion to QFC by using button specific data. Thus if
476 * we have two submit buttons, we could have one displayed as a button and
477 * the other as an image, both are of type 'submit'.
478 *
479 * @return string the name of the button that has been pressed by the user
480 * @access public
481 */
482 function getButtonName() {
483 $data = &$this->container();
484 return CRM_Utils_Array::value('_qf_button_name', $data);
485 }
486
487 /**
488 * function to destroy all the session state of the controller.
489 *
490 * @access public
491 *
492 * @return void
493 */
494 function reset() {
495 $this->container(TRUE);
496 self::$_session->resetScope($this->_scope);
497 }
498
499 /**
500 * virtual function to do any processing of data.
501 * Sometimes it is useful for the controller to actually process data.
502 * This is typically used when we need the controller to figure out
503 * what pages are potentially involved in this wizard. (this is dynamic
504 * and can change based on the arguments
505 *
506 * @return void
507 * @access public
508 */
509 function process() {}
510
511 /**
512 * Store the variable with the value in the form scope
513 *
514 * @param string|array $name name of the variable or an assoc array of name/value pairs
515 * @param mixed $value value of the variable if string
516 *
517 * @access public
518 *
519 * @return void
520 *
521 */
522 function set($name, $value = NULL) {
523 self::$_session->set($name, $value, $this->_scope);
524 }
525
526 /**
527 * Get the variable from the form scope
528 *
529 * @param string name : name of the variable
530 *
531 * @access public
532
533 *
534 * @return mixed
535 *
536 */
537 function get($name) {
538 return self::$_session->get($name, $this->_scope);
539 }
540
541 /**
542 * Create the header for the wizard from the list of pages
543 * Store the created header in smarty
544 *
545 * @param string $currentPageName name of the page being displayed
546 *
547 * @return array
548 * @access public
549 */
550 function wizardHeader($currentPageName) {
551 $wizard = array();
552 $wizard['steps'] = array();
553 $count = 0;
554 foreach ($this->_pages as $name => $page) {
555 $count++;
556 $wizard['steps'][] = array(
557 'name' => $name,
558 'title' => $page->getTitle(),
559 //'link' => $page->getLink ( ),
560 'link' => NULL,
561 'step' => TRUE,
562 'valid' => TRUE,
563 'stepNumber' => $count,
564 'collapsed' => FALSE,
565 );
566
567 if ($name == $currentPageName) {
568 $wizard['currentStepNumber'] = $count;
569 $wizard['currentStepName'] = $name;
570 $wizard['currentStepTitle'] = $page->getTitle();
571 }
572 }
573
574 $wizard['stepCount'] = $count;
575
576 $this->addWizardStyle($wizard);
577
578 $this->assign('wizard', $wizard);
579 return $wizard;
580 }
581
582 function addWizardStyle(&$wizard) {
583 $wizard['style'] = array(
584 'barClass' => '',
585 'stepPrefixCurrent' => '&raquo;',
586 'stepPrefixPast' => '&radic;',
587 'stepPrefixFuture' => ' ',
588 'subStepPrefixCurrent' => '&nbsp;&nbsp;',
589 'subStepPrefixPast' => '&nbsp;&nbsp;',
590 'subStepPrefixFuture' => '&nbsp;&nbsp;',
591 'showTitle' => 1,
592 );
593 }
594
595 /**
596 * assign value to name in template
597 *
598 * @param array|string $name name of variable
599 * @param mixed $value value of varaible
600 *
601 * @return void
602 * @access public
603 */
604 function assign($var, $value = NULL) {
605 self::$_template->assign($var, $value);
606 }
607
608 /**
609 * assign value to name in template by reference
610 *
611 * @param array|string $name name of variable
612 * @param mixed $value (reference) value of varaible
613 *
614 * @return void
615 * @access public
616 */
617 function assign_by_ref($var, &$value) {
618 self::$_template->assign_by_ref($var, $value);
619 }
620
621 /**
622 * appends values to template variables
623 *
624 * @param array|string $tpl_var the template variable name(s)
625 * @param mixed $value the value to append
626 * @param bool $merge
627 */
628 function append($tpl_var, $value=NULL, $merge=FALSE) {
629 self::$_template->append($tpl_var, $value, $merge);
630 }
631
632 /**
633 * Returns an array containing template variables
634 *
635 * @param string $name
636 * @param string $type
637 * @return array
638 */
639 function get_template_vars($name=null) {
640 return self::$_template->get_template_vars($name);
641 }
642
643 /**
644 * setter for embedded
645 *
646 * @param boolean $embedded
647 *
648 * @return void
649 * @access public
650 */
651 function setEmbedded($embedded) {
652 $this->_embedded = $embedded;
653 }
654
655 /**
656 * getter for embedded
657 *
658 * @return boolean return the embedded value
659 * @access public
660 */
661 function getEmbedded() {
662 return $this->_embedded;
663 }
664
665 /**
666 * setter for skipRedirection
667 *
668 * @param boolean $skipRedirection
669 *
670 * @return void
671 * @access public
672 */
673 function setSkipRedirection($skipRedirection) {
674 $this->_skipRedirection = $skipRedirection;
675 }
676
677 /**
678 * getter for skipRedirection
679 *
680 * @return boolean return the skipRedirection value
681 * @access public
682 */
683 function getSkipRedirection() {
684 return $this->_skipRedirection;
685 }
686
687 function setWord($fileName = NULL) {
688 //Mark as a CSV file.
689 header('Content-Type: application/vnd.ms-word');
690
691 //Force a download and name the file using the current timestamp.
692 if (!$fileName) {
693 $fileName = 'Contacts_' . $_SERVER['REQUEST_TIME'] . '.doc';
694 }
695 header("Content-Disposition: attachment; filename=Contacts_$fileName");
696 }
697
698 function setExcel($fileName = NULL) {
699 //Mark as an excel file.
700 header('Content-Type: application/vnd.ms-excel');
701
702 //Force a download and name the file using the current timestamp.
703 if (!$fileName) {
704 $fileName = 'Contacts_' . $_SERVER['REQUEST_TIME'] . '.xls';
705 }
706
707 header("Content-Disposition: attachment; filename=Contacts_$fileName");
708 }
709
710 /**
711 * setter for print
712 *
713 * @param boolean $print
714 *
715 * @return void
716 * @access public
717 */
718 function setPrint($print) {
719 if ($print == "xls") {
720 $this->setExcel();
721 }
722 elseif ($print == "doc") {
723 $this->setWord();
724 }
725 $this->_print = $print;
726 }
727
728 /**
729 * getter for print
730 *
731 * @return boolean return the print value
732 * @access public
733 */
734 function getPrint() {
735 return $this->_print;
736 }
737
738 function getTemplateFile() {
739 if ($this->_print) {
740 if ($this->_print == CRM_Core_Smarty::PRINT_PAGE) {
741 return 'CRM/common/print.tpl';
742 }
743 elseif ($this->_print == 'xls' || $this->_print == 'doc') {
744 return 'CRM/Contact/Form/Task/Excel.tpl';
745 }
746 else {
747 return 'CRM/common/snippet.tpl';
748 }
749 }
750 else {
751 $config = CRM_Core_Config::singleton();
752 return 'CRM/common/' . strtolower($config->userFramework) . '.tpl';
753 }
754 }
755
756 public function addUploadAction($uploadDir, $uploadNames) {
757 if (empty($uploadDir)) {
758 $config = CRM_Core_Config::singleton();
759 $uploadDir = $config->uploadDir;
760 }
761
762 if (empty($uploadNames)) {
763 $uploadNames = $this->get('uploadNames');
764 if (!empty($uploadNames)) {
765 $uploadNames = array_merge($uploadNames,
766 CRM_Core_BAO_File::uploadNames()
767 );
768 }
769 else {
770 $uploadNames = CRM_Core_BAO_File::uploadNames();
771 }
772 }
773
774 $action = new CRM_Core_QuickForm_Action_Upload($this->_stateMachine,
775 $uploadDir,
776 $uploadNames
777 );
778 $this->addAction('upload', $action);
779 }
780
781 public function setParent($parent) {
782 $this->_parent = $parent;
783 }
784
785 public function getParent() {
786 return $this->_parent;
787 }
788
789 public function getDestination() {
790 return $this->_destination;
791 }
792
793 public function setDestination($url = NULL, $setToReferer = FALSE) {
794 if (empty($url)) {
795 if ($setToReferer) {
796 $url = $_SERVER['HTTP_REFERER'];
797 }
798 else {
799 $config = CRM_Core_Config::singleton();
800 $url = $config->userFrameworkBaseURL;
801 }
802 }
803
804 $this->_destination = $url;
805 $this->set('civicrmDestination', $this->_destination);
806 }
807
808 public function cancelAction() {
809 $actionName = $this->getActionName();
810 list($pageName, $action) = $actionName;
811 return $this->_pages[$pageName]->cancelAction();
812 }
813
814 /**
815 * Write a simple fatal error message. Other controllers can decide to do something else
816 * and present the user a better message and/or redirect to the same page with a reset url
817 *
818 * @return void
819 *
820 */
821 public function invalidKey() {
822 self::invalidKeyCommon();
823 }
824
825 public function invalidKeyCommon() {
826 $msg = ts('We can\'t load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site adminstrator for assistance.') . '<br /><br />' . ts('Site Administrators: This error may indicate that users are accessing this page using a domain or URL other than the configured Base URL. EXAMPLE: Base URL is http://example.org, but some users are accessing the page via http://www.example.org or a domain alias like http://myotherexample.org.') . '<br /><br />' . ts('Error type: Could not find a valid session key.');
827 CRM_Core_Error::fatal($msg);
828 }
829
830 /**
831 * Instead of outputting a fatal error message, we'll just redirect to the entryURL if present
832 *
833 * @return void
834 */
835 public function invalidKeyRedirect() {
836 if ($this->_entryURL) {
837 CRM_Core_Session::setStatus(ts('Your browser session has expired and we are unable to complete your form submission. We have returned you to the initial step so you can complete and resubmit the form. If you experience continued difficulties, please contact us for assistance.'));
838 return CRM_Utils_System::redirect($this->_entryURL);
839 }
840 else {
841 self::invalidKeyCommon();
842 }
843 }
844
845 }