function build($makefile, $css, $js, $dir) { $dev = @$_GET['dev']; if ($dev) { include __DIR__ . "/api.php"; $api = new FileApi("pass"); if ($api->pass() != 'ok') { $dev = false; } } return teacss($makefile, $css, $js, $dir, $dev); }
protected function deleteIfFails($bean, $args) { // if we already have the revision, we won't delete the document on failure to add another one if ($bean->document_revision_id) { return; } parent::deleteIfFails($bean, $args); }
<?php FileApi::extend('firepad_init', function ($self) { $cls = get_class($self); $secret = $cls::$firebase_secret; $url = $cls::$firebase_url; if (!$secret || !$url) { $ret = array('error' => 'Please define $firebase_secret and $firebase_url in your API class'); } else { require_once __DIR__ . "/lib/JWT.php"; require_once __DIR__ . "/lib/FirebaseToken.php"; $tokenGen = new Services_FirebaseTokenGenerator($secret); $token = $tokenGen->createToken(array("uid" => "1")); $ret = array('token' => $token, 'url' => $url); } echo json_encode($ret); });
<?php require_once __DIR__ . "/../../server/api.php"; FileApi::extend('git_commit', function ($self) { $path = $self->_pathFromUrl(@$_REQUEST['path']); if (!$path) { echo "ERROR: Invalid folder path"; die; } require_once __DIR__ . "/lib/controller.php"; new \GitWebCommit\Controller($path); });
private function setUserProfileFromUrl($url, $destination) { $user = Sentry::getUser(); $fileId = FileApi::uploadFromURL($url, $destination); // the old file needs to be deleted at this instance if not default DB::table('user_details')->where('user_id', $user->id)->update(array('user_profile_img' => $fileId)); $subscriber = new SentryuserEventHandler(); Event::subscribe($subscriber); Event::fire('sentryuser.profilechange', $user); return true; }