Xataface  2.0alpha2
Xataface Application Framework
 All Data Structures Namespaces Files Functions Variables Groups Pages
get_page_to_translate.php
Go to the documentation of this file.
1 <?php
2 
4 
5 
6  function handle($params){
8  if ( !isset($_GET['key']) ) trigger_error("No key specified", E_USER_ERROR);
9 
10  $sql = "select `value` from `".TRANSLATION_PAGE_TABLE."` where `key` = '".addslashes($_GET['key'])."'";
11  $res = mysql_query($sql,$app->db());
12  if ( !$res ) trigger_error(mysql_error($app->db()), E_USER_ERROR);
13  if ( mysql_num_rows($res) == 0 ) trigger_error("Sorry the specified key was invalid.", E_USER_ERROR);
14  list($content) = mysql_fetch_row($res);
15  @mysql_free_result($res);
16 
17  if ( function_exists('tidy_parse_string') ){
18  $config = array('show-body-only'=>true, 'output-encoding'=>'utf8');
19 
20  $html = tidy_repair_string($content, $config, "utf8");
21  $content = trim($html);
22  }
23 
24  df_display(array('content'=>$content), 'TranslationPageTemplate.html');
25  return true;
26 
27  }
28 
29 }
30 
31 ?>