[Isocial-svn] SF.net SVN: isocial: [88]
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <agu...@us...> - 2008-03-17 11:39:31
|
Revision: 88 http://isocial.svn.sourceforge.net/isocial/?rev=88&view=rev Author: aguidrevitch Date: 2008-03-17 04:39:36 -0700 (Mon, 17 Mar 2008) Log Message: ----------- a better way of handling PROJECT_NAME implemented Modified Paths: -------------- app/application_controller.php app/controllers/message_controller.php config/DEFAULT-config.php Added Paths: ----------- app/vendor/ext_template/ app/vendor/ext_template/ExtPhpTemplateHandler.php Removed Paths: ------------- app/helpers/translate_helper.php app/vendor/ext_sintags/ Modified: app/application_controller.php =================================================================== --- app/application_controller.php 2008-03-16 20:08:31 UTC (rev 87) +++ app/application_controller.php 2008-03-17 11:39:36 UTC (rev 88) @@ -2,7 +2,7 @@ require_once(AK_LIB_DIR.DS.'AkActionController.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_sintags'.DS.'ExtSintags.php'); +require_once(AK_APP_DIR.DS.'vendor'.DS.'ext_template'.DS.'ExtPhpTemplateHandler.php'); /** * This file is application-wide controller file. You can put all @@ -21,10 +21,18 @@ var $_errors = array(); var $app_models = array('User', 'Message'); - var $app_helpers = array('AutoComplete', 'City', 'Translate'); + var $app_helpers = array('AutoComplete', 'City'); var $current_user; + function _loadActionView () { + $this->Template =& new AkActionView($this->_getTemplateBasePath(), $this->Request->getParameters(), $this->Request->getController()); + $this->Template->_controllerInstance =& $this; + $this->Template->_registerTemplateHandler('tpl','ExtPhpTemplateHandler'); + + return parent::_loadActionView(); + } + function beforeAction ( $method = '' ) { $this->_validateLoginStatus(); } Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-16 20:08:31 UTC (rev 87) +++ app/controllers/message_controller.php 2008-03-17 11:39:36 UTC (rev 88) @@ -134,7 +134,12 @@ function _mark_messages ($is_read) { if (!empty($this->params['check_messages'])) { $messages = $this->Message->find('all', - array('conditions' => array("id IN (" . $this->Message->_make_in_statement_from_array('id', $this->params['check_messages']) . ")"))); + array('conditions' => + array("id IN (" . $this->Message->_make_in_statement_from_array('id', $this->params['check_messages']) . ") AND (sender_id = ? OR recipient_id = ?)", + $this->current_user->getId(), $this->current_user->getId() + ) + ) + ); if ($messages) { foreach ($messages as $message_loop_key => $message) { if ($message->sender_id == $this->current_user->getId() || Deleted: app/helpers/translate_helper.php =================================================================== --- app/helpers/translate_helper.php 2008-03-16 20:08:31 UTC (rev 87) +++ app/helpers/translate_helper.php 2008-03-17 11:39:36 UTC (rev 88) @@ -1,16 +0,0 @@ -<?php - -class TranslateHelper extends TextHelper { - - /** - * Translate strings to the current locale. PROJECT_NAME will be replaced with real project name - */ - function translate($string, $args = null, $locale_namespace = null) - { - $result = Ak::t($string, $args, empty($locale_namespace) ? - AkInflector::underscore($this->_controller->getControllerName()) : $locale_namespace); - return str_replace('PROJECT_NAME', PROJECT_NAME, $result); - } -} - -?> \ No newline at end of file Added: app/vendor/ext_template/ExtPhpTemplateHandler.php =================================================================== --- app/vendor/ext_template/ExtPhpTemplateHandler.php (rev 0) +++ app/vendor/ext_template/ExtPhpTemplateHandler.php 2008-03-17 11:39:36 UTC (rev 88) @@ -0,0 +1,14 @@ +<?php + +require_once(AK_LIB_DIR.DS.'AkActionView.php'); +require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'AkPhpTemplateHandler.php'); + +class ExtPhpTemplateHandler extends AkPhpTemplateHandler +{ + function render(&$____code, $____local_assigns, $____file_path) + { + $output = parent::render($____code, $____local_assigns, $____file_path); + return str_replace('PROJECT_NAME', PROJECT_NAME, $output); + } +} +?> Modified: config/DEFAULT-config.php =================================================================== --- config/DEFAULT-config.php 2008-03-16 20:08:31 UTC (rev 87) +++ config/DEFAULT-config.php 2008-03-17 11:39:36 UTC (rev 88) @@ -52,8 +52,6 @@ define('AK_AUTOMATICALLY_UPDATE_LANGUAGE_FILES', false); // disable security checks, at least before http://trac.akelos.org/ticket/122 gets fixed define('AK_TEMPLATE_SECURITY_CHECK', false); -// overriding default translation mechanics -define('AK_DEFAULT_TEMPLATE_ENGINE', 'ExtSintags'); define('PROJECT_NAME', 'iSocial'); define('NOREPLY_EMAIL', 'no-reply <no-...@is...>'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |