Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1072077
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jul 23, 12:23 PM
Size
3 KB
Mime Type
text/x-diff
Expires
Fri, Jul 25, 12:23 PM (13 h, 51 m)
Engine
blob
Format
Raw Data
Handle
694707
Attached To
rINP In-Portal
in-portal
View Options
Index: branches/RC/core/units/phrases/phrases_event_handler.php
===================================================================
--- branches/RC/core/units/phrases/phrases_event_handler.php (revision 9407)
+++ branches/RC/core/units/phrases/phrases_event_handler.php (revision 9408)
@@ -1,93 +1,94 @@
<?php
class PhrasesEventHandler extends kDBEventHandler
{
/**
* Allow to create phrases from front end in debug mode with DBG_PHRASES constant set
*
* @param kEvent $event
*/
function CheckPermission(&$event)
{
if (!$this->Application->IsAdmin() && $this->Application->isDebugMode() && constOn('DBG_PHRASES')) {
if ($event->Name == 'OnNew' || $event->Name == 'OnCreate') {
return true;
}
}
return parent::CheckPermission($event);
}
/**
* Forces new label in case if issued from get link
*
* @param kEvent $event
*/
function OnNew(&$event)
{
parent::OnNew($event);
$label = $this->Application->GetVar('phrases_label');
$object =& $event->getObject( $label ? Array('live_table'=>true, 'skip_autoload' => true) : Array('skip_autoload' => true) );
if ($label) {
$object->SetDBField('Phrase',$label);
- $object->SetDBField('LanguageId', $this->Application->GetVar('m_lang') );
+ // phrase is created in language, used to display phrases
+ $object->SetDBField('LanguageId', $this->Application->Phrases->LanguageId);
$object->SetDBField('PhraseType',1);
$primary_language = $this->Application->GetDefaultLanguageId();
$live_table = $this->Application->getUnitOption($event->Prefix, 'TableName');
$sql = 'SELECT Translation FROM %s WHERE Phrase = %s';
$primary_value = $this->Conn->GetOne( sprintf($sql, $live_table, $this->Conn->qstr($label) ) );
$object->SetDBField('PrimaryTranslation', $primary_value);
}
$last_module = $this->Application->GetVar('last_module');
if($last_module) $object->SetDBField('Module', $last_module);
if($event->Special == 'export' || $event->Special == 'import')
{
$object->SetDBField('PhraseType', '|0|1|2|');
$modules = $this->Conn->GetCol('SELECT Name FROM '.TABLE_PREFIX.'Modules');
$object->SetDBField('Module', '|'.implode('|', $modules).'|' );
}
}
/**
* Forces create to use live table
*
* @param kEvent $event
*/
function OnBeforePhraseCreate(&$event)
{
$edit_direct = $this->Application->GetVar($event->Prefix.'_label');
if ($edit_direct) {
$object =& $event->getObject( Array('skip_autoload' => true) );
if ($this->Application->GetVar('m_lang') != $this->Application->GetVar('lang_id')) {
$object->SwitchToLive();
}
}
}
/**
* Save phrase change date & ip translation was made from
*
* @param kEvent $event
*/
function OnSetLastUpdated(&$event)
{
$object =& $event->getObject();
$prev_translation = $this->Conn->GetOne('SELECT Translation FROM '.$object->TableName.' WHERE '.$object->IDField.' = '.(int)$object->GetId() );
if( $prev_translation != $object->GetDBField('Translation') )
{
$ip_address = getenv('HTTP_X_FORWARDED_FOR') ? getenv('HTTP_X_FORWARDED_FOR') : getenv('REMOTE_ADDR');
$object->SetDBField('LastChanged_date', adodb_mktime() );
$object->SetDBField('LastChanged_time', adodb_mktime() );
$object->SetDBField('LastChangeIP', $ip_address);
}
$this->Application->Session->SetCookie('last_module', $object->GetDBField('Module'));
}
}
?>
\ No newline at end of file
Property changes on: branches/RC/core/units/phrases/phrases_event_handler.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.14
\ No newline at end of property
+1.14.2.1
\ No newline at end of property
Event Timeline
Log In to Comment