diff --git a/common/framework/Korea.php b/common/framework/Korea.php index b7d57089d..774cda049 100644 --- a/common/framework/Korea.php +++ b/common/framework/Korea.php @@ -349,7 +349,7 @@ class Korea return self::$_domain_cache[$domain] = false; } } - foreach (self::_getDNSRecords($mx, \DNS_A) as $mx_ip) + foreach (self::_getDNSRecords($domain, \DNS_A) as $mx_ip) { return self::$_domain_cache[$domain] = self::isKoreanIP($mx_ip); } diff --git a/common/framework/Mail.php b/common/framework/Mail.php index 00851a749..72c226c95 100644 --- a/common/framework/Mail.php +++ b/common/framework/Mail.php @@ -585,7 +585,7 @@ class Mail // Reset Message-ID in case send() is called multiple times. $random = substr(hash('sha256', mt_rand() . microtime() . getmypid()), 0, 32); $sender = $this->message->getFrom(); - $sender_email = strval(array_key_first($sender)); + $sender_email = strval(array_first_key($sender)); $id = $random . '@' . (preg_match('/^(.+)@([^@]+)$/', $sender_email, $matches) ? $matches[2] : 'swift.generated'); $this->message->getHeaders()->get('Message-ID')->setId($id); diff --git a/common/framework/Password.php b/common/framework/Password.php index feb1943ec..3182557fb 100644 --- a/common/framework/Password.php +++ b/common/framework/Password.php @@ -112,7 +112,7 @@ class Password { unset($algos['argon2id']); } - return array_key_first($algos); + return array_first_key($algos); } /** diff --git a/common/framework/Router.php b/common/framework/Router.php index 29931b635..021449f90 100644 --- a/common/framework/Router.php +++ b/common/framework/Router.php @@ -608,7 +608,7 @@ class Router return false; } arsort($reordered_routes); - $best_route = array_key_first($reordered_routes); + $best_route = array_first_key($reordered_routes); return $best_route; } } diff --git a/common/framework/Storage.php b/common/framework/Storage.php index 6637c5cc0..5fe64c477 100644 --- a/common/framework/Storage.php +++ b/common/framework/Storage.php @@ -560,7 +560,6 @@ class Storage return false; } } - chmod($destination, 0666 & ~self::getUmask()); } elseif ($type === 'move') { @@ -571,7 +570,6 @@ class Storage return false; } } - chmod($destination, 0666 & ~self::getUmask()); } else { diff --git a/common/framework/Template.php b/common/framework/Template.php index 105da4fa6..f5919beab 100644 --- a/common/framework/Template.php +++ b/common/framework/Template.php @@ -368,10 +368,7 @@ class Template $content = $this->parse(); if (!Storage::write($this->cache_path, $content)) { - if (!Storage::write($this->cache_path, $content)) - { - throw new Exception('Cannot write template cache file: ' . $this->cache_path); - } + throw new Exception('Cannot write template cache file: ' . $this->cache_path); } } diff --git a/common/framework/drivers/mail/brevo.php b/common/framework/drivers/mail/brevo.php index 613b0309e..4fe4625ff 100644 --- a/common/framework/drivers/mail/brevo.php +++ b/common/framework/drivers/mail/brevo.php @@ -69,7 +69,7 @@ class Brevo extends Base implements \Rhymix\Framework\Drivers\MailInterface $from = $message->message->getFrom(); $to = $message->message->getTo(); $data = [ - 'sender' => ['email' => array_key_first($from), 'name' => array_first($from)], + 'sender' => ['email' => array_first_key($from), 'name' => array_first($from)], 'to' => array_map($format_callback, array_keys($to), array_values($to)), 'subject' => $message->message->getSubject(), 'htmlContent' => $message->message->getBody(), @@ -84,7 +84,7 @@ class Brevo extends Base implements \Rhymix\Framework\Drivers\MailInterface } if ($reply_to = $message->message->getReplyTo()) { - $data['replyTo'] = ['email' => array_key_first($reply_to)]; + $data['replyTo'] = ['email' => array_first_key($reply_to)]; } foreach ($message->getAttachments() as $attachment) { @@ -93,7 +93,7 @@ class Brevo extends Base implements \Rhymix\Framework\Drivers\MailInterface 'name' => $attachment->display_filename ?: $attachment->cid, ]; } - + // Prepare headers and options for Requests. $headers = [ 'api-key' => $this->_config['api_key'], @@ -103,7 +103,7 @@ class Brevo extends Base implements \Rhymix\Framework\Drivers\MailInterface $options = [ 'timeout' => 8, ]; - + // Send the API request. $request = \Rhymix\Framework\HTTP::post(self::$_url, $data, $headers, [], $options); $status_code = $request->getStatusCode(); diff --git a/common/framework/drivers/mail/sendgrid.php b/common/framework/drivers/mail/sendgrid.php index 8a7d84c96..b135c79bd 100644 --- a/common/framework/drivers/mail/sendgrid.php +++ b/common/framework/drivers/mail/sendgrid.php @@ -108,7 +108,7 @@ class SendGrid extends Base implements \Rhymix\Framework\Drivers\MailInterface $from = $message->message->getFrom(); if ($from) { - $data['from']['email'] = array_key_first($from); + $data['from']['email'] = array_first_key($from); if (array_first($from)) { $data['from']['name'] = array_first($from); @@ -119,7 +119,7 @@ class SendGrid extends Base implements \Rhymix\Framework\Drivers\MailInterface $replyTo = $message->message->getReplyTo(); if ($replyTo) { - $data['reply_to']['email'] = array_key_first($from); + $data['reply_to']['email'] = array_first_key($from); } // Set the subject. diff --git a/common/framework/parsers/DBTableParser.php b/common/framework/parsers/DBTableParser.php index 50874a7d8..cbd50ea55 100644 --- a/common/framework/parsers/DBTableParser.php +++ b/common/framework/parsers/DBTableParser.php @@ -304,13 +304,7 @@ class DBTableParser extends BaseParser if ($constraint->references) { $ref = explode('.', $constraint->references); - $reference_table_name = $ref[0]; - if ($reference_table_name === $table_name) - { - continue; // Ignore self-references. - } - - $info->refs[] = $reference_table_name; + $info->refs[] = $ref[0]; } } $ref_list[$table_name] = $info; @@ -334,6 +328,7 @@ class DBTableParser extends BaseParser } } } + $k++; } if (!$changed) { diff --git a/common/functions.php b/common/functions.php index 84b923681..72b3e9e5b 100644 --- a/common/functions.php +++ b/common/functions.php @@ -56,12 +56,9 @@ function lang(?string $code, $value = null) * @param array $array The input array * @return mixed */ -if (!function_exists('array_first')) +function array_first(array $array) { - function array_first(array $array) - { - return reset($array); - } + return reset($array); } /** @@ -72,7 +69,8 @@ if (!function_exists('array_first')) */ function array_first_key(array $array) { - return array_key_first($array); + reset($array); + return key($array); } /** @@ -81,12 +79,9 @@ function array_first_key(array $array) * @param array $array The input array * @return mixed */ -if (!function_exists('array_last')) +function array_last(array $array) { - function array_last(array $array) - { - return end($array); - } + return end($array); } /** @@ -97,7 +92,8 @@ if (!function_exists('array_last')) */ function array_last_key(array $array) { - return array_key_last($array); + end($array); + return key($array); } /** diff --git a/common/js/common.js b/common/js/common.js index 7504be4ad..728085456 100644 --- a/common/js/common.js +++ b/common/js/common.js @@ -614,7 +614,7 @@ Rhymix.ajaxForm = function(form, callback_success, callback_error) { } else { callback_success = function(data) { if (data.message && data.message !== 'success') { - rhymix_alert(data.message, data.redirect_url); + alert(data.message); } if (data.redirect_url) { Rhymix.redirectToUrl(data.redirect_url.replace(/&/g, '&')); diff --git a/modules/admin/controllers/AdminMenu.php b/modules/admin/controllers/AdminMenu.php index 47aa98a3e..f9bc3880b 100644 --- a/modules/admin/controllers/AdminMenu.php +++ b/modules/admin/controllers/AdminMenu.php @@ -7,7 +7,6 @@ use MenuAdminController; use MenuAdminModel; use Rhymix\Framework\Cache; use Rhymix\Framework\Storage; -use Rhymix\Framework\Exceptions\TargetNotFound; use Rhymix\Modules\Admin\Models\AdminMenu as AdminMenuModel; use Rhymix\Modules\Admin\Models\Favorite as FavoriteModel; @@ -65,10 +64,6 @@ class AdminMenu extends Base { // Check if favorite exists. $module_name = Context::get('module_name'); - if (!$module_name) - { - throw new TargetNotFound(); - } $output = FavoriteModel::isFavorite($module_name); if(!$output->toBool()) { diff --git a/modules/admin/tpl/config_domains_edit.html b/modules/admin/tpl/config_domains_edit.html index f6d5c1aee..159227a62 100644 --- a/modules/admin/tpl/config_domains_edit.html +++ b/modules/admin/tpl/config_domains_edit.html @@ -117,7 +117,7 @@
- +
{$lang->detail_input_header_script}
@@ -125,7 +125,7 @@
- +
{$lang->detail_input_footer_script}
diff --git a/modules/admin/tpl/config_notification.html b/modules/admin/tpl/config_notification.html index c3cc37685..e09062d6c 100644 --- a/modules/admin/tpl/config_notification.html +++ b/modules/admin/tpl/config_notification.html @@ -220,7 +220,7 @@ {@ $conf_exists = config("sms.$driver_name.api_key")} diff --git a/modules/admin/tpl/css/admin.bootstrap.css b/modules/admin/tpl/css/admin.bootstrap.css index f59f3fde2..a87f10ffb 100644 --- a/modules/admin/tpl/css/admin.bootstrap.css +++ b/modules/admin/tpl/css/admin.bootstrap.css @@ -309,10 +309,9 @@ .x .x_uneditable-input{width:206px} .x input.x_full-width, .x textarea.x_full-width, -.x .x_uneditable-input.x_full-width{width:calc(100% - 14px);resize:vertical} -.x textarea.x_full-width.lang_code{width:calc(100% - 42px);resize:vertical} -.x textarea.x_full-width + textarea.lang_code{width:calc(100% - 42px);resize:vertical} -.x textarea{height:auto;min-height:80px;} +.x .x_uneditable-input.x_full-width{width:calc(100% - 14px)} +.x textarea.x_full-width.lang_code{width:calc(100% - 42px)} +.x textarea{height:auto;min-height:80px;resize:vertical} .x textarea, .x input[type="text"], .x input[type="password"], @@ -373,7 +372,6 @@ .x textarea:-ms-input-placeholder{color:#999999} .x input::-webkit-input-placeholder, .x textarea::-webkit-input-placeholder{color:#999999} -.x textarea.x_code-font, .x textarea.x_code-font + textarea.lang_code { font-family: Consolas, SF Mono, monospace !important; } .x .x_radio, .x .x_checkbox{min-height:20px;padding-left:20px} .x .x_radio input[type="radio"], diff --git a/modules/advanced_mailer/advanced_mailer.controller.php b/modules/advanced_mailer/advanced_mailer.controller.php index 11679d716..904822dcd 100644 --- a/modules/advanced_mailer/advanced_mailer.controller.php +++ b/modules/advanced_mailer/advanced_mailer.controller.php @@ -18,7 +18,7 @@ class Advanced_MailerController extends Advanced_Mailer $recipients = $mail->message->getTo() ?: array(); if ($recipients) { - $first_recipient = array_key_first($recipients); + $first_recipient = array_first_key($recipients); if ($exception_driver = $this->getSendingMethodForEmailAddress($first_recipient, $config)) { $driver_class = '\\Rhymix\\Framework\\Drivers\Mail\\' . $exception_driver; @@ -51,7 +51,7 @@ class Advanced_MailerController extends Advanced_Mailer else { $sender = $mail->message->getFrom(); - $original_sender_email = $sender ? array_key_first($sender) : null; + $original_sender_email = $sender ? array_first_key($sender) : null; $original_sender_name = $sender ? array_first($sender) : null; list($default_from, $default_name) = $this->getDefaultEmailIdentity(); if ($original_sender_email !== $default_from && $default_from) diff --git a/modules/board/m.skins/default/write_form.html b/modules/board/m.skins/default/write_form.html index 7283326e2..b4105219f 100644 --- a/modules/board/m.skins/default/write_form.html +++ b/modules/board/m.skins/default/write_form.html @@ -19,12 +19,11 @@
  • diff --git a/modules/board/m.skins/simpleGray/write_form.html b/modules/board/m.skins/simpleGray/write_form.html index 991f81a06..fec0b3118 100644 --- a/modules/board/m.skins/simpleGray/write_form.html +++ b/modules/board/m.skins/simpleGray/write_form.html @@ -14,12 +14,11 @@
  • diff --git a/modules/board/skins/default/write_form.html b/modules/board/skins/default/write_form.html index 65bc195de..b6582ae79 100644 --- a/modules/board/skins/default/write_form.html +++ b/modules/board/skins/default/write_form.html @@ -6,11 +6,9 @@
    diff --git a/modules/board/skins/xedition/write_form.html b/modules/board/skins/xedition/write_form.html index 34bde1a00..a8c3de8d7 100644 --- a/modules/board/skins/xedition/write_form.html +++ b/modules/board/skins/xedition/write_form.html @@ -6,11 +6,9 @@
    diff --git a/modules/board/tpl/addition_setup.html b/modules/board/tpl/addition_setup.html index e73c5b5e1..954d0c56e 100644 --- a/modules/board/tpl/addition_setup.html +++ b/modules/board/tpl/addition_setup.html @@ -19,7 +19,7 @@

    {$lang->about_board_combined_board}

    diff --git a/modules/board/tpl/board_insert.html b/modules/board/tpl/board_insert.html index f66a1d6e3..e3c0b5d91 100644 --- a/modules/board/tpl/board_insert.html +++ b/modules/board/tpl/board_insert.html @@ -104,14 +104,14 @@
    - +

    {$lang->about_header_text}

    - +
    @@ -178,14 +178,14 @@
    - +

    {$lang->about_mobile_header_text}

    - +
    diff --git a/modules/board/tpl/board_setup_basic.html b/modules/board/tpl/board_setup_basic.html index bff67bfa2..1782a07e3 100644 --- a/modules/board/tpl/board_setup_basic.html +++ b/modules/board/tpl/board_setup_basic.html @@ -11,7 +11,7 @@
    - + {$lang->help}
    @@ -19,7 +19,7 @@
    - + {$lang->help}
    diff --git a/modules/document/document.controller.php b/modules/document/document.controller.php index ad36c5097..c38f7c003 100644 --- a/modules/document/document.controller.php +++ b/modules/document/document.controller.php @@ -949,8 +949,8 @@ class DocumentController extends Document { $this->addGrant($obj->document_srl); } - $output->add('document_srl', $obj->document_srl); - $output->add('category_srl', $obj->category_srl); + $output->add('document_srl',$obj->document_srl); + $output->add('category_srl',$obj->category_srl); return $output; } @@ -1397,8 +1397,7 @@ class DocumentController extends Document // Remove the thumbnail file Rhymix\Framework\Storage::deleteDirectory(RX_BASEDIR . sprintf('files/thumbnails/%s', getNumberingPath($obj->document_srl, 3))); - $output->add('document_srl', $obj->document_srl); - $output->add('category_srl', $obj->category_srl); + $output->add('document_srl',$obj->document_srl); //remove from cache self::clearDocumentCache($obj->document_srl); diff --git a/modules/layout/tpl/layout_edit.html b/modules/layout/tpl/layout_edit.html index 15a51f97a..df5302182 100644 --- a/modules/layout/tpl/layout_edit.html +++ b/modules/layout/tpl/layout_edit.html @@ -83,7 +83,7 @@

    HTML - layout.html

    - +
    | {$widget->title} @@ -93,7 +93,7 @@

    CSS - layout.css

    - +
    diff --git a/modules/layout/tpl/layout_html_css_view.html b/modules/layout/tpl/layout_html_css_view.html index 6d09e664e..7fb738c9f 100644 --- a/modules/layout/tpl/layout_html_css_view.html +++ b/modules/layout/tpl/layout_html_css_view.html @@ -60,7 +60,7 @@

    HTML - layout.html

    - +
    | {$widget->title} @@ -84,7 +84,7 @@

    CSS - layout.css

    - +
    diff --git a/modules/layout/tpl/layout_info_view.html b/modules/layout/tpl/layout_info_view.html index 9a8711e29..1d32aa128 100644 --- a/modules/layout/tpl/layout_info_view.html +++ b/modules/layout/tpl/layout_info_view.html @@ -45,7 +45,7 @@
    - + {$lang->about_header_script}
    diff --git a/modules/module/module.admin.model.php b/modules/module/module.admin.model.php index a74fd0ea7..0be94b122 100644 --- a/modules/module/module.admin.model.php +++ b/modules/module/module.admin.model.php @@ -174,13 +174,11 @@ class ModuleAdminModel extends Module // Get a permission group granted to the current module $selected_group = array(); - $default_xml_grant = array(); $default_grant = array(); foreach ($grant_list as $key => $val) { if (!empty($val->default)) { - $default_xml_grant[$key] = $val->default; $default_grant[$key] = $val->default; } } @@ -205,7 +203,6 @@ class ModuleAdminModel extends Module } } Context::set('selected_group', $selected_group); - Context::set('default_xml_grant', $default_xml_grant); Context::set('default_grant', $default_grant); Context::set('module_srl', $module_srl); // Extract admin ID set in the current module diff --git a/modules/module/tpl/include.module_setup.html b/modules/module/tpl/include.module_setup.html index 464d846ac..106f9b50e 100644 --- a/modules/module/tpl/include.module_setup.html +++ b/modules/module/tpl/include.module_setup.html @@ -78,7 +78,7 @@
    {@$use_multilang_textarea=true} - +

    {$lang->about_header_text}

    @@ -86,7 +86,7 @@
    - +

    {$lang->about_footer_text}

    diff --git a/modules/module/tpl/module_grants.html b/modules/module/tpl/module_grants.html index b4da47c59..dc4557465 100644 --- a/modules/module/tpl/module_grants.html +++ b/modules/module/tpl/module_grants.html @@ -58,11 +58,9 @@
    diff --git a/modules/module/tpl/module_setup.html b/modules/module/tpl/module_setup.html index 82a96ac8a..d99fe0501 100644 --- a/modules/module/tpl/module_setup.html +++ b/modules/module/tpl/module_setup.html @@ -46,14 +46,14 @@
    - +

    {$lang->about_header_text}

    - +

    {$lang->about_footer_text}

    @@ -68,5 +68,5 @@ - + diff --git a/modules/page/page.admin.view.php b/modules/page/page.admin.view.php index f78ee30c6..7a58172c6 100644 --- a/modules/page/page.admin.view.php +++ b/modules/page/page.admin.view.php @@ -296,10 +296,7 @@ class PageAdminView extends Page Context::set('oDocument', $oDocument); Context::set('mid', $this->module_info->mid); - if(config('view.manager_layout') !== 'admin') - { - $this->setLayoutAndTemplatePaths($isMobile ? 'M' : 'P', $this->module_info); - } + $this->setLayoutAndTemplatePaths($isMobile ? 'M' : 'P', $this->module_info); $skin_path = rtrim($this->getTemplatePath(), '/') . '/'; if (file_exists($skin_path . 'content_modify.blade.php') || file_exists($skin_path . 'content_modify.html')) {