html tags shows as it is in view page

I tried to add WYSIWYG text editor to my website. Everything works fine, it stores in database properly and acts completely fine in admin panel. The problem is when i view my description in view page, it shows as plain text but it works fine in admin panel. is there anything to do with this code. <!doctype html> has been loaded to website.

   <style>
    table{
        margin-top: 20px;
    }
    .table td{
        padding: .2rem .1rem;
        font-size: 14px;
        font-family: 'Arial', sans-serif;
        border-top:  none;

    }
    h3{
        color: #D80726;
        font-size: 16px;
        font-weight: bold;
    }
    h5{
        font-size: 15px;
    }
</style>
<div class="wrapper">

    <!-- Top container -->
    <section class="top-container">
        <div class="left-side">
            <ul>
                <?php foreach (($left_ads?:array()) as $la): ?>
                    <li><a href="<?php echo $la['url']; ?>" target="_blank"><img data-src="<?php echo $BASE; ?>/uploads/adds/<?php echo $la['image']; ?>" alt="" class="lazy"></a></li>
                <?php endforeach; ?>

            </ul>


        </div>
        <div class="middle-side" id="middle-side">
            <div class="col main-content">
                <h3><?php echo $listing['name']; ?></h3>
                <h5>Total Views<i class="fa fa-eye"></i>  : <strong><?php echo $listing['visited']; ?></strong></h5>
                <div class="addthis_native_toolbox"></div>
                <div class="row">
                    <?php if ($listing['image'] && $listing['image'] !=''): ?>
                        <a href="<?php echo $BASE; ?>/uploads/listing/<?php echo $listing['image']; ?>" data-lightbox="images" data-title="<?php echo $listing['name']; ?>" class="link-preview" title="Preview">
                            <img src="<?php echo $BASE; ?>/uploads/listing/<?php echo $listing['image']; ?>" class="img img-responsive" style="max-width: 400px;"></a>
                    <?php endif; ?>
                </div>
                <table class="table">
                    <tr>
                        <td>Listing Name</td>
                        <td><span>:</span><?php echo listing.name; ?></td>
                    </tr>
                    <?php if ($listing['description']): ?>
                        <tr>
                            <td>Description</td>
                            <td><span>:</span> <?php echo $listing['description']; ?></td>
                        </tr>
                    <?php endif; ?>

                    <tr>
                        <td>Address<i class="fa fa-location-arrow"></i></td>
                        <td><span>:</span> <?php echo $listing['add1']; ?></td>
                    </tr>
                    <tr>
                        <td>City</td>
                        <td><span>:</span> <?php echo $listing['city']; ?></td>
                    </tr>
                    <?php if ($listing['phone1']): ?>
                        <tr>
                            <td>Phone <i class="fa fa-phone"></i></td>
                            <td><span>:</span> <?php echo $listing['phone1']; ?></td>
                        </tr>
                    <?php endif; ?>
                    <?php if ($listing['phone2']): ?>
                        <tr>
                            <td>Mobile <i class="fa fa-mobile"></i></td>
                            <td><span>:</span> <?php echo $listing['phone2']; ?></td>
                        </tr>
                    <?php endif; ?>
                    <?php if ($listing['fax']): ?>
                        <tr>
                            <td>Fax</td>
                            <td><span>:</span> <?php echo $listing['fax']; ?></td>
                        </tr>
                    <?php endif; ?>
                    <?php if ($listing['email']): ?>
                        <tr>
                            <td>Email <i class="fa fa-envelope"></i></td>
                            <td ><span>:</span> <a href="mailto: <?php echo $listing['email']; ?>" style="color:#D80726"><?php echo $listing['email']; ?></a></td>
                        </tr>
                    <?php endif; ?>
                    <?php if ($listing['url']): ?>
                        <tr>
                            <td>Website <i class="fa fa-globe"></i></td>
                            <td ><span>:</span> <a href ="http://<?php echo $listing['url']; ?>" target="_blank"><?php echo $listing['url']; ?></a></td>
                        </tr>
                    <?php endif; ?>

                </table>

            </div>
            <div class="col">
                <div id="map" style="margin: 20px; padding: 20px;width:90%;height:324px;"></div>
                <script>
                    function initMap() {
                        var mapCanvas = document.getElementById("map");
                        var lat = "<?php echo $listing['latitude']; ?>";
                        var lon = "<?php echo $listing['longitude']; ?>";
                        var myCenter = new google.maps.LatLng(lat, lon);
                        var mapOptions = {center: myCenter, zoom: 12};
                        var map = new google.maps.Map(mapCanvas, mapOptions);
                        var marker = new google.maps.Marker({
                            position: myCenter,
                            animation: google.maps.Animation.BOUNCE
                        });
                        marker.setMap(map);

                    }

                </script>
                <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyApm29k9v7jFdX_fjvEqRrq2g24Rh_ivTg&callback=initMap"></script>
            </div>
            <div style="color:#D80726">Related Category:
                <?php foreach (($listing['category']?:array()) as $c): ?>
                    <a href="<?php echo $BASE; ?>/subcategory/<?php echo $c['0']; ?>" class="link"> <?php echo $c['1'] ."  "; ?></a>
                <?php endforeach; ?>
            </div> 
            <!-- Go to www.addthis.com/dashboard to customize your tools -->
            <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5509185e5d822cb8" async="async"></script>

        </div>
        <div class="right-side">

            <ul>
                <?php foreach (($right_ads?:array()) as $ra): ?>
                    <li><a href="<?php echo $ra['url']; ?>" target="_blank"><img src="<?php echo $BASE; ?>/assets/adds/<?php echo $ra['image']; ?>" alt="" class="lazy"></a></li>
                <?php endforeach; ?>
            </ul>
        </div>  
    </section>


</div>


<section class="bottom">

    <div class="regular">
        <?php foreach (($bottom_ads?:array()) as $ba): ?>
            <div style="margin: 0 auto;width: 100px;">
                <a href="<?php echo $ba['url']; ?>" target="_blank"> <img src="<?php echo $BASE; ?>/uploads/adds/<?php echo $ba['image']; ?>" alt="" ></a>
            </div>

        <?php endforeach; ?>       
    </div>  
</section>
<script>
                    $(document).ready(function () {

                        $('.link').click(function () {
                            var url = $(this).attr('href');
                            $.get(url, function (data, status) {
                                $('.main-content').html(data);
                            })
                            $('html, body').animate({
                                scrollTop: $(".main-content").offset().top
                            }, 1000);
                            return false;
                        })


                        $('.lazy').lazy({
                            // placeholder: "data:image/gif;base64,R0lGODlhEALAPQAPzl5uLr9Nrl8e7..."
                            delay: 500,
                            combined: true,
                        });
                    })
</script>

What i am Getting

How i want my text to show

Use Macroable or allowing somehow to add custom attributes to RouteRegistrar

I’m doing this:

    IlluminateRoutingRoute::macro('description', function (string $description): AppServiceProvider|IlluminateRoutingRoute {
        $this->action['description'] = isset($this->action['description']) ? $this->action['description'].$description : $description;
        return $this;
    });

So I can do this:

Route::post('/test', [TestController::class, 'test'])->description('this is a test description');

Then I will access the description as normally should by:

$request->route()->getAction('description');

The problem I’m facing is that if we add a new mixin/macro on IlluminateRoutingRoute, it cannot be accessed from RouteRegistrar because the $allowedAttributes are hardcoded.

Any work around for this?

Internet browser is showing cached image after applying meta ‘cache-control’ and ‘pregma’ too. How to fix?

My internet browser: Google Chrome is still showing old cached image when changing the image size and applying filters too. I wrote the following code:

<meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="0" />

I also applyed max-age=0 but internet browser still showing old image. I do not want to do ‘clear browsing data’ doing manually because all my website visiters do not clear the browsing data for that, I need to tell them individually for seeing the changed image on their browser. Hence, it is complicated.
I had written this code in head.php which is included as <?php include "head.php ?>" in main document.

With my stylesheets main.css and other files as style.css were having same problem but after writing as <link rel=’stylesheet’ href=’main.css?version=1.01> in this way, new styles has been updated but in case of images, save changes on images has not been shown in internet browsers. I also read the cache-control documentation in mozilla MDN website. I tried in localhost and in my website too but still showing old one. I did not find the solution to fix this issue. Any solution to write meta element to show the fresh image / content in my Google Chrome?

PHP OOP – subclasses

I have the following scenario:

There is a base class called a Document and two subclasses called FileDocument and TextDocument.
FileDocument class has properties fileName, fileType and blob. TextDocument class has properties content and can have an object of FileDocument class.

The implementation will be as following:

class Document{
 /**
 * @ORMId
 * @ORMGeneratedValue(strategy="NONE")
 * @ORMColumn(name="id", type="guid")
 */
private string $id;

 /**
 * @ORMColumn(name="type", type="string", length=20)
 */
private string $type;

 /**
 * @ORMColumn(name="authorName", type="string", length=20)
 */
private string $authorName

getters and settere are here
-----
-----
-----
}
class FileDocument extends Document {

 /**
 * @ORMColumn(name="fileName", type="string", length=20)
 */
private string $fileName;

 /**
 * @ORMColumn(name="fileType", type="string", length=20)
 */
private string $fileType;

/**
 * @ORMColumn(name="file", type="blob", length=20)
 */
private string $file;


public function getFileName(): string
{
    return $this->fileName;
}

public function setFileName(string $fileName): void
{
    $this->fileName = $fileName;
}

public function getContentType(): string
{
    return $this->contentType;
}

public function setContentType(string $contentType): void
{
    $this->contentType = $contentType;
}

-----
-----
-----
}
class TextDocument extends Document {

 /**
 * @ORMColumn(name="file", type="text", length=20)
 */
private string $content;


  /**
 * @ORMOneToOne(targetEntity=FileDocument::class)
 */
private FileDocument $file;

    
 public function getContent(): string
{
    return $this->content;
}

public function setContent(string $content): void
{
    $this->content = $content;
}

   public function getFileDocmuent(): FileDocmuent
{
    return $this->fileDocmuent;
}

public function setFileDocmuent(FileDocmuent $fileDocmuent): void
{
    $this->fileDocmuent = $fileDocmuent;
}

-----
-----
-----
}

Would this be possible in PHP to use subclass FileDocument in another sub class TextDocument, for example?

Deprecated Function WP_Scripts::print_inline_script in WordPress 6.3.0

I’m currently developing a WordPress website and encountering the following error message when running my code:

HP Deprecated: Function WP_Scripts::print_inline_script is <strong>deprecated</strong> since version 6.3.0! Use WP_Scripts::get_inline_script_data() or WP_Scripts::get_inline_script_tag() instead. in C:laragon-8laragonwwwdev-myprojectswp-includesfunctions.php on line 5453

I’m unsure about how to handle this deprecation warning. I’ve tried looking into the WordPress documentation for information, but I’m still confused. Could someone please guide me on how to address this issue?

  • I’ve searched the WordPress documentation for this error.
  • I’ve attempted to find solutions through search engines, but haven’t come across a suitable answer.

Problem: Cannot run existing moodle source code

I downloaded the source code and database of a website developed with moodle. I imported the database locally with the same credentials and just modified the configuration file as follows:

<?php  // Moodle configuration file

unset($CFG);
global $CFG;
$CFG = new stdClass();

$CFG->dbtype    = 'mariadb';
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle_bwv';
$CFG->dbuser    = 'bwv_moodle';
$CFG->dbpass    = 'bwv_moodle$4$deploy';
$CFG->prefix    = '';
$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbport' => '',
  'dbsocket' => '',
  'dbcollation' => 'utf8mb4_general_ci',
);

// $CFG->wwwroot   = 'https://bildungswerk-vielfalt.com';
// $CFG->dataroot  = '/var/www/vhosts/bildungswerk-vielfalt.com/moodledata';
// $CFG->admin     = 'admin';

$CFG->wwwroot   = 'http://localhost/bildungswerk';
$CFG->dataroot  = 'C:\wamp64\moodledata';
$CFG->admin     = 'admin';

$CFG->directorypermissions = 0777;

//added by cesaire to disable login token check
$CFG->disablelogintoken = true;

require_once(__DIR__ . '/lib/setup.php');

And I get the following error
enter image description here

Any help would be greatly appreciated.

Laravel Passport How to pass the access token to js?

I would like to ask how can I get back the accessToken from current user?
Background: I would like to develop an api that requires authentication of users.

Now, I am able to create the accessToken by
$accessToken = $user->createToken(‘auth_token’)->accessToken;

but where do I $accessToken? I have done some research on it, and I should not store the accessToken on database, I can get back some of the details of current users token
for example:
I can get back the user token by defining one-to-many relationship
$user->tokens->each(function($token){

})

but it can only get back the field in oauth_access_tokens table, I cannot get back the accessToken.

What I would like to do is, get the accessToken, and pass it to the frontend js.

I have few questions to ask:

1: is it a proper way to pass the accessToken directly from backend to frontend, because I am thinking if someone is able to view the brearer token via dev tools, then user credential will be compromised

2: how can I get back the access token via token id? or I should not get back the accessToken again? Similar to some of the api token service, you can only get the accessToken when you create the token, after created the token, you have to store it locally, and the server will not tell you the access token again?

Thanks!!!! I know I have asked a lot of dumb questions.

An uncaught Exception was encountered Type: TypeError Message: Cannot access offset of type string on string [closed]

I’m getting this error while running the program

An uncaught Exception was encountered

Type: TypeError

Message: Cannot access offset of type string on string
Filename: C:xampphtdocseditapplicationviewsfmh_index.php

Line Number: 201

This is where the error line

foreach (['data'] as $value) {
    $columnFab[] = array('label'=>$value['Year'], 'y'=>$value['Fabrikasi']);
    $columnInst[] = array('label'=>$value['Year'], 'y'=>$value['Instalasi']);
    $columnMain[] = array('label'=>$value['Year'], 'y'=>$value['Maintenance']);
    $columnPro[] = array('label'=>$value['Year'], 'y'=>$value['Project']);
}

and this is where ‘data’ came from:

public function getValuecategoriesChart($yearstart,$yearend){
    
    
    $query = "select Year
                , sum(case when JobCategories = 'FABRIKASI' then Amount else 0 end) as Fabrikasi
                , sum(case when JobCategories = 'MAINTENANCE' then Amount else 0 end) as Maintenance
                , sum(case when JobCategories = 'INSTALASI' then Amount else 0 end) as Instalasi
                , sum(case when JobCategories = 'PROJECT' then Amount else 0 end) as Project
                from tb_fmh_sales
                where year >= {$yearstart} and year <= {$yearend}
                group by Year
                Order by Year";
    // Die($query);
    $data = $this->db->query($query);
    $output=array(
        'data' => $data,
    );
    return $output;
}

Codeigniter Shield how to redirect seperate URL if the user not in group?

I’m trying to restrict users to access the administration area using Shield package Authorization group. everything works fine but it redirects to index page if the user not in group.

How i can redirect them to seperate page instead of redirecting to the index page ?

My code looks like :

$routes->group("admin", ["namespace" => "AdminControllers", "filter" => "group:admin"], static function ($routes) {
 
 
 
    $routes->get('entities', 'Entities::index');
    $routes->post('entities/create', 'Entities::create');
 
});

Create a live server using php

Regarding the Procentric IPTV Server, can a live external server be created to communicate with Procentric using PHP to deliver data server tokens, guest names, or room numbers?

I’ll try to use php to create a live server for Procentric IPTV.

EntityManager with createQuery()

With Symfony 3, I’ve often used the createQuery() function from the EntityManager so that I can use SQL statements.

Example:

$query = $em->createQuery("SELECT p FROM testcoreBundle:Product p JOIN p.productdetails d");

With the Update to Symfony 4 I need to change the entity. I tried the following but it doesnt work:

$query = $em->createQuery("SELECT p FROM :entity p JOIN p.productdetails d");
$query->setParameter('entity', Product::class);

Is there a way that I can still use full SQL statements with the QueryBuilder?

Symfony Mercure with Docker compose

I am trying to post private mercury updates, i follow the symfony documentation from near, as indicated I do this :

$update = new Update(
  'https://example.com/books/1',
   json_encode(['status' => 'OutOfStock']),
   true
);

 
$hub->publish($update);

My docker compose file :

 mercure:
  restart: unless-stopped
  image: dunglas/mercure
  environment:
    SERVER_NAME: :1337
    MERCURE_EXTRA_DIRECTIVES: |
      anonymous 0
      cors_origins https://localhost:8080
    MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
    MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
  ports:
    - 1337:1337
  volumes:
    - mercure_data:/data
    - mercure_config:/config

My project is in HTTPS but not the mercury hub.
At the time of publication I get this error message :

"Couldn't connect to server for "http://mercure/.well-known/mercure"."

I even tried this url :
http://localhost:1337/.well-known/mercure

but nothing changes.

I checked the generated jwt, I found that it is different from the one sent in the cookie, but even by putting a correct jwt manually I still have the same error

i have problem displaying data from database

here is an example of how it looks:

here is an example of how it looks

the hope is that I can display the data then be able to add the data to the new table

here is an example of how it looks:

here is an example of how it looks

<?php include "koneksi.php"; $sql="select * from po_list"; $hasil=mysqli_query($kon,$sql); $no=0;while ($data = mysqli_fetch_array($hasil)) {$no++; $ket="";if (isset($_GET['id'])) {$po_no = trim($_GET['po_no']); if ($po_no==$data['po_id']){$ket="selected";}} ?>
<?php $i = 1;if(isset($GET['po_no'])):$po_no=trim($_GET['po_no']);$order_items_qry = $conn->query("SELECT * FROM order_items where po_id = '{$row['id']}'");$sub_total = 0;while($row = $order_items_qry->fetch_assoc()):$sub_total += ($row['quantity'] * $row['unit_price']);?>

Laravel Passing parameter frontend required parameter for [Route: user.archive]

I have previously upgraded the version of my project to Laravel 8 and having a problem getting this error

Missing required parameter for [Route: user.archive] [URI:
user/archive/{id}] [Missing parameter: id]

this was the code that was calling the route and passing the parameters

 var url = "{{ route('user.archive', ['id' => '']) }}" + "/" + user_id;

it was working on my previous version of Laravel

is there other way i can pass the parameter user_id using frontend on routes?