Beispiel #1
0
 public function render($phpFile)
 {
     if (!Config::getVal('view', 'allow_php') && strpos($this->text, PHPFile::PHP_OPENTAG)) {
         throw new TemplateSyntaxException('Template "' . $this->origin . '" contains raw PHP code, which has been disallowed in the autoconfig file.');
     }
     $phpFile->addPageContent($this->text);
 }
Beispiel #2
0
 protected function get_smallicon_url()
 {
     $url = $this->stored['smallicon_url'];
     $url = str_replace('%/', '%', $url);
     $url = str_replace('%BASE_URL%', Config::getVal('urls', 'base_url') . '/', $url);
     return str_replace('%ICON_URL%', Config::getVal('urls', 'icon_url') . '/', $url);
 }
Beispiel #3
0
 protected function get_shot_url()
 {
     $url = $this->stored['shot_url'];
     $url = str_replace('%/', '%', $url);
     $url = str_replace('%BASE_URL%', Config::getVal('urls', 'base_url') . '/', $url);
     return str_replace('%SCREEN_URL%', Config::getVal('urls', 'screenshot_url') . '/', $url);
 }
 public function __construct()
 {
     $res = new Memcache();
     $host = Config::getVal('cache', 'memcache_host') ?: 'localhost';
     $port = Config::getVal('cache', 'memcache_port') ?: 11211;
     $res->addServer($host, $port);
     $this->memcache = $res;
 }
 public static function getEngine()
 {
     if (is_null(static::$engine)) {
         $engineName = Config::getVal('semaphore', 'engine', false) ?: 'No';
         $engineClass = "\\hydrogen\\semaphore\\engines\\{$engineName}Engine";
         static::$engine = new $engineClass();
     }
     return static::$engine;
 }
 public function profile()
 {
     $um = UserModel::getInstance();
     $nick = $um->getLoggedInNick();
     if (!$nick) {
         header("Location: " . Config::getVal("general", "app_url") . "/index.php/user/login");
     } else {
         View::load('user/profile', array("nick" => $nick));
     }
 }
Beispiel #7
0
 /**
  * Gets an instance (newly created or old) of a Loader.
  *
  * @param string $loaderType The type of loader (loader name, with a
  * 		capital first letter) of which to get an instance.  This argument
  * 		is optional; if false, the loader type specified in the
  * 		[view]=>loader config value will be used.  This value is normally
  * 		specified within hydrogen.autoload.php.
  * @return \hydrogen\view\Loader a Loader of the appropriate type.
  */
 public static function getLoader($loaderType = false)
 {
     if (!$loaderType) {
         $loaderType = Config::getVal("view", "loader") ?: "File";
     }
     if (!isset(static::$loaders[$loaderType])) {
         $class = __NAMESPACE__ . '\\loaders\\' . $loaderType . 'Loader';
         static::$loaders[$loaderType] = new $class();
     }
     return static::$loaders[$loaderType];
 }
 public function __construct()
 {
     $pool = Config::getVal("cache", "pool_name");
     $mc = new Memcached($pool);
     if ($pool === false || count($mc->getServerList()) === 0) {
         $host = Config::getVal('cache', 'memcache_host') ?: 'localhost';
         $port = Config::getVal('cache', 'memcache_port') ?: 11211;
         $mc->addServer($host, $port);
     }
     $this->memcached = $mc;
 }
 public function getLogsByTime($startTimeObj, $endTimeObj)
 {
     $query = new Query("SELECT");
     $query->where("channel_name = ?", Config::getVal("general", "channel"));
     $startTimeObj->makeTimestamp();
     $endTimeObj->makeTimestamp();
     $query->where("time > ?", $startTimeObj->timestamp);
     $query->where("time < ?", $endTimeObj->timestamp, "AND");
     $messagesArray = ChannelActionBean::select($query);
     return $messagesArray;
 }
Beispiel #10
0
    public static function applyTo($string, $args, &$escape, $phpfile)
    {
        if (count($args) > 3) {
            throw new TemplateSyntaxException('The "excerpt" filter supports only three arguments.');
        }
        $phpfile->addFunction('excerptFilter', array('$str', '$num', '$needle', '$append'), <<<'PHP'
			if ($str = trim($str)) {
				$cutpos = 0;
				if ($needle === false)
					$cutpos = $num;
				else {
					$steps = 0;
					$findpos = 0;
					while ($steps < $num && $findpos !== false) {
						$findpos = strpos($str, $needle, $findpos + 1);
						$steps++;
					}
					if ($findpos)
						$cutpos = $findpos;
				}
				if ($cutpos && strlen($str) > $cutpos)
					return substr($str, 0, $cutpos) . $append;
			}
			return $str;
PHP
);
        $num = isset($args[0]) ? $args[0]->getValue($phpfile) : 20;
        $mode = isset($args[1]) ? trim($args[1]->getValue($phpfile), "'") : 'w';
        $append = isset($args[2]) ? $args[2]->getValue($phpfile) : false;
        if ($append === false) {
            $append = Config::getVal('view', 'excerpt_append') ?: self::DEFAULT_APPEND_STRING;
            $append = "'" . str_replace("'", '\\\'', $append) . "'";
        }
        $needle = false;
        switch ($mode) {
            case 'l':
                $needle = '"\\n"';
                break;
            case 'c':
                $needle = 'false';
                break;
            case 'w':
            default:
                $needle = '" "';
        }
        // Manually handle the escaping here just in case excerptFilter needs
        // to append something that can't be escaped.
        if ($escape) {
            $string = "htmlentities({$string})";
            $escape = false;
        }
        return "excerptFilter({$string}, {$num}, {$needle}, {$append})";
    }
Beispiel #11
0
 protected function saveScreenshotLocally($jpg_url, $filename, &$is_horiz = false)
 {
     if (!($img = @imagecreatefromjpeg($jpg_url))) {
         return false;
     }
     if (!@imagejpeg($img, Config::getVal('paths', 'screenshot_path') . "/{$filename}", 95)) {
         return false;
     }
     $is_horiz = imagesx($img) > imagesy($img);
     @imagedestroy($img);
     return true;
 }
Beispiel #12
0
 public function __construct()
 {
     $logdir = Config::getVal('log', 'logdir');
     $prefix = Config::getVal('log', 'fileprefix', false) ?: 'log';
     $filename = $prefix . date('ymd') . '.log';
     // Get our path relative to the config file
     $logdir = Config::getAbsolutePath($logdir);
     // Add the trailing slash if necessary
     if ($logdir[strlen($logdir) - 1] != DIRECTORY_SEPARATOR) {
         $logdir .= DIRECTORY_SEPARATOR;
     }
     $this->logfile = $logdir . $filename;
 }
Beispiel #13
0
 public function render($phpFile)
 {
     $phpFile->addPageContent(PHPFile::PHP_OPENTAG);
     $printVar = Config::getVal('view', 'print_missing_var') ?: false;
     if ($printVar) {
         $phpFile->addPageContent('try {');
     }
     $phpFile->addPageContent('echo ' . $this->getVariablePHP($phpFile) . ';');
     if ($printVar) {
         $phpFile->addPageContent('} catch (\\hydrogen\\view\\exceptions\\NoSuchVariableException $e) { echo "{?", $e->variable, "?}"; }');
     }
     $phpFile->addPageContent(PHPFile::PHP_CLOSETAG);
 }
Beispiel #14
0
 /**
  * Creates a new ViewSandbox and calculates the necessary URLs.
  *
  * @param ContextStack|boolean context The context in which to load the
  * 		view.  If false or omitted, an empty context will be used.
  */
 public function __construct($context = false)
 {
     $this->context = $context ?: new ContextStack();
     $this->cleanAppURL = Config::getRequiredVal("general", "app_url");
     if ($this->cleanAppURL[strlen($this->cleanAppURL) - 1] == '/') {
         $this->cleanAppURL = substr($this->cleanAppURL, 0, -1);
     }
     $this->cleanViewURL = Config::getVal("view", "root_url");
     if ($this->cleanViewURL === null) {
         $this->cleanViewURL = $this->appURL(Config::getRequiredVal("view", "url_path"));
     }
     if ($this->cleanViewURL[strlen($this->cleanViewURL) - 1] == '/') {
         $this->cleanViewURL = substr($this->cleanViewURL, 0, -1);
     }
 }
 /**
  * Gets an instance of the specified cache engine.  If an instance has already been
  * created for the specified engine, it will be returned.  Otherwise, a new instance
  * will be made.
  *
  * @param string engine The name of the engine to instantiate or get.
  * @return CacheEngine An instance of the specified engine.
  */
 public static function getEngine($engine = false)
 {
     if (!isset(self::$engine)) {
         static::$engine = array();
     }
     if (!$engine) {
         $engine = Config::getVal('cache', 'engine');
     }
     if (!$engine) {
         $engine = 'No';
     }
     if (!isset(static::$engine[$engine])) {
         $engineClass = '\\hydrogen\\cache\\engines\\' . $engine . 'Engine';
         static::$engine[$engine] = new $engineClass();
     }
     return static::$engine[$engine];
 }
Beispiel #16
0
 /**
  * Construct a new RedisEngine.
  */
 public function __construct()
 {
     $pooling = Config::getVal("cache", "use_pooling");
     $server = Config::getRequiredVal("cache", "server");
     $port = Config::getVal("cache", "port") ?: 6379;
     $timeout = Config::getVal("cache", "timeout") ?: null;
     $password = Config::getVal("cache", "password");
     $this->engine = new Redis();
     if ($pooling) {
         $this->engine->pconnect($server, $port, $timeout);
     } else {
         $this->engine->connect($server, $port, $timeout);
     }
     if ($password) {
         $this->engine->auth($password);
     }
     $this->engine->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
 }
Beispiel #17
0
// Includes
require_once __DIR__ . '/../lib/appdb/appdb.inc.php';
use hydrogen\config\Config;
use appdb\models\ApplicationModel;
// Start us up
header("Content-type: text/xml; charset=utf-8");
// Constants
$PERPAGE = 15;
// Get the vars
$sort = isset($_GET['sort']) ? $_GET['sort'] : 'newvers';
$cat = isset($_GET['cat']) ? $_GET['cat'] : 0;
$page = isset($_GET['page']) ? $_GET['page'] : 1;
if (isset($_POST['filter'])) {
    $_GET['filter'] = $_POST['filter'];
}
$filter = isset($_GET['filter']) && !Config::getVal('general', 'disable_search') ? trim($_GET['filter']) : false;
if ($filter) {
    $sort = "relevance";
}
// Get the apps
$am = ApplicationModel::getInstance();
$apps = $am->getAppListCached($PERPAGE, $page, $sort, $cat, $filter);
$total = $am->getResultCountCached($cat, $filter);
$curshowing = $page * $PERPAGE;
$numNextPage = $total - $curshowing;
if ($numNextPage <= 0) {
    $numNextPage = false;
} else {
    if ($numNextPage > $PERPAGE) {
        $numNextPage = $PERPAGE;
    }
 /**
  * Gets the number of messages specified in $count
  * that are immediately before the given timestamp
  *
  * @param integer $timestamp unix epoch timestamp
  * @param integer $count number of messages to get
  * @return array array of ChannelActionBean objects latest
  * first
  */
 public function getMessagesBeforeTimestamp($timestamp, $count)
 {
     $query = new Query("SELECT");
     $query->where("channel_name = ?", Config::getVal("general", "channel"));
     $query->where("time < ?", $timestamp);
     $query->orderby("time", "DESC");
     $query->limit($count);
     $messages = ChannelActionBean::select($query);
     return $messages;
 }
Beispiel #19
0
$page += 0;
$filter = isset($_GET['filter']) && $_GET['filter'] != '*' && !Config::getVal('general', 'disable_search') ? strtolower(trim($_GET['filter'])) : '';
if (!$filter && $sort == "relevance") {
    $sort = "newvers";
}
$am = ApplicationModel::getInstance();
$apps = $am->getAppListCached($perpage, $page, $sort, $cat, $filter);
if (!$apps) {
    $jsonError = array('valid' => '0', 'error' => 'No applications matched your request.');
    die(json_encode($jsonError));
}
$total = $am->getResultCountCached($cat, $filter);
if ($sort != 'appname' && $sort != 'relevance') {
    $rsslink = Config::getVal('urls', 'base_url') . '/';
    if (Config::getVal('rewrite', 'rss_options', false) != '') {
        $rsslink .= Config::getVal('rewrite', 'rss_options');
        $rsslink = str_replace(array('%RESULTS%', '%SORT%', '%CAT%', '%FILTER%', '%TYPE%'), array('15', $sort, $cat, $filter == '' ? '*' : $filter, 'html'), $rsslink);
    } else {
        $rsslink .= "rss.php?results=15&sort={$sort}&cat={$cat}&filter={$filter}&type=html";
    }
} else {
    $rsslink = 0;
}
$jsonPage = array('valid' => 1, 'perpage' => $perpage, 'sort' => $sort, 'page' => $page, 'category' => $cat, 'filter' => $filter, 'rss' => $rsslink, 'totalapps' => $total, 'categories' => array(), 'apps' => array());
$acm = AppCategoryModel::getInstance();
$cats = $acm->getAllCached();
foreach ($cats as $bean) {
    $jsonPage['categories']["{$bean->id}"] = $bean->category_name;
}
foreach ($apps as $app) {
    $catbean = $app->getMapped('category');
Beispiel #20
0
<div id="page_domains" class="staticpage">
	<h1 id="pagetitle">Approved Domains</h1>
	<h2 class="pheading">Approved what?</h2>
	<p><?php 
echo Config::getVal('general', 'site_name');
?>
 has a level of quality to maintain, and we pride ourselves on how easy and useful this site is.  However, there are many file-sharing services out there whose quality and level of service are so abysmal that we can't even imagine forcing <?php 
echo Config::getVal('general', 'site_name');
?>
 users to download from there.  Unfortunately, some of our greedier users started posting links to these sites due to payment benefits they offered.  Their greed was making <?php 
echo Config::getVal('general', 'site_name');
?>
 worse for everyone!  So we've locked down the links you can submit to a set list of sites.</p>

	<h2 class="pheading">I know a good site that's not in this list!</h2>
	<p>Fantastic!  Contact the <?php 
echo Config::getVal('general', 'site_name');
?>
 author to have it added :)</p>

	<h2 class="pheading">Approved file-sharing sites</h2>
	<p>
		<ul>
			<?php 
foreach (Config::getVal('domains', 'allowed') as $aldm) {
    echo "<li><a href=\"http://{$aldm}\">{$aldm}</a></li>\n";
}
?>
		</ul>
	</p>
</div>
 /**
  * Creates a new instance of DatabaseEngine if the specified connection is new, or returns
  * the stored engine for a connection that an engine's already been instantiated for.  The
  * DatabaseEngine is connected as soon as it is created.
  * 
  * If no dbConfigName is specified, the database configuration from the
  * {@link \hydrogen\config\Config} object is used.  If there are multiple database configurations
  * in the Config object, the first one defined will be used here.
  *
  * If multiple database configurations have been specified in the Config object, the sub-key of
  * the appropriate configuration can be passed in for dbConfigName.  For example:
  * <pre>
  * [database]
  * host[primary] = localhost
  * port[primary] = 3306
  * socket[primary] = 
  * database[primary] = myDB
  * username[primary] = myDBUser
  * password[primary] = myDBPass
  * table_prefix[primary] = myApp_
  *
  * host[backup] = backup.mydomain.com
  * port[backup] = 3306
  * socket[backup] = 
  * database[backup] = backupDB
  * username[backup] = myDBUser
  * password[backup] = myDBPass
  * table_prefix[backup] = myApp_
  * </pre>
  * Using this configuration, this function could be called with either "primary" or "backup"
  * as the dbConfigName argument to get the appropriate DatabaseEngine.  If no dbConfigName
  * is specified, the "primary" sub-key will be used since it appears first in the file.
  *
  * @param string|boolean dbConfigName OPTIONAL: The sub-key of the engine configuration to
  * 		pull from the {@link \hydrogen\config\Config} object.  If false or unspecified, the
  * 		first (or only) database configuration is pulled from Config.
  * @throws hydrogen\database\exceptions\DatabaseConnectionException if a connection could not
  * 		be made.
  * @return DatabaseEngine The requested DatabaseEngine with a connection to the specified
  * 		database server.
  */
 public static function getEngine($dbConfigName = false)
 {
     if ($dbConfigName === false) {
         $engines = Config::getRequiredVal('database', 'engine');
         if (is_array($engines)) {
             $engines = array_keys($engines);
             $dbConfigName = $engines[0];
         }
     }
     try {
         $db = static::getCustomEngine(Config::getRequiredVal('database', 'engine', $dbConfigName), Config::getVal('database', 'host', $dbConfigName), Config::getVal('database', 'port', $dbConfigName), Config::getVal('database', 'socket', $dbConfigName), Config::getVal('database', 'database', $dbConfigName), Config::getVal('database', 'username', $dbConfigName), Config::getVal('database', 'password', $dbConfigName), Config::getVal('database', 'table_prefix', $dbConfigName));
     } catch (DatabaseConnectionException $e) {
         // Re-throw exception to remove DB credentials from the stack trace
         throw new DatabaseConnectionException($e->getMessage());
     }
     return $db;
 }
Beispiel #22
0
 * Index page for AwesomeIRCBotWeb
 * Includes all the library files and dispatches
 * the request to a controller
 *
 * Copyright (c) 2011, Jack Harley
 * All Rights Reserved
 */
session_start();
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
ini_set("display_errors", "On");
date_default_timezone_set('UTC');
require_once __DIR__ . "/lib/hydrogen/hydrogen.inc.php";
require_once __DIR__ . "/lib/awesomeircbotweb/awesomeircbotweb.inc.php";
use hydrogen\controller\Dispatcher;
use hydrogen\view\View;
use hydrogen\config\Config;
use hydrogen\errorhandler\ErrorHandler;
use awesomeircbotweb\models\UserModel;
use awesomeircbotweb\models\ChannelModel;
ErrorHandler::attachErrorPage();
View::setVar("channel", Config::getVal("general", "channel"));
View::setVar("ircAddress", Config::getVal("general", "irc_network_address"));
$um = UserModel::getInstance();
$nick = $um->getLoggedInNick();
if ($nick) {
    View::setVar("loggedInUser", $nick);
}
Dispatcher::addHomeMatchRule("\\awesomeircbotweb\\controllers\\HomeController", "index");
Dispatcher::addPathInfoAutoMapRule("\\awesomeircbotweb\\controllers", "Controller");
Dispatcher::addMatchAllRule("\\awesomeircbotweb\\controllers\\ErrorController", "notFound");
Dispatcher::dispatch();
Beispiel #23
0
		email VARCHAR(90) NOT NULL,
		date_banned DATETIME NOT NULL,
		PRIMARY KEY(id),
		INDEX email(email)
		)');
$db->exec('CREATE TABLE IF NOT EXISTS ' . Config::getVal('database', 'table_prefix') . 'baddies (
	    id BIGINT NOT NULL auto_increment,
	    ip VARCHAR(15) NOT NULL,
	    useragent VARCHAR(500) NOT NULL,
	    request VARCHAR(500) NOT NULL,
	    visited DATETIME NOT NULL,
		PRIMARY KEY(id),
	    INDEX ip(ip),
	    INDEX request(request)
	    )');
$db->exec('CREATE TABLE IF NOT EXISTS ' . Config::getVal('database', 'table_prefix') . 'apiprofiles (
		id BIGINT NOT NULL auto_increment,
		owner_id BIGINT NOT NULL,
		name VARCHAR(32) NOT NULL,
		priv_pem TEXT NOT NULL,
		created DATETIME NOT NULL,
		active TINYINT(1) NOT NULL DEFAULT 0,
		allowed_app_fields TEXT NOT NULL,
		perm_allow_rapidfire TINYINT(1) NOT NULL DEFAULT 0,
		perm_allow_multiple_ips TINYINT(1) NOT NULL DEFAULT 0,
		perm_app_getlist TINYINT(1) NOT NULL DEFAULT 0,
		perm_app_getdetails TINYINT(1) NOT NULL DEFAULT 0,
		perm_category_list TINYINT(1) NOT NULL DEFAULT 0,
		perm_user_checkauth TINYINT(1) NOT NULL DEFAULT 0,
		perm_link_get TINYINT(1) NOT NULL DEFAULT 0,
		perm_link_get_auth TINYINT(1) NOT NULL DEFAULT 0,
Beispiel #24
0
if (isset($_GET['id']) && preg_match("/\\d+/", $_GET['id'])) {
    try {
        $appinfo = new AppStoreScraper((int) $_GET['id']);
    } catch (InvalidITunesIDException $e) {
        returnInvalid();
    } catch (AppNotFoundException $e) {
        returnInvalid();
    } catch (TimeoutException $e) {
        returnInvalid();
    }
    $smallicon = $appinfo->getITunesID() . 'icon-57x57.png';
    $bigicon = $appinfo->getITunesID() . 'icon-100x100.png';
    $am = ApplicationModel::getInstance();
    $icons = $am->saveIconsLocally($appinfo->getIconUrlPNG(), $smallicon, $bigicon);
    $bigicon = $icons ? Config::getVal('urls', 'icon_url') . '/' . $appinfo->getITunesID() . 'icon-100x100.png' : 'false';
    $smallicon = $icons ? Config::getVal('urls', 'icon_url') . '/' . $appinfo->getITunesID() . 'icon-57x57.png' : 'false';
    $version = trim(preg_replace('/(?i)\\(iP\\w+ OS 3\\S+ Tested\\)/', '', $appinfo->getVersion()));
    $avm = AppVersionModel::getInstance();
    $allvers = $avm->getByITunesIDCached($appinfo->getITunesID());
    $verlist = array();
    $i = 0;
    foreach ($allvers as $ver) {
        $verlist["{$i}"] = $ver->version;
        $i++;
    }
    if (!in_array($version, $verlist)) {
        $verlist["{$i}"] = $version;
    }
    die(json_encode(array('valid' => 1, 'appname' => $appinfo->getName(), 'appcompany' => $appinfo->getCompany(), 'category' => $appinfo->getCategory(), 'appversion' => $version, 'bigicon' => $bigicon, 'smallicon' => $smallicon, 'allversions' => $verlist)));
} else {
    returnInvalid();
 public static function handleError($errno, $errstr, $errfile, $errline)
 {
     if (Config::getVal("errorhandler", "log_errors") == "1") {
         Log::error($errstr, $errfile, $errline);
     }
     ob_end_clean();
     $ad = static::$handlerStack[count(static::$handlerStack) - 1];
     static::sendHttpCodeHeader($ad->responseCode);
     switch ($ad->errorType) {
         case ActionDescriptor::ERRORTYPE_DEFAULT:
             die(static::constructErrorPage($ad->responseCode));
         case ActionDescriptor::ERRORTYPE_FILE:
             ob_start();
             $success = @(include $ad->errorData);
             $content = ob_get_contents();
             ob_end_clean();
             die($content);
         case ActionDescriptor::ERRORTYPE_STRING:
             die($ad->errorData);
         case ActionDescriptor::ERRORTYPE_REDIRECT:
             die(header("Location: " . $ad->errorData));
     }
 }
Beispiel #26
0
 /**
  * Retrieves the raw PHP code for any specified view, loading it through
  * the view loader and template engine specified in the Hydrogen
  * autoconfig file.
  *
  * @param string $viewName The name of the view for which the raw PHP should
  * 		be retreived.
  * @return string A string containing the raw PHP of the specified view.
  * @throws NoSuchViewException if the specified view cannot be found or
  * 		loaded.
  */
 protected static function getViewPHP($viewName)
 {
     $engine = Config::getVal("view", "engine") ?: static::DEFAULT_ENGINE;
     $engineClass = '\\hydrogen\\view\\engines\\' . $engine . '\\' . ucfirst($engine) . 'Engine';
     $loader = LoaderFactory::getLoader();
     return $engineClass::getPHP($viewName, $loader);
 }
Beispiel #27
0
	<h1 id="pagetitle">Upcoming Changes</h1>
	<h2 class="pheading">Top priority</h2>
	<ul>
		<li>Internationalization!  If you can help translate the text on <?php 
echo Config::getVal('general', 'site_name');
?>
, check <a href="http://hackulo.us">Hackulous</a> for updates on when we can use your skill!</li>
		<li>Implement a link reporting system, where users can inform <?php 
echo Config::getVal('general', 'site_name');
?>
 of links that are incorrect or no longer exist.</li>
		<li>Implement a link counter, which can judge the popularity of a submitted application by how many times its links were clicked on in total.  Once this is underway, results can be listed by popularity and the link-removal system can be automated.</li>
		<li>Give the links area for each application a complete overhaul.  Show which domain each link is to so you aren't forced to hover over each and look at the status bar.</li>
		<li>Implement the Link Certification System, allowing volunteers to mark links that they've certified to be working and correct.</li>
	</ul>
	<h2 class="pheading">Also in the works</h2>
	<ul>
		<li>The ability to edit your own links and manual submissions, change your password, retrieve your forgotten password, and all that other user account stuff.</li>
		<li>A reviews system.  Reviews in Apple's App Store are rarely relevant and can't be trusted, and so we're planning to have our own reviews process.  Posting reviews will require an account on <?php 
echo Config::getVal('general', 'site_name');
?>
.</li>
		<li>Back-button functionality.  Unfortunately this is still impossible to implement in all web browsers at once, but the browser's back button should function as though each page of apps or each viewed application were a separate page you could go back and forward to, rather than an AJAX call.  Note that this will not affect current AJAX functionality.</li>
		<li>A better design.  This site's design was thrown together very quickly to allow for speedy development of this web application.  It is very functional, but not very suave.  Note that this is not a high priority, as <?php 
echo Config::getVal('general', 'site_name');
?>
 believes the functionality and features provided by the other listed goals is more important.</li>
		<li>A "Watchlist" feature, where a single click will add an app to your watch list.  From there, you will be informed when it's updated.</li>
		<li>Add a manual submission form so that applications not currently available in the iTunes store can be added.</li>
		<li>Other unlisted surprises :)</li>
</div>
Beispiel #28
0
if (!class_exists('hydrogen\\config\\Config', false)) {
    die("Quit trying to hack my damn code.");
}
function returnBadRequest()
{
    die(json_encode(array('success' => 0, 'errormsg' => 'Bad request.')));
}
// Must be logged in
if (!UserSession::getUserBean()) {
    die(json_encode(array('success' => 0, 'errormsg' => 'You must be logged in to submit links.')));
}
// Can't be done via proxy
require_once __DIR__ . '/../lib/proxydetector/proxy_detector.php';
$pd = new proxy_detector();
if ($pd->detect()) {
    die(json_encode(array('success' => 0, 'errormsg' => 'Sorry, ' . Config::getVal('general', 'site_name') . ' does not accept submissions from proxy servers.')));
}
// Assert that we have the essential value
if (!isset($_POST['id']) || !preg_match("/\\d+/", $_POST['id'])) {
    returnBadRequest();
}
$itunes_id = $_POST['id'];
// Get cracker
$cracker = false;
if (isset($_POST['crackersel'])) {
    if ($_POST['crackersel'] == 'me') {
        $bean = UserSession::getUserBean();
        $cracker = $bean->username;
    } else {
        if ($_POST['crackersel'] == 'other' && isset($_POST['crackerother']) && trim($_POST['crackerother']) != '') {
            $cracker = trim($_POST['crackerother']);
 /**
  * Creates a new instance of DatabaseEngine if the specified connection is new, or returns
  * the stored engine for a connection that an engine's already been instantiated for.  The
  * DatabaseEngine is connected as soon as it is created.
  * 
  * If no dbConfigName is specified, the database configuration from the
  * {@link \hydrogen\config\Config} object is used.  If there are multiple database configurations
  * in the Config object, the first one defined will be used here.
  *
  * If multiple database configurations have been specified in the Config object, the sub-key of
  * the appropriate configuration can be passed in for dbConfigName.  For example:
  * <pre>
  * [database]
  * host[primary] = localhost
  * port[primary] = 3306
  * socket[primary] = 
  * database[primary] = myDB
  * username[primary] = myDBUser
  * password[primary] = myDBPass
  * table_prefix[primary] = myApp_
  *
  * host[backup] = backup.mydomain.com
  * port[backup] = 3306
  * socket[backup] = 
  * database[backup] = backupDB
  * username[backup] = myDBUser
  * password[backup] = myDBPass
  * table_prefix[backup] = myApp_
  * </pre>
  * Using this configuration, this function could be called with either "primary" or "backup"
  * as the dbConfigName argument to get the appropriate DatabaseEngine.  If no dbConfigName
  * is specified, the "primary" sub-key will be used since it appears first in the file.
  *
  * @param string|boolean dbConfigName OPTIONAL: The sub-key of the engine configuration to
  * 		pull from the {@link \hydrogen\config\Config} object.  If false or unspecified, the
  * 		first (or only) database configuration is pulled from Config.
  * @throws hydrogen\database\exceptions\DatabaseConnectionException if a connection could not
  * 		be made.
  * @return DatabaseEngine The requested DatabaseEngine with a connection to the specified
  * 		database server.
  */
 public static function getEngine($dbConfigName = false)
 {
     if ($dbConfigName === false) {
         $engines = Config::getRequiredVal('database', 'engine');
         if (is_array($engines)) {
             $engines = array_keys($engines);
             $dbConfigName = $engines[0];
         }
     }
     return static::getCustomEngine(Config::getRequiredVal('database', 'engine', $dbConfigName), Config::getVal('database', 'host', $dbConfigName), Config::getVal('database', 'port', $dbConfigName), Config::getVal('database', 'socket', $dbConfigName), Config::getVal('database', 'database', $dbConfigName), Config::getVal('database', 'username', $dbConfigName), Config::getVal('database', 'password', $dbConfigName), Config::getVal('database', 'table_prefix', $dbConfigName));
 }
 /**
  * Webchat
  */
 public function index()
 {
     View::load('chat', array("address" => Config::getVal('general', 'irc_network_address'), "channel" => Config::getVal('general', 'channel')));
 }