Index: trunk/admin/install.php =================================================================== diff -u -r8029 -r8104 --- trunk/admin/install.php (.../install.php) (revision 8029) +++ trunk/admin/install.php (.../install.php) (revision 8104) @@ -662,7 +662,8 @@ $application =& kApplication::Instance(); $application->Init(); - $objThemes->CreateMissingThemes(false); +// $objThemes->CreateMissingThemes(false); + $application->HandleEvent($theme_event, 'adm:OnRebuildThemes'); $css_hash = $application->Conn->GetCol('SELECT LOWER(Name) AS Name, StylesheetId FROM '.TABLE_PREFIX.'Stylesheets', 'StylesheetId'); @@ -1418,7 +1419,7 @@ if(!is_object($objMessageList)) $objMessageList = new clsEmailMessageList(); - $Offset = $objMessageList->ReadImportTable($EventTable, $force_finish ? false : true,100,$Offset); + $Offset = $objMessageList->ReadImportTable($EventTable, $force_finish ? false : true,300,$Offset); if($Offset > $Total) { Index: trunk/core/kernel/db/dbitem.php =================================================================== diff -u -r8067 -r8104 --- trunk/core/kernel/db/dbitem.php (.../dbitem.php) (revision 8067) +++ trunk/core/kernel/db/dbitem.php (.../dbitem.php) (revision 8104) @@ -704,7 +704,6 @@ $values_sql .= $this->Conn->qstr($this->FieldValues[$field_name], 0); } } - $fields_sql .= '`'.$field_name.'`, '; //Adding field name to fields block of Insert statement $values_sql .= ', '; } Index: trunk/core/units/users/users_item.php =================================================================== diff -u -r6791 -r8104 --- trunk/core/units/users/users_item.php (.../users_item.php) (revision 6791) +++ trunk/core/units/users/users_item.php (.../users_item.php) (revision 8104) @@ -86,8 +86,8 @@ $this->Application->EmailEventUser('USER.VALIDATE', $this->GetID() ); } else { - $this->Application->EmailEventAdmin('USER.ADD', $this->GetID() ); - $this->Application->EmailEventUser('USER.ADD', $this->GetID() ); + $this->Application->EmailEventAdmin('USER.ADD', $this->GetID() ); + $this->Application->EmailEventUser('USER.ADD', $this->GetID() ); } break; Index: trunk/kernel/include/globals.php =================================================================== diff -u -r7635 -r8104 --- trunk/kernel/include/globals.php (.../globals.php) (revision 7635) +++ trunk/kernel/include/globals.php (.../globals.php) (revision 8104) @@ -1625,6 +1625,9 @@ } foreach($main as $vl_key => $vl_value) { + // we need to skip wid here, otherwise empty wid will become 0 and the window name for javascript will be changed (to main_0), + // making all links to original (main) window open in new window + if ($vl_key == 'wid') continue; if(!$vl_value) $main[$vl_key] = '0'; // unset($main[$vl_key]); } Index: trunk/kernel/admin_templates/catalog.tpl =================================================================== diff -u -r7391 -r8104 --- trunk/kernel/admin_templates/catalog.tpl (.../catalog.tpl) (revision 7391) +++ trunk/kernel/admin_templates/catalog.tpl (.../catalog.tpl) (revision 8104) @@ -177,17 +177,17 @@ - - +
+
- + + Index: trunk/core/admin_templates/js/catalog.js =================================================================== diff -u -r7413 -r8104 --- trunk/core/admin_templates/js/catalog.js (.../catalog.js) (revision 7413) +++ trunk/core/admin_templates/js/catalog.js (.../catalog.js) (revision 8104) @@ -111,6 +111,10 @@ } } +Catalog.prototype.trim = function ($string) { + return $string.replace(/\s*((\S+\s*)*)/, "$1").replace(/((\s*\S+)*)\s*/, "$1"); +} + Catalog.prototype.errorCallback = function($request, $params, $object) { // $Debugger.ShowProps($request, 'req'); alert('AJAX Error; class: Catalog; ' + Request.getErrorHtml($request)); Index: trunk/core/kernel/application.php =================================================================== diff -u -r8067 -r8104 --- trunk/core/kernel/application.php (.../application.php) (revision 8067) +++ trunk/core/kernel/application.php (.../application.php) (revision 8104) @@ -324,7 +324,6 @@ $this->registerModuleConstants(); return false; } - $modules_helper =& $this->recallObject('ModulesHelper'); $sql = 'SELECT * FROM '.TABLE_PREFIX.'Modules @@ -1587,7 +1586,6 @@ } ob_end_flush(); - // session expiration is called from session initialization, // that's why $this->Session may be not defined here $session =& $this->Application->recallObject('Session'); @@ -1731,7 +1729,6 @@ if (defined('IS_INSTALL') && IS_INSTALL && !$this->TableFound('ConfigurationValues')) { return false; } - $res = $this->Conn->GetRow('SELECT VariableId, VariableValue FROM '.TABLE_PREFIX.'ConfigurationValues WHERE VariableName = '.$this->Conn->qstr($name)); if ($res) { $this->ConfigHash[$name] = $res['VariableValue']; @@ -2249,6 +2246,7 @@ function LoggedIn() { return $this->Session->LoggedIn(); + } /** Index: trunk/core/units/categories/categories_event_handler.php =================================================================== diff -u -r7855 -r8104 --- trunk/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 7855) +++ trunk/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 8104) @@ -81,6 +81,19 @@ } /** + * Set's mark, that root category is edited + * + * @param kEvent $event + */ + function OnEdit(&$event) + { + $category_id = $this->Application->GetVar($event->getPrefixSpecial().'_id'); + $this->Application->StoreVar('IsRootCategory_'.$this->Application->GetVar('m_wid'), $category_id === '0'); + + parent::OnEdit($event); + } + + /** * Apply system filter to categories list * * @param kEvent $event @@ -383,6 +396,18 @@ } /** + * Reset root-category flag when new category is created + * + * @param kEvent $event + */ + function OnPreCreate(&$event) + { + $this->Application->RemoveVar('IsRootCategory_'.$this->Application->GetVar('m_wid')); + + parent::OnPreCreate($event); + } + + /** * Checks cache update mark and redirect to cache if needed * * @param kEvent $event @@ -392,14 +417,16 @@ $object =& $event->getObject(); if ($object->IsRoot()) { $event->setEventParam('master_ids', Array(0)); + $this->RemoveRequiredFields($object); } parent::OnSave($event); if ($event->status == erSUCCESS && $this->Application->RecallVar('PermCache_UpdateRequired')) { // "catalog" should be in opener stack by now $wid = $this->Application->GetVar('m_wid'); $stack_name = rtrim('opener_stack_'.$wid, '_'); - + $this->Application->RemoveVar('IsRootCategory_'.$wid); + $opener_stack = unserialize($this->Application->RecallVar($stack_name)); $opener_stack[0] = str_replace('catalog', 'categories/cache_updater', $opener_stack[0]); $this->Application->StoreVar($stack_name, serialize($opener_stack)); @@ -408,6 +435,25 @@ } /** + * Creates a new item in temp table and + * stores item id in App vars and Session on succsess + * + * @param kEvent $event + */ + function OnPreSaveCreated(&$event) + { + $object =& $event->getObject( Array('skip_autoload' => true) ); + /* @var $object CategoriesItem */ + + if ($object->IsRoot()) { + // don't create root category while saving permissions + return ; + } + + parent::OnPreSaveCreated($event); + } + + /** * Deletes all selected items. * Automatically recurse into sub-items using temp handler, and deletes sub-items * by calling its Delete method if sub-item has AutoDelete set to true in its config file Index: trunk/core/units/general/cat_event_handler.php =================================================================== diff -u -r8012 -r8104 --- trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 8012) +++ trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 8104) @@ -61,27 +61,32 @@ } } - $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); - $table_name = $this->Application->getUnitOption($event->Prefix, 'TableName'); - $sql = 'SELECT '.$id_field.', CreatedById, ci.CategoryId - FROM '.$table_name.' item_table - LEFT JOIN '.$this->Application->getUnitOption('ci', 'TableName').' ci ON ci.ItemResourceId = item_table.ResourceId - WHERE '.$id_field.' IN ('.$selected_ids.') AND (ci.PrimaryCat = 1)'; - $items = $this->Conn->Query($sql, $id_field); - $perm_value = true; - $perm_helper =& $this->Application->recallObject('PermissionsHelper'); - foreach ($items as $item_id => $item_data) { - if ($perm_helper->ModifyCheckPermission($item_data['CreatedById'], $item_data['CategoryId'], $event->Prefix) == 0) { - // one of items selected has no permission - $perm_value = false; - break; + if (strlen($selected_ids)) { + $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); + $table_name = $this->Application->getUnitOption($event->Prefix, 'TableName'); + $sql = 'SELECT '.$id_field.', CreatedById, ci.CategoryId + FROM '.$table_name.' item_table + LEFT JOIN '.$this->Application->getUnitOption('ci', 'TableName').' ci ON ci.ItemResourceId = item_table.ResourceId + WHERE '.$id_field.' IN ('.$selected_ids.') AND (ci.PrimaryCat = 1)'; + $items = $this->Conn->Query($sql, $id_field); + + $perm_helper =& $this->Application->recallObject('PermissionsHelper'); + foreach ($items as $item_id => $item_data) { + if ($perm_helper->ModifyCheckPermission($item_data['CreatedById'], $item_data['CategoryId'], $event->Prefix) == 0) { + // one of items selected has no permission + $perm_value = false; + break; + } } - } - if (!$perm_value) { - $event->status = erPERM_FAIL; + if (!$perm_value) { + $event->status = erPERM_FAIL; + } } + else { + trigger_error('IDs not passed to '.$event->getPrefixSpecial().':CheckPermission', E_USER_WARNING); + } return $perm_value; } @@ -595,6 +600,13 @@ } $object->Fields['Status']['options'] = $new_options; } + elseif (!$this->Application->IsAdmin() && $object->GetDBField('Status') != 1 && $object->Prefix != 'cms') { + header('HTTP/1.0 404 Not Found'); + while (ob_get_level()) { ob_end_clean(); } + $this->Application->HTML = $this->Application->ParseBlock(array('name'=>$this->Application->ConfigValue('ErrorTemplate'))); + $this->Application->Done(); + exit(); + } } @@ -1397,10 +1409,10 @@ $export_options = $export_object->loadOptions($event); echo $export_options['start_from'] * 100 / $export_options['total_records']; - + $event->status = erSTOP; } - + /** * Returns specific to each item type columns only * Index: trunk/core/units/email_events/email_events_event_handler.php =================================================================== diff -u -r7855 -r8104 --- trunk/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 7855) +++ trunk/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 8104) @@ -6,7 +6,7 @@ define('EVENT_STATUS_DISABLED', 0); define('EVENT_STATUS_ENABLED', 1); define('EVENT_STATUS_FRONTEND', 2); - + class EmailEventsEventsHandler extends kDBEventHandler { @@ -119,26 +119,26 @@ * * @param kEvent $event * @param int $event_id id of email event used - * + * * @return mixed */ function GetMessageRecipients(&$event, &$event_id) { $email_event =& $event->getObject( Array('skip_autoload' => true) ); /* @var $email_event kDBItem */ - + // get event parameters by name & type $load_keys = Array ( 'Event' => $event->getEventParam('EmailEventName'), 'Type' => $event->getEventParam('EmailEventType'), ); $email_event->Load($load_keys); - + if (!$email_event->isLoaded()) { // event record not found return false; } - + $enabled = $email_event->GetDBField('Enabled'); if ($enabled == EVENT_STATUS_DISABLED) { return false; @@ -150,18 +150,18 @@ // initial values $to_user_id = $event->getEventParam('EmailEventToUserId'); $from_user_id = $email_event->GetDBField('FromUserId'); - + if ($email_event->GetDBField('Type') == EVENT_TYPE_ADMIN) { // 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; } - + $event_id = $email_event->GetDBField('EventId'); - + return Array ($from_user_id, $to_user_id); } - + /** * Returns user name, email by id, or ones, that specified in $direct_params * @@ -175,36 +175,36 @@ // load user, because it can be addressed from email template tags $user =& $this->Application->recallObject('u.email-'.$user_type, null, Array('skip_autoload' => true)); /* @var $user UsersItem */ - + $email = $name = ''; $result = $user_id > 0 ? $user->Load($user_id) : $user->Clear(); if ($user->IsLoaded()) { $email = $user->GetDBField('Email'); $name = trim($user->GetDBField('FirstName').' '.$user->GetDBField('LastName')); } - + if (is_array($direct_params)) { if (isset($direct_params[$user_type.'_email'])) { $email = $direct_params[$user_type.'_email']; } - + if (isset($direct_params[$user_type.'_name'])) { $name = $direct_params[$user_type.'_name']; } } - + if (!$email) { // if email is empty, then use admins email $email = $this->Application->ConfigValue('Smtp_AdminMailFrom'); } - + if (!$name) { $name = $user_type == 'from' ? strip_tags($this->Application->ConfigValue('Site_Name')) : $email; } - + return Array ($email, $name); } - + /** * Returns email event message by ID (headers & body in one piece) * @@ -216,54 +216,54 @@ $current_language = $this->Application->GetVar('m_lang'); $message =& $this->Application->recallObject('emailmessages', null, Array('skip_autoload' => true)); /* @var $message kDBItem */ - + $message->Load( Array('EventId' => $event_id, 'LanguageId' => $current_language) ); if (!$message->isLoaded()) { // event translation on required language not found - return false; + return false; } - + $message_type = $message->GetDBField('MessageType'); - + // 1. get message body $message_body = $message->GetDBField('Template'); - + // 2. add footer $sql = 'SELECT em.Template FROM '.$message->TableName.' em LEFT JOIN '.TABLE_PREFIX.'Events e ON e.EventId = em.EventId WHERE em.LanguageId = '.$current_language.' AND e.Event = "COMMON.FOOTER"'; - + list (, $footer) = explode("\n\n", $this->Conn->GetOne($sql)); if ($message_type == 'text') { $esender =& $this->Application->recallObject('EmailSender'); /* @var $esender kEmailSendingHelper */ - + $footer = $esender->ConvertToText($footer); } - + if ($footer) { $message_body .= "\r\n".$footer; } - + // 3. replace tags if needed $default_replacement_tags = Array ( ' ' ' 'GetDBField('ReplacementTags'); $replacement_tags = $replacement_tags ? unserialize($replacement_tags) : Array (); $replacement_tags = array_merge_recursive2($default_replacement_tags, $replacement_tags); foreach ($replacement_tags as $replace_from => $replace_to) { $message_body = str_replace($replace_from, $replace_to, $message_body); } - + return $message_body; } - + /** * Parse message template and return headers (as array) and message body part * @@ -274,7 +274,7 @@ function ParseMessageBody($message, $direct_params = null) { $direct_params['message_text'] = isset($direct_params['message']) ? $direct_params['message'] : ''; // parameter alias - + // 1. parse template $this->Application->InitParser(); $parser_params = $this->Application->Parser->Params; // backup parser params @@ -289,16 +289,16 @@ // 3. separate headers from body $message_headers = Array (); list($headers, $message_body) = explode("\n\n", $message, 2); - + $headers = explode("\n", $headers); foreach ($headers as $header) { $header = explode(':', $header, 2); $message_headers[ trim($header[0]) ] = trim($header[1]); } - + return Array ($message_headers, $message_body); } - + /** * Raised when email message shoul be sent * @@ -313,38 +313,38 @@ // additional parameters from kApplication->EmailEvent $send_params = $event->getEventParam('DirectSendParams'); - + // 1. get information about message sender and recipient $recipients = $this->GetMessageRecipients($event, $event_id); if ($recipients === false) { // if not valid recipients found, then don't send event return false; } - + list ($from_id, $to_id) = $recipients; list ($from_email, $from_name) = $this->GetRecipientInfo($from_id, 'from', $send_params); list ($to_email, $to_name) = $this->GetRecipientInfo($to_id, 'to', $send_params); - + // 2. prepare message to be sent $message_template = $this->GetMessageBody($event_id, $message_type); if (!trim($message_template)) { return false; } - + list ($message_headers, $message_body) = $this->ParseMessageBody($message_template, $send_params); if (!trim($message_body)) { return false; } - + // 3. set headers & send message $esender =& $this->Application->recallObject('EmailSender'); /* @var $esender kEmailSendingHelper */ - + $esender->SetFrom($from_email, $from_name); $esender->AddTo($to_email, $to_name); - + $message_subject = isset($message_headers['Subject']) ? $message_headers['Subject'] : 'Mail message'; - $esender->SetSubject($message_subject); + $esender->SetSubject($message_subject); foreach ($message_headers as $header_name => $header_value) { $esender->SetEncodedHeader($header_name, $header_value); @@ -360,7 +360,7 @@ foreach ($send_keys as $send_key) { unset($send_params[$send_key]); } - + $fields_hash = Array ( 'fromuser' => $from_name.' ('.$from_email.')', 'addressto' => $to_name.' ('.$to_email.')', @@ -369,7 +369,7 @@ 'event' => $email_event_name, 'EventParams' => serialize($send_params), ); - + $this->Conn->doInsert($fields_hash, TABLE_PREFIX.'EmailLog'); } Index: trunk/core/admin_templates/js/script.js =================================================================== diff -u -r8096 -r8104 --- trunk/core/admin_templates/js/script.js (.../script.js) (revision 8096) +++ trunk/core/admin_templates/js/script.js (.../script.js) (revision 8104) @@ -503,8 +503,8 @@ } else { opener_action('d'); - submit_event(prefix_special,'OnPreCreate', edit_template); - } + submit_event(prefix_special,'OnPreCreate', edit_template); + } set_hidden_field(prefix_special+'_mode', ''); } Index: trunk/core/units/categories/categories_item.php =================================================================== diff -u -r7855 -r8104 --- trunk/core/units/categories/categories_item.php (.../categories_item.php) (revision 7855) +++ trunk/core/units/categories/categories_item.php (.../categories_item.php) (revision 8104) @@ -149,17 +149,7 @@ */ function IsRoot() { - $category_id = $this->Application->GetVar($this->getPrefixSpecial().'_id'); - if (is_numeric($category_id) && $category_id == 0 && !$this->Application->GetVar($this->getPrefixSpecial().'_PreCreate')) { - $sql = 'SELECT '.$this->IDField.' - FROM '.$this->TableName.' - WHERE '.$this->IDField.' = '.$category_id; - if ($this->Conn->GetOne($sql) === false) { - return true; - } - } - - return false; + return $this->Application->RecallVar('IsRootCategory_'.$this->Application->GetVar('m_wid')); } /** Index: trunk/core/kernel/db/db_event_handler.php =================================================================== diff -u -r8061 -r8104 --- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 8061) +++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 8104) @@ -911,7 +911,7 @@ { $object =& $event->getObject( Array('skip_autoload' => true) ); /* @var $object kDBItem */ - + $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); if ($items_info) { list($id,$field_values) = each($items_info); @@ -1785,7 +1785,6 @@ if (defined('IS_INSTALL') && IS_INSTALL && !$this->Application->TableFound('CustomField')) { return false; } - $main_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix'); if (!$main_prefix) return false; $item_type = $this->Application->getUnitOption($main_prefix, 'ItemType'); Index: trunk/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -r8052 -r8104 --- trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 8052) +++ trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 8104) @@ -354,13 +354,10 @@ $this->ValidateConfig($prefix); } } - function ValidateConfig($prefix) { global $debugger; - $config =& $this->configData[$prefix]; - $tablename = $config['TableName']; $float_types = Array ('float', 'double', 'numeric'); $conn =& $this->Application->GetADODBConnection(); @@ -372,10 +369,8 @@ safeDefine('DBG_RAISE_ON_WARNINGS', 1); return ; } - $res = $conn->Query('DESCRIBE '.$tablename); $config_link = $debugger->getFileLink(FULL_PATH.$this->prefixFiles[$config['Prefix']], 1, $config['Prefix']); - $error_messages = Array ( 'field_not_found' => 'Field %s exists in the database, but is not defined in config', 'default_missing' => 'Default value for field %s not set in config', @@ -385,10 +380,9 @@ 'invalid_default' => 'Default value for field %s%s not sync. to db (in config = %s, in db = %s)', 'type_missing' => 'Type definition for field %s missing in config', ); - $config_errors = Array (); $tablename = preg_replace('/^'.preg_quote(TABLE_PREFIX, '/').'(.*)/', '\\1', $tablename); // remove table prefix - + foreach ($res as $field) { $f_name = $field['Field']; @@ -397,7 +391,6 @@ // skip multilingual fields continue; } - if (!array_key_exists ($f_name, $config['Fields'])) { $config_errors[] = sprintf($error_messages['field_not_found'], $f_name); } @@ -412,7 +405,6 @@ $config_errors[] = sprintf($error_messages['default_missing'], $f_name); $default_missing = true; } - if ($field['Null'] != 'YES') { // field is NOT NULL in database (MySQL5 for null returns "NO", but MySQL4 returns "") if ( $f_name != $config['IDField'] && !isset($options['not_null']) && !isset($options['required']) ) { @@ -427,11 +419,9 @@ $config_errors[] = sprintf($error_messages['not_null_error3'], $f_name); } } - if (!array_key_exists('type', $options)) { $config_errors[] = sprintf($error_messages['type_missing'], $f_name); } - if (!$default_missing) { if ($f_name == $config['IDField'] && $options['type'] != 'string' && $options['default'] !== 0) { $config_errors[] = sprintf($error_messages['invalid_default'], 'IDField ', $f_name, $this->varDump($options['default']), $this->varDump($field['Default'])); @@ -443,21 +433,20 @@ } } } - if ($config_errors) { $error_prefix = 'Config Error'.(count($config_errors) > 1 ? 's' : '').': for prefix '.$config_link.' ('.$tablename.') in unit config:
'; $config_errors = $error_prefix.'   '.implode('
   ', $config_errors); - $debugger->appendHTML($config_errors); - safeDefine('DBG_RAISE_ON_WARNINGS', 1); - } + safeDefine('DBG_RAISE_ON_WARNINGS', 1); + } } function varDump($value) { return ''.var_export($value, true).' of '.gettype($value); + } - + function ProcessDependencies($prefix) { $config =& $this->configData[$prefix]; Index: trunk/kernel/frontaction.php =================================================================== diff -u -r7704 -r8104 --- trunk/kernel/frontaction.php (.../frontaction.php) (revision 7704) +++ trunk/kernel/frontaction.php (.../frontaction.php) (revision 8104) @@ -377,186 +377,189 @@ break; case "m_register": - $_POST=inp_escape($_POST); - $MissingCount = SetMissingDataErrors("m_register"); + $_POST=inp_escape($_POST); + $MissingCount = SetMissingDataErrors("m_register"); - if(!$objConfig->Get("User_Password_Auto")) - { - if(($_POST["password"] != $_POST["passwordverify"]) || !strlen($_POST["passwordverify"])) - { - $MissingCount++; - $FormError["m_register"]["passwordverify"] = language("lu_ferror_pswd_mismatch"); - } + if(!$objConfig->Get("User_Password_Auto")) + { + if(($_POST["password"] != $_POST["passwordverify"]) || !strlen($_POST["passwordverify"])) + { + $MissingCount++; + $FormError["m_register"]["passwordverify"] = language("lu_ferror_pswd_mismatch"); + } - if(strlen($_POST["password"])>30) - { - // echo "VAR: ".$_POST["password"]; die(); - $MissingCount++; - $FormError["m_register"]["password"] = language("lu_ferror_pswd_toolong"); - } + if(strlen($_POST["password"])>30) + { + // echo "VAR: ".$_POST["password"]; die(); + $MissingCount++; + $FormError["m_register"]["password"] = language("lu_ferror_pswd_toolong"); + } - if (strlen($_POST['password']) < $objConfig->Get("Min_Password")) - { - $MissingCount++; - $FormError["m_register"]["password"] = language("lu_ferror_pswd_tooshort"); - } - } + if (strlen($_POST['password']) < $objConfig->Get("Min_Password")) + { + $MissingCount++; + $FormError["m_register"]["password"] = language("lu_ferror_pswd_tooshort"); + } + } - if(($_POST["username"]=="root")) - { - $MissingCount++; - $FormError["m_register"]["username"] = language("lu_user_exists"); - } - else - { + if(($_POST["username"]=="root")) + { + $MissingCount++; + $FormError["m_register"]["username"] = language("lu_user_exists"); + } + else + { - $u = $objUsers->GetItemByField("Login",$_POST["username"]); - if(is_object($u)) - { - if($u->Get("Login")==$_POST["username"]) - { - $MissingCount++; - $FormError["m_register"]["username"] = language("lu_user_exists"); - } - } - } + $u = $objUsers->GetItemByField("Login",$_POST["username"]); + if(is_object($u)) + { + if($u->Get("Login")==$_POST["username"]) + { + $MissingCount++; + $FormError["m_register"]["username"] = language("lu_user_exists"); + } + } + } - if (strlen($_POST['username']) < $objConfig->Get("Min_UserName")) - { - $MissingCount++; - $FormError["m_register"]["username"] = language("lu_ferror_username_tooshort"); - } + if (strlen($_POST['username']) < $objConfig->Get("Min_UserName")) + { + $MissingCount++; + $FormError["m_register"]["username"] = language("lu_ferror_username_tooshort"); + } - if(!$MissingCount) - { - $CreatedOn = adodb_date("U"); - $GroupId = $objConfig->Get("User_NewGroup"); - $Status=0; + if(!$MissingCount) + { + $CreatedOn = adodb_date("U"); + $GroupId = $objConfig->Get("User_NewGroup"); + $Status=0; - /* determine the status of new users */ - switch ($objConfig->Get("User_Allow_New")) - { - case "1": - $Status=1; - break; - case "3": - $Status=2; - break; - } + /* determine the status of new users */ + switch ($objConfig->Get("User_Allow_New")) + { + case "1": + $Status=1; + break; + case "3": + $Status=2; + break; + } - /* set Destination template */ - $var_list["t"] = strlen($_GET["dest"])? $_GET["dest"] : "index"; + /* set Destination template */ + $var_list["t"] = strlen($_GET["dest"])? $_GET["dest"] : "index"; - if($Status>0) - { - if ($objConfig->Get("User_Password_Auto")) { - $password = makepassword(); -// $objSession->Set("password", $password); - SetVar('user_password', $password); - } - else { - $password = $_POST["password"]; - } + if($Status>0) + { + if ($objConfig->Get("User_Password_Auto")) { + $password = makepassword(); + // $objSession->Set("password", $password); + SetVar('user_password', $password); + } + else { + $password = $_POST["password"]; + } - $dob = adodb_mktime(0, 0, 0, $_POST['dob_month'], $_POST['dob_day'], $_POST['dob_year']); - $ip = $_SERVER['REMOTE_ADDR']; + $dob = adodb_mktime(0, 0, 0, $_POST['dob_month'], $_POST['dob_day'], $_POST['dob_year']); + $ip = $_SERVER['REMOTE_ADDR']; - $application =& kApplication::Instance(); - $application->SetVar('user_password', $password); - SetVar('user_password', $password); - $fields_hash = Array('Login' => $_POST['username'], - 'Password' => md5($password), - 'FirstName' => $_POST['firstname'], - 'LastName' => $_POST['lastname'], - 'Company' => $_POST['company'], - 'Email' => $_POST['email'], - 'Status' => $Status, - 'Phone' => $_POST['phone'], - 'Fax' => $_POST['fax'], - 'Street' => $_POST['street'], - 'Street2' => $_POST['street2'], - 'City' => $_POST['city'], - 'State' => $_POST['state'], - 'Zip' => $_POST['zip'], - 'Country' => $_POST['country'], - 'CreatedOn' => $CreatedOn, - 'dob' => $dob, - 'ip' => $ip); - $u =& $objUsers->Add_User_NEW($fields_hash, true); + $application =& kApplication::Instance(); + $application->SetVar('user_password', $password); + SetVar('user_password', $password); + $fields_hash = Array('Login' => $_POST['username'], + 'Password' => md5($password), + 'FirstName' => $_POST['firstname'], + 'LastName' => $_POST['lastname'], + 'Company' => $_POST['company'], + 'Email' => $_POST['email'], + 'Status' => $Status, + 'Phone' => $_POST['phone'], + 'Fax' => $_POST['fax'], + 'Street' => $_POST['street'], + 'Street2' => $_POST['street2'], + 'City' => $_POST['city'], + 'State' => $_POST['state'], + 'Zip' => $_POST['zip'], + 'Country' => $_POST['country'], + 'CreatedOn' => $CreatedOn, + 'dob' => $dob, + 'ip' => $ip); + $u =& $objUsers->Add_User_NEW($fields_hash, true); - if(!is_object($u)) - { - $RuleId=$u; - $r = $objBanList->GetItem($RuleId); - $err = $r->Get("ErrorTag"); + if(!is_object($u)) + { + $RuleId=$u; + $r = $objBanList->GetItem($RuleId); + $err = $r->Get("ErrorTag"); - if(strlen($err)) - { - $FormError["m_register"][$r->Get("ItemField")] = language($err); - $MissingCount++; - } - } - else - { - $u->Set("Password",$password); - $u->Clean(); - if($GroupId>0) - { - $g = $objGroups->GetItem($GroupId); - $g->AddUser($u->Get("PortalUserId"),1,false); - } + if(strlen($err)) + { + $FormError["m_register"][$r->Get("ItemField")] = language($err); + $MissingCount++; + } + } + else + { + $u->Set("Password",$password); + $u->Clean(); + if($GroupId>0) + { + $g = $objGroups->GetItem($GroupId); + $g->AddUser($u->Get("PortalUserId"),1,false); + } - $custom = $_POST["custom"]; - if (is_array($custom)) { - for($x = 0; $x < count($custom); $x++) { - $u->SetCustomField($custom[$x],$_POST[$custom[$x]]); - } - $u->SaveCustomFields(); - } + $custom = $_POST["custom"]; + if (is_array($custom)) { + for($x = 0; $x < count($custom); $x++) { + $u->SetCustomField($custom[$x],$_POST[$custom[$x]]); + } + $u->SaveCustomFields(); + } - if($Status==1) - { - if($objConfig->Get("User_Password_Auto")) - { - $u->SendUserEventMail("USER.VALIDATE",$u->Get("PortalUserId")); - $u->SendAdminEventMail("USER.VALIDATE"); - } - else - { - $doLoginNow = true; - $u->SendUserEventMail("USER.ADD",$u->Get("PortalUserId")); - $u->SendAdminEventMail("USER.ADD"); - } - } - else - { - $u->SendUserEventMail("USER.ADD.PENDING",$u->Get("PortalUserId")); - $u->SendAdminEventMail("USER.ADD.PENDING"); - } + if($Status==1) + { + if($objConfig->Get("User_Password_Auto")) + { + $u->SendUserEventMail("USER.VALIDATE",$u->Get("PortalUserId")); + $u->SendAdminEventMail("USER.VALIDATE"); + } + else + { + $doLoginNow = true; + $u->SendUserEventMail("USER.ADD",$u->Get("PortalUserId")); + $u->SendAdminEventMail("USER.ADD"); + } + } + else + { + $u->SendUserEventMail("USER.ADD.PENDING",$u->Get("PortalUserId")); + $u->SendAdminEventMail("USER.ADD.PENDING"); + } - if ($doLoginNow) - { - $login_ok = $objSession->Login($_POST["username"], md5($password)); - if($login_ok) - { - $next_template = $objSession->GetVariable('next_template'); - if($next_template) - { - $objSession->SetVariable('next_template',''); - $var_list_update["t"] = $next_template; - header('Location: ' . HREF_Wrapper() ); - exit; - $var_list['t'] = $next_template.'.tpl'; - } + if ($doLoginNow) + { + $login_ok = $objSession->Login($_POST["username"], md5($password)); + if($login_ok) + { + $next_template = $objSession->GetVariable('next_template'); + if (!$next_template) { +// $next_template = strlen($_GET["dest"])? $_GET["dest"] : "index"; + } + if($next_template) + { + $objSession->SetVariable('next_template',''); + $var_list_update["t"] = $next_template; + header('Location: ' . HREF_Wrapper() ); + exit; + $var_list['t'] = $next_template.'.tpl'; + } - } - } - } - } - } - break; + } + } + } + } + } + break; case "m_add_friend": $id = $_GET["UserId"]; $userid = $objSession->Get("PortalUserId"); Index: trunk/core/admin_templates/incs/style.css =================================================================== diff -u -r8073 -r8104 --- trunk/core/admin_templates/incs/style.css (.../style.css) (revision 8073) +++ trunk/core/admin_templates/incs/style.css (.../style.css) (revision 8104) @@ -112,6 +112,9 @@ white-space: nowrap; } +.search-box { + border: 1px solid #808080; +} .button { font-family: arial, verdana; Index: trunk/core/units/general/helpers/multilanguage.php =================================================================== diff -u -r8039 -r8104 --- trunk/core/units/general/helpers/multilanguage.php (.../multilanguage.php) (revision 8039) +++ trunk/core/units/general/helpers/multilanguage.php (.../multilanguage.php) (revision 8104) @@ -128,7 +128,6 @@ $field_mask['type'] = $field_options['db_type']; } $field_mask['default'] = 'DEFAULT '.$default_value; - if (strtoupper($field_mask['type']) == 'TEXT') { // text fields in mysql doesn't have default value $field_mask = $field_mask['name'].' '.$field_mask['type'].' '.$field_mask['null']; Index: trunk/core/kernel/db/db_connection.php =================================================================== diff -u -r8008 -r8104 --- trunk/core/kernel/db/db_connection.php (.../db_connection.php) (revision 8008) +++ trunk/core/kernel/db/db_connection.php (.../db_connection.php) (revision 8104) @@ -181,7 +181,6 @@ if (defined('DBG_SQL_MODE')) { $this->Query('SET sql_mode = \''.DBG_SQL_MODE.'\''); } - $this->setDB($db); $this->showError(); } Index: trunk/admin/install/inportal_data.sql =================================================================== diff -u -r7867 -r8104 --- trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 7867) +++ trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 8104) @@ -225,4 +225,4 @@ INSERT INTO Stylesheets VALUES (8, 'Default', 'In-Portal Default Theme', '', 1124952555, 1); -INSERT INTO Modules VALUES ('In-Portal', 'kernel/', 'm', '4.0.2', 1, 0, '', 0, '1054738405'); \ No newline at end of file +INSERT INTO Modules VALUES ('In-Portal', 'kernel/', 'm', '4.0.2', 1, 0, '', 0, '1054738405'); Index: trunk/core/kernel/db/db_tag_processor.php =================================================================== diff -u -r8097 -r8104 --- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 8097) +++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 8104) @@ -477,7 +477,7 @@ function PageLink($params) { - $t = isset($params['template']) ? $param['template'] : ''; + $t = isset($params['template']) ? $params['template'] : ''; unset($params['template']); if (!$t) $t = $this->Application->GetVar('t'); @@ -550,6 +550,7 @@ $currency =& $this->Application->recallObject('curr.-'.$iso, null, Array('skip_autoload' => true)); if( !$currency->isLoaded() ) $currency->Load($iso, 'ISO'); + $symbol = $currency->GetDBField('Symbol'); if (!$symbol) $symbol = $currency->GetDBField('ISO').' '; if ($currency->GetDBField('SymbolPosition') == 0) { Index: trunk/core/kernel/session/session.php =================================================================== diff -u -r7855 -r8104 --- trunk/core/kernel/session/session.php (.../session.php) (revision 7855) +++ trunk/core/kernel/session/session.php (.../session.php) (revision 8104) @@ -96,7 +96,6 @@ if (defined('IS_INSTALL') && IS_INSTALL && !$this->Application->TableFound($this->TableName)) { return false; } - $fields_hash = Array ( $this->IDField => $session->SID, $this->TimestampField => $session->Expiration @@ -872,7 +871,6 @@ { return $this->Storage->DeleteExpired(); } - /** * Allows to check if user in this session is logged in or not * @@ -881,7 +879,6 @@ function LoggedIn() { $user_id = $this->RecallVar('user_id'); - $ret = $user_id > 0; if ($this->RecallVar('admin') == 1 && ($user_id == -1)) { $ret = true; Index: trunk/kernel/include/parseditem.php =================================================================== diff -u -r7867 -r8104 --- trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 7867) +++ trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 8104) @@ -623,7 +623,7 @@ function SendAdminEventMail($EventName,$LangId=NULL) { - return $this->Application->EmailEventAdmin($EventName); + return $this->Application->EmailEventAdmin($EventName); } function parse_template($t) Index: trunk/kernel/admin_templates/incs/catalog.js =================================================================== diff -u -r7413 -r8104 --- trunk/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 7413) +++ trunk/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 8104) @@ -111,6 +111,10 @@ } } +Catalog.prototype.trim = function ($string) { + return $string.replace(/\s*((\S+\s*)*)/, "$1").replace(/((\s*\S+)*)\s*/, "$1"); +} + Catalog.prototype.errorCallback = function($request, $params, $object) { // $Debugger.ShowProps($request, 'req'); alert('AJAX Error; class: Catalog; ' + Request.getErrorHtml($request)); Index: trunk/core/units/languages/import_xml.php =================================================================== diff -u -r7855 -r8104 --- trunk/core/units/languages/import_xml.php (.../import_xml.php) (revision 7855) +++ trunk/core/units/languages/import_xml.php (.../import_xml.php) (revision 8104) @@ -214,16 +214,14 @@ $this->current_phrase = Array( 'LanguageId' => $this->current_language['LanguageId'], 'Phrase' => $attributes['LABEL'], 'PhraseType' => $attributes['TYPE'], - 'PhraseId' => 0, 'Module' => $phrase_module, 'LastChanged' => adodb_mktime(), 'LastChangeIP' => $this->ip_address, 'Translation' => ''); break; case 'LANGUAGES LANGUAGE EVENTS EVENT': - $this->current_event = Array( 'EmailMessageId'=> 0, - 'LanguageId' => $this->current_language['LanguageId'], + $this->current_event = Array( 'LanguageId' => $this->current_language['LanguageId'], 'EventId' => $this->events_hash[ $attributes['EVENT'].'_'.$attributes['TYPE'] ], 'MessageType' => $attributes['MESSAGETYPE'], 'Template' => ''); @@ -300,7 +298,7 @@ else { $this->current_phrase['Translation'] = base64_decode($this->current_phrase['Translation']); } - $this->Conn->doInsert($this->current_phrase, $this->tables['phrases']); + $this->insertRecord($this->tables['phrases'], $this->current_phrase); } break; @@ -312,13 +310,33 @@ else { $this->current_event['Template'] = base64_decode($this->current_event['Template']); } - $this->Conn->doInsert($this->current_event, $this->tables['emailmessages']); + $this->insertRecord($this->tables['emailmessages'],$this->current_event); break; } array_pop($this->path); } + function insertRecord($table, $fields_hash) + { + $fields = ''; + $values = ''; + + foreach($fields_hash as $field_name => $field_value) + { + $fields .= '`'.$field_name.'`,'; + $values .= $this->Conn->qstr($field_value).','; + } + + $fields = preg_replace('/(.*),$/', '\\1', $fields); + $values = preg_replace('/(.*),$/', '\\1', $values); + + $sql = 'INSERT INTO `'.$table.'` ('.$fields.') VALUES ('.$values.')'; + $this->Conn->Query($sql); + +// return $this->Conn->getInsertID(); // no need because of temp table without auto_increment column at all + } + /** * Creates XML file with exported language data * Index: trunk/core/units/users/users_event_handler.php =================================================================== diff -u -r8078 -r8104 --- trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 8078) +++ trunk/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 8104) @@ -118,14 +118,12 @@ if ($this->Application->GetVar('admin') == 1) { $session_admin =& $this->Application->recallObject('Session.admin'); /* @var $session_admin Session */ - if (!$session_admin->LoggedIn()) { // front-end session created from admin session & both expired $this->Application->DeleteVar('admin'); $this->Application->Redirect('index', Array('expired' => 1), '', 'admin/index.php'); } } - $get = $this->Application->HttpQuery->getRedirectParams(); $t = $this->Application->GetVar('t'); $get['js_redirect'] = $this->Application->ConfigValue('UseJSRedirect'); Index: trunk/admin/install/upgrades/readme_4_0_1.txt =================================================================== diff -u --- trunk/admin/install/upgrades/readme_4_0_1.txt (revision 0) +++ trunk/admin/install/upgrades/readme_4_0_1.txt (revision 8104) @@ -0,0 +1,18 @@ +Readme notes for In-Portal 4.0.1 +Intechnic Corporation, Apr 5, 2007 + +In current release versions of all modules were synchronized and increased to 4.x.x. +Major features in In-commerce like group-based pricing, payments +and shipping were introduced. Both back-end improvements and bug fixes +were done on platform and modules levels. For complete list of changes refer to changelog_4_0_1.txt. + +New Features: + +- Security code for User Registration +- Column picker for grids in Admin + +Bugs: + +- Sending User password in email after registration +- Copy/Paste items as Admin +- Uploading files with FCK editor \ No newline at end of file Index: trunk/kernel/include/emailmessage.php =================================================================== diff -u -r7867 -r8104 --- trunk/kernel/include/emailmessage.php (.../emailmessage.php) (revision 7867) +++ trunk/kernel/include/emailmessage.php (.../emailmessage.php) (revision 8104) @@ -74,10 +74,10 @@ WHERE em.LanguageId = '.$this->Get('LanguageId').' AND e.Event = "COMMON.FOOTER"'; $footer = explode("\n\n", $this->Conn->GetOne($sql)); - $email_object = &$this->Application->recallObject('kEmailMessage'); - $email_object->Clear(); + $esender =& $this->Application->recallObject('EmailSender'); + /* @var $esender kEmailSendingHelper */ - $footer = $this->Get('MessageType') == 'text' ? $email_object->convertHTMLtoPlain($footer[1]) : '
'.$footer[1]; + $footer = $this->Get('MessageType') == 'text' ? $esender->ConvertToText($footer[1]) : '
'.$footer[1]; $template = $this->Get('Template')."\r\n".$footer; // add footer: end @@ -120,7 +120,7 @@ global $objUsers, $objTemplate; $this->Application->InitParser(); - + $res = $this->ParseTemplateText($text); /* parse email class tags */ @@ -904,25 +904,25 @@ function SendMail($From, $FromName, $ToAddr, $ToName, $Subject, $Text, $Html, $charset, $SendEvent,$FileName="",$FileLoc="",$QueueOnly=0,$extra_headers = array()) { // $QueueOnly - {true = put in queue, false = nd now} - + $application =& kApplication::Instance(); - + $esender =& $application->recallObject('EmailSender'); /* @var $esender kEmailSendingHelper */ - + $esender->SetFrom($From, $FromName); $esender->AddTo($ToAddr, $ToName); - $esender->SetSubject($Subject); + $esender->SetSubject($Subject); $esender->SetBody(stripslashes($Html), $Text); - + // set additional headers if (is_array($extra_headers)) { foreach ($extra_headers as $header) { $header = explode(':', $header, 2); $esender->SetEncodedHeader(trim($header[0]), trim($header[1])); } } - + // add attachment if any if (strlen($FileName) > 0) { if(!strlen($FileLoc)) { @@ -932,17 +932,17 @@ } $status = $esender->Deliver(); - + if ($status) { - // write to log + // write to log $fields_hash = Array ( 'fromuser' => $FromName, 'addressto' => $ToName ? $ToName.' ('.$ToAddr.')' : $ToAddr, 'subject' => str_replace('Subject:', '', $Subject), 'timestamp' => adodb_mktime(), 'event' => $SendEvent, - ); - + ); + $db =& $application->GetADODBConnection(); $db->doInsert($fields_hash, TABLE_PREFIX.'EmailLog'); } Index: trunk/core/units/general/inp1_parser.php =================================================================== diff -u -r7855 -r8104 --- trunk/core/units/general/inp1_parser.php (.../inp1_parser.php) (revision 7855) +++ trunk/core/units/general/inp1_parser.php (.../inp1_parser.php) (revision 8104) @@ -1,15 +1,26 @@ InportalInited) { + $this->InitInPortal(); + } + // in case Parsing was called through InitInPortal -> moudles -> frontaction -> emailevent + // we need to make sure old parser is initialized + $this->InitParser(); + $template_body = $objTemplate->ParseTemplateFromBuffer($tname, $template_body); + return $template_body; + } + if ( !$this->InportalInited) { //$save_t = $this->Application->GetVar('t'); $this->InitInPortal(); @@ -19,13 +30,13 @@ $get = $_GET; unset($get['env'], $get['Action'], $get['_mod_rw_url_'], $get['rewrite']); $this->Application->StoreVar('K4_Template_Referer', $this->Application->GetVar('t') ); - + $this->Application->Redirect($var_list['t'], $get); } } - + $var_list['t'] = $this->cutTPL($var_list['t']); - + if ($var_list['t'] != $this->Application->GetVar('t')) { //$var_list['t'] = rtrim($var_list['t'],'.tpl'); $t = $var_list['t']; @@ -39,7 +50,7 @@ } return $template_body; } - + function cutTPL($tname) { if( substr($tname,-4) == '.tpl' ) @@ -48,80 +59,80 @@ } return $tname; } - + function InitParser() { global $objTemplate, $CurrentTheme, $objThemes, $objLanguageCache, $var_list; if ($this->InpParsetInited) return true; - + $theme_id = $this->Application->IsAdmin() ? 1 : $this->Application->GetVar('m_theme'); if ($theme_id) { $CurrentTheme = $objThemes->GetItem($theme_id); - + $timeout = $CurrentTheme->Get('CacheTimeout'); $objLanguageCache->LoadTemplateCache($var_list['t'], $timeout, $theme_id); $objLanguageCache->LoadCachedVars($this->Application->GetVar('m_lang')); - + $objTemplate = new clsTemplateList(FULL_PATH.THEMES_PATH.'/'); } - + $this->InpParsetInited = true; } - + function InitInPortal() { $this->InportalInited = true; - /*global $pathtoroot, $FrontEnd, $indexURL, $rootURL, $secureURL, $var_list, $CurrentTheme, - $objThemes, $objConfig, $m_var_list, $timeout, $objLanguages, $objLanguageCache, - $TemplateRoot, $objTemplate, $html, $objSession, $Errors, $objCatList, $objUsers, + /*global $pathtoroot, $FrontEnd, $indexURL, $rootURL, $secureURL, $var_list, $CurrentTheme, + $objThemes, $objConfig, $m_var_list, $timeout, $objLanguages, $objLanguageCache, + $TemplateRoot, $objTemplate, $html, $objSession, $Errors, $objCatList, $objUsers, $env, $mod_prefix, $ExtraVars, $timestart, $timeend, $timeout, $sqlcount, $totalsql, $template_path, $modules_loaded, $mod_root_cats, $objModules, $objItemTypes;*/ - - - global $sec, $usec, $timestart, $pathtoroot, $FrontEnd, $indexURL, $kernel_version, $FormError, - $FormValues, $ItemTables, $KeywordIgnore, $debuglevel, - $LogLevel, $LogFile, $rq_value, $rq_name, $dbg_constMap, $dbg_constValue, $dbg_constName, - $debugger, $g_LogFile, $LogData, $Errors, - $g_DebugMode, $totalsql, $sqlcount, $objConfig, $ItemTypePrefixes, $ItemTagFiles, $objModules, + + + global $sec, $usec, $timestart, $pathtoroot, $FrontEnd, $indexURL, $kernel_version, $FormError, + $FormValues, $ItemTables, $KeywordIgnore, $debuglevel, + $LogLevel, $LogFile, $rq_value, $rq_name, $dbg_constMap, $dbg_constValue, $dbg_constName, + $debugger, $g_LogFile, $LogData, $Errors, + $g_DebugMode, $totalsql, $sqlcount, $objConfig, $ItemTypePrefixes, $ItemTagFiles, $objModules, $objSystemCache, $objBanList, $objItemTypes, $objThemes, $objLanguages, $objImageList, $objFavorites, - $objUsers, $objGroups, $DownloadId, $objPermissions, $objPermCache, $m_var_list, $objCatList, - $objCustomFieldList, $objCustomDataList, $objCountCache, $CRLF, $objMessageList, $objEmailQueue, - $ExtraVars, $adodbConnection, $sql, $rs, $mod_prefix, $modules_loaded, $name, - $template_path, $mod_root_cats, $value, $mod, $ItemTypes, - $ParserFiles, $SessionQueryString, $var_list, $objSession, - $orderByClause, $TemplateRoot, $ip, $UseSession, $Action, $CookieTest, $sessionId, - $var_list_update, $CurrentTheme, $UserID, $objCurrentUser, $objLanguageCache, - $folder_name, $objLinkList, $tag_override, $timeZones, $siteZone, $serverZone, - $lastExpire, $diffZone, $date, $nowDate, $lastExpireDate, $SearchPerformed, - $TotalMessagesSent, $ado, $adminDir, $rootURL, $secureURL, $html, $timeout, + $objUsers, $objGroups, $DownloadId, $objPermissions, $objPermCache, $m_var_list, $objCatList, + $objCustomFieldList, $objCustomDataList, $objCountCache, $CRLF, $objMessageList, $objEmailQueue, + $ExtraVars, $adodbConnection, $sql, $rs, $mod_prefix, $modules_loaded, $name, + $template_path, $mod_root_cats, $value, $mod, $ItemTypes, + $ParserFiles, $SessionQueryString, $var_list, $objSession, + $orderByClause, $TemplateRoot, $ip, $UseSession, $Action, $CookieTest, $sessionId, + $var_list_update, $CurrentTheme, $UserID, $objCurrentUser, $objLanguageCache, + $folder_name, $objLinkList, $tag_override, $timeZones, $siteZone, $serverZone, + $lastExpire, $diffZone, $date, $nowDate, $lastExpireDate, $SearchPerformed, + $TotalMessagesSent, $ado, $adminDir, $rootURL, $secureURL, $html, $timeout, $pathchar, $objTemplate, $objTopicList, $objArticleList, $objPostingList, $objCensorList, $objSmileys, $objPMList, $SubscribeAddress, $SubscribeError, $SubscribeResult, $application; - + $pathtoroot = FULL_PATH.'/'; - + if (!file_exists(FULL_PATH.'/config.php')) { echo "In-Portal is probably not installed, or configuration file is missing.
"; echo "Please use the installation script to fix the problem.

"; echo "Go to installation script

"; flush(); $this->Application->ApplicationDie(); } - + //ob_start(); $FrontEnd = 1; - + $indexURL="../../index.php"; //Set to relative URL from the theme directory - + /* initalize the in-portal system */ include_once(FULL_PATH."/kernel/startup.php"); - + $rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); $secureURL = $rootURL; - + if( !$var_list['t'] ) $var_list['t'] = 'index'; - + $this->InitParser(); - + // process referer in session: begin if (is_object($objSession)) { $k4_referer = $objSession->GetVariable('K4_Template_Referer'); @@ -132,18 +143,18 @@ $objSession->SetVariable('Template_Referer', isset($_local_t) ? $_local_t : ''); } // process referer in session: end - + if ($this->Application->isDebugMode() && $Action) { $this->Application->Debugger->setHTMLByIndex(1, 'Front Action: '.$Action.'', 'append'); } - + LogEntry("Output Complete\n"); $objLanguageCache->SaveTemplateCache(); LogEntry("Templates Cached\n"); - + $timeend = getmicrotime(); $diff = $timeend - $timestart; - + LogEntry("\nTotal Queries Executed: $sqlcount in $totalsql seconds\n"); LogEntry("\nPage Execution Time: $diff seconds\n", true); if ($LogFile) { Index: trunk/core/admin_templates/catalog/catalog.tpl =================================================================== diff -u -r7391 -r8104 --- trunk/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 7391) +++ trunk/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 8104) @@ -177,17 +177,17 @@ -
Search:  - + Index: trunk/admin/install/langpacks/english.lang =================================================================== diff -u -r8061 -r8104 --- trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 8061) +++ trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 8104) @@ -147,6 +147,7 @@ RmlsZSBub3QgZm91bmQgKDQwNCkgdGVtcGxhdGU= Rmlyc3QgRGF5IE9mIFdlZWs= UmVkaXJlY3QgdG8gSFRUUCB3aGVuIFNTTCBpcyBub3QgcmVxdWlyZWQ= + SGVhZGVyIFNlcGFyYXRvciBUeXBl TmFtZQ== SW5zdWZmaWNlbnQgcGVybWlzc2lvbnMgdGVtcGxhdGU= R1pJUCBjb21wcmVzc2lvbiBsZXZlbCAwLTk= @@ -493,6 +494,7 @@ U29ydCByZXZpZXdzIGJ5 VVJM RGlzcGxheSBsaW5rIFVSTCBpbiBzdGF0dXMgYmFy + TGludXggKFxuKQ== TG9jYWwgSW1hZ2U= TG9nZ2VkIGluIGFz TG9naW4= @@ -944,6 +946,7 @@ bGFfUmF0aW5n QWxyZWFkeSB2b3RlZA== UmVjaXByb2NhbA== + VXNlIENhcHRjaGEgY29kZSBvbiBSZWdpc3RyYXRpb24= UmVtb3ZlIEZyb20= Tm90IGFsbCByZXF1aXJlZCBmaWVsZHMgYXJlIGZpbGxlZC4gUGxlYXNlIGZpbGwgdGhlbSBmaXJzdC4= QWNjZXNzIGRlbmllZA== @@ -1591,6 +1594,7 @@ WW91IGFyZSBhYm91dCB0byBkZWxldGUgdGhlIHByaW1hcnkgdGhlbWUuIENvbnRpbnVlPw== TW9kaWZpY2F0aW9ucyB3aWxsIG5vdCB0YWtlIGVmZmVjdCB1bnRpbCB5b3UgY2xpY2sgdGhlIFNhdmUgYnV0dG9uIQ== d2Vlaw== + V2luZG93cyAoXHJcbik= eWVhcg== WWVz WW91IGRvIG5vdCBoYXZlIGFjY2VzcyB0byBwZXJmb3JtIHRoaXMgb3BlcmF0aW9u @@ -1663,6 +1667,8 @@ WWVz Ynk= Q2FuY2Vs + U2VjdXJpdHkgY29kZQ== + RW50ZXIgU2VjdXJpdHkgQ29kZQ== Q2F0ZWdvcnk= Q2F0ZWdvcmllcw== Y2F0ZWdvcmllcyB1cGRhdGVk Index: trunk/kernel/include/itemdb.php =================================================================== diff -u -r7867 -r8104 --- trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 7867) +++ trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 8104) @@ -656,8 +656,9 @@ { static $tables_found = Array (); - if ($table == null) $table = $this->tablename; + if($table == null) $table = $this->tablename; + if (!isset($tables_found[$table])) { // checks if table specified in item exists in db $db =& GetADODBConnection(); Index: trunk/core/admin_templates/tools/system_tools.tpl =================================================================== diff -u -r7991 -r8104 --- trunk/core/admin_templates/tools/system_tools.tpl (.../system_tools.tpl) (revision 7991) +++ trunk/core/admin_templates/tools/system_tools.tpl (.../system_tools.tpl) (revision 8104) @@ -23,6 +23,7 @@ ');" value="Go">  
- +
+
- + -
Search:  - + Index: trunk/kernel/include/portaluser.php =================================================================== diff -u -r4758 -r8104 --- trunk/kernel/include/portaluser.php (.../portaluser.php) (revision 4758) +++ trunk/kernel/include/portaluser.php (.../portaluser.php) (revision 8104) @@ -757,8 +757,42 @@ return "Undefined:$tagname"; break; } - } + } + + /** + * Sends EmailEvent to user + * + * @param string $EventName email event name + * @param mixed $ToUserId recipient's user_id or email address + * @param int $LangId language_id (not in use) + * @param string $RecptName recipient's name (only when ID not passed) + * @return kEvent + */ + function SendUserEventMail($EventName,$ToUserId,$LangId=NULL,$RecptName=NULL) + { + $object =& $this->Application->recallObject('u', null, Array ('skip_autoload' => true)); + /* @var $object kDBItem */ + + $object->Load($this->UniqueId()); + + $send_params = is_numeric($ToUserId) ? Array() : Array ('to_email' => $ToUserId, 'to_name' => $RecptName); + $status = $this->Application->EmailEventUser($EventName, $ToUserId, $send_params); + $object->Load($this->Application->RecallVar('user_id')); + return $status; + } + function SendAdminEventMail($EventName,$LangId=NULL) + { + $object =& $this->Application->recallObject('u', null, Array ('skip_autoload' => true)); + /* @var $object kDBItem */ + + $object->Load($this->UniqueId()); + + $status = $this->Application->EmailEventAdmin($EventName); + $object->Load($this->Application->RecallVar('user_id')); + return $status; + } + } /* class clsPortalUser*/ Index: trunk/core/install/upgrades.sql =================================================================== diff -u -r8092 -r8104 --- trunk/core/install/upgrades.sql (.../upgrades.sql) (revision 8092) +++ trunk/core/install/upgrades.sql (.../upgrades.sql) (revision 8104) @@ -12,7 +12,6 @@ ALTER TABLE Phrase CHANGE Translation Translation TEXT NOT NULL, CHANGE Module Module VARCHAR(30) NOT NULL DEFAULT 'In-Portal'; - ALTER TABLE Category CHANGE Description Description TEXT, CHANGE l1_Description l1_Description TEXT, @@ -28,43 +27,32 @@ CHANGE l5_CachedNavbar l5_CachedNavbar text, CHANGE ParentPath ParentPath TEXT NULL DEFAULT NULL, CHANGE NamedParentPath NamedParentPath TEXT NULL DEFAULT NULL; - ALTER TABLE ConfigurationAdmin CHANGE ValueList ValueList TEXT; - ALTER TABLE EmailQueue CHANGE `Subject` `Subject` TEXT, CHANGE toaddr toaddr TEXT, CHANGE fromaddr fromaddr TEXT; - ALTER TABLE Category DROP Pop; - ALTER TABLE PortalUser CHANGE CreatedOn CreatedOn INT DEFAULT NULL, CHANGE dob dob INT(11) NULL DEFAULT NULL, CHANGE PassResetTime PassResetTime INT(11) UNSIGNED NULL DEFAULT NULL, CHANGE PwRequestTime PwRequestTime INT(11) UNSIGNED NULL DEFAULT NULL, CHANGE `Password` `Password` VARCHAR(255) NULL DEFAULT 'd41d8cd98f00b204e9800998ecf8427e'; - ALTER TABLE Modules CHANGE BuildDate BuildDate INT UNSIGNED NULL DEFAULT NULL, CHANGE Version Version VARCHAR(10) NOT NULL DEFAULT '0.0.0', CHANGE `Var` `Var` VARCHAR(100) NOT NULL DEFAULT ''; - ALTER TABLE Language CHANGE Enabled Enabled INT(11) NOT NULL DEFAULT '1', CHANGE InputDateFormat InputDateFormat VARCHAR(50) NOT NULL DEFAULT 'm/d/Y', CHANGE InputTimeFormat InputTimeFormat VARCHAR(50) NOT NULL DEFAULT 'g:i:s A', CHANGE DecimalPoint DecimalPoint VARCHAR(10) NOT NULL DEFAULT '', CHANGE ThousandSep ThousandSep VARCHAR(10) NOT NULL DEFAULT ''; - ALTER TABLE Events CHANGE FromUserId FromUserId INT(11) NOT NULL DEFAULT '-1'; - ALTER TABLE StdDestinations CHANGE DestAbbr2 DestAbbr2 CHAR(2) NULL DEFAULT NULL; - ALTER TABLE PermCache DROP DACL; - ALTER TABLE PortalGroup CHANGE CreatedOn CreatedOn INT UNSIGNED NULL DEFAULT NULL; - ALTER TABLE UserSession CHANGE SessionKey SessionKey INT UNSIGNED NULL DEFAULT NULL , CHANGE CurrentTempKey CurrentTempKey INT UNSIGNED NULL DEFAULT NULL , @@ -73,7 +61,6 @@ CHANGE PortalUserId PortalUserId INT(11) NOT NULL DEFAULT '-2', CHANGE Language Language INT(11) NOT NULL DEFAULT '1', CHANGE Theme Theme INT(11) NOT NULL DEFAULT '1'; - CREATE TABLE Counters ( CounterId int(10) unsigned NOT NULL auto_increment, Name varchar(100) NOT NULL default '', @@ -85,4 +72,4 @@ TablesAffected text, PRIMARY KEY (CounterId), UNIQUE KEY Name (Name) -); +); \ No newline at end of file Index: trunk/core/admin_templates/incs/grid_blocks.tpl =================================================================== diff -u -r8082 -r8104 --- trunk/core/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 8082) +++ trunk/core/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 8104) @@ -58,15 +58,14 @@
- _search_keyword" name="_search_keyword" value="" onkeydown="search_keydown(event, '', '', );" style="border: 1px solid grey;" /> - + _search_keyword" name="_search_keyword" value="" onkeydown="search_keydown(event, '', '', );" class="search-box"/> + ]"> + ]">
- - +
Index: trunk/core/units/admin/admin_tag_processor.php =================================================================== diff -u -r8078 -r8104 --- trunk/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 8078) +++ trunk/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 8104) @@ -151,8 +151,14 @@ return $ret; } + $debug_mode = $this->Application->isDebugMode(); // caching for faster performance ksort($section_data['children'], SORT_NUMERIC); foreach ($section_data['children'] as $section_name) { + $section_data =& $sections_helper->getSectionData($section_name); + if (!$debug_mode && isset($section_data['debug_only']) && $section_data['debug_only']) { + // don't show section for debug mode only without debug mode turned on + continue; + } $params['section_name'] = $section_name; $ret .= $this->DrawTree($params); $deep_level--;