示例#1
0
文件: article.php 项目: robkaper/kiki
         foreach ($_POST['connections'] as $id => $value) {
             if ($value != 'on') {
                 continue;
             }
             $connection = $user->getConnection($id);
             if ($connection) {
                 $rs = $connection->postArticle($article);
                 if (isset($rs->id)) {
                     $errors[] = "<p>" . $connection->serviceName() . " status geupdate: <a target=\"_blank\" href=\"" . $rs->url . "\">" . $rs->url . "</a></p>\n";
                 } else {
                     $errors[] = "<p>\nEr is een fout opgetreden bij het updaten van je " . $connection->serviceName() . " status:</p>\n<pre>" . print_r($rs->error, true) . "</pre>\n";
                 }
             }
         }
         // Update title of corresponding album
         $album = new Album($article->albumId());
         $album->setSystem(true);
         $album->setTitle($article->title());
         $album->save();
     }
 }
 if (isset($_POST['json'])) {
     $response = array();
     $response['formId'] = $_POST['formId'];
     $response['articleId'] = $article->id();
     if ($showAsPage) {
         $template = new Template('content/pages-single');
         $template->assign('page', $article->templateData());
     } else {
         $template = new Template('content/articles-single');
         $template->assign('article', $article->templateData());
示例#2
0
文件: index.php 项目: robkaper/kiki
<?php

use Kiki\Article;
use Kiki\Album;
$this->title = "Articles";
if (!$user->isAdmin()) {
    $this->template = 'pages/admin-required';
    return;
}
$this->template = 'pages/admin';
ob_start();
if (isset($_GET['id'])) {
    $id = isset($_GET['id']) ? $_GET['id'] : 0;
    $article = new Article($id);
    $album = new Album($article->albumId());
    // Create album for this article if it doesn't exist yet.
    if (!$album->id()) {
        $album->setSystem(true);
        $album->setTitle($article->title());
        $album->save();
        $article->setAlbumId($album->id());
        if ($article->id()) {
            $article->save();
        }
    }
    echo $article->form();
    if ($album->id()) {
        echo $album->form();
    }
} else {
    echo "<table>\n";
示例#3
0
 * @package Kiki
 * @author Rob Kaper <http://robkaper.nl/>
 * @copyright 2011 Rob Kaper <http://robkaper.nl/>
 * @license Released under the terms of the MIT license.
 */
use Kiki\Storage;
use Kiki\Album;
$tmpFile = $_FILES['attachment']['tmp_name'];
$name = $_FILES['attachment']['name'];
$size = $_FILES['attachment']['size'];
$target = $_POST['target'];
$id = $tmpFile ? Storage::save($name, file_get_contents($tmpFile)) : 0;
$html = null;
$albumId = isset($_POST['albumId']) ? $_POST['albumId'] : null;
if ($albumId && $id) {
    $album = new Album($albumId);
    $pictures = $album->addPictures(null, null, array($id));
    $html = $album->formItem($pictures[0]['id']);
}
// fileUploadHandler is defined in htdocs/scripts/default.js
?>
<script type="text/javascript">
window.parent.fileUploadHandler( '<?php 
echo $target;
?>
', '<?php 
echo $id;
?>
', '<?php 
echo Storage::url($id);
?>