本文整理汇总了PHP中Toolbox::get_magic_quotes_runtime方法的典型用法代码示例。如果您正苦于以下问题:PHP Toolbox::get_magic_quotes_runtime方法的具体用法?PHP Toolbox::get_magic_quotes_runtime怎么用?PHP Toolbox::get_magic_quotes_runtime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Toolbox
的用法示例。
在下文中一共展示了Toolbox::get_magic_quotes_runtime方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin_surveyticket_install
function plugin_surveyticket_install()
{
global $DB;
if (!TableExists('glpi_plugin_surveyticket_questions')) {
$DB_file = GLPI_ROOT . "/plugins/surveyticket/install/mysql/plugin_surveyticket-empty.sql";
$DBf_handle = fopen($DB_file, "rt");
$sql_query = fread($DBf_handle, filesize($DB_file));
fclose($DBf_handle);
foreach (explode(";\n", "{$sql_query}") as $sql_line) {
if (Toolbox::get_magic_quotes_runtime()) {
$sql_line = Toolbox::stripslashes_deep($sql_line);
}
if (!empty($sql_line)) {
$DB->query($sql_line);
}
}
include GLPI_ROOT . "/plugins/surveyticket/inc/profile.class.php";
$psProfile = new PluginSurveyticketProfile();
$psProfile->initProfile();
}
return true;
}
示例2: plugin_escalation_install
function plugin_escalation_install()
{
global $DB;
if (!TableExists("glpi_plugin_escalation_groups_groups")) {
$empty_sql = "plugin_escalation-empty.sql";
$DB_file = GLPI_ROOT . "/plugins/escalation/install/mysql/{$empty_sql}";
$DBf_handle = fopen($DB_file, "rt");
$sql_query = fread($DBf_handle, filesize($DB_file));
fclose($DBf_handle);
foreach (explode(";\n", "{$sql_query}") as $sql_line) {
if (Toolbox::get_magic_quotes_runtime()) {
$sql_line = Toolbox::stripslashes_deep($sql_line);
}
if (!empty($sql_line)) {
$DB->query($sql_line);
}
}
} else {
if (!TableExists("glpi_plugin_escalation_configs")) {
$DB->query("CREATE TABLE `glpi_plugin_escalation_configs` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `entities_id` int(11) NOT NULL DEFAULT '0',\n `unique_assigned` varchar(255) DEFAULT NULL,\n `workflow` varchar(255) DEFAULT NULL,\n `limitgroup` varchar(255) DEFAULT NULL,\n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
$DB->query("INSERT INTO `glpi_plugin_escalation_configs`\n (`id` ,`entities_id` ,`unique_assigned` ,`workflow`, `limitgroup`)\n VALUES (NULL , '0', '0', '0', '0');");
}
if (!TableExists("glpi_plugin_escalation_profiles")) {
$DB->query("CREATE TABLE `glpi_plugin_escalation_profiles` (\n `profiles_id` int(11) NOT NULL DEFAULT '0',\n `bypassworkflow` char(1) COLLATE utf8_unicode_ci DEFAULT NULL,\n `copyticket` char(1) COLLATE utf8_unicode_ci DEFAULT NULL,\n `copyticketonworkflow` char(1) COLLATE utf8_unicode_ci DEFAULT NULL\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
}
if (!FieldExists('glpi_plugin_escalation_profiles', 'copyticket')) {
$DB->query("ALTER TABLE `glpi_plugin_escalation_profiles` \n ADD `copyticket` CHAR( 1 ) NULL ");
$DB->query("ALTER TABLE `glpi_plugin_escalation_profiles` \n ADD `copyticketonworkflow` CHAR( 1 ) NULL ");
}
if (!FieldExists("glpi_plugin_escalation_configs", "limitgroup")) {
$migration = new Migration(PLUGIN_ESCALATION_VERSION);
$migration->addField('glpi_plugin_escalation_configs', "limitgroup", "varchar(255) DEFAULT NULL");
$migration->migrationOneTable('glpi_plugin_escalation_configs');
$DB->query("UPDATE `glpi_plugin_escalation_configs` \n SET `limitgroup` = '0' WHERE `entities_id` =1");
}
}
return true;
}
示例3: pluginFusioninventoryUpdate
//.........这里部分代码省略.........
if ($DB->numrows($result) == '0') {
$input = array();
$input['modulename'] = "InventoryComputerESX";
$input['is_active'] = 0;
$input['exceptions'] = exportArrayToDB(array());
$url = '';
if (isset($_SERVER['HTTP_REFERER'])) {
$url = $_SERVER['HTTP_REFERER'];
}
$agentmodule->add($input);
}
/*
* Add Collect module appear in version 0.84+2.0
*/
$agentmodule = new PluginFusioninventoryAgentmodule();
$query = "SELECT `id` FROM `glpi_plugin_fusioninventory_agentmodules`\n WHERE `modulename`='Collect'\n LIMIT 1";
$result = $DB->query($query);
if ($DB->numrows($result) == '0') {
$input = array();
$input['modulename'] = "Collect";
$input['is_active'] = 1;
$input['exceptions'] = exportArrayToDB(array());
$agentmodule->add($input);
}
/*
* Update pci and usb ids and oui
*/
foreach (array('usbid.sql', 'pciid.sql', 'oui.sql') as $sql) {
$DB_file = GLPI_ROOT . "/plugins/fusioninventory/install/mysql/{$sql}";
$DBf_handle = fopen($DB_file, "rt");
$sql_query = fread($DBf_handle, filesize($DB_file));
fclose($DBf_handle);
foreach (explode(";\n", "{$sql_query}") as $sql_line) {
if (Toolbox::get_magic_quotes_runtime()) {
$sql_line = Toolbox::stripslashes_deep($sql_line);
}
if (!empty($sql_line)) {
$DB->query($sql_line);
}
}
}
/*
* Migrate data of table glpi_plugin_fusinvsnmp_agentconfigs into
* glpi_plugin_fusioninventory_agents
*/
if (TableExists("glpi_plugin_fusinvsnmp_agentconfigs")) {
$query = "SELECT * FROM `glpi_plugin_fusinvsnmp_agentconfigs`";
$result = $DB->query($query);
while ($data = $DB->fetch_array($result)) {
$queryu = "UPDATE `glpi_plugin_fusioninventory_agents`\n SET `threads_networkdiscovery`='" . $data['threads_netdiscovery'] . "',\n `threads_networkinventory`='" . $data['threads_snmpquery'] . "',\n `senddico`='" . $data['senddico'] . "'\n WHERE `id`='" . $data['plugin_fusioninventory_agents_id'] . "'";
$DB->query($queryu);
}
}
// Update profiles
if (TableExists("glpi_plugin_tracker_profiles")) {
$profile = new Profile();
$pfProfile = new PluginFusioninventoryProfile();
$query = "SELECT * FROM `glpi_plugin_tracker_profiles`";
$result = $DB->query($query);
while ($data = $DB->fetch_array($result)) {
$profiledata = current($profile->find("`name`='" . $data['name'] . "'", "", 1));
if (!empty($profiledata)) {
$newprofile = array();
$newprofile['snmp_networking'] = "networkequipment";
$newprofile['snmp_printers'] = "printer";
$newprofile['snmp_models'] = "model";
示例4: header
return;
} else {
// Now send the file with header() magic
header("Expires: Mon, 26 Nov 1962 00:00:00 GMT");
header('Pragma: private');
/// IE BUG + SSL
//header('Pragma: no-cache');
header('Cache-control: private, must-revalidate');
/// IE BUG + SSL
header("Content-disposition: filename=\"{$filename}\"");
// header("Content-type: ".$mime);
$f = fopen($file, "r");
if (!$f) {
echo "Error opening file {$filename}";
} else {
// Pour que les \x00 ne devienne pas \0
$mc = Toolbox::get_magic_quotes_runtime();
if ($mc) {
@ini_set('magic_quotes_runtime', 0);
}
$fsize = filesize($file);
if ($fsize) {
echo fread($f, filesize($file));
} else {
}
if ($mc) {
@ini_set('magic_quotes_runtime', $mc);
}
}
}
}
示例5: runFile
/**
* Execute all the request in a file
*
* @param $path string with file full path
*
* @return boolean true if all query are successfull
**/
function runFile($path)
{
$DBf_handle = fopen($path, "rt");
if (!$DBf_handle) {
return false;
}
$formattedQuery = "";
$lastresult = false;
while (!feof($DBf_handle)) {
// specify read length to be able to read long lines
$buffer = fgets($DBf_handle, 102400);
// do not strip comments due to problems when # in begin of a data line
$formattedQuery .= $buffer;
if (substr(rtrim($formattedQuery), -1) == ";" && substr(rtrim($formattedQuery), -4) != ">" && substr(rtrim($formattedQuery), -4) != "160;") {
if (Toolbox::get_magic_quotes_runtime()) {
$formattedQuerytorun = stripslashes($formattedQuery);
} else {
$formattedQuerytorun = $formattedQuery;
}
// Do not use the $DB->query
if ($this->query($formattedQuerytorun)) {
//if no success continue to concatenate
$formattedQuery = "";
$lastresult = true;
} else {
$lastresult = false;
}
}
}
return $lastresult;
}
示例6: sylk_clean
/**
* Clean display value for sylk export
*
* @param $value string value
*
* @return clean value
**/
static function sylk_clean($value)
{
if (Toolbox::get_magic_quotes_runtime()) {
$value = stripslashes($value);
}
$value = preg_replace('/\\x0A/', ' ', $value);
$value = preg_replace('/\\x0D/', NULL, $value);
$value = str_replace("\"", "''", $value);
$value = str_replace(';', ';;', $value);
$value = Html::clean($value);
return $value;
}
示例7: restoreMySqlDump
/** Restore a mysql dump
*
* @param $DB DB object
* @param $dumpFile dump file
* @param $duree max delay before refresh
**/
function restoreMySqlDump($DB, $dumpFile, $duree)
{
global $DB, $TPSCOUR, $offset, $cpt;
// $dumpFile, fichier source
// $duree=timeout pour changement de page (-1 = aucun)
// Desactivation pour empecher les addslashes au niveau de la creation des tables
// En plus, au niveau du dump on considere qu'on est bon
// set_magic_quotes_runtime(0);
if (!file_exists($dumpFile)) {
echo sprintf(__('File %s not found.'), $dumpFile) . "<br>";
return false;
}
if (substr($dumpFile, -2) == "gz") {
$fileHandle = gzopen($dumpFile, "rb");
} else {
$fileHandle = fopen($dumpFile, "rb");
}
if (!$fileHandle) {
//TRASN: %s is the name of the file
echo sprintf(__('Unauthorized access to the file %s'), $dumpFile) . "<br>";
return false;
}
if ($offset != 0) {
if (substr($dumpFile, -2) == "gz") {
if (gzseek($fileHandle, $offset, SEEK_SET) != 0) {
//erreur
//TRANS: %s is the number of the byte
printf(__("Unable to find the byte %s"), Html::formatNumber($offset, false, 0));
echo "<br>";
return false;
}
} else {
if (fseek($fileHandle, $offset, SEEK_SET) != 0) {
//erreur
//TRANS: %s is the number of the byte
printf(__("Unable to find the byte %s"), Html::formatNumber($offset, false, 0));
echo "<br>";
return false;
}
}
Html::glpi_flush();
}
$formattedQuery = "";
if (substr($dumpFile, -2) == "gz") {
while (!gzeof($fileHandle)) {
current_time();
if ($duree > 0 && $TPSCOUR >= $duree) {
//on atteint la fin du temps imparti
return true;
}
// specify read length to be able to read long lines
$buffer = gzgets($fileHandle, 102400);
// do not strip comments due to problems when # in begin of a data line
$formattedQuery .= $buffer;
if (Toolbox::get_magic_quotes_runtime()) {
$formattedQuery = stripslashes($formattedQuery);
}
if (substr(rtrim($formattedQuery), -1) == ";") {
// Do not use the $DB->query
if ($DB->query($formattedQuery)) {
//if no success continue to concatenate
$offset = gztell($fileHandle);
$formattedQuery = "";
$cpt++;
}
}
}
} else {
while (!feof($fileHandle)) {
current_time();
if ($duree > 0 && $TPSCOUR >= $duree) {
//on atteint la fin du temps imparti
return true;
}
// specify read length to be able to read long lines
$buffer = fgets($fileHandle, 102400);
// do not strip comments due to problems when # in begin of a data line
$formattedQuery .= $buffer;
if (Toolbox::get_magic_quotes_runtime()) {
$formattedQuery = stripslashes($formattedQuery);
}
if (substr(rtrim($formattedQuery), -1) == ";") {
// Do not use the $DB->query
if ($DB->query($formattedQuery)) {
//if no success continue to concatenate
$offset = ftell($fileHandle);
$formattedQuery = "";
$cpt++;
}
}
}
}
if ($DB->error) {
echo "<hr>";
//.........这里部分代码省略.........
示例8: _putfonts
function _putfonts()
{
$nf = $this->n;
foreach ($this->diffs as $diff) {
//Encodings
$this->_newobj();
$this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [' . $diff . ']>>');
$this->_out('endobj');
}
$mqr = Toolbox::get_magic_quotes_runtime();
ini_set("magic_quotes_runtime", 0);
foreach ($this->FontFiles as $file => $info) {
//Font file embedding
$this->_newobj();
$this->FontFiles[$file]['n'] = $this->n;
$font = '';
$f = fopen($this->_getfontpath() . $file, 'rb', 1);
if (!$f) {
$this->Error('Font file not found');
}
while (!feof($f)) {
$font .= fread($f, 8192);
}
fclose($f);
$compressed = substr($file, -2) == '.z';
if (!$compressed && isset($info['length2'])) {
$header = ord($font[0]) == 128;
if ($header) {
//Strip first binary header
$font = substr($font, 6);
}
if ($header && ord($font[$info['length1']]) == 128) {
//Strip second binary header
$font = substr($font, 0, $info['length1']) . substr($font, $info['length1'] + 6);
}
}
$this->_out('<</Length ' . strlen($font));
if ($compressed) {
$this->_out('/Filter /FlateDecode');
}
$this->_out('/Length1 ' . $info['length1']);
if (isset($info['length2'])) {
$this->_out('/Length2 ' . $info['length2'] . ' /Length3 0');
}
$this->_out('>>');
$this->_putstream($font);
$this->_out('endobj');
}
ini_set("magic_quotes_runtime", $mqr);
foreach ($this->fonts as $k => $font) {
//Font objects
$this->fonts[$k]['n'] = $this->n + 1;
$type = $font['type'];
$name = $font['name'];
if ($type == 'core') {
//Standard font
$this->_newobj();
$this->_out('<</Type /Font');
$this->_out('/BaseFont /' . $name);
$this->_out('/Subtype /Type1');
if ($name != 'Symbol' && $name != 'ZapfDingbats') {
$this->_out('/Encoding /WinAnsiEncoding');
}
$this->_out('>>');
$this->_out('endobj');
} else {
if ($type == 'Type1' || $type == 'TrueType') {
//Additional Type1 or TrueType font
$this->_newobj();
$this->_out('<</Type /Font');
$this->_out('/BaseFont /' . $name);
$this->_out('/Subtype /' . $type);
$this->_out('/FirstChar 32 /LastChar 255');
$this->_out('/Widths ' . ($this->n + 1) . ' 0 R');
$this->_out('/FontDescriptor ' . ($this->n + 2) . ' 0 R');
if ($font['enc']) {
if (isset($font['diff'])) {
$this->_out('/Encoding ' . ($nf + $font['diff']) . ' 0 R');
} else {
$this->_out('/Encoding /WinAnsiEncoding');
}
}
$this->_out('>>');
$this->_out('endobj');
//Widths
$this->_newobj();
$cw =& $font['cw'];
$s = '[';
for ($i = 32; $i <= 255; $i++) {
$s .= $cw[chr($i)] . ' ';
}
$this->_out($s . ']');
$this->_out('endobj');
//Descriptor
$this->_newobj();
$s = '<</Type /FontDescriptor /FontName /' . $name;
foreach ($font['desc'] as $k => $v) {
$s .= ' /' . $k . ' ' . $v;
}
$file = $font['file'];
//.........这里部分代码省略.........