Index: trunk/core/units/phrases/phrases_event_handler.php =================================================================== diff -u -r5431 -r6093 --- trunk/core/units/phrases/phrases_event_handler.php (.../phrases_event_handler.php) (revision 5431) +++ trunk/core/units/phrases/phrases_event_handler.php (.../phrases_event_handler.php) (revision 6093) @@ -1,7 +1,18 @@ Application->IsAdmin() && $event->Name == 'OnCreate' && $this->Application->isDebugMode() && constOn('DBG_PHRASES')) { + if ($event->Name == 'OnCreate') { + // allow create phrases from front end in debug mode with DBG_PHRASES + return true; + } + } + } + /** * Forces new label in case if issued from get link * @@ -11,31 +22,31 @@ { 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') ); $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 * @@ -51,7 +62,7 @@ } } } - + /** * Save phrase change date & ip translation was made from * @@ -68,7 +79,7 @@ $object->SetDBField('LastChanged_time', adodb_mktime() ); $object->SetDBField('LastChangeIP', $ip_address); } - + $cookie_path = $this->Application->IsAdmin() ? BASE_PATH.'/admin' : BASE_PATH; setcookie('last_module', $object->GetDBField('Module'), $cookie_path, '.'.SERVER_NAME); }