Пример #1
0
<?php

/// Copyright (c) 2004-2016, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('GET' => array('identify' => array('string', 'min' => 1), 'owner' => array('email')));
require ROOT . '/library/preprocessor.php';
requireStrictRoute();
requirePrivilege('group.creators');
if ($uid = User::getUserIdByEmail($_GET['owner'])) {
    $result = addBlog('', $uid, $_GET['identify']);
    if ($result === true) {
        if ($_GET['owner'] == User::getEmail(getUserId())) {
            /// Update current user's access list.
            $priv = array();
            array_push($priv, "group.administrators");
            Acl::setAcl($rec['blogid'], $priv, true);
        }
        Respond::PrintResult(array('error' => 0));
    } else {
        Respond::PrintResult(array('error' => -1, 'result' => $result));
    }
} else {
    Respond::PrintResult(array('error' => -2, 'result' => _t('등록되지 않은 소유자 E-mail 입니다.')));
}
Пример #2
0
 function addUser($email, $name, $comment, $senderName, $senderEmail)
 {
     requireModel('blog.user');
     requireModel('blog.blogSetting');
     global $database, $service, $blogURL, $hostURL, $user, $blog;
     $blogid = getBlogId();
     if (empty($email)) {
         return 1;
     }
     if (!preg_match('/^[^@]+@([-a-zA-Z0-9]+\\.)+[-a-zA-Z0-9]+$/', $email)) {
         return array(2, _t('이메일이 바르지 않습니다.'));
     }
     $isUserExists = User::getUserIdByEmail($email);
     if (empty($isUserExists)) {
         // If user is not exist
         User::add($email, $name);
     }
     $userid = User::getUserIdByEmail($email);
     $result = addBlog(getBlogId(), $userid, null);
     if ($result === true) {
         return sendInvitationMail(getBlogId(), $userid, User::getName($userid), $comment, $senderName, $senderEmail);
     }
     return $result;
 }
Пример #3
0
$results["meta"]["ok"] = true;
$results["meta"]["status"] = 200;
$results["meta"]["msg"] = 'ok';
$verb = $_SERVER['REQUEST_METHOD'];
//the verb used to run the script (e.g. GET, POST)
switch ($verb) {
    case "GET":
        //just gets the entire database
        $results = getAllBlogs("all");
        break;
    case "POST":
        //action is a variable (set by the function) sent along with any variables
        $action = $_REQUEST['action'];
        switch ($action) {
            case "ADD":
                addBlog($_REQUEST);
                $results = getAllBlogs("all");
                break;
            case "UPDATE":
                updateBlog($_REQUEST);
                $results = getAllBlogs("all");
                break;
            case "DELETE":
                deleteBlog($_REQUEST['code']);
                $results = getProductsDB("all");
                break;
            case "search":
                $results = getSearchDB($_REQUEST['search']);
                break;
            default:
                //if the specified action isn't recognised set meta details
Пример #4
0
<?php

require_once 'config.php';
$session->requireLoggedIn();
if (isset($_POST['title']) && isset($_POST['body']) && isset($_POST['catid'])) {
    $blogId = addBlog($_POST['catid'], $_POST['title'], $_POST['body']);
    if ($blogId) {
        header('Location: blog.php?Blog:' . $blogId);
        die;
    } else {
        die('error saving blog');
    }
}
require 'design_head.php';
echo 'Create a new blog:<br/><br/>';
echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">';
echo 'Title:<br/>';
echo '<input type="text" name="title" size="67" maxlength="40"/><br/>';
echo '<br/>';
echo 'Select blog category:<br/>';
echo xhtmlSelectCategory(CATEGORY_BLOG, 0, 'catid');
echo '<br/><br/>';
echo '<textarea name="body" cols="64" rows="24"></textarea><br/><br/>';
echo '<input type="submit" class="button" value="Save"/>';
echo '</form><br/>';
require 'design_foot.php';
Пример #5
0
<?php

/// Copyright (c) 2004-2015, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('POST' => array('email' => array('email'), 'name' => array('string', 'default' => ''), 'identify' => array('string'), 'comment' => array('string', 'default' => ''), 'senderName' => array('string', 'default' => ''), 'senderEmail' => array('email')));
require ROOT . '/library/preprocessor.php';
importlib('model.blog.user');
requireStrictRoute();
if ($service['type'] == 'single' || !Acl::check("group.creators")) {
    Respond::ResultPage(false);
}
$useradd = User::add($_POST['email'], $_POST['name']);
if ($useradd !== true && $useradd != 9) {
    Respond::ResultPage($useradd);
}
$blogadd = addBlog(null, User::getUserIdByEmail($_POST['email']), $_POST['identify']);
if ($blogadd !== true) {
    if ($useradd != 9) {
        // If user is created at this time, delete that user.
        User::removePermanent(User::getUserIdByEmail($_POST['email']));
    }
    Respond::ResultPage($blogadd);
}
if (User::getEmail() == $_POST['email']) {
    $result = array('error' => 0, 'message' => _t('이 계정에 새로운 블로그를 추가하였습니다.'));
    Respond::ResultPage($result);
} else {
    $result = sendInvitationMail(null, User::getUserIdByEmail($_POST['email']), $_POST['name'], $_POST['comment'], $_POST['senderName'], $_POST['senderEmail']);
    Respond::ResultPage($result);
}
Пример #6
0
<?php

session_start();
include "config.php";
/*
** Controls all User-specific functionalities
** E.g Create user, Delete user, Edit user, Search user, Logout user
*/
//get action var: action|''
$action = isset($_POST['action']) ? $_POST['action'] : "";
//controls what to show in the front page
switch ($action) {
    case 'addBlog':
        addBlog();
        break;
    case 'editBlog':
        editBlog();
        break;
    case 'alterBlog':
        alterBlog();
        break;
    case 'deleteBlog':
        deleteBlog();
        break;
    default:
        homepage();
}
function addBlog()
{
    $blog = new Blog();
    $blog->storeFormValues($_POST);
Пример #7
0
<?php

header("Content-Type: text/html; charset=utf-8");
require_once dirname(__FILE__) . '/session.php';
require_once dirname(__FILE__) . '/connect.php';
$text = $_POST["text"];
$title = $_POST["title"];
$image = $_FILES["image"];
addBlog($title, $text, $image);
printMenu();