comparison check_sections_details.php @ 8:7258ccd8ef7d

new: user need to login in LGServices
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Wed, 27 May 2015 15:36:58 +0200
parents 3abf39f0eb46
children 2c35af0d78f3
comparison
equal deleted inserted replaced
7:3abf39f0eb46 8:7258ccd8ef7d
102 $lg_url = $lgserver_url."rest/utils/getUser?sessionId=".$session_id; // url to get username from LGService 102 $lg_url = $lgserver_url."rest/utils/getUser?sessionId=".$session_id; // url to get username from LGService
103 //$lg_url = "http://localgazetteers-dev/LGServices/rest/utils/getUser?sessionId=".$session_id; // url to get username from LGService 103 //$lg_url = "http://localgazetteers-dev/LGServices/rest/utils/getUser?sessionId=".$session_id; // url to get username from LGService
104 $output = file_get_contents($lg_url); 104 $output = file_get_contents($lg_url);
105 $user_info = json_decode($output, true); 105 $user_info = json_decode($output, true);
106 $current_editor = (string)$user_info['userName']; 106 $current_editor = (string)$user_info['userName'];
107
108 if ($current_editor == null) {
109 // redirect to LGServices homepage
110 header('Location: http://localgazetteers/LGServices');
111 }
107 112
108 } else { 113 } else {
109 // test locally 114 // test locally
115 // redirect to LGServices homepage
116 header('Location: http://localgazetteers/LGServices');
110 } 117 }
111 118
112 ?> 119 ?>
113 120
114 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 121 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
177 function setCurrentEditor() { 184 function setCurrentEditor() {
178 // current_editor is gotten from LGService 185 // current_editor is gotten from LGService
179 var current_editor = <?php echo json_encode($current_editor) ?>; 186 var current_editor = <?php echo json_encode($current_editor) ?>;
180 if (current_editor != "") { 187 if (current_editor != "") {
181 $("#saveBook .editor").val(current_editor); 188 $("#saveBook .editor").val(current_editor);
189 } else {
190 console.log("You have to login from LGService!");
182 } 191 }
183 } 192 }
184 193
185 document.getElementById("show_all").onclick = function(){showAll()}; 194 document.getElementById("show_all").onclick = function(){showAll()};
186 195