Example #1
0
 public function run()
 {
     $tpl = new template();
     $id = (int) $_GET['id'];
     if ($id > 0) {
         $lead = $this->getLead($id);
         // Comments
         $comments = new comments();
         if (isset($_POST['comment']) === true) {
             $values = array('text' => $_POST['text'], 'date' => date("Y-m-d H:i:s"), 'userId' => $_SESSION['userdata']['id'], 'moduleId' => $id, 'commentParent' => $_POST['father']);
             $comments->addComment($values, 'lead');
         }
         // files
         $file = new files();
         if (isset($_POST['upload'])) {
             if (isset($_FILES['file'])) {
                 $file->upload($_FILES, 'lead', $id);
                 $tpl->setNotification('FILE_UPLOADED', 'success');
             } else {
                 $tpl->setNotification('NO_FILE', 'error');
             }
         }
         $files = new files();
         $tpl->assign('files', $files->getFilesByModule('lead', $id));
         $tpl->assign('comments', $comments->getComments('lead', $id));
         $tpl->assign('contactInfo', $this->getLeadContact($id));
         $tpl->assign('lead', $lead);
     } else {
         $tpl->display('general.error');
     }
     $tpl->display('leads.showLead');
 }
Example #2
0
function clear_cache()
{
    $tmp_path = WEB_CACHE;
    //$tmp_my_path=dir($tmp_path);
    if (!class_exists('files')) {
        include_once WEB_INC . 'file.class.php';
    }
    $FS = new files();
    $FS->file_Delete($tmp_path);
}
Example #3
0
 public static function upload()
 {
     $dir = 'files/';
     $file = $_FILES['files'];
     $parts = explode('.', $file['name'][0]);
     $ext = strtolower(strtolower(end($parts)));
     $name = mb_strtolower(implode('.', array_slice($parts, 0, count($parts) - 1)));
     $name = files::fixname($name);
     $name = self::get_available_filename($dir, $name, $ext);
     $filename = $name . '.' . $ext;
     if (move_uploaded_file($file['tmp_name'][0], $dir . $filename)) {
         $finfo = new finfo(FILEINFO_MIME);
         $type = $finfo->file($dir . $filename);
         $mime = substr($type, 0, strpos($type, ';'));
         $file = ORM::factory('File');
         $file->filename = $name;
         $file->type = $mime;
         $file->ext = $ext;
         $file->created = time();
         try {
             $file->save();
             return $file;
         } catch (exception $e) {
             unlink($dir . $name);
             return false;
         }
     } else {
         return false;
     }
 }
Example #4
0
File: cache.php Project: rigidus/ea
 function save()
 {
     $content = ob_get_contents();
     ob_clean();
     files::write(self::$file, $content);
     echo $content;
 }
Example #5
0
    function siteMap()
    {
        db::table('pages');
        db::where('site_id', ADMIN_SITE_ID);
        db::where('page_map', '1');
        db::where('page_dynamic', '0');
        $res = db::select();
        $content = '';
        while ($row = mysql_fetch_assoc($res)) {
            $content .= '
<url>
	<loc>http://' . ADMIN_SITE . $row['page_folder'] . '</loc>
	<lastmod>' . substr($row['page_date'], 0, 10) . '</lastmod>
</url>';
        }
        $xml = '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">' . $content . '
</urlset>';
        if (files::write(ROOT . '/sitemap.xml', $xml)) {
            buffer::set('sitemap.xml успешно создан.');
        } else {
            buffer::set('Не удалось записать sitemap.xml.');
        }
    }
Example #6
0
File: dl.php Project: Nekrofage/FJR
function package_jeu($titre)
{
    global $phpbb_root_path, $phpEx, $areabb;
    // On est développeur et on veut le package de son mod
    load_function('lib.files');
    $package = new files();
    $name = 'AreaBB-jeux_' . $titre . '.pkg.gz';
    // on crée le package serialize
    $res = $package->makePackage($name, CHEMIN_JEU . $titre, CHEMIN_JEU, 1);
    // on l'enregistre dans un fichier
    if (($fp = fopen($phpbb_root_path . $areabb['chemin_pkg_jeux'] . $name, 'w')) !== false) {
        fwrite($fp, $res, strlen($res));
        fclose($fp);
    }
    return true;
}
Example #7
0
 public function action_edit()
 {
     $file = ORM::factory('file', $this->request->param('id'));
     if (!$file->loaded()) {
         notes::add('error', 'Filen blev ikke fundet!');
         cms::redirect('files');
     }
     if ($_POST) {
         $filename = arr::get($_POST, 'filename', '');
         if (empty($filename)) {
             $filename = $file->filename;
         }
         if ($filename != $file->filename) {
             $filename = files::fixname($filename);
             $filename = files::get_available_filename('files/', $filename, $file->ext);
             rename('files/' . $file->filename(), 'files/' . $filename . '.' . $file->ext);
             $versions = $file->versions->find_all();
             if ((bool) $versions->count()) {
                 foreach ($versions as $version) {
                     $version->delete();
                 }
             }
         }
         $file->filename = $filename;
         $file->alt = arr::get($_POST, 'alt', '');
         $file->description = arr::get($_POST, 'description', '');
         try {
             $file->save();
             cms::redirect('files/edit/' . $file->id);
         } catch (exception $e) {
             notes::add('error', 'Filen kunne ikke gemmes! Siden sagde: ' . $e->getMessage());
         }
     }
     $this->bind('file', $file);
 }
Example #8
0
 public function run()
 {
     $tpl = new template();
     $id = (int) $_GET['id'];
     if ($id > 0) {
         $lead = $this->getLead($id);
         $values = array('name' => $lead['name'], 'potentialMoney' => $lead['potentialMoney'], 'actualMoney' => $lead['actualMoney'], 'refSource' => $lead['refSource'], 'refValue' => $lead['refValue'], 'status' => $lead['status'], 'proposal' => $lead['proposal']);
         $clients = new clients();
         $dbClient = $clients->getClient($lead['clientId']);
         $client = array('name' => $dbClient['name'], 'street' => $dbClient['street'], 'zip' => $dbClient['zip'], 'city' => $dbClient['city'], 'state' => $dbClient['state'], 'country' => $dbClient['country'], 'phone' => $dbClient['phone'], 'email' => $dbClient['email'], 'internet' => $dbClient['internet']);
         if (isset($_POST['save'])) {
             if (isset($_FILES['file'])) {
                 if (htmlspecialchars($_FILES['file']['name']) !== '') {
                     $file = new files();
                     $file->upload($_FILES, 'lead', $id);
                 }
             }
             if (isset($_POST['name']) && isset($_POST['referralSource']) && isset($_POST['money']) && isset($_POST['status'])) {
                 $refValue = '';
                 if ($_POST['referralSource'] && $_POST['referralValueOther'] != '') {
                     $refValue = $_POST['referralValueOther'];
                 } else {
                     if ($_POST['referralSource'] == 5 && $_POST['referralValueClient'] > 0) {
                         $refValue = $_POST['referralValueClient'];
                     }
                 }
                 $values = array('name' => $_POST['name'], 'potentialMoney' => $_POST['money'], 'actualMoney' => $_POST['actualMoney'], 'refSource' => $_POST['referralSource'], 'refValue' => $refValue, 'status' => $_POST['status']);
                 $client = array('name' => $_POST['clientName'], 'street' => $_POST['street'], 'zip' => $_POST['zip'], 'city' => $_POST['city'], 'state' => $_POST['state'], 'country' => $_POST['country'], 'phone' => $_POST['phone'], 'email' => $_POST['email'], 'internet' => $_POST['internet']);
                 $this->editLead($values, $id);
                 $clients->editClient($client, $lead['clientId']);
                 $tpl->setNotification('EDIT_SUCCESS', 'success');
             } else {
                 $tpl->setNotification('MISSING_FIELDS', 'error');
             }
         }
         $tpl->assign('client', $client);
         $tpl->assign('lead', $values);
     } else {
         $tpl->display('general.error');
     }
     $client = new clients();
     $tpl->assign('status', $this->getStatus());
     $tpl->assign('referralSources', $this->getReferralSources());
     $tpl->assign('clients', $client->getAll());
     $tpl->display('leads.editLead');
 }
Example #9
0
 function isDeletable($f)
 {
     if (is_file($f)) {
         return is_writable(dirname($f));
     } elseif (is_dir($f)) {
         return is_writable(dirname($f)) && count(files::scandir($f)) <= 2;
     }
 }
 public function base()
 {
     $submit = isset($_GET['submit']) ? true : false;
     $link = isset($_GET['link']) ? $_GET['link'] : false;
     $message = 'Add the link below';
     if ($submit && $link) {
         $link_explode = explode('/', $link);
         $file = new files($this->getDb());
         $added = $file->select('*', 'WHERE link="' . $link . '"');
         if (!isset($added[0]['id'])) {
             $file->insert(array('name' => urldecode($link_explode[count($link_explode) - 1]), 'approved' => 0, 'downloaded' => 0, 'created' => time(), 'link' => $link));
             $message = 'Successfully Added! You can add another link below';
         } else {
             $message = 'This link is already in the index. You can add another link below';
         }
     }
     $this->set('message', $message);
 }
 /**
  * Ecrit un fichier avec les données envoyées en POST.
  *
  * @param string $sFilename
  * @return void
  */
 public function writeFileFromPost($sFilename)
 {
     if (!is_dir(dirname($sFilename))) {
         files::makeDir(dirname($sFilename), true);
     }
     $aValues = array_merge($this->getDefaultValues(), $this->getPostValues());
     $sFileContent = $this->getFileContent($aValues);
     file_put_contents($sFilename, $sFileContent);
 }
Example #12
0
 function getFile()
 {
     $file_id = params::get('file');
     $dir = FILES_ROOT . 'pages/';
     db::table('pages_files');
     db::where('file_id', $file_id);
     $file = db::assoc();
     $link = $dir . $file_id . '.' . $file['file_type'];
     files::downloadFile($link, $file['file_name'] . '.' . $file['file_type']);
 }
Example #13
0
 function upload()
 {
     $im = @getimagesize($_FILES["pic"]["tmp_name"]);
     if ($im[2]) {
         parent::upload();
     } else {
         $_SESSION["warning"] = "Файл <b>" . $_FILES["pic"]["name"] . "</b> не является графическим!";
         header("Location: ?chid={$this->chid}&dir={$this->dir}&w=1");
     }
 }
Example #14
0
 /**
  * Constructor.
  *
  * @param string $sLogDir
  */
 public function __construct($sLogDir = null)
 {
     if (is_null($sLogDir)) {
         $sLogDir = OKT_LOG_PATH;
     }
     $this->sLogDir = $sLogDir;
     if (!is_dir($this->sLogDir)) {
         files::makeDir($this->sLogDir, true);
     }
 }
Example #15
0
 public function index()
 {
     import('@.ORG.files');
     $files = files::files_tree('./doc', '.php');
     if (count($files)) {
         foreach ($files as $key => $value) {
             $this->sign_by_file($value);
             dump($value);
         }
     }
     echo 'done!';
 }
 /**
  * run - display template and edit data
  *
  * @access public
  */
 public function run()
 {
     $tpl = new template();
     $id = '';
     if (isset($_GET['id']) === true) {
         $id = (int) $_GET['id'];
     }
     $client = $this->getClient($id);
     if (empty($client) === false) {
         $file = new files();
         $project = new projects();
         $msgKey = '';
         if ($_SESSION['userdata']['role'] == 'admin') {
             $tpl->assign('admin', true);
         }
         if (isset($_POST['upload'])) {
             if (isset($_FILES['file'])) {
                 $msgKey = $file->upload($_FILES, 'client', $id);
             }
         }
         $comment = new comments();
         //Add comment
         if (isset($_POST['comment']) === true) {
             $mail = new mailer();
             $values = array('text' => $_POST['text'], 'date' => date("Y-m-d H:i:s"), 'userId' => $_SESSION['userdata']['id'], 'moduleId' => $id, 'commentParent' => $_POST['father']);
             $comment->addComment($values, 'client');
         }
         $tpl->assign('userClients', $this->getClientsUsers($id));
         $tpl->assign('comments', $comment->getComments('client', $id));
         $tpl->assign('imgExtensions', array('jpg', 'jpeg', 'png', 'gif', 'psd', 'bmp', 'tif', 'thm', 'yuv'));
         $tpl->assign('info', $msgKey);
         $tpl->assign('client', $client);
         $tpl->assign('clientProjects', $project->getClientProjects($id));
         $tpl->assign('files', $file->getFilesByModule('client'));
         //var_dump($file->getFilesByModule('client')); die();
         $tpl->display('clients.showClient');
     } else {
         $tpl->display('general.error');
     }
 }
Example #17
0
 function show()
 {
     $event = web::getEvent();
     if ($event === false) {
         $year = date('Y');
     } else {
         $year = $event;
     }
     s::set('info_date_select', htmlspecialchars($year));
     $sql = "SELECT `section_year` as date FROM `info_sections` WHERE `section_view`='0'  GROUP BY `date` ORDER BY `date` DESC";
     $res = db::query($sql);
     $rows = mysql_num_rows($res);
     if ($rows > 1) {
         s::add('info_date_selector', '<ul class="years">');
         while ($row = mysql_fetch_assoc($res)) {
             if ($row['date'] == $year) {
                 $row['date'] = '<li><span>' . $row['date'] . '</span></li>';
             } else {
                 $row['date'] = '<li><a href="' . web::get('page_folder') . '' . $row['date'] . '/">' . $row['date'] . '</a></li>';
             }
             s::add('info_date_selector', $row['date']);
         }
         s::add('info_date_selector', '</ul>');
     }
     $files = array();
     db::table('info_files');
     $r = db::select();
     while ($a = mysql_fetch_assoc($r)) {
         $files[$a['section_id']][] = $a;
     }
     db::table('info_sections');
     db::order('section_order', 'DESC');
     db::where('section_year', $year);
     $r = db::select();
     if (db::rows() == 0) {
         web::error404();
     }
     while ($a = mysql_fetch_assoc($r)) {
         if ($a['section_view'] == '0') {
             s::roll('sections', $a);
         } else {
             s::roll('sections_view', $a);
         }
         if (isset($files[$a['section_id']])) {
             foreach ($files[$a['section_id']] as $v) {
                 $v['file_icon'] = files::getFileIco($v['file_type']);
                 $v['file_size'] = files::parseSizeSmart($v['file_size']);
                 s::roll('items' . $a['section_id'], $v);
             }
         }
     }
 }
Example #18
0
 function getCleanContentType($contenttype, $filename = '')
 {
     global $FILE_LIB;
     if (isset($FILE_LIB['alias'][$contenttype])) {
         $contenttype = $FILE_LIB['alias'][$contenttype];
     }
     if ($contenttype == 'application/octet-stream' && $filename != '') {
         if (preg_match('/^(.*)\\.([^\\.]*)$/', $filename, $matches)) {
             $contenttype = files::getContentTypeFromExtension(strtolower($matches[2]));
         }
     }
     return $contenttype;
 }
 /**
  * Make basis directories
  *
  */
 protected function makeDirs()
 {
     if (file_exists($this->dir)) {
         throw new Exception(sprintf(__('m_development_bootstrap_module_allready_exists'), $this->id));
     }
     files::makeDir($this->dir);
     files::makeDir($this->dir . '/_install', true);
     files::makeDir($this->dir . '/_install/tpl', true);
     files::makeDir($this->dir . '/inc', true);
     files::makeDir($this->dir . '/inc/admin', true);
     files::makeDir($this->dir . '/locales', true);
     files::makeDir($this->dir . '/locales/fr', true);
     files::makeDir($this->dir . '/locales/en', true);
 }
Example #20
0
 function execute()
 {
     // Make views
     $files = new files($this->files->getClass());
     $files->setFeature("photo");
     $files->makeFile("crud/view.images", $this->directory . "/views/images.blade.php");
     // Change mainFoto input on read
     $analyzeFile = new analyzeFile($this->directory . "/views/create.blade.php");
     $analyzeFile->waitForFunctions();
     $search = 'name = \'{{$mainFoto}}\'';
     $search = $files->replace($search);
     $line = $analyzeFile->getLineWhere($search);
     $analyzeFile->changeLine($line, "");
     // Remove line
     $analyzeFile->changeLine($line + 1, "");
     $analyzeFile->changeLine($line - 1, "");
     $analyzeFile->changeLine($line - 2, "");
     $res = $analyzeFile->finishWait();
     $analyzeFile = new analyzeFile($this->directory . "/controllers/" . ucfirst($this->files->getClass()->id) . "Controller.php");
     $analyzeFile->waitForFunctions();
     $search = 'Input::get(\'{{$mainFoto}}\')';
     $search = $files->replace($search);
     $analyzeFile->replaceLineWhere($search, "");
     $res = $analyzeFile->finishWait();
     $analyzeFile = new analyzeFile($this->directory . "/views/edit.blade.php");
     $analyzeFile->waitForFunctions();
     $search = '{{$data->{{$mainFoto}}}}';
     $search = $files->replace($search);
     $line = $analyzeFile->getLineWhere($search);
     $analyzeFile->changeLine($line, "");
     // Remove line
     $analyzeFile->changeLine($line + 1, "");
     $analyzeFile->changeLine($line - 1, "");
     $analyzeFile->changeLine($line - 2, "");
     $res = $analyzeFile->finishWait();
     // add in Menu
     $analyzeFile = new analyzeFile("result/theme/views/layouts/master.blade.php");
     $analyzeFile->waitForFunctions();
     $search = '@if(Request::is(\'{{$id}}/*\') && isset($id))';
     $search = $files->replace($search);
     $add = '						<a href="{{url(\'{{$id}}/images\'.\'/\'.$id)}}">Images</a>';
     $add = $files->replace($add);
     $analyzeFile->addAfterLine($search, $add);
     $res = $analyzeFile->finishWait();
 }
Example #21
0
 function upload()
 {
     $dir = FILES_ROOT . 'all/';
     if (!empty($_FILES['file']['name'])) {
         $file_name = urldecode($_GET['file_name']);
         $file_type = files::info($_FILES['file']['name'], 'type');
         $file_size = files::info($_FILES['file']['tmp_name'], 'size');
         db::table('files');
         db::insert('', 'NOW()', $file_name, $file_type, $file_size);
         $file_id = mysql_insert_id();
         $file = $dir . $file_id . '.' . $file_type;
         copy($_FILES['file']['tmp_name'], $file);
         $file_icon = files::getFileIco($file_type);
         buffer::set('<p class="load"><img src="/i/fileicons/' . $file_icon . '.png" width="18" height="18" alt="" />&nbsp;<a href="/download/files/download/?file=' . $file_id . '">' . $file_name . '</a> <span>(' . $file_type . ', ' . round($file_size / 1000) . ' Кб)</span></p>');
     }
 }
Example #22
0
function packIt($name, $root, $fname, $save, $err_msg, &$err)
{
    # Cr.ation du pack
    if (($res = files::makePackage($name, $root . '/' . $name, $root . '/', 1)) !== false) {
        if ($save) {
            if (($fp = fopen('tmp/distrib/plugins/' . $fname, 'w')) !== false) {
                fwrite($fp, $res, strlen($res));
                fclose($fp);
            } else {
                $err = '<p>' . $err_msg . '</p>';
            }
        }
    } else {
        $err = '<p>' . $err_msg . '</p>';
    }
}
Example #23
0
 /**
  * Retourne les informations des fichiers d'un article
  *
  * @return array
  */
 public function getFilesInfo()
 {
     $files = array();
     if (!$this->okt->diary->config->files['enable']) {
         return $files;
     }
     $files_array = array_filter((array) unserialize($this->files));
     $j = 1;
     for ($i = 1; $i <= $this->okt->diary->config->files['number']; $i++) {
         if (!isset($files_array[$i]) || empty($files_array[$i]['filename']) || !file_exists($this->okt->diary->upload_dir . 'files/' . $files_array[$i]['filename'])) {
             continue;
         }
         $mime_type = files::getMimeType($this->okt->diary->upload_dir . 'files/' . $files_array[$i]['filename']);
         $files[$j] = array_merge(stat($this->okt->diary->upload_dir . 'files/' . $files_array[$i]['filename']), array('url' => $this->okt->diary->upload_url . 'files/' . $files_array[$i]['filename'], 'filename' => $files_array[$i]['filename'], 'title' => $files_array[$i]['title'], 'mime' => $mime_type, 'type' => util::getMediaType($mime_type), 'ext' => pathinfo($this->okt->diary->upload_dir . 'files/' . $files_array[$i]['filename'], PATHINFO_EXTENSION)));
         $j++;
     }
     return $files;
 }
 public function memoryAllocate($w, $h)
 {
     $mem_used = function_exists('memory_get_usage') ? @memory_get_usage() : 4000000;
     $mem_limit = @ini_get('memory_limit');
     if ($mem_used || $mem_limit) {
         $mem_limit = files::str2bytes($mem_limit);
         $mem_avail = $mem_limit - $mem_used - 512 * 1024;
         $mem_needed = $w * $h * 8;
         if ($mem_needed > $mem_avail) {
             if (@ini_set('memory_limit', $mem_limit + $mem_needed + $mem_used) === false) {
                 throw new Exception(__('Not enough memory to open image.'));
             }
             if (!$this->memory_limit) {
                 $this->memory_limit = $mem_limit;
             }
         }
     }
 }
Example #25
0
 /**
  * Retourne les informations des fichiers d'une question
  *
  * @param string $imageslist
  * @return 	array
  */
 function getFilesInfo()
 {
     $files_infos = array();
     $files = unserialize($this->files);
     foreach ($files as $locale => $files) {
         $files_infos[$locale] = array();
         $i = 0;
         foreach ($files as $file) {
             $path = $this->okt->faq->upload_dir . $file;
             $url = $this->okt->faq->upload_url . $file;
             if (!file_exists($path)) {
                 continue;
             }
             $mime_type = files::getMimeType($path);
             $files_infos[$locale][$i] = array_merge(stat($path), array('filename' => $file, 'path' => $path, 'url' => $url, 'mime' => $mime_type, 'type' => util::getMediaType($mime_type), 'ext' => pathinfo($path, PATHINFO_EXTENSION)));
             $i++;
         }
     }
     return $files_infos;
 }
Example #26
0
 /**
  * Récupération des informations de version sur le dépot distant.
  *
  */
 protected function getVersionInfo($sVersionType)
 {
     $this->resetVersionInfos();
     $sVersionType = $sVersionType == 'dev' ? 'dev' : 'stable';
     $this->sCacheFile = OKT_CACHE_PATH . '/releases/okatea-' . $sVersionType;
     # Check cached file
     if (is_readable($this->sCacheFile) && filemtime($this->sCacheFile) > strtotime($this->sCacheTtl)) {
         $c = @file_get_contents($this->sCacheFile);
         $c = @unserialize($c);
         if (is_array($c)) {
             $this->aVersionInfo = $c;
             return $this->aVersionInfo;
         }
     }
     $sCacheDir = dirname($this->sCacheFile);
     $bCanWrite = !is_dir($sCacheDir) && is_writable(dirname($sCacheDir)) || !file_exists($this->sCacheFile) && is_writable($sCacheDir) || is_writable($this->sCacheFile);
     # If we can't write file, don't bug host with queries
     if (!$bCanWrite) {
         return $this->aVersionInfo;
     }
     if (!is_dir($sCacheDir)) {
         try {
             files::makeDir($sCacheDir);
         } catch (Exception $e) {
             return $this->aVersionInfo;
         }
     }
     # Try to get latest version number
     try {
         $sFilename = $this->sRepositoryPath . '/packages/versions.xml';
         if (!file_exists($sFilename)) {
             throw new Exception('File version.xml not found.');
         }
         $this->readVersion(file_get_contents($this->sRepositoryPath . '/packages/versions.xml'), $sVersionType);
     } catch (Exception $e) {
         return $this->aVersionInfo;
     }
     # Create cache
     file_put_contents($this->sCacheFile, serialize($this->aVersionInfo));
     return $this->aVersionInfo;
 }
Example #27
0
function dc_admin_icon_url($img)
{
    global $core;
    $core->auth->user_prefs->addWorkspace('interface');
    $user_ui_iconset = @$core->auth->user_prefs->interface->iconset;
    if ($user_ui_iconset && $img) {
        $icon = false;
        if (preg_match('/^images\\/menu\\/(.+)$/', $img, $m) || preg_match('/^index\\.php\\?pf=(.+)$/', $img, $m)) {
            if ($m[1]) {
                $icon = path::real(dirname(__FILE__) . '/../../admin/images/iconset/' . $user_ui_iconset . '/' . $m[1], false);
                if ($icon !== false) {
                    $allow_types = array('png', 'jpg', 'jpeg', 'gif');
                    if (is_file($icon) && is_readable($icon) && in_array(files::getExtension($icon), $allow_types)) {
                        return DC_ADMIN_URL . 'images/iconset/' . $user_ui_iconset . '/' . $m[1];
                    }
                }
            }
        }
    }
    return $img;
}
Example #28
0
File: ini.php Project: rigidus/ea
 function write($array = false, $file = false, $sections = true)
 {
     if (!$file) {
         $file = self::$file;
     }
     if (!$array) {
         $array = self::$ini;
     }
     $string = '';
     if ($sections) {
         foreach (array_keys($array) as $key) {
             $string .= '[' . $key . "]\r\n";
             $string .= self::_write($array[$key], '') . "\r\n";
         }
     } else {
         foreach ($array as $k => $v) {
             $string .= self::__write($k, $v) . "\r\n";
         }
     }
     files::write($file, $string);
 }
Example #29
0
 function _save()
 {
     $file_id = params::get('item_id');
     $array = array('file_name' => params::get('file_name'), 'section_id' => params::get('section_id'));
     db::table('info_files');
     db::where('file_id', $file_id);
     db::update($array);
     $dir = FILES_ROOT . 'info/';
     if (!empty($_FILES['file']['name'])) {
         $file_size = $_FILES['file']['size'];
         $file_type = files::info($_FILES['file']['name'], 'type');
         $file_name = str_replace('.' . $file_type, '', $_FILES['file']['name']);
         $file = $dir . $_FILES['file']['name'];
         copy($_FILES['file']['tmp_name'], $file);
         $array = array('file_type' => $file_type, 'file_realname' => $file_name, 'file_size' => $file_size);
         db::table('info_files');
         db::where('file_id', $file_id);
         db::update($array);
     }
     headers::self();
 }
Example #30
0
 /**
  * Récupération des informations de version sur le dépot distant.
  *
  */
 public function getVersionInfo()
 {
     # Check cached file
     if (is_readable($this->sCacheFile) && filemtime($this->sCacheFile) > strtotime($this->sCacheTtl)) {
         $c = @file_get_contents($this->sCacheFile);
         $c = @unserialize($c);
         if (is_array($c)) {
             $this->aVersionInfo = $c;
             return;
         }
     }
     $sCacheDir = dirname($this->sCacheFile);
     $bCanWrite = !is_dir($sCacheDir) && is_writable(dirname($sCacheDir)) || !file_exists($this->sCacheFile) && is_writable($sCacheDir) || is_writable($this->sCacheFile);
     # If we can't write file, don't bug host with queries
     if (!$bCanWrite) {
         return;
     }
     if (!is_dir($sCacheDir)) {
         try {
             files::makeDir($sCacheDir);
         } catch (Exception $e) {
             return;
         }
     }
     # Try to get latest version number
     try {
         $sPath = '';
         $oClient = netHttp::initClient($this->sUrl, $sPath);
         if ($oClient !== false) {
             $oClient->setTimeout(4);
             $oClient->setUserAgent($_SERVER['HTTP_USER_AGENT']);
             $oClient->get($sPath);
             $this->readVersion($oClient->getContent());
         }
     } catch (Exception $e) {
     }
     # Create cache
     file_put_contents($this->sCacheFile, serialize($this->aVersionInfo));
 }