本文整理汇总了PHP中addslash函数的典型用法代码示例。如果您正苦于以下问题:PHP addslash函数的具体用法?PHP addslash怎么用?PHP addslash使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addslash函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: my_pathinfo
function my_pathinfo($param = NULL)
{
removeslash($param, 0);
$tab["dirname"] = preg_match("/(^.+)\\//", $param, $dump) ? $dump[1] : ".";
if (preg_match("/.*\\/(.*)\$/", $param, $dump)) {
$tab["basename"] = $dump[1];
} else {
removeslash($param, 1);
preg_match("/(.*)/", $param, $dump);
$tab["basename"] = $dump[1];
}
if ($param === ".." || $param === ".") {
dotordot($param, $tab);
} else {
if (preg_match("/[.]([^.\\/]*)\$/", $param, $dump)) {
$tab["extension"] = $dump[1];
addslash($param);
preg_match("/\\/([^\\/]*)\\.[^\\/]*\$/", $param, $dump);
$tab["filename"] = $dump[1];
} else {
preg_match("/\\/?([^\\/]+)[.\\/]?\$/", $param, $dump);
$tab["filename"] = $dump[1];
}
}
return $tab;
}
示例2: __construct
public function __construct()
{
global $topDirectory;
$this->datafile = addslash(getSettingsPath()) . 'fileshare.dat';
$this->check_post($this->postlist);
$this->load();
$this->userdir = addslash($topDirectory);
}
示例3: getTempDir
public static function getTempDir($token = null)
{
if ($token !== null) {
return array('tok' => $token, 'dir' => addslash(addslash(self::$config['tempdir']) . '.rutorrent/.fman/' . $token));
}
if (is_null(self::$tmpdir)) {
$tmp = self::newTempDir();
self::$tmpdir = $tmp;
}
return self::$tmpdir;
}
示例4: move
public function move($files, $to)
{
$temp = Helper::getTempDir();
$args = array('action' => 'recursiveMove', 'params' => array('files' => $files, 'to' => addslash($to)), 'temp' => $temp);
$task = $temp['dir'] . 'task';
file_put_contents($task, json_encode($args));
$task_opts = array('requester' => 'filemanager', 'name' => 'move');
$rtask = new \rTask($task_opts);
$commands = array(Helper::getTaskCmd() . " " . escapeshellarg($task));
$ret = $rtask->start($commands, 0);
// var_dump($ret);
return $temp;
}
示例5: fastResume
public static function fastResume($torrent, $base, $add_path = true)
{
$files = array();
$info = $torrent->info;
$psize = intval($info['piece length']);
$base = trim($base);
if ($base == '') {
$req = new rXMLRPCRequest(new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, 'get_directory'));
if ($req->success()) {
$base = $req->val[0];
}
}
if ($psize && \model\xmlrpc\rTorrentSettings::get(\config\Conf::$userscgi)->correctDirectory($base)) {
$base = addslash($base);
$tsize = 0.0;
if (isset($info['files'])) {
foreach ($info['files'] as $key => $file) {
$tsize += floatval($file['length']);
$files[] = $add_path ? $info['name'] . "/" . implode('/', $file['path']) : implode('/', $file['path']);
}
} else {
$tsize = floatval($info['length']);
$files[] = $info['name'];
}
$chunks = intval(($tsize + $psize - 1) / $psize);
$torrent->{'libtorrent_resume'}['bitfield'] = intval($chunks);
if (!isset($torrent->{'libtorrent_resume'}['files'])) {
$torrent->{'libtorrent_resume'}['files'] = array();
}
foreach ($files as $key => $file) {
$ss = LFS::stat($base . $file);
if ($ss === false) {
return false;
}
if (count($torrent->{'libtorrent_resume'}['files']) < $key) {
$torrent->{'libtorrent_resume'}['files'][$key]['mtime'] = $ss["mtime"];
} else {
$torrent->{'libtorrent_resume'}['files'][$key] = array("priority" => 2, "mtime" => $ss["mtime"]);
}
}
return $torrent;
}
return false;
}
示例6: simplify_path
function simplify_path ($path) {
global $delim;
if (@file_exists($path) && function_exists('realpath') && @realpath($path) != '') {
$path = realpath($path);
if (@is_dir($path)) {
return addslash($path);
} else {
return $path;
}
}
$pattern = $delim . '.' . $delim;
if (@is_dir($path)) {
$path = addslash($path);
}
while (strpos($path, $pattern) !== false) {
$path = str_replace($pattern, $delim, $path);
}
$e = addslashes($delim);
$regex = $e . '((\.[^\.' . $e . '][^' . $e . ']*)|(\.\.[^' . $e . ']+)|([^\.][^' . $e . ']*))' . $e . '\.\.' . $e;
while (ereg($regex, $path)) {
$path = ereg_replace($regex, $delim, $path);
}
return $path;
}
示例7: array
} else {
require_once INCLUDES . "html_buttons_include.php";
}
$settings2 = array();
$result = dbquery("SELECT * FROM " . DB_SETTINGS);
while ($data = dbarray($result)) {
$settings2[$data['settings_name']] = $data['settings_value'];
}
if (isset($_POST['savesettings'])) {
$error = 0;
if (addslash($_POST['license_agreement']) != $settings2['license_agreement']) {
$license_lastupdate = time();
} else {
$license_lastupdate = $settings2['license_lastupdate'];
}
$license_agreement = addslash(preg_replace("(^<p>\\s</p>\$)", "", $_POST['license_agreement']));
$result = dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . (isnum($_POST['enable_registration']) ? $_POST['enable_registration'] : "1") . "' WHERE settings_name='enable_registration'");
if (!$result) {
$error = 1;
}
$result = dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . (isnum($_POST['email_verification']) ? $_POST['email_verification'] : "1") . "' WHERE settings_name='email_verification'");
if (!$result) {
$error = 1;
}
$result = dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . (isnum($_POST['admin_activation']) ? $_POST['admin_activation'] : "0") . "' WHERE settings_name='admin_activation'");
if (!$result) {
$error = 1;
}
$result = dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . (isnum($_POST['display_validation']) ? $_POST['display_validation'] : "1") . "' WHERE settings_name='display_validation'");
if (!$result) {
$error = 1;
示例8: redirect
} else {
redirect(FUSION_SELF . $aidlink);
}
}
}
}
if (isset($_GET['action']) && $_GET['action'] == "2" && (isset($_GET['t']) && $_GET['t'] == "a")) {
if (isset($_POST['publish']) && (isset($_GET['submit_id']) && isnum($_GET['submit_id']))) {
$result = dbquery("SELECT ts.submit_criteria, user_id\r\n\t\t\tFROM " . DB_SUBMISSIONS . " ts\r\n\t\t\tLEFT JOIN " . DB_USERS . " tu ON ts.submit_user=tu.user_id\r\n\t\t\tWHERE submit_id='" . $_GET['submit_id'] . "'");
if (dbrows($result)) {
$data = dbarray($result);
$submit_criteria = unserialize($data['submit_criteria']);
$article_cat = isnum($_POST['article_cat']) ? $_POST['article_cat'] : 0;
$article_subject = stripinput($_POST['article_subject']);
$article_snippet = addslash($_POST['article_snippet']);
$article_body = addslash($_POST['article_body']);
$article_breaks = $_POST['article_breaks'] == "y" ? "y" : "n";
$result = dbquery("INSERT INTO " . DB_ARTICLES . " (article_cat, article_subject, article_snippet, article_article, article_breaks, article_name, article_datestamp, article_reads, article_allow_comments, article_allow_ratings) VALUES ('{$article_cat}', '{$article_subject}', '{$article_snippet}', '{$article_body}', '{$article_breaks}', '" . $data['user_id'] . "', '" . time() . "', '0', '1', '1' ,'" . LANGUAGE . "')");
$result = dbquery("DELETE FROM " . DB_SUBMISSIONS . " WHERE submit_id='" . $_GET['submit_id'] . "'");
opentable($locale['530']);
echo "<br /><div style='text-align:center'>" . $locale['531'] . "<br /><br />\n";
echo "<a href='" . FUSION_SELF . $aidlink . "'>" . $locale['402'] . "</a><br /><br />\n";
echo "<a href='index.php" . $aidlink . "'>" . $locale['403'] . "</a></div><br />\n";
closetable();
} else {
redirect(FUSION_SELF . $aidlink);
}
} else {
if (isset($_POST['delete']) && (isset($_GET['submit_id']) && isnum($_GET['submit_id']))) {
opentable($locale['532']);
$result = dbquery("DELETE FROM " . DB_SUBMISSIONS . " WHERE submit_id='" . $_GET['submit_id'] . "'");
示例9: findRemoteEXE
function findRemoteEXE($exe, $err, &$remoteRequests)
{
$st = getSettingsPath() . '/' . rand();
if (!array_key_exists($exe, $remoteRequests)) {
$path = realpath(dirname('.'));
global $pathToExternals;
$cmd = array("sh", addslash($path) . "test.sh", $exe, $st);
if (isset($pathToExternals[$exe]) && !empty($pathToExternals[$exe])) {
$cmd[] = $pathToExternals[$exe];
}
$req = new rXMLRPCRequest(new rXMLRPCCommand("execute", $cmd));
$req->run();
$remoteRequests[$exe] = array("path" => $st, "err" => array());
}
$remoteRequests[$exe]["err"][] = $err;
}
示例10: move
public function move($paths)
{
$files = array_map(array($this, 'getWorkDir'), (array) $paths->fls);
// destination dir requires ending /
$to = addslash($this->getUserDir($paths->to));
// var_dump($paths, $files);
$fs = Fs::get();
if (!$fs->isDir($to)) {
throw new Exception("Destination is not directory", 2);
}
$task_info = $fs->move($files, $to);
return $task_info;
}
示例11: author
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (fusion_get_settings("tinymce_enabled")) {
echo "<script language='javascript' type='text/javascript'>advanced();</script>\n";
}
if (isset($_GET['submit_id']) && isnum($_GET['submit_id'])) {
if (isset($_POST['publish']) && (isset($_GET['submit_id']) && isnum($_GET['submit_id']))) {
$result = dbquery("SELECT ts.*, tu.user_id, tu.user_name FROM " . DB_SUBMISSIONS . " ts\n\t\t\tLEFT JOIN " . DB_USERS . " tu ON ts.submit_user=tu.user_id\n\t\t\tWHERE submit_id='" . $_GET['submit_id'] . "'");
if (dbrows($result)) {
$data = dbarray($result);
$data = array('article_id' => 0, 'article_subject' => form_sanitizer($_POST['article_subject'], '', 'article_subject'), 'article_cat' => form_sanitizer($_POST['article_cat'], 0, 'article_cat'), 'article_name' => $data['user_id'], 'article_snippet' => addslash(preg_replace("(^<p>\\s</p>\$)", "", $_POST['article_snippet'])), 'article_article' => addslash(preg_replace("(^<p>\\s</p>\$)", "", $_POST['article_article'])), 'article_keywords' => form_sanitizer($_POST['article_keywords'], '', 'article_keywords'), 'article_datestamp' => form_sanitizer($_POST['article_datestamp'], time(), 'article_datestamp'), 'article_visibility' => form_sanitizer($_POST['article_visibility'], 0, 'article_visibility'), 'article_draft' => isset($_POST['article_draft']) ? "1" : "0", 'article_allow_comments' => 0, 'article_allow_ratings' => 0, 'article_language' => form_sanitizer($_POST['article_language'], '', 'article_language'));
if (fusion_get_settings('tinymce_enabled') != 1) {
$data['article_breaks'] = isset($_POST['line_breaks']) ? "y" : "n";
} else {
$data['article_breaks'] = "n";
}
if (defender::safe()) {
dbquery_insert(DB_ARTICLES, $data, "save");
$result = dbquery("DELETE FROM " . DB_SUBMISSIONS . " WHERE submit_id='" . $_GET['submit_id'] . "'");
if ($data['article_draft']) {
addNotice("success", $locale['articles_0051']);
} else {
addNotice("success", $locale['articles_0050']);
}
redirect(clean_request("", array("submit_id"), FALSE));
}
示例12: elseif
}
} elseif (isset($_POST['save_forum'])) {
$forum_name = trim(stripinput($_POST['forum_name']));
$forum_description = trim(stripinput($_POST['forum_description']));
$forum_cat = isnum($_POST['forum_cat']) ? $_POST['forum_cat'] : 0;
if (isset($_GET['action']) && $_GET['action'] == "edit" && (isset($_GET['forum_id']) && isnum($_GET['forum_id'])) && (isset($_GET['t']) && $_GET['t'] == "forum")) {
$forum_mods = $_POST['forum_mods'];
$forum_access = isnum($_POST['forum_access']) ? $_POST['forum_access'] : 0;
$forum_post = isnum($_POST['forum_post']) ? $_POST['forum_post'] : 0;
$forum_reply = isnum($_POST['forum_reply']) ? $_POST['forum_reply'] : 0;
$forum_attach = isnum($_POST['forum_attach']) ? $_POST['forum_attach'] : 0;
$forum_poll = isnum($_POST['forum_poll']) ? $_POST['forum_poll'] : 0;
$forum_vote = isnum($_POST['forum_vote']) ? $_POST['forum_vote'] : 0;
$result = dbquery("UPDATE " . DB_FORUMS . " SET forum_name='{$forum_name}', forum_cat='{$forum_cat}', forum_description='{$forum_description}', forum_moderators='{$forum_mods}', forum_access='{$forum_access}', forum_post='{$forum_post}', forum_reply='{$forum_reply}', forum_attach='{$forum_attach}', forum_poll='{$forum_poll}', forum_vote='{$forum_vote}' WHERE forum_id='" . $_GET['forum_id'] . "'");
// start fb4 mod
$forum_icon = addslash(stripinput($_POST['forum_icon']));
$forum_parent = isset($_POST['forum_parent']) && isNum($_POST['forum_parent']) ? $_POST['forum_parent'] : 0;
$result = dbquery("UPDATE " . $db_prefix . "fb_forums set forum_icon='{$forum_icon}', forum_parent='{$forum_parent}' where forum_id='" . $_GET['forum_id'] . "'");
// end fb4 mod
redirect(FUSION_SELF . $aidlink . "§ion=forums&status=savefu");
} else {
if ($forum_name) {
$forum_order = isnum($_POST['forum_order']) ? $_POST['forum_order'] : "";
$forum_parent = isset($_POST['forum_parent']) && isNum($_POST['forum_parent']) ? $_POST['forum_parent'] : 0;
if (!$forum_order) {
$forum_order = dbresult(dbquery("SELECT MAX(forum_order) FROM " . DB_FORUMS . " f\n\t\t\t\tleft join " . DB_PREFIX . "fb_forums f2 on f2.forum_id=f.forum_id\n\t\t\t\tWHERE f2.forum_parent='{$forum_parent}'"), 0) + 1;
}
$result2 = dbquery("select * from " . DB_FORUMS . " f\n\t\t\tleft join " . DB_PREFIX . "fb_forums f2 on f2.forum_id=f.forum_id\n\t\t\tWHERE forum_cat='{$forum_cat}' AND forum_order>='{$forum_order}'" . ($forum_parent ? " AND f2.forum_parent='{$forum_parent}'" : ""));
while ($data2 = dbarray($result2)) {
$result = dbquery("UPDATE " . DB_FORUMS . " SET forum_order=forum_order+1 where forum_id='" . $data2['forum_id'] . "'");
}
示例13: getTempDirectory
function getTempDirectory()
{
global $tempDirectory;
if (empty($tempDirectory)) {
$directories = array();
if (ini_get('upload_tmp_dir')) {
$directories[] = ini_get('upload_tmp_dir');
}
if (function_exists('sys_get_temp_dir')) {
$directories[] = sys_get_temp_dir();
}
$directories[] = '/tmp';
foreach ($directories as $directory) {
if (is_dir($directory) && is_writable($directory)) {
$tempDirectory = $directory;
break;
}
}
if (empty($tempDirectory)) {
$tempDirectory = getProfilePath() . '/tmp';
}
$tempDirectory = addslash($tempDirectory);
}
return $tempDirectory;
}
示例14: dbcount
}
if (isset($_GET['deny']) && isNum($_GET['deny']) && $userdata['user_id'] == $data['group_leader']) {
$apply = dbcount("(apply_user)", DB_PREFIX . "fb_apply", "apply_group='" . $data['group_id'] . "' and apply_user='" . $_GET['deny'] . "'");
if ($apply) {
$query = dbquery("delete from " . DB_PREFIX . "fb_apply where apply_group='" . $data['group_id'] . "' and apply_user='" . $_GET['deny'] . "'");
$message = str_replace(array("{1}"), array($settings['siteurl'] . "infusions/fusionboard4/groups.php?view=" . $data['group_id']), $locale['uc307']);
sendMessage($applyUser['user_id'], $data['group_leader'], $locale['uc305'], $message);
redirect(FUSION_SELF . "?section=groups&view=" . $_GET['view']);
} else {
redirect(FUSION_SELF . "?section=groups&view=" . $_GET['view']);
}
}
if (isset($_GET['action']) && $_GET['action'] == "edit" && $userdata['user_id'] == $data['group_leader']) {
if (isset($_POST['goGroup'])) {
$group_name = isset($_POST['group_name']) ? addslash(stripinput($_POST['group_name'])) : "";
$group_desc = isset($_POST['group_desc']) ? addslash(stripinput($_POST['group_desc'])) : "";
$group_type = isset($_POST['group_type']) && isNum($_POST['group_type']) ? $_POST['group_type'] : 1;
$group_wall = isset($_POST['group_wall']) && isNum($_POST['group_wall']) ? $_POST['group_wall'] : 0;
$group_visibility = isset($_POST['group_visibility']) && isNum($_POST['group_visibility']) ? $_POST['group_visibility'] : 0;
$group_moderate = isset($_POST['group_moderate']) && isNum($_POST['group_moderate']) ? $_POST['group_moderate'] : 0;
$result = dbquery("update " . DB_PREFIX . "fb_groups set group_description='{$group_desc}', group_access='{$group_type}', \n\t\t\tgroup_wall='{$group_wall}', group_visibility='{$group_visibility}', group_moderate='{$group_moderate}' \n\t\t\twhere group_id='" . $_GET['view'] . "'");
$result = dbquery("update " . DB_USER_GROUPS . " set group_name='{$group_name}', group_description='{$group_desc}' where group_id='" . $_GET['view'] . "'");
redirect(FUSION_SELF . "?section=groups&view=" . $_GET['view']);
}
echo "<tr>\n<td class='forum-caption' style='padding-left:5px;'>" . $locale['uc367'] . "\"" . stripslash($data['group_name']) . "\"</td>\n</tr>\n";
echo "<tr>\n<td class='tbl1' style='padding:10px;'><form action='" . FUSION_SELF . "?section=groups&view=" . $_GET['view'] . "&action=edit' method='post' name='groupeditform'>\n";
echo $locale['uc266'] . "<br /><input name='group_name' class='textbox' style='font-size:14px;margin:3px;margin-left:6px;width:320px;' value='" . stripslash($data['group_name']) . "'><br />\n";
echo $locale['uc267'] . "<br /><textarea name='group_desc' class='textbox' style='font-size:14px;margin:3px;margin-left:6px;width:320px;'>" . stripslash($data['group_description']) . "</textarea><br />\n";
echo $locale['uc268'] . "<br />\n<select name='group_type' class='textbox grouptext'>\n";
echo "<option value='1'" . ($data['group_access'] == "1" ? " SELECTED" : "") . ">" . $locale['uc269'] . "</option>\n";
echo "<option value='2'" . ($data['group_access'] == "2" ? " SELECTED" : "") . ">" . $locale['uc270'] . "</option>\n";
示例15: dbquery
if (!$result) {
$error = 1;
}
$result = dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . (isnum($_POST['maintenance']) ? $_POST['maintenance'] : "0") . "' WHERE settings_name='maintenance'");
if (!$result) {
$error = 1;
}
$result = dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . addslash(descript($_POST['maintenance_message'])) . "' WHERE settings_name='maintenance_message'");
if (!$result) {
$error = 1;
}
$result = dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . (isnum($_POST['bad_words_enabled']) ? $_POST['bad_words_enabled'] : "0") . "' WHERE settings_name='bad_words_enabled'");
if (!$result) {
$error = 1;
}
$result = dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . addslash($_POST['bad_words']) . "' WHERE settings_name='bad_words'");
if (!$result) {
$error = 1;
}
$result = dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . stripinput($_POST['bad_word_replace']) . "' WHERE settings_name='bad_word_replace'");
if (!$result) {
$error = 1;
}
if ($_POST['captcha'] == "recaptcha" && ($_POST['recaptcha_public'] == "" || $_POST['recaptcha_private'] == "")) {
$error = 2;
} else {
$result = dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . stripinput($_POST['captcha']) . "' WHERE settings_name='captcha'");
if (!$result) {
$error = 1;
}
$result = dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . stripinput($_POST['recaptcha_public']) . "' WHERE settings_name='recaptcha_public'");