# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc.,  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
include dirname(__FILE__) . "/../php/mb_validateSession.php";
include dirname(__FILE__) . "/../classes/class_administration.php";
$admin = new administration();
$ownwms = $admin->getWmsByWmsOwner($_SESSION["mb_user_id"]);
#need admin functions: getWmsLogTag, getWmsPrice, setWmsLogTag, setWmsPrice
#can set log only when proxy on, can set price only when log on
#read out the request
function array2str($array, $pre = '', $pad = '', $sep = ', ')
{
    $str = '';
    if (is_array($array)) {
        if (count($array)) {
            foreach ($array as $v) {
                $str .= $pre . $v . $pad . $sep;
            }
            $str = substr($str, 0, -strlen($sep));
        }
    } else {
        $str .= $pre . $array . $pad;
        }
        die;
    }
}
if (count($userIdArray) === 0) {
    echo _mb("No user found for the given parameters.");
    die;
}
$user_id_all = $userIdArray;
echo $br . "Count of registrating users: " . count($user_id_all) . $br;
$e = new mb_notice("mod_monitorCapabilities_main.php: count of group members: " . count($user_id_all));
$time_array = array();
for ($iz = 0; $iz < count($user_id_all); $iz++) {
    $userid = $user_id_all[$iz];
    //get all owned wms
    $wms_id_own = $admin->getWmsByWmsOwner($userid);
    // initialize monitoring processes
    echo "Starting monitoring cycle...{$br}";
    echo "WMS services are requested for availability.{$br}";
    echo "Capabilities documents are requested and compared to the infos in the service db.{$br}";
    $e = new mb_notice("mod_monitorCapabilities_main.php: monitoring for user: "******"SELECT wms_upload_url, wms_getcapabilities_doc, " . "wms_version, wms_getcapabilities, wms_getmap FROM wms " . "WHERE wms_id = \$1";
        $v = array($wms_id_own[$k]);
        $t = array('i');