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

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mb21 committed Feb 25, 2010
1 parent d57be03 commit a7599b1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
7 changes: 5 additions & 2 deletions Calendar.php
Expand Up @@ -66,9 +66,12 @@ public function update($force = FALSE) {
if ($lm) {
$lastupdated = $event->_date2timestamp($lm);
}
else{
$lastupdated = NULL;
}

$sql_error = FALSE;
$result = mysql_query("select * from user$user_id where sub_id ='$sub_id' and UID = '$UID'") or $sql_error = TRUE;
$result = mysql_query("select * from user$user_id where sub_id ='$sub_id' and binary UID = '$UID'") or $sql_error = TRUE;
if ($result && mysql_num_rows($result) === 0 && !$sql_error && !$force) {
//event doesn't exist yet, add it

Expand Down Expand Up @@ -102,7 +105,7 @@ public function update($force = FALSE) {
}
}
}
elseif($result) {
elseif($result && !$sql_error) {
//event already exists on fb or update is being forced
$data = mysql_fetch_array($result);

Expand Down
7 changes: 3 additions & 4 deletions Docs.php
Expand Up @@ -2,7 +2,7 @@
<style>
.list li{
padding-left: 1em;
list-style: circle;
list-style-type: disc;
display: list-item;
}
</style>
Expand All @@ -12,19 +12,18 @@
<p>With this app you can subscribe to an <a href="http://en.wikipedia.org/wiki/ICalendar">iCalendar</a> file which then gets regularly checked for updates. When new events in the calendar become available, it will create a facebook event in your name.</p>

<h4>Example: Google Calendar</h4>
<p>Most calendars export to the iCalendar format, usually a file with the suffix .ics. For example, to get your Google Calendar URL: in <a href="http://calendar.google.com/">Google Calendar</a> go to Settings -> Calendars -> choose a calendar -> ICAL</p>
<p>Most calendars export to the iCalendar format, usually a file with the suffix .ics. For example, to get your Google Calendar URL: in <a href="http://calendar.google.com/">Google Calendar</a> go to Settings -> Calendars -> choose a calendar -> public ICAL.</p>

<h4>Groups</h4>
<p>You can create events for a facebook group. Simply enter the group-id into the field when subscribing. To get your group-id, check the web-address of the grouppage for gid=XXX.</p>

<h4>Pages</h4>
<p>You can add this app to your facebook pages (fan-pages) to create events for them. Here is how: Right now on this page on the left side click on "Add to my Page". Add it to those of your pages you want, then close the popup. Now go to your page (fanpage) and edit it. Under Applications, you now should see "iCalendar to Event". Click there once again on Edit which should get you to the iCalendar to Event page with the page_id already filled in.</p>
<p>You can add this app to your facebook pages (fan-pages) to create events for them. Here is how: Go to the <a href="http://www.facebook.com/apps/application.php?v=info&id=164414672850" target="_blank">page of this app</a> and click on the left on "Add to my Page". Add it to those of your pages you want, then close the popup. Now go to your page (fanpage) and edit it. Under Applications, you now should see "iCalendar to Event". Click there once again on Edit which should get you to the iCalendar to Event page with the page_id already filled in under Advanced Options.</p>

<h4>Misc.</h4>
<ul>
<li>Don't add a calendar with lots of event, remove it again, add it again etc. Facebook imposes certain <a href="http://www.facebook.com/help/?page=421" target="_blank">limits</a> and they don't like adding/removing lots of event too fast.</li>
<li>If you change events in the ical file the facebook events will get updated but not the other way around.</li>
<li>If the same event gets added over and over again, this is because the UID (unique identifier) of events in the iCal file changes. And this isn't allowed by the <a href="http://tools.ietf.org/html/rfc5545#section-3.8.4.7">iCal specification</a> for precisely that reason (that programs don't recognize the existing event). So please fix your iCal file.</li>
<li>Internet Explorer might have some problems with this app. Get a decent browser like <a href="http://www.getfirefox.com">Firefox</a>.</li>
</ul>

Expand Down
6 changes: 3 additions & 3 deletions Event.php
Expand Up @@ -52,7 +52,7 @@ public function post_to_fb() {
$facebook->set_user($user_id, $session_key);

//post array to facebook
$event_id=$facebook->api_client->events_create(json_encode($this->fbEvent));
$event_id = $facebook->api_client->events_create(json_encode($this->fbEvent));

return $event_id;
}
Expand Down Expand Up @@ -105,7 +105,7 @@ private function convert() {
//page_id
$event['page_id'] = $this->calendar->sub_data['page_id'];
if ($event['page_id'] == 0)
$event['page_id'] = $this->calendar->sub_data['user_id'];;
$event['page_id'] = '';

//location
$location = $this->vEvent->getProperty('LOCATION');
Expand All @@ -127,7 +127,7 @@ private function convert() {
$description = $this->vEvent->getProperty('DESCRIPTION');
$weburl= $this->vEvent->getProperty('URL');
if ($weburl)
$description .= '<br/>'.$weburl;
$description .= '\r\n\r\n'.$weburl;
if ($description){
$description = str_replace("\\n", "\r\n", $description, $count);
$event['description'] = $description;
Expand Down
2 changes: 1 addition & 1 deletion receive_sub.php
Expand Up @@ -88,7 +88,7 @@ function __autoload($class_name) {
//create new user-table
$sql = 'CREATE TABLE user'. $user_id .'
(
event_id bigint NOT NULL,
event_id bigint UNSIGNED NOT NULL,
PRIMARY KEY(event_id),
UID varchar(256),
summary varchar(300),
Expand Down
2 changes: 0 additions & 2 deletions update_all.php
Expand Up @@ -58,8 +58,6 @@ function __autoload($class_name) {
while($row = mysql_fetch_assoc($result)) {
$sub_id = $row['sub_id'];
$sub_data = array("sub_id" => $row['sub_id'], "url" => $row['url'], "user_id" => $row['user_id'], "category" => $row['category'], "subcategory" => $row['subcategory'], "page_id" => $row['page_id']);
if ($sub_data['page_id'] == 0)
$sub_data['page_id'] = '';

try {
$numb_subs++;
Expand Down

0 comments on commit a7599b1

Please sign in to comment.