예제 #1
0
 function createFedoraDataStreams($form_values, &$dom, &$rootElement)
 {
     module_load_include('php', 'Fedora_Repository', 'mimetype');
     global $base_url;
     $mimetype = new mimetype();
     $server = null;
     $file = $form_values['ingest-file-location'];
     $dformat = $mimetype->getType($file);
     $fileUrl = $base_url . '/' . drupal_urlencode($file);
     $beginIndex = strrpos($fileUrl, '/');
     $dtitle = substr($fileUrl, $beginIndex + 1);
     $dtitle = substr($dtitle, 0, strpos($dtitle, "."));
     $ds1 = $dom->createElement("foxml:datastream");
     $ds1->setAttribute("ID", "COLLECTION_POLICY");
     //set the ID
     $ds1->setAttribute("STATE", "A");
     $ds1->setAttribute("CONTROL_GROUP", "M");
     $ds1v = $dom->createElement("foxml:datastreamVersion");
     $ds1v->setAttribute("ID", "COLLECTION_POLICY.0");
     $ds1v->setAttribute("MIMETYPE", "{$dformat}");
     $ds1v->setAttribute("LABEL", "{$dtitle}");
     $ds1content = $dom->createElement('foxml:contentLocation');
     $ds1content->setAttribute("REF", "{$fileUrl}");
     $ds1content->setAttribute("TYPE", "URL");
     $ds1->appendChild($ds1v);
     $ds1v->appendChild($ds1content);
     $rootElement->appendChild($ds1);
 }
예제 #2
0
function dirlist_view($config, $image = true)
{
    $files = get_file_list($config, $image);
    $file = false;
    if (isset($_GET['f']) && in_array($_GET['f'], $files)) {
        $file = $_GET['f'];
    } else {
        throw new Exception("File not specified");
    }
    if (!is_readable($config['target_dir'] . '/' . $file)) {
        throw new Exception("Can't read file: {$file}");
    }
    $content_type = false;
    if ($image) {
        if (function_exists('getimagesize')) {
            $info = getimagesize($config['target_dir'] . '/' . $file);
            if (!empty($info[2])) {
                $content_type = $info[2];
            }
        }
    }
    if (!$content_type) {
        $mimetype = new mimetype();
        $content_type = $mimetype->getType($config['target_dir'] . '/' . $file);
    }
    if ($content_type) {
        header("Content-type: {$content_type}");
    }
    readfile($config['target_dir'] . '/' . $file);
}
예제 #3
0
 function createFedoraDataStreams($form_values, &$dom, &$rootElement)
 {
     module_load_include('php', 'Fedora_Repository', 'mimetype');
     global $base_url;
     $mimetype = new mimetype();
     $server = null;
     $file = $form_values['ingest-file-location'];
     if (!empty($file)) {
         $dformat = $mimetype->getType($file);
         $fileUrl = $base_url . '/' . drupal_urlencode($file);
         $beginIndex = strrpos($fileUrl, '/');
         $dtitle = substr($fileUrl, $beginIndex + 1);
         $dtitle = urldecode($dtitle);
         //		$dtitle =  substr($dtitle, 0, strpos($dtitle, "."));
         $ds1 = $dom->createElement("foxml:datastream");
         $ds1->setAttribute("ID", "FULL_SIZE");
         $ds1->setAttribute("STATE", "A");
         $ds1->setAttribute("CONTROL_GROUP", "M");
         $ds1v = $dom->createElement("foxml:datastreamVersion");
         $rootElement->appendChild($ds1);
         $ds1v->setAttribute("ID", "FULL_SIZE.0");
         $ds1v->setAttribute("MIMETYPE", "{$dformat}");
         $ds1v->setAttribute("LABEL", "{$dtitle}");
         $ds1content = $dom->createElement('foxml:contentLocation');
         $ds1content->setAttribute("REF", "{$fileUrl}");
         $ds1content->setAttribute("TYPE", "URL");
         $ds1->appendChild($ds1v);
         $ds1v->appendChild($ds1content);
     }
     if (!empty($_SESSION['fedora_ingest_files'])) {
         foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) {
             $createdFile = strstr($createdFile, $file);
             $dformat = $mimetype->getType($createdFile);
             $fileUrl = $base_url . '/' . drupal_urlencode($createdFile);
             $beginIndex = strrpos($fileUrl, '/');
             $dtitle = substr($fileUrl, $beginIndex + 1);
             $dtitle = urldecode($dtitle);
             //				$dtitle =  substr($dtitle, 0, strpos($dtitle, "."));
             $dtitle = $dtitle;
             $ds1 = $dom->createElement("foxml:datastream");
             $ds1->setAttribute("ID", "{$dsid}");
             $ds1->setAttribute("STATE", "A");
             $ds1->setAttribute("CONTROL_GROUP", "M");
             $ds1v = $dom->createElement("foxml:datastreamVersion");
             $ds1v->setAttribute("ID", "{$dsid}.0");
             $ds1v->setAttribute("MIMETYPE", "{$dformat}");
             $ds1v->setAttribute("LABEL", "{$dtitle}");
             $ds1content = $dom->createElement('foxml:contentLocation');
             $ds1content->setAttribute("REF", "{$fileUrl}");
             $ds1content->setAttribute("TYPE", "URL");
             $ds1->appendChild($ds1v);
             $ds1v->appendChild($ds1content);
             $rootElement->appendChild($ds1);
         }
     }
 }
function custom_upload_mimes($existing_mimes = array())
{
    $mimetype = new mimetype();
    $file_types = get_option('ext');
    $variables = explode(' ', $file_types);
    foreach ($variables as $value) {
        $value = trim($value);
        if (!strstr($value, '/')) {
            $mime = $mimetype->privFindType($value);
        } else {
            $mime = $value;
        }
        $existing_mimes[$value] = $mime;
    }
    return $existing_mimes;
}
예제 #5
0
 function createFedoraDataStreams($form_values, &$dom, &$rootElement)
 {
     module_load_include('php', 'Fedora_Repository', 'mimetype');
     global $base_url;
     $mimetype = new mimetype();
     $server = null;
     $file = $form_values['ingest-file-location'];
     $dformat = $mimetype->getType($file);
     //$fileUrl = 'http://'.$_SERVER['HTTP_HOST'].$file;
     $fileUrl = $base_url . '/' . drupal_urlencode($file);
     $beginIndex = strrpos($fileUrl, '/');
     $dtitle = substr($fileUrl, $beginIndex + 1);
     $dtitle = substr($dtitle, 0, strpos($dtitle, "."));
     $ds1 = $dom->createElement("foxml:datastream");
     $ds1->setAttribute("ID", "FLV");
     $ds1->setAttribute("STATE", "A");
     $ds1->setAttribute("CONTROL_GROUP", "M");
     $ds1v = $dom->createElement("foxml:datastreamVersion");
     $ds1v->setAttribute("ID", "FLV.0");
     $ds1v->setAttribute("MIMETYPE", "{$dformat}");
     $ds1v->setAttribute("LABEL", "{$dtitle}");
     $ds1content = $dom->createElement('foxml:contentLocation');
     $ds1content->setAttribute("REF", "{$fileUrl}");
     $ds1content->setAttribute("TYPE", "URL");
     $ds1->appendChild($ds1v);
     $ds1v->appendChild($ds1content);
     $rootElement->appendChild($ds1);
     $createdFile = drupal_get_path('module', 'Fedora_Repository') . '/images/flashThumb.jpg';
     $fileUrl = $base_url . '/' . drupal_urlencode($createdFile);
     //'http://'.$_SERVER['HTTP_HOST'].'/'.$createdFile;
     $ds1 = $dom->createElement("foxml:datastream");
     $ds1->setAttribute("ID", "TN");
     $ds1->setAttribute("STATE", "A");
     $ds1->setAttribute("CONTROL_GROUP", "M");
     $ds1v = $dom->createElement("foxml:datastreamVersion");
     $ds1v->setAttribute("ID", "TN.0");
     $ds1v->setAttribute("MIMETYPE", "image/jpeg");
     $ds1v->setAttribute("LABEL", "Thumbnail");
     $ds1content = $dom->createElement('foxml:contentLocation');
     $ds1content->setAttribute("REF", "{$fileUrl}");
     $ds1content->setAttribute("TYPE", "URL");
     $ds1->appendChild($ds1v);
     $ds1v->appendChild($ds1content);
     $rootElement->appendChild($ds1);
 }
예제 #6
0
 function add_datastream_from_file($datastream_file, $datastream_id, $datastream_label = null, $datastream_mimetype = '', $controlGroup = 'M')
 {
     module_load_include('php', 'fedora_repository', 'mimetype');
     if (empty($datastream_mimetype)) {
         // Get mime type from the file extension.
         $mimetype_helper = new mimetype();
         $datastream_mimetype = $mimetype_helper->getType($datastream_file);
     }
     $original_path = $datastream_file;
     // Temporarily move file to a web-accessible location.
     file_copy($datastream_file, file_directory_path());
     $datastream_url = drupal_urlencode($datastream_file);
     $url = file_create_url($datastream_url);
     $return_value = $this->add_datastream_from_url($url, $datastream_id, $datastream_label, $datastream_mimetype, $controlGroup);
     if ($original_path != $datastream_file) {
         file_delete($datastream_file);
     }
     return $return_value;
 }
예제 #7
0
 function isAllowedMineType()
 {
     global $wfsConfig;
     $mimetype = new mimetype();
     //foreach(explode(" ", $wfsConfig['selmimetype']) as $type)
     foreach (explode(" ", $wfsConfig['selmimetype']) as $type) {
         if ($this->minetype == $mimetype->privFindType($type)) {
             return TRUE;
         }
     }
     return false;
 }
 /**
  * Get the markup for the publication download links.
  *
  * @see mimetype
  *
  * @uses WP_Publication_Archive::get_image()
  * @uses WP_Publication_Archive::get_open_link()
  * @uses WP_Publication_Archive::get_download_link()
  *
  * @return string
  */
 public function get_the_uri()
 {
     $mime = new mimetype();
     $uri = $this->get_the_link();
     if ('' == trim($uri)) {
         return '';
     }
     $output = '<div class="publication_download">';
     //	$output .= '<span class="title">' . __( 'Download:', 'wp_pubarch_translate' ) . ' </span>';
     $output .= '<span class="description">';
     $output .= '<img height="16" width="16" alt="download" src="' . WP_Publication_Archive::get_image($mime->getType($this->uri)) . '" /> ';
     $output .= '<a ';
     if (apply_filters('wp_pubarch_open_in_blank', false)) {
         $output .= 'target="_blank" ';
     }
     $output .= 'href="' . WP_Publication_Archive::get_open_link($this->ID) . '">';
     $output .= __('Open', 'wp_pubarch_translate') . '</a> | ';
     $output .= '<a href="' . WP_Publication_Archive::get_download_link($this->ID) . '">';
     $output .= __('Download', 'wp_pubarch_translate') . '</a>';
     $output .= '</span>';
     $output .= '</div>';
     return $output;
 }
예제 #9
0
function get_mimetype($minetype)        ## Get the icon from the filename
{
 	global $wfsConfig;
	$mimetype = new mimetype();
    echo $minetype; 	
	foreach(explode(" ", $wfsConfig['selmimetype']) as $type)
  		echo $mimetype->privFindType($type)."<br />";
		if ($minetype === $mimetype->privFindType($type))
   	return TRUE;

return FALSE;
}
예제 #10
0
	
	$sform->insertBreak("<tr class = bg3><td >"._AM_ADMINCONFIGMENU."</td><td></td></tr>");
		
	$notifysubmit_radio = new XoopsFormRadioYN(_AM_NOTIFYSUBMIT, 'notifysubmit', $wfsConfig['notifysubmit'], ' Yes', ' No');
	$sform->addElement($notifysubmit_radio);											
	
	$anonpost_radio = new XoopsFormRadioYN(_AM_ANONPOST, 'anonpost', $wfsConfig['anonpost'], ' Yes', ' No');
	$sform->addElement($anonpost_radio);
	
	$autoapprove_radio = new XoopsFormRadioYN(_AM_AUTOAPPROVE, 'autoapprove', $wfsConfig['autoapprove'], ' Yes', ' No');
	$sform->addElement($autoapprove_radio);
	
	$webmstonly_radio = new XoopsFormRadioYN(_AM_WEBMASTONLY, 'webmstonly', $wfsConfig['webmstonly'], ' Yes', ' No');
	$sform->addElement($webmstonly_radio);
	
	$graph_array =& mimetype::privBuildMimeArray();
	$indeximage_select = new XoopsFormSelect('', 'selmimetype', getGroupIda($wfsConfig['selmimetype']), 20, true);
	$indeximage_select->addOptionArray($graph_array);
	$indeximage_tray = new XoopsFormElementTray(_AM_ALLOWEDMIMETYPES, '');
	$indeximage_tray->addElement($indeximage_select);
	$sform->addElement($indeximage_tray);
	
	$sform->addElement(new XoopsFormText(_AM_UPLOADFILESIZE, 'filesize', 8, 8, $wfsConfig['filesize']));
	$sform->addElement(new XoopsFormText(_AM_FILEMODE, 'wfsmode', 4, 4, $wfsConfig['wfsmode']));
	$sform->addElement(new XoopsFormText(_AM_IMGHEIGHT, 'imgheight', 5, 5, $wfsConfig['imgheight']));
	$sform->addElement(new XoopsFormText(_AM_IMGWIDTH, 'imgwidth', 5, 5, $wfsConfig['imgwidth']));
		
	$defaults_radio = new XoopsFormRadioYN(_AM_DEFAULTS, 'defaults', 0, ' Yes', ' No');
	$sform->addElement($defaults_radio);
			
	$button_tray = new XoopsFormElementTray('','');
 /**
  * Filter WordPress' request so that we can send a redirect to the file if it's requested.
  *
  * @uses apply_filters() Calls 'wppa_download_url' to get the download URL.
  * @since 2.5
  */
 public static function download_file()
 {
     global $wp_query;
     // If this isn't the right kind of request, bail.
     if (!isset($wp_query->query_vars['wppa_download'])) {
         return;
     }
     $uri = get_post_meta($wp_query->post->ID, 'wpa_upload_doc', true);
     // Strip the old http| and https| if they're there
     $uri = str_replace('http|', 'http://', $uri);
     $uri = str_replace('https|', 'https://', $uri);
     $uri = apply_filters('wppa_download_url', $uri);
     if (apply_filters('wppa_mask_url', true)) {
         // Fetch the file from the remote server.
         $request = wp_remote_get($uri, array('sslverify' => false));
         if (!is_wp_error($request)) {
             $mime = new mimetype();
             $file = wp_remote_retrieve_body($request);
             $headers = wp_remote_retrieve_headers($request);
             $last_modified = isset($headers['last-modified']) ? $headers['last-modified'] : 'Wed, 9 Nov 1983 05:00:00 GMT';
             $content_type = isset($headers['content-type']) ? $headers['content-type'] : $mime->getType(basename($uri));
             header('HTTP/1.1 200 OK');
             header('Expires: Wed, 9 Nov 1983 05:00:00 GMT');
             header('Content-Disposition: attachment; filename=' . basename($uri));
             header('Last-Modified: ' . $last_modified);
             header('Content-type: ' . $content_type);
             header('Content-Transfer-Encoding: binary');
             echo $file;
         } else {
             header('HTTP/1.1 500 Internal Server Error');
         }
     } else {
         header('HTTP/1.1 303 See Other');
         header('Location: ' . $uri);
     }
     exit;
 }
# This file is part of Exponent
#
# Exponent 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 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
// Part of the Administration Control Panel : Files Subsystem category
if (!defined('EXPONENT')) {
    exit('');
}
if (exponent_permissions_check('files_subsystem', exponent_core_makeLocation('administrationmodule'))) {
    $type = null;
    if (isset($_POST['oldmime'])) {
        $type = $db->selectObject('mimetype', "mimetype='" . $_POST['oldmime'] . "'");
    }
    $is_existing = $type != null;
    $type = mimetype::update($_POST, $type);
    if ($is_existing) {
        $db->updateObject($type, 'mimetype', "mimetype='" . $type->mimetype . "'");
    } else {
        $db->insertObject($type, 'mimetype');
    }
    exponent_flow_redirect();
} else {
    echo SITE_403_HTML;
}
예제 #13
0
 function editform()
 {
     global $xoopsModule, $HTTP_SERVER_VARS, $HTTP_POST_VARS, $groupid, $myts, $xoopsConfig, $xoopsUser, $xoopsDB, $textareaname, $wfsConfig;
     include XOOPS_ROOT_PATH . "/include/xoopscodes.php";
     $textareaname = '';
     //$maintext = '';
     echo "<table width='100%' border='0' cellspacing='0' cellpadding='1'>";
     echo "<table><tr><td><form action='index.php' method='post' name='coolsus'>";
     echo "<div><b>" . _AM_GROUPPROMPT . "</b><br />";
     if (isset($this->groupid)) {
         listGroups($this->groupid);
     } else {
         listGroups();
     }
     echo "<br />";
     echo "</div><br />";
     echo "<div><b>" . _WFS_CATEGORY . "</b><br>";
     $xt = new WfsCategory();
     if (isset($this->categoryid)) {
         $xt->makeSelBox(0, $this->categoryid, "categoryid");
     } else {
         $xt->makeSelBox(0, 0, "categoryid");
     }
     echo "</div><br />";
     echo "<div><b>" . _AM_ARTICLEWEIGHT . "</b><br />";
     echo "<input type='text' name='weight' id='weight' value='";
     if (isset($this->weight)) {
         echo $this->weight("F");
     } else {
         $this->weight = 0;
         echo $this->weight("F");
     }
     echo "' size='5' /></div><br>";
     echo "<div>" . _WFS_CAUTH . "<br></div>";
     echo "<div><select name='changeuser'>";
     echo "<option value='-1'>------</option>";
     $result = $xoopsDB->query("SELECT uid, uname FROM " . $xoopsDB->prefix("users") . " ORDER BY uname");
     while (list($uid, $uname) = $xoopsDB->fetchRow($result)) {
         if ($uid == $this->uid) {
             $opt_selected = "selected='selected'";
         } else {
             $opt_selected = "";
         }
         echo "<option value='" . $uid . "' {$opt_selected}>" . $uname . "</option>";
     }
     echo "</select></div><br />";
     echo "<div><b>" . _WFS_TITLE . "</b><br />";
     echo "<input type='text' name='title' id='title' value='";
     if (isset($this->title)) {
         if ($this->titleFlag) {
             echo $this->title("F");
         } else {
             echo $this->title("E");
         }
     }
     echo "' size='50' /></div><br />";
     //HTML Page Seclection//
     echo "<div><b>" . _WFS_HTMLPAGE . "</b></div>";
     //echo " <b>HTML Path: </b>".$htmlpath."<br /><br /></div>";
     $html_array = XoopsLists::getFileListAsArray(XOOPS_ROOT_PATH . '/' . $wfsConfig['htmlpath']);
     echo "<div><select size='1' name='htmlpage'>";
     echo "<option value=' '>------</option>";
     foreach ($html_array as $htmlpage) {
         if ($htmlpage == $this->htmlpage()) {
             $opt_selected = "selected='selected'";
         } else {
             $opt_selected = "";
         }
         echo "<option value='" . $htmlpage . "' {$opt_selected}>" . $htmlpage . "</option>";
     }
     echo "</select>";
     $htmlpath = XOOPS_ROOT_PATH . '/' . $wfsConfig['htmlpath'];
     echo " <b>HTML Path: </b>" . $htmlpath . "<br /><br /></div>";
     //echo "</div><br />";
     echo "<div><b>" . _WFS_MAINTEXT . "</b></div>";
     if (isset($this->maintext)) {
         if ($this->maintextFlag) {
             $GLOBALS['maintext'] = $this->maintext("F");
         } else {
             $GLOBALS['maintext'] = $this->maintext("E");
         }
     }
     if (!strstr($HTTP_SERVER_VARS["HTTP_USER_AGENT"], "MSIE")) {
         $wfsConfig['wysiwygeditor'] = '0';
     }
     if ($wfsConfig['wysiwygeditor'] == '1') {
         html_editor('maintext');
         $smiliepath = $wfsConfig['smiliepath'];
         $smilie_array = XoopsLists::getimgListAsArray(XOOPS_ROOT_PATH . "/" . $smiliepath);
         echo "<br /><div style='text-align: left;'><b>" . _AM_SMILIE . "</b><br />";
         echo "<table><tr><td align='top' valign='left'>";
         echo "<div><script type='text/javascript'>\n\t\t<!--\n\t\t\tfunction showbutton() {\n\t\t\t   \tdocument.all." . $textareaname . "_mysmile.src = '" . $xoopsConfig['xoops_url'] . "/{$smiliepath}/' + document.all." . $textareaname . "_smiley.value;\n\t\t\t}\n\t\t// -->\n\t\t</script>";
         echo "<select name='" . $textareaname . "_smiley' onchange='showbutton();'>";
         foreach ($smilie_array as $file) {
             echo "<option value='" . $file . "' {$opt_selected}>" . $file . "</option>";
         }
         echo "</select></td><td align='top' valign='left'>";
         echo "<img name='" . $textareaname . "_mysmile' src='" . $xoopsConfig['xoops_url'] . "/{$smiliepath}/{$file}' style='cursor:hand;' border='0' onclick=\"doFormat('InsertImage', document.all." . $textareaname . "_mysmile.src);\" />";
         echo "</td></tr></table>\n\t\t<script type='text/javascript'>\n\t\t\tshowbutton();\n\t\t</script>";
         //Start of article images
         $graphpath = $wfsConfig['graphicspath'];
         $graph_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/" . $graphpath);
         echo "<br><div style='text-align: left;'><b>" . _AM_GRAPHIC . "</b><br />";
         echo "<table><tr><td align='top' valign='left'>";
         echo "<script type='text/javascript'>\n\t\t<!--\n\t\t\tfunction showbutton2() {\n\t\t\t\tdocument.all." . $textareaname . "_mygraph.src = '" . $xoopsConfig['xoops_url'] . "/{$graphpath}/' + document.all." . $textareaname . "_graph.value;\n\t\t\t}\n\t\t// -->\n\t\t</script>";
         echo "<select name='" . $textareaname . "_graph' onchange='showbutton2();'>";
         foreach ($graph_array as $file2) {
             echo "<option value='" . $file2 . "' {$opt_selected}>" . $file2 . "</option>";
         }
         echo "</select></td><td align='top' valign='left'>";
         echo "<img name='" . $textareaname . "_mygraph' src='" . $xoopsConfig['xoops_url'] . "/{$graphpath}/{$file2}' style='cursor:hand;' border='0' onclick=\"doFormat('InsertImage', document.all." . $textareaname . "_mygraph.src);\" />";
         echo "</td></tr></table>\n\t\t<script type='text/javascript'>\n\t\t\tshowbutton2();\n\t\t</script>";
     } else {
         xoopsCodeTarea("maintext", 60, 15);
         xoopsSmilies("maintext");
     }
     echo "<div><b>" . _WFS_SUMMARY . "</b></div>";
     echo "<div><textarea id='summary' name='summary' wrap='virtual' cols='60' rows='5'>";
     if (isset($this->summary)) {
         if ($this->summaryFlag) {
             echo $this->summary("F");
         } else {
             echo $this->summary("E");
         }
     }
     echo "</textarea></div>";
     echo "<div class = 'bg3'><h4>" . _WFS_ARTICLELINK . "</h4></div>";
     echo "<div><b>" . _WFS_LINKURL . "</b><br />";
     echo "<input type='text' name='url' id='url' value='";
     if (isset($this->url)) {
         echo $this->url("F");
     }
     echo "' size='70' /></div><br />";
     echo "<div><b>" . _WFS_LINKURLNAME . "</b><br />";
     echo "<input type='text' name='urlname' id='urlname' value='";
     if (isset($this->urlname)) {
         echo $this->urlname("F");
     }
     echo "' size='50' /></div><br>";
     echo "<div class = 'bg3'><h4>" . _WFS_ATTACHEDFILES . "</h4></div>";
     echo "<div>" . _WFS_ATTACHEDFILESTXT . "</div><br />";
     if (empty($this->articleid)) {
         echo _WFS_AFTERREGED . "<br />";
     } elseif ($num = $this->getFilesCount()) {
         echo "<table border='1' style='border-collapse: collapse' bordercolor='#ffffff' width='100%' >";
         echo "<tr class='bg3'><td align='center'>" . _AM_FILEID . "</td><td align='center'>" . _AM_FILEICON . "</td><td align='center'>" . _AM_FILESTORE . "</td><td align='center'>" . _AM_REALFILENAME . "</td><td align='center'>" . _AM_USERFILENAME . "</td><td align='center' class='nw'>" . _AM_FILEMIMETYPE . "</td><td align='center' class='nw'>" . _AM_FILESIZE . "</td><td align='center'>" . _AM_ACTION . "</td></tr>";
         foreach ($this->files as $attached) {
             if (is_file(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $attached->getFileRealName())) {
                 $filename = $attached->getFileRealName();
             } else {
                 $filename = "File Error!";
             }
             $fileid = $attached->getFileid();
             $mimetype = new mimetype();
             $icon = get_icon(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename);
             $iconshow = "<img src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/" . $icon . " align='middle'>";
             if (is_file(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename)) {
                 $size = Prettysize(filesize(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename));
             } else {
                 $size = '0';
             }
             $filerealname = $attached->downloadname;
             $mimeshow = $mimetype->getType(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename);
             $counter = $attached->getCounter();
             $linkedname = $attached->getFileShowName();
             //$linkedname = $attached->getLinkedName(XOOPS_URL."/modules/".$xoopsModule->dirname()."/download.php?fileid=");
             $editlink = "<a href='index.php?op=fileedit&amp;fileid=" . $fileid . "'>" . _AM_EDIT . "</a>";
             $dellink = "<a href='index.php?op=delfile&amp;fileid=" . $fileid . "'>" . _AM_DELETE . "</a>";
             echo "<tr><td align='center'><b>" . $fileid . "</b>";
             echo "</td><td align='center'>" . $iconshow . "";
             echo "</td><td align='center'>" . $filename . "";
             echo "</td><td align='center'>" . $filerealname . "";
             echo "</td><td align='center'>" . $linkedname . "";
             echo "</td><td align='center'>" . $mimeshow . "";
             echo "</td><td align='center'>" . $size . "";
             //echo "</td><td align='center' class='nw'>".$counter."";
             echo "</td><td align='center'>" . $editlink . " " . $dellink . "";
             echo "</td></tr>";
         }
         echo "</table>";
     } else {
         echo "<div align='left'>" . _WFS_NOFILE . "</div>";
     }
     echo "</div><br />";
     echo "<div class = 'bg3'><h4>" . _WFS_MISCSETTINGS . "</h4></div>";
     echo "<input type='checkbox' name='autodate' value='1'";
     if (isset($autodate) && $autodate == 1) {
         echo " checked='checked'";
     }
     echo "> ";
     $time = time();
     if (!empty($this->articleid)) {
         $isedit = 1;
     }
     if (isset($isedit) && $isedit == 1 && $this->published > $time) {
         echo "<b>" . _AM_CHANGEDATETIME . "</b><br /><br />";
         printf(_AM_NOWSETTIME, formatTimestamp($this->published));
         $published = xoops_getUserTimestamp($this->published);
         echo "<br /><br />";
         printf(_AM_CURRENTTIME, formatTimestamp($time));
         echo "<br />";
         echo "<input type='hidden' name='isedit' value='1' />";
     } else {
         echo "<b>" . _AM_SETDATETIME . "</b><br /><br />";
         printf(_AM_CURRENTTIME, formatTimestamp($time));
         echo "<br />";
     }
     echo "<br /> &nbsp; " . _AM_MONTHC . " <select name='automonth'>";
     if (isset($automonth)) {
         $automonth = intval($automonth);
     } elseif (isset($this->published)) {
         $automonth = date('m', $this->published);
     } else {
         $automonth = date('m');
     }
     for ($xmonth = 1; $xmonth < 13; $xmonth++) {
         if ($xmonth == $automonth) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xmonth}' {$sel}>{$xmonth}</option>";
     }
     echo "</select>&nbsp;";
     echo _AM_DAYC . " <select name='autoday'>";
     if (isset($autoday)) {
         $autoday = intval($autoday);
     } elseif (isset($published)) {
         $autoday = date('d', $this->published);
     } else {
         $autoday = date('d');
     }
     for ($xday = 1; $xday < 32; $xday++) {
         if ($xday == $autoday) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xday}' {$sel}>{$xday}</option>";
     }
     echo "</select>&nbsp;";
     echo _AM_YEARC . " <select name='autoyear'>";
     if (isset($autoyear)) {
         $autoyear = intval($autoyear);
     } elseif (isset($this->published)) {
         $autoyear = date('Y', $this->published);
     } else {
         $autoyear = date('Y');
     }
     $cyear = date('Y');
     for ($xyear = $autoyear - 8; $xyear < $cyear + 2; $xyear++) {
         if ($xyear == $autoyear) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xyear}' {$sel}>{$xyear}</option>";
     }
     echo "</select>";
     echo "&nbsp;" . _AM_TIMEC . " <select name='autohour'>";
     if (isset($autohour)) {
         $autohour = intval($autohour);
     } elseif (isset($this->publishedshed)) {
         $autohour = date('H', $this->published);
     } else {
         $autohour = date('H');
     }
     for ($xhour = 0; $xhour < 24; $xhour++) {
         if ($xhour == $autohour) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xhour}' {$sel}>{$xhour}</option>";
     }
     echo "</select>";
     echo " : <select name='automin'>";
     if (isset($automin)) {
         $automin = intval($automin);
     } elseif (isset($published)) {
         $automin = date('i', $published);
     } else {
         $automin = date('i');
     }
     for ($xmin = 0; $xmin < 61; $xmin++) {
         if ($xmin == $automin) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         $xxmin = $xmin;
         if ($xxmin < 10) {
             $xxmin = "{$xmin}";
         }
         echo "<option value='{$xmin}' {$sel}>{$xxmin}</option>";
     }
     echo "</select></br />";
     echo "<br /><input type='checkbox' name='autoexpdate' value='1'";
     if (isset($autoexpdate) && $autoexpdate == 1) {
         echo " checked='checked'";
     }
     echo "> ";
     $time = time();
     if (isset($isedit) && $isedit == 1 && $this->expired > 0) {
         echo "<b>" . _AM_CHANGEEXPDATETIME . "</b><br /><br />";
         printf(_AM_NOWSETEXPTIME, formatTimestamp($this->expired));
         echo "<br /><br />";
         $expired = xoops_getUserTimestamp($this->expired);
         printf(_AM_CURRENTTIME, formatTimestamp($time));
         echo "<br />";
         echo "<input type='hidden' name='isedit' value='1' />";
     } else {
         echo "<b>" . _AM_SETEXPDATETIME . "</b><br /><br />";
         printf(_AM_CURRENTTIME, formatTimestamp($time));
         echo "<br />";
     }
     echo "<br /> &nbsp; " . _AM_MONTHC . " <select name='autoexpmonth'>";
     if (isset($autoexpmonth)) {
         $autoexpmonth = intval($autoexpmonth);
     } elseif (isset($expired)) {
         $autoexpmonth = date('m', $expired);
     } else {
         $autoexpmonth = date('m');
         $autoexpmonth = $autoexpmonth + 1;
     }
     for ($xmonth = 1; $xmonth < 13; $xmonth++) {
         if ($xmonth == $autoexpmonth) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xmonth}' {$sel}>{$xmonth}</option>";
     }
     echo "</select>&nbsp;";
     echo _AM_DAYC . " <select name='autoexpday'>";
     if (isset($autoexpday)) {
         $autoexpday = intval($autoexpday);
     } elseif (isset($expired)) {
         $autoexpday = date('d', $expired);
     } else {
         $autoexpday = date('d');
     }
     for ($xday = 1; $xday < 32; $xday++) {
         if ($xday == $autoexpday) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xday}' {$sel}>{$xday}</option>";
     }
     echo "</select>&nbsp;";
     echo _AM_YEARC . " <select name='autoexpyear'>";
     if (isset($autoexpyear)) {
         $autoyear = intval($autoexpyear);
     } elseif (isset($expired)) {
         $autoexpyear = date('Y', $expired);
     } else {
         $autoexpyear = date('Y');
     }
     $cyear = date('Y');
     for ($xyear = $autoexpyear - 8; $xyear < $cyear + 2; $xyear++) {
         if ($xyear == $autoexpyear) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xyear}' {$sel}>{$xyear}</option>";
     }
     echo "</select>";
     echo "&nbsp;" . _AM_TIMEC . " <select name='autoexphour'>";
     if (isset($autoexphour)) {
         $autoexphour = intval($autoexphour);
     } elseif (isset($expired)) {
         $autoexphour = date('H', $expired);
     } else {
         $autoexphour = date('H');
     }
     for ($xhour = 0; $xhour < 24; $xhour++) {
         if ($xhour == $autoexphour) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xhour}' {$sel}>{$xhour}</option>";
     }
     echo "</select>";
     echo " : <select name='autoexpmin'>";
     if (isset($autoexpmin)) {
         $autoexpmin = intval($autoexpmin);
     } elseif (isset($expired)) {
         $autoexpmin = date('i', $expired);
     } else {
         $autoexpmin = date('i');
     }
     for ($xmin = 0; $xmin < 61; $xmin++) {
         if ($xmin == $autoexpmin) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         $xxmin = $xmin;
         if ($xxmin < 10) {
             $xxmin = "0{$xmin}";
         }
         echo "<option value='{$xmin}' {$sel}>{$xxmin}</option>";
     }
     echo "</select><br /><br />";
     if (isset($this->published) && $this->published == 0 && isset($this->type) && $this->type == "user") {
         echo "<div><input type='checkbox' name='approved' value='1' checked='checked'>&nbsp;<b>" . _AM_APPROVE . "</b></div><br />";
     }
     echo "<br /><div><input type='checkbox' name='nosmiley' value='1'";
     if (isset($this->nosmiley) && $this->nosmiley == 1) {
         echo " checked='checked'";
     }
     echo " /> <b>" . _WFS_DISAMILEY . "</b></div>";
     echo "<div><input type='checkbox' name='nohtml' value='1'";
     if (isset($this->nohtml) && $this->nohtml == 1) {
         echo " checked='checked'";
     }
     echo " /> <b>" . _WFS_DISHTML . "</b><br />";
     echo "</div><br />";
     if (isset($isedit) && $isedit == 1) {
         echo "<input type='checkbox' name='movetotop' value='1'";
         if (isset($movetotop) && $movetotop == 1) {
             echo " checked='checked'";
         }
         echo " />&nbsp;<b>" . _AM_MOVETOTOP . "</b><br />";
     }
     echo "<br /><div><input type='checkbox' name='justhtml' value='2'";
     if (isset($this->htmlpage) && $this->ishtml == '2') {
         echo " checked='checked'";
     }
     echo " />" . _AM_JUSTHTML . "<br /></div>";
     echo "<div><input type='checkbox' name='noshowart' value='1'";
     if (isset($this->noshowart) && $this->noshowart == 1) {
         echo " checked='checked'";
     }
     echo " /> " . _AM_NOSHOART . "<br />";
     echo "</div><br />";
     echo "<input type='checkbox' name='offline' value='1'";
     if (isset($this->offline) && $this->offline == 1) {
         echo " checked='checked'";
     }
     echo " />&nbsp;" . _AM_OFFLINE . "<br />";
     echo "<br />";
     if (!empty($this->articleid)) {
         echo "<input type='hidden' name='articleid' value='" . $this->articleid . "' />\n";
     }
     if (!empty($HTTP_POST_VARS['referer'])) {
         echo "<input type='hidden' name='referer' value='" . $HTTP_POST_VARS['referer'] . "' />\n";
     } elseif (!empty($HTTP_SERVER_VARS['HTTP_REFERER'])) {
         echo "<input type='hidden' name='referer' value='" . $HTTP_SERVER_VARS['HTTP_REFERER'] . "' />\n";
     }
     echo "<input type='submit' name='op' class='formButton' value='Preview' />&nbsp;<input type='submit' name='op' class='formButton' value='Save' />&nbsp;<input type='submit' name='op' class='formButton' value='Clean' />";
     echo "</form>";
     echo "</td></tr></table>";
     if (!empty($this->articleid)) {
         echo "<hr />";
         $upload = new UploadFile();
         echo $upload->formStart("index.php?op=fileup");
         echo "<h4>" . _WFS_FILEUPLOAD . "</h4>\n";
         echo "" . _WFS_ATTACHFILEACCESS . "<br />";
         echo "<br /><b>" . _WFS_ATTACHFILE . "</b><br />";
         echo $upload->formMax();
         echo $upload->formField();
         echo "<br /><br /><b>" . _WFS_FILESHOWNAME . "</b><br />";
         echo "<input type='text' name='fileshowname' id='fileshowname' value='";
         if (isset($this->fileshowname)) {
             echo $this->fileshowname;
         }
         echo "' size='70' maxlength='80' /><br />";
         echo "<br /><b>" . _WFS_FILEDESCRIPT . "</b><br />";
         echo "<textarea name='textfiledescript' cols='50' rows='5'></textarea><br />";
         echo "<br /><b>" . _WFS_FILETEXT . "</b><br />";
         echo "<textarea name='textfilesearch' cols='50' rows='3'></textarea><br />";
         echo "<input type='hidden' name='groupid' value='" . $this->groupip . "' />";
         echo "<input type='hidden' name='articleid' value='" . $this->articleid . "' />";
         echo "<input type='hidden' name='groupid' value= '" . $this->groupid . "' />";
         echo $upload->formSubmit(_WFS_UPLOAD);
         echo $upload->formEnd();
     }
 }
function wpsc_get_mimetype($file, $check_reliability = false)
{
    // Sometimes we need to know how useless the result from this is, hence the "check_reliability" parameter
    if (file_exists($file)) {
        if (function_exists('finfo_open') && function_exists('finfo_file')) {
            // fileinfo apparently works best, wish it was included with PHP by default
            $finfo_handle = finfo_open(FILEINFO_MIME);
            $mimetype = finfo_file($finfo_handle, $file);
            $is_reliable = true;
        } else {
            if (function_exists('mime_content_type') && mime_content_type($file) != '') {
                //obsolete, but probably second best due to completeness
                $mimetype = mime_content_type($file);
                $is_reliable = true;
            } else {
                //included with plugin, uses the extention, limited and odd list, last option
                $mimetype_class = new mimetype();
                $mimetype = $mimetype_class->getType($file);
                $is_reliable = false;
            }
        }
    } else {
        $mimetype = false;
        $is_reliable = false;
    }
    if ($check_reliability == true) {
        return array('mime_type' => $mimetype, 'is_reliable' => $is_reliable);
    } else {
        return $mimetype;
    }
}
예제 #15
0
function sendToUser($nUserId, $nCirculationId, $nSlotId, $nCirculationProcessId, $nCirculationHistoryId, $tsDateInProcessSince = '')
{
    global $DATABASE_HOST, $DATABASE_UID, $DATABASE_PWD, $DATABASE_DB, $MAIL_HEADER_PRE, $CUTEFLOW_SERVER;
    global $SMTP_SERVER, $SMTP_PORT, $SMTP_USERID, $SMTP_PWD, $SMTP_USE_AUTH;
    global $SYSTEM_REPLY_ADDRESS, $CUTEFLOW_VERSION, $TStoday, $objURL, $EMAIL_FORMAT, $EMAIL_VALUES, $MAIL_SEND_TYPE, $MTA_PATH, $SMPT_ENCRYPTION;
    global $CUTEFLOW_SERVER, $CUTEFLOW_VERSION, $EMAIL_BROWSERVIEW, $MAIL_LINK_DESCRIPTION, $MAIL_HEADER_PRE;
    global $CIRCULATION_DONE_MESSSAGE_REJECT, $CIRCULATION_DONE_MESSSAGE_SUCCESS, $CIRCDETAIL_SENDER, $CIRCDETAIL_SENDDATE, $MAIL_ADDITION_INFORMATIONS;
    global $DEFAULT_CHARSET, $SEND_WORKFLOW_MAIL;
    $nConnection = mysql_connect($DATABASE_HOST, $DATABASE_UID, $DATABASE_PWD);
    if ($nConnection) {
        if (mysql_select_db($DATABASE_DB, $nConnection)) {
            // Create the Transport
            if ($MAIL_SEND_TYPE == 'SMTP') {
                $transport = Swift_SmtpTransport::newInstance($SMTP_SERVER, $SMTP_PORT)->setUsername($SMTP_USERID)->setPassword($SMTP_PWD);
                if ($SMPT_ENCRYPTION != 'NONE') {
                    $transport = $transport->setEncryption(strtolower($SMPT_ENCRYPTION));
                }
            } else {
                if ($MAIL_SEND_TYPE == 'PHP') {
                    $transport = Swift_MailTransport::newInstance();
                } else {
                    if ($MAIL_SEND_TYPE == 'MTA') {
                        $transport = Swift_SendmailTransport::newInstance($MTA_PATH);
                    }
                }
            }
            // Create the Mailer using the created Transport
            $mailer = Swift_Mailer::newInstance($transport);
            $message = Swift_Message::newInstance()->setCharset($DEFAULT_CHARSET);
            //------------------------------------------------------
            //--- get the needed informations
            //------------------------------------------------------
            //--- circulation form
            $arrForm = array();
            $strQuery = "SELECT * FROM cf_circulationform WHERE nID={$nCirculationId}";
            $nResult = mysql_query($strQuery, $nConnection);
            if ($nResult) {
                if (mysql_num_rows($nResult) > 0) {
                    $arrForm = mysql_fetch_array($nResult);
                }
            }
            //--- circulation history
            $arrHistory = array();
            $strQuery = "SELECT * FROM cf_circulationhistory WHERE nID={$nCirculationHistoryId}";
            $nResult = mysql_query($strQuery, $nConnection);
            if ($nResult) {
                if (mysql_num_rows($nResult) > 0) {
                    $arrHistory = mysql_fetch_array($nResult);
                }
            }
            //--- the attachments
            $strQuery = "SELECT * FROM cf_attachment WHERE nCirculationHistoryId={$nCirculationHistoryId}";
            $nResult = mysql_query($strQuery, $nConnection);
            if ($nResult) {
                if (mysql_num_rows($nResult) > 0) {
                    while ($arrRow = mysql_fetch_array($nResult)) {
                        $strFileName = basename($arrRow['strPath']);
                        $mimetype = new mimetype();
                        $filemime = $mimetype->getType($strFileName);
                        $message->attach(Swift_Attachment::fromPath($arrRow["strPath"], $filemime)->setFilename($strFileName));
                    }
                }
            }
            //------------------------------------------------------
            //--- update status in circulationprocess table
            //------------------------------------------------------
            if ($tsDateInProcessSince == '') {
                $strQuery = "INSERT INTO cf_circulationprocess values (null, {$nCirculationId}, {$nSlotId}, {$nUserId}, {$TStoday}, 0, 0, {$nCirculationProcessId}, {$nCirculationHistoryId}, 0)";
                mysql_query($strQuery, $nConnection) or die($strQuery . mysql_error());
            } else {
                //( `nID` , `nCirculationFormId` , `nSlotId`, `nUserId` , `dateInProcessSince` , `nDecissionState`, `dateDecission` , `nIsSubstitiuteOf` , `nCirculationHistoryId`)
                $strQuery = "INSERT INTO cf_circulationprocess values (null, {$nCirculationId}, {$nSlotId}, {$nUserId}, {$tsDateInProcessSince}, 0, 0, 0, {$nCirculationHistoryId}, 0)";
                mysql_query($strQuery, $nConnection) or die($strQuery . mysql_error());
            }
            //------------------------------------------------------
            //--- generate email message
            //------------------------------------------------------
            if ($SEND_WORKFLOW_MAIL == true) {
                $strQuery = "SELECT nID FROM cf_circulationprocess WHERE nSlotId={$nSlotId} AND nUserId={$nUserId} AND nCirculationFormId={$nCirculationId} AND nCirculationHistoryId={$nCirculationHistoryId}";
                $nResult = mysql_query($strQuery, $nConnection);
                if ($nResult) {
                    if (mysql_num_rows($nResult) > 0) {
                        $arrLastRow = array();
                        while ($arrRow = mysql_fetch_array($nResult)) {
                            $arrLastRow = $arrRow;
                        }
                        $Circulation_cpid = $arrLastRow[0];
                    }
                }
                //switching Email Format
                if ($nUserId != -2) {
                    $strQuery = "SELECT * FROM `cf_user` WHERE nID = {$nUserId};";
                } else {
                    // in this case the next user is the sender of this circulation
                    $strQuery = "SELECT * FROM `cf_user` WHERE nID = " . $arrForm['nSenderId'] . ";";
                }
                $nResult = mysql_query($strQuery, $nConnection);
                if ($nResult) {
                    $user = mysql_fetch_array($nResult, MYSQL_ASSOC);
                    $useGeneralEmailConfig = $user['bUseGeneralEmailConfig'];
                    if (!$useGeneralEmailConfig) {
                        $emailFormat = $user['strEmail_Format'];
                        $emailValues = $user['strEmail_Values'];
                    } else {
                        $emailFormat = $EMAIL_FORMAT;
                        $emailValues = $EMAIL_VALUES;
                    }
                    $Circulation_Name = $arrForm['strName'];
                    $Circulation_AdditionalText = str_replace("\n", "<br>", $arrHistory['strAdditionalText']);
                    //--- create mail
                    require_once '../mail/mail_' . $emailFormat . $emailValues . '.inc.php';
                    switch ($emailFormat) {
                        case PLAIN:
                            $message->setBody($strMessage, 'text/plain');
                            break;
                        case HTML:
                            $message->setBody($strMessage, 'text/html');
                            break;
                    }
                }
                //------------------------------------------------------
                //--- send email to user
                //------------------------------------------------------
                if ($nUserId != -2) {
                    $strQuery = "SELECT * FROM cf_user WHERE nID = {$nUserId}";
                } else {
                    // in this case the next user is the sender of this circulation
                    $strQuery = "SELECT * FROM cf_user WHERE nID = " . $arrForm['nSenderId'] . "";
                }
                $nResult = mysql_query($strQuery, $nConnection);
                if ($nResult) {
                    if (mysql_num_rows($nResult) > 0) {
                        $arrRow = mysql_fetch_array($nResult);
                        $SYSTEM_REPLY_ADDRESS = str_replace(' ', '_', $SYSTEM_REPLY_ADDRESS);
                        $message->setFrom(array($SYSTEM_REPLY_ADDRESS => 'CuteFlow'));
                        $message->setSubject($MAIL_HEADER_PRE . $arrForm["strName"]);
                        $message->setTo(array($arrRow["strEMail"]));
                        $result = $mailer->send($message);
                        if (!$result) {
                            $fp = @fopen("mailerror.log", "a");
                            if ($fp) {
                                @fputs($fp, date("d.m.Y", time()) . " - sendToUser\n");
                                fclose($fp);
                            }
                        } else {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
예제 #16
0
<?php

if (!isset($_GET['file'])) {
    die;
}
if (strpos($_GET['file'], (isset($_SERVER['HTTPS']) ? 'https|' : 'http|') . $_SERVER['SERVER_NAME']) === false) {
    die;
}
require_once '../lib/class.mimetype.php';
$mime = new mimetype();
$fPath = str_replace('http|', 'http://', $_GET['file']);
$fPath = str_replace('https|', 'https://', $fPath);
$fType = $mime->getType($fPath);
$fName = basename($fPath);
$origname = preg_replace('/_#_#\\d*/', '', $fName);
$fContent = fetch_content($fPath);
output_content($fContent, $origname);
function fetch_content($url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    ob_start();
    curl_exec($ch);
    curl_close($ch);
    $fContent = ob_get_contents();
    ob_end_clean();
    return $fContent;
}
function output_content($content, $name)
{
예제 #17
0
        function isAllowedMineType(){

        global $wfsConfig;

// no check mode
		global $xoopsUser;
		global $wfsAdminNotCheckMineType, $wfsUserNotCheckMineType;
		if ( $xoopsUser )
		{
			if ($xoopsUser->isAdmin() && $wfsAdminNotCheckMineType)  return TRUE;
			if ($wfsUserNotCheckMineType)  return TRUE;
		}

			$mimetype = new mimetype();

			//foreach(explode(" ", $wfsConfig['selmimetype']) as $type)
				
				foreach(explode(" ", $wfsConfig['selmimetype']) as $type)
				if ($this->minetype == $mimetype->privFindType($type))
					return TRUE;												
				return false;

		}
예제 #18
0
function get_mimetype($minetype)
{
    global $wfsConfig;
    $mimetype = new mimetype();
    echo $minetype;
    foreach (explode(" ", $wfsConfig['selmimetype']) as $type) {
        echo $mimetype->privFindType($type) . "<br />";
    }
    if ($minetype === $mimetype->privFindType($type)) {
        return TRUE;
    }
    return FALSE;
}
예제 #19
0
 }
 // Setup URL link for article
 $articletag['urllink'] = '&nbsp';
 if ($article->url && !$article->urlname) {
     $articletag['urllink'] = "<a href='http://" . $article->url() . "' target='_blank'>Url Link: " . $article->url() . "</a><br />";
 } elseif ($article->urlname) {
     $articletag['urllink'] = "<a href='http://" . $article->url() . "' target='_blank'>Url Link: " . $article->urlname() . "</a><br />";
 }
 //Downloads links
 $workdir = XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'];
 $articletag['downloadlink'] = "<table width='100%' cellspacing = 0 cellpadding = '2'>";
 if ($article->getFilesCount() > 0) {
     foreach ($article->files as $file) {
         if (checkAccess($file->groupid)) {
             $filename = $file->getFileRealName();
             $mimetype = new mimetype();
             $mimeshow = $mimetype->getType(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename);
             $icon = get_icon($workdir . "/" . $filename);
             if (is_file(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename)) {
                 $size = Prettysize(filesize(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename));
             } else {
                 $size = '0';
             }
             if (empty($size)) {
                 $size = '0';
             }
             $accessnot = '';
             if (checkAccess($file->groupid) == '1') {
                 $accessnot = '1';
             }
             if (checkAccess($file->groupid)) {
예제 #20
0
    return $confirm;
}

//image defines 
$folderimg = "<img src=".XOOPS_URL."/modules/".$xoopsModule->dirname()."/images/icon/folder.gif ALT='Folder'>";
$dirimg = "<img src=".XOOPS_URL."/modules/".$xoopsModule->dirname()."/images/icon/folder.gif ALT='Change Folder'>";
$renameimg = "<img src=".XOOPS_URL."/modules/".$xoopsModule->dirname()."/images/icon/rename.gif ALT='Rename file'>";
$editimg = "<img src=".XOOPS_URL."/modules/".$xoopsModule->dirname()."/images/icon/edit.gif ALT='Edit file'>";
$downimg = "<img src=".XOOPS_URL."/modules/".$xoopsModule->dirname()."/images/icon/download.gif ALT='Download'>";
$deleteimg = "<img src=".XOOPS_URL."/modules/".$xoopsModule->dirname()."/images/icon/delete.gif ALT='Delete File'>";
$viewimg = "<img src=".XOOPS_URL."/modules/".$xoopsModule->dirname()."/images/icon/view.gif ALT='View File'>";
$home = "<img src=".XOOPS_URL."/modules/".$xoopsModule->dirname()."/images/icon/home.gif ALT='home'>";
$refresh = "<img src=".XOOPS_URL."/modules/".$xoopsModule->dirname()."/images/icon/refresh.gif ALT='refresh'>";
$pathtoimages = "".XOOPS_URL."/modules/".$xoopsModule->dirname()."/images/icon/";

$mimetype = new mimetype();

if (isset($_GET['file'])) {
	$file = $_GET['file'];
}

function filecheck($path = '', $file = '', $namecheck = '', $extra = '') {
	if (!is_valid_name($namecheck)) {
		redirect_header("javascript:history.go(-1)",1, "<font color='#CC0000'>Invalid File name</font>");
	}
}
function folderwrite($path = '', $file = '', $namecheck = '', $extra = '') {
	if ( is_dir($path) && !is_writable($path) ) {
	  	redirect_header("filemanager.php?rootpath=".$path."",3,"Cannot ".$extra." File,<br /> Folder ".$path." is not writable!");
	}
}
예제 #21
0
 /**
  * Detect the MIME type based on extension in the filename.
  * @return MIME type text.
  */
 static function detect($filename)
 {
     $mime = new mimetype();
     return $mime->getType($filename);
 }
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: admin_editmimetype.php,v 1.7 2005/04/18 15:49:02 filetreefrog Exp $
##################################################
// Part of the Administration Control Panel : Files Subsystem category
if (!defined('PATHOS')) {
    exit('');
}
if (pathos_permissions_check('files_subsystem', pathos_core_makeLocation('administrationmodule'))) {
    $type = null;
    if (isset($_GET['type'])) {
        $type = $db->selectObject('mimetype', "mimetype='" . $_GET['type'] . "'");
    }
    if (!defined('SYS_FORMS')) {
        require_once BASE . 'subsystems/forms.php';
    }
    pathos_forms_initialize();
    $form = mimetype::form($type);
    $form->meta('module', 'filemanager');
    $form->meta('action', 'admin_savemimetype');
    $template = new template('filemanager', '_form_editmimetype', $loc);
    $template->assign('form_html', $form->toHTML());
    $template->assign('is_edit', isset($type->id) ? 1 : 0);
    $template->output();
} else {
    echo SITE_403_HTML;
}
예제 #23
0
파일: Flv.php 프로젝트: ratzeni/islandora
 function createFedoraDataStreams($form_values, &$dom, &$rootElement)
 {
     module_load_include('php', 'Fedora_Repository', 'mimetype');
     $mimetype = new mimetype();
     $server = null;
     $file = $form_values['ingest-file-location'];
     $dformat = $mimetype->getType($file);
     $fileUrl = 'http://' . $_SERVER['HTTP_HOST'] . $file;
     $beginIndex = strrpos($fileUrl, '/');
     $dtitle = substr($fileUrl, $beginIndex + 1);
     $dtitle = substr($dtitle, 0, strpos($dtitle, "."));
     $ds1 = $dom->createElement("foxml:datastream");
     $ds1->setAttribute("ID", "OBJ");
     $ds1->setAttribute("STATE", "A");
     $ds1->setAttribute("CONTROL_GROUP", "M");
     $ds1v = $dom->createElement("foxml:datastreamVersion");
     $ds1v->setAttribute("ID", "OBJ.0");
     $ds1v->setAttribute("MIMETYPE", "{$dformat}");
     $ds1v->setAttribute("LABEL", "{$dtitle}");
     $ds1content = $dom->createElement('foxml:contentLocation');
     $ds1content->setAttribute("REF", "{$fileUrl}");
     $ds1content->setAttribute("TYPE", "URL");
     $ds1->appendChild($ds1v);
     $ds1v->appendChild($ds1content);
     $rootElement->appendChild($ds1);
     foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) {
         $createdFile = strstr($createdFile, $file);
         $dformat = $mimetype->getType($createdFile);
         $fileUrl = 'http://' . $_SERVER['HTTP_HOST'] . $createdFile;
         $beginIndex = strrpos($fileUrl, '/');
         $dtitle = substr($fileUrl, $beginIndex + 1);
         $dtitle = substr($dtitle, 0, strpos($dtitle, "."));
         $dtitle = $dtitle . '_' . $dsid;
         $ds1 = $dom->createElement("foxml:datastream");
         $ds1->setAttribute("ID", "{$dsid}");
         $ds1->setAttribute("STATE", "A");
         $ds1->setAttribute("CONTROL_GROUP", "M");
         $ds1v = $dom->createElement("foxml:datastreamVersion");
         $ds1v->setAttribute("ID", "{$dsid}.0");
         $ds1v->setAttribute("MIMETYPE", "{$dformat}");
         $ds1v->setAttribute("LABEL", "{$dtitle}");
         $ds1content = $dom->createElement('foxml:contentLocation');
         $ds1content->setAttribute("REF", "{$fileUrl}");
         $ds1content->setAttribute("TYPE", "URL");
         $ds1->appendChild($ds1v);
         $ds1v->appendChild($ds1content);
         $rootElement->appendChild($ds1);
     }
 }