/** * Construct our adapter by gleaning the keys from the ENV params. * These can be set in the .env file, or set as environment vars on a production server. */ public function __construct() { $app_id = env('PARSE_APP_APID'); $rest_key = env('PARSE_APP_REST'); $master_key = env('PARSE_APP_MAST'); ParseClient::initialize($app_id, $rest_key, $master_key); }
/** * Initialize Push with needed Parse keys * * @param $appId * @param $restKey * @param $masterKey */ public function __construct($appId, $restKey, $masterKey) { $this->appId = $appId; $this->restKey = $restKey; $this->masterKey = $masterKey; ParseClient::initialize($appId, $restKey, $masterKey); }
public function __construct() { parent::__construct(); $this->load->database(); // Init parse: app_id, rest_key, master_key ParseClient::initialize($this->config->item('app_id'), $this->config->item('rest_key'), $this->config->item('master_key')); }
public static function setUp() { ini_set('error_reporting', E_ALL); ini_set('display_errors', 1); date_default_timezone_set('UTC'); ParseClient::initialize('app-id-here', 'rest-api-key-here', 'master-key-here'); }
/** * Inicializa la aplicacion de la base de datos de Parse */ public static function inicializa() { try { ParseClient::initialize('ve3SsAciKVt8GwhmLDCzW9rQ6EkPj8ai3pWcp3Is', 'zt0dVKAQwyRTAOFkfFj5d9jzDWAH9fjaJsUR5fhD', 'QpnJBJkOEp3VmEbcaAX8r6HDixj2wCUNQ42e1c4N'); } catch (ParseException $ex) { } }
public static function setUp() { ini_set('error_reporting', E_ALL); ini_set('display_errors', 1); date_default_timezone_set('UTC'); ParseClient::initialize('SVybRISVg4pUS0jciWYkZH5CSTyPaXAXvdWZjCu6', 'JthZqiVHiZ2BEEkwxWB2ltriJjmay3z7TRSS6KX5', 'RH4pRDW25piAJsMUEx3uduzvbSu2t9h37se77mNn'); }
public function onBootstrap(MvcEvent $e) { //parse uses a global client, and needs the session to be started $config = $e->getApplication()->getServiceManager()->get('config'); session_start(); ParseClient::initialize($config['parse']['app_id'], $config['parse']['rest_key'], $config['parse']['master_key']); }
public function testQuery() { $app_id = "XASVlMZE1IVe3zCDpHT5mzhTiEd3su7IWM68Uepa"; $rest_key = "zBwmJIkcOE1dvX3GUIpJT5ebLOhhPhn1NmsdWC6e"; $master_key = "0zNVL0uJnxUiU9r1Ogvii7vLW8tOASIyS5j5HK4G"; ParseClient::$HOST_NAME = "http://localhost/parse/public/"; ParseClient::initialize($app_id, $rest_key, $master_key); \App\Test::truncate(); $response = $this->generalQuery(); $this->assertArrayHasKey("results", $response); $this->assertEmpty($response["results"]); $this->objects = factory(\App\Test::class, 50)->create(); $response = $this->generalQuery(); $this->assertArrayHasKey("results", $response); $this->assertEquals(50, count($response["results"])); $response = $this->firstQuery(); $this->assertArrayHasKey("results", $response); $this->assertEquals(1, count($response["results"])); $response = $this->equalToQuery(); $this->assertArrayHasKey("results", $response); $this->assertEquals(1, count($response["results"])); $response = $this->notEqualToQuery(); $this->assertArrayHasKey("results", $response); $this->assertEquals(49, count($response["results"])); $response = $this->limitQuery(); $this->assertArrayHasKey("results", $response); $this->assertEquals(10, count($response["results"])); }
private function bootParseClient() { $config = $this->app['config']->get('parse'); // Init the parse client ParseClient::initialize($config['app_id'], $config['rest_key'], $config['master_key']); ParseClient::setStorage(new ParseSessionStorage($this->app['session'])); }
public function __construct() { $app_id = "id"; $rest_key = "rest_key"; $master_key = "master_key"; ParseClient::initialize($app_id, $rest_key, $master_key); }
/** * Setup parse. * * @param \Illuminate\Contracts\Foundation\Application $app * * @return void */ protected function setupParse(Application $app) { $app_id = env('PARSE_APP_ID'); $rest_key = env('PARSE_REST_KEY'); $master_key = env('PARSE_MASTER_KEY'); ParseClient::initialize($app_id, $rest_key, $master_key); }
public static function setUp() { ini_set('error_reporting', E_ALL); ini_set('display_errors', 1); date_default_timezone_set('UTC'); ParseClient::initialize('app-id-here', 'rest-api-key-here', 'master-key-here', true, 'account-key-here'); ParseClient::setServerURL('http://localhost:1337/parse'); }
public static function email($type, $email, $title = "") { ParseClient::initialize(self::$app_id, self::$rest_key, self::$master_key); $alert = ["Nuevas validaciones disponibles", "Tiene un nuevo evento disponible", "Nuevas encuestas disponibles", "Tiene un nuevo mensaje"]; $query = ParseInstallation::query(); $query->equalTo("email", $email); ParsePush::send(array("where" => $query, "data" => array("title" => "VaClases", "alert" => ($title ? $title . " - " : "") . $alert[$type]))); }
public function connect_to_db() { //almacenamos en variables los datos obtenidos desde la clase Config $app_id = Config::appId; $rest_key = Config::restKey; $master_key = Config::masterKey; //establecemos la conexión a la DB $connection = ParseClient::initialize($app_id, $rest_key, $master_key); }
public static function setUp() { $app_id = "8PYzxLlTqztkDEBCx3oDH6m6CqXYRpb4QTCWuuMw"; $rest_key = "VUEHy9GWuE9SJdCn8wvScoWAMYWun6PbpzqP8KAh"; $master_key = "WOyCyOO7gXaMs2wCqgwmBsWDxo8R7CIPhDH9baOM"; ini_set('error_reporting', E_ALL); ini_set('display_errors', 1); date_default_timezone_set('UTC'); ParseClient::initialize($app_id, $rest_key, $master_key); }
private function bootParseClient() { $config = $this->app['config']->get('parse'); // Init the parse client ParseClient::initialize($config['app_id'], $config['rest_key'], $config['master_key']); if (empty($config['server_url']) != true && empty($config['mount_path'] != true)) { ParseClient::setServerURL($config['server_url'], $config['mount_path']); } ParseClient::setStorage(new ParseSessionStorage($this->app['session'])); }
public function __construct() { $appId = '**************'; $restApiKey = '**************'; $masterKey = '**************'; // initialize parse ParseClient::initialize($appId, $restApiKey, $masterKey); // set session storage ParseClient::setStorage(new ParseSessionStorage()); }
/** * Creates a Transport instance * * @param array $config transport-specific configuration options */ public function __construct(array $config) { parent::__construct($config); $keys = Configure::read('Notifications.transports.push_message'); if (Configure::check('Notifications.transports.push_message.' . ENVIRONMENT)) { // prefer environment specific config keys $keys = Configure::read('Notifications.transports.push_message.' . ENVIRONMENT); } ParseClient::initialize($keys['app_id'], $keys['rest_key'], $keys['master_key']); }
public function initialize() { // Initialize Parse Connection ParseClient::initialize('csuwC4xF8eEbruLrXFbVnWn9cfc3kdGwwphGDpuh', 'YFUTIzUHA9pejKqtLhBRldwP1JnjJqhkziLHGVaJ', 'XtZONCdSLK6fCIKPv6o4vmRbYfRrydduDTxjKZs1'); // ------------------------ Asset Collections ------------------------ // Css in the header $this->assets->collection('header')->addCss('plugins/pace/pace-theme-flash.css')->addCss('plugins/boostrapv3/css/bootstrap.min.css')->addCss('plugins/boostrapv3/css/bootstrap-theme.min.css')->addCss('plugins/font-awesome/css/font-awesome.css')->addCss('css/animate.min.css')->addCss('css/style.css')->addCss('css/responsive.css')->addCss('css/custom-icon-set.css'); // Javascript in the footer $this->assets->collection('footer')->addJs('plugins/jquery-1.8.3.min.js')->addJs('plugins/boostrapv3/js/bootstrap.min.js')->addJs('plugins/pace/pace.min.js')->addJs('plugins/jquery-validation/js/jquery.validate.min.js')->addJs('plugins/jquery-lazyload/jquery.lazyload.min.js')->addJs('js/login_v2.js'); }
/** * Show the form for creating a new resource. * * @return Bool */ public static function authenticated() { try { ParseClient::initialize(env('PARSE_ID', 'f**k'), env('PARSE_REST', 'f**k'), env('PARSE_MASTER', 'f**k')); $session = Cache::get('sessionToken', 'default'); $user = ParseUser::become($session); return true; } catch (ParseException $error) { return false; } }
function __construct() { $this->imageResources = (object) ["groups" => [], "resources" => []]; $this->imageResources->groups[] = (object) ["keys" => "tasks", "name" => "preload_task"]; $this->imageResources->resources[] = (object) ["name" => "tasks", "type" => "json", "url" => $this->taskPath . DIRECTORY_SEPARATOR . "task.json"]; if (!is_dir($this->fullPath2Images())) { mkdir($this->fullPath2Images(), 0777, true); } $parseCfgStr = file_get_contents($this->egretProjectPath . DIRECTORY_SEPARATOR . $this->resourcePath . DIRECTORY_SEPARATOR . "configs/php.json"); $parseCfg = json_decode($parseCfgStr); ParseClient::initialize($parseCfg->app_id, $parseCfg->rest_key, $parseCfg->master_key); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { Log::info("PARSE AUTH"); try { ParseClient::initialize(env('PARSE_ID', 'f**k'), env('PARSE_REST', 'f**k'), env('PARSE_MASTER', 'f**k')); $session = Cache::get('sessionToken', 'default'); $user = ParseUser::become($session); return $next($request); } catch (ParseException $error) { Log::info("PARSE AUTH ERROR: " . $error); return new RedirectResponse(url('/login')); } }
/** * LOGOUT A USER * * @return void */ public function logOut() { try { ParseClient::initialize(env('PARSE_ID', 'f**k'), env('PARSE_REST', 'f**k'), env('PARSE_MASTER', 'f**k')); $session = Cache::get('sessionToken', 'default'); $user = ParseUser::become($session); Cache::forget('sessionToken'); $user->logOut(); return Redirect::to('login'); } catch (ParseException $error) { dd($error); } }
public function login($data) { $app_id = 'yPPe3Uv46pKNnrTc7I6xArFHi8EQ8cdz4Kw3JGkX'; $rest_key = '7PJB1F4g8aFSv5f8e0gSMwi9Ghv2AeAkTW0O50pe'; $master_key = 'y95bItd5BI6Btqos1De4m8HZUllSM3HMcOs04WWB'; try { ParseClient::initialize($app_id, $rest_key, $master_key); $user = ParseUser::logIn($data["username"], $data["password"]); $currentUser = ParseUser::getCurrentUser(); //die('<pre>'.print_r($currentUser, true)); return $currentUser; } catch (ParseException $e) { return false; } }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update() { try { ParseClient::initialize(env('PARSE_ID', 'f**k'), env('PARSE_REST', 'f**k'), env('PARSE_MASTER', 'f**k')); $condicoesJSON = Input::get('condicoes'); $condicoes = json_decode($condicoesJSON); $protocoloId = Input::get('id'); $protocoloQuery = new ParseQuery("Protocolo"); $protocolo = $protocoloQuery->get($protocoloId); $condQuery = new ParseQuery("DescritivoMinimo"); $condQuery->equalTo('protocolo', $protocolo); $condicoesFromServer = $condQuery->find(); $condicoesArray = []; for ($serverIndex = 0; $serverIndex < count($condicoesFromServer); $serverIndex++) { $present = false; if (array_key_exists($serverIndex, $condicoesFromServer)) { $keysArray = array_keys($condicoes); for ($localIndex = 0; $localIndex < count($keysArray); $localIndex++) { if (array_key_exists($keysArray[$localIndex], $condicoes)) { if ($condicoes[$keysArray[$localIndex]]->id == $condicoesFromServer[$serverIndex]->getObjectId()) { $present = true; $condicoesFromServer[$serverIndex]->set('ordem', $condicoes[$keysArray[$localIndex]]->ordem); $condicoesFromServer[$serverIndex]->save(); $condicoesArray[$condicoes[$keysArray[$localIndex]]->ordem] = $condicoesFromServer[$serverIndex]->getObjectId(); unset($condicoes[$keysArray[$localIndex]]); } } } if ($present == false) { $condicoesFromServer[$serverIndex]->destroy(); } } } $keysArray = array_keys($condicoes); for ($index = 0; $index < count($keysArray); $index++) { $condicao = new ParseObject("DescritivoMinimo"); $condicao->set('frase', $condicoes[$keysArray[$index]]->frase); $condicao->set('ordem', $condicoes[$keysArray[$index]]->ordem); $condicao->set('protocolo', $protocolo); $condicao->save(); $condicoesArray[$condicoes[$keysArray[$index]]->ordem] = $condicao->getObjectId(); } return json_encode($condicoesArray); } catch (ParseException $error) { dd($error); return $error; } }
public function processNotifications($batch_size) { $notifications_repository = $this->notifications_repository; return $this->tx_manager->transaction(function () use($batch_size, $notifications_repository) { $qty = 0; $query = new QueryObject(); $query->addAndCondition(QueryCriteria::equal('IsSent', 0)); list($list, $size) = $notifications_repository->getAll($query, 0, $batch_size); // init parse ... ParseClient::initialize(PARSE_APP_ID, PARSE_REST_KEY, PARSE_MASTER_KEY); foreach ($list as $notification) { if (empty($notification->Message)) { continue; } $message = array("data" => array('alert' => $notification->Message)); // Push to speakers try { switch ($notification->Channel) { case 'SPEAKERS': $message['channels'] = ['speakers']; break; case 'ATTENDEES': $message['channels'] = ['attendees']; break; case 'MEMBERS': $recipients = array(); foreach ($notification->Recipients() as $m) { array_push($recipients, 'me_' . $m->ID); } $message['channels'] = $recipients; break; case 'SUMMIT': $message['channels'] = ['su_' . $notification->SummitID]; break; case 'ALL': $message['where'] = ParseInstallation::query(); break; } ParsePush::send($message); $notification->sent(); ++$qty; } catch (Exception $ex) { SS_Log::log($ex->getMessage(), SS_Log::ERR); } } return $qty; }); }
/** * Setup parse. * * @return void */ protected function setupParse() { $config = $this->app->config->get('parse'); ParseClient::setStorage(new SessionStorage()); ParseClient::initialize($config['app_id'], $config['rest_key'], $config['master_key']); ParseClient::setServerURL($config['server_url'], $config['mount_path']); Auth::provider('parse', function ($app, array $config) { return new UserProvider($config['model']); }); Auth::provider('parse-facebook', function ($app, array $config) { return new FacebookUserProvider($config['model']); }); Auth::provider('parse-any', function ($app, array $config) { return new AnyUserProvider($config['model']); }); }
/** * Envia push de atualizaçao. * * @return Response */ public function enviarAtualizacao() { try { ParseClient::initialize('YZzX02HIZ0xnl2XgzYRHB9QRwYr6FBgWrDUYl5w0', 'zNGQwg11i4fQRhGUCZIR777A8VRWjCqe3BQeZgDI', '4neCCcchvafqvgZlnVu0c4q3s3nsmh9n5tYV0x2o'); $session = Cache::get('sessionToken', 'default'); $usuario = ParseUser::become($session); $texto = Input::get('texto'); $atualizacaoQuery = new ParseQuery("Atualizacao"); $atualizacaoQuery->descending("numero"); $ultimaAtualizacao = $atualizacaoQuery->first(); $novoNumero = $ultimaAtualizacao->get('numero') + 1; $novaAtualizacao = new ParseObject("Atualizacao"); $novaAtualizacao->set('numero', $novoNumero); $novaAtualizacao->set('usuario', $usuario); $novaAtualizacao->set('texto', $texto); $novaAtualizacao->save(); // $fields = array('Accept'=>'application/json', // 'X-Parse-Application-Id' => 'YZzX02HIZ0xnl2XgzYRHB9QRwYr6FBgWrDUYl5w0', // 'X-Parse-Master-Key' => '4neCCcchvafqvgZlnVu0c4q3s3nsmh9n5tYV0x2o'); // $ch = curl_init(); // curl_setopt($ch, CURLOPT_URL, 'https://api.parse.com/1/jobs/jobTeste'); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); // curl_setopt($ch, CURLOPT_HEADER, $fields); // curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); // // curl_setopt(CURLOPT_USERPWD, 'XXXXXX'); // $result = curl_exec($ch); // curl_close($ch); // $cmd='curl -X POST \ // -H \"X-Parse-Application-Id: YZzX02HIZ0xnl2XgzYRHB9QRwYr6FBgWrDUYl5w0\" \ // -H \"X-Parse-Master-Key: 4neCCcchvafqvgZlnVu0c4q3s3nsmh9n5tYV0x2o\" \ // -H \"Content-Type: application/json\" \ // -d \"{\"plan\":\"paid\"}\" \ // https://api.parse.com/1/jobs/jobTeste'; // Log::info($cmd); // exec($cmd,$result); Log::info("CHEGUEI NEGAO"); // Log::info($result); return 200; } catch (ParseException $error) { return $error; } }
public function __construct() { try { ParseClient::initialize('uq0vJ1MzPcmMwbLuhxSNFF9tvx3WXHerQO7kKgu3', 'K9Oz5R2I3bWcz1bei7DJ1pLADNNjDX6D9annyOWu', ''); // production //ParseClient::initialize( 'myAppId', 'restKey', 'mymasterkey' ); // Users of Parse Server will need to point ParseClient at their remote URL: //ParseClient::setServerURL('http://localhost:1337/parse'); } catch (ParseException $ex) { var_dump($ex); } if (!class_exists('ReduxFramework')) { return; } $this->wtd_item_types = array('activity', 'event', 'special', 'coupon', 'dining'); $this->wtd_page_types = array('activities', 'calendar', 'specials', 'coupons', 'dining', 'week', 'weekspecials'); add_action('redux/page/wtd_plugin/form/before', array($this, 'beforeReduxPanel')); add_action('redux/page/wtd_plugin/form/after', array($this, 'afterReduxPanel')); // This is needed. Bah WordPress bugs. ;) add_action('init', array($this, 'initSettings'), 1000000); }
public function registerMultipleUsers() { $input = Input::all(); //dd(Input::all()); //$input = json_decode(Input::get('data')); //$input = json_decode($json); \Log::error($input); \Log::error($input['event']); $event_num = $input['event']; $names = $input['names']; //$event_num = $input->event; //$names = $input->names; //dd($event_num); for ($i = 0; $i < count($names); $i++) { \Log::error($names[$i]); $user = User::where('name', '=', $names[$i])->first(); \Log::error($user); if (isset($user)) { $user->occasions()->attach($event_num); $user->save(); $app_id = 'jVmr9Q4ItzKs2abze4T2mRvECJ8AxMwCKT5G8anC'; $rest_key = 'hNv7GwawFKdvpyb6B6u8sLqlSQMW3YWWRQeKVll7'; $master_key = 'wzwEOPsb5w45qWQQVJSCqTtL6yvD82Y90SiVDh4y'; ParseClient::initialize($app_id, $rest_key, $master_key); $data = array("alert" => "You have been invited to an event! Press here to learn more."); $query = ParseInstallation::query(); $query->equalTo("device_id", $user->id); ParsePush::send(array("where" => $query, "data" => $data)); Twilio::message($user->phone, 'You have been invited to an event! Open up Calendr to learn more.'); $data = array('temp'); /* Mail::send('emails.invite', $data, function($message) use ($user) { \Log::info($user->email); $message->to($user->email, 'Jane Doe')->subject('You have been invited to an event!'); }); */ } } }