Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sat, Jul 19, 8:57 PM

in-portal

Index: trunk/kernel/units/help/help_tag_processor.php
===================================================================
--- trunk/kernel/units/help/help_tag_processor.php (revision 4206)
+++ trunk/kernel/units/help/help_tag_processor.php (revision 4207)
@@ -1,89 +1,89 @@
<?php
class HelpTagProcessor extends kDBTagProcessor
{
function SectionTitle($params)
{
$rets = explode('.', $this->Application->GetVar('h_prefix') );
$this->Prefix = $rets[0];
$this->Special = isset($rets[1]) ? $rets[1] : '';
//$this->Prefix = $this->Application->GetVar('h_prefix');
$title_preset_name = $this->Application->GetVar('h_title_preset');
$title_presets = $this->Application->getUnitOption($this->Prefix,'TitlePresets');
$format = $title_presets[$title_preset_name]['format'];
$format = preg_replace('/[ ]*( ([\'"]{1}) | ([\(]{1}) ) \#.*\# (?(2) \1 | \) )[ ]*/Ux', ' ', $format);
$title_presets[$title_preset_name]['format'] = $format;
$this->Application->setUnitOption($this->Prefix,'TitlePresets',$title_presets);
$params['title_preset'] = $title_preset_name;
$ret = parent::SectionTitle($params);
return $ret;
}
function ShowHelp($params)
{
$module = $this->Application->GetVar('h_module');
- if (!$module) $module = $this->Application->RecallVar('current_module');
+ if (!$module) $module = $this->Application->RecallVar('module');
$title_preset = $this->Application->GetVar('h_title_preset');
$sql = 'SELECT Path FROM '.TABLE_PREFIX.'Modules WHERE LOWER(Name)='.$this->Conn->qstr( strtolower($module) );
$module_path = $this->Conn->GetOne($sql);
$help_file = FULL_PATH.'/'.$module_path.'module_help/'.$title_preset.'.txt';
if( $this->Application->isDebugMode() && dbg_ConstOn('DBG_EDIT_HELP') )
{
global $debugger;
$ret = 'Help file: <b>'.$debugger->getLocalFile($help_file).'</b><hr>';
}
else
{
$ret = '';
}
$help_data = file_exists($help_file) ? file_get_contents($help_file) : false;
if( $this->Application->isDebugMode() && dbg_ConstOn('DBG_HELP') )
{
$this->Application->Factory->includeClassFile('FCKeditor');
$oFCKeditor = new FCKeditor('HelpContent');
$oFCKeditor->BasePath = $this->Application->BaseURL('/'.ADMIN_DIR.'/editor/cmseditor');
$oFCKeditor->Width = '100%';
$oFCKeditor->Height = '300';
$oFCKeditor->ToolbarSet = 'Advanced';
$oFCKeditor->Value = $help_data;
$oFCKeditor->Config = Array(
'UserFilesPath' => FULL_PATH.'kernel/user_files',
'ProjectPath' => $this->Application->ConfigValue('Site_Path'),
'CustomConfigurationsPath' => rtrim( $this->Application->BaseURL('/'.ADMIN_DIR.'/editor/inp_fckconfig.js'), '/'),
);
$ret .= $oFCKeditor->CreateHtml();
}
else
{
$ret .= $help_data ? $help_data : $this->Application->Phrase('la_section_help_file_missing');
}
return $ret;
}
function GetIcon($params)
{
$icon_var = getArrayValue($params,'var_name');
$icon = $this->Application->GetVar($icon_var);
if(!$icon) $icon = getArrayValue($params,'default_icon');
return $icon;
}
}
?>
\ No newline at end of file
Property changes on: trunk/kernel/units/help/help_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.6
\ No newline at end of property
+1.7
\ No newline at end of property
Index: trunk/kernel/units/configuration/configuration_event_handler.php
===================================================================
--- trunk/kernel/units/configuration/configuration_event_handler.php (revision 4206)
+++ trunk/kernel/units/configuration/configuration_event_handler.php (revision 4207)
@@ -1,145 +1,149 @@
<?php
class ConfigurationEventHandler extends InpDBEventHandler {
/**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
* @access protected
* @see OnListBuild
*/
function SetCustomQuery(&$event)
{
$object =& $event->getObject();
$module_owner = $this->Application->GetLinkedVar('module');
$section = $this->Application->GetLinkedVar('section');
$object->addFilter('module_filter', '%1$s.ModuleOwner = '.$this->Conn->qstr($module_owner));
$object->addFilter('section_filter', '%1$s.Section = '.$this->Conn->qstr($section));
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnBeforeItemUpdate(&$event)
{
$object =& $event->getObject();
+
+ // if password field is empty, then don't update
if ($object->GetDBField('element_type') == 'password') {
if (trim($object->GetDBField('VariableValue')) == '') {
$field_options = $object->GetFieldOptions('VariableValue');
$field_options['skip_empty'] = 1;
$object->SetFieldOptions('VariableValue', $field_options);
}else {
$object->SetDBField('VariableValue', md5($object->GetDBField('VariableValue')));
}
}
- $submitted_vars = $this->Application->GetVar('conf');
+ $field_values = $this->Application->GetVar($event->getPrefixSpecial(true));
- //$this->country_state_pairs = Array('Comm_Country' => 'Comm_State', 'Comm_Shipping_Country' => 'Comm_Shipping_State');
- $this->state_country_pairs = Array('Comm_State' => 'Comm_Country', 'Comm_Shipping_State' => 'Comm_Shipping_Country');
+ $state_country_hash = Array('Comm_State' => 'Comm_Country',
+ 'Comm_Shipping_State' => 'Comm_Shipping_Country');
- if ( isset($this->state_country_pairs[$object->GetDBField('VariableName')]) ) {
- //$this->state_country_codes[$this->country_state_pairs[$object->GetDBField('VariableName')]]=$object->GetDBField('VariableValue');
- $check_state = $object->GetDBField('VariableValue');
- $check_country = $submitted_vars[$this->state_country_pairs[$object->GetDBField('VariableName')]]['VariableValue'];
- //}
- //if( isset($this->state_country_codes[$object->GetDBField('VariableName')]) )
- //{
- $cs_helper = &$this->Application->recallObject('CountryStatesHelper');
- $state_valid_code = $cs_helper->CheckState( $check_state, $check_country );
- if ($state_valid_code !== false)
- {
- $object->SetDBField('VariableValue', $state_valid_code);
+ $field_name = $object->GetDBField('VariableName');
+ if (isset($state_country_hash[$field_name])) {
+ // if this is state field
+ $check_state = $object->GetDBField('VariableValue');
+ $check_country = $field_values[ $state_country_hash[$field_name] ]['VariableValue'];
+
+ if (!($check_country && $check_state)) {
+ return true;
+ }
+
+ $cs_helper =& $this->Application->recallObject('CountryStatesHelper');
+ $state_iso = $cs_helper->CheckState($check_state, $check_country);
+ if ($state_iso !== false) {
+ $object->SetDBField('VariableValue', $state_iso);
}
else
{
$errormsgs = $this->Application->GetVar('errormsgs');
$errors = !$errormsgs || !isset($errormsgs[$event->Prefix_Special]) ? Array() : $errormsgs[$event->Prefix_Special];
- $errors[ $object->GetDBField('VariableName') ] = 'la_InvalidState';
+ $errors[$field_name] = 'la_InvalidState';
$errormsgs[$event->Prefix_Special] = $errors;
$this->Application->SetVar('errormsgs', $errormsgs);
-
- $event->redirect = false;
$event->status = erFAIL;
}
}
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnAfterItemUpdate(&$event)
{
$object =& $event->getObject();
if ($object->GetDBField('element_type') == 'password') {
if (trim($object->GetDBField('VariableValue')) == '') {
$field_options = $object->GetFieldOptions('VariableValue');
unset($field_options['skip_empty']);
$object->SetFieldOptions('VariableValue', $field_options);
}
}
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnUpdate(&$event)
{
if (!$this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 0)) {
parent::OnUpdate($event);
}
$event->SetRedirectParam('opener', 's');
if ($this->Application->GetVar('errormsgs')) {
+ // because we have list out there, and this is item
+ $this->Application->removeObject($event->getPrefixSpecial());
$event->redirect = false;
}
}
function OnCancel(&$event)
{
parent::OnCancel($event);
$event->SetRedirectParam('opener', 's');
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnChangeCountry(&$event)
{
$event->setPseudoClass('_List');
$object = &$event->getObject( Array('per_page'=>-1) );
$object->Query();
//$object->SetDBField('');
$array_records = &$object->Records;
foreach($array_records as $i=>$record){
if ($record['VariableName']=='Comm_Country'){
$values = $this->Application->GetVar('conf');
$array_records[$i]['VariableValue'] = $values['Comm_Country']['VariableValue'];
}
}
$event->redirect_params = Array('opener' => 's', 'pass'=>'all,conf'); //stay!
$event->redirect = false;
}
}
?>
\ No newline at end of file
Property changes on: trunk/kernel/units/configuration/configuration_event_handler.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.9
\ No newline at end of property
+1.10
\ No newline at end of property
Index: trunk/kernel/units/modules/modules_event_handler.php
===================================================================
--- trunk/kernel/units/modules/modules_event_handler.php (revision 4206)
+++ trunk/kernel/units/modules/modules_event_handler.php (revision 4207)
@@ -1,36 +1,25 @@
<?php
class ModulesEventHandler extends InpDBEventHandler {
/**
- * Builds list
- *
- * @param kEvent $event
- * @access protected
- */
- function OnListBuild(&$event)
- {
- parent::OnListBuild($event);
- }
-
- /**
* Builds item
*
* @param kEvent $event
* @access protected
*/
function OnItemBuild(&$event)
{
- $this->Application->SetVar( $event->getPrefixSpecial(true).'_id', $event->Special);
+ $this->Application->SetVar($event->getPrefixSpecial(true).'_id', $event->Special);
parent::OnItemBuild($event);
}
function SetCustomQuery(&$event)
{
- $object=&$event->getObject();
- $object->addFilter('current_module', 'Name='.$event->Special);
+ $object =& $event->getObject();
+ $object->addFilter('current_module', 'Name = '.$event->Special);
}
}
?>
\ No newline at end of file
Property changes on: trunk/kernel/units/modules/modules_event_handler.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.3
\ No newline at end of property
+1.4
\ No newline at end of property
Index: trunk/kernel/units/email_events/email_events_event_handler.php
===================================================================
--- trunk/kernel/units/email_events/email_events_event_handler.php (revision 4206)
+++ trunk/kernel/units/email_events/email_events_event_handler.php (revision 4207)
@@ -1,222 +1,220 @@
<?php
class EmailEventsEventsHandler extends InpDBEventHandler
{
/**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
* @access protected
* @see OnListBuild
*/
function SetCustomQuery(&$event)
{
- if($event->Special == 'module')
- {
+ if ($event->Special == 'module') {
$object =& $event->getObject();
- $this->Application->LinkVar('module', 'current_module');
- $module = $this->Application->GetVar('module');
- $object->addFilter('module_filter', '%1$s.Module = \''.$module.'\'');
+ $module_owner = $this->Application->GetLinkedVar('module');
+ $object->addFilter('module_filter', '%1$s.Module = '.$this->Conn->qstr($module_owner));
}
}
/**
* Sets status Front-End Only to selected email events
*
* @param kEvent $event
*/
function OnFrontOnly(&$event)
{
$this->StoreSelectedIDs($event);
$ids = $this->getSelectedIDs($event);
$ids = implode(',', $ids);
$table = $this->Application->getUnitOption($event->Prefix,'TableName');
$sql = 'UPDATE '.$table.' SET Enabled = 2 WHERE EventId IN ('.$ids.')';
$this->Conn->Query($sql);
}
/**
* Sets selected user to email events selected
*
* @param kEvent $event
*/
function OnSelectUser(&$event)
{
$user_name = $this->Application->GetVar( $event->getPrefixSpecial(true).'_PopupSelectedUser' );
if( strlen($user_name) > 0 )
{
$this->StoreSelectedIDs($event);
$ids = $this->getSelectedIDs($event);
$ids = implode(',', $ids);
$user_id = $this->Conn->GetOne('SELECT PortalUserId FROM '.TABLE_PREFIX.'PortalUser WHERE Login = '.$this->Conn->qstr($user_name) );
$table = $this->Application->getUnitOption($event->Prefix,'TableName');
$sql = 'UPDATE '.$table.' SET FromUserId = '.$user_id.' WHERE EventId IN ('.$ids.')';
$this->Conn->Query($sql);
}
}
/**
* Raised when email message shoul be sent
*
* @param kEvent $event
*/
function OnEmailEvent(&$event){
$email_event = $event->getEventParam('EmailEventName');
if( strpos($email_event, '_') !== false )
{
trigger_error('<span class="debug_error">Invalid email event name</span> <b>'.$email_event.'</b>. Use only <b>UPPERCASE characters</b> and <b>dots</b> as email event names', E_USER_ERROR);
}
$to_user_id = $event->getEventParam('EmailEventToUserId');
$email_event_type = $event->getEventParam('EmailEventType');
$this->Application->setUnitOption('emailmessages', 'AutoLoad', false);
$message_object = &$this->Application->recallObject('emailmessages');
$event_table = $this->Application->getUnitOption('emailevents', 'TableName');
$event_object = &$event->getObject();
$event_object->Load(array('Event'=>$email_event, 'Type'=>$email_event_type));
$event_id = $event_object->GetDBField('EventId');
$from_user_id = $event_object->GetDBField('FromUserId');
$type = $event_object->GetDBField('Type');
$enabled = $event_object->GetDBField('Enabled');
$direct_send_params = $event->getEventParam('DirectSendParams');
if ($enabled == 0) return; // disabled event
if ($enabled == 2 && $this->Application->IsAdmin() ) return; // event only for front-end
if ($type == 1){
// For type "Admin" recipient is a user from field FromUserId which means From/To user in Email events list
$to_user_id = $from_user_id;
$from_user_id = -1;
}
/*
if (!($to_user_id > 0) && !$direct_send_params){
// if we can not determine recepient we will not send email
return;
}
*/
//Parse Message Template
$message_object->Load(array('EventId' => $event_id, 'LanguageId' => $this->Application->GetVar('m_lang')));
$message_type = $message_object->GetDBField('MessageType');
$message_template = $message_object->GetDBField('Template');
$email_object = &$this->Application->recallObject('kEmailMessage');
$email_object->Clear();
$old_autoload = $this->Application->getUnitOption('u', 'AutoLoad');
$this->Application->setUnitOption('u', 'AutoLoad', false);
$from_user_object = &$this->Application->recallObject('u.-email'.$from_user_id);
$from_user_object->Load($from_user_id);
// here if we don't have from_user loaded, it takes a default user from config values
if ( $from_user_object->IsLoaded() ) {
$from_user_email = $from_user_object->GetDBField('Email');
$from_user_name = trim($from_user_object->GetDBField('FirstName').' '.$from_user_object->GetDBField('LastName'));
}
else {
$from_user_email = $this->Application->ConfigValue('Smtp_AdminMailFrom');
}
$to_user_object = &$this->Application->recallObject('u.-email'.$to_user_id);
$to_user_object->Load($to_user_id);
$to_user_email = $to_user_object->GetDBField('Email');
$to_user_name = trim($to_user_object->GetDBField('FirstName').' '.$to_user_object->GetDBField('LastName'));
$this->Application->setUnitOption('u', 'AutoLoad', $old_autoload);
if($direct_send_params){
$to_user_email = ( $direct_send_params['to_email'] ? $direct_send_params['to_email'] : $to_user_email );
$to_user_name = ( $direct_send_params['to_name'] ? $direct_send_params['to_name'] : $to_user_name );
$from_user_email = ( $direct_send_params['from_email'] ? $direct_send_params['from_email'] : $from_user_email);
$from_user_name = ( $direct_send_params['from_name'] ? $direct_send_params['from_name'] : $from_user_name );
$message_body_additional = $direct_send_params['message'];
}
$to_user_email = $to_user_email ? $to_user_email : $this->Application->ConfigValue('Smtp_AdminMailFrom');
$this->Application->makeClass('Template');
$this->Application->InitParser();
$parser_params = $this->Application->Parser->Params;
$direct_send_params['message_text'] = $message_body_additional;
$this->Application->Parser->Params = array_merge_recursive2($this->Application->Parser->Params, $direct_send_params);
$message_template = str_replace('<inp:touser _Field', '<inp2:u_Field name', $message_template);
$message_template = $this->Application->Parser->Parse($message_template, 'email_template', 0);
$this->Application->Parser->Params = $parser_params;
$message_template = str_replace("\r", "", $message_template);
list($message_headers, $message_body) = explode("\n\n", $message_template, 2);
$email_object->setFrom($from_user_email, $from_user_name);
$email_object->setTo($to_user_email, $to_user_name);
$email_object->setSubject('Mail message');
$email_object->setHeaders($message_headers);
if ($message_type == 'html'){
$email_object->setHTMLBody($message_body);
}
else {
$email_object->setTextBody($message_body);
}
$smtp_object = &$this->Application->recallObject('kSmtpClient');
$smtp_server = $this->Application->ConfigValue('Smtp_Server');
$smtp_port = $this->Application->ConfigValue('Smtp_Port');
$smtp_authenticate = $this->Application->ConfigValue('Smtp_Authenticate');
if ($smtp_authenticate){
$smtp_user = $this->Application->ConfigValue('Smtp_User');
$smtp_pass = $this->Application->ConfigValue('Smtp_Pass');
}else{
$smtp_user = '';
$smtp_pass = '';
}
if ($smtp_server){
if ($email_object->sendSMTP($smtp_object, $smtp_server, $smtp_user, $smtp_pass, $smtp_authenticate)){
$event->status=erSUCCESS;
}
else {
$event->status=erFAIL;
}
}else{
if($email_object->send()){
$event->status=erSUCCESS;
}
else {
$event->status=erFAIL;
}
}
if ($event->status == erSUCCESS){
if (!$from_user_name) {
$from_user_name = strip_tags( $this->Application->ConfigValue('Site_Name') );
}
$sql = 'INSERT INTO '.TABLE_PREFIX.'EmailLog SET
fromuser = '.$this->Conn->qstr($from_user_name.' ('.$from_user_email.')').',
addressto = '.$this->Conn->qstr($to_user_name.' ('.$to_user_email.')').',
subject = '.$this->Conn->qstr($email_object->Subject).',
timestamp = UNIX_TIMESTAMP(),
event = '.$this->Conn->qstr($email_event);
$this->Conn->Query($sql);
}
return $event;
}
}
?>
\ No newline at end of file
Property changes on: trunk/kernel/units/email_events/email_events_event_handler.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.16
\ No newline at end of property
+1.17
\ No newline at end of property
Index: trunk/kernel/admin_templates/config/config_search.tpl
===================================================================
--- trunk/kernel/admin_templates/config/config_search.tpl (revision 4206)
+++ trunk/kernel/admin_templates/config/config_search.tpl (revision 4207)
@@ -1,122 +1,122 @@
<inp2:m_set nobody="yes"/>
<inp2:m_include t="incs/header"/>
<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF">
<inp2:m_ParseBlock name="section_header" icon="icon46_settings_search" title="!la_tab_ConfigSearch!"/>
-<inp2:m_ParseBlock name="blue_bar" prefix="confs" title_preset="config_list_search" module="in-portal" icon="icon46_settings_output"/>
+<inp2:m_ParseBlock name="blue_bar" prefix="confs" title_preset="config_list_search" icon="icon46_settings_output"/>
<!-- ToolBar --->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<script type="text/javascript">
var a_toolbar = new ToolBar();
a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
submit_event('confs','<inp2:confs_SaveEvent/>');
}
) );
a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
submit_event('confs','OnCancel');
}
) );
a_toolbar.Render();
</script>
</td>
</tr>
</tbody>
</table>
<inp2:m_DefineElement name="confs_checkbox_td">
<td valign="top" class="text">
<inp2:m_if check="m_ParamEquals" name="nolabel" value="true">
<inp2:m_else />
<label for="_cb_<inp2:InputName field="$Field"/>"><inp2:m_Phrase label="$Label" /></label>
</inp2:m_if>
<input type="checkbox" name="_cb_<inp2:InputName field="$Field"/>" <inp2:Field field="$Field" checked="checked" db="db"/> id="_cb_<inp2:InputName field="$Field"/>" onclick="update_checkbox(this, document.getElementById('<inp2:InputName field="$Field"/>'))" >
<input type="hidden" id="<inp2:InputName field="$Field"/>" name="<inp2:InputName field="$Field"/>" value="<inp2:Field field="$Field" db="db"/>">
</td>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="confs_edit_text">
<td valign="top" class="text">
<label for="<inp2:InputName field="$Field"/>"><inp2:m_Phrase label="$Label" /></label>
<input type="text" name="<inp2:InputName field="$Field"/>" value="<inp2:Field field="$Field"/>" size="3" />
</td>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="confs_detail_row">
<inp2:m_if check="m_ParamEquals" name="show_heading" value="1">
<tr class="subsectiontitle">
<td colspan="4">
<inp2:Field name="ConfigHeader" as_label="1"/>
</td>
</tr>
</inp2:m_if>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<td class="text">
<inp2:Field field="DisplayName" as_label="true" />
<inp2:m_if check="m_IsDebugMode">
<br /><small>[<inp2:Field name="SearchConfigId"/>] <inp2:Field name="FieldName"/></small>
</inp2:m_if>
</td>
<inp2:m_ParseBlock name="confs_checkbox_td" pass_params="true" IdField="SearchConfigId" Label="la_prompt_SimpleSearch" Field="SimpleSearch" />
<inp2:m_ParseBlock name="confs_edit_text" pass_params="true" IdField="SearchConfigId" Label="la_prompt_weight" Field="Priority" />
<inp2:m_ParseBlock name="confs_checkbox_td" pass_params="true" IdField="SearchConfigId" Label="la_prompt_AdvancedSearch" Field="AdvancedSearch" />
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="config_values">
<tr class="subsectiontitle">
<td colspan="4">
<inp2:m_phrase name="$module_item" /> <inp2:m_phrase name="la_prompt_relevence_settings" />
</td>
</tr>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<td colspan="4">
<inp2:m_phrase name="la_prompt_required_field_increase"/>
<input type="text" size="3" name="conf[SearchRel_Increase_<inp2:m_param name="module_key" />][VariableValue]" VALUE="<inp2:Field field="SearchRel_Increase_{$module_key}" />">%
</td>
</tr>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<td colspan="4">
<inp2:m_phrase name="la_prompt_relevence_percent"/>
<input type="text" size="3" name="conf[SearchRel_Keyword_<inp2:m_param name="module_key" />][VariableValue]" value="<inp2:Field field="SearchRel_Keyword_{$module_key}" />">% <inp2:Field field="SearchRel_Keyword_{$module_key}_prompt" as_label="1" /> &nbsp;&nbsp;&nbsp;
<input type="text" size="3" name="conf[SearchRel_Pop_<inp2:m_param name="module_key" />][VariableValue]" value="<inp2:Field field="SearchRel_Pop_{$module_key}" />">% <inp2:Field field="SearchRel_Pop_{$module_key}_prompt" as_label="1" />&nbsp;&nbsp;&nbsp;
<input type="text" size="3" name="conf[SearchRel_Rating_<inp2:m_param name="module_key" />][VariableValue]" value="<inp2:Field field="SearchRel_Rating_{$module_key}" />">% <inp2:Field field="SearchRel_Rating_{$module_key}_prompt" as_label="1" />
</td>
</tr>
<inp2:m_if check="m_GetEquals" name="module" value="In-Portal" inverse="inverse">
<tr class="subsectiontitle">
<td colspan="4">
<inp2:m_phrase name="$module_item" /> <inp2:m_phrase name="la_prompt_multipleshow" />
</td>
</tr>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<td class="text" width="120"><inp2:Field field="Search_ShowMultiple_{$module_key}_prompt" as_label="1"/></td>
<td class="text" colspan="3">
<input type="checkbox" name="_cb_conf[Search_ShowMultiple_<inp2:m_param name="module_key" />][VariableValue]" <inp2:Field field="Search_ShowMultiple_{$module_key}" checked="checked" db="db"/> id="_cb_conf[Search_ShowMultiple_<inp2:m_param name="module_key" />][VariableValue]" onclick="update_checkbox(this, document.getElementById('conf[Search_ShowMultiple_<inp2:m_param name="module_key" />][VariableValue]'))" >
<input type="hidden" id="conf[Search_ShowMultiple_<inp2:m_param name="module_key" />][VariableValue]" name="conf[Search_ShowMultiple_<inp2:m_param name="module_key" />][VariableValue]" value="<inp2:Field field="Search_ShowMultiple_{$module_key}" db="db"/>">
</td>
</tr>
</inp2:m_if>
</inp2:m_DefineElement>
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder" style="border-bottom-width: 0px;">
<inp2:confs_PrintList render_as="confs_detail_row" />
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
<inp2:conf_PrintConfList block="config_values" />
</table>
<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Property changes on: trunk/kernel/admin_templates/config/config_search.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Index: trunk/core/units/help/help_tag_processor.php
===================================================================
--- trunk/core/units/help/help_tag_processor.php (revision 4206)
+++ trunk/core/units/help/help_tag_processor.php (revision 4207)
@@ -1,89 +1,89 @@
<?php
class HelpTagProcessor extends kDBTagProcessor
{
function SectionTitle($params)
{
$rets = explode('.', $this->Application->GetVar('h_prefix') );
$this->Prefix = $rets[0];
$this->Special = isset($rets[1]) ? $rets[1] : '';
//$this->Prefix = $this->Application->GetVar('h_prefix');
$title_preset_name = $this->Application->GetVar('h_title_preset');
$title_presets = $this->Application->getUnitOption($this->Prefix,'TitlePresets');
$format = $title_presets[$title_preset_name]['format'];
$format = preg_replace('/[ ]*( ([\'"]{1}) | ([\(]{1}) ) \#.*\# (?(2) \1 | \) )[ ]*/Ux', ' ', $format);
$title_presets[$title_preset_name]['format'] = $format;
$this->Application->setUnitOption($this->Prefix,'TitlePresets',$title_presets);
$params['title_preset'] = $title_preset_name;
$ret = parent::SectionTitle($params);
return $ret;
}
function ShowHelp($params)
{
$module = $this->Application->GetVar('h_module');
- if (!$module) $module = $this->Application->RecallVar('current_module');
+ if (!$module) $module = $this->Application->RecallVar('module');
$title_preset = $this->Application->GetVar('h_title_preset');
$sql = 'SELECT Path FROM '.TABLE_PREFIX.'Modules WHERE LOWER(Name)='.$this->Conn->qstr( strtolower($module) );
$module_path = $this->Conn->GetOne($sql);
$help_file = FULL_PATH.'/'.$module_path.'module_help/'.$title_preset.'.txt';
if( $this->Application->isDebugMode() && dbg_ConstOn('DBG_EDIT_HELP') )
{
global $debugger;
$ret = 'Help file: <b>'.$debugger->getLocalFile($help_file).'</b><hr>';
}
else
{
$ret = '';
}
$help_data = file_exists($help_file) ? file_get_contents($help_file) : false;
if( $this->Application->isDebugMode() && dbg_ConstOn('DBG_HELP') )
{
$this->Application->Factory->includeClassFile('FCKeditor');
$oFCKeditor = new FCKeditor('HelpContent');
$oFCKeditor->BasePath = $this->Application->BaseURL('/'.ADMIN_DIR.'/editor/cmseditor');
$oFCKeditor->Width = '100%';
$oFCKeditor->Height = '300';
$oFCKeditor->ToolbarSet = 'Advanced';
$oFCKeditor->Value = $help_data;
$oFCKeditor->Config = Array(
'UserFilesPath' => FULL_PATH.'kernel/user_files',
'ProjectPath' => $this->Application->ConfigValue('Site_Path'),
'CustomConfigurationsPath' => rtrim( $this->Application->BaseURL('/'.ADMIN_DIR.'/editor/inp_fckconfig.js'), '/'),
);
$ret .= $oFCKeditor->CreateHtml();
}
else
{
$ret .= $help_data ? $help_data : $this->Application->Phrase('la_section_help_file_missing');
}
return $ret;
}
function GetIcon($params)
{
$icon_var = getArrayValue($params,'var_name');
$icon = $this->Application->GetVar($icon_var);
if(!$icon) $icon = getArrayValue($params,'default_icon');
return $icon;
}
}
?>
\ No newline at end of file
Property changes on: trunk/core/units/help/help_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.6
\ No newline at end of property
+1.7
\ No newline at end of property
Index: trunk/core/units/configuration/configuration_event_handler.php
===================================================================
--- trunk/core/units/configuration/configuration_event_handler.php (revision 4206)
+++ trunk/core/units/configuration/configuration_event_handler.php (revision 4207)
@@ -1,145 +1,149 @@
<?php
class ConfigurationEventHandler extends InpDBEventHandler {
/**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
* @access protected
* @see OnListBuild
*/
function SetCustomQuery(&$event)
{
$object =& $event->getObject();
$module_owner = $this->Application->GetLinkedVar('module');
$section = $this->Application->GetLinkedVar('section');
$object->addFilter('module_filter', '%1$s.ModuleOwner = '.$this->Conn->qstr($module_owner));
$object->addFilter('section_filter', '%1$s.Section = '.$this->Conn->qstr($section));
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnBeforeItemUpdate(&$event)
{
$object =& $event->getObject();
+
+ // if password field is empty, then don't update
if ($object->GetDBField('element_type') == 'password') {
if (trim($object->GetDBField('VariableValue')) == '') {
$field_options = $object->GetFieldOptions('VariableValue');
$field_options['skip_empty'] = 1;
$object->SetFieldOptions('VariableValue', $field_options);
}else {
$object->SetDBField('VariableValue', md5($object->GetDBField('VariableValue')));
}
}
- $submitted_vars = $this->Application->GetVar('conf');
+ $field_values = $this->Application->GetVar($event->getPrefixSpecial(true));
- //$this->country_state_pairs = Array('Comm_Country' => 'Comm_State', 'Comm_Shipping_Country' => 'Comm_Shipping_State');
- $this->state_country_pairs = Array('Comm_State' => 'Comm_Country', 'Comm_Shipping_State' => 'Comm_Shipping_Country');
+ $state_country_hash = Array('Comm_State' => 'Comm_Country',
+ 'Comm_Shipping_State' => 'Comm_Shipping_Country');
- if ( isset($this->state_country_pairs[$object->GetDBField('VariableName')]) ) {
- //$this->state_country_codes[$this->country_state_pairs[$object->GetDBField('VariableName')]]=$object->GetDBField('VariableValue');
- $check_state = $object->GetDBField('VariableValue');
- $check_country = $submitted_vars[$this->state_country_pairs[$object->GetDBField('VariableName')]]['VariableValue'];
- //}
- //if( isset($this->state_country_codes[$object->GetDBField('VariableName')]) )
- //{
- $cs_helper = &$this->Application->recallObject('CountryStatesHelper');
- $state_valid_code = $cs_helper->CheckState( $check_state, $check_country );
- if ($state_valid_code !== false)
- {
- $object->SetDBField('VariableValue', $state_valid_code);
+ $field_name = $object->GetDBField('VariableName');
+ if (isset($state_country_hash[$field_name])) {
+ // if this is state field
+ $check_state = $object->GetDBField('VariableValue');
+ $check_country = $field_values[ $state_country_hash[$field_name] ]['VariableValue'];
+
+ if (!($check_country && $check_state)) {
+ return true;
+ }
+
+ $cs_helper =& $this->Application->recallObject('CountryStatesHelper');
+ $state_iso = $cs_helper->CheckState($check_state, $check_country);
+ if ($state_iso !== false) {
+ $object->SetDBField('VariableValue', $state_iso);
}
else
{
$errormsgs = $this->Application->GetVar('errormsgs');
$errors = !$errormsgs || !isset($errormsgs[$event->Prefix_Special]) ? Array() : $errormsgs[$event->Prefix_Special];
- $errors[ $object->GetDBField('VariableName') ] = 'la_InvalidState';
+ $errors[$field_name] = 'la_InvalidState';
$errormsgs[$event->Prefix_Special] = $errors;
$this->Application->SetVar('errormsgs', $errormsgs);
-
- $event->redirect = false;
$event->status = erFAIL;
}
}
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnAfterItemUpdate(&$event)
{
$object =& $event->getObject();
if ($object->GetDBField('element_type') == 'password') {
if (trim($object->GetDBField('VariableValue')) == '') {
$field_options = $object->GetFieldOptions('VariableValue');
unset($field_options['skip_empty']);
$object->SetFieldOptions('VariableValue', $field_options);
}
}
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnUpdate(&$event)
{
if (!$this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 0)) {
parent::OnUpdate($event);
}
$event->SetRedirectParam('opener', 's');
if ($this->Application->GetVar('errormsgs')) {
+ // because we have list out there, and this is item
+ $this->Application->removeObject($event->getPrefixSpecial());
$event->redirect = false;
}
}
function OnCancel(&$event)
{
parent::OnCancel($event);
$event->SetRedirectParam('opener', 's');
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnChangeCountry(&$event)
{
$event->setPseudoClass('_List');
$object = &$event->getObject( Array('per_page'=>-1) );
$object->Query();
//$object->SetDBField('');
$array_records = &$object->Records;
foreach($array_records as $i=>$record){
if ($record['VariableName']=='Comm_Country'){
$values = $this->Application->GetVar('conf');
$array_records[$i]['VariableValue'] = $values['Comm_Country']['VariableValue'];
}
}
$event->redirect_params = Array('opener' => 's', 'pass'=>'all,conf'); //stay!
$event->redirect = false;
}
}
?>
\ No newline at end of file
Property changes on: trunk/core/units/configuration/configuration_event_handler.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.9
\ No newline at end of property
+1.10
\ No newline at end of property
Index: trunk/core/units/modules/modules_event_handler.php
===================================================================
--- trunk/core/units/modules/modules_event_handler.php (revision 4206)
+++ trunk/core/units/modules/modules_event_handler.php (revision 4207)
@@ -1,36 +1,25 @@
<?php
class ModulesEventHandler extends InpDBEventHandler {
/**
- * Builds list
- *
- * @param kEvent $event
- * @access protected
- */
- function OnListBuild(&$event)
- {
- parent::OnListBuild($event);
- }
-
- /**
* Builds item
*
* @param kEvent $event
* @access protected
*/
function OnItemBuild(&$event)
{
- $this->Application->SetVar( $event->getPrefixSpecial(true).'_id', $event->Special);
+ $this->Application->SetVar($event->getPrefixSpecial(true).'_id', $event->Special);
parent::OnItemBuild($event);
}
function SetCustomQuery(&$event)
{
- $object=&$event->getObject();
- $object->addFilter('current_module', 'Name='.$event->Special);
+ $object =& $event->getObject();
+ $object->addFilter('current_module', 'Name = '.$event->Special);
}
}
?>
\ No newline at end of file
Property changes on: trunk/core/units/modules/modules_event_handler.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.3
\ No newline at end of property
+1.4
\ No newline at end of property
Index: trunk/core/units/email_events/email_events_event_handler.php
===================================================================
--- trunk/core/units/email_events/email_events_event_handler.php (revision 4206)
+++ trunk/core/units/email_events/email_events_event_handler.php (revision 4207)
@@ -1,222 +1,220 @@
<?php
class EmailEventsEventsHandler extends InpDBEventHandler
{
/**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
* @access protected
* @see OnListBuild
*/
function SetCustomQuery(&$event)
{
- if($event->Special == 'module')
- {
+ if ($event->Special == 'module') {
$object =& $event->getObject();
- $this->Application->LinkVar('module', 'current_module');
- $module = $this->Application->GetVar('module');
- $object->addFilter('module_filter', '%1$s.Module = \''.$module.'\'');
+ $module_owner = $this->Application->GetLinkedVar('module');
+ $object->addFilter('module_filter', '%1$s.Module = '.$this->Conn->qstr($module_owner));
}
}
/**
* Sets status Front-End Only to selected email events
*
* @param kEvent $event
*/
function OnFrontOnly(&$event)
{
$this->StoreSelectedIDs($event);
$ids = $this->getSelectedIDs($event);
$ids = implode(',', $ids);
$table = $this->Application->getUnitOption($event->Prefix,'TableName');
$sql = 'UPDATE '.$table.' SET Enabled = 2 WHERE EventId IN ('.$ids.')';
$this->Conn->Query($sql);
}
/**
* Sets selected user to email events selected
*
* @param kEvent $event
*/
function OnSelectUser(&$event)
{
$user_name = $this->Application->GetVar( $event->getPrefixSpecial(true).'_PopupSelectedUser' );
if( strlen($user_name) > 0 )
{
$this->StoreSelectedIDs($event);
$ids = $this->getSelectedIDs($event);
$ids = implode(',', $ids);
$user_id = $this->Conn->GetOne('SELECT PortalUserId FROM '.TABLE_PREFIX.'PortalUser WHERE Login = '.$this->Conn->qstr($user_name) );
$table = $this->Application->getUnitOption($event->Prefix,'TableName');
$sql = 'UPDATE '.$table.' SET FromUserId = '.$user_id.' WHERE EventId IN ('.$ids.')';
$this->Conn->Query($sql);
}
}
/**
* Raised when email message shoul be sent
*
* @param kEvent $event
*/
function OnEmailEvent(&$event){
$email_event = $event->getEventParam('EmailEventName');
if( strpos($email_event, '_') !== false )
{
trigger_error('<span class="debug_error">Invalid email event name</span> <b>'.$email_event.'</b>. Use only <b>UPPERCASE characters</b> and <b>dots</b> as email event names', E_USER_ERROR);
}
$to_user_id = $event->getEventParam('EmailEventToUserId');
$email_event_type = $event->getEventParam('EmailEventType');
$this->Application->setUnitOption('emailmessages', 'AutoLoad', false);
$message_object = &$this->Application->recallObject('emailmessages');
$event_table = $this->Application->getUnitOption('emailevents', 'TableName');
$event_object = &$event->getObject();
$event_object->Load(array('Event'=>$email_event, 'Type'=>$email_event_type));
$event_id = $event_object->GetDBField('EventId');
$from_user_id = $event_object->GetDBField('FromUserId');
$type = $event_object->GetDBField('Type');
$enabled = $event_object->GetDBField('Enabled');
$direct_send_params = $event->getEventParam('DirectSendParams');
if ($enabled == 0) return; // disabled event
if ($enabled == 2 && $this->Application->IsAdmin() ) return; // event only for front-end
if ($type == 1){
// For type "Admin" recipient is a user from field FromUserId which means From/To user in Email events list
$to_user_id = $from_user_id;
$from_user_id = -1;
}
/*
if (!($to_user_id > 0) && !$direct_send_params){
// if we can not determine recepient we will not send email
return;
}
*/
//Parse Message Template
$message_object->Load(array('EventId' => $event_id, 'LanguageId' => $this->Application->GetVar('m_lang')));
$message_type = $message_object->GetDBField('MessageType');
$message_template = $message_object->GetDBField('Template');
$email_object = &$this->Application->recallObject('kEmailMessage');
$email_object->Clear();
$old_autoload = $this->Application->getUnitOption('u', 'AutoLoad');
$this->Application->setUnitOption('u', 'AutoLoad', false);
$from_user_object = &$this->Application->recallObject('u.-email'.$from_user_id);
$from_user_object->Load($from_user_id);
// here if we don't have from_user loaded, it takes a default user from config values
if ( $from_user_object->IsLoaded() ) {
$from_user_email = $from_user_object->GetDBField('Email');
$from_user_name = trim($from_user_object->GetDBField('FirstName').' '.$from_user_object->GetDBField('LastName'));
}
else {
$from_user_email = $this->Application->ConfigValue('Smtp_AdminMailFrom');
}
$to_user_object = &$this->Application->recallObject('u.-email'.$to_user_id);
$to_user_object->Load($to_user_id);
$to_user_email = $to_user_object->GetDBField('Email');
$to_user_name = trim($to_user_object->GetDBField('FirstName').' '.$to_user_object->GetDBField('LastName'));
$this->Application->setUnitOption('u', 'AutoLoad', $old_autoload);
if($direct_send_params){
$to_user_email = ( $direct_send_params['to_email'] ? $direct_send_params['to_email'] : $to_user_email );
$to_user_name = ( $direct_send_params['to_name'] ? $direct_send_params['to_name'] : $to_user_name );
$from_user_email = ( $direct_send_params['from_email'] ? $direct_send_params['from_email'] : $from_user_email);
$from_user_name = ( $direct_send_params['from_name'] ? $direct_send_params['from_name'] : $from_user_name );
$message_body_additional = $direct_send_params['message'];
}
$to_user_email = $to_user_email ? $to_user_email : $this->Application->ConfigValue('Smtp_AdminMailFrom');
$this->Application->makeClass('Template');
$this->Application->InitParser();
$parser_params = $this->Application->Parser->Params;
$direct_send_params['message_text'] = $message_body_additional;
$this->Application->Parser->Params = array_merge_recursive2($this->Application->Parser->Params, $direct_send_params);
$message_template = str_replace('<inp:touser _Field', '<inp2:u_Field name', $message_template);
$message_template = $this->Application->Parser->Parse($message_template, 'email_template', 0);
$this->Application->Parser->Params = $parser_params;
$message_template = str_replace("\r", "", $message_template);
list($message_headers, $message_body) = explode("\n\n", $message_template, 2);
$email_object->setFrom($from_user_email, $from_user_name);
$email_object->setTo($to_user_email, $to_user_name);
$email_object->setSubject('Mail message');
$email_object->setHeaders($message_headers);
if ($message_type == 'html'){
$email_object->setHTMLBody($message_body);
}
else {
$email_object->setTextBody($message_body);
}
$smtp_object = &$this->Application->recallObject('kSmtpClient');
$smtp_server = $this->Application->ConfigValue('Smtp_Server');
$smtp_port = $this->Application->ConfigValue('Smtp_Port');
$smtp_authenticate = $this->Application->ConfigValue('Smtp_Authenticate');
if ($smtp_authenticate){
$smtp_user = $this->Application->ConfigValue('Smtp_User');
$smtp_pass = $this->Application->ConfigValue('Smtp_Pass');
}else{
$smtp_user = '';
$smtp_pass = '';
}
if ($smtp_server){
if ($email_object->sendSMTP($smtp_object, $smtp_server, $smtp_user, $smtp_pass, $smtp_authenticate)){
$event->status=erSUCCESS;
}
else {
$event->status=erFAIL;
}
}else{
if($email_object->send()){
$event->status=erSUCCESS;
}
else {
$event->status=erFAIL;
}
}
if ($event->status == erSUCCESS){
if (!$from_user_name) {
$from_user_name = strip_tags( $this->Application->ConfigValue('Site_Name') );
}
$sql = 'INSERT INTO '.TABLE_PREFIX.'EmailLog SET
fromuser = '.$this->Conn->qstr($from_user_name.' ('.$from_user_email.')').',
addressto = '.$this->Conn->qstr($to_user_name.' ('.$to_user_email.')').',
subject = '.$this->Conn->qstr($email_object->Subject).',
timestamp = UNIX_TIMESTAMP(),
event = '.$this->Conn->qstr($email_event);
$this->Conn->Query($sql);
}
return $event;
}
}
?>
\ No newline at end of file
Property changes on: trunk/core/units/email_events/email_events_event_handler.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.16
\ No newline at end of property
+1.17
\ No newline at end of property

Event Timeline