コード例 #1
0
 public function updateChargeStatus($cid, $status)
 {
     $data = array('status' => $status, 'optuid' => uid(), 'donedate' => time());
     $this->db->where('cid', $cid);
     $this->db->update($this->table, $data);
     return $this->db->affected_rows();
 }
コード例 #2
0
ファイル: VRobotHome.php プロジェクト: Aaronqcd/robot
 public function robot()
 {
     if (!he_is('agency')) {
         abort(403);
     }
     $data = DB::table('i_robot')->select('i_robot.*', 'i_robot_lease_log.*', 'i_hospital.name as hospital_name', 'i_employee.name as employee_name')->leftJoin('i_robot_lease_log', 'i_robot.id', '=', 'i_robot_lease_log.robot_id')->leftJoin('i_hospital', 'i_hospital.id', '=', 'i_robot_lease_log.hospital_id')->leftJoin('i_employee', 'i_employee.id', '=', 'i_robot.employee_id')->where('i_robot_lease_log.recent', 1)->where('i_robot_lease_log.agency_id', uid())->orderBy('i_robot.id', 'i_robot_lease_log.lease_ended_at desc')->get();
     return ss($data);
 }
コード例 #3
0
ファイル: app.php プロジェクト: ramo01/1kapp
function api_mycss()
{
    $sql = "SELECT `css` FROM `css` WHERE `uid` = '" . intval(uid()) . "' LIMIT 1";
    $data = get_var($sql);
    if (db_errno() != 0) {
        apiController::send_error(LR_API_DB_ERROR, 'DATABASE ERROR ' . db_error());
    }
    return apiController::send_result($data);
}
コード例 #4
0
ファイル: recommend.php プロジェクト: uakfdotb/oneapp
function requestRecommendation($user_id, $author, $email, $message)
{
    if (!checkLock("peer")) {
        return 6;
    }
    $config = $GLOBALS['config'];
    $user_id = escape($user_id);
    $author = escape($author);
    $email = escape($email);
    if (!validEmail($email)) {
        return 1;
    }
    if (strlen($author) <= 3) {
        return 2;
    }
    //make sure there aren't too many recommendations already
    $result = mysql_query("SELECT COUNT(*) FROM recommendations WHERE user_id = '{$user_id}'");
    $row = mysql_fetch_row($result);
    if ($row[0] >= $config['max_recommend']) {
        return 4;
        //too many recommendations
    }
    //ensure this email hasn't been asked with this user already
    $result = mysql_query("SELECT COUNT(*) FROM recommendations WHERE user_id = '{$user_id}' AND email = '{$email}'");
    $row = mysql_fetch_row($result);
    if ($row[0] > 0) {
        return 5;
        //email address already asked
    }
    lockAction("peer");
    //first create an instance
    $instance_id = customCreate(customGetCategory('recommend', true), $user_id);
    //insert into recommendations table
    $auth = escape(uid(64));
    mysql_query("INSERT INTO recommendations (user_id, instance_id, author, email, auth, status, filename) VALUES ('{$user_id}', '{$instance_id}', '{$author}', '{$email}', '{$auth}', '0', '')");
    $recommend_id = mysql_insert_id();
    $userinfo = getUserInformation($user_id);
    //array (username, email address, name)
    //send email now
    $content = page_db("request_recommendation");
    $content = str_replace('$USERNAME$', $userinfo[0], $content);
    $content = str_replace('$USEREMAIL$', $userinfo[1], $content);
    $content = str_replace('$NAME$', $userinfo[2], $content);
    $content = str_replace('$AUTHOR$', $author, $content);
    $content = str_replace('$EMAIL$', $email, $content);
    $content = str_replace('$MESSAGE$', page_convert($message), $content);
    $content = str_replace('$AUTH$', $auth, $content);
    $content = str_replace('$SUBMIT_ADDRESS$', $config['site_address'] . "/recommend.php?id={$recommend_id}&user_id={$user_id}&auth={$auth}", $content);
    $result = one_mail("Recommendation request", $content, $email);
    if ($result) {
        return 0;
    } else {
        return 3;
    }
}
コード例 #5
0
ファイル: path.php プロジェクト: newset/gd
 function usb_url($type)
 {
     if (!he_is('employee')) {
         return;
     }
     $base = 'http://www.remebot.cn/isapi/remeisapi.dll/?';
     $user = DB::table('i_employee')->select(DB::raw('right(password, 4) as pass'))->where('id', uid())->first();
     $time = time();
     $params = ['a' => $type, 'b' => $time, 'c' => uid() * 3 * substr($time, -4), 'd' => $user->pass];
     return $base . http_build_query($params);
 }
コード例 #6
0
ファイル: IMessage.php プロジェクト: newset/robot
 public function read()
 {
     $id = rq('id');
     $data = $this->find($id);
     $res = 0;
     if ($data->recipientid == uid()) {
         $data->read = 1;
         $res = $data->save();
     }
     return ss($res);
 }
コード例 #7
0
ファイル: Controller.php プロジェクト: rajveer4155/vidmgr
 public function accessRules()
 {
     Yii::app()->user->loginUrl = param('adminUrl') . 'user/login';
     $assumed = false;
     if (isset(Yii::app()->session['assumed']) && Yii::app()->session['assumed'] != '') {
         $assumed = true;
     }
     if (uid() != 'admin' && uid() != '' && !$assumed) {
         $this->redirect(array('/video/admin'));
     }
     return array(array('allow', 'actions' => array('login', 'logout'), 'users' => array('*')), array('allow', 'users' => array('admin')), array('deny', 'users' => array('*')));
 }
コード例 #8
0
ファイル: IDepartment.php プロジェクト: newset/robot
 public function rl()
 {
     $user = uid();
     $time = time();
     $row = $this->select(DB::raw('right(password, 4) as pass, name'))->where('id', $user)->first();
     $params = ['a' => 'department', 'b' => $time, 'd' => $row->pass, 'c' => substr($time, -4) * 3 * $user];
     $baseUrl = env('ISAPI_URL');
     $url = $baseUrl . http_build_query($params);
     $res = Requests::get($url);
     $data = json_decode($res->body);
     $data->name = $row->name;
     return response()->json($data);
 }
コード例 #9
0
ファイル: inbox.class.php プロジェクト: ramo01/1kapp
 function client()
 {
     if (v('type') == 'android') {
         $type = 'android';
     } else {
         $type = 'ios';
     }
     $data['type'] = $type;
     $token = $_SESSION['token'];
     $api = parse_url(c('api_server'), PHP_URL_HOST);
     $data['url'] = $token . '|' . $api . '|' . $_SESSION['uname'] . '|' . uid() . '|' . $_SESSION['level'];
     render($data, 'ajax', 'raw');
 }
コード例 #10
0
ファイル: gpg.php プロジェクト: 17Halbe/gpg-mailgate
function verifyPGPKey($content, $email)
{
    global $config;
    //allow blank "keys" if this is set
    //this means that encryption for $email will be disabled by the cron if it
    // was enabled originally
    if ($config['pgpverify_allowblank'] && trim($content) == '') {
        return true;
    }
    require_once "Crypt/GPG.php";
    //try to create a random subdirectory of $config['pgpverify_tmpdir']
    do {
        $path = $config['pgpverify_tmpdir'] . '/' . uid(16);
    } while (file_exists($path));
    $result = @mkdir($path);
    if ($result === false) {
        if ($config['debug']) {
            die("Failed to create directory [" . $path . "] for PGP verification.");
        } else {
            return false;
        }
    }
    $gpg = new Crypt_GPG(array('homedir' => $path));
    //import the key to our GPG temp directory
    try {
        $gpg->importKey($content);
    } catch (Crypt_GPG_NoDataException $e) {
        //user supplied an invalid key!
        recursiveDelete($path);
        return false;
    }
    //verify the email address matches
    $keys = $gpg->getKeys();
    if (count($keys) != 1) {
        if ($config['debug']) {
            die("Error in PGP verification: key count is " . count($keys) . "!");
        } else {
            recursiveDelete($path);
            return false;
        }
    }
    $userIds = $keys[0]->getUserIds();
    if (count($userIds) != 1 || strtolower($userIds[0]->getEmail()) != strtolower($email)) {
        recursiveDelete($path);
        return false;
    }
    recursiveDelete($path);
    return true;
}
コード例 #11
0
ファイル: UserController.php プロジェクト: rocketyang/mincms
 public function actionDelete($id)
 {
     if ($_POST['action'] == 1) {
         if ($id == 1) {
             echo json_encode(array('id' => array(0), 'class' => 'alert-error', 'message' => __('supper user can not delete')));
             exit;
         }
         if ($id === uid()) {
             echo json_encode(array('id' => array(0), 'class' => 'alert-error', 'message' => __('you can not remove yourself')));
             exit;
         }
         $model = \app\modules\auth\models\User::find($id);
         $model->delete();
         echo json_encode(array('id' => array($id), 'class' => 'alert-success', 'message' => __('delete user success')));
         exit;
     }
 }
コード例 #12
0
ファイル: frontview.php プロジェクト: hetykai/domain_auction
 function header($view)
 {
     //view同级下是否存在对应的header
     $header = $view . '_header';
     $viewPath = APPPATH . 'views/';
     $data['controller'] = $this->CI->router->fetch_class();
     if (uli()) {
         //获取用户信息
         lm('user_model');
         $data['userprofile'] = $this->CI->user_model->getUserProfileByIdArray(uid());
     }
     if (file_exists($viewPath . $header . '.php')) {
         lv($header, $data);
     } else {
         lv('header', $data);
     }
 }
コード例 #13
0
ファイル: pgp.php プロジェクト: 17Halbe/gpg-mailgate
function requestPGP($email, $key)
{
    require_once includePath() . "/lock.php";
    global $config, $lang;
    if (!checkLock('requestpgp')) {
        return $lang['submit_error_trylater'];
    }
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        return $lang['submit_error_bademail'];
    }
    if (strlen($email) > 256 || strlen($key) > 1024 * 32) {
        return $lang['submit_error_toolong'];
    }
    if (!isAscii($key)) {
        return $lang['submit_error_nonascii'];
    }
    //housekeeping
    databaseQuery("DELETE FROM gpgmw_keys WHERE time < DATE_SUB(NOW(), INTERVAL 48 HOUR) AND confirm != '' AND status = 0");
    //if we already have an unaccepted key for this user, only replace if one day has elapsed since the last request
    // this may prevent spam
    $result = databaseQuery("SELECT HOUR(TIMEDIFF(time, NOW())), id FROM gpgmw_keys WHERE email = ? AND status = 0", array($email));
    if ($row = $result->fetch()) {
        if ($row[0] < 24) {
            return $lang['submit_error_alreadyqueue'];
        } else {
            databaseQuery('DELETE FROM gpgmw_keys WHERE id = ?', array($row[1]));
        }
    }
    //if PGP key verification is enabled, do it
    if ($config['pgpverify_enable']) {
        require_once includePath() . "/gpg.php";
        if (!verifyPGPKey($key, $email)) {
            return $lang['submit_error_badkey'];
        }
    }
    //well, it looks good, let's submit it
    lockAction('requestpgp');
    $confirm = uid(32);
    $confirm_link = "{$config['site_url']}/confirm.php?email=" . urlencode($email) . "&confirm={$confirm}";
    $result = gpgmw_mail($config['email_subject_requestpgp'], sprintf($lang['mail_confirm'], $confirm_link), $email);
    if (!$result) {
        return $lang['submit_error_emailfail'];
    }
    databaseQuery("INSERT INTO gpgmw_keys (email, publickey, confirm) VALUES (?, ?, ?)", array($email, $key, $confirm));
    return true;
}
コード例 #14
0
ファイル: pluglist.class.php プロジェクト: xianliflc/teamirr
 function uploaded()
 {
     if (!is_admin()) {
         return info_page(__('ADMIN_ONLY_LOGIN'));
     }
     if ($_FILES['pfile']['error'] != 0) {
         return info_page(__('PLUGIN_UPLOAD_FILE_ERROR_RETRY'));
     }
     $tmp_name = $_FILES['pfile']['tmp_name'];
     $tname = uid() . '-' . time();
     $plug_path = c('plugin_path') . DS . $tname;
     if (@mkdir($plug_path)) {
         include_once AROOT . 'lib' . DS . 'dUnzip2.inc.php';
         $zip = new dUnzip2($tmp_name);
         $zip->debug = false;
         $zip->unzipAll($plug_path);
         @chmod($plug_path, 0755);
         $info_file = $plug_path . DS . 'app.php';
         if (file_exists($info_file)) {
             if ($info = get_plugin_info(file_get_contents($info_file))) {
                 if (isset($info['folder_name'])) {
                     $folder_name = $info['folder_name'];
                 }
                 if (strlen($folder_name) < 1) {
                     $folder_name = reset(explode('.', basename($_FILES['pfile']['name'])));
                 }
                 if (strlen($folder_name) > 0) {
                     if (file_exists(c('plugin_path') . DS . $folder_name)) {
                         @rename(c('plugin_path') . DS . $folder_name . DS . 'app.php', c('plugin_path') . DS . $folder_name . DS . 'app.bak.php');
                         @rename(c('plugin_path') . DS . $folder_name, c('plugin_path') . DS . $folder_name . '_' . uid() . '_' . time());
                     }
                     rename($plug_path, c('plugin_path') . DS . $folder_name);
                     header("Location: ?c=pluglist");
                     return true;
                 } else {
                     return info_page(__('PLUGIN_GET_NAME_ERROR_RETRY', $tname));
                 }
             }
         } else {
             // clear dir
         }
         return info_page(__('PLUGIN_PACKAGE_FORMAT_ERROR'));
     } else {
         return info_page(__('PLUGIN_CREATE_FOLDER_ERROR'));
     }
 }
コード例 #15
0
ファイル: pluglist.class.php プロジェクト: ramo01/1kapp
 function uploaded()
 {
     if (!is_admin()) {
         return info_page('只有管理员才能进入此页面,<a href="?c=guest&a=logout">请先用管理员账户登入</a>');
     }
     if ($_FILES['pfile']['error'] != 0) {
         return info_page('文件上传错误,请重新上传');
     }
     $tmp_name = $_FILES['pfile']['tmp_name'];
     $tname = uid() . '-' . time();
     $plug_path = c('plugin_path') . DS . $tname;
     if (@mkdir($plug_path)) {
         include_once AROOT . 'lib' . DS . 'dUnzip2.inc.php';
         $zip = new dUnzip2($tmp_name);
         $zip->debug = false;
         $zip->unzipAll($plug_path);
         @chmod($plug_path, 0755);
         $info_file = $plug_path . DS . 'app.php';
         if (file_exists($info_file)) {
             if ($info = get_plugin_info(file_get_contents($info_file))) {
                 if (isset($info['folder_name'])) {
                     $folder_name = $info['folder_name'];
                 }
                 if (strlen($folder_name) < 1) {
                     $folder_name = reset(explode('.', basename($_FILES['pfile']['name'])));
                 }
                 if (strlen($folder_name) > 0) {
                     if (file_exists(c('plugin_path') . DS . $folder_name)) {
                         @rename(c('plugin_path') . DS . $folder_name . DS . 'app.php', c('plugin_path') . DS . $folder_name . DS . 'app.bak.php');
                         @rename(c('plugin_path') . DS . $folder_name, c('plugin_path') . DS . $folder_name . '_' . uid() . '_' . time());
                     }
                     rename($plug_path, c('plugin_path') . DS . $folder_name);
                     header("Location: ?c=pluglist");
                     return true;
                 } else {
                     return info_page('尝试获取插件名称失败,启用' . $tname . '作为临时名称,<a href="?c=pluglist">请点击继续</a>');
                 }
             }
         } else {
             // clear dir
         }
         return info_page('找不到插件执行脚本-app.php文件,<a href="?c=pluglist">请重新上传格式正确的插件包</a>');
     } else {
         return info_page('创建插件目录失败,请将plugin目录设置为可写后<a href="?c=pluglist">重试</a>');
     }
 }
コード例 #16
0
ファイル: SiteController.php プロジェクト: rocketyang/mincms
 /**
  * 管理员上传
  */
 function actionUpload()
 {
     $name = $_REQUEST['field'];
     if (!$name) {
         exit;
     }
     $file = new File();
     $file->uid = uid();
     $file->admin = 1;
     $rt = $file->upload();
     if (!$rt) {
         return;
     }
     $new[] = $rt;
     $out = File::input($new, $name);
     $rt->tag = $out;
     die(json_encode($rt));
 }
コード例 #17
0
ファイル: Handler.php プロジェクト: newset/robot
 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof TokenMismatchException) {
         $data = ['msg' => 'CSRF Token 错误, 请刷新页面', 'code' => '00003', 'token' => $request->session()->token()];
         // todo 检查当前用户 token 错误原因
         //
         return response($data, 403)->withCookie(cookie('XSRF-TOKEN', $request->session()->token()));
     }
     if ($e->getMessage() == 'insufficient_permission') {
         if (!uid()) {
             $data = ['msg' => '登录过期', 'code' => '00001'];
         } else {
             $data = ['msg' => '无权限访问', 'code' => '00002'];
         }
         return response($data, 403);
     }
     return parent::render($request, $e);
 }
コード例 #18
0
ファイル: api.php プロジェクト: JaredKat/analytics
function postview()
{
    global $conn;
    $page = $_SERVER['HTTP_REFERER'];
    $ip = $_SERVER['REMOTE_ADDR'];
    $dbTable = "analytics";
    $id = uid();
    $now = date("Y-m-d H:i:s");
    $domain = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
    if (!$conn) {
        die("Connection failed: " . mysqli_connect_error());
    }
    $sql = "INSERT INTO {$dbTable} (id, page, ip, domain) VALUES('{$id}', '{$page}', '{$ip}', '{$domain}');";
    if (mysqli_query($conn, $sql)) {
        echo 'Successfull';
    } else {
        echo "Error: " . $sql . "<br />" . mysqli_error($conn);
    }
    mysqli_close($conn);
}
コード例 #19
0
ファイル: home.php プロジェクト: hetykai/domain_auction
 function index()
 {
     if (!uli()) {
         redirect('auth/login');
     }
     $day = intval($this->uri->segment(3));
     if (empty($day) || $day <= 0 || $day > 7) {
         $day = 1;
     }
     $time = time();
     $pageStartDate = $time + 86400 * ($day - 1);
     $pageEndDate = 86400 + $pageStartDate;
     //首页放出所有域名,临时加上的
     if ($day == 1) {
         $pageEndDate = 604800 + $pageStartDate;
     }
     lm('domain_model');
     $data['day'] = $day;
     $data['todaySelling'] = $this->domain_model->getTodayDomainListArray(uid(), $pageStartDate, $pageEndDate);
     $data['todayOver'] = $this->domain_model->getTodayOverListArray($time);
     lfv('home/home_index', $data);
 }
コード例 #20
0
ファイル: app.php プロジェクト: ramo01/1kapp
function plugin_simple_token()
{
    $do = z(t(v('do')));
    switch ($do) {
        case 'create':
        case 'refresh':
            $new_token = substr(md5(uid() . time("Y h j G") . rand(1, 9999)), 0, rand(9, 20));
            $new_token = uid() . substr(md5($new_token), 0, 10);
            $sql = "REPLACE INTO `stoken` ( `uid` , `token` , `on` ) VALUES ( '" . intval(uid()) . "' , '" . s($new_token) . "' , '1' )";
            run_sql($sql);
            if (db_errno() == 0) {
                return ajax_echo('done');
            } else {
                return ajax_echo('error');
            }
            break;
        case 'close':
            $sql = "UPDATE `stoken` SET `on` = '0' WHERE `uid` = '" . intval(uid()) . "' LIMIT 1";
            run_sql($sql);
            if (db_errno() == 0) {
                return ajax_echo('done');
            } else {
                return ajax_echo('error');
            }
            break;
        case 'reopen':
            $sql = "UPDATE `stoken` SET `on` = '1' WHERE `uid` = '" . intval(uid()) . "' LIMIT 1";
            run_sql($sql);
            if (db_errno() == 0) {
                return ajax_echo('done');
            } else {
                return ajax_echo('error');
            }
            break;
        default:
            $data['tinfo'] = get_line("SELECT * FROM `stoken` WHERE `uid` = '" . intval(uid()) . "' LIMIT 1");
            render($data, 'ajax', 'plugin', 'simple_token');
    }
}
コード例 #21
0
ファイル: IInit.php プロジェクト: Aaronqcd/robot
 public function front()
 {
     $cache = Cache::get('i_settings', null);
     $per_page = array_get($cache, 'user.per_page');
     $d = ['debug' => debugging(), 'is_logged_in' => sess('is_logged_in'), 'his_chara' => sess('his_chara'), 'username' => sess('username'), 'uid' => sess('uid'), 'per_page' => $per_page, 'agency_end' => $this->retrieve('system.agency_end')];
     $type = ['employee' => 1, 'agency' => 2, 'doctor' => 3];
     // 获取未读通知
     if (uid()) {
         $d['unread'] = M('message')->where('recipientid', uid())->where('recipienttype', $type[his_chara()[0]])->where('read', 0)->count();
     } else {
         $d['unread'] = 0;
     }
     $d['org'] = '';
     if (he_is('agency')) {
         $org = DB::table(table_name('agency'))->select('name')->where('id', uid())->first();
         sess('org', $org->name);
         $d['org'] = sess('org');
     }
     if (he_is('employee')) {
         $d['org'] = sess('org');
     }
     return ss($d);
 }
コード例 #22
0
ファイル: app.php プロジェクト: xianliflc/teamirr
function plugin_system_setting_save()
{
    $new_lang = z(t(v('new_lang')));
    $sql = "UPDATE `user` SET `language`='" . $new_lang . "' WHERE `id`='" . intval(uid()) . "'";
    run_sql($sql);
    $sql = "UPDATE ip_br_os_lang SET language='" . $new_lang . "' WHERE ip = '" . $GLOBALS['sys']['ip'] . "' AND browser = '" . $GLOBALS['sys']['browser'] . "' AND browser_ver='" . $GLOBALS['sys']['browser_version'] . "' AND platform= '" . $GLOBALS['sys']['platform'] . "' AND uid='" . intval(uid()) . "'";
    run_sql($sql);
    plugin_system_setting();
    $script = '
	<script type="text/javascript" src="static/script/jquery.tablesorter.js"></script>
	<script type="text/javascript">
	$(function(){
	  $("#sys_confirm").tablesorter();

	toastr.options = {
						"closeButton": true,
						"debug": false,
						"newestOnTop": true,
						"progressBar": false,
						"positionClass": "toast-top-full-width",
						"preventDuplicates": false,
						"showDuration": "300",
						"hideDuration": "1000",
						"timeOut": "5000",
						"extendedTimeOut": "1000",
						"showEasing": "swing",
						"hideEasing": "linear",
						"showMethod": "fadeIn",
						"hideMethod": "fadeOut",
						
	}
	toastr.options.onHidden = function() { location.reload(); }
	toastr["success"]("' . __('PL_SYS_SUCCESS') . '", "' . __('PL_SYS_RELOADING') . '");
});</script>';
    return ajax_echo($script);
}
コード例 #23
0
ファイル: api.function.php プロジェクト: ramo01/1kapp
function add_history($tid, $content)
{
    $sql = "INSERT INTO `todo_history` ( `tid` , `uid` , `content` , `type` , `timeline` ) VALUES ( '" . intval($tid) . "' , '" . intval(uid()) . "' , '" . s($content) . "' , 1 , NOW() )";
    run_sql($sql);
    return db_errno() == 0;
}
コード例 #24
0
ファイル: api.class.php プロジェクト: xianliflc/teamirr
 /**
  * 创建激活码
  *
  * 普通成员通过创建激活码,邀请其他用户注册
  *
  * @param string token , 必填
  * @return array('activecode'=>$string) 
  * @author EasyChen
  */
 public function team_activecode()
 {
     $string = substr(md5(rand(1000, 9999) . time()), 0, 4);
     //$string = md5(rand( 1000 , 9999 ) . time());
     $sql = "REPLACE INTO `activecode` ( `code` , `creator_uid` , `timeline` ) VALUES ( '" . s($string) . "' , '" . uid() . "' , NOW() )";
     run_sql($sql);
     if (db_errno() != 0) {
         return self::send_error(LR_API_DB_ERROR, __('API_MESSAGE_DATABASE_ERROR') . db_error());
     } else {
         return self::send_result(array('activecode' => $string));
     }
 }
コード例 #25
0
ファイル: minecraft.php プロジェクト: andregirol/uxpanel
function minecraftBackupWorld($service_id, $label)
{
    global $config;
    $label = stripAlphaNumeric($label);
    if (empty($label) || strlen($label) > 32) {
        $label = uid(5);
    }
    //get the identifier
    $id = stripAlphaNumeric(getServiceParam($service_id, "id"));
    if ($id === false) {
        return "Error: the identifier for this service is not set.";
    }
    //make sure didn't exceed limit on backups
    $backupLimit = getServiceParam($service_id, "blimit");
    if ($backupLimit === false) {
        $backupLimit = 12;
    }
    $num_backups = count(minecraftServerList($service_id, "backups"));
    if ($num_backups > $backupLimit) {
        return "You have exceeded the limit on the number of backups. Please contact support.";
    }
    //try to turn off saving and do a save of the current world state
    // don't worry if this fails; if it fails the server probably isn't running...
    $result = minecraftCommand($service_id, array("save-off", "save-all"));
    sleep(2);
    //wait for anything to finish
    //copy the world directory to temporary directory
    $jail = jailEnabled($service_id);
    if ($jail) {
        jailFileMove($service_id, "world", "world_tmp", "cp -r");
    } else {
        recursiveCopy($config['minecraft_path'] . $id . "/world", $config['minecraft_path'] . $id . "/world_tmp");
    }
    //zip the directory simply, delete the temporary directory
    if ($jail) {
        jailExecute($service_id, "cd " . escapeshellarg(jailPath($service_id)) . " && zip -r " . escapeshellarg(jailPath($service_id) . $label . ".uxbakzip") . " world_tmp");
        jailExecute($service_id, "rm -r " . escapeshellarg(jailPath($service_id) . "world_tmp"));
    } else {
        exec("cd " . escapeshellarg($config['minecraft_path'] . $id) . " && zip -r " . escapeshellarg($config['minecraft_path'] . $id . "/" . $label . ".uxbakzip") . " world_tmp");
        delete_directory($config['minecraft_path'] . $id . "/world_tmp");
    }
    minecraftCommand($service_id, "save-on");
}
コード例 #26
0
ファイル: app.php プロジェクト: Rongya/TeamToy-Plugins
function api_checklist_add()
{
    $content = z(t(v('text')));
    if (!not_empty($content)) {
        return apiController::send_error(LR_API_ARGS_ERROR, 'TEXT CAN\'T EMPTY');
    }
    $tid = intval(v('tid'));
    if (intval($tid) < 1) {
        return apiController::send_error(LR_API_ARGS_ERROR, 'TID NOT EXISTS');
    }
    // check user
    $tinfo = get_todo_info_by_id($tid);
    if (intval($tinfo['details']['is_public']) == 0 && uid() != $tinfo['owner_uid']) {
        return apiController::send_error(LR_API_FORBIDDEN, 'ONLY PUBLIC TODO CAN ADD CHECKLIST BY OTHERS');
    }
    $sql = "INSERT INTO `checklist` ( `tid` , `title` , `content` , `timeline` , `uid` ) VALUES ( '" . intval($tid) . "' , '" . s($content) . "' , '" . s($content) . "'  , NOW() , '" . intval(uid()) . "' ) ";
    run_sql($sql);
    if (db_errno() != 0) {
        return apiController::send_error(LR_API_DB_ERROR, 'DATABASE ERROR ' . mysql_error());
    } else {
        return apiController::send_result(get_line("SELECT * FROM `checklist` WHERE `id` = '" . intval(last_id()) . "' LIMIT 1", db()));
    }
}
コード例 #27
0
ファイル: _scrollImg.php プロジェクト: rajveer4155/vidmgr
<div class="row-fluid">
    <label>
        You can upload and place that image anywhere of the video You can also make the image clickable
         by entering a url into the text field!
     </label>

    <?php 
$this->widget('ext.EFineUploader.EFineUploader', array('id' => 'TopImageUploader2', 'config' => array('autoUpload' => true, 'request' => array('endpoint' => $this->createUrl('video/uploadTopImage'), 'params' => array('YII_CSRF_TOKEN' => Yii::app()->request->csrfToken)), 'retry' => array('enableAuto' => true, 'preventRetryResponseProperty' => true), 'chunking' => array('enable' => true, 'partSize' => 10000), 'callbacks' => array('onComplete' => "js:function(id, name, response){ \$('#Video_top_image').val(response.filename); \$('#Video_newTopImage').val('1'); \$('.qq-upload-button').hide(100);}", 'onError' => "js:function(id, name, errorReason){ alert(errorReason);}"), "text" => array("uploadButton" => "Upload Image"), 'validation' => array('allowedExtensions' => array('jpg', 'jpeg', 'gif', 'png'), 'sizeLimit' => 100 * 1024 * 1024, 'minSizeLimit' => 0 * 1024 * 1024))));
?>
 (acceptable formats: jpg, jpeg, gif, png)
    <?php 
if (!empty($model->top_image)) {
    echo '<br /><br />';
    echo '<img src="' . Yii::app()->request->baseUrl . '/files/' . uid() . '/' . $model->top_image . '" style="height:100px;width:100px;" />&nbsp;&nbsp;';
    echo '<input type="hidden" name="removeTopImage" id="removeTopImage" value="0" />';
    echo CHtml::link("Remove", '#', array("id" => "link-rm-top-image", "class" => "btn btn-small"));
}
?>
    <?php 
echo $form->hiddenField($model, 'top_image_pos');
?>
</div>
<div class="row-fluid">
    <label>Resize image</label>
    <input type="text" name="Video_top_image_resize" value="" placeholder="Size percentage" />
     (10-90% , e.g: 10, 20, 30, ..., 90)
</div>
<div class="row-fluid">
    <label>Top image url</label>
    <?php 
コード例 #28
0
ファイル: admin.php プロジェクト: Profforgr/openban
    if (count($argv) < 3) {
        echo "usage: admin.php add name [ip]\n";
        return;
    }
    $name = escape($argv[2]);
    $ip = "";
    if (count($argv) >= 4) {
        $ip = escape($argv[3]);
    }
    $result = $db->query("SELECT COUNT(*) FROM openban_keys WHERE name = '{$name}'");
    $row = $result->fetch_array();
    if ($row[0] > 0) {
        echo "Key for that name already exists (use remove first maybe)\n";
        return;
    }
    $key = uid(64);
    $db->query("INSERT INTO openban_keys (name, ip, k, last_export) VALUES ('{$name}', '{$ip}', '{$key}', 0)");
    echo "Added with name={$name}, ip={$ip}\n";
    echo "Key: {$key}\n";
} else {
    if ($action == "remove") {
        if (count($argv) < 3) {
            echo "usage: admin.php remove name\n";
            return;
        }
        $name = escape($argv[2]);
        $db->query("DELETE FROM openban_keys WHERE name = '{$name}'");
        echo "Deleted {$db->affected_rows} rows.\n";
    } else {
        if ($action == "list") {
            $result = $db->query("SELECT name, ip, k FROM openban_keys");
コード例 #29
0
ファイル: project.php プロジェクト: helenadeus/s3db.map
    Header('Location: http://' . $def . '/s3db/');
    exit;
}
$key = $_GET['key'];
#Get the key, send it to check validity
include_once 'core.header.php';
if ($key) {
    $user_id = get_entry('access_keys', 'account_id', 'key_id', $key, $db);
} else {
    $user_id = $_SESSION['user']['account_id'];
}
#Universal variables
$sortorder = $_REQUEST['orderBy'];
$direction = $_REQUEST['direction'];
$project_id = $_REQUEST['project_id'];
$uid_info = uid($project_id);
#$acl = find_final_acl($user_id, $project_id, $db);
$project_info = URIinfo('P' . $project_id, $user_id, $key, $db);
$uni = compact('db', 'acl', 'user_id', 'key', 'project_id', 'dbstruct', 'sortorder', 'direction');
#relevant extra arguments
#$args = '?key='.$_REQUEST['key'].'&project_id='.$_REQUEST['project_id'];
#Define the page actions
include 'webActions.php';
#include the specification of the link map. Must be put in here becuase arguments vary.
if ($project_id == '') {
    echo "Please specify a project_id";
    exit;
} elseif (!$project_info['view']) {
    echo "User does not have access in this project.";
    exit;
} else {
コード例 #30
-8
ファイル: app.php プロジェクト: xianliflc/teamirr
function progress_area($data)
{
    $all = count(get_data("SELECT * FROM todo_user WHERE `uid` = 0 OR `uid` = '" . intval(uid()) . "'"));
    $finished = count(get_data("SELECT * FROM todo_user WHERE (`uid` = 0 OR `uid` = '" . intval(uid()) . "') AND `status`='3' "));
    $data['all'] = $all;
    $data['finished'] = $finished;
    $data['margin-left'] = 25;
    $private_all = count(get_data("SELECT * FROM todo_user WHERE (`uid` = 0 OR `uid` = '" . intval(uid()) . "') AND `is_public` ='0'"));
    $private_finished = count(get_data("SELECT * FROM todo_user WHERE (`uid` = 0 OR `uid` = '" . intval(uid()) . "') AND `is_public` = '0' AND `status`='3' "));
    $data['private_all'] = $private_all;
    $data['private_finished'] = $private_finished;
    $data['private_margin-left'] = 200;
    echo render_html($data, dirname(__FILE__) . DS . 'view' . DS . 'progress.tpl.html');
}