diff options
-rw-r--r-- | include/network.php | 6 | ||||
-rwxr-xr-x | index.php | 3 | ||||
-rw-r--r-- | mod/admin.php | 28 | ||||
-rw-r--r-- | mod/post.php | 3 | ||||
-rwxr-xr-x | view/tpl/admin_hubloc.tpl | 1 |
5 files changed, 26 insertions, 15 deletions
diff --git a/include/network.php b/include/network.php index 3fe7f5400..1fb4beaa7 100644 --- a/include/network.php +++ b/include/network.php @@ -78,7 +78,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { @curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); - // don't let curl abort the entire application + // don't let curl abort the entire application' // if it throws any errors. $s = @curl_exec($ch); @@ -86,7 +86,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { $base = $s; $curl_info = @curl_getinfo($ch); $http_code = $curl_info['http_code']; -// logger('fetch_url:' . $http_code . ' data: ' . $s); + //logger('fetch_url:' . $http_code . ' data: ' . $s); $header = ''; // Pull out multiple headers, e.g. proxy and continuation headers @@ -129,7 +129,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { function z_post_url($url,$params, $redirects = 0, $opts = array()) { - + $ret = array('return_code' => 0, 'success' => false, 'header' => "", 'body' => ""); $ch = curl_init($url); @@ -19,7 +19,7 @@ $a = new App; /** * * Load the configuration file which contains our DB credentials. - * Ignore errors. If the file doesn't exist or is empty, we are running in installation mode. + * Ignore errors. If the file doesn't exist or is empty, we are running in installation mode.' * */ @@ -182,7 +182,6 @@ if(strlen($a->module)) { * Otherwise, look for the standard program module in the 'mod' directory */ - if(! $a->module_loaded) { if(file_exists("custom/{$a->module}.php")) { include_once("custom/{$a->module}.php"); diff --git a/mod/admin.php b/mod/admin.php index 950c7e5ce..12b847b03 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -9,7 +9,7 @@ * @param App $a */ function admin_post(&$a){ - + logger('admin_post', LOGGER_DEBUG); if(!is_site_admin()) { return; @@ -74,6 +74,7 @@ function admin_post(&$a){ */ function admin_content(&$a) { + logger('admin_content', LOGGER_DEBUG); if(!is_site_admin()) { return login(false); } @@ -468,6 +469,7 @@ function admin_page_site(&$a) { } function admin_page_hubloc_post(&$a){ check_form_security_token_redirectOnErr('/admin/hubloc', 'admin_hubloc'); + require_once('include/zot.php'); //prepare for ping @@ -477,18 +479,24 @@ function admin_page_hubloc_post(&$a){ intval($hublocid) ); $hublocurl = $arrhublocurl[0]['hubloc_url'] . '/post'; - logger('hubloc_url : ' . $hublocurl , LOGGER_DEBUG); - } + + //perform ping + $m = zot_build_packet($a->get_channel(),'ping'); + $r = zot_zot($hublocurl,$m); + logger('ping answer: ' . print_r($r,true), LOGGER_DEBUG); + + //unfotunatly zping wont work, I guess return format is not correct + //require_once('mod/zping.php'); + //$r = zping_content($hublocurl); + //logger('zping answer: ' . $r, LOGGER_DEBUG); + + //handle results and set the hubloc flags in db to make results visible - //if ( $_POST'' == "check" ) { - // //todo - //} + //in case of repair store new pub key for tested hubloc (all channel with this hubloc) in db + //after repair set hubloc flags to 0 - //perform ping - //handle results and set the hubloc flags in db to make results visible + } - //in case of repair store new pub key for tested hubloc (all channel with this hubloc) in db - //after repair set hubloc flags to 0 goaway($a->get_baseurl(true) . '/admin/hubloc' ); return; diff --git a/mod/post.php b/mod/post.php index 965ba09a3..cce183e46 100644 --- a/mod/post.php +++ b/mod/post.php @@ -9,6 +9,8 @@ require_once('include/zot.php'); function post_init(&$a) { + logger('POST inside',LOGGER_DEBUG); + logger('POST given parameter: ' . print_r($_REQUEST,true), LOGGER_DEBUG); // Most access to this endpoint is via the post method. // Here we will pick out the magic auth params which arrive @@ -490,6 +492,7 @@ function post_post(&$a) { // Useful to get a health check on a remote site. // This will let us know if any important communication details // that we may have stored are no longer valid, regardless of xchan details. + logger('POST: got ping send pong now back: ' . z_root() , LOGGER_DEBUG ); $ret['success'] = true; $ret['site'] = array(); diff --git a/view/tpl/admin_hubloc.tpl b/view/tpl/admin_hubloc.tpl index ea840e1b3..06a8cdf6a 100755 --- a/view/tpl/admin_hubloc.tpl +++ b/view/tpl/admin_hubloc.tpl @@ -15,6 +15,7 @@ <form action="{{$baseurl}}/admin/hubloc" method="post"> <input type="hidden" name="hublocid" value="{{$hub.hubloc_id}}"> <input type='hidden' name='form_security_token' value='{{$form_security_token}}'> + <input type='hidden' name='url' value='{{$hub.hubloc_host}}'> <input type="submit" name="check" value="check" > <input type="submit" name="repair" value="repair" ></td> </form> |