Пример #1
0
<!DOCTYPE HTML>
<?php 
session_start();
require "fonctions.inc.php";
require "bd.inc.php";
$i = infosEntreprise();
$connexion = connect();
$nomE = $_GET['nomEntreprise'];
if (isset($_POST['mdp'])) {
    //$mdp = md5($_POST['mdp']);
    $mdp = $_POST['mdp'];
}
if (!empty($_POST['login']) && !empty($_POST['mdp'])) {
    //récupération des infos de connexion des clients
    $j = logClient($_POST['login'], $_POST['mdp']);
    if ($j != null) {
        if ($_POST['login'] == $j->login_client && $_POST['mdp'] == $j->mdp_client) {
            $_SESSION["client"] = $j->id_client;
            $_SESSION["estConnecteClient"] = 1;
            $_SESSION["nomSession"] = $_GET['nomEntreprise'];
            ?>
					<SCRIPT language="javascript">
						javascript:parent.opener.location.reload();
						window.close();
					</SCRIPT>
					<?php 
        }
    }
}
?>
		//log with private key
		$client->setAssertionCredentials(new Google_AssertionCredentials(	
			SERVICE_ACCOUNT_NAME,
			array('https://www.googleapis.com/auth/calendar'),
			$key	
		));

		return $client;
	} catch (Exception $e) {
		$cli = eZCLI::instance();
		$cli->output($e->getMessage());
	}
}

//get google Calendar Client
$client = logClient();

if($client != null) {
	//Google calendar service (handler)
	$service = new Google_CalendarService($client);

	//create event
	$event = createCalendarEvent($service);	
}

//launch script runcronjobs.php
$tampon = runCronJob();

if($client != null) {
	//update event
	updateDateEvent($service, $event, $tampon);