Current File : //root/panel/modules/addmime/code/controller.ext.php |
<?php
/**
* @copyright 2014-2015 Sentora Project (http://www.sentora.org/)
* Sentora is a GPL fork of the ZPanel Project whose original header follows:
*
* ZPanel - A Cross-Platform Open-Source Web Hosting Control panel.
*
* @package ZPanel
* @version $Id$
* @author Bobby Allen - ballen@bobbyallen.me
* @copyright (c) 2008-2014 ZPanel Group - http://www.zpanelcp.com/
* @license http://opensource.org/licenses/gpl-3.0.html GNU Public License v3
*
* This program (ZPanel) is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class module_controller extends ctrl_module
{
static function gethelpicon()
{
global $zdbh;
global $controller;
$temp=$controller->GetControllerRequest('URL','module') ;
$val = '/assets/one.txt';
$val1 = '/modules/';
$name=file_get_contents("modules/$temp/assets/helpicon.txt");
return $name;
}
static function getmimetype()
{
ini_set("display_errors", true);
ini_set("error_reporting", E_ALL);
ini_set("memory_limit", "500M");
ini_set("max_execution_time", 0);
$d_path = "/etc/";
$m_path = $d_path . "mime.types";
$f_array = array();
$str_dis ="";
if (is_dir($d_path))
{
if (file_exists($m_path) && is_readable($m_path))
{
if ($m_file = fopen($m_path, "r"))
{
while (!feof($m_file))
{
$m_line = fgets($m_file);
$m_line = trim(preg_replace('/\s+/',' ', $m_line));
$m_line1 = str_replace(" ","",$m_line);
$len_s = strlen($m_line1);
if($len_s >0 )
{
$f_md = $m_line1[0];
if($f_md != "\n" && $f_md !="#" )
{
$m_string = explode(" ",$m_line);
$n_count = count($m_string);
if($n_count >1 )
{
$s_d = $n_count - 1;
$a_es = array_slice($m_string, 1, $s_d);
$d_cd = count($a_es);
$ext_d = "";
if ($d_cd > 0)
{
$ext_d = implode(" ", $a_es);
}
array_push($f_array,array('mime_name' =>$m_string[0],"mime_ext"=>$ext_d) );
}
}
}
}
fclose($m_file);
return $f_array;
}
else
{
return false;
}
}
else
{
return false;
}
}
else
{
return false;
}
}
}