예제 #1
0
 function __construct()
 {
     include "config.php";
     $config = new config();
     define("LOGIN_PATH", dirname(__FILE__) . "/" . $config->get("auth", "login-path"));
     session_start();
     if (isset($_POST["email"]) and isset($_POST["password"])) {
         // load user information
         $users = $config->get("auth", "users");
         // find current user
         foreach ($users as $user) {
             if ($user["email"] == $_POST["email"]) {
                 break;
             }
         }
         // verify password and set session cookie
         if (password_verify($_POST["password"], $user["hash"])) {
             $_SESSION["user"] = array("email" => $user["email"], "name" => $user["name"]);
         } else {
             $this->login();
         }
     } elseif (!isset($_SESSION["user"])) {
         $this->login();
     }
 }
예제 #2
0
 function get_code($order,$payment) {
     $data_order_id      = $order['id'];
     $data_amount        = $order['orderamount'];
     $data_return_url    = pay::url(basename(__FILE__,'.php'));
     $data_pay_account   = $payment['paypal_account'];
     $currency_code      = $payment['paypal_currency'];
     $data_notify_url    = pay::url(basename(__FILE__,'.php'));
     define('SERVER_HTTP',$_SERVER['SERVER_PORT'] == '443'?'https://': 'http://');
     define('SITE_URL',SERVER_HTTP.$_SERVER['HTTP_HOST']);
     $cancel_return      = SITE_URL.config::get('base_url');
     $def_url  = '<br /><form style="text-align:center;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">'.
             "<input type='hidden' name='cmd' value='_xclick'>".
             "<input type='hidden' name='business' value='$data_pay_account'>".
             "<input type='hidden' name='item_name' value='$order[order_sn]'>".
             "<input type='hidden' name='amount' value='$data_amount'>".
             "<input type='hidden' name='currency_code' value='$currency_code'>".
             "<input type='hidden' name='return' value='$data_return_url'>".
             "<input type='hidden' name='invoice' value='$data_order_id'>".
             "<input type='hidden' name='charset' value='utf-8'>".
             "<input type='hidden' name='no_shipping' value='1'>".
             "<input type='hidden' name='no_note' value=''>".
             "<input type='hidden' name='notify_url' value='$data_notify_url'>".
             "<input type='hidden' name='rm' value='2'>".
             "<input type='hidden' name='cancel_return' value='$cancel_return'>".
             "<input type='submit' value='".$GLOBALS['_LANG']['paypal_button'] ."'>".
             "</form><br />";
     return $def_url;
 }
예제 #3
0
 public function login($username = null, $pass = null, $remember = false)
 {
     if (!$username && !$pass && $this->exist()) {
         Session::put($this->_sessionName, $this->data()->id);
     } else {
         $user = $this->find($username);
         if ($user) {
             if ($this->_data->password === Hash::make($pass, $this->_data->salt)) {
                 Session::put($this->_sessionName, $this->_data->id);
                 if ($remember) {
                     $hash = hash::unique();
                     $hashCheck = $this->_db->get('user_session', array('user_id', '=', $this->data()->id));
                     if (!$hashCheck->count()) {
                         $this->_db->insert('user_session', array('user_id' => $this->_data->id, 'hash' => $hash));
                     } else {
                         $hash = $hashCheck->first()->hash;
                     }
                     Cookies::put($this->_cookieName, $hash, config::get('remember/expiry'));
                 }
                 return true;
             }
         }
     }
     return false;
 }
예제 #4
0
function update014()
{
    global $url, $smarty;
    //Checking if this Update already done
    if (CURRENT_DB_UPDATE < "014") {
        if (is_null(config::get('014updatestatus'))) {
            config::set('014updatestatus', 0);
        }
        $qry = DBFactory::getDBQuery(true);
        if (config::get('014updatestatus') < 1) {
            // Add killmail summary. time, hash, trust.
            $sql = 'CREATE TABLE IF NOT EXISTS `kb3_mails` (
  `kll_id` int(11) NOT NULL auto_increment,
  `kll_timestamp` datetime NOT NULL default "0000-00-00 00:00:00",
  `kll_external_id` int(8) default NULL,
  `kll_hash` BINARY(16) NOT NULL,
  `kll_trust` TINYINT NOT NULL DEFAULT 0,
  PRIMARY KEY  (`kll_id`),
  UNIQUE KEY `external_id` (`kll_external_id`),
  UNIQUE KEY `time_hash` (`kll_timestamp`,`kll_hash`)
) Engine=InnoDB';
            $qry->execute($sql);
        }
        killCache();
        config::set("DBUpdate", "014");
        $qry->execute("INSERT INTO kb3_config (cfg_site, cfg_key, cfg_value) SELECT cfg_site, 'DBUpdate', '014' FROM kb3_config GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '014'");
        config::del("014updatestatus");
        $smarty->assign('refresh', 1);
        $smarty->assign('content', "Update 014 completed.");
        $smarty->display('update.tpl');
        die;
    }
}
예제 #5
0
 function init() {
     $user='';
     $guest = front::get('guest');
     if($guest=='1'&&config::get('opguestadd')) {
         $user = '******';
     }else {
         if(cookie::get('login_username') &&cookie::get('login_password')) {
             $user=new user();
             $user=$user->getrow(array('username'=>cookie::get('login_username')));
         }
     }
     if(cookie::get('login_username') &&cookie::get('login_password')) {
         $guestuser=new user();
         $guestuser=$guestuser->getrow(array('username'=>cookie::get('login_username')));
     }
     $this->view->guestuser = $guestuser;
     if(!$user &&front::$act != 'login'&&front::$act != 'register')  front::redirect(url::create('user/login'));
     $this->view->user=$user;
     $this->_user=new user;
     $this->table=front::get('manage');
     if($this->table <>'archive'&&$this->table <>'orders') exit('PAGE NOT FOUND!');
     $this->_table=new $this->table;
     $this->_table->getFields();
     $this->view->form=$this->_table->get_form();
     $this->_pagesize=config::get('manage_pagesize');
     $this->view->manage=$this->table;
     $this->view->primary_key=$this->_table->primary_key;
     if(!front::get('page')) front::$get['page']=1;
     $manage='table_'.$this->table;
     $this->manage=new $manage;
 }
예제 #6
0
 public static function run($uri)
 {
     self::$router = new Router($uri);
     self::$db = new DB(config::get('db.host'), config::get('db.name'), config::get('db.user'), config::get('db.password'));
     Lang::load(self::$router->getLanguage());
     if ($_POST and (isset($_POST['username_in']) and isset($_POST['password_in'])) or isset($_POST['exit'])) {
         $us = new RegisterController();
         if (isset($_POST['exit'])) {
             $us->LogOut();
         } else {
             $us->Login($_POST);
         }
     }
     if (self::$router->getController() == 'admin' and !Session::getSession('root') or self::$router->getController() == 'myblog' and !Session::getSession('id')) {
         self::$router->setController(Config::get('default_controller'));
         self::$router->setAction(Config::get('default_action'));
         Session::setSession('message', 'Отказ в доступе');
     }
     $controller_class = ucfirst(self::$router->getController()) . 'Controller';
     $controller_method = strtolower(self::$router->getMethodPrefix() . self::$router->getAction());
     $controller_object = new $controller_class();
     if (method_exists($controller_object, $controller_method)) {
         $controller_object->{$controller_method}();
         $view_object = new View($controller_object->getData());
         $content = $view_object->render();
     } else {
         throw new Exception('Method ' . $controller_method . ' of class ' . $controller_class . ' does not exist');
     }
     $layout = self::$router->getRoute();
     $layout_path = VIEWS_PATH . DS . $layout . '.html';
     $layout_view_object = new View(compact('content'), $layout_path);
     echo $layout_view_object->render();
 }
예제 #7
0
파일: data.php 프로젝트: 453111208/bbc
 public function getBaseData()
 {
     $apis = config::get('apis.routes');
     $formatApi = array();
     foreach ($apis as $key => $api) {
         $apiGroup = $this->_genGroup($api);
         $apiMethod = $key;
         $routingKey = $api['uses'];
         //echo $key.':'.$routingKey."\n";continue;
         $apiParams = $this->_getParams($routingKey);
         $formatApi[$apiGroup][$apiMethod]['description'] = $apiParams['description'];
         $formatApi[$apiGroup][$apiMethod]['required_oauth'] = $api['oauth'];
         //$formatApi[$apiGroup][$apiMethod]['description'] = $this->_getDescription($routingkey);
         foreach ($apiParams['params'] as $paramKey => $param) {
             $formatApi[$apiGroup][$apiMethod]['params'][$paramKey]['name'] = $paramKey;
             //以后更新数据过滤,就采用这个方式获取必填项
             $formatApi[$apiGroup][$apiMethod]['params'][$paramKey]['required'] = $this->_genRequired($param['valid']);
             $formatApi[$apiGroup][$apiMethod]['params'][$paramKey]['type'] = $param['type'];
             $formatApi[$apiGroup][$apiMethod]['params'][$paramKey]['example'] = $param['example'];
             $formatApi[$apiGroup][$apiMethod]['params'][$paramKey]['default'] = $param['default'];
             $formatApi[$apiGroup][$apiMethod]['params'][$paramKey]['description'] = $param['description'];
         }
     }
     return $formatApi;
 }
예제 #8
0
 function remotelogin_action() {
     cookie::del('passinfo');
     $this->view->loginfalse=cookie::get('loginfalse'.md5($_SERVER['REQUEST_URI']));
     if (front::$args) {
         $user=new user();
         $args = xxtea_decrypt(base64_decode(front::$args), config::get('cookie_password'));
         $user=$user->getrow(unserialize($args));
         if (is_array($user)) {
             if ($user['groupid'] == '888')
                 front::$isadmin=true;
             cookie::set('login_username',$user['username']);
             cookie::set('login_password',front::cookie_encode($user['password']));
             session::set('username',$user['username']);
             require_once ROOT.'/celive/include/config.inc.php';
             require_once ROOT.'/celive/include/celive.class.php';
             $login=new celive();
             $login->auth();
             $GLOBALS['auth']->remotelogin($user['username'],$user['password']);
             $GLOBALS['auth']->check_login1();
             front::$user=$user;
         }elseif (!is_array(front::$user) ||!isset(front::$isadmin)) {
             cookie::set('loginfalse'.md5($_SERVER['REQUEST_URI']),(int) cookie::get('loginfalse'.md5($_SERVER['REQUEST_URI'])) +1,time() +3600);
             event::log('loginfalse','失败 user='******'username']);
             front::flash('密码错误或不存在该管理员!');
             front::refresh(url('admin/login',true));
         }
     }
     $this->render();
 }
예제 #9
0
파일: server.php 프로젝트: 453111208/bbc
 private function __getApiInfo(&$params, &$response)
 {
     //提取系统参数
     $method = $params['method'];
     $timestamp = $params['timestamp'];
     $format = $params['format'];
     $v = $params['v'];
     $sign_type = $params['sign_type'];
     $sign = $params['sign'];
     $exception = 'LogicException';
     if (!base_rpc_validate::isValidate($params)) {
         return $response->sendError('system.systemParams.signError', app::get('base')->_('签名错误'), $format, $exception);
     }
     if (!($format == 'json' || $format == 'xml')) {
         return $response->sendError('system.systemParams.formatError', app::get('base')->_('返回格式设定必须是json或者xml'), $format, $exception);
     }
     if (!is_numeric($timestamp)) {
         return $response->sendError('system.systemParams.timestampFormatError', app::get('base')->_('时间格式错误(包含非数字的字符)'), $format, $exception);
     }
     if (time() - intval($timestamp) > 300) {
         return $response->sendError('system.systemParams.timeOut', app::get('base')->_('请求已超时'), $format, $exception);
     }
     $apis = config::get('apis.routes');
     if (!isset($apis[$method])) {
         return $response->sendError('system.systemParams.methodNotFound', app::get('base')->_('找不到请求API'), $format, $exception);
     }
     if (!in_array($v, $apis[$method]['version'])) {
         return $response->sendError('system.systemParams.versionNotMatch', app::get('base')->_('API版本不匹配'), $format, $exception);
     }
     return $apis[$method];
 }
예제 #10
0
파일: Hash.php 프로젝트: Jay-En/BonePHP
 public static function make($string, $salt = "")
 {
     if ($salt = "") {
         $salt = config::get('encryption/salt');
     }
     return hash('sha256', $string, $salt);
 }
예제 #11
0
 public function article($uri)
 {
     $this->template->content = View::factory('blog/view')->bind('post', $post)->bind('comments', $comments)->bind('form', $form);
     $post = ORM::factory('blog_post', (string) $uri);
     // Show 404 if we don't find posts
     if (!$post->loaded) {
         Event::run('system.404');
     }
     $comments = $post->blog_comments;
     $this->head->title->prepend($post->title);
     if (!($post->comment_status === 'open' and config::get('blog.comment_status') === 'open')) {
         return;
     }
     $form = Formo::factory()->plugin('csrf')->add('text', 'author', array('label' => __('Name')))->add('text', 'email', array('label' => __('Email')))->add('text', 'url', array('label' => __('Homepage')))->add('textarea', 'content', array('label' => __('Comment')))->add('submit', 'submit', array('label' => __('Submit')))->pre_filter('all', 'trim')->pre_filter('author', 'security::xss_clean')->pre_filter('content', 'security::xss_clean')->pre_filter('url', 'security::xss_clean')->pre_filter('url', 'format::url')->add_rule('author', 'required', __('You must provide your name'))->add_rule('author', 'length[2,40]', __('Your Name is too long'))->add_rule('email', 'valid::email', __('Email address is not valid'))->add_rule('content', 'required', __('You must enter a comment'));
     if (config::get('blog.enable_captcha') === 'yes') {
         $form->add('captcha', 'security', array('label' => __('Security code')));
         $form->security->error_msg = __('Invalid security code');
     }
     if ($form->validate()) {
         $comment = ORM::factory('blog_comment');
         $comment->author = $form->author->value;
         $comment->email = $form->email->value;
         $comment->content = $form->content->value;
         $comment->url = $form->url->value;
         $comment->ip = $this->input->ip_address();
         $comment->agent = Kohana::$user_agent;
         $comment->date = date("Y-m-d H:i:s", time());
         $post->add_comment($comment);
         Event::run('blog.comment_added', $comment);
         Cache::instance()->delete('s7n_blog_feed');
         Cache::instance()->delete('s7n_blog_feed_comments');
         url::redirect($post->url());
     }
     $form = View::factory('blog/form_comment', $form->get(TRUE));
 }
예제 #12
0
 public static function conectar()
 {
     //Si no esta conectado, se conecta, sino, no.
     if (self::$conexion === null) {
         $svr = config::get('bd.servidor', 'localhost');
         $usr = config::get('bd.usuario', 'root');
         $pwd = config::get('bd.clave', '');
         $dbn = config::get('bd.nombre', '');
         self::$depurar = config::get('bd.depurar', false);
         self::$conexion = new mysqli($svr, $usr, $pwd, $dbn);
         if (!mysqli_connect_error()) {
             $charset = config::get('bd.charset', '');
             if (!empty($charset)) {
                 self::$conexion->set_charset($charset);
             }
         }
         //if
         if (!mysqli_connect_error()) {
             if (self::$depurar) {
                 log::mensajeLin(__METHOD__ . ' Ok');
             }
             self::$error = false;
         } else {
             self::$error = 'Error BD(' . mysqli_connect_errno() . '): ' . mysqli_connect_error();
             self::$conexion = null;
             log::mensajeLin(__METHOD__ . ' ' . self::$error);
         }
         //if
     }
     //if
     return self::$conexion !== null;
 }
예제 #13
0
    function manage_action() {
        if(!config::get('sms_username') || !config::get('sms_password')){
            echo '<script>alert("您需要先设置用户名和密码才能使用短信管理功能!");window.location.href="'.url('config/system/set/sms').'";</script>';
            exit;
        }
        include_once("phprpc/phprpc_client.php");
        $client = new PHPRPC_Client();
        $client->setProxy(NULL);
        $client->useService('http://pay.cmseasy.cn/sms.php');
        $client->setKeyLength(128);
        $client->setEncryptMode(3);
        $info = $client->getInfo(config::get('sms_username'),md5(config::get('sms_password')));
        $info[0] = intval($info[0]);
        $info[1] = intval($info[1]);
        $this->view->info = $info;
        if (front::post('submit')) {
            if (front::post('act') == 'test') {
                $rs = sendMsg(front::post('mobile'),'test');
                if($rs->SendSMSResult == '0'){
                    front::flash('发送成功');
                }else{
                    front::flash('发送失败,请检查用户名、密码或剩余条数');
                }
            }
        }else{
			if($info[0] < 50) front::flash('你的剩余短信不足50条,请及时充值');
		}
    }
예제 #14
0
파일: shopnode.php 프로젝트: 453111208/bbc
 static function send_to_center($app_id, $data = null, $method = 'node.reg')
 {
     $app_info = app::get($app_id)->define();
     $obj_app = app::get($app_id);
     // 生成参数...
     $api_data = array('certi_app' => $method, 'certificate_id' => base_certificate::certi_id(), 'node_type' => 'ecos.' . $app_id, 'url' => kernel::base_url(true), 'version' => $app_info['version'], 'channel_ver' => $app_info['api_ver'], 'api_ver' => '1.2', 'format' => 'json', 'api_url' => kernel::base_url(1) . kernel::url_prefix() . '/api');
     //更新时,多带个参数
     if ($method == 'node.update') {
         $api_data['node_id'] = base_shopnode::node_id($app_id);
     }
     ksort($api_data);
     foreach ($api_data as $key => $value) {
         $str .= $value;
     }
     $api_data['certi_ac'] = strtoupper(md5($str . base_certificate::token()));
     $http = kernel::single('base_httpclient');
     $http->set_timeout(6);
     $result = $http->post(config::get('link.license_center'), $api_data);
     $result = json_decode($result, true);
     if ($result['res'] == 'succ') {
         return self::set_node_id($result['info'], $app_id);
     } else {
         return false;
     }
 }
예제 #15
0
 /**
  * Update the sign-in credentials for the specific user.
  *
  * @param UserRecord $user The user to update the credentials for
  * @return Boolean True on success
  */
 public function assignCredentials(UserRecord $user)
 {
     $db = new DatabaseConnection();
     // Generate a new salt and hash the password
     $salt = $this->generateSalt();
     // What hashing algorithm to use
     $ha = config::get('lepton.user.hashalgorithm', 'md5');
     $ps = $user->password . $salt;
     $hp = hash($ha, $ps);
     if ($user->userid == null) {
         $uuid = UUID::v4();
         try {
             $id = $db->insertRow("REPLACE INTO " . LEPTON_DB_PREFIX . "users (username,salt,password,email,flags,registered,uuid) VALUES (%s,%s,%s,%s,%s,NOW(),%s)", $user->username, $salt, $hp, $user->email, $user->flags, $uuid);
             $user->userid = $id;
         } catch (Exception $e) {
             throw $e;
             // TODO: Handle exception
         }
     } else {
         try {
             $db->updateRow("UPDATE " . LEPTON_DB_PREFIX . "users SET username=%s,salt=%s,password=%s,email=%s,flags=%s WHERE id=%d", $user->username, $salt, $hp, $user->email, $user->flags, $user->userid);
         } catch (Exception $e) {
             throw $e;
             // TODO: Handle exception
         }
     }
     return true;
 }
예제 #16
0
 private function execQuery()
 {
     $this->qry = DBFactory::getDBQuery();
     $query = "SELECT * FROM kb3_navigation WHERE nav_type = '{$this->type}'";
     if (Killboard::hasCampaigns() == false) {
         $query .= " AND url NOT LIKE '?a=campaigns'";
     }
     if (config::get('public_losses')) {
         $query .= " AND url NOT LIKE '?a=losses'";
     }
     if (!config::get('show_standings')) {
         $query .= " AND url NOT LIKE '?a=standings'";
     }
     if (config::get('public_stats') == 'remove') {
         $query .= " AND url NOT LIKE '?a=self_detail'";
     }
     $query .= " AND (page = '" . $this->page . "' OR page = 'ALL_PAGES') AND hidden = 0";
     $query .= " AND KBSITE = '" . $this->site . "' ORDER BY posnr";
     $this->qry->execute($query);
     // If no navigation table was found then make one.
     if (!$this->qry->recordCount()) {
         $this->check_navigationtable();
         $this->qry->execute($query);
     }
 }
예제 #17
0
파일: configx.php 프로젝트: 453111208/bbc
 /**
  * 娴嬭瘯parse comments
  *
  * @return void
  */
 public function testConfigWrite()
 {
     $configWrite = new base_setup_config();
     $configWrite->overwrite = true;
     $configs = ['database.host' => config::get('database.host'), 'database.database' => config::get('database.database'), 'database.username' => config::get('database.username'), 'database.password' => config::get('database.password')];
     $configWrite->write($configs);
 }
예제 #18
0
 function delete_before() {
     $tbname = config::get('database','prefix').'archive';
     $typeid = front::$get['id'];
     $where = "typeid = '$typeid'";
     $arc=new archive();
     $arc->rec_delete($tbname,$where);
 }
예제 #19
0
파일: swoole.php 프로젝트: 453111208/bbc
 private function _setting($queue = null)
 {
     $q = array();
     $config = config::get('swoolequeue.config');
     $type = config::get('swoolequeue.type');
     if ($queue) {
         $q = $type[$queue];
         if ($q['worker_num']) {
             $config['worker_num'] = $q['worker_num'];
         }
         if ($q['task_worker_num']) {
             $config['task_worker_num'] = $q['task_worker_num'];
         }
         if ($q['reactor_num']) {
             $config['reactor_num'] = $q['reactor_num'];
         }
     }
     if ($config['log_file']) {
         $config['log_file'] = DATA_DIR . "/" . $config['log_file'];
     }
     $this->host = $q['host'] ? $q['host'] : $config['host'];
     $this->port = $q['port'] ? $q['port'] : $config['port'];
     $this->mode = $q['mode'] ? $q['mode'] : $config['mode'];
     $callbackClass = $q['callback_class'] ? $q['callback_class'] : $config['callback_class'];
     unset($config['host'], $config['port'], $config['mode']);
     if (!$config) {
         throw new \LogicException("配置项参数缺失");
     }
     $this->config = $config;
     if (!$callbackClass) {
         throw new \LogicException("配置项参数缺失");
     }
     $this->objCallback = new $callbackClass();
     return true;
 }
예제 #20
0
/**
 * @package EDK
 */
function update034()
{
    global $url, $smarty;
    //Checking if this Update already done
    if (CURRENT_DB_UPDATE < "034") {
        if (is_null(config::get('034updatestatus'))) {
            config::set('034updatestatus', 0);
        }
        $qry = DBFactory::getDBQuery(true);
        if (config::get('034updatestatus') < 1) {
            $qry->execute("SHOW COLUMNS FROM kb3_invtypes LIKE 'radius'");
            if ($qry->recordCount()) {
                $sql = "ALTER TABLE `kb3_invtypes` DROP COLUMN `radius` ";
                $qry->execute($sql);
            }
        }
        config::set("DBUpdate", "034");
        $qry->execute("INSERT INTO kb3_config (cfg_site, cfg_key, cfg_value) SELECT cfg_site, 'DBUpdate', '034' FROM kb3_config GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '034'");
        config::del("034updatestatus");
        $smarty->assign('refresh', 1);
        $smarty->assign('content', "Update 034 completed.");
        $smarty->display('update.tpl');
        die;
    }
}
예제 #21
0
파일: Redirect.php 프로젝트: Jay-En/BonePHP
 public function to($location = null)
 {
     if ($location) {
         header('Location: ' . config::get('base_url') . $location);
         exit;
     }
 }
예제 #22
0
 /**
  * Load the image,
  * set the image processor library
  *
  * @return void
  */
 protected function load()
 {
     $this->basePath = public_path($this->config->get('image::dir')) . '/';
     $this->baseDir = $this->config->get('image::dir') . '/';
     $this->sizes = $this->config->get('image::sizes');
     $this->allowGif = $this->config->get('image::allow-animated-gif');
     $this->saveOriginal = $this->config->get('image::save-original');
     $this->maxSize = $this->config->get('image::max-size');
     $this->allowExt = explode(',', $this->config->get('image::ext-allowed'));
     $this->name = $this->isUrl ? md5($this->uploadFile) : $this->uploadFile->getClientOriginalName();
     $this->ext = (string) strtolower($this->isUrl ? $this->file->extension($this->uploadFile) : $this->uploadFile->getClientOriginalExtension());
     $this->uploadFilePath = $this->isUrl ? $this->uploadFile : $this->uploadFile->getRealPath();
     if (!$this->isUrl and $this->file->size($this->uploadFilePath) > $this->maxSize) {
         $this->hasError = true;
     }
     //also confirm the image type
     if (!in_array($this->ext, $this->allowExt)) {
         $this->hasError = true;
     }
     /**
      * Load our library
      */
     require_once 'library/gif_exg.php';
     //require_once 'library/wideimage/lib/WideImage.php';
     require_once 'library/PHPImageWorkshop/autoload.php';
 }
예제 #23
0
 public static function load(&$killlist, $type = 'kill')
 {
     if ($type == 'kill') {
         if (config::get('cfg_pilotid')) {
             $killlist->addInvolvedPilot(config::get('cfg_pilotid'));
         }
         if (config::get('cfg_corpid')) {
             $killlist->addInvolvedCorp(config::get('cfg_corpid'));
         }
         if (config::get('cfg_allianceid')) {
             $killlist->addInvolvedAlliance(config::get('cfg_allianceid'));
         }
     } elseif ($type == 'loss') {
         if (config::get('cfg_pilotid')) {
             $killlist->addVictimPilot(config::get('cfg_pilotid'));
         }
         if (config::get('cfg_corpid')) {
             $killlist->addVictimCorp(config::get('cfg_corpid'));
         }
         if (config::get('cfg_allianceid')) {
             $killlist->addVictimAlliance(config::get('cfg_allianceid'));
         }
     } elseif ($type == 'combined') {
         if (config::get('cfg_pilotid')) {
             $killlist->addCombinedPilot(config::get('cfg_pilotid'));
         }
         if (config::get('cfg_corpid')) {
             $killlist->addCombinedCorp(config::get('cfg_corpid'));
         }
         if (config::get('cfg_allianceid')) {
             $killlist->addCombinedAlliance(config::get('cfg_allianceid'));
         }
     }
 }
 function generate()
 {
     $sql = "select DISTINCT kll.kll_id, kll_isk_loss as isk, kll_ship_id as ship, kll_victim_id as plt_id\n                from kb3_kills kll\n\t      INNER JOIN kb3_inv_detail ind on ( ind.ind_kll_id = kll.kll_id )";
     $bottomSQL = "order by 2 desc limit " . $this->limit;
     // do we need to exclude ship types?
     $excludeShipClasses = array();
     // exclude supercaps?
     if (config::get("mostexptoplist_supercaps") === "0") {
         // Supercarrier
         $this->excludeVictimShipClass(28);
         // Titan
         $this->excludeVictimShipClass(26);
     }
     // exclude regular caps?
     if (config::get("mostexptoplist_caps") === "0") {
         // Dreadnought
         $this->excludeVictimShipClass(19);
         // Carrier
         $this->excludeVictimShipClass(27);
         // Capital Industrial
         $this->excludeVictimShipClass(29);
     }
     // exclude NPC kills?
     if (config::get("mostexptoplist_npclosses") === "0") {
         $noNpcWhere = " AND ind_shp_id != 0 ";
         $bottomSQL = $noNpcWhere . $bottomSQL;
     }
     $this->setSQLTop($sql);
     // we dont want structures
     $this->setNoStructures();
     $this->setSQLBottom($bottomSQL);
     // pods, shuttles, noob ships are intersting, too!
     $this->setPodsNoobShips(TRUE);
 }
예제 #25
0
 public function login($email = null, $password = null, $remember = false)
 {
     if (!$email && !$password && $this->exists()) {
         session::put($this->_session_name, $this->_data->id);
     } else {
         $user = $this->find($email);
         if ($user) {
             if ($this->_data->password === hash::make($password, $this->_data->salt)) {
                 session::put($this->_session_name, $this->_data->id);
                 if ($remember) {
                     $hash = hash::unique();
                     $hash_check = $this->_db->get('users_session', array('user_id', '=', $this->_data->id));
                     if (!$hash_check->count()) {
                         $this->_db->insert('users_session', array('user_id' => $this->_data->id, 'hash' => $hash));
                     } else {
                         $hash = $hash_check->firstResult()->hash;
                     }
                     cookie::put($this->_cookie_name, $hash, config::get('remember/cookie_expiry'));
                 }
                 return true;
             }
         }
     }
     return false;
 }
예제 #26
0
 /**
  * Examine the URL, optionally looking for a specific service. If no
  * service selection is done, all the services that the URL publishes
  * will be returned.
  *
  * @param string $url The URL to explore
  * @param string $service The service to look for
  * @return array An array of the exposed services at the URL
  */
 function discover($url, $services = null)
 {
     // Perform the query
     $ret = new HttpRequest($url);
     // Grab the data
     $status = $ret->status();
     $content = $ret->responseText();
     $headers = $ret->headers();
     $results = array();
     // Enumerate the explorers
     $explorers = config::get(Discovery::KEY_EXPLORERS, array());
     foreach ($explorers as $explorer) {
         // Discover the service and merge the results
         $instance = new $explorer($url, $headers, $content);
         $instance->discover();
         if ($services) {
             foreach ($instance->getAllServices() as $stype => $sdata) {
                 // Return the service if it matches the type.
                 if ($stype == $service) {
                     return $sdata;
                 }
             }
         } else {
             // Merge the resultset otherwise
             $results = array_merge($results, $instance->getAllServices());
         }
     }
     // Return null if we were looking for a specific service
     if ($services) {
         return null;
     }
     return $results;
 }
예제 #27
0
파일: Log.php 프로젝트: meetcd/sofast
 /** 
  * 写日志 
  * 
  * @param string $s_message 日志信息 
  * @param string $s_type    日志类型 
  */
 public static function write($s_message, $s_type = 'log')
 {
     // 检查日志目录是否可写
     if (!is_dir(config::get("log_dir"))) {
         @mkdir(config::get("log_dir"));
         chmod(config::get("log_dir"), 0777);
     }
     if (!is_writable(config::get("log_dir"))) {
         throw new sfException(lang::get('LOG_PATH is not writeable !'));
     }
     $s_now_time = date('[Y-m-d H:i:s]');
     $s_now_day = date('Y_m_d');
     // 根据类型设置日志目标位置
     $s_target = config::get("log_dir");
     switch ($s_type) {
         case 'debug':
             $s_target .= '/Out_' . $s_now_day . '.log';
             break;
         case 'error':
             $s_target .= '/Err_' . $s_now_day . '.log';
             break;
         default:
             $s_target .= '/Log_' . $s_now_day . '.log';
             break;
     }
     //检测日志文件大小, 超过配置大小则重命名
     if (file_exists($s_target) && self::$max_size <= filesize($s_target)) {
         $s_file_name = substr(basename($s_target), 0, strrpos(basename($s_target), '.log')) . '_' . time() . '.log';
         rename($s_target, dirname($s_target) . '/' . $s_file_name);
     }
     clearstatcache();
     // 写日志, 返回成功与否
     return error_log("{$s_now_time} {$s_message}\n", 3, $s_target);
 }
예제 #28
0
파일: roles.php 프로젝트: 453111208/bbc
 public function edit()
 {
     $this->contentHeaderTitle = app::get('topshop')->_('添加角色');
     //面包屑
     $this->runtimePath = array(['url' => url::action('topshop_ctl_index@index'), 'title' => app::get('topshop')->_('首页')], ['url' => url::action('topshop_ctl_account_roles@index'), 'title' => app::get('topshop')->_('角色管理')], ['title' => app::get('topshop')->_('添加角色')]);
     if (input::get('role_id')) {
         $params['shop_id'] = $this->shopId;
         $params['role_id'] = input::get('role_id');
         $data = app::get('topshop')->rpcCall('account.shop.roles.get', $params);
         if ($data) {
             $pagedata['role_id'] = $data['role_id'];
             $pagedata['role_name'] = $data['role_name'];
             $pagedata['workground'] = explode(',', $data['workground']);
         }
     }
     $permission = config::get('permission');
     unset($permission['common']);
     foreach ($permission as $k => $row) {
         foreach ($row['group'] as $key => $value) {
             $permissionKey[$key] = $k . '.group.' . $key;
         }
     }
     $pagedata['permissionKey'] = $permissionKey;
     $pagedata['permission'] = $permission;
     return $this->page('topshop/account/roles/edit.html', $pagedata);
 }
예제 #29
0
 function createSelectBackground()
 {
     $options = array();
     if (config::get('style_background') == "0") {
         $state = 1;
     } else {
         $state = 0;
     }
     $options[] = array('value' => "0", 'descr' => "No background", 'state' => $state);
     $dir = "background/";
     if (is_dir($dir)) {
         if ($dh = scandir($dir)) {
             foreach ($dh as $file) {
                 $file = substr($file, 0);
                 if (!is_dir($dir . $file)) {
                     if (config::get('style_background') == $file) {
                         $state = 1;
                     } else {
                         $state = 0;
                     }
                     $options[] = array('value' => $file, 'descr' => $file, 'state' => $state);
                 }
             }
         }
     }
     return $options;
 }
예제 #30
0
파일: sms.php 프로젝트: 453111208/bbc
 /**
  * send
  * 必有方法,发送时调用
  * config参数为getOptions取得的所有项的配置结果
  * @param string $to
  * @param string $content
  * @param array $config
  * @access public
  * @return void
  */
 public function send($to, $title, $content, $config)
 {
     if (!$to) {
         throw new \LogicException('短信发送失败:手机号为空!');
     }
     if (!$content) {
         throw new \LogicException('短信发送失败:短信内容为空!');
     }
     $setSmsSign = app::get('system')->getConf('setSmsSign');
     if (is_array($setSmsSign)) {
         $setSmsSign = $setSmsSign['sign'];
     }
     //当在shopex内网开发时,配置测试内容时使用
     if ($testConf = config::get('messenger.intranet')) {
         $setSmsSign = $testConf['sign'];
         $config = array_merge($config, $testConf);
     }
     if (!$setSmsSign) {
         throw new \LogicException('短信签名不能为空!');
     }
     if (is_array($to)) {
         $to = implode(',', $to);
     }
     $setSms = $this->_checkReg($setSmsSign);
     $content = $content . '【' . $setSmsSign . '】';
     $contents = array(0 => array('phones' => $to, 'content' => $content));
     try {
         $result = kernel::single('system_messenger_smschg')->send($contents, $config);
     } catch (Exception $e) {
         $msg = $e->getMessage();
         throw new \LogicException($msg);
         return false;
     }
     return true;
 }