Xataface  2.0alpha2
Xataface Application Framework
 All Data Structures Namespaces Files Functions Variables Groups Pages
invalidate_translations.php
Go to the documentation of this file.
1 <?php
11 
12 
13  function handle(&$params){
14 
16  if ( !isset($_POST['--confirm_invalidate']) ){
17  return PEAR::raiseError("Cannot invalidate translations with a GET request. Please provide the POST parameter '--confirm_invalidate'");
18  }
19 
20  $record =& $app->getRecord();
21  if ( !$record ){
22  return PEAR::raiseError("Attempt to invalidate translations on null record. No record could be found to match the query parameters.");
23  }
24 
25  import('Dataface/TranslationTool.php');
26  $tt = new Dataface_TranslationTool();
27  $res = $tt->markNewCanonicalVersion($record, basename($app->_conf['default_language']));
28  if ( PEAR::isError($res) ){
29  return $res;
30  }
31 
32  $query =& $app->getQuery();
33  if ( isset($query['--redirect']) ){
34  $app->redirect($query['--redirect'].'&--msg='.urlencode("Translations successfully invalidated."));
35  } else {
36  $app->redirect($record->getURL('-action=edit').'&--msg='.urlencode('Translations successfully invalidated.'));
37  }
38  }
39 }
40 
41 ?>