Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Commit

Permalink
.gitignore config.php
Browse files Browse the repository at this point in the history
  • Loading branch information
mb21 committed Dec 1, 2009
1 parent 030677f commit 74d5370
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.php
3 changes: 2 additions & 1 deletion Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ private function convert(){
$event['name'] = $this->icsEvent['SUMMARY'];

//description
$event['description'] = $this->icsEvent['DESCRIPTION'];
if (isset($this->icsEvent['DESCRIPTION']))
$event['description'] = $this->icsEvent['DESCRIPTION'];

//start_time
$event["start_time"] = $this->to_facebook_time($this->find_key("DTSTART"));
Expand Down
10 changes: 8 additions & 2 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@

* associate a picture with a subscription which then will be added to every event created
* Update event on facebook when it changes in the ical file

* add URL from ical file with Events.edit
* share events created with $facebook->api_client->stream_publish($message, $attachment, $action_links, NULL, $page_id);
* redo user interface with AJAX. (error messages etc.)
* Your default RSVP: not attending.
* publish to stream: $facebook->api_client->stream_publish($message, $attachment, $action_links, NULL, $page_id);
* invite members of group/fans

* redo user interface with AJAX. (error messages etc.)
* display error message from update_all.php to user
32 changes: 32 additions & 0 deletions config.template.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
mb_internal_encoding('UTF-8');

//after filling in your data, change the file name of this file to 'config.php'

//canvas url
define('_SITE_URL','http://apps.facebook.com/test-ics-to-event/'); // your Canvas URL
define('_HOST_URL','http://ics-to-fbevent.project21.ch/'); // your Canvas Callback URL

//facebook
$appapikey = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$appsecret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';

//database
$database_name = 'ics-to-fbevent';
$host = 'localhost';
$db_user = '';
$db_password = '';



////////////////////
// config parameters
////////////////////

//do not add more than "number" events at the same time to not overstretch the facebook limits
$config['number_of_events_threshold'] = 19;

//event is not added if it is older than now "-1 month"
$config['old_event_threshold'] = "-1 month";

?>
10 changes: 5 additions & 5 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,6 @@ function unsubscribe(sub_id, sub_name){
</div>
</div>

<!-- div to place messages with facebook's mockAJAX in -->
<div id="messages">
<img id="spinner" src="<?php echo _HOST_URL; ?>loader.gif" alt="Loading..." style="display:none;">
</div>

<div>
<!-- GUI: URL-SUBMIT FORM -->
<form id="sub_form" method="get" promptpermission="offline_access, create_event">
Expand Down Expand Up @@ -286,6 +281,11 @@ function unsubscribe(sub_id, sub_name){
</form>
</div>

<!-- div to place messages with facebook's mockAJAX in -->
<div id="messages">
<img id="spinner" src="<?php echo _HOST_URL; ?>loader.gif" alt="Loading..." style="display:none;">
</div>


<div id="subscriptions">

Expand Down
22 changes: 12 additions & 10 deletions receive_sub.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->require_login();

echo '<img id="spinner" src="' . _HOST_URL .'loader.gif" alt="Loading..." style="display:none; padding-right:540px;">';
echo '<div style="height: 30px"><img id="spinner" src="' . _HOST_URL .'loader.gif" alt="Loading..." style="display:none; padding:0 540px 1em 0;"></div>';

//whether offline_access and create_event permissions are set
$perms = $facebook->api_client->users_hasAppPermission('offline_access') && $facebook->api_client->users_hasAppPermission('create_event');
Expand All @@ -31,31 +31,32 @@ function __autoload($class_name) {
/////////////////////////////////
// PARSE NEW SUBSCRIPTION
/////////////////////////////////
if ($perms && isset($_GET['url'])){
$url = $_GET['url'];
$page_id = $_GET['page_id'];
if ($perms && isset($_POST['url'])){

$url = $_POST['url'];
$page_id = $_POST['page_id'];

//check subscription name
if (mb_strlen($_GET['sub_name']) == 0){
if (mb_strlen($_POST['sub_name']) == 0){
echo '<fb:error><fb:message>You need to give your subscription a name.</fb:message></fb:error>';
exit;
}
else{
$sub_name = $_GET['sub_name'];
$sub_name = $_POST['sub_name'];
}

//check category
if ($_GET['category'] == "" || $_GET['subcategory'] == ""){
if ($_POST['category'] == "" || $_POST['subcategory'] == ""){
echo '<fb:error><fb:message>You need to specify a category and subcategory.</fb:message></fb:error>';
exit;
}
else{
$category = $_GET['category'];
$subcategory = $_GET['subcategory'];
$category = $_POST['category'];
$subcategory = $_POST['subcategory'];
}

//put subscription specific data in $sub_data array
$sub_data = array("url" => $url, "user_id" => $user_id, "category" => $category, "subcategory" => $subcategory, "page_id" => $_GET['page_id']);
$sub_data = array("url" => $url, "user_id" => $user_id, "category" => $category, "subcategory" => $subcategory, "page_id" => $_POST['page_id']);

$calendar = new Calendar($sub_data);

Expand Down Expand Up @@ -115,4 +116,5 @@ function __autoload($class_name) {


mysql_close($con);

?>
3 changes: 3 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#messages{
min-height: 60px;
}
.box{
float:left;
width: 50%;
Expand Down

0 comments on commit 74d5370

Please sign in to comment.