File "sms_plan.php"

Full Path: /home/asmplong/www/ancien-site-2019/plongeev4/sms_plan.php
File size: 1.3 KB
MIME-type: text/x-php
Charset: utf-8

#!/usr/bin/php -q
<?php
/*
** Sms plan permet de planifier un message pour une date précise
**
*/

include "GoogleCalendarWrapper.php";
$gc = new GoogleCalendarWrapper("VOTRE_MAIL", "VOTRE_PASS");

//$gc->feed_url = "http://www.google.com/calendar/feeds/untiuro1rs%40group.calendar.google.com/private-6a7151779f99b/basic";
//A spécifier si vous ne voulez pas travailler sur le calendrier par default http://code.google.com/apis/gdata/calendar.html#get_feed)

if($argc != 4)
{
	echo "Mauvaise syntaxe:\n php $argv[0] titre message datedebut(HH:MM) \n";
	exit;
}
else
{ // Je retire une heure au datedebut, Si on ajoute à 10h google le mets à 11h 
$newtime = explode(":",$argv[3]);

$time = (int)$newtime[0]-1;
	if($time == 9
		or $time == 8
		or $time == 7	
		or $time == 6
		or $time == 5
		or $time == 4
		or $time == 3
		or $time == 2
		or $time == 1
		or $time == 0
	){
	$time = (string)"0$time";
	}

$goodtime = $time.":".$newtime[1];

$s = array();
$s["title"] = $argv[1];
$s["content"] = "";
$s["where"] = $argv[2];
$s["startDay"] = date("Y-m-d");
$s["startTime"] = $goodtime.":00";
$s["endDay"] = date("Y-m-d");
$s["endTime"] = $goodtime.":10";

if($gc->add_event($s))
  echo "Evenement: '".$s["title"]."' planifier a $argv[3] [ Ok ]\n";
else
  echo "Erreur\n";


}
?>