public function actionError() { if ($error = Yii::app()->errorHandler->error) { if (Yii::app()->request->isAjaxRequest) { echo $error['message']; } else { $this->layout = "//layouts/error"; $error = new ERROR(404, "", ""); $this->renderText($error->getMessageByError()); } } }
public function addHandle() { $id = $_POST['id']; $activityId = $_POST['activityId']; $ecid = $_POST['ecid']; $Model = new Model(); $result = $Model->query("\r\n SELECT \r\n user_info.id,\r\n user_info.nickname,\r\n user_info.headimgurl\r\n FROM sz12365_fw_company_qr_sign_user_openid_{$activityId} AS user_openid\r\n JOIN sz12365_fw_company_{$ecid}_user_info AS user_info ON\r\n user_openid.openid=user_info.openId\r\n Where user_info.id > {$id} \r\n LIMIT 0,1\r\n "); if ($result) { $data = $result[0]; $data['status'] = ERROR::SUCCESS_OK; } else { $data['status'] = ERROR::ERROR_EDIT_HANDLE_ERR; $data['info'] = ERROR::getErrMsg(ERROR::ERROR_EDIT_HANDLE_ERR); } $this->ajaxReturn($data, "JSON"); }
public static function group($conn, $gid) { $sql = "select * from `group` where gid='" . $gid . "' limit 1"; if (!$conn) { return '出错'; } if (!($result = $conn->query($sql))) { return ERROR::err('SQL语句有误!2'); } if (!($group = $result->fetch_assoc())) { return '用户组不存在!'; } if ($group['isupload']) { $_SESSION['KCFINDER'] = array(); $_SESSION['KCFINDER']['disabled'] = false; } return $group; }
public function sitepath($conn, $cid) { if ($cid) { $sql = "select cid, classname, parentclass from `class` where `cid`='" . $cid . "' limit 1"; if (!($result = $conn->query($sql))) { return ERROR::err(305, 'SQL语句错误!'); } $class = $result->fetch_assoc(); foreach (explode('|', $class['parentclass']) as $value) { if ($value) { $arr = explode(',', $value); $url = "category.php?cid={$arr[0]}"; sitepath($arr[1], $url); } } $url = "category.php?cid={$class['cid']}"; sitepath($class['classname'], $url); return $class; } }
if (ERROR::isError($result)) { die($result->getErrstr()); } } $AppUI->redirect($forward_link); die; } else { foreach ($_POST["bugs"] as $b) { $mantis->resetRequest(); $mantis->setFunction("MantisRPC"); $mantis->addArg(array($mantis_user, $mantis_pass)); $mantis->addArg("updateMantisBugStatusById"); $mantis->addArg($b); $mantis->addArg($_POST["bug_action"]); $result = $mantis->call(); if (ERROR::isError($result)) { die($result->getErrstr()); } } $AppUI->redirect($forward_link); die; } function createTask($obj) { // Include any files for handling module-specific requirements foreach (findTabModules('tasks', 'addedit') as $mod) { $fname = dPgetConfig('root_dir') . "/modules/{$mod}/tasks_dosql.addedit.php"; dprint(__FILE__, __LINE__, 3, "checking for {$fname}"); if (file_exists($fname)) { require_once $fname; }
echo $_SERVER['DOCUMENT_ROOT']; function get_microtime() { list($usec, $sec) = explode(' ', microtime()); return (double) $usec + (double) $sec; } if (!defined('ABSPATH')) { define('ABSPATH', dirname(__FILE__)); } require ABSPATH . '/const.inc.php'; require ABSPATH . '/include/sql.class.php'; $timestart = get_microtime(); $sql = "select * from user where uid='1' limit 1"; if (!($result = $conn->query($sql))) { return ERROR::err('SQL语句有误!'); } if (!($user = $result->fetch_assoc())) { return '用户名或密码错误!'; } $str = '$user = array('; $str2 = ''; foreach ($user as $key => $val) { if ($str2 == '') { $str2 = '\'' . $key . '\' => \'' . $val . '\''; } else { $str2 .= ', \'' . $key . '\' => \'' . $val . '\''; } } /* foreach($user as $key=>$val){
$mantis->setFunction("MantisRPC"); $mantis->addArg(array($mantis_user, $mantis_pass)); $mantis->addArg("getMantisBugByProjectName"); $mantis->addArg($project_name); $bugs = $mantis->call(); if (ERROR::isError($bugs)) { die($bugs->getErrstr()); } } else { $mantis->resetRequest(); $mantis->setFunction("MantisRPC"); $mantis->addArg(array($mantis_user, $mantis_pass)); $mantis->addArg("getMantisBugByProjectID"); $mantis->addArg(""); $bugs = $mantis->call(); if (ERROR::isError($bugs)) { die($bugs->getErrstr()); } } if ($bugs == 0) { ?> <br /><br />This project was not found in Mantis.<br /><br /> <input class="button" type="button" value="<?php echo $AppUI->_('Create Project In Mantis'); ?> " onClick="window.location='?m=mantis&a=addproject&project_id=<?php echo $project_id; ?> '"> <br /> <br />
switch ($_GET['action']) { case 'add': $e = $c->add($db); break; case 'modify': $e = $c->modify($db); break; /*case 'edit': $e = $c->edit($db); break;*/ /*case 'edit': $e = $c->edit($db); break;*/ case 'delete': if (!isset($_GET['cid'])) { $e = ERROR::err('非法访问!'); break; } $e = $c->_delete($db, $_GET['cid']); break; default: $e = ''; break; } $classes = $c->_list($db, 0); $options = $c->createoption($db, 0); $class_dir = ''; if (!DIR_MODE) { include ABSPATH . '/template/class_dir.html'; } include ABSPATH . '/template/table.html';
public static function canEditKshow($kshow_id, $existing_kshow, $likuser_id) { if ($existing_kshow == NULL) { // TODO - some good error - // TODO - let's make a list of all errors we encounter and see how we use the I18N and built-in configuration mechanism to maintain the list // and later on translate the errors. ERROR::fatal(12345, "Kshow with id [" . $kshow_id . "] does not exist in the system. This is either an innocent mistake or you are a wicked bastard"); // TODO - think of our policy - what do we do if we notice what looks like an attemp to harm the system ? // because the system is not stable, mistakes like this one might very possibly be innocent, but later on - what should happen in XSS / SQL injection / // attemp to insert malformed data ? return false; } // make sure the logged-in user is allowed to access this kshow in 2 aspects: // 1. - it is produced by him or a template if ($existing_kshow->getProducerId() != $likuser_id) { ERROR::fatal(10101, "User (with id [" . $likuser_id . "] is attempting to modify a kshow with id [{$kshow_id}] that does not belong to him (producer_id [" . $existing_kshow->getProducerId() . "] !!"); return false; } return true; }