本文整理汇总了PHP中get_error函数的典型用法代码示例。如果您正苦于以下问题:PHP get_error函数的具体用法?PHP get_error怎么用?PHP get_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_error
function check_error($model)
{
$error = get_error($model);
if (!empty($error)) {
return_value_json(false, 'msg', $error);
}
}
示例2: get_subscribed_topic_func
function get_subscribed_topic_func()
{
global $config, $db, $user, $auth, $mobiquo_config;
// Only registered users can go beyond this point
if (!$user->data['is_registered']) {
return get_error(9);
}
$topic_list = array();
if ($config['allow_topic_notify']) {
$forbidden_forums = $auth->acl_getf('!f_read', true);
$forbidden_forums = array_unique(array_keys($forbidden_forums));
if (isset($mobiquo_config['hide_forum_id'])) {
$forbidden_forums = array_unique(array_merge($forbidden_forums, $mobiquo_config['hide_forum_id']));
}
$sql_array = array('SELECT' => 't.*,
f.forum_name,
u.user_avatar,
u.user_avatar_type', 'FROM' => array(TOPICS_WATCH_TABLE => 'tw', TOPICS_TABLE => 't', USERS_TABLE => 'u'), 'WHERE' => 'tw.user_id = ' . $user->data['user_id'] . '
AND t.topic_id = tw.topic_id
AND u.user_id = t.topic_last_poster_id
AND ' . $db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true), 'ORDER_BY' => 't.topic_last_post_time DESC');
$sql_array['LEFT_JOIN'] = array();
$sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 't.forum_id = f.forum_id');
if ($config['allow_bookmarks']) {
$sql_array['SELECT'] .= ', bm.topic_id as bookmarked';
$sql_array['LEFT_JOIN'][] = array('FROM' => array(BOOKMARKS_TABLE => 'bm'), 'ON' => 'bm.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = bm.topic_id');
}
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query_limit($sql, 20);
$topic_list = array();
while ($row = $db->sql_fetchrow($result)) {
$forum_id = $row['forum_id'];
$topic_id = isset($row['b_topic_id']) ? $row['b_topic_id'] : $row['topic_id'];
// Replies
$replies = $auth->acl_get('m_approve', $forum_id) ? $row['topic_replies_real'] : $row['topic_replies'];
if ($row['topic_status'] == ITEM_MOVED && !empty($row['topic_moved_id'])) {
$topic_id = $row['topic_moved_id'];
}
// Get folder img, topic status/type related information
$folder_img = $folder_alt = $topic_type = '';
topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
$short_content = get_short_content($row['topic_last_post_id']);
if ($forum_id) {
$topic_tracking = get_complete_topic_tracking($forum_id, $topic_id);
$new_post = $topic_tracking[$topic_id] < $row['topic_last_post_time'] ? true : false;
} else {
$new_post = false;
}
$user_avatar_url = get_user_avatar_url($row['user_avatar'], $row['user_avatar_type']);
$allow_change_type = $auth->acl_get('m_', $forum_id) || $user->data['is_registered'] && $user->data['user_id'] == $row['topic_poster'] ? true : false;
$xmlrpc_topic = new xmlrpcval(array('forum_id' => new xmlrpcval($forum_id), 'forum_name' => new xmlrpcval(html_entity_decode($row['forum_name']), 'base64'), 'topic_id' => new xmlrpcval($topic_id), 'topic_title' => new xmlrpcval(html_entity_decode(strip_tags(censor_text($row['topic_title']))), 'base64'), 'reply_number' => new xmlrpcval(intval($replies), 'int'), 'view_number' => new xmlrpcval(intval($row['topic_views']), 'int'), 'short_content' => new xmlrpcval($short_content, 'base64'), 'post_author_id' => new xmlrpcval($row['topic_last_poster_id']), 'post_author_name' => new xmlrpcval(html_entity_decode($row['topic_last_poster_name']), 'base64'), 'new_post' => new xmlrpcval($new_post, 'boolean'), 'post_time' => new xmlrpcval(mobiquo_iso8601_encode($row['topic_last_post_time']), 'dateTime.iso8601'), 'icon_url' => new xmlrpcval($user_avatar_url), 'can_delete' => new xmlrpcval($auth->acl_get('m_delete', $forum_id), 'boolean'), 'can_bookmark' => new xmlrpcval($user->data['is_registered'] && $config['allow_bookmarks'], 'boolean'), 'isbookmarked' => new xmlrpcval($row['bookmarked'] ? true : false, 'boolean'), 'can_close' => new xmlrpcval($auth->acl_get('m_lock', $forum_id) || $auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $row['topic_poster'], 'boolean'), 'is_closed' => new xmlrpcval($row['topic_status'] == ITEM_LOCKED, 'boolean'), 'can_stick' => new xmlrpcval($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $row['topic_type'] != POST_STICKY, 'boolean')), 'struct');
$topic_list[] = $xmlrpc_topic;
}
$db->sql_freeresult($result);
}
$topic_num = count($topic_list);
$response = new xmlrpcval(array('total_topic_num' => new xmlrpcval($topic_num, 'int'), 'topics' => new xmlrpcval($topic_list, 'array')), 'struct');
return new xmlrpcresp($response);
}
示例3: log
public function log($data)
{
$Sms = M('Sms');
check_error($Sms);
$Sms->create($data);
check_error($Sms);
if (false === $Sms->add()) {
return_value_json(false, 'msg', get_error($Sms));
}
}
示例4: update
/**
* 保存参数设置
*/
public function update()
{
$Setting = M('Setting');
check_error($Setting);
$hasData = $Setting->count() > 0;
$Setting->create();
$result = $hasData ? $Setting->where('1')->save() : $Setting->add();
if ($result === false) {
//TODO Log
return_value_json(false, 'msg', get_error($Setting));
}
//TODO Log
return_value_json(true);
}
示例5: createUserHandle
public function createUserHandle($email, $username, $password, $verified, $custom_register_fields, $profile, &$errors)
{
global $sourcedir, $context, $modSettings, $maintenance, $mmessage, $scripturl;
checkSession();
$_POST['emailActivate'] = true;
if (empty($password)) {
get_error('password cannot be empty');
}
if (!($maintenance == 0)) {
get_error('Forum is in maintenance model or Tapatalk is disabled by forum administrator.');
}
if ($modSettings['registration_method'] == 0) {
$register_mode = 'nothing';
} else {
if ($modSettings['registration_method'] == 1) {
$register_mode = $verified ? 'nothing' : 'activation';
} else {
$register_mode = isset($modSettings['auto_approval_tp_user']) && $modSettings['auto_approval_tp_user'] && $verified ? 'nothing' : 'approval';
}
}
$email = htmltrim__recursive(str_replace(array("\n", "\r"), '', $email));
$username = htmltrim__recursive(str_replace(array("\n", "\r"), '', $username));
$password = htmltrim__recursive(str_replace(array("\n", "\r"), '', $password));
$group = 0;
if ($register_mode == 'nothing' && isset($modSettings['tp_iar_usergroup_assignment'])) {
$group = $modSettings['tp_iar_usergroup_assignment'];
}
$regOptions = array('interface' => $register_mode == 'approval' ? 'guest' : 'admin', 'username' => $username, 'email' => $email, 'password' => $password, 'password_check' => $password, 'check_reserved_name' => true, 'check_password_strength' => true, 'check_email_ban' => false, 'send_welcome_email' => isset($_POST['emailPassword']) || empty($password), 'require' => $register_mode, 'memberGroup' => (int) $group);
define('mobi_register', 1);
require_once $sourcedir . '/Subs-Members.php';
$memberID = registerMember($regOptions);
if (!empty($memberID)) {
$context['new_member'] = array('id' => $memberID, 'name' => $username, 'href' => $scripturl . '?action=profile;u=' . $memberID, 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $memberID . '">' . $username . '</a>');
$context['registration_done'] = sprintf($txt['admin_register_done'], $context['new_member']['link']);
//update profile
if (isset($profile) && !empty($profile) && is_array($profile)) {
$profile_vars = array('avatar' => $profile['avatar_url']);
updateMemberData($memberID, $profile_vars);
}
return get_user_by_name_or_email($username, false);
}
return null;
}
示例6: login
/**
* 登录系统,并启动刷新线程
*/
public function login($returnOnSuccess = true, $startRefreshThreadAfterLogin = true)
{
$setting = $this->_getSetting();
if (empty($setting)) {
return_value_json(false, 'msg', '系统错误:数据导入设置为空');
}
$re = $this->_curl_request(self::$base_url . 'bll/doLogin.aspx', array('s' => date('D M m Y H:i:s') . ' GMT 0800', 'username' => $setting['username'], 'userpwd' => $setting['password'], 'system' => 0), self::$base_url . 'login.aspx', false, self::$tempcookiefile);
if ($re['success'] && $re['response'] === '1') {
$index = $this->_curl_request(self::$base_url . 'index.aspx', null, self::$base_url . 'login.aspx', false, self::$tempcookiefile);
$EVENTVALIDATION_pattern = '/<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="(.*)" \\/>/';
preg_match_all($EVENTVALIDATION_pattern, $index['response'], $matches);
if (!empty($matches) && !empty($matches[1])) {
$setting['EVENTVALIDATION'] = $matches[1][0];
}
$VIEWSTATE_pattern = '/<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="(.*)" \\/>/';
preg_match_all($VIEWSTATE_pattern, $index['response'], $matches2);
if (!empty($matches2) && !empty($matches2[1])) {
$setting['VIEWSTATE'] = $matches2[1][0];
}
$cishu = $this->_curl_request(self::$base_url . 'bll/doIndex.aspx', array('s' => date('D M m Y H:i:s') . ' GMT 0800', 'cishu' => 0), self::$base_url . 'index.aspx', false, self::$tempcookiefile);
if ($cishu['success'] && !empty($cishu['response'])) {
$setting['countleft'] = $cishu['response'] + 0;
}
$setting['logined'] = 1;
$setting['last_login'] = date('Y-m-d H:i:s');
$DataImport = M('DataImport1');
check_error($DataImport);
if (false === $DataImport->where('1')->save($setting)) {
return_value_json(false, 'msg', get_error($DataImport));
}
if ($startRefreshThreadAfterLogin) {
$this->_startRefreshThread();
}
if ($returnOnSuccess) {
return_value_json(true);
}
} else {
return_value_json(false, 'msg', '登录失败:' . $re['response']);
}
}
示例7: edit
function edit($id = null)
{
if (empty($id) or !$this->fuel_auth->module_has_action('save')) {
show_404();
}
if ($this->input->post($this->model->key_field())) {
$this->model->on_before_post();
$posted = $this->_process();
if ($this->model->save($posted)) {
// process $_FILES
if (!$this->_process_uploads($posted)) {
$this->session->set_flashdata('error', get_error());
redirect(fuel_uri($this->module_uri . '/edit/' . $id));
}
$this->model->on_after_post($posted);
if (!$this->model->is_valid()) {
add_errors($this->model->get_errors());
} else {
// archive data
if ($this->archivable) {
$this->model->archive($id, $this->model->cleaned_data());
}
$data = $this->model->find_one_array(array($this->model->table_name() . '.' . $this->model->key_field() => $id));
$msg = lang('module_edited', $this->module_name, $data[$this->display_field]);
$this->logs_model->logit($msg);
$this->session->set_flashdata('success', $this->lang->line('data_saved'));
$this->_clear_cache();
redirect(fuel_uri($this->module_uri . '/edit/' . $id));
}
}
}
$vars = $this->_form($id);
$this->_render($this->views['create_edit'], $vars);
}
示例8: mysql_fetch_object
$row = mysql_fetch_object($abfrage);
}
if (isset($_POST['submit'])) {
$title = $_POST['title'];
$news = $_POST['news'];
$cat = $_POST['cat'];
$autor = $_SESSION['SESS_FIRST_NAME'];
if (empty($title) || empty($news) || empty($autor)) {
echo get_error('Bitte Danke alle benoetigten Felder ausfuellen!');
} else {
$eintragen = mysql_query("INSERT INTO w_news (autor, title, news, cat, date) VALUES ('{$autor}','{$title}','{$news}','{$cat}', now())");
}
if ($eintragen) {
header("Location: member-index.php");
} else {
echo get_error('Der Eintrag war leider nicht erfolgreich! ".mysql_error()."');
}
}
?>
<script type="text/javascript">
/* Funtionn BBCode */
var n = 1;
function add(code) {
document.getElementById('bbcode').news.value += " " + code ;
}
</script>
<!-- CONTENT -->
示例9: send_error
function send_error($type, $info = null)
{
$error = get_error($type);
if ($info != null) {
$error['message'] = $error['message'] . ' -' . $info;
}
send_json($error);
}
示例10: draw_site_error
function draw_site_error()
{
$error_text = get_error();
if ($error_text) {
printf('<p class="error">%s</p>', $error_text);
}
}
示例11: array
if (isHttpUrl($_GET['url']) === false) {
$response = array('error' => 'Only http scheme and https scheme are allowed');
} else {
if (preg_match('#[^A-Za-z0-9_[.]\\[\\]]#', $param_callback) !== 0) {
$response = array('error' => 'Parameter "callback" contains invalid characters');
$param_callback = JSLOG;
} else {
if (createFolder() === false) {
$err = get_error();
$response = array('error' => 'Can not create directory' . ($err !== null && isset($err['message']) && strlen($err['message']) > 0 ? ': ' . $err['message'] : ''));
$err = null;
} else {
$http_port = (int) $_SERVER['SERVER_PORT'];
$tmp = createTmpFile($_GET['url'], false);
if ($tmp === false) {
$err = get_error();
$response = array('error' => 'Can not create file' . ($err !== null && isset($err['message']) && strlen($err['message']) > 0 ? ': ' . $err['message'] : ''));
$err = null;
} else {
$response = downloadSource($_GET['url'], $tmp['source'], 0);
fclose($tmp['source']);
}
}
}
}
}
}
}
}
}
if (is_array($response) && isset($response['mime']) && strlen($response['mime']) > 0) {
示例12: after_action_create_message
function after_action_create_message()
{
global $context;
if (!empty($context['send_log']['failed'])) {
foreach ($context['send_log']['failed'] as $error_text) {
get_error($error_text);
}
}
}
示例13: mob_update_password
function mob_update_password($rpcmsg)
{
global $txt, $modSettings;
global $cookiename, $context;
global $sourcedir, $scripturl, $db_prefix;
global $ID_MEMBER, $user_info;
global $newpassemail, $user_profile, $validationCode;
loadLanguage('Profile');
// Start with no updates and no errors.
$profile_vars = array();
$post_errors = array();
$good_password = false;
// reset directly with tapatalk id credential
if ($rpcmsg->getParam(2)) {
$_POST['passwrd1'] = $rpcmsg->getParam(0) ? $rpcmsg->getScalarValParam(0) : '';
$_POST['passwrd1'] = utf8ToAscii($_POST['passwrd1']);
$token = $rpcmsg->getParam(1) ? $rpcmsg->getScalarValParam(1) : '';
$code = $rpcmsg->getParam(2) ? $rpcmsg->getScalarValParam(2) : '';
// verify Tapatalk Authorization
if ($token && $code) {
$ttid = TapatalkSsoVerification($token, $code);
if ($ttid && $ttid->result) {
$tapatalk_id_email = $ttid->email;
if (empty($ID_MEMBER) && ($ID_MEMBER = emailExists($tapatalk_id_email))) {
loadMemberData($ID_MEMBER, false, 'profile');
$user_info = $user_profile[$ID_MEMBER];
$user_info['is_guest'] = false;
$user_info['is_admin'] = $user_info['id_group'] == 1 || in_array(1, explode(',', $user_info['additionalGroups']));
$user_info['id'] = $ID_MEMBER;
if (empty($user_info['additionalGroups'])) {
$user_info['groups'] = array($user_info['ID_GROUP'], $user_info['ID_POST_GROUP']);
} else {
$user_info['groups'] = array_merge(array($user_info['ID_GROUP'], $user_info['ID_POST_GROUP']), explode(',', $user_info['additionalGroups']));
}
$user_info['groups'] = array_unique(array_map('intval', $user_info['groups']));
loadPermissions();
}
if (strtolower($user_info['emailAddress']) == strtolower($tapatalk_id_email) && $user_info['ID_GROUP'] != 1) {
$good_password = true;
}
}
}
if (!$good_password) {
get_error('Failed to update password');
}
} else {
$_POST['oldpasswrd'] = $rpcmsg->getParam(0) ? $rpcmsg->getScalarValParam(0) : '';
$_POST['passwrd1'] = $rpcmsg->getParam(1) ? $rpcmsg->getScalarValParam(1) : '';
$_POST['passwrd1'] = utf8ToAscii($_POST['passwrd1']);
}
// Clean up the POST variables.
$_POST = htmltrim__recursive($_POST);
$_POST = stripslashes__recursive($_POST);
$_POST = htmlspecialchars__recursive($_POST);
$_POST = addslashes__recursive($_POST);
$memberResult = loadMemberData($ID_MEMBER, false, 'profile');
if (!is_array($memberResult)) {
fatal_lang_error(453, false);
}
$memID = $ID_MEMBER;
$context['user']['is_owner'] = true;
isAllowedTo(array('manage_membergroups', 'profile_identity_any', 'profile_identity_own'));
// You didn't even enter a password!
if (trim($_POST['oldpasswrd']) == '' && !$good_password) {
fatal_error($txt['profile_error_no_password']);
}
// Since the password got modified due to all the $_POST cleaning, lets undo it so we can get the correct password
$_POST['oldpasswrd'] = addslashes(un_htmlspecialchars(stripslashes($_POST['oldpasswrd'])));
// Does the integration want to check passwords?
if (isset($modSettings['integrate_verify_password']) && function_exists($modSettings['integrate_verify_password'])) {
if (call_user_func($modSettings['integrate_verify_password'], $user_profile[$memID]['memberName'], $_POST['oldpasswrd'], false) === true) {
$good_password = true;
}
}
// Bad password!!!
if (!$good_password && $user_info['passwd'] != sha1(strtolower($user_profile[$memID]['memberName']) . $_POST['oldpasswrd'])) {
fatal_error($txt['profile_error_bad_password']);
}
// Let's get the validation function into play...
require_once $sourcedir . '/Subs-Auth.php';
$passwordErrors = validatePassword($_POST['passwrd1'], $user_info['username'], array($user_info['name'], $user_info['email']));
// Were there errors?
if ($passwordErrors != null) {
fatal_error($txt['profile_error_password_' . $passwordErrors]);
}
// Set up the new password variable... ready for storage.
$profile_vars['passwd'] = '\'' . sha1(strtolower($user_profile[$memID]['memberName']) . un_htmlspecialchars(stripslashes($_POST['passwrd1']))) . '\'';
// If we've changed the password, notify any integration that may be listening in.
if (isset($modSettings['integrate_reset_pass']) && function_exists($modSettings['integrate_reset_pass'])) {
call_user_func($modSettings['integrate_reset_pass'], $user_profile[$memID]['memberName'], $user_profile[$memID]['memberName'], $_POST['passwrd1']);
}
updateMemberData($memID, $profile_vars);
require_once $sourcedir . '/Subs-Auth.php';
setLoginCookie(60 * $modSettings['cookieTime'], $memID, sha1(sha1(strtolower($user_profile[$memID]['memberName']) . un_htmlspecialchars(stripslashes($_POST['passwrd1']))) . $user_profile[$memID]['passwordSalt']));
$response = array('result' => new xmlrpcval(true, 'boolean'), 'result_text' => new xmlrpcval('', 'base64'));
return new xmlrpcresp(new xmlrpcval($response, 'struct'));
}
示例14: ac_templates_proxy
/**
* Callback to for proxy page
*/
function ac_templates_proxy()
{
drupal_add_http_header('Content-Type', 'application/javascript');
if (isset($_GET['callback']) && strlen($_GET['callback']) > 0) {
$param_callback = $_GET['callback'];
}
if (isset($_SERVER['HTTP_HOST']) === FALSE || strlen($_SERVER['HTTP_HOST']) === 0) {
$response = array('error' => 'The client did not send the Host header');
} else {
if (isset($_SERVER['SERVER_PORT']) === FALSE) {
$response = array('error' => 'The Server-proxy did not send the PORT (configure PHP)');
} else {
if (MAX_EXEC < 10) {
$response = array('error' => 'Execution time is less 15 seconds, configure this with ini_set/set_time_limit or "php.ini" (if safe_mode is enabled), recommended time is 30 seconds or more');
} else {
if (MAX_EXEC <= TIMEOUT) {
$response = array('error' => 'The execution time is not configured enough to TIMEOUT in SOCKET, configure this with ini_set/set_time_limit or "php.ini" (if safe_mode is enabled), recommended that the "max_execution_time =;" be a minimum of 5 seconds longer or reduce the TIMEOUT in "define(\'TIMEOUT\', ' . TIMEOUT . ');"');
} else {
if (isset($_GET['url']) === FALSE || strlen($_GET['url']) === 0) {
$response = array('error' => 'No such parameter "url"');
} else {
if (isHttpUrl($_GET['url']) === FALSE) {
$response = array('error' => 'Only http scheme and https scheme are allowed');
} else {
if (preg_match('#[^A-Za-z0-9_[.]\\[\\]]#', $param_callback) !== 0) {
$response = array('error' => 'Parameter "callback" contains invalid characters');
$param_callback = JSLOG;
} else {
if (createFolder() === FALSE) {
$err = get_error();
$response = array('error' => 'Can not create directory' . ($err !== NULL && isset($err['message']) && strlen($err['message']) > 0 ? ': ' . $err['message'] : ''));
$err = NULL;
} else {
$http_port = (int) $_SERVER['SERVER_PORT'];
$tmp = createTmpFile($_GET['url'], FALSE);
if ($tmp === FALSE) {
$err = get_error();
$response = array('error' => 'Can not create file' . ($err !== NULL && isset($err['message']) && strlen($err['message']) > 0 ? ': ' . $err['message'] : ''));
$err = NULL;
} else {
$response = downloadSource($_GET['url'], $tmp['source'], 0);
fclose($tmp['source']);
}
}
}
}
}
}
}
}
}
if (is_array($response) && isset($response['mime']) && strlen($response['mime']) > 0) {
clearstatcache();
if (FALSE === file_exists($tmp['location'])) {
$response = array('error' => 'Request was downloaded, but file can not be found, try again');
} else {
if (filesize($tmp['location']) < 1) {
$response = array('error' => 'Request was downloaded, but there was some problem and now the file is empty, try again');
} else {
$extension = str_replace(array('image/', 'text/', 'application/'), '', $response['mime']);
$extension = str_replace(array('windows-bmp', 'ms-bmp'), 'bmp', $extension);
$extension = str_replace(array('svg+xml', 'svg-xml'), 'svg', $extension);
$extension = str_replace('xhtml+xml', 'xhtml', $extension);
$extension = str_replace('jpeg', 'jpg', $extension);
$locationFile = preg_replace('#[.][0-9_]+$#', '.' . $extension, $tmp['location']);
if (file_exists($locationFile)) {
unlink($locationFile);
}
if (rename($tmp['location'], $locationFile)) {
//set cache
setHeaders(FALSE);
remove_old_files();
if (CROSS_DOMAIN === 1) {
$mime = JsonEncodeString($response['mime'], TRUE);
$mime = $response['mime'];
if ($response['encode'] !== NULL) {
$mime .= ';charset=' . JsonEncodeString($response['encode'], TRUE);
}
$tmp = $response = NULL;
if (strpos($mime, 'image/svg') !== 0 && strpos($mime, 'image/') === 0) {
echo $param_callback, '("data:', $mime, ';base64,', base64_encode(file_get_contents($locationFile)), '");';
} else {
echo $param_callback, '("data:', $mime, ',', asciiToInline(file_get_contents($locationFile)), '");';
}
} else {
$tmp = $response = NULL;
$dir_name = dirname($_SERVER['SCRIPT_NAME']);
if ($dir_name === '\\/' || $dir_name === '\\') {
$dir_name = '';
}
if (strpos($locationFile, 'public://') === FALSE) {
$parse_file_location = explode('/', $locationFile);
$locationFile = sprintf('%s/%s', PATH, end($parse_file_location));
}
echo $param_callback, '(', JsonEncodeString(file_create_url($locationFile)), ');';
}
exit;
//.........这里部分代码省略.........
示例15: delete
public function delete()
{
if (!$this->isPost()) {
return_value_json(false, 'msg', '非法的调用');
}
$paths = json_decode(file_get_contents("php://input"));
if (!is_array($paths)) {
$paths = array($paths);
}
$id = array();
foreach ($paths as $path) {
$id[] = $path->id;
}
if (count($id) > 0) {
$PathArea = M('PathArea');
check_error($PathArea);
if (false === $PathArea->where("`id` IN (" . implode(",", $id) . ")")->delete()) {
return_value_json(false, 'msg', get_error($PathArea));
}
$Point = M('Point');
check_error($Point);
if (false === $Point->where("`path_area_id` IN (" . implode(",", $id) . ")")->delete()) {
return_value_json(false, 'msg', '删除路径的顶点时出错:' . get_error($Point));
}
}
return_value_json(true);
}