function __construct() { parent::__construct(); $this->authorize(false, 'ADMIN', 'CLIENT'); $this->httpStatus = APIController::HTTP_INTERNAL_SERVER_ERROR; $this->responseObj = array($this->config->item('rest_message_field_name') => null); }
function __construct() { parent::__construct(); $this->authorize(true, 'ADMIN'); $this->httpStatus = APIController::HTTP_UNAUTHORIZED; $this->responseObj = array($this->config->item('rest_message_field_name') => null); }
function __construct() { parent::__construct(); $dsn = 'mysql:host=' . MYSQL_SERVER . ';dbname=' . MYSQL_DB . ';charset=utf8'; $this->storage = new \API\Middleware\SSCOauthStoragePDO(array('dsn' => $dsn, 'username' => MYSQL_USER, 'password' => MYSQL_PW)); $this->server = new \OAuth2_Server($this->storage); $this->server->addGrantType(new \API\Middleware\SSC_OAuth2_GrantType_UserCredentials($this->storage)); $this->server->addGrantType(new \API\Middleware\SSC_OAuth2_GrantType_ClientCredentials($this->storage)); }
public function post() { if (!($userID = User::login($this->post['username'], $this->post['password']))) { $this->status = 403; $this->message = "Invalid username or password"; } else { Session::login($userID); $this->response = array($this->slug => array('auth_id' => $userID, 'auth_token' => APIController::authToken($userID))); } }
public static function getSession() { self::startSessionIfNecessary(); try { if (!isset($_SESSION['user_session'])) { self::$singleton = new SessionController(); } else { self::$singleton = $_SESSION['user_session']; if (isset(self::$singleton->user)) { self::updateUserData(); } } } catch (Exception $e) { APIController::getError($e->getMessage()); } return self::$singleton; }
<?php set_include_path($_SERVER["DOCUMENT_ROOT"] . "/shalomshanti/"); require_once "Controller/APIController.php"; header("Content-type: text/json"); if ($_SERVER['REQUEST_METHOD'] === "GET") { echo APIController::runAction("getUser"); } else { echo APIController::getError("Unsupported HTTP Method: " . $_SERVER['REQUEST_METHOD']); }
* * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ include_once "../includes/sp-load.php"; include_once SP_CTRLPATH . "/api.ctrl.php"; include_once SP_CTRLPATH . "/settings.ctrl.php"; include SP_ABSPATH . "/api/api.functions.php"; $controller = new APIController(); $inputInfo = $_SERVER['REQUEST_METHOD'] == 'POST' ? $_POST : $_GET; // sp demo enabled if (SP_DEMO) { $returnInfo['response'] = 'Error'; $returnInfo['error_msg'] = "API will not work in demo mode!"; } else { if ($controller->verifyAPICredentials($inputInfo)) { $category = strtolower($inputInfo['category']); $action = $inputInfo['action']; // check for category and action values if (!empty($category) && !empty($action)) { // call api class with the action if (include SP_ABSPATH . "/api/" . $category . ".api.php") { $categortClassName = ucfirst($category) . "API"; // check for class exists or not
public function __construct($appName, IRequest $request, Folder $userFolder) { parent::__construct($appName, $request); $this->userFolder = $userFolder; }
public function sendMessageToTheGroup() { $user = Auth::user(); $input = Input::all(); //print_r(json_decode($input['userList'])); $conversationMessage = new ConversationMessage(); $conversationMessage->message = $input['message']; $conversationMessage->sender_id = $user['id']; $conversationMessage->member = $input['userList']; // add user to the group $userListArray = json_decode($input['userList']); $apicontroller = new APIController(); $conversationMessage->conversation_id = $input['conversationID']; $conversationMessage->save(); foreach ($userListArray as $key => $value) { # code... if ($user->id != $value->id) { // send notification to the other members among the group $notificationCheck = GroupNotificationStatus::where('conversation_id', '=', $input['conversationID'])->where('user_id', '=', $value->id)->get(); if ($notificationCheck[0]->status == "1") { $apicontroller->addNotification($value->id, 'newgroupmessage', $input['conversationID'], $input['message']); } } // end codition check } // end loop }
function __construct($merge = false) { parent::__construct($merge); }
} $content .= " <tr>\n <td></td>\n <td align='right'><input type='submit' value='submit'></td>\n </tr>\n"; $content .= " </table>\n"; $content .= "</form>\n"; $content .= "<hr/>\n"; } return $content; } public function enumCss() { } public function enumJs() { } } ?> <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <?php $controller = new APIController(); $controller->run(); ?> </head> <body> <?php echo $controller->render(); ?> </body> </html>
<?php include 'library/bootstrap.php'; Routing::init(); try { if (Routing::isAPI()) { $controller = APIController::create(array('controller' => Routing::controllerName())); } else { $controller = Controller::create(array('controller' => Routing::controllerName())); } } catch (Exception $e) { Util::redirect('/404.html'); } $controller->beforeFilter(); $controller->filter(Routing::action(), Routing::args()); $controller->afterFilter();
date_default_timezone_set("PRC"); defined('YII_DEBUG') or define('YII_DEBUG', false); @ini_set('display_errors', '1'); error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING); // change the following paths if necessary $config = dirname(__FILE__) . '/protected/config/main.php'; $yii = dirname(__FILE__) . '/yii/framework/yii.php'; // specify how many levels of call stack should be shown in each log message defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 8); // 客户端请求 defined('CLIENT_REQUEST_API') or define('CLIENT_REQUEST_API', TRUE); require_once $yii; Yii::createWebApplication($config); header('Access-Control-Allow-Origin: http://static.miniyun.cn'); header('Access-Control-Allow-Methods: POST'); header('Access-Control-Allow-Methods: GET'); MiniAppParam::getInstance()->load(); //初始化APP静态数据 MiniPlugin::getInstance()->load(); //加载插件 $routePath = MiniHttp::getParam("route", ""); if (empty($routePath)) { //老接口 $meta = new MAPIController(); //通过meta的控制器进行跳转处理逻辑 $meta->invoke(); } else { //新接口 $api = new APIController(); $api->invoke(); }
* * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ include_once "includes/sp-load.php"; checkAdminLoggedIn(); include_once SP_CTRLPATH . "/api.ctrl.php"; include_once SP_CTRLPATH . "/settings.ctrl.php"; $controller = new APIController(); $controller->view->menu = 'adminpanel'; $controller->layout = 'ajax'; $controller->set('spTextPanel', $controller->getLanguageTexts('panel', $_SESSION['lang_code'])); $controller->set('spTextSettings', $controller->getLanguageTexts('settings', $_SESSION['lang_code'])); $controller->spTextAPI = $controller->getLanguageTexts('api', $_SESSION['lang_code']); $controller->set('spTextAPI', $controller->spTextAPI); if ($_SERVER['REQUEST_METHOD'] == 'POST') { switch ($_POST['sec']) { default: $controller->showAPIConnectionManager($_POST); break; } } else { switch ($_GET['sec']) { default:
function __construct() { parent::__construct(); $this->httpStatus = APIController::HTTP_UNAUTHORIZED; $this->responseObj = array($this->config->item('rest_message_field_name') => null, 'loggedIn' => false); }
function __construct() { parent::__construct(); }