]> git.mxchange.org Git - friendica.git/commitdiff
begin event module
authorFriendika <info@friendika.com>
Mon, 6 Jun 2011 06:10:07 +0000 (23:10 -0700)
committerFriendika <info@friendika.com>
Mon, 6 Jun 2011 06:10:07 +0000 (23:10 -0700)
boot.php
database.sql
include/event.php
mod/events.php [new file with mode: 0644]
update.php

index 3c8208339583b8b49097aa4c6445761aeb4ada22..a112b9d0dc8ae99afaf8a8328bdfd04010df7d53 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -6,7 +6,7 @@ ini_set('pcre.backtrack_limit', 250000);
 
 define ( 'FRIENDIKA_VERSION',      '2.2.1002' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.21'    );
-define ( 'DB_UPDATE_VERSION',      1060      );
+define ( 'DB_UPDATE_VERSION',      1061      );
 
 define ( 'EOL',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
index 7c26af341b5511e73ce0e80e02279774303428fe..ab047968ebfa6314982bdc8ba32ccfdf7af8a256 100644 (file)
@@ -476,6 +476,7 @@ CREATE TABLE IF NOT EXISTS `event` (
 `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
 `uid` INT NOT NULL ,
 `cid` INT NOT NULL ,
+`uri` CHAR( 255 ) NOT NULL,
 `created` DATETIME NOT NULL ,
 `edited` DATETIME NOT NULL ,
 `start` DATETIME NOT NULL ,
index 06239b2abb89c4dcba063ee17639e8e559bd52ce..21817086f094753594b1ab43ad041f94932f69a6 100644 (file)
@@ -31,4 +31,7 @@ function format_event_html($ev) {
        $o .= '</div>';
 
 return $o;
-}
\ No newline at end of file
+}
+
+
+
diff --git a/mod/events.php b/mod/events.php
new file mode 100644 (file)
index 0000000..73328b9
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+
+require_once('include/datetime.php');
+require_once('include/event.php');
+
+function events_post(&$a) {
+
+       if(! local_user())
+               return;
+
+       $event_id = ((x($_POST,'event_id')) ? intval($_POST['event_id']) : 0);
+       $uid      = local_user();
+       $start    = strip_tags($_POST['start']);
+       $finish   = strip_tags($_POST['finish']);
+       $desc     = escape_tags($_POST['desc']);
+       $location = escape_tags($_POST['location']);
+       $type     = 'event';
+       $adjust   = intval($_POST['adjust']);
+
+       $str_group_allow   = perms2str($_POST['group_allow']);
+       $str_contact_allow = perms2str($_POST['contact_allow']);
+       $str_group_deny    = perms2str($_POST['group_deny']);
+       $str_contact_deny  = perms2str($_POST['contact_deny']);
+
+
+       if($event_id) {
+               $r = q("UPDATE `event` SET
+                       `edited` = '%s',
+                       `start` = '%s',
+                       `finish` = '%s',
+                       `desc` = '%s',
+                       `location` = '%s',
+                       `type` = '%s',
+                       `adjust` = %d,
+                       `allow_cid` = '%s',
+                       `allow_gid` = '%s',
+                       `deny_cid` = '%s',
+                       `deny_gid` = '%s'
+                       WHERE `id` = %d AND `uid` = %d LIMIT 1",
+
+                       dbesc(datetime_convert()),
+                       dbesc($start),
+                       dbesc($finish),
+                       dbesc($desc),
+                       dbesc($location),
+                       dbesc($type),
+                       intval($adjust),
+                       dbesc($str_contact_allow),
+                       dbesc($str_group_allow),
+                       dbesc($str_contact_deny),
+                       dbesc($str_group_deny),
+                       intval($event_id),
+                       intval($local_user())
+               );
+
+       }
+       else {
+
+               $uri = item_new_uri($a->get_hostname(),local_user());
+
+               $r = q("INSERT INTO `event` ( `uid`,`uri`,`created`,`edited`,`start`,`finish`,`desc`,`location`,`type`,
+                       `adjust`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`)
+                       VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s' ) ",
+                       intval(local_user()),
+
+                       dbesc(datetime_convert()),
+                       dbesc(datetime_convert()),
+                       dbesc($start),
+                       dbesc($finish),
+                       dbesc($desc),
+                       dbesc($location),
+                       dbesc($type),
+                       intval($adjust),
+                       dbesc($str_contact_allow),
+                       dbesc($str_group_allow),
+                       dbesc($str_contact_deny),
+                       dbesc($str_group_deny)
+
+               );
+       }
+
+}
+
+
index be1b184ae9c3268abee9854fa10376bbfca97725..be78f068f0136695d0b240220770b1bb64dd81fb 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-define( 'UPDATE_VERSION' , 1060 );
+define( 'UPDATE_VERSION' , 1061 );
 
 /**
  *
@@ -506,3 +506,7 @@ function update_1059() {
        q("ALTER TABLE `queue` ADD `network` CHAR( 32 ) NOT NULL AFTER `cid` ");
 }
 
+function update_1060() {
+       q("ALTER TABLE `event` ADD `uri` CHAR( 255 ) NOT NULL AFTER `cid` ");
+}
+