public function delete_planet(array $params) { $planetID = array_val_required($params, 'planetID'); $planet = m('Planet', $planetID); $planet->delete(); v('json/success', 'Planet deleted'); }
public function delete_inhabitant(array $params) { $inhabitantID = array_val_required($params, 'inhabitantID'); $inhabitant = m('inhabitant', $inhabitantID); $inhabitant->delete(); v('json/success', 'Inhabitant deleted'); }
/** * get the wib client, lazy loading the client library if this is the first call * * @return void * @author Craig Ulliott */ public static function getClient() { if (!self::$wib) { // the wib client has its own database connection $database_configuration = getConfiguration('db', 'db1'); // lazy load the library to keep memory use low require 'whereivebeen.php'; // get the configuration $config = getConfiguration('wib'); // setup the object self::$wib = new WhereIveBeen(array_val_required($config, 'api_key'), array_val_required($config, 'api_secret'), $database_configuration, $use_oauth = true, array_val_required($config, 'server_addr'), array_val_required($config, 'authorize_uri')); } return self::$wib; }
<?php // get the main configuration from the core.ini file $config = getConfiguration('core'); // this is used to set up the URIs below and help catch dev vs production environments define('ROOT_DOMAIN', array_val_required($config, 'root_domain')); define('IMG_BASE_URL', array_val_required($config, 'img_base_url')); define('STATIC_BASE_URL', array_val_required($config, 'static_base_url')); define('MEMCACHED_PREFIX', array_val_required($config, 'memcached_prefix')); define('PAGINATION_HARD_LIMIT', array_val_required($config, 'pagination_hard_limit')); define('SESSION_DB', array_val_required($config, 'session_db')); // mvc default controller (essentially the default page) define('DEFAULT_CONTROLLER', array_val_required($config, 'default_controller')); define('DEFAULT_METHOD', array_val_required($config, 'default_method')); // constants define('MYSQL_DATETIME', 'Y-m-d H:i:s'); define('MYSQL_DATE', 'Y-m-d'); // if this is a *.dev.* host, we're in dev if (isset($_SERVER['HTTP_HOST']) && strstr($_SERVER['HTTP_HOST'], '.dev.')) { define('ENV', 'dev'); //get the dev name from a URI like : http://www.developers-name.dev.ROOT_DOMAIN if (preg_match('/\\.([a-z]*)\\.dev\\.' . ROOT_DOMAIN . '/', $_SERVER['HTTP_HOST'], $matches)) { define('DEV_NAME', $matches[1]); } else { die('could not determine environment dev_name'); } } else { define('ENV', 'production'); }