diff --git a/README.md b/README.md index f8c2f50..4ebeb04 100755 --- a/README.md +++ b/README.md @@ -1,17 +1,43 @@ -## 🚧 Altsys module was merged into XCL branch module/altsys ! -https://github.com/xoopscube/xcl/tree/module/altsys +[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/2.0.0/active.svg)](https://github.com/xoopscube/xcl) +![License GPL](https://img.shields.io/badge/License-GPL-green) +![License GPL](https://img.shields.io/badge/X--Update%20Store-Pending-red) -## ⚠️ This repository is planned to be archived ! +## ///// — AltSys UI Common Library + +![alt text](https://repository-images.githubusercontent.com/8041517/16f372e9-91e2-4ff8-8d79-ccbb6b2ad0d9) + + +MODULE | ALTSYS +------------ | ------------- +Description | UI Common Library to create and manage Modules Blocks, Templates, Localization +Render Engine | Smarty v2 and XCube Layout +Version | 2.3.1 +Author | Original by GiJoe ( peak.ne.jp ) +Author | Update by Nuno Luciano (aka Gigamaster) +Copyright | 2005-2022 Authors +License | GPL + + +##### :computer: The Minimum Requirements -== ALTSYS == alternative system module & library -[b]SUMMARY:[/b] -The unified module of blocksadmin, tplsadmin, etc around the system. + Apache, Nginx, etc. PHP 7.2.x + MySQL 5.6, MariaDB InnoDB utf8 / utf8mb4 + XCL version 2.3.+ -I'm appreciated your bug reports :-) -I'll maintain this module instead of blocksadmin, tplsadmin, avaman etc. + +----- + + +== ALTSYS == alternative system module & library + +[b]SUMMARY:[/b] + +UI Common Library to create custom Blocks and Templates. +Manage modules Blocks, Templates, and translations. +GUI for Localization. [b]INSTALL:[/b] diff --git a/html/modules/altsys/admin/admin_menu.php b/html/modules/altsys/admin/admin_menu.php index f23cbcc..51ac23e 100644 --- a/html/modules/altsys/admin/admin_menu.php +++ b/html/modules/altsys/admin/admin_menu.php @@ -4,8 +4,8 @@ die('set XOOPS_TRUST_PATH in mainfile.php') ; } -$mydirname = basename(dirname(dirname(__FILE__))) ; -$mydirpath = dirname(dirname(__FILE__)) ; +$mydirname = basename(dirname(__DIR__)) ; +$mydirpath = dirname(__DIR__) ; // require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname $mytrustdirname = 'altsys' ; diff --git a/html/modules/altsys/admin/index.php b/html/modules/altsys/admin/index.php index 9a6e4cd..9eb5ce8 100644 --- a/html/modules/altsys/admin/index.php +++ b/html/modules/altsys/admin/index.php @@ -5,8 +5,8 @@ die('set XOOPS_TRUST_PATH in mainfile.php') ; } -$mydirname = basename(dirname(dirname(__FILE__))) ; -$mydirpath = dirname(dirname(__FILE__)) ; +$mydirname = basename(dirname(__DIR__)) ; +$mydirpath = dirname(__DIR__) ; // require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname $mytrustdirname = 'altsys' ; diff --git a/html/modules/altsys/altsys_slogo.png b/html/modules/altsys/altsys_slogo.png deleted file mode 100644 index 5903563..0000000 Binary files a/html/modules/altsys/altsys_slogo.png and /dev/null differ diff --git a/html/modules/altsys/blocks/blocks.php b/html/modules/altsys/blocks/blocks.php index 3578d46..2e1073a 100644 --- a/html/modules/altsys/blocks/blocks.php +++ b/html/modules/altsys/blocks/blocks.php @@ -4,8 +4,8 @@ die('set XOOPS_TRUST_PATH into mainfile.php') ; } -$mydirname = basename(dirname(dirname(__FILE__))) ; -$mydirpath = dirname(dirname(__FILE__)) ; +$mydirname = basename(dirname(__DIR__)) ; +$mydirpath = dirname(__DIR__) ; // require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname $mytrustdirname = 'altsys' ; diff --git a/html/modules/altsys/images/module_icon.png b/html/modules/altsys/images/module_icon.png deleted file mode 100644 index 6399b39..0000000 Binary files a/html/modules/altsys/images/module_icon.png and /dev/null differ diff --git a/html/modules/altsys/images/module_icon.svg b/html/modules/altsys/images/module_icon.svg new file mode 100644 index 0000000..7b0526a --- /dev/null +++ b/html/modules/altsys/images/module_icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/html/modules/altsys/images/module_ui_components.svg b/html/modules/altsys/images/module_ui_components.svg new file mode 100644 index 0000000..9b4ce36 --- /dev/null +++ b/html/modules/altsys/images/module_ui_components.svg @@ -0,0 +1,9 @@ + + + + +UI-Components + + + \ No newline at end of file diff --git a/html/modules/altsys/include/Legacy_AltsysAdminRenderSystem.class.php b/html/modules/altsys/include/Legacy_AltsysAdminRenderSystem.class.php index 6f82d2b..0cc3685 100644 --- a/html/modules/altsys/include/Legacy_AltsysAdminRenderSystem.class.php +++ b/html/modules/altsys/include/Legacy_AltsysAdminRenderSystem.class.php @@ -4,8 +4,8 @@ die('set XOOPS_TRUST_PATH into mainfile.php') ; } -$mydirname = basename(dirname(dirname(__FILE__))) ; -$mydirpath = dirname(dirname(__FILE__)) ; +$mydirname = basename(dirname(__DIR__)) ; +$mydirpath = dirname(__DIR__) ; // require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname $mytrustdirname = 'altsys' ; diff --git a/html/modules/altsys/include/oninstall.php b/html/modules/altsys/include/oninstall.php index 8aa5182..f4f0d39 100644 --- a/html/modules/altsys/include/oninstall.php +++ b/html/modules/altsys/include/oninstall.php @@ -4,8 +4,8 @@ die('set XOOPS_TRUST_PATH into mainfile.php') ; } -$mydirname = basename(dirname(dirname(__FILE__))) ; -$mydirpath = dirname(dirname(__FILE__)) ; +$mydirname = basename(dirname(__DIR__)) ; +$mydirpath = dirname(__DIR__) ; // require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname $mytrustdirname = 'altsys' ; diff --git a/html/modules/altsys/include/onuninstall.php b/html/modules/altsys/include/onuninstall.php index 29577e1..b959cf0 100644 --- a/html/modules/altsys/include/onuninstall.php +++ b/html/modules/altsys/include/onuninstall.php @@ -4,8 +4,8 @@ die('set XOOPS_TRUST_PATH into mainfile.php') ; } -$mydirname = basename(dirname(dirname(__FILE__))) ; -$mydirpath = dirname(dirname(__FILE__)) ; +$mydirname = basename(dirname(__DIR__)) ; +$mydirpath = dirname(__DIR__) ; // require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname $mytrustdirname = 'altsys' ; diff --git a/html/modules/altsys/include/onupdate.php b/html/modules/altsys/include/onupdate.php index db47540..32b8c24 100644 --- a/html/modules/altsys/include/onupdate.php +++ b/html/modules/altsys/include/onupdate.php @@ -4,8 +4,8 @@ die('set XOOPS_TRUST_PATH into mainfile.php') ; } -$mydirname = basename(dirname(dirname(__FILE__))) ; -$mydirpath = dirname(dirname(__FILE__)) ; +$mydirname = basename(dirname(__DIR__)) ; +$mydirpath = dirname(__DIR__) ; // require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname $mytrustdirname = 'altsys' ; diff --git a/html/modules/altsys/language/english/help/altsys_guide.html b/html/modules/altsys/language/english/help/altsys_guide.html new file mode 100644 index 0000000..3ae50b6 --- /dev/null +++ b/html/modules/altsys/language/english/help/altsys_guide.html @@ -0,0 +1,138 @@ + +
+ +

AltSys Guide

+ +
+ +
+ +
+ + + + + +
+ + + +
+ +
+ + +
+ +
+ +
+ +
+
-
+
+ +
+
+ +
+
+ +
+
-
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+ + + + + +
+ +
+ +
+ + + +
+
+ + + +
+ +
diff --git a/html/modules/altsys/language/english/help/help.html b/html/modules/altsys/language/english/help/help.html new file mode 100644 index 0000000..b1e7cf1 --- /dev/null +++ b/html/modules/altsys/language/english/help/help.html @@ -0,0 +1,254 @@ +
+
+ +
+ +
+ +
+ +

Overview

+ +

This module aims to provide quick access to most common tasks of the application platform. +

This module (library) is required and installed by default with the core modules. +

Permissions can be extended to trusted user groups. + +

Next we will give an overview of some common tasks you can do with the Administration. + Each task will be used to highlight a particular function within the module. +

creation of custom blocks (HTML, PHP and BBCode), modules block management, + advanced templates design, customization, translations and localization. +

+ + +
+ + +
+ +

Blocks management

+ +

The building blocks of your site are single components of content like business information, + advertisements, contact forms, images or media embeds from other platforms.

+ +

Block Settings

+

Each block has the following default properties :

+
    +
  • name (title)
  • +
  • order or weight of display
  • +
  • default block "side"
  • +
  • enabled or disable
  • +
  • in which module
  • +
  • for which user groups
  • +
  • and cache settings
  • +
  • Custom Blocks
  • +
  • + Type of Block (HTML,PHP...)
  • +
  • + Copy/duplicate
  • +
  • + edit the template
  • +
  • + and delete the custom block
  • +
+ +

Block Side

+ +

The block "side"" is just a legacy code convention to identify areas in the theme and organize the layout. + Blocks are modular units of content that can be positioned almost anywhere on the page.

+

For example, a theme can place the block-left "Main Menu" at the top of the page to create a navigation bar.

+ +
The block template specifies the shape, and the global theme specifies the areas and appearance. + However, the block's presentation layer can be replaced by a custom template.
+ +

Types of blocks

+ +

Custom blocks

+ +

A Custom block can be built with HTML, CSS, JavaScript, PHP and Smarty variables. + Thus allowing to create reusable Components to create an effective website layout.

+

It can also embed code or integrate with third-party features specific to a site's unique needs.

+ +
The block editor will switch according to the type of content.
+ +

Modules blocks

+ +

Modules have several pre-built blocks that offer specific functionality and favor composition over inheritance. + These blocks are made available in Block Management by enabling modules. + Each module block has its own settings and customization options.

+ +

Learn more about Blocks ⭢

+ +
+ + +
+ + +
+ +

Templates

+ +

Templates of modules and blocks shape content. While the frontend and backend Themes define the general appearance.

+

A custom template can be created with HTML, CSS, JavaScript, PHP and Smarty variables to make a single file component.

+ +

Template Set

+ +

The list of Template Sets can be found in Template Management of module Renderer. + When modules are installed, their templates become part of the Default Template Set.

+ +

1. First, make a copy of the Default Template Set ( Base-File )

+

2. Browse to templates »» Module

+

3. Click "edit" next to the template of the new Set

+

4. Make the changes you want

+

5. Save the template

+ +
In case of errors, check the box next to the template to easily copy from Base-File Set !
+ +

Find a Template

+ +

Naming Convention

+ +

The template naming convention is a systematic method for naming files + written in all-lowercase ASCII letters. The name specs might include the package name, action, event.

+
    +
  • [module-name]_[admin].html
  • +
  • [module-name]_[block].html
  • +
  • [module-name]_[inc]_[component-name].html
  • +
+ +

Learn more about Naming Convention ⭢

+ +

Custom Templates

+

1. Create a custom template

+

2. Add some content

+

3. Name the template eg.: mycustom_template.html

+

4. Save the custom template

+ +

Then, you can create a custom block and load your custom template

+

+$xoopsTpl = new XoopsTpl();
+$test = $xoopsTpl->fetch('myblock_custom.html');
+echo $test;
+        
+ +

Renderer Engine

+ +

The Renderer uses Smarty Template Engine —one of the most popular and mature template engines— with custom delimiters + similar to HTML markup language that make easier to design and develop components for templates.

+

From template Management you can enable a Set and check the list of templates that you can edit, copy, download or delete.

+ +

Learn more about Themes and Templates ⭢

+ +
+ + +
+ + +
+ +

Advanced Templates

+ +

These features allow you to insert ruler guides and logic to collect template variables + in order to help designers identify components during the design process.

+ +
You can also generate a DreamWeaver extension with template variables.
+ +
+ + +
+ + +
+ +

Language

+ +

The default distribution comes with English, French, Japanese and Portuguese translations. + You can change the 'Default Language' in
+

System »» Preferences »» Settings
+ +

Other local languages translations are available that you can download from the + GitHub repository - i18n-language ⭧

+ +

+ Note that he translations of installation wizard, System and modules might not be up-to-date. + However, you can translate and customize here any missing constants. +
+ +

Translation

+ +

If your language files are not available, you’ll need to translate the files located in modules directories + e.g. “/language/english/”

+ +
+ Some times you have a placeholder within a constant, for example, %s or {0}, + it's important to keep them !
+ define( '_MSC_INTSITE' , 'Interesting Site: %s');
+ // Here %s is a placeholder for your site name +
+ +

1. Click the module to translate +

2. Select the local language, e.g. english

+

3. Select the file to translate

+

4. Add a new Custom Value

+

5. Update to save the constants translated into your language

+

This will save into the database and in a file under TRUST_PATH/cache/....

+ +

Localization

+ +

Localisation (l10n) is the process of customizing your app and + adapting your product's translation to a specific country or region.

+ +
+ Keep your global voice consistent across all modules, branches, cultures, and language locales +
+ +

It is the second phase of a larger process of product translation and cultural adaptation to account for + differences in distinct markets, a process known as internationalisation and localisation.

+ +
+ + +
+ + +
+

Development

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Module nameAltsys
TypeTrust Module [ D3 library ]
Version2.31
LevelRequired
🌐 Repository URLhttps://github.com/xoopscube/altsys ⭧
+ +
+ + +
+
diff --git a/html/modules/altsys/language/english/help/index.html b/html/modules/altsys/language/english/help/index.html new file mode 100644 index 0000000..2c5cdd3 --- /dev/null +++ b/html/modules/altsys/language/english/help/index.html @@ -0,0 +1 @@ + diff --git a/html/modules/altsys/language/english/index.html b/html/modules/altsys/language/english/index.html new file mode 100644 index 0000000..2c5cdd3 --- /dev/null +++ b/html/modules/altsys/language/english/index.html @@ -0,0 +1 @@ + diff --git a/html/modules/altsys/language/fr_utf8/help/help.html b/html/modules/altsys/language/fr_utf8/help/help.html new file mode 100644 index 0000000..b1e7cf1 --- /dev/null +++ b/html/modules/altsys/language/fr_utf8/help/help.html @@ -0,0 +1,254 @@ +
+
+ +
+ +
+ +
+ +

Overview

+ +

This module aims to provide quick access to most common tasks of the application platform. +

This module (library) is required and installed by default with the core modules. +

Permissions can be extended to trusted user groups. + +

Next we will give an overview of some common tasks you can do with the Administration. + Each task will be used to highlight a particular function within the module. +

creation of custom blocks (HTML, PHP and BBCode), modules block management, + advanced templates design, customization, translations and localization. +

+ + +
+ + +
+ +

Blocks management

+ +

The building blocks of your site are single components of content like business information, + advertisements, contact forms, images or media embeds from other platforms.

+ +

Block Settings

+

Each block has the following default properties :

+
    +
  • name (title)
  • +
  • order or weight of display
  • +
  • default block "side"
  • +
  • enabled or disable
  • +
  • in which module
  • +
  • for which user groups
  • +
  • and cache settings
  • +
  • Custom Blocks
  • +
  • + Type of Block (HTML,PHP...)
  • +
  • + Copy/duplicate
  • +
  • + edit the template
  • +
  • + and delete the custom block
  • +
+ +

Block Side

+ +

The block "side"" is just a legacy code convention to identify areas in the theme and organize the layout. + Blocks are modular units of content that can be positioned almost anywhere on the page.

+

For example, a theme can place the block-left "Main Menu" at the top of the page to create a navigation bar.

+ +
The block template specifies the shape, and the global theme specifies the areas and appearance. + However, the block's presentation layer can be replaced by a custom template.
+ +

Types of blocks

+ +

Custom blocks

+ +

A Custom block can be built with HTML, CSS, JavaScript, PHP and Smarty variables. + Thus allowing to create reusable Components to create an effective website layout.

+

It can also embed code or integrate with third-party features specific to a site's unique needs.

+ +
The block editor will switch according to the type of content.
+ +

Modules blocks

+ +

Modules have several pre-built blocks that offer specific functionality and favor composition over inheritance. + These blocks are made available in Block Management by enabling modules. + Each module block has its own settings and customization options.

+ +

Learn more about Blocks ⭢

+ +
+ + +
+ + +
+ +

Templates

+ +

Templates of modules and blocks shape content. While the frontend and backend Themes define the general appearance.

+

A custom template can be created with HTML, CSS, JavaScript, PHP and Smarty variables to make a single file component.

+ +

Template Set

+ +

The list of Template Sets can be found in Template Management of module Renderer. + When modules are installed, their templates become part of the Default Template Set.

+ +

1. First, make a copy of the Default Template Set ( Base-File )

+

2. Browse to templates »» Module

+

3. Click "edit" next to the template of the new Set

+

4. Make the changes you want

+

5. Save the template

+ +
In case of errors, check the box next to the template to easily copy from Base-File Set !
+ +

Find a Template

+ +

Naming Convention

+ +

The template naming convention is a systematic method for naming files + written in all-lowercase ASCII letters. The name specs might include the package name, action, event.

+
    +
  • [module-name]_[admin].html
  • +
  • [module-name]_[block].html
  • +
  • [module-name]_[inc]_[component-name].html
  • +
+ +

Learn more about Naming Convention ⭢

+ +

Custom Templates

+

1. Create a custom template

+

2. Add some content

+

3. Name the template eg.: mycustom_template.html

+

4. Save the custom template

+ +

Then, you can create a custom block and load your custom template

+

+$xoopsTpl = new XoopsTpl();
+$test = $xoopsTpl->fetch('myblock_custom.html');
+echo $test;
+        
+ +

Renderer Engine

+ +

The Renderer uses Smarty Template Engine —one of the most popular and mature template engines— with custom delimiters + similar to HTML markup language that make easier to design and develop components for templates.

+

From template Management you can enable a Set and check the list of templates that you can edit, copy, download or delete.

+ +

Learn more about Themes and Templates ⭢

+ +
+ + +
+ + +
+ +

Advanced Templates

+ +

These features allow you to insert ruler guides and logic to collect template variables + in order to help designers identify components during the design process.

+ +
You can also generate a DreamWeaver extension with template variables.
+ +
+ + +
+ + +
+ +

Language

+ +

The default distribution comes with English, French, Japanese and Portuguese translations. + You can change the 'Default Language' in
+

System »» Preferences »» Settings
+ +

Other local languages translations are available that you can download from the + GitHub repository - i18n-language ⭧

+ +

+ Note that he translations of installation wizard, System and modules might not be up-to-date. + However, you can translate and customize here any missing constants. +
+ +

Translation

+ +

If your language files are not available, you’ll need to translate the files located in modules directories + e.g. “/language/english/”

+ +
+ Some times you have a placeholder within a constant, for example, %s or {0}, + it's important to keep them !
+ define( '_MSC_INTSITE' , 'Interesting Site: %s');
+ // Here %s is a placeholder for your site name +
+ +

1. Click the module to translate +

2. Select the local language, e.g. english

+

3. Select the file to translate

+

4. Add a new Custom Value

+

5. Update to save the constants translated into your language

+

This will save into the database and in a file under TRUST_PATH/cache/....

+ +

Localization

+ +

Localisation (l10n) is the process of customizing your app and + adapting your product's translation to a specific country or region.

+ +
+ Keep your global voice consistent across all modules, branches, cultures, and language locales +
+ +

It is the second phase of a larger process of product translation and cultural adaptation to account for + differences in distinct markets, a process known as internationalisation and localisation.

+ +
+ + +
+ + +
+

Development

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Module nameAltsys
TypeTrust Module [ D3 library ]
Version2.31
LevelRequired
🌐 Repository URLhttps://github.com/xoopscube/altsys ⭧
+ +
+ + +
+
diff --git a/html/modules/altsys/language/fr_utf8/help/index.html b/html/modules/altsys/language/fr_utf8/help/index.html new file mode 100644 index 0000000..2c5cdd3 --- /dev/null +++ b/html/modules/altsys/language/fr_utf8/help/index.html @@ -0,0 +1 @@ + diff --git a/html/modules/altsys/language/fr_utf8/index.html b/html/modules/altsys/language/fr_utf8/index.html new file mode 100644 index 0000000..2c5cdd3 --- /dev/null +++ b/html/modules/altsys/language/fr_utf8/index.html @@ -0,0 +1 @@ + diff --git a/html/modules/altsys/language/index.html b/html/modules/altsys/language/index.html new file mode 100644 index 0000000..2c5cdd3 --- /dev/null +++ b/html/modules/altsys/language/index.html @@ -0,0 +1 @@ + diff --git a/html/modules/altsys/language/ja_utf8/help/help.html b/html/modules/altsys/language/ja_utf8/help/help.html new file mode 100644 index 0000000..b1e7cf1 --- /dev/null +++ b/html/modules/altsys/language/ja_utf8/help/help.html @@ -0,0 +1,254 @@ +
+
+ +
+ +
+ +
+ +

Overview

+ +

This module aims to provide quick access to most common tasks of the application platform. +

This module (library) is required and installed by default with the core modules. +

Permissions can be extended to trusted user groups. + +

Next we will give an overview of some common tasks you can do with the Administration. + Each task will be used to highlight a particular function within the module. +

creation of custom blocks (HTML, PHP and BBCode), modules block management, + advanced templates design, customization, translations and localization. +

+ + +
+ + +
+ +

Blocks management

+ +

The building blocks of your site are single components of content like business information, + advertisements, contact forms, images or media embeds from other platforms.

+ +

Block Settings

+

Each block has the following default properties :

+
    +
  • name (title)
  • +
  • order or weight of display
  • +
  • default block "side"
  • +
  • enabled or disable
  • +
  • in which module
  • +
  • for which user groups
  • +
  • and cache settings
  • +
  • Custom Blocks
  • +
  • + Type of Block (HTML,PHP...)
  • +
  • + Copy/duplicate
  • +
  • + edit the template
  • +
  • + and delete the custom block
  • +
+ +

Block Side

+ +

The block "side"" is just a legacy code convention to identify areas in the theme and organize the layout. + Blocks are modular units of content that can be positioned almost anywhere on the page.

+

For example, a theme can place the block-left "Main Menu" at the top of the page to create a navigation bar.

+ +
The block template specifies the shape, and the global theme specifies the areas and appearance. + However, the block's presentation layer can be replaced by a custom template.
+ +

Types of blocks

+ +

Custom blocks

+ +

A Custom block can be built with HTML, CSS, JavaScript, PHP and Smarty variables. + Thus allowing to create reusable Components to create an effective website layout.

+

It can also embed code or integrate with third-party features specific to a site's unique needs.

+ +
The block editor will switch according to the type of content.
+ +

Modules blocks

+ +

Modules have several pre-built blocks that offer specific functionality and favor composition over inheritance. + These blocks are made available in Block Management by enabling modules. + Each module block has its own settings and customization options.

+ +

Learn more about Blocks ⭢

+ +
+ + +
+ + +
+ +

Templates

+ +

Templates of modules and blocks shape content. While the frontend and backend Themes define the general appearance.

+

A custom template can be created with HTML, CSS, JavaScript, PHP and Smarty variables to make a single file component.

+ +

Template Set

+ +

The list of Template Sets can be found in Template Management of module Renderer. + When modules are installed, their templates become part of the Default Template Set.

+ +

1. First, make a copy of the Default Template Set ( Base-File )

+

2. Browse to templates »» Module

+

3. Click "edit" next to the template of the new Set

+

4. Make the changes you want

+

5. Save the template

+ +
In case of errors, check the box next to the template to easily copy from Base-File Set !
+ +

Find a Template

+ +

Naming Convention

+ +

The template naming convention is a systematic method for naming files + written in all-lowercase ASCII letters. The name specs might include the package name, action, event.

+
    +
  • [module-name]_[admin].html
  • +
  • [module-name]_[block].html
  • +
  • [module-name]_[inc]_[component-name].html
  • +
+ +

Learn more about Naming Convention ⭢

+ +

Custom Templates

+

1. Create a custom template

+

2. Add some content

+

3. Name the template eg.: mycustom_template.html

+

4. Save the custom template

+ +

Then, you can create a custom block and load your custom template

+

+$xoopsTpl = new XoopsTpl();
+$test = $xoopsTpl->fetch('myblock_custom.html');
+echo $test;
+        
+ +

Renderer Engine

+ +

The Renderer uses Smarty Template Engine —one of the most popular and mature template engines— with custom delimiters + similar to HTML markup language that make easier to design and develop components for templates.

+

From template Management you can enable a Set and check the list of templates that you can edit, copy, download or delete.

+ +

Learn more about Themes and Templates ⭢

+ +
+ + +
+ + +
+ +

Advanced Templates

+ +

These features allow you to insert ruler guides and logic to collect template variables + in order to help designers identify components during the design process.

+ +
You can also generate a DreamWeaver extension with template variables.
+ +
+ + +
+ + +
+ +

Language

+ +

The default distribution comes with English, French, Japanese and Portuguese translations. + You can change the 'Default Language' in
+

System »» Preferences »» Settings
+ +

Other local languages translations are available that you can download from the + GitHub repository - i18n-language ⭧

+ +

+ Note that he translations of installation wizard, System and modules might not be up-to-date. + However, you can translate and customize here any missing constants. +
+ +

Translation

+ +

If your language files are not available, you’ll need to translate the files located in modules directories + e.g. “/language/english/”

+ +
+ Some times you have a placeholder within a constant, for example, %s or {0}, + it's important to keep them !
+ define( '_MSC_INTSITE' , 'Interesting Site: %s');
+ // Here %s is a placeholder for your site name +
+ +

1. Click the module to translate +

2. Select the local language, e.g. english

+

3. Select the file to translate

+

4. Add a new Custom Value

+

5. Update to save the constants translated into your language

+

This will save into the database and in a file under TRUST_PATH/cache/....

+ +

Localization

+ +

Localisation (l10n) is the process of customizing your app and + adapting your product's translation to a specific country or region.

+ +
+ Keep your global voice consistent across all modules, branches, cultures, and language locales +
+ +

It is the second phase of a larger process of product translation and cultural adaptation to account for + differences in distinct markets, a process known as internationalisation and localisation.

+ +
+ + +
+ + +
+

Development

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Module nameAltsys
TypeTrust Module [ D3 library ]
Version2.31
LevelRequired
🌐 Repository URLhttps://github.com/xoopscube/altsys ⭧
+ +
+ + +
+
diff --git a/html/modules/altsys/language/ja_utf8/help/index.html b/html/modules/altsys/language/ja_utf8/help/index.html new file mode 100644 index 0000000..2c5cdd3 --- /dev/null +++ b/html/modules/altsys/language/ja_utf8/help/index.html @@ -0,0 +1 @@ + diff --git a/html/modules/altsys/language/ja_utf8/index.html b/html/modules/altsys/language/ja_utf8/index.html new file mode 100644 index 0000000..2c5cdd3 --- /dev/null +++ b/html/modules/altsys/language/ja_utf8/index.html @@ -0,0 +1 @@ + diff --git a/html/modules/altsys/language/pt_utf8/help/help.html b/html/modules/altsys/language/pt_utf8/help/help.html new file mode 100644 index 0000000..b1e7cf1 --- /dev/null +++ b/html/modules/altsys/language/pt_utf8/help/help.html @@ -0,0 +1,254 @@ +
+
+ +
+ +
+ +
+ +

Overview

+ +

This module aims to provide quick access to most common tasks of the application platform. +

This module (library) is required and installed by default with the core modules. +

Permissions can be extended to trusted user groups. + +

Next we will give an overview of some common tasks you can do with the Administration. + Each task will be used to highlight a particular function within the module. +

creation of custom blocks (HTML, PHP and BBCode), modules block management, + advanced templates design, customization, translations and localization. +

+ + +
+ + +
+ +

Blocks management

+ +

The building blocks of your site are single components of content like business information, + advertisements, contact forms, images or media embeds from other platforms.

+ +

Block Settings

+

Each block has the following default properties :

+
    +
  • name (title)
  • +
  • order or weight of display
  • +
  • default block "side"
  • +
  • enabled or disable
  • +
  • in which module
  • +
  • for which user groups
  • +
  • and cache settings
  • +
  • Custom Blocks
  • +
  • + Type of Block (HTML,PHP...)
  • +
  • + Copy/duplicate
  • +
  • + edit the template
  • +
  • + and delete the custom block
  • +
+ +

Block Side

+ +

The block "side"" is just a legacy code convention to identify areas in the theme and organize the layout. + Blocks are modular units of content that can be positioned almost anywhere on the page.

+

For example, a theme can place the block-left "Main Menu" at the top of the page to create a navigation bar.

+ +
The block template specifies the shape, and the global theme specifies the areas and appearance. + However, the block's presentation layer can be replaced by a custom template.
+ +

Types of blocks

+ +

Custom blocks

+ +

A Custom block can be built with HTML, CSS, JavaScript, PHP and Smarty variables. + Thus allowing to create reusable Components to create an effective website layout.

+

It can also embed code or integrate with third-party features specific to a site's unique needs.

+ +
The block editor will switch according to the type of content.
+ +

Modules blocks

+ +

Modules have several pre-built blocks that offer specific functionality and favor composition over inheritance. + These blocks are made available in Block Management by enabling modules. + Each module block has its own settings and customization options.

+ +

Learn more about Blocks ⭢

+ +
+ + +
+ + +
+ +

Templates

+ +

Templates of modules and blocks shape content. While the frontend and backend Themes define the general appearance.

+

A custom template can be created with HTML, CSS, JavaScript, PHP and Smarty variables to make a single file component.

+ +

Template Set

+ +

The list of Template Sets can be found in Template Management of module Renderer. + When modules are installed, their templates become part of the Default Template Set.

+ +

1. First, make a copy of the Default Template Set ( Base-File )

+

2. Browse to templates »» Module

+

3. Click "edit" next to the template of the new Set

+

4. Make the changes you want

+

5. Save the template

+ +
In case of errors, check the box next to the template to easily copy from Base-File Set !
+ +

Find a Template

+ +

Naming Convention

+ +

The template naming convention is a systematic method for naming files + written in all-lowercase ASCII letters. The name specs might include the package name, action, event.

+
    +
  • [module-name]_[admin].html
  • +
  • [module-name]_[block].html
  • +
  • [module-name]_[inc]_[component-name].html
  • +
+ +

Learn more about Naming Convention ⭢

+ +

Custom Templates

+

1. Create a custom template

+

2. Add some content

+

3. Name the template eg.: mycustom_template.html

+

4. Save the custom template

+ +

Then, you can create a custom block and load your custom template

+

+$xoopsTpl = new XoopsTpl();
+$test = $xoopsTpl->fetch('myblock_custom.html');
+echo $test;
+        
+ +

Renderer Engine

+ +

The Renderer uses Smarty Template Engine —one of the most popular and mature template engines— with custom delimiters + similar to HTML markup language that make easier to design and develop components for templates.

+

From template Management you can enable a Set and check the list of templates that you can edit, copy, download or delete.

+ +

Learn more about Themes and Templates ⭢

+ +
+ + +
+ + +
+ +

Advanced Templates

+ +

These features allow you to insert ruler guides and logic to collect template variables + in order to help designers identify components during the design process.

+ +
You can also generate a DreamWeaver extension with template variables.
+ +
+ + +
+ + +
+ +

Language

+ +

The default distribution comes with English, French, Japanese and Portuguese translations. + You can change the 'Default Language' in
+

System »» Preferences »» Settings
+ +

Other local languages translations are available that you can download from the + GitHub repository - i18n-language ⭧

+ +

+ Note that he translations of installation wizard, System and modules might not be up-to-date. + However, you can translate and customize here any missing constants. +
+ +

Translation

+ +

If your language files are not available, you’ll need to translate the files located in modules directories + e.g. “/language/english/”

+ +
+ Some times you have a placeholder within a constant, for example, %s or {0}, + it's important to keep them !
+ define( '_MSC_INTSITE' , 'Interesting Site: %s');
+ // Here %s is a placeholder for your site name +
+ +

1. Click the module to translate +

2. Select the local language, e.g. english

+

3. Select the file to translate

+

4. Add a new Custom Value

+

5. Update to save the constants translated into your language

+

This will save into the database and in a file under TRUST_PATH/cache/....

+ +

Localization

+ +

Localisation (l10n) is the process of customizing your app and + adapting your product's translation to a specific country or region.

+ +
+ Keep your global voice consistent across all modules, branches, cultures, and language locales +
+ +

It is the second phase of a larger process of product translation and cultural adaptation to account for + differences in distinct markets, a process known as internationalisation and localisation.

+ +
+ + +
+ + +
+

Development

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Module nameAltsys
TypeTrust Module [ D3 library ]
Version2.31
LevelRequired
🌐 Repository URLhttps://github.com/xoopscube/altsys ⭧
+ +
+ + +
+
diff --git a/html/modules/altsys/language/pt_utf8/help/index.html b/html/modules/altsys/language/pt_utf8/help/index.html new file mode 100644 index 0000000..2c5cdd3 --- /dev/null +++ b/html/modules/altsys/language/pt_utf8/help/index.html @@ -0,0 +1 @@ + diff --git a/html/modules/altsys/language/pt_utf8/index.html b/html/modules/altsys/language/pt_utf8/index.html new file mode 100644 index 0000000..2c5cdd3 --- /dev/null +++ b/html/modules/altsys/language/pt_utf8/index.html @@ -0,0 +1 @@ + diff --git a/html/modules/altsys/preload/AltsysPreload.class.php b/html/modules/altsys/preload/AltsysPreload.class.php index 1b675d7..238d12e 100644 --- a/html/modules/altsys/preload/AltsysPreload.class.php +++ b/html/modules/altsys/preload/AltsysPreload.class.php @@ -4,8 +4,8 @@ die('set XOOPS_TRUST_PATH into mainfile.php') ; } -$mydirname = basename(dirname(dirname(__FILE__))) ; -$mydirpath = dirname(dirname(__FILE__)) ; +$mydirname = basename(dirname(__DIR__)) ; +$mydirpath = dirname(__DIR__) ; // require $mydirpath.'/mytrustdirname.php' ; // set $mytrustdirname $mytrustdirname = 'altsys' ; diff --git a/html/modules/altsys/setup_xoops_trust_path.php b/html/modules/altsys/setup_xoops_trust_path.php index 4c7cfa1..9ecca18 100644 --- a/html/modules/altsys/setup_xoops_trust_path.php +++ b/html/modules/altsys/setup_xoops_trust_path.php @@ -1,26 +1,35 @@ define('XOOPS_ROOT_PATH', '".htmlspecialchars(XOOPS_ROOT_PATH, ENT_QUOTES)."');
define('XOOPS_TRUST_PATH', '".htmlspecialchars($xoops_trust_path, ENT_QUOTES)."');"; + $hint = "Insert the red line.
define('XOOPS_ROOT_PATH', '".htmlspecialchars(XOOPS_ROOT_PATH, ENT_QUOTES)."');
define('XOOPS_TRUST_PATH', '".htmlspecialchars($xoops_trust_path, ENT_QUOTES)."');"; } else { - $hint = "define('XOOPS_TRUST_PATH', '');
define('XOOPS_TRUST_PATH', '".htmlspecialchars($xoops_trust_path, ENT_QUOTES)."');"; + $hint = "define('XOOPS_TRUST_PATH', '');
define('XOOPS_TRUST_PATH', '".htmlspecialchars($xoops_trust_path, ENT_QUOTES)."');"; } } diff --git a/html/modules/altsys/xoops_version.php b/html/modules/altsys/xoops_version.php index 5f29537..65f04a3 100644 --- a/html/modules/altsys/xoops_version.php +++ b/html/modules/altsys/xoops_version.php @@ -1,12 +1,21 @@ mController->mCreateLanguageManager->add('SetupAltsysLangMgr::createLanguageManager'); - } - - public function createLanguageManager(&$langManager, $languageName) - { - $langManager = new AltsysLangMgr_LanguageManager(); - } -} - - -require_once XOOPS_ROOT_PATH . "/core/XCube_LanguageManager.class.php"; -require_once XOOPS_ROOT_PATH . "/modules/legacy/kernel/Legacy_LanguageManager.class.php"; - -class AltsysLangMgr_LanguageManager extends Legacy_LanguageManager -{ - public $langman = null ; - public $theme_lang_checked = false ; - - public function prepare() - { - $langmanpath = XOOPS_TRUST_PATH.'/libs/altsys/class/D3LanguageManager.class.php' ; - if (! file_exists($langmanpath)) { - die('install the latest altsys') ; - } - require_once($langmanpath) ; - $this->langman =& D3LanguageManager::getInstance() ; - $this->langman->language = $this->mLanguageName ; - - parent::prepare(); - } - - public function _loadLanguage($dirname, $fileBodyName) - { - // read/check once (selected_theme)/language/(lang).php - if (! $this->theme_lang_checked) { - $root =& XCube_Root::getSingleton() ; - if (! empty($root->mContext->mXoopsConfig['theme_set'])) { - $langdir = XOOPS_THEME_PATH.'/'.$root->mContext->mXoopsConfig['theme_set'].'/language' ; - if (file_exists($langdir)) { - $langfile = $langdir.'/'.$this->mLanguageName.'.php' ; - $engfile = $langdir.'/english.php' ; - if (file_exists($langfile)) { - require_once $langfile ; - } elseif (file_exists($engfile)) { - require_once $engfile ; - } - } - $this->theme_lang_checked = true ; - } - } - - // read normal - $this->langman->read($fileBodyName.'.php', $dirname) ; - } - - public function loadPageTypeMessageCatalog($type) - { - // I dare not to use langman... - if (strpos($type, '.') === false && $this->langman->my_language) { - $mylang_file = $this->langman->my_language.'/'.$this->mLanguageName.'/'.$type.'.php' ; - if (file_exists($mylang_file)) { - require_once $mylang_file ; - } - } - $original_error_level = error_reporting() ; - error_reporting($original_error_level & ~ E_NOTICE) ; - parent::loadPageTypeMessageCatalog($type); - error_reporting($original_error_level) ; - } - - public function loadGlobalMessageCatalog() - { - /* if (!$this->_loadFile(XOOPS_ROOT_PATH . "/modules/legacy/language/" . $this->mLanguageName . "/global.php")) { - $this->_loadFile(XOOPS_ROOT_PATH . "/modules/legacy/language/english/global.php"); - } */ - $this->_loadLanguage('legacy', 'global') ; - $this->_loadLanguage('legacy', 'setting') ; - - // - // Now, if XOOPS_USE_MULTIBYTES isn't defined, set zero to it. - // - if (!defined("XOOPS_USE_MULTIBYTES")) { - define("XOOPS_USE_MULTIBYTES", 0); - } - } -} diff --git a/xoops_trust_path/libs/altsys/CHANGELOG b/xoops_trust_path/libs/altsys/CHANGELOG deleted file mode 100644 index e280488..0000000 --- a/xoops_trust_path/libs/altsys/CHANGELOG +++ /dev/null @@ -1,343 +0,0 @@ -[xlang:en] - - - -v0.71 (2008-12-21) -- modified rendering options form for XCL2.1 cl::{BlockClass} (thx tohokuaiki) -- modified some behaviors for XOOPS2.3 -- fixed group permissions is lost in custom block previewing -- added RTL support (use _GLOBAL_LEFT/RIGHT instead of left,right directly) -- updated language files --- persian (thx voltan) --- portuguesebr (thx leco1) 0.71b -- fixed _GLOBAL_LEFT is defined as 'right' if _ADM_USE_RTL is not defined 0.71a -- _ADM_USE_RTLƤʤĶ_GLOBAL_LEFTrightˤʤХ 0.71a -- added a delegate D3NotificationHandler.Trigger into D3NotificationHandler 0.71b - -v0.70 (2008-12-14) Note: update the module -- rewritten myblocksadmin fully -- modified groups can be selected in list_blocks and edit_block -- added a support for ImpressCMS (page ID and block positions) -- removed a support for XOOPS2.2 -- added WYSIWYG edition for custom blocks by common/fckeditor (fckxoops) -- removed WYSIWYG edition for custom blocks by common/spaw -- added language files --- portuguesebr (thx leco1) - -v0.61 (2008-09-05) -- added D3NotificationHandler -- fixed some modinfo.php loaded twice with langauge overridding 0.61a - -v0.60 (2008-08-07) -- fixed warning by assert() in Text_Diff -- fixed notices missing modinfo.php (thx shige-p) - -v0.59 (2008-05-22) -- fixed css for admin with XCL2.1 and "admin in theme" -- modified the compatibility of blocksadmin with XCL2.1 -- updated gtickets.php -- updated language files --- persian (thx stranger) 0.59a - -v0.58 (2008-04-10) -- fixed wrong breadcrumbs as my*admin -- modified "admin in theme" read language files under the theme -- added setup_xoops_trust_path.php - -v0.57 (2008-04-01) -- modified public top altsys -- fixed typo in langman (thx nobunobu) -- fixed templates_c/index.html can be removed (thx nobunobu) -- added module's language files under the theme for XCL2.1 -- added pagetype's language files under the theme for XCL2.1 -- fixed menu duplication with admin in theme and XCL2.1 (thx nobunobu) -- added a class named AltsysBreadcrumbs -- modified xoops_breadcrumbs for "admin in theme" -- added language files --- spanish (thx debianus) - -v0.56 (2007-12-28) -- added a feature of custom template file (not custom "template set") -- modified cloned blocks have independent "func_num" each other -- modified compatibility with some XCL special modules about admin_in_theme -- added partially overriding language constants by XOOPS_ROOT_PATH/my_language -- modified mylangadmin displays which constants are overridden partially 0.56a -- modified compatibility with NBFrame 0.56a - -v0.55 (2007-07-12) -- modified the compatibility against XOOPS 2.0.14/15/16 -- added a class D3Tpl extends XoopsTpl -- modified adminmenu hack (thx nobu) 0.55a -- updated language files 0.55a --- persian (thx voltan) -- added language files 0.55a --- german (thx rene) - -v0.54 (2007-07-06) -- fixed admin_in_theme conflicts PHP debug of conventinal XOOPS2 -- fixed admin_in_theme conflicts redirect hack - -v0.53 (2007-06-05) -- modified some interfaces -- renamed language --- ja_utf8 (formerly japanaeseutf) - -v0.52 (2007-05-11) -- added config of "force block cloning" -- mofieid cache files for overriding language constants -- modified mylangadmin can treat modinfo.php even - -v0.51 (2007-05-10) -- added mylangadmin for conventional modules -- added a preload for overriding XC Legacy 2.1 Language Manager -- modified interface of mylangadmin -- templatized mymenu for altsys -- templatized mymenusub for altsys - -v0.50 (2007-05-07) -- added mylangadmin - the override system for language constants -- templatized mymenu -- added "update and continue to edit" button into mytplsadmin -- added language files --- japaneseutf -- modified the compatibility of mylangadmin 0.50a -- updated language files 0.50a --- persian (thx voltan) - -v0.41 (2007-04-04) -- modified tplsadmin can edit themes with dbtheme module -- fixed compatibility between "admin in theme" and Legacy 2.1 (thx sakichi) -- fixed redirect_message 0.41a - -v0.40 (2007-03-27) note: overwrite XOOPS_ROOT_PATH/modules/altsys also -- modified the structure radically -- added a bridge "admin in theme" to XC Legacy 2.1 -- added a block of adminmenu -- modified README better - -v0.36 (2007-03-23) -- modified compatibilities of "admin in theme" still -- added a feature blocks can be displayed in "admin in theme" (also xoops.org) -- changed blocks displaying rule in "admin in theme" (specify ALTSYS explicitly) -- added xoops_breadcrumbs for "admin in theme" -- fixed compatibity problem with php5 on "admin in theme" (thx sakichi) 0.36a - -v0.35 (2007-03-22) -- modified compatibilities of "admin in theme" -- added a feature any blocks can be displayed in "admin in theme" (only with JP) - -v0.34 (2007-03-21) -- added a feature of "admin in theme" - -v0.33 (2007-03-20) -- modified admin menu hacks a little bit -- modified compilehookadmin for other than html templates -- updated language files --- persian (thx voltan) - -v0.32 (2007-03-19) -- modified admin menu hacks -- fixed a bug on installing newly (thx fourpsk) - -v0.31 (2007-03-18) -- added admin menu hacks :-) - -v0.30 (2007-03-14) note: remove XOOPS_ROOT_PATH/modules/altsys once -- modified the structure of file tree - -v0.21 (2006-10-27) -- fixed wrong link from templates (thx makimaki) -- added language persian (thx voltan) - -v0.20 (2006-10-18) -- modified compatibility with Cube 2.1 beta -- fixed wrong links of admin menu (thx usagiya) 0.20a - -v0.12 (2006-07-18) -- modified compatibility with Cube 2.1 alpha3 without system module - -v0.11 (2006-06-21) -- fixed uri of spaw in myblocksadmin (thx nico) -- modified icon (thx argon) - -v0.10 (2006-05-19) -- 1st release as altsys -- myblocksadmin -- mytplsadmin -- mypreferences -- compilehookadmin -- fixed escaping rule of & (myblocksadmin) -- XOOPS 2.2 ready (myblocksadmin) - - -[/xlang:en] -[xlang:ja] - -v0.71 (2008-12-21) -- XCL2.1cl::{BlockClass}б (thx tohokuaiki) -- XOOPS2.3Ǥưǧ -- ץӥ塼˥롼׸¤ƤΤ -- RTLݡ (leftrightľ˵Ҥˡ_GLOBAL_LEFT/RIGHTȤ) -- --- persian (thx voltan) --- portuguesebr (thx leco1) 0.71b -- _ADM_USE_RTLƤʤĶ_GLOBAL_LEFTrightˤʤХ 0.71a -- ٥Υϥɥ餬 D3NotificationHandler.Trigger call褦ѹ 0.71b - -v0.70 (2008-12-14) ץ⥸塼륢åץǡ -- myblocksadminޤޤľ -- ɽоݥ롼פľǤ褦ˤ -- ImpressCMSбʥڡIDɲå֥åݥ -- XOOPS2.2ؤб᤿ -- common/fckeditor (fckxoops)ǥ֥åԽǤ褦ˤ -- ֥åԽspawؤб᤿ -- ɲ --- portuguesebr (thx leco1) - -v0.61 (2008-09-05) -- D3NotificationHandler ɲ -- С饤ɤ modinfo.php ɤޤƤޤݤ 0.61a - -v0.60 (2008-08-07) -- Text_DiffǤassert()ˤWarningȤꤢä -- modinfo.phpɤ߹ޤʤNoticeФƤΤ (thx shige-p) - -v0.59 (2008-05-22) -- XCL2.1ˤ̥ơޤǡCSSɤ߹ޤʤβ -- XCL2.1ˤ֥å -- gtickets.php ι -- ե빹 --- persian (thx stranger) 0.59a - -v0.58 (2008-04-10) -- ѥ󤯤ϢΥХ -- ̥ơޤΥơ޲եб -- XOOPS_TRUST_PATHꤷƤʤбɲ - -v0.57 (2008-04-01) -- Altsys򳫻ϥ⥸塼ȤƤޤäнɲ -- ޥ͡typo (thx nobunobu) -- ƥץ졼ȥåեθ (thx nobunobu) -- XCL2.1Ѹޥ͡եåpreloadΥơ޲եб -- XCL2.1Ѹޥ͡եåpreloadmy_language/ڡ׸եб -- XCL2.1δ̥ơޤǡ˥塼ܤʣХν (thx nobunobu) -- AltsysBreadcrumbs 饹ο -- Altsysxoops_breadcrumbsŪܤ˺ä -- եɲ --- spanish (thx debianus) - -v0.56 (2007-12-28) -- ƥץ졼Ȥμ -- ʣ֥åfunc_numʤ٤֤ʤ褦ˤ -- ̥ơޤ Module.class.php ǥС饤ɤ⥸塼б -- XOOPS_ROOT_PATH/my_language ˤκʬС饤ɤ -- ʬС饤ɾ̤ǤǧǤ褦ˤ 0.56a -- NBFrameؤб 0.56a - -v0.55 (2007-07-12) -- ܲǥ2.0.14/15/16Ȥθߴ -- XoopsTplѾD3Tpl饹μ -- ̥˥塼񤭴ǽβ (thx nobu) 0.55a -- ե빹 0.55a --- persian (thx voltan) -- եɲ 0.55a --- german (thx rene) - -v0.54 (2007-07-06) -- ̥ơޤȤȥ顼ɽʤʤäƤޤäΤ -- ̥ơޤȤڹ®HackȤξͤ - -v0.53 (2007-06-05) -- ٤ -- ե̾ѹ --- ja_utf8 ( japanaeseutf) - -v0.52 (2007-05-11) -- ֥åʣǽץο -- åե롼ѹ -- ե륪С饤ɤ modinfo.php ⰷ褦ˤ - -v0.51 (2007-05-10) -- ̾⥸塼ե륪С饤ɥƥǰ褦˻ѹ -- XoopsCube Legacy 2.1 ѤΥ󥲡ޥ͡㥪С饤preloadƱ -- mylangadmin -- altsysmymenuΥƥץ졼Ȳ -- Ʊ֥˥塼Υƥץ졼Ȳ - -v0.50 (2007-05-07) -- ե륪С饤ɥƥmylangadminμ -- mymenuΥƥץ졼Ȳ -- ƥץ졼ԽǤγǧܥɲ -- եɲ --- japaneseutf -- mylangadminθߴ 0.50a -- ե뽤 0.50a --- persian (thx voltan) - -v0.41 (2007-04-04) -- tplsadmin ơԽб (dbtheme⥸塼Ȥʻѻ) -- ̥ơޤLegacy 2.1ߴ夵 (thx sakichi) -- ڹ®HackǥåɽƤʤäΤ 0.41a - -v0.40 (2007-03-27) ¦񤭤Ƥ -- ¤ѹ -- ̥ơޤXC Legacy 2.1ư褦ˤ -- ̥˥塼֥å -- ɥȤ򾯤 - -v0.36 (2007-03-23) -- ̥ơޤθߴΤʤ -- ̥ơޤǡܲ2.0.xǤ֥åɽǽȤ -- ̥ơޥ֥åɽѹ оݤ"ALTSYS"Ū˻ꤵ줿 -- ̥ơޤǤxoops_breadcrumbsб -- PHPȴ̥ơޤǽʤäΤ (thx sakichi) 0.36a - -v0.35 (2007-03-22) -- ̥ơޤθߴ -- ֥åɽǽˤ (ǤJPǤΤ) - -v0.34 (2007-03-21) -- ̤¦ơޤɽ뵡ǽɲ - -v0.33 (2007-03-20) -- ˥塼ν񤭴ǽ⤦ɤ -- ƥץ졼Ȥι٤ʴǡHTMLʳΥƥץ졼Ȥνѹ -- ե빹 --- persian (thx voltan) - -v0.32 (2007-03-19) -- ˥塼ν񤭴ǽδ٤᤿ -- 0.31ǥ󥹥ȡǤʤʤäƤХν (thx fourpsk) - -v0.31 (2007-03-18) -- ˥塼ν񤭴ǽɲ - -v0.30 (2007-03-14) ¦򤤤ääƤ -- ե빽θľʰʹߤXOOPS_TRUST_PATHΤ߾񤭤ɤˤ - -v0.21 (2006-10-27) -- ƥץ졼Ȥؤߤǥ褬äΤ (thx makimaki) -- ȥ륳ɲ (thx voltan) - -v0.20 (2006-10-18) -- Cube 2.1 beta ư褦ˤ -- ˥塼äΤ (thx usagiya) 0.20a - -v0.12 (2006-07-18) -- Cube 2.1 alpha3 system⥸塼뤬¸ߤʤؤбɲ - -v0.11 (2006-06-21) -- myblocksadminspaw󥯤äΤ (thx nico) -- 󹹿 (thx argon) - -v0.10 (2006-05-19) -- ǽΥ꡼ -- myblocksadmin -- mytplsadmin -- mypreferences -- compilehookadmin -- & ΰ (myblocksadmin) -- XOOPS 2.2б (myblocksadmin) - - -[/xlang:ja] diff --git a/xoops_trust_path/libs/altsys/README b/xoops_trust_path/libs/altsys/README deleted file mode 100644 index aaab031..0000000 --- a/xoops_trust_path/libs/altsys/README +++ /dev/null @@ -1,282 +0,0 @@ -[mlimg] -[xlang:en] -== ALTSYS == alternative system module & library - -[b]SUMMARY:[/b] - -The unified module of blocksadmin, tplsadmin, etc around the system. - -I'm appreciated your bug reports :-) - -I'll maintain this module instead of blocksadmin, tplsadmin, avaman etc. - - -[b]INSTALL:[/b] - -- set XOOPS_TRUST_PATH into mainfile.php -- copy xoops_trus_path/libs/ in the archive into XOOPS_TRUST_PATH/ -- copy html/modules/altsys in the archive into XOOPS_ROOT_PATH/modules/ -- install it - - -[b]UPDATE[/b] -from 0.2x/0.3x: - - remove XOOPS_ROOT_PATH/modules/altsys/ once - - upload/overwrite both XOOPS_ROOT_PATH/modules/altsys and XOOPS_TRUST_PATH/libs/altsys - - -[b]FEATURES[/b] - -- easy block administration -- easy permission adminstration -- easy copy/delete/edit any DB templates -- easy import/export any DB templates -- displaying diff between each version of templates -- finding the template you want to edit easily -- making an Extension for Dreamweaver to edit templates -- modifying adminmenu in the left side of XOOPS 2.0.x easier -- displaying admin controll panels in any conventional themes -- supporting three types of template auto-updating into the DB -- modifying operations/developments of any versions of core (X2,XCL2.1,ImpressCMS etc.) efficient - - -[b]DB template auto-updating feature[/b] - -This feature make your customizing/developping DB templates much efficient. -Altsys supports three types of auto-updating into the DB. - -(1) auto-updating template under the theme. -This feature is useful for developper of site/theme. -Insert a line just after including common.php of mainfile.php. -[code] - include XOOPS_ROOT_PATH."/include/common.php"; - [color=ff0000] - include XOOPS_TRUST_PATH."/libs/altsys/include/autoupdate_from_theme.inc.php" ; - [/color] -[/code] -Then, just modifying the templates of /themes/(your_theme)/templates/* will be updated into the DB - -(2) auto-updating template under the module -This feature is useful for developper of modules. -Insert two lines just after including common.php of mainfile.php. -[code] - include XOOPS_ROOT_PATH."/include/common.php"; - [color=ff0000] - $tplsadmin_autoupdate_dirnames = array( '(your_module)' ) ; - include XOOPS_TRUST_PATH."/libs/altsys/include/autoupdate_from_module.inc.php" ; - [/color] -[/code] -Then, just modifying the templates of /modules/(your_module)/templates/* will be updated into the DB. -You can specify modules multiply. eg) array( 'piCal' , 'tinyd0' ) - -(3) auto-updating template under XOOPS_TRUST_PATH -This feature is useful for developper of D3 modules. -Insert two lines just after including common.php of mainfile.php. -[code] - include XOOPS_ROOT_PATH."/include/common.php"; - [color=ff0000] - $tplsadmin_autoupdate_mydirnames = array( 'pico' , 'd3forum' ) ; - include XOOPS_TRUST_PATH."/libs/altsys/include/autoupdate_from_d3module.inc.php" ; - [/color] -[/code] -Then, just modifying the templates of XOOPS_TRUST_PATH/modules/pico/templates/* and XOOPS_TRUST_PATH/modules/d3forum/templates/* will be updated into the DB. - - -[b]admin in theme[/b] - -You can display admin side in the theme for XOOPS. -This must be useful for accessibility or mobile. - -You have to make some patch for enabling this feature. - -(1) XOOPS2.0.x -Insert a line just after including common.php of mainfile.php. -[code] - include XOOPS_TRUST_PATH.'/libs/altsys/include/admin_in_theme.inc.php' ; -[/code] - -(2) XOOPS Cube Legacy 2.1 -Insert some lines into settings/site_custom.ini.php (If this file does not exist, make it newly) -[code] -[RenderSystems] -Legacy_AdminRenderSystem=Legacy_AltsysAdminRenderSystem - -[Legacy_AltsysAdminRenderSystem] -path=/modules/altsys/include -class=Legacy_AltsysAdminRenderSystem -[/code] - -(3) XOOPS 2.2 and ORETEKI -Not supported yet - -Specify the theme for admin in the preferences of altsys. -This means that you can specify different themes between public and admin. -If you disable "admin in theme", set blank here. - -If you want to diplaying a block into the admin, Specify "ALTSYS" as the target explicitly. - - -[b]Admin menu hack[/b] - -Even if you turn "admin in theme" disabled, you can modify the adminmenu in the left side of admin area. (for 2.0.x) - -Just change "Rewrite admin menu" in altsys's preferences. -This is not a core hack but a cache hack. -If your admin area is broken, just remove cache/adminmenu. - - -[b]Language constants override system[/b] - -mylangadmin offers you to override the language constants of each modules. - -But, there are a hardle to enable this feature. - -- You always override constants of module using D3LanguageManager natively. - -- With core XoopsCube Legacy2.1, you can use this feature with conventional modules just by copying preload/SetupAltsysLangMgr.class.php - -- With conventinal core of XOOPS2, you have to hack the core. (follow the instruction in mylangadmin) - -[/xlang:en] -[xlang:ja] -== ALTSYS == إƥ⥸塼饤֥ - -׻ - -ȤŤ餤ƥ⥸塼ȤƺäƤblocksadmintplsadminȤä˴ؤ礷⥸塼Ǥ - -Duplicatable V3⥸塼뤫顢饤֥ȤѤǤˤᡢ¤礭ľƤޤ -Х紿ޤޤ - -ϡavamanۼ伫ȤΥƥʥ󥹤ڤˤȻפޤ - - -󥹥ȡ - -- mainfile.php ˤ XOOPS_TRUST_PATH ꤷƤ -- ֤xoops_trus_path/XOOPS_TRUST_PATHŸƤ -- ֤html/XOOPS_ROOT_PATHŸƤ -- ⥸塼Ȥƥ󥹥ȡ뤷Ƥ -- ̥ơ޵ǽѤϡμ˽äƤ - - -åץǡ - -0.2x 0.3x ΥåץǡȤǤϡ¦(XOOPS_ROOT_PATH/modules/altsys)򤤤ääƤ顢񤭤Ƥ - -0.4顢altsysϸᥤĤ褦ˤʤޤᥤ˥塼ʤɤˡALTSYSɽƺϡ⥸塼ɽ0ѹƤ - - -ǽ - -- X2Ƚ䤹֥åǤޤ -- X2Ƚ䤹´Ǥޤ -- DBƥץ졼Ȥǽ褫ԽǤޤ -- ƥץ졼ȤΥݡ/ݡȤͳߤǤ -- ƥץ졼Խκʬɽޤ -- оݥƥץ졼Ȥ򸫤Ĥ䤹Ǥޤ -- ƥץ졼Խ򤷤䤹뤿DreamWeaverExtensionưޤ -- X2̤δ˥塼ʬɽǤޤ -- ̤̾ơޤɽ뤳ȤǤޤʴ̥ơ޵ǽȡ -- ƥץ졼ȼưǽ󶡤ޤʥƥץ졼ȼưǽȡ -- X2, XCL2.1, ImpressCMS륳ȯΨ夷ޤ - - -ƥץ졼ȼưǽ - -DBƥץ졼ȤԽݤˤϡե򹹿ǡưŪDBƥץ졼ȤȿǤƤ뵡ǽȡȤƤⳫȯΨ夷ޤaltsysǤϡ3ĤΥѥ󶡤ޤ - -(1)ơƥץ졼ȼưǽ -Ȥơ޳ȯԤˤȤäʵǽǤ -mainfile.phpcommon.phpɹԤľˡʲΤ褦ˣޤ -[code] - include XOOPS_ROOT_PATH."/include/common.php"; - [color=ff0000] - include XOOPS_TRUST_PATH."/libs/altsys/include/autoupdate_from_theme.inc.php" ; - [/color] -[/code] -ˤꡢ򤵤줿ơtemplates/ե֤줿ƥץ졼ȤưŪɤ߹褦ˤʤޤ - -(2)⥸塼ƥץ졼ȼưǽ -⥸塼볫ȯԤˤȤäʵǽǤ -mainfile.phpcommon.phpɹԤľˡʲΤ褦ˣޤ -[code] - include XOOPS_ROOT_PATH."/include/common.php"; - [color=ff0000] - $tplsadmin_autoupdate_dirnames = array( 'piCal' ) ; - include XOOPS_TRUST_PATH."/libs/altsys/include/autoupdate_from_module.inc.php" ; - [/color] -[/code] -Τ褦˵Ҥ뤳ȤǡpiCal⥸塼Υƥץ졼ȤθեԽǡ¨˥ǡ١ȿǤޤincludeˡ$tplsadmin_autoupdate_dirnames򥻥åȤƤȤפǤ -ʣΥ⥸塼Ʊꤹ뤳ȤǽǤarray( 'piCal' , 'tinyd0' ) Τ褦˻ꤷޤ - -(3)TRUST_PATHƥץ졼ȼưǽ -D3⥸塼볫ȯԤˤȤäʵǽǤ -mainfile.phpcommon.phpɹԤľˡʲΤ褦ˣޤ -[code] - include XOOPS_ROOT_PATH."/include/common.php"; - [color=ff0000] - $tplsadmin_autoupdate_mydirnames = array( 'pico' , 'd3forum' ) ; - include XOOPS_TRUST_PATH."/libs/altsys/include/autoupdate_from_d3module.inc.php" ; - [/color] -[/code] -Τ褦˵Ҥ뤳Ȥǡpico⥸塼d3forumΥƥץ졼ȤθեԽǡ¨˥ǡ١ȿǤޤincludeˡ$tplsadmin_autoupdate_mydirnames򥻥åȤƤȤפǤ - -(1)(3)Τ⡢ʻѤǽǤ - - -̥ơ޵ǽ - -̤򡢸ѤΥơޤɽޤˤꡢ̤̤Ʊ̤ǥ쥹ѤǤ褦ˤʤꡢѼԤˤȤäƤΰ´ʤʤåȤޤȤΤ⡢ơޡƥץ졼ȥ٥ǤǤ夵뤳ȤǤޤ - -פˤäͭˡ㤤ޤʲŪXOOPS2.2ˤбƤޤ - -(1) XOOPS2.0.x -mainfile.php common.phpɹԤľˡʲΣԤޤ -[code] - include XOOPS_TRUST_PATH.'/libs/altsys/include/admin_in_theme.inc.php' ; -[/code] -̵ˤϡΣԤƤ - -(2) XOOPS Cube Legacy 2.1 -settings/site_custom.ini.php ˰ʲιԤޤʤΥե뤬ʤк -[code] -[RenderSystems] -Legacy_AdminRenderSystem=Legacy_AltsysAdminRenderSystem - -[Legacy_AltsysAdminRenderSystem] -path=/modules/altsys/include -class=Legacy_AltsysAdminRenderSystem -[/code] -̵ˤϡιԤƤ - -̥ơޤϡaltsysΰǻꤷޤ -Ĥޤꡢ¦ơޤȴ¦ơޤ̡ΤΤǤޤ -ˤǤ⡢̥ơޤ̵뤳ȤǤޤ -ȯˤϡˡȤΤǤ - -ۤȤɤΥ֥ḁ̊ơޤɽ뤳ȤǽǤ֥åǡڡפȻꤷƤ̤ˤɽޤALTSYS⥸塼Фɽꤵ줿֥åɽޤ̤ˤ̤ˤɽ֥åǤСڡפȡALTSYSפCTRL+åξ򤷤Ƥ - -̤ǤΥϥޥ򤱤뤿ˡ̤ˤϤʤ餺˥塼֥åɽޤŪɽ򤷤Ƥʤ硢֥åΰ־˶ޤɽꤵƤСΤޤɽޤ - - -˥塼 - -0.4顢ִ˥塼ץ֥åaltsysˤĤޤ֥å顢ALTSYS⥸塼Фɽꤹ뤳Ȥǡ˥֥åɽޤ󤳤ϡ̥ơޤͭˤʤäƤΤߤǤ - -XOOPS2.0.x ˤơ̤̾ѤƤʴ̥ơޤѤƤʤˡaltsysΡִѥ˥塼ν񤭴פ̣ޤƤߤƤˤäƤ⤷̤ʤäʤ顢cache/adminmenu.php ȤեƤ顢餿ƴ̤줷ޤʳǧ̤ǡ֤Ϥפ򲡤Ƥ - - -ե륪С饤 - -0.5ե륪С饤ɵǽaltsysˤĤޤ顢⥸塼->->եǡɬפʬ񤭴Ǥ - -줬ͭˤʤʤ¿դɬפǤ - -D3LanguageManagerб⥸塼ǤС̵ͭ˵ǽޤʳΥ⥸塼ˤĤƤϡСˤ󤬤ޤ - -XoopsCube Legacy2.1ǤкǤñǤźդpreloadͭˤǤǰŪʥ⥸塼Ͻ񤭴ǽǤ - -XOOPS2ˤĤơεǽͭˤ뤿ˤϡHackɬפˤʤäƤޤޤեζɹ񤭴ˤʤ뤿ᡢŪϡɥ⤯ޤꤪᤷޤ󡣡ʤ⤳ǤϽ񤭤ޤ - -[/xlang:ja] diff --git a/xoops_trust_path/libs/altsys/TODO b/xoops_trust_path/libs/altsys/TODO deleted file mode 100644 index 6aa3751..0000000 --- a/xoops_trust_path/libs/altsys/TODO +++ /dev/null @@ -1,37 +0,0 @@ -x myblocksadmin ΰ̤ -x xoops 2.2 б -x ѡߥåǧ (äget_ put_ compilehook) -x ֥åΥ˥塼 -x autoupdate_from_module.inc.php μ -x Υå -x system⥸塼ʸäƤ -x optionsνå -x argonˤȤäƤ餦:-) -x ̥˥塼եå - -importing avaman -hasMainʤ⥸塼Υ⥸塼륢 -2.0.14ʹߤɽɡˤ롩 - -altsysΤθС饤ɥƥ -Legacyʳglobal.phpԽ -Legacyʳadmin.phpNotice̤˽Ф - -gzipžȴ̥ơޤȤΥХåƥ󥰤Ĵ٤ - - - - - -= Premissions = -mypreferences -> module_admin of the module -myblocksadmin -> module_admin of altsys (old XOOPS_SYSTEM_BLOCK) -mytplsadmin,mytplsform -> module_admin of altsys (old XOOPS_SYSTEM_TPLSET) -compilehookadmin,get_*,put_* -> module_admin of altsys -mylangadmin -> module_admin of altsys - - -= Pending = -myblocksadmin edit "Visible In" for 2.2 -custom block preview for 2.2 - diff --git a/xoops_trust_path/libs/altsys/admin_menu.php b/xoops_trust_path/libs/altsys/admin_menu.php index 12e2f82..10e67cc 100644 --- a/xoops_trust_path/libs/altsys/admin_menu.php +++ b/xoops_trust_path/libs/altsys/admin_menu.php @@ -1,48 +1,58 @@ _MI_ALTSYS_MENU_CUSTOMBLOCKS , - 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=__CustomBlocks__' , - ) , - array( - 'title' => _MI_ALTSYS_MENU_NEWCUSTOMBLOCK , - 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=__CustomBlocks__&op=edit' , - 'show' => false , - ) , - array( - 'title' => _MI_ALTSYS_MENU_MYBLOCKSADMIN , - 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin' , - ) , - array( - 'title' => _MI_ALTSYS_MENU_MYTPLSADMIN , - 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mytplsadmin' , - ) , - array( - 'title' => _MI_ALTSYS_MENU_COMPILEHOOKADMIN , - 'link' => 'admin/index.php?mode=admin&lib=altsys&page=compilehookadmin' , - ) , - array( - 'title' => _MI_ALTSYS_MENU_MYLANGADMIN , - 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mylangadmin' , - ) , -/* array( - 'title' => _MI_ALTSYS_MENU_MYAVATAR , - 'link' => 'index.php?mode=admin&lib=altsys&page=myavatar' , - ) ,*/ -/* array( - 'title' => _MI_ALTSYS_MENU_MYSMILEY , - 'link' => 'index.php?mode=admin&lib=altsys&page=mysmiley' , - ) ,*/ -) ; +$adminmenu = [ + [ + 'title' => _MI_ALTSYS_MENU_CUSTOMBLOCKS, + 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=__CustomBlocks__', + ], + [ + 'title' => _MI_ALTSYS_MENU_NEWCUSTOMBLOCK, + 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=__CustomBlocks__&op=edit', + 'show' => false, + ], + [ + 'title' => _MI_ALTSYS_MENU_MYBLOCKSADMIN, + 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', + ], + [ + 'title' => _MI_ALTSYS_MENU_MYTPLSADMIN, + 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mytplsadmin', + ], + [ + 'title' => _MI_ALTSYS_MENU_COMPILEHOOKADMIN, + 'link' => 'admin/index.php?mode=admin&lib=altsys&page=compilehookadmin', + ], + [ + 'title' => _MI_ALTSYS_MENU_MYLANGADMIN, + 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mylangadmin', + ], + /* array( + 'title' => _MI_ALTSYS_MENU_MYAVATAR , + 'link' => 'index.php?mode=admin&lib=altsys&page=myavatar' , + ) ,*/ + /* array( + 'title' => _MI_ALTSYS_MENU_MYSMILEY , -$adminmenu4altsys = array( - array( - 'title' => 'ALTSYS '._PREFERENCES , - 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mypreferences' , - ) , -) ; + 'link' => 'index.php?mode=admin&lib=altsys&page=mysmiley' , + ) ,*/ +]; + +$adminmenu4altsys = [ + [ + 'title' => _PREFERENCES, + 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mypreferences', + ], +]; diff --git a/xoops_trust_path/libs/altsys/blocks.php b/xoops_trust_path/libs/altsys/blocks.php index d3a3721..c2dea6a 100644 --- a/xoops_trust_path/libs/altsys/blocks.php +++ b/xoops_trust_path/libs/altsys/blocks.php @@ -1,21 +1,31 @@ getVar("mid") ; + if (is_object(@$GLOBALS['xoopsModule'])) { + $mid_selected = $GLOBALS['xoopsModule']->getVar('mid'); // for system->preferences - if ($mid_selected == 1 && @$_GET["fct"] == "preferences" && @$_GET["op"] == "showmod" && ! empty($_GET["mod"])) { - $mid_selected = intval($_GET["mod"]) ; + if (1 == $mid_selected && 'preferences' == @$_GET['fct'] && 'showmod' == @$_GET['op'] && !empty($_GET['mod'])) { + $mid_selected = (int)$_GET['mod']; } } else { - $mid_selected = 0 ; + $mid_selected = 0; } $db =& XoopsDatabaseFactory::getDatabaseConnection(); + (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance(); $module_handler =& xoops_gethandler('module'); + $current_module =& $module_handler->getByDirname($mydirname); + $config_handler =& xoops_gethandler('config'); - $current_configs = $config_handler->getConfigList($current_module->mid()) ; + + $current_configs = $config_handler->getConfigList($current_module->mid()); + $moduleperm_handler =& xoops_gethandler('groupperm'); + $admin_mids = $moduleperm_handler->getItemIds('module_admin', $xoopsUser->getGroups()); - $modules = $module_handler->getObjects(new Criteria('mid', '('.implode(',', $admin_mids) . ')', 'IN'), true) ; - $block = array( - 'mydirname' => $mydirname , - 'mod_url' => XOOPS_URL.'/modules/'.$mydirname , - 'mod_imageurl' => XOOPS_URL.'/modules/'.$mydirname.'/'.$current_configs['images_dir'] , - 'mod_config' => $current_configs , - ) ; + $modules = $module_handler->getObjects(new Criteria('mid', '(' . implode(',', $admin_mids) . ')', 'IN'), true); + + $block = [ + 'mydirname' => $mydirname, + 'mod_url' => XOOPS_URL . '/modules/' . $mydirname, + 'mod_imageurl' => XOOPS_URL . '/modules/' . $mydirname . '/' . $current_configs['images_dir'], + 'mod_config' => $current_configs, + ]; foreach ($modules as $mod) { - $mid = intval($mod->getVar('mid')) ; - $dirname = $mod->getVar('dirname') ; - $modinfo = $mod->getInfo() ; - $submenus4assign = array() ; - $adminmenu = array() ; - $adminmenu4altsys = array() ; - unset($adminmenu_use_altsys) ; - @include XOOPS_ROOT_PATH.'/modules/'.$dirname.'/'.@$modinfo['adminmenu'] ; + + $mid = (int)$mod->getVar('mid'); + + $dirname = $mod->getVar('dirname'); + + // TODO gigamaster add module icon + $moduleIcon = ''; + $modinfo = $mod->getInfo(); + + $submenus4assign = []; + + $adminmenu = []; + + $adminmenu4altsys = []; + + unset($adminmenu_use_altsys); + + @include XOOPS_ROOT_PATH . '/modules/' . $dirname . '/' . @$modinfo['adminmenu']; // from admin_menu.php etc. - $adminmenu = array_merge($adminmenu, $adminmenu4altsys) ; + + $adminmenu = array_merge($adminmenu, $adminmenu4altsys); + foreach ($adminmenu as $sub) { - $link = empty($sub['altsys_link']) ? $sub['link'] : $sub['altsys_link'] ; - if (isset($sub['show']) && $sub['show'] === false) { - continue ; + $link = empty($sub['altsys_link']) ? $sub['link'] : $sub['altsys_link']; + if (isset($sub['show']) && false === $sub['show']) { + continue; } - $submenus4assign[] = array( - 'title' => $myts->makeTboxData4Show($sub['title']) , - 'url' => XOOPS_URL.'/modules/'.$dirname.'/'.htmlspecialchars($link, ENT_QUOTES) , - ) ; + $submenus4assign[] = [ + 'title' => $myts->makeTboxData4Show($sub['title']), + 'url' => XOOPS_URL . '/modules/' . $dirname . '/' . htmlspecialchars($link, ENT_QUOTES), + ]; } // for modules overriding Module.class.php (eg. Analyzer for XC) - if (empty($submenus4assign) && defined('XOOPS_CUBE_LEGACY') && ! empty($modinfo['cube_style'])) { + if (empty($submenus4assign) && defined('XOOPS_CUBE_LEGACY') && !empty($modinfo['cube_style'])) { + $module_handler =& xoops_gethandler('module'); + $module =& $module_handler->get($mid); + $moduleObj =& Legacy_Utils::createModule($module); - $modinfo['adminindex'] = $moduleObj->getAdminIndex() ; - $modinfo['adminindex_absolute'] = true ; + + $modinfo['adminindex'] = $moduleObj->getAdminIndex(); + + $modinfo['adminindex_absolute'] = true; + foreach ($moduleObj->getAdminMenu() as $sub) { - if (@$sub['show'] === false) { - continue ; + if (false === @$sub['show']) { + continue; } - $submenus4assign[] = array( - 'title' => $myts->makeTboxData4Show($sub['title']) , - 'url' => strncmp($sub['link'], 'http', 4) === 0 ? htmlspecialchars($sub['link'], ENT_QUOTES) : XOOPS_URL.'/modules/'.$dirname.'/'.htmlspecialchars($sub['link'], ENT_QUOTES) , - ) ; + $submenus4assign[] = [ + 'title' => $myts->makeTboxData4Show($sub['title']), + 'url' => 0 === strncmp($sub['link'], 'http', 4) ? htmlspecialchars($sub['link'], ENT_QUOTES) : XOOPS_URL . '/modules/' . $dirname . '/' . htmlspecialchars($sub['link'], ENT_QUOTES), + ]; } } elseif (empty($adminmenu4altsys)) { // add preferences - if ($mod->getVar('hasconfig') && ! in_array($mod->getVar('dirname'), array( 'system', 'legacy' ))) { - $submenus4assign[] = array( - 'title' => _PREFERENCES , - 'url' => htmlspecialchars(altsys_get_link2modpreferences($mid, $coretype), ENT_QUOTES) , - ) ; + if ($mod->getVar('hasconfig') && !in_array($mod->getVar('dirname'), ['system', 'legacy'])) { + $submenus4assign[] = [ + 'title' => _PREFERENCES, + 'url' => htmlspecialchars(altsys_get_link2modpreferences($mid, $coretype), ENT_QUOTES), + ]; } // add help - if (defined('XOOPS_CUBE_LEGACY') && ! empty($modinfo['help'])) { - $submenus4assign[] = array( - 'title' => _HELP , - 'url' => XOOPS_URL.'/modules/legacy/admin/index.php?action=Help&dirname='.$dirname , - ) ; + if (defined('XOOPS_CUBE_LEGACY') && !empty($modinfo['help'])) { + $submenus4assign[] = [ + 'title' => _HELP, + 'url' => XOOPS_URL . '/modules/legacy/admin/index.php?action=Help&dirname=' . $dirname, + ]; } } - - $module4assign = array( - 'mid' => $mid , - 'dirname' => $dirname , - 'name' => $mod->getVar('name') , - 'version_in_db' => sprintf('%.2f', $mod->getVar('version') / 100.0) , - 'version_in_file' => sprintf('%.2f', $modinfo['version']) , - 'description' => htmlspecialchars(@$modinfo['description'], ENT_QUOTES) , - 'image' => htmlspecialchars($modinfo['image'], ENT_QUOTES) , - 'isactive' => $mod->getVar('isactive') , - 'hasmain' => $mod->getVar('hasmain') , - 'hasadmin' => $mod->getVar('hasadmin') , - 'hasconfig' => $mod->getVar('hasconfig') , - 'weight' => $mod->getVar('weight') , - 'adminindex' => htmlspecialchars(@$modinfo['adminindex'], ENT_QUOTES) , - 'adminindex_absolute' => @$modinfo['adminindex_absolute'] , - 'submenu' => $submenus4assign , - 'selected' => $mid == $mid_selected ? true : false , - 'dot_suffix' => $mid == $mid_selected ? 'selected_opened' : 'closed' , - ) ; - $block['modules'][] = $module4assign ; + // TODO gigamaster add module icon + $module4assign = [ + 'mid' => $mid, + 'dirname' => $dirname, + 'name' => $mod->getVar('name'), + 'icon' => $moduleIcon, + 'version_in_db' => sprintf('%.2f', $mod->getVar('version') / 100.0), + 'version_in_file' => sprintf('%.2f', $modinfo['version']), + 'description' => htmlspecialchars(@$modinfo['description'], ENT_QUOTES), +// 'image' => htmlspecialchars($modinfo['image'], ENT_QUOTES), + 'isactive' => $mod->getVar('isactive'), + 'hasmain' => $mod->getVar('hasmain'), + 'hasadmin' => $mod->getVar('hasadmin'), + 'hasconfig' => $mod->getVar('hasconfig'), + 'weight' => $mod->getVar('weight'), + 'adminindex' => htmlspecialchars(@$modinfo['adminindex'], ENT_QUOTES), + 'adminindex_absolute' => @$modinfo['adminindex_absolute'], + 'submenu' => $submenus4assign, + //'selected' => $mid == $mid_selected ? true : false, TODO gigamaster check + 'selected' => $mid == $mid_selected, + 'dot_suffix' => $mid == $mid_selected ? 'selected_opened' : 'closed', + ]; + $block['modules'][] = $module4assign; } - require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; - $tpl = new D3Tpl() ; - $tpl->assign('block', $block) ; - $ret['content'] = $tpl->fetch($this_template) ; - return $ret ; + require_once XOOPS_TRUST_PATH . '/libs/altsys/class/D3Tpl.class.php'; + + $tpl = new D3Tpl(); + + $tpl->assign('block', $block); + + $ret['content'] = $tpl->fetch($this_template); + + return $ret; } function b_altsys_admin_menu_edit($options) { - $mydirname = empty($options[0]) ? 'd3forum' : $options[0] ; - $this_template = empty($options[1]) ? 'db:'.$mydirname.'_block_admin_menu.html' : trim($options[1]) ; + $mydirname = empty($options[0]) ? 'd3forum' : $options[0]; + + $this_template = empty($options[1]) ? 'db:' . $mydirname . '_block_admin_menu.html' : trim($options[1]); if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) { - die('Invalid mydirname') ; + die('Invalid mydirname'); } $form = " - -  : - -
- \n" ; + +  : + +
+ \n"; return $form; } diff --git a/xoops_trust_path/libs/altsys/blocks/index.php b/xoops_trust_path/libs/altsys/blocks/index.php new file mode 100644 index 0000000..6a50543 --- /dev/null +++ b/xoops_trust_path/libs/altsys/blocks/index.php @@ -0,0 +1,2 @@ +paths as $val) { // delayed language constant - if (substr($val['name'], 0, 1) == '_' && defined($val['name'])) { - $ret[] = array( - 'url' => $val['url'] , - 'name' => constant($val['name']) , - ) ; - } else { - $ret[] = $val ; - } + + if ('_' == mb_substr($val['name'], 0, 1) && defined($val['name'])) { + $ret[] = [ + 'url' => $val['url'], + 'name' => constant($val['name']), + ]; + } else { + $ret[] = $val; + } } - unset($ret[ sizeof($ret) - 1 ]['url']) ; - return $ret ; + + unset($ret[count($ret) - 1]['url']); + + return $ret; } -// all data should be escaped -public function appendPath($url_or_path, $name = '...') -{ - if (is_array($url_or_path)) { - if (empty($url_or_path['name'])) { - // multiple paths - $this->paths = array_merge($this->paths, $url_or_path) ; + /** + * all data should be escaped + * @param $url_or_path + * @param string $name + */ + public function appendPath($url_or_path, string $name = '...') + { + if (is_array($url_or_path)) { + if (empty($url_or_path['name'])) { + // multiple paths + + $this->paths = array_merge($this->paths, $url_or_path); + } else { + // array format (just a path) + + $this->paths[] = $url_or_path; + } } else { - // array format (just a path) - $this->paths[] = $url_or_path ; + // separate format + $this->paths[] = ['url' => $url_or_path, 'name' => $name]; } - } else { - // separate format - $this->paths[] = array( 'url' => $url_or_path , 'name' => $name ) ; } -} - public function hasPaths() + /** + * @return bool + */ + public function hasPaths(): bool { - return ! empty($this->paths) ; + return !empty($this->paths); } } diff --git a/xoops_trust_path/libs/altsys/class/D3LanguageManager.class.php b/xoops_trust_path/libs/altsys/class/D3LanguageManager.class.php index c0e5e55..144c6ca 100644 --- a/xoops_trust_path/libs/altsys/class/D3LanguageManager.class.php +++ b/xoops_trust_path/libs/altsys/class/D3LanguageManager.class.php @@ -1,113 +1,153 @@ language = preg_replace('/[^0-9a-zA-Z_-]/', '', @$GLOBALS['xoopsConfig']['language']) ; - $this->salt = substr(md5(XOOPS_ROOT_PATH . XOOPS_DB_USER . XOOPS_DB_PREFIX), 0, 6) ; - $this->cache_path = XOOPS_TRUST_PATH.'/cache' ; + public $cache_path; - if (defined('ALTSYS_MYLANGUAGE_ROOT_PATH') && file_exists(ALTSYS_MYLANGUAGE_ROOT_PATH)) { - $this->my_language = ALTSYS_MYLANGUAGE_ROOT_PATH ; - } -} -//HACK by domifara for php5.3+ -//function &getInstance( $conn = null ) -public static function &getInstance($conn = null) -{ - static $instance ; - if (! isset($instance)) { - $instance = new D3LanguageManager() ; + public $cache_prefix = 'lang'; + + public $my_language = false; + + + /** + * D3LanguageManager constructor. + */ + public function __construct() + { + $this->language = preg_replace('/[^0-9a-zA-Z_-]/', '', @$GLOBALS['xoopsConfig']['language']); + + $this->salt = mb_substr(md5(XOOPS_ROOT_PATH . XOOPS_DB_USER . XOOPS_DB_PREFIX), 0, 6); + + $this->cache_path = XOOPS_TRUST_PATH . '/cache'; + + if (defined('ALTSYS_MYLANGUAGE_ROOT_PATH') && file_exists(ALTSYS_MYLANGUAGE_ROOT_PATH)) { + $this->my_language = ALTSYS_MYLANGUAGE_ROOT_PATH; + } } - return $instance ; -} - public function read($resource, $mydirname, $mytrustdirname = null, $read_once = true) + /** + * @param null $conn + * @return \D3LanguageManager + */ + public static function getInstance($conn = null) + { + static $instance; + + if (!isset($instance)) { + $instance = new self(); + } + + return $instance; + } + + /** + * @param $resource + * @param $mydirname + * @param null $mytrustdirname + * @param bool $read_once + */ + public function read($resource, $mydirname, $mytrustdirname = null, bool $read_once = true) { - $d3file = XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/mytrustdirname.php' ; + $d3file = XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/mytrustdirname.php'; - if (empty($mytrustdirname) && file_exists($d3file)) { - require $d3file ; + if (empty($mytrustdirname) && is_file($d3file)) { + require $d3file; } if (empty($this->language)) { - $this->language = preg_replace('/[^0-9a-zA-Z_-]/', '', @$GLOBALS['xoopsConfig']['language']) ; + $this->language = preg_replace('/[^0-9a-zA-Z_-]/', '', @$GLOBALS['xoopsConfig']['language']); } - $cache_file = $this->getCacheFileName($resource, $mydirname) ; - $root_file = XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/language/'.$this->language.'/'.$resource ; + $cache_file = $this->getCacheFileName($resource, $mydirname); + + $root_file = XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/language/' . $this->language . '/' . $resource; - // language overriding by XOOPS_ROOT_PATH/my_language - if ($this->my_language) { - $mylang_file = $this->my_language.'/modules/'.$mydirname.'/'.$this->language.'/'.$resource ; - if (file_exists($mylang_file)) { - require_once $mylang_file ; + // language overriding by XOOPS_ROOT_PATH/my_language + if ($this->my_language) { + $mylang_file = $this->my_language . '/modules/' . $mydirname . '/' . $this->language . '/' . $resource; + + if (is_file($mylang_file)) { + require_once $mylang_file; + } + + $original_error_level = error_reporting(); + + error_reporting($original_error_level & ~E_NOTICE); } - $original_error_level = error_reporting() ; - error_reporting($original_error_level & ~ E_NOTICE) ; - } if (empty($mytrustdirname)) { // conventional module - $default_file = XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/language/'.$this->default_language.'/'.$resource ; + $default_file = XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/language/' . $this->default_language . '/' . $resource; - if (file_exists($cache_file)) { - require_once $cache_file ; - } elseif (file_exists($root_file)) { - require_once $root_file ; - } elseif (file_exists($default_file)) { + if (is_file($cache_file)) { + require_once $cache_file; + } elseif (is_file($root_file)) { + require_once $root_file; + } elseif (is_file($default_file)) { // fall back english - require_once $default_file ; + + require_once $default_file; } } else { // D3 modules - $trust_file = XOOPS_TRUST_PATH.'/modules/'.$mytrustdirname.'/language/'.$this->language.'/'.$resource ; - $default_file = XOOPS_TRUST_PATH.'/modules/'.$mytrustdirname.'/language/'.$this->default_language.'/'.$resource ; - - if (file_exists($cache_file)) { - require_once $cache_file ; - } elseif (file_exists($root_file)) { - require_once $root_file ; - } elseif (file_exists($trust_file)) { + $trust_file = XOOPS_TRUST_PATH . '/modules/' . $mytrustdirname . '/language/' . $this->language . '/' . $resource; + + $default_file = XOOPS_TRUST_PATH . '/modules/' . $mytrustdirname . '/language/' . $this->default_language . '/' . $resource; + + if (is_file($cache_file)) { + require_once $cache_file; + } elseif (is_file($root_file)) { + require_once $root_file; + } elseif (is_file($trust_file)) { if ($read_once) { - require_once $trust_file ; + require_once $trust_file; } else { - require $trust_file ; + require $trust_file; + } + } elseif (is_file($default_file)) { + // fall back to english + if ($read_once) { + require_once $default_file; + } else { + require $default_file; } - } elseif (file_exists($default_file)) { - // fall back english - if ($read_once) { - require_once $default_file ; - } else { - require $default_file ; - } } } if ($this->my_language) { - error_reporting($original_error_level) ; + error_reporting($original_error_level); } } - + /** + * @param $resource + * @param $mydirname + * @param null $language + * @return string + */ public function getCacheFileName($resource, $mydirname, $language = null) { if (empty($language)) { - $language = $this->language ; + $language = $this->language; } - return $this->cache_path . '/' . $this->cache_prefix . '_' . $this->salt . '_' . $mydirname . '_' . $language . '_' . $resource ; + + return $this->cache_path . '/' . $this->cache_prefix . '_' . $this->salt . '_' . $mydirname . '_' . $language . '_' . $resource; } } diff --git a/xoops_trust_path/libs/altsys/class/D3NotificationHandler.class.php b/xoops_trust_path/libs/altsys/class/D3NotificationHandler.class.php index 49ab743..44007ea 100644 --- a/xoops_trust_path/libs/altsys/class/D3NotificationHandler.class.php +++ b/xoops_trust_path/libs/altsys/class/D3NotificationHandler.class.php @@ -1,62 +1,145 @@ getByDirname($mydirname) ; + $module_handler =& xoops_gethandler('module'); + + $module =& $module_handler->getByDirname($mydirname); + + $notification_handler = xoops_gethandler('notification'); + + $mail_template_dir = $this->getMailTemplateDir($mydirname, $mytrustdirname); + + // calling a delegate before + if (class_exists('XCube_DelegateUtils')) { + $force_return = false; + + //Gigamaster fixed deprecated XCube_DelegateUtils::raiseEvent(). Use call() + XCube_DelegateUtils::call( + 'D3NotificationHandler.Trigger', + new XCube_Ref($category), + new XCube_Ref($event), + new XCube_Ref($item_id), + new XCube_Ref($extra_tags), + new XCube_Ref($module), + new XCube_Ref($user_list), + new XCube_Ref($omit_user_id), + $module->getInfo('notification'), + new XCube_Ref($force_return), + new XCube_Ref($mail_template_dir), + $mydirname, + $mytrustdirname + ); + + if ($force_return) { + return; + } + } + + $mid = $module->getVar('mid'); + + // Check if event is enabled + + $configHandler =& xoops_getHandler('config'); - $notification_handler =& xoops_gethandler('notification') ; - $mail_template_dir = $this->getMailTemplateDir($mydirname, $mytrustdirname) ; + $mod_config =& $configHandler->getConfigsByCat(0, $mid); // calling a delegate before if (class_exists('XCube_DelegateUtils')) { - $force_return = false ; - XCube_DelegateUtils::raiseEvent('D3NotificationHandler.Trigger', new XCube_Ref($category), new XCube_Ref($event), new XCube_Ref($item_id), new XCube_Ref($extra_tags), new XCube_Ref($module), new XCube_Ref($user_list), new XCube_Ref($omit_user_id), $module->getInfo('notification'), new XCube_Ref($force_return), new XCube_Ref($mail_template_dir), $mydirname, $mytrustdirname) ; + + //Gigamaster fixed deprecated XCube_DelegateUtils::raiseEvent(). Use call() + XCube_DelegateUtils::call( + 'D3NotificationHandler.Trigger', + new XCube_Ref($category), + new XCube_Ref($event), + new XCube_Ref($item_id), + new XCube_Ref($extra_tags), + new XCube_Ref($module), + new XCube_Ref($user_list), + new XCube_Ref($omit_user_id), + $module->getInfo('notification'), + new XCube_Ref($force_return), + new XCube_Ref($mail_template_dir), + $mydirname, + $mytrustdirname) ; if ($force_return) { return ; } @@ -85,24 +168,29 @@ public function triggerEvent($mydirname, $mytrustdirname, $category, $item_id, $ } } $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('not_modid', intval($mid))); + $criteria->add(new Criteria('not_modid', (int)$mid)); $criteria->add(new Criteria('not_category', $category)); - $criteria->add(new Criteria('not_itemid', intval($item_id))); + $criteria->add(new Criteria('not_itemid', (int)$item_id)); $criteria->add(new Criteria('not_event', $event)); $mode_criteria = new CriteriaCompo(); $mode_criteria->add(new Criteria('not_mode', XOOPS_NOTIFICATION_MODE_SENDALWAYS), 'OR'); $mode_criteria->add(new Criteria('not_mode', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE), 'OR'); $mode_criteria->add(new Criteria('not_mode', XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT), 'OR'); $criteria->add($mode_criteria); - $notifications =& $notification_handler->getObjects($criteria); + + $notifications = &$notification_handler->getObjects($criteria); + if (empty($notifications)) { return; } - // Add some tag substitutions here - $tags = array(); - // {X_ITEM_NAME} {X_ITEM_URL} {X_ITEM_TYPE} from lookup_func are disabled - $tags['X_MODULE'] = $module->getVar('name', 'n'); + // Add some tag substitutions here + + $tags = []; + + // {X_ITEM_NAME} {X_ITEM_URL} {X_ITEM_TYPE} from lookup_func are disabled + $tags['X_MODULE'] = $module->getVar('name', 'n'); + $tags['X_MODULE_URL'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/'; $tags['X_NOTIFY_CATEGORY'] = $category; $tags['X_NOTIFY_EVENT'] = $event; @@ -116,12 +204,14 @@ public function triggerEvent($mydirname, $mytrustdirname, $category, $item_id, $ foreach ($notifications as $notification) { $send_uid = $notification->getVar('not_uid'); if ((empty($omit_user_id) || $send_uid != $omit_user_id) - && - (!$user_list || isset($user_list[$send_uid]))) { + && (!$user_list || isset($user_list[$send_uid]))) { // user-specific tags - //$tags['X_UNSUBSCRIBE_URL'] = 'TODO'; - // TODO: don't show unsubscribe link if it is 'one-time' ?? - $tags['X_UNSUBSCRIBE_URL'] = XOOPS_URL . '/notifications.php'; + // $tags['X_UNSUBSCRIBE_URL'] = 'TODO'; + + // TODO: don't show unsubscribe link if it is 'one-time' ?? + + $tags['X_UNSUBSCRIBE_URL'] = XOOPS_URL . '/notifications.php'; + $tags = array_merge($tags, $extra_tags); $notification->notifyUser($mail_template_dir, $template, $subject, $tags); diff --git a/xoops_trust_path/libs/altsys/class/D3Tpl.class.php b/xoops_trust_path/libs/altsys/class/D3Tpl.class.php index 24ce380..293b160 100644 --- a/xoops_trust_path/libs/altsys/class/D3Tpl.class.php +++ b/xoops_trust_path/libs/altsys/class/D3Tpl.class.php @@ -1,22 +1,30 @@ plugins_dir, XOOPS_TRUST_PATH.'/libs/altsys/smarty_plugins') ; - } // for RTL users - @define('_GLOBAL_LEFT', @_ADM_USE_RTL == 1 ? 'right' : 'left') ; - @define('_GLOBAL_RIGHT', @_ADM_USE_RTL == 1 ? 'left' : 'right') ; + @define('_GLOBAL_LEFT', 1 == @_ADM_USE_RTL ? 'right' : 'left') ; + @define('_GLOBAL_RIGHT', 1 == @_ADM_USE_RTL ? 'left' : 'right') ; } } diff --git a/xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php b/xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php index 55fbb8a..3cec72d 100644 --- a/xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php +++ b/xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php @@ -1,1073 +1,1188 @@ db =& XoopsDatabaseFactory::getDatabaseConnection() ; - $this->lang = @$GLOBALS['xoopsConfig']['language'] ; - - $this->cachetime_options = array( - 0 => _NOCACHE , - 30 => sprintf(_SECONDS, 30) , - 60 => _MINUTE , - 300 => sprintf(_MINUTES, 5) , - 1800 => sprintf(_MINUTES, 30) , - 3600 => _HOUR , - 18000 => sprintf(_HOURS, 5) , - 86400 => _DAY , - 259200 => sprintf(_DAYS, 3) , - 604800 => _WEEK , - 2592000 => _MONTH , - ); - - $this->ctype_options = array( - 'H' => _MD_A_MYBLOCKSADMIN_CTYPE_HTML , - 'T' => _MD_A_MYBLOCKSADMIN_CTYPE_NOSMILE , - 'S' => _MD_A_MYBLOCKSADMIN_CTYPE_SMILE , - 'P' => _MD_A_MYBLOCKSADMIN_CTYPE_PHP , - ) ; - - $this->type_options = array( - 'C' => 'custom block' , - 'E' => 'cloned custom block' , - 'M' => 'module\'s block' , - 'D' => 'cloned module\'s block' , - 'S' => 'system block' , - ) ; - } - -//HACK by domifara for php5.3+ -//function &getInstance() -public static function &getInstance() -{ - static $instance; - if (!isset($instance)) { - $instance = new MyBlocksAdmin() ; - $instance->construct() ; - } - return $instance; -} +/** + * Altsys library (UI-Components) for D3 modules + * Class MyBlocksAdmin + * @package Altsys + * @version XCL 2.3.1 + * @author Other authors Gigamaster, 2020 XCL PHP7 + * @author Gijoe (Peak) + * @copyright (c) 2005-2022 Authors + * @license GPL v2.0 + */ -// virtual -public function checkPermission() -{ - // only groups have 'module_admin' of 'altsys' can do that. - $module_handler =& xoops_gethandler('module') ; - $module =& $module_handler->getByDirname('altsys') ; - $moduleperm_handler =& xoops_gethandler('groupperm') ; - if (! is_object(@$GLOBALS['xoopsUser']) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) { - die('only admin of altsys can access this area') ; - } -} +class MyBlocksAdmin { + public $db; + public $lang; - public function init($xoopsModule) - { - // altsys "module" MODE - if ($xoopsModule->getVar('dirname') == 'altsys') { - // set target_module if specified by $_GET['dirname'] - $module_handler =& xoops_gethandler('module'); - if (! empty($_GET['dirname'])) { - $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']) ; - $target_module =& $module_handler->getByDirname($dirname) ; - } - - if (is_object(@$target_module)) { - // module's blocks - $this->target_mid = $target_module->getVar('mid') ; - $this->target_mname = $target_module->getVar('name') . " " . sprintf("(%2.2f)", $target_module->getVar('version') / 100.0) ; - $this->target_dirname = $target_module->getVar('dirname') ; - $modinfo = $target_module->getInfo() ; - // breadcrumbs - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', '_MI_ALTSYS_MENU_MYBLOCKSADMIN') ; - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$this->target_dirname, $this->target_mname) ; - } else { - // custom blocks - $this->target_mid = 0 ; - $this->target_mname = _MI_ALTSYS_MENU_CUSTOMBLOCKS ; - $this->target_dirname = '__CustomBlocks__' ; - // breadcrumbs - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', '_MI_ALTSYS_MENU_MYBLOCKSADMIN') ; - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$this->target_dirname, '_MI_ALTSYS_MENU_CUSTOMBLOCKS') ; - } - } else { - // myblocksadmin as a library - $this->target_mid = $xoopsModule->getVar('mid') ; - $this->target_mname = $xoopsModule->getVar('name') . " " . sprintf("(%2.2f)", $xoopsModule->getVar('version') / 100.0) ; - $this->target_dirname = $xoopsModule->getVar('dirname') ; - $mod_url = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname') ; - $modinfo = $xoopsModule->getInfo() ; - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; - $breadcrumbsObj->appendPath($mod_url.'/'.@$modinfo['adminindex'], $this->target_mname) ; - $breadcrumbsObj->appendPath($mod_url.'/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', _MD_A_MYBLOCKSADMIN_BLOCKADMIN) ; - } - - // read xoops_version.php of the target - $this->block_configs = $this->get_block_configs() ; - } - - -// virtual -public function canEdit($block) -{ - return true ; -} + public $cachetime_options = []; + public $ctype_options = []; -// virtual -public function canDelete($block) -{ - // can delete if it is a cloned block - if ($block->getVar("block_type") == 'D' || $block->getVar("block_type") == 'C') { - return true ; - } else { - return false ; - } -} + public $type_options = []; + public $target_mid = 0; -// virtual -// ret 0 : cannot -// ret 1 : forced by altsys or system -// ret 2 : can_clone -public function canClone($block) -{ - // can clone link if it is marked as cloneable block - if ($block->getVar("block_type") == 'D' || $block->getVar("block_type") == 'C') { - return 2 ; - } else { - // $modversion['blocks'][n]['can_clone'] - foreach ($this->block_configs as $bconf) { - if ($block->getVar("show_func") == @$bconf['show_func'] && $block->getVar("func_file") == @$bconf['file'] && (empty($bconf['template']) || $block->getVar("template") == @$bconf['template'])) { - if (! empty($bconf['can_clone'])) { - return 2 ; - } - } - } - } - - if (! empty($GLOBALS['altsysModuleConfig']['enable_force_clone'])) { - return 1 ; - } - - return 0 ; -} + public $target_dirname = ''; + public $target_mname = ''; -// virtual -// options -public function renderCell4BlockOptions($block_data) -{ - $bid = intval($block_data['bid']) ; - -//HACK by domifara - if (defined('XOOPS_CUBE_LEGACY')) { - $handler =& xoops_gethandler('block'); - $block =& $handler->create(false) ; - $block->load($bid) ; - } else { - $block = new XoopsBlock($bid) ; - } - return $block->getOptions() ; -} + public $block_configs = []; + public $preview_request = []; -// virtual -// link blocks - modules -public function renderCell4BlockModuleLink($block_data) -{ - $bid = intval($block_data['bid']) ; - - // get selected targets - if (is_array(@$block_data['bmodule'])) { - // bmodule origined from request (preview etc.) - $selected_mids = $block_data['bmodule'] ; - } else { - // origined from the table of `block_module_link` - $result = $this->db->query("SELECT module_id FROM ".$this->db->prefix('block_module_link')." WHERE block_id='$bid'") ; - $selected_mids = array(); - while (list($selected_mid) = $this->db->fetchRow($result)) { - $selected_mids[] = intval($selected_mid) ; - } - if (empty($selected_mids)) { - $selected_mids = array( 0 ) ; - } // all pages - } - - // get all targets - $module_handler =& xoops_gethandler('module'); - $criteria = new CriteriaCompo(new Criteria('hasmain', 1)); - $criteria->add(new Criteria('isactive', 1)); - $module_list = $module_handler->getList($criteria); - $module_list= array( -1 => _MD_A_MYBLOCKSADMIN_TOPPAGE , 0 => _MD_A_MYBLOCKSADMIN_ALLPAGES ) + $module_list ; - - // build options - $module_options = '' ; - foreach ($module_list as $mid => $mname) { - $mname = htmlspecialchars($mname) ; - if (in_array($mid, $selected_mids)) { - $module_options .= "\n" ; - } else { - $module_options .= "\n" ; - } - } - - $ret = " - " ; - - return $ret ; -} + public function MyBlocksAadmin() { + } + public function construct() { + $this->db =& XoopsDatabaseFactory::getDatabaseConnection(); -// virtual -// group_permission - 'block_read' -public function renderCell4BlockReadGroupPerm($block_data) -{ - $bid = intval($block_data['bid']) ; - - // get selected targets - if (is_array(@$block_data['bgroup'])) { - // bgroup origined from request (preview etc.) - $selected_gids = $block_data['bgroup'] ; - } else { - // origined from the table of `group_perm` - $result = $this->db->query("SELECT gperm_groupid FROM ".$this->db->prefix('group_permission')." WHERE gperm_itemid='$bid' AND gperm_name='block_read'") ; - $selected_gids = array(); - while (list($selected_gid) = $this->db->fetchRow($result)) { - $selected_gids[] = intval($selected_gid) ; - } - if ($bid == 0 && empty($selected_gids)) { - $selected_gids = $GLOBALS['xoopsUser']->getGroups() ; - } - } - - // get all targets - $group_handler =& xoops_gethandler('group'); - $groups = $group_handler->getObjects() ; - - // build options - $group_options = '' ; - foreach ($groups as $group) { - $gid = $group->getVar('groupid') ; - $gname = $group->getVar('name', 's') ; - if (in_array($gid, $selected_gids)) { - $group_options .= "\n" ; - } else { - $group_options .= "\n" ; - } - } - - $ret = " - " ; - - return $ret ; -} + $this->lang = @$GLOBALS['xoopsConfig']['language']; + $this->cachetime_options = [ + 0 => _NOCACHE, + 30 => sprintf( _SECONDS, 30 ), + 60 => _MINUTE, + 300 => sprintf( _MINUTES, 5 ), + 1800 => sprintf( _MINUTES, 30 ), + 3600 => _HOUR, + 18000 => sprintf( _HOURS, 5 ), + 86400 => _DAY, + 259200 => sprintf( _DAYS, 3 ), + 604800 => _WEEK, + 2592000 => _MONTH, + ]; -// virtual -// visible and side -public function renderCell4BlockPosition($block_data) -{ - $bid = intval($block_data['bid']) ; - $side = intval($block_data['side']) ; - $visible = intval($block_data['visible']) ; - - $sseln = $ssel0 = $ssel1 = $ssel2 = $ssel3 = $ssel4 = ""; - $scoln = $scol0 = $scol1 = $scol2 = $scol3 = $scol4 = "unselected"; - $stextbox = "unselected" ; - $value4extra_side = '' ; - - if ($visible != 1) { - $sseln = " checked='checked'"; - $scoln = "disabled"; - } else { - switch ($side) { - case XOOPS_SIDEBLOCK_LEFT : - $ssel0 = " checked='checked'"; - $scol0 = "selected"; - break ; - case XOOPS_SIDEBLOCK_RIGHT : - $ssel1 = " checked='checked'"; - $scol1 = "selected"; - break ; - case XOOPS_CENTERBLOCK_LEFT : - $ssel2 = " checked='checked'"; - $scol2 = "selected"; - break ; - case XOOPS_CENTERBLOCK_RIGHT : - $ssel4 = " checked='checked'"; - $scol4 = "selected"; - break ; - case XOOPS_CENTERBLOCK_CENTER : - $ssel3 = " checked='checked'"; - $scol3 = "selected"; - break ; - default : - $value4extra_side = $side ; - $stextbox = "selected" ; - break ; - } - } + $this->ctype_options = [ + 'H' => _MD_A_MYBLOCKSADMIN_CTYPE_HTML, + 'T' => _MD_A_MYBLOCKSADMIN_CTYPE_NOSMILE, + 'S' => _MD_A_MYBLOCKSADMIN_CTYPE_SMILE, + 'P' => _MD_A_MYBLOCKSADMIN_CTYPE_PHP, + ]; - return " -
- -
-
-
-
- -
-
- -
-
- -
-
-
-
- -
-
-
-
- -
-
- -
-
"._NONE."
- " ; -} + $this->type_options = [ + 'C' => 'custom block', + 'E' => 'copied custom block', + 'M' => 'module\'s block', + 'D' => 'copied module\'s block', + 'S' => 'system block', + ]; + } + /** + * @return \MyBlocksAdmin + */ + public static function getInstance() { + static $instance; -// public -public function list_blocks() -{ - global $xoopsGTicket ; - - // main query - $sql = "SELECT * FROM ".$this->db->prefix("newblocks")." WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight" ; - $result = $this->db->query($sql) ; - $block_arr = array() ; -//HACK by domifara - if (defined('XOOPS_CUBE_LEGACY')) { - $handler =& xoops_gethandler('block');//add - } - while ($myrow = $this->db->fetchArray($result)) { - -//HACK by domifara - if (defined('XOOPS_CUBE_LEGACY')) { - $block_one =& $handler->create(false) ; - $block_one->assignVars($myrow); - $block_arr[] =& $block_one ; - } else { - $block_arr[] = new XoopsBlock($myrow) ; - } - } - if (empty($block_arr)) { - return ; - } - - // blocks rendering loop - $blocks4assign = array() ; - foreach ($block_arr as $i => $block) { - $block_data = array( - 'bid' => intval($block->getVar('bid')) , - 'name' => $block->getVar('name', 'n') , - 'title' => $block->getVar('title', 'n') , - 'weight' => intval($block->getVar('weight')) , - 'bcachetime' => intval($block->getVar('bcachetime')) , - 'side' => intval($block->getVar('side')) , - 'visible' => intval($block->getVar('visible')) , - 'can_edit' => $this->canEdit($block) , - 'can_delete' => $this->canDelete($block) , - 'can_clone' => $this->canClone($block) , - ) ; - $blocks4assign[] = array( - 'name_raw' => $block_data['name'] , - 'title_raw' => $block_data['title'] , - 'cell_position' => $this->renderCell4BlockPosition($block_data) , - 'cell_module_link' => $this->renderCell4BlockModuleLink($block_data) , - 'cell_group_perm' => $this->renderCell4BlockReadGroupPerm($block_data) , - ) + $block_data ; - } - - // display - require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; - $tpl = new D3Tpl() ; - $tpl->assign(array( - 'target_mid' => $this->target_mid, - 'target_dirname' => $this->target_dirname, - 'target_mname' => $this->target_mname, - 'language' => $this->lang, - 'cachetime_options' => $this->cachetime_options, - 'blocks' => $blocks4assign, - 'gticket_hidden' => $xoopsGTicket->getTicketHtml(__LINE__, 1800, 'myblocksadmin'), - )) ; - $tpl->display('db:altsys_main_myblocksadmin_list.html') ; -} + if ( ! isset( $instance ) ) { + $instance = new self(); + $instance->construct(); + } - public function get_block_configs() - { - if ($this->target_mid <= 0) { - return array() ; - } - include XOOPS_ROOT_PATH.'/modules/'.$this->target_dirname.'/xoops_version.php' ; - - if (empty($modversion['blocks'])) { - return array() ; - } else { - return $modversion['blocks'] ; - } - } - - - public function list_groups() - { - // query for getting blocks - $sql = "SELECT * FROM ".$this->db->prefix("newblocks")." WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight" ; - $result = $this->db->query($sql) ; - $block_arr = array() ; -//HACK by domifara - if (defined('XOOPS_CUBE_LEGACY')) { - $handler =& xoops_gethandler('block');//add - } - while ($myrow = $this->db->fetchArray($result)) { - //HACK by domifara - if (defined('XOOPS_CUBE_LEGACY')) { - $block_one =& $handler->create(false) ; - $block_one->assignVars($myrow); - $block_arr[] =& $block_one ; - } else { - $block_arr[] = new XoopsBlock($myrow) ; - } - } - - $item_list = array() ; - foreach (array_keys($block_arr) as $i) { - $item_list[ $block_arr[$i]->getVar("bid") ] = $block_arr[$i]->getVar("title") ; - } - - $form = new MyXoopsGroupPermForm(_MD_A_MYBLOCKSADMIN_PERMFORM, 1, 'block_read', '') ; - // skip system (TODO) - if ($this->target_mid > 1) { - $form->addAppendix('module_admin', $this->target_mid, $this->target_mname . ' ' . _MD_A_MYBLOCKSADMIN_PERM_MADMIN) ; - $form->addAppendix('module_read', $this->target_mid, $this->target_mname .' ' . _MD_A_MYBLOCKSADMIN_PERM_MREAD) ; - } - foreach ($item_list as $item_id => $item_name) { - $form->addItem($item_id, $item_name) ; - } - echo $form->render() ; - } - - - public function update_block($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $options=array()) - { - global $xoopsConfig; - -//HACK by domifara - if (defined('XOOPS_CUBE_LEGACY')) { - $handler =& xoops_gethandler('block'); - $block =& $handler->create(false) ; - $block->load($bid) ; - } else { - $block = new XoopsBlock($bid); - } - - if ($bside >= 0) { - $block->setVar('side', $bside); - } - $block->setVar('weight', $bweight); - $block->setVar('visible', $bvisible); - $block->setVar('title', $btitle); - if (isset($bcontent)) { - $block->setVar('content', $bcontent); - } - if (isset($bctype)) { - $block->setVar('c_type', $bctype); - } - $block->setVar('bcachetime', $bcachetime); - if (is_array($options) && count($options) > 0) { - $block->setVar('options', implode('|', $options)) ; - } - if ($block->getVar('block_type') == 'C') { - $name = $this->get_blockname_from_ctype($block->getVar('c_type')) ; - $block->setVar('name', $name); - } - $msg = _MD_A_MYBLOCKSADMIN_DBUPDATED; - if ($block->store() != false) { - include_once XOOPS_ROOT_PATH.'/class/template.php'; - $xoopsTpl = new XoopsTpl(); - $xoopsTpl->xoops_setCaching(2); - if ($block->getVar('template') != '') { - if ($xoopsTpl->is_cached('db:'.$block->getVar('template'))) { - if (!$xoopsTpl->clear_cache('db:'.$block->getVar('template'))) { - $msg = 'Unable to clear cache for block ID'.$bid; - } - } - } else { - if ($xoopsTpl->is_cached('db:system_dummy.html', 'blk_'.$bid)) { - if (!$xoopsTpl->clear_cache('db:system_dummy.html', 'blk_'.$bid)) { - $msg = 'Unable to clear cache for block ID'.$bid; - } - } - } - } else { - $msg = 'Failed update of block. ID:'.$bid; - } - return $msg ; - } - - -// virtual -public function updateBlockModuleLink($bid, $bmodules) -{ - $bid = intval($bid) ; - $table = $this->db->prefix("block_module_link") ; - - $sql = "DELETE FROM `$table` WHERE `block_id`=$bid" ; - $this->db->query($sql) ; - foreach ($bmodules as $mid) { - $mid = intval($mid) ; - $sql = "INSERT INTO `$table` (`block_id`,`module_id`) VALUES ($bid,$mid)" ; - $this->db->query($sql) ; - } -} + return $instance; + } + /** + * Virtual + */ + public function checkPermission() { + // only groups with 'module_admin' permissions. + $module_handler =& xoops_gethandler( 'module' ); -// virtual -public function updateBlockReadGroupPerm($bid, $req_gids) -{ - $bid = intval($bid) ; - $table = $this->db->prefix("group_permission") ; - $req_gids = array_map('intval', $req_gids) ; - sort($req_gids) ; - - // compare group ids from request and the records. - $sql = "SELECT `gperm_groupid` FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid" ; - $result = $this->db->query($sql) ; - $db_gids = array() ; - while (list($gid) = $this->db->fetchRow($result)) { - $db_gids[] = $gid ; - } - $db_gids = array_map('intval', $db_gids) ; - sort($db_gids) ; - - // if they are identical, just return (prevent increase of gperm_id) - if (serialize($req_gids) == serialize($db_gids)) { - return ; - } - - $sql = "DELETE FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid" ; - $this->db->query($sql) ; - foreach ($req_gids as $gid) { - $gid = intval($gid) ; - $sql = "INSERT INTO `$table` (`gperm_groupid`,`gperm_itemid`,`gperm_modid`,`gperm_name`) VALUES ($gid,$bid,1,'block_read')" ; - $this->db->query($sql) ; - } -} + $module =& $module_handler->getByDirname( 'altsys' ); + $moduleperm_handler =& xoops_gethandler( 'groupperm' ); - public function do_order() - { - $sides = is_array(@$_POST['sides']) ? $_POST['sides'] : array() ; - foreach (array_keys($sides) as $bid) { - $request = $this->fetchRequest4Block($bid) ; - - // update the block - $this->update_block($request['bid'], $request['side'], $request['weight'], $request['visible'], $request['title'], null, null, $request['bcachetime'], array()) ; - - // block_module_link update - $this->updateBlockModuleLink($bid, $request['bmodule']) ; - - // group_permission update - $this->updateBlockReadGroupPerm($bid, $request['bgroup']) ; - } - return _MD_A_MYBLOCKSADMIN_DBUPDATED ; - } - - - public function fetchRequest4Block($bid) - { - $bid = intval($bid) ; - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance() ; - - if (@$_POST['extra_sides'][$bid] > 0) { - $_POST['sides'][$bid] = intval($_POST['extra_sides'][$bid]) ; - } - - if (@$_POST['sides'][$bid] < 0) { - $visible = 0 ; - $_POST['sides'][$bid] = -1 ; - } else { - $visible = 1 ; - } - - return array( - 'bid' => $bid , - 'side' => intval(@$_POST['sides'][$bid]) , - 'weight' => intval(@$_POST['weights'][$bid]) , - 'visible' => $visible , - 'title' => $myts->stripSlashesGPC(@$_POST['titles'][$bid]) , - 'content' => $myts->stripSlashesGPC(@$_POST['contents'][$bid]) , - 'ctype' => preg_replace('/[^A-Z]/', '', @$_POST['ctypes'][$bid]) , - 'bcachetime' => intval(@$_POST['bcachetimes'][$bid]) , - 'bmodule' => is_array(@$_POST['bmodules'][$bid]) ? $_POST['bmodules'][$bid] : array( 0 ) , - 'bgroup' => is_array(@$_POST['bgroups'][$bid]) ? $_POST['bgroups'][$bid] : array() , - 'options' => is_array(@$_POST['options'][$bid]) ? $_POST['options'][$bid] : array() , - ) ; - } - - - public function do_delete($bid) - { - $bid = intval($bid) ; - -//HACK by domifara - if (defined('XOOPS_CUBE_LEGACY')) { - $handler =& xoops_gethandler('block'); - $block =& $handler->create(false) ; - $block->load($bid) ; - } else { - $block = new XoopsBlock($bid) ; - } - - if (! is_object($block)) { - die('Invalid bid') ; - } - if (! $this->canDelete($block)) { - die('Cannot delete this block') ; - } - $this->do_deleteBlockReadGroupPerm($bid); //HACK add by domifara - $block->delete() ; - return _MD_A_MYBLOCKSADMIN_DBUPDATED ; - } - -//HACK add by domifara -public function do_deleteBlockReadGroupPerm($bid) -{ - $bid = intval($bid) ; - $table = $this->db->prefix("group_permission") ; - $sql = "DELETE FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid" ; - $this->db->query($sql) ; -} + if ( ! is_object( @$GLOBALS['xoopsUser'] ) || ! $moduleperm_handler->checkRight( 'module_admin', $module->getVar( 'mid' ), $GLOBALS['xoopsUser']->getGroups() ) ) { + die( 'only admin of UI Components can access this area' ); + } + } + + /** + * @param $xoopsModule + */ + + public function init( $xoopsModule ) { + // altsys "module" MODE + + if ( 'altsys' == $xoopsModule->getVar( 'dirname' ) ) { + // set target_module if specified by $_GET['dirname'] + + $module_handler =& xoops_gethandler( 'module' ); - public function form_delete($bid) - { - $bid = intval($bid) ; - -//HACK by domifara -//HACK by domifara - if (defined('XOOPS_CUBE_LEGACY')) { - $handler =& xoops_gethandler('block'); - $block =& $handler->create(false) ; - $block->load($bid) ; - } else { - $block = new XoopsBlock($bid) ; - } - - if (! is_object($block)) { - die('Invalid bid') ; - } - if (! $this->canDelete($block)) { - die('Cannot delete this block') ; - } - - // breadcrumbs - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; - $breadcrumbsObj->appendPath('', _DELETE) ; - - xoops_confirm(array( 'op' => 'delete_ok' ) + $GLOBALS['xoopsGTicket']->getTicketArray(__LINE__, 1800, 'myblocksadmin'), "?mode=admin&lib=altsys&page=myblocksadmin&dirname=$this->target_dirname&bid=$bid", sprintf(_MD_A_MYBLOCKSADMIN_FMT_REMOVEBLOCK, $block->getVar('title'))) ; - } - - - public function do_clone($bid) - { - $bid = intval($bid) ; - - $request = $this->fetchRequest4Block($bid) ; - -//HACK by domifara - if (defined('XOOPS_CUBE_LEGACY')) { - $handler =& xoops_gethandler('block'); - $block =& $handler->create(false) ; - $block->load($bid) ; - } else { - $block = new XoopsBlock($bid) ; - } - - if (! $block->getVar('bid')) { - die('Invalid bid') ; - } - if (! $this->canClone($block)) { - die('Invalid block_type') ; - } - - if (empty($_POST['options'])) { - $options = array() ; - } elseif (is_array($_POST['options'])) { - $options = $_POST['options'] ; - } else { - $options = explode('|', $_POST['options']) ; - } - - // for backward compatibility - // $cblock =& $block->clone(); or $cblock =& $block->xoopsClone(); - -//HACK by domifara - if (defined('XOOPS_CUBE_LEGACY')) { - $cblock =& $handler->create(false) ; - } else { - $cblock = new XoopsBlock() ; - } - - foreach ($block->vars as $k => $v) { - $cblock->assignVar($k, $v['value']) ; - } - $cblock->setNew(); - $cblock->setVar('bid', 0); - $cblock->setVar('block_type', $block->getVar('block_type') == 'C' ? 'C' : 'D'); - $cblock->setVar('func_num', $this->find_func_num_vacancy($block->getVar('mid'))) ; - // store the block into DB as a new one - $newbid = $cblock->store() ; - if (! $newbid) { - return $cblock->getHtmlErrors() ; - } - - // update the block by the request - $this->update_block($newbid, $request['side'], $request['weight'], $request['visible'], $request['title'], $request['content'], $request['ctype'], $request['bcachetime'], is_array(@$_POST['options']) ? $_POST['options'] : array()) ; - - // block_module_link update - $this->updateBlockModuleLink($newbid, $request['bmodule']) ; - - // group_permission update - $this->updateBlockReadGroupPerm($newbid, $request['bgroup']) ; - - return _MD_A_MYBLOCKSADMIN_DBUPDATED ; - } - - - public function find_func_num_vacancy($mid) - { - $func_num = 256 ; - do { - $func_num -- ; - list($count) = $this->db->fetchRow($this->db->query("SELECT COUNT(*) FROM ".$this->db->prefix("newblocks")." WHERE mid=".intval($mid)." AND func_num=".$func_num)) ; - } while ($count > 0) ; - - return $func_num > 128 ? $func_num : 255 ; - } - - - public function do_edit($bid) - { - $bid = intval($bid) ; - - if ($bid <= 0) { - // new custom block - -//HACK by domifara - if (defined('XOOPS_CUBE_LEGACY')) { - $handler =& xoops_gethandler('block'); - $new_block =& $handler->create(false) ; - } else { - $new_block = new XoopsBlock() ; - } - - $new_block->setNew() ; - $new_block->setVar('name', $this->get_blockname_from_ctype('C')) ; - $new_block->setVar('block_type', 'C') ; - $new_block->setVar('func_num', 0) ; - $bid = $new_block->store() ; - $request = $this->fetchRequest4Block(0) ; - // permission copy - foreach ($GLOBALS['xoopsUser']->getGroups() as $gid) { - $sql = "INSERT INTO ".$this->db->prefix('group_permission')." (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES ($gid, $bid, 1, 'block_read')"; - $this->db->query($sql); - } - } else { - $request = $this->fetchRequest4Block($bid) ; - } - - // update the block by the request - $msg = $this->update_block($bid, $request['side'], $request['weight'], $request['visible'], $request['title'], $request['content'], $request['ctype'], $request['bcachetime'], is_array(@$_POST['options']) ? $_POST['options'] : array()) ; - - // block_module_link update - $this->updateBlockModuleLink($bid, $request['bmodule']) ; - - // group_permission update - $this->updateBlockReadGroupPerm($bid, $request['bgroup']) ; - - return $msg ; - } - - - public function form_edit($bid, $mode = 'edit') - { - $bid = intval($bid) ; - -//HACK by domifara - if (defined('XOOPS_CUBE_LEGACY')) { - $handler =& xoops_gethandler('block'); - $block =& $handler->create(false) ; - $block->load($bid) ; - } else { - $block = new XoopsBlock($bid) ; - } - - if (! $block->getVar('bid')) { - // new defaults - $bid = 0 ; - $mode = 'new' ; - $block->setVar('mid', 0) ; - $block->setVar('block_type', 'C') ; - } - - switch ($mode) { - case 'clone' : - $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM ; - $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE ; - $next_op = 'clone_ok' ; - // breadcrumbs - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM) ; - break ; - case 'new' : - $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM ; - $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW ; - $next_op = 'new_ok' ; - // breadcrumbs - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM) ; - break ; - case 'edit' : - default : - $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM ; - $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT ; - $next_op = 'edit_ok' ; - // breadcrumbs - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM) ; - break ; - } - - $is_custom = in_array($block->getVar('block_type'), array( 'C', 'E' )) ? true : false ; - $block_template = $block->getVar('template', 'n') ; - $block_template_tplset = '' ; - - if (! $is_custom && $block_template) { - // find template of the block - $tplfile_handler =& xoops_gethandler('tplfile'); - $found_templates = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', null, null, $block_template) ; - $block_template_tplset = count($found_templates) > 0 ? $GLOBALS['xoopsConfig']['template_set'] : 'default' ; - } -//HACK by domifara -/* - if ( !($block->getVar('c_type')) ){ - $block->setVar('c_type','S'); - } -*/ - $block_data = $this->preview_request + array( - 'bid' => $bid , - 'name' => $block->getVar('name', 'n') , - 'title' => $block->getVar('title', 'n') , - 'weight' => intval($block->getVar('weight')) , - 'bcachetime' => intval($block->getVar('bcachetime')) , - 'side' => intval($block->getVar('side')) , - 'visible' => intval($block->getVar('visible')) , - 'template' => $block_template , - 'template_tplset' => $block_template_tplset , - 'options' => $block->getVar('options') , - 'content' => $block->getVar('content', 'n') , - 'is_custom' => $is_custom , - 'type' => $block->getVar('block_type') , - 'ctype' => $block->getVar('c_type') , - ) ; - - $block4assign = array( - 'name_raw' => $block_data['name'] , - 'title_raw' => $block_data['title'] , - 'content_raw' => $block_data['content'] , - 'cell_position' => $this->renderCell4BlockPosition($block_data) , - 'cell_module_link' => $this->renderCell4BlockModuleLink($block_data) , - 'cell_group_perm' => $this->renderCell4BlockReadGroupPerm($block_data) , - 'cell_options' => $this->renderCell4BlockOptions($block_data) , - 'content_preview' => $this->previewContent($block_data) , - ) + $block_data ; - - // display - require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; - $tpl = new D3Tpl() ; - - //HACK by domifara - if (defined('XOOPS_CUBE_LEGACY')) { - $tpl->assign('xoops_cube_legacy', true) ; - include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; - } else { - $tpl->assign('xoops_cube_legacy', false) ; - } - - $tpl->assign(array( - 'target_dirname' => $this->target_dirname, - 'target_mname' => $this->target_mname, - 'language' => $this->lang, - 'cachetime_options' => $this->cachetime_options, - 'ctype_options' => $this->ctype_options, - 'block' => $block4assign, - 'op' => $next_op, - 'form_title' => $form_title, - 'submit_button' => $button_value, - 'common_fck_installed' => $this->checkFck(), - 'gticket_hidden' => $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 1800, 'myblocksadmin'), - )) ; - - if (defined('XOOPS_CUBE_LEGACY')) { - $tpl->display('db:altsys_main_myblocksadmin_edit_4legacy.html') ; - } else { - $tpl->display('db:altsys_main_myblocksadmin_edit.html') ; - } - return ; - } - - public function checkFck() - { - return file_exists(XOOPS_ROOT_PATH.'/common/fckeditor/fckeditor.js'); - } - - public function previewContent($block_data) - { - $bid = intval($block_data['bid']) ; - - if (! $block_data['is_custom']) { - return '' ; - } - if (empty($this->preview_request)) { - return '' ; - } - -//HACK by domifara -//TODO : need no hook block at this - $block = new XoopsBlock($bid) ; -/* - $handler =& xoops_gethandler('block'); - $block =& $handler->create(false) ; - $block->load($bid) ; -*/ - - if ($block->getVar('mid')) { - return '' ; - } - - $block->setVar('title', $block_data['title']) ; - $block->setVar('content', $block_data['content']) ; - - restore_error_handler() ; - $original_level = error_reporting(E_ALL) ; - $ret = $block->getContent('S', $block_data['ctype']) ; - error_reporting($original_level) ; - - return $ret ; - } - - - public function get_blockname_from_ctype($bctype) - { - $ctypes = array( - 'H' => _MD_A_MYBLOCKSADMIN_CTYPE_HTML , - 'S' => _MD_A_MYBLOCKSADMIN_CTYPE_SMILE , - 'N' => _MD_A_MYBLOCKSADMIN_CTYPE_NOSMILE , - 'P' => _MD_A_MYBLOCKSADMIN_CTYPE_PHP , - ) ; - - return isset($ctypes[$bctype]) ? $ctypes[$bctype] : _MD_A_MYBLOCKSADMIN_CTYPE_SMILE ; - } - - - public function processPost() - { - // Ticket Check - if (! $GLOBALS['xoopsGTicket']->check(true, 'myblocksadmin')) { - redirect_header(XOOPS_URL.'/', 3, $GLOBALS['xoopsGTicket']->getErrors()); - } - - $msg = '' ; - $bid = intval(@$_GET['bid']) ; - if (! empty($_POST['preview'])) { - // preview - $this->preview_request = $this->fetchRequest4Block($bid) ; - $_GET['op'] = str_replace('_ok', '', @$_POST['op']) ; - return ; // continue ; - } elseif (@$_POST['op'] == 'order') { - // order ok - $msg = $this->do_order() ; - } elseif (@$_POST['op'] == 'delete_ok') { - // delete ok - $msg = $this->do_delete($bid) ; - } elseif (@$_POST['op'] == 'clone_ok') { - // clone ok - $msg = $this->do_clone($bid) ; - } elseif (@$_POST['op'] == 'edit_ok' || @$_POST['op'] == 'new_ok') { - // edit ok - $msg = $this->do_edit($bid) ; - } elseif (! empty($_POST['submit'])) { - // update module_admin,module_read,block_read - include dirname(dirname(__FILE__)).'/include/mygroupperm.php' ; - $msg = _MD_A_MYBLOCKSADMIN_PERMUPDATED ; - } - - redirect_header('?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$this->target_dirname, 1, $msg) ; - exit ; - } - - - public function processGet() - { - $bid = intval(@$_GET['bid']) ; - switch (@$_GET['op']) { - case 'clone' : - $this->form_edit($bid, 'clone') ; - break ; - case 'new' : - case 'edit' : - $this->form_edit($bid, 'edit') ; - break ; - case 'delete' : - $this->form_delete($bid) ; - break ; - case 'list' : - default : - // the first form (blocks) - $this->list_blocks() ; - // the second form (groups) - $this->list_groups() ; - break ; - } - } + if ( ! empty( $_GET['dirname'] ) ) { + $dirname = preg_replace( '/[^0-9a-zA-Z_-]/', '', $_GET['dirname'] ); + + $target_module =& $module_handler->getByDirname( $dirname ); + } + + if ( is_object( @$target_module ) ) { + // module's blocks + + $this->target_mid = $target_module->getVar( 'mid' ); + + $this->target_mname = $target_module->getVar( 'name' ) . ' ' . sprintf( '(%2.2f)', $target_module->getVar( 'version' ) / 100.0 ); + //$this->target_mname = $target_module->getVar( 'name' ) . sprintf( 'v %2.2f ', $target_module->getVar( 'version' ) / 100.0 ); + + $this->target_dirname = $target_module->getVar( 'dirname' ); + + $modinfo = $target_module->getInfo(); + + // breadcrumbs + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); + + $breadcrumbsObj->appendPath( XOOPS_URL . '/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', '_MI_ALTSYS_MENU_MYBLOCKSADMIN' ); + + $breadcrumbsObj->appendPath( XOOPS_URL . '/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=' . $this->target_dirname, $this->target_mname ); + } else { + // custom blocks + $this->target_mid = 0; + + $this->target_mname = _MI_ALTSYS_MENU_CUSTOMBLOCKS; + + $this->target_dirname = '__CustomBlocks__'; + + // breadcrumbs + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); + + $breadcrumbsObj->appendPath( XOOPS_URL . '/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', '_MI_ALTSYS_MENU_MYBLOCKSADMIN' ); + + $breadcrumbsObj->appendPath( XOOPS_URL . '/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=' . $this->target_dirname, '_MI_ALTSYS_MENU_CUSTOMBLOCKS' ); + } + } else { + // myblocksadmin as a library + $this->target_mid = $xoopsModule->getVar( 'mid' ); + + $this->target_mname = $xoopsModule->getVar( 'name' ) . ' ' . sprintf( '(%2.2f)', $xoopsModule->getVar( 'version' ) / 100.0 ); + //$this->target_mname = $xoopsModule->getVar( 'name' ) . sprintf( 'v %2.2f ', $xoopsModule->getVar( 'version' ) / 100.0 ); + $this->target_dirname = $xoopsModule->getVar( 'dirname' ); + + $mod_url = XOOPS_URL . '/modules/' . $xoopsModule->getVar( 'dirname' ); + + $modinfo = $xoopsModule->getInfo(); + + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); + + $breadcrumbsObj->appendPath( $mod_url . '/' . @$modinfo['adminindex'], $this->target_mname ); + + $breadcrumbsObj->appendPath( $mod_url . '/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', _MD_A_MYBLOCKSADMIN_BLOCKADMIN ); + } + + // read xoops_version.php of the target + $this->block_configs = $this->get_block_configs(); + } + + /** + * Virtual + * + * @param $block + * + * @return bool + */ + public function canEdit( $block ) { + return true; + } + + /** + * Virtual + * + * @param $block + * + * @return bool + */ + + public function canDelete( $block ) { + // can delete if it is a copy/duplicated block + return 'D' == $block->getVar( 'block_type' ) || 'C' == $block->getVar( 'block_type' ); + } + + /** + * Virtual + * ret 0 : cannot + * ret 1 : forced by altsys or system + * ret 2 : can_clone + * + * @param $block + * + * @return int + */ + public function canClone( $block ) { + // can clone link if it is marked as cloneable block + if ( 'D' == $block->getVar( 'block_type' ) || 'C' == $block->getVar( 'block_type' ) ) { + return 2; + } + + // $modversion['blocks'][n]['can_clone'] + foreach ( $this->block_configs as $bconf ) { + if ( $block->getVar( 'show_func' ) == @$bconf['show_func'] && $block->getVar( 'func_file' ) == @$bconf['file'] && ( empty( $bconf['template'] ) || $block->getVar( 'template' ) == @$bconf['template'] ) ) { + if ( ! empty( $bconf['can_clone'] ) ) { + return 2; + } + } + } + + if ( ! empty( $GLOBALS['altsysModuleConfig']['enable_force_clone'] ) ) { + return 1; + } + + return 0; + } + + /** + * Virtual options + * + * @param $block_data + * + * @return bool|string + */ + public function renderCell4BlockOptions( $block_data ) { + $bid = (int) $block_data['bid']; + + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $handler = xoops_gethandler( 'block' ); + + $block = $handler->create( false ); + + $block->load( $bid ); + } else { + $block = new XoopsBlock( $bid ); + } + + return $block->getOptions(); + } + + /** + * Virtual + * link blocks - modules + * + * @param $block_data + * + * @return string + */ + public function renderCell4BlockModuleLink( $block_data ) { + $bid = (int) $block_data['bid']; + + // get selected targets + if ( is_array( @$block_data['bmodule'] ) ) { + // bmodule originated from request (preview etc.) + $selected_mids = $block_data['bmodule']; + } else { + // originated from the table of `block_module_link` + $result = $this->db->query( 'SELECT module_id FROM ' . $this->db->prefix( 'block_module_link' ) . " WHERE block_id='$bid'" ); + + $selected_mids = []; + + while ( list( $selected_mid ) = $this->db->fetchRow( $result ) ) { + $selected_mids[] = (int) $selected_mid; + } + + if ( empty( $selected_mids ) ) { + $selected_mids = [ 0 ]; + } // all pages + } + + // get all targets + $module_handler =& xoops_gethandler( 'module' ); + $criteria = new CriteriaCompo( new Criteria( 'hasmain', 1 ) ); + $criteria->add( new Criteria( 'isactive', 1 ) ); + + $module_list = $module_handler->getList( $criteria ); + $module_list = [ - 1 => _MD_A_MYBLOCKSADMIN_TOPPAGE, 0 => _MD_A_MYBLOCKSADMIN_ALLPAGES ] + $module_list; + + // build options + $module_options = ''; + foreach ( $module_list as $mid => $mname ) { + $mname = htmlspecialchars( $mname ); + //$mname = htmlspecialchars($mname, ENT_QUOTES | ENT_HTML5); + if ( in_array( $mid, $selected_mids, true ) ) { + $module_options .= "\n"; + } else { + $module_options .= "\n"; + } + } + + return ""; + } + + /** + * Virtual + * group_permission - 'block_read' + * + * @param $block_data + * + * @return string + */ + public function renderCell4BlockReadGroupPerm( $block_data ) { + $bid = (int) $block_data['bid']; + + // get selected targets + if ( is_array( @$block_data['bgroup'] ) ) { + // bgroup originated from request (preview etc.) + $selected_gids = $block_data['bgroup']; + } else { + // originated from the table of `group_perm` + $result = $this->db->query( 'SELECT gperm_groupid FROM ' . $this->db->prefix( 'group_permission' ) . " WHERE gperm_itemid='$bid' AND gperm_name='block_read'" ); + $selected_gids = []; + while ( list( $selected_gid ) = $this->db->fetchRow( $result ) ) { + $selected_gids[] = (int) $selected_gid; + } + if ( 0 == $bid && empty( $selected_gids ) ) { + $selected_gids = $GLOBALS['xoopsUser']->getGroups(); + } + } + + // get all targets + $group_handler = xoops_gethandler( 'group' ); + $groups = $group_handler->getObjects(); + + // build options + $group_options = ''; + foreach ( $groups as $group ) { + $gid = $group->getVar( 'groupid' ); + $gname = $group->getVar( 'name', 's' ); + //!Fix Note: do not apply here a strict third parameter + // if (in_array($gid, $selected_gids, true)) { + if ( in_array( $gid, $selected_gids ) ) { + $group_options .= "\n"; + } else { + $group_options .= "\n"; + } + } + + return ""; + } + + /** + * Virtual + * Visible and side + * + * @param $block_data + * + * @return string + */ + public function renderCell4BlockPosition( $block_data ) { + $bid = (int) $block_data['bid']; + $side = (int) $block_data['side']; + $visible = (int) $block_data['visible']; + + $sseln = $ssel0 = $ssel1 = $ssel2 = $ssel3 = $ssel4 = ''; + $scoln = $scol0 = $scol1 = $scol2 = $scol3 = $scol4 = 'unselected'; + $stextbox = 'unselected'; + $value4extra_side = ''; + + if ( 1 != $visible ) { + $sseln = " checked='checked'"; + $scoln = 'disabled'; + } else { + switch ( $side ) { + case XOOPS_SIDEBLOCK_LEFT: + $ssel0 = " checked='checked'"; + $scol0 = 'selected'; + break; + case XOOPS_SIDEBLOCK_RIGHT: + $ssel1 = " checked='checked'"; + $scol1 = 'selected'; + break; + case XOOPS_CENTERBLOCK_LEFT: + $ssel2 = " checked='checked'"; + $scol2 = 'selected'; + break; + case XOOPS_CENTERBLOCK_RIGHT: + $ssel4 = " checked='checked'"; + $scol4 = 'selected'; + break; + case XOOPS_CENTERBLOCK_CENTER: + $ssel3 = " checked='checked'"; + $scol3 = 'selected'; + break; + default: + $value4extra_side = $side; + $stextbox = 'selected'; + break; + } + } + + // Block-Side Render View + return " +
+ +
+
-
+
+ +
+
+ +
+
+ +
+
-
+
+ +
+ + + +
+ +
+ "; + } + + + // public + public function list_blocks() { + global $xoopsGTicket; + + // main query + $sql = 'SELECT * FROM ' . $this->db->prefix( 'newblocks' ) . " WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight"; + $result = $this->db->query( $sql ); + $block_arr = []; + + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $handler =& xoops_gethandler( 'block' ); //add + } + while ( $myrow = $this->db->fetchArray( $result ) ) { + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $block_one =& $handler->create( false ); + $block_one->assignVars( $myrow ); + $block_arr[] =& $block_one; + } else { + $block_arr[] = new XoopsBlock( $myrow ); + } + } + if ( empty( $block_arr ) ) { + return; + } + + // blocks rendering loop + $blocks4assign = []; + foreach ( $block_arr as $i => $block ) { + $block_data = [ + 'bid' => (int) $block->getVar( 'bid' ), + 'name' => $block->getVar( 'name', 'n' ), + 'title' => $block->getVar( 'title', 'n' ), + 'weight' => (int) $block->getVar( 'weight' ), + 'bcachetime' => (int) $block->getVar( 'bcachetime' ), + 'side' => (int) $block->getVar( 'side' ), + 'visible' => (int) $block->getVar( 'visible' ), + 'can_edit' => $this->canEdit( $block ), + 'can_delete' => $this->canDelete( $block ), + 'can_clone' => $this->canClone( $block ), + ]; + $blocks4assign[] = [ + 'name_raw' => $block_data['name'], + 'title_raw' => $block_data['title'], + 'cell_position' => $this->renderCell4BlockPosition( $block_data ), + 'cell_module_link' => $this->renderCell4BlockModuleLink( $block_data ), + 'cell_group_perm' => $this->renderCell4BlockReadGroupPerm( $block_data ), + ] + $block_data; + } + + // display + require_once XOOPS_TRUST_PATH . '/libs/altsys/class/D3Tpl.class.php'; + $tpl = new D3Tpl(); + $tpl->assign( + [ + 'target_mid' => $this->target_mid, + 'target_dirname' => $this->target_dirname, + 'target_mname' => $this->target_mname, + 'language' => $this->lang, + 'cachetime_options' => $this->cachetime_options, + 'blocks' => $blocks4assign, + 'gticket_hidden' => $xoopsGTicket->getTicketHtml( __LINE__, 1800, 'myblocksadmin' ), + ] + ); + $tpl->display( 'db:altsys_main_blocks_admin_list.html' ); + } + + /** + * @return array + */ + public function get_block_configs() { + if ( $this->target_mid <= 0 ) { + return []; + } + include XOOPS_ROOT_PATH . '/modules/' . $this->target_dirname . '/xoops_version.php'; + + if ( empty( $modversion['blocks'] ) ) { + return []; + } + + return $modversion['blocks']; + } + + + public function list_groups() { + // query for getting blocks + $sql = 'SELECT * FROM ' . $this->db->prefix( 'newblocks' ) . " WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight"; + $result = $this->db->query( $sql ); + $block_arr = []; + + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $handler =& xoops_gethandler( 'block' ); //add + } + while ( $myrow = $this->db->fetchArray( $result ) ) { + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $block_one =& $handler->create( false ); + $block_one->assignVars( $myrow ); + $block_arr[] =& $block_one; + } else { + $block_arr[] = new XoopsBlock( $myrow ); + } + } + + $item_list = []; + foreach ( array_keys( $block_arr ) as $i ) { + $item_list[ $block_arr[ $i ]->getVar( 'bid' ) ] = $block_arr[ $i ]->getVar( 'title' ); + } + + // ADMIN BLOCKS PERMISSIONS + $form = new MyXoopsGroupPermForm( '

'._MD_A_MYBLOCKSADMIN_PERMFORM.'

', 1, 'block_read', '' ); + // skip system (TODO) + if ( $this->target_mid > 1 ) { + $form->addAppendix( 'module_admin', $this->target_mid, $this->target_mname . ' ' . _MD_A_MYBLOCKSADMIN_PERM_MADMIN ); + $form->addAppendix( 'module_read', $this->target_mid, $this->target_mname . ' ' . _MD_A_MYBLOCKSADMIN_PERM_MREAD ); + } + foreach ( $item_list as $item_id => $item_name ) { + $form->addItem( $item_id, $item_name ); + } + echo $form->render(); + } + + /** + * @param $bid + * @param $bside + * @param $bweight + * @param $bvisible + * @param $btitle + * @param $bcontent + * @param $bctype + * @param $bcachetime + * @param array $options + * + * @return string + */ + public function update_block( $bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $options = [] ) { + global $xoopsConfig; + + //HACK by domifara + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $handler =& xoops_gethandler( 'block' ); + $block =& $handler->create( false ); + $block->load( $bid ); + } else { + $block = new XoopsBlock( $bid ); + } + + if ( $bside >= 0 ) { + $block->setVar( 'side', $bside ); + } + $block->setVar( 'weight', $bweight ); + $block->setVar( 'visible', $bvisible ); + $block->setVar( 'title', $btitle ); + if ( isset( $bcontent ) ) { + $block->setVar( 'content', $bcontent ); + } + if ( isset( $bctype ) ) { + $block->setVar( 'c_type', $bctype ); + } + $block->setVar( 'bcachetime', $bcachetime ); + + //!Fix Test + // if ($options && is_array($options)) { + if ( is_array( $options ) && count( $options ) > 0 ) { + $block->setVar( 'options', implode( '|', $options ) ); + } + if ( 'C' == $block->getVar( 'block_type' ) ) { + $name = $this->get_blockname_from_ctype( $block->getVar( 'c_type' ) ); + $block->setVar( 'name', $name ); + } + $msg = _MD_A_MYBLOCKSADMIN_DBUPDATED; + + if ( false != $block->store() ) { + include_once XOOPS_ROOT_PATH . '/class/template.php'; + $xoopsTpl = new XoopsTpl(); + $xoopsTpl->xoops_setCaching( 2 ); + + if ( '' != $block->getVar( 'template' ) ) { + if ( $xoopsTpl->is_cached( 'db:' . $block->getVar( 'template' ) ) ) { + if ( ! $xoopsTpl->clear_cache( 'db:' . $block->getVar( 'template' ) ) ) { + $msg = 'Unable to clear cache for block ID' . $bid; + } + } + } else { + if ( $xoopsTpl->is_cached( 'db:system_dummy.html', 'blk_' . $bid ) ) { + if ( ! $xoopsTpl->clear_cache( 'db:system_dummy.html', 'blk_' . $bid ) ) { + $msg = 'Unable to clear cache for block ID' . $bid; + } + } + } + } else { + $msg = 'Failed update of block. ID:' . $bid; + } + + return $msg; + } + + // virtual + + /** + * @param int $bid + * @param $bmodules + */ + public function updateBlockModuleLink( $bid, $bmodules ) { + $bid = (int) $bid; + $table = $this->db->prefix( 'block_module_link' ); + + $sql = "DELETE FROM `$table` WHERE `block_id`=$bid"; + $this->db->query( $sql ); + foreach ( $bmodules as $mid ) { + $mid = (int) $mid; + $sql = "INSERT INTO `$table` (`block_id`,`module_id`) VALUES ($bid,$mid)"; + $this->db->query( $sql ); + } + } + + /** + * Virtual + * + * @param int $bid + * @param $req_gids + */ + public function updateBlockReadGroupPerm( $bid, $req_gids ) { + $bid = (int) $bid; + $table = $this->db->prefix( 'group_permission' ); + $req_gids = array_map( 'intval', $req_gids ); + sort( $req_gids ); + + // compare group ids from request and the records. + $sql = "SELECT `gperm_groupid` FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid"; + $result = $this->db->query( $sql ); + $db_gids = []; + while ( list( $gid ) = $this->db->fetchRow( $result ) ) { + $db_gids[] = $gid; + } + $db_gids = array_map( 'intval', $db_gids ); + sort( $db_gids ); + + // if they are identical, just return (prevent increase of gperm_id) + if ( serialize( $req_gids ) == serialize( $db_gids ) ) { + return; + } + + $sql = "DELETE FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid"; + $this->db->query( $sql ); + foreach ( $req_gids as $gid ) { + $gid = (int) $gid; + $sql = "INSERT INTO `$table` (`gperm_groupid`,`gperm_itemid`,`gperm_modid`,`gperm_name`) VALUES ($gid,$bid,1,'block_read')"; + $this->db->query( $sql ); + } + } + + /** + * @return string + */ + public function do_order() { + $sides = is_array( @$_POST['sides'] ) ? $_POST['sides'] : []; + foreach ( array_keys( $sides ) as $bid ) { + $request = $this->fetchRequest4Block( $bid ); + + // update the block + $this->update_block( $request['bid'], $request['side'], $request['weight'], $request['visible'], $request['title'], null, null, $request['bcachetime'], [] ); + + // block_module_link update + $this->updateBlockModuleLink( $bid, $request['bmodule'] ); + + // group_permission update + $this->updateBlockReadGroupPerm( $bid, $request['bgroup'] ); + } + + return _MD_A_MYBLOCKSADMIN_DBUPDATED; + } + + /** + * @param int $bid + * + * @return array + */ + public function fetchRequest4Block( $bid ) { + $bid = (int) $bid; + ( method_exists( 'MyTextSanitizer', 'sGetInstance' ) and $myts = MyTextSanitizer::sGetInstance() ) || $myts = MyTextSanitizer::getInstance(); + + if ( @$_POST['extra_sides'][ $bid ] > 0 ) { + $_POST['sides'][ $bid ] = (int) $_POST['extra_sides'][ $bid ]; + } + + if ( @$_POST['sides'][ $bid ] < 0 ) { + $visible = 0; + $_POST['sides'][ $bid ] = - 1; + } else { + $visible = 1; + } + + return [ + 'bid' => $bid, + 'side' => (int) @$_POST['sides'][ $bid ], + 'weight' => (int) @$_POST['weights'][ $bid ], + 'visible' => $visible, + 'title' => $myts->stripSlashesGPC( @$_POST['titles'][ $bid ] ), + 'content' => $myts->stripSlashesGPC( @$_POST['contents'][ $bid ] ), + 'ctype' => preg_replace( '/[^A-Z]/', '', @$_POST['ctypes'][ $bid ] ), + 'bcachetime' => (int) @$_POST['bcachetimes'][ $bid ], + 'bmodule' => is_array( @$_POST['bmodules'][ $bid ] ) ? $_POST['bmodules'][ $bid ] : [ 0 ], + 'bgroup' => is_array( @$_POST['bgroups'][ $bid ] ) ? $_POST['bgroups'][ $bid ] : [], + 'options' => is_array( @$_POST['options'][ $bid ] ) ? $_POST['options'][ $bid ] : [], + ]; + } + + /** + * @param int $bid + * + * @return string + */ + public function do_delete( $bid ) { + $bid = (int) $bid; + + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $handler =& xoops_gethandler( 'block' ); + $block =& $handler->create( false ); + $block->load( $bid ); + } else { + $block = new XoopsBlock( $bid ); + } + + if ( ! is_object( $block ) ) { + die( 'Invalid bid' ); + } + if ( ! $this->canDelete( $block ) ) { + die( 'Cannot delete this block' ); + } + $this->do_deleteBlockReadGroupPerm( $bid ); //HACK add by domifara + $block->delete(); + + return _MD_A_MYBLOCKSADMIN_DBUPDATED; + } + + /** + * add by domifara + * + * @param int $bid + */ + public function do_deleteBlockReadGroupPerm( $bid ) { + $bid = (int) $bid; + $table = $this->db->prefix( 'group_permission' ); + $sql = "DELETE FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid"; + $this->db->query( $sql ); + } + + /** + * @param int $bid + */ + public function form_delete( $bid ) { + $bid = (int) $bid; + + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $handler =& xoops_gethandler( 'block' ); + $block =& $handler->create( false ); + $block->load( $bid ); + } else { + $block = new XoopsBlock( $bid ); + } + + if ( ! is_object( $block ) ) { + die( 'Invalid bid' ); + } + if ( ! $this->canDelete( $block ) ) { + die( 'Cannot delete this block' ); + } + + // breadcrumbs + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); + $breadcrumbsObj->appendPath( '', _DELETE ); + + xoops_confirm( [ 'op' => 'delete_ok' ] + $GLOBALS['xoopsGTicket']->getTicketArray( __LINE__, 1800, 'myblocksadmin' ), "?mode=admin&lib=altsys&page=myblocksadmin&dirname=$this->target_dirname&bid=$bid", sprintf( _MD_A_MYBLOCKSADMIN_FMT_REMOVEBLOCK, $block->getVar( 'title' ) ) ); + } + + + public function do_clone( $bid ) { + $bid = (int) $bid; + + $request = $this->fetchRequest4Block( $bid ); + + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $handler =& xoops_gethandler( 'block' ); + $block =& $handler->create( false ); + $block->load( $bid ); + } else { + $block = new XoopsBlock( $bid ); + } + + if ( ! $block->getVar( 'bid' ) ) { + die( 'Invalid bid' ); + } + if ( ! $this->canClone( $block ) ) { + die( 'Invalid block_type' ); + } + + if ( empty( $_POST['options'] ) ) { + $options = []; + } elseif ( is_array( $_POST['options'] ) ) { + $options = $_POST['options']; + } else { + $options = explode( '|', $_POST['options'] ); + } + + // for backward compatibility + // $cblock =& $block->clone(); or $cblock =& $block->xoopsClone(); + + //HACK by domifara + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $cblock =& $handler->create( false ); + } else { + $cblock = new XoopsBlock(); + } + + foreach ( $block->vars as $k => $v ) { + $cblock->assignVar( $k, $v['value'] ); + } + $cblock->setNew(); + $cblock->setVar( 'bid', 0 ); + $cblock->setVar( 'block_type', 'C' == $block->getVar( 'block_type' ) ? 'C' : 'D' ); + $cblock->setVar( 'func_num', $this->find_func_num_vacancy( $block->getVar( 'mid' ) ) ); + // store the block into DB as a new one + $newbid = $cblock->store(); + if ( ! $newbid ) { + return $cblock->getHtmlErrors(); + } + + // update the block by the request + $this->update_block( $newbid, $request['side'], $request['weight'], $request['visible'], $request['title'], $request['content'], $request['ctype'], $request['bcachetime'], is_array( @$_POST['options'] ) ? $_POST['options'] : [] ); + + // block_module_link update + $this->updateBlockModuleLink( $newbid, $request['bmodule'] ); + + // group_permission update + $this->updateBlockReadGroupPerm( $newbid, $request['bgroup'] ); + + return _MD_A_MYBLOCKSADMIN_DBUPDATED; + } + + /** + * @param $mid + * + * @return int + */ + public function find_func_num_vacancy( $mid ) { + $func_num = 256; + do { + $func_num --; + [ $count ] = $this->db->fetchRow( $this->db->query( 'SELECT COUNT(*) FROM ' . $this->db->prefix( 'newblocks' ) . ' WHERE mid=' . (int) $mid . ' AND func_num=' . $func_num ) ); + } while ( $count > 0 ); + + return $func_num > 128 ? $func_num : 255; + } + + /** + * @param int $bid + * + * @return string + */ + + public function do_edit( $bid ) { + $bid = (int) $bid; + + if ( $bid <= 0 ) { + // new custom block + + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $handler =& xoops_gethandler( 'block' ); + $new_block =& $handler->create( false ); + } else { + $new_block = new XoopsBlock(); + } + + $new_block->setNew(); + $new_block->setVar( 'name', $this->get_blockname_from_ctype( 'C' ) ); + $new_block->setVar( 'block_type', 'C' ); + $new_block->setVar( 'func_num', 0 ); + $bid = $new_block->store(); + $request = $this->fetchRequest4Block( 0 ); + // permission copy + foreach ( $GLOBALS['xoopsUser']->getGroups() as $gid ) { + $sql = 'INSERT INTO ' . $this->db->prefix( 'group_permission' ) . " (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES ($gid, $bid, 1, 'block_read')"; + $this->db->query( $sql ); + } + } else { + $request = $this->fetchRequest4Block( $bid ); + } + + // update the block by the request + $msg = $this->update_block( $bid, $request['side'], $request['weight'], $request['visible'], $request['title'], $request['content'], $request['ctype'], $request['bcachetime'], is_array( @$_POST['options'] ) ? $_POST['options'] : [] ); + + // block_module_link update + $this->updateBlockModuleLink( $bid, $request['bmodule'] ); + + // group_permission update + $this->updateBlockReadGroupPerm( $bid, $request['bgroup'] ); + + return $msg; + } + + /** + * @param $bid + * @param string $mode + */ + public function form_edit( $bid, $mode = 'edit' ) { + $bid = (int) $bid; + + //HACK by domifara + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $handler =& xoops_gethandler( 'block' ); + $block =& $handler->create( false ); + $block->load( $bid ); + } else { + $block = new XoopsBlock( $bid ); + } + + if ( ! $block->getVar( 'bid' ) ) { + // new defaults + $bid = 0; + $mode = 'new'; + $block->setVar( 'mid', 0 ); + $block->setVar( 'block_type', 'C' ); + } + + switch ( $mode ) { + case 'clone': + $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM; + $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE; + $next_op = 'clone_ok'; + // breadcrumbs + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); + $breadcrumbsObj->appendPath( '', _MD_A_MYBLOCKSADMIN_CLONEFORM ); + break; + case 'new': + $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM; + $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW; + $next_op = 'new_ok'; + // breadcrumbs + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); + $breadcrumbsObj->appendPath( '', _MD_A_MYBLOCKSADMIN_NEWFORM ); + break; + case 'edit': + default: + $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM; + $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT; + $next_op = 'edit_ok'; + // breadcrumbs + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); + $breadcrumbsObj->appendPath( '', _MD_A_MYBLOCKSADMIN_EDITFORM ); + break; + } + //!Fix test + // $is_custom = in_array($block->getVar('block_type'), ['C', 'E'], true) ? true : false; + $is_custom = in_array( $block->getVar( 'block_type' ), [ 'C', 'E' ] ); + $block_template = $block->getVar( 'template', 'n' ); + $block_template_tplset = ''; + + if ( ! $is_custom && $block_template ) { + + // find template of the block + $tplfile_handler =& xoops_gethandler( 'tplfile' ); + $found_templates =& $tplfile_handler->find( $GLOBALS['xoopsConfig']['template_set'], 'block', null, null, $block_template ); + $block_template_tplset = count( $found_templates ) > 0 ? $GLOBALS['xoopsConfig']['template_set'] : 'default'; + } + //HACK by domifara + /* + if ( !($block->getVar('c_type')) ){ + $block->setVar('c_type','S'); + } + */ + $block_data = $this->preview_request + [ + 'bid' => $bid, + 'name' => $block->getVar( 'name', 'n' ), + 'title' => $block->getVar( 'title', 'n' ), + 'weight' => (int) $block->getVar( 'weight' ), + 'bcachetime' => (int) $block->getVar( 'bcachetime' ), + 'side' => (int) $block->getVar( 'side' ), + 'visible' => (int) $block->getVar( 'visible' ), + 'template' => $block_template, + 'template_tplset' => $block_template_tplset, + 'options' => $block->getVar( 'options' ), + 'content' => $block->getVar( 'content', 'n' ), + 'is_custom' => $is_custom, + 'type' => $block->getVar( 'block_type' ), + 'ctype' => $block->getVar( 'c_type' ), + ]; + + $block4assign = [ + 'name_raw' => $block_data['name'], + 'title_raw' => $block_data['title'], + 'content_raw' => $block_data['content'], + 'cell_position' => $this->renderCell4BlockPosition( $block_data ), + 'cell_module_link' => $this->renderCell4BlockModuleLink( $block_data ), + 'cell_group_perm' => $this->renderCell4BlockReadGroupPerm( $block_data ), + 'cell_options' => $this->renderCell4BlockOptions( $block_data ), + 'content_preview' => $this->previewContent( $block_data ), + ] + $block_data; + + // display + require_once XOOPS_TRUST_PATH . '/libs/altsys/class/D3Tpl.class.php'; + $tpl = new D3Tpl(); + + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $tpl->assign( 'xoops_cube_legacy', true ); + include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + } else { + $tpl->assign( 'xoops_cube_legacy', false ); + } + + $tpl->assign( + [ + 'target_dirname' => $this->target_dirname, + 'target_mname' => $this->target_mname, + 'language' => $this->lang, + 'cachetime_options' => $this->cachetime_options, + 'ctype_options' => $this->ctype_options, + 'block' => $block4assign, + 'op' => $next_op, + 'form_title' => $form_title, + 'submit_button' => $button_value, + // 'common_fck_installed' => $this->checkFck(), + 'gticket_hidden' => $GLOBALS['xoopsGTicket']->getTicketHtml( __LINE__, 1800, 'myblocksadmin' ), + ] + ); + + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $tpl->display( 'db:altsys_main_blocks_admin_edit.html' ); + } + + return; + } + + + /** + * @param $block_data + * + * @return string + */ + + public function previewContent( $block_data ) { + $bid = (int) $block_data['bid']; + + if ( ! $block_data['is_custom'] ) { + return ''; + } + if ( empty( $this->preview_request ) ) { + return ''; + } + + //HACK by domifara + //TODO : need no hook block at this + $block = new XoopsBlock( $bid ); + /* + $handler =& xoops_gethandler('block'); + $block =& $handler->create(false) ; + $block->load($bid) ; + */ + + if ( $block->getVar( 'mid' ) ) { + return ''; + } + + $block->setVar( 'title', $block_data['title'] ); + $block->setVar( 'content', $block_data['content'] ); + + restore_error_handler(); + $original_level = error_reporting( E_ALL ); + $ret = $block->getContent( 'S', $block_data['ctype'] ); + error_reporting( $original_level ); + + return $ret; + } + + /** + * @param $bctype + * + * @return mixed|string + */ + public function get_blockname_from_ctype( $bctype ) { + $ctypes = [ + 'H' => _MD_A_MYBLOCKSADMIN_CTYPE_HTML, + 'S' => _MD_A_MYBLOCKSADMIN_CTYPE_SMILE, + 'N' => _MD_A_MYBLOCKSADMIN_CTYPE_NOSMILE, + 'P' => _MD_A_MYBLOCKSADMIN_CTYPE_PHP, + ]; + + return $ctypes[ $bctype ] ?? _MD_A_MYBLOCKSADMIN_CTYPE_SMILE; + } + + + public function processPost() { + // Ticket Check + if ( ! $GLOBALS['xoopsGTicket']->check( true, 'myblocksadmin' ) ) { + redirect_header( XOOPS_URL . '/', 3, $GLOBALS['xoopsGTicket']->getErrors() ); + } + + $msg = ''; + $bid = (int) @$_GET['bid']; + + if ( ! empty( $_POST['preview'] ) ) { + // preview + $this->preview_request = $this->fetchRequest4Block( $bid ); + $_GET['op'] = str_replace( '_ok', '', @$_POST['op'] ); + + return; // continue ; + } + + if ( 'order' == @$_POST['op'] ) { + // order ok + $msg = $this->do_order(); + } elseif ( 'delete_ok' == @$_POST['op'] ) { + // delete ok + $msg = $this->do_delete( $bid ); + } elseif ( 'clone_ok' == @$_POST['op'] ) { + // clone ok + $msg = $this->do_clone( $bid ); + } elseif ( 'edit_ok' == @$_POST['op'] || 'new_ok' == @$_POST['op'] ) { + // edit ok + $msg = $this->do_edit( $bid ); + } elseif ( ! empty( $_POST['submit'] ) ) { + // update module_admin,module_read,block_read + include dirname( __DIR__ ) . '/include/mygroupperm.php'; + $msg = _MD_A_MYBLOCKSADMIN_PERMUPDATED; + } + + redirect_header( $_SERVER['REQUEST_URI'], 1, $msg ); + exit; + } + + + public function processGet() { + $bid = (int) @$_GET['bid']; + switch ( @$_GET['op'] ) { + case 'clone': + $this->form_edit( $bid, 'clone' ); + break; + case 'new': + case 'edit': + $this->form_edit( $bid, 'edit' ); + break; + case 'delete': + $this->form_delete( $bid ); + break; + case 'list': + default: + // the first form (blocks) + $this->list_blocks(); + // the second form (groups) + $this->list_groups(); + break; + } + } } diff --git a/xoops_trust_path/libs/altsys/class/MyBlocksAdminForICMS.class.php b/xoops_trust_path/libs/altsys/class/MyBlocksAdminForICMS.class.php deleted file mode 100644 index 5986d6b..0000000 --- a/xoops_trust_path/libs/altsys/class/MyBlocksAdminForICMS.class.php +++ /dev/null @@ -1,161 +0,0 @@ -lang.'/admin/blocksadmin.php' ; - $result = $this->db->query("SELECT id,pname,title FROM ".$this->db->prefix("block_positions")) ; - while (list($id, $pname, $title) = $this->db->fetchRow($result)) { - $this->block_positions[ $id ] = defined($title) ? constant($title) : $title ; - } - $this->block_positions[ -1 ] = _NONE ; - } - -//HACK by domifara for php5.3+ -//function &getInstance() -public static function &getInstance() -{ - static $instance; - if (!isset($instance)) { - $instance = new MyBlocksAdminForICMS(); - $instance->construct() ; - } - return $instance; -} - - -// virtual -// link blocks - modules - pages -public function renderCell4BlockModuleLink($block_data) -{ - $bid = intval($block_data['bid']) ; - - // get selected targets - if (is_array(@$block_data['bmodule'])) { - // bmodule origined from request (preview etc.) - $selected_pages = $block_data['bmodule'] ; - } else { - // origined from the table of `block_module_link` - $result = $this->db->query("SELECT module_id,page_id FROM ".$this->db->prefix('block_module_link')." WHERE block_id='$bid'") ; - $selected_pages = array(); - while (list($mid, $pid) = $this->db->fetchRow($result)) { - $selected_pages[] = intval($mid) . '-' . intval($pid) ; - } - } - - $page_handler =& xoops_gethandler('page'); - $ret = " - " ; - - return $ret ; -} - - -// virtual -// visible and side -public function renderCell4BlockPosition($block_data) -{ - return " - - - - - - - - - - - - - - - - -
".$this->renderRadio4BlockPosition(1, $block_data)."".$this->renderRadio4BlockPosition(3, $block_data)."".$this->renderRadio4BlockPosition(4, $block_data)."".$this->renderRadio4BlockPosition(5, $block_data)."".$this->renderRadio4BlockPosition(2, $block_data)."
".$this->renderRadio4BlockPosition(6, $block_data)."".$this->renderRadio4BlockPosition(7, $block_data)."".$this->renderRadio4BlockPosition(8, $block_data)."
".$this->renderRadio4BlockPositions($block_data, array(1, 2, 3, 4, 5, 6, 7, 8))."
" ; -} - - -// private -public function renderRadio4BlockPosition($target_side, $block_data) -{ - $bid = intval($block_data['bid']) ; - $visible = intval($block_data['visible']) ; - $current_side = $visible ? intval($block_data['side']) : -1 ; - - $label4disp = htmlspecialchars($this->block_positions[ $target_side ], ENT_QUOTES) ; - - if ($current_side == $target_side) { - $checked = "checked='checked'" ; - $divstyle = $target_side == -1 ? "disabled" : "selected" ; - } else { - $checked = "" ; - $divstyle = "unselected" ; - } - - return "
" ; -} - - -// private -public function renderRadio4BlockPositions($block_data, $skip_sides = array()) -{ - $bid = intval($block_data['bid']) ; - $visible = intval($block_data['visible']) ; - $current_side = $visible ? intval($block_data['side']) : -1 ; - - $ret = '' ; - foreach ($this->block_positions as $target_side => $label) { - if (in_array($target_side, $skip_sides)) { - continue ; - } - - $label4disp = htmlspecialchars($label, ENT_QUOTES) ; - - if ($current_side == $target_side) { - $checked = "checked='checked'" ; - $divstyle = $target_side == -1 ? "disabled" : "selected" ; - } else { - $checked = "" ; - $divstyle = "unselected" ; - } - - $ret .= "
" ; - } - - return $ret ; -} - - -// virtual -public function updateBlockModuleLink($bid, $bmodules) -{ - $bid = intval($bid) ; - $table = $this->db->prefix("block_module_link") ; - - $sql = "DELETE FROM `$table` WHERE `block_id`=$bid" ; - $this->db->query($sql) ; - foreach ($bmodules as $mid) { - $regs = explode('-', $mid) ; - $module_id = intval(@$regs[0]) ; - $page_id = intval(@$regs[1]) ; - $sql = "INSERT INTO `$table` (`block_id`,`module_id`,`page_id`) VALUES ($bid,$module_id,$page_id)" ; - $this->db->query($sql) ; - } -} -} diff --git a/xoops_trust_path/libs/altsys/class/MyBlocksAdminForX20S.class.php b/xoops_trust_path/libs/altsys/class/MyBlocksAdminForX20S.class.php deleted file mode 100644 index facc029..0000000 --- a/xoops_trust_path/libs/altsys/class/MyBlocksAdminForX20S.class.php +++ /dev/null @@ -1,90 +0,0 @@ -lang.'/admin/blocksadmin.php' ; - $this->block_positions = array( - -1 => _NONE , - 0 => _AM_SBLEFT , - 1 => _AM_SBRIGHT , - 3 => _AM_CBLEFT , - 4 => _AM_CBRIGHT , - 5 => _AM_CBCENTER , - 7 => _AM_CBBOTTOMLEFT , - 8 => _AM_CBBOTTOMRIGHT , - 9 => _AM_CBBOTTOM , - ) ; - } - -//HACK by domifara for php5.3+ -//function &getInstance() -public static function &getInstance() -{ - static $instance; - if (!isset($instance)) { - $instance = new MyBlocksAdminForX20S(); - $instance->construct() ; - } - return $instance; -} - - -// virtual -// visible and side -public function renderCell4BlockPosition($block_data) -{ - return " - - - - - - - - - - - - - - - - -
".$this->renderRadio4BlockPosition(0, $block_data)."".$this->renderRadio4BlockPosition(3, $block_data)."".$this->renderRadio4BlockPosition(5, $block_data)."".$this->renderRadio4BlockPosition(4, $block_data)."".$this->renderRadio4BlockPosition(1, $block_data)."
".$this->renderRadio4BlockPosition(7, $block_data)."".$this->renderRadio4BlockPosition(9, $block_data)."".$this->renderRadio4BlockPosition(8, $block_data)."
".$this->renderRadio4BlockPosition(-1, $block_data)._NONE."
" ; -} - - -// private -public function renderRadio4BlockPosition($target_side, $block_data) -{ - $bid = intval($block_data['bid']) ; - $visible = intval($block_data['visible']) ; - $current_side = $visible ? intval($block_data['side']) : -1 ; - - $label4disp = htmlspecialchars($this->block_positions[ $target_side ], ENT_QUOTES) ; - - if ($current_side == $target_side) { - $checked = "checked='checked'" ; - $divstyle = $target_side == -1 ? "disabled" : "selected" ; - } else { - $checked = "" ; - $divstyle = "unselected" ; - } - - return "
" ; -} -} diff --git a/xoops_trust_path/libs/altsys/class/MyBlocksAdminForX22.class.php b/xoops_trust_path/libs/altsys/class/MyBlocksAdminForX22.class.php deleted file mode 100644 index 31a996f..0000000 --- a/xoops_trust_path/libs/altsys/class/MyBlocksAdminForX22.class.php +++ /dev/null @@ -1,544 +0,0 @@ -lang.'/admin/blocksadmin.php' ; - } - -//HACK by domifara for php5.3+ -//function &getInstance() -public static function &getInstance() -{ - static $instance; - if (!isset($instance)) { - $instance = new MyBlocksAdminForX22(); - $instance->construct() ; - } - return $instance; -} - -/* -function list_blocks( $target_mid , $target_dirname ) -{ - global $xoopsGTicket ; - - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance() ; - - // main query - $db = XoopsDatabaseFactory::getDatabaseConnection(); - if( $target_mid ) { - // normal - $sql = "SELECT bid,name,show_func,func_file,template FROM ".$db->prefix("newblocks")." WHERE mid='$target_mid'"; - } else { - // custom blocks - $sql = "SELECT bid,name,show_func,func_file,template FROM ".$db->prefix("newblocks")." WHERE show_func='b_system_custom_show'"; - } - $result = $db->query($sql); - $block_arr = array(); - while( list( $bid , $bname , $show_func , $func_file , $template ) = $db->fetchRow( $result ) ) { - $block_arr[$bid] = array( - 'name' => $bname , - 'show_func' => $show_func , - 'func_file' => $func_file , - 'template' => $template - ) ; - } - if( empty( $block_arr ) ) return ; - - // cachetime options - $cachetimes = array('0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK, '2592000' => _MONTH); - - // displaying TH - echo " -

"._MD_A_MYBLOCKSADMIN_BLOCKADMIN."

-
- - - - - - - - - \n" ; - - // get block instances - $crit = new Criteria("bid", "(".implode(",",array_keys($block_arr)).")", "IN"); - $criteria = new CriteriaCompo($crit); - $criteria->setSort('visible DESC, side ASC, weight'); - $instance_handler =& xoops_gethandler('blockinstance'); - $instances =& $instance_handler->getObjects($criteria, true, true); - - //Get modules and pages for visible in - $modules_pages_list = $this->get_modules_pages_list() ; - - // blocks displaying loop - $class = 'even' ; - $block_configs = $this->get_block_configs() ; - foreach( array_keys( $instances ) as $i ) { - $sseln = $ssel0 = $ssel1 = $ssel2 = $ssel3 = $ssel4 = ""; - $scoln = $scol0 = $scol1 = $scol2 = $scol3 = $scol4 = "#FFFFFF"; - - $weight = $instances[$i]->getVar("weight") ; - $title = htmlspecialchars($instances[$i]->getVar("title",'n'),ENT_QUOTES) ; - $bcachetime = $instances[$i]->getVar("bcachetime") ; - $bid = $instances[$i]->getVar("bid") ; - $name = htmlspecialchars( $block_arr[$bid]['name'] , ENT_QUOTES ) ; - - $visiblein = $instances[$i]->getVisibleIn(); - - // visible and side - if ( $instances[$i]->getVar("visible") != 1 ) { - $sseln = " checked='checked'"; - $scoln = "#FF0000"; - } else switch( $instances[$i]->getVar("side") ) { - default : - case XOOPS_SIDEBLOCK_LEFT : - $ssel0 = " checked='checked'"; - $scol0 = "#00FF00"; - break ; - case XOOPS_SIDEBLOCK_RIGHT : - $ssel1 = " checked='checked'"; - $scol1 = "#00FF00"; - break ; - case XOOPS_CENTERBLOCK_LEFT : - $ssel2 = " checked='checked'"; - $scol2 = "#00FF00"; - break ; - case XOOPS_CENTERBLOCK_RIGHT : - $ssel4 = " checked='checked'"; - $scol4 = "#00FF00"; - break ; - case XOOPS_CENTERBLOCK_CENTER : - $ssel3 = " checked='checked'"; - $scol3 = "#00FF00"; - break ; - } - - // bcachetime - $cachetime_options = '' ; - foreach( $cachetimes as $cachetime => $cachetime_name ) { - if( $bcachetime == $cachetime ) { - $cachetime_options .= "\n" ; - } else { - $cachetime_options .= "\n" ; - } - } - - $module_options = '' ; - foreach( $modules_pages_list as $mname => $module ) { - $module_options .= "\n" ; - foreach( $module as $mkey => $mval ) { - if( in_array( $mkey , $visiblein ) ) { - $module_options .= "\n" ; - } else { - $module_options .= "\n" ; - } - } - $module_options .= "\n" ; - } - - // delete link if it is cloned block - $delete_link = "
"._DELETE."" ; - - // displaying part - echo " - - - - - - - - \n" ; - - $class = ( $class == 'even' ) ? 'odd' : 'even' ; - } - - echo " - - - -
"._MD_A_MYBLOCKSADMIN_TITLE.""._MD_A_MYBLOCKSADMIN_SIDE.""._MD_A_MYBLOCKSADMIN_WEIGHT.""._MD_A_MYBLOCKSADMIN_VISIBLEIN.""._MD_A_MYBLOCKSADMIN_BCACHETIME.""._MD_A_MYBLOCKSADMIN_ACTION."
- $name -
- -
-
- -
-
-
-
- -
-
- -
-
- -
-
-
-
- -
-
-
-
 
-
- -
-
"._NONE."
-
- - - - - - - "._EDIT."{$delete_link} - -
- - ".$xoopsGTicket->getTicketHtml( __LINE__ , 1800 , 'myblocksadmin' )." - -
-
\n" ; - - // list block classes for add (not instances) - echo " -
- - ".$xoopsGTicket->getTicketHtml( __LINE__ , 1800 , 'myblocksadmin' )." - - - - - - \n" ; - - foreach( $block_arr as $bid => $block ) { - - $description4show = '' ; - foreach( $block_configs as $bconf ) { - if( $block['show_func'] == $bconf['show_func'] && $block['func_file'] == $bconf['file'] && ( empty( $bconf['template'] ) || $block['template'] == $bconf['template'] ) ) { - if( ! empty( $bconf['description'] ) ) $description4show = $myts->makeTboxData4Show( $bconf['description'] ) ; - } - } - - echo " - - - - - \n" ; - $class = ( $class == 'even' ) ? 'odd' : 'even' ; - } - - echo " -
"._MD_A_MYBLOCKSADMIN_NAME.""._MD_A_MYBLOCKSADMIN_DESCRIPTION.""._MD_A_MYBLOCKSADMIN_ACTION."
- ".$myts->makeTboxData4Edit($block['name'])." - - $description4show - - -
-
\n" ; -} - - - - -function list_groups( $target_mid , $target_dirname , $target_mname ) -{ - // query for getting blocks - $db =& XoopsDatabaseFactory::getDatabaseConnection(); - if( $target_mid ) { - // normal - $sql = "SELECT i.instanceid,i.title FROM ".$db->prefix("block_instance")." i LEFT JOIN ".$db->prefix("newblocks")." b ON i.bid=b.bid WHERE b.mid='$target_mid'" ; - } else { - // custom blocks - $sql = "SELECT i.instanceid,i.title FROM ".$db->prefix("block_instance")." i LEFT JOIN ".$db->prefix("newblocks")." b ON i.bid=b.bid WHERE b.show_func='b_system_custom_show'" ; - } - $result = $db->query( $sql ) ; - - $item_list = array() ; - while( list( $iid , $title ) = $db->fetchRow( $result ) ) { - $item_list[ $iid ] = $title ; - } - - $form = new MyXoopsGroupPermForm( _MD_A_MYBLOCKSADMIN_PERMFORM , 1 , 'block_read' , '' ) ; - // skip system (TODO) - if( $target_mid > 1 ) { - $form->addAppendix( 'module_admin' , $target_mid , $target_mname . ' ' . _MD_A_MYBLOCKSADMIN_PERM_MADMIN ) ; - $form->addAppendix( 'module_read' , $target_mid , $target_mname .' ' . _MD_A_MYBLOCKSADMIN_PERM_MREAD ) ; - } - foreach( $item_list as $item_id => $item_name) { - $form->addItem( $item_id , $item_name ) ; - } - echo $form->render() ; -} - - - - - -function update_blockinstance($id, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $bmodules, $options=array(), $bid=null) -{ - global $xoopsDB ; - - $instance_handler =& xoops_gethandler('blockinstance'); - $block_handler =& xoops_gethandler('block') ; - if ($id > 0) { - // update - $instance =& $instance_handler->get($id); - if( $bside >= 0 ) $instance->setVar('side', $bside); - if( ! empty($options) ) $instance->setVar('options', $options); - } else { - // insert - $instance =& $instance_handler->create(); - $instance->setVar( 'bid' , $bid ) ; - $instance->setVar('side', $bside); - $block = $block_handler->get( $bid ) ; - $instance->setVar('options', $block->getVar("options") ); - if( empty( $btitle ) ) $btitle = $block->getVar("name") ; - } - $instance->setVar('weight', $bweight); - $instance->setVar('visible', $bvisible); - $instance->setVar('title', $btitle); - // if( isset( $bcontent ) ) $instance->setVar('content', $bcontent); - // if( isset( $bctype ) ) $instance->setVar('c_type', $bctype); - $instance->setVar('bcachetime', $bcachetime); - - if ($instance_handler->insert($instance) && $bmodules !== -1) { - $GLOBALS['xoopsDB']->query("DELETE FROM ".$GLOBALS['xoopsDB']->prefix('block_module_link')." WHERE block_id=".$instance->getVar('instanceid')); - foreach ($bmodules as $mid) { - $page = explode('-', $mid); - $mid = $page[0]; - $pageid = $page[1]; - $GLOBALS['xoopsDB']->query("INSERT INTO ".$GLOBALS['xoopsDB']->prefix('block_module_link')." VALUES (".$instance->getVar('instanceid').", ".intval($mid).", ".intval($pageid).")"); - } - return _MD_A_MYBLOCKSADMIN_DBUPDATED; - } - return 'Failed update of block instance. ID:'.$id; -} - - - -function do_order() -{ - if( is_array( @$_POST['addblock'] ) ) { - - // addblock - foreach( $_POST['addblock'] as $bid => $val ) { - $this->update_blockinstance( 0, 0, 0, 0, '', null , null , 0, array(), array(), intval( $bid ) ); - } - - } else { - - // else change order - if ( !empty($_POST['side']) ) { $side = $_POST['side']; } - if ( !empty($_POST['visible']) ) { $visible = $_POST['visible']; } - if ( !empty($_POST['id']) ) { $id = $_POST['id']; } else { $id = array(); } - - foreach (array_keys($id) as $i) { - // separate side and visible - if( $side[$i] < 0 ) { - $visible[$i] = 0 ; - $side[$i] = -1 ; // for not to destroy the original position - } else { - $visible[$i] = 1 ; - } - - $bmodule = (isset($_POST['bmodule'][$i]) && is_array($_POST['bmodule'][$i])) ? $_POST['bmodule'][$i] : array(-1) ; - - $this->update_blockinstance($i, $side[$i], $_POST['weight'][$i], $visible[$i], $_POST['title'][$i], null , null , $_POST['bcachetime'][$i], $bmodule, array()); - - } - } - - return _MD_A_MYBLOCKSADMIN_DBUPDATED ; -} - - -function form_delete( $bid ) -{ - global $target_dirname ; - - $bid = intval( $bid ) ; - - $bi_handler =& xoops_gethandler('blockinstance') ; - $bi =& $bi_handler->get( $bid ) ; - if( ! is_object( $bi ) ) die( 'Invalid instanceid' ) ; - - xoops_confirm( array( 'op' => 'delete_ok' ) + $GLOBALS['xoopsGTicket']->getTicketArray( __LINE__ , 1800 , 'myblocksadmin' ) , "?mode=admin&lib=altsys&page=myblocksadmin&dirname=$target_dirname&bid=$bid" , sprintf( _MD_A_MYBLOCKSADMIN_FMT_REMOVEBLOCK , $bi->getVar('title') ) ) ; -} - - -function do_delete( $bid ) -{ - $bid = intval( $bid ) ; - - $bi_handler =& xoops_gethandler('blockinstance') ; - $bi =& $bi_handler->get( $bid ) ; - if( ! is_object( $bi ) ) die( 'Invalid instanceid' ) ; - - $bi_handler->delete( $bi ) ; - return _MD_A_MYBLOCKSADMIN_DBUPDATED ; -} - - - -function do_edit( $bid ) -{ - $bid = intval( $bid ) ; - - if( $bid <= 0 ) { - $db =& XoopsDatabaseFactory::getDatabaseConnection() ; - $result = $db->query( "SELECT bid FROM ".$db->prefix("newblocks")." WHERE show_func='b_system_custom_show'" ) ; - list( $blockbase_id ) = $db->fetchRow( $result ) ; - - $bi_handler =& xoops_gethandler('blockinstance') ; - $instance =& $bi_handler->create(); - $instance->setVar( 'bid' , $blockbase_id ) ; - $block_handler =& xoops_gethandler('block') ; - $blockbase = $block_handler->get( $blockbase_id ) ; - $instance->setVar('options', $blockbase->getVar("options") ); - $instance->setVar('title', $blockbase->getVar("name") ); - $bi_handler->insert( $instance ) ; - $bid = $instance->getVar('instanceid') ; - } - - $bcachetime = intval( @$_POST['bcachetime'] ) ; - $options = isset($_POST['options']) ? $_POST['options'] : array(); - $bcontent = isset($_POST['bcontent']) ? $_POST['bcontent'] : ''; - $bctype = isset($_POST['bctype']) ? $_POST['bctype'] : ''; -// $bmodules = (isset($_POST['bmodules']) && is_array($_POST['bmodules'])) ? $_POST['bmodules'] : array(-1) ; // TODO - return $this->update_blockinstance( $bid , intval(@$_POST['bside']) , intval(@$_POST['bweight']) , intval(@$_POST['bvisible']) , @$_POST['btitle'] , $bcontent , $bctype , $bcachetime , -1 , $options ) ; -} - - - -function form_edit( $bid , $mode = 'edit' ) -{ - $bid = intval( $bid ) ; - - $bi_handler =& xoops_gethandler('blockinstance') ; - $bi =& $bi_handler->get( $bid ) ; - - if( ! $bi->getVar('instanceid') ) { - // create new custom block - $mode = 'new' ; - $db =& XoopsDatabaseFactory::getDatabaseConnection() ; - $result = $db->query( "SELECT bid FROM ".$db->prefix("newblocks")." WHERE show_func='b_system_custom_show'" ) ; - list( $blockbase_id ) = $db->fetchRow( $result ) ; - $bi->setVar( 'bid' , $blockbase_id ) ; - $bi->setVar( 'options' , array( '' , 'S' ) ) ; - } - - $block_handler =& xoops_gethandler( 'block' ) ; - $blockbase =& $block_handler->get( $bi->getVar('bid') ) ; - $bi->setBlock( $blockbase ) ; - $module_handler =& xoops_gethandler( 'module' ) ; - $module =& $module_handler->get( $blockbase->getVar('mid') ) ; - - $action_base_url4disp = "?mode=admin&lib=altsys&page=myblocksadmin&dirname=".($blockbase->getVar('show_func')=='b_system_custom_show'?"__CustomBlocks__":$module->getVar('dirname'))."&bid=$bid" ; - - - switch( $mode ) { -// case 'clone' : -// $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM ; -// $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE ; -// $next_op = 'clone_ok' ; -// break ; - case 'new' : - $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM ; - $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW ; - $next_op = 'new_ok' ; - break ; - case 'edit' : - default : - $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM ; - $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT ; - $next_op = 'edit_ok' ; - break ; - } - - // TODO - // $modules = $this->get_modules_pages_list() ; - - $block = array( - 'bid' => $bid , - 'form_action' => $action_base_url4disp , -// 'title' => $bi->getVar('name') , - 'side' => $bi->getVar('side') , - 'weight' => $bi->getVar('weight') , - 'visible' => $bi->getVar('visible') , -// 'content' => $bi->getVar('content', 'N') , - 'title' => $bi->getVar('title','E') , -// 'modules' => $modules , - 'modules' => -1 , - 'is_custom' => false , -// 'ctype' => $bi->getVar('c_type') , - 'cachetime' => $bi->getVar('bcachetime') , - 'edit_form' => $bi->getOptions() , - 'template' => $blockbase->getVar('template') , - 'options' => $bi->getVar('options') , - 'op' => $next_op , - 'form_title' => $form_title , - 'submit_button' => $button_value , - ) ; - - echo ''. _MD_A_MYBLOCKSADMIN_BLOCKADMIN .' »» '.$form_title.'

'; - include dirname(__FILE__).'/myblockform.php' ; - $GLOBALS['xoopsGTicket']->addTicketXoopsFormElement( $form , __LINE__ , 1800 , 'myblocksadmin' ) ; - $form->display(); - -} - - -function get_modules_pages_list() -{ - $module_list = array() ; - - $module_list[_AM_SYSTEMLEVEL]["0-2"] = _AM_ADMINBLOCK; - $module_list[_AM_SYSTEMLEVEL]["0-1"] = _AM_TOPPAGE; - $module_list[_AM_SYSTEMLEVEL]["0-0"] = _AM_ALLPAGES; - $criteria = new CriteriaCompo(new Criteria('hasmain', 1)); - $criteria->add(new Criteria('isactive', 1)); - $module_handler =& xoops_gethandler('module'); - $module_main =& $module_handler->getObjects($criteria, true, true); - if (count($module_main) > 0) { - foreach (array_keys($module_main) as $mid) { - $module_list[$module_main[$mid]->getVar('name')][$mid."-0"] = _AM_ALLMODULEPAGES; - $pages = $module_main[$mid]->getInfo("pages"); - if ($pages == false) { - $pages = $module_main[$mid]->getInfo("sub"); - } - if (is_array($pages) && $pages != array()) { - foreach ($pages as $id => $pageinfo) { - $module_list[$module_main[$mid]->getVar('name')][$mid."-".$id] = $pageinfo['name']; - } - } - } - } - - return $module_list ; -} -*/ -} diff --git a/xoops_trust_path/libs/altsys/class/MyBlocksAdminForX25.class.php b/xoops_trust_path/libs/altsys/class/MyBlocksAdminForX25.class.php deleted file mode 100644 index 4adba94..0000000 --- a/xoops_trust_path/libs/altsys/class/MyBlocksAdminForX25.class.php +++ /dev/null @@ -1,364 +0,0 @@ -lang.'/admin/blocksadmin.php' ; - } - -//HACK by domifara for php5.3+ -//function &getInstance() -public static function &getInstance() -{ - static $instance; - if (!isset($instance)) { - $instance = new MyBlocksAdminForX25(); - $instance->construct() ; - } - return $instance; -} - -// virtual -// visible and side -public function renderCell4BlockPosition($block_data) -{ - $bid = intval($block_data['bid']) ; - $side = intval($block_data['side']) ; - $visible = intval($block_data['visible']) ; - - $sseln = $ssel0 = $ssel1 = $ssel3 = $ssel4 = $ssel5 = $ssel7 = $ssel8 = $ssel9 = ""; - $scoln = $scol0 = $scol1 = $scol3 = $scol4 = $scol5 = $scol7 = $scol8 = $scol9 = "unselected"; - $stextbox = "unselected" ; - $value4extra_side = '' ; - - if ($visible != 1) { - $sseln = " checked='checked'"; - $scoln = "disabled"; - } else { - switch ($side) { - case XOOPS_SIDEBLOCK_LEFT : - $ssel0 = " checked='checked'"; - $scol0 = "selected"; - break ; - case XOOPS_SIDEBLOCK_RIGHT : - $ssel1 = " checked='checked'"; - $scol1 = "selected"; - break ; - case XOOPS_CENTERBLOCK_LEFT : - $ssel3 = " checked='checked'"; - $scol3 = "selected"; - break ; - case XOOPS_CENTERBLOCK_RIGHT : - $ssel4 = " checked='checked'"; - $scol4 = "selected"; - break ; - case XOOPS_CENTERBLOCK_CENTER : - $ssel5 = " checked='checked'"; - $scol5 = "selected"; - break ; - case XOOPS_CENTERBLOCK_BOTTOMLEFT : - $ssel7 = " checked='checked'"; - $scol7 = "selected"; - break ; - case XOOPS_CENTERBLOCK_BOTTOMRIGHT : - $ssel8 = " checked='checked'"; - $scol8 = "selected"; - break ; - case XOOPS_CENTERBLOCK_BOTTOM : - $ssel9 = " checked='checked'"; - $scol9 = "selected"; - break ; - default : - $value4extra_side = $side ; - $stextbox = "selected" ; - break ; - } - } - - return " - - - - - - - - - - - - - - - - -
-
- -
-
-
-
-
- -
-
-
- -
-
-
- -
-
-
-
-
- -
-
-
- -
-
-
- -
-
-
- -
- -
-
- -
-
- -
-
"._NONE."
-
- " ; -} - - public function form_edit($bid, $mode = 'edit') - { - $bid = intval($bid) ; - -//HACK by domifara - $block = new XoopsBlock($bid) ; - - if (! $block->getVar('bid')) { - // new defaults - $bid = 0 ; - $mode = 'new' ; - $block->setVar('mid', 0) ; - $block->setVar('block_type', 'C') ; - } - - switch ($mode) { - case 'clone' : - $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM ; - $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE ; - $next_op = 'clone_ok' ; - // breadcrumbs - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM) ; - break ; - case 'new' : - $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM ; - $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW ; - $next_op = 'new_ok' ; - // breadcrumbs - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM) ; - break ; - case 'edit' : - default : - $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM ; - $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT ; - $next_op = 'edit_ok' ; - // breadcrumbs - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM) ; - break ; - } - - $is_custom = in_array($block->getVar('block_type'), array( 'C', 'E' )) ? true : false ; - $block_template = $block->getVar('template', 'n') ; - $block_template_tplset = '' ; - - if (! $is_custom && $block_template) { - // find template of the block - $tplfile_handler =& xoops_gethandler('tplfile'); - $found_templates = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', null, null, $block_template) ; - $block_template_tplset = count($found_templates) > 0 ? $GLOBALS['xoopsConfig']['template_set'] : 'default' ; - } -//HACK by domifara -/* - if ( !($block->getVar('c_type')) ){ - $block->setVar('c_type','S'); - } -*/ - $block_data = $this->preview_request + array( - 'bid' => $bid , - 'name' => $block->getVar('name', 'n') , - 'title' => $block->getVar('title', 'n') , - 'weight' => intval($block->getVar('weight')) , - 'bcachetime' => intval($block->getVar('bcachetime')) , - 'side' => intval($block->getVar('side')) , - 'visible' => intval($block->getVar('visible')) , - 'template' => $block_template , - 'template_tplset' => $block_template_tplset , - 'options' => $block->getVar('options') , - 'content' => $block->getVar('content', 'n') , - 'is_custom' => $is_custom , - 'type' => $block->getVar('block_type') , - 'ctype' => $block->getVar('c_type') , - ) ; - - $block4assign = array( - 'name_raw' => $block_data['name'] , - 'title_raw' => $block_data['title'] , - 'content_raw' => $block_data['content'] , - 'cell_position' => $this->renderCell4BlockPosition($block_data) , - 'cell_module_link' => $this->renderCell4BlockModuleLink($block_data) , - 'cell_group_perm' => $this->renderCell4BlockReadGroupPerm($block_data) , - 'cell_options' => $this->renderCell4BlockOptions($block_data) , - 'content_preview' => $this->previewContent($block_data) , - ) + $block_data ; - - // display - require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; - $tpl = new D3Tpl() ; -//dhtml - include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; - - if ($block_data['ctype']=='H' || empty($block_data['ctype'])) { - $editor_configs=array(); - $editor_configs["name"] ="content_block"; - $editor_configs["value"] = $block_data['content']; - $editor_configs["rows"] = 20; - $editor_configs["cols"] = 100; - $editor_configs["width"] = "100%"; - $editor_configs["height"] = "400px"; - $editor_configs["editor"] = xoops_getModuleOption('blocks_editor', 'system'); - $form= new XoopsFormEditor('', "textarea_content", $editor_configs); - $rendered = $form->render(); - $tpl->assign('altsys_x25_dhtmltextarea', $rendered) ; - } else { - $form = new XoopsFormDhtmlTextArea('', 'textarea_content', $block_data['content'], 80, 20); - $rendered = $form->render(); - $rendered = '
'.str_replace(array( '
' ), array( '
' ), $rendered) . '
' ; - $tpl->assign('altsys_x25_dhtmltextarea', $rendered) ; - } - - $tpl->assign(array( - 'target_dirname' => $this->target_dirname, - 'target_mname' => $this->target_mname, - 'language' => $this->lang, - 'cachetime_options' => $this->cachetime_options, - 'ctype_options' => $this->ctype_options, - 'block' => $block4assign, - 'op' => $next_op, - 'form_title' => $form_title, - 'submit_button' => $button_value, - 'common_fck_installed' => file_exists(XOOPS_ROOT_PATH.'/common/fckeditor/fckeditor.js'), - 'gticket_hidden' => $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 1800, 'myblocksadmin'), - )) ; -//HACK by domifara - $tpl->display('db:altsys_main_myblocksadmin_edit_4x25.html') ; - - return ; - } - public function fetchRequest4Block($bid) - { - $bid = intval($bid) ; - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance() ; - - if (@$_POST['extra_sides'][$bid] > 0) { - $_POST['sides'][$bid] = intval($_POST['extra_sides'][$bid]) ; - } - - if (@$_POST['sides'][$bid] < 0) { - $visible = 0 ; - $_POST['sides'][$bid] = -1 ; - } else { - $visible = 1 ; - } - - return array( - 'bid' => $bid , - 'side' => intval(@$_POST['sides'][$bid]) , - 'weight' => intval(@$_POST['weights'][$bid]) , - 'visible' => $visible , - 'title' => $myts->stripSlashesGPC(@$_POST['titles'][$bid]) , - 'content' => $myts->stripSlashesGPC(@$_POST['textarea_content']) , - 'ctype' => preg_replace('/[^A-Z]/', '', @$_POST['ctypes'][$bid]) , - 'bcachetime' => intval(@$_POST['bcachetimes'][$bid]) , - 'bmodule' => is_array(@$_POST['bmodules'][$bid]) ? $_POST['bmodules'][$bid] : array( 0 ) , - 'bgroup' => is_array(@$_POST['bgroups'][$bid]) ? $_POST['bgroups'][$bid] : array() , - 'options' => is_array(@$_POST['options'][$bid]) ? $_POST['options'][$bid] : array() , - ) ; - } - - public function previewContent($block_data) - { - $bid = intval($block_data['bid']) ; - - if (! $block_data['is_custom']) { - return '' ; - } - if (empty($this->preview_request)) { - return '' ; - } - -//HACK by domifara -//TODO : need no hook block at this - $block = new XoopsBlock($bid) ; - - if ($block->getVar('mid')) { - return '' ; - } - - $block->setVar('title', $block_data['title']) ; - $block->setVar('content', $block_data['content']) ; - - restore_error_handler() ; - $original_level = error_reporting(E_ALL) ; - -// $ret = $block->getContent( 'S' , $block_data['ctype'] ) ; - - $c_type = $block_data['ctype']; - if ($c_type == 'H') { - $ret = str_replace('{X_SITEURL}', XOOPS_URL . '/', $block->getVar('content', 'N')); - } elseif ($c_type == 'P') { - ob_start(); - echo eval($block->getVar('content', 'N')); - $content = ob_get_contents(); - ob_end_clean(); - $ret = str_replace('{X_SITEURL}', XOOPS_URL . '/', $content); - } elseif ($c_type == 'S') { - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance(); - $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $block->getVar('content', 'N')); - $ret = $myts->displayTarea($content, 1, 1); - } else { - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance(); - $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $block->getVar('content', 'N')); - $ret = $myts->displayTarea($content, 1, 0); - } - - error_reporting($original_level) ; - - return $ret ; - } -} diff --git a/xoops_trust_path/libs/altsys/class/MyBlocksAdminForXCL21.class.php b/xoops_trust_path/libs/altsys/class/MyBlocksAdminForXCL21.class.php index 221c1a5..9794216 100644 --- a/xoops_trust_path/libs/altsys/class/MyBlocksAdminForXCL21.class.php +++ b/xoops_trust_path/libs/altsys/class/MyBlocksAdminForXCL21.class.php @@ -1,52 +1,57 @@ construct() ; - } - return $instance; -} + $instance = new self(); + $instance->construct(); + } -// virtual -// options -public function renderCell4BlockOptions($block_data) -{ - if ($this->target_dirname && substr($this->target_dirname, 0, 1) != '_') { - $langman =& D3LanguageManager::getInstance() ; - $langman->read('admin.php', $this->target_dirname) ; - } + return $instance; + } - $bid = intval($block_data['bid']) ; + /** + * Virtual options + * + * @param $block_data + * + * @return false|mixed|string|null + */ + public function renderCell4BlockOptions( $block_data ) { + // if ($this->target_dirname && '_' !== substr($this->target_dirname, 0, 1)) { + if ( $this->target_dirname && '_' !== $this->target_dirname[0] ) { + $langman = D3LanguageManager::getInstance(); + $langman->read( 'admin.php', $this->target_dirname ); + } -//HACK by domifara -// $block = new XoopsBlock( $bid ) ; - $handler =& xoops_gethandler('block'); - $block =& $handler->create(false) ; - $block->load($bid) ; + $bid = (int) $block_data['bid']; - $legacy_block =& Legacy_Utils::createBlockProcedure($block) ; - return $legacy_block->getOptionForm() ; -} + $handler =& xoops_gethandler( 'block' ); + $block =& $handler->create( false ); + $block->load( $bid ); + + $legacy_block =& Legacy_Utils::createBlockProcedure( $block ); + + return $legacy_block->getOptionForm(); + } - public function checkFck() - { - return (! altsysUtils::isInstalledXclHtmleditor() && file_exists(XOOPS_ROOT_PATH.'/common/fckeditor/fckeditor.js')); - } } diff --git a/xoops_trust_path/libs/altsys/class/SetupAltsysLangMgr.class.php b/xoops_trust_path/libs/altsys/class/SetupAltsysLangMgr.class.php index a50260c..dbe3a91 100644 --- a/xoops_trust_path/libs/altsys/class/SetupAltsysLangMgr.class.php +++ b/xoops_trust_path/libs/altsys/class/SetupAltsysLangMgr.class.php @@ -1,103 +1,132 @@ mController->mCreateLanguageManager->add('SetupAltsysLangMgr::createLanguageManager'); - } +class SetupAltsysLangMgr extends XCube_ActionFilter { + public function preFilter() { + $this->mController->mCreateLanguageManager->add( 'SetupAltsysLangMgr::createLanguageManager' ); + } - public function createLanguageManager(&$langManager, $languageName) - { - $langManager = new AltsysLangMgr_LanguageManager(); - } + /** + * @param $languageName + * @param mixed $langManager + */ + + public function createLanguageManager( &$langManager, $languageName ) { + $langManager = new AltsysLangMgr_LanguageManager(); + } } -require_once XOOPS_ROOT_PATH . "/core/XCube_LanguageManager.class.php"; -require_once XOOPS_ROOT_PATH . "/modules/legacy/kernel/Legacy_LanguageManager.class.php"; - -class AltsysLangMgr_LanguageManager extends Legacy_LanguageManager -{ - public $langman = null ; - public $theme_lang_checked = false ; - - public function prepare() - { - $langmanpath = XOOPS_TRUST_PATH.'/libs/altsys/class/D3LanguageManager.class.php' ; - if (! file_exists($langmanpath)) { - die('install the latest altsys') ; - } - require_once($langmanpath) ; - $this->langman =& D3LanguageManager::getInstance() ; - $this->langman->language = $this->mLanguageName ; - - parent::prepare(); - } - - public function _loadLanguage($dirname, $fileBodyName) - { - // read/check once (selected_theme)/language/(lang).php - if (! $this->theme_lang_checked) { - $root =& XCube_Root::getSingleton() ; - if (! empty($root->mContext->mXoopsConfig['theme_set'])) { - $langdir = XOOPS_THEME_PATH.'/'.$root->mContext->mXoopsConfig['theme_set'].'/language' ; - if (file_exists($langdir)) { - $langfile = $langdir.'/'.$this->mLanguageName.'.php' ; - $engfile = $langdir.'/english.php' ; - if (file_exists($langfile)) { - require_once $langfile ; - } elseif (file_exists($engfile)) { - require_once $engfile ; - } - } - $this->theme_lang_checked = true ; - } - } - - // read normal - $this->langman->read($fileBodyName.'.php', $dirname) ; - } - - public function loadPageTypeMessageCatalog($type) - { - // I dare not to use langman... - if (strpos($type, '.') === false && $this->langman->my_language) { - $mylang_file = $this->langman->my_language.'/'.$this->mLanguageName.'/'.$type.'.php' ; - if (file_exists($mylang_file)) { - require_once $mylang_file ; - } - } - $original_error_level = error_reporting() ; - error_reporting($original_error_level & ~ E_NOTICE) ; - parent::loadPageTypeMessageCatalog($type); - error_reporting($original_error_level) ; - } - - public function loadGlobalMessageCatalog() - { - /* if (!$this->_loadFile(XOOPS_ROOT_PATH . "/modules/legacy/language/" . $this->mLanguageName . "/global.php")) { - $this->_loadFile(XOOPS_ROOT_PATH . "/modules/legacy/language/english/global.php"); - } */ - $this->_loadLanguage('legacy', 'global') ; - - // - // Now, if XOOPS_USE_MULTIBYTES isn't defined, set zero to it. - // - if (!defined("XOOPS_USE_MULTIBYTES")) { - define("XOOPS_USE_MULTIBYTES", 0); - } - } +require_once XOOPS_ROOT_PATH . '/core/XCube_LanguageManager.class.php'; +require_once XOOPS_ROOT_PATH . '/modules/legacy/kernel/Legacy_LanguageManager.class.php'; + +/** + * Class AltsysLangMgr_LanguageManager + */ +class AltsysLangMgr_LanguageManager extends Legacy_LanguageManager { + public $langman = null; + + public $theme_lang_checked = false; + + public function prepare() { + $langmanpath = XOOPS_TRUST_PATH . '/libs/altsys/class/D3LanguageManager.class.php'; + + if ( ! is_file( $langmanpath ) ) { + die( 'install the latest altsys' ); + } + + require_once $langmanpath; + + $this->langman = D3LanguageManager::getInstance(); + + $this->langman->language = $this->mLanguageName; + + parent::prepare(); + } + + /** + * @param $dirname + * @param $fileBodyName + */ + public function _loadLanguage( $dirname, $fileBodyName ) { + // read/check once (selected_theme)/language/(lang).php + if ( ! $this->theme_lang_checked ) { + + $root = XCube_Root::getSingleton(); + + if ( ! empty( $root->mContext->mXoopsConfig['theme_set'] ) ) { + + $langdir = XOOPS_THEME_PATH . '/' . $root->mContext->mXoopsConfig['theme_set'] . '/language'; + if ( file_exists( $langdir ) ) { + $langfile = $langdir . '/' . $this->mLanguageName . '.php'; + $engfile = $langdir . '/english.php'; + + if ( is_file( $langfile ) ) { + require_once $langfile; + } elseif ( is_file( $engfile ) ) { + require_once $engfile; + } + } + $this->theme_lang_checked = true; + } + } + + // read normal + $this->langman->read( $fileBodyName . '.php', $dirname ); + } + + /** + * @param string $type + */ + public function loadPageTypeMessageCatalog( $type ) { + // I dare not to use langman... + if ( false === mb_strpos( $type, '.' ) && $this->langman->my_language ) { + $mylang_file = $this->langman->my_language . '/' . $this->mLanguageName . '/' . $type . '.php'; + + if ( is_file( $mylang_file ) ) { + require_once $mylang_file; + } + } + + $original_error_level = error_reporting(); + + error_reporting( $original_error_level & ~E_NOTICE ); + parent::loadPageTypeMessageCatalog( $type ); + + error_reporting( $original_error_level ); + + } + + public function loadGlobalMessageCatalog() { + $this->_loadLanguage( 'legacy', 'global' ); + + // + // Now, if XOOPS_USE_MULTIBYTES isn't defined, set zero to it. + // + if ( ! defined( 'XOOPS_USE_MULTIBYTES' ) ) { + define( 'XOOPS_USE_MULTIBYTES', 0 ); + } + } } diff --git a/xoops_trust_path/libs/altsys/class/altsysUtils.class.php b/xoops_trust_path/libs/altsys/class/altsysUtils.class.php index eea3696..5c2fd19 100644 --- a/xoops_trust_path/libs/altsys/class/altsysUtils.class.php +++ b/xoops_trust_path/libs/altsys/class/altsysUtils.class.php @@ -1,14 +1,30 @@ register($name); @@ -16,8 +32,10 @@ public static function getDelegateCallbackClassNames($name, $doRegist = true) $m = XCube_Root::getSingleton()->mDelegateManager; if ($m) { $delgates = $m->getDelegates(); + if (isset($delgates[$name])) { $d_target = $delgates[$name]; + $keys = array_keys($d_target); $callbacks = $d_target[$keys[0]]->_mCallbacks; foreach (array_keys($callbacks) as $priority) { @@ -32,38 +50,51 @@ public static function getDelegateCallbackClassNames($name, $doRegist = true) } return $names; } - - public static function isInstalledXclHtmleditor() + + /** + * @return bool + */ + public static function isInstalledXclHtmleditor(): bool { - if (defined('LEGACY_BASE_VERSION') && version_compare(LEGACY_BASE_VERSION, '2.2.0.0', '>=')) { + if (defined('LEGACY_BASE_VERSION') && version_compare(LEGACY_BASE_VERSION, '2.2', '>=')) { $cNames = self::getDelegateCallbackClassNames('Site.TextareaEditor.HTML.Show'); if ($cNames) { $last = array_pop($cNames); - if ($last !== 'Legacy_TextareaEditor') { + if ('Legacy_TextareaEditor' !== $last) { return true; } } } return false; } - - public static function htmlspecialchars($str, $flags = ENT_COMPAT, $encoding = null, $double_encode = true) + + /** + * @param $str + * @param int $flags + * @param null $encoding + * @param bool $double_encode + * @return array|string|string[] + */ + public static function htmlSpecialChars($str, int $flags = ENT_COMPAT, $encoding = null, bool $double_encode = true) { - static $php523 = null; - if (is_null($php523)) { - $php523 = version_compare(PHP_VERSION, '5.2.3', '>='); + + $ver = (float)phpversion(); + + if ($encoding === null) { + $encoding = defined('_CHARSET') ? _CHARSET : ''; } - if (is_null($encoding)) { - $encoding = (defined('_CHARSET'))? _CHARSET : ''; - } - if ($php523) { + if ($ver > 7.0) { + // PHP_VERSION_ID >= 70000; + // do something for php7.1 and above. return htmlspecialchars($str, $flags, $encoding, $double_encode); - } else { - $ret = htmlspecialchars($str, $flags, $encoding); - if (! $double_encode) { - $ret = str_replace('&amp;', '&', $ret); - } - return $ret; } + + $ret = htmlspecialchars($str, $flags, $encoding); + + if (!$double_encode) { + $ret = str_replace('&amp;', '&', $ret); + } + + return $ret; } } diff --git a/xoops_trust_path/libs/altsys/class/d3utilities.php b/xoops_trust_path/libs/altsys/class/d3utilities.php index 233fb19..4f26847 100644 --- a/xoops_trust_path/libs/altsys/class/d3utilities.php +++ b/xoops_trust_path/libs/altsys/class/d3utilities.php @@ -1,4 +1,14 @@ dirname = basename(dirname(dirname(__FILE__))) ; - $this->mydirname = $mydirname ; - $this->table = $db->prefix($mydirname ? $mydirname . '_' . $table_body : $table_body) ; - $this->primary_key = $primary_key ; - $this->cols = $cols ; - $module_handler =& xoops_gethandler('module') ; - $module =& $module_handler->getByDirname($this->mydirname) ; - if (! empty($module)) { - $this->mid = intval($module->getVar('mid')) ; + $db =& XoopsDatabaseFactory::getDatabaseConnection(); + + $this->dirname = \basename(\dirname(__DIR__)); + + $this->mydirname = $mydirname; + + $this->table = $db->prefix($mydirname ? $mydirname . '_' . $table_body : $table_body); + + $this->primary_key = $primary_key; + + $this->cols = $cols; + + $module_handler =& xoops_gethandler('module'); + + $module =& $module_handler->getByDirname($this->mydirname); + + if (!empty($module)) { + $this->mid = (int)$module->getVar('mid'); } - $this->page_name = $page_name ; - $this->action_base_hiddens = $action_base_hiddens ; - } + $this->page_name = $page_name; + $this->action_base_hiddens = $action_base_hiddens; + } + + /** + * @param $name + * @return mixed + */ public function get_language_constant($name) { - return constant(strtoupper('_MD_A_' . $this->dirname . '_' . $this->page_name . '_' . $name)) ; + return constant(mb_strtoupper('_MD_A_' . $this->dirname . '_' . $this->page_name . '_' . $name)); } - + /** + * @param $value + * @param $col + * @return string + */ public function get_set4sql($value, $col) { switch ($col['type']) { - case 'text' : - case 'blob' : - $length = empty($col['length']) ? 65535 : intval($col['length']) ; + case 'text': + case 'blob': + $length = empty($col['length']) ? 65535 : (int)$col['length']; return "`{$col['name']}`='".addslashes(xoops_substr($value, 0, $length))."'" ; case 'char' : case 'varchar' : case 'string' : - $length = empty($col['length']) ? 255 : intval($col['length']) ; + $length = empty($col['length']) ? 191 : (int)$col['length']; return "`{$col['name']}`='".addslashes(xoops_substr($value, 0, $length))."'" ; case 'int' : case 'integer' : - $value = intval($value) ; - if (! empty($col['max'])) { - $value = min($value, intval($col['max'])) ; + $value = (int)$value; + if (!empty($col['max'])) { + $value = min($value, (int)$col['max']); } if (! empty($col['min'])) { - $value = max($value, intval($col['min'])) ; + $value = max($value, (int)$col['min']); } - return "`{$col['name']}`=$value" ; + return "`{$col['name']}`=$value"; } } - - // single update or insert + /** + * Single update or insert + * @return array + */ public function insert() { - $db =& XoopsDatabaseFactory::getDatabaseConnection() ; + $db =& XoopsDatabaseFactory::getDatabaseConnection(); - $id = $this->init_default_values() ; + $id = $this->init_default_values(); + + $set4sql = ''; - $set4sql = '' ; foreach ($this->cols as $col) { if (empty($col['edit_edit'])) { - continue ; + continue; } if ($col['name'] == $this->primary_key) { - continue ; + continue; } $set4sql .= $this->get_set4sql(@$_POST[ $col['name'] ], $col) . ',' ; } - if (! empty($set4sql)) { + if (!empty($set4sql)) { if ($id > 0) { // UPDATE - $db->queryF("UPDATE $this->table SET ".substr($set4sql, 0, -1)." WHERE $this->primary_key='".addslashes($id)."'") ; - return array( $id , 'update' ) ; + $db->queryF("UPDATE $this->table SET ".substr($set4sql, 0, -1)." WHERE $this->primary_key='".addslashes($id)."'"); + return [$id, 'update']; } else { // INSERT - $db->queryF("INSERT INTO $this->table SET ".substr($set4sql, 0, -1)) ; - return array( $db->getInsertId() , 'insert' ) ; + $db->queryF("INSERT INTO $this->table SET ".substr($set4sql, 0, -1)); + return [$db->getInsertId(), 'insert']; } } } - - // multiple update + /** + * Multiple update + * @return array + */ public function update() { - $db =& XoopsDatabaseFactory::getDatabaseConnection() ; + $db =& XoopsDatabaseFactory::getDatabaseConnection(); // search appropriate column for getting primary_key foreach ($this->cols as $col) { - if (in_array(@$col['list_edit'], array( 'text', 'textarea', 'hidden' ))) { - $column4key = $col['name'] ; - break ; + if (in_array(@$col['list_edit'], ['text', 'textarea', 'hidden'], true)) { + $column4key = $col['name']; + + break; } } if (empty($column4key)) { - $column4key = $this->cols[0]['name'] ; + $column4key = $this->cols[0]['name']; } - $ret = array() ; + $ret = []; foreach (array_keys($_POST[$column4key]) as $id) { - $id = intval($id) ; // primary_key should be 'integer' - $set4sql = '' ; + $id = (int)$id; // primary_key should be 'integer' + + $set4sql = ''; + foreach ($this->cols as $col) { if (empty($col['list_edit'])) { - continue ; + continue; } if ($col['name'] == $this->primary_key) { - continue ; + continue; } $set4sql .= $this->get_set4sql(@$_POST[ $col['name'] ][$id], $col) . ',' ; } - if (! empty($set4sql)) { - $result = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id") ; - if ($db->getRowsNum($result) == 1) { - $db->queryF("UPDATE $this->table SET ".substr($set4sql, 0, -1)." WHERE $this->primary_key=$id") ; - if ($db->getAffectedRows() == 1) { - $ret[ $id ] = $db->fetchArray($result) ; + if (!empty($set4sql)) { + $result = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id"); + if (1 == $db->getRowsNum($result)) { + $db->queryF("UPDATE $this->table SET " . mb_substr($set4sql, 0, -1) . " WHERE $this->primary_key=$id"); + + if (1 == $db->getAffectedRows()) { + $ret[$id] = $db->fetchArray($result); } } } } - return $ret ; + return $ret; } - + /** + * @param bool $delete_comments + * @param bool $delete_notifications + * @return array + */ public function delete($delete_comments = false, $delete_notifications = false) { - $db =& XoopsDatabaseFactory::getDatabaseConnection() ; + $db =& XoopsDatabaseFactory::getDatabaseConnection(); - $ret = array() ; + $ret = []; foreach (array_keys($_POST['admin_main_checkboxes']) as $id) { - $id = intval($id) ; // primary_key should be 'integer' - $result = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id") ; - if ($db->getRowsNum($result) == 1) { - $ret[ $id ] = $db->fetchArray($result) ; + $id = (int)$id; // primary_key should be 'integer' + + $result = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id"); + + if (1 == $db->getRowsNum($result)) { + $ret[$id] = $db->fetchArray($result); + + $db->queryF("DELETE FROM $this->table WHERE $this->primary_key=$id"); $db->queryF("DELETE FROM $this->table WHERE $this->primary_key=$id") ; if ($delete_comments) { // remove comments - $db->queryF("DELETE FROM ".$db->prefix("xoopscomments")." WHERE com_modid=$this->mid AND com_itemid=$id") ; + + $db->queryF('DELETE FROM ' . $db->prefix('xoopscomments') . " WHERE com_modid=$this->mid AND com_itemid=$id"); } if ($delete_notifications) { // remove notifications - $db->queryF("DELETE FROM ".$db->prefix("xoopsnotifications")." WHERE not_modid=$this->mid AND not_itemid=$id") ; + + $db->queryF('DELETE FROM ' . $db->prefix('xoopsnotifications') . " WHERE not_modid=$this->mid AND not_itemid=$id"); } } } - return $ret ; + return $ret; } - - public function init_default_values() + /** + * @return int + */ + public function init_default_values(): int { - $db =& XoopsDatabaseFactory::getDatabaseConnection() ; + $db =& XoopsDatabaseFactory::getDatabaseConnection(); if (@$_GET['id']) { - $id = intval($_GET['id']) ; - $rs = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id") ; - if ($db->getRowsNum($rs) == 1) { - $row = $db->fetchArray($rs) ; + $id = (int)$_GET['id']; + $rs = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id"); + if (1 == $db->getRowsNum($rs)) { + $row = $db->fetchArray($rs); foreach (array_keys($this->cols) as $key) { if (empty($this->cols[$key]['edit_show'])) { - continue ; + continue; } - $this->cols[$key]['default_value'] = $row[ $this->cols[$key]['name'] ] ; + $this->cols[$key]['default_value'] = $row[ $this->cols[$key]['name'] ]; } - $this->form_mode = 'edit' ; - return $id ; + + $this->form_mode = 'edit'; + + return $id; } } - $this->form_mode = 'new' ; - return 0 ; - } + $this->form_mode = 'new'; + return 0; + } + /** + * @return array + */ public function get_view_edit() { - $id = $this->init_default_values() ; + $id = $this->init_default_values(); + + $lines = []; - $lines = array() ; foreach ($this->cols as $col) { if (empty($col['edit_show'])) { - continue ; + continue; } - if (! isset($col['default_value'])) { + + if (!isset($col['default_value'])) { switch ($col['type']) { - case 'int' : - case 'integer' : - $col['default_value'] = 0 ; - break ; - default : - $col['default_value'] = '' ; - break ; + case 'int': + case 'integer': + $col['default_value'] = 0; + break; + default: + $col['default_value'] = ''; + break; } } switch ($col['edit_edit']) { - case 'checkbox' : - $checked = empty($col['default_value']) ? '' : "checked='checked'" ; - $value = empty($col['checkbox_value']) ? 1 : htmlspecialchars($col['checkbox_value'], ENT_QUOTES) ; - - $lines[ $col['name'] ] = "" ; - break ; - case 'text' : - default : - $size = empty($col['edit_size']) ? 32 : intval($col['edit_size']) ; - $length = empty($col['length']) ? 255 : intval($col['length']) ; - $lines[ $col['name'] ] = "" ; - break ; - case false : - $lines[ $col['name'] ] = htmlspecialchars($col['default_value'], ENT_QUOTES) ; - break ; + case 'checkbox': + $checked = empty($col['default_value']) ? '' : "checked='checked'"; + $value = empty($col['checkbox_value']) ? 1 : htmlspecialchars($col['checkbox_value'], ENT_QUOTES); + + $lines[$col['name']] = ""; + break; + case 'text': + default: + $size = empty($col['edit_size']) ? 32 : (int)$col['edit_size']; + $length = empty($col['length']) ? 191 : (int)$col['length']; + $lines[ $col['name'] ] = "" ; + break; + case false: + $lines[ $col['name'] ] = htmlspecialchars($col['default_value'], ENT_QUOTES); + break; } } - return array( $id , $lines ) ; + return [$id, $lines]; } - + /** + * @param $controllers + * @return string + */ public function get_control_form($controllers) { - $hiddens = '' ; + $hiddens = ''; + foreach ($this->action_base_hiddens as $key => $val) { - $key4disp = htmlspecialchars($key, ENT_QUOTES) ; - $val4disp = htmlspecialchars($val, ENT_QUOTES) ; - $hiddens .= "\n" ; + $key4disp = htmlspecialchars($key, ENT_QUOTES); + + $val4disp = htmlspecialchars($val, ENT_QUOTES); + + $hiddens .= "\n"; } - $controllers_html = '' ; + $controllers_html = ''; + foreach ($controllers as $type => $body) { - if ($type == 'num') { - $controllers_html .= $this->get_select('num', $body, $GLOBALS['num']) ; + if ('num' == $type) { + $controllers_html .= $this->get_select('num', $body, $GLOBALS['num']); } } return " -
- $hiddens - $controllers_html - -
\n" ; +
+ $hiddens + $controllers_html + +
\n"; } + /** + * @param $name + * @param $options + * @param $current_value + * @return string + */ public function get_select($name, $options, $current_value) { - $ret = "\n"; + foreach ($options as $key => $val) { - $selected = $val == $current_value ? "selected='selected'" : "" ; - $ret .= "\n" ; + $selected = $val == $current_value ? "selected='selected'" : ''; + + $ret .= "\n"; } - $ret .= "\n" ; - return $ret ; + $ret .= "\n"; + + return $ret; } } diff --git a/xoops_trust_path/libs/altsys/class/index.php b/xoops_trust_path/libs/altsys/class/index.php new file mode 100644 index 0000000..6a50543 --- /dev/null +++ b/xoops_trust_path/libs/altsys/class/index.php @@ -0,0 +1,2 @@ + // -// ------------------------------------------------------------------------- // - -require_once dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php' ; -include_once dirname(__FILE__).'/include/gtickets.php' ; -include_once dirname(__FILE__).'/include/altsys_functions.php' ; - +/** + * Altsys library (UI-Components) for D3 modules + * Compile templates admin + * @package Altsys + * @version XCL 2.3.1 + * @author Other authors gigamaster, 2020 XCL/PHP7 + * @author Gijoe (Peak) + * @copyright (c) 2005-2022 Authors + * @license GPL v2.0 + */ + +require_once __DIR__ . '/class/AltsysBreadcrumbs.class.php'; +include_once __DIR__ . '/include/gtickets.php'; +include_once __DIR__ . '/include/altsys_functions.php'; // this page can be called only from altsys // if( $xoopsModule->getVar('dirname') != 'altsys' ) die( 'this page can be called only from altsys' ) ; // language file -altsys_include_language_file('compilehookadmin') ; +altsys_include_language_file( 'compilehookadmin' ); // // DEFINITIONS // -$compile_hooks = array( - - 'enclosebycomment' => array( - 'pre' => '' , - 'post' => '' , - 'success_msg' => _TPLSADMIN_FMT_MSG_ENCLOSEBYCOMMENT , - 'dt' => _TPLSADMIN_DT_ENCLOSEBYCOMMENT , - 'dd' => _TPLSADMIN_DD_ENCLOSEBYCOMMENT , - 'conf_msg' => _TPLSADMIN_CNF_ENCLOSEBYCOMMENT , - 'skip_theme' => true , - ) , - - 'enclosebybordereddiv' => array( - 'pre' => '
' , - 'post' => '
Edit:
%1$s
' , - 'success_msg' => _TPLSADMIN_FMT_MSG_ENCLOSEBYBORDEREDDIV , - 'dt' => _TPLSADMIN_DT_ENCLOSEBYBORDEREDDIV , - 'dd' => _TPLSADMIN_DD_ENCLOSEBYBORDEREDDIV , - 'conf_msg' => _TPLSADMIN_CNF_ENCLOSEBYBORDEREDDIV , - 'skip_theme' => true , - ) , - - 'hooksavevars' => array( - 'pre' => '' , - 'post' => '' , - 'success_msg' => _TPLSADMIN_FMT_MSG_HOOKSAVEVARS , - 'dt' => _TPLSADMIN_DT_HOOKSAVEVARS , - 'dd' => _TPLSADMIN_DD_HOOKSAVEVARS , - 'conf_msg' => _TPLSADMIN_CNF_HOOKSAVEVARS , - 'skip_theme' => false , - ) , - - 'removehooks' => array( - 'pre' => '' , - 'post' => '' , - 'success_msg' => _TPLSADMIN_FMT_MSG_REMOVEHOOKS , - 'dt' => _TPLSADMIN_DT_REMOVEHOOKS , - 'dd' => _TPLSADMIN_DD_REMOVEHOOKS , - 'conf_msg' => _TPLSADMIN_CNF_REMOVEHOOKS , - 'skip_theme' => false , - ) , - -) ; +$compile_hooks = [ + + 'enclosebycomment' => [ + 'pre' => '', + 'post' => '', + 'success_msg' => _TPLSADMIN_FMT_MSG_ENCLOSEBYCOMMENT, + 'dt' => _TPLSADMIN_DT_ENCLOSEBYCOMMENT, + 'dd' => _TPLSADMIN_DD_ENCLOSEBYCOMMENT, + 'conf_msg' => _TPLSADMIN_CNF_ENCLOSEBYCOMMENT, + 'skip_theme' => true, + ], + + 'enclosebybordereddiv' => [ + 'pre' => '
', + 'post' => '
Edit:
%1$s
', + 'success_msg' => _TPLSADMIN_FMT_MSG_ENCLOSEBYBORDEREDDIV, + 'dt' => _TPLSADMIN_DT_ENCLOSEBYBORDEREDDIV, + 'dd' => _TPLSADMIN_DD_ENCLOSEBYBORDEREDDIV, + 'conf_msg' => _TPLSADMIN_CNF_ENCLOSEBYBORDEREDDIV, + 'skip_theme' => true, + ], + + 'hooksavevars' => [ + 'pre' => '', + 'post' => '', + 'success_msg' => _TPLSADMIN_FMT_MSG_HOOKSAVEVARS, + 'dt' => _TPLSADMIN_DT_HOOKSAVEVARS, + 'dd' => _TPLSADMIN_DD_HOOKSAVEVARS, + 'conf_msg' => _TPLSADMIN_CNF_HOOKSAVEVARS, + 'skip_theme' => false, + ], + + 'removehooks' => [ + 'pre' => '', + 'post' => '', + 'success_msg' => _TPLSADMIN_FMT_MSG_REMOVEHOOKS, + 'dt' => _TPLSADMIN_DT_REMOVEHOOKS, + 'dd' => _TPLSADMIN_DD_REMOVEHOOKS, + 'conf_msg' => _TPLSADMIN_CNF_REMOVEHOOKS, + 'skip_theme' => false, + ], + +]; // @@ -70,253 +74,224 @@ // // clearing files in templates_c/ -if (! empty($_POST['clearcache']) || ! empty($_POST['cleartplsvars'])) { - // Ticket Check - if (! $xoopsGTicket->check()) { - redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); - } - - if ($handler = opendir(XOOPS_COMPILE_PATH . '/')) { - while (($file = readdir($handler)) !== false) { - if (! empty($_POST['clearcache'])) { - // judging template cache '*.php' - if (substr($file, -4) !== '.php') { - continue ; - } - } else { - // judging tplsvars cache 'tplsvars_*' - if (substr($file, 0, 9) !== 'tplsvars_') { - continue ; - } - } - - $file_path = XOOPS_COMPILE_PATH . '/' . $file ; - @unlink($file_path) ; - } - redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 1, _TPLSADMIN_MSG_CLEARCACHE) ; - exit ; - } else { - die('XOOPS_COMPILE_PATH cannot be opened') ; - } +if ( ! empty( $_POST['clearcache'] ) || ! empty( $_POST['cleartplsvars'] ) ) { + // Ticket Check + + if ( ! $xoopsGTicket->check() ) { + redirect_header( XOOPS_URL . '/', 3, $xoopsGTicket->getErrors() ); + } + + if ( $handler = opendir( XOOPS_COMPILE_PATH . '/' ) ) { + while ( false !== ( $file = readdir( $handler ) ) ) { + if ( ! empty( $_POST['clearcache'] ) ) { + // check template cache '*.php' + + if ( '.php' !== mb_substr( $file, - 4 ) ) { + continue; + } + } else { + // check tplsvars cache 'tplsvars_*' + + if ( 'tplsvars_' !== mb_substr( $file, 0, 9 ) ) { + continue; + } + } + + $file_path = XOOPS_COMPILE_PATH . '/' . $file; + + @unlink( $file_path ); + } + + redirect_header( '?mode=admin&lib=altsys&page=compilehookadmin', 1, _TPLSADMIN_MSG_CLEARCACHE ); + + exit; + } + + exit( 'XOOPS_COMPILE_PATH cannot be opened' ); } // append hooking commands -foreach ($compile_hooks as $command => $compile_hook) { - if (! empty($_POST[$command])) { - // Ticket Check - if (! $xoopsGTicket->check()) { - redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); - } - - if ($handler = opendir(XOOPS_COMPILE_PATH . '/')) { - $file_count = 0 ; - while (($file = readdir($handler)) !== false) { - - // skip /. /.. and hidden files - if ($file{0} == '.') { - continue ; - } - - // skip if the extension is not .html.php - if (substr($file, -9) != '.html.php') { - continue ; - } - - // skip theme.html when comment-mode or div-mode - if ($compile_hook['skip_theme'] && substr($file, -15) == '%theme.html.php') { - $skip_mode = true ; - } else { - $skip_mode = false ; - } - - $file_path = XOOPS_COMPILE_PATH . '/' . $file ; - $file_bodies = file($file_path) ; - - // remove lines inserted by compilehookadmin - if (strstr($file_bodies[0], 'altsys')) { - array_shift($file_bodies) ; - } - if (strstr($file_bodies[count($file_bodies)-1], 'altsys')) { - array_pop($file_bodies) ; - $file_bodies[count($file_bodies)-1] = rtrim($file_bodies[count($file_bodies)-1]) ; - } - - // get the name of the source template from Smarty's comment - if (preg_match('/compiled from (\S+)/', $file_bodies[1], $regs)) { - $tpl_name = $regs[1] ; - } else { - $tpl_name = '__FILE__' ; - } - - $fw = fopen($file_path, 'w') ; - - // insert "pre" command before the compiled cache - if ($compile_hook['pre'] && ! $skip_mode) { - fwrite($fw, sprintf($compile_hook['pre'], htmlspecialchars($tpl_name, ENT_QUOTES)) . "\r\n") ; - } - - // rest of template cache - foreach ($file_bodies as $line) { - fwrite($fw, $line) ; - } - - // insert "post" command after the compiled cache - if ($compile_hook['post'] && ! $skip_mode) { - fwrite($fw, "\r\n" . sprintf($compile_hook['post'], htmlspecialchars($tpl_name, ENT_QUOTES))) ; - } - - fclose($fw) ; - - $file_count ++ ; - } - - if ($file_count > 0) { - redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, sprintf($compile_hook['success_msg'], $file_count)) ; - exit ; - } else { - redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, _TPLSADMIN_MSG_CREATECOMPILECACHEFIRST) ; - exit ; - } - } else { - die('XOOPS_COMPILE_PATH cannot be opened') ; - } - } -} +foreach ( $compile_hooks as $command => $compile_hook ) { + if ( ! empty( $_POST[ $command ] ) ) { + // Ticket Check + if ( ! $xoopsGTicket->check() ) { + redirect_header( XOOPS_URL . '/', 3, $xoopsGTicket->getErrors() ); + } + if ( $handler = opendir( XOOPS_COMPILE_PATH . '/' ) ) { + $file_count = 0; -// -// EXAMINE STAGE -// + while ( false !== ( $file = readdir( $handler ) ) ) { -// count template vars & compiled caches -$compiledcache_num = 0 ; -$tplsvars_num = 0 ; -if ($handler = opendir(XOOPS_COMPILE_PATH . '/')) { - while (($file = readdir($handler)) !== false) { - if (strncmp($file, 'tplsvars_', 9) === 0) { - $tplsvars_num ++ ; - } elseif (substr($file, -4) === '.php') { - $compiledcache_num ++ ; - } - } + // skip /. /.. and hidden files + if ( '.' == $file[0] ) { + continue; + } + + // skip if the extension is not .html.php + if ( '.html.php' != mb_substr( $file, - 9 ) ) { + continue; + } + + // skip theme.html when comment-mode or div-mode + if ( $compile_hook['skip_theme'] && '%theme.html.php' == mb_substr( $file, - 15 ) ) { + $skip_mode = true; + } else { + $skip_mode = false; + } + + $file_path = XOOPS_COMPILE_PATH . '/' . $file; + + $file_bodies = file( $file_path ); + + // remove lines inserted by compilehookadmin + if ( mb_strstr( $file_bodies[0], 'altsys' ) ) { + array_shift( $file_bodies ); + } + + if ( mb_strstr( $file_bodies[ count( $file_bodies ) - 1 ], 'altsys' ) ) { + array_pop( $file_bodies ); + + $file_bodies[ count( $file_bodies ) - 1 ] = rtrim( $file_bodies[ count( $file_bodies ) - 1 ] ); + } + + // get the name of the source template from Smarty's comment + if ( preg_match( '/compiled from (\S+)/', $file_bodies[1], $regs ) ) { + $tpl_name = $regs[1]; + } else { + $tpl_name = '__FILE__'; + } + + $fw = fopen( $file_path, 'wb' ); + + // insert "pre" command before the compiled cache + if ( $compile_hook['pre'] && ! $skip_mode ) { + fwrite( $fw, sprintf( $compile_hook['pre'], htmlspecialchars( $tpl_name, ENT_QUOTES ) ) . "\r\n" ); + } + + // rest of template cache + foreach ( $file_bodies as $line ) { + fwrite( $fw, $line ); + } + + // insert "post" command after the compiled cache + if ( $compile_hook['post'] && ! $skip_mode ) { + fwrite( $fw, "\r\n" . sprintf( $compile_hook['post'], htmlspecialchars( $tpl_name, ENT_QUOTES ) ) ); + } + + fclose( $fw ); + + $file_count ++; + } + + if ( $file_count > 0 ) { + redirect_header( '?mode=admin&lib=altsys&page=compilehookadmin', 3, sprintf( $compile_hook['success_msg'], $file_count ) ); + + exit; + } + + redirect_header( '?mode=admin&lib=altsys&page=compilehookadmin', 3, _TPLSADMIN_MSG_CREATECOMPILECACHEFIRST ); + + exit; + } + + die( 'XOOPS_COMPILE_PATH cannot be opened' ); + } } -// get tplsets -$sql = "SELECT tplset_name,COUNT(distinct tpl_file) FROM ".$xoopsDB->prefix("tplset")." LEFT JOIN ".$xoopsDB->prefix("tplfile")." ON tplset_name=tpl_tplset GROUP BY tpl_tplset ORDER BY tpl_tplset='default' DESC,tpl_tplset" ; -$srs = $xoopsDB->query($sql); -$tplset_options = "\n" ; -while (list($tplset, $tpl_count) = $xoopsDB->fetchRow($srs)) { - $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES) ; - $tplset_options .= "\n" ; + +// count template vars & compiled caches +$compiledcache_num = 0; +$tplsvars_num = 0; +if ( $handler = opendir( XOOPS_COMPILE_PATH . '/' ) ) { + while ( false !== ( $file = readdir( $handler ) ) ) { + if ( 0 === strncmp( $file, 'tplsvars_', 9 ) ) { + $tplsvars_num ++; + } elseif ( '.php' === mb_substr( $file, - 4 ) ) { + $compiledcache_num ++; + } + } } +// get tplsets +$sql = 'SELECT tplset_name,COUNT(DISTINCT tpl_file) FROM ' . $xoopsDB->prefix( 'tplset' ) . ' LEFT JOIN ' . $xoopsDB->prefix( 'tplfile' ) . " ON tplset_name=tpl_tplset GROUP BY tpl_tplset ORDER BY tpl_tplset='default' DESC,tpl_tplset"; +$srs = $xoopsDB->query( $sql ); +$tplset_options = "\n"; +while ( list( $tplset, $tpl_count ) = $xoopsDB->fetchRow( $srs ) ) { + $tplset4disp = htmlspecialchars( $tplset, ENT_QUOTES ); + + $tplset_options .= "\n"; +} -// -// FORM STAGE -// +// FORM RENDER -xoops_cp_header() ; +xoops_cp_header(); -// mymenu -altsys_include_mymenu() ; +// MyMenu +altsys_include_mymenu(); -// breadcrumbs -$breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; -$breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=compilehookadmin', _MI_ALTSYS_MENU_COMPILEHOOKADMIN) ; +// Breadcrumbs +$breadcrumbsObj = AltsysBreadcrumbs::getInstance(); +$breadcrumbsObj->appendPath( XOOPS_URL . '/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=compilehookadmin', _MI_ALTSYS_MENU_COMPILEHOOKADMIN ); +// Heading Title echo " +

" . _MI_ALTSYS_MENU_COMPILEHOOKADMIN . "

+ -
-\n" ; - -foreach ($compile_hooks as $command => $compile_hook) { - echo " -

-

-
- {$compile_hook['dt']} - -
-
- {$compile_hook['dd']} -
-
-

- \n" ; + + +\n"; + +foreach ( $compile_hooks as $command => $compile_hook ) { + echo " +

{$compile_hook['dt']}

+
+

{$compile_hook['dd']}

+

+
+ \n"; } -echo " -

- "._TPLSADMIN_NUMCAP_COMPILEDCACHES.": $compiledcache_num - - -

-

- "._TPLSADMIN_NUMCAP_TPLSVARS.": $tplsvars_num - - -

- ".$xoopsGTicket->getTicketHtml(__LINE__)." + echo "
+

" . _TPLSADMIN_NUMCAP_COMPILEDCACHES . ": $compiledcache_num

+

+

" . _TPLSADMIN_NUMCAP_TPLSVARS . ": $tplsvars_num

+

+ " . $xoopsGTicket->getTicketHtml( __LINE__ ) . " +
-
-

-

-
- "._TPLSADMIN_DT_GETTPLSVARSINFO_DW." -
-
- "._TPLSADMIN_DD_GETTPLSVARSINFO_DW." -
- - -
-
-

-
-
-

-

-
- "._TPLSADMIN_DT_GETTEMPLATES." -
-
- "._TPLSADMIN_DD_GETTEMPLATES." -
- - - -
-
-

+ +

" . _TPLSADMIN_DT_GETTPLSVARSINFO_DW . "

+
+

" . _TPLSADMIN_DD_GETTPLSVARSINFO_DW . "

+

+
-
-

-

-
- "._TPLSADMIN_DT_PUTTEMPLATES." -
-
- "._TPLSADMIN_DD_PUTTEMPLATES." -
- - - -
-
-

+ +

" . _TPLSADMIN_DT_GETTEMPLATES . "

+
+

" . _TPLSADMIN_DD_GETTEMPLATES . "

+

+
-\n" ; +
+

" . _TPLSADMIN_DT_PUTTEMPLATES . "

+
+

" . _TPLSADMIN_DD_PUTTEMPLATES . "

+

+
+
"; -xoops_cp_footer() ; +xoops_cp_footer(); diff --git a/xoops_trust_path/libs/altsys/controllers.php b/xoops_trust_path/libs/altsys/controllers.php index 4196738..52e6c13 100644 --- a/xoops_trust_path/libs/altsys/controllers.php +++ b/xoops_trust_path/libs/altsys/controllers.php @@ -1,23 +1,28 @@ read( 'modinfo.php' , 'altsys' , 'altsys' ) ; - -if (file_exists(dirname(__FILE__).'/language/'.$GLOBALS['xoopsConfig']['language'].'/modinfo.php')) { - include_once dirname(__FILE__).'/language/'.$GLOBALS['xoopsConfig']['language'].'/modinfo.php' ; -} elseif (file_exists(dirname(__FILE__).'/language/english/modinfo.php')) { - include_once dirname(__FILE__).'/language/english/modinfo.php' ; +if ( file_exists( __DIR__ . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/modinfo.php' ) ) { + include_once __DIR__ . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/modinfo.php'; +} elseif ( file_exists( __DIR__ . '/language/english/modinfo.php' ) ) { + include_once __DIR__ . '/language/english/modinfo.php'; } -$controllers = array( - 'myblocksadmin', - 'compilehookadmin', - 'get_templates', - 'get_tplsvarsinfo', - 'mypreferences', - 'mytplsadmin', - 'mytplsform', - 'put_templates', - 'mylangadmin', -) ; +$controllers = [ + 'myblocksadmin', + 'compilehookadmin', + 'get_templates', + 'get_tplsvarsinfo', + 'mypreferences', + 'mytplsadmin', + 'mytplsform', + 'put_templates', + 'mylangadmin', +]; diff --git a/xoops_trust_path/libs/altsys/get_templates.php b/xoops_trust_path/libs/altsys/get_templates.php index 940d031..6eab638 100644 --- a/xoops_trust_path/libs/altsys/get_templates.php +++ b/xoops_trust_path/libs/altsys/get_templates.php @@ -1,61 +1,66 @@ // -// ------------------------------------------------------------------------- // +/** + * Altsys library (UI-Components) for D3 modules + * Get templates admin + * @package Altsys + * @version XCL 2.3.1 + * @author Other authors gigamaster, 2020 XCL/PHP7 + * @author Gijoe (Peak) + * @copyright (c) 2005-2022 Authors + * @license GPL v2.0 + */ -error_reporting(0) ; +error_reporting( 0 ); -include_once dirname(__FILE__).'/include/gtickets.php' ; -include_once dirname(__FILE__).'/include/altsys_functions.php' ; +include_once __DIR__ . '/include/gtickets.php'; +include_once __DIR__ . '/include/altsys_functions.php'; // this page can be called only from altsys -if ($xoopsModule->getVar('dirname') != 'altsys') { - die('this page can be called only from altsys') ; +if ( 'altsys' != $xoopsModule->getVar( 'dirname' ) ) { + die( 'this page can be called only from altsys' ); } // language file -altsys_include_language_file('compilehookadmin') ; +altsys_include_language_file( 'compilehookadmin' ); -if (! empty($_POST['download_zip'])) { - require_once XOOPS_ROOT_PATH.'/class/zipdownloader.php' ; - $downloader = new XoopsZipDownloader(); - $do_download = true ; -} elseif (! empty($_POST['download_tgz'])) { - require_once XOOPS_ROOT_PATH.'/class/tardownloader.php' ; - $downloader = new XoopsTarDownloader(); - $do_download = true ; +if ( ! empty( $_POST['download_zip'] ) ) { + require_once XOOPS_ROOT_PATH . '/class/zipdownloader.php'; + $downloader = new XoopsZipDownloader(); + $do_download = true; +} elseif ( ! empty( $_POST['download_tgz'] ) ) { + require_once XOOPS_ROOT_PATH . '/class/tardownloader.php'; + $downloader = new XoopsTarDownloader(); + $do_download = true; } -if (empty($do_download)) { - exit ; +if ( empty( $do_download ) ) { + exit; } -$tplset = @$_POST['tplset'] ; -if (! preg_match('/^[0-9A-Za-z_-]{1,16}$/', $tplset)) { - die(_TPLSADMIN_ERR_INVALIDTPLSET) ; +$tplset = @$_POST['tplset']; +if ( ! preg_match( '/^[0-9A-Za-z_-]{1,16}$/', $tplset ) ) { + die( _TPLSADMIN_ERR_INVALIDTPLSET ); } //fix for mb_http_output setting and for add any browsers - if (function_exists('mb_http_output')) { - mb_http_output('pass'); - } +if ( function_exists( 'mb_http_output' ) ) { + mb_http_output( 'pass' ); +} //ob_buffer over flow //HACK by suin & nao-pon 2012/01/06 - while (ob_get_level() > 0) { - if (! ob_end_clean()) { - break; - } - } -$trs = $xoopsDB->query("SELECT distinct tpl_file,tpl_source,tpl_lastmodified FROM ".$xoopsDB->prefix("tplfile")." NATURAL LEFT JOIN ".$xoopsDB->prefix("tplsource")." WHERE tpl_tplset='".addslashes($tplset)."' ORDER BY tpl_file") ; -if ($xoopsDB->getRowsNum($trs) <= 0) { - die(_TPLSADMIN_ERR_INVALIDTPLSET) ; +while ( ob_get_level() > 0 ) { + if ( ! ob_end_clean() ) { + break; + } +} +$trs = $xoopsDB->query( 'SELECT DISTINCT tpl_file,tpl_source,tpl_lastmodified FROM ' . $xoopsDB->prefix( 'tplfile' ) . ' NATURAL LEFT JOIN ' . $xoopsDB->prefix( 'tplsource' ) . " WHERE tpl_tplset='" . addslashes( $tplset ) . "' ORDER BY tpl_file" ); +if ( $xoopsDB->getRowsNum( $trs ) <= 0 ) { + die( _TPLSADMIN_ERR_INVALIDTPLSET ); } -while (list($tpl_file, $tpl_source, $tpl_lastmodified) = $xoopsDB->fetchRow($trs)) { - $downloader->addFileData($tpl_source, $tplset.'/'.$tpl_file, $tpl_lastmodified) ; +while ( list( $tpl_file, $tpl_source, $tpl_lastmodified ) = $xoopsDB->fetchRow( $trs ) ) { + $downloader->addFileData( $tpl_source, $tplset . '/' . $tpl_file, $tpl_lastmodified ); } //bugfix by nao-pon ,echo is not necessary for downloader -$downloader->download('template_'.$tplset, true) ; +$downloader->download( 'template_' . $tplset, true ); diff --git a/xoops_trust_path/libs/altsys/get_tplsvarsinfo.php b/xoops_trust_path/libs/altsys/get_tplsvarsinfo.php index 7faf6e7..564e7c0 100644 --- a/xoops_trust_path/libs/altsys/get_tplsvarsinfo.php +++ b/xoops_trust_path/libs/altsys/get_tplsvarsinfo.php @@ -1,156 +1,172 @@ // -// ------------------------------------------------------------------------- // +/** + * Altsys library (UI-Components) for D3 modules + * Get templates vars info + * @package Altsys + * @version XCL 2.3.1 + * @author Other authors gigamaster, 2020 XCL/PHP7 + * @author Gijoe (Peak) + * @copyright (c) 2005-2022 Authors + * @license GPL v2.0 + */ -error_reporting(0) ; +error_reporting( 0 ); -include_once dirname(__FILE__).'/include/gtickets.php' ; -include_once dirname(__FILE__).'/include/altsys_functions.php' ; +include_once __DIR__ . '/include/gtickets.php'; +include_once __DIR__ . '/include/altsys_functions.php'; // this page can be called only from altsys -if ($xoopsModule->getVar('dirname') != 'altsys') { - die('this page can be called only from altsys') ; +if ( 'altsys' != $xoopsModule->getVar( 'dirname' ) ) { + die( 'this page can be called only from altsys' ); } // language file -altsys_include_language_file('compilehookadmin') ; +altsys_include_language_file( 'compilehookadmin' ); -$dw_snippets_dirname = 'files' ; -$site_name = @$_SERVER['HTTP_HOST'] ; -if (! preg_match('/^[0-9A-Za-z._-]+$/', $site_name)) { - $site_name = 'xoops_site' ; +$dw_snippets_dirname = 'files'; +$site_name = @$_SERVER['HTTP_HOST']; +if ( ! preg_match( '/^[0-9A-Za-z._-]+$/', $site_name ) ) { + $site_name = 'xoops_site'; } -// -// FUNCTIONS -// - -function convert_array2info_recursive($var_name, $var_value, $sum_array_name) -{ - switch (gettype($var_value)) { - case 'array' : - foreach ($var_value as $key => $val) { - if (gettype($key) == 'integer') { - $GLOBALS[ $sum_array_name ][ $var_name ] = '(array)' ; - continue ; - } - convert_array2info_recursive($var_name.'.'.$key, $val, $sum_array_name) ; - } - return ; - case 'string' : - $GLOBALS[ $sum_array_name ][ $var_name ] = $var_value ; - return ; - case 'boolean' : - case 'integer' : - case 'float' : - case 'double' : - $GLOBALS[ $sum_array_name ][ $var_name ] = (string)$var_value ; - return ; - case 'null' : - $GLOBALS[ $sum_array_name ][ $var_name ] = '(null)' ; - return ; - case 'object' : - $GLOBALS[ $sum_array_name ][ $var_name ] = '(object)' ; - return ; - default : - return ; - } +/** + * @param $var_name + * @param $var_value + * @param $sum_array_name + */ +function convert_array2info_recursive( $var_name, $var_value, $sum_array_name ) { + switch ( gettype( $var_value ) ) { + case 'array': + foreach ( $var_value as $key => $val ) { + if ( 'integer' == gettype( $key ) ) { + $GLOBALS[ $sum_array_name ][ $var_name ] = '(array)'; + continue; + } + convert_array2info_recursive( $var_name . '.' . $key, $val, $sum_array_name ); + } + + return; + case 'string': + $GLOBALS[ $sum_array_name ][ $var_name ] = $var_value; + + return; + case 'boolean': + case 'integer': + case 'float': + case 'double': + $GLOBALS[ $sum_array_name ][ $var_name ] = (string) $var_value; + + return; + case 'null': + $GLOBALS[ $sum_array_name ][ $var_name ] = '(null)'; + + return; + case 'object': + $GLOBALS[ $sum_array_name ][ $var_name ] = '(object)'; + + return; + default: + return; + } } - -function get_mxi_body($mxi_name, $file_entries) -{ - global $site_name ; - - return ' - - - - - + + + + + -'.$file_entries.' +' . $file_entries . ' -' ; +'; } - -// // TOTAL STAGE -// - -$tplsvarsinfo_mod_tpl = array() ; -$tplsvarsinfo_total = array() ; - -if ($handler = opendir(XOOPS_COMPILE_PATH . '/')) { - while (($file = readdir($handler)) !== false) { - - // skip files other than tplsvars_* files - if (substr($file, 0, 9) !== 'tplsvars_') { - continue ; - } - - // 'tplsvars_'.(randomized 4byte).'_'.(tpl_file) - $tpl_name = substr($file, 14) ; - if (! preg_match('/^[%0-9A-Za-z._-]+$/', $tpl_name)) { - continue ; - } - $file_path = XOOPS_COMPILE_PATH . '/' . $file ; - $file_body = implode('', file($file_path)) ; - $tplsvars = @unserialize($file_body) ; - if (! is_array($tplsvars)) { - $tplsvars = array() ; - } - $GLOBALS['tplsvarsinfo'] = array() ; - convert_array2info_recursive('', $tplsvars, 'tplsvarsinfo') ; - if (strstr($tpl_name, '%')) { - $mod_name = 'theme_etc' ; - } else { - list($mod_name) = explode('_', $tpl_name) ; - } - $tplsvarsinfo_mod_tpl[$mod_name][$tpl_name] = $tplsvarsinfo ; - $tplsvarsinfo_total = array_merge($tplsvarsinfo_total, $tplsvarsinfo) ; - } + +$tplsvarsinfo_mod_tpl = []; +$tplsvarsinfo_total = []; + +if ( $handler = opendir( XOOPS_COMPILE_PATH . '/' ) ) { + while ( false !== ( $file = readdir( $handler ) ) ) { + // skip files other than tplsvars_* files + + if ( 'tplsvars_' !== substr( $file, 0, 9 ) ) { + continue; + } + + // 'tplsvars_'.(randomized 4byte).'_'.(tpl_file) + + $tpl_name = substr( $file, 14 ); + + if ( ! preg_match( '/^[%0-9A-Za-z._-]+$/', $tpl_name ) ) { + continue; + } + $file_path = XOOPS_COMPILE_PATH . '/' . $file; + $file_body = implode( '', file( $file_path ) ); + $tplsvars = @unserialize( $file_body ); + if ( ! is_array( $tplsvars ) ) { + $tplsvars = []; + } + $GLOBALS['tplsvarsinfo'] = []; + convert_array2info_recursive( '', $tplsvars, 'tplsvarsinfo' ); + + if ( mb_strstr( $tpl_name, '%' ) ) { + $mod_name = 'theme_etc'; + } else { + list( $mod_name ) = explode( '_', $tpl_name ); + } + $tplsvarsinfo_mod_tpl[ $mod_name ][ $tpl_name ] = $tplsvarsinfo; + $tplsvarsinfo_total = array_merge( $tplsvarsinfo_total, $tplsvarsinfo ); + } } else { - die('XOOPS_COMPILE_PATH cannot be opened') ; + die( 'XOOPS_COMPILE_PATH cannot be opened' ); } -if (empty($tplsvarsinfo_total)) { - die(_TPLSADMIN_ERR_NOTPLSVARSINFO) ; + +// Redirect message if empty templates variables +if ( empty( $tplsvarsinfo_total ) ) { + redirect_header( '?mode=admin&lib=altsys&page=compilehookadmin', 3, _TPLSADMIN_ERR_NOTPLSVARSINFO ); + exit; } -// -// FOR DREAM WEAVER -// + +// FOR DREAMWEAVER $snippet_format = ' @@ -159,54 +175,62 @@ function get_mxi_body($mxi_name, $file_entries) -' ; +'; -if (! empty($_POST['as_dw_extension_zip'])) { - require_once XOOPS_ROOT_PATH.'/class/zipdownloader.php' ; - $downloader = new XoopsZipDownloader(); - $do_download = true ; -} elseif (! empty($_POST['as_dw_extension_tgz'])) { - require_once XOOPS_ROOT_PATH.'/class/tardownloader.php' ; - $downloader = new XoopsTarDownloader(); - $do_download = true ; +if ( ! empty( $_POST['as_dw_extension_zip'] ) ) { + require_once XOOPS_ROOT_PATH . '/class/zipdownloader.php'; + $downloader = new XoopsZipDownloader(); + $do_download = true; +} elseif ( ! empty( $_POST['as_dw_extension_tgz'] ) ) { + require_once XOOPS_ROOT_PATH . '/class/tardownloader.php'; + $downloader = new XoopsTarDownloader(); + $do_download = true; } -if (! empty($do_download)) { - //fix for mb_http_output setting and for add any browsers - if (function_exists('mb_http_output')) { - mb_http_output('pass'); - } - //ob_buffer over flow -//HACK by suin & nao-pon 2012/01/06 - while (ob_get_level() > 0) { - if (! ob_end_clean()) { - break; - } - } - // make files for each tplsvars - foreach ($tplsvarsinfo_total as $key => $val) { - $name = substr($key, 1) ; - $description = htmlspecialchars(xoops_utf8_encode(xoops_substr($val, 0, 256)), ENT_QUOTES) ; - $snippet_body = sprintf($snippet_format, $name, $description) ; - - $file_name = strtr($key, '.', '_') . '.csn' ; - $downloader->addFileData($snippet_body, $dw_snippets_dirname.'/'.$file_name) ; - } - - // make a mxi file per module - foreach ($tplsvarsinfo_mod_tpl as $mod_name => $tplsvarsinfo_tpl) { - $file_entries = '' ; - foreach ($tplsvarsinfo_tpl as $tpl_name => $tplsvarsinfo) { - foreach ($tplsvarsinfo as $key => $val) { - $name = substr($key, 1) ; - $file_name = strtr($key, '.', '_') . '.csn' ; - $file_entries .= "\t\t".''."\n" ; - } - } - $mxi_body = get_mxi_body($mod_name, $file_entries) ; - $downloader->addFileData($mxi_body, $mod_name.'.mxi') ; - } -//bugfix by nao-pon ,echo is not necessary for downloader - $downloader->download('tplsvarsinfo', true) ; +if ( ! empty( $do_download ) ) { + //fix for mb_http_output setting and for add any browsers + if ( function_exists( 'mb_http_output' ) ) { + mb_http_output( 'pass' ); + } + //ob_buffer over flow + //HACK by suin & nao-pon 2012/01/06 + while ( ob_get_level() > 0 ) { + if ( ! ob_end_clean() ) { + break; + } + } + // make files for each tplsvars + foreach ( $tplsvarsinfo_total as $key => $val ) { + $name = mb_substr( $key, 1 ); + + // TODO @gigamaster only variables can be passed by reference + //$description = htmlspecialchars( xoops_utf8_encode( xoops_substr( $val, 0, 191 ) ), ENT_QUOTES ); + $textval = xoops_substr($val, 0, 191); + $description = htmlspecialchars( xoops_utf8_encode($textval), ENT_QUOTES ); + + $snippet_body = sprintf( $snippet_format, $name, $description ); + + $file_name = strtr( $key, '.', '_' ) . '.csn'; + + $downloader->addFileData( $snippet_body, $dw_snippets_dirname . '/' . $file_name ); + } + + // make a mxi file per module + foreach ( $tplsvarsinfo_mod_tpl as $mod_name => $tplsvarsinfo_tpl ) { + $file_entries = ''; + foreach ( $tplsvarsinfo_tpl as $tpl_name => $tplsvarsinfo ) { + foreach ( $tplsvarsinfo as $key => $val ) { + $name = mb_substr( $key, 1 ); + + $file_name = strtr( $key, '.', '_' ) . '.csn'; + + $file_entries .= "\t\t" . '' . "\n"; + } + } + $mxi_body = get_mxi_body( $mod_name, $file_entries ); + $downloader->addFileData( $mxi_body, $mod_name . '.mxi' ); + } + //bugfix by nao-pon ,echo is not necessary for downloader + $downloader->download( 'tplsvarsinfo', true ); } diff --git a/xoops_trust_path/libs/altsys/include/Archive_Zip.php b/xoops_trust_path/libs/altsys/include/Archive_Zip.php index 5ed4042..693a37e 100644 --- a/xoops_trust_path/libs/altsys/include/Archive_Zip.php +++ b/xoops_trust_path/libs/altsys/include/Archive_Zip.php @@ -144,8 +144,7 @@ public function __construct($p_zipname) PEAR::loadExtension('zlib'); }*/ // GIJ if (!extension_loaded('zlib')) { - die("The extension 'zlib' couldn't be found.\n". - "Please make sure your version of PHP was built ". + die("The extension 'zlib' couldn't be found.\n". 'Please make sure your version of PHP was built ' . "with 'zlib' support.\n"); return false; } @@ -186,19 +185,22 @@ public function create($p_filelist, $p_params=0) $this->_errorReset(); // ----- Set default values - if ($p_params === 0) { - $p_params = array(); - } - if ($this->_check_parameters($p_params, - array('no_compression' => false, - 'add_path' => "", - 'remove_path' => "", - 'remove_all_path' => false)) != 1) { + if (0 === $p_params) { + $p_params = []; + } + if (1 != $this->_check_parameters($p_params, + [ + 'no_compression' => false, + 'add_path' => '', + 'remove_path' => '', + 'remove_all_path' => false + ] + )) { return 0; } // ----- Look if the $p_filelist is really an array - $p_result_list = array(); + $p_result_list = []; if (is_array($p_filelist)) { $v_result = $this->_create($p_filelist, $p_result_list, $p_params); } @@ -218,7 +220,7 @@ public function create($p_filelist, $p_params=0) $v_result = ARCHIVE_ZIP_ERR_INVALID_PARAMETER; } - if ($v_result != 1) { + if (1 != $v_result) { return 0; } @@ -257,21 +259,24 @@ public function add($p_filelist, $p_params=0) $this->_errorReset(); // ----- Set default values - if ($p_params === 0) { - $p_params = array(); - } - if ($this->_check_parameters($p_params, - array('no_compression' => false, - 'add_path' => '', - 'remove_path' => '', - 'remove_all_path' => false, - 'callback_pre_add' => '', - 'callback_post_add' => '')) != 1) { + if (0 === $p_params) { + $p_params = []; + } + if (1 != $this->_check_parameters($p_params, + [ + 'no_compression' => false, + 'add_path' => '', + 'remove_path' => '', + 'remove_all_path' => false, + 'callback_pre_add' => '', + 'callback_post_add' => '' + ] + )) { return 0; } // ----- Look if the $p_filelist is really an array - $p_result_list = array(); + $p_result_list = []; if (is_array($p_filelist)) { // ----- Call the create fct $v_result = $this->_add($p_filelist, $p_result_list, $p_params); @@ -289,11 +294,12 @@ public function add($p_filelist, $p_params=0) // ----- Invalid variable else { $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER, - "add() : Invalid variable type p_filelist"); + 'add() : Invalid variable type p_filelist' + ); $v_result = ARCHIVE_ZIP_ERR_INVALID_PARAMETER; } - if ($v_result != 1) { + if (1 != $v_result) { return 0; } @@ -355,10 +361,10 @@ public function listContent() return(0); } - $v_list = array(); - if ($this->_list($v_list) != 1) { + $v_list = []; + if (1 != $this->_list($v_list)) { unset($v_list); - return(0); + return 0; } return $v_list; @@ -409,33 +415,36 @@ public function extract($p_params=0) // ----- Check archive if (!$this->_checkFormat()) { - return(0); + return 0; } // ----- Set default values - if ($p_params === 0) { - $p_params = array(); - } - if ($this->_check_parameters($p_params, - array('extract_as_string' => false, - 'add_path' => '', - 'remove_path' => '', - 'remove_all_path' => false, - 'callback_pre_extract' => '', - 'callback_post_extract' => '', - 'set_chmod' => 0, - 'by_name' => '', - 'by_index' => '', - 'by_ereg' => '', - 'by_preg' => '')) != 1) { + if (0 === $p_params) { + $p_params = []; + } + if (1 != $this->_check_parameters($p_params, + [ + 'extract_as_string' => false, + 'add_path' => '', + 'remove_path' => '', + 'remove_all_path' => false, + 'callback_pre_extract' => '', + 'callback_post_extract' => '', + 'set_chmod' => 0, + 'by_name' => '', + 'by_index' => '', + 'by_ereg' => '', + 'by_preg' => '' + ] + )) { return 0; } // ----- Call the extracting fct - $v_list = array(); - if ($this->_extractByRule($v_list, $p_params) != 1) { + $v_list = []; + if (1 != $this->_extractByRule($v_list, $p_params)) { unset($v_list); - return(0); + return 0; } return $v_list; @@ -471,23 +480,26 @@ public function delete($p_params) // ----- Check archive if (!$this->_checkFormat()) { - return(0); + return 0; } // ----- Set default values - if ($this->_check_parameters($p_params, - array('by_name' => '', - 'by_index' => '', - 'by_ereg' => '', - 'by_preg' => '')) != 1) { + if (1 != $this->_check_parameters($p_params, + [ + 'by_name' => '', + 'by_index' => '', + 'by_ereg' => '', + 'by_preg' => '' + ] + )) { return 0; } // ----- Check that at least one rule is set - if (($p_params['by_name'] == '') - && ($p_params['by_index'] == '') - && ($p_params['by_ereg'] == '') - && ($p_params['by_preg'] == '')) { + if (('' == $p_params['by_name']) + && ('' == $p_params['by_index']) + && ('' == $p_params['by_ereg']) + && ('' == $p_params['by_preg'])) { $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER, 'At least one filtering rule must' .' be set as parameter'); @@ -495,10 +507,10 @@ public function delete($p_params) } // ----- Call the delete fct - $v_list = array(); - if ($this->_deleteByRule($v_list, $p_params) != 1) { + $v_list = []; + if (1 != $this->_deleteByRule($v_list, $p_params)) { unset($v_list); - return(0); + return 0; } return $v_list; @@ -507,27 +519,26 @@ public function delete($p_params) // {{{ properties() /** - * This method gives the global properties of the archive. - * The properties are : - * nb : Number of files in the archive - * comment : Comment associated with the archive file - * status : not_exist, ok - * - * @access public - * @param mixed $p_params {Description} - * @return mixed An array with the global properties or 0 on error. - */ + * This method gives the global properties of the archive. + * The properties are : + * nb : Number of files in the archive + * comment : Comment associated with the archive file + * status : not_exist, ok + * + * @access public + * @return mixed An array with the global properties or 0 on error. + */ public function properties() { $this->_errorReset(); // ----- Check archive if (!$this->_checkFormat()) { - return(0); + return 0; } // ----- Default properties - $v_prop = array(); + $v_prop = []; $v_prop['comment'] = ''; $v_prop['nb'] = 0; $v_prop['status'] = 'not_exist'; @@ -535,7 +546,7 @@ public function properties() // ----- Look if file exists if (@is_file($this->_zipname)) { // ----- Open the zip file - if (($this->_zip_fd = @fopen($this->_zipname, 'rb')) == 0) { + if (0 == ($this->_zip_fd = @fopen($this->_zipname, 'rb'))) { $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->_zipname .'\' in binary read mode'); @@ -543,8 +554,8 @@ public function properties() } // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->_readEndCentralDir($v_central_dir)) != 1) { + $v_central_dir = []; + if (1 != ($v_result = $this->_readEndCentralDir($v_central_dir))) { return 0; } @@ -570,7 +581,7 @@ public function properties() * @access public * @param mixed $p_archive It can be a valid Archive_Zip object or * the filename of a valid zip archive. - * @return integer 1 on success, 0 on failure. + * @return int 1 on success, 0 on failure. */ public function duplicate($p_archive) { @@ -578,7 +589,7 @@ public function duplicate($p_archive) // ----- Look if the $p_archive is a Archive_Zip object if ((is_object($p_archive)) - && (strtolower(get_class($p_archive)) == 'archive_zip')) { + && ('archive_zip' == mb_strtolower(get_class($p_archive)))) { $v_result = $this->_duplicate($p_archive->_zipname); } @@ -598,7 +609,8 @@ public function duplicate($p_archive) // ----- Invalid variable else { $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER, - "Invalid variable type p_archive_to_add"); + 'Invalid variable type p_archive_to_add' + ); $v_result = ARCHIVE_ZIP_ERR_INVALID_PARAMETER; } @@ -616,7 +628,7 @@ public function duplicate($p_archive) * @access public * @param mixed $p_archive_to_add It can be a valid Archive_Zip object or * the filename of a valid zip archive. - * @return integer 1 on success, 0 on failure. + * @return int 1 on success, 0 on failure. */ public function merge($p_archive_to_add) { @@ -625,12 +637,12 @@ public function merge($p_archive_to_add) // ----- Check archive if (!$this->_checkFormat()) { - return(0); + return 0; } // ----- Look if the $p_archive_to_add is a Archive_Zip object if ((is_object($p_archive_to_add)) - && (strtolower(get_class($p_archive_to_add)) == 'archive_zip')) { + && ('archive_zip' == mb_strtolower(get_class($p_archive_to_add)))) { $v_result = $this->_merge($p_archive_to_add); } @@ -646,7 +658,8 @@ public function merge($p_archive_to_add) // ----- Invalid variable else { $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER, - "Invalid variable type p_archive_to_add"); + 'Invalid variable type p_archive_to_add' + ); $v_result = ARCHIVE_ZIP_ERR_INVALID_PARAMETER; } @@ -659,7 +672,7 @@ public function merge($p_archive_to_add) * Method that gives the lastest error code. * * @access public - * @return integer The error code value. + * @return int The error code value. */ public function errorCode() { @@ -672,7 +685,7 @@ public function errorCode() * This method gives the latest error code name. * * @access public - * @param boolean $p_with_code If true, gives the name and the int value. + * @param bool $p_with_code If true, gives the name and the int value. * @return string The error name. */ public function errorName($p_with_code=false) @@ -682,22 +695,22 @@ public function errorName($p_with_code=false) // ----- Extract error constants from all const. for (reset($v_const_list); list($v_key, $v_value) = each($v_const_list);) { - if (substr($v_key, 0, strlen('ARCHIVE_ZIP_ERR_')) - =='ARCHIVE_ZIP_ERR_') { + if ('ARCHIVE_ZIP_ERR_' + == mb_substr($v_key, 0, mb_strlen('ARCHIVE_ZIP_ERR_'))) { $v_error_list[$v_key] = $v_value; } } // ----- Search the name form the code value - $v_key=array_search($this->_error_code, $v_error_list, true); - if ($v_key!=false) { + $v_key = array_search($this->_error_code, $v_error_list, true); + if (false != $v_key) { $v_value = $v_key; } else { $v_value = 'NoName'; } if ($p_with_code) { - return($v_value.' ('.$this->_error_code.')'); + return($v_value .' ('.$this->_error_code.')'); } else { return($v_value); } @@ -709,7 +722,7 @@ public function errorName($p_with_code=false) * This method returns the description associated with the latest error. * * @access public - * @param boolean $p_full If set to true gives the description with the + * @param bool $p_full If set to true gives the description with the * error code, the name and the description. * If set to false gives only the description * and the error code. @@ -718,9 +731,9 @@ public function errorName($p_with_code=false) public function errorInfo($p_full=false) { if ($p_full) { - return($this->errorName(true)." : ".$this->_error_string); + return($this->errorName(true) . ' : ' . $this->_error_string); } else { - return($this->_error_string." [code ".$this->_error_code."]"); + return($this->_error_string . ' [code ' . $this->_error_code . ']'); } } // }}} @@ -746,13 +759,14 @@ public function errorInfo($p_full=false) // true on success, // false on error, the error code is set. // --------------------------------------------------------------------------- - /** - * Archive_Zip::_checkFormat() - * - * { Description } - * - * @param integer $p_level - */ + /** + * Archive_Zip::_checkFormat() + * + * { Description } + * + * @param int $p_level + * @return bool + */ public function _checkFormat($p_level=0) { $v_result = true; @@ -796,23 +810,26 @@ public function _checkFormat($p_level=0) // Parameters : // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_create() - * - * { Description } - * - */ + /** + * Archive_Zip::_create() + * + * { Description } + * @param $p_list + * @param $p_result_list + * @param $p_params + * @return int + */ public function _create($p_list, &$p_result_list, &$p_params) { $v_result=1; - $v_list_detail = array(); + $v_list_detail = []; $p_add_dir = $p_params['add_path']; $p_remove_dir = $p_params['remove_path']; $p_remove_all_dir = $p_params['remove_all_path']; // ----- Open the file in write mode - if (($v_result = $this->_openFd('wb')) != 1) { + if (1 != ($v_result = $this->_openFd('wb'))) { // ----- Return return $v_result; } @@ -834,35 +851,38 @@ public function _create($p_list, &$p_result_list, &$p_params) // Parameters : // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_add() - * - * { Description } - * - */ + /** + * Archive_Zip::_add() + * + * { Description } + * @param $p_list + * @param $p_result_list + * @param $p_params + * @return int + */ public function _add($p_list, &$p_result_list, &$p_params) { $v_result=1; - $v_list_detail = array(); + $v_list_detail = []; $p_add_dir = $p_params['add_path']; $p_remove_dir = $p_params['remove_path']; $p_remove_all_dir = $p_params['remove_all_path']; // ----- Look if the archive exists or is empty and need to be created - if ((!is_file($this->_zipname)) || (filesize($this->_zipname) == 0)) { + if ((!is_file($this->_zipname)) || (0 == filesize($this->_zipname))) { $v_result = $this->_create($p_list, $p_result_list, $p_params); return $v_result; } // ----- Open the zip file - if (($v_result=$this->_openFd('rb')) != 1) { + if (1 != ($v_result=$this->_openFd('rb'))) { return $v_result; } // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->_readEndCentralDir($v_central_dir)) != 1) { + $v_central_dir = []; + if (1 != ($v_result = $this->_readEndCentralDir($v_central_dir))) { $this->_closeFd(); return $v_result; } @@ -874,7 +894,7 @@ public function _add($p_list, &$p_result_list, &$p_params) $v_zip_temp_name = ARCHIVE_ZIP_TEMPORARY_DIR.uniqid('archive_zip-').'.tmp'; // ----- Open the temporary file in write mode - if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) { + if (0 == ($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb'))) { $this->_closeFd(); $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL, @@ -887,7 +907,7 @@ public function _add($p_list, &$p_result_list, &$p_params) // TBC : Here I should better append the file and go back to erase the // central dir $v_size = $v_central_dir['offset']; - while ($v_size != 0) { + while (0 != $v_size) { $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE ? $v_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); $v_buffer = fread($this->_zip_fd, $v_read_size); @@ -903,10 +923,10 @@ public function _add($p_list, &$p_result_list, &$p_params) $v_zip_temp_fd = $v_swap; // ----- Add the files - $v_header_list = array(); - if (($v_result = $this->_addFileList($p_list, $v_header_list, - $p_add_dir, $p_remove_dir, - $p_remove_all_dir, $p_params)) != 1) { + $v_header_list = []; + if (1 != ($v_result = $this->_addFileList($p_list, $v_header_list, + $p_add_dir, $p_remove_dir, + $p_remove_all_dir, $p_params))) { fclose($v_zip_temp_fd); $this->_closeFd(); @unlink($v_zip_temp_name); @@ -920,7 +940,7 @@ public function _add($p_list, &$p_result_list, &$p_params) // ----- Copy the block of file headers from the old archive $v_size = $v_central_dir['size']; - while ($v_size != 0) { + while (0 != $v_size) { $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE ? $v_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); $v_buffer = @fread($v_zip_temp_fd, $v_read_size); @@ -929,10 +949,10 @@ public function _add($p_list, &$p_result_list, &$p_params) } // ----- Create the Central Dir files header - for ($i=0, $v_count=0; $i_writeCentralFileHeader($v_header_list[$i]))!=1) { + if ('ok' == $v_header_list[$i]['status']) { + if (1 != ($v_result=$this->_writeCentralFileHeader($v_header_list[$i]))) { fclose($v_zip_temp_fd); $this->_closeFd(); @unlink($v_zip_temp_name); @@ -954,10 +974,10 @@ public function _add($p_list, &$p_result_list, &$p_params) $v_size = @ftell($this->_zip_fd)-$v_offset; // ----- Create the central dir footer - if (($v_result = $this->_writeCentralHeader($v_count - +$v_central_dir['entries'], - $v_size, $v_offset, - $v_comment)) != 1) { + if (1 != ($v_result = $this->_writeCentralHeader($v_count + +$v_central_dir['entries'], + $v_size, $v_offset, + $v_comment))) { // ----- Reset the file list unset($v_header_list); @@ -995,25 +1015,26 @@ public function _add($p_list, &$p_result_list, &$p_params) // Description : // Parameters : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_openFd() - * - * { Description } - * - */ + /** + * Archive_Zip::_openFd() + * + * { Description } + * @param $p_mode + * @return int + */ public function _openFd($p_mode) { $v_result=1; // ----- Look if already open - if ($this->_zip_fd != 0) { + if (0 != $this->_zip_fd) { $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->_zipname.'\' already open'); return Archive_Zip::errorCode(); } // ----- Open the zip file - if (($this->_zip_fd = @fopen($this->_zipname, $p_mode)) == 0) { + if (0 == ($this->_zip_fd = @fopen($this->_zipname, $p_mode))) { $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->_zipname .'\' in '.$p_mode.' mode'); @@ -1040,7 +1061,7 @@ public function _closeFd() { $v_result=1; - if ($this->_zip_fd != 0) { + if (0 != $this->_zip_fd) { @fclose($this->_zip_fd); } $this->_zip_fd = 0; @@ -1063,22 +1084,28 @@ public function _closeFd() // $p_remove_dir : Path to remove in the filename path archived // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_addList() - * - * { Description } - * - */ + /** + * Archive_Zip::_addList() + * + * { Description } + * @param $p_list + * @param $p_result_list + * @param $p_add_dir + * @param $p_remove_dir + * @param $p_remove_all_dir + * @param $p_params + * @return int + */ public function _addList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params) { $v_result=1; // ----- Add the files - $v_header_list = array(); - if (($v_result = $this->_addFileList($p_list, $v_header_list, - $p_add_dir, $p_remove_dir, - $p_remove_all_dir, $p_params)) != 1) { + $v_header_list = []; + if (1 != ($v_result = $this->_addFileList($p_list, $v_header_list, + $p_add_dir, $p_remove_dir, + $p_remove_all_dir, $p_params))) { return $v_result; } @@ -1086,10 +1113,10 @@ public function _addList($p_list, &$p_result_list, $v_offset = @ftell($this->_zip_fd); // ----- Create the Central Dir files header - for ($i=0, $v_count=0; $i_writeCentralFileHeader($v_header_list[$i])) != 1) { + if ('ok' == $v_header_list[$i]['status']) { + if (1 != ($v_result = $this->_writeCentralFileHeader($v_header_list[$i]))) { return $v_result; } $v_count++; @@ -1106,8 +1133,8 @@ public function _addList($p_list, &$p_result_list, $v_size = @ftell($this->_zip_fd)-$v_offset; // ----- Create the central dir footer - if (($v_result = $this->_writeCentralHeader($v_count, $v_size, $v_offset, - $v_comment)) != 1) { + if (1 != ($v_result = $this->_writeCentralHeader($v_count, $v_size, $v_offset, + $v_comment))) { // ----- Reset the file list unset($v_header_list); @@ -1133,29 +1160,35 @@ public function _addList($p_list, &$p_result_list, // $p_remove_dir : Path to remove in the filename path archived // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_addFileList() - * - * { Description } - * - */ + /** + * Archive_Zip::_addFileList() + * + * { Description } + * @param $p_list + * @param $p_result_list + * @param $p_add_dir + * @param $p_remove_dir + * @param $p_remove_all_dir + * @param $p_params + * @return int + */ public function _addFileList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params) { $v_result=1; - $v_header = array(); + $v_header = []; // ----- Recuperate the current number of elt in list - $v_nb = sizeof($p_result_list); + $v_nb = count($p_result_list); // ----- Loop on the files - for ($j=0; ($j_tool_TranslateWinPath($p_list[$j], false); // ----- Skip empty file names - if ($p_filename == "") { + if ('' == $p_filename) { continue; } @@ -1169,7 +1202,7 @@ public function _addFileList($p_list, &$p_result_list, // ----- Look if it is a file or a dir with no all pathnre move if ((is_file($p_filename)) || ((is_dir($p_filename)) && !$p_remove_all_dir)) { // ----- Add the file - if (($v_result = $this->_addFile($p_filename, $v_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_params)) != 1) { + if (1 != ($v_result = $this->_addFile($p_filename, $v_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_params))) { // ----- Return status return $v_result; } @@ -1182,10 +1215,10 @@ public function _addFileList($p_list, &$p_result_list, if (is_dir($p_filename)) { // ----- Look for path - if ($p_filename != ".") { - $v_path = $p_filename."/"; + if ('.' != $p_filename) { + $v_path = $p_filename . '/'; } else { - $v_path = ""; + $v_path = ''; } // ----- Read the directory for files and sub-directories @@ -1198,7 +1231,7 @@ public function _addFileList($p_list, &$p_result_list, if (is_file($v_path.$p_hitem)) { // ----- Add the file - if (($v_result = $this->_addFile($v_path.$p_hitem, $v_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_params)) != 1) { + if (1 != ($v_result = $this->_addFile($v_path . $p_hitem, $v_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_params))) { // ----- Return status return $v_result; } @@ -1215,7 +1248,7 @@ public function _addFileList($p_list, &$p_result_list, $v_result = $this->_addFileList($p_temp_list, $p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_params); // ----- Update the number of elements of the list - $v_nb = sizeof($p_result_list); + $v_nb = count($p_result_list); } } @@ -1236,19 +1269,25 @@ public function _addFileList($p_list, &$p_result_list, // Parameters : // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_addFile() - * - * { Description } - * - */ + /** + * Archive_Zip::_addFile() + * + * { Description } + * @param $p_filename + * @param $p_header + * @param $p_add_dir + * @param $p_remove_dir + * @param $p_remove_all_dir + * @param $p_params + * @return int + */ public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params) { $v_result=1; - if ($p_filename == "") { + if ('' == $p_filename) { // ----- Error log - $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)"); + $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER, 'Invalid file list parameter (invalid or empty list)'); // ----- Return return Archive_Zip::errorCode(); @@ -1262,16 +1301,16 @@ public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_ $v_stored_filename = basename($p_filename); } // ----- Look for partial path remove - elseif ($p_remove_dir != "") { - if (substr($p_remove_dir, -1) != '/') { - $p_remove_dir .= "/"; + elseif ('' != $p_remove_dir) { + if ('/' != substr($p_remove_dir, -1)) { + $p_remove_dir .= '/'; } - if ((substr($p_filename, 0, 2) == "./") || (substr($p_remove_dir, 0, 2) == "./")) { - if ((substr($p_filename, 0, 2) == "./") && (substr($p_remove_dir, 0, 2) != "./")) { - $p_remove_dir = "./".$p_remove_dir; + if (('./' == substr($p_filename, 0, 2)) || ('./' == substr($p_remove_dir, 0, 2))) { + if (('./' == substr($p_filename, 0, 2)) && ('./' != substr($p_remove_dir, 0, 2))) { + $p_remove_dir = './' . $p_remove_dir; } - if ((substr($p_filename, 0, 2) != "./") && (substr($p_remove_dir, 0, 2) == "./")) { + if (('./' != substr($p_filename, 0, 2)) && ('./' == substr($p_remove_dir, 0, 2))) { $p_remove_dir = substr($p_remove_dir, 2); } } @@ -1281,19 +1320,19 @@ public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_ // if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir) - if ($v_compare == 2) { - $v_stored_filename = ""; + if (2 == $v_compare) { + $v_stored_filename = ''; } else { $v_stored_filename = substr($p_filename, strlen($p_remove_dir)); } } } // ----- Look for path to add - if ($p_add_dir != "") { - if (substr($p_add_dir, -1) == "/") { + if ('' != $p_add_dir) { + if ('/' == substr($p_add_dir, -1)) { $v_stored_filename = $p_add_dir.$v_stored_filename; } else { - $v_stored_filename = $p_add_dir."/".$v_stored_filename; + $v_stored_filename = $p_add_dir . '/' . $v_stored_filename; } } @@ -1339,19 +1378,19 @@ public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_ // ----- Look for pre-add callback if ((isset($p_params[ARCHIVE_ZIP_PARAM_PRE_ADD])) - && ($p_params[ARCHIVE_ZIP_PARAM_PRE_ADD] != '')) { + && ('' != $p_params[ARCHIVE_ZIP_PARAM_PRE_ADD])) { // ----- Generate a local information - $v_local_header = array(); + $v_local_header = []; $this->_convertHeader2FileInfo($p_header, $v_local_header); // ----- Call the callback // Here I do not use call_user_func() because I need to send a reference to the // header. eval('$v_result = '.$p_params[ARCHIVE_ZIP_PARAM_PRE_ADD].'(ARCHIVE_ZIP_PARAM_PRE_ADD, $v_local_header);'); - if ($v_result == 0) { + if (0 == $v_result) { // ----- Change the file status - $p_header['status'] = "skipped"; + $p_header['status'] = 'skipped'; $v_result = 1; } @@ -1363,8 +1402,8 @@ public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_ } // ----- Look for empty stored filename - if ($p_header['stored_filename'] == "") { - $p_header['status'] = "filtered"; + if ('' == $p_header['stored_filename']) { + $p_header['status'] = 'filtered'; } // ----- Check the path length @@ -1373,12 +1412,12 @@ public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_ } // ----- Look if no error, or file not skipped - if ($p_header['status'] == 'ok') { + if ('ok' == $p_header['status']) { // ----- Look for a file if (is_file($p_filename)) { // ----- Open the source file - if (($v_file = @fopen($p_filename, "rb")) == 0) { + if (0 == ($v_file = @fopen($p_filename, 'rb'))) { $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); return Archive_Zip::errorCode(); } @@ -1405,7 +1444,7 @@ public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_ $p_header['compression'] = 8; // ----- Call the header generation - if (($v_result = $this->_writeFileHeader($p_header)) != 1) { + if (1 != ($v_result = $this->_writeFileHeader($p_header))) { @fclose($v_file); return $v_result; } @@ -1427,7 +1466,7 @@ public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_ $p_header['external'] = 0x41FF0010; // Value for a folder : to be checked // ----- Call the header generation - if (($v_result = $this->_writeFileHeader($p_header)) != 1) { + if (1 != ($v_result = $this->_writeFileHeader($p_header))) { return $v_result; } } @@ -1435,17 +1474,17 @@ public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_ // ----- Look for pre-add callback if ((isset($p_params[ARCHIVE_ZIP_PARAM_POST_ADD])) - && ($p_params[ARCHIVE_ZIP_PARAM_POST_ADD] != '')) { + && ('' != $p_params[ARCHIVE_ZIP_PARAM_POST_ADD])) { // ----- Generate a local information - $v_local_header = array(); + $v_local_header = []; $this->_convertHeader2FileInfo($p_header, $v_local_header); // ----- Call the callback // Here I do not use call_user_func() because I need to send a reference to the // header. eval('$v_result = '.$p_params[ARCHIVE_ZIP_PARAM_POST_ADD].'(ARCHIVE_ZIP_PARAM_POST_ADD, $v_local_header);'); - if ($v_result == 0) { + if (0 == $v_result) { // ----- Ignored $v_result = 1; } @@ -1465,12 +1504,13 @@ public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_ // Parameters : // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_writeFileHeader() - * - * { Description } - * - */ + /** + * Archive_Zip::_writeFileHeader() + * + * { Description } + * @param $p_header + * @return int + */ public function _writeFileHeader(&$p_header) { $v_result=1; @@ -1488,20 +1528,21 @@ public function _writeFileHeader(&$p_header) $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; // ----- Packed data - $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50, $p_header['version'], $p_header['flag'], + $v_binary_data = pack( + 'VvvvvvVVVvv', 0x04034b50, $p_header['version'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], - strlen($p_header['stored_filename']), $p_header['extra_len']); + strlen($p_header['stored_filename']), $p_header['extra_len']); // ----- Write the first 148 bytes of the header in the archive - fputs($this->_zip_fd, $v_binary_data, 30); + fwrite($this->_zip_fd, $v_binary_data, 30); // ----- Write the variable fields - if (strlen($p_header['stored_filename']) != 0) { - fputs($this->_zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); + if (0 != strlen($p_header['stored_filename'])) { + fwrite($this->_zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); } - if ($p_header['extra_len'] != 0) { - fputs($this->_zip_fd, $p_header['extra'], $p_header['extra_len']); + if (0 != $p_header['extra_len']) { + fwrite($this->_zip_fd, $p_header['extra'], $p_header['extra_len']); } // ----- Return @@ -1515,12 +1556,13 @@ public function _writeFileHeader(&$p_header) // Parameters : // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_writeCentralFileHeader() - * - * { Description } - * - */ + /** + * Archive_Zip::_writeCentralFileHeader() + * + * { Description } + * @param $p_header + * @return int + */ public function _writeCentralFileHeader(&$p_header) { $v_result=1; @@ -1535,24 +1577,25 @@ public function _writeCentralFileHeader(&$p_header) $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; // ----- Packed data - $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50, $p_header['version'], $p_header['version_extracted'], + $v_binary_data = pack( + 'VvvvvvvVVVvvvvvVV', 0x02014b50, $p_header['version'], $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], - strlen($p_header['stored_filename']), $p_header['extra_len'], $p_header['comment_len'], + strlen($p_header['stored_filename']), $p_header['extra_len'], $p_header['comment_len'], $p_header['disk'], $p_header['internal'], $p_header['external'], $p_header['offset']); // ----- Write the 42 bytes of the header in the zip file - fputs($this->_zip_fd, $v_binary_data, 46); + fwrite($this->_zip_fd, $v_binary_data, 46); // ----- Write the variable fields - if (strlen($p_header['stored_filename']) != 0) { - fputs($this->_zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); + if (0 != strlen($p_header['stored_filename'])) { + fwrite($this->_zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); } - if ($p_header['extra_len'] != 0) { - fputs($this->_zip_fd, $p_header['extra'], $p_header['extra_len']); + if (0 != $p_header['extra_len']) { + fwrite($this->_zip_fd, $p_header['extra'], $p_header['extra_len']); } - if ($p_header['comment_len'] != 0) { - fputs($this->_zip_fd, $p_header['comment'], $p_header['comment_len']); + if (0 != $p_header['comment_len']) { + fwrite($this->_zip_fd, $p_header['comment'], $p_header['comment_len']); } // ----- Return @@ -1566,25 +1609,29 @@ public function _writeCentralFileHeader(&$p_header) // Parameters : // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_writeCentralHeader() - * - * { Description } - * - */ + /** + * Archive_Zip::_writeCentralHeader() + * + * { Description } + * @param $p_nb_entries + * @param $p_size + * @param $p_offset + * @param $p_comment + * @return int + */ public function _writeCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment) { $v_result=1; // ----- Packed data - $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries, $p_nb_entries, $p_size, $p_offset, strlen($p_comment)); + $v_binary_data = pack('VvvvvVVv', 0x06054b50, 0, 0, $p_nb_entries, $p_nb_entries, $p_size, $p_offset, strlen($p_comment)); // ----- Write the 22 bytes of the header in the zip file - fputs($this->_zip_fd, $v_binary_data, 22); + fwrite($this->_zip_fd, $v_binary_data, 22); // ----- Write the variable fields - if (strlen($p_comment) != 0) { - fputs($this->_zip_fd, $p_comment, strlen($p_comment)); + if (0 != strlen($p_comment)) { + fwrite($this->_zip_fd, $p_comment, strlen($p_comment)); } // ----- Return @@ -1598,18 +1645,19 @@ public function _writeCentralHeader($p_nb_entries, $p_size, $p_offset, $p_commen // Parameters : // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_list() - * - * { Description } - * - */ + /** + * Archive_Zip::_list() + * + * { Description } + * @param $p_list + * @return int + */ public function _list(&$p_list) { $v_result=1; // ----- Open the zip file - if (($this->_zip_fd = @fopen($this->_zipname, 'rb')) == 0) { + if (0 == ($this->_zip_fd = @fopen($this->_zipname, 'rb'))) { // ----- Error log $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->_zipname.'\' in binary read mode'); @@ -1618,8 +1666,8 @@ public function _list(&$p_list) } // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->_readEndCentralDir($v_central_dir)) != 1) { + $v_central_dir = []; + if (1 != ($v_result = $this->_readEndCentralDir($v_central_dir))) { return $v_result; } @@ -1636,7 +1684,7 @@ public function _list(&$p_list) // ----- Read each entry for ($i=0; $i<$v_central_dir['entries']; $i++) { // ----- Read the file header - if (($v_result = $this->_readCentralFileHeader($v_header)) != 1) { + if (1 != ($v_result = $this->_readCentralFileHeader($v_header))) { return $v_result; } $v_header['index'] = $i; @@ -1672,12 +1720,14 @@ public function _list(&$p_list) // Parameters : // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_convertHeader2FileInfo() - * - * { Description } - * - */ + /** + * Archive_Zip::_convertHeader2FileInfo() + * + * { Description } + * @param $p_header + * @param $p_info + * @return int + */ public function _convertHeader2FileInfo($p_header, &$p_info) { $v_result=1; @@ -1689,7 +1739,7 @@ public function _convertHeader2FileInfo($p_header, &$p_info) $p_info['compressed_size'] = $p_header['compressed_size']; $p_info['mtime'] = $p_header['mtime']; $p_info['comment'] = $p_header['comment']; - $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010); + $p_info['folder'] = (0x00000010 == ($p_header['external'] & 0x00000010)); $p_info['index'] = $p_header['index']; $p_info['status'] = $p_header['status']; @@ -1714,12 +1764,14 @@ public function _convertHeader2FileInfo($p_header, &$p_info) // Return Values : // 1 on success,0 or less on error (see error code list) // --------------------------------------------------------------------------- - /** - * Archive_Zip::_extractByRule() - * - * { Description } - * - */ + /** + * Archive_Zip::_extractByRule() + * + * { Description } + * @param $p_file_list + * @param $p_params + * @return int + */ public function _extractByRule(&$p_file_list, &$p_params) { $v_result=1; @@ -1729,34 +1781,34 @@ public function _extractByRule(&$p_file_list, &$p_params) $p_remove_all_path = $p_params['remove_all_path']; // ----- Check the path - if (($p_path == "") - || ((substr($p_path, 0, 1) != "/") - && (substr($p_path, 0, 3) != "../") && (substr($p_path, 1, 2)!=":/"))) { - $p_path = "./".$p_path; + if (('' == $p_path) + || (('/' != substr($p_path, 0, 1)) + && ('../' != substr($p_path, 0, 3)) && (':/' != substr($p_path, 1, 2)))) { + $p_path = './' . $p_path; } // ----- Reduce the path last (and duplicated) '/' - if (($p_path != "./") && ($p_path != "/")) { + if (('./' != $p_path) && ('/' != $p_path)) { // ----- Look for the path end '/' - while (substr($p_path, -1) == "/") { + while ('/' == substr($p_path, -1)) { $p_path = substr($p_path, 0, strlen($p_path)-1); } } // ----- Look for path to remove format (should end by /) - if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/')) { + if (('' != $p_remove_path) && ('/' != substr($p_remove_path, -1))) { $p_remove_path .= '/'; } $p_remove_path_size = strlen($p_remove_path); // ----- Open the zip file - if (($v_result = $this->_openFd('rb')) != 1) { + if (1 != ($v_result = $this->_openFd('rb'))) { return $v_result; } // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->_readEndCentralDir($v_central_dir)) != 1) { + $v_central_dir = []; + if (1 != ($v_result = $this->_readEndCentralDir($v_central_dir))) { // ----- Close the zip file $this->_closeFd(); @@ -1781,8 +1833,8 @@ public function _extractByRule(&$p_file_list, &$p_params) } // ----- Read the file header - $v_header = array(); - if (($v_result = $this->_readCentralFileHeader($v_header)) != 1) { + $v_header = []; + if (1 != ($v_result = $this->_readCentralFileHeader($v_header))) { $this->_closeFd(); return $v_result; @@ -1799,16 +1851,16 @@ public function _extractByRule(&$p_file_list, &$p_params) // ----- Look for extract by name rule if ((isset($p_params[ARCHIVE_ZIP_PARAM_BY_NAME])) - && ($p_params[ARCHIVE_ZIP_PARAM_BY_NAME] != 0)) { + && (0 != $p_params[ARCHIVE_ZIP_PARAM_BY_NAME])) { // ----- Look if the filename is in the list for ($j=0; - ($j strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) @@ -1825,7 +1877,7 @@ public function _extractByRule(&$p_file_list, &$p_params) // ----- Look for extract by ereg rule elseif ((isset($p_params[ARCHIVE_ZIP_PARAM_BY_EREG])) - && ($p_params[ARCHIVE_ZIP_PARAM_BY_EREG] != "")) { + && ('' != $p_params[ARCHIVE_ZIP_PARAM_BY_EREG])) { if (ereg($p_params[ARCHIVE_ZIP_PARAM_BY_EREG], $v_header['stored_filename'])) { $v_extract = true; } @@ -1833,7 +1885,7 @@ public function _extractByRule(&$p_file_list, &$p_params) // ----- Look for extract by preg rule elseif ((isset($p_params[ARCHIVE_ZIP_PARAM_BY_PREG])) - && ($p_params[ARCHIVE_ZIP_PARAM_BY_PREG] != "")) { + && ('' != $p_params[ARCHIVE_ZIP_PARAM_BY_PREG])) { if (preg_match($p_params[ARCHIVE_ZIP_PARAM_BY_PREG], $v_header['stored_filename'])) { $v_extract = true; } @@ -1841,10 +1893,10 @@ public function _extractByRule(&$p_file_list, &$p_params) // ----- Look for extract by index rule elseif ((isset($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) - && ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX] != 0)) { + && (0 != $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) { // ----- Look if the index is in the list - for ($j=$j_start; ($j=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) && ($i<=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) { $v_extract = true; } @@ -1884,7 +1936,7 @@ public function _extractByRule(&$p_file_list, &$p_params) if ($p_params[ARCHIVE_ZIP_PARAM_EXTRACT_AS_STRING]) { // ----- Extracting the file - if (($v_result = $this->_extractFileAsString($v_header, $v_string)) != 1) { + if (1 != ($v_result = $this->_extractFileAsString($v_header, $v_string))) { // ----- Close the zip file $this->_closeFd(); @@ -1892,7 +1944,7 @@ public function _extractByRule(&$p_file_list, &$p_params) } // ----- Get the only interesting attributes - if (($v_result = $this->_convertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1) { + if (1 != ($v_result = $this->_convertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted]))) { // ----- Close the zip file $this->_closeFd(); @@ -1906,7 +1958,7 @@ public function _extractByRule(&$p_file_list, &$p_params) $v_nb_extracted++; } else { // ----- Extracting the file - if (($v_result = $this->_extractFile($v_header, $p_path, $p_remove_path, $p_remove_all_path, $p_params)) != 1) { + if (1 != ($v_result = $this->_extractFile($v_header, $p_path, $p_remove_path, $p_remove_all_path, $p_params))) { // ----- Close the zip file $this->_closeFd(); @@ -1914,7 +1966,7 @@ public function _extractByRule(&$p_file_list, &$p_params) } // ----- Get the only interesting attributes - if (($v_result = $this->_convertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) { + if (1 != ($v_result = $this->_convertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++]))) { // ----- Close the zip file $this->_closeFd(); @@ -1938,18 +1990,23 @@ public function _extractByRule(&$p_file_list, &$p_params) // Parameters : // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_extractFile() - * - * { Description } - * - */ + /** + * Archive_Zip::_extractFile() + * + * { Description } + * @param $p_entry + * @param $p_path + * @param $p_remove_path + * @param $p_remove_all_path + * @param $p_params + * @return int + */ public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_params) { $v_result=1; // ----- Read the file header - if (($v_result = $this->_readFileHeader($v_header)) != 1) { + if (1 != ($v_result = $this->_readFileHeader($v_header))) { // ----- Return return $v_result; } @@ -1959,18 +2016,18 @@ public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_p // TBC // ----- Look for all path to remove - if ($p_remove_all_path == true) { + if (true == $p_remove_all_path) { // ----- Get the basename of the path $p_entry['filename'] = basename($p_entry['filename']); } // ----- Look for path to remove - elseif ($p_remove_path != "") { + elseif ('' != $p_remove_path) { //if (strcmp($p_remove_path, $p_entry['filename'])==0) - if ($this->_tool_PathInclusion($p_remove_path, $p_entry['filename']) == 2) { + if (2 == $this->_tool_PathInclusion($p_remove_path, $p_entry['filename'])) { // ----- Change the file status - $p_entry['status'] = "filtered"; + $p_entry['status'] = 'filtered'; // ----- Return return $v_result; @@ -1985,25 +2042,25 @@ public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_p } // ----- Add the path - if ($p_path != '') { - $p_entry['filename'] = $p_path."/".$p_entry['filename']; + if ('' != $p_path) { + $p_entry['filename'] = $p_path . '/' . $p_entry['filename']; } // ----- Look for pre-extract callback if ((isset($p_params[ARCHIVE_ZIP_PARAM_PRE_EXTRACT])) - && ($p_params[ARCHIVE_ZIP_PARAM_PRE_EXTRACT] != '')) { + && ('' != $p_params[ARCHIVE_ZIP_PARAM_PRE_EXTRACT])) { // ----- Generate a local information - $v_local_header = array(); + $v_local_header = []; $this->_convertHeader2FileInfo($p_entry, $v_local_header); // ----- Call the callback // Here I do not use call_user_func() because I need to send a reference to the // header. eval('$v_result = '.$p_params[ARCHIVE_ZIP_PARAM_PRE_EXTRACT].'(ARCHIVE_ZIP_PARAM_PRE_EXTRACT, $v_local_header);'); - if ($v_result == 0) { + if (0 == $v_result) { // ----- Change the file status - $p_entry['status'] = "skipped"; + $p_entry['status'] = 'skipped'; $v_result = 1; } @@ -2015,7 +2072,7 @@ public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_p // ----- Trace // ----- Look if extraction should be done - if ($p_entry['status'] == 'ok') { + if ('ok' == $p_entry['status']) { // ----- Look for specific actions while the file exist if (file_exists($p_entry['filename'])) { @@ -2024,16 +2081,16 @@ public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_p if (is_dir($p_entry['filename'])) { // ----- Change the file status - $p_entry['status'] = "already_a_directory"; + $p_entry['status'] = 'already_a_directory'; // ----- Return //return $v_result; } // ----- Look if file is write protected - elseif (!is_writeable($p_entry['filename'])) { + elseif (!is_writable($p_entry['filename'])) { // ----- Change the file status - $p_entry['status'] = "write_protected"; + $p_entry['status'] = 'write_protected'; // ----- Return //return $v_result; @@ -2043,7 +2100,7 @@ public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_p elseif (filemtime($p_entry['filename']) > $p_entry['mtime']) { // ----- Change the file status - $p_entry['status'] = "newer_exist"; + $p_entry['status'] = 'newer_exist'; // ----- Return //return $v_result; @@ -2052,18 +2109,18 @@ public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_p // ----- Check the directory availability and create it if necessary else { - if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) { + if ((0x00000010 == ($p_entry['external'] & 0x00000010)) || ('/' == substr($p_entry['filename'], -1))) { $v_dir_to_check = $p_entry['filename']; - } elseif (!strstr($p_entry['filename'], "/")) { - $v_dir_to_check = ""; + } elseif (!strstr($p_entry['filename'], '/')) { + $v_dir_to_check = ''; } else { $v_dir_to_check = dirname($p_entry['filename']); } - if (($v_result = $this->_dirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) { + if (1 != ($v_result = $this->_dirCheck($v_dir_to_check, (0x00000010 == ($p_entry['external'] & 0x00000010))))) { // ----- Change the file status - $p_entry['status'] = "path_creation_fail"; + $p_entry['status'] = 'path_creation_fail'; // ----- Return //return $v_result; @@ -2073,19 +2130,19 @@ public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_p } // ----- Look if extraction should be done - if ($p_entry['status'] == 'ok') { + if ('ok' == $p_entry['status']) { // ----- Do the extraction (if not a folder) - if (!(($p_entry['external']&0x00000010)==0x00000010)) { + if (!(0x00000010 == ($p_entry['external'] & 0x00000010))) { // ----- Look for not compressed file if ($p_entry['compressed_size'] == $p_entry['size']) { // ----- Opening destination file - if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { + if (0 == ($v_dest_file = @fopen($p_entry['filename'], 'wb'))) { // ----- Change the file status - $p_entry['status'] = "write_error"; + $p_entry['status'] = 'write_error'; // ----- Return return $v_result; @@ -2094,7 +2151,7 @@ public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_p // ----- Read the file by ARCHIVE_ZIP_READ_BLOCK_SIZE octets blocks $v_size = $p_entry['compressed_size']; - while ($v_size != 0) { + while (0 != $v_size) { $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE ? $v_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); $v_buffer = fread($this->_zip_fd, $v_read_size); $v_binary_data = pack('a'.$v_read_size, $v_buffer); @@ -2111,10 +2168,10 @@ public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_p // ----- Trace // ----- Opening destination file - if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { + if (0 == ($v_dest_file = @fopen($p_entry['filename'], 'wb'))) { // ----- Change the file status - $p_entry['status'] = "write_error"; + $p_entry['status'] = 'write_error'; return $v_result; } @@ -2140,7 +2197,7 @@ public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_p // ----- Look for chmod option if ((isset($p_params[ARCHIVE_ZIP_PARAM_SET_CHMOD])) - && ($p_params[ARCHIVE_ZIP_PARAM_SET_CHMOD] != 0)) { + && (0 != $p_params[ARCHIVE_ZIP_PARAM_SET_CHMOD])) { // ----- Change the mode of the file chmod($p_entry['filename'], $p_params[ARCHIVE_ZIP_PARAM_SET_CHMOD]); @@ -2150,10 +2207,10 @@ public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_p // ----- Look for post-extract callback if ((isset($p_params[ARCHIVE_ZIP_PARAM_POST_EXTRACT])) - && ($p_params[ARCHIVE_ZIP_PARAM_POST_EXTRACT] != '')) { + && ('' != $p_params[ARCHIVE_ZIP_PARAM_POST_EXTRACT])) { // ----- Generate a local information - $v_local_header = array(); + $v_local_header = []; $this->_convertHeader2FileInfo($p_entry, $v_local_header); // ----- Call the callback @@ -2173,19 +2230,21 @@ public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_p // Parameters : // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_extractFileAsString() - * - * { Description } - * - */ + /** + * Archive_Zip::_extractFileAsString() + * + * { Description } + * @param $p_entry + * @param $p_string + * @return int + */ public function _extractFileAsString(&$p_entry, &$p_string) { $v_result=1; // ----- Read the file header - $v_header = array(); - if (($v_result = $this->_readFileHeader($v_header)) != 1) { + $v_header = []; + if (1 != ($v_result = $this->_readFileHeader($v_header))) { // ----- Return return $v_result; } @@ -2197,7 +2256,7 @@ public function _extractFileAsString(&$p_entry, &$p_string) // ----- Trace // ----- Do the extraction (if not a folder) - if (!(($p_entry['external']&0x00000010)==0x00000010)) { + if (!(0x00000010 == ($p_entry['external'] & 0x00000010))) { // ----- Look for not compressed file if ($p_entry['compressed_size'] == $p_entry['size']) { // ----- Trace @@ -2230,12 +2289,13 @@ public function _extractFileAsString(&$p_entry, &$p_string) // Parameters : // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_readFileHeader() - * - * { Description } - * - */ + /** + * Archive_Zip::_readFileHeader() + * + * { Description } + * @param $p_header + * @return int + */ public function _readFileHeader(&$p_header) { $v_result=1; @@ -2245,7 +2305,7 @@ public function _readFileHeader(&$p_header) $v_data = unpack('Vid', $v_binary_data); // ----- Check signature - if ($v_data['id'] != 0x04034b50) { + if (0x04034b50 != $v_data['id']) { // ----- Error log $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); @@ -2258,12 +2318,12 @@ public function _readFileHeader(&$p_header) $v_binary_data = fread($this->_zip_fd, 26); // ----- Look for invalid block size - if (strlen($v_binary_data) != 26) { - $p_header['filename'] = ""; - $p_header['status'] = "invalid_header"; + if (26 != strlen($v_binary_data)) { + $p_header['filename'] = ''; + $p_header['status'] = 'invalid_header'; // ----- Error log - $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data)); + $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : ' . strlen($v_binary_data)); // ----- Return return Archive_Zip::errorCode(); @@ -2276,7 +2336,7 @@ public function _readFileHeader(&$p_header) $p_header['filename'] = fread($this->_zip_fd, $v_data['filename_len']); // ----- Get extra_fields - if ($v_data['extra_len'] != 0) { + if (0 != $v_data['extra_len']) { $p_header['extra'] = fread($this->_zip_fd, $v_data['extra_len']); } else { $p_header['extra'] = ''; @@ -2319,7 +2379,7 @@ public function _readFileHeader(&$p_header) $p_header['stored_filename'] = $p_header['filename']; // ----- Set the status field - $p_header['status'] = "ok"; + $p_header['status'] = 'ok'; // ----- Return return $v_result; @@ -2332,12 +2392,13 @@ public function _readFileHeader(&$p_header) // Parameters : // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_readCentralFileHeader() - * - * { Description } - * - */ + /** + * Archive_Zip::_readCentralFileHeader() + * + * { Description } + * @param $p_header + * @return int + */ public function _readCentralFileHeader(&$p_header) { $v_result=1; @@ -2347,7 +2408,7 @@ public function _readCentralFileHeader(&$p_header) $v_data = unpack('Vid', $v_binary_data); // ----- Check signature - if ($v_data['id'] != 0x02014b50) { + if (0x02014b50 != $v_data['id']) { // ----- Error log $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); @@ -2360,12 +2421,12 @@ public function _readCentralFileHeader(&$p_header) $v_binary_data = fread($this->_zip_fd, 42); // ----- Look for invalid block size - if (strlen($v_binary_data) != 42) { - $p_header['filename'] = ""; - $p_header['status'] = "invalid_header"; + if (42 != strlen($v_binary_data)) { + $p_header['filename'] = ''; + $p_header['status'] = 'invalid_header'; // ----- Error log - $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data)); + $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : ' . strlen($v_binary_data)); // ----- Return return Archive_Zip::errorCode(); @@ -2375,21 +2436,21 @@ public function _readCentralFileHeader(&$p_header) $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data); // ----- Get filename - if ($p_header['filename_len'] != 0) { + if (0 != $p_header['filename_len']) { $p_header['filename'] = fread($this->_zip_fd, $p_header['filename_len']); } else { $p_header['filename'] = ''; } // ----- Get extra - if ($p_header['extra_len'] != 0) { + if (0 != $p_header['extra_len']) { $p_header['extra'] = fread($this->_zip_fd, $p_header['extra_len']); } else { $p_header['extra'] = ''; } // ----- Get comment - if ($p_header['comment_len'] != 0) { + if (0 != $p_header['comment_len']) { $p_header['comment'] = fread($this->_zip_fd, $p_header['comment_len']); } else { $p_header['comment'] = ''; @@ -2422,7 +2483,7 @@ public function _readCentralFileHeader(&$p_header) $p_header['status'] = 'ok'; // ----- Look if it is a directory - if (substr($p_header['filename'], -1) == '/') { + if ('/' == substr($p_header['filename'], -1)) { $p_header['external'] = 0x41FF0010; } @@ -2438,12 +2499,13 @@ public function _readCentralFileHeader(&$p_header) // Parameters : // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_readEndCentralDir() - * - * { Description } - * - */ + /** + * Archive_Zip::_readEndCentralDir() + * + * { Description } + * @param $p_central_dir + * @return int + */ public function _readEndCentralDir(&$p_central_dir) { $v_result=1; @@ -2476,7 +2538,7 @@ public function _readEndCentralDir(&$p_central_dir) $v_data = unpack('Vid', $v_binary_data); // ----- Check signature - if ($v_data['id'] == 0x06054b50) { + if (0x06054b50 == $v_data['id']) { $v_found = 1; } @@ -2508,7 +2570,7 @@ public function _readEndCentralDir(&$p_central_dir) $v_bytes = ($v_bytes << 8) | Ord($v_byte); // ----- Compare the bytes - if ($v_bytes == 0x504b0506) { + if (0x504b0506 == $v_bytes) { $v_pos++; break; } @@ -2519,7 +2581,8 @@ public function _readEndCentralDir(&$p_central_dir) // ----- Look if not found end of central dir if ($v_pos == $v_size) { $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, - "Unable to find End of Central Dir Record signature"); + 'Unable to find End of Central Dir Record signature' + ); return Archive_Zip::errorCode(); } } @@ -2528,10 +2591,10 @@ public function _readEndCentralDir(&$p_central_dir) $v_binary_data = fread($this->_zip_fd, 18); // ----- Look for invalid block size - if (strlen($v_binary_data) != 18) { + if (18 != strlen($v_binary_data)) { $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, - "Invalid End of Central Dir Record size : " - .strlen($v_binary_data)); + 'Invalid End of Central Dir Record size : ' + . strlen($v_binary_data)); return Archive_Zip::errorCode(); } @@ -2541,12 +2604,13 @@ public function _readEndCentralDir(&$p_central_dir) // ----- Check the global size if (($v_pos + $v_data['comment_size'] + 18) != $v_size) { $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, - "Fail to find the right signature"); + 'Fail to find the right signature' + ); return Archive_Zip::errorCode(); } // ----- Get comment - if ($v_data['comment_size'] != 0) { + if (0 != $v_data['comment_size']) { $p_central_dir['comment'] = fread($this->_zip_fd, $v_data['comment_size']); } else { $p_central_dir['comment'] = ''; @@ -2570,26 +2634,28 @@ public function _readEndCentralDir(&$p_central_dir) // Parameters : // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_deleteByRule() - * - * { Description } - * - */ + /** + * Archive_Zip::_deleteByRule() + * + * { Description } + * @param $p_result_list + * @param $p_params + * @return int + */ public function _deleteByRule(&$p_result_list, &$p_params) { $v_result=1; - $v_list_detail = array(); + $v_list_detail = []; // ----- Open the zip file - if (($v_result=$this->_openFd('rb')) != 1) { + if (1 != ($v_result=$this->_openFd('rb'))) { // ----- Return return $v_result; } // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->_readEndCentralDir($v_central_dir)) != 1) { + $v_central_dir = []; + if (1 != ($v_result = $this->_readEndCentralDir($v_central_dir))) { $this->_closeFd(); return $v_result; } @@ -2611,15 +2677,15 @@ public function _deleteByRule(&$p_result_list, &$p_params) } // ----- Read each entry - $v_header_list = array(); + $v_header_list = []; $j_start = 0; for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) { // ----- Read the file header - $v_header_list[$v_nb_extracted] = array(); + $v_header_list[$v_nb_extracted] = []; $v_result = $this->_readCentralFileHeader($v_header_list[$v_nb_extracted]); - if ($v_result != 1) { + if (1 != $v_result) { // ----- Clean $this->_closeFd(); @@ -2634,23 +2700,23 @@ public function _deleteByRule(&$p_result_list, &$p_params) // ----- Look for extract by name rule if ((isset($p_params[ARCHIVE_ZIP_PARAM_BY_NAME])) - && ($p_params[ARCHIVE_ZIP_PARAM_BY_NAME] != 0)) { + && (0 != $p_params[ARCHIVE_ZIP_PARAM_BY_NAME])) { // ----- Look if the filename is in the list for ($j=0; - ($j strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) { $v_found = true; - } elseif ((($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */ - && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) { + } elseif ((0x00000010 == ($v_header_list[$v_nb_extracted]['external'] & 0x00000010)) /* Indicates a folder */ + && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) { $v_found = true; } } @@ -2664,7 +2730,7 @@ public function _deleteByRule(&$p_result_list, &$p_params) // ----- Look for extract by ereg rule elseif ((isset($p_params[ARCHIVE_ZIP_PARAM_BY_EREG])) - && ($p_params[ARCHIVE_ZIP_PARAM_BY_EREG] != "")) { + && ('' != $p_params[ARCHIVE_ZIP_PARAM_BY_EREG])) { if (ereg($p_params[ARCHIVE_ZIP_PARAM_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { $v_found = true; @@ -2673,7 +2739,7 @@ public function _deleteByRule(&$p_result_list, &$p_params) // ----- Look for extract by preg rule elseif ((isset($p_params[ARCHIVE_ZIP_PARAM_BY_PREG])) - && ($p_params[ARCHIVE_ZIP_PARAM_BY_PREG] != "")) { + && ('' != $p_params[ARCHIVE_ZIP_PARAM_BY_PREG])) { if (preg_match($p_params[ARCHIVE_ZIP_PARAM_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { $v_found = true; @@ -2682,11 +2748,11 @@ public function _deleteByRule(&$p_result_list, &$p_params) // ----- Look for extract by index rule elseif ((isset($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) - && ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX] != 0)) { + && (0 != $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) { // ----- Look if the index is in the list for ($j=$j_start; - ($j=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) @@ -2722,7 +2788,7 @@ public function _deleteByRule(&$p_result_list, &$p_params) $v_temp_zip = new Archive_Zip($v_zip_temp_name); // ----- Open the temporary zip file in write mode - if (($v_result = $v_temp_zip->_openFd('wb')) != 1) { + if (1 != ($v_result = $v_temp_zip->_openFd('wb'))) { $this->_closeFd(); // ----- Return @@ -2730,7 +2796,7 @@ public function _deleteByRule(&$p_result_list, &$p_params) } // ----- Look which file need to be kept - for ($i=0; $i_zip_fd); @@ -2746,7 +2812,7 @@ public function _deleteByRule(&$p_result_list, &$p_params) } // ----- Read the file header - if (($v_result = $this->_readFileHeader($v_header_list[$i])) != 1) { + if (1 != ($v_result = $this->_readFileHeader($v_header_list[$i]))) { // ----- Clean $this->_closeFd(); $v_temp_zip->_closeFd(); @@ -2757,7 +2823,7 @@ public function _deleteByRule(&$p_result_list, &$p_params) // ----- Write the file header $v_result = $v_temp_zip->_writeFileHeader($v_header_list[$i]); - if ($v_result != 1) { + if (1 != $v_result) { // ----- Clean $this->_closeFd(); $v_temp_zip->_closeFd(); @@ -2770,7 +2836,7 @@ public function _deleteByRule(&$p_result_list, &$p_params) $v_result = $this->_tool_CopyBlock($this->_zip_fd, $v_temp_zip->_zip_fd, $v_header_list[$i]['compressed_size']); - if ($v_result != 1) { + if (1 != $v_result) { // ----- Clean $this->_closeFd(); $v_temp_zip->_closeFd(); @@ -2784,10 +2850,10 @@ public function _deleteByRule(&$p_result_list, &$p_params) $v_offset = @ftell($v_temp_zip->_zip_fd); // ----- Re-Create the Central Dir files header - for ($i=0; $i_writeCentralFileHeader($v_header_list[$i]); - if ($v_result != 1) { + if (1 != $v_result) { // ----- Clean $v_temp_zip->_closeFd(); $this->_closeFd(); @@ -2809,10 +2875,10 @@ public function _deleteByRule(&$p_result_list, &$p_params) $v_size = @ftell($v_temp_zip->_zip_fd)-$v_offset; // ----- Create the central dir footer - $v_result = $v_temp_zip->_writeCentralHeader(sizeof($v_header_list), + $v_result = $v_temp_zip->_writeCentralHeader(count($v_header_list), $v_size, $v_offset, $v_comment); - if ($v_result != 1) { + if (1 != $v_result) { // ----- Clean unset($v_header_list); $v_temp_zip->_closeFd(); @@ -2855,24 +2921,26 @@ public function _deleteByRule(&$p_result_list, &$p_params) // 1 : OK // -1 : Unable to create directory // --------------------------------------------------------------------------- - /** - * Archive_Zip::_dirCheck() - * - * { Description } - * - * @param [type] $p_is_dir - */ + /** + * Archive_Zip::_dirCheck() + * + * { Description } + * + * @param [type] $p_is_dir + * @param bool $p_is_dir + * @return int + */ public function _dirCheck($p_dir, $p_is_dir=false) { $v_result = 1; // ----- Remove the final '/' - if (($p_is_dir) && (substr($p_dir, -1)=='/')) { + if (($p_is_dir) && ('/' == substr($p_dir, -1))) { $p_dir = substr($p_dir, 0, strlen($p_dir)-1); } // ----- Check the directory availability - if ((is_dir($p_dir)) || ($p_dir == "")) { + if ((is_dir($p_dir)) || ('' == $p_dir)) { return 1; } @@ -2882,8 +2950,8 @@ public function _dirCheck($p_dir, $p_is_dir=false) // ----- Just a check if ($p_parent_dir != $p_dir) { // ----- Look for parent directory - if ($p_parent_dir != "") { - if (($v_result = $this->_dirCheck($p_parent_dir)) != 1) { + if ('' != $p_parent_dir) { + if (1 != ($v_result = $this->_dirCheck($p_parent_dir))) { return $v_result; } } @@ -2908,12 +2976,13 @@ public function _dirCheck($p_dir, $p_is_dir=false) // Parameters : // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_merge() - * - * { Description } - * - */ + /** + * Archive_Zip::_merge() + * + * { Description } + * @param $p_archive_to_add + * @return int + */ public function _merge(&$p_archive_to_add) { $v_result=1; @@ -2933,13 +3002,13 @@ public function _merge(&$p_archive_to_add) } // ----- Open the zip file - if (($v_result=$this->_openFd('rb')) != 1) { + if (1 != ($v_result=$this->_openFd('rb'))) { return $v_result; } // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->_readEndCentralDir($v_central_dir)) != 1) { + $v_central_dir = []; + if (1 != ($v_result = $this->_readEndCentralDir($v_central_dir))) { $this->_closeFd(); return $v_result; } @@ -2948,15 +3017,15 @@ public function _merge(&$p_archive_to_add) @rewind($this->_zip_fd); // ----- Open the archive_to_add file - if (($v_result=$p_archive_to_add->_openFd('rb')) != 1) { + if (1 != ($v_result=$p_archive_to_add->_openFd('rb'))) { $this->_closeFd(); return $v_result; } // ----- Read the central directory informations - $v_central_dir_to_add = array(); + $v_central_dir_to_add = []; $v_result = $p_archive_to_add->_readEndCentralDir($v_central_dir_to_add); - if ($v_result != 1) { + if (1 != $v_result) { $this->_closeFd(); $p_archive_to_add->_closeFd(); return $v_result; @@ -2969,7 +3038,7 @@ public function _merge(&$p_archive_to_add) $v_zip_temp_name = ARCHIVE_ZIP_TEMPORARY_DIR.uniqid('archive_zip-').'.tmp'; // ----- Open the temporary file in write mode - if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) { + if (0 == ($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb'))) { $this->_closeFd(); $p_archive_to_add->_closeFd(); $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL, @@ -2982,7 +3051,7 @@ public function _merge(&$p_archive_to_add) // TBC : Here I should better append the file and go back to erase the // central dir $v_size = $v_central_dir['offset']; - while ($v_size != 0) { + while (0 != $v_size) { $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE ? $v_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); $v_buffer = fread($this->_zip_fd, $v_read_size); @@ -2992,7 +3061,7 @@ public function _merge(&$p_archive_to_add) // ----- Copy the files from the archive_to_add into the temporary file $v_size = $v_central_dir_to_add['offset']; - while ($v_size != 0) { + while (0 != $v_size) { $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE ? $v_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); $v_buffer = fread($p_archive_to_add->_zip_fd, $v_read_size); @@ -3005,7 +3074,7 @@ public function _merge(&$p_archive_to_add) // ----- Copy the block of file headers from the old archive $v_size = $v_central_dir['size']; - while ($v_size != 0) { + while (0 != $v_size) { $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE ? $v_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); $v_buffer = @fread($this->_zip_fd, $v_read_size); @@ -3015,7 +3084,7 @@ public function _merge(&$p_archive_to_add) // ----- Copy the block of file headers from the archive_to_add $v_size = $v_central_dir_to_add['size']; - while ($v_size != 0) { + while (0 != $v_size) { $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE ? $v_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); $v_buffer = @fread($p_archive_to_add->_zip_fd, $v_read_size); @@ -3038,10 +3107,10 @@ public function _merge(&$p_archive_to_add) $v_zip_temp_fd = $v_swap; // ----- Create the central dir footer - if (($v_result = $this->_writeCentralHeader($v_central_dir['entries'] - +$v_central_dir_to_add['entries'], - $v_size, $v_offset, - $v_comment)) != 1) { + if (1 != ($v_result = $this->_writeCentralHeader($v_central_dir['entries'] + +$v_central_dir_to_add['entries'], + $v_size, $v_offset, + $v_comment))) { $this->_closeFd(); $p_archive_to_add->_closeFd(); @fclose($v_zip_temp_fd); @@ -3086,12 +3155,13 @@ public function _merge(&$p_archive_to_add) // Parameters : // Return Values : // --------------------------------------------------------------------------- - /** - * Archive_Zip::_duplicate() - * - * { Description } - * - */ + /** + * Archive_Zip::_duplicate() + * + * { Description } + * @param $p_archive_filename + * @return int + */ public function _duplicate($p_archive_filename) { $v_result=1; @@ -3107,13 +3177,13 @@ public function _duplicate($p_archive_filename) } // ----- Open the zip file - if (($v_result=$this->_openFd('wb')) != 1) { + if (1 != ($v_result=$this->_openFd('wb'))) { // ----- Return return $v_result; } // ----- Open the temporary file in write mode - if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0) { + if (0 == ($v_zip_temp_fd = @fopen($p_archive_filename, 'rb'))) { $this->_closeFd(); $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \'' @@ -3125,7 +3195,7 @@ public function _duplicate($p_archive_filename) // TBC : Here I should better append the file and go back to erase the // central dir $v_size = filesize($p_archive_filename); - while ($v_size != 0) { + while (0 != $v_size) { $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE ? $v_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); $v_buffer = fread($v_zip_temp_fd, $v_read_size); @@ -3143,14 +3213,15 @@ public function _duplicate($p_archive_filename) } // --------------------------------------------------------------------------- - /** - * Archive_Zip::_check_parameters() - * - * { Description } - * - * @param integer $p_error_code - * @param string $p_error_string - */ + /** + * Archive_Zip::_check_parameters() + * + * { Description } + * + * @param $p_params + * @param $p_default + * @return int + */ public function _check_parameters(&$p_params, $p_default) { @@ -3179,11 +3250,13 @@ public function _check_parameters(&$p_params, $p_default) } // ----- Check specific parameters - $v_callback_list = array('callback_pre_add', 'callback_post_add', - 'callback_pre_extract', 'callback_post_extract'); - for ($i=0; $i_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAM_VALUE, "Callback '".$p_params[$v_key] @@ -3208,7 +3281,7 @@ public function _check_parameters(&$p_params, $p_default) * * { Description } * - * @param integer $p_error_code + * @param int $p_error_code * @param string $p_error_string */ public function _errorLog($p_error_code=0, $p_error_string='') @@ -3242,35 +3315,36 @@ public function _errorReset() // Parameters : // Return Values : // --------------------------------------------------------------------------- - /** - * _tool_PathReduction() - * - * { Description } - * - */ + /** + * _tool_PathReduction() + * + * { Description } + * @param $p_dir + * @return string + */ public function _tool_PathReduction($p_dir) { - $v_result = ""; + $v_result = ''; // ----- Look for not empty path - if ($p_dir != "") { + if ('' != $p_dir) { // ----- Explode path by directory names - $v_list = explode("/", $p_dir); + $v_list = explode('/', $p_dir); // ----- Study directories from last to first - for ($i=sizeof($v_list)-1; $i>=0; $i--) { + for ($i= count($v_list) - 1; $i >= 0; $i--) { // ----- Look for current path - if ($v_list[$i] == ".") { + if ('.' == $v_list[$i]) { // ----- Ignore this directory // Should be the first $i=0, but no check is done - } elseif ($v_list[$i] == "..") { + } elseif ('..' == $v_list[$i]) { // ----- Ignore it and ignore the $i-1 $i--; - } elseif (($v_list[$i] == "") && ($i!=(sizeof($v_list)-1)) && ($i!=0)) { + } elseif (('' == $v_list[$i]) && ($i != (count($v_list) - 1)) && (0 != $i)) { // ----- Ignore only the double '//' in path, // but not the first and last '/' } else { - $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:""); + $v_result = $v_list[$i].($i!=(count($v_list) - 1)? '/' . $v_result: ''); } } } @@ -3295,21 +3369,23 @@ public function _tool_PathReduction($p_dir) // 1 if $p_path is inside directory $p_dir // 2 if $p_path is exactly the same as $p_dir // --------------------------------------------------------------------------- - /** - * _tool_PathInclusion() - * - * { Description } - * - */ + /** + * _tool_PathInclusion() + * + * { Description } + * @param $p_dir + * @param $p_path + * @return int + */ public function _tool_PathInclusion($p_dir, $p_path) { $v_result = 1; // ----- Explode dir and path by directory separator - $v_list_dir = explode("/", $p_dir); - $v_list_dir_size = sizeof($v_list_dir); - $v_list_path = explode("/", $p_path); - $v_list_path_size = sizeof($v_list_path); + $v_list_dir = explode('/', $p_dir); + $v_list_dir_size = count($v_list_dir); + $v_list_path = explode('/', $p_path); + $v_list_path_size = count($v_list_path); // ----- Study directories paths $i = 0; @@ -3317,19 +3393,19 @@ public function _tool_PathInclusion($p_dir, $p_path) while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) { // ----- Look for empty dir (path reduction) - if ($v_list_dir[$i] == '') { + if ('' == $v_list_dir[$i]) { $i++; continue; } - if ($v_list_path[$j] == '') { + if ('' == $v_list_path[$j]) { $j++; continue; } // ----- Compare the items if (($v_list_dir[$i] != $v_list_path[$j]) - && ($v_list_dir[$i] != '') - && ($v_list_path[$j] != '')) { + && ('' != $v_list_dir[$i]) + && ('' != $v_list_path[$j])) { $v_result = 0; } @@ -3341,10 +3417,10 @@ public function _tool_PathInclusion($p_dir, $p_path) // ----- Look if everything seems to be the same if ($v_result) { // ----- Skip all the empty items - while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) { + while (($j < $v_list_path_size) && ('' == $v_list_path[$j])) { $j++; } - while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) { + while (($i < $v_list_dir_size) && ('' == $v_list_dir[$i])) { $i++; } @@ -3373,43 +3449,47 @@ public function _tool_PathInclusion($p_dir, $p_path) // 3 : src & dest gzip // Return Values : // --------------------------------------------------------------------------- - /** - * _tool_CopyBlock() - * - * { Description } - * - * @param integer $p_mode - */ + /** + * _tool_CopyBlock() + * + * { Description } + * + * @param $p_src + * @param $p_dest + * @param $p_size + * @param int $p_mode + * @return int + */ public function _tool_CopyBlock($p_src, $p_dest, $p_size, $p_mode=0) { $v_result = 1; - if ($p_mode==0) { - while ($p_size != 0) { + if (0 == $p_mode) { + while (0 != $p_size) { $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); $v_buffer = @fread($p_src, $v_read_size); @fwrite($p_dest, $v_buffer, $v_read_size); $p_size -= $v_read_size; } - } elseif ($p_mode==1) { - while ($p_size != 0) { + } elseif (1 == $p_mode) { + while (0 != $p_size) { $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); $v_buffer = @gzread($p_src, $v_read_size); @fwrite($p_dest, $v_buffer, $v_read_size); $p_size -= $v_read_size; } - } elseif ($p_mode==2) { - while ($p_size != 0) { + } elseif (2 == $p_mode) { + while (0 != $p_size) { $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); $v_buffer = @fread($p_src, $v_read_size); @gzwrite($p_dest, $v_buffer, $v_read_size); $p_size -= $v_read_size; } - } elseif ($p_mode==3) { - while ($p_size != 0) { + } elseif (3 == $p_mode) { + while (0 != $p_size) { $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); $v_buffer = @gzread($p_src, $v_read_size); @@ -3435,12 +3515,14 @@ public function _tool_CopyBlock($p_src, $p_dest, $p_size, $p_mode=0) // Return Values : // 1 on success, 0 on failure. // --------------------------------------------------------------------------- - /** - * _tool_Rename() - * - * { Description } - * - */ + /** + * _tool_Rename() + * + * { Description } + * @param $p_src + * @param $p_dest + * @return int + */ public function _tool_Rename($p_src, $p_dest) { $v_result = 1; @@ -3472,29 +3554,30 @@ public function _tool_Rename($p_src, $p_dest) // Return Values : // The path translated. // --------------------------------------------------------------------------- - /** - * _tool_TranslateWinPath() - * - * { Description } - * - * @param [type] $p_remove_disk_letter - */ + /** + * _tool_TranslateWinPath() + * + * { Description } + * + * @param [type] $p_remove_disk_letter + * @param bool $p_remove_disk_letter + * @return false|string + */ public function _tool_TranslateWinPath($p_path, $p_remove_disk_letter=true) { - if (stristr(php_uname(), 'windows')) { - // ----- Look for potential disk letter + if (mb_stristr(php_uname(), 'windows')) { + // ----- Look for potential disk letter if (($p_remove_disk_letter) - && (($v_position = strpos($p_path, ':')) != false)) { - $p_path = substr($p_path, $v_position+1); + && (false != ($v_position = mb_strpos($p_path, ':')))) { + $p_path = mb_substr($p_path, $v_position + 1); } // ----- Change potential windows directory separator - if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) { - $p_path = strtr($p_path, '\\', '/'); - } + if ((mb_strpos($p_path, '\\') > 0) || ('\\' == mb_substr($p_path, 0, 1))) { + $p_path = strtr($p_path, '\\', '/'); + } } return $p_path; } // --------------------------------------------------------------------------- } - // End of class -; +// End of class diff --git a/xoops_trust_path/libs/altsys/include/Legacy_AltsysAdminRenderSystem.class.php b/xoops_trust_path/libs/altsys/include/Legacy_AltsysAdminRenderSystem.class.php index 2bb4338..d2eebdd 100644 --- a/xoops_trust_path/libs/altsys/include/Legacy_AltsysAdminRenderSystem.class.php +++ b/xoops_trust_path/libs/altsys/include/Legacy_AltsysAdminRenderSystem.class.php @@ -1,21 +1,30 @@ getAttributes() ; - altsys_admin_in_theme_in_last($attributes['xoops_contents']) ; - exit ; - } - } +class Legacy_AltsysAdminRenderSystem extends Legacy_AdminRenderSystem { + public function renderTheme( &$target ) { + global $altsysModuleConfig; + + if ( empty( $altsysModuleConfig['admin_in_theme'] ) ) { + parent::renderTheme( $target ); + } else { + $attributes = $target->getAttributes(); + + altsys_admin_in_theme_in_last( $attributes['xoops_contents'] ); + exit; + } + } } diff --git a/xoops_trust_path/libs/altsys/include/Text_Diff.php b/xoops_trust_path/libs/altsys/include/Text_Diff.php index 0d9096a..62e573f 100644 --- a/xoops_trust_path/libs/altsys/include/Text_Diff.php +++ b/xoops_trust_path/libs/altsys/include/Text_Diff.php @@ -1,5 +1,7 @@ */ -class Text_Diff -{ - - /** - * Array of changes. - * - * @var array - */ - public $_edits; - - /** - * Computes diffs between sequences of strings. - * - * @param array $from_lines An array of strings. Typically these are - * lines from a file. - * @param array $to_lines An array of strings. - */ +class Text_Diff { + + /** + * Array of changes. + * + * @var array + */ + public $_edits; + + /** + * Computes diffs between sequences of strings. + * + * @param array $from_lines An array of strings. Typically these are + * lines from a file. + * @param array $to_lines An array of strings. + */ //HACK by domifara // function Text_Diff($from_lines, $to_lines) - public function __construct($from_lines, $to_lines) - { - array_walk($from_lines, array($this, '_trimNewlines')); - array_walk($to_lines, array($this, '_trimNewlines')); - - if (extension_loaded('xdiff')) { - $engine = new Text_Diff_Engine_xdiff(); - } else { - $engine = new Text_Diff_Engine_native(); - } - - $this->_edits = $engine->diff($from_lines, $to_lines); - } - - /** - * Returns the array of differences. - */ - public function getDiff() - { - return $this->_edits; - } - - /** - * Computes a reversed diff. - * - * Example: - * - * $diff = new Text_Diff($lines1, $lines2); - * $rev = $diff->reverse(); - * - * - * @return Text_Diff A Diff object representing the inverse of the - * original diff. Note that we purposely don't return a - * reference here, since this essentially is a clone() - * method. - */ - public function reverse() - { - if (version_compare(zend_version(), '2', '>')) { - $rev = clone($obj); - } else { - $rev = $this; - } - $rev->_edits = array(); - foreach ($this->_edits as $edit) { - $rev->_edits[] = $edit->reverse(); - } - return $rev; - } - - /** - * Checks for an empty diff. - * - * @return boolean True if two sequences were identical. - */ - public function isEmpty() - { - foreach ($this->_edits as $edit) { - if (!is_a($edit, 'Text_Diff_Op_copy')) { - return false; - } - } - return true; - } - - /** - * Computes the length of the Longest Common Subsequence (LCS). - * - * This is mostly for diagnostic purposes. - * - * @return integer The length of the LCS. - */ - public function lcs() - { - $lcs = 0; - foreach ($this->_edits as $edit) { - if (is_a($edit, 'Text_Diff_Op_copy')) { - $lcs += count($edit->orig); - } - } - return $lcs; - } - - /** - * Gets the original set of lines. - * - * This reconstructs the $from_lines parameter passed to the constructor. - * - * @return array The original sequence of strings. - */ - public function getOriginal() - { - $lines = array(); - foreach ($this->_edits as $edit) { - if ($edit->orig) { - array_splice($lines, count($lines), 0, $edit->orig); - } - } - return $lines; - } - - /** - * Gets the final set of lines. - * - * This reconstructs the $to_lines parameter passed to the constructor. - * - * @return array The sequence of strings. - */ - public function getFinal() - { - $lines = array(); - foreach ($this->_edits as $edit) { - if ($edit->final) { - array_splice($lines, count($lines), 0, $edit->final); - } - } - return $lines; - } - - /** - * Removes trailing newlines from a line of text. This is meant to be used - * with array_walk(). - * - * @param string $line The line to trim. - * @param integer $key The index of the line in the array. Not used. - */ - public function _trimNewlines(&$line, $key) - { - $line = str_replace(array("\n", "\r"), '', $line); - } - - /** - * Checks a diff for validity. - * - * This is here only for debugging purposes. - */ - public function _check($from_lines, $to_lines) - { - if (serialize($from_lines) != serialize($this->getOriginal())) { - trigger_error("Reconstructed original doesn't match", E_USER_ERROR); - } - if (serialize($to_lines) != serialize($this->getFinal())) { - trigger_error("Reconstructed final doesn't match", E_USER_ERROR); - } - - $rev = $this->reverse(); - if (serialize($to_lines) != serialize($rev->getOriginal())) { - trigger_error("Reversed original doesn't match", E_USER_ERROR); - } - if (serialize($from_lines) != serialize($rev->getFinal())) { - trigger_error("Reversed final doesn't match", E_USER_ERROR); - } - - $prevtype = null; - foreach ($this->_edits as $edit) { - if ($prevtype == get_class($edit)) { - trigger_error("Edit sequence is non-optimal", E_USER_ERROR); - } - $prevtype = get_class($edit); - } - - return true; - } + public function __construct( $from_lines, $to_lines ) { + array_walk( $from_lines, [ $this, '_trimNewlines' ] ); + array_walk( $to_lines, [ $this, '_trimNewlines' ] ); + + if ( extension_loaded( 'xdiff' ) ) { + $engine = new Text_Diff_Engine_xdiff(); + } else { + $engine = new Text_Diff_Engine_native(); + } + + $this->_edits = $engine->diff( $from_lines, $to_lines ); + } + + /** + * Returns the array of differences. + */ + public function getDiff() { + return $this->_edits; + } + + /** + * Computes a reversed diff. + * + * Example: + * + * $diff = new Text_Diff($lines1, $lines2); + * $rev = $diff->reverse(); + * + * + * @return Text_Diff A Diff object representing the inverse of the + * original diff. Note that we purposely don't return a + * reference here, since this essentially is a clone() + * method. + */ + public function reverse() { + if ( version_compare( zend_version(), '2', '>' ) ) { + $rev = clone( $obj ); + } else { + $rev = $this; + } + $rev->_edits = []; + foreach ( $this->_edits as $edit ) { + $rev->_edits[] = $edit->reverse(); + } + + return $rev; + } + + /** + * Checks for an empty diff. + * + * @return bool True if two sequences were identical. + */ + public function isEmpty() { + foreach ( $this->_edits as $edit ) { + if ( ! is_a( $edit, 'Text_Diff_Op_copy' ) ) { + return false; + } + } + + return true; + } + + /** + * Computes the length of the Longest Common Subsequence (LCS). + * + * This is mostly for diagnostic purposes. + * + * @return int The length of the LCS. + */ + public function lcs() { + $lcs = 0; + foreach ( $this->_edits as $edit ) { + if ( is_a( $edit, 'Text_Diff_Op_copy' ) ) { + $lcs += count( $edit->orig ); + } + } + + return $lcs; + } + + /** + * Gets the original set of lines. + * + * This reconstructs the $from_lines parameter passed to the constructor. + * + * @return array The original sequence of strings. + */ + public function getOriginal() { + $lines = []; + foreach ( $this->_edits as $edit ) { + if ( $edit->orig ) { + array_splice( $lines, count( $lines ), 0, $edit->orig ); + } + } + + return $lines; + } + + /** + * Gets the final set of lines. + * + * This reconstructs the $to_lines parameter passed to the constructor. + * + * @return array The sequence of strings. + */ + public function getFinal() { + $lines = []; + foreach ( $this->_edits as $edit ) { + if ( $edit->final ) { + array_splice( $lines, count( $lines ), 0, $edit->final ); + } + } + + return $lines; + } + + /** + * Removes trailing newlines from a line of text. This is meant to be used + * with array_walk(). + * + * @param string $line The line to trim. + * @param int $key The index of the line in the array. Not used. + */ + public function _trimNewlines( &$line, $key ) { + $line = str_replace( [ "\n", "\r" ], '', $line ); + } + + /** + * Checks a diff for validity. + * + * This is here only for debugging purposes. + * + * @param $from_lines + * @param $to_lines + * + * @return bool + */ + public function _check( $from_lines, $to_lines ) { + if ( serialize( $from_lines ) != serialize( $this->getOriginal() ) ) { + trigger_error( "Reconstructed original doesn't match", E_USER_ERROR ); + } + if ( serialize( $to_lines ) != serialize( $this->getFinal() ) ) { + trigger_error( "Reconstructed final doesn't match", E_USER_ERROR ); + } + + $rev = $this->reverse(); + if ( serialize( $to_lines ) != serialize( $rev->getOriginal() ) ) { + trigger_error( "Reversed original doesn't match", E_USER_ERROR ); + } + if ( serialize( $from_lines ) != serialize( $rev->getFinal() ) ) { + trigger_error( "Reversed final doesn't match", E_USER_ERROR ); + } + + $prevtype = null; + foreach ( $this->_edits as $edit ) { + if ( $prevtype == get_class( $edit ) ) { + trigger_error( 'Edit sequence is non-optimal', E_USER_ERROR ); + } + $prevtype = get_class( $edit ); + } + + return true; + } } /** @@ -203,53 +205,56 @@ public function _check($from_lines, $to_lines) * @package Text_Diff * @author Geoffrey T. Dairiki */ -class Text_MappedDiff extends Text_Diff -{ - - /** - * Computes a diff between sequences of strings. - * - * This can be used to compute things like case-insensitve diffs, or diffs - * which ignore changes in white-space. - * - * @param array $from_lines An array of strings. - * @param array $to_lines An array of strings. - * @param array $mapped_from_lines This array should have the same size - * number of elements as $from_lines. The - * elements in $mapped_from_lines and - * $mapped_to_lines are what is actually - * compared when computing the diff. - * @param array $mapped_to_lines This array should have the same number - * of elements as $to_lines. - */ - public function Text_MappedDiff($from_lines, $to_lines, - $mapped_from_lines, $mapped_to_lines) - { - assert(count($from_lines) == count($mapped_from_lines)); - assert(count($to_lines) == count($mapped_to_lines)); - - parent::Text_Diff($mapped_from_lines, $mapped_to_lines); - - $xi = $yi = 0; - for ($i = 0; $i < count($this->_edits); $i++) { - $orig = &$this->_edits[$i]->orig; - if (is_array($orig)) { - $orig = array_slice($from_lines, $xi, count($orig)); - $xi += count($orig); - } - - $final = &$this->_edits[$i]->final; - if (is_array($final)) { - $final = array_slice($to_lines, $yi, count($final)); - $yi += count($final); - } - } - } +class Text_MappedDiff extends Text_Diff { + + /** + * Computes a diff between sequences of strings. + * + * This can be used to compute things like case-insensitve diffs, or diffs + * which ignore changes in white-space. + * + * @param array $from_lines An array of strings. + * @param array $to_lines An array of strings. + * @param array $mapped_from_lines This array should have the same size + * number of elements as $from_lines. The + * elements in $mapped_from_lines and + * $mapped_to_lines are what is actually + * compared when computing the diff. + * @param array $mapped_to_lines This array should have the same number + * of elements as $to_lines. + */ + + public function __construct( + $from_lines, + $to_lines, + $mapped_from_lines, + $mapped_to_lines + ) { + assert( count( $from_lines ) == count( $mapped_from_lines ) ); + assert( count( $to_lines ) == count( $mapped_to_lines ) ); + + parent::Text_Diff( $mapped_from_lines, $mapped_to_lines ); + + $xi = $yi = 0; + for ( $i = 0; $i < count( $this->_edits ); $i ++ ) { + $orig = &$this->_edits[ $i ]->orig; + if ( is_array( $orig ) ) { + $orig = array_slice( $from_lines, $xi, count( $orig ) ); + $xi += count( $orig ); + } + + $final = &$this->_edits[ $i ]->final; + if ( is_array( $final ) ) { + $final = array_slice( $to_lines, $yi, count( $final ) ); + $yi += count( $final ); + } + } + } } /** * Class used internally by Diff to actually compute the diffs. This class - * uses the xdiff PECL package (http://pecl.php.net/package/xdiff) to compute + * uses the xdiff PECL package (https://pecl.php.net/package/xdiff) to compute * the differences between the two input arrays. * * @author Jon Parise @@ -257,46 +262,48 @@ public function Text_MappedDiff($from_lines, $to_lines, * * @access private */ -class Text_Diff_Engine_xdiff -{ - - public function diff($from_lines, $to_lines) - { - /* Convert the two input arrays into strings for xdiff processing. */ - $from_string = implode("\n", $from_lines); - $to_string = implode("\n", $to_lines); - - /* Diff the two strings and convert the result to an array. */ - $diff = xdiff_string_diff($from_string, $to_string, count($to_lines)); - $diff = explode("\n", $diff); - - /* Walk through the diff one line at a time. We build the $edits - * array of diff operations by reading the first character of the - * xdiff output (which is in the "unified diff" format). - * - * Note that we don't have enough information to detect "changed" - * lines using this approach, so we can't add Text_Diff_Op_changed - * instances to the $edits array. The result is still perfectly - * valid, albeit a little less descriptive and efficient. */ - $edits = array(); - foreach ($diff as $line) { - switch ($line[0]) { - case ' ': - $edits[] = new Text_Diff_Op_copy(array(substr($line, 1))); - break; - - case '+': - $edits[] = new Text_Diff_Op_add(array(substr($line, 1))); - break; - - case '-': - $edits[] = new Text_Diff_Op_delete(array(substr($line, 1))); - break; - } - } - - return $edits; - } +class Text_Diff_Engine_xdiff { + /** + * @param $from_lines + * @param $to_lines + * + * @return array + */ + + public function diff( $from_lines, $to_lines ) { + /* Convert the two input arrays into strings for xdiff processing. */ + $from_string = implode( "\n", $from_lines ); + $to_string = implode( "\n", $to_lines ); + + /* Diff the two strings and convert the result to an array. */ + $diff = xdiff_string_diff( $from_string, $to_string, count( $to_lines ) ); + $diff = explode( "\n", $diff ); + + /* Walk through the diff one line at a time. We build the $edits + * array of diff operations by reading the first character of the + * xdiff output (which is in the "unified diff" format). + * + * Note that we don't have enough information to detect "changed" + * lines using this approach, so we can't add Text_Diff_Op_changed + * instances to the $edits array. The result is still perfectly + * valid, albeit a little less descriptive and efficient. */ + $edits = []; + foreach ( $diff as $line ) { + switch ( $line[0] ) { + case ' ': + $edits[] = new Text_Diff_Op_copy( [ mb_substr( $line, 1 ) ] ); + break; + case '+': + $edits[] = new Text_Diff_Op_add( [ mb_substr( $line, 1 ) ] ); + break; + case '-': + $edits[] = new Text_Diff_Op_delete( [ mb_substr( $line, 1 ) ] ); + break; + } + } + + return $edits; + } } /** @@ -305,10 +312,10 @@ public function diff($from_lines, $to_lines) * * The algorithm used here is mostly lifted from the perl module * Algorithm::Diff (version 1.06) by Ned Konz, which is available at: - * http://www.perl.com/CPAN/authors/id/N/NE/NEDKONZ/Algorithm-Diff-1.06.zip + * https://www.perl.com/CPAN/authors/id/N/NE/NEDKONZ/Algorithm-Diff-1.06.zip * * More ideas are taken from: - * http://www.ics.uci.edu/~eppstein/161/960229.html + * https://www.ics.uci.edu/~eppstein/161/960229.html * * Some ideas (and a bit of code) are taken from analyze.c, of GNU * diffutils-2.7, which can be found at: @@ -323,412 +330,442 @@ public function diff($from_lines, $to_lines) * * @access private */ -class Text_Diff_Engine_native -{ - - public function diff($from_lines, $to_lines) - { - $n_from = count($from_lines); - $n_to = count($to_lines); - - $this->xchanged = $this->ychanged = array(); - $this->xv = $this->yv = array(); - $this->xind = $this->yind = array(); - unset($this->seq); - unset($this->in_seq); - unset($this->lcs); - - // Skip leading common lines. - for ($skip = 0; $skip < $n_from && $skip < $n_to; $skip++) { - if ($from_lines[$skip] != $to_lines[$skip]) { - break; - } - $this->xchanged[$skip] = $this->ychanged[$skip] = false; - } - - // Skip trailing common lines. - $xi = $n_from; - $yi = $n_to; - for ($endskip = 0; --$xi > $skip && --$yi > $skip; $endskip++) { - if ($from_lines[$xi] != $to_lines[$yi]) { - break; - } - $this->xchanged[$xi] = $this->ychanged[$yi] = false; - } - - // Ignore lines which do not exist in both files. - for ($xi = $skip; $xi < $n_from - $endskip; $xi++) { - $xhash[$from_lines[$xi]] = 1; - } - for ($yi = $skip; $yi < $n_to - $endskip; $yi++) { - $line = $to_lines[$yi]; - if (($this->ychanged[$yi] = empty($xhash[$line]))) { - continue; - } - $yhash[$line] = 1; - $this->yv[] = $line; - $this->yind[] = $yi; - } - for ($xi = $skip; $xi < $n_from - $endskip; $xi++) { - $line = $from_lines[$xi]; - if (($this->xchanged[$xi] = empty($yhash[$line]))) { - continue; - } - $this->xv[] = $line; - $this->xind[] = $xi; - } - - // Find the LCS. - $this->_compareseq(0, count($this->xv), 0, count($this->yv)); - - // Merge edits when possible. - $this->_shiftBoundaries($from_lines, $this->xchanged, $this->ychanged); - $this->_shiftBoundaries($to_lines, $this->ychanged, $this->xchanged); - - // Compute the edit operations. - $edits = array(); - $xi = $yi = 0; - while ($xi < $n_from || $yi < $n_to) { - assert($yi < $n_to || $this->xchanged[$xi]); - assert($xi < $n_from || $this->ychanged[$yi]); - - // Skip matching "snake". - $copy = array(); - while ($xi < $n_from && $yi < $n_to - && !$this->xchanged[$xi] && !$this->ychanged[$yi]) { - $copy[] = $from_lines[$xi++]; - ++$yi; - } - if ($copy) { - $edits[] = new Text_Diff_Op_copy($copy); - } - - // Find deletes & adds. - $delete = array(); - while ($xi < $n_from && $this->xchanged[$xi]) { - $delete[] = $from_lines[$xi++]; - } - - $add = array(); - while ($yi < $n_to && $this->ychanged[$yi]) { - $add[] = $to_lines[$yi++]; - } - - if ($delete && $add) { - $edits[] = new Text_Diff_Op_change($delete, $add); - } elseif ($delete) { - $edits[] = new Text_Diff_Op_delete($delete); - } elseif ($add) { - $edits[] = new Text_Diff_Op_add($add); - } - } - - return $edits; - } - - /** - * Divides the Largest Common Subsequence (LCS) of the sequences (XOFF, - * XLIM) and (YOFF, YLIM) into NCHUNKS approximately equally sized - * segments. - * - * Returns (LCS, PTS). LCS is the length of the LCS. PTS is an array of - * NCHUNKS+1 (X, Y) indexes giving the diving points between sub - * sequences. The first sub-sequence is contained in (X0, X1), (Y0, Y1), - * the second in (X1, X2), (Y1, Y2) and so on. Note that (X0, Y0) == - * (XOFF, YOFF) and (X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM). - * - * This function assumes that the first lines of the specified portions of - * the two files do not match, and likewise that the last lines do not - * match. The caller must trim matching lines from the beginning and end - * of the portions it is going to specify. - */ - public function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) - { - $flip = false; - - if ($xlim - $xoff > $ylim - $yoff) { - /* Things seems faster (I'm not sure I understand why) when the - * shortest sequence is in X. */ - $flip = true; - list($xoff, $xlim, $yoff, $ylim) - = array($yoff, $ylim, $xoff, $xlim); - } - - if ($flip) { - for ($i = $ylim - 1; $i >= $yoff; $i--) { - $ymatches[$this->xv[$i]][] = $i; - } - } else { - for ($i = $ylim - 1; $i >= $yoff; $i--) { - $ymatches[$this->yv[$i]][] = $i; - } - } - - $this->lcs = 0; - $this->seq[0]= $yoff - 1; - $this->in_seq = array(); - $ymids[0] = array(); - - $numer = $xlim - $xoff + $nchunks - 1; - $x = $xoff; - for ($chunk = 0; $chunk < $nchunks; $chunk++) { - if ($chunk > 0) { - for ($i = 0; $i <= $this->lcs; $i++) { - $ymids[$i][$chunk - 1] = $this->seq[$i]; - } - } - - $x1 = $xoff + (int)(($numer + ($xlim-$xoff)*$chunk) / $nchunks); - for (; $x < $x1; $x++) { - $line = $flip ? $this->yv[$x] : $this->xv[$x]; - if (empty($ymatches[$line])) { - continue; - } - $matches = $ymatches[$line]; - foreach ($matches as $y) { - if (empty($this->in_seq[$y])) { - $k = $this->_lcsPos($y); - assert($k > 0); - $ymids[$k] = $ymids[$k - 1]; - break; - } - } - - while (list($junk, $y) = each($matches)) { - if ($y > $this->seq[$k - 1]) { - // assert($y < $this->seq[$k]); // GIJ Patched - /* Optimization: this is a common case: next match is - * just replacing previous match. */ - $this->in_seq[$this->seq[$k]] = false; - $this->seq[$k] = $y; - $this->in_seq[$y] = 1; - } elseif (empty($this->in_seq[$y])) { - $k = $this->_lcsPos($y); - assert($k > 0); - $ymids[$k] = $ymids[$k - 1]; - } - } - } - } - - $seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff); - $ymid = $ymids[$this->lcs]; - for ($n = 0; $n < $nchunks - 1; $n++) { - $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks); - $y1 = $ymid[$n] + 1; - $seps[] = $flip ? array($y1, $x1) : array($x1, $y1); - } - $seps[] = $flip ? array($ylim, $xlim) : array($xlim, $ylim); - - return array($this->lcs, $seps); - } - - public function _lcsPos($ypos) - { - $end = $this->lcs; - if ($end == 0 || $ypos > $this->seq[$end]) { - $this->seq[++$this->lcs] = $ypos; - $this->in_seq[$ypos] = 1; - return $this->lcs; - } - - $beg = 1; - while ($beg < $end) { - $mid = (int)(($beg + $end) / 2); - if ($ypos > $this->seq[$mid]) { - $beg = $mid + 1; - } else { - $end = $mid; - } - } - - assert($ypos != $this->seq[$end]); - - $this->in_seq[$this->seq[$end]] = false; - $this->seq[$end] = $ypos; - $this->in_seq[$ypos] = 1; - return $end; - } - - /** - * Finds LCS of two sequences. - * - * The results are recorded in the vectors $this->{x,y}changed[], by - * storing a 1 in the element for each line that is an insertion or - * deletion (ie. is not in the LCS). - * - * The subsequence of file 0 is (XOFF, XLIM) and likewise for file 1. - * - * Note that XLIM, YLIM are exclusive bounds. All line numbers are - * origin-0 and discarded lines are not counted. - */ - public function _compareseq($xoff, $xlim, $yoff, $ylim) - { - /* Slide down the bottom initial diagonal. */ - while ($xoff < $xlim && $yoff < $ylim - && $this->xv[$xoff] == $this->yv[$yoff]) { - ++$xoff; - ++$yoff; - } - - /* Slide up the top initial diagonal. */ - while ($xlim > $xoff && $ylim > $yoff - && $this->xv[$xlim - 1] == $this->yv[$ylim - 1]) { - --$xlim; - --$ylim; - } - - if ($xoff == $xlim || $yoff == $ylim) { - $lcs = 0; - } else { - /* This is ad hoc but seems to work well. $nchunks = - * sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5); $nchunks = - * max(2,min(8,(int)$nchunks)); */ - $nchunks = min(7, $xlim - $xoff, $ylim - $yoff) + 1; - list($lcs, $seps) - = $this->_diag($xoff, $xlim, $yoff, $ylim, $nchunks); - } - - if ($lcs == 0) { - /* X and Y sequences have no common subsequence: mark all - * changed. */ - while ($yoff < $ylim) { - $this->ychanged[$this->yind[$yoff++]] = 1; - } - while ($xoff < $xlim) { - $this->xchanged[$this->xind[$xoff++]] = 1; - } - } else { - /* Use the partitions to split this problem into subproblems. */ - reset($seps); - $pt1 = $seps[0]; - while ($pt2 = next($seps)) { - $this->_compareseq($pt1[0], $pt2[0], $pt1[1], $pt2[1]); - $pt1 = $pt2; - } - } - } - - /** - * Adjusts inserts/deletes of identical lines to join changes as much as - * possible. - * - * We do something when a run of changed lines include a line at one end - * and has an excluded, identical line at the other. We are free to - * choose which identical line is included. `compareseq' usually chooses - * the one at the beginning, but usually it is cleaner to consider the - * following identical line to be the "change". - * - * This is extracted verbatim from analyze.c (GNU diffutils-2.7). - */ - public function _shiftBoundaries($lines, &$changed, $other_changed) - { - $i = 0; - $j = 0; - - assert('count($lines) == count($changed)'); - $len = count($lines); - $other_len = count($other_changed); - - while (1) { - /* Scan forward to find the beginning of another run of - * changes. Also keep track of the corresponding point in the - * other file. - * - * Throughout this code, $i and $j are adjusted together so that - * the first $i elements of $changed and the first $j elements of - * $other_changed both contain the same number of zeros (unchanged - * lines). - * - * Furthermore, $j is always kept so that $j == $other_len or - * $other_changed[$j] == false. */ - while ($j < $other_len && $other_changed[$j]) { - $j++; - } - - while ($i < $len && ! $changed[$i]) { - assert('$j < $other_len && ! $other_changed[$j]'); - $i++; - $j++; - while ($j < $other_len && $other_changed[$j]) { - $j++; - } - } - - if ($i == $len) { - break; - } - - $start = $i; - - /* Find the end of this run of changes. */ - while (++$i < $len && $changed[$i]) { - continue; - } - - do { - /* Record the length of this run of changes, so that we can - * later determine whether the run has grown. */ - $runlength = $i - $start; - - /* Move the changed region back, so long as the previous - * unchanged line matches the last changed one. This merges - * with previous changed regions. */ - while ($start > 0 && $lines[$start - 1] == $lines[$i - 1]) { - $changed[--$start] = 1; - $changed[--$i] = false; - while ($start > 0 && $changed[$start - 1]) { - $start--; - } - assert('$j > 0'); - while ($other_changed[--$j]) { - continue; - } - assert('$j >= 0 && !$other_changed[$j]'); - } - - /* Set CORRESPONDING to the end of the changed run, at the - * last point where it corresponds to a changed run in the - * other file. CORRESPONDING == LEN means no such point has - * been found. */ - $corresponding = $j < $other_len ? $i : $len; - - /* Move the changed region forward, so long as the first - * changed line matches the following unchanged one. This - * merges with following changed regions. Do this second, so - * that if there are no merges, the changed region is moved - * forward as far as possible. */ - while ($i < $len && $lines[$start] == $lines[$i]) { - $changed[$start++] = false; - $changed[$i++] = 1; - while ($i < $len && $changed[$i]) { - $i++; - } - - assert('$j < $other_len && ! $other_changed[$j]'); - $j++; - if ($j < $other_len && $other_changed[$j]) { - $corresponding = $i; - while ($j < $other_len && $other_changed[$j]) { - $j++; - } - } - } - } while ($runlength != $i - $start); - - /* If possible, move the fully-merged run of changes back to a - * corresponding run in the other file. */ - while ($corresponding < $i) { - $changed[--$start] = 1; - $changed[--$i] = 0; - assert('$j > 0'); - while ($other_changed[--$j]) { - continue; - } - assert('$j >= 0 && !$other_changed[$j]'); - } - } - } +class Text_Diff_Engine_native { + /** + * @param $from_lines + * @param $to_lines + * + * @return array + */ + + public function diff( $from_lines, $to_lines ) { + $n_from = count( $from_lines ); + $n_to = count( $to_lines ); + + $this->xchanged = $this->ychanged = []; + $this->xv = $this->yv = []; + $this->xind = $this->yind = []; + + unset( $this->seq, $this->in_seq, $this->lcs ); + + // Skip leading common lines. + for ( $skip = 0; $skip < $n_from && $skip < $n_to; $skip ++ ) { + if ( $from_lines[ $skip ] != $to_lines[ $skip ] ) { + break; + } + $this->xchanged[ $skip ] = $this->ychanged[ $skip ] = false; + } + + // Skip trailing common lines. + $xi = $n_from; + $yi = $n_to; + for ( $endskip = 0; -- $xi > $skip && -- $yi > $skip; $endskip ++ ) { + if ( $from_lines[ $xi ] != $to_lines[ $yi ] ) { + break; + } + $this->xchanged[ $xi ] = $this->ychanged[ $yi ] = false; + } + + // Ignore lines which do not exist in both files. + for ( $xi = $skip; $xi < $n_from - $endskip; $xi ++ ) { + $xhash[ $from_lines[ $xi ] ] = 1; + } + for ( $yi = $skip; $yi < $n_to - $endskip; $yi ++ ) { + $line = $to_lines[ $yi ]; + if ( ( $this->ychanged[ $yi ] = empty( $xhash[ $line ] ) ) ) { + continue; + } + $yhash[ $line ] = 1; + $this->yv[] = $line; + $this->yind[] = $yi; + } + for ( $xi = $skip; $xi < $n_from - $endskip; $xi ++ ) { + $line = $from_lines[ $xi ]; + if ( ( $this->xchanged[ $xi ] = empty( $yhash[ $line ] ) ) ) { + continue; + } + $this->xv[] = $line; + $this->xind[] = $xi; + } + + // Find the LCS. + $this->_compareseq( 0, count( $this->xv ), 0, count( $this->yv ) ); + + // Merge edits when possible. + $this->_shiftBoundaries( $from_lines, $this->xchanged, $this->ychanged ); + $this->_shiftBoundaries( $to_lines, $this->ychanged, $this->xchanged ); + + // Compute the edit operations. + $edits = []; + $xi = $yi = 0; + while ( $xi < $n_from || $yi < $n_to ) { + assert( $yi < $n_to || $this->xchanged[ $xi ] ); + assert( $xi < $n_from || $this->ychanged[ $yi ] ); + + // Skip matching "snake". + $copy = []; + while ( $xi < $n_from && $yi < $n_to + && ! $this->xchanged[ $xi ] + && ! $this->ychanged[ $yi ] ) { + $copy[] = $from_lines[ $xi ++ ]; + ++ $yi; + } + if ( $copy ) { + $edits[] = new Text_Diff_Op_copy( $copy ); + } + + // Find deletes & adds. + $delete = []; + while ( $xi < $n_from && $this->xchanged[ $xi ] ) { + $delete[] = $from_lines[ $xi ++ ]; + } + + $add = []; + while ( $yi < $n_to && $this->ychanged[ $yi ] ) { + $add[] = $to_lines[ $yi ++ ]; + } + + if ( $delete && $add ) { + $edits[] = new Text_Diff_Op_change( $delete, $add ); + } elseif ( $delete ) { + $edits[] = new Text_Diff_Op_delete( $delete ); + } elseif ( $add ) { + $edits[] = new Text_Diff_Op_add( $add ); + } + } + + return $edits; + } + + /** + * Divides the Largest Common Subsequence (LCS) of the sequences (XOFF, + * XLIM) and (YOFF, YLIM) into NCHUNKS approximately equally sized + * segments. + * + * Returns (LCS, PTS). LCS is the length of the LCS. PTS is an array of + * NCHUNKS+1 (X, Y) indexes giving the diving points between sub + * sequences. The first sub-sequence is contained in (X0, X1), (Y0, Y1), + * the second in (X1, X2), (Y1, Y2) and so on. Note that (X0, Y0) == + * (XOFF, YOFF) and (X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM). + * + * This function assumes that the first lines of the specified portions of + * the two files do not match, and likewise that the last lines do not + * match. The caller must trim matching lines from the beginning and end + * of the portions it is going to specify. + * + * @param $xoff + * @param $xlim + * @param $yoff + * @param $ylim + * @param $nchunks + * + * @return array + */ + public function _diag( $xoff, $xlim, $yoff, $ylim, $nchunks ) { + $flip = false; + + if ( $xlim - $xoff > $ylim - $yoff ) { + /* Things seems faster (I'm not sure I understand why) when the + * shortest sequence is in X. */ + $flip = true; + + list( $xoff, $xlim, $yoff, $ylim ) = [ $yoff, $ylim, $xoff, $xlim ]; + } + + if ( $flip ) { + for ( $i = $ylim - 1; $i >= $yoff; $i -- ) { + $ymatches[ $this->xv[ $i ] ][] = $i; + } + } else { + for ( $i = $ylim - 1; $i >= $yoff; $i -- ) { + $ymatches[ $this->yv[ $i ] ][] = $i; + } + } + + $this->lcs = 0; + + $this->seq[0] = $yoff - 1; + + $this->in_seq = []; + $ymids[0] = []; + + $numer = $xlim - $xoff + $nchunks - 1; + $x = $xoff; + for ( $chunk = 0; $chunk < $nchunks; $chunk ++ ) { + if ( $chunk > 0 ) { + for ( $i = 0; $i <= $this->lcs; ++ $i ) { + $ymids[ $i ][ $chunk - 1 ] = $this->seq[ $i ]; + } + } + + $x1 = $xoff + (int) ( ( $numer + ( $xlim - $xoff ) * $chunk ) / $nchunks ); + + for ( ; $x < $x1; $x ++ ) { + $line = $flip ? $this->yv[ $x ] : $this->xv[ $x ]; + if ( empty( $ymatches[ $line ] ) ) { + continue; + } + $matches = $ymatches[ $line ]; + foreach ( $matches as $y ) { + if ( empty( $this->in_seq[ $y ] ) ) { + $k = $this->_lcsPos( $y ); + assert( $k > 0 ); + $ymids[ $k ] = $ymids[ $k - 1 ]; + break; + } + } + // TODO @gigamaster replace each (deprecated) with foreach + // while ( list( $junk, $y ) = each( $matches ) ) { + foreach($matches as $junk => $y) { + if ( $y > $this->seq[ $k - 1 ] ) { + // assert($y < $this->seq[$k]); // GIJ Patched + /* Optimization: this is a common case: next match is + * just replacing previous match. */ + $this->in_seq[ $this->seq[ $k ] ] = false; + $this->seq[ $k ] = $y; + $this->in_seq[ $y ] = 1; + } elseif ( empty( $this->in_seq[ $y ] ) ) { + $k = $this->_lcsPos( $y ); + assert( $k > 0 ); + $ymids[ $k ] = $ymids[ $k - 1 ]; + } + } + } + } + + $seps[] = $flip ? [ $yoff, $xoff ] : [ $xoff, $yoff ]; + $ymid = $ymids[ $this->lcs ]; + for ( $n = 0; $n < $nchunks - 1; $n ++ ) { + $x1 = $xoff + (int) ( ( $numer + ( $xlim - $xoff ) * $n ) / $nchunks ); + $y1 = $ymid[ $n ] + 1; + $seps[] = $flip ? [ $y1, $x1 ] : [ $x1, $y1 ]; + } + $seps[] = $flip ? [ $ylim, $xlim ] : [ $xlim, $ylim ]; + + return [ $this->lcs, $seps ]; + } + + /** + * @param $ypos + * + * @return int + */ + + public function _lcsPos( $ypos ) { + $end = $this->lcs; + if ( 0 == $end || $ypos > $this->seq[ $end ] ) { + $this->seq[ ++ $this->lcs ] = $ypos; + $this->in_seq[ $ypos ] = 1; + + return $this->lcs; + } + + $beg = 1; + while ( $beg < $end ) { + $mid = (int) ( ( $beg + $end ) / 2 ); + if ( $ypos > $this->seq[ $mid ] ) { + $beg = $mid + 1; + } else { + $end = $mid; + } + } + + assert( $ypos != $this->seq[ $end ] ); + + $this->in_seq[ $this->seq[ $end ] ] = false; + $this->seq[ $end ] = $ypos; + $this->in_seq[ $ypos ] = 1; + + return $end; + } + + /** + * Finds LCS of two sequences. + * + * The results are recorded in the vectors $this->{x,y}changed[], by + * storing a 1 in the element for each line that is an insertion or + * deletion (ie. is not in the LCS). + * + * The subsequence of file 0 is (XOFF, XLIM) and likewise for file 1. + * + * Note that XLIM, YLIM are exclusive bounds. All line numbers are + * origin-0 and discarded lines are not counted. + * + * @param $xoff + * @param $xlim + * @param $yoff + * @param $ylim + */ + public function _compareseq( $xoff, $xlim, $yoff, $ylim ) { + /* Slide down the bottom initial diagonal. */ + while ( $xoff < $xlim && $yoff < $ylim + && $this->xv[ $xoff ] == $this->yv[ $yoff ] ) { + ++ $xoff; + ++ $yoff; + } + + /* Slide up the top initial diagonal. */ + while ( $xlim > $xoff && $ylim > $yoff + && $this->xv[ $xlim - 1 ] == $this->yv[ $ylim - 1 ] ) { + -- $xlim; + -- $ylim; + } + + if ( $xoff == $xlim || $yoff == $ylim ) { + $lcs = 0; + } else { + /* This is ad hoc but seems to work well. $nchunks = + * sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5); $nchunks = + * max(2,min(8,(int)$nchunks)); */ + $nchunks = min( 7, $xlim - $xoff, $ylim - $yoff ) + 1; + + list( $lcs, $seps ) = $this->_diag( $xoff, $xlim, $yoff, $ylim, $nchunks ); + } + + if ( 0 == $lcs ) { + /* X and Y sequences have no common subsequence: mark all + * changed. */ + while ( $yoff < $ylim ) { + $this->ychanged[ $this->yind[ $yoff ++ ] ] = 1; + } + while ( $xoff < $xlim ) { + $this->xchanged[ $this->xind[ $xoff ++ ] ] = 1; + } + } else { + /* Use the partitions to split this problem into subproblems. */ + reset( $seps ); + $pt1 = $seps[0]; + while ( $pt2 = next( $seps ) ) { + $this->_compareseq( $pt1[0], $pt2[0], $pt1[1], $pt2[1] ); + $pt1 = $pt2; + } + } + } + + /** + * Adjusts inserts/deletes of identical lines to join changes as much as + * possible. + * + * We do something when a run of changed lines include a line at one end + * and has an excluded, identical line at the other. We are free to + * choose which identical line is included. `compareseq' usually chooses + * the one at the beginning, but usually it is cleaner to consider the + * following identical line to be the "change". + * + * This is extracted verbatim from analyze.c (GNU diffutils-2.7). + * + * @param $lines + * @param $changed + * @param $other_changed + */ + public function _shiftBoundaries( $lines, &$changed, $other_changed ) { + $i = 0; + $j = 0; + + assert( count( $lines ) == count( $changed ) ); + $len = count( $lines ); + $other_len = count( $other_changed ); + + while ( 1 ) { + /* Scan forward to find the beginning of another run of + * changes. Also keep track of the corresponding point in the + * other file. + * + * Throughout this code, $i and $j are adjusted together so that + * the first $i elements of $changed and the first $j elements of + * $other_changed both contain the same number of zeros (unchanged + * lines). + * + * Furthermore, $j is always kept so that $j == $other_len or + * $other_changed[$j] == false. */ + while ( $j < $other_len && $other_changed[ $j ] ) { + $j ++; + } + + while ( $i < $len && ! $changed[ $i ] ) { + + assert( $j < $other_len && ! $other_changed[ $j ] ); + $i ++; + $j ++; + while ( $j < $other_len && $other_changed[ $j ] ) { + $j ++; + } + } + + if ( $i == $len ) { + break; + } + + $start = $i; + + /* Find the end of this run of changes. */ + while ( ++ $i < $len && $changed[ $i ] ) { + continue; + } + + do { + /* Record the length of this run of changes, so that we can + * later determine whether the run has grown. */ + $runlength = $i - $start; + + /* Move the changed region back, so long as the previous + * unchanged line matches the last changed one. This merges + * with previous changed regions. */ + while ( $start > 0 && $lines[ $start - 1 ] == $lines[ $i - 1 ] ) { + $changed[ -- $start ] = 1; + $changed[ -- $i ] = false; + while ( $start > 0 && $changed[ $start - 1 ] ) { + $start --; + } + assert( $j > 0 ); + while ( $other_changed[ -- $j ] ) { + continue; + } + assert( $j >= 0 && !$other_changed[$j] ); + } + + /* Set CORRESPONDING to the end of the changed run, at the + * last point where it corresponds to a changed run in the + * other file. CORRESPONDING == LEN means no such point has + * been found. */ + $corresponding = $j < $other_len ? $i : $len; + + /* Move the changed region forward, so long as the first + * changed line matches the following unchanged one. This + * merges with following changed regions. Do this second, so + * that if there are no merges, the changed region is moved + * forward as far as possible. */ + while ( $i < $len && $lines[ $start ] == $lines[ $i ] ) { + $changed[ $start ++ ] = false; + $changed[ $i ++ ] = 1; + while ( $i < $len && $changed[ $i ] ) { + $i ++; + } + + assert( $j < $other_len && ! $other_changed[$j] ); + $j ++; + if ( $j < $other_len && $other_changed[ $j ] ) { + $corresponding = $i; + while ( $j < $other_len && $other_changed[ $j ] ) { + $j ++; + } + } + } + } while ( $runlength != $i - $start ); + + /* If possible, move the fully-merged run of changes back to a + * corresponding run in the other file. */ + while ( $corresponding < $i ) { + $changed[ -- $start ] = 1; + $changed[ -- $i ] = 0; + assert( $j > 0 ); + while ( $other_changed[ -- $j ] ) { + continue; + } + assert( $j >= 0 && !$other_changed[$j] ); + } + } + } } /** @@ -737,26 +774,30 @@ public function _shiftBoundaries($lines, &$changed, $other_changed) * * @access private */ -class Text_Diff_Op -{ - - public $orig; - public $final; - - public function reverse() - { - trigger_error('Abstract method', E_USER_ERROR); - } - - public function norig() - { - return $this->orig ? count($this->orig) : 0; - } - - public function nfinal() - { - return $this->final ? count($this->final) : 0; - } +class Text_Diff_Op { + + public $orig; + public $final; + + public function reverse() { + trigger_error( 'Abstract method', E_USER_ERROR ); + } + + /** + * @return int|void + */ + + public function norig() { + return $this->orig ? count( $this->orig ) : 0; + } + + /** + * @return int|void + */ + + public function nfinal() { + return $this->final ? count( $this->final ) : 0; + } } /** @@ -765,22 +806,29 @@ public function nfinal() * * @access private */ -class Text_Diff_Op_copy extends Text_Diff_Op -{ - - public function Text_Diff_Op_copy($orig, $final = false) - { - if (!is_array($final)) { - $final = $orig; - } - $this->orig = $orig; - $this->final = $final; - } - - public function &reverse() - { - return $reverse = new Text_Diff_Op_copy($this->final, $this->orig); - } +class Text_Diff_Op_copy extends Text_Diff_Op { + /** + * Text_Diff_Op_copy constructor. + * + * @param $orig + * @param bool $final + */ + + public function __construct( $orig, $final = false ) { + if ( ! is_array( $final ) ) { + $final = $orig; + } + $this->orig = $orig; + $this->final = $final; + } + + /** + * @return \Text_Diff_Op_copy + */ + + public function &reverse() { + return $reverse = new self( $this->final, $this->orig ); + } } /** @@ -789,19 +837,25 @@ public function &reverse() * * @access private */ -class Text_Diff_Op_delete extends Text_Diff_Op -{ - - public function Text_Diff_Op_delete($lines) - { - $this->orig = $lines; - $this->final = false; - } - - public function &reverse() - { - return $reverse = new Text_Diff_Op_add($this->orig); - } +class Text_Diff_Op_delete extends Text_Diff_Op { + /** + * Text_Diff_Op_delete constructor. + * + * @param $lines + */ + + public function __construct( $lines ) { + $this->orig = $lines; + $this->final = false; + } + + /** + * @return \Text_Diff_Op_add + */ + + public function &reverse() { + return $reverse = new Text_Diff_Op_add( $this->orig ); + } } /** @@ -810,19 +864,25 @@ public function &reverse() * * @access private */ -class Text_Diff_Op_add extends Text_Diff_Op -{ - - public function Text_Diff_Op_add($lines) - { - $this->final = $lines; - $this->orig = false; - } - - public function &reverse() - { - return $reverse = new Text_Diff_Op_delete($this->final); - } +class Text_Diff_Op_add extends Text_Diff_Op { + /** + * Text_Diff_Op_add constructor. + * + * @param $lines + */ + + public function __construct( $lines ) { + $this->final = $lines; + $this->orig = false; + } + + /** + * @return \Text_Diff_Op_delete + */ + + public function &reverse() { + return $reverse = new Text_Diff_Op_delete( $this->final ); + } } /** @@ -831,17 +891,24 @@ public function &reverse() * * @access private */ -class Text_Diff_Op_change extends Text_Diff_Op -{ - - public function Text_Diff_Op_change($orig, $final) - { - $this->orig = $orig; - $this->final = $final; - } - - public function &reverse() - { - return $reverse = new Text_Diff_Op_change($this->final, $this->orig); - } +class Text_Diff_Op_change extends Text_Diff_Op { + /** + * Text_Diff_Op_change constructor. + * + * @param $orig + * @param $final + */ + + public function __construct( $orig, $final ) { + $this->orig = $orig; + $this->final = $final; + } + + /** + * @return \Text_Diff_Op_change + */ + + public function &reverse() { + return $reverse = new self( $this->final, $this->orig ); + } } diff --git a/xoops_trust_path/libs/altsys/include/Text_Diff_Renderer.php b/xoops_trust_path/libs/altsys/include/Text_Diff_Renderer.php index 77883bf..d630a8e 100644 --- a/xoops_trust_path/libs/altsys/include/Text_Diff_Renderer.php +++ b/xoops_trust_path/libs/altsys/include/Text_Diff_Renderer.php @@ -9,203 +9,255 @@ * * @package Text_Diff */ -class Text_Diff_Renderer -{ - - /** - * Number of leading context "lines" to preserve. - * - * This should be left at zero for this class, but subclasses may want to - * set this to other values. - */ - public $_leading_context_lines = 0; - - /** - * Number of trailing context "lines" to preserve. - * - * This should be left at zero for this class, but subclasses may want to - * set this to other values. - */ - public $_trailing_context_lines = 0; - - /** - * Constructor. - */ -//HACK by domifara -// function Text_Diff_Renderer($params = array()) - public function __construct($params = array()) - { - foreach ($params as $param => $value) { - $v = '_' . $param; - if (isset($this->$v)) { - $this->$v = $value; - } - } - } - - /** - * Get any renderer parameters. - * - * @return array All parameters of this renderer object. - */ - public function getParams() - { - $params = array(); - foreach (get_object_vars($this) as $k => $v) { - if ($k{0} == '_') { - $params[substr($k, 1)] = $v; - } - } - - return $params; - } - - /** - * Renders a diff. - * - * @param Text_Diff $diff A Text_Diff object. - * - * @return string The formatted output. - */ - public function render($diff) - { - $xi = $yi = 1; - $block = false; - $context = array(); - - $nlead = $this->_leading_context_lines; - $ntrail = $this->_trailing_context_lines; - - $output = $this->_startDiff(); - - foreach ($diff->getDiff() as $edit) { - if (is_a($edit, 'Text_Diff_Op_copy')) { - if (is_array($block)) { - if (count($edit->orig) <= $nlead + $ntrail) { - $block[] = $edit; - } else { - if ($ntrail) { - $context = array_slice($edit->orig, 0, $ntrail); - $block[] = new Text_Diff_Op_copy($context); - } - $output .= $this->_block($x0, $ntrail + $xi - $x0, - $y0, $ntrail + $yi - $y0, - $block); - $block = false; - } - } - $context = $edit->orig; - } else { - if (!is_array($block)) { - $context = array_slice($context, count($context) - $nlead); - $x0 = $xi - count($context); - $y0 = $yi - count($context); - $block = array(); - if ($context) { - $block[] = new Text_Diff_Op_copy($context); - } - } - $block[] = $edit; - } - - if ($edit->orig) { - $xi += count($edit->orig); - } - if ($edit->final) { - $yi += count($edit->final); - } - } - - if (is_array($block)) { - $output .= $this->_block($x0, $xi - $x0, - $y0, $yi - $y0, - $block); - } - - return $output . $this->_endDiff(); - } - - public function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) - { - $output = $this->_startBlock($this->_blockHeader($xbeg, $xlen, $ybeg, $ylen)); - - foreach ($edits as $edit) { - switch (strtolower(get_class($edit))) { - case 'text_diff_op_copy': - $output .= $this->_context($edit->orig); - break; - - case 'text_diff_op_add': - $output .= $this->_added($edit->final); - break; - - case 'text_diff_op_delete': - $output .= $this->_deleted($edit->orig); - break; - - case 'text_diff_op_change': - $output .= $this->_changed($edit->orig, $edit->final); - break; - } - } - - return $output . $this->_endBlock(); - } - - public function _startDiff() - { - return ''; - } - - public function _endDiff() - { - return ''; - } - - public function _blockHeader($xbeg, $xlen, $ybeg, $ylen) - { - if ($xlen > 1) { - $xbeg .= ',' . ($xbeg + $xlen - 1); - } - if ($ylen > 1) { - $ybeg .= ',' . ($ybeg + $ylen - 1); - } - - return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg; - } - - public function _startBlock($header) - { - return $header . "\n"; - } - - public function _endBlock() - { - return ''; - } - - public function _lines($lines, $prefix = ' ') - { - return $prefix . implode("\n$prefix", $lines) . "\n"; - } - - public function _context($lines) - { - return $this->_lines($lines); - } - - public function _added($lines) - { - return $this->_lines($lines, '>'); - } - - public function _deleted($lines) - { - return $this->_lines($lines, '<'); - } - - public function _changed($orig, $final) - { - return $this->_deleted($orig) . "---\n" . $this->_added($final); - } +class Text_Diff_Renderer { + + /** + * Number of leading context "lines" to preserve. + * + * This should be left at zero for this class, but subclasses may want to + * set this to other values. + */ + public $_leading_context_lines = 0; + + /** + * Number of trailing context "lines" to preserve. + * + * This should be left at zero for this class, but subclasses may want to + * set this to other values. + */ + public $_trailing_context_lines = 0; + + /** + * Constructor. + * + * @param array $params + */ + + //HACK by domifara + + public function __construct( $params = [] ) { + foreach ( $params as $param => $value ) { + $v = '_' . $param; + if ( isset( $this->$v ) ) { + $this->$v = $value; + } + } + } + + /** + * Get any renderer parameters. + * + * @return array All parameters of this renderer object. + */ + public function getParams() { + $params = []; + foreach ( get_object_vars( $this ) as $k => $v ) { + if ( '_' == $k[0] ) { + $params[ mb_substr( $k, 1 ) ] = $v; + } + } + + return $params; + } + + /** + * Renders a diff. + * + * @param Text_Diff $diff A Text_Diff object. + * + * @return string The formatted output. + */ + public function render( $diff ) { + $xi = $yi = 1; + $block = false; + $context = []; + + $nlead = $this->_leading_context_lines; + $ntrail = $this->_trailing_context_lines; + + $output = $this->_startDiff(); + + foreach ( $diff->getDiff() as $edit ) { + if ( is_a( $edit, 'Text_Diff_Op_copy' ) ) { + if ( is_array( $block ) ) { + if ( count( $edit->orig ) <= $nlead + $ntrail ) { + $block[] = $edit; + } else { + if ( $ntrail ) { + $context = array_slice( $edit->orig, 0, $ntrail ); + $block[] = new Text_Diff_Op_copy( $context ); + } + + $output .= $this->_block( $x0, $ntrail + $xi - $x0, $y0, $ntrail + $yi - $y0, $block ); + + $block = false; + } + } + $context = $edit->orig; + } else { + if ( ! is_array( $block ) ) { + $context = array_slice( $context, count( $context ) - $nlead ); + $x0 = $xi - count( $context ); + $y0 = $yi - count( $context ); + $block = []; + if ( $context ) { + $block[] = new Text_Diff_Op_copy( $context ); + } + } + $block[] = $edit; + } + + if ( $edit->orig ) { + $xi += count( $edit->orig ); + } + if ( $edit->final ) { + $yi += count( $edit->final ); + } + } + + if ( is_array( $block ) ) { + $output .= $this->_block( $x0, $xi - $x0, $y0, $yi - $y0, $block ); + } + + return $output . $this->_endDiff(); + } + + /** + * @param $xbeg + * @param $xlen + * @param $ybeg + * @param $ylen + * @param $edits + * + * @return string + */ + + public function _block( $xbeg, $xlen, $ybeg, $ylen, $edits ) { + $output = $this->_startBlock( $this->_blockHeader( $xbeg, $xlen, $ybeg, $ylen ) ); + + foreach ( $edits as $edit ) { + switch ( mb_strtolower( get_class( $edit ) ) ) { + case 'text_diff_op_copy': + $output .= $this->_context( $edit->orig ); + break; + case 'text_diff_op_add': + $output .= $this->_added( $edit->final ); + break; + case 'text_diff_op_delete': + $output .= $this->_deleted( $edit->orig ); + break; + case 'text_diff_op_change': + $output .= $this->_changed( $edit->orig, $edit->final ); + break; + } + } + + return $output . $this->_endBlock(); + } + + /** + * @return string + */ + + public function _startDiff() { + return ''; + } + + /** + * @return string + */ + + public function _endDiff() { + return ''; + } + + /** + * @param $xbeg + * @param $xlen + * @param $ybeg + * @param $ylen + * + * @return string + */ + + public function _blockHeader( $xbeg, $xlen, $ybeg, $ylen ) { + if ( $xlen > 1 ) { + $xbeg .= ',' . ( $xbeg + $xlen - 1 ); + } + if ( $ylen > 1 ) { + $ybeg .= ',' . ( $ybeg + $ylen - 1 ); + } + + return $xbeg . ( $xlen ? ( $ylen ? 'c' : 'd' ) : 'a' ) . $ybeg; + } + + /** + * @param $header + * + * @return string + */ + + public function _startBlock( $header ) { + return $header . "\n"; + } + + /** + * @return string + */ + + public function _endBlock() { + return ''; + } + + /** + * @param $lines + * @param string $prefix + * + * @return string + */ + + public function _lines( $lines, $prefix = ' ' ) { + return $prefix . implode( "\n$prefix", $lines ) . "\n"; + } + + /** + * @param $lines + * + * @return string + */ + + public function _context( $lines ) { + return $this->_lines( $lines ); + } + + /** + * @param $lines + * + * @return string + */ + + public function _added( $lines ) { + return $this->_lines( $lines, '>' ); + } + + /** + * @param $lines + * + * @return string + */ + + public function _deleted( $lines ) { + return $this->_lines( $lines, '<' ); + } + + /** + * @param $orig + * @param $final + * + * @return string + */ + + public function _changed( $orig, $final ) { + return $this->_deleted( $orig ) . "---\n" . $this->_added( $final ); + } } diff --git a/xoops_trust_path/libs/altsys/include/Text_Diff_Renderer_inline.php b/xoops_trust_path/libs/altsys/include/Text_Diff_Renderer_inline.php index 228a11a..1b402da 100644 --- a/xoops_trust_path/libs/altsys/include/Text_Diff_Renderer_inline.php +++ b/xoops_trust_path/libs/altsys/include/Text_Diff_Renderer_inline.php @@ -2,151 +2,232 @@ /** * "Inline" diff renderer. * - * This class renders diffs in the Wiki-style "inline" format. + * $Horde: framework/Text_Diff/Diff/Renderer/inline.php,v 1.4.10.16 2009/07/24 13:25:29 jan Exp $ + * + * Copyright 2004-2009 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you did + * not receive this file, see http://opensource.org/licenses/lgpl-license.php. + * + * @author Ciprian Popovici + * @package Text_Diff + */ + +/** Text_Diff_Renderer */ +if ( ! class_exists( 'Text_Diff_Renderer' ) ) { + require_once 'Text/Diff/Renderer.php'; +} + +/** + * "Inline" diff renderer. * - * $Horde: framework/Text_Diff/Diff/Renderer/inline.php,v 1.14 2005/07/22 19:45:15 chuck Exp $ + * This class renders diffs in the Wiki-style "inline" format. * * @author Ciprian Popovici * @package Text_Diff */ -class Text_Diff_Renderer_inline extends Text_Diff_Renderer -{ - - /** - * Number of leading context "lines" to preserve. - */ - public $_leading_context_lines = 10000; - - /** - * Number of trailing context "lines" to preserve. - */ - public $_trailing_context_lines = 10000; - - /** - * Prefix for inserted text. - */ - public $_ins_prefix = ''; - - /** - * Suffix for inserted text. - */ - public $_ins_suffix = ''; - - /** - * Prefix for deleted text. - */ - public $_del_prefix = ''; - - /** - * Suffix for deleted text. - */ - public $_del_suffix = ''; - - /** - * Header for each change block. - */ - public $_block_header = ''; - - /** - * What are we currently splitting on? Used to recurse to show word-level - * changes. - */ - public $_split_level = 'lines'; - - public function _blockHeader($xbeg, $xlen, $ybeg, $ylen) - { - return $this->_block_header; - } - - public function _startBlock($header) - { - return $header; - } - - public function _lines($lines, $prefix = ' ', $encode = true) - { - if ($encode) { - array_walk($lines, array(&$this, '_encode')); - } - - if ($this->_split_level == 'words') { - return implode('', $lines); - } else { - return implode("\n", $lines) . "\n"; - } - } - - public function _added($lines) - { - array_walk($lines, array(&$this, '_encode')); - $lines[0] = $this->_ins_prefix . $lines[0]; - $lines[count($lines) - 1] .= $this->_ins_suffix; - return $this->_lines($lines, ' ', false); - } - - public function _deleted($lines, $words = false) - { - array_walk($lines, array(&$this, '_encode')); - $lines[0] = $this->_del_prefix . $lines[0]; - $lines[count($lines) - 1] .= $this->_del_suffix; - return $this->_lines($lines, ' ', false); - } - - public function _changed($orig, $final) - { - /* If we've already split on words, don't try to do so again - just - * display. */ - if ($this->_split_level == 'words') { - $prefix = ''; - while ($orig[0] !== false && $final[0] !== false && - substr($orig[0], 0, 1) == ' ' && - substr($final[0], 0, 1) == ' ') { - $prefix .= substr($orig[0], 0, 1); - $orig[0] = substr($orig[0], 1); - $final[0] = substr($final[0], 1); - } - return $prefix . $this->_deleted($orig) . $this->_added($final); - } - - $text1 = implode("\n", $orig); - $text2 = implode("\n", $final); - - /* Non-printing newline marker. */ - $nl = "\0"; - - /* We want to split on word boundaries, but we need to - * preserve whitespace as well. Therefore we split on words, - * but include all blocks of whitespace in the wordlist. */ - $diff = new Text_Diff($this->_splitOnWords($text1, $nl), - $this->_splitOnWords($text2, $nl)); - - /* Get the diff in inline format. */ - $renderer = new Text_Diff_Renderer_inline(array_merge($this->getParams(), - array('split_level' => 'words'))); - - /* Run the diff and get the output. */ - return str_replace($nl, "\n", $renderer->render($diff)) . "\n"; - } - - public function _splitOnWords($string, $newlineEscape = "\n") - { - $words = array(); - $length = strlen($string); - $pos = 0; - - while ($pos < $length) { - // Eat a word with any preceding whitespace. - $spaces = strspn(substr($string, $pos), " \n"); - $nextpos = strcspn(substr($string, $pos + $spaces), " \n"); - $words[] = str_replace("\n", $newlineEscape, substr($string, $pos, $spaces + $nextpos)); - $pos += $spaces + $nextpos; - } - - return $words; - } - - public function _encode(&$string) - { - $string = htmlspecialchars($string); - } +class Text_Diff_Renderer_inline extends Text_Diff_Renderer { + /** + * Number of leading context "lines" to preserve. + */ + + public $_leading_context_lines = 10000; + + /** + * Number of trailing context "lines" to preserve. + */ + + public $_trailing_context_lines = 10000; + + /** + * Prefix for inserted text. + */ + + public $_ins_prefix = ''; + + /** + * Suffix for inserted text. + */ + + public $_ins_suffix = ''; + + /** + * Prefix for deleted text. + */ + + public $_del_prefix = ''; + + /** + * Suffix for deleted text. + */ + + public $_del_suffix = ''; + + /** + * Header for each change block. + */ + + public $_block_header = ''; + + /** + * What are we currently splitting on? Used to recurse to show word-level + * changes. + */ + + public $_split_level = 'lines'; + + /** + * @param $xbeg + * @param $xlen + * @param $ybeg + * @param $ylen + * + * @return string + */ + + public function _blockHeader( $xbeg, $xlen, $ybeg, $ylen ) { + return $this->_block_header; + } + + /** + * @param $header + * + * @return mixed + */ + + public function _startBlock( $header ) { + return $header; + } + + /** + * @param $lines + * @param string $prefix + * @param bool $encode + * + * @return string + */ + + public function _lines($lines, $prefix = ' ', bool $encode = true ) { + if ( $encode ) { + array_walk( $lines, [ &$this, '_encode' ] ); + } + + if ( 'words' == $this->_split_level ) { + return implode( '', $lines ); + } + + return implode( "\n", $lines ) . "\n"; + } + + /** + * @param $lines + * + * @return string + */ + + public function _added( $lines ) { + array_walk( $lines, [ &$this, '_encode' ] ); + + $lines[0] = $this->_ins_prefix . $lines[0]; + $lines[ count( $lines ) - 1 ] .= $this->_ins_suffix; + + return $this->_lines( $lines, ' ', false ); + } + + /** + * @param $lines + * @param bool $words + * + * @return string + */ + + public function _deleted( $lines, $words = false ) { + array_walk( $lines, [ &$this, '_encode' ] ); + + $lines[0] = $this->_del_prefix . $lines[0]; + $lines[ count( $lines ) - 1 ] .= $this->_del_suffix; + + return $this->_lines( $lines, ' ', false ); + } + + /** + * @param $orig + * @param $final + * + * @return string + */ + + public function _changed( $orig, $final ) { + /* If we've already split on words, don't try to do so again - just + * display. */ + if ( $this->_split_level == 'words' ) { + $prefix = ''; + + while ( false !== $orig[0] && false !== $final[0] + && ' ' == mb_substr( $orig[0], 0, 1 ) + && ' ' == mb_substr( $final[0], 0, 1 ) ) { + $prefix .= mb_substr( $orig[0], 0, 1 ); + + $orig[0] = mb_substr( $orig[0], 1 ); + + $final[0] = mb_substr( $final[0], 1 ); + } + + return $prefix . $this->_deleted( $orig ) . $this->_added( $final ); + } + + $text1 = implode( "\n", $orig ); + $text2 = implode( "\n", $final ); + + /* Non-printing newline marker. */ + $nl = "\0"; + + /* We want to split on word boundaries, but we need to + * preserve whitespace as well. Therefore we split on words, + * but include all blocks of whitespace in the wordlist. */ + + $diff = new Text_Diff( $this->_splitOnWords( $text1, $nl ), $this->_splitOnWords( $text2, $nl ) ); + + /* Get the diff in inline format. */ + + $renderer = new self( array_merge( $this->getParams(), [ 'split_level' => 'words' ] ) ); + + /* Run the diff and get the output. */ + + return str_replace( $nl, "\n", $renderer->render( $diff ) ) . "\n"; + } + + /** + * @param $string + * @param string $newlineEscape + * + * @return array + */ + + public function _splitOnWords($string, string $newlineEscape = "\n" ) { + $words = []; + + $length = mb_strlen( $string ); + + $pos = 0; + + while ( $pos < $length ) { + // Eat a word with any preceding whitespace. + + $spaces = strspn( mb_substr( $string, $pos ), " \n" ); + + $nextpos = strcspn( mb_substr( $string, $pos + $spaces ), " \n" ); + + $words[] = str_replace( "\n", $newlineEscape, mb_substr( $string, $pos, $spaces + $nextpos ) ); + + $pos += $spaces + $nextpos; + } + + return $words; + } + + public function _encode( &$string ) { + $string = htmlspecialchars( $string, ENT_QUOTES | ENT_HTML5 ); + } + } diff --git a/xoops_trust_path/libs/altsys/include/Text_Diff_Renderer_unified.php b/xoops_trust_path/libs/altsys/include/Text_Diff_Renderer_unified.php index cd8c8a4..1c04a4b 100644 --- a/xoops_trust_path/libs/altsys/include/Text_Diff_Renderer_unified.php +++ b/xoops_trust_path/libs/altsys/include/Text_Diff_Renderer_unified.php @@ -8,42 +8,66 @@ * * @package Text_Diff */ -class Text_Diff_Renderer_unified extends Text_Diff_Renderer -{ - - /** - * Number of leading context "lines" to preserve. - */ - public $_leading_context_lines = 4; - - /** - * Number of trailing context "lines" to preserve. - */ - public $_trailing_context_lines = 4; - - public function _blockHeader($xbeg, $xlen, $ybeg, $ylen) - { - if ($xlen != 1) { - $xbeg .= ',' . $xlen; - } - if ($ylen != 1) { - $ybeg .= ',' . $ylen; - } - return "@@ -$xbeg +$ybeg @@"; - } - - public function _added($lines) - { - return $this->_lines($lines, '+'); - } - - public function _deleted($lines) - { - return $this->_lines($lines, '-'); - } - - public function _changed($orig, $final) - { - return $this->_deleted($orig) . $this->_added($final); - } +class Text_Diff_Renderer_unified extends Text_Diff_Renderer { + + /** + * Number of leading context "lines" to preserve. + */ + public $_leading_context_lines = 4; + + /** + * Number of trailing context "lines" to preserve. + */ + public $_trailing_context_lines = 4; + + /** + * @param $xbeg + * @param $xlen + * @param $ybeg + * @param $ylen + * + * @return string + */ + + public function _blockHeader( $xbeg, $xlen, $ybeg, $ylen ) { + if ( 1 != $xlen ) { + $xbeg .= ',' . $xlen; + } + if ( 1 != $ylen ) { + $ybeg .= ',' . $ylen; + } + + return "@@ -$xbeg +$ybeg @@"; + } + + /** + * @param $lines + * + * @return string + */ + + public function _added( $lines ) { + return $this->_lines( $lines, '+' ); + } + + /** + * @param $lines + * + * @return string + */ + + public function _deleted( $lines ) { + return $this->_lines( $lines, '-' ); + } + + /** + * @param $orig + * @param $final + * + * @return string + */ + + public function _changed( $orig, $final ) { + return $this->_deleted( $orig ) . $this->_added( $final ); + } } diff --git a/xoops_trust_path/libs/altsys/include/admin_in_theme.inc.php b/xoops_trust_path/libs/altsys/include/admin_in_theme.inc.php index b5bd5e3..c70ac0a 100644 --- a/xoops_trust_path/libs/altsys/include/admin_in_theme.inc.php +++ b/xoops_trust_path/libs/altsys/include/admin_in_theme.inc.php @@ -1,30 +1,44 @@ ", $tmp_s, 2) ; - if (empty($tmp_s)) { - define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ; - return $s ; - } - - list($tmp_s, $tmp_after) = explode("", $tmp_s) ; - if (empty($tmp_after)) { - define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ; - return $s ; - } - - $xoops_admin_contents = $former_outputs . substr(strrev(strstr(strrev($tmp_s), strrev(''))), 0, -6) ; - - return '' ; +/** + * Altsys library (UI-Components) for D3 modules + * + * @package Altsys + * @version XCL 2.3.1 + * @author Other authors Gigamaster, 2020 XCL PHP7 + * @author Gijoe (Peak) + * @copyright (c) 2005-2022 Authors + * @license GPL v2.0 + */ + +function altsys_admin_in_theme( $s ) { + global $xoops_admin_contents; + + $xoops_admin_contents = ''; + + if ( defined( 'ALTSYS_DONT_USE_ADMIN_IN_THEME' ) ) { + return $s; + } + + // check whether cp_functions.php is loaded + if ( ! defined( 'XOOPS_CPFUNC_LOADED' ) ) { + define( 'ALTSYS_DONT_USE_ADMIN_IN_THEME', 1 ); + + return $s; + } + + //!Fix redirect + //strpos - Find the position of the first occurrence of a substring in a string + //mb_strstr - Finds first occurrence of a string within another + if (strpos($s, '", $tmp_s, 2 ); + if ( empty( $tmp_s ) ) { + define( 'ALTSYS_DONT_USE_ADMIN_IN_THEME', 1 ); + + return $s; + } + + [ $tmp_s, $tmp_after ] = explode( "
", $tmp_s ); + if ( empty( $tmp_after ) ) { + define( 'ALTSYS_DONT_USE_ADMIN_IN_THEME', 1 ); + + return $s; + } + + $xoops_admin_contents = $former_outputs . substr( strrev( strstr( strrev( $tmp_s ), strrev( '
' ) ) ), 0, - 6 ); + + return ''; } -function altsys_admin_in_theme_in_last($contents = null) -{ - global $xoops_admin_contents , $xoopsConfig , $xoopsModule , $xoopsUser , $xoopsUserIsAdmin , $xoopsLogger , $altsysModuleConfig , $altsysModuleId ; - - if (! isset($contents)) { - while (ob_get_level()) { - ob_end_flush() ; - } - } else { - $xoops_admin_contents = $contents ; - } - - if (! isset($xoops_admin_contents)) { - return ; - } - if (defined('ALTSYS_DONT_USE_ADMIN_IN_THEME')) { - return ; - } - - if (! is_object($xoopsUser)) { - exit ; - } - - // language files - if (file_exists(dirname(dirname(__FILE__)).'/language/'.$xoopsConfig['language'].'/admin_in_theme.php')) { - include_once dirname(dirname(__FILE__)).'/language/'.$xoopsConfig['language'].'/admin_in_theme.php' ; - } else { - include_once dirname(dirname(__FILE__)).'/language/english/admin_in_theme.php' ; - } - - // set the theme - $xoopsConfig['theme_set'] = $altsysModuleConfig['admin_in_theme'] ; - - // language files under the theme - $original_error_level = error_reporting() ; - error_reporting($original_error_level & ~ E_NOTICE) ; - if (file_exists(XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/'.$xoopsConfig['language'].'.php')) { - include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/'.$xoopsConfig['language'].'.php' ; - } elseif (file_exists(XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/english.php')) { - include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/english.php' ; - } - error_reporting($original_error_level) ; - - include dirname(__FILE__).'/admin_in_theme_header.inc.php' ; - -/* // include adminmenu - include XOOPS_CACHE_PATH.'/adminmenu.php' ; - - // admin permissions - $moduleperm_handler =& xoops_gethandler('groupperm'); - $admin_mids = $moduleperm_handler->getItemIds('module_admin', $xoopsUser->getGroups()); - $module_handler =& xoops_gethandler('module'); - $modules = $module_handler->getObjects(new Criteria('mid', "(".implode(',', $admin_mids).")", 'IN'), true); - $admin_mids = array_keys($modules); - - // menu items &= admin permissions - $xoops_admin_menu_ft = array_flip( array_intersect( array_flip( $xoops_admin_menu_ft ) , $admin_mids ) ) ; - $xoops_admin_menu_ml = array_flip( array_intersect( array_flip( $xoops_admin_menu_ml ) , $admin_mids ) ) ; - $xoops_admin_menu_sd = array_flip( array_intersect( array_flip( $xoops_admin_menu_sd ) , $admin_mids ) ) ; - - // adminmenu as a block - $admin_menu_block_contents = '
'.implode( "\n" , $xoops_admin_menu_ft ).'
' ; - $admin_menu_block = array( array( - 'title' => 'Admin Menu' , - 'content' => $admin_menu_block_contents , - 'weight' => 0 , - ) ) ; - $lblocks = $xoopsTpl->get_template_vars( 'xoops_lblocks' ) ; - if( ! is_array( $lblocks ) ) $lblocks = array() ; - $xoopsTpl->assign( 'xoops_lblocks' , array_merge( $admin_menu_block , $lblocks ) ) ; - - // javascripts - $xoops_admin_menu_js .= ' - var thresholdY = 15; - var ordinata_margin = 20; - function moveLayers() {'.implode("\n",$xoops_admin_menu_ml).'} - function shutdown() {'.implode("\n",$xoops_admin_menu_sd).'}' ; */ - - // appendix (core specific css etc) - $xoops_module_header = '' ; - if (altsys_get_core_type() == ALTSYS_CORE_TYPE_XCL21) { - $xoops_module_header .= ''."\n" ; - if (is_object(@$xoopsModule)) { - $xoops_module_header .= ''."\n" ; - } - } - - // assignment - $xoopsTpl->assign(array( - 'xoops_theme' => $xoopsConfig['theme_set'], - 'xoops_imageurl' => XOOPS_THEME_URL.'/'.$xoopsConfig['theme_set'].'/', - 'xoops_themecss'=> xoops_getcss($xoopsConfig['theme_set']), - 'xoops_requesturi' => htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES), - 'xoops_sitename' => htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES), - 'xoops_showlblock' => 1, -// 'xoops_js' => '//--> + + ' . sprintf( $this->messages['fmt_prompt4repost'], $this->getErrors() ) . $table . $form . ''; } -// end of class - } -// create a instance in global scope -$GLOBALS['xoopsGTicket'] = new XoopsGTicket() ; -} + /** + * @param $key_name + * @param $tmp_array + * + * @return array + */ -if (! function_exists('admin_refcheck')) { + public function extract_post_recursive( $key_name, $tmp_array ) { + $table = ''; -//Admin Referer Check By Marijuana(Rev.011) -function admin_refcheck($chkref = "") -{ - if (empty($_SERVER['HTTP_REFERER'])) { - return true ; - } else { - $ref = $_SERVER['HTTP_REFERER']; - } - $cr = XOOPS_URL; - if ($chkref != "") { - $cr .= $chkref; - } - if (strpos($ref, $cr) !== 0) { - return false; - } - return true; + $form = ''; + + foreach ( $tmp_array as $key => $val ) { + if ( function_exists( 'get_magic_quotes_gpc' ) && @get_magic_quotes_gpc() ) { + $key = stripslashes( $key ); + } + + if ( is_array( $val ) ) { + + [ + $tmp_table, + $tmp_form + ] = $this->extract_post_recursive( $key_name . '[' . htmlspecialchars( $key, ENT_QUOTES ) . ']', $val ); + + $table .= $tmp_table; + + $form .= $tmp_form; + } else { + if ( function_exists( 'get_magic_quotes_gpc' ) && @get_magic_quotes_gpc() ) { + $val = stripslashes( $val ); + } + + $table .= '' . $key_name . '[' . htmlspecialchars( $key, ENT_QUOTES ) . ']' . htmlspecialchars( $val, ENT_QUOTES ) . '' . "\n"; + + $form .= '' . "\n"; + } + } + + return [ $table, $form ]; + } + + // clear all stubs + + public function clear() { + $_SESSION['XOOPS_G_STUBS'] = []; + } + + // Ticket Using + + /** + * @return bool + */ + + public function using() { + if ( ! empty( $_SESSION['XOOPS_G_STUBS'] ) ) { + return true; + } + + return false; + } + + // return errors + + /** + * @param bool $ashtml + * + * @return array|string + */ + + public function getErrors(bool $ashtml = true ) { + if ( $ashtml ) { + $ret = ''; + + foreach ( $this->_errors as $msg ) { + $ret .= "$msg
\n"; + } + } else { + $ret = $this->_errors; + } + + return $ret; + } + + /** + * @param $errNo + * @param $errStr + * @param $errFile + * @param $errLine + */ + + public function errorHandler4FindOutput( $errNo, $errStr, $errFile, $errLine ) { + if ( preg_match( '?' . preg_quote( XOOPS_ROOT_PATH ) . '([^:]+)\:(\d+)?', $errStr, $regs ) ) { + echo 'Irregular output! check the file ' . htmlspecialchars( $regs[1], ENT_QUOTES | ENT_HTML5 ) . ' line ' . htmlspecialchars( $regs[2], ENT_QUOTES | ENT_HTML5 ); + } else { + echo 'Irregular output! check language files etc.'; + } + } + + // end of class + } + + // create a instance in global scope + + $GLOBALS['xoopsGTicket'] = new XoopsGTicket(); } + +//Admin Referer Check By Marijuana(Rev.011) +if ( ! function_exists( 'admin_refcheck' ) ) { + + /** + * @param string $chkref + * + * @return bool + */ + + function admin_refcheck(string $chkref = '' ) { + if ( empty( $_SERVER['HTTP_REFERER'] ) ) { + return true; + } + + $ref = $_SERVER['HTTP_REFERER']; + + $cr = XOOPS_URL; + + if ( '' != $chkref ) { + $cr .= $chkref; + } + + if ( 0 !== mb_strpos( $ref, $cr ) ) { + return false; + } + + return true; + } } diff --git a/xoops_trust_path/libs/altsys/include/index.php b/xoops_trust_path/libs/altsys/include/index.php new file mode 100644 index 0000000..6a50543 --- /dev/null +++ b/xoops_trust_path/libs/altsys/include/index.php @@ -0,0 +1,2 @@ + $name) { - $constants[ $name ] = $matches[4][$i] ; - } + $file_contents = file_get_contents( $langfile_path ); - return $constants ; + preg_match_all( '/\n\s*define\(\s*(["\'])([0-9a-zA-Z_]+)\\1\s*\,\s*(["\'])([^\\3]+)\\3/iU', $file_contents, $matches ); + + $constants = []; + + foreach ( $matches[2] as $i => $name ) { + $constants[ $name ] = $matches[4][ $i ]; + } + + return $constants; } +/** + * @param $target_mname + * @param $message4disp + */ +function altsys_mylangadmin_errordie( $target_mname, $message4disp ) { + + xoops_cp_header(); + + altsys_include_mymenu(); + + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); + + $breadcrumbsObj->appendPath( XOOPS_URL . '/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mylangadmin', _MI_ALTSYS_MENU_MYLANGADMIN ); + + $breadcrumbsObj->appendPath( '', $target_mname ); + + echo '
altsys/include/lang_functions.php
'; + echo '

' . _MYLANGADMIN_H3_MODULE . ' » ' . $target_mname . '

'; + echo '

' . $message4disp . '

'; -function altsys_mylangadmin_errordie($target_mname, $message4disp) -{ - xoops_cp_header() ; - altsys_include_mymenu() ; - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mylangadmin', _MI_ALTSYS_MENU_MYLANGADMIN) ; - $breadcrumbsObj->appendPath('', $target_mname) ; - echo '

' . _MYLANGADMIN_H3_MODULE . ' : ' . $target_mname . '

' ; - echo '

'.$message4disp.'

' ; - xoops_cp_footer() ; - exit ; + xoops_cp_footer(); + exit; } diff --git a/xoops_trust_path/libs/altsys/include/mygroupperm.php b/xoops_trust_path/libs/altsys/include/mygroupperm.php index 1d6682e..dbd7c3c 100644 --- a/xoops_trust_path/libs/altsys/include/mygroupperm.php +++ b/xoops_trust_path/libs/altsys/include/mygroupperm.php @@ -1,117 +1,135 @@ add(new Criteria('gperm_name', $gperm_name)); - if (isset($gperm_itemid)) { - $criteria->add(new Criteria('gperm_itemid', intval($gperm_itemid))); - } - } - $sql = "DELETE FROM ".$DB->prefix('group_permission').' '.$criteria->renderWhere(); - if (!$result = $DB->query($sql)) { - return false; - } - return true; -} +/** + * @param $DB + * @param $gperm_modid + * @param null $gperm_name + * @param null $gperm_itemid + * + * @return bool + */ +function myDeleteByModule( $DB, $gperm_modid, $gperm_name = null, $gperm_itemid = null ) { + $criteria = new CriteriaCompo( new Criteria( 'gperm_modid', (int) $gperm_modid ) ); + + if ( isset( $gperm_name ) ) { + $criteria->add( new Criteria( 'gperm_name', $gperm_name ) ); + + if ( isset( $gperm_itemid ) ) { + $criteria->add( new Criteria( 'gperm_itemid', (int) $gperm_itemid ) ); + } + } + $sql = 'DELETE FROM ' . $DB->prefix( 'group_permission' ) . ' ' . $criteria->renderWhere(); + + if ( ! $result = $DB->query( $sql ) ) { + return false; + } + + return true; +} // include '../../../include/cp_header.php'; GIJ -$modid = isset($_POST['modid']) ? intval($_POST['modid']) : 1; - -if ($modid == 1) { - // check by the permission of eather 'altsys' or 'system' - $module_handler =& xoops_gethandler('module') ; - $module =& $module_handler->getByDirname('altsys') ; - if (! is_object($module)) { - $module =& $module_handler->getByDirname('system') ; - if (! is_object($module)) { - die('there is no altsys nor system.') ; - } - } - $moduleperm_handler =& xoops_gethandler('groupperm') ; - if (! is_object(@$GLOBALS['xoopsUser']) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) { - die('only admin of altsys can access this area') ; - } +$modid = isset( $_POST['modid'] ) ? (int) $_POST['modid'] : 1; + +if ( 1 == $modid ) { + // check by the permission of eather 'altsys' or 'system' + $module_handler = xoops_gethandler( 'module' ); + + $module =& $module_handler->getByDirname( 'altsys' ); + + if ( ! is_object( $module ) ) { + $module = $module_handler->getByDirname( 'system' ); + if ( ! is_object( $module ) ) { + + die( 'there is no UI Components nor base system.' ); + } + } + + $moduleperm_handler = xoops_gethandler( 'groupperm' ); + if ( ! is_object( @$GLOBALS['xoopsUser'] ) || ! $moduleperm_handler->checkRight( 'module_admin', $module->getVar( 'mid' ), $GLOBALS['xoopsUser']->getGroups() ) ) { + die( 'only admin of UI Components can access this area' ); + } } else { - // check the permission of 'module_admin' of the module - if ($modid <= 0 || !is_object($GLOBALS['xoopsUser']) || !$GLOBALS['xoopsUser']->isAdmin($modid)) { - die(_NOPERM) ; - } - $module_handler =& xoops_gethandler('module'); - $module =& $module_handler->get($modid); - if (!is_object($module) || !$module->getVar('isactive')) { - die(_MODULENOEXIST) ; - } -} + // check the permission of 'module_admin' of the module + if ( $modid <= 0 || ! is_object( $GLOBALS['xoopsUser'] ) || ! $GLOBALS['xoopsUser']->isAdmin( $modid ) ) { + die( _NOPERM ); + } + $module_handler = xoops_gethandler( 'module' ); -$member_handler =& xoops_gethandler('member'); -$group_list = $member_handler->getGroupList(); -if (!empty($_POST['perms']) && is_array($_POST['perms'])) { - if (!isset($msg) || !is_array($msg)) { - $msg = isset($msg)? array($msg) : array(); - } - $gperm_handler = xoops_gethandler('groupperm'); - foreach ($_POST['perms'] as $perm_name => $perm_data) { - foreach ($perm_data['itemname' ] as $item_id => $item_name) { - // checking code - // echo "
" ;
-            // var_dump( $_POST['perms'] ) ;
-            // exit ;
-            if (false != myDeleteByModule($gperm_handler->db, $modid, $perm_name, $item_id)) {
-                if (empty($perm_data['groups'])) {
-                    continue ;
-                }
-                foreach ($perm_data['groups'] as $group_id => $item_ids) {
-                    //				foreach ($item_ids as $item_id => $selected) {
-                    $selected = isset($item_ids[ $item_id ]) ? $item_ids[ $item_id ] : 0 ;
-                    if ($selected == 1) {
-                        // make sure that all parent ids are selected as well
-                        if ($perm_data['parents'][$item_id] != '') {
-                            $parent_ids = explode(':', $perm_data['parents'][$item_id]);
-                            foreach ($parent_ids as $pid) {
-                                if ($pid != 0 && !in_array($pid, array_keys($item_ids))) {
-                                    // one of the parent items were not selected, so skip this item
-                                    $msg[] = sprintf(_MD_A_MYBLOCKSADMIN_PERMADDNG, ''.$perm_name.'', ''.$perm_data['itemname'][$item_id].'', ''.$group_list[$group_id].'').' ('._MD_A_MYBLOCKSADMIN_PERMADDNGP.')';
-                                    continue 2;
-                                }
-                            }
-                        }
-                        $gperm =& $gperm_handler->create();
-                        $gperm->setVar('gperm_groupid', $group_id);
-                        $gperm->setVar('gperm_name', $perm_name);
-                        $gperm->setVar('gperm_modid', $modid);
-                        $gperm->setVar('gperm_itemid', $item_id);
-                        if (!$gperm_handler->insert($gperm)) {
-                            $msg[] = sprintf(_MD_A_MYBLOCKSADMIN_PERMADDNG, ''.$perm_name.'', ''.$perm_data['itemname'][$item_id].'', ''.$group_list[$group_id].'');
-                        } else {
-                            $msg[] = sprintf(_MD_A_MYBLOCKSADMIN_PERMADDOK, ''.$perm_name.'', ''.$perm_data['itemname'][$item_id].'', ''.$group_list[$group_id].'');
-                        }
-                        unset($gperm);
-                    }
-                }
-            } else {
-                $msg[] = sprintf(_MD_A_MYBLOCKSADMIN_PERMRESETNG, $module->getVar('name'));
-            }
-        }
-    }
+	$module = $module_handler->get( $modid );
+	if ( ! is_object( $module ) || ! $module->getVar( 'isactive' ) ) {
+		die( _MODULENOEXIST );
+	}
 }
-/*
-$backlink = XOOPS_URL.'/admin.php';
-if ($module->getVar('hasadmin')) {
-    $adminindex = $module->getInfo('adminindex');
-    if ($adminindex) {
-        $backlink = XOOPS_URL.'/modules/'.$module->getVar('dirname').'/'.$adminindex;
-    }
+
+$member_handler = xoops_gethandler( 'member' );
+$group_list     = $member_handler->getGroupList();
+if ( ! empty( $_POST['perms'] ) && is_array( $_POST['perms'] ) ) {
+
+	if ( ! isset( $msg ) || ! is_array( $msg ) ) {
+		$msg = isset( $msg ) ? [ $msg ] : [];
+	}
+	$gperm_handler = xoops_gethandler( 'groupperm' );
+
+	foreach ( $_POST['perms'] as $perm_name => $perm_data ) {
+
+		foreach ( $perm_data['itemname'] as $item_id => $item_name ) {
+			// checking code
+			// echo "
" ;
+			// var_dump( $_POST['perms'] ) ;
+			// exit ;
+			if ( false != myDeleteByModule( $gperm_handler->db, $modid, $perm_name, $item_id ) ) {
+				if ( empty( $perm_data['groups'] ) ) {
+					continue;
+				}
+				foreach ( $perm_data['groups'] as $group_id => $item_ids ) {
+					//				foreach ($item_ids as $item_id => $selected) {
+					$selected = isset( $item_ids[ $item_id ] ) ? $item_ids[ $item_id ] : 0;
+					if ( 1 == $selected ) {
+						// make sure that all parent ids are selected as well
+						if ( '' != $perm_data['parents'][ $item_id ] ) {
+							$parent_ids = explode( ':', $perm_data['parents'][ $item_id ] );
+							foreach ( $parent_ids as $pid ) {
+								if ( 0 != $pid && ! in_array( $pid, array_keys( $item_ids ) ) ) {
+									// one of the parent items were not selected, so skip this item
+									$msg[] = sprintf( _MD_A_MYBLOCKSADMIN_PERMADDNG, '' . $perm_name . '', '' . $perm_data['itemname'][ $item_id ] . '', '' . $group_list[ $group_id ] . '' ) . ' (' . _MD_A_MYBLOCKSADMIN_PERMADDNGP . ')';
+									continue 2;
+								}
+							}
+						}
+						$gperm = $gperm_handler->create();
+						$gperm->setVar( 'gperm_groupid', $group_id );
+						$gperm->setVar( 'gperm_name', $perm_name );
+						$gperm->setVar( 'gperm_modid', $modid );
+						$gperm->setVar( 'gperm_itemid', $item_id );
+
+						if ( ! $gperm_handler->insert( $gperm ) ) {
+							$msg[] = sprintf( _MD_A_MYBLOCKSADMIN_PERMADDNG, '' . $perm_name . '', '' . $perm_data['itemname'][ $item_id ] . '', '' . $group_list[ $group_id ] . '' );
+						} else {
+							$msg[] = sprintf( _MD_A_MYBLOCKSADMIN_PERMADDOK, '' . $perm_name . '', '' . $perm_data['itemname'][ $item_id ] . '', '' . $group_list[ $group_id ] . '' );
+						}
+						unset( $gperm );
+					}
+				}
+			} else {
+				$msg[] = sprintf( _MD_A_MYBLOCKSADMIN_PERMRESETNG, $module->getVar( 'name' ) );
+			}
+		}
+	}
 }
 
-$msg[] = '

'._BACK.''; -xoops_cp_header(); -xoops_result($msg); -xoops_cp_footer(); GIJ */; diff --git a/xoops_trust_path/libs/altsys/include/mygrouppermform.php b/xoops_trust_path/libs/altsys/include/mygrouppermform.php index a09c9ad..f529530 100644 --- a/xoops_trust_path/libs/altsys/include/mygrouppermform.php +++ b/xoops_trust_path/libs/altsys/include/mygrouppermform.php @@ -1,389 +1,410 @@ // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// You may not change or alter any portion of this comment or credits // -// of supporting developers from this source code or any supporting // -// source code which is considered copyrighted (c) material of the // -// original comment or credit authors. // -// // -// This program is distributed in the hope that it will be useful, // -// but WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // -// Author: Kazumi Ono (AKA onokazu) // -// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // -// Project: The XOOPS Project // -// ------------------------------------------------------------------------- // - -if (! defined('XOOPS_ROOT_PATH')) { - exit ; -} - -require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelement.php'; -require_once XOOPS_ROOT_PATH.'/class/xoopsform/formhidden.php'; -require_once XOOPS_ROOT_PATH.'/class/xoopsform/formbutton.php'; -require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelementtray.php'; -require_once XOOPS_ROOT_PATH.'/class/xoopsform/form.php'; - /** + * Altsys library (UI-Components) for D3 modules * Renders a form for setting module specific group permissions - * - * @author Kazumi Ono - * @copyright copyright (c) 2000-2003 XOOPS.org - * - * @package kernel - * @subpackage form + * @package Altsys + * @version XCL 2.3.1 + * @author Other authors gigamaster, 2020 XCL/PHP7 + * @author Gijoe (Peak) + * @copyright (c) 2005-2022 Authors + * @license GPL v2.0 */ -class MyXoopsGroupPermForm extends XoopsForm -{ - - /** - * Module ID - * @var int - */ - public $_modid; - /** - * Tree structure of items - * @var array - */ - public $_itemTree = array() ; - /** - * Name of permission - * @var string - */ - public $_permName; - /** - * Description of permission - * @var string - */ - public $_permDesc; - /** - * Appendix - * @var array ('permname'=>,'itemid'=>,'itemname'=>,'selected'=>) - */ - public $_appendix = array() ; - - /** - * Constructor - */ -//HACK by domifara -// public function MyXoopsGroupPermForm($title, $modid, $permname, $permdesc) - public function __construct($title, $modid, $permname, $permdesc) - { - // $this->XoopsForm($title, 'groupperm_form', XOOPS_URL.'/modules/system/admin/groupperm.php', 'post'); GIJ - $this->XoopsForm($title, 'groupperm_form', '', 'post'); - $this->_modid = intval($modid); - $this->_permName = $permname; - $this->_permDesc = $permdesc; - $this->addElement(new XoopsFormHidden('modid', $this->_modid)); - } - - /** - * Adds an item to which permission will be assigned - * - * @param string $itemName - * @param int $itemId - * @param int $itemParent - * @access public - */ - public function addItem($itemId, $itemName, $itemParent = 0) - { - $this->_itemTree[$itemParent]['children'][] = $itemId; - $this->_itemTree[$itemId]['parent'] = $itemParent; - $this->_itemTree[$itemId]['name'] = $itemName; - $this->_itemTree[$itemId]['id'] = $itemId; - } - - /** - * Add appendix - * - * @access public - */ - public function addAppendix($permName, $itemId, $itemName) - { - $this->_appendix[] = array('permname'=>$permName,'itemid'=>$itemId,'itemname'=>$itemName,'selected'=>false); - } - - /** - * Loads all child ids for an item to be used in javascript - * - * @param int $itemId - * @param array $childIds - * @access private - */ - public function _loadAllChildItemIds($itemId, &$childIds) - { - if (!empty($this->_itemTree[$itemId]['children'])) { - $first_child = $this->_itemTree[$itemId]['children']; - foreach ($first_child as $fcid) { - array_push($childIds, $fcid); - if (!empty($this->_itemTree[$fcid]['children'])) { - foreach ($this->_itemTree[$fcid]['children'] as $_fcid) { - array_push($childIds, $_fcid); - $this->_loadAllChildItemIds($_fcid, $childIds); - } - } - } - } - } - - /** - * Renders the form - * - * @return string - * @access public - */ - public function render() - { - global $xoopsGTicket ; - - // load all child ids for javascript codes - foreach (array_keys($this->_itemTree) as $item_id) { - $this->_itemTree[$item_id]['allchild'] = array(); - $this->_loadAllChildItemIds($item_id, $this->_itemTree[$item_id]['allchild']); - } - $gperm_handler =& xoops_gethandler('groupperm'); - $member_handler =& xoops_gethandler('member'); - $glist = $member_handler->getGroupList(); - foreach (array_keys($glist) as $i) { - // get selected item id(s) for each group - $selected = $gperm_handler->getItemIds($this->_permName, $i, $this->_modid); - $ele = new MyXoopsGroupFormCheckBox($glist[$i], 'perms['.$this->_permName.']', $i, $selected); - $ele->setOptionTree($this->_itemTree); - - // GIJ start - $ele->setDescription('') ; - // GIJ_end - - foreach ($this->_appendix as $key => $append) { - $this->_appendix[$key]['selected'] = $gperm_handler->checkRight($append['permname'], $append['itemid'], $i, $this->_modid) ; - } - $ele->setAppendix($this->_appendix); - $this->addElement($ele); - unset($ele); - } - - // GIJ start - $jstray = new XoopsFormElementTray('   '); - $jsuncheckbutton = new XoopsFormButton('', 'none', _NONE, 'button'); - $jsuncheckbutton->setExtra("onclick=\"with(document.groupperm_form){for(i=0;isetExtra("onclick=\"with(document.groupperm_form){for(i=0;i=0)){elements[i].checked=true;}}}\"") ; - $jstray->addElement($jsuncheckbutton) ; - $jstray->addElement($jscheckbutton) ; - $this->addElement($jstray); - // GIJ end - - $tray = new XoopsFormElementTray(''); - $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); - $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); - $this->addElement($tray); - - $ret = '

'.$this->getTitle().'

'.$this->_permDesc.'
'; - $ret .= "
getExtra().">\n\n"; - $elements =& $this->getElements(); - foreach (array_keys($elements) as $i) { - if (!is_object($elements[$i])) { - $ret .= $elements[$i]; - } elseif (!$elements[$i]->isHidden()) { - // group name - $ret .= "\n\n"; - } else { - $ret .= $elements[$i]->render(); - } - } - $ret .= "
".$elements[$i]->getCaption(); - // group description - if ($elements[$i]->getDescription() != '') { - $ret .= '

'.$elements[$i]->getDescription().''; - } - $ret .= "
\n".$elements[$i]->render()."\n
".$xoopsGTicket->getTicketHtml(__LINE__, 1800, 'myblocksadmin')."
"; - return $ret; - } + +if ( ! defined( 'XOOPS_ROOT_PATH' ) ) { + exit; +} + +require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelement.php'; +require_once XOOPS_ROOT_PATH . '/class/xoopsform/formhidden.php'; +require_once XOOPS_ROOT_PATH . '/class/xoopsform/formbutton.php'; +require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelementtray.php'; +require_once XOOPS_ROOT_PATH . '/class/xoopsform/form.php'; + +class MyXoopsGroupPermForm extends XoopsForm { + + /** + * Module ID + * @var int + */ + public $_modid; + /** + * Tree structure of items + * @var array + */ + public $_itemTree = []; + /** + * Name of permission + * @var string + */ + public $_permName; + /** + * Description of permission + * @var string + */ + public $_permDesc; + /** + * Appendix + * @var array ('permname'=>,'itemid'=>,'itemname'=>,'selected'=>) + */ + public $_appendix = []; + + /** + * Constructor + * + * @param string $title + * @param string $modid + * @param string $permname + * @param string $permdesc + */ + //HACK by domifara + public function __construct( $title, $modid, $permname, $permdesc ) { + parent::__construct( $title, 'groupperm_form', '', 'post' ); + + $this->_modid = (int) $modid; + $this->_permName = $permname; + $this->_permDesc = $permdesc; + + $instance = new XoopsFormHidden( 'modid', $this->_modid ); + + $this->addElement( $instance ); + + //$this->addElement(new XoopsFormHidden('modid', $this->_modid)); + } + + /** + * Adds an item to which permission will be assigned + * + * @param string $itemName + * @param int $itemId + * @param int $itemParent + * + * @access public + */ + public function addItem( $itemId, $itemName, $itemParent = 0 ) { + $this->_itemTree[ $itemParent ]['children'][] = $itemId; + $this->_itemTree[ $itemId ]['parent'] = $itemParent; + $this->_itemTree[ $itemId ]['name'] = $itemName; + $this->_itemTree[ $itemId ]['id'] = $itemId; + } + + /** + * Add appendix + * + * @access public + * + * @param $permName + * @param $itemId + * @param $itemName + */ + public function addAppendix( $permName, $itemId, $itemName ) { + $this->_appendix[] = [ + 'permname' => $permName, + 'itemid' => $itemId, + 'itemname' => $itemName, + 'selected' => false + ]; + } + + /** + * Loads all child ids for an item to be used in javascript + * + * @param int $itemId + * @param array $childIds + * + * @access private + */ + public function _loadAllChildItemIds( $itemId, &$childIds ) { + if ( ! empty( $this->_itemTree[ $itemId ]['children'] ) ) { + $first_child = $this->_itemTree[ $itemId ]['children']; + foreach ( $first_child as $fcid ) { + $childIds[] = $fcid; + if ( ! empty( $this->_itemTree[ $fcid ]['children'] ) ) { + foreach ( $this->_itemTree[ $fcid ]['children'] as $_fcid ) { + $childIds[] = $_fcid; + $this->_loadAllChildItemIds( $_fcid, $childIds ); + } + } + } + } + } + + /** + * Render the form + * + * @return string + * @access public + */ + public function render() { + global $xoopsGTicket; + + // load all child ids for javascript codes + foreach ( array_keys( $this->_itemTree ) as $item_id ) { + $this->_itemTree[ $item_id ]['allchild'] = []; + $this->_loadAllChildItemIds( $item_id, $this->_itemTree[ $item_id ]['allchild'] ); + } + $gperm_handler = xoops_gethandler( 'groupperm' ); + + $member_handler = xoops_gethandler( 'member' ); + $glist = $member_handler->getGroupList(); + + foreach ( array_keys( $glist ) as $i ) { + // get selected item id(s) for each group + $selected = $gperm_handler->getItemIds( $this->_permName, $i, $this->_modid ); + $ele = new MyXoopsGroupFormCheckBox( $glist[ $i ], 'perms[' . $this->_permName . ']', $i, $selected ); + $ele->setOptionTree( $this->_itemTree ); + + // GIJ start + $ele->setDescription( '' ); + // GIJ_end + + foreach ( $this->_appendix as $key => $append ) { + $this->_appendix[ $key ]['selected'] = $gperm_handler->checkRight( $append['permname'], $append['itemid'], $i, $this->_modid ); + } + $ele->setAppendix( $this->_appendix ); + $this->addElement( $ele ); + unset( $ele ); + } + + // GIJ start + $jstray = new XoopsFormElementTray( '   ' ); + $jsuncheckbutton = new XoopsFormButton( '', 'none', _NONE, 'button' ); + $jsuncheckbutton->setExtra( "onclick=\"with(document.groupperm_form){for(i=0;isetExtra( "onclick=\"with(document.groupperm_form){for(i=0;i=0)){elements[i].checked=true;}}}\"" ); + $jstray->addElement( $jsuncheckbutton ); + $jstray->addElement( $jscheckbutton ); + $this->addElement( $jstray ); + // GIJ end + + $tray = new XoopsFormElementTray( '' ); + $buttonReset = new XoopsFormButton( '', 'reset', _CANCEL, 'reset' ); + $tray->addElement( $buttonReset ); + + $buttonSubmit = new XoopsFormButton( '', 'submit', _SUBMIT, 'submit' ); + $tray->addElement( $buttonSubmit ); + + $this->addElement( $tray ); + + $ret = '
'; + $ret .= '

' . $this->getTitle() . '

'; + $ret .= $this->_permDesc . '
'; + $ret .= "
getExtra() . ">\n"; + $ret .= "\n"; + + $elements = &$this->getElements(); + foreach ( array_keys( $elements ) as $i ) { + if ( ! is_object( $elements[ $i ] ) ) { + $ret .= $elements[ $i ]; + } elseif ( ! $elements[ $i ]->isHidden() ) { + // group name + $ret .= "\n\n"; + } else { + $ret .= $elements[ $i ]->render(); + } + } + $ret .= '
" . $elements[ $i ]->getCaption() . ''; + // group description + if ( '' != $elements[ $i ]->getDescription() ) { + $ret .= '
' . $elements[ $i ]->getDescription(); + } + $ret .= "
\n" . $elements[ $i ]->render() . "\n
' . $xoopsGTicket->getTicketHtml( __LINE__, 1800, 'myblocksadmin' ) . '
'; + + return $ret; + } } + /** * Renders checkbox options for a group permission form * - * @author Kazumi Ono - * @copyright copyright (c) 2000-2003 XOOPS.org + * @author Kazumi Ono + * @copyright copyright (c) 2000-2003 XOOPS.org * * @package kernel * @subpackage form */ -class MyXoopsGroupFormCheckBox extends XoopsFormElement -{ - - /** - * Pre-selected value(s) - * @var array; - */ - public $_value; - /** - * Group ID - * @var int - */ - public $_groupId; - /** - * Option tree - * @var array - */ - public $_optionTree; - /** - * Appendix - * @var array ('permname'=>,'itemid'=>,'itemname'=>,'selected'=>) - */ - public $_appendix = array() ; - - /** - * Constructor - */ - public function MyXoopsGroupFormCheckBox($caption, $name, $groupId, $values = null) - { - $this->setCaption($caption); - $this->setName($name); - if (isset($values)) { - $this->setValue($values); - } - $this->_groupId = $groupId; - } - - /** - * Sets pre-selected values - * - * @param mixed $value A group ID or an array of group IDs - * @access public - */ - public function setValue($value) - { - if (is_array($value)) { - foreach ($value as $v) { - $this->setValue($v); - } - } else { - $this->_value[] = $value; - } - } - - /** - * Sets the tree structure of items - * - * @param array $optionTree - * @access public - */ - public function setOptionTree(&$optionTree) - { - $this->_optionTree =& $optionTree; - } - - /** - * Sets appendix of checkboxes - * - * @access public - */ - public function setAppendix($appendix) - { - $this->_appendix = $appendix ; - } - - /** - * Renders checkbox options for this group - * - * @return string - * @access public - */ - public function render() - { - $ret = '' ; - - if (sizeof($this->_appendix) > 0) { - $ret .= ''; - $cols = 1; - foreach ($this->_appendix as $append) { - if ($cols > 4) { - $ret .= ''; - $cols = 1; - } - $checked = $append['selected'] ? 'checked="checked"' : '' ; - $name = 'perms['.$append['permname'].']' ; - $itemid = $append['itemid'] ; - $itemid = $append['itemid'] ; - $ret .= "" ; - $cols++; - } - $ret .= '
_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked />{$append['itemname']}
'; - } - - $ret .= ''; - $cols = 1; - if (! empty($this->_optionTree[0]['children'])) { - foreach ($this->_optionTree[0]['children'] as $topitem) { - if ($cols > 4) { - $ret .= ''; - $cols = 1; - } - $tree = ''; - $cols++; - } - } - $ret .= '
'; - $prefix = ''; - $this->_renderOptionTree($tree, $this->_optionTree[$topitem], $prefix); - $ret .= $tree.'
'; - return $ret; - } - - /** - * Renders checkbox options for an item tree - * - * @param string $tree - * @param array $option - * @param string $prefix - * @param array $parentIds - * @access private - */ - public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array()) - { - $tree .= $prefix."getName()."[groups][".$this->_groupId."][".$option['id']."]\" id=\"".$this->getName()."[groups][".$this->_groupId."][".$option['id']."]\" onclick=\""; - // If there are parent elements, add javascript that will - // make them selecteded when this element is checked to make - // sure permissions to parent items are added as well. - foreach ($parentIds as $pid) { - $parent_ele = $this->getName().'[groups]['.$this->_groupId.']['.$pid.']'; - $tree .= "var ele = xoopsGetElementById('".$parent_ele."'); if(ele.checked != true) {ele.checked = this.checked;}"; - } - // If there are child elements, add javascript that will - // make them unchecked when this element is unchecked to make - // sure permissions to child items are not added when there - // is no permission to this item. - foreach ($option['allchild'] as $cid) { - $child_ele = $this->getName().'[groups]['.$this->_groupId.']['.$cid.']'; - $tree .= "var ele = xoopsGetElementById('".$child_ele."'); if(this.checked != true) {ele.checked = false;}"; - } - $tree .= '" value="1"'; - if (isset($this->_value) && in_array($option['id'], $this->_value)) { - $tree .= ' checked="checked"'; - } - $tree .= " />".$option['name']."getName()."[parents][".$option['id']."]\" value=\"".implode(':', $parentIds)."\" />getName()."[itemname][".$option['id']."]\" value=\"".htmlspecialchars($option['name'])."\" />
\n"; - if (isset($option['children'])) { - foreach ($option['children'] as $child) { - array_push($parentIds, $option['id']); - $this->_renderOptionTree($tree, $this->_optionTree[$child], $prefix.' -', $parentIds); - } - } - } +class MyXoopsGroupFormCheckBox extends XoopsFormElement { + + /** + * Pre-selected value(s) + * @var array; + */ + public $_value; + /** + * Group ID + * @var int + */ + public $_groupId; + /** + * Option tree + * @var array + */ + public $_optionTree; + /** + * Appendix + * @var array ('permname'=>,'itemid'=>,'itemname'=>,'selected'=>) + */ + public $_appendix = []; + + /** + * Constructor + * + * @param $caption + * @param $name + * @param $groupId + * @param null $values + */ + public function __construct( $caption, $name, $groupId, $values = null ) { + $this->setCaption( $caption ); + $this->setName( $name ); + if ( isset( $values ) ) { + $this->setValue( $values ); + } + $this->_groupId = $groupId; + } + + /** + * Sets pre-selected values + * + * @param mixed $value A group ID or an array of group IDs + * + * @access public + */ + public function setValue( $value ) { + if ( is_array( $value ) ) { + foreach ( $value as $v ) { + $this->setValue( $v ); + } + } else { + $this->_value[] = $value; + } + } + + /** + * Sets the tree structure of items + * + * @param array $optionTree + * + * @access public + */ + public function setOptionTree( $optionTree ) { + $this->_optionTree = $optionTree; + } + + /** + * Sets appendix of checkboxes + * + * @access public + * + * @param $appendix + */ + public function setAppendix( $appendix ) { + $this->_appendix = $appendix; + } + + /** + * Renders checkbox options for this group + * + * @return string + * @access public + */ + public function render() { + $ret = ''; + + if ( count( $this->_appendix ) > 0 ) { + $ret .= ''; + $cols = 1; + foreach ( $this->_appendix as $append ) { + if ( $cols > 3 ) { + $ret .= ''; + $cols = 1; + } + $checked = $append['selected'] ? 'checked="checked"' : ''; + $name = 'perms[' . $append['permname'] . ']'; + $itemid = $append['itemid']; + $itemid = $append['itemid']; + $ret .= ""; + $cols ++; + } + $ret .= '
"; + $ret .= "_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked>"; + $ret .= "{$append['itemname']}"; + $ret .= ""; + $ret .= ""; + $ret .= "
'; + } + + $ret .= ''; + $cols = 1; + if ( ! empty( $this->_optionTree[0]['children'] ) ) { + foreach ( $this->_optionTree[0]['children'] as $topitem ) { + if ( $cols > 3 ) { + $ret .= ''; + $cols = 1; + } + $tree = ''; + $cols ++; + } + } + $ret .= '
'; + $prefix = ''; + $this->_renderOptionTree( $tree, $this->_optionTree[ $topitem ], $prefix ); + $ret .= $tree . '
'; + + return $ret; + } + + /** + * Renders checkbox options for an item tree + * + * @param string $tree + * @param array $option + * @param string $prefix + * @param array $parentIds + * + * @access private + */ + public function _renderOptionTree( &$tree, $option, $prefix, $parentIds = [] ) { + $tree .= $prefix . 'getName() . '[groups][' . $this->_groupId . '][' . $cid . ']'; + $tree .= "var ele = xoopsGetElementById('" . $child_ele . "'); if(this.checked != true) {ele.checked = false;}"; + } + $tree .= '" value="1"'; + if ( isset( $this->_value ) && in_array( $option['id'], $this->_value ) ) { + $tree .= ' checked="checked"'; + } + $tree .= '>' + . $option['name'] + . '
\n"; + if ( isset( $option['children'] ) ) { + foreach ( $option['children'] as $child ) { + array_push( $parentIds, $option['id'] ); + $this->_renderOptionTree( $tree, $this->_optionTree[ $child ], $prefix . ' -', $parentIds ); + } + } + } } diff --git a/xoops_trust_path/libs/altsys/include/tpls_functions.php b/xoops_trust_path/libs/altsys/include/tpls_functions.php index 4f3720f..d808f8a 100644 --- a/xoops_trust_path/libs/altsys/include/tpls_functions.php +++ b/xoops_trust_path/libs/altsys/include/tpls_functions.php @@ -1,166 +1,287 @@ fetchRow( $db->query( 'SELECT COUNT(*) FROM ' . $db->prefix( 'tplfile' ) . " WHERE tpl_tplset='default' AND tpl_file='" . addslashes( $tpl_file ) . "'" ) ); + + if ( ! $count ) { + return false; + } + + // check the template exists in the tplset + if ( 'default' != $tplset ) { + [ $count ] = $db->fetchRow( $db->query( 'SELECT COUNT(*) FROM ' . $db->prefix( 'tplfile' ) . " WHERE tpl_tplset='" . addslashes( $tplset ) . "' AND tpl_file='" . addslashes( $tpl_file ) . "'" ) ); + + if ( $count <= 0 ) { + // copy from 'default' to the tplset + + $result = $db->query( 'SELECT * FROM ' . $db->prefix( 'tplfile' ) . " WHERE tpl_tplset='default' AND tpl_file='" . addslashes( $tpl_file ) . "'" ); + + while ( false !== ( $row = $db->fetchArray( $result ) ) ) { + $db->queryF( 'INSERT INTO ' + . $db->prefix( 'tplfile' ) + . " SET tpl_refid='" + . addslashes( $row['tpl_refid'] ) + . "',tpl_module='" + . addslashes( $row['tpl_module'] ) + . "',tpl_tplset='" + . addslashes( $tplset ) + . "',tpl_file='" + . addslashes( $tpl_file ) + . "',tpl_desc='" + . addslashes( $row['tpl_desc'] ) + . "',tpl_type='" + . addslashes( $row['tpl_type'] ) + . "'" ); + + $tpl_id = $db->getInsertId(); + + $db->queryF( 'INSERT INTO ' . $db->prefix( 'tplsource' ) . " SET tpl_id='$tpl_id', tpl_source=''" ); + } + } + } + + // UPDATE just tpl_lastmodified and tpl_source + + $drs = $db->query( 'SELECT tpl_id FROM ' . $db->prefix( 'tplfile' ) . " WHERE tpl_tplset='" . addslashes( $tplset ) . "' AND tpl_file='" . addslashes( $tpl_file ) . "'" ); + + while ( list( $tpl_id ) = $db->fetchRow( $drs ) ) { + $db->queryF( 'UPDATE ' . $db->prefix( 'tplfile' ) . " SET tpl_lastmodified='" . addslashes( $lastmodified ) . "',tpl_lastimported=UNIX_TIMESTAMP() WHERE tpl_id='$tpl_id'" ); + + $db->queryF( 'UPDATE ' . $db->prefix( 'tplsource' ) . " SET tpl_source='" . addslashes( $tpl_source ) . "' WHERE tpl_id='$tpl_id'" ); + + altsys_template_touch( $tpl_id ); + } + + return true; +} -include_once XOOPS_ROOT_PATH.'/class/template.php'; -include_once dirname(__FILE__).'/altsys_functions.php' ; - -function tplsadmin_import_data($tplset, $tpl_file, $tpl_source, $lastmodified = 0) -{ - $db =& Database::getInstance() ; - - // check the file is valid template - list($count) = $db->fetchRow($db->query("SELECT COUNT(*) FROM ".$db->prefix("tplfile")." WHERE tpl_tplset='default' AND tpl_file='".addslashes($tpl_file)."'")) ; - if (! $count) { - return false ; - } - - // check the template exists in the tplset - if ($tplset != 'default') { - list($count) = $db->fetchRow($db->query("SELECT COUNT(*) FROM ".$db->prefix("tplfile")." WHERE tpl_tplset='".addslashes($tplset)."' AND tpl_file='".addslashes($tpl_file)."'")) ; - if ($count <= 0) { - // copy from 'default' to the tplset - $result = $db->query("SELECT * FROM ".$db->prefix("tplfile")." WHERE tpl_tplset='default' AND tpl_file='".addslashes($tpl_file)."'") ; - while ($row = $db->fetchArray($result)) { - $db->queryF("INSERT INTO ".$db->prefix("tplfile")." SET tpl_refid='".addslashes($row['tpl_refid'])."',tpl_module='".addslashes($row['tpl_module'])."',tpl_tplset='".addslashes($tplset)."',tpl_file='".addslashes($tpl_file)."',tpl_desc='".addslashes($row['tpl_desc'])."',tpl_type='".addslashes($row['tpl_type'])."'") ; - $tpl_id = $db->getInsertId() ; - $db->queryF("INSERT INTO ".$db->prefix("tplsource")." SET tpl_id='$tpl_id', tpl_source=''") ; - } - } - } - - // UPDATE just tpl_lastmodified and tpl_source - $drs = $db->query("SELECT tpl_id FROM ".$db->prefix("tplfile")." WHERE tpl_tplset='".addslashes($tplset)."' AND tpl_file='".addslashes($tpl_file)."'") ; - while (list($tpl_id) = $db->fetchRow($drs)) { - $db->queryF("UPDATE ".$db->prefix("tplfile")." SET tpl_lastmodified='".addslashes($lastmodified)."',tpl_lastimported=UNIX_TIMESTAMP() WHERE tpl_id='$tpl_id'") ; - $db->queryF("UPDATE ".$db->prefix("tplsource")." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'") ; - altsys_template_touch($tpl_id) ; - } - - return true ; +/** + * @param $lines + * + * @return string + */ +function tplsadmin_get_fingerprint( $lines ) { + $str = ''; + + foreach ( $lines as $line ) { + if ( trim( $line ) ) { + $str .= md5( trim( $line ) ); + } + } + + return md5( $str ); } +/** + * @param $tplset_from + * @param $tplset_to + * @param string $whr_append + */ +function tplsadmin_copy_templates_db2db( $tplset_from, $tplset_to, $whr_append = '1' ) { + global $db; + + // get tplfile and tplsource + + $result = $db->query( "SELECT tpl_refid,tpl_module,'" + . addslashes( $tplset_to ) + . "',tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type,tpl_source FROM " + . $db->prefix( 'tplfile' ) + . ' NATURAL LEFT JOIN ' + . $db->prefix( 'tplsource' ) + . " WHERE tpl_tplset='" + . addslashes( $tplset_from ) + . "' AND ($whr_append)" ); + + while ($row = $db->fetchArray($result)) { + $tpl_source = array_pop( $row ); + + $drs = $db->query( 'SELECT tpl_id FROM ' . $db->prefix( 'tplfile' ) . " WHERE tpl_tplset='" . addslashes( $tplset_to ) . "' AND ($whr_append) AND tpl_file='" . addslashes( $row['tpl_file'] ) . "' AND tpl_refid='" . addslashes( $row['tpl_refid'] ) . "'" ); + + if ( ! $db->getRowsNum( $drs ) ) { + // INSERT mode + $sql = 'INSERT INTO ' . $db->prefix( 'tplfile' ) . ' (tpl_refid,tpl_module,tpl_tplset,tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type) VALUES ('; + foreach ( $row as $colval ) { + $sql .= "'" . addslashes( $colval ) . "',"; + } + + $db->query( mb_substr( $sql, 0, - 1 ) . ')' ); + + $tpl_id = $db->getInsertId(); + + $db->query( 'INSERT INTO ' . $db->prefix( 'tplsource' ) . " SET tpl_id='$tpl_id', tpl_source='" . addslashes( $tpl_source ) . "'" ); + + altsys_template_touch( $tpl_id ); + } else { + while ( list( $tpl_id ) = $db->fetchRow( $drs ) ) { + // UPDATE mode + + $db->query( 'UPDATE ' + . $db->prefix( 'tplfile' ) + . " SET tpl_refid='" + . addslashes( $row['tpl_refid'] ) + . "',tpl_desc='" + . addslashes( $row['tpl_desc'] ) + . "',tpl_lastmodified='" + . addslashes( $row['tpl_lastmodified'] ) + . "',tpl_lastimported='" + . addslashes( $row['tpl_lastimported'] ) + . "',tpl_type='" + . addslashes( $row['tpl_type'] ) + . "' WHERE tpl_id='$tpl_id'" ); + + $db->query( 'UPDATE ' . $db->prefix( 'tplsource' ) . " SET tpl_source='" . addslashes( $tpl_source ) . "' WHERE tpl_id='$tpl_id'" ); + + altsys_template_touch( $tpl_id ); + } + } + } +} +/** + * @param $tplset_to + * @param string $whr_append + */ +function tplsadmin_copy_templates_f2db( $tplset_to, $whr_append = '1' ) { + global $db; -function tplsadmin_get_fingerprint($lines) -{ - $str = '' ; - foreach ($lines as $line) { - if (trim($line)) { - $str .= md5(trim($line)) ; - } - } - return md5($str) ; -} + // get tplsource + //$result = $db->query('SELECT * FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='default' AND ($whr_append)") ; + $result = $db->query( 'SELECT * FROM ' . $db->prefix( 'tplfile' ) . " WHERE tpl_tplset='default' AND ($whr_append)" ); + while ($row = $db->fetchArray($result)) { + $basefilepath = tplsadmin_get_basefilepath( $row['tpl_module'], $row['tpl_type'], $row['tpl_file'] ); -function tplsadmin_copy_templates_db2db($tplset_from, $tplset_to, $whr_append = '1') -{ - global $db ; - - // get tplfile and tplsource - $result = $db->query("SELECT tpl_refid,tpl_module,'".addslashes($tplset_to)."',tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type,tpl_source FROM ".$db->prefix("tplfile")." NATURAL LEFT JOIN ".$db->prefix("tplsource")." WHERE tpl_tplset='".addslashes($tplset_from)."' AND ($whr_append)") ; - - while ($row = $db->fetchArray($result)) { - $tpl_source = array_pop($row) ; - - $drs = $db->query("SELECT tpl_id FROM ".$db->prefix("tplfile")." WHERE tpl_tplset='".addslashes($tplset_to)."' AND ($whr_append) AND tpl_file='".addslashes($row['tpl_file'])."' AND tpl_refid='".addslashes($row['tpl_refid'])."'") ; - - if (! $db->getRowsNum($drs)) { - // INSERT mode - $sql = "INSERT INTO ".$db->prefix("tplfile")." (tpl_refid,tpl_module,tpl_tplset,tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type) VALUES (" ; - foreach ($row as $colval) { - $sql .= "'".addslashes($colval)."'," ; - } - $db->query(substr($sql, 0, -1) . ')') ; - $tpl_id = $db->getInsertId() ; - $db->query("INSERT INTO ".$db->prefix("tplsource")." SET tpl_id='$tpl_id', tpl_source='".addslashes($tpl_source)."'") ; - altsys_template_touch($tpl_id) ; - } else { - while (list($tpl_id) = $db->fetchRow($drs)) { - // UPDATE mode - $db->query("UPDATE ".$db->prefix("tplfile")." SET tpl_refid='".addslashes($row['tpl_refid'])."',tpl_desc='".addslashes($row['tpl_desc'])."',tpl_lastmodified='".addslashes($row['tpl_lastmodified'])."',tpl_lastimported='".addslashes($row['tpl_lastimported'])."',tpl_type='".addslashes($row['tpl_type'])."' WHERE tpl_id='$tpl_id'") ; - $db->query("UPDATE ".$db->prefix("tplsource")." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'") ; - altsys_template_touch($tpl_id) ; - } - } - } -} + $tpl_source = rtrim( implode( '', file( $basefilepath ) ) ); + + $lastmodified = filemtime( $basefilepath ); + + $drs = $db->query( 'SELECT tpl_id FROM ' . $db->prefix( 'tplfile' ) . " WHERE tpl_tplset='" . addslashes( $tplset_to ) . "' AND ($whr_append) AND tpl_file='" . addslashes( $row['tpl_file'] ) . "' AND tpl_refid='" . addslashes( $row['tpl_refid'] ) . "'" ); + + if ( ! $db->getRowsNum( $drs ) ) { + // INSERT mode + $sql = 'INSERT INTO ' + . $db->prefix( 'tplfile' ) + . " SET tpl_refid='" + . addslashes( $row['tpl_refid'] ) + . "',tpl_desc='" + . addslashes( $row['tpl_desc'] ) + . "',tpl_lastmodified='" + . addslashes( $lastmodified ) + . "',tpl_type='" + . addslashes( $row['tpl_type'] ) + . "',tpl_tplset='" + . addslashes( $tplset_to ) + . "',tpl_file='" + . addslashes( $row['tpl_file'] ) + . "',tpl_module='" + . addslashes( $row['tpl_module'] ) + . "'"; + + $db->query( $sql ); + + $tpl_id = $db->getInsertId(); + + $db->query( 'INSERT INTO ' . $db->prefix( 'tplsource' ) . " SET tpl_id='$tpl_id', tpl_source='" . addslashes( $tpl_source ) . "'" ); + altsys_template_touch( $tpl_id ); + } else { + while ( list( $tpl_id ) = $db->fetchRow( $drs ) ) { + // UPDATE mode + $db->query( 'UPDATE ' . $db->prefix( 'tplfile' ) . " SET tpl_lastmodified='" . addslashes( $lastmodified ) . "' WHERE tpl_id='$tpl_id'" ); -function tplsadmin_copy_templates_f2db($tplset_to, $whr_append = '1') -{ - global $db ; - - // get tplsource - $result = $db->query("SELECT * FROM ".$db->prefix("tplfile")." WHERE tpl_tplset='default' AND ($whr_append)") ; - - while ($row = $db->fetchArray($result)) { - $basefilepath = tplsadmin_get_basefilepath($row['tpl_module'], $row['tpl_type'], $row['tpl_file']) ; - $tpl_source = rtrim(implode("", file($basefilepath))) ; - $lastmodified = filemtime($basefilepath) ; - - $drs = $db->query("SELECT tpl_id FROM ".$db->prefix("tplfile")." WHERE tpl_tplset='".addslashes($tplset_to)."' AND ($whr_append) AND tpl_file='".addslashes($row['tpl_file'])."' AND tpl_refid='".addslashes($row['tpl_refid'])."'") ; - - if (! $db->getRowsNum($drs)) { - // INSERT mode - $sql = "INSERT INTO ".$db->prefix("tplfile")." SET tpl_refid='".addslashes($row['tpl_refid'])."',tpl_desc='".addslashes($row['tpl_desc'])."',tpl_lastmodified='".addslashes($lastmodified)."',tpl_type='".addslashes($row['tpl_type'])."',tpl_tplset='".addslashes($tplset_to)."',tpl_file='".addslashes($row['tpl_file'])."',tpl_module='".addslashes($row['tpl_module'])."'" ; - $db->query($sql) ; - $tpl_id = $db->getInsertId() ; - $db->query("INSERT INTO ".$db->prefix("tplsource")." SET tpl_id='$tpl_id', tpl_source='".addslashes($tpl_source)."'") ; - altsys_template_touch($tpl_id) ; - } else { - while (list($tpl_id) = $db->fetchRow($drs)) { - // UPDATE mode - $db->query("UPDATE ".$db->prefix("tplfile")." SET tpl_lastmodified='".addslashes($lastmodified)."' WHERE tpl_id='$tpl_id'") ; - $db->query("UPDATE ".$db->prefix("tplsource")." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'") ; - altsys_template_touch($tpl_id) ; - } - } - } + $db->query( 'UPDATE ' . $db->prefix( 'tplsource' ) . " SET tpl_source='" . addslashes( $tpl_source ) . "' WHERE tpl_id='$tpl_id'" ); + + altsys_template_touch( $tpl_id ); + } + } + } } +/** + * @param $dirname + * @param $type + * @param $tpl_file + * + * @return string + */ +function tplsadmin_get_basefilepath( $dirname, $type, $tpl_file ) { + // module instance + + $path = $basefilepath = XOOPS_ROOT_PATH . '/modules/' . $dirname . '/templates/' . ( 'block' == $type ? 'blocks/' : '' ) . $tpl_file; + + if ( is_callable( 'Legacy_Utils::getTrustDirnameByDirname' ) ) { + $mytrustdirname = Legacy_Utils::getTrustDirnameByDirname( $dirname ); + } elseif ( ! defined( 'XOOPS_CUBE_LEGACY' ) ) { + $mytrustdirname = XOOPS_PATH; + } + + if ( defined( 'ALTSYS_TPLSADMIN_BASEPATH' ) ) { + // Special hook + + $path = ALTSYS_TPLSADMIN_BASEPATH . '/' . substr( $tpl_file, strlen( $dirname ) + 1 ); + } elseif ( $mytrustdirname || @include XOOPS_ROOT_PATH . '/modules/' . $dirname . '/mytrustdirname.php' ) { + // D3 module base + if ( ! empty( $mytrustdirname ) ) { + $mid_path = 'altsys' == $mytrustdirname ? '/libs/' : '/modules/'; + $path = XOOPS_TRUST_PATH . $mid_path . $mytrustdirname . '/templates/' . ( 'block' == $type ? 'blocks/' : '' ) . substr( $tpl_file, strlen( $dirname ) + 1 ); -function tplsadmin_get_basefilepath($dirname, $type, $tpl_file) -{ - // module instance - $path = $basefilepath = XOOPS_ROOT_PATH.'/modules/'.$dirname.'/templates/'.($type=='block'?'blocks/':'').$tpl_file ; - - if (is_callable('Legacy_Utils::getTrustDirnameByDirname')) { - $mytrustdirname = Legacy_Utils::getTrustDirnameByDirname($dirname); - } - - if (defined('ALTSYS_TPLSADMIN_BASEPATH')) { - // Special hook - $path = ALTSYS_TPLSADMIN_BASEPATH.'/'.substr($tpl_file, strlen($dirname) + 1) ; - } elseif ($mytrustdirname || @include(XOOPS_ROOT_PATH.'/modules/'.$dirname.'/mytrustdirname.php')) { - // D3 module base - if (! empty($mytrustdirname)) { - $mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/' ; - - $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type=='block'?'blocks/':'').substr($tpl_file, strlen($dirname) + 1) ; - //new for xcck etc.other trust_module - if (! file_exists($path)) { - $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type=='block'?'blocks/':'').$tpl_file ; - if (! file_exists($path)) { - $path = $basefilepath; - } - } - } - } - - return $path ; + //new for xcck etc.other trust_module + + if ( ! file_exists( $path ) ) { + $path = XOOPS_TRUST_PATH . $mid_path . $mytrustdirname . '/templates/' . ( 'block' == $type ? 'blocks/' : '' ) . $tpl_file; + + if ( ! file_exists( $path ) ) { + $path = $basefilepath; + } + } + } + } + + return $path; } +/** + * @param $msg + * @param string $target_dirname + * @param int $wait + */ +function tplsadmin_die( $msg, $target_dirname = '', $wait = 2 ) { + if ( 'post' === mb_strtolower( $_SERVER['REQUEST_METHOD'] ) ) { + redirect_header( '?mode=admin&lib=altsys&page=mytplsadmin&dirname=' . $target_dirname, $wait, $msg ); + + exit; + } -function tplsadmin_die($msg, $target_dirname = '', $wait = 2) -{ - if (strtolower($_SERVER['REQUEST_METHOD']) === 'post') { - redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, $wait, $msg) ; - exit ; - } else { - die($msg) ; - } + die( $msg ); } diff --git a/xoops_trust_path/libs/altsys/include/x20_keepblockoptions.inc.php b/xoops_trust_path/libs/altsys/include/x20_keepblockoptions.inc.php index fd2463f..59b418b 100644 --- a/xoops_trust_path/libs/altsys/include/x20_keepblockoptions.inc.php +++ b/xoops_trust_path/libs/altsys/include/x20_keepblockoptions.inc.php @@ -1,91 +1,63 @@ prefix('modules')." WHERE dirname='".$modversion['dirname']."' "; -$result = $xoopsDB->query($query); -$record= $xoopsDB->fetcharray($result); -if ($record) { - $mid = $record['mid']; - $count = count($modversion['blocks']); - /* $sql = "SELECT * FROM ".$xoopsDB->prefix('newblocks')." WHERE mid=".$mid." AND block_type ='D'"; - $fresult = $xoopsDB->query($sql); - $n_funcnum = $count; - while ($fblock = $xoopsDB->fetchArray($fresult)) { - $bnum = 0; - for ($i = 1 ; $i <= $count ; $i++) { - if (($modversion['blocks'][$i]['file'] == $fblock['func_file']) and ($modversion['blocks'][$i]['show_func'] == $fblock['show_func'])) { - $bnum = $i; - break; - } - } - if($bnum) { - $n_funcnum++; - $modversion['blocks'][$n_funcnum]['file'] = $fblock['func_file']; - $modversion['blocks'][$n_funcnum]['name'] = $fblock['name']; - $modversion['blocks'][$n_funcnum]['description'] = $fblock['name']; - $modversion['blocks'][$n_funcnum]['show_func'] = $fblock['show_func']; - $modversion['blocks'][$n_funcnum]['edit_func'] = $fblock['edit_func']; - $modversion['blocks'][$n_funcnum]['template'] = $fblock['template']; - if ($fblock['options']) { - $old_vals=explode("|",$fblock['options']); - $def_vals=explode("|",$modversion['blocks'][$bnum]['options']); - if (count($old_vals) == count($def_vals)) { - // the number of parameters is not changed - $modversion['blocks'][$n_funcnum]['options'] = $fblock['options']; - $local_msgs[] = "Option's values of the cloned block ".$fblock['name']." will be kept. (value = ".$fblock['options'].")"; - } else if (count($old_vals) < count($def_vals)){ - // the number of parameters is increased - for ($j=0; $j < count($old_vals); $j++) { - $def_vals[$j] = $old_vals[$j]; - } - $modversion['blocks'][$n_funcnum]['options'] = implode("|",$def_vals); - $local_msgs[] = "Option's values of the cloned block ".$fblock['name']." will be kept and new options are added. (value = ".$modversion['blocks'][$fblock['func_num']]['options'].")"; - } else { - $modversion['blocks'][$n_funcnum]['options'] = implode("|",$def_vals); - $local_msgs[] = "Option's values of the cloned block ".$fblock['name']." will be reset to the default, because of some decrease of options. (value = ".$modversion['blocks'][$n_funcnum]['options'].")"; - } - } - $sql = "UPDATE ".$xoopsDB->prefix('newblocks')." SET func_num='$n_funcnum' WHERE mid=".$mid." AND bid='".$fblock['bid']."'"; - $iret = $xoopsDB->query($sql); +$query = 'SELECT mid FROM ' . $xoopsDB->prefix( 'modules' ) . " WHERE dirname='" . $modversion['dirname'] . "' "; +$result = $xoopsDB->query( $query ); +$record = $xoopsDB->fetchArray( $result ); +if ( $record ) { + $mid = $record['mid']; + $count = count( $modversion['blocks'] ); - } - } */ - - $sql = "SELECT * FROM ".$xoopsDB->prefix('newblocks')." WHERE mid=".$mid." AND block_type <>'D' AND func_num > $count"; - $fresult = $xoopsDB->query($sql); - while ($fblock = $xoopsDB->fetchArray($fresult)) { - $local_msgs[] = "Non Defined Block ".$fblock['name']." will be deleted"; - $sql = "DELETE FROM ".$xoopsDB->prefix('newblocks')." WHERE bid='".$fblock['bid']."'"; - $iret = $xoopsDB->query($sql); - } - - for ($i = 1 ; $i <= $count ; $i++) { - $sql = "SELECT name,options FROM ".$xoopsDB->prefix('newblocks')." WHERE mid=".$mid." AND func_num=".$i." AND show_func='".addslashes($modversion['blocks'][$i]['show_func'])."' AND func_file='".addslashes($modversion['blocks'][$i]['file'])."'"; - $fresult = $xoopsDB->query($sql); - $fblock = $xoopsDB->fetchArray($fresult); - if (isset($fblock['options'])) { - $old_vals=explode("|", $fblock['options']); - $def_vals=explode("|", $modversion['blocks'][$i]['options']); - if (count($old_vals) == count($def_vals)) { - $modversion['blocks'][$i]['options'] = $fblock['options']; - $local_msgs[] = "Option's values of the block ".$fblock['name']." will be kept. (value = ".$fblock['options'].")"; - } elseif (count($old_vals) < count($def_vals)) { - for ($j=0; $j < count($old_vals); $j++) { - $def_vals[$j] = $old_vals[$j]; - } - $modversion['blocks'][$i]['options'] = implode("|", $def_vals); - $local_msgs[] = "Option's values of the block ".$fblock['name']." will be kept and new option(s) are added. (value = ".$modversion['blocks'][$i]['options'].")"; - } else { - $local_msgs[] = "Option's values of the block ".$fblock['name']." will be reset to the default, because of some decrease of options. (value = ".$modversion['blocks'][$i]['options'].")"; - } - } - } + + $sql = 'SELECT * FROM ' . $xoopsDB->prefix( 'newblocks' ) . ' WHERE mid=' . $mid . " AND block_type <>'D' AND func_num > $count"; + $fresult = $xoopsDB->query( $sql ); + + while ( false !== ( $fblock = $xoopsDB->fetchArray( $fresult ) ) ) { + $local_msgs[] = 'Non Defined Block ' . $fblock['name'] . ' will be deleted'; + $sql = 'DELETE FROM ' . $xoopsDB->prefix( 'newblocks' ) . " WHERE bid='" . $fblock['bid'] . "'"; + $iret = $xoopsDB->query( $sql ); + } + + for ( $i = 1; $i <= $count; ++ $i ) { + $sql = 'SELECT name,options FROM ' . $xoopsDB->prefix( 'newblocks' ) . ' WHERE mid=' . $mid . ' AND func_num=' . $i . " AND show_func='" . addslashes( $modversion['blocks'][ $i ]['show_func'] ) . "' AND func_file='" . addslashes( $modversion['blocks'][ $i ]['file'] ) . "'"; + $fresult = $xoopsDB->query( $sql ); + $fblock = $xoopsDB->fetchArray( $fresult ); + if ( isset( $fblock['options'] ) ) { + $old_vals = explode( '|', $fblock['options'] ); + + $def_vals = explode( '|', $modversion['blocks'][ $i ]['options'] ); + + if ( count( $old_vals ) == count( $def_vals ) ) { + $modversion['blocks'][ $i ]['options'] = $fblock['options']; + + $local_msgs[] = "Option's values of the block " . $fblock['name'] . ' will be kept. (value = ' . $fblock['options'] . ')'; + } elseif ( count( $old_vals ) < count( $def_vals ) ) { + for ( $j = 0; $j < count( $old_vals ); $j ++ ) { + $def_vals[ $j ] = $old_vals[ $j ]; + } + $modversion['blocks'][ $i ]['options'] = implode( '|', $def_vals ); + + $local_msgs[] = "Option's values of the block " . $fblock['name'] . ' will be kept and new option(s) are added. (value = ' . $modversion['blocks'][ $i ]['options'] . ')'; + } else { + $local_msgs[] = "Option's values of the block " . $fblock['name'] . ' will be reset to the default, because of some decrease of options. (value = ' . $modversion['blocks'][ $i ]['options'] . ')'; + } + } + } } -global $msgs , $myblocksadmin_parsed_updateblock ; -if (! empty($msgs) && ! empty($local_msgs) && empty($myblocksadmin_parsed_updateblock)) { - $msgs = array_merge($msgs, $local_msgs) ; - $myblocksadmin_parsed_updateblock = true ; +global $msgs, $myblocksadmin_parsed_updateblock; +if ( ! empty( $msgs ) && ! empty( $local_msgs ) && empty( $myblocksadmin_parsed_updateblock ) ) { + $msgs = array_merge( $msgs, $local_msgs ); + + $myblocksadmin_parsed_updateblock = true; } diff --git a/xoops_trust_path/libs/altsys/index.php b/xoops_trust_path/libs/altsys/index.php index 2aca7d2..814a944 100644 --- a/xoops_trust_path/libs/altsys/index.php +++ b/xoops_trust_path/libs/altsys/index.php @@ -1,51 +1,62 @@ getByDirname('altsys') ; + $xoopsModule = $moduleperm_handler->getByDirname( 'altsys' ); } -require XOOPS_ROOT_PATH.'/include/cp_functions.php' ; +require XOOPS_ROOT_PATH . '/include/cp_functions.php'; // breadcrumbs -$breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; -$breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php', $GLOBALS['xoopsModule']->getVar('name')) ; +$breadcrumbsObj = AltsysBreadcrumbs::getInstance(); +$breadcrumbsObj->appendPath( XOOPS_URL . '/modules/altsys/admin/index.php', $GLOBALS['xoopsModule']->getVar( 'name' ) ); // get page -$page = preg_replace('/[^a-zA-Z0-9_-]/', '', @$_GET['page']) ; -require dirname(__FILE__).'/controllers.php' ; -if (! in_array($page, $controllers)) { - $_GET['page'] = $page = 'myblocksadmin' ; - $_SERVER['REQUEST_URI'] = '/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin' ; +$page = preg_replace( '/[^a-zA-Z0-9_-]/', '', @$_GET['page'] ); +require __DIR__ . '/controllers.php'; +if ( ! in_array( $page, $controllers, true ) ) { + $_GET['page'] = $page = 'myblocksadmin'; + $_SERVER['REQUEST_URI'] = '/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin'; } // half measure ... (TODO) -if (empty($_GET['dirname'])) { - $module_handler =& xoops_gethandler('module') ; - list($top_module) = $module_handler->getObjects(new Criteria('isactive', 1)) ; - $_GET['dirname'] = $top_module->getVar('dirname') ; +if ( empty( $_GET['dirname'] ) ) { + $module_handler = xoops_gethandler( 'module' ); + [ $top_module ] = $module_handler->getObjects( new Criteria( 'isactive', 1 ) ); + $_GET['dirname'] = $top_module->getVar( 'dirname' ); } // language file -altsys_include_language_file($page) ; +altsys_include_language_file( $page ); // branch to each pages -$mytrustdirpath = dirname(__FILE__) ; -if (file_exists(XOOPS_TRUST_PATH.'/libs/altsys/'.$page.'.php')) { - include XOOPS_TRUST_PATH.'/libs/altsys/'.$page.'.php' ; +$mytrustdirpath = __DIR__; +if ( file_exists( XOOPS_TRUST_PATH . '/libs/altsys/' . $page . '.php' ) ) { + include XOOPS_TRUST_PATH . '/libs/altsys/' . $page . '.php'; } else { - die('wrong request') ; + die( 'wrong request' ); } diff --git a/xoops_trust_path/libs/altsys/language/english/admin.php b/xoops_trust_path/libs/altsys/language/english/admin.php index 2af8731..d46dc71 100644 --- a/xoops_trust_path/libs/altsys/language/english/admin.php +++ b/xoops_trust_path/libs/altsys/language/english/admin.php @@ -1,3 +1,3 @@ +Since this rarely breaks the layout of the template, this option is recommended in order to help designers identify components during the design process.'); +define( '_TPLSADMIN_CNF_ENCLOSEBYCOMMENT' , 'Compiled template caches will be enclosed by tplsadmin comments. Confirm to proceed or cancel !'); -define('_TPLSADMIN_FMT_MSG_ENCLOSEBYBORDEREDDIV', '%d template caches have been enclosed by div tags') ; -define('_TPLSADMIN_DT_ENCLOSEBYBORDEREDDIV', 'Implant div tags') ; -define('_TPLSADMIN_DD_ENCLOSEBYBORDEREDDIV', 'Each templates will be enclosed by black-bordered div tags. A link for editing controller of tplsadmin will be implanted into each templates. Though this often cause destructions in designing, you can edit each templates the most instictively and easily.') ; -define('_TPLSADMIN_CNF_ENCLOSEBYBORDEREDDIV', 'Compiled template caches will be enclosed by div tags. Are you OK?') ; +define( '_TPLSADMIN_FMT_MSG_ENCLOSEBYBORDEREDDIV' , '%d template caches have been enclosed by div tags'); +define( '_TPLSADMIN_DT_ENCLOSEBYBORDEREDDIV' , 'Insert div tags'); +define( '_TPLSADMIN_DD_ENCLOSEBYBORDEREDDIV' , 'Each template will be enclosed by black-bordered div tags. A link for editing controller of tplsadmin will be added into each templates. Though this can often break the design, you can easily edit each template instantly.'); +define( '_TPLSADMIN_CNF_ENCLOSEBYBORDEREDDIV' , 'Compiled template caches will be enclosed by div tags. Confirm to proceed or cancel !'); -define('_TPLSADMIN_FMT_MSG_HOOKSAVEVARS', '%d template caches have been implanted hooking logics to collect template varibles') ; -define('_TPLSADMIN_DT_HOOKSAVEVARS', 'Implant logics to collect template variables') ; -define('_TPLSADMIN_DD_HOOKSAVEVARS', 'The first step of getting the informations of template variables in your site. The template vars infos will be collected when public sides of your site is displayed. If all templates you want to edit are displayed, get template vars info by underlying buttons.') ; -define('_TPLSADMIN_CNF_HOOKSAVEVARS', 'Compiled template caches will be implanted the logics to collect template variables. Are you OK?') ; +define( '_TPLSADMIN_FMT_MSG_HOOKSAVEVARS' , '%d template caches have been modified hooking logic to collect template variables'); +define( '_TPLSADMIN_DT_HOOKSAVEVARS' , 'Insert logic to collect template variables'); +define( '_TPLSADMIN_DD_HOOKSAVEVARS' , 'The first step of getting the information of templates variables in your site. The template vars infos will be collected when the front-end is displayed. If all templates you want to edit are displayed, get template vars info by underlying buttons.'); +define( '_TPLSADMIN_CNF_HOOKSAVEVARS' , 'Compiled template caches will be implanted the logics to collect template variables. Are you OK?'); -define('_TPLSADMIN_FMT_MSG_REMOVEHOOKS', '%d template caches have been normalized') ; -define('_TPLSADMIN_DT_REMOVEHOOKS', 'Normalize compiled template caches') ; -define('_TPLSADMIN_DD_REMOVEHOOKS', 'This removes comments/div tags/logics implanted by upper operations from each compiled template caches.') ; -define('_TPLSADMIN_CNF_REMOVEHOOKS', 'Are you OK for normlizing?') ; +define( '_TPLSADMIN_FMT_MSG_REMOVEHOOKS' , '%d template caches have been normalized'); +define( '_TPLSADMIN_DT_REMOVEHOOKS' , 'Normalize compiled template caches'); +define( '_TPLSADMIN_DD_REMOVEHOOKS' , 'This removes comments/div tags/logic implemented by hooks from each compiled template cache.'); +define( '_TPLSADMIN_CNF_REMOVEHOOKS' , 'Confirm to proceed and remove the hooks!'); -define('_TPLSADMIN_MSG_CLEARCACHE', 'Template caches are removed') ; -define('_TPLSADMIN_MSG_CREATECOMPILECACHEFIRST', 'There are no compiled template caches. Create complied template caches by displaying public sides of your site, first') ; +define( '_TPLSADMIN_MSG_CLEARCACHE' , 'Template caches were removed.'); +define( '_TPLSADMIN_MSG_CREATECOMPILECACHEFIRST' , 'There are no compiled template in cache. First, create the compiled templates in cache by browsing to the public side of your site.'); -define('_TPLSADMIN_CNF_DELETEOK', 'Delete OK?') ; +define( '_TPLSADMIN_CNF_DELETEOK' , 'Confirm to proceed and Delete!'); -define('_TPLSADMIN_DT_GETTPLSVARSINFO_DW', 'Get info of template variables as DreamWeaver Extensions') ; -define('_TPLSADMIN_DD_GETTPLSVARSINFO_DW', 'Open Macromedia Extension Manager, first.
Extract the download archive.
Execute the files which extensions are .mxi and you will meet installing dialogs.
The snippets for template variables of your site will be usable after restarting Dream Weaver.') ; +define( '_TPLSADMIN_DT_GETTPLSVARSINFO_DW' , 'Get info of template variables as DreamWeaver Extensions'); +define( '_TPLSADMIN_DD_GETTPLSVARSINFO_DW' , 'Open Macromedia Extension Manager, first.
Extract the download archive.
Run the files with the .mxi extension and follow the installation dialogues.
The snippets for template variables of your site will be usable after restarting DreamWeaver.'); -define('_TPLSADMIN_DT_GETTEMPLATES', 'Download templates') ; -define('_TPLSADMIN_DD_GETTEMPLATES', 'Select a set before pushing either button') ; +define( '_TPLSADMIN_DT_GETTEMPLATES' , 'Download templates'); +define( '_TPLSADMIN_DD_GETTEMPLATES' , 'Select a set before pushing either button'); -define('_TPLSADMIN_FMT_MSG_PUTTEMPLATES', '%d templates are imported.') ; -define('_TPLSADMIN_DT_PUTTEMPLATES', 'Upload templates') ; -define('_TPLSADMIN_DD_PUTTEMPLATES', 'Select a set you want to upload/overwrite before uploading zip/tgz archive including template files (.html). You need not to check depths of the paths in the archive.') ; +define( '_TPLSADMIN_FMT_MSG_PUTTEMPLATES' , '%d templates are imported.'); +define( '_TPLSADMIN_DT_PUTTEMPLATES' , 'Upload templates'); +define( '_TPLSADMIN_DD_PUTTEMPLATES' , 'Select a template set you want to upload/overwrite.
Select the file tar archive including the template files (.html)
Automatically extracts all files from the archive to their absolute location no matter the tree structure.'); -define('_TPLSADMIN_ERR_NOTUPLOADED', 'No files are uploaded.') ; -define('_TPLSADMIN_ERR_EXTENSION', 'This extension cannot be recognized.') ; -define('_TPLSADMIN_ERR_INVALIDARCHIVE', 'The archive is not extractable.') ; -define('_TPLSADMIN_ERR_INVALIDTPLSET', 'Invalid set name has been specified.') ; +define( '_TPLSADMIN_ERR_NOTUPLOADED' , 'No files are uploaded.'); +define( '_TPLSADMIN_ERR_EXTENSION' , 'This extension cannot be recognized.'); +define( '_TPLSADMIN_ERR_INVALIDARCHIVE' , 'The archive is not extractable.'); +define( '_TPLSADMIN_ERR_INVALIDTPLSET' , 'Invalid set name has been specified.'); -define('_TPLSADMIN_ERR_NOTPLSVARSINFO', 'There are no template vars info files.') ; +define( '_TPLSADMIN_ERR_NOTPLSVARSINFO' , 'There are no template vars info files.'); -define('_TPLSADMIN_NUMCAP_COMPILEDCACHES', 'Compiled template caches') ; -define('_TPLSADMIN_NUMCAP_TPLSVARS', 'Template vars info files') ; +define( '_TPLSADMIN_NUMCAP_COMPILEDCACHES' , 'Compiled template caches'); +define( '_TPLSADMIN_NUMCAP_TPLSVARS' , 'Template vars info files'); diff --git a/xoops_trust_path/libs/altsys/language/english/modinfo.php b/xoops_trust_path/libs/altsys/language/english/modinfo.php index 264f7fe..7868a6a 100644 --- a/xoops_trust_path/libs/altsys/language/english/modinfo.php +++ b/xoops_trust_path/libs/altsys/language/english/modinfo.php @@ -1,37 +1,37 @@ include XOOPS_TRUST_PATH.\'/libs/altsys/include/admin_in_theme.inc.php\';
to enable this. This feature works only with XOOPS 2.0.x') ; +define( '_MI_ALTSYS_ADMIN_IN_THEME' , 'Theme set for admin'); +define( '_MI_ALTSYS_ADMIN_IN_THEMEDSC' , 'Set the name of the theme displaying admin area. Insert a line just after including common.php in mainfile.php
include XOOPS_TRUST_PATH.\'/libs/altsys/include/admin_in_theme.inc.php\');
to enable this. This feature works only with XOOPS 2.0.x'); -define('_MI_ALTSYS_ENABLEFORCECLONE', 'Force all blocks to be clonable') ; -define('_MI_ALTSYS_ENABLEFORCECLONEDSC', 'You should know there are blocks cause errors if multiple instances is displayed on a page') ; +define( '_MI_ALTSYS_ENABLEFORCECLONE' , 'Force all blocks to be duplicable'); +define( '_MI_ALTSYS_ENABLEFORCECLONEDSC' , 'Warning : Some blocks may cause errors if multiple instances are displayed on the same page!'); -define('_MI_ALTSYS_IMAGES_DIR', 'Directory for image files'); -define('_MI_ALTSYS_IMAGES_DIRDSC', 'relative path should be set in the module directory. default: images'); +define( '_MI_ALTSYS_IMAGES_DIR' , 'Directory for image files'); +define( '_MI_ALTSYS_IMAGES_DIRDSC' , 'relative path should be set in the module directory. default: images'); diff --git a/xoops_trust_path/libs/altsys/language/english/myblocksadmin.php b/xoops_trust_path/libs/altsys/language/english/myblocksadmin.php index 7bc17fa..ef78838 100644 --- a/xoops_trust_path/libs/altsys/language/english/myblocksadmin.php +++ b/xoops_trust_path/libs/altsys/language/english/myblocksadmin.php @@ -1,56 +1,59 @@ +Thus allowing to create reusable Components and act as building block for your app.
A single component contains HTML, JavaScript and CSS.
+Modules have several pre-built blocks that offer specific functionality and favor composition over inheritance.
The editor will change according to the type of content.'); +define( '_MD_A_MYBLOCKSADMIN_PERMUPDATED' , 'Permissions updated successfully'); +define( '_MD_A_MYBLOCKSADMIN_BLOCKADMIN' , 'Blocks management'); +define( '_MD_A_MYBLOCKSADMIN_NAME' , 'Name'); +define( '_MD_A_MYBLOCKSADMIN_TITLE' , 'Title'); +define( '_MD_A_MYBLOCKSADMIN_SIDE' , 'Side'); +define( '_MD_A_MYBLOCKSADMIN_SBLEFT' , 'o --- - LEFT'); +define( '_MD_A_MYBLOCKSADMIN_SBRIGHT' , '- --- o RIGHT'); +define( '_MD_A_MYBLOCKSADMIN_CBLEFT' , '- o-- - CENTERLEFT'); +define( '_MD_A_MYBLOCKSADMIN_CBRIGHT' , '- --o - CENTERRIGHT'); +define( '_MD_A_MYBLOCKSADMIN_CBCENTER' , '- -o- - CENTER'); +define( '_MD_A_MYBLOCKSADMIN_VISIBLE' , 'Visible'); +define( '_MD_A_MYBLOCKSADMIN_WEIGHT' , 'Weight'); +define( '_MD_A_MYBLOCKSADMIN_VISIBLEIN' , 'Visible in'); +define( '_MD_A_MYBLOCKSADMIN_CONTENT' , 'Content'); +define( '_MD_A_MYBLOCKSADMIN_CAPT_USABLETAGS' , 'Usable tags'); +define( '_MD_A_MYBLOCKSADMIN_FMT_TAGRULE' , '%s will be replaced into %s in the view'); +define( '_MD_A_MYBLOCKSADMIN_CTYPE' , 'Custom Type'); +define( '_MD_A_MYBLOCKSADMIN_EDITTPL' , 'Edit the template'); +define( '_MD_A_MYBLOCKSADMIN_OPTIONS' , 'Block\'s option'); +define( '_MD_A_MYBLOCKSADMIN_BCACHETIME' , 'Cache Time'); +define( '_MD_A_MYBLOCKSADMIN_ACTION' , 'Action'); +define( '_MD_A_MYBLOCKSADMIN_DESCRIPTION' , 'Description'); +define( '_MD_A_MYBLOCKSADMIN_TOPPAGE' , 'Top Page'); +define( '_MD_A_MYBLOCKSADMIN_ALLPAGES' , 'All Pages'); +define( '_MD_A_MYBLOCKSADMIN_PERMFORM' , 'Permissions'); +define( '_MD_A_MYBLOCKSADMIN_PERM_MADMIN' , 'module admin'); +define( '_MD_A_MYBLOCKSADMIN_PERM_MREAD' , 'module read'); +define( '_MD_A_MYBLOCKSADMIN_DBUPDATED' , 'Database updated successfully'); +define( '_MD_A_MYBLOCKSADMIN_FMT_REMOVEBLOCK' , '%s will be deleted. Are you sure to delete this block?'); + + +define( '_MD_A_MYBLOCKSADMIN_CLONEFORM' , 'Copy the block'); +define( '_MD_A_MYBLOCKSADMIN_NEWFORM' , 'Create a block'); +define( '_MD_A_MYBLOCKSADMIN_EDITFORM' , 'Edit the block'); + +define( '_MD_A_MYBLOCKSADMIN_LINK_FORCECLONE' , 'Force Copy'); + +define( '_MD_A_MYBLOCKSADMIN_BTN_CLONE' , 'Copy'); +define( '_MD_A_MYBLOCKSADMIN_BTN_NEW' , 'Create'); +define( '_MD_A_MYBLOCKSADMIN_BTN_EDIT' , 'Update'); + +define( '_MD_A_MYBLOCKSADMIN_CTYPE_HTML' , 'Custom (plain HTML)'); +define( '_MD_A_MYBLOCKSADMIN_CTYPE_NOSMILE' , 'Custom (HTML+BBCODE+AutoLink)'); +define( '_MD_A_MYBLOCKSADMIN_CTYPE_SMILE' , 'Custom (HTML+BBCODE+AutoLink+Smiley)'); +define( '_MD_A_MYBLOCKSADMIN_CTYPE_PHP' , 'Custom (PHP eval())'); + +define( '_MD_A_MYBLOCKSADMIN_NOTICE4COMMONFCK' , 'If you want to use WYSIWYG editor, install common/fckeditor'); // Group permission phrases -define('_MD_A_MYBLOCKSADMIN_PERMADDNG', 'Could not add %s permission to %s for group %s'); -define('_MD_A_MYBLOCKSADMIN_PERMADDOK', 'Added %s permission to %s for group %s'); -define('_MD_A_MYBLOCKSADMIN_PERMRESETNG', 'Could not reset group permission for module %s'); -define('_MD_A_MYBLOCKSADMIN_PERMADDNGP', 'All parent items must be selected.'); +define( '_MD_A_MYBLOCKSADMIN_PERMADDNG' , 'Could not add %s permission to %s for group %s'); +define( '_MD_A_MYBLOCKSADMIN_PERMADDOK' , 'Added %s permission to %s for group %s'); +define( '_MD_A_MYBLOCKSADMIN_PERMRESETNG' , 'Could not reset group permission for module %s'); +define( '_MD_A_MYBLOCKSADMIN_PERMADDNGP' , 'All parent items must be selected.'); diff --git a/xoops_trust_path/libs/altsys/language/english/mylangadmin.php b/xoops_trust_path/libs/altsys/language/english/mylangadmin.php index 5cb823c..818e6fc 100644 --- a/xoops_trust_path/libs/altsys/language/english/mylangadmin.php +++ b/xoops_trust_path/libs/altsys/language/english/mylangadmin.php @@ -1,27 +1,27 @@ + Create a new template set and copy the templates to customize.
+ In the Render, you can select the new Template, edit, copy, download or delete.'); +define( '_MYTPLSADMIN_CREATE_NEW_TPLSET' , 'Create a new set'); +define( '_MYTPLSADMIN_CAPTION_BASE' , 'Base'); +define( '_MYTPLSADMIN_CAPTION_SETNAME' , 'name'); +define( '_MYTPLSADMIN_OPT_BLANKSET' , '(blank)'); +define( '_MYTPLSADMIN_CAPTION_COPYTO' , 'Destination'); +define( '_MYTPLSADMIN_BTN_COPY' , 'Copy'); +define( '_MYTPLSADMIN_TITLE_CHECKALL' , 'Turn on/off all of checkboxes in this row'); +define( '_MYTPLSADMIN_CNF_DELETE_SELECTED_TEMPLATES' , 'All of checked templates in the set(row) will be removed. Are you OK?'); +define( '_MYTPLSADMIN_CNF_COPY_SELECTED_TEMPLATES' , 'All of checked templates in the set(row) will be copied/overwritten into the selected set. Are you OK?'); +define( '_MYTPLSADMIN_TH_SET' , 'Template Set'); +define( '_MYTPLSADMIN_TH_NAME' , 'Template name'); +define( '_MYTPLSADMIN_TH_TYPE' , 'Type'); +define( '_MYTPLSADMIN_TH_FILE' , 'Base file'); +define( '_MYTPLSADMIN_ERR_NOTPLFILE' , 'No template is checked.'); +define( '_MYTPLSADMIN_ERR_INVALIDTPLSET' , 'Destination set is same as source set, or no valid tplset is specified.'); +define( '_MYTPLSADMIN_ERR_CANTREMOVEDEFAULT' , "You can't remove 'default' template."); +define( '_MYTPLSADMIN_ERR_DUPLICATEDSETNAME' , 'The set name already exists.'); +define( '_MYTPLSADMIN_ERR_INVALIDSETNAME' , 'a wrong set name is specified.'); -define('_MYTPLSADMIN_H3_MODULE', 'Module') ; -define('_MYTPLSADMIN_BTN_NEWTPLSET', 'create') ; +define( '_MYTPLSADMIN_H3_MODULE' , 'Module'); +define( '_MYTPLSADMIN_BTN_NEWTPLSET' , 'create'); -define('_MYTPLSADMIN_DBUPDATED', 'Templates updated successfully') ; +define( '_MYTPLSADMIN_DBUPDATED' , 'Templates updated successfully'); -define('_MYTPLSADMIN_CUSTOMTEMPLATE', 'Custom template') ; -define('_MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE', 'Create a new custom template') ; +define( '_MYTPLSADMIN_CUSTOMTEMPLATE' , 'Custom template'); +define( '_MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE' , 'Create a new custom template'); diff --git a/xoops_trust_path/libs/altsys/language/english/mytplsform.php b/xoops_trust_path/libs/altsys/language/english/mytplsform.php index f2b5a91..17f9aa7 100644 --- a/xoops_trust_path/libs/altsys/language/english/mytplsform.php +++ b/xoops_trust_path/libs/altsys/language/english/mytplsform.php @@ -1,11 +1,11 @@ Extract the download archive.
Execute the files which extensions are .mxi and you will meet installing dialogs.
The snippets for template variables of your site will be usable after restarting Dream Weaver.'); + +define( '_TPLSADMIN_DT_GETTEMPLATES' , 'Download templates'); +define( '_TPLSADMIN_DD_GETTEMPLATES' , 'Select a set before pushing either button'); + +define( '_TPLSADMIN_FMT_MSG_PUTTEMPLATES' , '%d templates are imported.'); +define( '_TPLSADMIN_DT_PUTTEMPLATES' , 'Upload templates'); +define( '_TPLSADMIN_DD_PUTTEMPLATES' , "Sélectionner un ensemble de modèles que vous souhaitez remplacer.
Sélectionner le fichier tar comprenant les modèles (.html)
Extraire automatiquement tous les modèles indépendamment de l'arborescence des répertoires."); + + +define( '_TPLSADMIN_ERR_NOTUPLOADED' , 'No files are uploaded.'); +define( '_TPLSADMIN_ERR_EXTENSION' , 'This extension cannot be recognized.'); +define( '_TPLSADMIN_ERR_INVALIDARCHIVE' , 'The archive is not extractable.'); +define( '_TPLSADMIN_ERR_INVALIDTPLSET' , 'Invalid set name has been specified.'); + +define( '_TPLSADMIN_ERR_NOTPLSVARSINFO' , 'There are no template vars info files.'); + +define( '_TPLSADMIN_NUMCAP_COMPILEDCACHES' , 'Compiled template caches'); +define( '_TPLSADMIN_NUMCAP_TPLSVARS' , 'Template vars info files'); diff --git a/xoops_trust_path/libs/altsys/language/fr_utf8/modinfo.php b/xoops_trust_path/libs/altsys/language/fr_utf8/modinfo.php new file mode 100644 index 0000000..13f5db3 --- /dev/null +++ b/xoops_trust_path/libs/altsys/language/fr_utf8/modinfo.php @@ -0,0 +1,37 @@ +include XOOPS_TRUST_PATH.\'/libs/altsys/include/admin_in_theme.inc.php\');
to enable this. This feature works only with XOOPS 2.0.x'); + +define( '_MI_ALTSYS_ENABLEFORCECLONE' , 'Forcer tous les blocs à CLONABLE'); +define( '_MI_ALTSYS_ENABLEFORCECLONEDSC' , 'Vous devriez savoir que l\'utilisation de multiples instances d\'un bloc sur une même page peut provoquer des erreurs d\'affichage'); + +define( '_MI_ALTSYS_IMAGES_DIR' , 'Répertoire pour les fichiers image'); +define( '_MI_ALTSYS_IMAGES_DIRDSC' , 'chemin relatif dans le répertoire du module. par défaut: images'); diff --git a/xoops_trust_path/libs/altsys/language/fr_utf8/myblocksadmin.php b/xoops_trust_path/libs/altsys/language/fr_utf8/myblocksadmin.php new file mode 100644 index 0000000..cacc64e --- /dev/null +++ b/xoops_trust_path/libs/altsys/language/fr_utf8/myblocksadmin.php @@ -0,0 +1,61 @@ + +Un composant unique contient du HTML, du JavaScript et du CSS.
+Les modules sont constitués de plusieurs blocs prédéfinis offrant des fonctionnalités spécifiques et privilégiant la composition plutôt que l'héritage.
+L'éditeur change en fonction du type de contenu."); +define( '_MD_A_MYBLOCKSADMIN_PERMUPDATED' , 'Permissions mises à jour avec succès'); +define( '_MD_A_MYBLOCKSADMIN_BLOCKADMIN' , 'Gestion des blocs'); +define( '_MD_A_MYBLOCKSADMIN_NAME' , 'Nom'); +define( '_MD_A_MYBLOCKSADMIN_TITLE' , 'Titre'); +define( '_MD_A_MYBLOCKSADMIN_SIDE' , 'Emplacement'); +define( '_MD_A_MYBLOCKSADMIN_SBLEFT' , 'o --- - Gauche'); +define( '_MD_A_MYBLOCKSADMIN_SBRIGHT' , '- --- o Droite'); +define( '_MD_A_MYBLOCKSADMIN_CBLEFT' , '- o-- - CENTRE-GAUCHE'); +define( '_MD_A_MYBLOCKSADMIN_CBRIGHT' , '- --o - CENTRE-DROIT'); +define( '_MD_A_MYBLOCKSADMIN_CBCENTER' , '- -o- - CENTRE'); +define( '_MD_A_MYBLOCKSADMIN_VISIBLE' , 'Visible'); +define( '_MD_A_MYBLOCKSADMIN_WEIGHT' , 'Ordre'); +define( '_MD_A_MYBLOCKSADMIN_VISIBLEIN' , 'Visible sur'); +define( '_MD_A_MYBLOCKSADMIN_CONTENT' , 'Contenu'); +define( '_MD_A_MYBLOCKSADMIN_CAPT_USABLETAGS' , 'Tags Utilisables'); +define( '_MD_A_MYBLOCKSADMIN_FMT_TAGRULE' , "%s sera remplacé par %s dans l'affichage"); +define( '_MD_A_MYBLOCKSADMIN_CTYPE' , 'Type personnalisé'); +define( '_MD_A_MYBLOCKSADMIN_EDITTPL' , 'Editer le template'); +define( '_MD_A_MYBLOCKSADMIN_OPTIONS' , 'Option du Bloc'); +define( '_MD_A_MYBLOCKSADMIN_BCACHETIME' , 'Temps du Cache'); +define( '_MD_A_MYBLOCKSADMIN_ACTION' , 'Action'); +define( '_MD_A_MYBLOCKSADMIN_DESCRIPTION' , 'Description'); +define( '_MD_A_MYBLOCKSADMIN_TOPPAGE' , 'Top Page'); +define( '_MD_A_MYBLOCKSADMIN_ALLPAGES' , 'Toutes les Pages'); +define( '_MD_A_MYBLOCKSADMIN_PERMFORM' , 'Permissions'); +define( '_MD_A_MYBLOCKSADMIN_PERM_MADMIN' , 'Admin module'); +define( '_MD_A_MYBLOCKSADMIN_PERM_MREAD' , 'Accés module'); +define( '_MD_A_MYBLOCKSADMIN_DBUPDATED' , 'Mise à jour avec succés de la Base de données'); +define( '_MD_A_MYBLOCKSADMIN_FMT_REMOVEBLOCK' , '%s sera supprimé. Voulez-vous confirmer?'); + + +define( '_MD_A_MYBLOCKSADMIN_CLONEFORM' , 'Copier le bloc'); +define( '_MD_A_MYBLOCKSADMIN_NEWFORM' , 'Créer un bloc'); +define( '_MD_A_MYBLOCKSADMIN_EDITFORM' , 'Editer un bloc'); + +define( '_MD_A_MYBLOCKSADMIN_LINK_FORCECLONE' , 'Forcer copie'); + +define( '_MD_A_MYBLOCKSADMIN_BTN_CLONE' , 'Copier'); +define( '_MD_A_MYBLOCKSADMIN_BTN_NEW' , 'Créer'); +define( '_MD_A_MYBLOCKSADMIN_BTN_EDIT' , 'Mise à jour'); + +define( '_MD_A_MYBLOCKSADMIN_CTYPE_HTML' , 'Personnalisé (HTML)'); +define( '_MD_A_MYBLOCKSADMIN_CTYPE_NOSMILE' , 'HTML+BBCODE+AutoLink'); +define( '_MD_A_MYBLOCKSADMIN_CTYPE_SMILE' , 'HTML+BBCODE+AutoLink+Smiley'); +define( '_MD_A_MYBLOCKSADMIN_CTYPE_PHP' , 'PHP eval()'); + +define( '_MD_A_MYBLOCKSADMIN_NOTICE4COMMONFCK' , "Si vous voulez utiliser l'éditeur WYSIWYG, installez /common/FCKeditor"); + + +// Group permission phrases +define( '_MD_A_MYBLOCKSADMIN_PERMADDNG' , "Impossible d'ajouter %s permissions de %s pour le groupe %s"); +define( '_MD_A_MYBLOCKSADMIN_PERMADDOK' , 'Ajouté %s permissions de %s pour le groupe %s'); +define( '_MD_A_MYBLOCKSADMIN_PERMRESETNG' , 'impossible de supprimer permissions de groupe pour le module %s'); +define( '_MD_A_MYBLOCKSADMIN_PERMADDNGP' , 'Tous les articles de la catégorie parent doivent être sélectionnés.'); diff --git a/xoops_trust_path/libs/altsys/language/fr_utf8/mylangadmin.php b/xoops_trust_path/libs/altsys/language/fr_utf8/mylangadmin.php new file mode 100644 index 0000000..bb1474f --- /dev/null +++ b/xoops_trust_path/libs/altsys/language/fr_utf8/mylangadmin.php @@ -0,0 +1,27 @@ + +Créez un nouveau jeu de modèles et copiez les fichiers modèles à personnaliser.
+Dans le rendu, vous pouvez sélectionner un jeu de modèles, modifier, copier, télécharger ou supprimer.'); +define( '_MYTPLSADMIN_CREATE_NEW_TPLSET' , 'Créer une nouvelle série'); +define( '_MYTPLSADMIN_CAPTION_BASE' , 'Base'); +define( '_MYTPLSADMIN_CAPTION_SETNAME' , 'Nom'); +define( '_MYTPLSADMIN_OPT_BLANKSET' , '(Vide)'); +define( '_MYTPLSADMIN_CAPTION_COPYTO' , 'Destination'); +define( '_MYTPLSADMIN_BTN_COPY' , 'Copier'); +define( '_MYTPLSADMIN_TITLE_CHECKALL' , 'Activer / désactiver toutes les cases de cette ligne'); +define( '_MYTPLSADMIN_CNF_DELETE_SELECTED_TEMPLATES' , "Tous les templates sélectionnés dans l'ensemble (ligne) seront supprimés. Voulez-vous confirmer?"); +define( '_MYTPLSADMIN_CNF_COPY_SELECTED_TEMPLATES' , "Tous les templates sélectionnés dans l'ensemble (ligne) seront copiés/écrasés dans l'ensemble sélectionné. Voulez-vous confirmer?"); +define( '_MYTPLSADMIN_TH_SET' , 'Template Set'); +define( '_MYTPLSADMIN_TH_NAME' , 'Nom template'); +define( '_MYTPLSADMIN_TH_TYPE' , 'Type'); +define( '_MYTPLSADMIN_TH_FILE' , 'Fichier source'); +define( '_MYTPLSADMIN_ERR_NOTPLFILE' , "Aucun template sélectionné."); +define( '_MYTPLSADMIN_ERR_INVALIDTPLSET' , "L'ensemble de destination est le même que la source, ou aucun ensemble de templates n'a été spécifié."); +define( '_MYTPLSADMIN_ERR_CANTREMOVEDEFAULT' , "Vous ne pouvez pas supprimer l'ensemble 'default'."); +define( '_MYTPLSADMIN_ERR_DUPLICATEDSETNAME' , "Ce nom d'ensemble de templates existe déjà."); +define( '_MYTPLSADMIN_ERR_INVALIDSETNAME' , "un mauvais nom d'ensemble de templates a été spécifié."); +define( '_MYTPLSADMIN_H3_MODULE' , 'Module'); +define( '_MYTPLSADMIN_BTN_NEWTPLSET' , 'Créer'); +define( '_MYTPLSADMIN_DBUPDATED' , 'Mise à jour avec succés des Templates'); +define( '_MYTPLSADMIN_CUSTOMTEMPLATE' , 'Template personnalisé'); +define( '_MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE' , 'Créer un nouveau template personnalisé'); diff --git a/xoops_trust_path/libs/altsys/language/fr_utf8/mytplsform.php b/xoops_trust_path/libs/altsys/language/fr_utf8/mytplsform.php new file mode 100644 index 0000000..f08ddaa --- /dev/null +++ b/xoops_trust_path/libs/altsys/language/fr_utf8/mytplsform.php @@ -0,0 +1,11 @@ +Extract the download archive.
Execute the files which extensions are .mxi and you will meet installing dialogs.
The snippets for template variables of your site will be usable after restarting Dream Weaver.') ; - -define('_TPLSADMIN_DT_GETTEMPLATES', 'Download templates') ; -define('_TPLSADMIN_DD_GETTEMPLATES', 'Select a set before pushing either button') ; - -define('_TPLSADMIN_FMT_MSG_PUTTEMPLATES', '%d templates are imported.') ; -define('_TPLSADMIN_DT_PUTTEMPLATES', 'Upload templates') ; -define('_TPLSADMIN_DD_PUTTEMPLATES', 'Select a set you want to upload/overwrite before uploading zip/tgz archive including template files (.html). You need not to check depths of the paths in the archive.') ; - - -define('_TPLSADMIN_ERR_NOTUPLOADED', 'No files are uploaded.') ; -define('_TPLSADMIN_ERR_EXTENSION', 'This extension cannot be recognized.') ; -define('_TPLSADMIN_ERR_INVALIDARCHIVE', 'The archive is not extractable.') ; -define('_TPLSADMIN_ERR_INVALIDTPLSET', 'Invalid set name has been specified.') ; - -define('_TPLSADMIN_ERR_NOTPLSVARSINFO', 'There are no template vars info files.') ; - -define('_TPLSADMIN_NUMCAP_COMPILEDCACHES', 'Compiled template caches') ; -define('_TPLSADMIN_NUMCAP_TPLSVARS', 'Template vars info files') ; diff --git a/xoops_trust_path/libs/altsys/language/french/modinfo.php b/xoops_trust_path/libs/altsys/language/french/modinfo.php deleted file mode 100644 index 8432394..0000000 --- a/xoops_trust_path/libs/altsys/language/french/modinfo.php +++ /dev/null @@ -1,37 +0,0 @@ -include XOOPS_TRUST_PATH.\'/libs/altsys/include/admin_in_theme.inc.php\';
to enable this. This feature works only with XOOPS 2.0.x') ; - -define('_MI_ALTSYS_ENABLEFORCECLONE', 'Forcer tous les blocs CLONABLE') ; -define('_MI_ALTSYS_ENABLEFORCECLONEDSC', 'Vous devriez savoir que l\'utilisation de multiples instances d\'un bloc sur une mme page peut provoquer des erreurs d\'affichage') ; - -define('_MI_ALTSYS_IMAGES_DIR', 'Rpertoire pour les fichiers image'); -define('_MI_ALTSYS_IMAGES_DIRDSC', 'chemin relatif dans le rpertoire du module. par dfaut: images'); diff --git a/xoops_trust_path/libs/altsys/language/french/myblocksadmin.php b/xoops_trust_path/libs/altsys/language/french/myblocksadmin.php deleted file mode 100644 index 0517216..0000000 --- a/xoops_trust_path/libs/altsys/language/french/myblocksadmin.php +++ /dev/null @@ -1,56 +0,0 @@ -Extract the download archive.
Execute the files which extensions are .mxi and you will meet installing dialogs.
The snippets for template variables of your site will be usable after restarting Dream Weaver.') ; - -define('_TPLSADMIN_DT_GETTEMPLATES', 'Download Templates') ; -define('_TPLSADMIN_DD_GETTEMPLATES', 'Select a set before pushing either button') ; - -define('_TPLSADMIN_FMT_MSG_PUTTEMPLATES', '%d Templates wurde importiert.') ; -define('_TPLSADMIN_DT_PUTTEMPLATES', 'Upload Templates') ; -define('_TPLSADMIN_DD_PUTTEMPLATES', 'Select a set you want to upload/overwrite before uploading zip/tgz archive including template files (.html). You need not to check depths of the paths in the archive.') ; - - -define('_TPLSADMIN_ERR_NOTUPLOADED', 'Es wurden keine Daten hochgeladen.') ; -define('_TPLSADMIN_ERR_EXTENSION', 'Die Dateierweiterung konnte nicht erkannt werden.') ; -define('_TPLSADMIN_ERR_INVALIDARCHIVE', 'Das Archiv kann nicht entpackt werden.') ; -define('_TPLSADMIN_ERR_INVALIDTPLSET', 'Invalid set name has been specified.') ; - -define('_TPLSADMIN_ERR_NOTPLSVARSINFO', 'There are no template vars info files.') ; - -define('_TPLSADMIN_NUMCAP_COMPILEDCACHES', 'Compiled template caches') ; -define('_TPLSADMIN_NUMCAP_TPLSVARS', 'Template vars info files') ; diff --git a/xoops_trust_path/libs/altsys/language/german/modinfo.php b/xoops_trust_path/libs/altsys/language/german/modinfo.php deleted file mode 100644 index bbc565f..0000000 --- a/xoops_trust_path/libs/altsys/language/german/modinfo.php +++ /dev/null @@ -1,37 +0,0 @@ -include XOOPS_TRUST_PATH.\'/libs/altsys/include/admin_in_theme.inc.php\';
to enable this. This feature works only with XOOPS 2.0.x') ; - -define('_MI_ALTSYS_ENABLEFORCECLONE', 'Force all blocks to be clonable') ; -define('_MI_ALTSYS_ENABLEFORCECLONEDSC', 'You should know there are blocks cause errors if multiple instances is displayed on a page') ; - -define('_MI_ALTSYS_IMAGES_DIR', 'Directory for image files'); -define('_MI_ALTSYS_IMAGES_DIRDSC', 'relative path should be set in the module directory. default: images'); diff --git a/xoops_trust_path/libs/altsys/language/german/myblocksadmin.php b/xoops_trust_path/libs/altsys/language/german/myblocksadmin.php deleted file mode 100644 index 8062b98..0000000 --- a/xoops_trust_path/libs/altsys/language/german/myblocksadmin.php +++ /dev/null @@ -1,58 +0,0 @@ -ダウンロードしたファイルを解凍して、拡張子mxiのファイルを実行することで、お使いのDreamWeaverにExtensionとしてインストールされます。DreamWeaver再起動後に、Snippetから利用できます。') ; +define( '_TPLSADMIN_DT_GETTPLSVARSINFO_DW' , 'テンプレート変数情報をDreamWeaver用に取得する'); +define( '_TPLSADMIN_DD_GETTPLSVARSINFO_DW' , 'まずは Macromedia Extension Manager がインストールされていることを確認し、起動しておいてください。
ダウンロードしたファイルを解凍して、拡張子mxiのファイルを実行することで、お使いのDreamWeaverにExtensionとしてインストールされます。DreamWeaver再起動後に、Snippetから利用できます。'); -define('_TPLSADMIN_DT_GETTEMPLATES', 'テンプレートをダウンロードする') ; -define('_TPLSADMIN_DD_GETTEMPLATES', 'テンプレートセットを選択してから、希望のアーカイブタイプボタンを押してください') ; +define( '_TPLSADMIN_DT_GETTEMPLATES' , 'テンプレートをダウンロードする'); +define( '_TPLSADMIN_DD_GETTEMPLATES' , 'テンプレートセットを選択してから、希望のアーカイブタイプボタンを押してください'); -define('_TPLSADMIN_FMT_MSG_PUTTEMPLATES', '%d 個のテンプレートをインポートしました') ; -define('_TPLSADMIN_DT_PUTTEMPLATES', 'テンプレートをアップロードする') ; -define('_TPLSADMIN_DD_PUTTEMPLATES', '上書きしたいテンプレートセットを選択してから、各テンプレートファイル(.html)をzipかtar.gzにくるんでアップロードしてください。テンプレートファイル名さえ正しければ、パスの深さは気にしなくて構いません') ; +define( '_TPLSADMIN_FMT_MSG_PUTTEMPLATES' , '%d 個のテンプレートをインポートしました'); +define( '_TPLSADMIN_DT_PUTTEMPLATES' , 'テンプレートをアップロードする'); +define( '_TPLSADMIN_DD_PUTTEMPLATES' , '置き換える一連のテンプレートを選択します。
テンプレート (.html) を含む tar ファイルを選択します。
ディレクトリ ツリー構造に関係なく、すべてのテンプレートを自動的に抽出します。'); -define('_TPLSADMIN_ERR_NOTUPLOADED', 'ファイルがアップロードされていません') ; -define('_TPLSADMIN_ERR_EXTENSION', '未対応のファイル種別です') ; -define('_TPLSADMIN_ERR_INVALIDARCHIVE', 'アーカイブから読み出せません') ; -define('_TPLSADMIN_ERR_INVALIDTPLSET', 'テンプレートセット指定が不正です') ; +define( '_TPLSADMIN_ERR_NOTUPLOADED' , 'ファイルがアップロードされていません'); +define( '_TPLSADMIN_ERR_EXTENSION' , '未対応のファイル種別です'); +define( '_TPLSADMIN_ERR_INVALIDARCHIVE' , 'アーカイブから読み出せません'); +define( '_TPLSADMIN_ERR_INVALIDTPLSET' , 'テンプレートセット指定が不正です'); -define('_TPLSADMIN_ERR_NOTPLSVARSINFO', 'テンプレート変数情報ファイルが作成されていません') ; +define( '_TPLSADMIN_ERR_NOTPLSVARSINFO' , 'テンプレート変数情報ファイルが作成されていません'); -define('_TPLSADMIN_NUMCAP_COMPILEDCACHES', 'コンパイル済テンプレートキャッシュ') ; -define('_TPLSADMIN_NUMCAP_TPLSVARS', 'テンプレート変数情報ファイル') ; +define( '_TPLSADMIN_NUMCAP_COMPILEDCACHES' , 'コンパイル済テンプレートキャッシュ'); +define( '_TPLSADMIN_NUMCAP_TPLSVARS' , 'テンプレート変数情報ファイル'); diff --git a/xoops_trust_path/libs/altsys/language/ja_utf8/modinfo.php b/xoops_trust_path/libs/altsys/language/ja_utf8/modinfo.php index cb3420d..06f6d21 100644 --- a/xoops_trust_path/libs/altsys/language/ja_utf8/modinfo.php +++ b/xoops_trust_path/libs/altsys/language/ja_utf8/modinfo.php @@ -1,37 +1,37 @@ include XOOPS_TRUST_PATH.\'/libs/altsys/include/admin_in_theme.inc.php\';
の1行を挿入する必要があります') ; +define( '_MI_ALTSYS_ADMIN_IN_THEME' , '管理画面用テーマ'); +define( '_MI_ALTSYS_ADMIN_IN_THEMEDSC' , '管理画面を表示するテーマ名を指定します。XOOPS 2.0.x 以外では有効になりません。また、mainfile.phpのcommon.php行直後に、
include XOOPS_TRUST_PATH.\'/libs/altsys/include/admin_in_theme.inc.php\');
の1行を挿入する必要があります'); -define('_MI_ALTSYS_ENABLEFORCECLONE', '全ブロックを複製可能とする') ; -define('_MI_ALTSYS_ENABLEFORCECLONEDSC', '全てのモジュール所属ブロックを複製可能であると見なします。同時に複数個表示するとおかしくなるブロックがある点には注意が必要です') ; +define( '_MI_ALTSYS_ENABLEFORCECLONE' , '全ブロックを複製可能とする'); +define( '_MI_ALTSYS_ENABLEFORCECLONEDSC' , '全てのモジュール所属ブロックを複製可能であると見なします。同時に複数個表示するとおかしくなるブロックがある点には注意が必要です'); -define('_MI_ALTSYS_IMAGES_DIR', 'イメージファイルディレクトリ'); -define('_MI_ALTSYS_IMAGES_DIRDSC', 'このモジュール用のイメージが格納されたディレクトリをモジュールディレクトリからの相対パスで指定します。デフォルトはimagesです。'); +define( '_MI_ALTSYS_IMAGES_DIR' , 'イメージファイルディレクトリ'); +define( '_MI_ALTSYS_IMAGES_DIRDSC' , 'このモジュール用のイメージが格納されたディレクトリをモジュールディレクトリからの相対パスで指定します。デフォルトはimagesです。'); diff --git a/xoops_trust_path/libs/altsys/language/ja_utf8/myblocksadmin.php b/xoops_trust_path/libs/altsys/language/ja_utf8/myblocksadmin.php index 13e1831..358de11 100644 --- a/xoops_trust_path/libs/altsys/language/ja_utf8/myblocksadmin.php +++ b/xoops_trust_path/libs/altsys/language/ja_utf8/myblocksadmin.php @@ -1,56 +1,60 @@ +一つのコンポーネントはHTML、JavaScript、CSSを含んでいます。
+モジュールは、特定の機能を提供し、継承よりも構成を優先するいくつかの事前構築されたブロックを持ちます。
+エディタは、コンテンツの種類に応じて変化します。'); +define( '_MD_A_MYBLOCKSADMIN_PERMUPDATED' , '権限を更新しました'); +define( '_MD_A_MYBLOCKSADMIN_BLOCKADMIN' , 'ブロック管理'); +define( '_MD_A_MYBLOCKSADMIN_NAME' , '名称'); +define( '_MD_A_MYBLOCKSADMIN_TITLE' , 'タイトル'); +define( '_MD_A_MYBLOCKSADMIN_SIDE' , '表示サイド'); +define( '_MD_A_MYBLOCKSADMIN_SBLEFT' , 'o --- - 左'); +define( '_MD_A_MYBLOCKSADMIN_SBRIGHT' , '- --- o 右'); +define( '_MD_A_MYBLOCKSADMIN_CBLEFT' , '- o-- - 中央左'); +define( '_MD_A_MYBLOCKSADMIN_CBRIGHT' , '- --o - 中央右'); +define( '_MD_A_MYBLOCKSADMIN_CBCENTER' , '- -o- - 中央'); +define( '_MD_A_MYBLOCKSADMIN_VISIBLE' , '表示ON/OFF'); +define( '_MD_A_MYBLOCKSADMIN_WEIGHT' , '優先度'); +define( '_MD_A_MYBLOCKSADMIN_VISIBLEIN' , '表示対象'); +define( '_MD_A_MYBLOCKSADMIN_CONTENT' , 'コンテンツ'); +define( '_MD_A_MYBLOCKSADMIN_CAPT_USABLETAGS' , '使用可能なタグ'); +define( '_MD_A_MYBLOCKSADMIN_FMT_TAGRULE' , '%s は %s に変換されます'); +define( '_MD_A_MYBLOCKSADMIN_CTYPE' , 'カスタムブロックの種類'); +define( '_MD_A_MYBLOCKSADMIN_EDITTPL' , 'このブロックのテンプレートを編集する'); +define( '_MD_A_MYBLOCKSADMIN_OPTIONS' , 'ブロックオプション'); +define( '_MD_A_MYBLOCKSADMIN_BCACHETIME' , 'キャッシュ'); +define( '_MD_A_MYBLOCKSADMIN_ACTION' , '操作'); +define( '_MD_A_MYBLOCKSADMIN_DESCRIPTION' , '説明'); +define( '_MD_A_MYBLOCKSADMIN_TOPPAGE' , 'トップページ'); +define( '_MD_A_MYBLOCKSADMIN_ALLPAGES' , '全ページ'); +define( '_MD_A_MYBLOCKSADMIN_PERMFORM' , 'アクセス権限設定'); +define( '_MD_A_MYBLOCKSADMIN_PERM_MADMIN' , 'モジュール管理者権限'); +define( '_MD_A_MYBLOCKSADMIN_PERM_MREAD' , 'モジュールアクセス権限'); +define( '_MD_A_MYBLOCKSADMIN_DBUPDATED' , 'データベースを更新しました'); +define( '_MD_A_MYBLOCKSADMIN_FMT_REMOVEBLOCK' , 'このブロック「 %s 」を本当に削除してよろしいですか?'); + + +define( '_MD_A_MYBLOCKSADMIN_CLONEFORM' , 'ブロックの複製'); +define( '_MD_A_MYBLOCKSADMIN_NEWFORM' , 'ブロックの新規作成'); +define( '_MD_A_MYBLOCKSADMIN_EDITFORM' , 'ブロックの編集'); + +define( '_MD_A_MYBLOCKSADMIN_LINK_FORCECLONE' , '強制複製'); + +define( '_MD_A_MYBLOCKSADMIN_BTN_CLONE' , '複製実行'); +define( '_MD_A_MYBLOCKSADMIN_BTN_NEW' , '新規作成'); +define( '_MD_A_MYBLOCKSADMIN_BTN_EDIT' , '更新実行'); + +define( '_MD_A_MYBLOCKSADMIN_CTYPE_HTML' , 'カスタムHTML(無変換)'); +define( '_MD_A_MYBLOCKSADMIN_CTYPE_NOSMILE' , 'カスタム(HTML+BBCODE変換+自動リンク)'); +define( '_MD_A_MYBLOCKSADMIN_CTYPE_SMILE' , 'カスタム(HTML+BBCODE変換+自動リンク+顔アイコン)'); +define( '_MD_A_MYBLOCKSADMIN_CTYPE_PHP' , 'カスタム(PHP eval())'); + +define( '_MD_A_MYBLOCKSADMIN_NOTICE4COMMONFCK' , 'common/fckeditorを入れることでWYSIWYGエディタを利用できます'); // Group permission phrases -define('_MD_A_MYBLOCKSADMIN_PERMADDNG', 'グループ・パーミッションの追加に失敗しました(パーミッション名:%s 対象アイテム:%s 対象グループ:%s)'); -define('_MD_A_MYBLOCKSADMIN_PERMADDOK', 'グループ・パーミッションを追加しました(パーミッション名:%s 対象アイテム:%s 対象グループ:%s)'); -define('_MD_A_MYBLOCKSADMIN_PERMRESETNG', '「%s」モジュールのグループ・パーミッション設定の初期化に失敗しました'); -define('_MD_A_MYBLOCKSADMIN_PERMADDNGP', 'このアイテムの上位アイテム全てにパーミッションを与える必要があります'); +define( '_MD_A_MYBLOCKSADMIN_PERMADDNG' , 'グループ・パーミッションの追加に失敗しました(パーミッション名:%s 対象アイテム:%s 対象グループ:%s)'); +define( '_MD_A_MYBLOCKSADMIN_PERMADDOK' , 'グループ・パーミッションを追加しました(パーミッション名:%s 対象アイテム:%s 対象グループ:%s)'); +define( '_MD_A_MYBLOCKSADMIN_PERMRESETNG' , '「%s」モジュールのグループ・パーミッション設定の初期化に失敗しました'); +define( '_MD_A_MYBLOCKSADMIN_PERMADDNGP' , 'このアイテムの上位アイテム全てにパーミッションを与える必要があります'); diff --git a/xoops_trust_path/libs/altsys/language/ja_utf8/mylangadmin.php b/xoops_trust_path/libs/altsys/language/ja_utf8/mylangadmin.php index 0736c04..1c93e87 100644 --- a/xoops_trust_path/libs/altsys/language/ja_utf8/mylangadmin.php +++ b/xoops_trust_path/libs/altsys/language/ja_utf8/mylangadmin.php @@ -1,27 +1,27 @@ +新しいテンプレートセットを作成し、カスタマイズするテンプレートをコピーします。
+Renderでは、新しいTemplateを選択し、編集、コピー、ダウンロード、削除することができます。'); +define( '_MYTPLSADMIN_CREATE_NEW_TPLSET' , '新規にテンプレートセットを作成する'); +define( '_MYTPLSADMIN_CAPTION_BASE' , 'ベース'); +define( '_MYTPLSADMIN_CAPTION_SETNAME' , 'セット名'); +define( '_MYTPLSADMIN_OPT_BLANKSET' , '(空)'); +define( '_MYTPLSADMIN_CAPTION_COPYTO' , '行先'); +define( '_MYTPLSADMIN_BTN_COPY' , 'コピー'); +define( '_MYTPLSADMIN_TITLE_CHECKALL' , 'この縦一列のチェックボックスすべてをON/OFFします'); +define( '_MYTPLSADMIN_CNF_DELETE_SELECTED_TEMPLATES' , 'このセット(縦一列)内のチェックされたテンプレートを削除します。よろしいですか?'); +define( '_MYTPLSADMIN_CNF_COPY_SELECTED_TEMPLATES' , 'このセット(縦一列)内のチェックされたテンプレートを下のセレクトボックスで指示されたセットにコピーします。よろしいですか?'); +define( '_MYTPLSADMIN_TH_SET' , 'Template Set'); +define( '_MYTPLSADMIN_TH_NAME' , 'テンプレート名'); +define( '_MYTPLSADMIN_TH_TYPE' , 'タイプ'); +define( '_MYTPLSADMIN_TH_FILE' , 'オリジナルファイル'); +define( '_MYTPLSADMIN_ERR_NOTPLFILE' , 'テンプレートが一つもチェックされていません'); +define( '_MYTPLSADMIN_ERR_INVALIDTPLSET' , 'コピー先セットが指定されていないか、コピー元セットとコピー先セットが同一です'); +define( '_MYTPLSADMIN_ERR_CANTREMOVEDEFAULT' , 'defaultセットからテンプレートは削除できません'); +define( '_MYTPLSADMIN_ERR_DUPLICATEDSETNAME' , '指定されたセット名はすでに存在しています'); +define( '_MYTPLSADMIN_ERR_INVALIDSETNAME' , '指定されたセット名は、長すぎるか、使用できないキャラクターが含まれています'); -define('_MYTPLSADMIN_H3_MODULE', 'テンプレート操作対象モジュール') ; -define('_MYTPLSADMIN_BTN_NEWTPLSET', '新規作成') ; +define( '_MYTPLSADMIN_H3_MODULE' , 'テンプレート操作対象モジュール'); +define( '_MYTPLSADMIN_BTN_NEWTPLSET' , '新規作成'); -define('_MYTPLSADMIN_DBUPDATED', 'テンプレートを更新しました') ; +define( '_MYTPLSADMIN_DBUPDATED' , 'テンプレートを更新しました'); -define('_MYTPLSADMIN_CUSTOMTEMPLATE', 'カスタムテンプレート') ; -define('_MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE', '新規カスタムテンプレート作成') ; +define( '_MYTPLSADMIN_CUSTOMTEMPLATE' , 'カスタムテンプレート'); +define( '_MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE' , '新規カスタムテンプレート作成'); diff --git a/xoops_trust_path/libs/altsys/language/ja_utf8/mytplsform.php b/xoops_trust_path/libs/altsys/language/ja_utf8/mytplsform.php index fb902fa..f7bfcdf 100644 --- a/xoops_trust_path/libs/altsys/language/ja_utf8/mytplsform.php +++ b/xoops_trust_path/libs/altsys/language/ja_utf8/mytplsform.php @@ -1,11 +1,11 @@ ɤեषơĥmxiΥե¹Ԥ뤳ȤǡȤDreamWeaverExtensionȤƥ󥹥ȡ뤵ޤDreamWeaverƵưˡSnippetѤǤޤ') ; - -define('_TPLSADMIN_DT_GETTEMPLATES', 'ƥץ졼Ȥɤ') ; -define('_TPLSADMIN_DD_GETTEMPLATES', 'ƥץ졼ȥåȤ򤷤Ƥ顢˾Υ֥ץܥ򲡤Ƥ') ; - -define('_TPLSADMIN_FMT_MSG_PUTTEMPLATES', '%d ĤΥƥץ졼Ȥ򥤥ݡȤޤ') ; -define('_TPLSADMIN_DT_PUTTEMPLATES', 'ƥץ졼Ȥ򥢥åץɤ') ; -define('_TPLSADMIN_DD_PUTTEMPLATES', '񤭤ƥץ졼ȥåȤ򤷤Ƥ顢ƥƥץ졼ȥե(.html)ziptar.gzˤǥåץɤƤƥץ졼ȥե̾Сѥοϵˤʤƹޤ') ; - - -define('_TPLSADMIN_ERR_NOTUPLOADED', 'ե뤬åץɤƤޤ') ; -define('_TPLSADMIN_ERR_EXTENSION', '̤бΥե̤Ǥ') ; -define('_TPLSADMIN_ERR_INVALIDARCHIVE', '֤ɤ߽Фޤ') ; -define('_TPLSADMIN_ERR_INVALIDTPLSET', 'ƥץ졼ȥåȻ꤬Ǥ') ; - -define('_TPLSADMIN_ERR_NOTPLSVARSINFO', 'ƥץ졼ѿե뤬Ƥޤ') ; - -define('_TPLSADMIN_NUMCAP_COMPILEDCACHES', 'ѥѥƥץ졼ȥå') ; -define('_TPLSADMIN_NUMCAP_TPLSVARS', 'ƥץ졼ѿե') ; diff --git a/xoops_trust_path/libs/altsys/language/japanese/modinfo.php b/xoops_trust_path/libs/altsys/language/japanese/modinfo.php deleted file mode 100644 index a0535b3..0000000 --- a/xoops_trust_path/libs/altsys/language/japanese/modinfo.php +++ /dev/null @@ -1,37 +0,0 @@ -include XOOPS_TRUST_PATH.\'/libs/altsys/include/admin_in_theme.inc.php\';
ΣԤɬפޤ') ; - -define('_MI_ALTSYS_ENABLEFORCECLONE', '֥åʣǽȤ') ; -define('_MI_ALTSYS_ENABLEFORCECLONEDSC', 'ƤΥ⥸塼°֥åʣǽǤȸʤޤƱʣɽȤʤ֥åˤդɬפǤ') ; - -define('_MI_ALTSYS_IMAGES_DIR', '᡼եǥ쥯ȥ'); -define('_MI_ALTSYS_IMAGES_DIRDSC', 'Υ⥸塼ѤΥ᡼Ǽ줿ǥ쥯ȥ⥸塼ǥ쥯ȥ꤫ХѥǻꤷޤǥեȤimagesǤ'); diff --git a/xoops_trust_path/libs/altsys/language/japanese/myblocksadmin.php b/xoops_trust_path/libs/altsys/language/japanese/myblocksadmin.php deleted file mode 100644 index 43e23f3..0000000 --- a/xoops_trust_path/libs/altsys/language/japanese/myblocksadmin.php +++ /dev/null @@ -1,56 +0,0 @@ - -* @author voltan -* @version $Id$ -*/ - -define('_MD_A_DBUPDATED', 'پایگاه داده‌ها با موفقیت به روز شد') ; diff --git a/xoops_trust_path/libs/altsys/language/persian/admin_in_theme.php b/xoops_trust_path/libs/altsys/language/persian/admin_in_theme.php deleted file mode 100644 index 100a606..0000000 --- a/xoops_trust_path/libs/altsys/language/persian/admin_in_theme.php +++ /dev/null @@ -1,16 +0,0 @@ - -* @author voltan -* @version $Id$ -*/ - -define('_MD_A_AINTHEME_FMT_PUBLICTOP', 'برترین %s برای کاربران') ; -define('_MD_A_AINTHEME_FMT_ADMINTOP', 'برترین %s برای مدیران') ; diff --git a/xoops_trust_path/libs/altsys/language/persian/blocks_common.php b/xoops_trust_path/libs/altsys/language/persian/blocks_common.php deleted file mode 100644 index 3a3c45f..0000000 --- a/xoops_trust_path/libs/altsys/language/persian/blocks_common.php +++ /dev/null @@ -1,18 +0,0 @@ - -* @author voltan -* @version $Id$ -*/ -// definitions for editing blocks - -// Appended by Xoops Language Checker -GIJOE- in 2007-05-07 18:10:30 -define('_MB_ALTSYS_OPENCLOSE', 'باز/ بسته کردن'); - -define("_MB_ALTSYS_THISTEMPLATE", "الگوی این بلوک"); diff --git a/xoops_trust_path/libs/altsys/language/persian/blocks_each.php b/xoops_trust_path/libs/altsys/language/persian/blocks_each.php deleted file mode 100644 index a983a81..0000000 --- a/xoops_trust_path/libs/altsys/language/persian/blocks_each.php +++ /dev/null @@ -1,25 +0,0 @@ - -* @author voltan -* @version $Id$ -*/ - -if (defined('FOR_XOOPS_LANG_CHECKER')) { - $mydirname = 'd3forum' ; -} -$constpref = '_MB_' . strtoupper($mydirname) ; - -if (defined('FOR_XOOPS_LANG_CHECKER') || ! defined($constpref.'_LOADED')) { - define($constpref.'_LOADED', 1) ; - -// definitions for displaying blocks -// Since altsys is a singleton moudle, this file has non-sense. -} diff --git a/xoops_trust_path/libs/altsys/language/persian/compilehookadmin.php b/xoops_trust_path/libs/altsys/language/persian/compilehookadmin.php deleted file mode 100644 index 50caf70..0000000 --- a/xoops_trust_path/libs/altsys/language/persian/compilehookadmin.php +++ /dev/null @@ -1,62 +0,0 @@ - -* @author voltan -* @version $Id$ -*/ - -define('_TPLSADMIN_FMT_MSG_ENCLOSEBYCOMMENT', '%d ذخیره‌سازِ الگو با نظرات مدیر الگوها بسته شدند') ; -define('_TPLSADMIN_DT_ENCLOSEBYCOMMENT', 'القا کردن نظرات') ; -define('_TPLSADMIN_DD_ENCLOSEBYCOMMENT', 'Two HTML comments will be implanted in the begging/ending point of each templates. Since this rarely breaks its design, it is recommended to professionals can read HTML itself') ; -define('_TPLSADMIN_CNF_ENCLOSEBYCOMMENT', 'Compiled template caches will be enclosed by tplsadmin comments. Are you OK?') ; - - -define('_TPLSADMIN_FMT_MSG_ENCLOSEBYBORDEREDDIV', '%d ذخیره‌سازِ الگو با تگ‌های "div" بسته شدند') ; -define('_TPLSADMIN_DT_ENCLOSEBYBORDEREDDIV', 'القا کردن تگ‌های "div"') ; -define('_TPLSADMIN_DD_ENCLOSEBYBORDEREDDIV', 'Each templates will be enclosed by black-bordered div tags. A link for editing controller of tplsadmin will be implanted into each templates. Though this often cause destructions in designing, you can edit each templates the most instictively and easily.') ; -define('_TPLSADMIN_CNF_ENCLOSEBYBORDEREDDIV', 'Compiled template caches will be enclosed by div tags. Are you OK?') ; - -define('_TPLSADMIN_FMT_MSG_HOOKSAVEVARS', '%d template caches have been implanted hooking logics to collect template varibles') ; -define('_TPLSADMIN_DT_HOOKSAVEVARS', 'Implant logics to collect template variables') ; -define('_TPLSADMIN_DD_HOOKSAVEVARS', 'The first step of getting the informations of template variables in your site. The template vars infos will be collected when public sides of your site is displayed. If all templates you want to edit are displayed, get template vars info by underlying buttons.') ; -define('_TPLSADMIN_CNF_HOOKSAVEVARS', 'Compiled template caches will be implanted the logics to collect template variables. Are you OK?') ; - -define('_TPLSADMIN_FMT_MSG_REMOVEHOOKS', '%d template caches have been normalized') ; -define('_TPLSADMIN_DT_REMOVEHOOKS', 'معمولی‌سازی پرونده‌های ذخیره‌ساز الگوها') ; -define('_TPLSADMIN_DD_REMOVEHOOKS', 'This removes comments/div tags/logics implanted by upper operations from each compiled template caches.') ; -define('_TPLSADMIN_CNF_REMOVEHOOKS', 'آیا با معمولی‌سازی موافقت می کنید؟') ; - - -define('_TPLSADMIN_MSG_CLEARCACHE', 'ذحیره‌ساز الگو پاک شد') ; -define('_TPLSADMIN_MSG_CREATECOMPILECACHEFIRST', 'There are no compiled template caches. Create complied template caches by displaying public sides of your site, first') ; - -define('_TPLSADMIN_CNF_DELETEOK', 'آیا حذف شود؟') ; - - -define('_TPLSADMIN_DT_GETTPLSVARSINFO_DW', 'Get info of template variables as DreamWeaver Extensions') ; -define('_TPLSADMIN_DD_GETTPLSVARSINFO_DW', 'Open Macromedia Extension Manager, first.
Extract the download archive.
Execute the files which extensions are .mxi and you will meet installing dialogs.
The snippets for template variables of your site will be usable after restarting Dream Weaver.') ; - -define('_TPLSADMIN_DT_GETTEMPLATES', 'دریافت الگو') ; -define('_TPLSADMIN_DD_GETTEMPLATES', 'پیش از کلیک بروی هرگونه دکمه، یک دسته را انتخاب کنید') ; - -define('_TPLSADMIN_FMT_MSG_PUTTEMPLATES', '%d الگو وارد شد.') ; -define('_TPLSADMIN_DT_PUTTEMPLATES', 'بارگذاری الگو') ; -define('_TPLSADMIN_DD_PUTTEMPLATES', 'Select a set you want to upload/overwrite before uploading zip/tgz archive including template files (.html). You need not to check depths of the paths in the archive.') ; - - -define('_TPLSADMIN_ERR_NOTUPLOADED', 'هیچ فایلی بارگذاری نشده است') ; -define('_TPLSADMIN_ERR_EXTENSION', 'این پسوند قابل تشخیص نمی باشد.') ; -define('_TPLSADMIN_ERR_INVALIDARCHIVE', 'این آرشیو قابل استخراج شدن نمی باشد.') ; -define('_TPLSADMIN_ERR_INVALIDTPLSET', 'نام دسته غیر مجاز می باشد.') ; - -define('_TPLSADMIN_ERR_NOTPLSVARSINFO', 'هیچ پرونده‌ای برای اطلاعات متغیرهای الگوها وجود ندارد.') ; - -define('_TPLSADMIN_NUMCAP_COMPILEDCACHES', 'ذحیره‌سازی‌های الگو گردآوری شدند') ; -define('_TPLSADMIN_NUMCAP_TPLSVARS', 'پرونده‌های اطلاعات متغیرهای الگوها') ; diff --git a/xoops_trust_path/libs/altsys/language/persian/modinfo.php b/xoops_trust_path/libs/altsys/language/persian/modinfo.php deleted file mode 100644 index 88f0788..0000000 --- a/xoops_trust_path/libs/altsys/language/persian/modinfo.php +++ /dev/null @@ -1,48 +0,0 @@ - -* @author voltan -* @version $Id$ -*/ -// Appended by Xoops Language Checker -GIJOE- in 2007-05-11 17:24:39 -define('_MI_ALTSYS_ENABLEFORCECLONE', 'اجبار تمام بلوک‌ها به تکثیر شدن'); -define('_MI_ALTSYS_ENABLEFORCECLONEDSC', 'شما باید بدانید چندین خطا در ذخریه‌های بلوک‌ها وجود خواهد داشت اگر شما از چند بلوک یک شکل در یک صفحه استفاده کنید'); - -// Appended by Xoops Language Checker -GIJOE- in 2007-05-10 17:21:59 -define('_MI_ALTSYS_MENU_MYLANGADMIN', 'زبان‌ها'); -define('_MI_ALTSYS_MENU_ADVANCEDLANGADMIN', 'زبان‌های پیشرفته'); - -// Appended by Xoops Language Checker -GIJOE- in 2007-03-26 17:09:10 -define('_MI_ALTSYS_BNAME_ADMIN_MENU', 'منوی مدیریت'); -define('_MI_ALTSYS_IMAGES_DIR', 'شاخه برای تصاویر'); -define('_MI_ALTSYS_IMAGES_DIRDSC', 'مسیر وابسته برای ارسال عکس را در ماژول تنظیم کنید. شاخه ی پیش فرض: images'); - -// Appended by Xoops Language Checker -GIJOE- in 2007-03-21 05:34:59 -define('_MI_ALTSYS_ADMIN_IN_THEME', 'قالب بخش مدیریت'); -define('_MI_ALTSYS_ADMIN_IN_THEMEDSC', 'این گزینه برای انتخاب قالب منوی مدیریت به کار میرود . خط زیر را باید به فایل mainfile.php اضافه کنید . درست بعد از خطی که برای شناساندن فایل common.php اضافه شده است .( include XOOPS_ROOT_PATH."/include/common.php";) توجه داشته باشید در زبان فارسی ممکن است ظاهر منوی مدیریت اندکی به هم بریزد.

include XOOPS_TRUST_PATH.\'/libs/altsys/include/admin_in_theme.inc.php\';

این قابلیت فقط در زوپس ۲.۰ و ایمپرس سی‌ام‌اس کار میکند'); -define('_MI_ALTSYS_MODULENAME', 'آلت سیس') ; -define('_MI_ALTSYS_MODULEDESC', 'مدیریت ساده‌ی سیستم') ; - -define('_MI_ALTSYS_MENU_CUSTOMBLOCKS', 'بلوک شخصی') ; -define('_MI_ALTSYS_MENU_NEWCUSTOMBLOCK', '(بلوک شخصی جدید)') ; -define('_MI_ALTSYS_MENU_MYBLOCKSADMIN', 'بلوک ماژول‌ها') ; -define('_MI_ALTSYS_MENU_MYTPLSADMIN', 'الگو‌ها') ; -define('_MI_ALTSYS_MENU_COMPILEHOOKADMIN', 'الگو‌های پیشرفته') ; -define('_MI_ALTSYS_MENU_MYAVATAR', 'شکلک‌ها') ; -define('_MI_ALTSYS_MENU_MYSMILEY', 'لبخندک‌ها') ; - -define('_MI_ALTSYS_ADMINMENU_HFT', 'بازسازی منوی مدیریت') ; -define('_MI_ALTSYS_ADMINMENU_HFTDSC', 'اگر شکل منوی مدیریت شما تغییر نکرد پرونده‌ی cache/adminmenu.php را حذف کنید یا با استفاده از ctrl + F5 ذخریه‌های سیستم را خالی کنید. این ویژگی فقط در زوپس 2.0 کار میکند.') ; -define('_MI_ALTSYS_AMHFT_OPT_2COL', 'نمایش تصویر ماژول‌ها در دو ردیف') ; -define('_MI_ALTSYS_AMHFT_OPT_NOIMG', 'نمایش نام ماژول‌ها به جای تصویر آن‌ها') ; -define('_MI_ALTSYS_AMHFT_OPT_XCSTY', 'مشابه سیستم XoopsCube Legacy') ; - -define('_MI_ALTSYS_ADMINMENU_IM', 'کپی کردن لینک‌های ماژول mymenu در منوی مدیریت') ; -define('_MI_ALTSYS_ADMINMENU_IMDSC', 'اگر شکل منوی مدیریت شما تغییر نکرد پرونده‌ی cache/adminmenu.php را حذف کنید یا با استفاده از ctrl + F5 ذخریه‌های سیستم را خالی کنید. این ویژگی فقط در زوپس 2.0 کار میکند.') ; diff --git a/xoops_trust_path/libs/altsys/language/persian/myblocksadmin.php b/xoops_trust_path/libs/altsys/language/persian/myblocksadmin.php deleted file mode 100644 index ef0f12b..0000000 --- a/xoops_trust_path/libs/altsys/language/persian/myblocksadmin.php +++ /dev/null @@ -1,70 +0,0 @@ - -* @author voltan -* @version $Id$ -*/ - -// Appended by Xoops Language Checker -GIJOE- in 2008-12-13 18:32:08 -define('_MD_A_MYBLOCKSADMIN_NOTICE4COMMONFCK', 'اگر شما میخواهید از یک ویرایشگر WYSIWYG استفاده کنید,common/fckeditor را نصب کنید'); - -// Appended by Xoops Language Checker -GIJOE- in 2007-05-11 17:24:39 -define('_MD_A_MYBLOCKSADMIN_LINK_FORCECLONE', 'تکثیر اجباری'); - -define('_MD_A_MYBLOCKSADMIN_PERMUPDATED', 'دسترسی‌ها با موفقیت به روز شد') ; -define('_MD_A_MYBLOCKSADMIN_BLOCKADMIN', 'مدیریت بلوک‌ها') ; -define('_MD_A_MYBLOCKSADMIN_NAME', 'نام') ; -define('_MD_A_MYBLOCKSADMIN_TITLE', 'عنوان') ; -define('_MD_A_MYBLOCKSADMIN_SIDE', 'محل قرار گیری'); -define('_MD_A_MYBLOCKSADMIN_SBLEFT', 'راست') ; -define('_MD_A_MYBLOCKSADMIN_SBRIGHT', 'چپ') ; -define('_MD_A_MYBLOCKSADMIN_CBLEFT', ' وسط-راست') ; -define('_MD_A_MYBLOCKSADMIN_CBRIGHT', 'وسط-چپ') ; -define('_MD_A_MYBLOCKSADMIN_CBCENTER', 'وسط-وسط') ; -define('_MD_A_MYBLOCKSADMIN_VISIBLE', 'قابل رویت') ; -define('_MD_A_MYBLOCKSADMIN_WEIGHT', 'وزن') ; -define('_MD_A_MYBLOCKSADMIN_VISIBLEIN', 'قابل رویت در') ; -define('_MD_A_MYBLOCKSADMIN_CONTENT', 'محتویات') ; -define('_MD_A_MYBLOCKSADMIN_CAPT_USABLETAGS', 'تگ‌های قابل استفاده') ; -define('_MD_A_MYBLOCKSADMIN_FMT_TAGRULE', 'در هنگام نمایش %s به صورت %s نشان داده خواهد شد') ; -define('_MD_A_MYBLOCKSADMIN_CTYPE', 'حالت پیش فرض') ; -define('_MD_A_MYBLOCKSADMIN_EDITTPL', 'ویرایش الگو') ; -define('_MD_A_MYBLOCKSADMIN_OPTIONS', 'تنظیمات بلوک ') ; -define('_MD_A_MYBLOCKSADMIN_BCACHETIME', 'مدت زمان ذخیره‌سازی') ; -define('_MD_A_MYBLOCKSADMIN_ACTION', 'عملکرد') ; -define('_MD_A_MYBLOCKSADMIN_DESCRIPTION', 'توضیحات') ; -define('_MD_A_MYBLOCKSADMIN_TOPPAGE', 'صفحه‌ی اصلی') ; -define('_MD_A_MYBLOCKSADMIN_ALLPAGES', 'همه‌ی صفحات') ; -define('_MD_A_MYBLOCKSADMIN_PERMFORM', 'دسترسی‌ها') ; -define('_MD_A_MYBLOCKSADMIN_PERM_MADMIN', 'مدیریت ماژول') ; -define('_MD_A_MYBLOCKSADMIN_PERM_MREAD', 'خواندن ماژول') ; -define('_MD_A_MYBLOCKSADMIN_DBUPDATED', 'پایگاه داده‌ها با موفقیت به روز شد') ; -define('_MD_A_MYBLOCKSADMIN_FMT_REMOVEBLOCK', '%s پاک میشود. آیا اطمینان دارید؟') ; - - -define('_MD_A_MYBLOCKSADMIN_CLONEFORM', 'تکثیر بلوک') ; -define('_MD_A_MYBLOCKSADMIN_NEWFORM', 'ساخت بلوک') ; -define('_MD_A_MYBLOCKSADMIN_EDITFORM', 'ویرایش بلوک') ; - -define('_MD_A_MYBLOCKSADMIN_BTN_CLONE', 'تکثیر') ; -define('_MD_A_MYBLOCKSADMIN_BTN_NEW', 'ساختن') ; -define('_MD_A_MYBLOCKSADMIN_BTN_EDIT', 'بروز سازی') ; - -define('_MD_A_MYBLOCKSADMIN_CTYPE_HTML', 'کدهای HTML') ; -define('_MD_A_MYBLOCKSADMIN_CTYPE_NOSMILE', 'فرمت خودکار (لبخندک‌ها غیرفعال)') ; -define('_MD_A_MYBLOCKSADMIN_CTYPE_SMILE', 'فرمت خودکار (لبخندک‌ها فعال)') ; -define('_MD_A_MYBLOCKSADMIN_CTYPE_PHP', 'کدهای PHP (PHP eval())') ; - - -// Group permission phrases -define('_MD_A_MYBLOCKSADMIN_PERMADDNG', 'نا توانی در اختصاص دسترسی %s به قسمت %s برای گروه %s'); -define('_MD_A_MYBLOCKSADMIN_PERMADDOK', 'دسترسی %s به قسمت %s برای گروه %s اضافه شد'); -define('_MD_A_MYBLOCKSADMIN_PERMRESETNG', 'نا توانی در ریست کردن دسترسی گروه‌ها برای گروه %s'); -define('_MD_A_MYBLOCKSADMIN_PERMADDNGP', 'تمام موارد اصلی باید انتخاب شوند'); diff --git a/xoops_trust_path/libs/altsys/language/persian/mylangadmin.php b/xoops_trust_path/libs/altsys/language/persian/mylangadmin.php deleted file mode 100644 index d4402cb..0000000 --- a/xoops_trust_path/libs/altsys/language/persian/mylangadmin.php +++ /dev/null @@ -1,40 +0,0 @@ - -* @author voltan -* @version $Id$ -*/ -// Appended by Xoops Language Checker -GIJOE- in 2007-12-29 06:46:08 -define('_MYLANGADMIN_NOTE_ADDEDBYMYLANG', '(یک ثابت زبان توسط کاربر اضافه شده است)'); -define('_MYLANGADMIN_DT_MYLANGFILENAME', 'برجسته ساختن جزییِ نام پرونده'); - -// Appended by Xoops Language Checker -GIJOE- in 2007-05-11 17:24:39 -define('_MYLANGADMIN_MSG_NOTICE4ALREADYREAD', 'با توجه به اینکه این پرونده هم‌اکنون توسط سیستم خوانده می شود، این ستون ارزش فعلی را نشان می دهد.'); - -// Appended by Xoops Language Checker -GIJOE- in 2007-05-10 17:21:59 -define('_MYLANGADMIN_DT_CACHEFILENAME', 'نام فایل ذخیره‌ساز'); -define('_MYLANGADMIN_DT_CACHESTATUS', 'وضعیت ذخیره‌ساز'); -define('_MYLANGADMIN_CREATED', 'ساخته شد'); -define('_MYLANGADMIN_NOTCREATED', 'وجود ندارد'); -define('_MYLANGADMIN_ERR_MODNOLANGUAGE', 'ماژول انتخاب شده فایل زبان ندارد'); -define('_MYLANGADMIN_ERR_MODLANGINCOMPATIBLE', 'ماژول انتخاب شده با ساختمان زبان ناسازگار است'); -define('_MYLANGADMIN_ERR_MODEMPTYLANGDIR', 'فایل زبان ماژول انتخابی قابل نوشتن نیست '); -define('_MYLANGADMIN_MSG_D3LANGMANENABLED', 'برجسته‌سازی سیستم فعال است.'); -define('_MYLANGADMIN_FMT_HOWTOENABLED3LANGMAN4XCL', 'برجسته‌سازی سیستم غیرفعال است. برای فعال کردن آن، "%s" را به "%s" کپی کنید'); -define('_MYLANGADMIN_MSG_HOWTOENABLED3LANGMAN4X2', 'سیستم برجسته سازی با این هسته کار نمی کند بجز برای ماژول‌های D3. اگر اصرار به استفاده از این قابلیت دارید، هک زیر را انجام دهید:'); - -define('_MYLANGADMIN_H3_MODULE', 'ماژول مقصود') ; -define('_MYLANGADMIN_CACHEUPDATED', 'فایل ذخیره‌ساز به روز شد') ; -define('_MYLANGADMIN_BTN_UPDATE', 'بروز سازی') ; -define('_MYLANGADMIN_BTN_RESET', 'بازگشت') ; - -define('_MYLANGADMIN_TH_CONSTANTNAME', 'نام ثابت') ; -define('_MYLANGADMIN_TH_DEFAULTVALUE', 'ارزش پیشفرض') ; -define('_MYLANGADMIN_TH_USERVALUE', 'ارزش تعریف شده توسط کاربر') ; diff --git a/xoops_trust_path/libs/altsys/language/persian/mypreferences.php b/xoops_trust_path/libs/altsys/language/persian/mypreferences.php deleted file mode 100644 index 80788d8..0000000 --- a/xoops_trust_path/libs/altsys/language/persian/mypreferences.php +++ /dev/null @@ -1,15 +0,0 @@ - -* @author voltan -* @version $Id$ -*/ -define('_MD_A_MYPREFERENCES_FORMTITLE', 'دسترسی ماژول‌ها') ; -define('_MD_A_MYPREFERENCES_UPDATED', 'دسترسی‌ها با موفقیت به روز شدند') ; diff --git a/xoops_trust_path/libs/altsys/language/persian/mytplsadmin.php b/xoops_trust_path/libs/altsys/language/persian/mytplsadmin.php deleted file mode 100644 index 56b32c0..0000000 --- a/xoops_trust_path/libs/altsys/language/persian/mytplsadmin.php +++ /dev/null @@ -1,38 +0,0 @@ - -* @author voltan -* @version $Id$ -*/ -// Appended by Xoops Language Checker -GIJOE- in 2007-12-28 04:46:26 -define('_MYTPLSADMIN_CUSTOMTEMPLATE', 'الگوی شخصی'); -define('_MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE', 'یک الگوی شخصی بسازید'); - -define('_MYTPLSADMIN_CREATE_NEW_TPLSET', 'ساخت مجموعه‌ی جدید') ; -define('_MYTPLSADMIN_CAPTION_BASE', 'پایگاه') ; -define('_MYTPLSADMIN_CAPTION_SETNAME', 'نام') ; -define('_MYTPLSADMIN_OPT_BLANKSET', '(فاصله)') ; -define('_MYTPLSADMIN_CAPTION_COPYTO', 'بسوی') ; -define('_MYTPLSADMIN_BTN_COPY', 'کپی') ; -define('_MYTPLSADMIN_TITLE_CHECKALL', 'خاموش /روشن کردن تمام چک باکس‌ها در این خط') ; -define('_MYTPLSADMIN_CNF_DELETE_SELECTED_TEMPLATES', 'تمام الگو‌های انتخاب شده در این دسته پاک خواهند شد. آیا شما موافقید؟') ; -define('_MYTPLSADMIN_CNF_COPY_SELECTED_TEMPLATES', 'تمام الگو‌های انتخاب شده در این دسته در در دسته ی انتخاب شده کپی/بازچسبانی میشوند. آیا شما موافقید؟') ; -define('_MYTPLSADMIN_TH_NAME', 'نام الگو') ; -define('_MYTPLSADMIN_TH_TYPE', 'نوع') ; -define('_MYTPLSADMIN_TH_FILE', 'پرونده‌ی پایگاه') ; -define('_MYTPLSADMIN_ERR_NOTPLFILE', "هیچ الگوی چک نشده") ; -define('_MYTPLSADMIN_ERR_INVALIDTPLSET', "جایگاه مقصد باید دقیقا مانند جایگاه پرونده درون بسته باشد در غیر این صورت هیچ الگویی مجاز شناخته نخواهد شد") ; -define('_MYTPLSADMIN_ERR_CANTREMOVEDEFAULT', "شما میتوانید الگو پیش فرض را پاک کنید.") ; -define('_MYTPLSADMIN_ERR_DUPLICATEDSETNAME', "نام مجموعه قبلا وجود داشته.") ; -define('_MYTPLSADMIN_ERR_INVALIDSETNAME', "خطا: نام مجموعه پیشتر تعیین شده است.") ; - -define('_MYTPLSADMIN_H3_MODULE', 'ماژول') ; -define('_MYTPLSADMIN_BTN_NEWTPLSET', 'ساختن') ; - -define('_MYTPLSADMIN_DBUPDATED', 'الگو‌ها با موفقیت به روز شدند') ; diff --git a/xoops_trust_path/libs/altsys/language/persian/mytplsform.php b/xoops_trust_path/libs/altsys/language/persian/mytplsform.php deleted file mode 100644 index 82b3af5..0000000 --- a/xoops_trust_path/libs/altsys/language/persian/mytplsform.php +++ /dev/null @@ -1,29 +0,0 @@ - -* @author voltan -* @version $Id$ -*/ - -// Appended by Xoops Language Checker -GIJOE- in 2008-07-09 13:28:56 -define('_MD_A_MYTPLSFORM_TPLSADMIN', '‌الگوها'); - -// Appended by Xoops Language Checker -GIJOE- in 2007-12-28 04:46:26 -define('_MD_A_MYTPLSFORM_CREATED', 'الگویی با موفقیت ایجاد شد'); -define('_MD_A_MYTPLSFORM_LABEL_TPLFILE', 'نام الگو'); -define('_MD_A_MYTPLSFORM_BTN_CREATE', 'ساختن'); - -// Appended by Xoops Language Checker -GIJOE- in 2007-05-07 18:10:30 -define('_MD_A_MYTPLSFORM_BTN_MODIFYCONT', 'برگرداندن'); -define('_MD_A_MYTPLSFORM_BTN_MODIFYEND', 'ذخیره و پایان'); -define('_MD_A_MYTPLSFORM_BTN_RESET', 'راه‌اندازی مجدد'); - -define('_MD_A_MYTPLSFORM_EDIT', 'ویرایش الگو') ; -define('_MD_A_MYTPLSFORM_UPDATED', 'الگو با موفقیت به روز شد') ; diff --git a/xoops_trust_path/libs/altsys/language/portuguese/admin.php b/xoops_trust_path/libs/altsys/language/portuguese/admin.php deleted file mode 100644 index 2040cad..0000000 --- a/xoops_trust_path/libs/altsys/language/portuguese/admin.php +++ /dev/null @@ -1,4 +0,0 @@ - - http://xoops.net.br/ -// ** $Id: compilehookadmin.php 1040 2011-11-06 05:24:00Z mikhail $ -// ** License http://creativecommons.org/licenses/by/2.5/br/ -// ******************************************************************** // -// -define("_TPLSADMIN_CNF_DELETEOK", "Deseja remover?"); // remover o...? -define("_TPLSADMIN_CNF_ENCLOSEBYBORDEREDDIV", "Os caches dos modelos compilados ser�o abertos e fechados por c�digos DIV. Confirma?"); -define("_TPLSADMIN_CNF_ENCLOSEBYCOMMENT", "Os caches dos modelos compilados ser�o delimitadas pelos coment�rios do tplsadmin. Voc� concorda com isso?"); -define("_TPLSADMIN_CNF_HOOKSAVEVARS", "Nas compila��es dos caches dos modelos ser� implantada a l�gica para coleta das vari�veis do modelo. Voc� concorda com isso?"); -define("_TPLSADMIN_CNF_REMOVEHOOKS", "Voc� concorda com a normaliza��o?"); -define("_TPLSADMIN_DD_ENCLOSEBYBORDEREDDIV", "Cada modelo ser� envolto por c�digos DIV de bordas pretas. Um link para controle da edi��o do tplsadmin ser� inserido em cada um dos modelos. Embora isso muitas vezes cause a destrui��o do design, voc� pode editar cada modelo mais instintiva e facilmente."); -define("_TPLSADMIN_DD_ENCLOSEBYCOMMENT", "Dois coment�rios em HTML ser�o colocados nos pontos de come�o e final de cada modelo. Uma vez que isso raramente quebra os design, isso � recomendado para profissionais que podem eles mesmos ler HTML"); -define("_TPLSADMIN_DD_GETTEMPLATES", "Selecione um conjunto antes de apertar cada bot�o."); -define("_TPLSADMIN_DD_GETTPLSVARSINFO_DW", "Primeiro , abra o Gerenciador de Extens�es do Adobe DreamWeaver.
Extraia o arquivo descarregado.
Execute os arquivos com a extens�o .mxi e voc� encontrar� di�logos de instala��o.
Os snippets para vari�veis de modelo de seu portal ser�o utiliz�veis ap�s reiniciar o Adobe DreamWeaver."); // muito confuso... snippets? -define("_TPLSADMIN_DD_HOOKSAVEVARS", "O primeiro passo para obten��o das informa��es das vari�veis de modelo em seu site. As informa��es das vari�veis do modelo ser�o coletadas quando o lado p�blico de seu site for exibido. Ap�s os modelos que voc� deseja editar forem mostrados, obtenha as informa��es das vari�veis do modelo atrav�s dos bot�es subjacentes."); -define("_TPLSADMIN_DD_PUTTEMPLATES", "Selecione um conjunto que voc� queira enviar ou subescrever, antes de enviar o arquivo zip ou tgz incluindo esses arquivos des modelos (.html). Voc� n�o precisa verificar a profundidade dos caminhos nos arquivos."); -define("_TPLSADMIN_DD_REMOVEHOOKS", "Isso remove coment�rios, c�digos DIV, e sequ�ncias l�gicas inseridas pelas opera��es acima em cada cache compilado do modelo."); -define("_TPLSADMIN_DT_ENCLOSEBYBORDEREDDIV", "Inserir c�digos DIV"); // N�o tenho certeza pois ainda n�o trabalhei direito com esses recursos... -define("_TPLSADMIN_DT_ENCLOSEBYCOMMENT", "Inserir coment�rios"); // N�o tenho certeza pois ainda n�o trabalhei direito com esses recursos... -define("_TPLSADMIN_DT_GETTEMPLATES", "Descarregar os modelos"); // Prefiro traduzir download como descarregar. Pode haver um estranhamento inicial, mas vale a pena -define("_TPLSADMIN_DT_GETTPLSVARSINFO_DW", "Obter informa��es das vari�veis de modelo como extens�es do Adobe DreamWeaver"); -define("_TPLSADMIN_DT_HOOKSAVEVARS", "Inserir sequ�ncias l�gicas para coletar as vari�veis do modelo"); // N�o tenho certeza... -define("_TPLSADMIN_DT_PUTTEMPLATES", "Enviar os modelos"); // Enviar para... -define("_TPLSADMIN_DT_REMOVEHOOKS", "Normalizar compila��o dos caches dos modelos"); // Como assim? -define("_TPLSADMIN_ERR_EXTENSION", "Esta extens�o n�o p�de ser reconhecida."); // obviamente o acento diferencial continua para P�de e Pode -define("_TPLSADMIN_ERR_INVALIDARCHIVE", "O arquivo n�o p�de ser descompactado."); // v�lido apenas para arquivos compactados? -define("_TPLSADMIN_ERR_INVALIDTPLSET", "O nome escolhido para o conjunto de modelos foi considerado inv�lido pelo sistema."); // ficou natural, mas bem longo -define("_TPLSADMIN_ERR_NOTPLSVARSINFO", "N�o h� arquivos com informa��es sobre as vari�veis do modelo."); -define("_TPLSADMIN_ERR_NOTUPLOADED", "Os arquivos n�o foram enviados."); // ent�o ocorreu um erro? -define("_TPLSADMIN_FMT_MSG_ENCLOSEBYBORDEREDDIV", "%d os caches dos modelos est�o sendo envoltos por c�digos DIV"); // caches??? -define("_TPLSADMIN_FMT_MSG_ENCLOSEBYCOMMENT", "%d os caches dos modelos foram delimitados pelos coment�rios do tplsadmin"); // caches??? -define("_TPLSADMIN_FMT_MSG_HOOKSAVEVARS", "%d nos caches dos modelos est�o sendo inseridas sequ�ncias l�gicas para coletar as vari�veis do modelo"); -define("_TPLSADMIN_FMT_MSG_PUTTEMPLATES", "%d modelos foram importados."); // importados para onde? -define("_TPLSADMIN_FMT_MSG_REMOVEHOOKS", "%d os caches de modelo foram normalizados"); -define("_TPLSADMIN_MSG_CLEARCACHE", "Os caches dos modelos foram removidos"); // n�o gostei de 'CACHES'... vou tentar melhorar -define("_TPLSADMIN_MSG_CREATECOMPILECACHEFIRST", "Ainda n�o foi criado qualquer cache de modelos compilados. O primeiro passo para criar os arquivos de cache � tornar o seu portal acess�vel ao p�blico."); -define("_TPLSADMIN_NUMCAP_COMPILEDCACHES", "Caches de modelos compilados"); // cacheS??? -define("_TPLSADMIN_NUMCAP_TPLSVARS", "Arquivos com informa��es sobre as vari�veis do modelo"); // n�o sei se � isso o que o GiJOE quis dizer. Ele � um g�nio, mas o ingl�s dele consegue ser pior que o meu... :-) -; diff --git a/xoops_trust_path/libs/altsys/language/portuguese/index.html b/xoops_trust_path/libs/altsys/language/portuguese/index.html deleted file mode 100644 index 79f0c33..0000000 --- a/xoops_trust_path/libs/altsys/language/portuguese/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - -Acesso negado - - - - - -

Acesso negado.
Se esta página não recarregar automaticamente,
clique aqui para prosseguir...

- - \ No newline at end of file diff --git a/xoops_trust_path/libs/altsys/language/portuguese/modinfo.php b/xoops_trust_path/libs/altsys/language/portuguese/modinfo.php deleted file mode 100644 index 4cb5580..0000000 --- a/xoops_trust_path/libs/altsys/language/portuguese/modinfo.php +++ /dev/null @@ -1,28 +0,0 @@ -include XOOPS_TRUST_PATH.\"/libs/altsys/include/admin_in_theme.inc.php\";
para habilitar isso. Esta caracterstica trabalha somente com XOOPS 2.0.x"); -define("_MI_ALTSYS_ADMINMENU_HFT", "Reescrever o menu administrativo?"); -define("_MI_ALTSYS_ADMINMENU_HFTDSC", "Se seu menu administrativo estiver quebrado, remova o arquivo cache/adminmenu.php. Este macete s funciona com o XOOPS 2.0.x"); -define("_MI_ALTSYS_ADMINMENU_IM", "Importa os endereos do mdulo mymenu para o menu administrativo"); -define("_MI_ALTSYS_ADMINMENU_IMDSC", "Se o seu menu administrativo estiver quebrado, remova o arquivo cache/adminmenu.php. Este macete s funciona com o XOOPS 2.0.x"); -define("_MI_ALTSYS_AMHFT_OPT_2COL", "Duas colunas para os cones dos mdulo"); -define("_MI_ALTSYS_AMHFT_OPT_NOIMG", "No mostrar imagens , apenas os seus respectivos endereos em texto simples."); -define("_MI_ALTSYS_AMHFT_OPT_XCSTY", "Como o XOOPS Cube"); -define("_MI_ALTSYS_BNAME_ADMIN_MENU", "Menu administrativo"); -define("_MI_ALTSYS_ENABLEFORCECLONE", "Tornar todos os blocos clonveis"); -define("_MI_ALTSYS_ENABLEFORCECLONEDSC", "Esta opo permite que todos os blocos possam ser clonados. Antes de habilitar esta funo, tenha em mente que alguns blocos causaro erros se forem mostrados mais de uma vez na mesma pgina."); -define("_MI_ALTSYS_IMAGES_DIR", "Diretrio para os arquivos de imagem"); -define("_MI_ALTSYS_IMAGES_DIRDSC", "O caminho relativo deve ser configurado no diretrio do mdulo. O padro images."); -define("_MI_ALTSYS_MENU_ADVANCEDLANGADMIN", "Idiomas (avanado)"); -define("_MI_ALTSYS_MENU_COMPILEHOOKADMIN", "Modelos (avanado)"); -define("_MI_ALTSYS_MENU_CUSTOMBLOCKS", "Blocos personalizados"); -define("_MI_ALTSYS_MENU_MYAVATAR", "Avatares"); -define("_MI_ALTSYS_MENU_MYBLOCKSADMIN", "Blocos dos mdulos"); -define("_MI_ALTSYS_MENU_MYLANGADMIN", "Idiomas"); -define("_MI_ALTSYS_MENU_MYSMILEY", "cones emotivos"); -define("_MI_ALTSYS_MENU_MYTPLSADMIN", "Modelos"); -define("_MI_ALTSYS_MENU_NEWCUSTOMBLOCK", "Criar um novo bloco"); -define("_MI_ALTSYS_MODULEDESC", "Mdulo complementar para administrao do sistema cuja instalao necessria para o funcionamento de diversos mdulos."); -define("_MI_ALTSYS_MODULENAME", "Altsys legacy"); diff --git a/xoops_trust_path/libs/altsys/language/portuguese/myblocksadmin.php b/xoops_trust_path/libs/altsys/language/portuguese/myblocksadmin.php deleted file mode 100644 index 71ce0ee..0000000 --- a/xoops_trust_path/libs/altsys/language/portuguese/myblocksadmin.php +++ /dev/null @@ -1,48 +0,0 @@ -%s em %s"); -define("_MYLANGADMIN_H3_MODULE", "M�dulo alvo"); -define("_MYLANGADMIN_MSG_D3LANGMANENABLED", "O sistema de substitui��o est� habilitado agora."); -define("_MYLANGADMIN_MSG_HOWTOENABLED3LANGMAN4X2", "O sistema de substitui��o n�o est� funcionando com o n�cleo desta vers�o do XOOPS Cube, exceto alguns m�dulos D3. Se voc� deseja habilit�-lo neste core, tente um hack como este:"); -define("_MYLANGADMIN_MSG_NOTICE4ALREADYREAD", "Desde que este arquivo j� tenha sido lido pelo sistema, esta coluna significa o valor corrente"); -define("_MYLANGADMIN_NOTCREATED", "Ainda n�o foi criado"); -define("_MYLANGADMIN_NOTE_ADDEDBYMYLANG", "(uma constante criada pelo utilizador)"); -define("_MYLANGADMIN_TH_CONSTANTNAME", "Nome da constante"); -define("_MYLANGADMIN_TH_DEFAULTVALUE", "Valor Padr�o"); -define("_MYLANGADMIN_TH_USERVALUE", "Valor personalizado"); diff --git a/xoops_trust_path/libs/altsys/language/portuguese/mypreferences.php b/xoops_trust_path/libs/altsys/language/portuguese/mypreferences.php deleted file mode 100644 index 4133e81..0000000 --- a/xoops_trust_path/libs/altsys/language/portuguese/mypreferences.php +++ /dev/null @@ -1,5 +0,0 @@ - - http://xoops.net.br/ // ** $Id: compilehookadmin.php 1040 2011-11-06 05:24:00Z mikhail $ -// ** License http://creativecommons.org/licenses/by/2.5/br/ -// ******************************************************************** // -// -define("_TPLSADMIN_CNF_DELETEOK", "Deseja remover?"); -define("_TPLSADMIN_CNF_ENCLOSEBYBORDEREDDIV", "Os caches dos modelos compilados serão abertos e fechados por códigos DIV. Confirma?"); -define("_TPLSADMIN_CNF_ENCLOSEBYCOMMENT", "Os caches dos modelos compilados serão delimitadas pelos comentários do tplsadmin. Você concorda com isso?"); -define("_TPLSADMIN_CNF_HOOKSAVEVARS", "Nas compilações dos caches dos modelos será implantada a lógica para coleta das variáveis do modelo. Você concorda com isso?"); -define("_TPLSADMIN_CNF_REMOVEHOOKS", "Você concorda com a normalização?"); -define("_TPLSADMIN_DD_ENCLOSEBYBORDEREDDIV", "Cada modelo será envolto por códigos DIV de bordas pretas. Um link para controle da edição do tplsadmin será inserido em cada um dos modelos. Embora isso muitas vezes cause a destruição do design, você pode editar cada modelo mais instintiva e facilmente."); -define("_TPLSADMIN_DD_ENCLOSEBYCOMMENT", "Dois comentários em HTML serão colocados nos pontos de começo e final de cada modelo. Uma vez que isso raramente quebra os design, isso é recomendado para profissionais que podem eles mesmos ler HTML"); -define("_TPLSADMIN_DD_GETTEMPLATES", "Selecione um conjunto antes de apertar cada botão."); -define("_TPLSADMIN_DD_GETTPLSVARSINFO_DW", "Primeiro , abra o Gerenciador de Extensões do Adobe DreamWeaver.
Extraia o arquivo descarregado.
Execute os arquivos com a extensão .mxi e você encontrará diálogos de instalação.
Os snippets para variáveis de modelo de seu site serão utilizáveis após reiniciar o Adobe DreamWeaver."); -define("_TPLSADMIN_DD_HOOKSAVEVARS", "O primeiro passo para obtenção das informações das variáveis de modelo em seu site. As informações das variáveis do modelo serão coletadas quando o lado público de seu site for exibido. Após os modelos que você deseja editar forem mostrados, obtenha as informações das variáveis do modelo através dos botões subjacentes."); -define("_TPLSADMIN_DD_PUTTEMPLATES", "Selecione um conjunto que você queira enviar ou subescrever, antes de enviar o arquivo zip ou tgz incluindo esses arquivos des modelos (.html). Você não precisa verificar a profundidade dos caminhos nos arquivos."); -define("_TPLSADMIN_DD_REMOVEHOOKS", "Isso remove comentários, códigos DIV, e sequências lógicas inseridas pelas operações acima em cada cache compilado do modelo."); -define("_TPLSADMIN_DT_ENCLOSEBYBORDEREDDIV", "Inserir códigos DIV"); -define("_TPLSADMIN_DT_ENCLOSEBYCOMMENT", "Inserir comentários"); -define("_TPLSADMIN_DT_GETTEMPLATES", "Descarregar os modelos"); -define("_TPLSADMIN_DT_GETTPLSVARSINFO_DW", "Obter informações das variáveis de modelo como extensões do Adobe Dreamweaver"); -define("_TPLSADMIN_DT_HOOKSAVEVARS", "Inserir sequências lógicas para coletar as variáveis do modelo"); -define("_TPLSADMIN_DT_PUTTEMPLATES", "Enviar os modelos"); -define("_TPLSADMIN_DT_REMOVEHOOKS", "Normalizar compilação dos caches dos modelos"); -define("_TPLSADMIN_ERR_EXTENSION", "Esta extensão não pôde ser reconhecida."); -define("_TPLSADMIN_ERR_INVALIDARCHIVE", "O arquivo não pôde ser descompactado."); -define("_TPLSADMIN_ERR_INVALIDTPLSET", "O nome escolhido para o conjunto de modelos foi considerado inválido pelo sistema."); -define("_TPLSADMIN_ERR_NOTPLSVARSINFO", "Não há arquivos com informações sobre as variáveis do modelo."); -define("_TPLSADMIN_ERR_NOTUPLOADED", "Os arquivos não foram enviados."); -define("_TPLSADMIN_FMT_MSG_ENCLOSEBYBORDEREDDIV", "%d os caches dos modelos estão sendo envoltos por códigos DIV"); -define("_TPLSADMIN_FMT_MSG_ENCLOSEBYCOMMENT", "%d os caches dos modelos foram delimitados pelos comentários do tplsadmin"); -define("_TPLSADMIN_FMT_MSG_HOOKSAVEVARS", "%d nos caches dos modelos estão sendo inseridas sequências lógicas para coletar as variáveis do modelo"); -define("_TPLSADMIN_FMT_MSG_PUTTEMPLATES", "%d modelos foram importados."); -define("_TPLSADMIN_FMT_MSG_REMOVEHOOKS", "%d os caches de modelo foram normalizados"); -define("_TPLSADMIN_MSG_CLEARCACHE", "Os caches dos modelos foram removidos"); -define("_TPLSADMIN_MSG_CREATECOMPILECACHEFIRST", "Ainda não foi criado qualquer cache de modelos compilados. O primeiro passo para criar os arquivos de cache é tornar o seu portal acessível ao público."); -define("_TPLSADMIN_NUMCAP_COMPILEDCACHES", "Caches de modelos compilados"); -define("_TPLSADMIN_NUMCAP_TPLSVARS", "Arquivos com informações sobre as variáveis do modelo"); +// ** License http://creativecommons.org/licenses/by/2.5/br/ + +define( '_TPLSADMIN_CNF_DELETEOK' , "Deseja remover?"); +define( '_TPLSADMIN_CNF_ENCLOSEBYBORDEREDDIV' , "Os caches dos modelos compilados serão abertos e fechados por códigos DIV. Confirma?"); +define( '_TPLSADMIN_CNF_ENCLOSEBYCOMMENT' , "Os caches dos modelos compilados serão delimitadas pelos comentários do tplsadmin. Você concorda com isso?"); +define( '_TPLSADMIN_CNF_HOOKSAVEVARS' , "Nas compilações dos caches dos modelos será implantada a lógica para coleta das variáveis do modelo. Você concorda com isso?"); +define( '_TPLSADMIN_CNF_REMOVEHOOKS' , "Você concorda com a normalização?"); +define( '_TPLSADMIN_DD_ENCLOSEBYBORDEREDDIV' , "Cada modelo será envolto por códigos DIV de bordas pretas. Um link para controle da edição do tplsadmin será inserido em cada um dos modelos. Embora isso muitas vezes cause a destruição do design, você pode editar cada modelo mais instintiva e facilmente."); +define( '_TPLSADMIN_DD_ENCLOSEBYCOMMENT' , "Dois comentários em HTML serão colocados nos pontos de começo e final de cada modelo. Uma vez que isso raramente quebra os design, isso é recomendado para profissionais que podem eles mesmos ler HTML"); +define( '_TPLSADMIN_DD_GETTEMPLATES' , "Selecione um conjunto antes de apertar cada botão."); +define( '_TPLSADMIN_DD_GETTPLSVARSINFO_DW' , "Primeiro , abra o Gerenciador de Extensões do Adobe DreamWeaver.
Extraia o arquivo descarregado.
Execute os arquivos com a extensão .mxi e você encontrará diálogos de instalação.
Os snippets para variáveis de modelo de seu site serão utilizáveis após reiniciar o Adobe DreamWeaver."); +define( '_TPLSADMIN_DD_HOOKSAVEVARS' , "O primeiro passo para obtenção das informações das variáveis de modelo em seu site. As informações das variáveis do modelo serão coletadas quando o lado público de seu site for exibido. Após os modelos que você deseja editar forem mostrados, obtenha as informações das variáveis do modelo através dos botões subjacentes."); +define( '_TPLSADMIN_DD_PUTTEMPLATES' , "Selecione um conjunto de modelos que você deseja substituir.
Selecione o arquivo tar incluindo os modelos (.html)
Extrair automaticamente todos os modelos, independentemente da estrutura em árvore do directório do arquivo."); +define( '_TPLSADMIN_DD_REMOVEHOOKS' , "Isso remove comentários, códigos DIV, e sequências lógicas inseridas pelas operações acima em cada cache compilado do modelo."); +define( '_TPLSADMIN_DT_ENCLOSEBYBORDEREDDIV' , "Inserir códigos DIV"); +define( '_TPLSADMIN_DT_ENCLOSEBYCOMMENT' , "Inserir comentários"); +define( '_TPLSADMIN_DT_GETTEMPLATES' , "Descarregar os modelos"); +define( '_TPLSADMIN_DT_GETTPLSVARSINFO_DW' , "Obter informações das variáveis de modelo como extensões do Adobe Dreamweaver"); +define( '_TPLSADMIN_DT_HOOKSAVEVARS' , "Inserir sequências lógicas para coletar as variáveis do modelo"); +define( '_TPLSADMIN_DT_PUTTEMPLATES' , "Enviar os modelos"); +define( '_TPLSADMIN_DT_REMOVEHOOKS' , "Normalizar compilação dos caches dos modelos"); +define( '_TPLSADMIN_ERR_EXTENSION' , "Esta extensão não pôde ser reconhecida."); +define( '_TPLSADMIN_ERR_INVALIDARCHIVE' , "O arquivo não pôde ser descompactado."); +define( '_TPLSADMIN_ERR_INVALIDTPLSET' , "O nome escolhido para o conjunto de modelos foi considerado inválido pelo sistema."); +define( '_TPLSADMIN_ERR_NOTPLSVARSINFO' , "Não há arquivos com informações sobre as variáveis do modelo."); +define( '_TPLSADMIN_ERR_NOTUPLOADED' , "Os arquivos não foram enviados."); +define( '_TPLSADMIN_FMT_MSG_ENCLOSEBYBORDEREDDIV' , "%d os caches dos modelos estão sendo envoltos por códigos DIV"); +define( '_TPLSADMIN_FMT_MSG_ENCLOSEBYCOMMENT' , "%d os caches dos modelos foram delimitados pelos comentários do tplsadmin"); +define( '_TPLSADMIN_FMT_MSG_HOOKSAVEVARS' , "%d nos caches dos modelos estão sendo inseridas sequências lógicas para coletar as variáveis do modelo"); +define( '_TPLSADMIN_FMT_MSG_PUTTEMPLATES' , "%d modelos foram importados."); +define( '_TPLSADMIN_FMT_MSG_REMOVEHOOKS' , "%d os caches de modelo foram normalizados"); +define( '_TPLSADMIN_MSG_CLEARCACHE' , "Os caches dos modelos foram removidos"); +define( '_TPLSADMIN_MSG_CREATECOMPILECACHEFIRST' , "Ainda não foi criado qualquer cache de modelos compilados. O primeiro passo para criar os arquivos de cache é tornar o seu portal acessível ao público."); +define( '_TPLSADMIN_NUMCAP_COMPILEDCACHES' , "Caches de modelos compilados"); +define( '_TPLSADMIN_NUMCAP_TPLSVARS' , "Arquivos com informações sobre as variáveis do modelo"); diff --git a/xoops_trust_path/libs/altsys/language/pt_utf8/index.html b/xoops_trust_path/libs/altsys/language/pt_utf8/index.html deleted file mode 100644 index 79f0c33..0000000 --- a/xoops_trust_path/libs/altsys/language/pt_utf8/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - -Acesso negado - - - - - -

Acesso negado.
Se esta página não recarregar automaticamente,
clique aqui para prosseguir...

- - \ No newline at end of file diff --git a/xoops_trust_path/libs/altsys/language/pt_utf8/modinfo.php b/xoops_trust_path/libs/altsys/language/pt_utf8/modinfo.php index 90e8a9f..ad785b2 100644 --- a/xoops_trust_path/libs/altsys/language/pt_utf8/modinfo.php +++ b/xoops_trust_path/libs/altsys/language/pt_utf8/modinfo.php @@ -1,28 +1,28 @@ include XOOPS_TRUST_PATH.\"/libs/altsys/include/admin_in_theme.inc.php\";
para habilitar isso. Esta característica trabalha somente com XOOPS 2.0.x"); -define("_MI_ALTSYS_ADMINMENU_HFT", "Reescrever o menu administrativo?"); -define("_MI_ALTSYS_ADMINMENU_HFTDSC", "Se seu menu administrativo estiver quebrado, remova o arquivo cache/adminmenu.php. Este macete só funciona com o XOOPS 2.0.x"); -define("_MI_ALTSYS_ADMINMENU_IM", "Importa os endereços do módulo mymenu para o menu administrativo"); -define("_MI_ALTSYS_ADMINMENU_IMDSC", "Se o seu menu administrativo estiver quebrado, remova o arquivo cache/adminmenu.php. Este macete só funciona com o XOOPS 2.0.x"); -define("_MI_ALTSYS_AMHFT_OPT_2COL", "Duas colunas para os ícones dos módulo"); -define("_MI_ALTSYS_AMHFT_OPT_NOIMG", "Não mostrar imagens , apenas os seus respectivos endereços em texto simples."); -define("_MI_ALTSYS_AMHFT_OPT_XCSTY", "Como o XOOPS Cube"); -define("_MI_ALTSYS_BNAME_ADMIN_MENU", "Menu administrativo"); -define("_MI_ALTSYS_ENABLEFORCECLONE", "Tornar todos os blocos clonáveis"); -define("_MI_ALTSYS_ENABLEFORCECLONEDSC", "Esta opção permite que todos os blocos possam ser clonados. Antes de habilitar esta função, tenha em mente que alguns blocos causarão erros se forem mostrados mais de uma vez na mesma página."); -define("_MI_ALTSYS_IMAGES_DIR", "Diretório para os arquivos de imagem"); -define("_MI_ALTSYS_IMAGES_DIRDSC", "O caminho relativo deve ser configurado no diretório do módulo. O padrão é images."); -define("_MI_ALTSYS_MENU_ADVANCEDLANGADMIN", "Idiomas (avançado)"); -define("_MI_ALTSYS_MENU_COMPILEHOOKADMIN", "Modelos (avançado)"); -define("_MI_ALTSYS_MENU_CUSTOMBLOCKS", "Blocos personalizados"); -define("_MI_ALTSYS_MENU_MYAVATAR", "Avatares"); -define("_MI_ALTSYS_MENU_MYBLOCKSADMIN", "Blocos dos módulos"); -define("_MI_ALTSYS_MENU_MYLANGADMIN", "Idiomas"); -define("_MI_ALTSYS_MENU_MYSMILEY", "Ícones emotivos"); -define("_MI_ALTSYS_MENU_MYTPLSADMIN", "Modelos"); -define("_MI_ALTSYS_MENU_NEWCUSTOMBLOCK", "Criar um novo bloco"); -define("_MI_ALTSYS_MODULEDESC", "Módulo complementar para administração do sistema cuja instalação é necessária para o funcionamento de diversos módulos."); -define("_MI_ALTSYS_MODULENAME", "Altsys legacy"); +define( '_MI_ALTSYS_ADMIN_IN_THEME' , "Tema configurado para administrador"); +define( '_MI_ALTSYS_ADMIN_IN_THEMEDSC' , "Configure o nome do tema mostrado na área administrativa. Insira uma linha apenas depois da inclusão do common.php no mainfile.php
include XOOPS_TRUST_PATH.\"/libs/altsys/include/admin_in_theme.inc.php\");
para habilitar isso. Esta característica trabalha somente com XOOPS 2.0.x"); +define( '_MI_ALTSYS_ADMINMENU_HFT' , "Reescrever o menu administrativo?"); +define( '_MI_ALTSYS_ADMINMENU_HFTDSC' , "Se seu menu administrativo estiver quebrado, remova o arquivo cache/adminmenu.php. Este macete só funciona com o XOOPS 2.0.x"); +define( '_MI_ALTSYS_ADMINMENU_IM' , "Importa os endereços do módulo mymenu para o menu administrativo"); +define( '_MI_ALTSYS_ADMINMENU_IMDSC' , "Se o seu menu administrativo estiver quebrado, remova o arquivo cache/adminmenu.php. Este macete só funciona com o XOOPS 2.0.x"); +define( '_MI_ALTSYS_AMHFT_OPT_2COL' , "Duas colunas para os ícones dos módulo"); +define( '_MI_ALTSYS_AMHFT_OPT_NOIMG' , "Não mostrar imagens , apenas os seus respectivos endereços em texto simples."); +define( '_MI_ALTSYS_AMHFT_OPT_XCSTY' , "Como o XOOPS Cube"); +define( '_MI_ALTSYS_BNAME_ADMIN_MENU' , "Menu administrativo"); +define( '_MI_ALTSYS_ENABLEFORCECLONE' , "Tornar todos os blocos clonáveis"); +define( '_MI_ALTSYS_ENABLEFORCECLONEDSC' , "Esta opção permite que todos os blocos possam ser clonados. Antes de habilitar esta função, tenha em mente que alguns blocos causarão erros se forem mostrados mais de uma vez na mesma página."); +define( '_MI_ALTSYS_IMAGES_DIR' , "Diretório para os arquivos de imagem"); +define( '_MI_ALTSYS_IMAGES_DIRDSC' , "O caminho relativo deve ser configurado no diretório do módulo. O padrão é images."); +define( '_MI_ALTSYS_MENU_ADVANCEDLANGADMIN' , "Idiomas (avançado)"); +define( '_MI_ALTSYS_MENU_COMPILEHOOKADMIN' , "Modelos (avançado)"); +define( '_MI_ALTSYS_MENU_CUSTOMBLOCKS' , "Blocos personalizados"); +define( '_MI_ALTSYS_MENU_MYAVATAR' , "Avatares"); +define( '_MI_ALTSYS_MENU_MYBLOCKSADMIN' , "Blocos dos módulos"); +define( '_MI_ALTSYS_MENU_MYLANGADMIN' , "Idiomas"); +define( '_MI_ALTSYS_MENU_MYSMILEY' , "Ícones emotivos"); +define( '_MI_ALTSYS_MENU_MYTPLSADMIN' , "Modelos"); +define( '_MI_ALTSYS_MENU_NEWCUSTOMBLOCK' , "Adiconar novo bloco"); +define( '_MI_ALTSYS_MODULEDESC' , "Módulo complementar para administração do sistema cuja instalação é necessária para o funcionamento de diversos módulos."); +define( '_MI_ALTSYS_MODULENAME' , "Altsys legacy"); diff --git a/xoops_trust_path/libs/altsys/language/pt_utf8/myblocksadmin.php b/xoops_trust_path/libs/altsys/language/pt_utf8/myblocksadmin.php index ed2d575..09f7f53 100644 --- a/xoops_trust_path/libs/altsys/language/pt_utf8/myblocksadmin.php +++ b/xoops_trust_path/libs/altsys/language/pt_utf8/myblocksadmin.php @@ -1,48 +1,53 @@ +Um único componente contém HTML, JavaScript e CSS.
+Os módulos têm vários blocos pré-construídos que oferecem funcionalidades específicas e favorecem a composição em detrimento da herança.
+O editor muda de acordo com o tipo de conteúdo.'); +define( '_MD_A_MYBLOCKSADMIN_ACTION' , "Ação"); +define( '_MD_A_MYBLOCKSADMIN_ALLPAGES' , "Todas as páginas"); +define( '_MD_A_MYBLOCKSADMIN_BCACHETIME' , "Tempo do Cache"); +define( '_MD_A_MYBLOCKSADMIN_BLOCKADMIN' , "Gerir os blocos"); +define( '_MD_A_MYBLOCKSADMIN_BTN_CLONE' , "Clonar"); +define( '_MD_A_MYBLOCKSADMIN_BTN_EDIT' , "Atualizar"); +define( '_MD_A_MYBLOCKSADMIN_BTN_NEW' , "Adicionar"); +define( '_MD_A_MYBLOCKSADMIN_CAPT_USABLETAGS' , "Utilizar tags"); +define( '_MD_A_MYBLOCKSADMIN_CBCENTER' , "Centro"); +define( '_MD_A_MYBLOCKSADMIN_CBLEFT' , "Centro-esquero"); +define( '_MD_A_MYBLOCKSADMIN_CBRIGHT' , "Centro-direito"); +define( '_MD_A_MYBLOCKSADMIN_CLONEFORM' , "Clonar o bloco"); +define( '_MD_A_MYBLOCKSADMIN_CONTENT' , "Conteúdo"); +define( '_MD_A_MYBLOCKSADMIN_CTYPE' , "Tipo personalizado"); +define( '_MD_A_MYBLOCKSADMIN_CTYPE_HTML' , "Personalizado (HTML simples)"); +define( '_MD_A_MYBLOCKSADMIN_CTYPE_NOSMILE' , "Personalizado (HTML+BBCODE+AutoLink)"); +define( '_MD_A_MYBLOCKSADMIN_CTYPE_PHP' , "Personalizado (PHP eval())"); +define( '_MD_A_MYBLOCKSADMIN_CTYPE_SMILE' , "Personalizado (HTML+BBCODE+AutoLink+Smiley)"); +define( '_MD_A_MYBLOCKSADMIN_DBUPDATED' , "Banco de dados atualizado corretamente"); +define( '_MD_A_MYBLOCKSADMIN_DESCRIPTION' , "Descrição"); +define( '_MD_A_MYBLOCKSADMIN_EDITFORM' , "Editar o bloco"); +define( '_MD_A_MYBLOCKSADMIN_EDITTPL' , "Editar o modelo"); +define( '_MD_A_MYBLOCKSADMIN_FMT_REMOVEBLOCK' , "%s será removido. Você concorda?"); +define( '_MD_A_MYBLOCKSADMIN_FMT_TAGRULE' , "%s será substituído por %s."); +define( '_MD_A_MYBLOCKSADMIN_LINK_FORCECLONE' , "Forçar duplicação"); +define( '_MD_A_MYBLOCKSADMIN_NAME' , "Nome"); +define( '_MD_A_MYBLOCKSADMIN_NEWFORM' , "Adicionar novo bloco"); +define( '_MD_A_MYBLOCKSADMIN_NOTICE4COMMONFCK' , "Se você deseja utilizar um editor visual (WYSIWYG), instale-o em /common/fckeditor"); +define( '_MD_A_MYBLOCKSADMIN_OPTIONS' , "Blocos"); +define( '_MD_A_MYBLOCKSADMIN_PERM_MADMIN' , "Administrar"); +define( '_MD_A_MYBLOCKSADMIN_PERM_MREAD' , "Acessar"); +define( '_MD_A_MYBLOCKSADMIN_PERMADDNG' , "Não foi possível aplicar as permissões de %s ao módulo %s para o grupo %s"); +define( '_MD_A_MYBLOCKSADMIN_PERMADDNGP' , "Todos os itens relacionados também devem ser selecionados."); +define( '_MD_A_MYBLOCKSADMIN_PERMADDOK' , "Foram aplicadas as permissões de %s ao módulo %s para o grupo %s."); +define( '_MD_A_MYBLOCKSADMIN_PERMFORM' , "Permissões"); +define( '_MD_A_MYBLOCKSADMIN_PERMRESETNG' , "Não foi possível anular as permissões do grupo no módulo %s"); +define( '_MD_A_MYBLOCKSADMIN_PERMUPDATED' , "Permissões atualizadas corretamente"); +define( '_MD_A_MYBLOCKSADMIN_SBLEFT' , "Esquerdo"); +define( '_MD_A_MYBLOCKSADMIN_SBRIGHT' , "Direito"); +define( '_MD_A_MYBLOCKSADMIN_SIDE' , "Lado"); +define( '_MD_A_MYBLOCKSADMIN_TITLE' , "Título"); +define( '_MD_A_MYBLOCKSADMIN_TOPPAGE' , "Página inicial"); +define( '_MD_A_MYBLOCKSADMIN_VISIBLE' , "Visível"); +define( '_MD_A_MYBLOCKSADMIN_VISIBLEIN' , "Visível em"); +define( '_MD_A_MYBLOCKSADMIN_WEIGHT' , "Peso"); diff --git a/xoops_trust_path/libs/altsys/language/pt_utf8/mylangadmin.php b/xoops_trust_path/libs/altsys/language/pt_utf8/mylangadmin.php index ec3b148..7f54958 100644 --- a/xoops_trust_path/libs/altsys/language/pt_utf8/mylangadmin.php +++ b/xoops_trust_path/libs/altsys/language/pt_utf8/mylangadmin.php @@ -1,23 +1,23 @@ %s em %s"); -define("_MYLANGADMIN_H3_MODULE", "Módulo alvo"); -define("_MYLANGADMIN_MSG_D3LANGMANENABLED", "O sistema de substituição está habilitado agora."); -define("_MYLANGADMIN_MSG_HOWTOENABLED3LANGMAN4X2", "O sistema de substituição não está funcionando com o núcleo desta versão do XOOPS Cube, exceto alguns módulos D3. Se você deseja habilitá-lo neste core, tente um hack como este:"); -define("_MYLANGADMIN_MSG_NOTICE4ALREADYREAD", "Desde que este arquivo já tenha sido lido pelo sistema, esta coluna significa o valor corrente"); -define("_MYLANGADMIN_NOTCREATED", "Ainda não foi criado"); -define("_MYLANGADMIN_NOTE_ADDEDBYMYLANG", "(uma constante criada pelo utilizador)"); -define("_MYLANGADMIN_TH_CONSTANTNAME", "Nome da constante"); -define("_MYLANGADMIN_TH_DEFAULTVALUE", "Valor Padrão"); -define("_MYLANGADMIN_TH_USERVALUE", "Valor personalizado"); +define( '_MYLANGADMIN_BTN_RESET' , "Redefinir"); +define( '_MYLANGADMIN_BTN_UPDATE' , "Atualizar"); +define( '_MYLANGADMIN_CACHEUPDATED' , "O arquivo cache foi atualizado"); +define( '_MYLANGADMIN_CREATED' , "Criado"); +define( '_MYLANGADMIN_DT_CACHEFILENAME' , "Nome do arquivo cache"); +define( '_MYLANGADMIN_DT_CACHESTATUS' , "Situação do cache"); +define( '_MYLANGADMIN_DT_MYLANGFILENAME' , "Nome do arquivo parcialmente alterado"); +define( '_MYLANGADMIN_ERR_MODEMPTYLANGDIR' , "O módulo selecionado não tem arquivo de idioma com permissão de leitura"); +define( '_MYLANGADMIN_ERR_MODLANGINCOMPATIBLE' , "O módulo selecionado tem estrutura de idioma incompatível"); +define( '_MYLANGADMIN_ERR_MODNOLANGUAGE' , "O módulo selecionado não tem pasta de idioma"); +define( '_MYLANGADMIN_FMT_HOWTOENABLED3LANGMAN4XCL' , "O sistema de substituição está desabilitado agora. Para habilitá-lo, copie %s em %s"); +define( '_MYLANGADMIN_H3_MODULE' , "Módulo alvo"); +define( '_MYLANGADMIN_MSG_D3LANGMANENABLED' , "O sistema de substituição está habilitado agora."); +define( '_MYLANGADMIN_MSG_HOWTOENABLED3LANGMAN4X2' , "O sistema de substituição não está funcionando com o núcleo desta versão do XOOPS Cube, exceto alguns módulos D3. Se você deseja habilitá-lo neste core, tente um hack como este:"); +define( '_MYLANGADMIN_MSG_NOTICE4ALREADYREAD' , "Desde que este arquivo já tenha sido lido pelo sistema, esta coluna significa o valor corrente"); +define( '_MYLANGADMIN_NOTCREATED' , "Ainda não foi criado"); +define( '_MYLANGADMIN_NOTE_ADDEDBYMYLANG' , "(uma constante criada pelo utilizador)"); +define( '_MYLANGADMIN_TH_CONSTANTNAME' , "Nome da constante"); +define( '_MYLANGADMIN_TH_DEFAULTVALUE' , "Valor Padrão"); +define( '_MYLANGADMIN_TH_USERVALUE' , "Valor personalizado"); diff --git a/xoops_trust_path/libs/altsys/language/pt_utf8/mypreferences.php b/xoops_trust_path/libs/altsys/language/pt_utf8/mypreferences.php index 4de1196..bda61da 100644 --- a/xoops_trust_path/libs/altsys/language/pt_utf8/mypreferences.php +++ b/xoops_trust_path/libs/altsys/language/pt_utf8/mypreferences.php @@ -1,5 +1,5 @@ Extraiga el archivo que descarg.
Ejecute los archivos cuyas extensiones son .mxi y encontrar los dilogos de instalacin.
Los "snippets" para las variables de las plantillas de su sitio pueden ser usadas despus de reiniciar Dream Weaver.') ; - -define('_TPLSADMIN_DT_GETTEMPLATES', 'Descargar plantillas') ; -define('_TPLSADMIN_DD_GETTEMPLATES', 'Seleccione un conjunto antes de hacer clic en el botn para elegir el formato del archivo a descargar') ; - -define('_TPLSADMIN_FMT_MSG_PUTTEMPLATES', '%d plantillas fueron importadas.') ; -define('_TPLSADMIN_DT_PUTTEMPLATES', 'Subir un conjunto de plantillas') ; -define('_TPLSADMIN_DD_PUTTEMPLATES', 'Seleccione un conjunto de plantillas que desee subir o usar para sobreescribir otro existente cuando haya subido el archivo zip/tgz que incluya archivos de plantillas (.html). No necesita comprobar las rutas en el archivo.') ; - - -define('_TPLSADMIN_ERR_NOTUPLOADED', 'Los archivos no fueron subidos.') ; -define('_TPLSADMIN_ERR_EXTENSION', 'Esta extensin no pudo ser reconocida.') ; -define('_TPLSADMIN_ERR_INVALIDARCHIVE', 'El archivo no pudo ser descomprimido.') ; -define('_TPLSADMIN_ERR_INVALIDTPLSET', 'Se ha especificado un nombre invlido para el conjunto de plantillas.') ; - -define('_TPLSADMIN_ERR_NOTPLSVARSINFO', 'No hay archivos con informacin de las variables de las plantillas.') ; - -define('_TPLSADMIN_NUMCAP_COMPILEDCACHES', 'Archivos de cache de las plantillas') ; -define('_TPLSADMIN_NUMCAP_TPLSVARS', 'Archivos de informacin de las variables de las plantillas') ; diff --git a/xoops_trust_path/libs/altsys/language/spanish/modinfo.php b/xoops_trust_path/libs/altsys/language/spanish/modinfo.php deleted file mode 100644 index 2574fb8..0000000 --- a/xoops_trust_path/libs/altsys/language/spanish/modinfo.php +++ /dev/null @@ -1,37 +0,0 @@ -include XOOPS_TRUST_PATH.\'/libs/altsys/include/admin_in_theme.inc.php\';
para activar esta caracterstica') ; - -define('_MI_ALTSYS_ENABLEFORCECLONE', 'Forzar que todos los bloques sean duplicables') ; -define('_MI_ALTSYS_ENABLEFORCECLONEDSC', 'Tenga en cuenta que hay bloques que pueden causar errores si son mostrados varias veces en la misma pgina.') ; - -define('_MI_ALTSYS_IMAGES_DIR', 'Carpeta para los archivos de imagen'); -define('_MI_ALTSYS_IMAGES_DIRDSC', 'La ruta relativa debera establecerse en la carpeta del mdulo. Ruta predeterminada: images'); diff --git a/xoops_trust_path/libs/altsys/language/spanish/myblocksadmin.php b/xoops_trust_path/libs/altsys/language/spanish/myblocksadmin.php deleted file mode 100644 index f47415a..0000000 --- a/xoops_trust_path/libs/altsys/language/spanish/myblocksadmin.php +++ /dev/null @@ -1,58 +0,0 @@ - // -// ------------------------------------------------------------------------- // - -require_once dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php' ; -require_once dirname(__FILE__).'/include/gtickets.php' ; -include_once dirname(__FILE__).'/include/altsys_functions.php' ; -include_once dirname(__FILE__).'/include/mygrouppermform.php' ; -include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; +/** + * Altsys library (UI-Components) for D3 modules + * Admin Blocks of each module + * @package Altsys + * @version XCL 2.3.1 + * @author Other authors Gigamaster, 2020 XCL PHP7 + * @author Gijoe (Peak) + * @copyright (c) 2005-2022 Authors + * @license GPL v2.0 + */ + + +require_once __DIR__ . '/class/AltsysBreadcrumbs.class.php'; +require_once __DIR__ . '/include/gtickets.php'; +include_once __DIR__ . '/include/altsys_functions.php'; +include_once __DIR__ . '/include/mygrouppermform.php'; +include_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; // language file -altsys_include_language_file('myblocksadmin') ; +altsys_include_language_file( 'myblocksadmin' ); +altsys_get_core_type( ALTSYS_CORE_TYPE_XCL21 ); +include_once __DIR__ . '/class/MyBlocksAdminForXCL21.class.php'; +$myba =& MyBlocksAdminForXCL21::getInstance(); -// fork by core types -switch (altsys_get_core_type()) { - case ALTSYS_CORE_TYPE_X22 : - include_once dirname(__FILE__).'/class/MyBlocksAdminForX22.class.php' ; - $myba =& MyBlocksAdminForX22::getInstance() ; - break ; - case ALTSYS_CORE_TYPE_X25 : - include_once dirname(__FILE__).'/class/MyBlocksAdminForX25.class.php' ; - $myba =& MyBlocksAdminForX25::getInstance() ; - break ; - case ALTSYS_CORE_TYPE_XCL21 : - include_once dirname(__FILE__).'/class/MyBlocksAdminForXCL21.class.php' ; - $myba =& MyBlocksAdminForXCL21::getInstance() ; - break ; - case ALTSYS_CORE_TYPE_ICMS : - include_once dirname(__FILE__).'/class/MyBlocksAdminForICMS.class.php' ; - $myba =& MyBlocksAdminForICMS::getInstance() ; - break ; - case ALTSYS_CORE_TYPE_X20S : - case ALTSYS_CORE_TYPE_X23P : - include_once dirname(__FILE__).'/class/MyBlocksAdminForX20S.class.php' ; - $myba =& MyBlocksAdminForX20S::getInstance() ; - break ; - default : - include_once dirname(__FILE__).'/class/MyBlocksAdmin.class.php' ; - $myba =& MyBlocksAdmin::getInstance() ; - break ; -} // permission -$myba->checkPermission() ; +$myba->checkPermission(); // set parameters target_mid , target_dirname etc. -$myba->init($xoopsModule) ; +$myba->init( $xoopsModule ); -// -// transaction stage -// - -if (! empty($_POST)) { - $myba->processPost() ; +// transaction +if ( ! empty( $_POST ) ) { + $myba->processPost(); } -// -// form stage -// + +// RENDER View // header -xoops_cp_header() ; +xoops_cp_header(); // mymenu -altsys_include_mymenu() ; +altsys_include_mymenu(); -$myba->processGet() ; +$myba->processGet(); // footer -xoops_cp_footer() ; +xoops_cp_footer(); diff --git a/xoops_trust_path/libs/altsys/mylangadmin.php b/xoops_trust_path/libs/altsys/mylangadmin.php index ccedb3c..075f411 100644 --- a/xoops_trust_path/libs/altsys/mylangadmin.php +++ b/xoops_trust_path/libs/altsys/mylangadmin.php @@ -1,174 +1,181 @@ // -// ------------------------------------------------------------------------- // +/** + * Altsys library (UI-Components) for D3 modules + * Language constants admin + * @package Altsys + * @version XCL 2.3.1 + * @author Other authors Gigamaster, 2020 XCL PHP7 + * @author Gijoe (Peak) + * @copyright (c) 2005-2022 Authors + * @license GPL v2.0 + */ -require_once dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php' ; -include_once dirname(__FILE__)."/include/gtickets.php" ; -include_once dirname(__FILE__).'/include/altsys_functions.php' ; -include_once dirname(__FILE__).'/include/lang_functions.php' ; -include_once dirname(__FILE__).'/class/D3LanguageManager.class.php' ; + +require_once __DIR__ . '/class/AltsysBreadcrumbs.class.php'; +include_once __DIR__ . '/include/gtickets.php'; +include_once __DIR__ . '/include/altsys_functions.php'; +include_once __DIR__ . '/include/lang_functions.php'; +include_once __DIR__ . '/class/D3LanguageManager.class.php'; // only groups have 'module_admin' of 'altsys' can do that. -$module_handler =& xoops_gethandler('module') ; -$module =& $module_handler->getByDirname('altsys') ; -if (! is_object($module)) { - die('install altsys') ; +$module_handler = xoops_gethandler( 'module' ); +$module = $module_handler->getByDirname( 'altsys' ); +if ( ! is_object( $module ) ) { + die( 'install altsys' ); } -$moduleperm_handler =& xoops_gethandler('groupperm') ; -if (! is_object(@$xoopsUser) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) { - die('only admin of altsys can access this area') ; +$moduleperm_handler = xoops_gethandler( 'groupperm' ); +if ( ! is_object( @$xoopsUser ) || ! $moduleperm_handler->checkRight( 'module_admin', $module->getVar( 'mid' ), $xoopsUser->getGroups() ) ) { + die( 'only admin of altsys can access this area' ); } -// initials -$db =& XoopsDatabaseFactory::getDatabaseConnection(); -(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance() ; -$langman =& D3LanguageManager::getInstance() ; +// initial +$db = XoopsDatabaseFactory::getDatabaseConnection(); +( method_exists( 'MyTextSanitizer', 'sGetInstance' ) and $myts = MyTextSanitizer::sGetInstance() ) || $myts =& MyTextSanitizer::getInstance(); +$langman = D3LanguageManager::getInstance(); // language file of this controller -altsys_include_language_file('mylangadmin') ; +altsys_include_language_file( 'mylangadmin' ); // check $xoopsModule -if (! is_object($xoopsModule)) { - redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM) ; +if ( ! is_object( $xoopsModule ) ) { + redirect_header( XOOPS_URL . '/user.php', 1, _NOPERM ); } // set target_module if specified by $_GET['dirname'] -$module_handler =& xoops_gethandler('module'); -if (! empty($_GET['dirname'])) { - $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']) ; - $target_module =& $module_handler->getByDirname($dirname) ; +$module_handler = xoops_gethandler( 'module' ); +if ( ! empty( $_GET['dirname'] ) ) { + $dirname = preg_replace( '/[^0-9a-zA-Z_-]/', '', $_GET['dirname'] ); + $target_module = $module_handler->getByDirname( $dirname ); } -if (! empty($target_module) && is_object($target_module)) { - // specified by dirname (for langadmin as an independent module) - $target_mid = $target_module->getVar('mid') ; - $target_dirname = $target_module->getVar('dirname') ; - $target_dirname4sql = addslashes($target_dirname) ; - $target_mname = $target_module->getVar('name') . " " . sprintf("(%2.2f)", $target_module->getVar('version') / 100.0) ; - //$query4redirect = '?dirname='.urlencode(strip_tags($_GET['dirname'])) ; +if ( ! empty( $target_module ) && is_object( $target_module ) ) { + // specified by dirname (for langadmin as an independent module) + $target_mid = $target_module->getVar( 'mid' ); + $target_dirname = $target_module->getVar( 'dirname' ); + $target_dirname4sql = addslashes( $target_dirname ); + //$target_mname = $target_module->getVar( 'name' ) . ' ' . sprintf( '(%2.2f)', $target_module->getVar( 'version' ) / 100.0 ); + $target_mname = $target_module->getVar( 'name' ) . sprintf( 'v %2.2f ', $target_module->getVar( 'version' ) / 100.0 ); + //$query4redirect = '?dirname='.urlencode(strip_tags($_GET['dirname'])) ; } else { - // not specified by dirname (for 3rd party modules as mylangadmin) - $target_mid = $xoopsModule->getVar('mid') ; - $target_dirname = $xoopsModule->getVar('dirname') ; - $target_dirname4sql = addslashes($target_dirname) ; - $target_mname = $xoopsModule->getVar('name') ; - //$query4redirect = '' ; + // not specified by dirname (for 3rd party modules as mylangadmin) + $target_mid = $xoopsModule->getVar( 'mid' ); + $target_dirname = $xoopsModule->getVar( 'dirname' ); + $target_dirname4sql = addslashes( $target_dirname ); + $target_mname = $xoopsModule->getVar( 'name' ); + //$query4redirect = '' ; } // basic GET variables -$target_lang = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['target_lang']) ; -if (empty($target_lang)) { - $target_lang = $GLOBALS['xoopsConfig']['language'] ; +$target_lang = preg_replace( '/[^0-9a-zA-Z_-]/', '', @$_GET['target_lang'] ); +if ( empty( $target_lang ) ) { + $target_lang = $GLOBALS['xoopsConfig']['language']; } -$target_lang4sql = addslashes($target_lang) ; -$target_file = preg_replace('/[^0-9a-zA-Z_.-]/', '', @$_GET['target_file']) ; -if (empty($target_file)) { - $target_file = 'main.php' ; +$target_lang4sql = addslashes( $target_lang ); +$target_file = preg_replace( '/[^0-9a-zA-Z_.-]/', '', @$_GET['target_file'] ); +if ( empty( $target_file ) ) { + $target_file = 'main.php'; } // get $target_trustdirname -$mytrustdirname = '' ; -if (file_exists(XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/mytrustdirname.php')) { - require XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/mytrustdirname.php' ; +$mytrustdirname = ''; +if ( file_exists( XOOPS_ROOT_PATH . '/modules/' . $target_dirname . '/mytrustdirname.php' ) ) { + require XOOPS_ROOT_PATH . '/modules/' . $target_dirname . '/mytrustdirname.php'; } -$target_trustdirname = $mytrustdirname ; +$target_trustdirname = $mytrustdirname; // get base directory -if (empty($target_trustdirname)) { - // conventinal module - $base_dir = XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/language' ; +if ( empty( $target_trustdirname ) ) { + // conventional module + $base_dir = XOOPS_ROOT_PATH . '/modules/' . $target_dirname . '/language'; } else { - // D3 module - $base_dir = XOOPS_TRUST_PATH.'/modules/'.$target_trustdirname.'/language' ; + // D3 module + $base_dir = XOOPS_TRUST_PATH . '/modules/' . $target_trustdirname . '/language'; } // make list of language and check $target_lang -$languages = array() ; -$languages4disp = array() ; -if (! is_dir($base_dir)) { - altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODNOLANGUAGE) ; +$languages = []; +$languages4disp = []; +if ( ! is_dir( $base_dir ) ) { + altsys_mylangadmin_errordie( $target_mname, '
'._MYLANGADMIN_ERR_MODNOLANGUAGE.'
' ); } -$dh = opendir($base_dir) ; -if ($dh) { - while ($file = readdir($dh)) { - if (substr($file, 0, 1) == '.') { - continue ; - } - if (is_dir("$base_dir/$file")) { - list($count) = $db->fetchRow($db->query("SELECT COUNT(*) FROM ".$db->prefix("altsys_language_constants")." WHERE mid=$target_mid AND language='".addslashes($file)."'")) ; - $languages[] = $file ; - $languages4disp[] = $file . " ($count)" ; - } - } +$dh = opendir( $base_dir ); +if ( $dh ) { + while ( $file = readdir( $dh ) ) { + if ( '.' == mb_substr( $file, 0, 1 ) ) { + continue; + } + if ( is_dir( "$base_dir/$file" ) ) { + [ $count ] = $db->fetchRow( $db->query( 'SELECT COUNT(*) FROM ' . $db->prefix( 'altsys_language_constants' ) . " WHERE mid=$target_mid AND language='" . addslashes( $file ) . "'" ) ); + $languages[] = $file; + $languages4disp[] = $file . " ($count)"; + } + } } -closedir($dh) ; -if (! in_array($target_lang, $languages)) { - $target_lang = $languages[0] ; +closedir( $dh ); +if ( ! in_array( $target_lang, $languages, true ) ) { + $target_lang = $languages[0]; } // get base directory seleced language -$lang_base_dir = $base_dir.'/'.$target_lang ; -if (! is_dir($lang_base_dir)) { - altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODLANGINCOMPATIBLE) ; +$lang_base_dir = $base_dir . '/' . $target_lang; +if ( ! is_dir( $lang_base_dir ) ) { + altsys_mylangadmin_errordie( $target_mname, _MYLANGADMIN_ERR_MODLANGINCOMPATIBLE ); } // make list of files and check $target_file -$lang_files = array() ; -$dh = opendir($lang_base_dir) ; -if ($dh) { - while ($file = readdir($dh)) { - if (substr($file, 0, 1) == '.') { - continue ; - } - if ($file == 'index.html') { - continue ; - } - //if( $file == 'modinfo.php' ) continue ; // TODO(?) - //if( $file == 'global.php' ) continue ; // TODO(?) - if (is_file("$lang_base_dir/$file")) { - $lang_files[] = $file ; - } - } +$lang_files = []; +$dh = opendir( $lang_base_dir ); +if ( $dh ) { + while ( $file = readdir( $dh ) ) { + if ( '.' == mb_substr( $file, 0, 1 ) ) { + continue; + } + if ( 'index.html' == $file ) { + continue; + } + //if( $file == 'modinfo.php' ) continue ; // TODO(?) + //if( $file == 'global.php' ) continue ; // TODO(?) + if ( is_file( "$lang_base_dir/$file" ) ) { + $lang_files[] = $file; + } + } } -closedir($dh) ; -if (empty($lang_files)) { - altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODEMPTYLANGDIR) ; +closedir( $dh ); +if ( empty( $lang_files ) ) { + altsys_mylangadmin_errordie( $target_mname, _MYLANGADMIN_ERR_MODEMPTYLANGDIR ); } -if (! in_array($target_file, $lang_files)) { - $target_file = $lang_files[0] ; +if ( ! in_array( $target_file, $lang_files, true ) ) { + $target_file = $lang_files[0]; } // get unique path of language_file -$langfile_unique_path = "$lang_base_dir/$target_file" ; +$langfile_unique_path = "$lang_base_dir/$target_file"; // get constants defined by the target_file -list($langfile_names, $constpref, $already_read) = altsys_mylangadmin_get_constant_names($langfile_unique_path, $target_dirname) ; +list( $langfile_names, $constpref, $already_read ) = altsys_mylangadmin_get_constant_names( $langfile_unique_path, $target_dirname ); // get user_values should be overridden -$langfile_constants = array() ; -foreach ($langfile_names as $name) { - list($value) = $db->fetchRow($db->query("SELECT value FROM ".$db->prefix("altsys_language_constants")." WHERE mid=$target_mid AND language='$target_lang4sql' AND name='".addslashes($name)."'")) ; - $langfile_constants[ $name ] = $value ; +$langfile_constants = []; +foreach ( $langfile_names as $name ) { + [ $value ] = $db->fetchRow( $db->query( 'SELECT value FROM ' . $db->prefix( 'altsys_language_constants' ) . " WHERE mid=$target_mid AND language='$target_lang4sql' AND name='" . addslashes( $name ) . "'" ) ); + $langfile_constants[ $name ] = $value; } // constants defined in XOOPS_ROOT_PATH/my_language/(dirname)/... -if ($langman->my_language) { - $mylang_unique_path = $langman->my_language.'/modules/'.$target_dirname.'/'.$target_lang.'/'.$target_file ; - $mylang_constants = array_map('htmlspecialchars', altsys_mylangadmin_get_constants_by_pcre($mylang_unique_path)) ; - foreach ($mylang_constants as $key => $val) { - if (! in_array($key, array_keys($langfile_constants))) { - $langfile_constants[ $key ] = null ; - define($key, _MYLANGADMIN_NOTE_ADDEDBYMYLANG) ; - } - } +if ( $langman->my_language ) { + $mylang_unique_path = $langman->my_language . '/modules/' . $target_dirname . '/' . $target_lang . '/' . $target_file; + $mylang_constants = array_map( 'htmlspecialchars', altsys_mylangadmin_get_constants_by_pcre( $mylang_unique_path ) ); + foreach ( $mylang_constants as $key => $val ) { + if ( ! array_key_exists( $key, $langfile_constants ) ) { + $langfile_constants[ $key ] = null; + define( $key, _MYLANGADMIN_NOTE_ADDEDBYMYLANG ); + } + } } else { - $mylang_unique_path = '' ; - $mylang_constants = array() ; + $mylang_unique_path = ''; + $mylang_constants = []; } @@ -177,57 +184,57 @@ // // Update language table and cache file -if (! empty($_POST['do_update'])) { - // Ticket Check - if (! $xoopsGTicket->check(true, 'altsys')) { - redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); - } - - // read original file - $file_contents = file_get_contents($langfile_unique_path) ; - - // insert fingerprint of langfile_unique_path - $langfile_fingerprint = '_MYLANGADMIN_'.md5($langfile_unique_path) ; - $file_contents = str_replace('stripSlashesGPC(@$_POST[$name]) ; - $db->query("DELETE FROM ".$db->prefix("altsys_language_constants")." WHERE mid=$target_mid AND language='$target_lang4sql' AND name='".addslashes($name)."'") ; - if ($user_value !== '') { - $overrides_counter ++ ; - // Update table - $db->query("INSERT INTO ".$db->prefix("altsys_language_constants")." (mid,language,name,value) VALUES ($target_mid,'$target_lang4sql','".addslashes($name)."','".addslashes($user_value)."')") ; - // rewrite script for cache - // comment-out the line of define() - if (empty($constpref)) { - $from = '/.*define\s?\(\s*(["\'])'.preg_quote($name).'(\\1).*\;.*/' ; - } else { - $from = '/.*define\s?\(\s*\$constpref\s*\.\s*(["\'])'.preg_quote(substr($name, strlen($constpref))).'(\\1).*\;.*/' ; - } - $to = '//$0'."\ndefine('".addslashes($name)."','".addslashes($user_value)."');" ; - $file_contents = preg_replace($from, $to, $file_contents) ; - } - } - - // get the file name for caching - $cache_file_name = $langman->getCacheFileName($target_file, $target_dirname, $target_lang) ; - - // Create language cache file - if ($overrides_counter > 0) { - $fp = fopen($cache_file_name, 'wb') ; - if (! $fp) { - die('Invalid Cache Directory. (Set XOOPS_TRUST_PATH/cache writable)') ; - } - fwrite($fp, $file_contents) ; - fclose($fp) ; - } else { - unlink($cache_file_name) ; - } - - redirect_header('?mode=admin&lib=altsys&page=mylangadmin&dirname='.$target_dirname.'&target_lang='.rawurlencode($target_lang).'&target_file='.rawurlencode($target_file), 1, _MYLANGADMIN_CACHEUPDATED) ; - exit ; +if ( ! empty( $_POST['do_update'] ) ) { + // Ticket Check + if ( ! $xoopsGTicket->check( true, 'altsys' ) ) { + redirect_header( XOOPS_URL . '/', 3, $xoopsGTicket->getErrors() ); + } + + // read original file + $file_contents = file_get_contents( $langfile_unique_path ); + + // insert fingerprint of langfile_unique_path + $langfile_fingerprint = '_MYLANGADMIN_' . md5( $langfile_unique_path ); + $file_contents = str_replace( 'stripSlashesGPC( @$_POST[ $name ] ); + $db->query( 'DELETE FROM ' . $db->prefix( 'altsys_language_constants' ) . " WHERE mid=$target_mid AND language='$target_lang4sql' AND name='" . addslashes( $name ) . "'" ); + if ( '' !== $user_value ) { + $overrides_counter ++; + // Update table + $db->query( 'INSERT INTO ' . $db->prefix( 'altsys_language_constants' ) . " (mid,language,name,value) VALUES ($target_mid,'$target_lang4sql','" . addslashes( $name ) . "','" . addslashes( $user_value ) . "')" ); + // rewrite script for cache + // comment-out the line of define() + if ( empty( $constpref ) ) { + $from = '/.*define\s?\(\s*(["\'])' . preg_quote( $name ) . '(\\1).*\;.*/'; + } else { + $from = '/.*define\s?\(\s*\$constpref\s*\.\s*(["\'])' . preg_quote( substr( $name, strlen( $constpref ) ) ) . '(\\1).*\;.*/'; + } + $to = '//$0' . "\ndefine('" . addslashes( $name ) . "','" . addslashes( $user_value ) . "');"; + $file_contents = preg_replace( $from, $to, $file_contents ); + } + } + + // get the file name for caching + $cache_file_name = $langman->getCacheFileName( $target_file, $target_dirname, $target_lang ); + + // Create language cache file + if ( $overrides_counter > 0 ) { + $fp = fopen( $cache_file_name, 'wb' ); + if ( ! $fp ) { + die( 'Invalid Cache Directory. (Set XOOPS_TRUST_PATH/cache writable)' ); + } + fwrite( $fp, $file_contents ); + fclose( $fp ); + } else { + unlink( $cache_file_name ); + } + + redirect_header( '?mode=admin&lib=altsys&page=mylangadmin&dirname=' . $target_dirname . '&target_lang=' . rawurlencode( $target_lang ) . '&target_file=' . rawurlencode( $target_file ), 1, _MYLANGADMIN_CACHEUPDATED ); + exit; } @@ -236,37 +243,19 @@ // // check cache file -$cache_file_name = $langman->getCacheFileName($target_file, $target_dirname, $target_lang) ; -$cache_file_mtime = file_exists($cache_file_name) ? filemtime($cache_file_name) : 0 ; +$cache_file_name = $langman->getCacheFileName( $target_file, $target_dirname, $target_lang ); +$cache_file_mtime = file_exists( $cache_file_name ) ? filemtime( $cache_file_name ) : 0; // check core version and generate message to enable D3LanguageManager -if (altsys_get_core_type() == ALTSYS_CORE_TYPE_XCL21) { - // XoopsCube Legacy without preload - if (class_exists('AltsysLangMgr_LanguageManager')) { - // the preload enabled - $notice4disp = _MYLANGADMIN_MSG_D3LANGMANENABLED ; - } else { - // the preload disabled - $notice4disp = sprintf(_MYLANGADMIN_FMT_HOWTOENABLED3LANGMAN4XCL, 'SetupAltsysLangMgr.class.php', 'XOOPS_ROOT_PATH/preload') ; - } -} else { - // X2 core etc. - $notice4disp = _MYLANGADMIN_MSG_HOWTOENABLED3LANGMAN4X2.'
' ; - $notice4disp .= ' -

include/common.php

-
-        if ( file_exists(XOOPS_ROOT_PATH."/modules/"...."/main.php") ) {
-            include_once XOOPS_ROOT_PATH."/modules/"...."/main.php";
-        } else {
-            if ( file_exists(XOOPS_ROOT_PATH..../english/main.php") ) {
-                include_once XOOPS_ROOT_PATH..../english/main.php";
-            }
-        }
-        require_once XOOPS_TRUST_PATH."/libs/altsys/class/D3LanguageManager.class.php" ;
-        $langman =& D3LanguageManager::getInstance() ;
-        $langman->read( "main.php" , $xoopsModule->getVar("dirname") ) ;
-		
- ' ; +if ( ALTSYS_CORE_TYPE_XCL21 == altsys_get_core_type() ) { + // XoopsCube Legacy without preload + if ( class_exists( 'AltsysLangMgr_LanguageManager' ) ) { + // the preload enabled + $notice4disp = _MYLANGADMIN_MSG_D3LANGMANENABLED; + } else { + // the preload disabled + $notice4disp = sprintf( _MYLANGADMIN_FMT_HOWTOENABLED3LANGMAN4XCL, 'SetupAltsysLangMgr.class.php', 'XOOPS_ROOT_PATH/preload' ); + } } @@ -274,41 +263,44 @@ // display stage // - -xoops_cp_header() ; +xoops_cp_header(); // mymenu -altsys_include_mymenu() ; +altsys_include_mymenu(); // breadcrumbs -$breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; -if ($breadcrumbsObj->hasPaths()) { - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mylangadmin', _MI_ALTSYS_MENU_MYLANGADMIN) ; - $breadcrumbsObj->appendPath('', $target_mname) ; +$breadcrumbsObj = AltsysBreadcrumbs::getInstance(); +if ( $breadcrumbsObj->hasPaths() ) { + $breadcrumbsObj->appendPath( XOOPS_URL . '/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mylangadmin', _MI_ALTSYS_MENU_MYLANGADMIN ); + $breadcrumbsObj->appendPath( '', $target_mname ); } -require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; -$tpl = new D3Tpl() ; -$tpl->assign(array( - 'target_dirname' => $target_dirname, - 'target_mname' => $target_mname, - 'target_lang' => $target_lang, - 'languages' => $languages, - 'languages4disp' => $languages4disp, - 'target_file' => $target_file, - 'lang_files' => $lang_files, - 'langfile_constants' => $langfile_constants, - 'mylang_constants' => $mylang_constants, - 'use_my_language' => strlen($langman->my_language) > 0, - 'mylang_file_name' => htmlspecialchars($mylang_unique_path, ENT_QUOTES), - 'cache_file_name' => htmlspecialchars($cache_file_name, ENT_QUOTES), - 'cache_file_mtime' => intval($cache_file_mtime), - 'timezone_offset' => xoops_getUserTimestamp(0), - 'notice' => $notice4disp, - 'already_read' => $already_read, - 'gticket_hidden' => $xoopsGTicket->getTicketHtml(__LINE__, 1800, 'altsys'), -)) ; -$tpl->display('db:altsys_main_mylangadmin.html') ; - -xoops_cp_footer() ; -exit ; +require_once XOOPS_TRUST_PATH . '/libs/altsys/class/D3Tpl.class.php'; + +$tpl = new D3Tpl(); + +$tpl->assign( + [ + 'target_dirname' => $target_dirname, + 'target_mname' => $target_mname, + 'target_lang' => $target_lang, + 'languages' => $languages, + 'languages4disp' => $languages4disp, + 'target_file' => $target_file, + 'lang_files' => $lang_files, + 'langfile_constants' => $langfile_constants, + 'mylang_constants' => $mylang_constants, + 'use_my_language' => strlen( $langman->my_language ) > 0, + 'mylang_file_name' => htmlspecialchars( $mylang_unique_path, ENT_QUOTES ), + 'cache_file_name' => htmlspecialchars( $cache_file_name, ENT_QUOTES ), + 'cache_file_mtime' => (int) $cache_file_mtime, + 'timezone_offset' => xoops_getUserTimestamp( 0 ), + 'notice' => $notice4disp, + 'already_read' => $already_read, + 'gticket_hidden' => $xoopsGTicket->getTicketHtml( __LINE__, 1800, 'altsys' ), + ] +); +$tpl->display( 'db:altsys_main_lang_admin.html' ); + +xoops_cp_footer(); +exit; diff --git a/xoops_trust_path/libs/altsys/mymenu.php b/xoops_trust_path/libs/altsys/mymenu.php index 4febae5..7920139 100644 --- a/xoops_trust_path/libs/altsys/mymenu.php +++ b/xoops_trust_path/libs/altsys/mymenu.php @@ -1,72 +1,85 @@ XOOPS_URL.'/modules/altsys/admin/index.php' , 'name' => $xoopsModule->getVar('name') ) ) ; +//$GLOBALS['dirname'] = array( array( 'url' => XOOPS_URL.'/modules/altsys/admin/index.php' , 'name' => $xoopsModule->getVar('name') ) ) ; // highlight -foreach (array_keys($adminmenu) as $i) { - if ($mymenu_link == $adminmenu[$i]['link']) { - $adminmenu[$i]['selected'] = true ; - $adminmenu_hilighted = true ; -// $GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'url' => XOOPS_URL."/modules/altsys/".htmlspecialchars($adminmenu[$i]['link'],ENT_QUOTES) , 'name' => htmlspecialchars( $adminmenu[$i]['title'] , ENT_QUOTES ) ) ; - } else { - $adminmenu[$i]['selected'] = false ; - } +foreach ( array_keys( $adminmenu ) as $i ) { + if ( $mymenu_link == $adminmenu[ $i ]['link'] ) { + $adminmenu[ $i ]['selected'] = true; + $adminmenu_hilighted = true; + // $mydirname['dirname'][] = array( 'url' => XOOPS_URL."/modules/altsys/".htmlspecialchars($adminmenu[$i]['link'],ENT_QUOTES) , 'name' => htmlspecialchars( $adminmenu[$i]['title'] , ENT_QUOTES ) ) ; + } else { + $adminmenu[ $i ]['selected'] = false; + } } -if (empty($adminmenu_hilighted)) { - foreach (array_keys($adminmenu) as $i) { - if (stristr($mymenu_uri, $adminmenu[$i]['link'])) { - $adminmenu[$i]['selected'] = true ; +if ( empty( $adminmenu_hilighted ) ) { + foreach ( array_keys( $adminmenu ) as $i ) { + if ( mb_stristr( $mymenu_uri, $adminmenu[ $i ]['link'] ) ) { + $adminmenu[ $i ]['selected'] = true; // $GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'url' => XOOPS_URL."/modules/altsys/".htmlspecialchars($adminmenu[$i]['link'],ENT_QUOTES) , 'name' => htmlspecialchars( $adminmenu[$i]['title'] , ENT_QUOTES ) ) ; - break ; - } - } + break; + } + } } // link conversion from relative to absolute -foreach (array_keys($adminmenu) as $i) { - if (stristr($adminmenu[$i]['link'], XOOPS_URL) === false) { - $adminmenu[$i]['link'] = XOOPS_URL."/modules/$mydirname/" . $adminmenu[$i]['link'] ; - } +foreach ( array_keys( $adminmenu ) as $i ) { + if ( false === mb_stristr( $adminmenu[ $i ]['link'], XOOPS_URL ) ) { + $adminmenu[ $i ]['link'] = XOOPS_URL . "/modules/$mydirname/" . $adminmenu[ $i ]['link']; + // $adminmenu[$i]['name'] = XOOPS_URL . "/modules/$mydirname/index.php"; + } } +// Returns module dir name with the first character capitalized +// Assign to template for Admin Breadcrumbs +$dirname = ucfirst( $mydirname ); + // display -require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; -$tpl = new D3Tpl() ; -$tpl->assign(array( - 'adminmenu' => $adminmenu, -)) ; -$tpl->display('db:altsys_inc_mymenu.html') ; +require_once XOOPS_TRUST_PATH . '/libs/altsys/class/D3Tpl.class.php'; +$tpl = new D3Tpl(); +$tpl->assign( + [ + 'adminmenu' => $adminmenu, + 'dirname' => $dirname, + ] +); + +$tpl->display( 'db:altsys_inc_menu.html' ); // submenu -$page = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['page']) ; -if (file_exists(dirname(__FILE__).'/mymenusub/'.$page.'.php')) { - include dirname(__FILE__).'/mymenusub/'.$page.'.php' ; +$page = preg_replace( '/[^0-9a-zA-Z_-]/', '', @$_GET['page'] ); +if ( file_exists( __DIR__ . '/mymenusub/' . $page . '.php' ) ) { + include __DIR__ . '/mymenusub/' . $page . '.php'; } diff --git a/xoops_trust_path/libs/altsys/mymenusub/myblocksadmin.php b/xoops_trust_path/libs/altsys/mymenusub/myblocksadmin.php index bc7ca59..dc4c079 100644 --- a/xoops_trust_path/libs/altsys/mymenusub/myblocksadmin.php +++ b/xoops_trust_path/libs/altsys/mymenusub/myblocksadmin.php @@ -1,61 +1,73 @@ add(new Criteria('hasmain', 1)); - $criteria4menu->add(new Criteria('mid', '1', '>')); - $modules4menu =& $module_handler4menu->getObjects($criteria4menu, true); - $system_module =& $module_handler4menu->get(1) ; - if (is_object($system_module)) { - array_unshift($modules4menu, $system_module) ; - } - -$adminmenu = array() ; -foreach ($modules4menu as $m4menu) { - // get block info - if ($core_type != ALTSYS_CORE_TYPE_X22) { - list($block_count_all) = $db->fetchRow($db->query("SELECT COUNT(*) FROM ".$db->prefix("newblocks")." WHERE mid=".$m4menu->getVar('mid'))) ; - list($block_count_visible) = $db->fetchRow($db->query("SELECT COUNT(*) FROM ".$db->prefix("newblocks")." WHERE mid=".$m4menu->getVar('mid')." AND visible>0")) ; - // $block_desc = " $block_count_all($block_count_visible)" ; - $block_desc = " ($block_count_visible/$block_count_all)" ; - } else { - $block_desc = '' ; - } - - if ($m4menu->getVar('dirname') == $current_dirname) { - $adminmenu[] = array( - 'selected' => true , - 'title' => $m4menu->getVar('name', 'n') . $block_desc , - 'link' => '?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$m4menu->getVar('dirname', 'n') , - ) ; - //$GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'name' => $m4menu->getVar('name') ) ; - } else { - $adminmenu[] = array( - 'selected' => false , - 'title' => $m4menu->getVar('name', 'n') . $block_desc , - 'link' => '?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$m4menu->getVar('dirname', 'n') , - ) ; - } +// Module is active +$module_handler4menu = xoops_gethandler( 'module' ); +$criteria4menu = new CriteriaCompo( new Criteria( 'isactive', 1 ) ); + +//$criteria4menu->add(new Criteria('hasmain', 1)); +$criteria4menu->add( new Criteria( 'mid', '1', '>' ) ); +$modules4menu = $module_handler4menu->getObjects( $criteria4menu, true ); +$system_module = $module_handler4menu->get( 1 ); + +if ( is_object( $system_module ) ) { + array_unshift( $modules4menu, $system_module ); +} + +$adminmenu = []; + +foreach ( $modules4menu as $m4menu ) { + + $block_desc = ''; + $moduleIcon = ''; + + if ( $m4menu->getVar( 'dirname' ) == $current_dirname ) { + $adminmenu[] = [ + 'selected' => true, + 'title' => $m4menu->getVar( 'name', 'n' ) . $block_desc, + 'link' => '?mode=admin&lib=altsys&page=myblocksadmin&dirname=' . $m4menu->getVar( 'dirname', 'n' ), + 'icon' => $moduleIcon, + ]; + + } else { + $adminmenu[] = [ + 'selected' => false, + 'title' => $m4menu->getVar( 'name', 'n' ) . $block_desc, + 'link' => '?mode=admin&lib=altsys&page=myblocksadmin&dirname=' . $m4menu->getVar( 'dirname', 'n' ), + 'icon' => $moduleIcon, + ]; + } } // display -require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; -$tpl = new D3Tpl() ; -$tpl->assign(array( - 'adminmenu' => $adminmenu, - 'mypage' => 'myblocksadmin', -)) ; -$tpl->display('db:altsys_inc_mymenusub.html') ; +require_once XOOPS_TRUST_PATH . '/libs/altsys/class/D3Tpl.class.php'; + +$tpl = new D3Tpl(); +$tpl->assign( array( + 'adminmenu' => $adminmenu, + 'mypage' => 'myblocksadmin', +) ); + +$tpl->display( 'db:altsys_inc_menu_sub.html' ); diff --git a/xoops_trust_path/libs/altsys/mymenusub/mylangadmin.php b/xoops_trust_path/libs/altsys/mymenusub/mylangadmin.php index 8991771..a8f3961 100644 --- a/xoops_trust_path/libs/altsys/mymenusub/mylangadmin.php +++ b/xoops_trust_path/libs/altsys/mymenusub/mylangadmin.php @@ -1,37 +1,57 @@ query("SELECT m.name,m.dirname,COUNT(l.mid) FROM ".$db->prefix("modules")." m LEFT JOIN ".$db->prefix("altsys_language_constants")." l ON m.mid=l.mid WHERE m.isactive GROUP BY m.mid ORDER BY m.weight,m.mid") ; - -$adminmenu = array() ; -while (list($name, $dirname, $count) = $db->fetchRow($mrs)) { - if ($dirname == $current_dirname) { - $adminmenu[] = array( - 'selected' => true , - 'title' => $name . " ($count)" , - 'link' => '?mode=admin&lib=altsys&page=mylangadmin&dirname='.$dirname , - ) ; - //$GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'name' => htmlspecialchars( $name , ENT_QUOTES ) ) ; - } else { - $adminmenu[] = array( - 'selected' => false , - 'title' => $name . " ($count)" , - 'link' => '?mode=admin&lib=altsys&page=mylangadmin&dirname='.$dirname , - ) ; - } +$current_dirname = preg_replace( '/[^0-9a-zA-Z_-]/', '', @$_GET['dirname'] ); + +$db = XoopsDatabaseFactory::getDatabaseConnection(); +$mrs = $db->query( 'SELECT m.name,m.dirname,COUNT(l.mid) FROM ' . $db->prefix( 'modules' ) . ' m LEFT JOIN ' . $db->prefix( 'altsys_language_constants' ) . ' l ON m.mid=l.mid WHERE m.isactive GROUP BY m.mid ORDER BY m.weight,m.mid' ); + +$adminmenu = []; + + +while ( list( $name, $dirname, $count ) = $db->fetchRow( $mrs ) ) { + + $moduleIcon = ''; + + if ( $dirname == $current_dirname ) { + + $adminmenu[] = [ + 'selected' => true, + 'title' => "$count" .$name, + 'icon' => $moduleIcon, + 'link' => '?mode=admin&lib=altsys&page=mylangadmin&dirname=' . $dirname, + ]; + //$GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'name' => htmlspecialchars( $name , ENT_QUOTES ) ) ; + } else { + $adminmenu[] = [ + 'selected' => false, + 'title' => "$count" .$name, + 'icon' => $moduleIcon, + 'link' => '?mode=admin&lib=altsys&page=mylangadmin&dirname=' . $dirname, + ]; + } } // display -require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; -$tpl = new D3Tpl() ; -$tpl->assign(array( - 'adminmenu' => $adminmenu, - 'mypage' => 'mylangadmin', -)) ; -$tpl->display('db:altsys_inc_mymenusub.html') ; +require_once XOOPS_TRUST_PATH . '/libs/altsys/class/D3Tpl.class.php'; +$tpl = new D3Tpl(); +$tpl->assign( + [ + 'adminmenu' => $adminmenu, + 'mypage' => 'mylangadmin', + ] +); +$tpl->display( 'db:altsys_inc_menu_sub.html' ); diff --git a/xoops_trust_path/libs/altsys/mymenusub/mytplsadmin.php b/xoops_trust_path/libs/altsys/mymenusub/mytplsadmin.php index 515d511..b481872 100644 --- a/xoops_trust_path/libs/altsys/mymenusub/mytplsadmin.php +++ b/xoops_trust_path/libs/altsys/mymenusub/mytplsadmin.php @@ -1,56 +1,74 @@ fetchRow($db->query("SELECT COUNT(t.tpl_module) AS tpl_count FROM ".$db->prefix("tplfile")." t WHERE t.tpl_type='custom'")) ; -if ($current_dirname == '_custom') { - // $GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'name' => _MYTPLSADMIN_CUSTOMTEMPLATE ) ; - $custom_selected = true ; +list( $count ) = $db->fetchRow( $db->query( 'SELECT COUNT(t.tpl_module) AS tpl_count FROM ' . $db->prefix( 'tplfile' ) . " t WHERE t.tpl_type='custom'" ) ); +if ( '_custom' == $current_dirname ) { + // $GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'name' => _MYTPLSADMIN_CUSTOMTEMPLATE ); + $custom_selected = true; } else { - $custom_selected = false ; + $custom_selected = false; } -$adminmenu = array( - array( - 'selected' => $custom_selected , - 'title' => _MYTPLSADMIN_CUSTOMTEMPLATE . " ($count)" , - 'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname=_custom' , - ) , -) ; +$adminmenu = [ + [ + 'selected' => $custom_selected, + 'title' => _MYTPLSADMIN_CUSTOMTEMPLATE . " ($count)", + 'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname=_custom', + ], +]; // get modules/templates -$mrs = $db->query("SELECT m.name,m.dirname,COUNT(t.tpl_module) AS tpl_count FROM ".$db->prefix("modules")." m LEFT JOIN ".$db->prefix("tplfile")." t ON m.dirname=t.tpl_module WHERE m.isactive GROUP BY m.mid HAVING tpl_count>0 ORDER BY m.weight,m.mid") ; +$mrs = $db->query( 'SELECT m.name,m.dirname,COUNT(t.tpl_module) AS tpl_count FROM ' . $db->prefix( 'modules' ) . ' m LEFT JOIN ' . $db->prefix( 'tplfile' ) . ' t ON m.dirname=t.tpl_module WHERE m.isactive GROUP BY m.mid HAVING tpl_count>0 ORDER BY m.weight,m.mid' ); // module loop -while (list($name, $dirname, $count) = $db->fetchRow($mrs)) { - if ($dirname == $current_dirname) { - $adminmenu[] = array( - 'selected' => true , - 'title' => $name . " ($count)" , - 'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$dirname , - ) ; - //$GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'name' => htmlspecialchars( $name , ENT_QUOTES ) ) ; - } else { - $adminmenu[] = array( - 'selected' => false , - 'title' => $name . " ($count)" , - 'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$dirname , - ) ; - } +while ( list( $name, $dirname, $count ) = $db->fetchRow( $mrs ) ) { + + $moduleIcon = ''; + + if ( $dirname == $current_dirname ) { + $adminmenu[] = [ + 'selected' => true, + 'title' => "$count" . $name, + 'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname=' . $dirname, + 'icon' => $moduleIcon, + ]; + //$GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'name' => htmlspecialchars( $name , ENT_QUOTES ) ) ; + // @todo @gigamaster Badge count + } else { + $adminmenu[] = [ + 'selected' => false, + 'title' => "$count". $name, + 'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname=' . $dirname, + 'icon' => $moduleIcon, + ]; + } } // display -require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; -$tpl = new D3Tpl() ; -$tpl->assign(array( - 'adminmenu' => $adminmenu, - 'mypage' => 'mytplsadmin', -)) ; -$tpl->display('db:altsys_inc_mymenusub.html') ; +require_once XOOPS_TRUST_PATH . '/libs/altsys/class/D3Tpl.class.php'; +$tpl = new D3Tpl(); +$tpl->assign( + [ + 'adminmenu' => $adminmenu, + 'mypage' => 'mytplsadmin', + ] +); +$tpl->display( 'db:altsys_inc_menu_sub.html' ); diff --git a/xoops_trust_path/libs/altsys/mypreferences.php b/xoops_trust_path/libs/altsys/mypreferences.php index 93d5008..bd4d9db 100644 --- a/xoops_trust_path/libs/altsys/mypreferences.php +++ b/xoops_trust_path/libs/altsys/mypreferences.php @@ -1,299 +1,301 @@ // -// ------------------------------------------------------------------------- // +/** + * Altsys library (UI-Components) for D3 modules + * Alternative preferences + * @package Altsys + * @version XCL 2.3.1 + * @author Other authors gigamaster, 2020 XCL/PHP7 + * @author Gijoe (Peak) + * @copyright (c) 2005-2022 Authors + * @license GPL v2.0 + */ -require_once dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php' ; -include_once dirname(__FILE__).'/include/gtickets.php' ; -include_once dirname(__FILE__).'/include/altsys_functions.php' ; +require_once __DIR__ . '/class/AltsysBreadcrumbs.class.php'; +include_once __DIR__ . '/include/gtickets.php'; +include_once __DIR__ . '/include/altsys_functions.php'; // check access right (needs module_admin of this module) -if (! is_object($xoopsUser) || ! is_object($xoopsModule) || ! $xoopsUser->isAdmin($xoopsModule->mid())) { - die('Access Denied') ; +if ( ! is_object( $xoopsUser ) || ! is_object( $xoopsModule ) || ! $xoopsUser->isAdmin( $xoopsModule->mid() ) ) { + die( 'Access Denied' ); } - // initials $db =& XoopsDatabaseFactory::getDatabaseConnection(); -(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance() ; +( method_exists( 'MyTextSanitizer', 'sGetInstance' ) and $myts =& MyTextSanitizer::sGetInstance() ) || $myts =& MyTextSanitizer::getInstance(); // language file -altsys_include_language_file('mypreferences') ; - - -$op = empty($_GET['op']) ? 'showmod' : preg_replace('/[^a-zA-Z0-9_-]/', '', $_GET['op']) ; - -if ($op == 'showmod') { - $config_handler =& xoops_gethandler('config'); - $mod = $xoopsModule->mid() ; - $config =& $config_handler->getConfigs(new Criteria('conf_modid', $mod)); - $count = count($config); - if ($count < 1) { - die('no configs') ; - } - include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; - $form = new XoopsThemeForm(_MD_A_MYPREFERENCES_FORMTITLE, 'pref_form', 'index.php?mode=admin&lib=altsys&page=mypreferences&op=save'); - $module_handler =& xoops_gethandler('module'); - $module =& $module_handler->get($mod); - - // language - $language = empty($xoopsConfig['language']) ? 'english' : $xoopsConfig['language'] ; - - // load modinfo.php if necessary (judged by a specific constant is defined) - if (! defined('_MYMENU_CONSTANT_IN_MODINFO') || ! defined(_MYMENU_CONSTANT_IN_MODINFO)) { - if (file_exists("$mydirpath/language/$language/modinfo.php")) { - // user customized language file - include_once "$mydirpath/language/$language/modinfo.php" ; - } elseif (file_exists("$mytrustdirpath/language/$language/modinfo.php")) { - // default language file - include_once "$mytrustdirpath/language/$language/modinfo.php" ; - } else { - // fallback english - include_once "$mytrustdirpath/language/english/modinfo.php" ; - } - } - - // if has comments feature, need comment lang file - if ($module->getVar('hascomments') == 1 && ! defined('_CM_TITLE')) { - include_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/comment.php'; - } - - // RMV-NOTIFY - // if has notification feature, need notification lang file - if ($module->getVar('hasnotification') == 1 && ! defined('_NOT_NOTIFICATIONOPTIONS')) { - include_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/notification.php'; - } - - $modname = $module->getVar('name'); - $button_tray = new XoopsFormElementTray(""); - // if ($module->getInfo('adminindex')) { - // $form->addElement(new XoopsFormHidden('redirect', XOOPS_URL.'/modules/'.$module->getVar('dirname').'/'.$module->getInfo('adminindex'))); - // } - for ($i = 0; $i < $count; $i++) { - $title_icon = ($config[$i]->getVar('conf_valuetype') === 'encrypt')? 'Encrypted' : ''; // support XCL 2.2.3 'encrypt' of 'conf_valuetype' - $title4tray = (!defined($config[$i]->getVar('conf_desc')) || constant($config[$i]->getVar('conf_desc')) == '') ? (constant($config[$i]->getVar('conf_title')).$title_icon) : (constant($config[$i]->getVar('conf_title')).$title_icon.'

'.constant($config[$i]->getVar('conf_desc')).''); // GIJ - $title = '' ; // GIJ - switch ($config[$i]->getVar('conf_formtype')) { - case 'textarea': - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance(); - if ($config[$i]->getVar('conf_valuetype') == 'array') { - // this is exceptional.. only when value type is arrayneed a smarter way for this - $ele = ($config[$i]->getVar('conf_value') != '') ? new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars(implode('|', $config[$i]->getConfValueForOutput())), 5, 50) : new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), '', 5, 50); - } else { - $ele = new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars($config[$i]->getConfValueForOutput()), 5, 50); - } - break; - case 'select': - case 'radio': - if ($config[$i]->getVar('conf_formtype') === 'select') { - $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); - $addBr = ''; - } else { - $ele = new XoopsFormRadio($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); - $addBr = '
'; - } - $options =& $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); - $opcount = count($options); - for ($j = 0; $j < $opcount; $j++) { - $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); - $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name'); - $ele->addOption($optval, $optkey.$addBr); - } - break; - case 'select_multi': - case 'checkbox': - if ($config[$i]->getVar('conf_formtype') === 'select_multi') { - $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), 5, true); - $addBr = ''; - } else { - $ele = new XoopsFormCheckBox($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); - $addBr = '
'; - } - $options =& $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); - $opcount = count($options); - for ($j = 0; $j < $opcount; $j++) { - $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); - $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name'); - - $ele->addOption($optval, $optkey.$addBr); - } - break; - case 'yesno': - $ele = new XoopsFormRadioYN($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), _YES, _NO); - break; - case 'group': - include_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; - $ele = new XoopsFormSelectGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false); - break; - case 'group_multi': - include_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; - $ele = new XoopsFormSelectGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true); - break; - case 'group_checkbox': - include_once dirname(__FILE__).'/include/formcheckboxgroup.php'; - $ele = new AltsysFormCheckboxGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput()); - break; - // RMV-NOTIFY: added 'user' and 'user_multi' - case 'user': - include_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; - $ele = new XoopsFormSelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false); - break; - case 'user_multi': - include_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; - $ele = new XoopsFormSelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true); - break; - case 'password': - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance(); - $ele = new XoopsFormPassword($title, $config[$i]->getVar('conf_name'), 50, 255, $myts->htmlspecialchars($config[$i]->getConfValueForOutput())); - break; - case 'textbox': - default: - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance(); - $ele = new XoopsFormText($title, $config[$i]->getVar('conf_name'), 50, 255, $myts->htmlspecialchars($config[$i]->getConfValueForOutput())); - break; - } - $hidden = new XoopsFormHidden('conf_ids[]', $config[$i]->getVar('conf_id')); - $ele_tray = new XoopsFormElementTray($title4tray, '') ; - $ele_tray->addElement($ele); - $ele_tray->addElement($hidden); - $form->addElement($ele_tray) ; - unset($ele_tray); - unset($ele); - unset($hidden); - } - // $button_tray->addElement(new XoopsFormHidden('op', 'save')); - $xoopsGTicket->addTicketXoopsFormElement($button_tray, __LINE__, 1800, 'mypreferences') ; - $button_tray->addElement(new XoopsFormButton('', 'button', _GO, 'submit')); - $form->addElement($button_tray) ; - xoops_cp_header(); - - // GIJ patch start - altsys_include_mymenu() ; - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; - if ($breadcrumbsObj->hasPaths()) { - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mypreferences', _PREFERENCES) ; - } - echo "

".$module->getvar('name').'   '._PREFERENCES."

\n" ; - // GIJ patch end - - $form->display(); - xoops_cp_footer(); - exit(); +altsys_include_language_file( 'mypreferences' ); + + +$op = empty( $_GET['op'] ) ? 'showmod' : preg_replace( '/[^a-zA-Z0-9_-]/', '', $_GET['op'] ); + +if ( 'showmod' == $op ) { + $config_handler =& xoops_gethandler( 'config' ); + $mod = $xoopsModule->mid(); + $config =& $config_handler->getConfigs( new Criteria( 'conf_modid', $mod ) ); + $count = count( $config ); + if ( $count < 1 ) { + die( 'no configs' ); + } + include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + + + // Form Preferences + $form = new XoopsThemeForm( _MD_A_MYPREFERENCES_FORMTITLE, 'pref_form', 'index.php?mode=admin&lib=altsys&page=mypreferences&op=save' ); + $module_handler =& xoops_gethandler( 'module' ); + $module =& $module_handler->get( $mod ); + + + // language + $language = empty( $xoopsConfig['language'] ) ? 'english' : $xoopsConfig['language']; + + + // load modinfo.php if necessary (when a specific constant is defined) + if ( ! defined( '_MYMENU_CONSTANT_IN_MODINFO' ) || ! defined( _MYMENU_CONSTANT_IN_MODINFO ) ) { + if ( file_exists( "$mydirpath/language/$language/modinfo.php" ) ) { + // user customized language file + include_once "$mydirpath/language/$language/modinfo.php"; + } elseif ( file_exists( "$mytrustdirpath/language/$language/modinfo.php" ) ) { + // default language file + include_once "$mytrustdirpath/language/$language/modinfo.php"; + } else { + // fallback english + include_once "$mytrustdirpath/language/english/modinfo.php"; + } + } + + // if it has comments feature, include comment lang file + if ( 1 == $module->getVar( 'hascomments' ) && ! defined( '_CM_TITLE' ) ) { + include_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/comment.php'; + } + + // RMV-NOTIFY + // if it has notification feature, include notification lang file + if ( 1 == $module->getVar( 'hasnotification' ) && ! defined( '_NOT_NOTIFICATIONOPTIONS' ) ) { + include_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/notification.php'; + } + + $modname = $module->getVar( 'name' ); + $button_tray = new XoopsFormElementTray( '' ); + // if ($module->getInfo('adminindex')) { + // $form->addElement(new XoopsFormHidden('redirect', XOOPS_URL.'/modules/'.$module->getVar('dirname').'/'.$module->getInfo('adminindex'))); + // } + for ( $i = 0; $i < $count; $i ++ ) { + $title_icon = ( 'encrypt' === $config[ $i ]->getVar( 'conf_valuetype' ) ) ? 'Encrypted' : ''; // support XCL 2.2.3 'encrypt' of 'conf_valuetype' + $title4tray = ( ! defined( $config[ $i ]->getVar( 'conf_desc' ) ) || '' == constant( $config[ $i ]->getVar( 'conf_desc' ) ) ) ? ( constant( $config[ $i ]->getVar( 'conf_title' ) ) . $title_icon ) : ( constant( $config[ $i ]->getVar( 'conf_title' ) ) . $title_icon . '

' . constant( $config[ $i ]->getVar( 'conf_desc' ) ) . '' ); // GIJ + $title = ''; // GIJ + switch ( $config[ $i ]->getVar( 'conf_formtype' ) ) { + case 'textarea': + ( method_exists( 'MyTextSanitizer', 'sGetInstance' ) and $myts =& MyTextSanitizer::sGetInstance() ) || $myts =& MyTextSanitizer::getInstance(); + if ( 'array' == $config[ $i ]->getVar( 'conf_valuetype' ) ) { + // this is exceptional. only when value type is array need a smarter way for this + $ele = ( '' != $config[ $i ]->getVar( 'conf_value' ) ) ? new XoopsFormTextArea( $title, $config[ $i ]->getVar( 'conf_name' ), $myts->htmlspecialchars( implode( '|', $config[ $i ]->getConfValueForOutput() ) ), 5, 50 ) : new XoopsFormTextArea( $title, $config[ $i ]->getVar( 'conf_name' ), '', 5, 50 ); + } else { + $ele = new XoopsFormTextArea( $title, $config[ $i ]->getVar( 'conf_name' ), $myts->htmlspecialchars( $config[ $i ]->getConfValueForOutput() ), 5, 50 ); + } + break; + case 'select': + case 'radio': + if ( 'select' == $config[ $i ]->getVar( 'conf_formtype' ) ) { + $ele = new XoopsFormSelect( $title, $config[ $i ]->getVar( 'conf_name' ), $config[ $i ]->getConfValueForOutput() ); + $addBr = ''; + } else { + $ele = new XoopsFormRadio( $title, $config[ $i ]->getVar( 'conf_name' ), $config[ $i ]->getConfValueForOutput() ); + $addBr = '
'; + } + $options =& $config_handler->getConfigOptions( new Criteria( 'conf_id', $config[ $i ]->getVar( 'conf_id' ) ) ); + $opcount = count( $options ); + for ( $j = 0; $j < $opcount; $j ++ ) { + $optval = defined( $options[ $j ]->getVar( 'confop_value' ) ) ? constant( $options[ $j ]->getVar( 'confop_value' ) ) : $options[ $j ]->getVar( 'confop_value' ); + $optkey = defined( $options[ $j ]->getVar( 'confop_name' ) ) ? constant( $options[ $j ]->getVar( 'confop_name' ) ) : $options[ $j ]->getVar( 'confop_name' ); + $ele->addOption( $optval, $optkey . $addBr ); + } + break; + case 'select_multi': + case 'checkbox': + if ( 'select_multi' === $config[ $i ]->getVar( 'conf_formtype' ) ) { + $ele = new XoopsFormSelect( $title, $config[ $i ]->getVar( 'conf_name' ), $config[ $i ]->getConfValueForOutput(), 5, true ); + $addBr = ''; + } else { + $ele = new XoopsFormCheckBox( $title, $config[ $i ]->getVar( 'conf_name' ), $config[ $i ]->getConfValueForOutput() ); + $addBr = '
'; + } + $options =& $config_handler->getConfigOptions( new Criteria( 'conf_id', $config[ $i ]->getVar( 'conf_id' ) ) ); + $opcount = count( $options ); + for ( $j = 0; $j < $opcount; $j ++ ) { + $optval = defined( $options[ $j ]->getVar( 'confop_value' ) ) ? constant( $options[ $j ]->getVar( 'confop_value' ) ) : $options[ $j ]->getVar( 'confop_value' ); + $optkey = defined( $options[ $j ]->getVar( 'confop_name' ) ) ? constant( $options[ $j ]->getVar( 'confop_name' ) ) : $options[ $j ]->getVar( 'confop_name' ); + + $ele->addOption( $optval, $optkey . $addBr ); + } + break; + case 'yesno': + $ele = new XoopsFormRadioYN( $title, $config[ $i ]->getVar( 'conf_name' ), $config[ $i ]->getConfValueForOutput(), _YES, _NO ); + break; + case 'group': + include_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; + $ele = new XoopsFormSelectGroup( $title, $config[ $i ]->getVar( 'conf_name' ), false, $config[ $i ]->getConfValueForOutput(), 1, false ); + break; + case 'group_multi': + include_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; + $ele = new XoopsFormSelectGroup( $title, $config[ $i ]->getVar( 'conf_name' ), false, $config[ $i ]->getConfValueForOutput(), 5, true ); + break; + case 'group_checkbox': + include_once __DIR__ . '/include/formcheckboxgroup.php'; + $ele = new AltsysFormCheckboxGroup( $title, $config[ $i ]->getVar( 'conf_name' ), false, $config[ $i ]->getConfValueForOutput() ); + break; + // RMV-NOTIFY: added 'user' and 'user_multi' + case 'user': + include_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; + $ele = new XoopsFormSelectUser( $title, $config[ $i ]->getVar( 'conf_name' ), false, $config[ $i ]->getConfValueForOutput(), 1, false ); + break; + case 'user_multi': + include_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; + $ele = new XoopsFormSelectUser( $title, $config[ $i ]->getVar( 'conf_name' ), false, $config[ $i ]->getConfValueForOutput(), 5, true ); + break; + case 'password': + ( method_exists( 'MyTextSanitizer', 'sGetInstance' ) and $myts =& MyTextSanitizer::sGetInstance() ) || $myts =& MyTextSanitizer::getInstance(); + $ele = new XoopsFormPassword( $title, $config[ $i ]->getVar( 'conf_name' ), 50, 191, $myts->htmlspecialchars( $config[ $i ]->getConfValueForOutput() ) ); + break; + case 'textbox': + default: + ( method_exists( 'MyTextSanitizer', 'sGetInstance' ) and $myts =& MyTextSanitizer::sGetInstance() ) || $myts =& MyTextSanitizer::getInstance(); + $ele = new XoopsFormText( $title, $config[ $i ]->getVar( 'conf_name' ), 50, 191, $myts->htmlspecialchars( $config[ $i ]->getConfValueForOutput() ) ); + break; + } + $hidden = new XoopsFormHidden( 'conf_ids[]', $config[ $i ]->getVar( 'conf_id' ) ); + $ele_tray = new XoopsFormElementTray( $title4tray, '' ); + $ele_tray->addElement( $ele ); + $ele_tray->addElement( $hidden ); + $form->addElement( $ele_tray ); + unset( $ele_tray, $ele, $hidden ); + } + + $xoopsGTicket->addTicketXoopsFormElement( $button_tray, __LINE__, 1800, 'mypreferences' ); + + $button = new XoopsFormButton( '', 'button', _GO, 'submit' ); + $button_tray->addElement( $button ); + + $form->addElement( $button_tray ); + xoops_cp_header(); + + // MyMenu + altsys_include_mymenu(); + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); + if ( $breadcrumbsObj->hasPaths() ) { + $breadcrumbsObj->appendPath( XOOPS_URL . '/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mypreferences', _PREFERENCES ); + } + + // Heading Title + // Module Name + echo "

" . $module->getvar( 'name' ) . '   ' . _PREFERENCES . "

\n"; + + $form->display(); + + xoops_cp_footer(); + exit(); } -if ($op == 'save') { - //if ( !admin_refcheck("/modules/$admin_mydirname/admin/") ) { - // exit('Invalid referer'); - //} - if (! $xoopsGTicket->check(true, 'mypreferences')) { - redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); - } - require_once XOOPS_ROOT_PATH.'/class/template.php' ; - $xoopsTpl = new XoopsTpl(); -//HACK by domifara for new XOOPS and XCL etc. -//old xoops - $core_type = intval(altsys_get_core_type()); - if ($core_type <= 10) { - $xoopsTpl->clear_all_cache(); - // regenerate admin menu file - xoops_module_write_admin_menu(xoops_module_get_admin_menu()); - } - if (!empty($_POST['conf_ids'])) { - $conf_ids = $_POST['conf_ids']; - } - $count = count($conf_ids); - $tpl_updated = false; - $theme_updated = false; - $startmod_updated = false; - $lang_updated = false; - if ($count > 0) { - for ($i = 0; $i < $count; $i++) { - $config =& $config_handler->getConfig($conf_ids[$i]); - $new_value =& $_POST[$config->getVar('conf_name')]; - if (is_array($new_value) || $new_value != $config->getVar('conf_value')) { - // if language has been changed - if (!$lang_updated && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'language') { - // regenerate admin menu file - $xoopsConfig['language'] = $_POST[$config->getVar('conf_name')]; - xoops_module_write_admin_menu(xoops_module_get_admin_menu()); - $lang_updated = true; - } - - // if default theme has been changed - if (!$theme_updated && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'theme_set') { - $member_handler =& xoops_gethandler('member'); - $member_handler->updateUsersByField('theme', $_POST[$config->getVar('conf_name')]); - $theme_updated = true; - } - - // if default template set has been changed - if (!$tpl_updated && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'template_set') { - // clear cached/compiled files and regenerate them if default theme has been changed - if ($xoopsConfig['template_set'] != $_POST[$config->getVar('conf_name')]) { - $newtplset = $_POST[$config->getVar('conf_name')]; - - // clear all compiled and cachedfiles - $xoopsTpl->clear_compiled_tpl(); - - // generate compiled files for the new theme - // block files only for now.. - $tplfile_handler =& xoops_gethandler('tplfile'); - $dtemplates =& $tplfile_handler->find('default', 'block'); - $dcount = count($dtemplates); - - // need to do this to pass to xoops_template_touch function - $GLOBALS['xoopsConfig']['template_set'] = $newtplset; - - altsys_clear_templates_c() ; - -/* for ($i = 0; $i < $dcount; $i++) { - $found =& $tplfile_handler->find($newtplset, 'block', $dtemplates[$i]->getVar('tpl_refid'), null); - if (count($found) > 0) { - // template for the new theme found, compile it - xoops_template_touch($found[0]->getVar('tpl_id')); - } else { - // not found, so compile 'default' template file - xoops_template_touch($dtemplates[$i]->getVar('tpl_id')); - } - }*/ - - // generate image cache files from image binary data, save them under cache/ - $image_handler =& xoops_gethandler('imagesetimg'); - $imagefiles =& $image_handler->getObjects(new Criteria('tplset_name', $newtplset), true); - foreach (array_keys($imagefiles) as $i) { - if (!$fp = fopen(XOOPS_CACHE_PATH.'/'.$newtplset.'_'.$imagefiles[$i]->getVar('imgsetimg_file'), 'wb')) { - } else { - fwrite($fp, $imagefiles[$i]->getVar('imgsetimg_body')); - fclose($fp); - } - } - } - $tpl_updated = true; - } - - // add read permission for the start module to all groups - if (!$startmod_updated && $new_value != '--' && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'startpage') { - $member_handler =& xoops_gethandler('member'); - $groups =& $member_handler->getGroupList(); - $moduleperm_handler =& xoops_gethandler('groupperm'); - $module_handler =& xoops_gethandler('module'); - $module =& $module_handler->getByDirname($new_value); - foreach ($groups as $groupid => $groupname) { - if (!$moduleperm_handler->checkRight('module_read', $module->getVar('mid'), $groupid)) { - $moduleperm_handler->addRight('module_read', $module->getVar('mid'), $groupid); - } - } - $startmod_updated = true; - } - - $config->setConfValueForInput($new_value); - $config_handler->insertConfig($config); - } - unset($new_value); - } - } - - redirect_header('index.php?mode=admin&lib=altsys&page=mypreferences', 2, _MD_A_MYPREFERENCES_UPDATED) ; +if ( $op == 'save' ) { + + if ( ! $xoopsGTicket->check( true, 'mypreferences' ) ) { + redirect_header( XOOPS_URL . '/', 3, $xoopsGTicket->getErrors() ); + } + require_once XOOPS_ROOT_PATH . '/class/template.php'; + $xoopsTpl = new XoopsTpl(); + //HACK by domifara for new XOOPS and XCL etc. + //old xoops + //!TODO XCL version + $core_type = (int) altsys_get_core_type(); + if ( $core_type <= 10 ) { + $xoopsTpl->clear_all_cache(); + // regenerate admin menu file + xoops_module_write_admin_menu( xoops_module_get_admin_menu() ); + } + if ( ! empty( $_POST['conf_ids'] ) ) { + $conf_ids = $_POST['conf_ids']; + } + $count = count( $conf_ids ); + $tpl_updated = false; + $theme_updated = false; + $startmod_updated = false; + $lang_updated = false; + if ( $count > 0 ) { + for ( $i = 0; $i < $count; $i ++ ) { + $config =& $config_handler->getConfig( $conf_ids[ $i ] ); + $new_value =& $_POST[ $config->getVar( 'conf_name' ) ]; + if ( is_array( $new_value ) || $new_value != $config->getVar( 'conf_value' ) ) { + // if language has been changed + if ( ! $lang_updated && $config->getVar( 'conf_catid' ) == XOOPS_CONF && $config->getVar( 'conf_name' ) == 'language' ) { + // regenerate admin menu file + $xoopsConfig['language'] = $_POST[ $config->getVar( 'conf_name' ) ]; + xoops_module_write_admin_menu( xoops_module_get_admin_menu() ); + $lang_updated = true; + } + + // if default theme has been changed + if ( ! $theme_updated && $config->getVar( 'conf_catid' ) == XOOPS_CONF && $config->getVar( 'conf_name' ) == 'theme_set' ) { + $member_handler =& xoops_gethandler( 'member' ); + $member_handler->updateUsersByField( 'theme', $_POST[ $config->getVar( 'conf_name' ) ] ); + $theme_updated = true; + } + + // if default template set has been changed + if ( ! $tpl_updated && $config->getVar( 'conf_catid' ) == XOOPS_CONF && $config->getVar( 'conf_name' ) == 'template_set' ) { + // clear cached/compiled files and regenerate them if default theme has been changed + if ( $xoopsConfig['template_set'] != $_POST[ $config->getVar( 'conf_name' ) ] ) { + $newtplset = $_POST[ $config->getVar( 'conf_name' ) ]; + + // clear all compiled and cached files + $xoopsTpl->clear_compiled_tpl(); + + // generate compiled files for the new theme + // block files only for now.. + $tplfile_handler =& xoops_gethandler( 'tplfile' ); + $dtemplates =& $tplfile_handler->find( 'default', 'block' ); + $dcount = count( $dtemplates ); + + // need to do this to pass to xoops_template_touch function + $GLOBALS['xoopsConfig']['template_set'] = $newtplset; + + altsys_clear_templates_c(); + + // generate image cache files from image binary data, save them under cache/ + $image_handler =& xoops_gethandler( 'imagesetimg' ); + $imagefiles =& $image_handler->getObjects( new Criteria( 'tplset_name', $newtplset ), true ); + foreach ( array_keys( $imagefiles ) as $i ) { + if ( ! $fp = fopen( XOOPS_CACHE_PATH . '/' . $newtplset . '_' . $imagefiles[ $i ]->getVar( 'imgsetimg_file' ), 'wb' ) ) { + // gen + } else { + fwrite( $fp, $imagefiles[ $i ]->getVar( 'imgsetimg_body' ) ); + fclose( $fp ); + } + } + } + $tpl_updated = true; + } + + // add read permission for the start module to all groups + if ( ! $startmod_updated && $new_value != '--' && $config->getVar( 'conf_catid' ) == XOOPS_CONF && $config->getVar( 'conf_name' ) == 'startpage' ) { + $member_handler =& xoops_gethandler( 'member' ); + $groups =& $member_handler->getGroupList(); + $moduleperm_handler =& xoops_gethandler( 'groupperm' ); + $module_handler =& xoops_gethandler( 'module' ); + $module =& $module_handler->getByDirname( $new_value ); + foreach ( $groups as $groupid => $groupname ) { + if ( ! $moduleperm_handler->checkRight( 'module_read', $module->getVar( 'mid' ), $groupid ) ) { + $moduleperm_handler->addRight( 'module_read', $module->getVar( 'mid' ), $groupid ); + } + } + $startmod_updated = true; + } + + $config->setConfValueForInput( $new_value ); + $config_handler->insertConfig( $config ); + } + unset( $new_value ); + } + } + + redirect_header( 'index.php?mode=admin&lib=altsys&page=mypreferences', 2, _MD_A_MYPREFERENCES_UPDATED ); } diff --git a/xoops_trust_path/libs/altsys/mytplsadmin.php b/xoops_trust_path/libs/altsys/mytplsadmin.php index 8303923..be6506d 100644 --- a/xoops_trust_path/libs/altsys/mytplsadmin.php +++ b/xoops_trust_path/libs/altsys/mytplsadmin.php @@ -1,213 +1,214 @@ // -// ------------------------------------------------------------------------- // +/** + * Altsys library (UI-Components) for D3 modules + * Templates admin for each modules + * @package Altsys + * @version XCL 2.3.1 + * @author Other authors Gigamaster, 2020 XCL PHP7 + * @author Gijoe (Peak) + * @copyright (c) 2005-2022 Authors + * @license GPL v2.0 + */ -require_once dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php' ; -include_once dirname(__FILE__)."/include/gtickets.php" ; -include_once dirname(__FILE__).'/include/altsys_functions.php' ; -include_once dirname(__FILE__)."/include/tpls_functions.php" ; + +require_once __DIR__ . '/class/AltsysBreadcrumbs.class.php'; +include_once __DIR__ . '/include/gtickets.php'; +include_once __DIR__ . '/include/altsys_functions.php'; +include_once __DIR__ . '/include/tpls_functions.php'; // only groups have 'module_admin' of 'altsys' can do that. -$module_handler =& xoops_gethandler('module') ; -$module =& $module_handler->getByDirname('altsys') ; -if (! is_object($module)) { - die('install altsys') ; +$module_handler = xoops_gethandler( 'module' ); +$module = $module_handler->getByDirname( 'altsys' ); +if ( ! is_object( $module ) ) { + die( 'install altsys' ); } -$moduleperm_handler =& xoops_gethandler('groupperm') ; -if (! is_object(@$xoopsUser) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) { - die('only admin of altsys can access this area') ; +$moduleperm_handler = xoops_gethandler( 'groupperm' ); +if ( ! is_object( @$xoopsUser ) || ! $moduleperm_handler->checkRight( 'module_admin', $module->getVar( 'mid' ), $xoopsUser->getGroups() ) ) { + die( 'only admin of altsys can access this area' ); } // initials -$db =& XoopsDatabaseFactory::getDatabaseConnection(); -(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance() ; +$db = XoopsDatabaseFactory::getDatabaseConnection(); +( method_exists( 'MyTextSanitizer', 'sGetInstance' ) and $myts = MyTextSanitizer::sGetInstance() ) || $myts =& MyTextSanitizer::getInstance(); // language file -altsys_include_language_file('mytplsadmin') ; +altsys_include_language_file( 'mytplsadmin' ); // check $xoopsModule -if (! is_object($xoopsModule)) { - redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM) ; +if ( ! is_object( $xoopsModule ) ) { + redirect_header( XOOPS_URL . '/user.php', 1, _NOPERM ); } // set target_module if specified by $_GET['dirname'] -$module_handler =& xoops_gethandler('module'); -if (! empty($_GET['dirname'])) { - $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']) ; - $target_module =& $module_handler->getByDirname($dirname) ; +$module_handler = xoops_gethandler( 'module' ); +if ( ! empty( $_GET['dirname'] ) ) { + $dirname = preg_replace( '/[^0-9a-zA-Z_-]/', '', $_GET['dirname'] ); + $target_module = $module_handler->getByDirname( $dirname ); } -if (! empty($target_module) && is_object($target_module)) { - // specified by dirname (for tplsadmin as an independent module) - $target_mid = $target_module->getVar('mid') ; - $target_dirname = $target_module->getVar('dirname') ; - $target_dirname4sql = addslashes($target_dirname) ; - $target_mname = $target_module->getVar('name') . " " . sprintf("(%2.2f)", $target_module->getVar('version') / 100.0) ; - //$query4redirect = '?dirname='.urlencode(strip_tags($_GET['dirname'])) ; -} elseif (@$_GET['dirname'] == '_custom') { - // custom template - $target_mid = 0 ; - $target_dirname = '_custom' ; - $target_dirname4sql = '_custom' ; - $target_mname = _MYTPLSADMIN_CUSTOMTEMPLATE ; - //$query4redirect = '' ; +if ( ! empty( $target_module ) && is_object( $target_module ) ) { + // specified by dirname (for tplsadmin as an independent module) + $target_mid = $target_module->getVar( 'mid' ); + $target_dirname = $target_module->getVar( 'dirname' ); + $target_dirname4sql = addslashes( $target_dirname ); + $target_mname = $target_module->getVar( 'name' ) . sprintf( 'v %2.2f ', $target_module->getVar( 'version' ) / 100.0 ); + //$query4redirect = '?dirname='.urlencode(strip_tags($_GET['dirname'])) ; +} elseif ( @$_GET['dirname'] == '_custom' ) { + // custom template + $target_mid = 0; + $target_dirname = '_custom'; + $target_dirname4sql = '_custom'; + $target_mname = _MYTPLSADMIN_CUSTOMTEMPLATE; + //$query4redirect = '' ; } else { - // not specified by dirname (for 3rd party modules as mytplsadmin) - $target_mid = $xoopsModule->getVar('mid') ; - $target_dirname = $xoopsModule->getVar('dirname') ; - $target_dirname4sql = addslashes($target_dirname) ; - $target_mname = $xoopsModule->getVar('name') ; - //$query4redirect = '' ; + // not specified by dirname (for 3rd party modules as mytplsadmin) + $target_mid = $xoopsModule->getVar( 'mid' ); + $target_dirname = $xoopsModule->getVar( 'dirname' ); + $target_dirname4sql = addslashes( $target_dirname ); + $target_mname = $xoopsModule->getVar( 'name' ); + //$query4redirect = '' ; } -//**************// -// POST stages // -//**************// - +// POST // Create new template set (blank or clone) -if (! empty($_POST['clone_tplset_do']) && ! empty($_POST['clone_tplset_from']) && ! empty($_POST['clone_tplset_to'])) { - // Ticket Check - if (! $xoopsGTicket->check()) { - redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); - } +if ( ! empty( $_POST['clone_tplset_do'] ) && ! empty( $_POST['clone_tplset_from'] ) && ! empty( $_POST['clone_tplset_to'] ) ) { + // Ticket Check + if ( ! $xoopsGTicket->check() ) { + redirect_header( XOOPS_URL . '/', 3, $xoopsGTicket->getErrors() ); + } - $tplset_from = $myts->stripSlashesGPC($_POST['clone_tplset_from']) ; - $tplset_to = $myts->stripSlashesGPC($_POST['clone_tplset_to']) ; - // check tplset_name "from" and "to" - if (! preg_match('/^[0-9A-Za-z_-]{1,16}$/', $_POST['clone_tplset_from'])) { - tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDSETNAME, $target_dirname) ; - } - if (! preg_match('/^[0-9A-Za-z_-]{1,16}$/', $_POST['clone_tplset_to'])) { - tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDSETNAME, $target_dirname) ; - } - list($is_exist) = $db->fetchRow($db->query("SELECT COUNT(*) FROM ".$db->prefix("tplfile")." WHERE tpl_tplset='".addslashes($tplset_to)."'")) ; - if ($is_exist) { - tplsadmin_die(_MYTPLSADMIN_ERR_DUPLICATEDSETNAME, $target_dirname) ; - } - list($is_exist) = $db->fetchRow($db->query("SELECT COUNT(*) FROM ".$db->prefix("tplset")." WHERE tplset_name='".addslashes($tplset_to)."'")) ; - if ($is_exist) { - tplsadmin_die(_MYTPLSADMIN_ERR_DUPLICATEDSETNAME, $target_dirname) ; - } - // insert tplset table - $db->query("INSERT INTO ".$db->prefix("tplset")." SET tplset_name='".addslashes($tplset_to)."', tplset_desc='Created by tplsadmin', tplset_created=UNIX_TIMESTAMP()") ; - tplsadmin_copy_templates_db2db($tplset_from, $tplset_to, "tpl_module='$target_dirname4sql'") ; - redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED) ; - exit ; + $tplset_from = $myts->stripSlashesGPC( $_POST['clone_tplset_from'] ); + $tplset_to = $myts->stripSlashesGPC( $_POST['clone_tplset_to'] ); + + // check tplset_name "from" and "to" + if ( ! preg_match( '/^[0-9A-Za-z_-]{1,16}$/', $_POST['clone_tplset_from'] ) ) { + tplsadmin_die( _MYTPLSADMIN_ERR_INVALIDSETNAME, $target_dirname ); + } + if ( ! preg_match( '/^[0-9A-Za-z_-]{1,16}$/', $_POST['clone_tplset_to'] ) ) { + tplsadmin_die( _MYTPLSADMIN_ERR_INVALIDSETNAME, $target_dirname ); + } + list( $is_exist ) = $db->fetchRow( $db->query( 'SELECT COUNT(*) FROM ' . $db->prefix( 'tplfile' ) . " WHERE tpl_tplset='" . addslashes( $tplset_to ) . "'" ) ); + if ( $is_exist ) { + tplsadmin_die( _MYTPLSADMIN_ERR_DUPLICATEDSETNAME, $target_dirname ); + } + list( $is_exist ) = $db->fetchRow( $db->query( 'SELECT COUNT(*) FROM ' . $db->prefix( 'tplset' ) . " WHERE tplset_name='" . addslashes( $tplset_to ) . "'" ) ); + if ( $is_exist ) { + tplsadmin_die( _MYTPLSADMIN_ERR_DUPLICATEDSETNAME, $target_dirname ); + } + // insert tplset table + $db->query( 'INSERT INTO ' . $db->prefix( 'tplset' ) . " SET tplset_name='" . addslashes( $tplset_to ) . "', tplset_desc='Created by tplsadmin', tplset_created=UNIX_TIMESTAMP()" ); + tplsadmin_copy_templates_db2db( $tplset_from, $tplset_to, "tpl_module='$target_dirname4sql'" ); + redirect_header( '?mode=admin&lib=altsys&page=mytplsadmin&dirname=' . $target_dirname, 1, _MYTPLSADMIN_DBUPDATED ); + exit; } // DB to DB template copy (checked templates) -if (is_array(@$_POST['copy_do'])) { - foreach ($_POST['copy_do'] as $tplset_from_tmp => $val) { - if (! empty($val)) { - // Ticket Check - if (! $xoopsGTicket->check()) { - redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); - } +if ( is_array( @$_POST['copy_do'] ) ) { + foreach ( $_POST['copy_do'] as $tplset_from_tmp => $val ) { + if ( ! empty( $val ) ) { + // Ticket Check + if ( ! $xoopsGTicket->check() ) { + redirect_header( XOOPS_URL . '/', 3, $xoopsGTicket->getErrors() ); + } - $tplset_from = $myts->stripSlashesGPC($tplset_from_tmp) ; - if (empty($_POST['copy_to'][$tplset_from]) || $_POST['copy_to'][$tplset_from] == $tplset_from) { - tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDTPLSET, $target_dirname) ; - } - if (empty($_POST["{$tplset_from}_check"])) { - tplsadmin_die(_MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname) ; - } - $tplset_to = $myts->stripSlashesGPC($_POST['copy_to'][$tplset_from]) ; - foreach ($_POST["{$tplset_from}_check"] as $tplfile_tmp => $val) { - if (empty($val)) { - continue ; - } - $tplfile = $myts->stripSlashesGPC($tplfile_tmp) ; - tplsadmin_copy_templates_db2db($tplset_from, $tplset_to, "tpl_file='".addslashes($tplfile)."'") ; - } - redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED) ; - exit ; - } - } + $tplset_from = $myts->stripSlashesGPC( $tplset_from_tmp ); + if ( empty( $_POST['copy_to'][ $tplset_from ] ) || $_POST['copy_to'][ $tplset_from ] == $tplset_from ) { + tplsadmin_die( _MYTPLSADMIN_ERR_INVALIDTPLSET, $target_dirname ); + } + if ( empty( $_POST["{$tplset_from}_check"] ) ) { + tplsadmin_die( _MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname ); + } + $tplset_to = $myts->stripSlashesGPC( $_POST['copy_to'][ $tplset_from ] ); + foreach ( $_POST["{$tplset_from}_check"] as $tplfile_tmp => $val ) { + if ( empty( $val ) ) { + continue; + } + $tplfile = $myts->stripSlashesGPC( $tplfile_tmp ); + tplsadmin_copy_templates_db2db( $tplset_from, $tplset_to, "tpl_file='" . addslashes( $tplfile ) . "'" ); + } + redirect_header( '?mode=admin&lib=altsys&page=mytplsadmin&dirname=' . $target_dirname, 1, _MYTPLSADMIN_DBUPDATED ); + exit; + } + } } // File to DB template copy (checked templates) -if (! empty($_POST['copyf2db_do'])) { - // Ticket Check - if (! $xoopsGTicket->check()) { - redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); - } +if ( ! empty( $_POST['copyf2db_do'] ) ) { + // Ticket Check + if ( ! $xoopsGTicket->check() ) { + redirect_header( XOOPS_URL . '/', 3, $xoopsGTicket->getErrors() ); + } - if (empty($_POST['copyf2db_to'])) { - tplsadmin_die(_MYTPLSADMIN_ERR_INVALIDTPLSET, $target_dirname) ; - } - if (empty($_POST['basecheck'])) { - tplsadmin_die(_MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname) ; - } - $tplset_to = $myts->stripSlashesGPC($_POST['copyf2db_to']) ; - foreach ($_POST['basecheck'] as $tplfile_tmp => $val) { - if (empty($val)) { - continue ; - } - $tplfile = $myts->stripSlashesGPC($tplfile_tmp) ; - tplsadmin_copy_templates_f2db($tplset_to, "tpl_file='".addslashes($tplfile)."'") ; - } - redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED) ; - exit ; + if ( empty( $_POST['copyf2db_to'] ) ) { + tplsadmin_die( _MYTPLSADMIN_ERR_INVALIDTPLSET, $target_dirname ); + } + if ( empty( $_POST['basecheck'] ) ) { + tplsadmin_die( _MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname ); + } + $tplset_to = $myts->stripSlashesGPC( $_POST['copyf2db_to'] ); + foreach ( $_POST['basecheck'] as $tplfile_tmp => $val ) { + if ( empty( $val ) ) { + continue; + } + $tplfile = $myts->stripSlashesGPC( $tplfile_tmp ); + tplsadmin_copy_templates_f2db( $tplset_to, "tpl_file='" . addslashes( $tplfile ) . "'" ); + } + redirect_header( '?mode=admin&lib=altsys&page=mytplsadmin&dirname=' . $target_dirname, 1, _MYTPLSADMIN_DBUPDATED ); + exit; } // DB template remove (checked templates) -if (is_array(@$_POST['del_do'])) { - foreach ($_POST['del_do'] as $tplset_from_tmp => $val) { - if (! empty($val)) { - // Ticket Check - if (! $xoopsGTicket->check()) { - redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); - } +if ( is_array( @$_POST['del_do'] ) ) { + foreach ( $_POST['del_do'] as $tplset_from_tmp => $val ) { + if ( ! empty( $val ) ) { + // Ticket Check + if ( ! $xoopsGTicket->check() ) { + redirect_header( XOOPS_URL . '/', 3, $xoopsGTicket->getErrors() ); + } - $tplset_from = $myts->stripSlashesGPC($tplset_from_tmp) ; - if ($tplset_from == 'default' && $target_dirname != '_custom') { - tplsadmin_die(_MYTPLSADMIN_ERR_CANTREMOVEDEFAULT, $target_dirname) ; - } - if (empty($_POST["{$tplset_from}_check"])) { - tplsadmin_die(_MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname) ; - } - - require_once XOOPS_ROOT_PATH.'/class/template.php' ; - $tpl = new XoopsTpl(); - $tpl->force_compile = true; - - foreach ($_POST["{$tplset_from}_check"] as $tplfile_tmp => $val) { - if (empty($val)) { - continue ; - } - $tplfile = $myts->stripSlashesGPC($tplfile_tmp) ; - $result = $db->query("SELECT tpl_id FROM ".$db->prefix("tplfile")." WHERE tpl_tplset='".addslashes($tplset_from)."' AND tpl_file='".addslashes($tplfile)."'") ; - while (list($tpl_id) = $db->fetchRow($result)) { - $tpl_id = intval($tpl_id) ; - $db->query("DELETE FROM ".$db->prefix("tplfile")." WHERE tpl_id=$tpl_id") ; - $db->query("DELETE FROM ".$db->prefix("tplsource")." WHERE tpl_id=$tpl_id") ; - } - // remove templates_c - $tpl->clear_cache('db:'.$tplfile); - $tpl->clear_compiled_tpl('db:'.$tplfile); - } - redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, 1, _MYTPLSADMIN_DBUPDATED) ; - exit ; - } - } -} + $tplset_from = $myts->stripSlashesGPC( $tplset_from_tmp ); + if ( $tplset_from == 'default' && $target_dirname != '_custom' ) { + tplsadmin_die( _MYTPLSADMIN_ERR_CANTREMOVEDEFAULT, $target_dirname ); + } + if ( empty( $_POST["{$tplset_from}_check"] ) ) { + tplsadmin_die( _MYTPLSADMIN_ERR_NOTPLFILE, $target_dirname ); + } + require_once XOOPS_ROOT_PATH . '/class/template.php'; + $tpl = new XoopsTpl(); + $tpl->force_compile = true; + + foreach ( $_POST["{$tplset_from}_check"] as $tplfile_tmp => $val ) { + if ( empty( $val ) ) { + continue; + } + $tplfile = $myts->stripSlashesGPC( $tplfile_tmp ); + $result = $db->query( 'SELECT tpl_id FROM ' . $db->prefix( 'tplfile' ) . " WHERE tpl_tplset='" . addslashes( $tplset_from ) . "' AND tpl_file='" . addslashes( $tplfile ) . "'" ); + while ( list( $tpl_id ) = $db->fetchRow( $result ) ) { + $tpl_id = (int) $tpl_id; + $db->query( 'DELETE FROM ' . $db->prefix( 'tplfile' ) . " WHERE tpl_id=$tpl_id" ); + $db->query( 'DELETE FROM ' . $db->prefix( 'tplsource' ) . " WHERE tpl_id=$tpl_id" ); + } + // remove templates_c + $tpl->clear_cache( 'db:' . $tplfile ); + $tpl->clear_compiled_tpl( 'db:' . $tplfile ); + } + redirect_header( '?mode=admin&lib=altsys&page=mytplsadmin&dirname=' . $target_dirname, 1, _MYTPLSADMIN_DBUPDATED ); + exit; + } + } +} -//************// -// GET stage // -//************// +// GET stage // javascript -$_MYTPLSADMIN_ERR_INVALIDTPLSET = htmlspecialchars(_MYTPLSADMIN_ERR_INVALIDTPLSET); -$_MYTPLSADMIN_ERR_NOTPLFILE = htmlspecialchars(_MYTPLSADMIN_ERR_NOTPLFILE); -$javascript = << function altsys_mytpladmin_check_copy_submit(msg, id, selcheck) { if (typeof jQuery != 'undefined') { @@ -233,172 +234,242 @@ function altsys_mytpladmin_check_copy_submit(msg, id, selcheck) { EOD; + // get tplsets -$tplset_handler =& xoops_gethandler('tplset') ; -$tplsets = array_keys($tplset_handler->getList()) ; -$sql = "SELECT distinct tpl_tplset FROM ".$db->prefix("tplfile")." ORDER BY tpl_tplset='default' DESC,tpl_tplset" ; -$srs = $db->query($sql); -while (list($tplset) = $db->fetchRow($srs)) { - if (! in_array($tplset, $tplsets)) { - $tplsets[] = $tplset ; - } +$tplset_handler = xoops_gethandler( 'tplset' ); +$tplsets = array_keys( $tplset_handler->getList() ); +$sql = 'SELECT distinct tpl_tplset FROM ' . $db->prefix( 'tplfile' ) . " ORDER BY tpl_tplset='default' DESC,tpl_tplset"; +$srs = $db->query( $sql ); +while ( list( $tplset ) = $db->fetchRow( $srs ) ) { + if ( ! in_array( $tplset, $tplsets ) ) { + $tplsets[] = $tplset; + } } -$tplsets_th4disp = '' ; -$tplset_options = "\n" ; -foreach ($tplsets as $tplset) { - $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES) ; - $active = $th_attr = ''; - if ($tplset == $xoopsConfig['template_set']) { - $th_attr = "class='active dbtplset_active'"; - $active = '*'; - } - $tplsets_th4disp .= "=0){elements[i].checked=this.checked;}}}\" />{$active}DB-{$tplset4disp}" ; - $tplset_options .= "\n" ; +$tplsets_th4disp = ''; +$tplset_options = "\n"; +foreach ( $tplsets as $tplset ) { + $tplset4disp = htmlspecialchars( $tplset, ENT_QUOTES ); + + // Active Template Set + $active = $th_attr = ''; + if ( $tplset == $xoopsConfig['template_set'] ) { + $th_attr = "class='list_left active dbtplset_active'"; + $active = '*'; + } + $tplsets_th4disp .= "" + ."=0){elements[i].checked=this.checked;}}}\">" + ."{$active}DB-{$tplset4disp}" + .""; + $tplset_options .= "\n"; } // get tpl_file owned by the module -$sql = "SELECT tpl_file,tpl_desc,tpl_type,COUNT(tpl_id) FROM ".$db->prefix("tplfile")." WHERE tpl_module='$target_dirname4sql' GROUP BY tpl_file ORDER BY tpl_type, tpl_file" ; -$frs = $db->query($sql); +$sql = 'SELECT tpl_file,tpl_desc,tpl_type,COUNT(tpl_id) FROM ' . $db->prefix( 'tplfile' ) . " WHERE tpl_module='$target_dirname4sql' GROUP BY tpl_file ORDER BY tpl_type, tpl_file"; +$frs = $db->query( $sql ); + -xoops_cp_header() ; +// Render +xoops_cp_header(); // css display -require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; -$tpl = new D3Tpl() ; -echo ''; +echo ''; */ // javascript echo $javascript; -// mymenu -altsys_include_mymenu() ; - -// breadcrumbs -$breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; -if ($breadcrumbsObj->hasPaths()) { - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin', _MI_ALTSYS_MENU_MYTPLSADMIN) ; - $breadcrumbsObj->appendPath('', $target_mname) ; -} - -echo "

"._MYTPLSADMIN_H3_MODULE." : $target_mname

\n" ; +// MyMenu +altsys_include_mymenu(); -// link to create a new custom template -if ($target_dirname == '_custom') { - echo ""._MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE."\n" ; +// Breadcrumbs +$breadcrumbsObj = AltsysBreadcrumbs::getInstance(); +if ( $breadcrumbsObj->hasPaths() ) { + $breadcrumbsObj->appendPath( XOOPS_URL . '/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin', _MI_ALTSYS_MENU_MYTPLSADMIN ); + $breadcrumbsObj->appendPath( '', $target_mname ); } -// beggining of table & form -echo " -
- ".$xoopsGTicket->getTicketHtml(__LINE__)." - - - - - - $tplsets_th4disp - \n" ; - -// STYLE for distinguishing fingerprints -$fingerprint_classes = array( '' , ' fingerprint1' , ' fingerprint2' , ' fingerprint3' , ' fingerprint4' , ' fingerprint5' , ' fingerprint6' , ' fingerprint7' ) ; +// Heading Title +echo '
file:mytplsadmin.php
'; +echo "

" . _MYTPLSADMIN_H3_MODULE . " » $target_mname

\n"; +echo '
' . _MYTPLSADMIN_TIPS . '
'; + +// Form +echo "" + . $xoopsGTicket->getTicketHtml( __LINE__ ) ; + +////— ACTION-CONTROL —\\\\ +echo '
+
' . _MYTPLSADMIN_CREATE_NEW_TPLSET . ' : ' . _MYTPLSADMIN_CAPTION_BASE . ': + ' . _MYTPLSADMIN_CAPTION_SETNAME . ' : + + +
+
'; + // link to create a new custom template + if ( $target_dirname == '_custom' ) { + echo '' . _MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE . ''; + } +echo 'Renderer + +
+
'; + + +// TABLE +echo "
"._MYTPLSADMIN_TH_NAME.""._MYTPLSADMIN_TH_TYPE."=0){elements[i].checked=this.checked;}}}\" />"._MYTPLSADMIN_TH_FILE."
+ + + + + + $tplsets_th4disp + + \n"; + +// STYLE to distinguish fingerprints +$fingerprint_classes = [ + '', + ' fingerprint1', + ' fingerprint2', + ' fingerprint3', + ' fingerprint4', + ' fingerprint5', + ' fingerprint6', + ' fingerprint7' +]; // template ROWS -while (list($tpl_file, $tpl_desc, $type, $count) = $db->fetchRow($frs)) { - $evenodd = @$evenodd == 'even' ? 'odd' : 'even' ; - $fingerprints = array(); - - // information about the template - echo " - - - \n" ; - - // the base file template column - $basefilepath = tplsadmin_get_basefilepath($target_dirname, $type, $tpl_file) ; - - if (file_exists($basefilepath)) { - $fingerprint = tplsadmin_get_fingerprint(file($basefilepath)) ; - $fingerprints[ $fingerprint ] = '' ; - echo "\n" ; - $fingerprint_class_count = 0 ; - } else { - echo "" ; - $fingerprint_class_count = -1 ; - } +while ( list( $tpl_file, $tpl_desc, $type, $count ) = $db->fetchRow( $frs ) ) { + + $fingerprints = []; + + // information about the template + echo " + + \n"; + + // the base file template column + $basefilepath = tplsadmin_get_basefilepath( $target_dirname, $type, $tpl_file ); + + if ( file_exists( $basefilepath ) ) { + $fingerprint = tplsadmin_get_fingerprint( file( $basefilepath ) ); + $fingerprints[ $fingerprint ] = ''; + echo "\n"; + $fingerprint_class_count = 0; + } else { + echo ''; + $fingerprint_class_count = - 1; + } - // db template columns - foreach ($tplsets as $tplset) { - $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES) ; - - // query for templates in db - $drs = $db->query("SELECT * FROM ".$db->prefix("tplfile")." f NATURAL LEFT JOIN ".$db->prefix("tplsource")." s WHERE tpl_file='".addslashes($tpl_file)."' AND tpl_tplset='".addslashes($tplset)."'") ; - $numrows = $db->getRowsNum($drs) ; - $tpl = $db->fetchArray($drs) ; - if (empty($tpl['tpl_id'])) { - echo "\n" ; - } else { - $fingerprint = tplsadmin_get_fingerprint(explode("\n", $tpl['tpl_source'])) ; - if (isset($fingerprints[ $fingerprint ])) { - $class = $fingerprints[ $fingerprint ] ; - } else { - //$fingerprint_class_count ++ ; - $class = $fingerprint_classes[++$fingerprint_class_count] ; - $fingerprints[ $fingerprint ] = $class ; - } - echo "\n" ; - } - } + // db template columns + foreach ( $tplsets as $tplset ) { + $tplset4disp = htmlspecialchars( $tplset, ENT_QUOTES ); + + // query for templates in db + $drs = $db->query( 'SELECT * FROM ' . $db->prefix( 'tplfile' ) + . ' f NATURAL LEFT JOIN ' + . $db->prefix( 'tplsource' ) + . " s WHERE tpl_file='" + . addslashes( $tpl_file ) + . "' AND tpl_tplset='" + . addslashes( $tplset ) . "'" + ); + $numrows = $db->getRowsNum( $drs ); + $tpl = $db->fetchArray( $drs ); + if ( empty( $tpl['tpl_id'] ) ) { + echo ""; + } else { + $fingerprint = tplsadmin_get_fingerprint( explode( "\n", $tpl['tpl_source'] ) ); + if ( isset( $fingerprints[ $fingerprint ] ) ) { + $class = $fingerprints[ $fingerprint ]; + } else { + //$fingerprint_class_count ++ ; + $class = $fingerprint_classes[ ++ $fingerprint_class_count ]; + $fingerprints[ $fingerprint ] = $class; + } + echo " + \n"; + } + } - echo "\n" ; + echo "\n"; } -// command submit ROW -echo " - - + + - - \n" ; - - foreach ($tplsets as $tplset) { - $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES) ; - echo "\t\t\n" ; - } + \n"; + +foreach ( $tplsets as $tplset ) { + $tplset4disp = htmlspecialchars( $tplset, ENT_QUOTES ); + echo "\t\n"; +} -echo " \n" ; +echo ''; -echo "
" . _MYTPLSADMIN_TH_NAME . "" . _MYTPLSADMIN_TH_TYPE . " + =0){elements[i].checked=this.checked;}}}\">" + . _MYTPLSADMIN_TH_FILE + . "
-
-
".htmlspecialchars($tpl_file, ENT_QUOTES)."
-
".htmlspecialchars($tpl_desc, ENT_QUOTES)."
-
-
".$type."
(".$count.")
".formatTimestamp(filemtime($basefilepath), 'm').'
'.substr($fingerprint, 0, 16)."

+ " . htmlspecialchars( $tpl_file, ENT_QUOTES ) . "
+ " . htmlspecialchars( $tpl_desc, ENT_QUOTES ) . " +
" . $type . " " . $count . "" + ."" + . formatTimestamp( filemtime( $basefilepath ), 'm' ) + . "
" + . substr( $fingerprint, 0, 16 ) + . "

($numrows)".formatTimestamp($tpl['tpl_lastmodified'], 'm').'
'.substr($fingerprint, 0, 16)."
  "._EDIT." ($numrows)
($numrows) + + " + . _EDIT + . " + $numrows
" + . formatTimestamp( $tpl['tpl_lastmodified'], 'm' ) + . '
' + . substr( $fingerprint, 0, 16 ) + . "
- "._MYTPLSADMIN_CREATE_NEW_TPLSET.":
- "._MYTPLSADMIN_CAPTION_BASE.": -
". _MYTPLSADMIN_CREATE_NEW_TPLSET . " : " . _MYTPLSADMIN_CAPTION_BASE + . " -
- "._MYTPLSADMIN_CAPTION_SETNAME.": + + +
" + . _MYTPLSADMIN_CAPTION_SETNAME + . "
- "._MYTPLSADMIN_CAPTION_COPYTO.": - -
- -
- " . ($tplset == 'default' && $target_dirname != '_custom' ? "" : "

") . " - "._MYTPLSADMIN_CAPTION_COPYTO.": - - -
" + . _MYTPLSADMIN_CAPTION_COPYTO . " +
+ + +
" + . _MYTPLSADMIN_CAPTION_COPYTO + . "
\n" + . "\n" + . "\n" + . ( 'default' == $tplset && '_custom' != $target_dirname ? '' + : "" ) + . "
" ; +echo ''; // end of table & form -xoops_cp_footer() ; +xoops_cp_footer(); diff --git a/xoops_trust_path/libs/altsys/mytplsform.php b/xoops_trust_path/libs/altsys/mytplsform.php index 904fa75..f130c1a 100644 --- a/xoops_trust_path/libs/altsys/mytplsform.php +++ b/xoops_trust_path/libs/altsys/mytplsform.php @@ -1,262 +1,292 @@ // -// ------------------------------------------------------------------------- // - -require_once dirname(__FILE__).'/class/AltsysBreadcrumbs.class.php' ; -include_once dirname(__FILE__)."/include/gtickets.php" ; -include_once dirname(__FILE__).'/include/altsys_functions.php' ; -include_once dirname(__FILE__)."/include/tpls_functions.php" ; -include_once dirname(__FILE__).'/include/Text_Diff.php' ; -include_once dirname(__FILE__).'/include/Text_Diff_Renderer.php' ; -include_once dirname(__FILE__).'/include/Text_Diff_Renderer_unified.php' ; - - -// only groups have 'module_admin' of 'altsys' can do that. -$module_handler =& xoops_gethandler('module') ; -$module =& $module_handler->getByDirname('altsys') ; -$moduleperm_handler =& xoops_gethandler('groupperm') ; -if (! is_object(@$xoopsUser) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) { - die('only admin of altsys can access this area') ; +/** + * Altsys library (UI-Components) for D3 modules + * Templates admin form for each modules + * @package Altsys + * @version XCL 2.3.1 + * @author Other authors gigamaster, 2020 XCL/PHP7 + * @author Gijoe (Peak) + * @copyright (c) 2005-2022 Authors + * @license GPL v2.0 + */ + + +require_once __DIR__ . '/class/AltsysBreadcrumbs.class.php'; +include_once __DIR__ . '/include/gtickets.php'; +include_once __DIR__ . '/include/altsys_functions.php'; +include_once __DIR__ . '/include/tpls_functions.php'; +include_once __DIR__ . '/include/Text_Diff.php'; +include_once __DIR__ . '/include/Text_Diff_Renderer.php'; +include_once __DIR__ . '/include/Text_Diff_Renderer_unified.php'; + + +// only user groups with admin permissions +$module_handler =& xoops_gethandler( 'module' ); +$module =& $module_handler->getByDirname( 'altsys' ); +$moduleperm_handler =& xoops_gethandler( 'groupperm' ); +if ( ! is_object( @$xoopsUser ) || ! $moduleperm_handler->checkRight( 'module_admin', $module->getVar( 'mid' ), $xoopsUser->getGroups() ) ) { + die( 'only admin of altsys can access this area' ); } -//$xoops_system_path = XOOPS_ROOT_PATH . '/modules/system' ; // initials $db =& XoopsDatabaseFactory::getDatabaseConnection(); -(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts =& MyTextSanitizer::getInstance() ; +( method_exists( 'MyTextSanitizer', 'sGetInstance' ) and $myts =& MyTextSanitizer::sGetInstance() ) || $myts =& MyTextSanitizer::getInstance(); + // language file -altsys_include_language_file('mytplsform') ; -altsys_include_language_file('mytplsadmin') ; +altsys_include_language_file( 'mytplsform' ); +altsys_include_language_file( 'mytplsadmin' ); + // check $xoopsModule -if (! is_object($xoopsModule)) { - redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM) ; +if ( ! is_object( $xoopsModule ) ) { + redirect_header( XOOPS_URL . '/user.php', 1, _NOPERM ); } -// check access right (needs system_admin of tplset) -//$sysperm_handler =& xoops_gethandler('groupperm'); -//if (!$sysperm_handler->checkRight('system_admin', XOOPS_SYSTEM_TPLSET, $xoopsUser->getGroups())) redirect_header( XOOPS_URL.'/user.php' , 1 , _NOPERM ) ; // tpl_file from $_GET -$tpl_tplset = $myts->stripSlashesGPC(@$_GET['tpl_tplset']) ; -if (! $tpl_tplset) { - $tpl_tplset = $xoopsConfig['template_set'] ; +$tpl_tplset = $myts->stripSlashesGPC( @$_GET['tpl_tplset'] ); +if ( ! $tpl_tplset ) { + $tpl_tplset = $xoopsConfig['template_set']; } -$tpl_tplset4sql = addslashes($tpl_tplset) ; - -if (empty($_GET['tpl_file']) || $_GET['tpl_file'] == '_custom') { - $edit_mode = 'create' ; - $tpl_file = '_custom' ; - $tpl = array( - 'tpl_id' => 0 , - 'tpl_refid' => 0 , - 'tpl_module' => '_custom' , - 'tpl_tplset' => $tpl_tplset , - 'tpl_file' => '_custom_'.substr(date('YmdHis'), 2, -2).'.html' , - 'tpl_desc' => '' , - 'tpl_lastmodified' => 0 , - 'tpl_lastimported' => 0 , - 'tpl_type' => 'custom' , - 'tpl_source' => '' , - ) ; - - // breadcrumbs - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin', '_MI_ALTSYS_MENU_MYTPLSADMIN') ; - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname=_custom', _MYTPLSADMIN_CUSTOMTEMPLATE) ; - $breadcrumbsObj->appendPath('', '_MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE') ; - $target_mname = _MYTPLSADMIN_CUSTOMTEMPLATE; +$tpl_tplset4sql = addslashes( $tpl_tplset ); + + +if ( empty( $_GET['tpl_file'] ) || '_custom' == $_GET['tpl_file'] ) { + $edit_mode = 'create'; + $tpl_file = '_custom'; + $tpl = [ + 'tpl_id' => 0, + 'tpl_refid' => 0, + 'tpl_module' => '_custom', + 'tpl_tplset' => $tpl_tplset, + 'tpl_file' => '_custom_' . substr(date('YmdHis'), 2, -2) . '.html', + 'tpl_desc' => '', + 'tpl_lastmodified' => 0, + 'tpl_lastimported' => 0, + 'tpl_type' => 'custom', + 'tpl_source' => '', + ]; + + + // breadcrumbs + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); + $breadcrumbsObj->appendPath( XOOPS_URL . '/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin', '_MI_ALTSYS_MENU_MYTPLSADMIN' ); + $breadcrumbsObj->appendPath( XOOPS_URL . '/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname=_custom', _MYTPLSADMIN_CUSTOMTEMPLATE ); + $breadcrumbsObj->appendPath( '', '_MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE' ); + $target_mname = _MYTPLSADMIN_CUSTOMTEMPLATE; + } else { - // tpl_file from $_GET - $edit_mode = 'modify' ; - $tpl_file = $myts->stripSlashesGPC(@$_GET['tpl_file']) ; - $tpl_file = str_replace('db:', '', $tpl_file) ; - $tpl_file4sql = addslashes($tpl_file) ; - - // get information from tplfile table - $sql = "SELECT * FROM ".$db->prefix("tplfile")." f NATURAL LEFT JOIN ".$db->prefix("tplsource")." s WHERE f.tpl_file='$tpl_file4sql' ORDER BY f.tpl_tplset='$tpl_tplset4sql' DESC,f.tpl_tplset='default' DESC" ; - $tpl = $db->fetchArray($db->query($sql)) ; - - // get module info - if ($tpl['tpl_module'] == '_custom') { - $target_module = null ; - $target_mname = _MYTPLSADMIN_CUSTOMTEMPLATE ; - } else { - $module_handler =& xoops_gethandler('module') ; - $target_module =& $module_handler->getByDirname($tpl['tpl_module']) ; - $target_mname = is_object($target_module) ? $target_module->getVar('name') : '' ; - } - - // breadcrumbs - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; - if ($mydirname != 'altsys' && is_object($target_module)) { - // mytplsform in each modules - $mod_url = XOOPS_URL.'/modules/'.$target_module->getVar('dirname') ; - $modinfo = $target_module->getInfo() ; - $breadcrumbsObj->appendPath($mod_url.'/'.@$modinfo['adminindex'], $target_mname) ; - $breadcrumbsObj->appendPath($mod_url.'/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin', _MD_A_MYTPLSFORM_TPLSADMIN) ; - } else { - // mytplsform in altsys - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin', '_MI_ALTSYS_MENU_MYTPLSADMIN') ; - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.htmlspecialchars($tpl['tpl_module']), $target_mname) ; - } - $breadcrumbsObj->appendPath('', _MD_A_MYTPLSFORM_EDIT) ; + + // tpl_file from $_GET + $edit_mode = 'modify'; + $tpl_file = $myts->stripSlashesGPC( @$_GET['tpl_file'] ); + $tpl_file = str_replace( 'db:', '', $tpl_file ); + $tpl_file4sql = addslashes( $tpl_file ); + + // get information from tplfile table + $sql = 'SELECT * FROM ' . $db->prefix( 'tplfile' ) . ' f NATURAL LEFT JOIN ' . $db->prefix( 'tplsource' ) . " s WHERE f.tpl_file='$tpl_file4sql' ORDER BY f.tpl_tplset='$tpl_tplset4sql' DESC,f.tpl_tplset='default' DESC"; + $tpl = $db->fetchArray( $db->query( $sql ) ); + + // get module info + if ( '_custom' == $tpl['tpl_module'] ) { + $target_module = null; + $target_mname = _MYTPLSADMIN_CUSTOMTEMPLATE; + } else { + $module_handler =& xoops_gethandler( 'module' ); + $target_module =& $module_handler->getByDirname( $tpl['tpl_module'] ); + $target_mname = is_object( $target_module ) ? $target_module->getVar( 'name' ) : ''; + } + + // breadcrumbs + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); + if ( 'altsys' != $mydirname && is_object( $target_module ) ) { + // mytplsform in each modules + $mod_url = XOOPS_URL . '/modules/' . $target_module->getVar( 'dirname' ); + $modinfo = $target_module->getInfo(); + $breadcrumbsObj->appendPath( $mod_url . '/' . @$modinfo['adminindex'], $target_mname ); + $breadcrumbsObj->appendPath( $mod_url . '/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin', _MD_A_MYTPLSFORM_TPLSADMIN ); + } else { + // mytplsform in altsys + $breadcrumbsObj->appendPath( XOOPS_URL . '/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin', '_MI_ALTSYS_MENU_MYTPLSADMIN' ); + $breadcrumbsObj->appendPath( XOOPS_URL . '/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname=' . htmlspecialchars( $tpl['tpl_module'] ), $target_mname ); + } + $breadcrumbsObj->appendPath( '', _MD_A_MYTPLSFORM_EDIT ); } + // error in specifying tpl_file -if (empty($tpl)) { - if (strncmp($tpl_file, 'file:', 5) === 0) { - die('Not DB template') ; - } else { - die('Invalid tpl_file.') ; - } -} +if ( empty( $tpl ) ) { + if ( 0 === strncmp( $tpl_file, 'file:', 5 ) ) { + die( 'Not DB template' ); + } -//****************// -// TRANSACT stage // -//****************// -if (! empty($_POST['do_modifycont']) || ! empty($_POST['do_modify'])) { - // Ticket Check - if (! $xoopsGTicket->check(true, 'altsys_tplsform')) { - redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); - } - - $result = $db->query("SELECT tpl_id FROM ".$db->prefix("tplfile")." WHERE tpl_file='$tpl_file4sql' AND tpl_tplset='".addslashes($tpl['tpl_tplset'])."'") ; - while (list($tpl_id) = $db->fetchRow($result)) { - $sql = "UPDATE ".$db->prefix("tplsource")." SET tpl_source='".addslashes($myts->stripSlashesGPC($_POST['tpl_source']))."' WHERE tpl_id=$tpl_id" ; - if (! $db->query($sql)) { - die('SQL Error') ; - } - $db->query("UPDATE ".$db->prefix("tplfile")." SET tpl_lastmodified=UNIX_TIMESTAMP() WHERE tpl_id=$tpl_id") ; - altsys_template_touch($tpl_id) ; - } - - // continue or end ? - if (! empty($_POST['do_modifycont'])) { - redirect_header('index.php?mode=admin&lib=altsys&page=mytplsform&tpl_file='.$tpl_file.'&tpl_tplset='.$tpl_tplset.'&dirname='.$tpl['tpl_module'].'#altsys_tplsform_top', 1, _MD_A_MYTPLSFORM_UPDATED) ; - } else { - redirect_header('index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$tpl['tpl_module'], 1, _MD_A_MYTPLSFORM_UPDATED) ; - } - exit ; + die( 'Invalid tpl_file.' ); } -if (! empty($_POST['do_create'])) { - // Ticket Check - if (! $xoopsGTicket->check(true, 'altsys_tplsform')) { - redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); - } - - $sql = "INSERT INTO ".$db->prefix("tplfile")." SET tpl_file='".addslashes($myts->stripSlashesGPC($_POST['tpl_file']))."',tpl_refid=0,tpl_module='".addslashes($tpl['tpl_module'])."',tpl_tplset='".addslashes($tpl['tpl_tplset'])."',tpl_lastmodified=UNIX_TIMESTAMP(),tpl_type='".addslashes($tpl['tpl_type'])."'" ; - if (! $db->query($sql)) { - die('SQL Error'.__LINE__) ; - } - $tpl_id = intval($db->getInsertId()) ; - $sql = "INSERT INTO ".$db->prefix("tplsource")." SET tpl_id=$tpl_id,tpl_source='".addslashes($myts->stripSlashesGPC($_POST['tpl_source']))."'" ; - if (! $db->query($sql)) { - die('SQL Error'.__LINE__) ; - } - altsys_template_touch($tpl_id) ; - - // continue or end ? - redirect_header('index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$tpl['tpl_module'], 1, _MD_A_MYTPLSFORM_CREATED) ; - exit ; + +// TRANSACTION +if ( ! empty( $_POST['do_modifycont'] ) || ! empty( $_POST['do_modify'] ) ) { + // Ticket Check + if ( ! $xoopsGTicket->check( true, 'altsys_tplsform' ) ) { + redirect_header( XOOPS_URL . '/', 3, $xoopsGTicket->getErrors() ); + } + + $result = $db->query( 'SELECT tpl_id FROM ' . $db->prefix( 'tplfile' ) . " WHERE tpl_file='$tpl_file4sql' AND tpl_tplset='" . addslashes( $tpl['tpl_tplset'] ) . "'" ); + while ( list( $tpl_id ) = $db->fetchRow( $result ) ) { + $sql = 'UPDATE ' . $db->prefix( 'tplsource' ) . " SET tpl_source='" . addslashes( $myts->stripSlashesGPC( $_POST['tpl_source'] ) ) . "' WHERE tpl_id=$tpl_id"; + if ( ! $db->query( $sql ) ) { + die( 'SQL Error' ); + } + $db->query( 'UPDATE ' . $db->prefix( 'tplfile' ) . " SET tpl_lastmodified=UNIX_TIMESTAMP() WHERE tpl_id=$tpl_id" ); + altsys_template_touch( $tpl_id ); + } + + // continue or end ? + if ( ! empty( $_POST['do_modifycont'] ) ) { + redirect_header( 'index.php?mode=admin&lib=altsys&page=mytplsform&tpl_file=' . $tpl_file . '&tpl_tplset=' . $tpl_tplset . '&dirname=' . $tpl['tpl_module'] . '#altsys_tplsform_top', 1, _MD_A_MYTPLSFORM_UPDATED ); + } else { + redirect_header( 'index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname=' . $tpl['tpl_module'], 1, _MD_A_MYTPLSFORM_UPDATED ); + } + exit; } +if ( ! empty( $_POST['do_create'] ) ) { + // Ticket Check + if ( ! $xoopsGTicket->check( true, 'altsys_tplsform' ) ) { + redirect_header( XOOPS_URL . '/', 3, $xoopsGTicket->getErrors() ); + } + + $sql = 'INSERT INTO ' + . $db->prefix( 'tplfile' ) . " SET tpl_file='" . addslashes( $myts->stripSlashesGPC( $_POST['tpl_file'] ) ) . "',tpl_refid=0,tpl_module='" . addslashes( $tpl['tpl_module'] ) . "',tpl_tplset='" . addslashes( $tpl['tpl_tplset'] ) . "',tpl_lastmodified=UNIX_TIMESTAMP(),tpl_type='" . addslashes( $tpl['tpl_type'] ) . "'"; + if ( ! $db->query( $sql ) ) { + die( 'SQL Error' . __LINE__ ); + } + $tpl_id = (int) $db->getInsertId(); + $sql = 'INSERT INTO ' . $db->prefix( 'tplsource' ) . " SET tpl_id=$tpl_id,tpl_source='" . addslashes( $myts->stripSlashesGPC( $_POST['tpl_source'] ) ) . "'"; + if ( ! $db->query( $sql ) ) { + die( 'SQL Error' . __LINE__ ); + } + altsys_template_touch( $tpl_id ); + + // continue or end ? + redirect_header( 'index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname=' . $tpl['tpl_module'], 1, _MD_A_MYTPLSFORM_CREATED ); + exit; +} -//****************// -// FORM stage // -//****************// -xoops_cp_header() ; -$mymenu_fake_uri = 'index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$mydirname ; - -// mymenu -altsys_include_mymenu() ; - -echo "

"._MD_A_MYTPLSFORM_EDIT." : ".htmlspecialchars($tpl['tpl_type'], ENT_QUOTES)." : ".htmlspecialchars($tpl['tpl_file'], ENT_QUOTES)." (".htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES).")

\n" ; - - -// diff from file to selected DB template -$basefilepath = tplsadmin_get_basefilepath($tpl['tpl_module'], $tpl['tpl_type'], $tpl['tpl_file']) ; -$diff_from_file4disp = '' ; -if (file_exists($basefilepath)) { - $original_error_level = error_reporting() ; - error_reporting($original_error_level & ~ E_NOTICE & ~ E_WARNING) ; - $diff = new Text_Diff(file($basefilepath), explode("\n", $tpl['tpl_source'])) ; - $renderer = new Text_Diff_Renderer_unified(); - $diff_str = htmlspecialchars($renderer->render($diff), ENT_QUOTES) ; - foreach (explode("\n", $diff_str) as $line) { - if (ord($line) == 0x2d) { - $diff_from_file4disp .= "".$line."\n" ; - } elseif (ord($line) == 0x2b) { - $diff_from_file4disp .= "".$line."\n" ; - } else { - $diff_from_file4disp .= $line."\n" ; - } - } - error_reporting($original_error_level) ; + +// FORM RENDER + +xoops_cp_header(); +$mymenu_fake_uri = 'index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname=' . $mydirname; + +// Menu +altsys_include_mymenu(); + +echo '

' . _MD_A_MYTPLSFORM_EDIT . '

'; + +// Template Set, Name, Type +echo ' + + + +
' . _MYTPLSADMIN_TH_SET . '' . htmlspecialchars( $tpl['tpl_tplset'], ENT_QUOTES ) . '
' . _MYTPLSADMIN_TH_NAME .'' . htmlspecialchars( $tpl['tpl_file'], ENT_QUOTES ) . '
' . _MYTPLSADMIN_TH_TYPE . '' . htmlspecialchars( $tpl['tpl_type'], ENT_QUOTES ) . '
'; + +// Diff from file to selected DB template +$basefilepath = tplsadmin_get_basefilepath( $tpl['tpl_module'], $tpl['tpl_type'], $tpl['tpl_file'] ); +$diff_from_file4disp = ''; +if ( file_exists( $basefilepath ) ) { + $original_error_level = error_reporting(); + error_reporting( $original_error_level & ~E_NOTICE & ~E_WARNING ); + $diff = new Text_Diff( file( $basefilepath ), explode( "\n", $tpl['tpl_source'] ) ); + $renderer = new Text_Diff_Renderer_unified(); + $diff_str = htmlspecialchars( $renderer->render( $diff ), ENT_QUOTES ); + foreach ( explode( "\n", $diff_str ) as $line ) { + if ( 0x2d == ord( $line ) ) { + $diff_from_file4disp .= "" . $line . "\n"; + } elseif ( 0x2b == ord( $line ) ) { + $diff_from_file4disp .= "" . $line . "\n"; + } else { + $diff_from_file4disp .= $line . "\n"; + } + } + error_reporting( $original_error_level ); } -// diff from DB-default to selected DB template -$diff_from_default4disp = '' ; -if ($tpl['tpl_tplset'] != 'default') { - $original_error_level = error_reporting() ; - error_reporting($original_error_level & ~ E_NOTICE & ~ E_WARNING) ; - list($default_source) = $db->fetchRow($db->query("SELECT tpl_source FROM ".$db->prefix("tplfile")." NATURAL LEFT JOIN ".$db->prefix("tplsource")." WHERE tpl_tplset='default' AND tpl_file='".addslashes($tpl['tpl_file'])."' AND tpl_module='".addslashes($tpl['tpl_module'])."'")) ; - $diff = new Text_Diff(explode("\n", $default_source), explode("\n", $tpl['tpl_source'])) ; - $renderer = new Text_Diff_Renderer_unified(); - $diff_str = htmlspecialchars($renderer->render($diff), ENT_QUOTES) ; - foreach (explode("\n", $diff_str) as $line) { - if (ord($line) == 0x2d) { - $diff_from_default4disp .= "".$line."\n" ; - } elseif (ord($line) == 0x2b) { - $diff_from_default4disp .= "".$line."\n" ; - } else { - $diff_from_default4disp .= $line."\n" ; - } - } - error_reporting($original_error_level) ; +// Diff from DB-default to selected DB template +$diff_from_default4disp = ''; +if ( 'default' != $tpl['tpl_tplset'] ) { + $original_error_level = error_reporting(); + error_reporting( $original_error_level & ~E_NOTICE & ~E_WARNING ); + [ $default_source ] = $db->fetchRow( $db->query( 'SELECT tpl_source FROM ' . $db->prefix( 'tplfile' ) . ' NATURAL LEFT JOIN ' . $db->prefix( 'tplsource' ) . " WHERE tpl_tplset='default' AND tpl_file='" . addslashes( $tpl['tpl_file'] ) . "' AND tpl_module='" . addslashes( $tpl['tpl_module'] ) . "'" ) ); + $diff = new Text_Diff( explode( "\n", $default_source ), explode( "\n", $tpl['tpl_source'] ) ); + $renderer = new Text_Diff_Renderer_unified(); + $diff_str = htmlspecialchars( $renderer->render( $diff ), ENT_QUOTES ); + foreach ( explode( "\n", $diff_str ) as $line ) { + if ( 0x2d == ord( $line ) ) { + $diff_from_default4disp .= "" . $line . "\n"; + } elseif ( 0x2b == ord( $line ) ) { + $diff_from_default4disp .= "" . $line . "\n"; + } else { + $diff_from_default4disp .= $line . "\n"; + } + } + error_reporting( $original_error_level ); } -echo " -
\n" ; -if ($diff_from_file4disp) { - echo "  -
$diff_from_file4disp
\n" ; +echo '
'; + +// Diff Switch View +echo ''; +if ( $diff_from_file4disp ) { + echo ' '; + echo "
$diff_from_file4disp
"; } -if ($diff_from_default4disp) { - echo "  - \n" ; +if ( $diff_from_default4disp ) { + echo ' '; + echo "
$diff_from_default4disp
"; } -echo " - \n" ; - - -echo " - -
- ".$xoopsGTicket->getTicketHtml(__LINE__, 1800, 'altsys_tplsform')." - -
-" ; -if ($edit_mode == 'create') { - // create form - echo " - -
- \n" ; +echo "
"; + + +// Edit Template +echo " +
" + . $xoopsGTicket->getTicketHtml( __LINE__, 1800, 'altsys_tplsform' ) . " +
+ +
"; + +// Create New Template +if ( 'create' == $edit_mode ) { + // create form + echo " +
+ "; } else { - // modify form - echo " - - - -
\n" ; + // modify form + echo "
+
+ + + +
"; } +echo "
"; -xoops_cp_footer() ; +xoops_cp_footer(); diff --git a/xoops_trust_path/libs/altsys/oninstall.php b/xoops_trust_path/libs/altsys/oninstall.php index 8af02d1..0822e7a 100644 --- a/xoops_trust_path/libs/altsys/oninstall.php +++ b/xoops_trust_path/libs/altsys/oninstall.php @@ -1,128 +1,138 @@ mDelegateManager->add('Legacy.Admin.Event.ModuleInstall.' . ucfirst($mydirname) . '.Success', 'altsys_message_append_oninstall') ; - $ret = array() ; - } else { - if (! is_array($ret)) { - $ret = array() ; - } - } - - $db =& XoopsDatabaseFactory::getDatabaseConnection() ; - $mid = $module->getVar('mid') ; - - /*************** BEGIN ALTSYS SPECIFIC PART ******************/ - // set weight=0 - $db->queryF("UPDATE ".$db->prefix("modules")." SET weight=0 WHERE mid=$mid") ; - /*************** END ALTSYS SPECIFIC PART ******************/ - - // TABLES (loading mysql.sql) - $sql_file_path = dirname(__FILE__).'/sql/mysql.sql' ; - $prefix_mod = $db->prefix() . '_' . $mydirname ; - if (file_exists($sql_file_path)) { - $ret[] = "SQL file found at ".htmlspecialchars($sql_file_path).".
Creating tables..."; - - if (file_exists(XOOPS_ROOT_PATH.'/class/database/oldsqlutility.php')) { - include_once XOOPS_ROOT_PATH.'/class/database/oldsqlutility.php' ; - $sqlutil = new OldSqlUtility ; - } else { - include_once XOOPS_ROOT_PATH.'/class/database/sqlutility.php' ; - $sqlutil = new SqlUtility ; - } - - $sql_query = trim(file_get_contents($sql_file_path)) ; - $sqlutil->splitMySqlFile($pieces, $sql_query) ; - $created_tables = array() ; - foreach ($pieces as $piece) { - $prefixed_query = $sqlutil->prefixQuery($piece, $prefix_mod) ; - if (! $prefixed_query) { - $ret[] = "Invalid SQL ".htmlspecialchars($piece)."
"; - return false ; - } - if (! $db->query($prefixed_query[0])) { - $ret[] = ''.htmlspecialchars($db->error()).'
' ; - //var_dump( $db->error() ) ; - return false ; - } else { - if (! in_array($prefixed_query[4], $created_tables)) { - $ret[] = 'Table '.htmlspecialchars($prefix_mod.'_'.$prefixed_query[4]).' created.
'; - $created_tables[] = $prefixed_query[4]; - } else { - $ret[] = 'Data inserted to table '.htmlspecialchars($prefix_mod.'_'.$prefixed_query[4]).'.
'; - } - } - } - } - - // TEMPLATES - $tplfile_handler =& xoops_gethandler('tplfile') ; - $tpl_path = dirname(__FILE__).'/templates' ; - if ($handler = @opendir($tpl_path . '/')) { - while (($file = readdir($handler)) !== false) { - if (substr($file, 0, 1) == '.') { - continue ; - } - $file_path = $tpl_path . '/' . $file ; - if (is_file($file_path)) { - $mtime = intval(@filemtime($file_path)) ; - $tplfile =& $tplfile_handler->create() ; - $tplfile->setVar('tpl_source', file_get_contents($file_path), true) ; - $tplfile->setVar('tpl_refid', $mid) ; - $tplfile->setVar('tpl_tplset', 'default') ; - $tplfile->setVar('tpl_file', $mydirname . '_' . $file) ; - $tplfile->setVar('tpl_desc', '', true) ; - $tplfile->setVar('tpl_module', $mydirname) ; - $tplfile->setVar('tpl_lastmodified', $mtime) ; - $tplfile->setVar('tpl_lastimported', 0) ; - $tplfile->setVar('tpl_type', 'module') ; - if (! $tplfile_handler->insert($tplfile)) { - $ret[] = 'ERROR: Could not insert template '.htmlspecialchars($mydirname.'_'.$file).' to the database.
'; - } else { - $tplid = $tplfile->getVar('tpl_id') ; - $ret[] = 'Template '.htmlspecialchars($mydirname.'_'.$file).' added to the database. (ID: '.$tplid.')
'; - require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php' ; - altsys_clear_templates_c() ; - // generate compiled file - /*include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; - include_once XOOPS_ROOT_PATH.'/class/template.php' ; - if( ! xoops_template_touch( $tplid ) ) { - $ret[] = 'ERROR: Failed compiling template '.htmlspecialchars($mydirname.'_'.$file).'.
'; - } else { - $ret[] = 'Template '.htmlspecialchars($mydirname.'_'.$file).' compiled.
'; - }*/ - } - } - } - closedir($handler) ; - } - include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; - include_once XOOPS_ROOT_PATH.'/class/template.php' ; - xoops_template_clear_module_cache($mid) ; - - return true ; - } - - function altsys_message_append_oninstall(&$module_obj, &$log) - { - if (is_array(@$GLOBALS['ret'])) { - foreach ($GLOBALS['ret'] as $message) { - $log->add(strip_tags($message)) ; - } - } - - // use mLog->addWarning() or mLog->addError() if necessary - } + +eval( ' function xoops_module_install_' . $mydirname . '( $module ) { return altsys_oninstall_base( $module , "' . $mydirname . '" ) ; } ' ); + +if ( ! function_exists( 'altsys_oninstall_base' ) ) { + /** + * @param $module + * @param $mydirname + * + * @return bool + */ + + if ( ! function_exists( 'altsys_oninstall_base' ) ) { + function altsys_oninstall_base( $module, $mydirname ) { + // transactions on module install + + global $ret; // TODO :-D + + // for Cube 2.1 + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $root = XCube_Root::getSingleton(); + $root->mDelegateManager->add( 'Legacy.Admin.Event.ModuleInstall.' . ucfirst( $mydirname ) . '.Success', 'altsys_message_append_oninstall' ); + $ret = []; + } else { + if ( ! is_array( $ret ) ) { + $ret = []; + } + } + + $db = XoopsDatabaseFactory::getDatabaseConnection(); + + $mid = $module->getVar( 'mid' ); + + // ALTSYS SPECIFIC PART + // set weight=0 + $db->queryF( 'UPDATE ' . $db->prefix( 'modules' ) . " SET weight=0 WHERE mid=$mid" ); + + + // TABLES (loading mysql.sql) + $sql_file_path = __DIR__ . '/sql/mysql.sql'; + $prefix_mod = $db->prefix() . '_' . $mydirname; + if ( file_exists( $sql_file_path ) ) { + //$ret[] = 'SQL file found at ' . htmlspecialchars($sql_file_path) . '.
Creating tables...'; + $ret[] = 'SQL file found at ' . htmlspecialchars( $sql_file_path, ENT_QUOTES | ENT_HTML5 ) . '.
Creating tables...'; + + if ( is_file( XOOPS_ROOT_PATH . '/class/database/oldsqlutility.php' ) ) { + include_once XOOPS_ROOT_PATH . '/class/database/oldsqlutility.php'; + $sqlutil = new OldSqlUtility(); + } else { + include_once XOOPS_ROOT_PATH . '/class/database/sqlutility.php'; + $sqlutil = new SqlUtility(); + } + + $sql_query = trim( file_get_contents( $sql_file_path ) ); + $sqlutil->splitMySqlFile( $pieces, $sql_query ); + $created_tables = []; + foreach ( $pieces as $piece ) { + $prefixed_query = $sqlutil->prefixQuery( $piece, $prefix_mod ); + if ( ! $prefixed_query ) { + $ret[] = 'Invalid SQL ' . htmlspecialchars( $piece ) . '
'; + + return false; + } + if ( ! $db->query( $prefixed_query[0] ) ) { + $ret[] = '' . htmlspecialchars( $db->error() ) . '
'; + + //var_dump( $db->error() ) ; + return false; + } else if ( ! in_array( $prefixed_query[4], $created_tables ) ) { + $ret[] = 'Table ' . htmlspecialchars( $prefix_mod . '_' . $prefixed_query[4] ) . ' created.
'; + $created_tables[] = $prefixed_query[4]; + } else { + $ret[] = 'Data inserted to table ' . htmlspecialchars( $prefix_mod . '_' . $prefixed_query[4] ) . '.
'; + } + } + } + + // TEMPLATES + $tplfile_handler = xoops_gethandler( 'tplfile' ); + $tpl_path = __DIR__ . '/templates'; + if ( $handler = @opendir( $tpl_path . '/' ) ) { + while ( false !== ( $file = readdir( $handler ) ) ) { + if ( '.' == substr( $file, 0, 1 ) ) { + continue; + } + $file_path = $tpl_path . '/' . $file; + if ( is_file( $file_path ) ) { + $mtime = (int) @filemtime( $file_path ); + $tplfile = $tplfile_handler->create(); + $tplfile->setVar( 'tpl_source', file_get_contents( $file_path ), true ); + $tplfile->setVar( 'tpl_refid', $mid ); + $tplfile->setVar( 'tpl_tplset', 'default' ); + $tplfile->setVar( 'tpl_file', $mydirname . '_' . $file ); + $tplfile->setVar( 'tpl_desc', '', true ); + $tplfile->setVar( 'tpl_module', $mydirname ); + $tplfile->setVar( 'tpl_lastmodified', $mtime ); + $tplfile->setVar( 'tpl_lastimported', 0 ); + $tplfile->setVar( 'tpl_type', 'module' ); + if ( ! $tplfile_handler->insert( $tplfile ) ) { + $ret[] = 'ERROR: Could not insert template ' . htmlspecialchars( $mydirname . '_' . $file ) . ' to the database.
'; + } else { + $tplid = $tplfile->getVar( 'tpl_id' ); + $ret[] = 'Template ' . htmlspecialchars( $mydirname . '_' . $file ) . ' added to the database. (ID: ' . $tplid . ')
'; + require_once XOOPS_TRUST_PATH . '/libs/altsys/include/altsys_functions.php'; + altsys_clear_templates_c(); + } + } + } + closedir( $handler ); + } + include_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; + include_once XOOPS_ROOT_PATH . '/class/template.php'; + xoops_template_clear_module_cache( $mid ); + + return true; + } + + function altsys_message_append_oninstall( &$module_obj, &$log ) { + if ( is_array( @$GLOBALS['ret'] ) ) { + foreach ( $GLOBALS['ret'] as $message ) { + $log->add( strip_tags( $message ) ); + } + } + + // use mLog->addWarning() or mLog->addError() if necessary + } + } } diff --git a/xoops_trust_path/libs/altsys/onuninstall.php b/xoops_trust_path/libs/altsys/onuninstall.php index 9971f45..a6dfb6c 100644 --- a/xoops_trust_path/libs/altsys/onuninstall.php +++ b/xoops_trust_path/libs/altsys/onuninstall.php @@ -1,75 +1,78 @@ mDelegateManager->add('Legacy.Admin.Event.ModuleUninstall.' . ucfirst($mydirname) . '.Success', 'altsys_message_append_onuninstall') ; - $ret = array() ; - } else { - if (! is_array($ret)) { - $ret = array() ; - } - } + global $ret; // TODO :-D - $db =& XoopsDatabaseFactory::getDatabaseConnection() ; - $mid = $module->getVar('mid') ; + // for Cube 2.1 + if (defined('XOOPS_CUBE_LEGACY')) { + $root = XCube_Root::getSingleton(); - // TABLES (loading mysql.sql) - $sql_file_path = dirname(__FILE__).'/sql/mysql.sql' ; - $prefix_mod = $db->prefix() . '_' . $mydirname ; - if (file_exists($sql_file_path)) { - $ret[] = "SQL file found at ".htmlspecialchars($sql_file_path).".
Deleting tables...
"; - $sql_lines = file($sql_file_path) ; - foreach ($sql_lines as $sql_line) { - if (preg_match('/^CREATE TABLE \`?([a-zA-Z0-9_-]+)\`? /i', $sql_line, $regs)) { - $sql = 'DROP TABLE '.addslashes($prefix_mod.'_'.$regs[1]); - if (!$db->query($sql)) { - $ret[] = 'ERROR: Could not drop table '.htmlspecialchars($prefix_mod.'_'.$regs[1]).'.
'; - } else { - $ret[] = 'Table '.htmlspecialchars($prefix_mod.'_'.$regs[1]).' dropped.
'; - } - } - } - } - - // TEMPLATES (Not necessary because modulesadmin removes all templates) - /* $tplfile_handler =& xoops_gethandler( 'tplfile' ) ; - $templates =& $tplfile_handler->find( null , 'module' , $mid ) ; - $tcount = count( $templates ) ; - if( $tcount > 0 ) { - $ret[] = 'Deleting templates...' ; - for( $i = 0 ; $i < $tcount ; $i ++ ) { - if( ! $tplfile_handler->delete( $templates[$i] ) ) { - $ret[] = 'ERROR: Could not delete template '.$templates[$i]->getVar('tpl_file','s').' from the database. Template ID: '.$templates[$i]->getVar('tpl_id','s').'
'; + $root->mDelegateManager->add('Legacy.Admin.Event.ModuleUninstall.' . ucfirst($mydirname) . '.Success', 'altsys_message_append_onuninstall'); + $ret = []; } else { - $ret[] = 'Template '.$templates[$i]->getVar('tpl_file','s').' deleted from the database. Template ID: '.$templates[$i]->getVar('tpl_id','s').'
'; + if (!is_array($ret)) { + $ret = []; + } } - } - } - unset($templates); */ + $db = XoopsDatabaseFactory::getDatabaseConnection(); - return true ; - } + $mid = $module->getVar('mid'); - function altsys_message_append_onuninstall(&$module_obj, &$log) - { - if (is_array(@$GLOBALS['ret'])) { - foreach ($GLOBALS['ret'] as $message) { - $log->add(strip_tags($message)) ; + // TABLES (loading mysql.sql) + $sql_file_path = __DIR__ . '/sql/mysql.sql'; + $prefix_mod = $db->prefix() . '_' . $mydirname; + if (is_file($sql_file_path)) { + $ret[] = 'SQL file found at ' . htmlspecialchars($sql_file_path) . '.
Deleting tables...
'; + $sql_lines = file($sql_file_path); + foreach ($sql_lines as $sql_line) { + if (preg_match('/^CREATE TABLE \`?([a-zA-Z0-9_-]+)\`? /i', $sql_line, $regs)) { + $sql = 'DROP TABLE ' . addslashes($prefix_mod . '_' . $regs[1]); + if (!$db->query($sql)) { + $ret[] = 'ERROR: Could not drop table ' . htmlspecialchars($prefix_mod . '_' . $regs[1]) . '.
'; + } else { + $ret[] = 'Table ' . htmlspecialchars($prefix_mod . '_' . $regs[1]) . ' dropped.
'; + } + } + } } + + return true; } - // use mLog->addWarning() or mLog->addError() if necessary + function altsys_message_append_onuninstall(&$module_obj, &$log) + { + if (is_array(@$GLOBALS['ret'])) { + foreach ($GLOBALS['ret'] as $message) { + $log->add(strip_tags($message)); + } + } + + // use mLog->addWarning() or mLog->addError() if necessary + } } } diff --git a/xoops_trust_path/libs/altsys/onupdate.php b/xoops_trust_path/libs/altsys/onupdate.php index dba60fd..39720c9 100644 --- a/xoops_trust_path/libs/altsys/onupdate.php +++ b/xoops_trust_path/libs/altsys/onupdate.php @@ -1,101 +1,101 @@ mDelegateManager->add('Legacy.Admin.Event.ModuleUpdate.' . ucfirst($mydirname) . '.Success', 'altsys_message_append_onupdate') ; - $msgs = array() ; - } else { - if (! is_array($msgs)) { - $msgs = array() ; - } - } - - $db =& XoopsDatabaseFactory::getDatabaseConnection() ; - $mid = $module->getVar('mid') ; - - - - // TABLES (write here ALTER TABLE etc. if necessary) - - // configs (Though I know it is not a recommended way...) - $check_sql = "SHOW COLUMNS FROM ".$db->prefix("config")." LIKE 'conf_title'" ; - if (($result = $db->query($check_sql)) && ($myrow = $db->fetchArray($result)) && @$myrow['Type'] == 'varchar(30)') { - $db->queryF("ALTER TABLE ".$db->prefix("config")." MODIFY `conf_title` varchar(255) NOT NULL default '', MODIFY `conf_desc` varchar(255) NOT NULL default ''") ; - } - - // 0.4 -> 0.5 - $check_sql = "SELECT COUNT(*) FROM ".$db->prefix($mydirname."_language_constants") ; - if (! $db->query($check_sql)) { - $db->queryF("CREATE TABLE ".$db->prefix($mydirname."_language_constants")." (mid smallint(5) unsigned NOT NULL default 0,language varchar(32) NOT NULL default '',name varchar(255) NOT NULL default '',value text,PRIMARY KEY (mid,language,name)) ENGINE=MyISAM") ; - } - - - // TEMPLATES (all templates have been already removed by modulesadmin) - $tplfile_handler =& xoops_gethandler('tplfile') ; - $tpl_path = dirname(__FILE__).'/templates' ; - if ($handler = @opendir($tpl_path . '/')) { - while (($file = readdir($handler)) !== false) { - if (substr($file, 0, 1) == '.') { - continue ; - } - $file_path = $tpl_path . '/' . $file ; - if (is_file($file_path)) { - $mtime = intval(@filemtime($file_path)) ; - $tplfile =& $tplfile_handler->create() ; - $tplfile->setVar('tpl_source', file_get_contents($file_path), true) ; - $tplfile->setVar('tpl_refid', $mid) ; - $tplfile->setVar('tpl_tplset', 'default') ; - $tplfile->setVar('tpl_file', $mydirname . '_' . $file) ; - $tplfile->setVar('tpl_desc', '', true) ; - $tplfile->setVar('tpl_module', $mydirname) ; - $tplfile->setVar('tpl_lastmodified', $mtime) ; - $tplfile->setVar('tpl_lastimported', 0) ; - $tplfile->setVar('tpl_type', 'module') ; - if (! $tplfile_handler->insert($tplfile)) { - $msgs[] = 'ERROR: Could not insert template '.htmlspecialchars($mydirname.'_'.$file).' to the database.'; - } else { - $tplid = $tplfile->getVar('tpl_id') ; - $msgs[] = 'Template '.htmlspecialchars($mydirname.'_'.$file).' added to the database. (ID: '.$tplid.')'; - // generate compiled file - require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php' ; - altsys_clear_templates_c() ; - /*include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; - if( ! xoops_template_touch( $tplid ) ) { - $msgs[] = 'ERROR: Failed compiling template '.htmlspecialchars($mydirname.'_'.$file).'.'; - } else { - $msgs[] = 'Template '.htmlspecialchars($mydirname.'_'.$file).' compiled.'; - }*/ - } - } - } - closedir($handler) ; - } - include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; - include_once XOOPS_ROOT_PATH.'/class/template.php' ; - xoops_template_clear_module_cache($mid) ; - - return true ; - } - - function altsys_message_append_onupdate(&$module_obj, &$log) - { - if (is_array(@$GLOBALS['msgs'])) { - foreach ($GLOBALS['msgs'] as $message) { - $log->add(strip_tags($message)) ; - } - } - - // use mLog->addWarning() or mLog->addError() if necessary - } +/** + * Altsys library (UI-Components) for D3 modules + * @package Altsys + * @version XCL 2.3.1 + * @author Other authors gigamaster, 2020 XCL/PHP7 + * @author Gijoe (Peak) + * @copyright (c) 2005-2022 Authors + * @license GPL v2.0 + */ + + +eval( ' function xoops_module_update_' . $mydirname . '( $module ) { return altsys_onupdate_base( $module , \'' . $mydirname . '\' ) ; } ' ); + + +if ( ! function_exists( 'altsys_onupdate_base' ) ) { + function altsys_onupdate_base( $module, $mydirname ) { + // transactions on module update + + global $msgs; // TODO :-D + + // for Cube 2.1 + if ( defined( 'XOOPS_CUBE_LEGACY' ) ) { + $root =& XCube_Root::getSingleton(); + $root->mDelegateManager->add( 'Legacy.Admin.Event.ModuleUpdate.' . ucfirst( $mydirname ) . '.Success', 'altsys_message_append_onupdate' ); + $msgs = []; + } else if ( ! is_array( $msgs ) ) { + $msgs = []; + } + + $db =& XoopsDatabaseFactory::getDatabaseConnection(); + $mid = $module->getVar( 'mid' ); + + + // TABLES (write here ALTER TABLE etc. if necessary) + + // configs (Though I know it is not a recommended way...) + $check_sql = 'SHOW COLUMNS FROM ' . $db->prefix( 'config' ) . " LIKE 'conf_title'"; + if ( ( $result = $db->query( $check_sql ) ) && ( $myrow = $db->fetchArray( $result ) ) && 'varchar(30)' === @$myrow['Type'] ) { + $db->queryF( 'ALTER TABLE ' . $db->prefix( 'config' ) . " MODIFY `conf_title` varchar(191) NOT NULL default '', MODIFY `conf_desc` varchar(191) NOT NULL default ''" ); + } + + // 0.4 -> 0.5 + $check_sql = 'SELECT COUNT(*) FROM ' . $db->prefix( $mydirname . '_language_constants' ); + if ( ! $db->query( $check_sql ) ) { + $db->queryF( 'CREATE TABLE ' . $db->prefix( $mydirname . '_language_constants' ) . " (mid smallint(5) unsigned NOT NULL default 0,language varchar(32) NOT NULL default '',name varchar(191) NOT NULL default '',value text,PRIMARY KEY (mid,language,name)) ENGINE=InnoDB" ); + } + + + // TEMPLATES (all templates have been already removed by modulesadmin) + $tplfile_handler =& xoops_gethandler( 'tplfile' ); + $tpl_path = __DIR__ . '/templates'; + if ( $handler = @opendir( $tpl_path . '/' ) ) { + while ( false !== ( $file = readdir( $handler ) ) ) { + if ( strpos( $file, '.' ) === 0 ) { + continue; + } + $file_path = $tpl_path . '/' . $file; + if ( is_file( $file_path ) ) { + $mtime = (int) @filemtime( $file_path ); + $tplfile =& $tplfile_handler->create(); + $tplfile->setVar( 'tpl_source', file_get_contents( $file_path ), true ); + $tplfile->setVar( 'tpl_refid', $mid ); + $tplfile->setVar( 'tpl_tplset', 'default' ); + $tplfile->setVar( 'tpl_file', $mydirname . '_' . $file ); + $tplfile->setVar( 'tpl_desc', '', true ); + $tplfile->setVar( 'tpl_module', $mydirname ); + $tplfile->setVar( 'tpl_lastmodified', $mtime ); + $tplfile->setVar( 'tpl_lastimported', 0 ); + $tplfile->setVar( 'tpl_type', 'module' ); + if ( ! $tplfile_handler->insert( $tplfile ) ) { + $msgs[] = 'ERROR: Could not insert template ' . htmlspecialchars( $mydirname . '_' . $file ) . ' to the database.'; + } else { + $tplid = $tplfile->getVar( 'tpl_id' ); + $msgs[] = 'Template ' . htmlspecialchars( $mydirname . '_' . $file ) . ' added to the database. (ID: ' . $tplid . ')'; + // generate compiled file + require_once XOOPS_TRUST_PATH . '/libs/altsys/include/altsys_functions.php'; + altsys_clear_templates_c(); + } + } + } + closedir( $handler ); + } + include_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; + include_once XOOPS_ROOT_PATH . '/class/template.php'; + xoops_template_clear_module_cache( $mid ); + + return true; + } + + function altsys_message_append_onupdate( &$module_obj, &$log ) { + if ( is_array( @$GLOBALS['msgs'] ) ) { + foreach ( $GLOBALS['msgs'] as $message ) { + $log->add( strip_tags( $message ) ); + } + } + + // use mLog->addWarning() or mLog->addError() if necessary + } } + diff --git a/xoops_trust_path/libs/altsys/preload.php b/xoops_trust_path/libs/altsys/preload.php index f838490..3415194 100644 --- a/xoops_trust_path/libs/altsys/preload.php +++ b/xoops_trust_path/libs/altsys/preload.php @@ -1,15 +1,23 @@ mController->_mStrategy) { - if (strtolower(get_class($root->mController->_mStrategy)) == strtolower('Legacy_AdminControllerStrategy')) { - include_once dirname(__FILE__).'/include/altsys_functions.php' ; - // language file (modinfo.php) - altsys_include_language_file('modinfo') ; - } +if ( $root->mController->_mStrategy && strtolower( get_class( $root->mController->_mStrategy ) ) == strtolower( 'Legacy_AdminControllerStrategy' ) ) { + include_once __DIR__ . '/include/altsys_functions.php'; + // language file (modinfo.php) + altsys_include_language_file( 'modinfo' ); } // load altsys newly gticket class for other modules -require_once XOOPS_TRUST_PATH.'/libs/altsys/include/gtickets.php'; +require_once XOOPS_TRUST_PATH . '/libs/altsys/include/gtickets.php'; diff --git a/xoops_trust_path/libs/altsys/put_templates.php b/xoops_trust_path/libs/altsys/put_templates.php index f833c6e..0f55708 100644 --- a/xoops_trust_path/libs/altsys/put_templates.php +++ b/xoops_trust_path/libs/altsys/put_templates.php @@ -1,102 +1,123 @@ // -// ------------------------------------------------------------------------- // +/** + * Altsys library (UI-Components) for D3 modules + * @package Altsys + * @version XCL 2.3.1 + * @author Other authors Gigamaster, 2020 XCL PHP7 + * @author Gijoe (Peak) + * @copyright (c) 2005-2022 Authors + * @license GPL v2.0 + */ -include_once dirname(__FILE__).'/include/gtickets.php' ; -include_once dirname(__FILE__).'/include/altsys_functions.php' ; -include_once dirname(__FILE__).'/include/tpls_functions.php' ; +include_once __DIR__ . '/include/gtickets.php'; +include_once __DIR__ . '/include/altsys_functions.php'; +include_once __DIR__ . '/include/tpls_functions.php'; // this page can be called only from altsys -if ($xoopsModule->getVar('dirname') != 'altsys') { - die('this page can be called only from altsys') ; +if ( 'altsys' != $xoopsModule->getVar( 'dirname' ) ) { + die( 'this page can be called only from altsys' ); } // language file -altsys_include_language_file('compilehookadmin') ; +altsys_include_language_file( 'compilehookadmin' ); -$db =& XoopsDatabaseFactory::getDatabaseConnection() ; +$db = XoopsDatabaseFactory::getDatabaseConnection(); -if (empty($_FILES['tplset_archive']['tmp_name']) || ! is_uploaded_file($_FILES['tplset_archive']['tmp_name'])) { - die(_TPLSADMIN_ERR_NOTUPLOADED) ; +if ( empty( $_FILES['tplset_archive']['tmp_name'] ) || ! is_uploaded_file( $_FILES['tplset_archive']['tmp_name'] ) ) { + die( _TPLSADMIN_ERR_NOTUPLOADED ); } //fix for mb_http_output setting and for add any browsers - if (function_exists('mb_http_output')) { - mb_http_output('pass'); - } +if ( function_exists( 'mb_http_output' ) ) { + mb_http_output( 'pass' ); +} //ob_buffer over flow //HACK by suin & nao-pon 2012/01/06 - while (ob_get_level() > 0) { - if (! ob_end_clean()) { - break; - } - } - -// -// EXTRACT STAGE -// - -$orig_filename4check = strtolower($_FILES['tplset_archive']['name']) ; -if (strtolower(substr($orig_filename4check, -4)) == '.zip') { - - // zip - require_once dirname(__FILE__).'/include/Archive_Zip.php' ; - $reader = new Archive_Zip($_FILES['tplset_archive']['tmp_name']) ; - $files = $reader->extract(array( 'extract_as_string' => true )) ; - if (! is_array(@$files)) { - die($reader->errorName()) ; - } - $do_upload = true ; -} elseif (substr($orig_filename4check, -4) == '.tgz' || substr($orig_filename4check, -7) == '.tar.gz') { - - // tar.gz - require_once XOOPS_ROOT_PATH.'/class/class.tar.php' ; - $tar = new tar() ; - $tar->openTar($_FILES['tplset_archive']['tmp_name']) ; - $files = array() ; - foreach ($tar->files as $id => $info) { - $files[] = array( - 'filename' => $info['name'] , - 'mtime' => $info['time'] , - 'content' => $info['file'] , - ) ; - } - if (empty($files)) { - die(_TPLSADMIN_ERR_INVALIDARCHIVE) ; - } - $do_upload = true ; +while ( ob_get_level() > 0 ) { + if ( ! ob_end_clean() ) { + break; + } +} + + +// EXTRACT VIEW + +$orig_filename4check = mb_strtolower( $_FILES['tplset_archive']['name'] ); +if ( '.zip' == mb_strtolower( mb_substr( $orig_filename4check, - 4 ) ) ) { + // zip + + // TODO gigamaster redirect with message + $msg = "Deprecated zip! "._TPLSADMIN_ERR_NOTUPLOADED; + redirect_header( '?mode=admin&lib=altsys&page=compilehookadmin', 3, $msg ); + redirect_header( $_SERVER['REQUEST_URI'], 1, $msg ); + exit; + + // zip + //require_once __DIR__ . '/include/Archive_Zip.php'; + //$reader = new Archive_Zip( $_FILES['tplset_archive']['tmp_name'] ); + //$files = $reader->extract( [ 'extract_as_string' => true ] ); + //if ( ! is_array( @$files ) ) { + // die( $reader->errorName() ); + //} + //$do_upload = true; +} elseif ( '.tgz' == mb_substr( $orig_filename4check, - 4 ) || '.tar.gz' == mb_substr( $orig_filename4check, - 7 ) ) { + // tar.gz + + // TODO gigamaster redirect with message + //$msg = "Deprecated zip"._TPLSADMIN_ERR_NOTUPLOADED; + $msg = "Deprecated .tgz and .tar.gz ! "._TPLSADMIN_ERR_NOTUPLOADED; + redirect_header( '?mode=admin&lib=altsys&page=compilehookadmin', 3, $msg ); + exit; +//TODO gigamaster TAR +} elseif ( '.tar' == mb_substr( $orig_filename4check, - 4 ) ) { + // tar.gz + require_once XOOPS_ROOT_PATH . '/class/class.tar.php'; + $tar = new tar(); + + $tar->openTAR( $_FILES['tplset_archive']['tmp_name'] ); + + $files = []; + foreach ( $tar->files as $id => $info ) { + $files[] = [ + 'filename' => $info['name'], + 'mtime' => $info['time'], + 'content' => $info['file'], + ]; + } + if ( empty( $files ) ) { + die( _TPLSADMIN_ERR_INVALIDARCHIVE ); + } + $do_upload = true; } -if (empty($do_upload)) { - die(_TPLSADMIN_ERR_EXTENSION) ; +if ( empty( $do_upload ) ) { + die( _TPLSADMIN_ERR_EXTENSION ); } -// -// IMPORT STAGE -// -$tplset = @$_POST['tplset'] ; -if (! preg_match('/^[0-9A-Za-z_-]{1,16}$/', $tplset)) { - die(_TPLSADMIN_ERR_INVALIDTPLSET) ; +// IMPORT VIEW + +$tplset = @$_POST['tplset']; +if ( ! preg_match( '/^[0-9A-Za-z_-]{1,16}$/', $tplset ) ) { + die( _TPLSADMIN_ERR_INVALIDTPLSET ); } -$imported = 0 ; -foreach ($files as $file) { - if (! empty($file['folder'])) { - continue ; - } - $pos = strrpos($file['filename'], '/') ; - $tpl_file = $pos === false ? $file['filename'] : substr($file['filename'], $pos + 1) ; - - if (tplsadmin_import_data($tplset, $tpl_file, rtrim($file['content']), $file['mtime'])) { - $imported ++ ; - } +$imported = 0; +foreach ( $files as $file ) { + if ( ! empty( $file['folder'] ) ) { + continue; + } + + $pos = mb_strrpos( $file['filename'], '/' ); + + $tpl_file = false === $pos ? $file['filename'] : mb_substr( $file['filename'], $pos + 1 ); + + if ( tplsadmin_import_data( $tplset, $tpl_file, rtrim( $file['content'] ), $file['mtime'] ) ) { + $imported ++; + } } -redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, sprintf(_TPLSADMIN_FMT_MSG_PUTTEMPLATES, $imported)) ; -exit ; +redirect_header( '?mode=admin&lib=altsys&page=compilehookadmin', 3, sprintf( _TPLSADMIN_FMT_MSG_PUTTEMPLATES, $imported ) ); +exit; diff --git a/xoops_trust_path/libs/altsys/smarty_plugins/resource.db.php b/xoops_trust_path/libs/altsys/smarty_plugins/resource.db.php index 52f6c38..3935147 100644 --- a/xoops_trust_path/libs/altsys/smarty_plugins/resource.db.php +++ b/xoops_trust_path/libs/altsys/smarty_plugins/resource.db.php @@ -1,89 +1,120 @@ getVar('tpl_source', 'n'); - } else { - $fp = fopen($tpl, 'r'); - $tpl_source = fread($fp, filesize($tpl)); - fclose($fp); - } - return true; + +/** + * @param $tpl_name + * @param mixed $tpl_source + * @param mixed $smarty + * + * @return bool + */ +function smarty_resource_db_source( $tpl_name, &$tpl_source, &$smarty ) { + if ( ! $tpl = smarty_resource_db_tplinfo( $tpl_name ) ) { + return false; + } + if ( is_object( $tpl ) ) { + $tpl_source = $tpl->getVar( 'tpl_source', 'n' ); + } else { + $fp = fopen( $tpl, 'r' ); + $tpl_source = fread( $fp, filesize( $tpl ) ); + fclose( $fp ); + } + + return true; } -function smarty_resource_db_timestamp($tpl_name, &$tpl_timestamp, &$smarty) -{ - if (!$tpl = smarty_resource_db_tplinfo($tpl_name)) { - return false; - } - if (is_object($tpl)) { - $tpl_timestamp = $tpl->getVar('tpl_lastmodified', 'n'); - } else { - $tpl_timestamp = filemtime($tpl); - } - return true; +/** + * @param $tpl_name + * @param mixed $tpl_timestamp + * @param mixed $smarty + * + * @return bool + */ +function smarty_resource_db_timestamp( $tpl_name, &$tpl_timestamp, &$smarty ) { + if ( ! $tpl = smarty_resource_db_tplinfo( $tpl_name ) ) { + return false; + } + if ( is_object( $tpl ) ) { + $tpl_timestamp = $tpl->getVar( 'tpl_lastmodified', 'n' ); + } else { + $tpl_timestamp = filemtime( $tpl ); + } + + return true; } -function smarty_resource_db_secure($tpl_name, &$smarty) -{ - // assume all templates are secure - return true; +/** + * @param $tpl_name + * @param mixed $smarty + * + * @return bool + */ +function smarty_resource_db_secure( $tpl_name, &$smarty ) { + // assume all templates are secure + return true; } -function smarty_resource_db_trusted($tpl_name, &$smarty) -{ - // not used for templates +/** + * @param $tpl_name + * @param mixed $smarty + */ +function smarty_resource_db_trusted( $tpl_name, &$smarty ) { + // not used for templates } -function smarty_resource_db_tplinfo($tpl_name) -{ - static $cache = array(); - global $xoopsConfig; +/** + * @param $tpl_name + * + * @return bool|mixed|string + */ +function smarty_resource_db_tplinfo( $tpl_name ) { + static $cache = []; + global $xoopsConfig; + + if ( isset( $cache[ $tpl_name ] ) ) { + return $cache[ $tpl_name ]; + } + $tplset = $xoopsConfig['template_set']; + //$theme = isset($xoopsConfig['theme_set']) ? $xoopsConfig['theme_set'] : 'default'; + $theme = $xoopsConfig['theme_set'] ?? 'default'; + + $tplfile_handler =& xoops_gethandler( 'tplfile' ); + // If we're not using the "default" template set, then get the templates from the DB + if ( 'default' != $tplset ) { + $tplobj = $tplfile_handler->find( $tplset, null, null, null, $tpl_name, true ); + if ( count( $tplobj ) ) { + return $cache[ $tpl_name ] = $tplobj[0]; + } + } + // If we are using the default tplset, get the template from the filesystem + $tplobj = $tplfile_handler->find( 'default', null, null, null, $tpl_name, true ); - if (isset($cache[$tpl_name])) { - return $cache[$tpl_name]; - } - $tplset = $xoopsConfig['template_set']; - $theme = isset($xoopsConfig['theme_set']) ? $xoopsConfig['theme_set'] : 'default'; - - $tplfile_handler =& xoops_gethandler('tplfile'); - // If we're not using the "default" template set, then get the templates from the DB - if ($tplset != "default") { - $tplobj = $tplfile_handler->find($tplset, null, null, null, $tpl_name, true); - if (count($tplobj)) { - return $cache[$tpl_name] = $tplobj[0]; - } - } - // If we'using the default tplset, get the template from the filesystem - $tplobj = $tplfile_handler->find("default", null, null, null, $tpl_name, true); + if ( ! count( $tplobj ) ) { + return $cache[ $tpl_name ] = false; + } + $tplobj = $tplobj[0]; + $module = $tplobj->getVar( 'tpl_module', 'n' ); + $type = $tplobj->getVar( 'tpl_type', 'n' ); + $blockpath = ( 'block' == $type ) ? 'blocks/' : ''; + // First, check for an overloaded version within the theme folder @gigamaster modified theme folder structure + $filepath = XOOPS_THEME_PATH . "/$theme/templates/$module/$blockpath$tpl_name"; + //$filepath = XOOPS_THEME_PATH . "/$theme/modules/$module/$blockpath$tpl_name"; + if ( ! file_exists( $filepath ) ) { + // If no custom version exists, get the tpl from its default location + $filepath = XOOPS_ROOT_PATH . "/modules/$module/templates/$blockpath$tpl_name"; + if ( ! file_exists( $filepath ) ) { + return $cache[ $tpl_name ] = $tplobj; + } + } - if (!count($tplobj)) { - return $cache[$tpl_name] = false; - } - $tplobj = $tplobj[0]; - $module = $tplobj->getVar('tpl_module', 'n'); - $type = $tplobj->getVar('tpl_type', 'n'); - $blockpath = ($type == 'block') ? 'blocks/' : ''; - // First, check for an overloaded version within the theme folder - $filepath = XOOPS_THEME_PATH . "/$theme/modules/$module/$blockpath$tpl_name"; - if (!file_exists($filepath)) { - // If no custom version exists, get the tpl from its default location - $filepath = XOOPS_ROOT_PATH . "/modules/$module/templates/$blockpath$tpl_name"; - if (!file_exists($filepath)) { - return $cache[$tpl_name] = $tplobj ; - } - } - return $cache[$tpl_name] = $filepath; + return $cache[ $tpl_name ] = $filepath; } diff --git a/xoops_trust_path/libs/altsys/sql/mysql.sql b/xoops_trust_path/libs/altsys/sql/mysql.sql index 3ddbf9f..b6ac58f 100644 --- a/xoops_trust_path/libs/altsys/sql/mysql.sql +++ b/xoops_trust_path/libs/altsys/sql/mysql.sql @@ -1,11 +1,12 @@ # CREATE TABLE `tablename` will be queried as # CREATE TABLE `prefix_dirname_tablename` -CREATE TABLE language_constants ( - mid smallint(5) unsigned NOT NULL default 0, - language varchar(32) NOT NULL default '', - name varchar(255) NOT NULL default '', - value text, - PRIMARY KEY (mid,language,name) -) ENGINE=MyISAM; +CREATE TABLE language_constants +( + mid smallint(5) unsigned NOT NULL default 0, + language varchar(32) NOT NULL default '', + name varchar(191) NOT NULL default '', + value text, + PRIMARY KEY (mid, language, name) +) ENGINE=InnoDB; diff --git a/xoops_trust_path/libs/altsys/templates/block_admin_menu.html b/xoops_trust_path/libs/altsys/templates/block_admin_menu.html index e4b3497..30bddce 100644 --- a/xoops_trust_path/libs/altsys/templates/block_admin_menu.html +++ b/xoops_trust_path/libs/altsys/templates/block_admin_menu.html @@ -1,31 +1,27 @@ - -
- <{foreach from=$block.modules item="module"}> - -
-
    - <{foreach from=$module.submenu item="sub"}> -
  • - <{$sub.title}> -
  • - <{/foreach}> -
- <{$module.name}> - <{if $module.version_in_db < $module.version_in_file}><{$module.version_in_db}>-><{$module.version_in_file}><{else}><{$module.version_in_db}><{/if}> -
- <{/foreach}> -
+<{* altsys_block_admin_menu_custom.html *}> +
<{$smarty.template}>
+ +<{foreach from=$block.modules item="module"}> +
+ + <{$module.icon}> <{$module.name}> + +
    + <{foreach from=$module.submenu item="sub"}> +
  • + <{$sub.title}> +
  • + <{/foreach}> +
  • +
  • + +<{if $module.version_in_db < $module.version_in_file}> +<{$module.version_in_db}>-><{$module.version_in_file}> +<{else}> +v. <{$module.version_in_db}> +<{/if}> + +
  • +
+
+<{/foreach}> diff --git a/xoops_trust_path/libs/altsys/templates/inc_menu.html b/xoops_trust_path/libs/altsys/templates/inc_menu.html new file mode 100644 index 0000000..ce32649 --- /dev/null +++ b/xoops_trust_path/libs/altsys/templates/inc_menu.html @@ -0,0 +1,17 @@ +
+ Dashboard + + »» <{$dirname|ucfirst}> + + <{foreach from=$adminmenu item="menuitem"}> + <{if $menuitem.selected}> + »» <{$menuitem.title|escape}> + <{/if}> + <{/foreach}> +
+ + diff --git a/xoops_trust_path/libs/altsys/templates/inc_menu_sub.html b/xoops_trust_path/libs/altsys/templates/inc_menu_sub.html new file mode 100644 index 0000000..4918df3 --- /dev/null +++ b/xoops_trust_path/libs/altsys/templates/inc_menu_sub.html @@ -0,0 +1,9 @@ + + +
+ <{foreach from=$adminmenu item="menuitem"}> + + <{$menuitem.icon}> <{$menuitem.title}> + + <{/foreach}> +
diff --git a/xoops_trust_path/libs/altsys/templates/inc_mymenu.css b/xoops_trust_path/libs/altsys/templates/inc_mymenu.css deleted file mode 100644 index 2ca6288..0000000 --- a/xoops_trust_path/libs/altsys/templates/inc_mymenu.css +++ /dev/null @@ -1,34 +0,0 @@ -div.altsys_mymenu { - text-align:<{$smarty.const._GLOBAL_LEFT}>; - width:98%; -} -div.altsys_mymenu div { - float: <{$smarty.const._GLOBAL_LEFT}>; - font-weight: bold; - font-size: 9pt; - line-height: 12pt; - height: 1.5em; -} -div.altsys_mymenu div a, -div.altsys_mymenu div a:visited { - font-weight: bold; -} -div.altsys_mymenu a.unselected { - background-color: #dddddd; -} -div.altsys_mymenu a.selected { - background-color: #ffcccc; -} -div.altsys_mymenusub_myblocksadmin a.selected { - background-color: #ffdd99; -} -div.altsys_mymenusub_mylangadmin a.selected { - background-color: #ccccff; -} -div.altsys_mymenusub_mytplsadmin a.selected { - background-color: #99ff99; -} -hr.altsys_mymenu_separator { - clear: <{$smarty.const._GLOBAL_LEFT}>; - display: block; -} diff --git a/xoops_trust_path/libs/altsys/templates/inc_mymenu.html b/xoops_trust_path/libs/altsys/templates/inc_mymenu.html deleted file mode 100644 index 5a65dac..0000000 --- a/xoops_trust_path/libs/altsys/templates/inc_mymenu.html +++ /dev/null @@ -1,9 +0,0 @@ - -
- <{foreach from=$adminmenu item="menuitem"}> - - <{/foreach}> -
-
diff --git a/xoops_trust_path/libs/altsys/templates/inc_mymenusub.html b/xoops_trust_path/libs/altsys/templates/inc_mymenusub.html deleted file mode 100644 index c4366fb..0000000 --- a/xoops_trust_path/libs/altsys/templates/inc_mymenusub.html +++ /dev/null @@ -1,8 +0,0 @@ -
- <{foreach from=$adminmenu item="menuitem"}> - - <{/foreach}> -
-
diff --git a/xoops_trust_path/libs/altsys/templates/inc_mytplsadmin.css b/xoops_trust_path/libs/altsys/templates/inc_mytplsadmin.css deleted file mode 100644 index 9e67bcc..0000000 --- a/xoops_trust_path/libs/altsys/templates/inc_mytplsadmin.css +++ /dev/null @@ -1,29 +0,0 @@ -table.altsys_mytplsadmin .dbtplset_active { - background-color: #99FF99; - background-image: none; - color: #5E06F6; -} -table.altsys_mytplsadmin .dbtplset_active sup { - /*display: none;*/ -} -table.altsys_mytplsadmin .fingerprint1 { - background-color: #00FF00; -} -table.altsys_mytplsadmin .fingerprint2 { - background-color: #00CC88; -} -table.altsys_mytplsadmin .fingerprint3 { - background-color: #00FFFF; -} -table.altsys_mytplsadmin .fingerprint4 { - background-color: #0088FF; -} -table.altsys_mytplsadmin .fingerprint5 { - background-color: #FF8800; -} -table.altsys_mytplsadmin .fingerprint6 { - background-color: #0000FF; -} -table.altsys_mytplsadmin .fingerprint7 { - background-color: #FFFFFF; -} diff --git a/xoops_trust_path/libs/altsys/templates/main_blocks_admin_edit.html b/xoops_trust_path/libs/altsys/templates/main_blocks_admin_edit.html new file mode 100644 index 0000000..832d86d --- /dev/null +++ b/xoops_trust_path/libs/altsys/templates/main_blocks_admin_edit.html @@ -0,0 +1,165 @@ +
<{$smarty.template}>
+ +

<{$smarty.const._MD_A_MYBLOCKSADMIN_BLOCKADMIN}> » <{$target_mname|ucfirst}>

+ +
+ + <{if $block.content_preview}> +
+ <{$block.content_preview}> +
+ <{/if}> + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <{if $block.is_custom}> + + + + + + + + + + + <{else}> + + <{if $block.template_tplset}> + + + + + <{/if}> + + + + + + + <{/if}> + + + + + + + + + + + + +
<{$form_title}>
<{$smarty.const._MD_A_MYBLOCKSADMIN_NAME}> + <{$block.name_raw|escape}> +
<{$smarty.const._MD_A_MYBLOCKSADMIN_TITLE}> + +
<{$smarty.const._MD_A_MYBLOCKSADMIN_SIDE}> + <{$block.cell_position}> +
<{$smarty.const._MD_A_MYBLOCKSADMIN_WEIGHT}> + +
<{$smarty.const._MD_A_MYBLOCKSADMIN_VISIBLEIN}> + <{$block.cell_module_link}> + <{$block.cell_group_perm}> +
<{$smarty.const._MD_A_MYBLOCKSADMIN_CONTENT}> + <{if $xoops_cube_legacy}> + + <{if $block.ctype == 'P'}> + + + + + + + <{elseif $block.ctype == 'H' || empty($block.ctype)}> + <{xoops_dhtmltarea cols=74 rows=15 name="contents[`$block.bid`]" id="textarea_content" value="`$block.content_raw`" class=html editor=html}> + <{else}> + + <{xoops_dhtmltarea cols=74 rows=15 name="contents[`$block.bid`]" id="textarea_content" value="`$block.content_raw`" myckeditor=true class=bbcode editor=bbcode}> + <{/if}> + + <{/if}> +
<{$smarty.const._MD_A_MYBLOCKSADMIN_CTYPE}> + +
<{$smarty.const._MD_A_MYBLOCKSADMIN_CONTENT}> + <{$smarty.const._MD_A_MYBLOCKSADMIN_EDITTPL}> +
<{$smarty.const._MD_A_MYBLOCKSADMIN_OPTIONS}> + <{$block.cell_options}> +
<{$smarty.const._MD_A_MYBLOCKSADMIN_BCACHETIME}> + +
+ <{if $block.is_custom}> + + + <{/if}> + + +
+<{$gticket_hidden}> + +
+ +
diff --git a/xoops_trust_path/libs/altsys/templates/main_blocks_admin_list.html b/xoops_trust_path/libs/altsys/templates/main_blocks_admin_list.html new file mode 100644 index 0000000..8c0ac9e --- /dev/null +++ b/xoops_trust_path/libs/altsys/templates/main_blocks_admin_list.html @@ -0,0 +1,163 @@ +
<{$smarty.template}>
+ + +

<{$smarty.const._MD_A_MYBLOCKSADMIN_BLOCKADMIN}> » <{$target_mname|ucfirst}>

+ +
+ <{$smarty.const._MD_A_MYBLOCKSADMIN_TIPS}> +
+ + +<{* ////— ACTION-CONTROL —\\\\ *}> +
+ + + + + + <{$smarty.const._MI_ALTSYS_MENU_NEWCUSTOMBLOCK}> + +
+ + + +
+ +
+ + + +
+ + + + +
+ + <{foreach from=$blocks item="block"}> + +
+ +
+ + + +
+ <{if $block.can_delete}> + + + + + + + <{/if}> +
+ +
<{* /ui-card-block-header *}> + + + <{* /ui-card-block-image *}> + + +
+ +
+
+ + +
+ +
+ <{$block.cell_position}> +
+
+ +
+ <{$block.cell_module_link}> + + <{$block.cell_group_perm}> +
+ +
+ +
+ + + +
<{* /ui-card-block-content *}> + +
<{* ui-card-block *}> + + + <{/foreach from=$blocks item="block"}> + + +
<{* ui-data-render *}> + + +
+ + + <{$gticket_hidden}> + +
+ +
diff --git a/xoops_trust_path/libs/altsys/templates/main_lang_admin.html b/xoops_trust_path/libs/altsys/templates/main_lang_admin.html new file mode 100644 index 0000000..4554211 --- /dev/null +++ b/xoops_trust_path/libs/altsys/templates/main_lang_admin.html @@ -0,0 +1,104 @@ +
<{$smarty.template}>
+ + +

<{$smarty.const._MYLANGADMIN_H3_MODULE}> » <{$target_mname}> » <{$target_lang|escape}> » <{$target_file|escape}>

+ + +
+
+ <{if $use_my_language}> +
<{$smarty.const._MYLANGADMIN_DT_MYLANGFILENAME}>
+
<{$mylang_file_name}>
+ <{/if}> +
<{$smarty.const._MYLANGADMIN_DT_CACHEFILENAME}>
+
<{$cache_file_name}>
+
<{$smarty.const._MYLANGADMIN_DT_CACHESTATUS}>
+
<{if $cache_file_mtime}><{$smarty.const._MYLANGADMIN_CREATED}> (<{"Y-m-d H:i:s"|date:$cache_file_mtime+$timezone_offset}>)<{else}><{$smarty.const._MYLANGADMIN_NOTCREATED}><{/if}>
+
<{$notice}>
+
+
+ + +<{* ////— ACTION-CONTROL —\\\\ *}> +
+ +
+ + + + + + + +
+ +
+ +
+ +
+ + +
+ + + + + + + + + + <{foreach from=$langfile_constants key="langfile_name" item="langfile_uservalue"}> + + + + + + <{/foreach}> + + + + + + +
<{$smarty.const._MYLANGADMIN_TH_CONSTANTNAME}> + <{$smarty.const._MYLANGADMIN_TH_DEFAULTVALUE}> + <{if $already_read}>
(<{$smarty.const._MYLANGADMIN_MSG_NOTICE4ALREADYREAD}>)<{/if}> +
<{$smarty.const._MYLANGADMIN_TH_USERVALUE}>
+
+ <{$langfile_name|constant|escape}> +
+
+ <{if empty($mylang_constants.$langfile_name)}> + <{if strlen(constant($langfile_name)) < 32}> + class="lang-custom"<{/if}> + title="<{$smarty.const._MYLANGADMIN_TH_USERVALUE}>"> + <{else}> + + <{/if}> + <{else}> + <{$mylang_constants.$langfile_name}> + <{/if}> +
+ + + <{$gticket_hidden}> +
+
+ +
+
diff --git a/xoops_trust_path/libs/altsys/templates/main_myblocksadmin_edit.html b/xoops_trust_path/libs/altsys/templates/main_myblocksadmin_edit.html deleted file mode 100644 index 22f4cd2..0000000 --- a/xoops_trust_path/libs/altsys/templates/main_myblocksadmin_edit.html +++ /dev/null @@ -1,136 +0,0 @@ -<{$smarty.const._MD_A_MYBLOCKSADMIN_BLOCKADMIN}> »» <{$form_title}>

- -

<{$target_mname}>

- - - -<{if $common_fck_installed}> - - -<{/if}> - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - <{if $block.is_custom}> - - - - - - - - - - - <{else}> - - <{if $block.template_tplset}> - - - - - <{/if}> - - - - - - - <{/if}> - - - - - - - - - -
<{$form_title}>
<{$smarty.const._MD_A_MYBLOCKSADMIN_NAME}> - <{$block.name_raw|escape}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_TITLE}> - -
<{$smarty.const._MD_A_MYBLOCKSADMIN_SIDE}> - <{$block.cell_position}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_WEIGHT}> - -
<{$smarty.const._MD_A_MYBLOCKSADMIN_VISIBLEIN}> - <{$block.cell_module_link}> - <{$block.cell_group_perm}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_CONTENT}> - <{if $block.ctype == 'P' || ! $common_fck_installed}> - - <{if ! $common_fck_installed}>
<{$smarty.const._MD_A_MYBLOCKSADMIN_NOTICE4COMMONFCK}><{/if}> - <{else}> - - - <{/if}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_CTYPE}> - -
<{$smarty.const._MD_A_MYBLOCKSADMIN_CONTENT}> - <{$smarty.const._MD_A_MYBLOCKSADMIN_EDITTPL}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_OPTIONS}> - <{$block.cell_options}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_BCACHETIME}> - -
- <{if $block.is_custom}> - - <{/if}> - -
-<{$gticket_hidden}> - -
- -<{if $block.content_preview}> -
- <{$block.content_preview}> -
-<{/if}> - diff --git a/xoops_trust_path/libs/altsys/templates/main_myblocksadmin_edit_4legacy.html b/xoops_trust_path/libs/altsys/templates/main_myblocksadmin_edit_4legacy.html deleted file mode 100644 index d239e53..0000000 --- a/xoops_trust_path/libs/altsys/templates/main_myblocksadmin_edit_4legacy.html +++ /dev/null @@ -1,150 +0,0 @@ -<{$smarty.const._MD_A_MYBLOCKSADMIN_BLOCKADMIN}> »» <{$form_title}>

- -

<{$target_mname}>

- - - -<{if $common_fck_installed}> - - -<{/if}> - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - <{if $block.is_custom}> - - - - - - - - - - - <{else}> - - <{if $block.template_tplset}> - - - - - <{/if}> - - - - - - - <{/if}> - - - - - - - - - -
<{$form_title}>
<{$smarty.const._MD_A_MYBLOCKSADMIN_NAME}> - <{$block.name_raw|escape}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_TITLE}> - -
<{$smarty.const._MD_A_MYBLOCKSADMIN_SIDE}> - <{$block.cell_position}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_WEIGHT}> - -
<{$smarty.const._MD_A_MYBLOCKSADMIN_VISIBLEIN}> - <{$block.cell_module_link}> - <{$block.cell_group_perm}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_CONTENT}> - <{if $xoops_cube_legacy}> - <{if $block.ctype == 'P'}> - - <{if ! $common_fck_installed}>
<{$smarty.const._MD_A_MYBLOCKSADMIN_NOTICE4COMMONFCK}><{/if}> - <{elseif $block.ctype == 'H' && $common_fck_installed}> - - - <{elseif $block.ctype == 'H' || empty($block.ctype) }> - <{xoops_dhtmltarea cols=74 rows=15 name="contents[`$block.bid`]" id="textarea_content" value="`$block.content_raw`" class=html editor=html}> - <{else}> - <{xoops_dhtmltarea cols=74 rows=15 name="contents[`$block.bid`]" id="textarea_content" value="`$block.content_raw`" myckeditor=true class=bbcode editor=bbcode}> - <{/if}> - <{else}> - <{if $block.ctype == 'P' || ! $common_fck_installed}> - - <{if ! $common_fck_installed}>
<{$smarty.const._MD_A_MYBLOCKSADMIN_NOTICE4COMMONFCK}><{/if}> - <{else}> - - - <{/if}> - <{/if}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_CTYPE}> - -
<{$smarty.const._MD_A_MYBLOCKSADMIN_CONTENT}> - <{$smarty.const._MD_A_MYBLOCKSADMIN_EDITTPL}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_OPTIONS}> - <{$block.cell_options}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_BCACHETIME}> - -
- <{if $block.is_custom}> - - <{/if}> - -
-<{$gticket_hidden}> - -
- -<{if $block.content_preview}> -
- <{$block.content_preview}> -
-<{/if}> - diff --git a/xoops_trust_path/libs/altsys/templates/main_myblocksadmin_edit_4x25.html b/xoops_trust_path/libs/altsys/templates/main_myblocksadmin_edit_4x25.html deleted file mode 100644 index 0f54d7b..0000000 --- a/xoops_trust_path/libs/altsys/templates/main_myblocksadmin_edit_4x25.html +++ /dev/null @@ -1,177 +0,0 @@ -<{$smarty.const._MD_A_MYBLOCKSADMIN_BLOCKADMIN}> »» <{$form_title}>

- -

<{$target_mname}>

- - - -<{if $block.ctype != 'P' }> -<{if $block.ctype == 'H' || empty($block.ctype) }> - <{if $common_fck_installed}> - - - <{else}> - <{php}> - $_makescript = & xoops_getmodulehandler('makescript','myckeditor',true); - $params = array('id'=>'textarea_content','editor'=>'html','myckeditor'=>true); - if (@is_object( $_makescript )){ - $this->assign( 'common_myck_installed' , true ) ; - $_makescript->makeheader($params); - } - <{/php}> - <{/if}> -<{else}> - <{php}> - $_makescript = & xoops_getmodulehandler('makescript','myckeditor',true); - $params = array('id'=>'textarea_content','editor'=>'bbcode','myckeditor'=>true); - if (@is_object( $_makescript )){ - $this->assign( 'common_myck_installed' , true ) ; - $_makescript->makeheader($params); - } - <{/php}> -<{/if}> -<{/if}> -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - <{if $block.is_custom}> - - - - - - - - - - - <{else}> - - <{if $block.template_tplset}> - - - - - <{/if}> - - - - - - - <{/if}> - - - - - - - - - -
<{$form_title}>
<{$smarty.const._MD_A_MYBLOCKSADMIN_NAME}> - <{$block.name_raw|escape}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_TITLE}> - -
<{$smarty.const._MD_A_MYBLOCKSADMIN_SIDE}> - <{$block.cell_position}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_WEIGHT}> - -
<{$smarty.const._MD_A_MYBLOCKSADMIN_VISIBLEIN}> - <{$block.cell_module_link}> - <{$block.cell_group_perm}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_CONTENT}> - <{if $common_myck_installed }> - <{if $block.ctype == 'H' || empty($block.ctype) }> -
- - <{else}> -
- - <{/if}> - <{/if}> -
- <{if $block.ctype == 'P'}> - - <{if ! $common_fck_installed}>
<{$smarty.const._MD_A_MYBLOCKSADMIN_NOTICE4COMMONFCK}><{/if}> - <{elseif $block.ctype == 'H' && $common_fck_installed}> - - - <{elseif $block.ctype == 'H' || empty($block.ctype) }> - <{if $common_myck_installed }> - - <{else}> - <{$altsys_x25_dhtmltextarea}> - <{/if}> - <{else}> -
-
- <{$altsys_x25_dhtmltextarea}> - <{/if}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_CTYPE}> - -
<{$smarty.const._MD_A_MYBLOCKSADMIN_CONTENT}> - <{$smarty.const._MD_A_MYBLOCKSADMIN_EDITTPL}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_OPTIONS}> - <{$block.cell_options}> -
<{$smarty.const._MD_A_MYBLOCKSADMIN_BCACHETIME}> - -
- <{if $block.is_custom}> - - <{/if}> - -
-<{$gticket_hidden}> - -
- -<{if $block.content_preview}> -
- <{$block.content_preview}> -
-<{/if}> - diff --git a/xoops_trust_path/libs/altsys/templates/main_myblocksadmin_list.html b/xoops_trust_path/libs/altsys/templates/main_myblocksadmin_list.html deleted file mode 100644 index 397a70a..0000000 --- a/xoops_trust_path/libs/altsys/templates/main_myblocksadmin_list.html +++ /dev/null @@ -1,73 +0,0 @@ -

<{$target_mname}>

- -

<{$smarty.const._MD_A_MYBLOCKSADMIN_BLOCKADMIN}>

- - -
- - - - - - - - - - - <{foreach from=$blocks item="block"}> - "> - - - - - - - - <{/foreach from=$blocks item="block"}> - - - - -
<{$smarty.const._MD_A_MYBLOCKSADMIN_TITLE}><{$smarty.const._MD_A_MYBLOCKSADMIN_SIDE}><{$smarty.const._MD_A_MYBLOCKSADMIN_WEIGHT}><{$smarty.const._MD_A_MYBLOCKSADMIN_VISIBLEIN}><{$smarty.const._MD_A_MYBLOCKSADMIN_BCACHETIME}><{$smarty.const._MD_A_MYBLOCKSADMIN_ACTION}>
- <{$block.name_raw|escape}> -
- -
- <{$block.cell_position}> - - - - <{$block.cell_module_link}> - <{$block.cell_group_perm}> - - - - <{if $block.can_edit}> - <{$smarty.const._EDIT}> - <{/if}> -
- <{if $block.can_delete}> - <{$smarty.const._DELETE}> - <{/if}> -
- <{if $block.can_clone}> - <{if $block.can_clone == 2}><{$smarty.const._CLONE}><{else}><{$smarty.const._MD_A_MYBLOCKSADMIN_LINK_FORCECLONE}><{/if}> - <{/if}> -
- - - <{$gticket_hidden}> - -
-
diff --git a/xoops_trust_path/libs/altsys/templates/main_mylangadmin.html b/xoops_trust_path/libs/altsys/templates/main_mylangadmin.html deleted file mode 100644 index ad2e2ba..0000000 --- a/xoops_trust_path/libs/altsys/templates/main_mylangadmin.html +++ /dev/null @@ -1,71 +0,0 @@ -
- - - - - - - -
- -

<{$smarty.const._MYLANGADMIN_H3_MODULE}> : <{$target_mname}> : <{$target_lang|escape}> : <{$target_file|escape}>

- -
- <{if $use_my_language}> -
<{$smarty.const._MYLANGADMIN_DT_MYLANGFILENAME}>
-
<{$mylang_file_name}>
- <{/if}> -
<{$smarty.const._MYLANGADMIN_DT_CACHEFILENAME}>
-
<{$cache_file_name}>
-
<{$smarty.const._MYLANGADMIN_DT_CACHESTATUS}>
-
<{if $cache_file_mtime}><{$smarty.const._MYLANGADMIN_CREATED}> (<{"Y-m-d H:i:s"|date:$cache_file_mtime+$timezone_offset}>)<{else}><{$smarty.const._MYLANGADMIN_NOTCREATED}><{/if}>
-
- -
- - - - - - - - <{foreach from=$langfile_constants key="langfile_name" item="langfile_uservalue"}> - " title="<{$langfile_name|escape}>"> - - - - - <{/foreach}> - -
<{$smarty.const._MYLANGADMIN_TH_CONSTANTNAME}> - <{$smarty.const._MYLANGADMIN_TH_DEFAULTVALUE}> - <{if $already_read}>
(<{$smarty.const._MYLANGADMIN_MSG_NOTICE4ALREADYREAD}>)<{/if}> -
<{$smarty.const._MYLANGADMIN_TH_USERVALUE}>
-
- <{$langfile_name|constant|escape}> -
-
- <{if empty($mylang_constants.$langfile_name)}> - <{if strlen(constant($langfile_name)) < 32}> - - <{else}> - - <{/if}> - <{else}> - <{$mylang_constants.$langfile_name}> - <{/if}> -
-
- - - <{$gticket_hidden}> -
-
- -
- <{$notice}> -
diff --git a/xoops_trust_path/libs/altsys/xoops_version.php b/xoops_trust_path/libs/altsys/xoops_version.php index 62e4e95..23dfb9d 100644 --- a/xoops_trust_path/libs/altsys/xoops_version.php +++ b/xoops_trust_path/libs/altsys/xoops_version.php @@ -1,39 +1,52 @@ PEAK Corp.(http://www.peak.ne.jp/), XOOPS X Distribution(https://github.com/XoopsX)" ; -$modversion['license'] = "GPL see LICENSE"; -$modversion['official'] = 0; -$modversion['image'] = "images/module_icon.png"; -$modversion['dirname'] = "altsys"; - -// Admin things -$modversion['hasAdmin'] = 1; -$modversion['adminindex'] = "admin/index.php" ; -$modversion['adminmenu'] = "admin/admin_menu.php"; - -// All Templates can't be touched by modulesadmin. -$modversion['templates'] = array() ; +altsys_include_language_file( 'modinfo' ); + +// Manifesto +$modversion['dirname'] = 'altsys'; +$modversion['name'] = _MI_ALTSYS_MODULENAME; +$modversion['version'] = '2.32'; +$modversion['detailed_version'] = '2.32.1'; +$modversion['description'] = _MI_ALTSYS_MODULEDESC; +$modversion['author'] = 'GIJ=CHECKMATE
PEAK Corp.(https://www.peak.ne.jp/)'; +$modversion['credits'] = 'PEAK Corp., Gigamaster (XCL/PHP7)'; +$modversion['license'] = 'GPL see LICENSE'; +$modversion['image'] = 'images/module_ui_components.svg'; +$modversion['icon'] = 'images/module_icon.svg'; +$modversion['help'] = "help.html"; +$modversion['official'] = 0; +$modversion['cube_style'] = true; + +// Admin +$modversion['hasAdmin'] = 1; +$modversion['adminindex'] = 'admin/index.php'; +$modversion['adminmenu'] = 'admin/admin_menu.php'; + +// Templates can't be touched by modulesadmin. +$modversion['templates'] = []; // Blocks -$modversion['blocks'][1] = array( - 'file' => 'blocks.php' , - 'name' => _MI_ALTSYS_BNAME_ADMIN_MENU , - 'description' => '' , - 'show_func' => 'b_altsys_admin_menu_show' , - 'edit_func' => 'b_altsys_admin_menu_edit' , - 'options' => "$mydirname" , - 'template' => '' , // use "module" template instead -) ; +$modversion['blocks'][1] = [ + 'file' => 'blocks.php', + 'name' => _MI_ALTSYS_BNAME_ADMIN_MENU, + 'description' => '', + 'show_func' => 'b_altsys_admin_menu_show', + 'edit_func' => 'b_altsys_admin_menu_edit', + 'options' => $mydirname, + 'template' => '', // use "module" template instead +]; // Menu $modversion['hasMain'] = 1; @@ -45,7 +58,7 @@ $modversion['hasComments'] = 0; // Configurations -$modversion['config'][1] = array( +/* $modversion['config'][1] = array( 'name' => 'adminmenu_hack_ft' , 'title' => '_MI_ALTSYS_ADMINMENU_HFT' , 'description' => '_MI_ALTSYS_ADMINMENU_HFTDSC' , @@ -53,57 +66,52 @@ 'valuetype' => 'int' , 'default' => 0 , 'options' => array( '_NONE' => 0 , '_MI_ALTSYS_AMHFT_OPT_2COL' => 1 , '_MI_ALTSYS_AMHFT_OPT_NOIMG' => 2 , '_MI_ALTSYS_AMHFT_OPT_XCSTY' => 3 ) -) ; - -$modversion['config'][] = array( - 'name' => 'adminmenu_insert_mymenu' , - 'title' => '_MI_ALTSYS_ADMINMENU_IM' , - 'description' => '_MI_ALTSYS_ADMINMENU_IMDSC' , - 'formtype' => 'yesno' , - 'valuetype' => 'int' , - 'default' => 0 , - 'options' => array() -) ; - -$modversion['config'][] = array( - 'name' => 'admin_in_theme' , - 'title' => '_MI_ALTSYS_ADMIN_IN_THEME' , - 'description' => '_MI_ALTSYS_ADMIN_IN_THEMEDSC' , - 'formtype' => 'textbox' , - 'valuetype' => 'text' , - 'default' => 'default' , +) ; */ + +/* $modversion['config'][] = array( + 'name' => 'adminmenu_insert_mymenu', + 'title' => '_MI_ALTSYS_ADMINMENU_IM', + 'description' => '_MI_ALTSYS_ADMINMENU_IMDSC', + 'formtype' => 'yesno', + 'valuetype' => 'int', + 'default' => 0, 'options' => array() -) ; - -$modversion['config'][] = array( - 'name' => 'enable_force_clone' , - 'title' => '_MI_ALTSYS_ENABLEFORCECLONE' , - 'description' => '_MI_ALTSYS_ENABLEFORCECLONEDSC' , - 'formtype' => 'yesno' , - 'valuetype' => 'int' , - 'default' => 1 , - 'options' => array() -) ; - -$modversion['config'][] = array( - 'name' => 'images_dir' , - 'title' => '_MI_ALTSYS_IMAGES_DIR' , - 'description' => '_MI_ALTSYS_IMAGES_DIRDSC' , - 'formtype' => 'textbox' , - 'valuetype' => 'text' , - 'default' => 'images' , - 'options' => array() -) ; +); */ + +$modversion['config'][] = [ + 'name' => 'admin_in_theme', + 'title' => '_MI_ALTSYS_ADMIN_IN_THEME', + 'description' => '_MI_ALTSYS_ADMIN_IN_THEMEDSC', + 'formtype' => 'textbox', + 'valuetype' => 'text', + 'default' => 'xcl_default', + 'options' => [] +]; + +$modversion['config'][] = [ + 'name' => 'enable_force_clone', + 'title' => '_MI_ALTSYS_ENABLEFORCECLONE', + 'description' => '_MI_ALTSYS_ENABLEFORCECLONEDSC', + 'formtype' => 'yesno', + 'valuetype' => 'int', + 'default' => 1, + 'options' => [] +]; + +$modversion['config'][] = [ + 'name' => 'images_dir', + 'title' => '_MI_ALTSYS_IMAGES_DIR', + 'description' => '_MI_ALTSYS_IMAGES_DIRDSC', + 'formtype' => 'textbox', + 'valuetype' => 'text', + 'default' => 'images', + 'options' => [] +]; // Notification $modversion['hasNotification'] = 0; -$modversion['onInstall'] = 'include/oninstall.php' ; -$modversion['onUpdate'] = 'include/onupdate.php' ; -$modversion['onUninstall'] = 'include/onuninstall.php' ; - -// keep block's options -if (! defined('XOOPS_CUBE_LEGACY') && substr(XOOPS_VERSION, 6, 3) < 2.1 && ! empty($_POST['fct']) && ! empty($_POST['op']) && $_POST['fct'] == 'modulesadmin' && $_POST['op'] == 'update_ok' && $_POST['dirname'] == $modversion['dirname']) { - include dirname(__FILE__).'/include/x20_keepblockoptions.inc.php' ; -} +$modversion['onInstall'] = 'include/oninstall.php'; +$modversion['onUpdate'] = 'include/onupdate.php'; +$modversion['onUninstall'] = 'include/onuninstall.php';