[Isocial-svn] SF.net SVN: isocial: [91] app
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <agu...@us...> - 2008-03-17 20:02:23
|
Revision: 91 http://isocial.svn.sourceforge.net/isocial/?rev=91&view=rev Author: aguidrevitch Date: 2008-03-17 13:01:58 -0700 (Mon, 17 Mar 2008) Log Message: ----------- minor fixes Modified Paths: -------------- app/application_controller.php app/controllers/profile_controller.php app/controllers/user_controller.php app/installers/user_installer.php app/shared_model.php Modified: app/application_controller.php =================================================================== --- app/application_controller.php 2008-03-17 19:04:39 UTC (rev 90) +++ app/application_controller.php 2008-03-17 20:01:58 UTC (rev 91) @@ -1,6 +1,7 @@ <?php require_once(AK_LIB_DIR.DS.'AkActionController.php'); +require_once(AK_VENDOR_DIR.DS.'phputf8'.DS.'ucfirst.php'); require_once(AK_APP_DIR.DS.'vendor'.DS.'utf8_to_ascii'.DS.'utf8_to_ascii.php'); require_once(AK_APP_DIR.DS.'vendor'.DS.'ext_template'.DS.'ExtPhpTemplateHandler.php'); Modified: app/controllers/profile_controller.php =================================================================== --- app/controllers/profile_controller.php 2008-03-17 19:04:39 UTC (rev 90) +++ app/controllers/profile_controller.php 2008-03-17 20:01:58 UTC (rev 91) @@ -44,6 +44,12 @@ } function contact () { + $this->contact_profile = $this->current_user->contact_profile->load(); + if ($this->Request->isPost()) { + if (!empty($this->params['contact_profile'])) { + + } + } } function relationships () { Modified: app/controllers/user_controller.php =================================================================== --- app/controllers/user_controller.php 2008-03-17 19:04:39 UTC (rev 90) +++ app/controllers/user_controller.php 2008-03-17 20:01:58 UTC (rev 91) @@ -3,7 +3,7 @@ class UserController extends ApplicationController { - var $models = 'user, confirmation'; + var $models = array('User', 'Confirmation'); function beforeAction ( $method = '' ) { Modified: app/installers/user_installer.php =================================================================== --- app/installers/user_installer.php 2008-03-17 19:04:39 UTC (rev 90) +++ app/installers/user_installer.php 2008-03-17 20:01:58 UTC (rev 91) @@ -16,22 +16,24 @@ $this->execute( "CREATE TABLE `confirmations` ( - `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, - `user_id` int(11) NOT NULL, + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `user_id` int(11), `uuid` char(40) NOT NULL, `created_at` datetime NOT NULL, - FOREIGN KEY (user_id) REFERENCES users(id) + FOREIGN KEY (user_id) REFERENCES users(id), + INDEX user_idx (user_id) ) ENGINE=innoDB"); $this->execute( "CREATE TABLE `friends` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, - `user_id` int(11) NOT NULL DEFAULT 0, + `user_id` int(11), `friend_id` int(11) NOT NULL DEFAULT 0, FOREIGN KEY (user_id) REFERENCES users(id), FOREIGN KEY (friend_id) REFERENCES users(id), UNIQUE forward_key (user_id, friend_id), - UNIQUE reverse_key (friend_id, user_id) + UNIQUE reverse_key (friend_id, user_id), + INDEX user_idx (user_id) ) ENGINE=InnoDB"); $this->execute( @@ -47,7 +49,10 @@ `is_sender_del` tinyint(1) NOT NULL DEFAULT '0', `is_recipient_del` tinyint(1) NOT NULL DEFAULT '0', FOREIGN KEY (sender_id) REFERENCES users(id), - FOREIGN KEY (recipient_id) REFERENCES users(id) + FOREIGN KEY (recipient_id) REFERENCES users(id), + INDEX thread_idx (thread_id), + INDEX sender_idx (sender_id, is_sender_del), + INDEX recipient_idx (recipient_id, is_read, is_recipient_del) ) ENGINE=InnoDB"); $this->execute( @@ -69,9 +74,9 @@ `third_id` int(11), `is_native` bool NOT NULL DEFAULT 0, `name` char(100) NOT NULL DEFAULT '', + FOREIGN KEY (country_id) REFERENCES countries(id), INDEX oid_idx (oid), - INDEX name_idx (name, first_id), - FOREIGN KEY (country_id) REFERENCES countries(id) + INDEX name_idx (name, first_id) ) ENGINE=InnoDB"); $this->execute( @@ -86,7 +91,7 @@ $this->execute( "CREATE TABLE `political_views` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, - `en_name` char(255) NOT NULL DEFAULT '' + `en_name` char(255) NOT NULL DEFAULT '' ) ENGINE=InnoDB"); $this->execute("INSERT INTO political_views (id, en_name) VALUES (0, 'Very Liberal')"); @@ -101,37 +106,38 @@ "CREATE TABLE `religious_views` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `name` char(100) NOT NULL DEFAULT '', - `votes` int(11) NOT NULL DEFAULT 0, + `votes` int(11) NOT NULL DEFAULT 0, INDEX name_idx (name, votes) ) ENGINE=InnoDB"); $this->execute( "CREATE TABLE `religious_view_votes` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, - `user_id` int(11), - `religious_view_id` int(11), + `user_id` int(11), + `religious_view_id` int(11), FOREIGN KEY (user_id) REFERENCES users(id), - FOREIGN KEY (religious_view_id) REFERENCES religious_views(id) + FOREIGN KEY (religious_view_id) REFERENCES religious_views(id), + UNIQUE vote_idx (user_id, religious_view_id) ) ENGINE=InnoDB"); $this->execute( "CREATE TRIGGER rvv_insert AFTER INSERT ON religious_view_votes - FOR EACH ROW BEGIN - UPDATE `religious_views` SET votes = votes + 1 WHERE id = NEW.religious_view_id; - END; + FOR EACH ROW BEGIN + UPDATE `religious_views` SET votes = votes + 1 WHERE id = NEW.religious_view_id; + END; "); $this->execute( "CREATE TRIGGER rvv_delete AFTER DELETE ON religious_view_votes - FOR EACH ROW BEGIN - UPDATE `religious_views` SET votes = votes - 1 WHERE id = OLD.religious_view_id; - END; + FOR EACH ROW BEGIN + UPDATE `religious_views` SET votes = votes - 1 WHERE id = OLD.religious_view_id; + END; "); $this->execute( "CREATE TABLE `basic_profiles` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, - `user_id` int(11) NOT NULL, + `user_id` int(11), `sex_id` int(11), `city_id` int(11), `city_other` char(100), @@ -141,20 +147,76 @@ `religious_view_id` int(11), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, - FOREIGN KEY (user_id) REFERENCES users(id), - FOREIGN KEY (sex_id) REFERENCES sexes(id), - FOREIGN KEY (city_id) REFERENCES cities(id), - FOREIGN KEY (country_id) REFERENCES countries(id), + FOREIGN KEY (user_id) REFERENCES users(id), + FOREIGN KEY (sex_id) REFERENCES sexes(id), + FOREIGN KEY (city_id) REFERENCES cities(id), + FOREIGN KEY (country_id) REFERENCES countries(id), FOREIGN KEY (political_view_id) REFERENCES political_views(id), - FOREIGN KEY (religious_view_id) REFERENCES religious_views(id) + FOREIGN KEY (religious_view_id) REFERENCES religious_views(id), + INDEX user_idx (user_id) ) ENGINE=InnoDB"); + + $this->execute( + "CREATE TABLE `email_profiles` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `user_id` int(11), + `email` char(100) NOT NULL DEFAULT '', + FOREIGN KEY (user_id) REFERENCES users(id), + INDEX user_idx (user_id) + ) ENGINE=InnoDB"); + + $this->execute( + "CREATE TABLE `ims` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `name` char(100) NOT NULL DEFAULT '' + ) ENGINE=InnoDB"); + + $this->execute("INSERT INTO ims (id, name) VALUES (0, 'ICQ')"); + $this->execute("INSERT INTO ims (id, name) VALUES (0, 'Mail.ru Agent')"); + $this->execute("INSERT INTO ims (id, name) VALUES (0, 'Skype')"); + $this->execute("INSERT INTO ims (id, name) VALUES (0, 'Windows Live')"); + $this->execute("INSERT INTO ims (id, name) VALUES (0, 'Google Talk')"); + $this->execute("INSERT INTO ims (id, name) VALUES (0, 'Yahoo')"); + $this->execute("INSERT INTO ims (id, name) VALUES (0, 'AIM')"); + $this->execute("INSERT INTO ims (id, name) VALUES (0, 'Jabber')"); + $this->execute("INSERT INTO ims (id, name) VALUES (0, 'Gadu-Gadu')"); + $this->execute( + "CREATE TABLE `im_profiles` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `im_id` int(11), + `value` varchar(50), + FOREIGN KEY (user_id) REFERENCES users(id), + FOREIGN KEY (im_id) REFERENCES ims(id), + INDEX user_idx (user_id) + ) ENGINE=InnoDB"); + $this->execute( + "CREATE TABLE `contact_profiles` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `mobile` varchar(40), + `land` varchar(40), + `address` varchar(100), + `website` text, + `city_id` int(11), + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + FOREIGN KEY (user_id) REFERENCES users(id), + FOREIGN KEY (city_id) REFERENCES cities(id), + INDEX user_idx (user_id) + ) ENGINE=InnoDB"); } function down_1() { + $this->dropTable('contact_profiles'); + $this->dropTable('im_profiles'); + $this->dropTable('ims'); + $this->dropTable('email_profiles'); $this->dropTable('basic_profiles'); + // triggers should be dropped automatically // http://dev.mysql.com/doc/refman/5.1/en/drop-trigger.html $this->dropTable('religious_view_votes'); Modified: app/shared_model.php =================================================================== --- app/shared_model.php 2008-03-17 19:04:39 UTC (rev 90) +++ app/shared_model.php 2008-03-17 20:01:58 UTC (rev 91) @@ -29,6 +29,8 @@ var $votes_model; var $min_votes_to_appear = 2; + var $strtolower = true; + var $ucfirst = true; function &voteOrCreate ($value, $user) { @@ -40,6 +42,15 @@ $record = $this->findFirst(array('conditions' => array("name LIKE ?", $value))); if (empty($record)) { + + if ($this->strtolower) { + $value = utf8_strtolower($value); + } + + if ($this->ucfirst) { + $value = utf8_ucfirst($value); + } + $this->name = $value; $this->save(); $record =& $this; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |