I have a function
function getImg($img,$str,$input){
// dd($img);
$img_path = public_path().'/images/photos/devices/'.$img.'.jpg';
if(file_exists($img_path)){
if(strpos($input,$str)){
return $img;
}else{
return 'no-img';
}
}else{
return 'no-img';
}
}
Then, I call it like this
getImg('phone','phone',$input);
Why do I keep getting this error ?
Cannot redeclare App\getImg()
The whole function
public static function img($input){
$img_path = public_path().'/images/photos/devices/';
$images = scandir($img_path, 1);
$devices = [];
foreach($images as $i=>$image){
if($image != '.' && $image != '..' && $image != '.DS_Store'){
$name = str_replace('.jpg', '', $image);
$devices[$i]['name'] = $name;
}
}
// dd($devices);
// dd($input);
foreach ($devices as $i=>$device) {
$matches = array_filter($devices, function($device) use ($input) {
return strpos($input, $device['name']) !== FALSE;
});
if(count($matches) > 0){
foreach ($matches as $match) {
$input = $match['name'];
$img_path = public_path().'/images/photos/devices/'.$input.'.jpg';
if(file_exists($img_path)){
return $input;
}else{
return 'no-img';
}
}
}else{
// dd($input);
function getImg($img,$str,$input){
// dd($img);
$img_path = public_path().'/images/photos/devices/'.$img.'.jpg';
if(file_exists($img_path)){
if(strpos($input,$str)){
return $img;
}else{
return 'no-img';
}
}else{
return 'no-img';
}
}
getImg('phone','phone',$input);
getImg('ipad','ipad',$input);
getImg('iphone','iphone',$input);
// getImg('imac','imac');
}
}
}
Your function should be declared outside the foreach loop like so
function getImg($img,$str,$input){
// dd($img);
$img_path = public_path().'/images/photos/devices/'.$img.'.jpg';
if(file_exists($img_path)){
if(strpos($input,$str)){
return $img;
}else{
return 'no-img';
}
}else{
return 'no-img';
}
}
foreach ($devices as $i=>$device) {
..........
}
In PHP a function is always in the global scope, this is different from JavaScript, where functions in functions are common.
So when you call your function img a second time it will try to redeclare the function getImg.
You should define your function outside of the first one, or wrap it in :
if ( ! function_exists('getImg')) {
...declare function
}
From the doc:
All functions and classes in PHP have the global scope - they can be
called outside a function even if they were defined inside and vice
versa.
Related
I want to create anonymous functions and add them to the hook instead of using defined functions in the hooks.
Error:spl_object_hash() expects exactly 1 parameter, 2 given in D:server\www\deneme\sistem\kanca.php on line 313
Error Problem function benzersiz_Filtre_id() spl_object_hash function
Misuse: kanca_cek("panel_main",function(){ return "a";});
Normal use: kanca_cek("panel_main","db_filter");
function kanca_tak($ad,$fonksiyon,$onem=10,$deger=1){
return self::filtre_ekle($ad,$fonksiyon,$onem,$deger);
}
function kanca_sil($ad,$fonksiyon,$onem=10){
return self::filtre_sil($ad,$fonksiyon,$onem);
}
function tum_kancalari_sil($ad,$onem=false){
return self::tum_filtreleri_sil($ad,$onem);
}
function kanca_sor($ad,$fonksiyon_kontrol=false){
return self::filtre_sor($ad,$fonksiyon_kontrol);
}
function kanca_saydir($ad){
if(!isset($this->islemSayaci) || !isset($this->islemSayaci[$ad]))
return 0;
return $this->islemSayaci[$ad];
}
function islemSayaci($ad,$kanca=false){
$kancaSor=($kanca ? "kanca":"filtre");
if(isset($this->islemSayaci[$ad][$kancaSor]))
$this->islemSayaci[$ad][$kancaSor]++;
else
$this->islemSayaci[$ad][$kancaSor]=1;
}
function kanca_cek($ad,$deger=''){
$depo = array();
$uFv=array();
if (isset($this->filtreler['hepsi'])) {
$this->guncelFiltre[] = $ad;
$depo = func_get_args();
$this->tum_kancalari_cagir($depo);
}
if (!isset($this->filtreler[$ad])) {
if (isset($this->filtreler['hepsi']))
array_pop($this->guncelFiltre);
return;
}
if (!isset($this->filtreler['hepsi']))
$this->guncelFiltre[] = $ad;
if (is_array($deger) && 1 == count($deger) && isset($deger[0]) && is_object($deger[0])) // array(&$this)
$depo[] =& $deger[0];
elseif(!empty($deger))
$depo[] = $deger;
for ($a = 2; $a < func_num_args(); $a++)
$depo[] = func_get_arg($a);
// Sort
if (!isset($this->topluFiltreler[$ad])) {
ksort($this->filtreler[$ad]);
$this->topluFiltreler[$ad] = true;
}
self::islemSayaci($ad,true);
do {
foreach ((array) current($this->filtreler[$ad]) as $yaz){
/**
*#param $uFv değişkeni call_user_func_array fonksiyonunda kullanıcı tanımlı fonksiyona gönderilecek değerleri içerir
*#param accepted_args varsa ve gelen değer eğer dizeyse $uFv ile $yaz["accepted_args"] birleştirir $uFv değişkenine atar.
* #example call_user_func_array gönderilecek değerleri oluşturur.
*/
$uFv=array_slice($depo, 0, (int) $yaz['accepted_args']);
if(isset($yaz["accepted_args"]) && is_array($yaz["accepted_args"]))
$uFv=array_merge($uFv,$yaz["accepted_args"]);
if (isset($yaz['fonksiyon']) && !is_null($yaz['fonksiyon']))
call_user_func_array($yaz["fonksiyon"], $uFv);
// call_user_func_array($yaz['fonksiyon'], array_slice($depo, 0, (int) $yaz['accepted_args']));
}
} while (next($this->filtreler[$ad]) !== false);
array_pop($this->guncelFiltre);
}
function referans_diziyle_kancala($ad,$deger){
if (isset($this->filtreler['hepsi'])) {
$this->guncelFiltre[] = $ad;
$depo = func_get_args();
$this->tum_kancalari_cagir($depo);
}
if (!isset($this->filtreler[$ad])) {
if (isset($this->filtreler['hepsi']))
array_pop($this->guncelFiltre);
return;
}
if (!isset($this->filtreler['hepsi']))
$this->guncelFiltre[] = $tag;
// Sort
if (!isset($this->topluFiltreler[$ad])) {
ksort($this->filtreler[$ad]);
$this->topluFiltreler[$ad] = true;
}
reset($this->filtreler[$tag]);
do {
foreach ((array) current($this->filtreler[$ad]) as $yaz)
if (isset($yaz['fonksiyon']) && !is_null($yaz['fonksiyon']))
call_user_func_array($yaz['fonksiyon'], array_slice($deger, 0, (int) $yaz['accepted_args']));
} while (next($this->filtreler[$ad]) !== false);
array_pop($this->guncelFiltre);
}
function filtre_ekle($ad,$fonksiyon,$onem,$deger=1,$sadeceKelime=0){
$fk=($sadeceKelime ? $ad."_".password_hash(rand(0,10000),PASSWORD_DEFAULT):$fonksiyon);
$cId=self::benzersiz_Filtre_id($ad,$fk,$onem);
if($sadeceKelime){
$this->filtreler[$ad][$onem][$cId]=array(
'deger'=>$fonksiyon,
'accepted_args'=>$deger,
'sK'=>$sadeceKelime);
}
else{
$this->filtreler[$ad][$onem][$cId]=array(
'fonksiyon'=>$fonksiyon,
'accepted_args'=>$deger,
'sK'=>$sadeceKelime);
}
unset($this->topluFiltreler[$ad]);
}
function filtre_sil($ad,$fonksiyon,$onem=10){
$fSil = self::benzersiz_Filtre_id($ad, $fonksiyon, $onem);
$varMi = isset($this->filtreler[$ad][$onem][$fSil]);
if (true === $varMi) {
unset($this->filtreler[$ad][$onem][$fSil]);
if (empty($this->filtreler[$ad][$onem]))
unset($this->filtreler[$ad][$onem]);
unset($this->topluFiltreler[$ad]);
}
return $varMi;
}
function tum_filtreleri_sil($ad,$onem=false){
if (isset($this->filtreler[$ad])) {
if (false !== $onem && isset($this->filtreler[$ad][$onem]))
unset($this->filtreler[$ad][$onem]);
else
unset($this->filtreler[$ad]);
}
if (isset($this->topluFiltreler[$ad]))
unset($this->topluFiltreler[$ad]);
return true;
}
function filtre_sor($ad,$fonksiyon_kontrol=false){
$sor=!empty($this->filtreler[$ad]);
if($fonksiyon_kontrol===false || $sor==false)
return $sor;
if(!$idSor=self::benzersiz_Filtre_id($ad,$fonksiyon_kontrol,false))
return false;
foreach ((array) array_keys($this->filtreler[$ad]) as $onem) {
if (isset($this->filtreler[$ad][$onem][$idSor]))
return $onem;
}
return false;
}
function guncel_filtre(){
return end($this->guncelFiltre);
}
public function filtrele($ad, $deger)
{
$depo = array();
$dondur=null;
$uFv=array();//call_user_func_array gönderilen Dizisi
// Do 'all' actions first
if(isset($this->filtreler["all"]))
{
$this->guncelFiltre=$ad;
$depo=func_get_arg();
$this->tum_kancalari_cagir($depo);
}
if(!isset($this->filtreler[$ad]))
{
if(isset($this->filtreler["all"]))
array_pop($this->guncelFiltre);
return $deger;
}
if (!isset($this->filtreler['hepsi']))
$this->guncelFiltre[] = $ad;
// Sort
if (!isset($this->topluFiltreler[$ad])) {
ksort($this->filtreler[$ad]);
$this->topluFiltreler[$ad] = true;
}
if (empty($depo))
$depo = func_get_args();
$keySifirla = array_map('array_values', $this->filtreler[$ad]);
do {
$conDizi=(is_array($keySifirla) ? $keySifirla:(array) $KXC);
foreach (current($conDizi) as $kx=>$yaz){
if (isset($yaz['fonksiyon']) && !is_null($yaz['fonksiyon'])) {
$depo[1] = $deger;
}
if(isset($yaz["deger"])){
if(is_array($yaz["deger"])){
foreach($yaz["deger"] as $yK)
$deger[]=$yK;
}else{
$deger=$yaz["deger"];
}
}else{
if(is_callable($yaz["fonksiyon"]) && $yaz["fonksiyon"] instanceof Closure) {
$yaz["fonksiyon"]();
}
elseif(function_exists($yaz["fonksiyon"])){
/**
*#param $uFv değişkeni call_user_func_array fonksiyonunda kullanıcı tanımlı fonksiyona gönderilecek değerleri içerir
*#param accepted_args varsa ve gelen değer eğer dizeyse $uFv ile $yaz["accepted_args"] birleştirir $uFv değişkenine atar.
* #example call_user_func_array gönderilecek değerleri oluşturur.
*/
$uFv=array_slice($depo, 1, (int) $yaz['accepted_args']);
if(isset($yaz["accepted_args"]) && is_array($yaz["accepted_args"]))
$uFv=array_merge($uFv,$yaz["accepted_args"]);
$deger = call_user_func_array($yaz["fonksiyon"], $uFv);
}
else{
hata_ekle($yaz["fonksiyon"]." fonksiyonu bulunamadı.","hata");
return false;
}
}
}
} while (next($keySifirla) !== false);
array_pop($this->guncelFiltre);
self::islemSayaci($ad);
return $deger;
}
function referans_diziyle_filtrele($ad,$deger){
// Do 'all' actions first
if (isset($this->filtrele['all'])) {
$this->guncelFiltre[] = $ad;
$depo = func_get_args();
$this->tum_kancalari_cagir($depo);
}
if (!isset($this->filtrele[$ad])) {
if (isset($this->filtrele['all']))
array_pop($this->guncelFiltre);
return $deger[0];
}
if (!isset($this->filtrele['all']))
$this->guncelFiltre[] = $ad;
// Sort
if (!isset($this->topluFiltreler[$ad])) {
ksort($this->filtrele[$ad]);
$this->topluFiltreler[$ad] = true;
}
reset($this->filtrele[$ad]);
do {
foreach ((array) current($this->filtrele[$ad]) as $yaz)
if (isset($yaz['fonksiyon']) && !is_null($yaz['fonksiyon']))
$deger[0] = call_user_func_array($yaz['fonksiyon'], array_slice($deger, 0, (int) $deger['accepted_args']));
} while (next($this->filtrele[$ad]) !== false);
array_pop($this->guncelFiltre);
return $depo[0];
}
public function tum_kancalari_cagir($deger)
{
reset($this->filtreler['hepsi']);
do {
foreach ((array) current($this->filtreler['hepsi']) as $yaz)
if (isset($yaz['fonksiyon']) && !is_null($yaz['fonksiyon']))
call_user_func_array($yaz['fonksiyon'], $depo);
} while (next($this->filtreler['hepsi']) !== false);
}
function dumps(){
echo "<pre>";
print_r($this);
echo "</pre>";
}
function benzersiz_Filtre_id($ad,$fonksiyon,$onem){
static $idSaydir=0;
if(is_string($fonksiyon))
return $fonksiyon;
if(is_object($fonksiyon))
$fonksiyon=array($fonksiyon,'');
else
$fonksiyon=(array) $fonksiyon;
if(is_object($fonksiyon[0]))
{
if(function_exists('spl_object_hash')){
return spl_object_hash($fonksiyon[0],$fonksiyon[1]);
}else{
$nesneId=get_class($fonksiyon[0]).$fonksiyon[1];
if (!isset($fonksiyon[0]->filter_id)) {
if (false === $onem)
return false;
$nesneId .= isset($this->filtreler[$ad][$onem]) ? count((array) $$this->filtreler[$ad][$onem]) : $idSaydir;
$fonksiyon[0]->filter_id = $idSaydir;
++$idSaydir;
} else {
$nesneId .= $fonksiyon[0]->filter_id;
}
return $nesneId;
}
} else if (is_string($fonksiyon[0])) {
if(count($fonksiyon)>=2)
return $fonksiyon[0] . $fonksiyon[1];
else
return $fonksiyon[0];
}
}
}
Problem Function 313 line code
if(function_exists('spl_object_hash')){
return spl_object_hash($fonksiyon[0],$fonksiyon[1]);
}else{
$nesneId=get_class($fonksiyon[0]).$fonksiyon[1];
the function from which the error was received
function benzersiz_Filtre_id($ad,$fonksiyon,$onem){
static $idSaydir=0;
if(is_string($fonksiyon))
return $fonksiyon;
if(is_object($fonksiyon))
$fonksiyon=array($fonksiyon,'');
else
$fonksiyon=(array) $fonksiyon;
if(is_object($fonksiyon[0]))
{
if(function_exists('spl_object_hash')){
return spl_object_hash($fonksiyon[0],$fonksiyon[1]);
}else{
$nesneId=get_class($fonksiyon[0]).$fonksiyon[1];
if (!isset($fonksiyon[0]->filter_id)) {
if (false === $onem)
return false;
$nesneId .= isset($this->filtreler[$ad][$onem]) ? count((array) $$this->filtreler[$ad][$onem]) : $idSaydir;
$fonksiyon[0]->filter_id = $idSaydir;
++$idSaydir;
} else {
$nesneId .= $fonksiyon[0]->filter_id;
}
return $nesneId;
}
} else if (is_string($fonksiyon[0])) {
if(count($fonksiyon)>=2)
return $fonksiyon[0] . $fonksiyon[1];
else
return $fonksiyon[0];
}
}
As documented spl_object_hash requires only one argument.
So the part you are using is wrong
if(function_exists('spl_object_hash')){
return spl_object_hash($fonksiyon[0],$fonksiyon[1]);
}else{
$nesneId=get_class($fonksiyon[0]).$fonksiyon[1];
}
As you want the ID (hash) of one object, I suppose you mean
return spl_object_hash($fonksiyon);
// or
return spl_object_hash($fonksiyon[0]);
You can remove the function_exists part, because SPL is part of PHP since 5.0.
We built an API to directly access other social networks APIs using our keys.
I'm trying to build a fuction to access that API.
The default function has been written and is working.
Question
How can I specify a new array to target the json data?
This will override the default setting.
function SocialAPI($handle, $service, $path="") {
$handle = strtolower($handle);
$service = strtolower($service);
$api = file_get_contents("https://api.service.domain.com/v1/Social?handle=$handle&service=$service");
if($api !== false) {
$data = json_decode($api, true);
if($data !== null) {
if($service === "twitter") {
return $data['0']['followers_count'];
}
if($service === "instagram") {
if(!empty($path)) {
while($id = array_shift($path)) {
echo $data[$id];
}
return $data;
} else {
return $data['user']['followed_by']['count'];
}
}
} else {
return false;
}
} else {
return "API call failed.";
}
}
//Test API Function - ** TO BE DELETED **
echo SocialAPI("JohnDoe", "Instagram", "['user']['full_name']");
exit();
function array_deref($data, $keys) {
return empty($keys) ? $data
: array_deref($data[$keys[0]], array_slice($data, 1))
}
function SocialAPI($handle, $service, $path="") {
$handle = strtolower($handle);
$service = strtolower($service);
$api = file_get_contents("https://api.service.domain.com/v1/Social?handle=$handle&service=$service");
if ($api === false) {
return "API call failed.";
}
$data = json_decode($api, true);
if($data !== null) {
return false;
}
if ($service === "twitter") {
if (empty($path)) $path = ['0','followers_count'];
return array_deref($data, $path);
} elseif ($service === "instagram") {
if (empty($path)) $path = ['user','followed_by'];
return array_deref($data, $path);
}
}
//Test API Function - ** TO BE DELETED **
echo SocialAPI("JohnDoe", "Instagram", ['user', 'full_name']);
echo SocialAPI("JohnDoe", "Instagram");
exit();
I added a utility function, array_deref, to walk the arrays recursively (calls itself to handle each level down).
I tied it myself but it does not work for me. How to properly change for example this old code to be compatible with php 7.x?
class DbSimple_Generic
{
function& connect($dsn)
{
// Load database driver and create its instance.
$parsed = DbSimple_Generic::parseDSN($dsn);
if (!$parsed) {
$dummy = null;
return $dummy;
}
$class = 'DbSimple_'.ucfirst($parsed['scheme']);
if (!class_exists($class)) {
$file = str_replace('_', '/', $class) . ".php";
if ($f = #fopen($file, "r", true)) {
fclose($f);
require_once($file);
} else {
$base = basename($file);
$dir = dirname(__FILE__);
if (#is_file($path = "$dir/$base")) {
require_once($path);
} else {
trigger_error("Error loading database driver: no file $file in include_path; no file $base in $dir", E_USER_ERROR);
return null;
}
}
}
$object =& new $class($parsed);
if (isset($parsed['ident_prefix'])) {
$object->setIdentPrefix($parsed['ident_prefix']);
}
class DbSimple_Mysql_Blob extends DbSimple_Generic_Blob
{
var $blobdata = null;
var $curSeek = 0;
function DbSimple_Mysql_Blob(&$database, $blobdata=null)
{
$this->blobdata = $blobdata;
$this->curSeek = 0;
}
function read($len)
{
$p = $this->curSeek;
$this->curSeek = min($this->curSeek + $len, strlen($this->blobdata));
return substr($this->blobdata, $this->curSeek, $len);
}
function write($data)
{
$this->blobdata .= $data;
}
function close()
{
return $this->blobdata;
}
function length()
{
return strlen($this->blobdata);
}
}
function& _performNewBlob($blobid=null)
{
$obj =& new DbSimple_Mysql_Blob($this, $blobid);
return $obj;
}
I tried to use every possible way to make this work like this:
$object = new $class($parsed);
$object->method();
Becase it seems for PHP 7.x is this the most problematic part:
$object =& new $class($parsed);
But thisdid not work. I tried to find it on some PHP documentation but no luck so far. So how to properly rewrite this? Thank you
Using this on Ubuntu Server 64bit 16.04+ with Apache and mysql.
Probably it is a better idea to understand that function and rewrite in a cleaner way but please find below my changes, hopefully it helps.
class DbSimple_Generic
{
function connect($dsn)
{
// Load database driver and create its instance.
$parsed = DbSimple_Generic::parseDSN($dsn);
if (!$parsed) {
$dummy = null;
return $dummy;
}
$class = 'DbSimple_'.ucfirst($parsed['scheme']);
if (!class_exists($class)) {
$file = str_replace('_', '/', $class) . ".php";
if ($f = #fopen($file, "r", true)) {
fclose($f);
require_once($file);
} else {
$base = basename($file);
$dir = dirname(__FILE__);
if (#is_file($path = "$dir/$base")) {
require_once($path);
} else {
trigger_error("Error loading database driver: no file $file in include_path; no file $base in $dir", E_USER_ERROR);
return null;
}
}
}
$object = new $class($parsed);
if (isset($parsed['ident_prefix'])) {
$object->setIdentPrefix($parsed['ident_prefix']);
}
}
public static function parseDSN($dsn){ // public or private depends on what you intend to do
// implementation here...
}
public function setIdentPrefix($identPrefix){
// implementation here...
}
}
class DbSimple_Mysql_Blob extends DbSimple_Generic_Blob
{
var $blobdata = null;
var $curSeek = 0;
function __construct($blobdata=null) // use __construct for class constructor
{
$this->blobdata = $blobdata;
$this->curSeek = 0;
}
function read($len)
{
$p = $this->curSeek;
$this->curSeek = min($this->curSeek + $len, strlen($this->blobdata));
return substr($this->blobdata, $this->curSeek, $len);
}
function write($data)
{
$this->blobdata .= $data;
}
function close()
{
return $this->blobdata;
}
function length()
{
return strlen($this->blobdata);
}
}
function _performNewBlob($blobid=null)
{
$obj = new DbSimple_Mysql_Blob($blobid); // no need to use &
return $obj;
}
Just don't ever use =& operator. It's been useless since PHP 5.0 and removed in PHP 7.0:
http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.other.new-by-ref
You will find more things on that page that no longer work in PHP 7.
I'm trying to load a website url from a textfile, then unset this string from an array and pick a random website from the array.
But once I try to access the array from my function the array would return NULL, does someone know where my mistake is located at?
My current code looks like the following:
<?php
$activeFile = 'activeSite.txt';
$sites = array(
'http://wwww.google.com',
'http://www.ebay.com',
'http://www.icloud.com',
'http://www.hackforums.net',
'http://www.randomsite.com'
);
function getActiveSite($file)
{
$activeSite = file_get_contents($file, true);
return $activeSite;
}
function unsetActiveSite($activeSite)
{
if(($key = array_search($activeSite, $sites)) !== false)
{
unset($sites[$key]);
return true;
}
else
{
return false;
}
}
function updateActiveSite($activeFile)
{
$activeWebsite = getActiveSite($activeFile);
if(!empty($activeWebsite))
{
$unsetActive = unsetActiveSite($activeWebsite);
if($unsetActive == true)
{
$randomSite = $sites[array_rand($sites)];
return $randomSite;
}
else
{
echo 'Could not unset the active website.';
}
}
else
{
echo $activeWebsite . ' did not contain any active website.';
}
}
$result = updateActiveSite($activeFile);
echo $result;
?>
$sites is not avaliable in unsetActiveSite function you need to create a function called "getSites" which return the $sites array and use it in unsetActiveSite
function getSites(){
$sites = [
'http://wwww.google.com',
'http://www.ebay.com',
'http://www.icloud.com',
'http://www.hackforums.net',
'http://www.randomsite.com'
];
return $sites;
}
function unsetActiveSite($activeSite)
{
$sites = getSites();
if(($key = array_search($activeSite, $sites)) !== false)
{
unset($sites[$key]);
return true;
}
else
{
return false;
}
}
I have a function inside a class, and I would like to get the result of this function, something like:
Returned dangerous functions are: dl, system
Here is my code
public final function filterFile(){
$disabled_functions = ini_get('disable_functions');
$disFunctionsNoSpace = str_replace(' ', '', $disabled_functions);
$disFunctions = explode(',', $disFunctionsNoSpace);
$this->disFunctions = $disFunctions;
// get file content of the uploaded file (renamed NOT the temporary)
$cFile = file_get_contents($this->fileDestination, FILE_USE_INCLUDE_PATH);
$found = array();
foreach($this->disFunctions as $kkeys => $vvals)
{
if(preg_match('#'.$vvals.'#i', $cFile))
{
array_push($found, $vvals);
}
} // end foreach
} // end filterFile
// calling the class
$up = new uploadFiles($filename);
$fileterringFile = $up->filterFile();
print_r($fileterringFile);
var_dump($fileterringFile);
EDIT: add 2 functions for errors:
// check if any uErrors
public final function checkErrors(){
$countuErrors = count($this->uErrors);
if((IsSet($this->uErrors) && (is_array($this->uErrors) && ($countuErrors > 0))))
{
return true;
}
return false;
} // end checkErrors()
// print user errors
public final function printErrors(){
$countuErrors = count($this->uErrors);
if((IsSet($this->uErrors) && (is_array($this->uErrors) && ($countuErrors > 0))))
{
echo '<ul>';
foreach($this->uErrors as $uV)
{
echo '<li>';
echo $uV;
echo '</li>';
}
echo '</ul>';
}
} // end printErrors()
Thanks in advance
at the end of end filterFile, add:
return 'Returned dangerous functions are: '.implode(',',$found);