Example #1
0
<?php

require 'includes/master.inc.php';
$Auth->requireAdmin('login.php');
if (isset($_POST['btnNewApp']) && strlen($_POST['name'])) {
    $a = new Application();
    $a->name = $_POST['name'];
    $a->insert();
    redirect('application.php?id=' . $a->id);
}
$apps = DBObject::glob('Application', 'SELECT * FROM applications ORDER BY name');
$orders = DBObject::glob('Order', 'SELECT * FROM orders ORDER BY dt DESC LIMIT 5');
$db = Database::getDatabase();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
 "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Shine</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
    <link rel="stylesheet" href="http://yui.yahooapis.com/2.7.0/build/reset-fonts-grids/reset-fonts-grids.css" type="text/css">
    <link rel="stylesheet" href="css/yuiapp.css" type="text/css">
	<link rel="stylesheet" href="js/jquery.fancybox.css" type="text/css" media="screen">
</head>
<body class="rounded">
    <div id="doc3" class="yui-t6">

        <div id="hd">
            <h1>Shine</h1>
            <div id="navigation">
                <ul id="primary-navigation">
Example #2
0
 public static function insertNewApp($owner, $title, $image, $description, $repository)
 {
     $now = date('Y-m-d H:i:s');
     // insert new application
     $row = array('title' => $title, 'api_key' => static::makeApiKey(), 'description' => $description, 'repository' => $repository, 'date_to_sort' => $now, 'created' => $now);
     $app = new Application($row);
     $app->insert();
     // upload icon to S3
     $icon_key = static::uploadIcon($image, $app->getId());
     $table = static::TABLE_NAME;
     mfwDBIBase::query("UPDATE {$table} SET icon_key = :icon_key WHERE id= :id", array(':id' => $app->getId(), ':icon_key' => $icon_key));
     // insert owner
     $row = array('app_id' => $app->getId(), 'owner_mail' => $owner->getMail());
     $owner = new ApplicationOwner($row);
     $owner->insert();
     return $app;
 }