File View Description as formatted/HTML

Hello, Does anyone know how to change the description field of an uploaded file as formatted/HTMl input instead of the normal text?

 

I'd like to insert screenshots and format the view of in the descriptions. 

 

 

Thanks!

Angelo

Quote · 9 Dec 2015

Find inc/classes/BXDolFilesDb.php

 

Around line 193, you'll see:

$sqlQuery .= "`{$this->aFileFields[$sKey]}`='" . process_db_input($sValue, BX_TAGS_STRIP) . "', ";

 

Change: BX_TAGS_STRIP

To: BX_TAGS_VALIDATE

 

Clear cache.

 

Keep in mind that this will also allow you to post descriptions in video, sound, photo, etc. description boxes too. It'll no longer strip away the html. It'll also allow your members to post html too (for better or worse).

 

I find the formatted text and the ability to post related affiliate links in that description box very beneficial.

Quote · 9 Dec 2015

You will find it useful until your members realize they can use html and start abusing it. Before facebook became as popular as it was, myspace was on top. The ability for members to use html caused a lot of problems for them. Eventually they had to start filtering it out. Hence the reason most social network sites no longer allow it.

You may be better off doing this.

if(isAdmin()) {

    $sqlQuery .= "`{$this->aFileFields[$sKey]}`='" . process_db_input($sValue, BX_TAGS_VALIDATE) . "', ";
} else {

    $sqlQuery .= "`{$this->aFileFields[$sKey]}`='" . process_db_input($sValue, BX_TAGS_STRIP) . "', ";

}

That way only admins can do it.

https://www.deanbassett.com
Quote · 9 Dec 2015

dean, that's even better! Making the change on all my sites.

Quote · 9 Dec 2015

or if I have to put the code ( isAdmin ()) because I have an error Parse error: syntax error, unexpected 'if' (T_IF), expecting function (T_FUNCTION) in)Frown

 

     }

        $sqlQuery .= "`{$this->sFileTable}` SET ";

        foreach ($aData as $sKey => $sValue) {

            if (array_key_exists($sKey, $this->aFileFields))

               $sqlQuery .= "`{$this->aFileFields[$sKey]}`='" . process_db_input($sValue, BX_TAGS_STRIP) . "', ";

        }

        return $this->query(trim($sqlQuery, ', ') . $sqlCond);

    }


Thank You

Quote · 12 May 2016

you have an idea?

Quote · 15 May 2016

The above solution from deano92964 still works perfect for me in v7.3.

Quote · 15 May 2016

 

The above solution from deano92964 still works perfect for me in v7.3.

 

no change on the description, or is the error?

------------------

       $aData['Hash'] = md5(microtime());

        }

        $sqlQuery .= "`{$this->sFileTable}` SET ";

        foreach ($aData as $sKey => $sValue) {

             if(isAdmin())

               $sqlQuery .= "`{$this->aFileFields[$sKey]}`='" . process_db_input($sValue, BX_TAGS_VALIDATE) . "', ";

               $sqlQuery .= "`{$this->aFileFields[$sKey]}`='" . process_db_input($sValue, BX_TAGS_STRIP) . "', ";

        }

        return $this->query(trim($sqlQuery, ', ') . $sqlCond);

    }

 

    function deleteData ($iFile)

Quote · 20 May 2016

Where is your else statement in the above? If admin, accept html description; else strip html from all others.

 

if(isAdmin()) {

    $sqlQuery .= "`{$this->aFileFields[$sKey]}`='" . process_db_input($sValue, BX_TAGS_VALIDATE) . "', ";
} else {

    $sqlQuery .= "`{$this->aFileFields[$sKey]}`='" . process_db_input($sValue, BX_TAGS_STRIP) . "', ";

}

Quote · 21 May 2016

Okay, change error

Parse error: syntax error, unexpected 'else' (T_ELSE) in /var/www/vhosts/msite/inc/classes/BxDolFilesDb.php on line 194


BxDolFilesDb.php · 12.9K · 157 downloads
Quote · 24 May 2016

Your missing a opening bracket { after if(isAdmin())

It should look exactly like this.

if (isAdmin()) {
    
$sqlQuery .= "`{$this->aFileFields[$sKey]}`='" process_db_input($sValueBX_TAGS_VALIDATE) . "', ";
} else {
    
$sqlQuery .= "`{$this->aFileFields[$sKey]}`='" process_db_input($sValueBX_TAGS_STRIP) . "', ";
}



https://www.deanbassett.com
Quote · 24 May 2016

Very good DeanoCool and thank you Launch3Smile

Quote · 31 May 2016
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.