Ejemplo n.º 1
0
function elggadmin_pagesetup()
{
    // first login?
    global $CFG;
    if (user_flag_get('admin', $_SESSION['userid']) && !isset($CFG->elggadmin_installed)) {
        $CFG->elggadmin_installed = true;
        set_config('elggadmin_installed', true);
        header_redirect(get_url(null, 'elggadmin::config'), __gettext('Welcome to the Elgg configuration manager!'));
    }
    if (context() == 'admin') {
        if (!plugin_is_loaded('pages')) {
            elgg_messages_add(__gettext('Error: <code>elggadmin</code> plugin needs <code>pages</code> plugin to run'));
        } else {
            pages_submenu_add('elggadmin', __gettext('Site administration'), get_url(null, 'elggadmin::'), 10);
        }
    } elseif (context() == 'elggadmin') {
        if (!plugin_is_loaded('pages')) {
            elgg_messages_add(__gettext('Error: <code>elggadmin</code> plugin needs <code>pages</code> plugin to run'));
            header_redirect(get_url(null, 'admin::'));
        }
        // submenu options
        pages_submenu_add('elggadmin', __gettext('Configuration manager'), get_url(null, 'elggadmin::'));
        pages_submenu_add('elggadmin:theme', __gettext('Default theme editor'), get_url(null, 'elggadmin::theme'));
        pages_submenu_add('elggadmin:frontpage', __gettext('Frontpage template editor'), get_url(null, 'elggadmin::frontpage'));
        pages_submenu_add('elggadmin:logs', __gettext('Error log'), get_url(null, 'elggadmin::logs'));
        sidebar_add(50, 'sidebar-' . elggadmin_currentpage(), elggadmin_sidebar());
        // clear sidebar
        $clear_sidebar[] = 'sidebar-profile';
        $clear_sidebar[] = 'sidebar-' . elggadmin_currentpage();
        sidebar_remove($clear_sidebar, true);
        if (elggadmin_is_404()) {
            header('HTTP/1.0 404 Not Found');
        }
    }
}
Ejemplo n.º 2
0
 private static function dispatch()
 {
     $route = Utils::get('appDispatch');
     if (!$route instanceof Container) {
         context()->is404();
         $route = container()->getRoute();
     }
     if (true !== container()->getIsDispatched()) {
         if (true !== $route->getCache()) {
             context()->dispatch($route);
         } else {
             $redis = context()->redis();
             $key = sha1(serialize($route->assoc())) . '::routeCache';
             $cached = $redis->get($key);
             if (!strlen($cached)) {
                 ob_start();
                 context()->dispatch($route);
                 $cached = ob_get_contents();
                 ob_end_clean();
                 $redis->set($key, $cached);
                 $ttl = Config::get('application.route.cache', 7200);
                 $redis->expire($key, $ttl);
             }
             echo $cached;
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Register options
  */
 public function register()
 {
     if ($this->registered) {
         return $this;
     }
     $hadStack = context()->exists(Stack::class);
     if (!$hadStack) {
         context()->bind(Stack::class, new Stack());
     }
     $this->registerAutoloaders($this->autoload());
     $this->registerClassMaps($this->classMaps());
     $this->registerApps($this->apps());
     $this->registerProviders($this->providers());
     $this->registerRoutes($this->routes());
     $this->registerListeners($this->listeners());
     $this->registerMiddlewares($this->middlewares());
     $this->registerAfterwares($this->afterwares());
     $this->registerPaths($this->paths());
     $this->registerViewObjects($this->viewObjects());
     $this->registerConsoles($this->consoles());
     $this->registerAssets($this->assets());
     if (method_exists($this, 'registered')) {
         Reflect::method($this, 'registered');
     }
     $this->registered = true;
     /**
      * Some actions needs to be executed in reverse direction, for example config initialization.
      */
     if (!$hadStack) {
         $stack = context()->get(Stack::class);
         $stack->execute();
     }
     return $this;
 }
Ejemplo n.º 4
0
 /**
  * @return Entity
  */
 public function createEntity()
 {
     $repository = $this->repository ? context()->get(Repository::class . '.' . $this->repository) : null;
     $entityClass = $this->framework_entity ? $this->framework_entity : Entity::class;
     $entity = new $entityClass($repository);
     $entity->setTable($this->table);
     return $entity;
 }
Ejemplo n.º 5
0
function douban_login()
{
    define('BASEURL', 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/');
    $options = array('oauth_as_header' => false);
    $tokenResultParams = OAuthRequester::requestRequestToken(DOUBAN_KEY, 0, array(), 'POST', $options);
    $_SESSION['oauth_token'] = $tokenResultParams['token'];
    context('redirect', DOUBAN_AUTHORIZE_URL . '?oauth_token=' . $tokenResultParams['token'] . '&oauth_callback=' . BASEURL . 'index.php?q=douban_oauth_callback');
}
Ejemplo n.º 6
0
 public function executeCron($cron, $unqueue = true)
 {
     $date = $cron->getDate();
     if ($date <= time()) {
         $_REQUEST = unserialize($cron->getData());
         context()->dispatch($cron);
         return true === $unqueue ? $this->unqueueCron($cron) : $this;
     }
 }
Ejemplo n.º 7
0
function elggadmin_page_before($c = null, $args = null)
{
    require_login('admin');
    if (!defined('context')) {
        context('elggadmin');
    }
    $page = isset($args[1]) ? $args[1] : 'config';
    elggadmin_currentpage($page);
}
Ejemplo n.º 8
0
 /**
  * @return Cache
  */
 public function getCache()
 {
     $key = 'pckg.database.repository.cache.' . sha1(Cache::getCachePathByRepository($this));
     $context = context();
     if (!$context->exists($key)) {
         $context->bind($key, $cache = new Cache($this));
     }
     return $context->get($key);
 }
Ejemplo n.º 9
0
 public function del($key)
 {
     if (is_string($key)) {
         $val = isAke($this->data, $key, '__null__');
         if ('__null__' != $val) {
             unset($this->data[$key]);
         }
     }
     return context('collection');
 }
Ejemplo n.º 10
0
 public function update($id = false)
 {
     $pk = $this->model->pk();
     $id = false === $id ? isAke($_POST, $pk, false) : $id;
     if (false !== $id && true === context()->isPost()) {
         $this->model->post()->save();
         return true;
     }
     return false;
 }
Ejemplo n.º 11
0
 public function __construct($name = '')
 {
     $this->tool =& get_clips_tool();
     context('app', $this);
     context('app_name', $name);
     context('smarty', $this->tool->create('Smarty'));
     set_error_handler("Clips\\web_error_handler");
     $this->name = $name;
     $this->router = $this->tool->load_class('Router', true);
     $this->router->route();
 }
Ejemplo n.º 12
0
 protected function executeInRepository()
 {
     $repositoryName = $this->migration->getRepository();
     foreach ($this->sqls as $sql) {
         $repository = context()->get($repositoryName);
         $prepare = $repository->getConnection()->prepare($sql);
         $execute = $prepare->execute();
         if (!$execute) {
             throw new Exception('Cannot execute query! ' . "\n" . $sql . "\n" . 'Error code ' . $prepare->errorCode() . "\n" . $prepare->errorInfo()[2]);
         }
     }
 }
Ejemplo n.º 13
0
 public static function init()
 {
     try {
         $loader = new \Phalcon\Loader();
         $loader->registerDirs([__DIR__ . DS . 'controllers' . DS, __DIR__ . DS . 'views' . DS, __DIR__ . DS . 'models' . DS, __DIR__ . DS . 'lib' . DS])->registerNamespaces(['Phalway' => __DIR__])->register();
         context()->set('phalwayLoader', $loader);
         $di = new \Phalcon\DI\FactoryDefault();
         return new \Phalcon\Mvc\Application($di);
     } catch (\Phalcon\Exception $e) {
         dd($e);
     }
 }
Ejemplo n.º 14
0
 public function execute(callable $next)
 {
     try {
         /**
          * First argument is always 'console'.
          * Second argument is app name or command.
          * If it's command, we leave things as they are.
          * Id it's app, we unset it.
          */
         $argv = $_SERVER['argv'];
         /**
          * Remove application name.
          */
         if (isset($argv[1]) && !strpos($argv[1], ':')) {
             unset($argv[1]);
         }
         /**
          * Remove platform name.
          */
         if (isset($argv[2]) && !strpos($argv[2], ':') && false === strpos($argv[2], '-')) {
             unset($argv[2]);
         }
         /**
          * Get Symfony Console Application, find available commands and run app.
          */
         $application = context()->get(SymfonyConsole::class);
         try {
             /**
              * Apply global middlewares.
              */
             if ($middlewares = $this->response->getMiddlewares()) {
                 chain($middlewares, 'execute');
             }
             $application->run(new ArgvInput(array_values($argv)));
             /**
              * Apply global afterwares/decorators.
              */
             if ($afterwares = $this->response->getAfterwares()) {
                 chain($afterwares, 'execute', [$this->response]);
             }
         } catch (Throwable $e) {
             die("EXCEPTION: " . exception($e));
         }
         /**
          * This is here just for better readability. =)
          */
         echo "\n";
     } catch (Throwable $e) {
     }
     return $next();
 }
Ejemplo n.º 15
0
 public function build($slug, $repository = null)
 {
     if ($repository) {
         $this->menus->setRepository(context()->get(Repository::class . ($repository ? '.' . $repository : '')));
     }
     $menu = $this->menus->withMenuItems(function (HasMany $relation) {
         $relation->joinTranslation();
         // $relation->joinPermissionTo('read');
     })->where('slug', $slug)->one();
     if (!$menu) {
         return '<!-- no menu ' . $slug . ' -->';
     }
     return view('Pckg\\Generic:menu\\' . $menu->template, ['menu' => $menu, 'menuItems' => $this->buildTree($menu->menuItems)]);
 }
Ejemplo n.º 16
0
 public function resolve($value)
 {
     $table = $this->router->resolved('table');
     $this->tables->setTable($table->table);
     $this->tables->setRecordClass(DatabaseRecord::class);
     if ($table->repository) {
         $this->tables->setRepository(context()->get(Repository::class . '.' . $table->repository));
     }
     $this->dynamic->joinTranslationsIfTranslatable($this->tables);
     $this->dynamic->joinPermissionsIfPermissionable($this->tables);
     return $this->tables->where('id', $value)->oneOrFail(function () {
         $this->response->unauthorized('Record not found');
     });
 }
Ejemplo n.º 17
0
 public function loginAction()
 {
     if (!is_null($this->user)) {
         $this->_url->redirect('home');
     }
     if (true === context()->isPost()) {
         $db = em('backend', 'user');
         $user = $db->where('pseudo = ' . request()->getPseudo())->where('password = '******'backend')->setUser($user);
             $this->_url->redirect('home');
         }
     }
     $this->view->title = 'Backend Login';
 }
Ejemplo n.º 18
0
 public function resolve($form)
 {
     if (is_subclass_of($form, Form::class)) {
         $this->form = Reflect::create($form);
         $this->request = context()->getOrCreate(Request::class);
         if (object_implements($form, ResolvesOnRequest::class)) {
             if ($this->request->isPost()) {
                 $this->response = context()->getOrCreate(Response::class);
                 $this->flash = context()->getOrCreate(Flash::class);
                 return $this->resolvePost();
             } elseif ($this->request->isGet()) {
                 return $this->resolveGet();
             }
         }
         return $this->form;
     }
 }
Ejemplo n.º 19
0
 /**
  * @param Repository $repository
  */
 public function __construct(Repository $repository = null)
 {
     $this->repository = $repository;
     if (!$repository) {
         if (!context()->exists($this->repositoryName)) {
             $connectionName = $this->repositoryName == Repository::class ? 'default' : str_replace(Repository::class . '.', '', $this->repositoryName);
             $config = config('database.' . $connectionName);
             $repository = (new InitDatabase(config(), context()))->initPdoDatabase($config, $connectionName);
             context()->bind($this->repositoryName, $repository);
         }
         $this->repository = context()->get($this->repositoryName);
         if (!$this->repository) {
             throw new Exception('Cannot prepare repository');
         }
     }
     $this->guessDefaults();
     $this->initExtensions();
 }
Ejemplo n.º 20
0
 public function init()
 {
     $this->view->config = context('config')->load('crudjson');
     $guestActions = array('login', 'logout', 'lost');
     $guestActions += arrayGet($this->view->config, 'guest.actions', array());
     $this->view->isAuth = false;
     $this->view->items = isAke($this->view->config, 'tables');
     $user = auth()->user();
     if (!$user) {
         if (!Arrays::in($this->action(), $guestActions)) {
             $this->forward('login');
         }
     } else {
         $this->view->isAuth = true;
         $this->view->user = $user;
         $this->isAdmin = auth()->is('admin');
         if ($this->action() == 'login' || $this->action() == 'lost') {
             $this->forward('home', 'static');
         }
     }
 }
Ejemplo n.º 21
0
 public function getCascadeOptions($value = null)
 {
     if (isset($this->cascade_model)) {
         $tool = get_clips_tool();
         $model = $tool->model($this->cascade_model);
         if ($model) {
             // We do have a cascade model
             $cascade_field = get_default($this, 'cascade_field', null);
             if ($cascade_field) {
                 if ($value) {
                     $cascade_data = $value;
                 } else {
                     $cascade_data = get_default(context('current_form_data'), $cascade_field);
                 }
                 $cascade_method = get_default($this, 'cascasde_method', 'list' . ucfirst($this->field));
                 return $model->{$cascade_method}($cascade_data);
             }
         }
     }
     return null;
 }
Ejemplo n.º 22
0
 /**
  * We
  */
 public function handle()
 {
     $this->app = $this->getApp();
     if (!$this->app) {
         throw new Exception('App name is required in migrator');
     }
     context()->bind(InstallMigrator::class, $this);
     $requestedMigrations = $this->getRequestedMigrations();
     $installedMigrations = (array) $this->getInstalledMigrations();
     $installed = 0;
     $updated = 0;
     foreach ($requestedMigrations as $requestedMigration) {
         /**
          * @T00D00
          * Implement beforeFirstUp(), beforeUp(), afterUp(), afterFirstUp(), isFirstUp()
          */
         try {
             $migration = new $requestedMigration();
             $migration->up();
             if (!in_array($requestedMigration, $installedMigrations)) {
                 $migration->afterFirstUp();
             }
             $this->output($migration->getRepository() . ' : ' . $requestedMigration);
             $this->output();
         } catch (Throwable $e) {
             dd(exception($e));
         }
         if (in_array($requestedMigration, $installedMigrations)) {
             $updated++;
         } else {
             $installedMigrations[] = $requestedMigration;
             $installed++;
         }
     }
     $this->output('Updated: ' . $updated);
     $this->output('Installed: ' . $installed);
     $this->output('Total: ' . count($installedMigrations));
     $this->putInstalledMigrations($installedMigrations);
 }
Ejemplo n.º 23
0
 private function getVarsPath()
 {
     $lessVars = context()->get(Asset::class);
     $variableFiles = $lessVars->getLessVariableFiles();
     if (!$variableFiles) {
         return null;
     }
     $filemtimes = [];
     foreach ($variableFiles as $file) {
         $filemtimes[] = filemtime($file);
     }
     $sourceHash = sha1(json_encode($variableFiles) . json_encode($filemtimes));
     $input = path('tmp') . $sourceHash . '.less.tmp';
     if (!is_file($input)) {
         $content = '';
         foreach ($variableFiles as $file) {
             $content .= file_get_contents($file);
         }
         file_put_contents($input, $content);
     }
     return $input;
 }
Ejemplo n.º 24
0
 public function importDatabase($filename)
 {
     $repository = context()->get(Repository::class);
     $prepare = $repository->prepareSQL('DROP DATABASE pckg_database');
     $repository->executePrepared($prepare);
     $prepare = $repository->prepareSQL('CREATE DATABASE pckg_database');
     $repository->executePrepared($prepare);
     $prepare = $repository->prepareSQL('USE pckg_database');
     $repository->executePrepared($prepare);
     $templine = '';
     $lines = file($filename);
     foreach ($lines as $line) {
         if (substr($line, 0, 2) == '/*' || substr($line, 0, 2) == '--' || $line == '') {
             continue;
         }
         $templine .= $line;
         if (substr(trim($line), -1, 1) == ';') {
             $prepare = $repository->prepareSQL($templine);
             $repository->executePrepared($prepare);
             $templine = '';
         }
     }
 }
Ejemplo n.º 25
0
 public function init()
 {
     //startMeasure('Src RouterProvider: ' . $this->config['src']);
     foreach ([path('app_src') . $this->config['src'] . path('ds'), path('root') . $this->config['src'] . path('ds')] as $dir) {
         if (is_dir($dir)) {
             context()->get(Config::class)->parseDir($dir);
         }
     }
     foreach ([path('app_src') . $this->config['src'] . path('ds') . 'Config/router.php', path('root') . $this->config['src'] . path('ds') . 'Config/router.php'] as $file) {
         if (!is_file($file)) {
             continue;
         }
         $phpProvider = new Php(['file' => $file, 'prefix' => isset($this->config['prefix']) ? $this->config['prefix'] : null]);
         $phpProvider->init();
         // then we have to find provider
         $class = $this->src . '\\Provider\\Config';
         if (class_exists($class)) {
             $provider = Reflect::create($class);
             $provider->register();
         }
     }
     //stopMeasure('Src RouterProvider: ' . $this->config['src']);
 }
Ejemplo n.º 26
0
 public function resolve($class)
 {
     if (isset(static::$bind[$class]) && context()->exists($class)) {
         return context()->get($class);
     }
     if (class_exists($class) && in_array($class, static::$singletones)) {
         $newInstance = Reflect::create($class);
         if (isset(static::$bind[$class])) {
             context()->bind($class, $newInstance);
             return $newInstance;
         }
     }
     foreach (context()->getData() as $object) {
         if (is_object($object)) {
             if (get_class($object) === $class || is_subclass_of($object, $class)) {
                 return $object;
             } else {
                 if (in_array($class, class_implements($object))) {
                     return $object;
                 }
             }
         }
     }
 }
Ejemplo n.º 27
0
            $matcher = new TypeMatcher('string');
            if (!$matcher->match('test')) {
                throw new \Exception('Does not return true');
            }
        });
        it('returns false if the value is not of the correct type', function () {
            $matcher = new TypeMatcher('integer');
            if ($matcher->match('test')) {
                throw new \Exception('Does not return false');
            }
        });
    });
    context('getFailureMessage', function () {
        it('lists the expected type and the type of the value', function () {
            $matcher = new TypeMatcher('integer');
            $matcher->match(false);
            $expected = 'Expected integer, got boolean';
            if ($expected !== $matcher->getFailureMessage()) {
                throw new \Exception('Did not return expected failure message');
            }
        });
        it('lists the expected and actual type with inversed logic', function () {
            $matcher = new TypeMatcher('integer');
            $matcher->match(0);
            $expected = 'Expected a type other than integer';
            if ($expected !== $matcher->getFailureMessage(true)) {
                throw new \Exception('Did not return expected failure message');
            }
        });
    });
});
Ejemplo n.º 28
0
 context("when configured to bail on failure", function () {
     it("should stop running on failure", function () {
         $suite = new Suite("suite", function () {
         });
         $passing = new Test("passing spec", function () {
         });
         $suite->addTest($passing);
         $childSuite = new Suite("child suite", function () {
         });
         $passingChild = new Test("passing child", function () {
         });
         $failingChild = new Test("failing child", function () {
             throw new Exception("booo");
         });
         $passing2Child = new Test("passing2 child", function () {
         });
         $childSuite->addTest($passingChild);
         $childSuite->addTest($failingChild);
         $childSuite->addTest($passing2Child);
         $suite->addTest($childSuite);
         $passing2 = new Test("passing2 spec", function () {
         });
         $suite->addTest($passing2);
         $configuration = new Configuration();
         $configuration->stopOnFailure();
         $suite->setEventEmitter($this->eventEmitter);
         $runner = new Runner($suite, $configuration, $this->eventEmitter);
         $result = new TestResult($this->eventEmitter);
         $runner->run($result);
         assert($result->getTestCount() === 3, "spec count should be 3");
     });
 });
Ejemplo n.º 29
0
Archivo: gma.php Proyecto: noikiy/inovi
 private function editStructure()
 {
     $dbs = $this->tableByName('gma_structure');
     $structure = $dbs->find(request()->getId());
     if (empty($structure)) {
         return $this->error('Wrong request.');
     }
     if (true === context()->isPost()) {
         $this->checkBool('is_index')->checkBool('can_be_null');
         $structure->hydrate()->save();
         Router::redirect(container()->getUrlsite() . 'gma.php?action=table&id=' . $structure->getTable());
     }
     $html = $this->headerTable($structure->getTable());
     $canBeNull = true === $structure->getCanBeNull() ? 'checked' : '';
     $isIndex = true === $structure->getIsIndex() ? 'checked' : '';
     $selectTypes = $this->selectTypes($structure);
     $html .= '<p class="first">Edit structure of &laquo; ' . $structure->field()->getName() . ' &raquo;</p>';
     $html .= '<p class="first">
         <form action="' . container()->getUrlsite() . 'gma.php?action=editStructure&amp;id=' . request()->getId() . '" method="post" id="editStructure">
         <table class="table">
         <tr>
             <th>Type</th>
             <th>Length</th>
             <th>Default</th>
             <th>Null</th>
             <th>Index</th>
             <th>Label</th>
         </tr>
         <tr>
             <td>' . $selectTypes . '</td>
             <td><input class="input-small" value="' . $structure->getLength() . '" name="length" id="length" /></td>
             <td><input class="input-small" value="' . $structure->getDefault() . '" name="default" id="default" /></td>
             <td><input name="can_be_null" value="true" id="can_be_null" type="checkbox" ' . $canBeNull . ' /></td>
             <td><input name="is_index" value="true" id="is_index" type="checkbox" ' . $isIndex . '/></td>
             <td><input class="input-small" value="' . $structure->getLabel() . '" name="label" id="label" /></td>
         </tr>
         </table>
         </p><p><button onclick="$(\'#editStructure\').submit();">OK</button></p>';
     return $html;
 }
Ejemplo n.º 30
0
function form_to_json($post){

  $context = context();
  $data = array_merge($context, $post);
  unset($data['create']);

  foreach($data as $k => $v){
    if((is_string($v) && strlen($v) < 1) || (is_array($v) && count($v) < 1)){
      unset($data[$k]);
    }
  }
  
  // Datetimes
  $data['as:published'] = $post['year']."-".$post['month']."-".$post['day']."T".$post['time'].$post['zone'];
  unset($data['year']); unset($data['month']); unset($data['day']); unset($data['time']); unset($data['zone']);
  $data['as:startTime'] = $post['startyear']."-".$post['startmonth']."-".$post['startday']."T".$post['starttime'].$post['startzone'];
  unset($data['startyear']); unset($data['startmonth']); unset($data['startday']); unset($data['starttime']); unset($data['startzone']);
  $data['as:endTime'] = $post['endyear']."-".$post['endmonth']."-".$post['endday']."T".$post['endtime'].$post['endzone'];
  unset($data['endyear']); unset($data['endmonth']); unset($data['endday']); unset($data['endtime']); unset($data['endzone']);

  // Types
  if(isset($data["as:origin"]) && isset($data["as:target"]) && isset($data["as:startTime"]) && isset($data["as:endTime"])){
    var_dump($data["as:origin"]);
    $data["@type"] = array("as:Travel");
  }elseif(isset($data["as:startTime"]) && isset($data["as:endTime"]) && isset($data["as:location"])){
    if(isset($data["as:inReplyTo"])){
      $data["@type"] = array("as:Accept");
    }else{
      $data["@type"] = array("as:Event");
    }
  }
  
  // URIs
  $uris = array("as:image", "as:target", "as:origin", "as:location");
  foreach($uris as $uri){
    unset($data[$uri]);
    if(isset($post[$uri]) && strlen($post[$uri]) > 0){
      $data[$uri] = array("@id" => $post[$uri]);
    }
  }
  $multiuris = array("as:inReplyTo");
  foreach($multiuris as $muri){
    if(isset($post[$muri])){
      unset($data[$muri]);
      if(is_array($post[$muri]) && count($post[$muri]) > 0) {
        $muris = $post[$muri];
      }elseif(is_string($post[$muri]) && strlen($post[$muri]) > 0){
        $muris = explode(",", $post[$muri]);
        $muris = array_map('trim', $muris);
      }
      foreach($muris as $u){
        $data[$muri][] = array("@id" => $u);
      }
    }
  }
  
  // Tags
  if(isset($post['moretags'])){
    if(!isset($post['as:tag'])) $post['as:tag'] = array();
    $values = explode(",", $post['moretags']);
		$values = array_map('trim', $values);
		$data['as:tag'] = array_merge($post['as:tag'], $values);
		unset($data['moretags']);
  }
  
  if(!in_array("rsvp", $data['as:tag'])){
    unset($data['blog:rsvp']);
  }
  
  $json = stripslashes(json_encode($data, JSON_PRETTY_PRINT));
  return $json;
}