本文整理汇总了PHP中Toolbox::sendFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Toolbox::sendFile方法的具体用法?PHP Toolbox::sendFile怎么用?PHP Toolbox::sendFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Toolbox
的用法示例。
在下文中一共展示了Toolbox::sendFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list
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.
GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkLoginUser();
if (isset($_GET["switchto"])) {
$_SESSION['glpigraphtype'] = $_GET["switchto"];
Html::back();
}
if (($uid = Session::getLoginUserID(false)) && isset($_GET["file"])) {
list($userID, $filename) = explode("_", $_GET["file"]);
if ($userID == $uid && file_exists(GLPI_GRAPH_DIR . "/" . $_GET["file"])) {
list($fname, $extension) = explode(".", $filename);
Toolbox::sendFile(GLPI_GRAPH_DIR . "/" . $_GET["file"], 'glpi.' . $extension);
} else {
Html::displayErrorAndDie(__('Unauthorized access to this file'), true);
}
}
示例2: Copyright
@package Plugin Monitoring for GLPI
@author David Durieux
@co-author
@comment
@copyright Copyright (c) 2011-2014 Plugin Monitoring for GLPI team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link https://forge.indepnet.net/projects/monitoring/
@since 2011
------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Session::checkLoginUser();
$docDir = GLPI_PLUGIN_DOC_DIR . '/monitoring';
if (isset($_GET['file'])) {
$filename = $_GET['file'];
$file = $docDir . '/' . $filename;
if (preg_match("/PluginMonitoringService-([0-9]+)-2h([0-9]+).png/", $filename)) {
include GLPI_ROOT . "/inc/includes.php";
$match = array();
preg_match("/PluginMonitoringService-([0-9]+)-2h([0-9]+).png/", $filename, $match);
$pmServicegraph = new PluginMonitoringServicegraph();
$pmService = new PluginMonitoringService();
$pmComponent = new PluginMonitoringComponent();
$pmService->getFromDB($match[1]);
$pmComponent->getFromDB($pmService->fields['plugin_monitoring_components_id']);
$pmServicegraph->displayGraph($pmComponent->fields['graph_template'], "PluginMonitoringService", $match[1], $match[2], '2h');
}
Toolbox::sendFile($file, $filename);
}
示例3: explode
// Doc alterated
} else {
$doc->send();
}
} else {
Html::displayErrorAndDie(__('Unauthorized access to this file'), true);
// No right
}
}
} else {
if (isset($_GET["file"])) {
// for other file
$splitter = explode("/", $_GET["file"]);
if (count($splitter) == 2) {
$send = false;
if ($splitter[0] == "_dumps" && Session::haveRight("backup", CREATE)) {
$send = true;
}
if ($splitter[0] == "_pictures") {
$send = true;
}
if ($send && file_exists(GLPI_DOC_DIR . "/" . $_GET["file"])) {
Toolbox::sendFile(GLPI_DOC_DIR . "/" . $_GET["file"], $splitter[1]);
} else {
Html::displayErrorAndDie(__('Unauthorized access to this file'), true);
}
} else {
Html::displayErrorAndDie(__('Invalid filename'), true);
}
}
}
示例4: send
/**
* Send a document to navigator
**/
function send()
{
$file = GLPI_DOC_DIR . "/" . $this->fields['filepath'];
Toolbox::sendFile($file, $this->fields['filename'], $this->fields['mime']);
}