From 9d1c3e4b4575e00acc23c940d9f64c4051153859 Mon Sep 17 00:00:00 2001 From: dshovchko Date: Thu, 29 Dec 2016 17:11:44 +0200 Subject: [PATCH 01/29] fix mistake with Undefined variable --- textpattern/vendors/Netcarver/MLP/Kickstart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textpattern/vendors/Netcarver/MLP/Kickstart.php b/textpattern/vendors/Netcarver/MLP/Kickstart.php index 0e26d2a..14e8f9e 100644 --- a/textpattern/vendors/Netcarver/MLP/Kickstart.php +++ b/textpattern/vendors/Netcarver/MLP/Kickstart.php @@ -27,7 +27,7 @@ public function l10n_upgrade() if (txpinterface === 'admin') { $this->l10n_install_version = get_pref('l10n_version', '', 1); - if (!$dbversion || ($dbversion != $thisversion) || ($l10n_release_version != $installed_l10n_version) || $txp_using_svn) { + if (!$dbversion || ($dbversion != $thisversion) || ($this->l10n_release_version != $this->l10n_install_version) || $txp_using_svn) { // Dirty: perform upgrade. // Ensure new indexes are present in case of upgrade. _l10n_check_index(); From 4b0aab46c53bd2384af0f600ec2953deed085389 Mon Sep 17 00:00:00 2001 From: dshovchko Date: Mon, 23 Jan 2017 19:00:19 +0200 Subject: [PATCH 02/29] remove creation of temporary tables and change form element --- textpattern/lib/l10n_admin.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/textpattern/lib/l10n_admin.php b/textpattern/lib/l10n_admin.php index 51180a8..d36a966 100644 --- a/textpattern/lib/l10n_admin.php +++ b/textpattern/lib/l10n_admin.php @@ -306,7 +306,7 @@ function _l10n_list_filter( $event, $step ) } } $languages = join( ',' , $selected ); - _l10n_create_temp_textpattern( $languages ); +// _l10n_create_temp_textpattern( $languages ); break; default: break; @@ -1777,7 +1777,9 @@ function _l10n_image_extend ($evt, $stp, $data, $rs) { if( $field === 'alt' ) { $r .= '

'; - $r .= '

'.n; +// $r .= '

'.n; + $r .= '

'.n; } else { From 4c018a225676c18ea4ef75a5d9cfe229b7fd9363 Mon Sep 17 00:00:00 2001 From: dshovchko Date: Mon, 23 Jan 2017 20:09:31 +0200 Subject: [PATCH 03/29] work with views while cloning and deleting rendition(s) --- textpattern/lib/l10n_admin_classes.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/textpattern/lib/l10n_admin_classes.php b/textpattern/lib/l10n_admin_classes.php index 4b435bf..419fe20 100644 --- a/textpattern/lib/l10n_admin_classes.php +++ b/textpattern/lib/l10n_admin_classes.php @@ -3616,6 +3616,7 @@ function _clone_rendition( $source , $article_id , $target_lang , $new_author='' $source['AuthorID'] = $new_author; $source[L10N_COL_LANG] = $target_lang; $source['Status'] = 1; + $source['Posted'] = 'now()'; $source['LastMod'] = 'now()'; $source['feed_time'] = 'now()'; $source['uid'] = md5(uniqid(rand(),true)); @@ -3647,10 +3648,10 @@ function _clone_rendition( $source , $article_id , $target_lang , $new_author='' # Add into the rendition table for this lang ensuring this has the ID of the # just added master entry! # - $insert[] = '`ID`='.doSlash( $rendition_id ); - $insert_sql = join( ', ' , $insert ); - $table_name = _l10n_make_textpattern_name( array( 'long'=>$target_lang ) ); - safe_insert( $table_name , $insert_sql ); +// $insert[] = '`ID`='.doSlash( $rendition_id ); +// $insert_sql = join( ', ' , $insert ); +// $table_name = _l10n_make_textpattern_name( array( 'long'=>$target_lang ) ); +// safe_insert( $table_name , $insert_sql ); return $rendition_id; } @@ -3794,12 +3795,12 @@ function delete_article() # # Delete from the rendition tables... # - foreach( $renditions as $rendition ) - { - $lang = $rendition[L10N_COL_LANG]; - $rendition_table = _l10n_make_textpattern_name( array( 'long'=>$lang ) ); - safe_delete( $rendition_table , L10N_COL_GROUP."=$article" ); - } +// foreach( $renditions as $rendition ) +// { +// $lang = $rendition[L10N_COL_LANG]; +// $rendition_table = _l10n_make_textpattern_name( array( 'long'=>$lang ) ); +// safe_delete( $rendition_table , L10N_COL_GROUP."=$article" ); +// } # # Delete from the articles table... @@ -3838,8 +3839,9 @@ function delete_rendition() # # Delete from the correct language rendition table... # - $rendition_table = _l10n_make_textpattern_name( array( 'long'=>$lang ) ); - $rendition_deleted = safe_delete( $rendition_table , "`ID`=$rendition" ); +// $rendition_table = _l10n_make_textpattern_name( array( 'long'=>$lang ) ); +// $rendition_deleted = safe_delete( $rendition_table , "`ID`=$rendition" ); + $rendition_deleted = true; # # Delete from the article table... From fee94fdab2a3389c715dd79a491ada877ef258de Mon Sep 17 00:00:00 2001 From: dshovchko Date: Tue, 24 Jan 2017 18:17:40 +0200 Subject: [PATCH 04/29] change check and generation lang views from upgrade script --- textpattern/lib/l10n_admin.php | 38 +++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/textpattern/lib/l10n_admin.php b/textpattern/lib/l10n_admin.php index d36a966..d95f08c 100644 --- a/textpattern/lib/l10n_admin.php +++ b/textpattern/lib/l10n_admin.php @@ -1200,25 +1200,39 @@ function _l10n_check_lang_table( $lang ) $code = $result; $table_name = _l10n_make_textpattern_name( $code ); - if( safe_query( "SHOW COLUMNS FROM `$table_name`" ) ) - { - return true; + $type = NULL; + if ( $r = safe_query( 'SHOW FULL TABLES') ) { + $type = 'NONE'; + if ( mysqli_num_rows( $r ) > 0 ) { + while ( $a = mysqli_fetch_row( $r ) ) { + if ( $a[0] === PFX.$table_name ) { + $type = strtoupper($a[1]); + } + } + + mysqli_free_result( $r ); } - return array($code, $table_name); + } + + return array($code, $table_name, $type); } function _l10n_generate_lang_table( $lang ) { $result = _l10n_check_lang_table( $lang ); if( !is_array($result) ) return $result; - list($code, $table_name) = $result; - $where = ' WHERE `'.L10N_COL_LANG."`='$lang'"; - - safe_query( 'LOCK TABLES `'.PFX.$table_name.'` WRITE' ); - safe_query( 'CREATE TABLE `'.PFX.$table_name.'` LIKE `'.PFX.'textpattern`' ); - safe_query( 'INSERT INTO `'.PFX.$table_name.'` SELECT * FROM `'.PFX.'textpattern`'.$where ); - safe_query( 'OPTIMIZE TABLE `'.PFX.$table_name.'`' ); - safe_query( 'UNLOCK TABLES' ); + list($code, $table_name, $type) = $result; + switch( $type ) { + case 'BASE TABLE': + safe_query( 'DROP TABLE `'.PFX.$table_name.'`' ); + + case 'NONE': + $where = ' WHERE `'.L10N_COL_LANG."`='$lang'"; + safe_query( 'CREATE VIEW `'.PFX.$table_name.'` AS SELECT * FROM `'.PFX.'textpattern`'.$where ); + + case 'VIEW': + default: + } } function _l10n_check_localise_table( $lang ) From 14b420cce56e2358836f6bd400b9b8d879ec6103 Mon Sep 17 00:00:00 2001 From: dshovchko Date: Tue, 24 Jan 2017 20:36:40 +0200 Subject: [PATCH 05/29] change add/del views on setup/cleanup MLP and on any changes made to the site languages --- textpattern/lib/l10n_admin_classes.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/textpattern/lib/l10n_admin_classes.php b/textpattern/lib/l10n_admin_classes.php index 419fe20..3ae5b8f 100644 --- a/textpattern/lib/l10n_admin_classes.php +++ b/textpattern/lib/l10n_admin_classes.php @@ -1276,7 +1276,7 @@ static function build_txp_langfile( $lang , $exclude_plugins = true , $media = ' $out[] = '#'; $out[] = '# ====================================================================='; $out[] = '# '; - $out[] = "#@version 4.5.2;".$time; + $out[] = "#@version 4.6.2;".$time; $out[] = '# '; foreach( $strings as $string ) { @@ -1523,9 +1523,8 @@ function prefs_save_cb( $event='' , $step='' ) # # Add language tables as needed and populate them as far as possible... # - $indexes = "(PRIMARY KEY (`ID`), KEY `categories_idx` (`Category1`(10),`Category2`(10)), KEY `Posted` (`Posted`), FULLTEXT KEY `searching` (`Title`,`Body`))"; - $sql = "create table `$full_name` $indexes ENGINE=MyISAM select * from `".PFX."textpattern` where ".L10N_COL_LANG."='$lang'"; - $ok = safe_query( $sql ); + $sql = "CREATE VIEW `$full_name` AS SELECT * FROM `".PFX."textpattern` WHERE ".L10N_COL_LANG."='$lang'"; + $ok = safe_query( $sql ); # # Add fields for this language... @@ -1553,7 +1552,7 @@ function prefs_save_cb( $event='' , $step='' ) # # Drop language tables that are no longer needed... # - $sql = 'drop table `'.$full_name.'`'; + $sql = 'DROP VIEW `'.$full_name.'`'; $ok = safe_query( $sql ); # @@ -5219,9 +5218,8 @@ function setup_7() # Create per-language copies of textpattern table { $code = MLPLanguageHandler::compact_code( $lang ); $table_name = _l10n_make_textpattern_name( $code ); - $indexes = "(PRIMARY KEY (`ID`), KEY `categories_idx` (`Category1`(10),`Category2`(10)), KEY `Posted` (`Posted`), FULLTEXT KEY `searching` (`Title`,`Body`))"; - $sql = "create table `".PFX."$table_name` $indexes ENGINE=MyISAM select * from `".PFX."textpattern` where `".L10N_COL_LANG."`='$lang'"; + $sql = "CREATE VIEW `".PFX."$table_name` AS SELECT * FROM `".PFX."textpattern` WHERE ".L10N_COL_LANG."='$lang'"; $ok = safe_query( $sql ); if (mysqli_error($DB->link) == "Table '".PFX."$table_name' already exists") $ok = 'skipped'; @@ -5379,7 +5377,7 @@ function cleanup_7() # Drop the per-language textpattern_XX tables... { $code = MLPLanguageHandler::compact_code( $lang ); $table_name = _l10n_make_textpattern_name( $code ); - $sql = 'drop table `'.PFX.$table_name.'`'; + $sql = 'DROP VIEW `'.PFX.$table_name.'`'; $ok = safe_query( $sql ); $this->add_report_item( gTxt('l10n-op_table',array('{op}'=>'Drop' ,'{table}'=>MLPLanguageHandler::get_native_name_of_lang( $lang ).' ['.$table_name.']')) , $ok , true ); } From 9be03f7e9ed360b26cec0142c5adcffff835e22a Mon Sep 17 00:00:00 2001 From: dshovchko Date: Wed, 25 Jan 2017 10:28:58 +0200 Subject: [PATCH 06/29] clean from commented out code --- textpattern/lib/l10n_admin_classes.php | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/textpattern/lib/l10n_admin_classes.php b/textpattern/lib/l10n_admin_classes.php index 3ae5b8f..6b55543 100644 --- a/textpattern/lib/l10n_admin_classes.php +++ b/textpattern/lib/l10n_admin_classes.php @@ -3643,15 +3643,6 @@ function _clone_rendition( $source , $article_id , $target_lang , $new_author='' # MLPArticles::add_rendition( $article_id , $rendition_id , $target_lang ); - # - # Add into the rendition table for this lang ensuring this has the ID of the - # just added master entry! - # -// $insert[] = '`ID`='.doSlash( $rendition_id ); -// $insert_sql = join( ', ' , $insert ); -// $table_name = _l10n_make_textpattern_name( array( 'long'=>$target_lang ) ); -// safe_insert( $table_name , $insert_sql ); - return $rendition_id; } @@ -3791,16 +3782,6 @@ function delete_article() # $master_deleted = safe_delete( 'textpattern' , L10N_COL_GROUP."=$article" ); - # - # Delete from the rendition tables... - # -// foreach( $renditions as $rendition ) -// { -// $lang = $rendition[L10N_COL_LANG]; -// $rendition_table = _l10n_make_textpattern_name( array( 'long'=>$lang ) ); -// safe_delete( $rendition_table , L10N_COL_GROUP."=$article" ); -// } - # # Delete from the articles table... # @@ -3838,8 +3819,7 @@ function delete_rendition() # # Delete from the correct language rendition table... # -// $rendition_table = _l10n_make_textpattern_name( array( 'long'=>$lang ) ); -// $rendition_deleted = safe_delete( $rendition_table , "`ID`=$rendition" ); + # (not required, as tables changed by views) $rendition_deleted = true; # From ff52b489f14655251df3e880f84ed935ad06ac72 Mon Sep 17 00:00:00 2001 From: dshovchko Date: Wed, 25 Jan 2017 18:00:14 +0200 Subject: [PATCH 07/29] remove all operations on rendition tables: insert/update/delete/alter --- textpattern/lib/l10n_admin.php | 179 +++------------------------------ 1 file changed, 15 insertions(+), 164 deletions(-) diff --git a/textpattern/lib/l10n_admin.php b/textpattern/lib/l10n_admin.php index d95f08c..801d4c0 100644 --- a/textpattern/lib/l10n_admin.php +++ b/textpattern/lib/l10n_admin.php @@ -234,37 +234,9 @@ function _l10n_check_index() } function _l10n_post_save( $event , $step ) { - $fields = array(); - if ($event === 'section') - { - $fields[] = 'Section'; - } - else if ($event === 'category' && strpos($step, '_save') !== false) - { - $fields = array('Category1', 'Category2'); - } - - if (empty($fields)) - { - return false; - } - - $old_name = doSlash( ps('old_name') ); - $name = doSlash( sanitizeForUrl( ps('name') ) ); - - if( $name !== $old_name ) - { - $langs = MLPLanguageHandler::get_site_langs(); - foreach( $langs as $lang ) - { - $table = _l10n_make_textpattern_name(array('long'=>$lang)); - foreach ($fields as $field) - { - $clause = $field . " = '$old_name'" ; - safe_update( $table , $field . " = '$name'", $clause ); - } - } - } + # + # Nothing to do, when tables are replaced by views + # } function _l10n_list_filter( $event, $step ) @@ -875,38 +847,15 @@ function _l10n_article_buffer_processor( $buffer ) function _l10n_replace_rendition( $lang , $replace=false , $id='' ) { - $op = 'INSERT'; - if( $replace ) - $op = 'REPLACE'; - - if( empty($id) ) - { - if(!empty($GLOBALS['ID'])) - $id = intval($GLOBALS['ID']); - else - $id = gps('ID'); - } - - if( !MLPLanguageHandler::is_valid_code($lang) ) - { - echo br , "Invalid language code '$lang' calculated in _l10n_add_rendition()"; - return; - } - $table_name = safe_pfx( _l10n_make_textpattern_name($lang) ); - $safe_txp = safe_pfx( 'textpattern' ); - - $sql = $op." INTO $table_name SELECT * FROM $safe_txp WHERE $safe_txp.ID='$id' LIMIT 1"; - safe_query( $sql ); + # + # Nothing to do, when tables are replaced by views + # } function _l10n_remove_rendition( $lang , $id ) { - if( !MLPLanguageHandler::is_valid_code($lang) ) - { - echo br , "Invalid language code '$lang' calculated in _l10n_add_rendition()"; - return; - } - $table_name = safe_pfx( _l10n_make_textpattern_name($lang) ); - safe_delete( $table_name , "`ID`='$id'" ); + # + # Nothing to do, when tables are replaced by views + # } function _l10n_add_rendition_to_article_cb( $event , $step ) { @@ -1129,28 +1078,9 @@ function _l10n_pre_multi_edit_cb( $event , $step ) function _l10n_observe_table_changes( $event , $step ) { - static $l10n_hashes = array(); - - if (isset($l10n_hashes['textpattern'])) { - $rs = $l10n_hashes['textpattern']; - } else { - $rs = safe_show('COLUMNS', 'textpattern'); - $l10n_hashes['textpattern'] = $rs; - } - - $txp_table_hash = md5(serialize($l10n_hashes['textpattern'])); - $previous_hashes = unserialize(get_pref('l10n_hashes')); - - if ($previous_hashes['textpattern'] !== $txp_table_hash) { - _l10n_sync_table_definitions( $l10n_hashes ); -// _l10n_update_dirty_flag( 'DIRTY' ); - } - - // Regenerate the hash table and stash it - $hash_table = array(); - $hash_table['textpattern'] = $txp_table_hash; - - set_pref('l10n_hashes', serialize($hash_table), 'l10n', PREF_HIDDEN); + # + # Nothing to do, when tables are replaced by views + # } function _l10n_check_lang_code( $lang ) @@ -1307,88 +1237,9 @@ function _l10n_generate_localise_table_fields( $lang ) */ function _l10n_sync_table_definitions( $source = array() ) { - if (!is_array($source)) { - return false; - } - - foreach ($source as $table => $definition) - { -//dmp($definition); - switch ($table) - { - case 'textpattern': - $langs = MLPLanguageHandler::get_site_langs(); - - foreach ($langs as $lang) - { - $sql = array(); - $safe_lang = _l10n_check_lang_code( $lang ); - if( !is_string($safe_lang) ) continue; - - $table = _l10n_make_textpattern_name(array('long' => $lang)); - $rs = safe_show('COLUMNS', $table); - - foreach ($definition as $def) - { - $field = $def['Field']; - - $type = $def['Type']; - $null = $def['Null']; - $default = $def['Default']; - $extra = $def['Extra']; - - $found = false; - foreach ($rs as $idx => $lang_field) { - if ( $lang_field['Field'] === $field) { - $found = $idx; - break; - } - } - - // ID fields can't be altered here due to auto_increment differences - // This can't be done earlier as we don't know the position in the destination table until now - if ($field === 'ID') { - unset($rs[$found]); - continue; - } - - if ($found !== false) { - // Field exists in destination table so update its definition if anything's changed - $dest_type = $rs[$found]['Type']; - $dest_null = $rs[$found]['Null']; - $dest_default = $rs[$found]['Default']; - $dest_extra = $rs[$found]['Extra']; - - if ( $type !== $dest_type - || $null !== $dest_null - || $default !== $dest_default - || $extra !== $dest_extra ) - { - $sql[] = 'MODIFY ' .$field. ' ' .$type . ($null === 'NO' ? ' NOT NULL' : ' NULL') . ($default ? ' DEFAULT "'.$default.'"' : '') . ' ' .$extra; - } - - // Removing each found item from the destination table serves two purposes: - // 1) it speeds the loop up as things move forward - // 2) it means that any fields left over by the time the loop ends are fields that need removing - unset($rs[$found]); - - } else { - // New field (or possibly a renamed field, but if that happens there are more urgent things to worry about!) - $sql[] = 'ADD ' .$field. ' ' .$type . ($null === 'NO' ? ' NOT NULL' : ' NULL') . ($default ? ' DEFAULT "'.$default.'"' : '') . ' ' .$extra; - } - } - - // Extraneous fields: remove them - foreach ($rs as $def) { - $sql[] = 'DROP ' . $def['Field']; - } - foreach ($sql as $statement) { - safe_alter($table, $statement); - } - } - break; - } - } + # + # Nothing to do, when tables are replaced by views + # } function _l10n_pre_discuss_multi_edit( $event , $step ) From 6ff7b0efd7e7287e38a8e7e25bf876bd2c647e6d Mon Sep 17 00:00:00 2001 From: dshovchko Date: Wed, 25 Jan 2017 18:11:58 +0200 Subject: [PATCH 08/29] update MLP Kickstart --- textpattern/vendors/Netcarver/MLP/Kickstart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textpattern/vendors/Netcarver/MLP/Kickstart.php b/textpattern/vendors/Netcarver/MLP/Kickstart.php index 14e8f9e..041b1f5 100644 --- a/textpattern/vendors/Netcarver/MLP/Kickstart.php +++ b/textpattern/vendors/Netcarver/MLP/Kickstart.php @@ -14,7 +14,7 @@ class Kickstart { // IMPORTANT: Bump this for each release so the dirty flag is set - protected $l10n_release_version = '4.6.0.20160216'; + protected $l10n_release_version = '4.6.2.20170125'; protected $l10n_install_version = ''; /** From 1d735a728031eb2fda19528e262214077651fec4 Mon Sep 17 00:00:00 2001 From: dshovchko Date: Thu, 23 Feb 2017 13:46:53 +0200 Subject: [PATCH 09/29] Get l10n.php from origin branch. Fix undefined array index l10n_l10n-url_default_lang_marker was undefined. --- plugins/sources/l10n.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/sources/l10n.php b/plugins/sources/l10n.php index 1d9a062..b97fb1a 100644 --- a/plugins/sources/l10n.php +++ b/plugins/sources/l10n.php @@ -542,7 +542,7 @@ function _l10n_textpattern_comment_submit() # The REQUEST_URI has to be maintained to ensure comments work and compatibility with # plugins... # - if ($prefs['l10n_l10n-url_default_lang_marker'] === '1' || isset($_SESSION['l10n_request_uri'])) + if ((isset($prefs['l10n_l10n-url_default_lang_marker']) && $prefs['l10n_l10n-url_default_lang_marker'] === '1') || isset($_SESSION['l10n_request_uri'])) { if (isset($_SESSION['l10n_request_uri'])) { $pretext['request_uri'] = $_SERVER['REQUEST_URI'] = $_SESSION['l10n_request_uri']; @@ -721,7 +721,7 @@ function _l10n_inject_lang_markers_cb( $matches ) $default_lang_long = $site_langs[0]; $default_lang_short = substr( $default_lang_long , 0 , 2 ); - if ( $prefs['l10n_l10n-url_default_lang_marker'] === '1' || ($callback_language_marker !== $default_lang_short) ) + if ( (isset($prefs['l10n_l10n-url_default_lang_marker']) && $prefs['l10n_l10n-url_default_lang_marker'] === '1') || ($callback_language_marker !== $default_lang_short) ) { $result = $l10n_replace_strings['start_rep'].$matches[1].'/'.$callback_language_marker.$extra.$matches[2].$l10n_replace_strings['stop_rep']; } From 5fc66fffd8da6119627b69e68e7d80380cd44f78 Mon Sep 17 00:00:00 2001 From: dshovchko Date: Fri, 10 Mar 2017 17:18:01 +0200 Subject: [PATCH 10/29] fix incorrect layout in MPL setup --- plugins/sources/gbp_admin_library.php | 7 +++---- textpattern/l10n.css | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/sources/gbp_admin_library.php b/plugins/sources/gbp_admin_library.php index 834e2bc..dfb9430 100644 --- a/plugins/sources/gbp_admin_library.php +++ b/plugins/sources/gbp_admin_library.php @@ -17,7 +17,7 @@ // 1 = Plugin help is in raw HTML. Not recommended. # $plugin['allow_html_help'] = 1; -$plugin['version'] = '4.6.0.20160216'; +$plugin['version'] = '4.6.2.20170310'; $plugin['author'] = 'Graeme Porteous'; $plugin['author_uri'] = ''; $plugin['description'] = 'GBP Admin-Side Library'; @@ -416,7 +416,7 @@ public function render_tabs () { } $out[] = '

'; - $out[] = '
'; + $out[] = '
'; echo join('', $out); } @@ -484,8 +484,7 @@ public function url ($vars = array(), $gp = false) { $out[] = $key.'='.urlencode($value); } - $script = hu.basename(txpath).'/index.php'; - return $script . (isset($out) + return (isset($out) ? '?'.join('&', $out) : ''); } diff --git a/textpattern/l10n.css b/textpattern/l10n.css index 2cd076a..bb861d3 100644 --- a/textpattern/l10n.css +++ b/textpattern/l10n.css @@ -39,7 +39,7 @@ l10n styles for other tabs... .l10n_values_list { float: right; width: 50%; } .l10n_string_list { float: left; width: 25%; } -.l10n_subtab { padding: 0 30px; } +.l10n_subtab { padding: 0 30px; clear:both; } .l10n_list { float: left; width: 50%; } .l10n_edit { float: right; width: 50%; } .l10n_owner_list { float: left; width: 20%; } From bb3f4c7953d685a4abed71c217f1fa699eee6a01 Mon Sep 17 00:00:00 2001 From: dshovchko Date: Tue, 14 Mar 2017 19:01:46 +0200 Subject: [PATCH 11/29] fix form editing section --- textpattern/lib/l10n_admin.php | 39 +++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/textpattern/lib/l10n_admin.php b/textpattern/lib/l10n_admin.php index 801d4c0..3fdbe62 100644 --- a/textpattern/lib/l10n_admin.php +++ b/textpattern/lib/l10n_admin.php @@ -1421,6 +1421,20 @@ function _l10n_section_paint( $page ) { $default = MLPLanguageHandler::get_site_default_lang(); + # + # Insert the default title field's language's direction... + # + $dir = MLPLanguageHandler::get_lang_direction_markup( $default ) . ' '; + $f = 'id="section_title"'; + $page = str_replace( $f , $f.$dir , $page ); + + # + # Insert the default title field's language name... + # + $f = '">'.gTxt('section_longtitle'); + $r = '['.MLPLanguageHandler::get_native_name_of_lang( $default ) . ']'; + $page = str_replace( $f , $f.n.$r , $page ); + # # Insert the remaining language title fields... # @@ -1435,7 +1449,8 @@ function _l10n_section_paint( $page ) $name = txpspecialchars($row['name']); $title = txpspecialchars($row['title']); - $f = 'id="section_title" />

'; + preg_match_all('/
([^<]*<[^>]*>){8}/', $page, $m); + $f = $m[0][0]; foreach( $fields as $field => $attributes ) { @@ -1444,34 +1459,24 @@ function _l10n_section_paint( $page ) { $full_name = MLPLanguageHandler::get_native_name_of_lang( $lang ); $dir = MLPLanguageHandler::get_lang_direction_markup( $lang ); + if( $lang !== $default ) { $field_name = _l10n_make_field_name( $field , $lang ); $field_value = $row[$field_name]; - $r .= '

'; - $r .= '

'; + $r .= '
'; + $r .= '
'; + $r .= '
'; + $r .= '
'; } } $page = str_replace( $f , $f.n.$r , $page ); } } - # - # Insert the default title field's language's direction... - # - $dir = MLPLanguageHandler::get_lang_direction_markup( $default ) . ' '; - $f = 'id="section_title"'; - $page = str_replace( $f , $f.$dir , $page ); - - # - # Insert the default title field's language name... - # - $f = '">'.gTxt('section_longtitle'); - $r = '['.MLPLanguageHandler::get_native_name_of_lang( $default ) . ']'; - $page = str_replace( $f , $f.n.$r , $page ); - return $page; } + function _l10n_section_save( $event , $step ) { $id_name = 'name'; From 4000185bfa5a5fdb3f229f6b74bc6dd15f3f8c16 Mon Sep 17 00:00:00 2001 From: dshovchko Date: Wed, 15 Mar 2017 12:47:07 +0200 Subject: [PATCH 12/29] fix form editing category --- textpattern/lib/l10n_admin.php | 60 ++++++++++++++++------------------ 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/textpattern/lib/l10n_admin.php b/textpattern/lib/l10n_admin.php index 3fdbe62..58dd330 100644 --- a/textpattern/lib/l10n_admin.php +++ b/textpattern/lib/l10n_admin.php @@ -91,7 +91,6 @@ } } - register_callback('_l10n_category_extend', 'category_ui', 'extend_detail_form'); register_callback('_l10n_image_extend', 'image_ui', 'extend_detail_form'); register_callback('_l10n_link_extend', 'link_ui', 'extend_detail_form'); @@ -1345,36 +1344,6 @@ function _l10n_build_sql_set( $table ) return join( ', ', $set ); } -function _l10n_category_extend ($evt, $stp, $data, $rs) { - $default = MLPLanguageHandler::get_site_default_lang(); - - # - # Insert the remaining language fields... - # - global $l10n_mappings; - $langs = MLPLanguageHandler::get_site_langs(); - $fields = $l10n_mappings['txp_category']; - $r = ''; - $id = $rs['id']; - - foreach( $fields as $field => $attributes ) - { - foreach( $langs as $lang ) - { - $full_name = MLPLanguageHandler::get_native_name_of_lang( $lang ); - $dir = MLPLanguageHandler::get_lang_direction_markup( $lang ); - if( $lang !== $default ) - { - $field_name = _l10n_make_field_name( $field , $lang ); - $r .= '

'; - $r .= ''; - $r .= '

'.n; - } - } - } - return $r; -} - function _l10n_category_paint( $page ) { $default = MLPLanguageHandler::get_site_default_lang(); @@ -1396,6 +1365,35 @@ function _l10n_category_paint( $page ) $f = '