Party Tool - Initial Commit - Ryan Flint <rflint@dslr.net>

This commit is contained in:
reed%reedloden.com 2006-09-11 05:56:11 +00:00
Родитель 15d914bdd1
Коммит 431d949033
55 изменённых файлов: 2595 добавлений и 0 удалений

5
webtools/partytool/.htaccess Executable file
Просмотреть файл

@ -0,0 +1,5 @@
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>

Просмотреть файл

@ -0,0 +1,4 @@
<?php
class AppController extends Controller {
}
?>

Просмотреть файл

@ -0,0 +1,4 @@
<?php
class AppModel extends Model {
}
?>

Просмотреть файл

@ -0,0 +1,76 @@
;<?php die() ?>
; SVN FILE: $Id: acl.ini.php,v 1.3 2006/10/08 03:39:21 reed%reedloden.com Exp $
;/**
; * Short description for file.
; *
; *
; * PHP versions 4 and 5
; *
; * CakePHP : Rapid Development Framework <http://www.cakephp.org/>
; * Copyright (c) 2006, Cake Software Foundation, Inc.
; * 1785 E. Sahara Avenue, Suite 490-204
; * Las Vegas, Nevada 89104
; *
; * Licensed under The MIT License
; * Redistributions of files must retain the above copyright notice.
; *
; * @filesource
; * @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
; * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
; * @package cake
; * @subpackage cake.app.config
; * @since CakePHP v 0.10.0.1076
; * @version $Revision: 1.3 $
; * @modifiedby $LastChangedBy: phpnut $
; * @lastmodified $Date: 2006/10/08 03:39:21 $
; * @license http://www.opensource.org/licenses/mit-license.php The MIT License
; */
; acl.ini.php - Cake ACL Configuration
; ---------------------------------------------------------------------
; Use this file to specify user permissions.
; aco = access control object (something in your application)
; aro = access request object (something requesting access)
;
; User records are added as follows:
;
; [uid]
; groups = group1, group2, group3
; allow = aco1, aco2, aco3
; deny = aco4, aco5, aco6
;
; Group records are added in a similar manner:
;
; [gid]
; allow = aco1, aco2, aco3
; deny = aco4, aco5, aco6
;
; The allow, deny, and groups sections are all optional.
; NOTE: groups names *cannot* ever be the same as usernames!
;
; ACL permissions are checked in the following order:
; 1. Check for user denies (and DENY if specified)
; 2. Check for user allows (and ALLOW if specified)
; 3. Gather user's groups
; 4. Check group denies (and DENY if specified)
; 5. Check group allows (and ALLOW if specified)
; 6. If no aro, aco, or group information is found, DENY
;
; ---------------------------------------------------------------------
;-------------------------------------
;Users
;-------------------------------------
[username-goes-here]
groups = group1, group2
deny = aco1, aco2
allow = aco3, aco4
;-------------------------------------
;Groups
;-------------------------------------
[groupname-goes-here]
deny = aco5, aco6
allow = aco7, aco8

Просмотреть файл

@ -0,0 +1,25 @@
<?php
/* You should specify a Google Map API key here. Without it, all mapping features
* will be disabled. To obtain a key, visit http://www.google.com/apis/maps/
*/
define('GMAP_API_KEY', '');
/* The search API key is used to generate spelling suggestions for locations not
* not found during a Geocode operation. You may obtain a key here: http://www.google.com/apis/
*/
define('GSEARCH_API_KEY', '');
define('MAX_YEAR', 2007);
define('APP_NAME', 'Firefox Party');
define('APP_EMAIL', '');
/* The Flickr API is used to show photos of each party on the individual party
* pages and home page. See http://flickr.com/services/api/keys/ to obtain a key
*/
define('FLICKR_API_KEY', '');
/* The tag prefix is used to limit the results returned to a specific party.
* e.g. any photo tagged with FirefoxParty11 will be shown on party 11's page.
* Photos tagged with only the prefix are shown on the front page (so choose wisely! ;) ).
*/
define('FLICKR_TAG_PREFIX', '');
?>

Просмотреть файл

@ -0,0 +1,147 @@
<?php
/* SVN FILE: $Id: core.php,v 1.2 2006/09/20 07:22:44 reed%reedloden.com Exp $ */
/**
* This is core configuration file.
*
* Use it to configure core behaviour ofCake.
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.app.config
* @since CakePHP v 0.2.9
* @version $Revision: 1.2 $
* @modifiedby $LastChangedBy: phpnut $
* @lastmodified $Date: 2006/09/20 07:22:44 $
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* If you do not have mod rewrite on your system
* or if you prefer to use CakePHP pretty urls.
* uncomment the line below.
* Note: If you do have mod rewrite but prefer the
* CakePHP pretty urls, you also have to remove the
* .htaccess files
* release/.htaccess
* release/app/.htaccess
* release/app/webroot/.htaccess
*/
// define ('BASE_URL', env('SCRIPT_NAME'));
/**
* Set debug level here:
* - 0: production
* - 1: development
* - 2: full debug with sql
* - 3: full debug with sql and dump of the current object
*
* In production, the "flash messages" redirect after a time interval.
* With the other debug levels you get to click the "flash message" to continue.
*
*/
define('DEBUG', 1);
/**
* Turn of caching checking wide.
* You must still use the controller var cacheAction inside you controller class.
* You can either set it controller wide, or in each controller method.
* use var $cacheAction = true; or in the controller method $this->cacheAction = true;
*/
define('CACHE_CHECK', false);
/**
* Error constant. Used for differentiating error logging and debugging.
* Currently PHP supports LOG_DEBUG
*/
define('LOG_ERROR', 2);
/**
* CakePHP includes 3 types of session saves
* database or file. Set this to your preferred method.
* If you want to use your own save handler place it in
* app/config/name.php DO NOT USE file or database as the name.
* and use just the name portion below.
*
* Setting this to cake will save files to /cakedistro/tmp directory
* Setting it to php will use the php default save path
* Setting it to database will use the database
*
*
*/
define('CAKE_SESSION_SAVE', 'php');
/**
* If using you own table name for storing sessions
* set the table name here.
* DO NOT INCLUDE PREFIX IF YOU HAVE SET ONE IN database.php
*
*/
define('CAKE_SESSION_TABLE', 'cake_sessions');
/**
* Set a random string of used in session.
*
*/
define('CAKE_SESSION_STRING', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi');
/**
* Set the name of session cookie
*
*/
define('CAKE_SESSION_COOKIE', 'CAKEPHP');
/**
* Set level of Cake security.
*
*/
define('CAKE_SECURITY', 'high');
/**
* Set Cake Session time out.
* If CAKE_SECURITY define is set
* high: multiplied by 10
* medium: is multiplied by 100
* low is: multiplied by 300
*
* Number below is seconds.
*/
define('CAKE_SESSION_TIMEOUT', '120');
/**
* Uncomment the define below to use cake built in admin routes.
* You can set this value to anything you want.
* All methods related to the admin route should be prefixed with the
* name you set CAKE_ADMIN to.
* For example: admin_index, admin_edit
*/
// define('CAKE_ADMIN', 'admin');
/**
* The define below is used to turn cake built webservices
* on or off. Default setting is off.
*/
define('WEBSERVICES', 'off');
/**
* Compress output CSS (removing comments, whitespace, repeating tags etc.)
* This requires a/var/cache directory to be writable by the web server (caching).
* To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use Controller::cssTag().
*/
define('COMPRESS_CSS', false);
/**
* If set to true, helpers would output data instead of returning it.
*/
define('AUTO_OUTPUT', false);
/**
* If set to false, session would not automatically be started.
*/
define('AUTO_SESSION', true);
/**
* Set the max size of file to use md5() .
*/
define('MAX_MD5SIZE', (5 * 1024) * 1024);
/**
* To use Access Control Lists with Cake...
*/
define('ACL_CLASSNAME', 'DB_ACL');
define('ACL_FILENAME', 'dbacl' . DS . 'db_acl');
?>

Просмотреть файл

@ -0,0 +1,11 @@
<?php
class DATABASE_CONFIG {
var $default = array('driver' => 'mysql',
'connect' => 'mysql_connect',
'host' => 'localhost',
'login' => '',
'password' => '',
'database' => '',
'prefix' => '');
}
?>

Просмотреть файл

@ -0,0 +1,72 @@
<?php
/* SVN FILE: $Id: inflections.php,v 1.3 2006/10/08 03:39:21 reed%reedloden.com Exp $ */
/**
* Custom Inflected Words.
*
* This file is used to hold words that are not matched in the normail Inflector::pluralize() and
* Inflector::singularize()
*
* PHP versions 4 and %
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.app.config
* @since CakePHP v 1.0.0.2312
* @version $Revision: 1.3 $
* @modifiedby $LastChangedBy: phpnut $
* @lastmodified $Date: 2006/10/08 03:39:21 $
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* This is a key => value array of regex used to match words.
* If key matches then the value is returned.
*
* $pluralRules = array('/(s)tatus$/i' => '\1\2tatuses', '/^(ox)$/i' => '\1\2en', '/([m|l])ouse$/i' => '\1ice');
*/
$pluralRules = array();
/**
* This is a key only array of plural words that should not be inflected.
* Notice the last comma
*
* $uninflectedPlural = array('.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox');
*/
$uninflectedPlural = array();
/**
* This is a key => value array of plural irregular words.
* If key matches then the value is returned.
*
* $irregularPlural = array('atlas' => 'atlases', 'beef' => 'beefs', 'brother' => 'brothers')
*/
$irregularPlural = array();
/**
* This is a key => value array of regex used to match words.
* If key matches then the value is returned.
*
* $singularRules = array('/(s)tatuses$/i' => '\1\2tatus', '/(matr)ices$/i' =>'\1ix','/(vert|ind)ices$/i')
*/
$singularRules = array();
/**
* This is a key only array of singular words that should not be inflected.
* You should not have to change this value below if you do change it use same format
* as the $uninflectedPlural above.
*/
$uninflectedSingular = $uninflectedPlural;
/**
* This is a key => value array of singular irregular words.
* Most of the time this will be a reverse of the above $irregularPlural array
* You should not have to change this value below if you do change it use same format
*
* $irregularSingular = array('atlases' => 'atlas', 'beefs' => 'beef', 'brothers' => 'brother')
*/
$irregularSingular = array_flip($irregularPlural);
?>

Просмотреть файл

@ -0,0 +1,46 @@
<?php
/* SVN FILE: $Id: routes.php,v 1.2 2006/09/20 07:22:44 reed%reedloden.com Exp $ */
/**
* Short description for file.
*
* In this file, you set up routes to your controllers and their actions.
* Routes are very important mechanism that allows you to freely connect
* different urls to chosen controllers and their actions (functions).
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.app.config
* @since CakePHP v 0.2.9
* @version $Revision: 1.2 $
* @modifiedby $LastChangedBy: phpnut $
* @lastmodified $Date: 2006/09/20 07:22:44 $
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Here, we are connecting '/' (base path) to controller called 'Pages',
* its action called 'display', and we pass a param to select the view file
* to use (in this case, /app/views/pages/home.thtml)...
*/
$Route->connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
* ...and connect the rest of 'Pages' controller's urls.
*/
$Route->connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
* Then we connect url '/test' to our test controller. This is helpfull in
* developement.
*/
$Route->connect('/tests', array('controller' => 'tests', 'action' => 'index'));
?>

Просмотреть файл

@ -0,0 +1,49 @@
CREATE TABLE IF NOT EXISTS `comments` (
`id` int(10) NOT NULL auto_increment,
`assoc` int(10) NOT NULL default '0',
`owner` int(10) NOT NULL default '0',
`time` int(15) NOT NULL default '0',
`text` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `parties` (
`id` int(10) NOT NULL auto_increment,
`owner` int(10) NOT NULL default '0',
`name` tinytext NOT NULL,
`vname` tinytext,
`address` tinytext NOT NULL,
`website` tinytext,
`notes` text,
`date` int(10) default NULL,
`duration` int(11) default NULL,
`guests` tinytext NOT NULL,
`confirmed` tinyint(1) NOT NULL default '0',
`inviteonly` tinyint(1) NOT NULL default '0',
`lat` float default NULL,
`long` float default NULL,
`zoom` int(5) default NULL,
`useflickr` tinyint(1) NOT NULL default '0',
`flickrid` tinytext NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `users` (
`id` int(10) NOT NULL auto_increment,
`role` tinyint(2) NOT NULL default '0',
`email` varchar(75) NOT NULL default '',
`active` varchar(10) default NULL,
`password` varchar(40) NOT NULL default '',
`salt` varchar(9) NOT NULL default '',
`name` tinytext NOT NULL,
`location` tinytext NOT NULL,
`website` tinytext NOT NULL,
`lat` float default NULL,
`long` float default NULL,
`zoom` tinyint(2) NOT NULL default '12',
`showemail` tinyint(1) NOT NULL default '1',
`showloc` tinyint(1) NOT NULL default '1',
`showmap` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Просмотреть файл

@ -0,0 +1,68 @@
<?php
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Firefox Party Tool
*
* The Initial Developer of the Original Code is
* Ryan Flint <rflint@dslr.net>
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
uses('sanitize');
class CommentController extends AppController {
var $name = 'Comment';
var $components = array('Security');
function beforeFilter() {
$this->Security->requirePost('add');
}
function add($pid, $uid) {
if (!$this->Session->check('User'))
$this->redirect('/');
if (!empty($this->data)) {
// Explictly destroy the last model to avoid an edit instead of an insert
$this->Comment->create();
$clean = new Sanitize();
$text = $clean->html($this->data['Comment']['text']);
$this->data['Comment']['text'] = preg_replace('/\n/', '<br/>', $text);
$this->data['Comment']['owner'] = $uid;
$this->data['Comment']['assoc'] = $pid;
$this->data['Comment']['time'] = time();
if ($this->Comment->save($this->data)) {
$this->redirect('/party/view/'.$pid);
}
}
}
}
?>

Просмотреть файл

@ -0,0 +1,75 @@
<?php
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Firefox Party Tool
*
* The Initial Developer of the Original Code is
* Ryan Flint <rflint@dslr.net>
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
class FeedsController extends AppController {
var $name = 'Feeds';
function index() {
header('Content-type: text/xml');
$this->layout = 'ajax';
$this->set('count', $this->Feed->findCount());
}
function latest() {
header('Content-type: text/xml');
$this->layout = 'ajax';
$this->set('latest', $this->Feed->findAll('', '', 'id DESC', 10, 1));
}
function comments($id = null) {
$this->layout = 'ajax';
header('Content-type: text/xml');
if (!is_numeric($id))
return;
$this->set('comments', $this->Feed->getComments($id));
$this->set('pid', $id);
}
function upcoming() {
$this->layout = 'ajax';
header('Content-type: text/xml');
$this->set('latest', $this->Feed->findAll('WHERE date > '. time(), '', 'date ASC', 10, 1));
}
function ical() {
$this->layout = 'ajax';
header('Content-type: text/plain');
$weekago = time() - 604800;
$this->set('events', $this->Feed->findAll('WHERE date > '. $weekago, '', 'date ASC', 50, 1));
}
}
?>

Просмотреть файл

@ -0,0 +1,44 @@
<?php
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Firefox Party Tool
*
* The Initial Developer of the Original Code is
* Ryan Flint <rflint@dslr.net>
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
class PagesController extends AppController {
var $name = 'Pages';
function display() {
$this->set('pcount', $this->Page->findCount());
$this->set('ucount', $this->Page->getUsers());
}
}

Просмотреть файл

@ -0,0 +1,212 @@
<?php
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Firefox Party Tool
*
* The Initial Developer of the Original Code is
* Ryan Flint <rflint@dslr.net>
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
vendor('webServices');
uses('sanitize');
class PartyController extends AppController {
var $name = 'Party';
var $components = array('RequestHandler');
var $components = array('Security');
function beforeFilter() {
$this->Security->requirePost('rsvp','unrsvp');
}
function index() {
if (GMAP_API_KEY != null)
$this->set('body_args', ' onload="initMashUp()" onunload="GUnload()"');
}
function register() {
if (!$this->Session->check('User')) {
$this->redirect('/user');
}
$this->set('error', false);
if (GMAP_API_KEY != null)
$this->set('body_args', ' onload="mapInit(14.944785, -156.796875, 1)" onunload="GUnload()"');
if (!empty($this->data)) {
$clean = new Sanitize();
$clean->cleanArray($this->data);
$this->data['Party']['date'] = mktime($this->data['Party']['hour_hour'],
$this->data['Party']['minute_min'],
0,
$this->data['Party']['month_hour'],
$this->data['Party']['day_day'],
$this->data['Party']['year_year']);
$this->data['Party']['owner'] = $_SESSION['User']['id'];
if (empty($this->data['Party']['lat']) && !empty($this->data['Party']['address']) &&
$this->data['Party']['geocoded'] == 0) {
// Attempt to geocode the address again
$geocoder = new webServices(array('type' => 'geocode'));
if ($ll = $geocoder->geocode($this->data['Party']['address']) != 0) {
$this->data['Party']['lat'] = $ll['lat'];
$this->data['Party']['long'] = $ll['lng'];
}
else {
// May not come back with exactly what the user was looking for, but they can always edit
$suggest = new webServices(array('type' => 'gsuggest'));
if ($suggestion = $suggest->GSuggest($this->data['Party']['address']) != 0) {
$this->data['Party']['address'] = $suggestion;
if ($ll = $geocoder->geocode($suggestion) != 0) {
$this->data['Party']['lat'] = $ll['lat'];
$this->data['Party']['long'] = $ll['lng'];
}
}
}
}
if ($this->Party->save($this->data))
$this->redirect('party/view/'.$this->Party->getInsertId());
}
}
function view($id = null, $page = null) {
if ($id == "all") {
$count = $this->Party->findCount();
$pages = ceil($count/10);
if ($page == null)
$page = 1;
if ($page > 1)
$this->set('prev', $page - 1);
if ($page < $pages)
$this->set('next', $page + 1);
$this->set('parties', $this->Party->findAll(null, null, "name ASC", 10, $page));
}
else if (is_numeric($id)) {
$party = $this->Party->findById($id);
$this->set('party', $party);
if ($party['Party']['useflickr'] == 1) {
$data = array('type' => 'flickr', 'userid' => $party['Party']['flickrid']);
$flickr = new webServices($data);
$this->set('flickr', ($flickr->fetchPhotos(FLICKR_TAG_PREFIX.$party['Party']['id'], 8)));
}
if (!empty($party['Party']['guests'])) {
$guests = explode(',', $party['Party']['guests']);
$names = array();
for ($i = 0; $i < count($guests); $i++)
array_push($names, $this->Party->getUserName($guests[$i]));
$this->set('guests', $guests);
$this->set('names', $names);
}
$this->set('host', $this->Party->getUserName($party['Party']['owner']));
$this->set('comments', $this->Party->getComments($party['Party']['id']));
$this->set('body_args', ' onload="mapInit('.$party['Party']['lat'].', '.$party['Party']['long'].', '.$party['Party']['zoom'].', \'stationary\')" onunload="GUnload()"');
}
else {
$this->redirect('/party/view/all');
}
}
function rsvp($aParty = null) {
if (!is_numeric($aParty))
$this->redirect('/');
$party = $this->Party->findById($aParty);
$user = $this->Session->read('User');
if (empty($user['id']))
$this->redirect('/user/login');
else {
if (empty($party['Party']['guests'])) {
$this->data['Party']['guests'] = $user['id'];
$this->data['Party']['id'] = $aParty;
}
else {
$attendees = explode(',', $party['Party']['guests']);
if (in_array($user['id'], $attendees))
$this->redirect('/party/view/'.$aParty);
else {
array_push($attendees, $user['id']);
$csv = implode(',', $attendees);
$this->data['Party']['guests'] = $csv;
}
}
if ($this->Party->save($this->data))
$this->redirect('/party/view/'.$aParty.'/added');
}
}
function unrsvp($aParty) {
$user = $this->Session->read('User');
if (empty($user)) {
$this->redirect('/user/login');
}
if (is_numeric($aParty)) {
$party = $this->Party->findById($aParty);
$temp = explode(',', $party['Party']['guests']);
$id = array_search($user['id'], $temp);
if (!empty($temp[$id])) {
unset($temp[$id]);
$this->data['Party']['guests'] = implode(',', $temp);
$this->data['Party']['id'] = $aParty;
if ($this->Party->save($this->data))
$this->redirect('/party/view/'.$aParty.'/removed');
}
}
else
$this->redirect('/');
}
function invite() {
//XXX TODO
}
function js() {
$this->layout = 'ajax';
$this->set('parties', $this->Party->findAll());
}
}
?>

Просмотреть файл

@ -0,0 +1,337 @@
<?php
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Firefox Party Tool
*
* The Initial Developer of the Original Code is
* Ryan Flint <rflint@dslr.net>
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
vendor('mail');
uses('sanitize');
class UserController extends AppController {
var $name = 'User';
var $helpers = array('Html');
function index() {
if (!$this->Session->check('User')) {
$this->redirect('/user/login');
}
$user = $this->Session->read('User');
$this->set('parties', $this->User->memberOf($user['id']));
$this->set('hparties', $this->User->hostOf($user['id']));
}
function edit() {
$this->set('error', false);
$user = $this->User->findById($_SESSION['User']['id']);
$this->set('user', $user);
if (GMAP_API_KEY != null && !empty($user['User']['lat']))
$this->set('body_args',
' onload="mapInit('.$user["User"]["lat"].', '.$user["User"]["long"].', '.$user["User"]["zoom"].');" onunload="GUnload()"');
if (!empty($this->data)) {
//XXX TODO
$this->redirect('/user/');
}
}
function view($aUid = null) {
if ($aUid === null || !is_numeric($aUid))
$this->redirect('/');
else {
$user = $this->User->findById($aUid);
$this->set('user', $user);
if (GMAP_API_KEY != null && !empty($user['User']['lat']))
$this->set('body_args',
' onload="mapInit('.$user["User"]["lat"].', '.$user["User"]["long"].', '.$user["User"]["zoom"].', \'stationary\');" onunload="GUnload()"');
$parties = $this->User->memberOf($user['User']['id']);
$this->set('parties', $parties);
}
}
function register() {
$this->set('error', false);
if ($this->Session->check('User')) {
$this->redirect('/user/');
}
if (GMAP_API_KEY != null)
$this->set('body_args', ' onload="mapInit()" onunload="GUnload()"');
if (!empty($this->data)) {
$clean = new Sanitize();
$temp = array('email' => $this->data['User']['email'],
'password' => $this->data['User']['password'],
'confpassword' => $this->data['User']['confpassword'],
'lat' => $clean->sql($this->data['User']['lat']),
'long' => $clean->sql($this->data['User']['long']));
//Nuke everything else
$clean->cleanArray($this->data);
$this->data['User']['email'] = $temp['email'];
$this->data['User']['password'] = $temp['password'];
$this->data['User']['confpassword'] = $temp['confpassword'];
$this->data['User']['lat'] = $temp['lat'];
$this->data['User']['long'] = $temp['long'];
$this->data['User']['role'] = 0;
if (!$this->User->findByEmail($this->data['User']['email'])) {
if ($this->data['User']['password'] === $this->data['User']['confpassword']) {
if ($this->User->validates($this->data)) {
$string = $this->data['User']['email'].uniqid(rand(), true).$this->data['User']['password'];
$this->data['User']['salt'] = substr(md5($string), 0, 9);
$this->data['User']['password'] = sha1($this->data['User']['password'] . $this->data['User']['salt']);
$key = null;
$chars = "1234567890abcdefghijklmnopqrstuvwxyz";
for ($i = 0; $i < 10; $i++) {
$key .= $chars{rand(0,35)};
}
$this->data['User']['active'] = $key;
if ($this->User->save($this->data)) {
$message = array(
'from' => 'Firefox Party <noreply@screwedbydesign.com>',
'envelope' => 'noreply@screwedbydesign.com',
'to' => $this->data['User']['email'],
'subject' => 'Your Firefox Party Registration',
'message' => "You're almost ready to party! Just go to http://screwedbydesign.com/cake/user/activate/".$key." to activate your account.");
$mail = new mail($message);
$mail->send();
$this->redirect('/user/login/new');
}
}
else {
$this->validateErrors($this->User);
$this->render();
}
}
else {
$this->User->invalidate('password');
$this->User->invalidate('confpassword');
$this->render();
}
}
else {
$this->User->invalidate('email');
$this->render();
}
}
}
function activate($aKey = null) {
if ($aKey == null)
$this->redirect('/');
else {
$this->data = $this->User->findByActive($aKey);
$this->data['User']['active'] = 1;
if ($this->User->save($this->data)) {
$this->redirect('/user/login/active');
}
}
}
function login($isNew = null) {
if ($this->Session->check('User')) {
$this->redirect('/user/');
}
$this->set('error', false);
if ($isNew !== null) {
switch($isNew) {
case "new":
$this->set('preamble', 'Thank you for registering! To login, you\'ll need to activate your account. Please check your email for your activation link.');
break;
case "rnew":
$this->set('preamble', 'An email with instructions on how to reset your password has been sent.');
break;
case "active":
$this->set('preamble', 'Your account has been activated. You may now login.');
break;
case "reset":
$this->set('preamble', 'Your password has been reset.');
break;
}
$this->render();
}
if (!empty($this->data)) {
$user = $this->User->findByEmail($this->data['User']['email']);
if ($user['User']['active'] != 1) {
$this->set('preamble', 'Your account hasn\'t been activated yet.
Please check your email (including junk/spam folders) for your
activation link, or click <a href="/cake/user/recover/activate">here</a>
to resend your activation details.');
$this->render();
}
if ($user['User']['active'] == 1 && $user['User']['password'] == sha1($this->data['User']['password'] . $user['User']['salt'])) {
$this->Session->write('User', $user['User']);
$this->redirect('/user/');
}
else {
$this->set('error', true);
}
}
}
function logout() {
$this->Session->delete('User');
$this->redirect('/');
}
function recover($aType = null, $aCode = null, $aId = null) {
switch ($aType) {
case "password":
$this->set('hideInput', false);
$this->set('url', 'password');
if (!empty($this->data)) {
$user = $this->User->findByEmail($this->data['User']['email']);
if (!isset($user['User']['email'])) {
$this->set('error', 'Could not find a user with that email address. Please check it and try again.');
$this->render();
}
else {
$code = md5($user['User']['salt'].$user['User']['email'].$user['User']['password']);
$message = array('from' => APP_NAME.'<'.APP_EMAIL.'>',
'envelope' => APP_EMAIL,
'to' => $user['User']['email'],
'subject' => APP_NAME.' Password Request',
'message' => "Just go to http://screwedbydesign.com/cake/user/recover/password/".$code."/".$user['User']['id']." to reset your password.");
$mail = new mail($message);
$mail->send();
$this->redirect('user/login/rnew');
}
}
if ($aCode !== null && $aId !== null) {
$this->set('hideInput', true);
$this->set('reset', false);
$user = $this->User->findById($aId);
if (!$user) {
$this->set('error', 'Invalid request. Please check the URL and try again.');
$this->render();
}
if ($aCode == md5($user['User']['salt'].$user['User']['email'].$user['User']['password'])) {
$this->set('reset', true);
$this->set('code', $aCode."/".$aId);
$this->render();
}
else {
$this->set('error', 'Invalid request. Please check the URL and try again.');
$this->render();
}
}
break;
case "activate":
$this->set('hideInput', false);
$this->set('url', 'activate');
if (!empty($this->data)) {
$user = $this->User->findByEmail($this->data['User']['email']);
if (!$user) {
$this->set('error', 'Could not find a user with that email address. Please check it and try again.');
$this->render();
}
if ($user['User']['active'] == 1)
$this->redirect('/user/login/active');
else {
$message = array('from' => 'Firefox Party <noreply@screwedbydesign.com>',
'envelope' => 'noreply@screwedbydesign.com',
'to' => $user['User']['email'],
'subject' => 'Your Firefox Party Registration',
'message' => "You're almost ready to party! Just go to http://screwedbydesign.com/cake/user/activate/".$user['User']['active']." to activate your account.");
$mail = new mail($message);
$mail->send();
$this->redirect('user/login/new');
}
}
break;
case "reset":
if ($aCode !== null && $aId !== null) {
if (!empty($this->data)) {
$user = $this->User->findById($aId);
if (!$user) {
$this->set('error', 'Invalid request. Please check the URL and try again.');
$this->render();
}
if ($aCode == md5($user['User']['salt'].$user['User']['email'].$user['User']['password'])) {
$string = $user['User']['email'] . uniqid(rand(), true) . $this->data['User']['password'];
$this->data['User']['salt'] = substr(md5($string), 0, 9);
$this->data['User']['password'] = sha1($this->data['User']['password'] . $this->data['User']['salt']);
$this->data['User']['id'] = $aId;
if ($this->User->save($this->data))
$this->redirect('/user/login/reset');
}
}
}
break;
default:
$this->redirect('/');
}
}
function delete($id) {
$role = $this->Session->read('User');
if ($role['role'] != 2)
die("Access denied.");
else {
$this->User->del($id);
$this->redirect('/');
}
}
}
?>

26
webtools/partytool/index.php Executable file
Просмотреть файл

@ -0,0 +1,26 @@
<?php
/* SVN FILE: $Id: index.php,v 1.3 2006/10/08 03:39:21 reed%reedloden.com Exp $ */
/**
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.app
* @since CakePHP v 0.10.0.1076
* @version $Revision: 1.3 $
* @modifiedby $LastChangedBy: phpnut $
* @lastmodified $Date: 2006/10/08 03:39:21 $
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
require 'webroot' . DIRECTORY_SEPARATOR . 'index.php';
?>

Просмотреть файл

@ -0,0 +1,44 @@
<?php
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Firefox Party Tool
*
* The Initial Developer of the Original Code is
* Ryan Flint <rflint@dslr.net>
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
class Comment extends AppModel {
var $name = 'Comment';
var $validate = array(
'text' => VALID_NOT_EMPTY
);
}
?>

Просмотреть файл

@ -0,0 +1,46 @@
<?php
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Firefox Party Tool
*
* The Initial Developer of the Original Code is
* Ryan Flint <rflint@dslr.net>
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
class Feed extends AppModel {
var $name = 'Feeds';
var $useTable = "parties";
function getComments($aParty) {
$rv = $this->query("SELECT * FROM comments WHERE assoc = ".$aParty." LIMIT 10");
return $rv;
}
}
?>

Просмотреть файл

@ -0,0 +1,11 @@
<?php
class Page extends AppModel {
var $name = 'Page';
var $useTable = 'parties';
function getUsers() {
$rv = $this->query("SELECT COUNT(*) FROM users");
return $rv[0][0]["COUNT(*)"];
}
}
?>

Просмотреть файл

@ -0,0 +1,59 @@
<?php
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Firefox Party Tool
*
* The Initial Developer of the Original Code is
* Ryan Flint <rflint@dslr.net>
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
class Party extends AppModel {
var $name = 'Party';
var $validate = array(
'name' => VALID_NOT_EMPTY
);
function getComments($pid) {
$rv = $this->query("SELECT users.id AS uid, users.name,
comments.id AS cid, comments.time, comments.text
FROM users, parties, comments
WHERE comments.assoc = ".$pid."
AND users.id = comments.owner
AND parties.id = ".$pid);
return $rv;
}
function getUserName($uid) {
$rv = $this->query("SELECT name FROM users WHERE id = ".$uid);
return $rv[0]['users']['name'];
}
}
?>

Просмотреть файл

@ -0,0 +1,55 @@
<?php
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Firefox Party Tool
*
* The Initial Developer of the Original Code is
* Ryan Flint <rflint@dslr.net>
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
class User extends AppModel {
var $name = 'User';
var $validate = array(
'email' => VALID_EMAIL,
'password' => VALID_NOT_EMPTY
);
function memberOf($uid) {
$parties = $this->query("SELECT id,name FROM parties WHERE guests REGEXP '(,|^)".$uid."{1}(,|$)'");
return $parties;
}
function hostOf($uid) {
$parties = $this->query("SELECT id,name FROM parties WHERE owner = ".$uid);
return $parties;
}
}
?>

59
webtools/partytool/vendors/mail.php поставляемый Executable file
Просмотреть файл

@ -0,0 +1,59 @@
<?php
class mail {
var $from;
var $to;
var $subject;
var $message;
var $envelope;
/**
* Everything coming in via $params should be validated already
*/
function mail($params) {
if (array_key_exists('from', $params)) {
$this->from = $params['from'];
}
if (array_key_exists('to', $params)) {
$this->to = $params['to'];
}
if (array_key_exists('subject', $params)) {
$this->subject = $params['subject'];
}
if (array_key_exists('message', $params)) {
$this->message = $params['message'];
}
if (array_key_exists('envelope', $params)) {
$this->envelope = $params['envelope'];
}
}
function make_headers($type='html') {
$headers = '';
switch($type) {
case 'html':
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
break;
}
if (!empty($this->from)) {
$headers .= "From: {$this->from}\r\n";
$headers .= "Reply-To: {$this->from}\r\n";
}
return $headers;
}
function make_additional_parameters() {
if (!empty($this->envelope)) {
return '-f'.$this->envelope;
}
}
function send() {
mail($this->to, $this->subject, $this->message, $this->make_headers(), $this->make_additional_parameters());
}
}
?>

167
webtools/partytool/vendors/webServices.php поставляемый Executable file
Просмотреть файл

@ -0,0 +1,167 @@
<?php
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Firefox Party Tool
*
* The Initial Developer of the Original Code is
* Ryan Flint <rflint@dslr.net>
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
class webServices {
var $userid;
var $host;
function webServices($data) {
switch ($data['type']) {
case "flickr":
$this->host = "api.flickr.com";
if (array_key_exists('userid', $data)) {
$this->userid = $data['userid'];
}
if (array_key_exists('username', $data)) {
$head = "GET /services/rest/?method=flickr.people.findByUsername&api_key=".FLICKR_API_KEY."&username=".$data['username']." HTTP/1.1\r\n";
$head .= "Host: ".$this->host."\r\n";
$head .= "Connection: Close\r\n\r\n";
if ($results = $this->fetchResults($head)) {
preg_match('/nsid=\"(.*)\"/', $results, $matches);
if ($matches[1]) {
$this->userid = $matches[1];
}
else
return 0;
}
}
break;
case "gsuggest":
$this->host = "api.google.com";
break;
case "geocode":
$this->host = "maps.google.com";
break;
}
}
function fetchPhotos($tags, $num_results) {
$head = "GET /services/rest/?method=flickr.photos.search&api_key=".FLICKR_API_KEY."&user_id=".$this->userid."&tags=".$tags."&per_page=".$num_results." HTTP/1.1\r\n";
$head .= "Host: ".$this->host."\r\n";
$head .= "Connection: Close\r\n\r\n";
if ($results = $this->fetchResults($head)) {
preg_match_all('/id="(.*)" own/', $results, $ids, PREG_SET_ORDER);
preg_match_all('/owner="(.*)" sec/', $results, $owners, PREG_SET_ORDER);
preg_match_all('/secret="(.*)" ser/', $results, $secrets, PREG_SET_ORDER);
preg_match_all('/server="(.*)" tit/', $results, $servers, PREG_SET_ORDER);
preg_match_all('/title="(.*)" isp/', $results, $titles, PREG_SET_ORDER);
$arr = array();
for ($i = 0; $i < count($ids); $i++) {
$arr[$i] = array('id' => $ids[$i][1],
'owner' => $owners[$i][1],
'secret' => $secrets[$i][1],
'server' => $servers[$i][1],
'title' => $titles[$i][1]);
}
return $arr;
}
return 0;
}
function GSuggest($phrase) {
$soapy = '<?xml version=\'1.0\' encoding=\'UTF-8\'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<doSpellingSuggestion xmlns="urn:GoogleSearch">
<key xsi:type="xsd:string">'.GSEARCH_API_KEY.'</key>
<phrase xsi:type="xsd:string">'.$phrase.'</phrase>
</doSpellingSuggestion>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>';
$head = "POST /search/beta2 HTTP/1.1\r\n";
$head .= "Host: api.google.com\r\n";
$head .= "MessageType: CALL\r\n";
$head .= "Content-type: text/xml\r\n";
$head .= "Content-length: ".strlen($soapy)."\r\n";
$head .= "Connection: Close\r\n\r\n";
$head .= $soapy;
if ($results = $this->fetchResults($head)) {
if (preg_match('/return xsi:type="xsd:string">(.*)</', $results, $matches))
return $matches[1];
else
return 0;
}
return 0;
}
function geocode($query) {
$head = "GET /maps/geo?q=".urlencode($query)."&output=xml&key=".GMAP_API_KEY." HTTP/1.1\r\n";
$head .= "Host: maps.google.com\r\n";
$head .= "Connection: Close\r\n\r\n";
if ($results = $this->fetchResults($head)) {
if (stristr($results, '<code>200</code>')) {
preg_match('/coordinates>(.*)</', $results, $matches);
$ll = explode(',', $matches[1]);
$rv = array('lat' => $ll[0], 'lng' => $ll[1]);
return $rv;
}
}
return 0;
}
function fetchResults($headers) {
$fs = fsockopen($this->host, 80, $errno, $errstr, 30);
if (!$fs)
return 0;
else {
fwrite($fs, $headers);
$buffer = null;
while (!feof($fs))
$buffer .= fgets($fs, 128);
fclose($fs);
return $buffer;
}
}
}
?>

Просмотреть файл

@ -0,0 +1,10 @@
<?php if(!isset($_SESSION['User'])): ?>
<strong>Welcome guest!</strong>
<a href="<?php echo $html->url('/user/login'); ?>">Login</a>
<a href="<?php echo $html->url('/user/register'); ?>">Register</a>
<?php else: ?>
<strong>Welcome <?php echo (!empty($_SESSION['User']['name'])) ? $_SESSION['User']['name'] : $_SESSION['User']['email']; ?>!</strong>
<a href="<?php echo $html->url('/user'); ?>">My Account</a>
<a href="<?php echo $html->url('/user/logout'); ?>">Logout</a>
<?php endif; ?>
<br/>

Просмотреть файл

@ -0,0 +1,16 @@
<?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; ?>
<rss version="0.91">
<channel>
<pubDate><?php echo date('r'); ?></pubDate>
<description><?php echo APP_NAME." - Latest Comments"; ?></description>
<link><?php echo "http://".$_SERVER["SERVER_NAME"].$html->url('/party/view/'.$pid); ?></link>
<title><?php echo APP_NAME." - Latest Comments"; ?></title>
<?php foreach($comments as $comment): ?>
<item>
<title><![CDATA[<?php echo substr($comment['comments']['text'], 0, 25); ?>]]></title>
<description><?php echo $comment['comments']['text'] ?></description>
<link><?php echo "http://".$_SERVER["SERVER_NAME"].$html->url('/party/view/'.$comment['comments']['assoc'].'#c'.$comment['comments']['id']); ?></link>
</item>
<?php endforeach; ?>
</channel>
</rss>

Просмотреть файл

@ -0,0 +1,26 @@
BEGIN:VCALENDAR
X-WR-CALNAME:<?php echo APP_NAME."\n"; ?>
X-WR-CALDESC:Upcoming Parties
X-WR-TIMEZONE:US/Eastern
PRODID:-//<?php echo $_SERVER["SERVER_NAME"]; ?>//calendar//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
<?php foreach($events as $event): ?>
BEGIN:VEVENT
UID:<?php echo "http://".$_SERVER["SERVER_NAME"].$html->url('/party/view/'.$event['Feeds']['id'])."\n"; ?>
DTSTAMP:<?php echo date('Ymd\This\Z', $event['Feeds']['date'])."\n"; ?>
LOCATION:<?php echo str_replace(",", "\,", $event['Feeds']['address'])."\n"; ?>
SUMMARY:<?php echo $event['Feeds']['name']."\n"; ?>
DTSTART:<?php echo date('Ymd\This', $event['Feeds']['date'])."\n"; ?>
DURATION:PT2H
URL:<?php echo "http://".$_SERVER["SERVER_NAME"].$html->url('/party/view/'.$event['Feeds']['id'])."\n"; ?>
STATUS:<?php echo (($event['Feeds']['confirmed'] == 1) ? "CONFIRMED" : "TENTATIVE")."\n"; ?>
DESCRIPTION:
<?php echo $event['Feeds']['name']." \n"; ?>
<?php echo str_replace(",", "\,", $event['Feeds']['address'])." \n"; ?>
<?php echo date('h:ia', $event['Feeds']['date'])." \n"; ?>
<?php echo $event['Feeds']['notes']." \n"; ?>
END:VEVENT
<?php endforeach; ?>
END:VCALENDAR

Просмотреть файл

@ -0,0 +1,14 @@
<?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; ?>
<rss version="0.91">
<channel>
<pubDate><?php echo date('r'); ?></pubDate>
<description><?php echo APP_NAME." - Party Count"; ?></description>
<link><?php echo "http://".$_SERVER["SERVER_NAME"].$html->url('/'); ?></link>
<title><?php echo APP_NAME." - Party Count"; ?></title>
<item>
<title><?php echo $count; ?></title>
<description>Total Parties</description>
<link><?php echo "http://".$_SERVER["SERVER_NAME"].$html->url('/'); ?></link>
</item>
</channel>
</rss>

Просмотреть файл

@ -0,0 +1,16 @@
<?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; ?>
<rss version="0.91">
<channel>
<pubDate><?php echo date('r'); ?></pubDate>
<description><?php echo APP_NAME." - Latest Parties"; ?></description>
<link><?php echo "http://".$_SERVER["SERVER_NAME"].$html->url('/'); ?></link>
<title><?php echo APP_NAME." - Latest Parties"; ?></title>
<?php foreach($latest as $party): ?>
<item>
<title><?php echo $party['Feeds']['name'] ?></title>
<description><?php echo $party['Feeds']['vname'] ?></description>
<link><?php echo "http://".$_SERVER["SERVER_NAME"].$html->url('/party/view/'.$party['Feeds']['id']); ?></link>
</item>
<?php endforeach; ?>
</channel>
</rss>

Просмотреть файл

@ -0,0 +1,16 @@
<?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; ?>
<rss version="0.91">
<channel>
<pubDate><?php echo date('r'); ?></pubDate>
<description><?php echo APP_NAME." - Upcoming Parties"; ?></description>
<link><?php echo "http://".$_SERVER["SERVER_NAME"].$html->url('/'); ?></link>
<title><?php echo APP_NAME." - Upcoming Parties"; ?></title>
<?php foreach($latest as $party): ?>
<item>
<title><![CDATA[<?php echo $party['Feeds']['name'] ?>]]></title>
<description><?php echo date('Y-m-d H:i', $party['Feeds']['date']); ?></description>
<link><?php echo "http://".$_SERVER["SERVER_NAME"].$html->url('/party/view/'.$party['Feeds']['id']); ?></link>
</item>
<?php endforeach; ?>
</channel>
</rss>

Просмотреть файл

@ -0,0 +1,21 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $title_for_layout?></title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="<?php echo $html->url('/css/main.css'); ?>"/>
<link rel="alternate" type="application/rss+xml" href="<?php echo $html->url('/feeds/latest'); ?>"/>
</head>
<body<?php echo @$body_args ?>>
<div id="container">
<div id="mozilla-com">
<a href="http://www.mozilla.com">Visit Mozilla.com</a>
</div>
<div id="user">
<?php echo $this->renderElement('user_options'); ?>
</div>
<div id="header"><br/><a href="/cake/">Firefox Party!</a></div>
<?php echo $content_for_layout ?>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,23 @@
<div style="font-size: x-large; font-weight: bold; text-align: center">
<?php echo $pcount.(($pcount == 1) ? ' Party, ' : ' Parties, ').$ucount.(($ucount == 1) ? ' Partygoer, ' : ' Partygoers, ');
$difference = 1161975280 - time();
$days_left = floor($difference/60/60/24);
echo $days_left." days until Firefox 2!"; ?><br/></div>
<div>
<div style="float: left; width: 75%">
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla porta tellus ac leo suscipit euismod. Aenean id ante. Vestibulum consectetuer. Integer diam neque, iaculis eget, ultricies ac, elementum sit amet, risus. Proin blandit. Cras quam. Aenean sollicitudin, lorem vel lobortis bibendum, lorem nibh gravida elit, et aliquam dolor libero bibendum sem. Cras pharetra. Vivamus ligula nisl, mattis sed, molestie nec, interdum ac, massa. In eros pede, dictum at, mollis eu, adipiscing eget, ante. Nunc elit nunc, tincidunt sit amet, tincidunt eu, euismod id, massa. Vivamus molestie. Sed non dui non velit semper egestas. Maecenas vulputate. Quisque sapien. Pellentesque interdum, libero rutrum tincidunt molestie, dui pede eleifend quam, quis tempor sapien ligula et turpis.
Maecenas ut sem. Nam adipiscing sem sit amet magna. Curabitur a risus non ipsum mattis tempor. Fusce in arcu. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed eu diam nec nisi ultrices laoreet. Pellentesque tincidunt, enim nec malesuada tristique, est neque luctus dui, sit amet posuere nunc nulla vel diam. Phasellus pharetra tortor ut massa lacinia adipiscing. Morbi in nulla. Proin ut diam et tortor hendrerit congue. Mauris porttitor fringilla augue. Etiam faucibus rutrum enim.
Maecenas varius massa sit amet nulla. Nunc sit amet mauris. Nunc eu purus a sapien aliquam aliquam. Donec sodales commodo dolor. Fusce volutpat. Sed quis ipsum nec dolor facilisis facilisis. Fusce leo massa, tincidunt in, sodales eu, sodales nec, libero. Etiam vehicula. Ut egestas. Ut consectetuer dolor ac est. Phasellus viverra euismod nisl. Nunc ut felis nec erat vulputate ullamcorper. Praesent rhoncus cursus nunc. Quisque elementum. Etiam euismod erat sit amet lorem.
</p>
</div>
<div style="float:right; width: 25%; font-size: large;">
<ul>
<li><a href="<?php echo $html->url('/party'); ?>">View map</a></li>
<li><a href="<?php echo $html->url('/party/view/all'); ?>">View all parties</a></li>
<li><a href="<?php echo $html->url('/user/register'); ?>">Register</a></li>
<li><a href="<?php echo $html->url('/party/register'); ?>">Create a party</a></li>
<ul>
</div>
</div>

Просмотреть файл

Просмотреть файл

@ -0,0 +1,7 @@
<?php if(GMAP_API_KEY != null): ?>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php echo GMAP_API_KEY; ?>"
type="text/javascript"></script>
<script src="<?php echo $html->url('/js/maps.js'); ?>" type="text/javascript"></script>
<script src="<?php echo $html->url('/party/js'); ?>" type="text/javascript"></script>
<div id="map" style="width: 750px; height: 500px"/>
<?php endif; ?>

Просмотреть файл

@ -0,0 +1,7 @@
function addParties() {
<?php foreach ($parties as $party):
if (!empty($party['Party']['lat']) && !empty($party['Party']['long'])): ?>
addParty(<?php echo $party['Party']['lat'];?>, <?php echo $party['Party']['long']?>, "<strong><?php echo $party['Party']['name']?></strong><br/><?php echo $party['Party']['vname']; ?><br/><?php echo $party['Party']['notes']; ?><br/><a href=\"<?php echo $html->url('/party/view/'.$party['Party']['id'])?>\">View Party</a>");
<?php endif; endforeach;?>
}
//

Просмотреть файл

@ -0,0 +1,75 @@
<?php if ($error): ?>
<p>There was an error in your submission, please try again.</p>
<?php endif; ?>
<form action="<?php echo $html->url('/party/register'); ?>" method="post">
<div>
<label for="name"><strong>Party Name</strong>:</label>
<?php echo $html->input('Party/name', array('size' => 35)); ?>
</div>
<div>
<label for="">Venue Name:</label>
<?php echo $html->input('Party/vname', array('size' => 35)); ?>
</div>
<div>
<label for="address">Address:</label>
<?php echo $html->input('Party/address', array('size' => 35, 'id' => 'location', 'onkeypress' => 'capture(event)', 'onblur' => 'update()')); ?>
<div id="suggest" style="display: none">Did you mean <span style="font-style: italic"><a id="suggest2" href="#" onclick=""></a></span>?</div>
</div>
<div>
<label for="date">Date:</label>
<?php echo $html->yearOptionTag('Party/year', null, date('Y'), MAX_YEAR, date('Y'), null, null, false); ?>-<?php echo $html->hourOptionTag('Party/month', null, false, date('m')); ?>-<?php echo $html->dayOptionTag('Party/day', null, date('d'), null, false); ?>
</div>
<div>
<label for="time">Time:</label>
<?php echo $html->hourOptionTag('Party/hour', null, true);?>:<?php echo $html->minuteOptionTag('Party/minute');?>
<?php echo $html->radio('Party/confirmed', array(0 => 'Tentative', 1 => 'Confirmed')); ?>
</div>
<div>
<label for="website">Web site:</label>
<?php echo $html->input('Party/website', array('size' => 35)); ?>
</div>
<div>
<label for="PartyNeedinvite">Invite only</label>
<?php echo $html->checkbox('Party/inviteonly'); ?>
</div>
<div>
Additional notes:<br/>
<?php echo $html->textarea('Party/notes'); ?>
</div>
<?php if(GMAP_API_KEY != null): ?>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php echo GMAP_API_KEY; ?>"
type="text/javascript"></script>
<script src="<?php echo $html->url('/js/maps.js'); ?>" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function update(aSuggest) {
var loc;
if (!aSuggest)
loc = document.getElementById("location").value;
else
loc = aSuggest;
if (loc != "")
geocode(loc);
}
function capture(event) {
if (event.keyCode == 13) {
event.preventDefault();
update();
}
}
//]]>
</script>
<div style="width: 500px; height: 300px; margin: 0 auto;">
<div id="maperror" style="display: none" class="error"></div>
<div id="map" style="height: 100%; width: 100%;"></div>
</div>
<?php echo $html->hidden('Party/lat', array('id' => 'lat'));
echo $html->hidden('Party/long', array('id' => 'long'));
echo $html->hidden('Party/zoom', array('id' => 'zoom'));
echo $html->hidden('Party/geocoded', array('id' => 'geocoded', 'value' => 0)); ?>
<?php endif; ?>
<?php echo $html->submit('Register'); ?>
</form>

Просмотреть файл

@ -0,0 +1,3 @@
<foo>
<s value="<?php echo $gresult; ?>"/>
</foo>

Просмотреть файл

Просмотреть файл

@ -0,0 +1,110 @@
<?php
if (isset($party)): ?>
<h1><?php echo $party['Party']['name']; ?></h1>
Host: <a href="<?php echo $html->url('/user/view/'.$party['Party']['owner']).'">'.$host; ?></a><br/>
<?php
if (!empty($party['Party']['address']))
echo 'Location: '.$party['Party']['address']."<br/>\n";
if (!empty($party['Party']['vname']))
echo 'Venue: '.$party['Party']['vname']."<br/>\n";
echo 'Date: '.(($party['Party']['confirmed'] == 1) ? date('Y-m-d h:m', $party['Party']['date']) : "TBA")."<br/>\n";
if (!empty($party['Party']['website']))
echo 'Website: <a href="'.$party['Party']['website'].'" rel="nofollow">'.$party['Party']['website']."</a><br/>\n";
if (!empty($party['Party']['notes']))
echo 'Notes: '.$party['Party']['notes']."<br/>\n";
?>
<br/>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php echo GMAP_API_KEY; ?>"
type="text/javascript"></script>
<script src="<?php echo $html->url('/js/maps.js'); ?>" type="text/javascript"></script>
<div id="map" style="height: 200px; width: 400px;"></div>
<h2>Who's coming:</h2>
<div>
<?php if (isset($guests)):
$i = 0;
$c = count($guests) - 1;
foreach ($guests as $guest): ?>
<a href="<?php echo $html->url('/user/view/'.$guest); ?>"><?php echo $names[$i]; ?></a><?php echo ($i < $c) ? ", " : ""; ?>
<?php $i++; endforeach; endif; if (isset($_SESSION['User']['id'])):?>
<br/><br/>
<form action="<?php
$isguest = (isset($guests)) ? in_array($_SESSION['User']['id'], $guests) : 0;
echo $html->url('/party/'.((!$isguest) ? 'rsvp/' : 'unrsvp/').$party['Party']['id']); ?>" method="post">
<?php if(!$isguest): ?>
<button>Count me in!</button>
<?php else: ?>
<button>Remove me</button>
<?php endif; ?>
</form>
<?php endif; ?>
</div>
<?php if (isset($flickr)): ?>
<a id="photos"></a>
<h2>Photos:</h2>
<?php foreach ($flickr as $pic): ?>
<a href="http://www.flickr.com/photos/<?php echo $pic['owner']."/".$pic['id']."/" ?>"><img src="http://static.flickr.com/<?php echo $pic['server']."/".$pic['id']."_".$pic['secret']."_s.jpg" ?>"/></a>
<?php endforeach; ?>
<br/>
<?php endif;
if (!empty($comments)): ?>
<h2>Comments:</h2>
<?php $i = 0;
foreach ($comments as $comment):
if ($i % 2 == 0)
$color = "white";
else
$color = "#DDD";
$i++;?>
<div style="border-top: 1px solid #555; background: <?php echo $color;?>"><?php echo $comment['comments']['text']; ?><br/>Posted by <a href="<?php echo $html->url('/user/view/'.$comment['users']['uid']); ?>"><?php echo $comment['users']['name']; ?></a> on <?php echo date('Y-m-d h:ia', $comment['comments']['time']); ?></span></div>
<?php endforeach;
endif;
if (isset($_SESSION['User'])): ?>
<h2>Add a comment:</h2>
<form action="<?php echo $html->url('/comment/add/'.$party['Party']['id'].'/'.$_SESSION['User']['id']); ?>" method="post">
<div>
<?php echo $html->textarea('Comment/text', array('rows' => 10, 'cols' => 50))."<br/>".$html->submit('Submit'); ?>
</div>
</form>
<?php endif; ?>
<?php endif; ?>
<?php if (isset($parties)):
if (isset($prev))
echo '<a href="'.$html->url('/party/view/all/'.$prev).'">Previous Page</a> ';
if (isset($next))
echo '<a href="'.$html->url('/party/view/all/'.$next).'">Next Page</a>';
$i = 0;
foreach ($parties as $party):
if ($i % 2 == 0)
$color = "white";
else
$color = "#DDD";
$i++; ?>
<div style="background: <?php echo $color; ?>">
<h1><?php echo $party['Party']['name']; ?></h1>
<?php
if (!empty($party['Party']['address']))
echo 'Location: '.$party['Party']['address']."<br/>\n";
if (!empty($party['Party']['vname']))
echo 'Venue: '.$party['Party']['vname']."<br/>\n";
echo 'Date: '.(($party['Party']['confirmed'] == 1) ? date('Y-m-d h:m', $party['Party']['date']) : "TBA")."<br/>\n";
if (!empty($party['Party']['website']))
echo 'Website: <a href="'.$party['Party']['website'].'" rel="nofollow">'.$party['Party']['website']."</a><br/>\n";
echo '<a href="'.$html->url('/party/view/'.$party['Party']['id']).'">View Party</a>';
?>
</div>
<?php endforeach;
if (isset($prev))
echo '<a href="'.$html->url('/party/view/all/'.$prev).'">Previous Page</a> ';
if (isset($next))
echo '<a href="'.$html->url('/party/view/all/'.$next).'">Next Page</a>';
endif;?>

Просмотреть файл

@ -0,0 +1,54 @@
<?php if ($error): ?>
<p>There was an error in your submission, please try again.</p>
<?php endif; ?>
<form action="<?php echo $html->url('/user/register'); ?>" method="post">
<div>
<label for="name">Name:</label>
<?php echo $html->input('User/name', array('size' => 20, 'value' => $user['User']['name'])); ?>
</div>
<div>
<label for="password"><strong>Password</strong>:</label>
<?php echo $html->password('User/password', array('size' => 20)); ?>
<?php echo $html->tagErrorMsg('User/password', 'Passwords don\'t match!')?>
</div>
<div>
<label for="confpassword"><strong>Confirm password</strong>:</label>
<?php echo $html->password('User/confpassword', array('size' => 20)); ?>
</div>
<div>
<label for="location">Location:</label>
<?php echo $html->input('User/location', array('id' => 'location', 'size' => 20, 'onkeypress' => 'capture(event)', 'value' => $user['User']['location'])); ?>
</div>
<?php if(GMAP_API_KEY != null): ?>
<a onclick="update()">Update map</a>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php echo GMAP_API_KEY; ?>"
type="text/javascript"></script>
<script src="<?php echo $html->url('/js/maps.js'); ?>" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function update() {
var loc = document.getElementById("location").value;
geocode(loc);
}
function capture(event) {
if (event.keyCode == 13) {
event.preventDefault();
update();
}
}
//]]>
</script>
<div style="width: 500px; height: 300px">
<div id="maperror" style="display: none" class="error"></div>
<div id="map" style="height: 100%; width: 100%;"></div>
</div>
<div>
<?php echo $html->hidden('User/lat', array('id' => 'lat'));
echo $html->hidden('User/long', array('id' => 'long'));
echo $html->hidden('User/zoom', array('id' => 'zoom')); ?>
</div>
<?php endif; ?>
<?php echo $html->submit('Update'); ?>
</form>

Просмотреть файл

@ -0,0 +1,25 @@
Parties I'm attending:
<?php
$c = count($parties) - 1;
$i = 0;
foreach ($parties as $party) {
echo '<a href="'.$html->url('/party/view/'.$party['parties']['id']).'">'.$party['parties']['name'].'</a>';
echo ($i < $c) ? ', ' : '';
$i++;
}
?>
<br/>
Parties I'm hosting:
<?php
$c = count($hparties) - 1;
$i = 0;
foreach ($hparties as $party) {
echo '<a href="'.$html->url('/party/view/'.$party['parties']['id']).'">'.$party['parties']['name'].'</a>';
echo ($i < $c) ? ', ' : '';
$i++;
}
?>
<ul>
<li><a href="<?php echo $html->url('/party/register'); ?>">Create a new party</a></li>
<li><a href="<?php echo $html->url('/user/edit'); ?>">Edit my account</a></li>
</ul>

Просмотреть файл

@ -0,0 +1,22 @@
<?if ($error): ?>
<p>The email address and password you supplied do not match. Please try again.</p>
<? endif;
if (isset($preamble)): ?>
<div class="info">
<?php echo $preamble; ?>
</div>
<?php endif; ?>
<form action="<?php echo $html->url('/user/login'); ?>" method="post">
<div>
<label for="email">Email:</label>
<?php echo $html->input('User/email', array('size' => 20)); ?>
</div>
<div>
<label for="password">Password:</label>
<?php echo $html->password('User/password', array('size' => 20)); ?>
<a href="<?php echo $html->url('/user/recover/password'); ?>">Forgot your password?</a>
</div>
<div>
<?php echo $html->submit('Login'); ?>
</div>
</form>

Просмотреть файл

@ -0,0 +1,25 @@
<form action="<?php
if (isset($reset))
echo $html->url('/user/recover/reset/'.$code);
else
echo $html->url('/user/recover/'.$url); ?>" method="post">
<?php if (isset($error)): ?>
<div class="error">
<?php echo $error; ?>
</div>
<?php endif; ?>
<div>
<?php if (!$hideInput): ?>
<label for="UserEmail">Email address:</label>
<?php echo $html->input('User/email'); ?>
<?php endif;
if (isset($reset)): ?>
<label for="UserPassword">New password:</label>
<?php echo $html->password('User/password'); ?>
<br/>
<label for="UserConfirm">Confirm password:</label>
<?php echo $html->password('User/confirm'); ?>
<?php endif; ?>
</div>
<?php echo $html->submit('Submit'); ?>
</form>

Просмотреть файл

@ -0,0 +1,63 @@
<?php if ($error): ?>
<p>There was an error in your submission, please try again.</p>
<?php endif; ?>
<form action="<?php echo $html->url('/user/register'); ?>" method="post">
<div>
<label for="email"><strong>Email address</strong>:</label>
<?php echo $html->input('User/email', array('size' => 20)); ?>
<?php echo $html->tagErrorMsg('User/email', 'Email invalid or already registered.')?>
</div>
<div>
<label for="name">Name:</label>
<?php echo $html->input('User/name', array('size' => 20)); ?>
</div>
<div>
<label for="password"><strong>Password</strong>:</label>
<?php echo $html->password('User/password', array('size' => 20)); ?>
<?php echo $html->tagErrorMsg('User/password', 'Passwords don\'t match!')?>
</div>
<div>
<label for="confpassword"><strong>Confirm password</strong>:</label>
<?php echo $html->password('User/confpassword', array('size' => 20)); ?>
</div>
<div>
<label for="location">Location:</label>
<?php echo $html->input('User/location', array('id' => 'location', 'size' => 20, 'onkeypress' => 'capture(event)')); ?>
</div>
<div>
<label for="website">Website:</label>
<?php echo $html->input('User/website', array('size' => 20)); ?>
</div>
<?php if(GMAP_API_KEY != null): ?>
<a onclick="update()">Update map</a>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php echo GMAP_API_KEY; ?>"
type="text/javascript"></script>
<script src="<?php echo $html->url('/js/maps.js'); ?>" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function update() {
var loc = document.getElementById("location").value;
geocode(loc);
}
function capture(event) {
if (event.keyCode == 13) {
event.preventDefault();
update();
}
}
//]]>
</script>
<div style="width: 500px; height: 300px">
<div id="maperror" style="display: none" class="error"></div>
<div id="map" style="height: 100%; width: 100%;"></div>
</div>
<div>
<?php echo $html->hidden('User/lat', array('id' => 'lat'));
echo $html->hidden('User/long', array('id' => 'long'));
echo $html->hidden('User/zoom', array('id' => 'zoom')); ?>
</div>
<?php endif; ?>
<?php echo $html->submit('Register'); ?>
</form>

Просмотреть файл

@ -0,0 +1,28 @@
<?php
if (!empty($user['User']['name']))
echo "<h1>".$user['User']['name']."</h1>";
if ($user['User']['showemail'] == 1 && @$_SESSION['User'])
echo "Email: ".$user['User']['email']."<br/>";
if ($user['User']['showloc'] == 1 && !empty($user['User']['location']))
echo "Location: ".$user['User']['location']."<br/>";
if (!empty($user['User']['website']))
echo 'Website: <a href="'.$user['User']['website'].'" rel="nofollow">'.$user['User']['website'].'</a><br/>';
echo "Attending: ";
$c = count($parties) - 1;
$i = 0;
foreach ($parties as $party) {
echo '<a href="'.$html->url('/party/view/'.$party['parties']['id']).'">'.$party['parties']['name'].'</a>';
echo ($i < $c) ? ', ' : '';
$i++;
}
?>
<?php if(isset($body_args) && $user['User']['showmap'] == 1): ?>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php echo GMAP_API_KEY; ?>" type="text/javascript"></script>
<script src="<?php echo $html->url('/js/maps.js'); ?>" type="text/javascript"></script>
<div id="map" style="height: 200px; width: 350px;"></div>
<?php endif; ?>

Просмотреть файл

@ -0,0 +1,6 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

Просмотреть файл

@ -0,0 +1,104 @@
<?php
/* SVN FILE: $Id: css.php,v 1.1 2006/09/11 05:56:11 reed%reedloden.com Exp $ */
/**
* Short description for file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.app.webroot
* @since CakePHP v 0.2.9
* @version $Revision: 1.1 $
* @modifiedby $LastChangedBy: phpnut $
* @lastmodified $Date: 2006/09/11 05:56:11 $
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
if (!defined(CAKE_CORE_INCLUDE_PATH)) {
die('You can not access this file directly');
}
/**
* Enter description here...
*/
require(CONFIGS . 'paths.php');
require(CAKE . 'basics.php');
require(LIBS . 'folder.php');
require(LIBS . 'file.php');
require(LIBS . 'legacy.php');
/**
* Enter description here...
*
* @param unknown_type $path
* @param unknown_type $name
* @return unknown
*/
function make_clean_css($path, $name) {
require(VENDORS . 'csspp' . DS . 'csspp.php');
$data =file_get_contents($path);
$csspp =new csspp();
$output=$csspp->compress($data);
$ratio =100 - (round(strlen($output) / strlen($data), 3) * 100);
$output=" /* file: $name, ratio: $ratio% */ " . $output;
return $output;
}
/**
* Enter description here...
*
* @param unknown_type $path
* @param unknown_type $content
* @return unknown
*/
function write_css_cache($path, $content) {
if (!is_dir(dirname($path))) {
mkdir(dirname($path));
}
$cache=new File($path);
return $cache->write($content);
}
if (preg_match('|\.\.|', $url) || !preg_match('|^ccss/(.+)$|i', $url, $regs)) {
die('Wrong file name.');
}
$filename = 'css/' . $regs[1];
$filepath = CSS . $regs[1];
$cachepath = CACHE . 'css' . DS . str_replace(array('/','\\'), '-', $regs[1]);
if (!file_exists($filepath)) {
die('Wrong file name.');
}
if (file_exists($cachepath)) {
$templateModified=filemtime($filepath);
$cacheModified =filemtime($cachepath);
if ($templateModified > $cacheModified) {
$output=make_clean_css($filepath, $filename);
write_css_cache($cachepath, $output);
} else {
$output = file_get_contents($cachepath);
}
} else {
$output=make_clean_css($filepath, $filename);
write_css_cache($cachepath, $output);
}
header("Date: " . date("D, j M Y G:i:s ", $templateModified) . 'GMT');
header("Content-Type: text/css");
header("Expires: " . gmdate("D, j M Y H:i:s", time() + DAY) . " GMT");
header("Cache-Control: cache"); // HTTP/1.1
header("Pragma: cache"); // HTTP/1.0
print $output;
?>

Просмотреть файл

@ -0,0 +1,74 @@
.error {
background: #ffa5a5;
border: 1px solid red;
text-align: center;
font-weight: bold;
padding: 5px;
margin: 5px 0 5px 0;
}
.info {
background: #fffe94;
border: 1px solid yellow;
text-align: center;
font-weight: bold;
padding: 5px;
margin: 5px 0 5px 0;
}
#user {
position: absolute;
right: 0;
}
img { border: 1px solid #555 }
body {
background: #fff url("/cake/img/body_back.png") top repeat-x;
color: #555;
font-family: arial, sans-serif;
margin: 0 10px;
padding: 0;
font-size: x-small;
voice-family: "\"}\"";
voice-family: inherit;
font-size: small;
}
a { color: #34518c; text-decoration: none; }
a:hover { text-decoration: underline; }
#container {
width: 742px;
position: relative;
margin: 0 auto;
padding: 22px 0;
}
#mozilla-com a {
position: absolute;
top: 0;
left: 0;
display: block;
text-indent: -5000em;
width: 110px;
height: 25px;
text-decoration: none;
background: url("/cake/img/mozilla-org.png") no-repeat;
}
#header {
background: url("/cake/img/header.gif") no-repeat;
color: white;
font-family: Arial;
font-size: 30px;
font-weight: bold;
text-align: center;
height: 127px;
}
#header a { color: white; text-decoration: none; }
#map {
border: 1px solid #555;
}

Двоичные данные
webtools/partytool/webroot/favicon.ico Executable file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.2 KiB

Двоичные данные
webtools/partytool/webroot/img/body_back.png Executable file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 365 B

Двоичные данные
webtools/partytool/webroot/img/header.gif Executable file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 15 KiB

Двоичные данные
webtools/partytool/webroot/img/header.png Executable file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 29 KiB

Двоичные данные
webtools/partytool/webroot/img/mozilla-org.png Executable file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.0 KiB

Просмотреть файл

@ -0,0 +1,87 @@
<?php
/* SVN FILE: $Id: index.php,v 1.1 2006/09/11 05:56:11 reed%reedloden.com Exp $ */
/**
* Short description for file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.app.webroot
* @since CakePHP v 0.2.9
* @version $Revision: 1.1 $
* @modifiedby $LastChangedBy: phpnut $
* @lastmodified $Date: 2006/09/11 05:56:11 $
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Do not change
*/
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
/**
* These defines should only be edited if you have cake installed in
* a directory layout other than the way it is distributed.
* Each define has a commented line of code that explains what you would change.
*
*/
if (!defined('ROOT')) {
//define('ROOT', 'FULL PATH TO DIRECTORY WHERE APP DIRECTORY IS LOCATED DO NOT ADD A TRAILING DIRECTORY SEPARATOR';
//You should also use the DS define to seperate your directories
define('ROOT', dirname(dirname(dirname(__FILE__))));
}
if (!defined('APP_DIR')) {
//define('APP_DIR', 'DIRECTORY NAME OF APPLICATION';
define('APP_DIR', basename(dirname(dirname(__FILE__))));
}
/**
* This only needs to be changed if the cake installed libs are located
* outside of the distributed directory structure.
*/
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
//define ('CAKE_CORE_INCLUDE_PATH', FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED DO NOT ADD A TRAILING DIRECTORY SEPARATOR';
//You should also use the DS define to seperate your directories
define('CAKE_CORE_INCLUDE_PATH', ROOT);
}
///////////////////////////////
//DO NOT EDIT BELOW THIS LINE//
///////////////////////////////
if (!defined('WEBROOT_DIR')) {
define('WEBROOT_DIR', basename(dirname(__FILE__)));
}
if (!defined('WWW_ROOT')) {
define('WWW_ROOT', dirname(__FILE__) . DS);
}
if (!defined('CORE_PATH')) {
if (function_exists('ini_set')) {
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS);
define('APP_PATH', null);
define('CORE_PATH', null);
} else {
define('APP_PATH', ROOT . DS . APP_DIR . DS);
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
}
}
require CORE_PATH . 'cake' . DS . 'bootstrap.php';
if (isset($_GET['url']) && $_GET['url'] === 'favicon.ico') {
} else {
$Dispatcher=new Dispatcher();
$Dispatcher->dispatch($url);
}
if (DEBUG) {
echo "<!-- " . round(getMicrotime() - $TIME_START, 4) . "s -->";
}
?>

Просмотреть файл

@ -0,0 +1,85 @@
var map;
var marker;
function mapInit(aLat, aLng, aZoom, aState) {
map = new GMap2(document.getElementById("map"));
map.addControl((aState == "stationary") ? new GSmallZoomControl() : new GSmallMapControl());
if (aLat) {
map.setCenter(new GLatLng(aLat, aLng), aZoom);
if (marker) {
map.removeOverlay(marker);
}
marker = new GMarker(new GLatLng(aLat, aLng), (aState != "stationary") ? {draggable: true} : {draggable: false});
}
else {
map.setCenter(new GLatLng(14.944785, -156.796875), 1);
if (marker) {
map.removeOverlay(marker);
}
marker = new GMarker(new GLatLng(14.944785, -156.796875), (aState != "stationary") ? {draggable: true} : {draggable: false});
}
map.addOverlay(marker);
if (aState != "stationary") {
GEvent.addListener(marker, "dragend", function() { onDragEnd(); });
GEvent.addListener(map, "moveend", function(){ onMoveEnd(); });
}
}
function geocode(aLoc) {
var gcoder = new GClientGeocoder();
gcoder.getLatLng(aLoc, function (point) {
if (!point) {
//mapHelper.suggest(aLoc);
alert("point not found");
}
else {
map.setZoom(10);
map.panTo(point);
map.removeOverlay(marker);
marker = new GMarker(point, {draggable: true});
map.addOverlay(marker);
//GEvent.addListener(marker, "dragend", function() { mapHelper.onDragEnd(); });
}
});
}
function onMoveEnd() {
var point = map.getCenter();
map.removeOverlay(marker);
marker = new GMarker(point, {draggable: true});
map.addOverlay(marker);
GEvent.addListener(marker, "dragend", function() { onDragEnd(); });
editForm();
}
function onDragEnd() {
var point = marker.getPoint()
map.panTo(point);
}
function initMashUp() {
map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(37.4419, -122.1419), 2);
addParties();
}
function editForm() {
var ll = map.getCenter();
document.getElementById('lat').value = ll.lat();
document.getElementById('long').value = ll.lng();
document.getElementById('zoom').value = map.getZoom();
}
function addParty(aLat, aLng, aTxt) {
var point = new GLatLng(aLat, aLng);
var mark = new GMarker(point);
GEvent.addListener(mark, "click", function() {
mark.openInfoWindowHtml(aTxt);
});
map.addOverlay(mark);
}

Просмотреть файл

@ -0,0 +1,36 @@
<?php
/* SVN FILE: $Id: vendors.php,v 1.1 2006/09/11 05:56:11 reed%reedloden.com Exp $ */
/**
* Short description for file.
*
* This file includes js vendor-files from /vendor/ directory if they need to
* be accessible to the public.
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.app.webroot.js
* @since CakePHP v 0.2.9
* @version $Revision: 1.1 $
* @modifiedby $LastChangedBy: phpnut $
* @lastmodified $Date: 2006/09/11 05:56:11 $
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Enter description here...
*/
if (is_file('../../vendors/javascript/' . $_GET['file']) && (preg_match('/(.+)\\.js/', $_GET['file']))) {
readfile('../../vendors/javascript/' . $_GET['file']);
}
?>