Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F860322
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, May 1, 2:46 AM
Size
68 KB
Mime Type
text/x-diff
Expires
Sat, May 3, 2:46 AM (4 h, 45 m)
Engine
blob
Format
Raw Data
Handle
611998
Attached To
rINP In-Portal
in-portal
View Options
Index: branches/5.1.x/core/units/admin/admin_events_handler.php
===================================================================
--- branches/5.1.x/core/units/admin/admin_events_handler.php (revision 13663)
+++ branches/5.1.x/core/units/admin/admin_events_handler.php (revision 13664)
@@ -1,1400 +1,1352 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class AdminEventsHandler extends kDBEventHandler {
function mapPermissions()
{
parent::mapPermissions();
$permissions = Array(
'OnSaveColumns' => array('self' => true),
'OnClosePopup' => array('self' => true),
'OnSaveSetting' => array('self' => true),
// export/import permissions is checked within events
'OnExportCSV' => Array('self' => true),
'OnGetCSV' => Array('self' => true),
'OnCSVImportBegin' => Array('self' => true),
'OnCSVImportStep' => Array('self' => true),
'OnDropTempTablesByWID' => Array('self' => true),
);
$this->permMapping = array_merge($this->permMapping, $permissions);
}
/**
* Checks permissions of user
*
* @param kEvent $event
*/
function CheckPermission(&$event)
{
$perm_value = null;
$system_events = Array (
'OnResetModRwCache', 'OnResetSections', 'OnResetConfigsCache', 'OnResetMemcache',
'OnDeleteCompiledTemplates', 'OnCompileTemplates', 'OnGenerateTableStructure',
'OnRebuildThemes', 'OnCheckPrefixConfig', 'OnMemoryCacheGet', 'OnMemoryCacheSet'
);
if (in_array($event->Name, $system_events)) {
// events from "Tools -> System Tools" section are controlled via that section "edit" permission
$perm_value = /*$this->Application->isDebugMode() ||*/ $this->Application->CheckPermission($event->getSection() . '.edit');
}
$tools_events = Array (
'OnBackup' => 'in-portal:backup.view',
'OnBackupProgress' => 'in-portal:backup.view',
'OnDeleteBackup' => 'in-portal:backup.view',
'OnBackupCancel' => 'in-portal:backup.view',
'OnRestore' => 'in-portal:restore.view',
'OnRestoreProgress' => 'in-portal:restore.view',
'OnRestoreCancel' => 'in-portal:backup.view',
'OnSqlQuery' => 'in-portal:sql_query.view',
);
if (array_key_exists($event->Name, $tools_events)) {
$perm_value = $this->Application->CheckPermission($tools_events[$event->Name]);
}
if ($event->Name == 'OnSaveMenuFrameWidth') {
$perm_value = $this->Application->isAdminUser;
}
if (isset($perm_value)) {
$perm_helper =& $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
return $perm_helper->finalizePermissionCheck($event, $perm_value);
}
return parent::CheckPermission($event);
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnResetModRwCache(&$event)
{
if ($this->Application->GetVar('ajax') == 'yes') {
$event->status = erSTOP;
}
$this->Conn->Query('DELETE FROM ' . TABLE_PREFIX . 'CachedUrls');
}
function OnResetSections(&$event)
{
if ($this->Application->GetVar('ajax') == 'yes') {
$event->status = erSTOP;
}
if ($this->Application->isCachingType(CACHING_TYPE_MEMORY)) {
$this->Application->deleteCache('master:sections_parsed');
}
else {
$this->Application->deleteDBCache('sections_parsed');
}
$event->SetRedirectParam('refresh_tree', 1);
}
function OnResetConfigsCache(&$event)
{
if ($this->Application->GetVar('ajax') == 'yes') {
$event->status = erSTOP;
}
if ($this->Application->isCachingType(CACHING_TYPE_MEMORY)) {
$this->Application->deleteCache('master:config_files');
$this->Application->deleteCache('master:configs_parsed');
$this->Application->deleteCache('master:sections_parsed');
}
else {
$this->Application->deleteDBCache('config_files');
$this->Application->deleteDBCache('configs_parsed');
$this->Application->deleteDBCache('sections_parsed');
}
$skin_helper =& $this->Application->recallObject('SkinHelper');
/* @var $skin_helper SkinHelper */
$skin_helper->deleteCompiled();
$event->SetRedirectParam('refresh_tree', 1);
}
function OnResetMemcache(&$event)
{
if ($this->Application->GetVar('ajax') == 'yes') {
$event->status = erSTOP;
}
if ($this->Application->isCachingType(CACHING_TYPE_MEMORY)) {
$this->Application->memoryCache->reset();
}
}
function OnCompileTemplates(&$event)
{
$compiler =& $this->Application->recallObject('NParserCompiler');
/* @var $compiler NParserCompiler */
$compiler->CompileTemplatesStep();
$event->status = erSTOP;
}
/**
* Deletes all compiled templates
*
* @param kEvent $event
*/
function OnDeleteCompiledTemplates(&$event)
{
if ($this->Application->GetVar('ajax') == 'yes') {
$event->status = erSTOP;
}
$base_path = WRITEABLE . DIRECTORY_SEPARATOR . 'cache';
// delete debugger reports
$debugger_reports = glob($base_path . '/debug_@*@.txt');
foreach ($debugger_reports as $debugger_report) {
unlink($debugger_report);
}
$this->_deleteCompiledTemplates($base_path);
}
function _deleteCompiledTemplates($folder, $unlink_folder = false)
{
$sub_folders = glob($folder . '/*', GLOB_ONLYDIR);
foreach ($sub_folders as $sub_folder) {
$this->_deleteCompiledTemplates($sub_folder, true);
}
$files = glob($folder . '/*.php');
foreach ($files as $file) {
unlink($file);
}
if ($unlink_folder) {
rmdir($folder);
}
}
/**
* Generates sturcture for specified table
*
* @param kEvent $event
* @author Alex
*/
function OnGenerateTableStructure(&$event)
{
$types_hash = Array(
'string' => 'varchar|text|mediumtext|longtext|date|datetime|time|timestamp|char|year|enum|set',
'int' => 'smallint|mediumint|int|bigint|tinyint',
'float' => 'float|double|decimal',
);
$table_name = $this->Application->GetVar('table_name');
if (!$table_name) {
echo 'error: no table name specified';
return ;
}
if (TABLE_PREFIX && !preg_match('/^'.preg_quote(TABLE_PREFIX, '/').'(.*)/', $table_name) && (strtolower($table_name) != $table_name)) {
// table name without prefix, then add it (don't affect K3 tables named in lowercase)
$table_name = TABLE_PREFIX.$table_name;
}
if (!$this->Conn->TableFound($table_name)) {
// table with prefix doesn't exist, assume that just config prefix passed -> resolve table name from it
$prefix = preg_replace('/^' . preg_quote(TABLE_PREFIX, '/') . '/', '', $table_name);
if ($this->Application->prefixRegistred($prefix)) {
// when prefix is found -> use it's table (don't affect K3 tables named in lowecase)
$table_name = $this->Application->getUnitOption($prefix, 'TableName');
}
}
$table_info = $this->Conn->Query('DESCRIBE '.$table_name);
// 1. prepare config keys
$grids = Array (
'Default' => Array (
'Icons' => Array ('default' => 'icon16_item.png'),
'Fields' => Array (),
)
);
$grid_fields = Array();
$id_field = '';
$fields = Array();
$float_types = Array ('float', 'double', 'numeric');
foreach ($table_info as $field_info) {
if (preg_match('/l[\d]+_.*/', $field_info['Field'])) {
// don't put multilingual fields in config
continue;
}
$field_options = Array ();
$grid_col_options = Array(
'title' => 'la_col_' . $field_info['Field'],
'filter_block' => 'grid_like_filter',
);
// 1. get php field type by mysql field type
foreach ($types_hash as $php_type => $db_types) {
if (preg_match('/'.$db_types.'/', $field_info['Type'])) {
$field_options['type'] = $php_type;
break;
}
}
$default_value = $field_info['Default'];
if (in_array($php_type, $float_types)) {
// this is float number
if (preg_match('/'.$db_types.'\([\d]+,([\d]+)\)/i', $field_info['Type'], $regs)) {
// size is described in structure -> add formatter
$field_options['formatter'] = 'kFormatter';
$field_options['format'] = '%01.'.$regs[1].'f';
if ($field_info['Null'] != 'YES') {
// null fields, will most likely have NULL as default value
$default_value = 0;
}
}
else {
// no size information, just convert to float
if ($field_info['Null'] != 'YES') {
// null fields, will most likely have NULL as default value
$default_value = (float)$default_value;
}
}
}
if (preg_match('/varchar\(([\d]+)\)/i', $field_info['Type'], $regs)) {
$field_options['max_len'] = (int)$regs[1];
}
if (preg_match('/tinyint\([\d]+\)/i', $field_info['Type'])) {
$field_options['formatter'] = 'kOptionsFormatter';
$field_options['options'] = Array (1 => 'la_Yes', 0 => 'la_No');
$field_options['use_phrases'] = 1;
$grid_col_options['filter_block'] = 'grid_options_filter';
}
if ($field_info['Null'] != 'YES') {
$field_options['not_null'] = 1;
}
if ($field_info['Key'] == 'PRI') {
$default_value = 0;
$id_field = $field_info['Field'];
}
if ($php_type == 'int' && !array_key_exists('not_null', $field_options)) {
// numeric null field
if (preg_match('/(On|Date)$/', $field_info['Field']) || $field_info['Field'] == 'Modified') {
$field_options['formatter'] = 'kDateFormatter';
$grid_col_options['filter_block'] = 'grid_date_rage_filter';
}
}
if ($php_type == 'int' && ($field_info['Null'] != 'YES' || is_numeric($default_value))) {
// is integer field AND not null
$field_options['default'] = (int)$default_value;
}
else {
$field_options['default'] = $default_value;
}
$fields[ $field_info['Field'] ] = $field_options;
$grids_fields[ $field_info['Field'] ] = $grid_col_options;
}
$grids['Default']['Fields'] = $grids_fields;
$ret = Array (
'IDField' => $id_field,
'Fields' => $fields,
'Grids' => $grids,
);
$decorator = new UnitConfigDecorator();
$ret = $decorator->decorate($ret);
$this->Application->InitParser();
ob_start();
echo $this->Application->ParseBlock(Array('name' => 'incs/header', 'body_properties' => 'style="background-color: #E7E7E7; margin: 8px;"'));
?>
<script type="text/javascript">
set_window_title('Table "<?php echo $table_name; ?>" Structure');
</script>
<a href="javascript:window_close();">Close Window</a><br /><br />
<?php echo $GLOBALS['debugger']->highlightString($ret); ?>
<br /><br /><a href="javascript:window_close();">Close Window</a><br />
<?php
echo $this->Application->ParseBlock(Array('name' => 'incs/footer'));
echo ob_get_clean();
$event->status = erSTOP;
}
/**
* Refreshes ThemeFiles & Theme tables by actual content on HDD
*
* @param kEvent $event
*/
function OnRebuildThemes(&$event)
{
if ($this->Application->GetVar('ajax') == 'yes') {
$event->status = erSTOP;
}
$themes_helper =& $this->Application->recallObject('ThemesHelper');
/* @var $themes_helper kThemesHelper */
$themes_helper->refreshThemes();
}
function OnSaveColumns(&$event)
{
$picker_helper =& $this->Application->recallObject('ColumnPickerHelper');
/* @var $picker_helper kColumnPickerHelper */
$picker_helper->SetGridName($this->Application->GetLinkedVar('grid_name'));
$picked = trim($this->Application->GetVar('picked_str'), '|');
$hidden = trim($this->Application->GetVar('hidden_str'), '|');
$main_prefix = $this->Application->GetVar('main_prefix');
$picker_helper->SaveColumns($main_prefix, $picked, $hidden);
$this->finalizePopup($event);
}
/**
* Saves various admin settings via ajax
*
* @param kEvent $event
*/
function OnSaveSetting(&$event)
{
if ($this->Application->GetVar('ajax') != 'yes') {
return ;
}
$var_name = $this->Application->GetVar('var_name');
$var_value = $this->Application->GetVar('var_value');
$this->Application->StorePersistentVar($var_name, $var_value);
$event->status = erSTOP;
}
/**
* Just closes popup & deletes last_template & opener_stack if popup, that is closing
*
* @param kEvent $event
*/
function OnClosePopup(&$event)
{
$event->SetRedirectParam('opener', 'u');
}
/**
* Occurs right after initialization of the kernel, used mainly as hook-to event
*
* @param kEvent $event
*/
function OnStartup(&$event)
{
}
/**
* Occurs right before echoing the output, in Done method of application, used mainly as hook-to event
*
* @param kEvent $event
*/
function OnBeforeShutdown(&$event)
{
}
/**
* Is called after tree was build (when not from cache)
*
* @param kEvent $event
*/
function OnAfterBuildTree(&$event)
{
}
/**
* Called by AJAX to perform CSV export
*
* @param kEvent $event
*/
function OnExportCSV(&$event)
{
$export_helper =& $this->Application->recallObject('CSVHelper');
/* @var $export_helper kCSVHelper */
$prefix_special = $this->Application->GetVar('PrefixSpecial');
if(!$prefix_special) {
$prefix_special = $export_helper->ExportData('prefix');
}
$prefix_elems = split('\.|_', $prefix_special, 2);
$perm_sections = $this->Application->getUnitOption($prefix_elems[0], 'PermSection');
if(!$this->Application->CheckPermission($perm_sections['main'].'.view')) {
$event->status = erPERM_FAIL;
return ;
}
$export_helper->PrefixSpecial = $prefix_special;
$export_helper->grid = $this->Application->GetVar('grid');
$export_helper->ExportStep();
$event->status = erSTOP;
}
/**
* Returning created by AJAX CSV file
*
* @param kEvent $event
*/
function OnGetCSV(&$event)
{
$export_helper =& $this->Application->recallObject('CSVHelper');
/* @var $export_helper kCSVHelper */
$prefix_special = $export_helper->ExportData('prefix');
$prefix_elems = split('\.|_', $prefix_special, 2);
$perm_sections = $this->Application->getUnitOption($prefix_elems[0], 'PermSection');
if(!$this->Application->CheckPermission($perm_sections['main'].'.view')) {
$event->status = erPERM_FAIL;
return ;
}
$export_helper->GetCSV();
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnCSVImportBegin(&$event)
{
$prefix_special = $this->Application->GetVar('PrefixSpecial');
$prefix_elems = split('\.|_', $prefix_special, 2);
$perm_sections = $this->Application->getUnitOption($prefix_elems[0], 'PermSection');
if(!$this->Application->CheckPermission($perm_sections['main'].'.add') && !$this->Application->CheckPermission($perm_sections['main'].'.edit')) {
$event->status = erPERM_FAIL;
return ;
}
$object =& $event->getObject( Array('skip_autoload' => true) );
/* @var $object kDBItem */
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
$field_values = array_shift($items_info);
$object->SetFieldsFromHash($field_values);
$event->redirect = false;
$result = 'required';
if($object->GetDBField('ImportFile')) {
$import_helper =& $this->Application->recallObject('CSVHelper');
/* @var $import_helper kCSVHelper */
$import_helper->PrefixSpecial = $this->Application->GetVar('PrefixSpecial');
$import_helper->grid = $this->Application->GetVar('grid');
$result = $import_helper->ImportStart( $object->GetField('ImportFile', 'file_paths') );
if($result === true) {
$event->redirect = $this->Application->GetVar('next_template');
$event->SetRedirectParam('PrefixSpecial', $this->Application->GetVar('PrefixSpecial'));
$event->SetRedirectParam('grid', $this->Application->GetVar('grid'));
}
}
if($event->redirect === false) {
$object->SetError('ImportFile', $result);
$event->status = erFAIL;
}
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnCSVImportStep(&$event)
{
$import_helper =& $this->Application->recallObject('CSVHelper');
/* @var $export_helper kCSVHelper */
$prefix_special = $import_helper->ImportData('prefix');
$prefix_elems = split('\.|_', $prefix_special, 2);
$perm_sections = $this->Application->getUnitOption($prefix_elems[0], 'PermSection');
if(!$this->Application->CheckPermission($perm_sections['main'].'.add') && !$this->Application->CheckPermission($perm_sections['main'].'.edit')) {
$event->status = erPERM_FAIL;
return ;
}
$import_helper->ImportStep();
$event->status = erSTOP;
}
/**
* Shows unit config filename, where requested prefix is defined
*
* @param kEvent $event
*/
function OnCheckPrefixConfig(&$event)
{
$prefix = $this->Application->GetVar('config_prefix');
$config_file = $this->Application->UnitConfigReader->prefixFiles[$prefix];
$this->Application->InitParser();
ob_start();
echo $this->Application->ParseBlock(Array('name' => 'incs/header', 'body_properties' => 'style="background-color: #E7E7E7; margin: 8px;"'));
?>
<script type="text/javascript">
set_window_title('Unit Config of "<?php echo $prefix; ?>" prefix');
</script>
<a href="javascript:window_close();">Close Window</a><br /><br />
<strong>Prefix:</strong> <?php echo $prefix; ?><br />
<strong>Unit Config:</strong> <?php echo $GLOBALS['debugger']->highlightString($config_file); ?><br />
<br /><a href="javascript:window_close();">Close Window</a><br />
<?php
echo $this->Application->ParseBlock(Array('name' => 'incs/footer'));
echo ob_get_clean();
$event->status = erSTOP;
}
- function OnUploadFile(&$event)
- {
- // Flash uploader does NOT send correct cookies, so we need to make our own check
- $cookie_name = 'adm_'.$this->Application->ConfigValue('SessionCookieName');
- $this->Application->HttpQuery->Cookie['cookies_on'] = 1;
- $this->Application->HttpQuery->Cookie[$cookie_name] = $this->Application->GetVar('flashsid');
-
- $admin_ses =& $this->Application->recallObject('Session.admin');
- /* @var $admin_ses Session */
- $user = $admin_ses->RecallVar('user_id');
- $perm_helper =& $this->Application->recallObject('PermissionsHelper');
- /* @var $perm_helper kPermissionsHelper */
-
- /*if() {
- $prefix_special = $this->Application->GetVar('PrefixSpecial');
- $prefix_elems = split('\.|_', $prefix_special, 2);
- $perm_sections = $this->Application->getUnitOption($prefix_elems[0], 'PermSection');
- $section = $perm_sections['main'];
- }
- else {*/
- $section = $event->getSection();
- /*}*/
-
- if ($this->Application->GetVar('t') != 'import/import_start' && !$perm_helper->CheckUserPermission($user, $section.'.add') && !$perm_helper->CheckUserPermission($user, $section.'.edit')) {
- $event->status = erPERM_FAIL;
- header('HTTP/1.0 403 You don\'t have permissions to upload');
- exit;
- return;
- }
-
- if (!$cookie_name) $cookie_name = 'sid';
-
- $value = $this->Application->GetVar('Filedata');
- if (!$value) return ;
- $tmp_path = WRITEABLE . '/tmp/';
- $fname = $value['name'];
- $id = $this->Application->GetVar('id');
- if ($id) $fname = $id.'_'.$fname;
-
- if (!is_writable($tmp_path)) {
- header('HTTP/1.0 500 Write permissions not set on the server');
- exit;
- }
-
- move_uploaded_file($value['tmp_name'], $tmp_path.$fname);
- exit;
- }
-
function OnDropTempTablesByWID(&$event)
{
$sid = $this->Application->GetSID();
$wid = $this->Application->GetVar('m_wid');
$tables = $this->Conn->GetCol('SHOW TABLES');
$mask_edit_table = '/'.TABLE_PREFIX.'ses_'.$sid.'_'.$wid.'_edit_(.*)$/';
foreach($tables as $table)
{
if( preg_match($mask_edit_table,$table,$rets) )
{
$this->Conn->Query('DROP TABLE IF EXISTS '.$table);
}
}
echo 'OK';
$event->status = erSTOP;
return ;
}
/**
* Backup all data
*
* @param kEvent $event
*/
function OnBackup(&$event)
{
$backup_path = $this->Application->ConfigValue('Backup_Path');
$file_helper =& $this->Application->recallObject('FileHelper');
/* @var $file_helper FileHelper */
if (!$file_helper->CheckFolder($backup_path) || !is_writable($backup_path)) {
$event->status = erFAIL;
$this->Application->SetVar('error_msg', $this->Application->Phrase('la_Text_backup_access'));
return ;
}
$a_tables = $this->Conn->GetCol('SHOW TABLES'); // array_keys($tables);
$TableNames = Array();
for($x=0;$x<count($a_tables);$x++)
{
if(substr($a_tables[$x],0,strlen(TABLE_PREFIX))==TABLE_PREFIX)
{
if (!strstr($a_tables[$x], 'ses_')) {
$TableNames[] = $a_tables[$x];
}
}
}
$backupProgress = Array (
'table_num' => 0,
'table_names' => $TableNames,
'table_count' => count($TableNames),
'record_count' => 0,
'file_name' => $backup_path."/dump".adodb_mktime().".txt",
);
$this->Application->RemoveVar('adm.backupcomplete_filename');
$this->Application->RemoveVar('adm.backupcomplete_filesize');
$out = array();
for($x=0;$x<count($TableNames);$x++) {
if (!strstr($TableNames[$x], 'ses_')) {
$out[] = $this->GetTableCreate($TableNames[$x]);
}
}
$fp = fopen($backupProgress['file_name'], 'a');
$sql = "SELECT Name, Version FROM ".TABLE_PREFIX."Modules";
$r = $this->Conn->Query($sql);
foreach ($r AS $a_module) {
$version = $a_module['Version'];
fwrite($fp, "# ".$a_module['Name']." Version: $version;\n");
}
fwrite($fp, "#------------------------------------------\n\n");
fwrite($fp,implode("\n",$out));
fwrite($fp,"\n");
fclose($fp);
$this->Application->StoreVar('adm.backup_status', serialize($backupProgress));
$event->redirect = 'tools/backup2';
}
/**
* Perform next backup step
*
* @param kEvent $event
*/
function OnBackupProgress(&$event)
{
$done_percent = $this->performBackup();
if ($done_percent == 100) {
$event->redirect = 'tools/backup3';
return ;
}
echo $done_percent;
$event->status = erSTOP;
}
/**
* Stops Backup & redirect to Backup template
*
* @param kEvent $event
*/
function OnBackupCancel(&$event)
{
$event->redirect = 'tools/backup1';
}
/**
* Stops Restore & redirect to Restore template
*
* @param kEvent $event
*/
function OnRestoreCancel(&$event)
{
$event->redirect = 'tools/restore1';
}
function performBackup()
{
$backupProgress = unserialize($this->Application->RecallVar('adm.backup_status'));
// echo "<pre>"; print_r($backupProgress); echo "</pre>";
// exit;
$CurrentTable = $backupProgress['table_names'][$backupProgress['table_num']];
// get records
$a_records = $this->insert_data($CurrentTable,$backupProgress['record_count'],50,"");
// echo "<pre>"; print_r($a_records); echo "</pre>";
// exit;
if ($a_records['num'] < 50) {
$backupProgress['table_num']++;
// if ($backupProgress['table_names'][$backupProgress['table_num']] == TABLE_PREFIX.'Cache') {
// $backupProgress['table_num']++;
// }
$backupProgress['record_count'] = 0;
} else {
$backupProgress['record_count']+=50;
}
if ($a_records['sql']) {
$fp = fopen($backupProgress['file_name'], 'a');
fwrite($fp, $a_records['sql']);
fclose($fp);
}
$percent = ($backupProgress['table_num'] / $backupProgress['table_count']) * 100;
if ($percent >= 100) {
$percent = 100;
$this->Application->StoreVar('adm.backupcomplete_filename', $backupProgress['file_name']);
$this->Application->StoreVar('adm.backupcomplete_filesize', round(filesize($backupProgress['file_name'])/1024/1024, 2)); // Mbytes
} else {
$this->Application->StoreVar('adm.backup_status', serialize($backupProgress));
}
return round($percent);
}
//extracts the rows of data from tables using limits
function insert_data($table, $start, $limit, $mywhere)
{
// global $out;
if ($mywhere !="")
{
$whereclause= " WHERE ".$mywhere." ";
}
else
{
$whereclause = "";
}
$a_data = $this->Conn->Query("SELECT * from $table $whereclause LIMIT $start, $limit");
// echo "SELECT * from $table $whereclause LIMIT $start, $limit";
// echo "<pre>"; print_r($a_records); echo "</pre>";
// exit;
if (!$a_data) {
return Array(
'num' => 0,
'sql' => '',
);
}
// $prefix = GetTablePrefix();
$rowcount = 0;
$a_fields = array_keys($a_data[0]);
$fields_sql = '';
foreach ($a_fields AS $field_name) {
$fields_sql .= '`'.$field_name.'`,';
}
$fields_sql = substr($fields_sql, 0, -1);
$temp = '';
foreach ($a_data AS $a_row)
{
$values_sql = '';
foreach ($a_row as $field_name => $field_value) {
$values_sql .= $this->Conn->qstr($field_value).',';
}
$values_sql = substr($values_sql, 0, -1);
$sql = 'INSERT INTO '.$table.' ('.$fields_sql.') VALUES ('.$values_sql.');';
$sql = str_replace("\n", "\\n", $sql);
$sql = str_replace("\r", "\\r", $sql);
$temp .= $sql."\n";
}
if(strlen(TABLE_PREFIX))
{
$temp = str_replace("INSERT INTO ".TABLE_PREFIX, "INSERT INTO ", $temp);
}
return Array(
'num' => count($a_data),
'sql' => $temp,
);
}
function GetTableCreate($table, $crlf="\n")
{
$schema_create = 'DROP TABLE IF EXISTS ' . $table . ';' . $crlf;
$schema_create .="# --------------------------------------------------------".$crlf;
$this->Conn->Query("SET SQL_QUOTE_SHOW_CREATE = 0");
$tmpres = $this->Conn->Query("SHOW CREATE TABLE $table");
// echo "<pre>"; print_r($tmpres); echo "</pre>";
// exit;
if(is_array($tmpres) && isset($tmpres[0]))
{
$tmpres = $tmpres[0];
$pos = strpos($tmpres["Create Table"], ' (');
$pos2 = strpos($tmpres["Create Table"], '(');
if ($pos2 != $pos + 1)
{
$pos = $pos2;
$tmpres["Create Table"] = str_replace(",", ",\n ", $tmpres["Create Table"]);
}
$tmpres["Create Table"] = substr($tmpres["Create Table"], 0, 13)
. (($use_backquotes) ? $tmpres["Table"] : $tmpres["Table"])
. substr($tmpres["Create Table"], $pos);
$tmpres["Create Table"] = str_replace("\n", $crlf, $tmpres["Create Table"]);
if (preg_match_all('((,\r?\n[\s]*(CONSTRAINT|FOREIGN[\s]*KEY)[^\r\n,]+)+)', $tmpres["Create Table"], $regs)) {
if (!isset($sql_constraints)) {
if (isset($GLOBALS['no_constraints_comments'])) {
$sql_constraints = '';
} else {
$sql_constraints = $crlf . '#' . $crlf
. '# ' . $GLOBALS['strConstraintsForDumped'] . $crlf
. '#' . $crlf;
}
}
if (!isset($GLOBALS['no_constraints_comments'])) {
$sql_constraints .= $crlf .'#' . $crlf .'# ' . $GLOBALS['strConstraintsForTable'] . ' ' . $table . $crlf . '#' . $crlf;
}
$sql_constraints .= 'ALTER TABLE $table $crlf '
. preg_replace('/(,\r?\n|^)([\s]*)(CONSTRAINT|FOREIGN[\s]*KEY)/', '\1\2ADD \3', substr($regs[0][0], 2))
. ";\n";
$tmpres["Create Table"] = preg_replace('((,\r?\n[\s]*(CONSTRAINT|FOREIGN[\s]*KEY)[^\r\n,]+)+)', '', $tmpres["Create Table"]);
}
$schema_create .= $tmpres["Create Table"];
}
if(strlen($schema_create))
{
$schema_create = str_replace("DROP TABLE IF EXISTS ".TABLE_PREFIX,"DROP TABLE ",$schema_create);
$schema_create = str_replace("CREATE TABLE ".TABLE_PREFIX,"CREATE TABLE ",$schema_create);
while(strlen($schema_create && substr($schema_create,-1)!=")"))
{
$schema_create = substr($schema_create,0,-1);
}
}
$schema_create .= "\n# --------------------------------------------------------\n";
return $schema_create;
}
/**
* Deletes one backup file
*
* @param kEvent $event
*/
function OnDeleteBackup(&$event)
{
@unlink($this->get_backup_file());
}
function get_backup_file()
{
return $this->Application->ConfigValue('Backup_Path').'/dump'.$this->Application->GetVar('backupdate').'.txt';
}
/**
* Starts restore process
*
* @param kEvent $event
*/
function OnRestore(&$event)
{
$file = $this->get_backup_file();
$restoreProgress = Array (
'file_pos' => 0,
'file_name' => $file,
'file_size' => filesize($file),
);
$this->Application->RemoveVar('adm.restore_success');
$this->Application->StoreVar('adm.restore_status', serialize($restoreProgress));
$event->redirect = 'tools/restore3';
}
function OnRestoreProgress(&$event)
{
$done_percent = $this->performRestore();
if ($done_percent == -3) {
$event->redirect = 'tools/restore4';
return ;
}
if ($done_percent < 0) {
$this->Application->StoreVar('adm.restore_error', 'File read error'); $event->redirect = 'tools/restore4';
return ;
}
if ($done_percent == 100) {
$this->replaceRestoredFiles();
$this->Application->StoreVar('adm.restore_success', 1);
$event->redirect = 'tools/restore4';
return ;
}
echo $done_percent;
$event->status = erSTOP;
}
function replaceRestoredFiles()
{
// gather restored table names
$tables = $this->Conn->GetCol('SHOW TABLES');
$mask_restore_table = '/^restore'.TABLE_PREFIX.'(.*)$/';
foreach($tables as $table)
{
if( preg_match($mask_restore_table,$table,$rets) )
{
$old_table = substr($table, 7);
$this->Conn->Query('DROP TABLE IF EXISTS '.$old_table);
$this->Conn->Query('CREATE TABLE '.$old_table.' LIKE '.$table);
$this->Conn->Query('INSERT INTO '.$old_table.' SELECT * FROM '.$table);
$this->Conn->Query('DROP TABLE '.$table);
}
}
}
function performRestore()
{
$restoreProgress = unserialize($this->Application->RecallVar('adm.restore_status'));
$filename = $restoreProgress['file_name'];
$FileOffset = $restoreProgress['file_pos'];
$MaxLines = 200;
$size = filesize($filename);
if($FileOffset > $size) {
return -2;
}
$fp = fopen($filename,"r");
if(!$fp) {
return -1;
}
if($FileOffset>0)
{
fseek($fp,$FileOffset);
}
else
{
$EndOfSQL = FALSE;
$sql = "";
while(!feof($fp) && !$EndOfSQL)
{
$l = fgets($fp);
if(substr($l,0,11)=="INSERT INTO")
{
$EndOfSQL = TRUE;
}
else
{
$sql .= $l;
$FileOffset = ftell($fp) - strlen($l);
}
}
if(strlen($sql))
{
$error = $this->runSchemaText($sql);
if ($error != '') {
$this->Application->StoreVar('adm.restore_error', $error);
return -3;
}
}
fseek($fp,$FileOffset);
}
$LinesRead = 0;
$sql = "";
$AllSql = array();
while($LinesRead < $MaxLines && !feof($fp))
{
$sql = fgets($fp);
if(strlen($sql))
{
$AllSql[] = $sql;
$LinesRead++;
}
}
if(!feof($fp))
{
$FileOffset = ftell($fp);
}
else
{
$FileOffset = $size;
}
fclose($fp);
if(count($AllSql)>0) {
$error = $this->runSQLText($AllSql);
if ($error != '') {
$this->Application->StoreVar('adm.restore_error', $error);
return -3;
}
}
$restoreProgress['file_pos'] = $FileOffset;
$this->Application->StoreVar('adm.restore_status', serialize($restoreProgress));
return round($FileOffset/$size * 100);
// $this->Application->StoreVar('adm.restore_error', 'lalalal');
// $event->redirect = 'tools/restore4';
}
function runSchemaText($sql)
{
$table_prefix = 'restore'.TABLE_PREFIX;
// $table_prefix = TABLE_PREFIX;
if (strlen($table_prefix) > 0) {
$replacements = Array ('INSERT INTO ', 'UPDATE ', 'ALTER TABLE ', 'DELETE FROM ', 'REPLACE INTO ');
foreach ($replacements as $replacement) {
$sql = str_replace($replacement, $replacement . $table_prefix, $sql);
}
}
$sql = str_replace('CREATE TABLE ', 'CREATE TABLE IF NOT EXISTS ' . $table_prefix, $sql);
$sql = str_replace('DROP TABLE ', 'DROP TABLE IF EXISTS ' . $table_prefix, $sql);
$commands = explode("# --------------------------------------------------------",$sql);
if(count($commands)>0)
{
// $query_func = getConnectionInterface('query',$dbo_type);
// $errorno_func = getConnectionInterface('errorno',$dbo_type);
// $errormsg_func = getConnectionInterface('errormsg',$dbo_type);
for($i = 0; $i < count($commands); $i++)
{
$cmd = $commands[$i];
$cmd = trim($cmd);
if(strlen($cmd)>0)
{
$this->Conn->Query($cmd);
if($this->Conn->errorCode != 0)
{
return $this->Conn->errorMessage." COMMAND:<PRE>$cmd</PRE>";
}
}
}
}
}
function runSQLText($allsql)
{
$line = 0;
// $query_func = getConnectionInterface('query',$dbo_type);
// $errorno_func = getConnectionInterface('errorno',$dbo_type);
// $errormsg_func = getConnectionInterface('errormsg',$dbo_type);
while($line<count($allsql))
{
$sql = $allsql[$line];
if(strlen(trim($sql))>0 && substr($sql,0,1)!="#")
{
$table_prefix = 'restore'.TABLE_PREFIX;
if (strlen($table_prefix) > 0) {
$replacements = Array ('INSERT INTO ', 'UPDATE ', 'ALTER TABLE ', 'DELETE FROM ', 'REPLACE INTO ');
foreach ($replacements as $replacement) {
$sql = str_replace($replacement, $replacement . $table_prefix, $sql);
}
}
$sql = str_replace('CREATE TABLE ', 'CREATE TABLE IF NOT EXISTS ' . $table_prefix, $sql);
$sql = str_replace('DROP TABLE ', 'DROP TABLE IF EXISTS ' . $table_prefix, $sql);
$sql = trim($sql);
if(strlen($sql)>0)
{
$this->Conn->Query($sql);
if($this->Conn->errorCode != 0)
{
return $this->Conn->errorMessage." COMMAND:<PRE>$sql</PRE>";
}
}
}
$line++;
}
}
/**
* Starts restore process
*
* @param kEvent $event
*/
function OnSqlQuery(&$event)
{
$sql = $this->Application->GetVar('sql');
if ($sql) {
$start = $this->getMoment();
$result = $this->Conn->Query($sql);
$this->Application->SetVar('sql_time', round($this->getMoment() - $start, 7));
if ($result)
{
if (is_array($result))
{
$this->Application->SetVar('sql_has_rows', 1);
$this->Application->SetVar('sql_rows', serialize($result));
}
}
$check_sql = trim(strtolower($sql));
if (
(substr($check_sql, 0, 6) == 'insert')
|| (substr($check_sql, 0, 6) == 'update')
|| (substr($check_sql, 0, 7) == 'replace')
|| (substr($check_sql, 0, 6) == 'delete')
) {
$this->Application->SetVar('sql_has_affected', 1);
$this->Application->SetVar('sql_affected', $this->Conn->getAffectedRows());
}
}
$this->Application->SetVar('query_status', 1);
$event->status = erFAIL;
}
function getMoment()
{
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
/**
* Occurs after unit config cache was successfully rebuilt
*
* @param kEvent $event
*/
function OnAfterCacheRebuild(&$event)
{
}
/**
* Removes "Community -> Groups" section when it is not allowed
*
* @param kEvent $event
*/
function OnAfterConfigRead(&$event)
{
parent::OnAfterConfigRead($event);
if (!$this->Application->ConfigValue('AdvancedUserManagement')) {
$section_ajustments = $this->Application->getUnitOption($event->Prefix, 'SectionAdjustments');
if (!$section_ajustments) {
$section_ajustments = Array ();
}
$section_ajustments['in-portal:user_groups'] = 'remove';
$this->Application->setUnitOption($event->Prefix, 'SectionAdjustments', $section_ajustments);
}
}
/**
* Saves menu (tree) frame width
*
* @param kEvent $event
*/
function OnSaveMenuFrameWidth(&$event)
{
$event->status = erSTOP;
if (!$this->Application->ConfigValue('ResizableFrames')) {
return ;
}
$sql = 'UPDATE ' . $this->Application->getUnitOption('conf', 'TableName') . '
SET VariableValue = ' . (int)$this->Application->GetVar('width') . '
WHERE VariableName = "MenuFrameWidth"';
$this->Conn->Query($sql);
if ($this->Conn->getAffectedRows()) {
$this->Application->UnitConfigReader->ResetParsedData(false);
}
}
/**
* Retrieves data from memory cache
*
* @param kEvent $event
*/
function OnMemoryCacheGet(&$event)
{
$event->status = erSTOP;
$ret = Array ('message' => '', 'code' => 0); // 0 - ok, > 0 - error
$key = $this->Application->GetVar('key');
if (!$key) {
$ret['code'] = 1;
$ret['message'] = 'Key name missing';
}
else {
$value = $this->Application->getCache($key);
$ret['value'] =& $value;
$ret['size'] = is_string($value) ? formatSize( strlen($value) ) : '?';
$ret['type'] = gettype($value);
if (IsSerialized($value)) {
$value = unserialize($value);
}
if (is_array($value)) {
$ret['value'] = print_r($value, true);
}
if ($ret['value'] === false) {
$ret['code'] = 2;
$ret['message'] = 'Key "' . $key . '" doesn\'t exist';
}
}
$json_helper =& $this->Application->recallObject('JSONHelper');
/* @var $json_helper JSONHelper */
echo $json_helper->encode($ret);
}
/**
* Retrieves data from memory cache
*
* @param kEvent $event
*/
function OnMemoryCacheSet(&$event)
{
$event->status = erSTOP;
$ret = Array ('message' => '', 'code' => 0); // 0 - ok, > 0 - error
$key = $this->Application->GetVar('key');
if (!$key) {
$ret['code'] = 1;
$ret['message'] = 'Key name missing';
}
else {
$value = $this->Application->GetVar('value');
$res = $this->Application->setCache($key, $value);
$ret['result'] = $res ? 'OK' : 'FAILED';
}
$json_helper =& $this->Application->recallObject('JSONHelper');
/* @var $json_helper JSONHelper */
echo $json_helper->encode($ret);
}
}
class UnitConfigDecorator {
var $parentPath = Array ();
function decorate($var, $level = 0)
{
$ret = '';
$deep_level = count($this->parentPath);
if ($deep_level && ($this->parentPath[0] == 'Fields')) {
$expand = $level < 2;
}
elseif ($deep_level && ($this->parentPath[0] == 'Grids')) {
if ($deep_level == 3 && $this->parentPath[2] == 'Icons') {
$expand = false;
}
else {
$expand = $level < 4;
}
}
else {
$expand = $level == 0;
}
if (is_array($var)) {
$ret .= 'Array (';
$prepend = $expand ? "\n" . str_repeat("\t", $level + 1) : '';
foreach ($var as $key => $value) {
array_push($this->parentPath, $key);
$ret .= $prepend . (is_string($key) ? "'" . $key . "'" : $key) . ' => ' . $this->decorate($value, $level + 1) . ', ';
array_pop($this->parentPath);
}
$prepend = $expand ? "\n" . str_repeat("\t", $level) : '';
$ret = rtrim($ret, ', ') . $prepend . ')';
}
else {
if (is_null($var)) {
$ret = 'NULL';
}
elseif (is_string($var)) {
$ret = "'" . $var . "'";
}
else {
$ret = $var;
}
}
return $ret;
}
}
\ No newline at end of file
Index: branches/5.1.x/core/admin_templates/skins/skin_edit.tpl
===================================================================
--- branches/5.1.x/core/admin_templates/skins/skin_edit.tpl (revision 13663)
+++ branches/5.1.x/core/admin_templates/skins/skin_edit.tpl (revision 13664)
@@ -1,293 +1,293 @@
<inp2:adm_SetPopupSize width="750" height="570"/>
<inp2:m_include t="incs/header"/>
<inp2:m_RenderElement name="combined_header" section="in-portal:skins" prefix="skin" title_preset="skin_edit"/>
<!-- ToolBar -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<script type="text/javascript">
a_toolbar = new ToolBar();
a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
submit_event('skin','<inp2:skin_SaveEvent/>');
}
));
a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
cancel_edit('skin','OnCancelEdit','<inp2:skin_SaveEvent/>','<inp2:m_Phrase label="la_FormCancelConfirmation" escape="1"/>');
}
));
a_toolbar.AddButton( new ToolBarButton('reset_edit', '<inp2:m_phrase label="la_ToolTip_Reset" escape="1"/>', function() {
reset_form('skin', 'OnReset', '<inp2:m_Phrase label="la_FormResetConfirmation" escape="1"/>');
}
));
a_toolbar.AddButton( new ToolBarSeparator('sep1') );
a_toolbar.AddButton( new ToolBarButton('prev', '<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>', function() {
go_to_id('skin', '<inp2:skin_PrevId/>');
}
));
a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
go_to_id('skin', '<inp2:skin_NextId/>');
}
));
a_toolbar.Render();
<inp2:m_if check="skin_IsSingle" >
a_toolbar.HideButton('prev');
a_toolbar.HideButton('next');
a_toolbar.HideButton('sep1');
<inp2:m_else/>
<inp2:m_if check="skin_IsLast" >
a_toolbar.DisableButton('next');
</inp2:m_if>
<inp2:m_if check="skin_IsFirst" >
a_toolbar.DisableButton('prev');
</inp2:m_if>
</inp2:m_if>
</script>
<script src="js/swfobject.js" type="text/javascript"></script>
- <script type="text/javascript" src="js/uploader.js"></script>
+ <script type="text/javascript" src="<inp2:m_Compress files='js/uploader/upload_manager.js|js/uploader/uploader.js'/>"></script>
</td>
</tr>
</tbody>
</table>
<inp2:m_DefineElement name="replacement_item" subfield="" class="" is_last="" maxlength="" onblur="" size="" onkeyup="" style="width: 100%">
<inp2:m_if check="{$prefix}_FieldVisible" field="$field">
<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" subfield="$subfield" title="$Description" is_last="$is_last"/>
<td class="control-cell">
<input style="<inp2:m_Param name='style'/>" type="text"
name="<inp2:{$prefix}_InputName field='$field' subfield='$subfield'/>[<inp2:m_Param name='key'/>][Value]" id="<inp2:{$prefix}_InputName field='$field' subfield='$subfield'/>[<inp2:m_Param name='key'/>]" value="<inp2:m_Param name='Value'/>">
</td>
</tr>
</inp2:m_if>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_serialized" subfield="" class="" is_last="" maxlength="" onblur="" size="" onkeyup="" style="width: 100%">
<inp2:PrintSerializedFields pass_params="1" field="$field" render_as="$item_render_as"/>
</inp2:m_DefineElement>
<inp2:skin_SaveWarning name="grid_save_warning"/>
<inp2:skin_ErrorWarning name="form_error_warning"/>
<div id="scroll_container">
<table class="edit-form">
<inp2:m_RenderElement name="inp_id_label" prefix="skin" field="SkinId" title="!la_fld_Id!"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="skin" field="Name" title="!la_fld_SkinName!" style="width: 100px"/>
<inp2:m_RenderElement name="inp_edit_swf_upload" prefix="skin" field="Logo" title="!la_fld_Logo!"/>
<inp2:m_RenderElement name="inp_edit_swf_upload" prefix="skin" field="LogoBottom" title="la_fld_LogoBottom"/>
<inp2:m_RenderElement name="inp_edit_swf_upload" prefix="skin" field="LogoLogin" title="la_fld_LogoLogin"/>
<style type="text/css">
.skin-table td {width: 90px};
</style>
<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="skin" field="Options" title="la_HeadFrame"/>
<td class="control-cell">
<table class="skin-table">
<tr>
<td>Font Color (HeadColor)</td>
<td>Background (HeadBgColor)</td>
<td>Bar Text Color (HeadBarColor)</td>
<td>Bar Background (HeadBarBgColor)</td>
</tr>
<tr>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[HeadColor][Value]"
value="<inp2:skin_Field name="Options" format="HeadColor.Value"/>">
</td>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[HeadBgColor][Value]"
value="<inp2:skin_Field name="Options" format="HeadBgColor.Value"/>">
</td>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[HeadBarColor][Value]"
value="<inp2:skin_Field name="Options" format="HeadBarColor.Value"/>">
</td>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[HeadBarBgColor][Value]"
value="<inp2:skin_Field name="Options" format="HeadBarBgColor.Value"/>">
</td>
</tr>
</table>
</td>
</tr>
<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="skin" field="Options" title="la_GeneralSections"/>
<td class="control-cell">
<table class="skin-table">
<tr>
<td>Section Title Color (SectionColor)</td>
<td>Section Background (SectionBgColor)</td>
<td>Titlebar Font Color (TitleBarColor)</td>
<td>Titlebar Background (TitleBarBgColor)</td>
</tr>
<tr>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[SectionColor][Value]"
value="<inp2:skin_Field name="Options" format="SectionColor.Value"/>">
</td>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[SectionBgColor][Value]"
value="<inp2:skin_Field name="Options" format="SectionBgColor.Value"/>">
</td>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[TitleBarColor][Value]"
value="<inp2:skin_Field name="Options" format="TitleBarColor.Value"/>">
</td>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[TitleBarBgColor][Value]"
value="<inp2:skin_Field name="Options" format="TitleBarBgColor.Value"/>">
</td>
</tr>
</table>
</td>
</tr>
<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="skin" field="Options" title="la_DataGrid1"/>
<td class="control-cell">
<table class="skin-table">
<tr>
<td>Toolbar Backgroun (ToolbarBgColor)</td>
<td>Filter Row Background (FiltersBgColor)</td>
<td>Column Titles Color (ColumnTitlesColor)</td>
<td>Column Titles Background (ColumnTitlesBgColor)</td>
</tr>
<tr>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[ToolbarBgColor][Value]"
value="<inp2:skin_Field name="Options" format="ToolbarBgColor.Value"/>">
</td>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[FiltersBgColor][Value]"
value="<inp2:skin_Field name="Options" format="FiltersBgColor.Value"/>">
</td>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[ColumnTitlesColor][Value]"
value="<inp2:skin_Field name="Options" format="ColumnTitlesColor.Value"/>">
</td>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[ColumnTitlesBgColor][Value]"
value="<inp2:skin_Field name="Options" format="ColumnTitlesBgColor.Value"/>">
</td>
</tr>
</table>
</td>
</tr>
<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="skin" field="Options" title="la_DataGrid2"/>
<td class="control-cell">
<table class="skin-table">
<tr>
<td>Grid Odd Row Color (OddColor)</td>
<td>Grid Odd Row Background Color (OddBgColor)</td>
<td>Grid Even Row Color (EvenColor)</td>
<td>Grid Even Row Background Color (EvenBgColor)</td>
</tr>
<tr>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[OddColor][Value]"
value="<inp2:skin_Field name="Options" format="OddColor.Value"/>">
</td>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[OddBgColor][Value]"
value="<inp2:skin_Field name="Options" format="OddBgColor.Value"/>">
</td>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[EvenColor][Value]"
value="<inp2:skin_Field name="Options" format="EvenColor.Value"/>">
</td>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[EvenBgColor][Value]"
value="<inp2:skin_Field name="Options" format="EvenBgColor.Value"/>">
</td>
</tr>
</table>
</td>
</tr>
<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="skin" field="Options" title="la_Trees"/>
<td class="control-cell">
<table class="skin-table">
<tr>
<td>Tree Item Color (TreeColor)</td>
<td>Tree Item Hover Color (TreeHoverColor)</td>
<td>Tree Highlighted Item Color (TreeHighColor)</td>
<td>Tree Highlighted Item Hover Color (TreeHighHoverColor)</td>
<td>Tree Highlighted Item Background Color (TreeHighBgColor)</td>
<td>Tree Background Color (TreeBgColor)</td>
</tr>
<tr>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[TreeColor][Value]"
value="<inp2:skin_Field name="Options" format="TreeColor.Value"/>">
</td>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[TreeHoverColor][Value]"
value="<inp2:skin_Field name="Options" format="TreeHoverColor.Value"/>">
</td>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[TreeHighColor][Value]"
value="<inp2:skin_Field name="Options" format="TreeHighColor.Value"/>">
</td>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[TreeHighHoverColor][Value]"
value="<inp2:skin_Field name="Options" format="TreeHighHoverColor.Value"/>">
</td>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[TreeHighBgColor][Value]"
value="<inp2:skin_Field name="Options" format="TreeHighBgColor.Value"/>">
</td>
<td>
<input style="width: 80px" type="text"
name="<inp2:skin_InputName field="Options"/>[TreeBgColor][Value]"
value="<inp2:skin_Field name="Options" format="TreeBgColor.Value"/>">
</td>
</tr>
</table>
</td>
</tr>
<!-- <inp2:m_RenderElement name="inp_edit_serialized" prefix="skin" field="Options" title="!la_fld_Options!" style="width: 100px" item_render_as="replacement_item"/>-->
<inp2:m_RenderElement name="inp_edit_textarea" prefix="skin" field="CSS" title="!la_fld_CSS!" control_options="{min_height: 300}"/>
</table>
</div>
<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Index: branches/5.1.x/core/admin_templates/mailing_lists/mailing_list_edit.tpl
===================================================================
--- branches/5.1.x/core/admin_templates/mailing_lists/mailing_list_edit.tpl (revision 13663)
+++ branches/5.1.x/core/admin_templates/mailing_lists/mailing_list_edit.tpl (revision 13664)
@@ -1,143 +1,143 @@
<inp2:adm_SetPopupSize width="865" height="640"/>
<inp2:m_include t="incs/header"/>
<inp2:m_RenderElement name="combined_header" section="in-portal:mailing_lists" prefix="mailing-list" title_preset="mailing_list_edit"/>
<!-- ToolBar -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<script type="text/javascript">
a_toolbar = new ToolBar();
<inp2:m_if check="mailing-list_IsNewItem">
a_toolbar.AddButton(
new ToolBarButton(
'select',
'<inp2:m_phrase label="la_ToolTip_Send" escape="1"/>',
function() {
submit_event('mailing-list', '<inp2:mailing-list_SaveEvent/>');
}
)
);
</inp2:m_if>
a_toolbar.AddButton(
new ToolBarButton(
'cancel',
'<inp2:m_phrase label="la_ToolTip_Close" escape="1"/>',
function() {
submit_event('mailing-list', 'OnGoBack');
}
)
);
a_toolbar.AddButton( new ToolBarSeparator('sep1') );
a_toolbar.AddButton(
new ToolBarButton(
'prev',
'<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>',
function() {
go_to_id('mailing-list', '<inp2:mailing-list_PrevId/>');
}
)
);
a_toolbar.AddButton(
new ToolBarButton(
'next',
'<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>',
function() {
go_to_id('mailing-list', '<inp2:mailing-list_NextId/>');
}
)
);
a_toolbar.Render();
<inp2:m_if check="mailing-list_IsSingle">
a_toolbar.HideButton('prev');
a_toolbar.HideButton('next');
a_toolbar.HideButton('sep1');
<inp2:m_else/>
<inp2:m_if check="mailing-list_IsLast">
a_toolbar.DisableButton('next');
</inp2:m_if>
<inp2:m_if check="mailing-list_IsFirst">
a_toolbar.DisableButton('prev');
</inp2:m_if>
</inp2:m_if>
</script>
<script type="text/javascript" src="js/swfobject.js"></script>
- <script type="text/javascript" src="js/uploader.js"></script>
+ <script type="text/javascript" src="<inp2:m_Compress files='js/uploader/upload_manager.js|js/uploader/uploader.js'/>"></script>
</td>
</tr>
</tbody>
</table>
<inp2:mailing-list_SaveWarning name="grid_save_warning"/>
<inp2:mailing-list_ErrorWarning name="form_error_warning"/>
<inp2:m_DefineElement name="recipient_element">
<<inp2:m_Param name="recipient_name"/>>
<inp2:m_if check="m_Param" name="not_last">; </inp2:m_if>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_recipient_box" class="" format="" is_last="" maxlength="" onblur="" onchange="" size="" onkeyup="" hint_label="" style="width: 100%">
<inp2:m_if check="{$prefix}_FieldVisible" field="$field">
<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" hint_label="$hint_label" is_last="$is_last"/>
<td class="control-cell">
<inp2:m_if check="{$prefix}_IsManualRecipient">
<input style="<inp2:m_Param name="style"/>" type="text" name="<inp2:{$prefix}_InputName field="$field"/>" id="<inp2:{$prefix}_InputName field="$field"/>" value="<inp2:{$prefix}_Field field="$field" format="$format"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" maxlength="<inp2:m_param name="maxlength"/>">
<inp2:m_else/>
<inp2:$prefix_PrintRecipients render_as="recipient_element" strip_nl="2"/>
<inp2:m_RenderElement name="inp_edit_hidden" prefix="$prefix" field="$field"/>
</inp2:m_if>
</td>
<inp2:m_RenderElement name="inp_edit_error" pass_params="1"/>
</tr>
</inp2:m_if>
</inp2:m_DefineElement>
<div id="scroll_container">
<table class="edit-form">
<inp2:m_RenderElement name="subsection" title="la_section_General"/>
<inp2:m_RenderElement name="inp_id_label" prefix="mailing-list" field="MailingId" title="la_fld_Id"/>
<inp2:m_RenderElement name="inp_recipient_box" prefix="mailing-list" field="To" title="la_fld_To" size="60"/>
<inp2:m_if check="mailing-list_IsNewItem">
<inp2:m_RenderElement name="inp_edit_box" prefix="mailing-list" field="Subject" title="la_fld_Subject" size="60"/>
<inp2:m_RenderElement name="inp_edit_swf_upload" prefix="mailing-list" field="Attachments" title="la_fld_Attachment"/>
<inp2:m_RenderElement name="inp_label" prefix="mailing-list" field="Status" title="la_fld_Status"/>
<inp2:m_else/>
<inp2:m_RenderElement name="inp_label" prefix="mailing-list" field="Subject" title="la_fld_Subject"/>
<inp2:m_RenderElement name="inp_label" prefix="mailing-list" field="Attachments" title="la_fld_Attachment"/>
<inp2:m_RenderElement name="inp_label" prefix="mailing-list" field="Status" title="la_fld_Status"/>
<inp2:m_RenderElement name="inp_label" prefix="mailing-list" field="EmailsQueued" title="la_fld_EmailsQueued"/>
<inp2:m_RenderElement name="inp_label" prefix="mailing-list" field="EmailsSent" title="la_fld_EmailsSent"/>
<inp2:m_RenderElement name="inp_label" prefix="mailing-list" field="EmailsTotal" title="la_fld_EmailsTotal"/>
</inp2:m_if>
<inp2:m_RenderElement name="subsection" title="la_section_Message"/>
<inp2:m_if check="mailing-list_IsNewItem">
<inp2:m_RenderElement name="inp_edit_textarea" prefix="mailing-list" field="MessageHtml" title="la_fld_HtmlVersion" control_options="{min_height: 140}" rows="10" cols="75"/>
<inp2:m_RenderElement name="inp_edit_textarea" prefix="mailing-list" field="MessageText" allow_html="0" title="la_fld_TextVersion" control_options="{min_height: 140}" rows="10" cols="75"/>
<inp2:m_else/>
<inp2:m_RenderElement name="inp_label" prefix="mailing-list" field="MessageHtml" title="la_fld_HtmlVersion"/>
<inp2:m_RenderElement name="inp_label" prefix="mailing-list" field="MessageText" title="la_fld_TextVersion" nl2br="1"/>
</inp2:m_if>
<inp2:m_RenderElement name="inp_edit_filler"/>
</table>
<input type="hidden" name="mailing_recipient_type" value="<inp2:m_Get name='mailing_recipient_type'/>"/>
</div>
<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Index: branches/5.1.x/core/admin_templates/js/uploader.js
===================================================================
--- branches/5.1.x/core/admin_templates/js/uploader.js (revision 13663)
+++ branches/5.1.x/core/admin_templates/js/uploader.js (nonexistent)
@@ -1,6 +0,0 @@
-var $uploader_scripts = [
- '<script type="text/javascript" src="js/uploader/upload_manager.js"></script>',
- '<script type="text/javascript" src="js/uploader/uploader.js"></script>'
-];
-
-document.write($uploader_scripts.join(''));
\ No newline at end of file
Property changes on: branches/5.1.x/core/admin_templates/js/uploader.js
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.3.4.3
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: branches/5.1.x/core/admin_templates/import/import_start.tpl
===================================================================
--- branches/5.1.x/core/admin_templates/import/import_start.tpl (revision 13663)
+++ branches/5.1.x/core/admin_templates/import/import_start.tpl (revision 13664)
@@ -1,53 +1,53 @@
<inp2:adm_SetPopupSize width="500" height="270"/>
<inp2:m_include t="incs/header"/>
<inp2:m_set adm_id="0" />
<inp2:m_Get var="PrefixSpecial" result_to_var="importprefix" />
<inp2:{$importprefix}_PermSection section="main" result_to_var="permsection" />
<inp2:m_RenderElement name="combined_header" section="$permsection" prefix="adm" title_preset="csv_import"/>
<!-- ToolBar -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<script type="text/javascript">
a_toolbar = new ToolBar();
a_toolbar.AddButton( new ToolBarButton('import', '<inp2:m_phrase label="la_ToolTip_Import" escape="1"/>', function() {
submit_event('adm','OnCSVImportBegin');
}
) );
a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
window_close();
}
) );
a_toolbar.Render();
</script>
<script src="js/swfobject.js" type="text/javascript"></script>
- <script type="text/javascript" src="js/uploader.js"></script>
+ <script type="text/javascript" src="<inp2:m_Compress files='js/uploader/upload_manager.js|js/uploader/uploader.js'/>"></script>
</td>
</tr>
</tbody>
</table>
<inp2:adm_SaveWarning name="grid_save_warning"/>
<inp2:adm_ErrorWarning name="form_error_warning"/>
<div id="scroll_container">
<table class="edit-form">
<inp2:m_RenderElement name="subsection" title="!la_section_General!"/>
<inp2:m_RenderElement name="inp_edit_swf_upload" prefix="adm" field="ImportFile" title="!la_fld_ImportFile!"/>
<inp2:m_RenderElement name="inp_edit_filler"/>
<!--<inp2:m_RenderElement name="inp_edit_checkbox" prefix="phrases.import" field="ImportOverwrite" hint_label="la_importlang_phrasewarning" title="la_prompt_overwritephrases"/>-->
</table>
</div>
<input type="hidden" name="next_template" value="import/import_progress" />
<input type="hidden" name="PrefixSpecial" value="<inp2:m_Get var="PrefixSpecial" />" />
<input type="hidden" name="grid" value="<inp2:m_Get var="grid" />" />
<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Index: branches/5.1.x/core/admin_templates/submissions/submission_log_edit.tpl
===================================================================
--- branches/5.1.x/core/admin_templates/submissions/submission_log_edit.tpl (revision 13663)
+++ branches/5.1.x/core/admin_templates/submissions/submission_log_edit.tpl (revision 13664)
@@ -1,145 +1,145 @@
<inp2:adm_SetPopupSize width="820" height="570"/>
<inp2:m_include t="incs/header"/>
<inp2:m_Get var="form_id" result_to_var="form_id"/>
<inp2:m_RenderElement name="combined_header" prefix="formsubs" section="in-portal:submissions:$form_id" title_preset="submission_log_edit"/>
<!-- ToolBar --->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td>
<script type="text/javascript">
a_toolbar = new ToolBar();
<inp2:m_if check="submission-log_IsNewItem">
a_toolbar.AddButton(
new ToolBarButton(
'select',
'<inp2:m_phrase label="la_ToolTip_Send" escape="1"/>',
function() {
submit_event('submission-log', '<inp2:submission-log_SaveEvent/>');
}
)
);
</inp2:m_if>
a_toolbar.AddButton(
new ToolBarButton(
'cancel',
'<inp2:m_phrase label="la_ToolTip_Close" escape="1"/>',
function() {
cancel_edit('submission-log', 'OnGoBack', '<inp2:submission-log_SaveEvent/>', '<inp2:m_Phrase label="la_FormCancelConfirmation" escape="1"/>');
}
)
);
<inp2:m_if check="submission-log_IsUserReply" inverse="inverse">
a_toolbar.AddButton(
new ToolBarButton(
'resend',
'<inp2:m_phrase label="la_ToolTip_Resend" escape="1"/>',
function() {
submit_event('submission-log', 'OnResendReply');
}
)
);
</inp2:m_if>
<inp2:m_if check="submission-log_IsNewItem">
a_toolbar.AddButton(
new ToolBarButton(
'reset_to_user',
'<inp2:m_phrase label="la_ToolTip_SaveAsDraft" escape="1"/>',
function() {
submit_event('submission-log', 'OnSaveDraft');
}
)
);
</inp2:m_if>
a_toolbar.Render();
</script>
<script type="text/javascript" src="js/swfobject.js"></script>
- <script type="text/javascript" src="js/uploader.js"></script>
+ <script type="text/javascript" src="<inp2:m_Compress files='js/uploader/upload_manager.js|js/uploader/uploader.js'/>"></script>
</td>
</tr>
</table>
<inp2:m_DefineElement name="file_element">
<a href="<inp2:Field field='$field' format='full_url'/>" target="_blank"><inp2:Field field="$field"/></a><br/>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_upload_label" is_last="">
<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td class="control-cell">
<inp2:$prefix_IterateFiles render_as="file_element" field="$field"/>
</td>
<inp2:m_RenderElement name="inp_edit_error" pass_params="1"/>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_draft" is_last="">
<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="la_DraftAvailableFrom" is_last="$is_last"/>
<td class="control-cell">
<inp2:draft.related_Field name="CreatedOn"/>
[<a href="#" onclick="submit_event('<inp2:m_Param name='prefix'/>', 'OnUseDraft'); return false;"><inp2:m_Phrase name="la_btn_UseDraft"/></a>]
[<a href="#" onclick="submit_event('<inp2:m_Param name='prefix'/>', 'OnDeleteDraft'); return false;"><inp2:m_Phrase name="la_btn_DeleteDraft"/></a>]
</td>
<inp2:m_RenderElement name="inp_edit_error" pass_params="1"/>
</tr>
</inp2:m_DefineElement>
<input type="hidden" name="client_mode" value="<inp2:m_Get name='client_mode'/>"/>
<inp2:submission-log_SaveWarning name="grid_save_warning"/>
<inp2:submission-log_ErrorWarning name="form_error_warning"/>
<div id="scroll_container">
<table class="edit-form">
<inp2:m_RenderElement name="inp_edit_hidden" prefix="submission-log" field="FormSubmissionId"/>
<inp2:m_RenderElement name="inp_edit_hidden" prefix="submission-log" field="DraftId"/>
<inp2:m_RenderElement name="inp_id_label" prefix="submission-log" field="SubmissionLogId" title="la_fld_Id"/>
<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="FromEmail" title="la_fld_FromEmail"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="submission-log" field="ToEmail" size="60" title="la_fld_ToEmail"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="submission-log" field="Cc" size="60" title="la_fld_Cc"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="submission-log" field="Bcc" size="60" title="la_fld_Bcc"/>
<inp2:m_if check="submission-log_IsNewItem">
<inp2:m_RenderElement name="inp_edit_box" prefix="submission-log" field="Subject" size="80" title="la_fld_Subject"/>
<inp2:m_if check="submission-log_HasDraft">
<inp2:m_RenderElement name="inp_edit_draft" prefix="submission-log" field="DraftId"/>
</inp2:m_if>
<inp2:m_RenderElement name="inp_edit_textarea" prefix="submission-log" field="Message" rows="30" cols="100" title="la_fld_Message"/>
<inp2:m_RenderElement name="inp_edit_swf_upload" prefix="submission-log" field="Attachment" title="la_fld_Attachment"/>
<inp2:m_else/>
<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="Subject" title="la_fld_Subject"/>
<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="Message" title="la_fld_Message" nl2br="1"/>
<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="ReplyStatus" title="la_fld_ReplyStatus"/>
<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="RepliedOn" title="la_fld_RepliedOn"/>
<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="SentStatus" title="la_fld_SentStatus"/>
<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="SentOn" title="la_fld_SentOn"/>
<inp2:m_RenderElement name="inp_edit_upload_label" prefix="submission-log" field="Attachment" title="la_fld_Attachment"/>
<inp2:m_if check="submission-log_Field" name="BounceInfo">
<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="BounceInfo" title="la_fld_BounceInfo" nl2br="1"/>
</inp2:m_if>
<inp2:m_if check="submission-log_Field" name="BounceDate" db="db">
<inp2:m_RenderElement name="inp_label" prefix="submission-log" field="BounceDate" title="la_fld_BounceDate"/>
</inp2:m_if>
</inp2:m_if>
<inp2:m_RenderElement name="inp_edit_hidden" prefix="submission-log" field="FromEmail"/>
<inp2:m_RenderElement name="inp_edit_hidden" prefix="submission-log" field="ReplyTo"/>
<inp2:m_RenderElement name="inp_edit_filler" />
</table>
</div>
<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Event Timeline
Log In to Comment