本文整理汇总了PHP中smart_addslashes函数的典型用法代码示例。如果您正苦于以下问题:PHP smart_addslashes函数的具体用法?PHP smart_addslashes怎么用?PHP smart_addslashes使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smart_addslashes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
$link_back = isset($_REQUEST['link_back']) && $_REQUEST['link_back'] != '' ? $_REQUEST['link_back'] : $_SERVER['REQUEST_URI'];
$db = new db();
switch ($task) {
case 'send':
if ($_REQUEST['message'] == '') {
$feedback .= 'Message is empty';
} else {
if ($receipient_id > 0) {
if ($db->query("SELECT * FROM messages_users WHERE user_id='{$receipient_id}'") && $db->next_record()) {
$has_permission = $GO_SECURITY->has_permission($GO_SECURITY->user_id, $db->f('acl_write'));
} else {
$has_permission = true;
}
if ($has_permission) {
$msg_id = $db->nextid("messages_messages");
$db->query("INSERT INTO messages_messages (id,user_id,sender_id,ctime, text) VALUES ('{$msg_id}','{$receipient_id}','{$GO_SECURITY->user_id}','" . get_gmt_time() . "','" . smart_addslashes($_REQUEST['message']) . "')");
$db->query("INSERT INTO messages_new (id) VALUES ('{$msg_id}')");
} else {
$feedback .= "You are not allowed to send message to the receipient";
}
} else {
$feedback .= 'You did not specify receipient';
}
}
break;
case 'delete':
if (is_array($_REQUEST['msgs'])) {
$db->query("DELETE FROM messages_messages WHERE id in (" . implode(',', $_REQUEST['msgs']) . ")");
$db->query("DELETE FROM messages_new WHERE id in (" . implode(',', $_REQUEST['msgs']) . ")");
}
break;
示例2: sqlsecure
function sqlsecure($query, $format = "str")
{
#return str_replace('<','<',$query);
return smart_addslashes($query);
}
示例3: elseif
if ($pass1 == '' || $username == '') {
$feedback = '<font color="red">Please enter a password and a username!</font>';
} elseif (strlen($pass1) < 4) {
$feedback = '<font color="red">Password can\'t be shorter then 4 characters!</font>';
} elseif ($pass1 != $pass2) {
$feedback = '<font color="red">Passwords did not match!</font>';
} elseif (!eregi("^([a-z0-9]+)([._-]([a-z0-9]+))*[@]([a-z0-9]+)([._-]([a-z0-9]+))*[.]([a-z0-9]){2}([a-z0-9])?\$", $email)) {
$feedback = '<font color="red">Invalid E-mail address!</font>';
} else {
$GO_USERS->get_users();
$new_user_id = $GO_USERS->nextid("users");
$GO_GROUPS->query("DELETE FROM db_sequence WHERE seq_name='groups'");
$GO_GROUPS->query("DELETE FROM groups");
$admin_group_id = $GO_GROUPS->add_group($new_user_id, 'Admins');
$root_group_id = $GO_GROUPS->add_group($new_user_id, 'Everyone');
$new_user_id = $GO_USERS->add_user(smart_addslashes($username), smart_addslashes($pass1), '', '', '', '', '', 'M', '', smart_addslashes($email), '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', true, $new_user_id);
$old_umask = umask(00);
mkdir($GO_CONFIG->file_storage_path . 'users', $GO_CONFIG->create_mode);
mkdir($GO_CONFIG->file_storage_path . 'common', $GO_CONFIG->create_mode);
mkdir($GO_CONFIG->file_storage_path . 'users/' . smartstrip($username), $GO_CONFIG->create_mode);
umask($old_umask);
//grant administrator privileges
$GO_GROUPS->add_user_to_group($new_user_id, $GO_CONFIG->group_root);
$_SESSION['completed']['administrator'] = true;
}
break;
case 'license':
$_SESSION['completed']['license'] = true;
break;
case 'release_notes':
$_SESSION['completed']['release_notes'] = true;
示例4: smart_addslashes
$cellular = smart_addslashes($_POST["cellular"]);
$country = smart_addslashes($_POST["country"]);
$state = smart_addslashes($_POST["state"]);
$city = smart_addslashes($_POST["city"]);
$zip = smart_addslashes($_POST["zip"]);
$address = smart_addslashes($_POST["address"]);
$department = smart_addslashes($_POST["department"]);
$function = smart_addslashes($_POST["function"]);
$company = smart_addslashes($_POST["company"]);
$work_country = smart_addslashes($_POST["work_country"]);
$work_state = smart_addslashes($_POST["work_state"]);
$work_city = smart_addslashes($_POST["work_city"]);
$work_zip = smart_addslashes($_POST["work_zip"]);
$work_address = smart_addslashes($_POST["work_address"]);
$work_fax = smart_addslashes($_POST["work_fax"]);
$homepage = smart_addslashes($_POST["homepage"]);
require $GO_CONFIG->class_path . "/validate.class.inc";
$val = new validate();
//translate the given birthdayto gmt unix time
$birthday = date_to_db_date($_POST['birthday']);
$val->error_required = $error_required;
$val->error_min_length = $error_min_length;
$val->error_max_length = $error_max_length;
$val->error_expression = $error_email;
$val->error_match = $error_match_auth;
$val->name = "first_name";
$val->input = $_POST['first_name'];
$val->max_length = 50;
$val->required = true;
$val->validate_input();
$val->name = "last_name";
示例5: or
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
*/
require "../../Group-Office.php";
$GO_SECURITY->authenticate();
require $GO_LANGUAGE->get_base_language_file('preferences');
$return_to = $GO_CONFIG->host . 'configuration/';
$save_action = isset($_POST['save_action']) ? $_POST['save_action'] : false;
require $GO_THEME->theme_path . "header.inc";
if ($_SERVER['REQUEST_METHOD'] == "POST") {
if ($save_action) {
$mail_client = isset($_POST['mail_client']) ? $_POST['mail_client'] : "0";
$DST = isset($_POST['DST']) ? '1' : '0';
//if date formats are not present in the settings then use this default
$date_format = isset($_POST['date_format']) && $_POST['date_format'] != '' ? $_POST['date_format'] : 'd-m-Y H:i';
$GO_USERS->set_preferences($GO_SECURITY->user_id, smart_addslashes($_POST['date_format']), smart_addslashes($_POST['time_format']), smart_addslashes($_POST['thousands_seperator']), smart_addslashes($_POST['decimal_seperator']), smart_addslashes($_POST['currency']), $mail_client, $_POST['max_rows_list'], $_POST['timezone'], $DST, $_POST['start_module'], $_POST['language'], $_POST['theme'], $_POST['first_weekday']);
$save_action = false;
echo '<script type="text/javascript">';
if ($_POST['close'] == 'true') {
echo 'parent.location="' . $GO_CONFIG->host . 'index.php?return_to=' . urlencode($return_to) . '";';
} else {
echo 'parent.location="' . $GO_CONFIG->host . 'index.php?return_to=' . urlencode($_SERVER['PHP_SELF']) . '";';
}
echo '</script>';
}
}
$tabtable = new tabtable('preferences_tab', $menu_preferences, '100%', '400', '120', '', true);
$tabtable->add_tab('preferences', $menu_preferences_tab);
$tabtable->add_tab('modules', $menu_modules_tab);
?>
<form name="preferences" method="post" action="<?php
示例6: smartstrip
echo smartstrip($_REQUEST['query']);
}
echo '"></td></tr>';
echo '<tr><td colspan="2">';
echo '<table><tr><td>';
$button = new button($cmdSearch, 'javascript:add_users()');
echo '</td><td>';
$button = new button($cmdShowAll, "javascript:document.group.query.value='';add_users()");
echo '</td><td>';
$button = new button($cmdCancel, 'javascript:return_to_group()');
echo '</td></tr></table>';
echo '</td></tr></table>';
if (isset($_REQUEST['query'])) {
echo '<table border="0" cellpadding="3" cellspacing="0"><tr><td>';
if ($_REQUEST['query'] != '') {
$GO_USERS->search('%' . smart_addslashes($_REQUEST['query']) . '%', smart_addslashes($search_field), $GO_SECURITY->user_id);
} else {
$GO_USERS->get_authorized_users($GO_SECURITY->user_id);
}
echo '<select name="group_users[]" multiple="true" style="width: 250px;height: 200px;" class="textbox">';
while ($GO_USERS->next_record()) {
$middle_name = $GO_USERS->f('middle_name') == '' ? '' : $GO_USERS->f('middle_name') . ' ';
//$name = $GO_USERS->f('first_name').' '.$middle_name.$GO_USERS->f('last_name');
$name = $GO_USERS->f('last_name') . ' ' . $middle_name . $GO_USERS->f('first_name');
echo '<option value="' . $GO_USERS->f('id') . '">' . $name . '</option>';
}
echo '</select>';
echo '<table><tr><td>';
$button = new button($cmdAdd, 'javascript:save_add_users()');
echo '</td></tr></table>';
echo '</td></tr></table>';
示例7: header
header('Location: ' . $return_to);
exit;
}
}
}
} else {
if ($name == '' || $task_template_id == 0) {
$feedback = '<p class="Error">' . $error_missing_field . '</p>';
} elseif ($projects->get_project_by_name($name)) {
$feedback = '<p class="Error">' . $pm_project_exists . '</p>';
} else {
$acl_read = $GO_SECURITY->get_new_acl('Project read: ' . $name);
$acl_write = $GO_SECURITY->get_new_acl('Project write: ' . $name);
if ($acl_read > 0 && $acl_write > 0) {
if ($GO_SECURITY->add_user_to_acl($GO_SECURITY->user_id, $acl_write)) {
if (!($project_id = $projects->add_project($GO_SECURITY->user_id, $name, smart_addslashes($_GET['description']), $_GET['contact_id'], smart_addslashes($_GET['comments']), $start_date, $end_date, STATUS_BEGIN, $_GET['responsible_user_id'], $_GET['probability'], $_GET['fee_id'], $_GET['budget'], $acl_read, $acl_write, $_GET['task_template_id'], $_GET['catalog']))) {
$GO_SECURITY->delete_acl($acl_read);
$GO_SECURITY->delete_acl($acl_write);
$feedback = '<p class="Error">' . $strSaveError . '</p>';
} else {
$is_brandnew_project = true;
$task = 'write_permissions';
$active_tab = 1;
}
} else {
$GO_SECURITY->delete_acl($acl_read);
$GO_SECURITY->delete_acl($acl_write);
$feedback = '<p class="Error">' . $strSaveError . '</p>';
}
} else {
$feedback = '<p class="Error">' . $strAclError . '</p>';
示例8: tabtable
$tabtable->add_tab('write_permissions', $strWriteRights);
if ($site['acl_read'] > 0) {
$tabtable->add_tab('read_permissions', $strReadRights);
}
if ($task == 'edit_search_words') {
$tabtable->set_active_tab('search_words');
}
} else {
$tabtable = new tabtable('properties', $cms_new_site, '600', '400');
}
switch ($task) {
case 'save_search_word':
if ($_POST['close'] == 'false') {
$task = 'add_search_word';
}
$search_word_name = smart_addslashes(trim($_POST['search_word_name']));
if ($search_word_name == '') {
$feedback = '<p class="Error">' . $error_missing_field . '</p>';
$task = 'add_search_word';
} else {
$search_word_id = isset($_POST['search_word_id']) ? $_POST['search_word_id'] : 0;
if ($search_word_id > 0) {
$search_word = $cms->get_search_word_by_name($site_id, $search_word_name);
if ($search_word && $search_word['id'] != $search_word_id) {
$feedback = '<p class="Error">' . $fbNameExists . '</p>';
$task = 'add_search_word';
} else {
$cms->update_search_word($search_word_id, $search_word_name);
}
} else {
if ($cms->get_search_word_by_name($site_id, $search_word_name)) {
示例9: or
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.
*/
require "../../Group-Office.php";
$GO_SECURITY->authenticate();
require $GO_LANGUAGE->get_language_file('bookmarks');
$GO_MODULES->authenticate('bookmarks');
require $GO_MODULES->path . 'classes/bookmarks.class.inc';
$bookmarks = new bookmarks();
$bookmark_id = isset($_REQUEST['bookmark_id']) ? $_REQUEST['bookmark_id'] : 0;
$task = isset($_REQUEST['task']) ? $_REQUEST['task'] : '';
switch ($task) {
case 'save':
$URL = smart_addslashes(trim($_REQUEST['URL']));
$name = smart_addslashes(trim($_REQUEST['name']));
$invalid[] = "\"";
$invalid[] = "&";
$invalid[] = "?";
if (!validate_input($name, $invalid)) {
$feedback = "<p class=\"Error\">" . $invalid_chars . ": \" & ?</p>";
} else {
if ($URL != "" && $name != "") {
/*if (!eregi('(^http[s]*:[/]+)(.*)', $URL))
{
$URL= "http://".$URL;
}*/
$new_window = isset($_REQUEST['new_window']) ? $_REQUEST['new_window'] : 0;
if ($bookmark_id > 0) {
if (!$bookmarks->update_bookmark($bookmark_id, $_POST['catagory_id'], $URL, $name, $new_window)) {
$feedback = "<p class=\"Error\">" . $strSaveError . "</p>";
示例10: while
} else {
while ($mailbox = array_shift($subscribed)) {
if ($mail->unsubscribe($mailbox['name'])) {
$email->unsubscribe($account['id'], addslashes($mailbox['name']));
}
}
}
$sent = isset($_POST['sent']) ? smart_addslashes($_POST['sent']) : '';
$draft = isset($_POST['draft']) ? smart_addslashes($_POST['draft']) : '';
$spam = isset($_POST['spam']) ? smart_addslashes($_POST['spam']) : '';
$trash = isset($_POST['trash']) ? smart_addslashes($_POST['trash']) : '';
$email->update_folders($account['id'], $sent, $spam, $trash, $draft);
if (isset($_POST['new_name'])) {
$new_name = smart_addslashes(trim($_POST['new_name']));
$old_name = smart_addslashes(trim($_POST['old_name']));
$location = smart_addslashes(trim($_POST['location']));
if ($new_name == '') {
$feedback = '<p class="Error">' . $error_missing_field . '</p>';
} else {
if ($mail->rename_folder($old_name, $location . $new_name)) {
$email->rename_folder($account_id, $old_name, $location . $new_name);
}
}
}
}
if (isset($_POST['close']) && $_POST['close'] == 'true') {
header('Location: ' . $return_to);
exit;
}
require $GO_THEME->theme_path . "header.inc";
echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '" name="email_client">';
示例11: trim
case 'save_company':
$name = trim(smart_addslashes($_POST['name']));
$shortname = trim(smart_addslashes($_POST['shortname']));
$engname = trim(smart_addslashes($_POST['engname']));
$relation_date = smart_addslashes($_POST["relation_date"]);
$address = smart_addslashes($_POST["address"]);
$zip = smart_addslashes($_POST["zip"]);
$city = smart_addslashes($_POST["city"]);
$state = smart_addslashes($_POST["state"]);
$country = smart_addslashes($_POST["country"]);
$email = smart_addslashes($_POST["email"]);
$phone = smart_addslashes($_POST["phone"]);
$fax = smart_addslashes($_POST["fax"]);
$homepage = smart_addslashes($_POST["homepage"]);
$bank_no = smart_addslashes($_POST["bank_no"]);
$vat_no = smart_addslashes($_POST["vat_no"]);
$parent_id = $_POST['parent_id'];
$relation_date = date_to_db_date($_POST['relation_date']);
if ($name == '') {
$feedback = "<p class=\"Error\">" . $error_missing_field . "</p>";
} else {
if ($_POST['company_id'] > 0) {
$seen = array();
$seen[$_POST['company_id']] = 1;
$parent = $parent_id;
while ($parent != 0 && !isset($seen[$parent])) {
$seen[$parent] = 1;
$sql = "SELECT parent FROM ab_companies WHERE id='{$parent}'";
if ($ab->query($sql) && $ab->next_record()) {
$parent = $ab->f('parent');
}
示例12: button
$button = new button($cmdSearch, "javascript:search()");
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<?php
if ($task == 'search' || $task == 'show_letter') {
if ($task == 'show_letter') {
$query = smart_addslashes($_POST['query']) . '%';
} else {
$query = '%' . smart_addslashes($_POST['query']) . '%';
}
if ($search_type == 'contacts' || $search_type == 'users') {
if ($search_type == 'users') {
$click_type = 'user';
$array_name = 'users[]';
$ab1 = new GO_USERS();
$ab1->search($query, $search_field, $GO_SECURITY->user_id);
} else {
$click_type = 'contact';
$array_name = 'contacts[]';
$ab1->search_contacts($GO_SECURITY->user_id, $query, $search_field, $ab_settings['search_addressbook_id']);
}
$search_results = '';
while ($ab1->next_record()) {
if ((!$require_email_address || $ab1->f("email") != '') && ($search_type == 'users' && $GO_SECURITY->has_permission($GO_SECURITY->user_id, $ab1->f('acl_id')) || $search_type != 'users' && ($GO_SECURITY->has_permission($GO_SECURITY->user_id, $ab1->f('acl_read')) || $GO_SECURITY->has_permission($GO_SECURITY->user_id, $ab1->f('acl_write'))))) {
示例13: preg_replace
exit;
}
if ($task == 'save') {
if ($file_id > 0) {
//fix for inserted iframes
$content = preg_replace("'<iframe([^>]*)/>'si", "<iframe\$1></iframe>", $_POST['content']);
$cms->update_file($file_id, smart_addslashes($_POST['name']), smart_addslashes($content), smart_addslashes($_POST['title']), smart_addslashes($_POST['description']), smart_addslashes($_POST['keywords']), $_POST['priority'], $_POST['hot_item']);
} else {
$name = smart_addslashes(trim($_POST['name']));
if ($name == '') {
$feedback = '<p class="Error">' . $error_missing_field . '</p>';
} else {
$filename = $name . '.html';
if ($cms->file_exists($folder_id, $filename)) {
$feedback = '<p class="Error">' . $fbNameExists . '</p>';
} elseif (!($file_id = $cms->add_file($folder_id, $filename, smart_addslashes($_POST['content']), '', '', '', $_POST['priority']))) {
$feedback = '<p class="Error">' . $strSaveError . '</p>';
}
}
}
}
if ($file_id > 0) {
$file = $cms->get_file($file_id);
$content = $file['content'];
$name = $file['name'];
$title = $file['title'];
$description = $file['description'];
$keywords = $file['keywords'];
$priority = $file['priority'];
$hot_item = $file['hot_item'];
} else {
示例14: trim
}
break;
case 'save_template_item':
$task = 'template_item';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$name = trim($_POST['name']);
if ($name == '') {
$feedback = '<p class="Error">' . $error_missing_field . '</p>';
} else {
if (isset($_FILES['content_file']) && is_uploaded_file($_FILES['content_file']['tmp_name'])) {
$fp = fopen($_FILES['content_file']['tmp_name'], 'r');
$_POST['content'] = addslashes(fread($fp, $_FILES['content_file']['size']));
fclose($fp);
unlink($_FILES['content_file']['tmp_name']);
} else {
$_POST['content'] = smart_addslashes($_POST['content']);
}
$content = get_html_body($_POST['content']);
$template_item_id = isset($_POST['template_item_id']) ? $_POST['template_item_id'] : 0;
if ($template_item_id > 0) {
if ($template_item = $cms->get_template_by_name($template_id, $name) && $template_item['id'] != $template_item_id) {
$feedback = '<p class="Error">' . $fbNameExists . '</p>';
} else {
if (!$cms->update_template_item($template_item_id, $name, $_POST['content'])) {
$feedback = '<p class="Error">' . $strSaveError . '</p>';
}
}
} else {
if ($cms->get_template_item_by_name($template_id, $name)) {
$feedback = '<p class="Error">' . $fbNameExists . '</p>';
} else {
示例15: smart_addslashes
if (!$is_subscribed && $in_array)
{
$cms2->subscribe_site($GO_SECURITY->user_id, $cms->f('id'));
}
}
}
break;
*/
case 'configuration':
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST['publish_path'])) {
$publish_path = smart_addslashes(trim($_POST['publish_path']));
if (!is_writable($publish_path)) {
$feedback = '<p class="Error">' . $cms_path_not_writable . '</p>';
} else {
$publish_url = smart_addslashes(trim($_POST['publish_url']));
if (substr($publish_path, -1) != $GO_CONFIG->slash) {
$publish_path = $publish_path . $GO_CONFIG->slash;
}
if (!eregi('(^http[s]*:[/]+)(.*)', $publish_url)) {
$publish_url = "http://" . $publish_url;
}
if (substr($publish_url, -1) != '/') {
$publish_url = $publish_url . '/';
}
$GO_CONFIG->save_setting('cms_publish_path', $publish_path);
$GO_CONFIG->save_setting('cms_publish_url', $publish_url);
}
} else {
$GO_CONFIG->delete_setting('cms_publish_path');
$GO_CONFIG->delete_setting('cms_publish_url');