# HG changeset patch # User Calvin Yeh # Date 1506342200 -7200 # Node ID a15320882b302ecbb89cbe11e849fad41f2b6567 # Parent 2e6bf16b0be301ad4919fdb9ca54a157431056dd modified version list area, make it more neat. diff -r 2e6bf16b0be3 -r a15320882b30 check_sections_details.php --- a/check_sections_details.php Tue Mar 21 18:05:52 2017 +0100 +++ b/check_sections_details.php Mon Sep 25 14:23:20 2017 +0200 @@ -13,39 +13,46 @@ } $db_selected = mysql_select_db($mysql_database, $link_mysql); + if (!$db_selected) { die ('Can\'t use foo : ' . mysql_error()); } + function getBookInfo($bookId){ $query="SELECT * FROM books WHERE id=".$bookId; $result=mysql_query($query); $bookInfo=mysql_fetch_assoc($result); return $bookInfo; } + function printBookInfo($bookInfo){ - $str=""; - $str.="
book id - book name - level1 - level2 - period - pages - version - editor - date"; + + $str=" + + + + + + + + + "; + $str.=""; $str.="
book idbook namelevel1level2periodpagesversioneditordate
".$bookInfo['id']; - $str.="".$bookInfo['name']; - $str.="".$bookInfo['level1']; - $str.="".$bookInfo['level2']; - $str.="".$bookInfo['period']; - $str.="".$bookInfo['line']; - $str.="".$bookInfo['version']; - $str.="".$bookInfo['editor']; - $str.="".$bookInfo['date']; - $str.="
"; + $str.="
".$bookInfo['name']; + $str.="".$bookInfo['level1']; + $str.="".$bookInfo['level2']; + $str.="".$bookInfo['period']; + $str.="".$bookInfo['line']; + $str.="".$bookInfo['version']; + $str.="".$bookInfo['editor']; + $str.="".$bookInfo['date']; + $str.="
"; + echo $str; } + function printSectionArray($sectionArray,$missingPageArray){ $str="
"; echo $str; @@ -67,7 +74,7 @@ $i++; echo $str; } - + $str="
"; $str.="
"; $str.="
".$row['id']."
"; @@ -84,7 +91,7 @@ $str.="
";//end of page $str.="
"; //end of class entry echo $str; - + } if($i"; @@ -101,20 +108,34 @@ global $lgserver_url; $lg_url = $lgserver_url."rest/utils/getUser?sessionId=".$session_id; // url to get username from LGService //$lg_url = "http://localgazetteers-dev/LGServices/rest/utils/getUser?sessionId=".$session_id; // url to get username from LGService - $output = file_get_contents($lg_url); - $user_info = json_decode($output, true); - $current_editor = (string)$user_info['userName']; - - if ($current_editor == null || $current_editor == "" || strcmp($current_editor, "") === 0 || strcmp($user_info['status'], "ok") !== 0) { - // redirect to LGServices homepage - header("Location: "+$lgserver_url+"LGServices"); - //header('Location: http://localgazetteers/LGServices'); - } + $output = file_get_contents($lg_url); + $user_info = json_decode($output, true); + + if(strcmp($user_info['status'], "ok") === 0 && isset($user_info['userName'])){ + + $current_editor = (string)$user_info['userName']; + + if($current_editor == "" || strcmp($current_editor, "") === 0){ + + // redirect to LGServices homepage + header("Location: ".$lgserver_url); + + exit; + + } + } else { + + // redirect to LGServices homepage + header("Location: ".$lgserver_url); + + exit; + } } else { // test locally // redirect to LGServices homepage - header("Location: "+$lgserver_url+"LGServices"); + header("Location: ".$lgserver_url); + exit; } @@ -128,16 +149,9 @@ - - - - - - + + + @@ -161,23 +175,15 @@ $missingPageArray=checkMissingPage($bookInfo,$info); ?> - - Show editing records: - - +
+ + + - - - - - - - - - + +
-
var version=; var session_id = ""; - -