Example #1
0
 function post($slug)
 {
     $article = get_article_by_slug($slug);
     if (isset($_POST['name']) && isset($_POST['body']) && strlen(trim($_POST['name'])) > 0 && strlen(trim($_POST['body'])) > 0) {
         save_comment($article['id'], trim($_POST['name']), trim($_POST['body']));
     }
     header("Location: /article/{$slug}");
 }
Example #2
0
            $error_message = "Cache cleared";
        } else {
            $error_message = "Nicht authentifiziert. Fool.";
        }
    } elseif ($_POST[action] == "save") {
        $headtpl->SetVariable("titel", "Eintrag Speichern: {$entry['title']}");
        if ($_SESSION[password] == $PASSWORD) {
            save_article($_POST[entry_id]);
            kill_cache($_POST[entry_id]);
            $error_message = "Geänderter Artikel gespeichert";
        } else {
            $error_message = "Nicht authentifiziert. Fool.";
        }
    } elseif ($_POST[action] == "comment") {
        if ($_POST['id'] != "") {
            save_comment($_POST['id']);
            header("Location: index.php?action=entry&id={$_POST['id']}");
        } else {
            $error_message = "Fehlende Angaben!.";
        }
    } else {
        $error_message = "Wrong POST action";
    }
} else {
    if ($_GET[action] != "") {
        if ($_GET[action] == "list") {
            $headtpl->SetVariable("titel", "Liste");
            $tpl->loadTemplatefile("list.tpl.html", true, true);
            for ($s = ord('a'); $s <= ord('z'); $s++) {
                $c = chr($s);
                if ($entries = return_query("SELECT entry_id,title,date FROM enz_entries WHERE idx='{$c}' ORDER BY title")) {
Example #3
0
        die;
    }
} else {
    header('Location: http://' . get_server_name() . $globals['base_url']);
    die;
}
$link = new Link();
$link->id = $comment->link;
if (!$link->read()) {
    header('Location: http://' . get_server_name() . $globals['base_url']);
    die;
}
//$globals['link']=$link;
//$globals['link_id']=$link->id;
if ($_POST['process'] == 'editcomment') {
    save_comment();
} else {
    print_edit_form();
}
function print_edit_form()
{
    global $link, $comment, $current_user, $site_key, $globals;
    if ($current_user->user_level != 'god' && time() - $comment->date > $globals['comment_edit_time'] || $current_user->user_level == 'god' && time() - $comment->date > 10800) {
        // Allow the admin
        die;
    }
    $rows = min(40, max(substr_count($comment->content, "\n") * 2, 8));
    echo '<div id="commentform" align="left">' . "\n";
    echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post" id="thisform" style="display:inline;">' . "\n";
    echo '<fieldset><legend><span class="sign">' . _('editar comentario') . '</span></legend>' . "\n";
    echo '<div style="float: right;">';
Example #4
0
session_start();
require "../../../php_functions/connect.php";
require "../../../php_functions/function.php";
require "../../../php_functions/library.php";
require "../../../php_functions/source.php";
require "../../../php_functions/myclass.php";
$mc = new myclass();
$date_time = $mc->date_difference();
$comment = str_replace('\'', "\"", $_GET["comment"]);
// $plno=$_GET["plno"];
$dtime = $date_time['date_time'];
$mno = $_SESSION['mno'];
$plno = $_SESSION['plno'];
// echo "comment was $comment ";
save_comment($plno, $mno, $comment, $dtime);
function save_comment($plno, $mno, $comment, $dtime)
{
    if (strlen($comment) > 0) {
        insert('posted_looks_comments', array('plno', 'mno', 'date_', 'msg'), array($plno, $mno, $dtime, tcleaner($comment)), 'plcno');
        // echo "<span style='color:green'> succesfully post comment </span>";
    } else {
        // echo " <span  style='color:red' > failled to post comment </span>" ;
    }
}
$posted_comment = true;
require 'commentDesign.php';
// echo " <li> comment design <li> ";
?>
	
 
function handle_response()
{
    global $Conf, $Me, $prow, $crow;
    $rname = @trim($_REQUEST["response"]);
    $rnum = $Conf->resp_round_number($rname);
    if ($rnum === false && $rname) {
        return Conf::msg_error("No such response round “" . htmlspecialchars($rname) . "”.");
    }
    $rnum = (int) $rnum;
    if ($crow && @(int) $crow->commentRound !== $rnum) {
        $Conf->warnMsg("Attempt to change response round ignored.");
        $rnum = @+$crow->commentRound;
    }
    if (!($xcrow = $crow)) {
        $xcrow = (object) array("commentType" => COMMENTTYPE_RESPONSE, "commentRound" => $rnum);
    }
    if ($whyNot = $Me->perm_respond($prow, $xcrow, true)) {
        return Conf::msg_error(whyNotText($whyNot, "respond to reviews for"));
    }
    $text = @rtrim($_REQUEST["comment"]);
    if ($text === "" && !$crow) {
        return Conf::msg_error("Enter a response.");
    }
    save_comment($text, true, $rnum);
}
        if (empty($json->{'ShopRequesterId'}) || empty($json->{'ShopPartnerId'}) || empty($json->{'Name'}) || empty($json->{'Detail'})) {
            echo_invalid_param($json);
        }
        save_co_promotion($json);
        break;
    case OPCODE::SERVICE_SAVE_ACCEPT_COPROMOTION_REQUEST:
        if (empty($json->{'CoPromotionId'})) {
            echo_invalid_param($json);
        }
        save_accept_co_promotion($json);
        break;
    case OPCODE::SERVICE_SAVE_COMMENT_REQUEST:
        if (empty($json->{'ShopId'}) || empty($json->{'CommentText'})) {
            echo_invalid_param($json);
        }
        save_comment($json);
        break;
    case OPCODE::SERVICE_SAVE_PICTURE_REQUEST:
        if (empty($json->{'Name'}) || empty($json->{'ShopId'}) || empty($_FILES['file']['name'])) {
            echo_invalid_param($json);
        }
        save_picture($json);
        break;
}
function register_owner($json)
{
    $database = new Database();
    $userTbl = $database->getUserTbl();
    $ownerTbl = $database->getOwnerTbl();
    $exist = $userTbl->isExisted($json->{'Email'});
    if ($exist) {
Example #7
0
} elseif (!empty($_REQUEST['id']) && ($id = intval($_REQUEST['id'])) > 0) {
    $comment = Comment::from_db($id);
    if (!$comment) {
        die;
    }
    $link_id = $comment->link;
}
$link = Link::from_db($link_id);
if (!$link) {
    die;
}
if (!$current_user->authenticated || $current_user->user_karma < $globals['min_karma_for_comments'] || $current_user->user_date > $globals['now'] - $globals['min_time_for_comments'] && $current_user->user_id != $link->author) {
    die;
}
if ($_POST['process'] == 'editcomment') {
    save_comment($comment, $link);
} else {
    print_edit_form($comment, $link);
}
function print_edit_form($comment, $link)
{
    global $current_user, $site_key, $globals, $reply_to;
    $data = array();
    $html = '';
    if ($comment->id == 0) {
        $comment->randkey = rand(1000000, 100000000);
    }
    $html .= '<div class="commentform">';
    $html .= '<form action="' . $globals['base_url'] . "comment_ajax?reply_to={$reply_to}&amp;link={$link->id}&amp;id={$comment->id}&amp;user={$current_user->user_id}" . '" class="comment" method="post" enctype="multipart/form-data" id="c_edit_form">';
    $html .= '<input type="hidden" name="randkey" value="' . $comment->randkey . '" />';
    $html .= '<input type="hidden" name="process" value="editcomment" />';
// gatekeeper
$question_id = get_input('question_id');
$endpoint = 'http://api.stackoverflow.com/1.1/questions/' . $question_id . '?type=jsontext&body=true&answers=true&comments=true';
$response = json_decode(http_inflate(file_get_contents($endpoint)));
$questions = $response->questions[0];
$question_title = $questions->title;
$question_body = add_link_to_original($questions->body, $question_id);
$answers = $questions->answers;
$elgg_question = save_question($question_title, $question_body);
foreach ($answers as $answer) {
    $answer_body = $answer->body;
    $elgg_answer = save_answer($elgg_question, $answer_body);
    $comments = $answer->comments;
    foreach ($comments as $comment) {
        $comment = $comment->body;
        save_comment($elgg_answer, $comment);
    }
}
echo json_encode(array('success' => true));
die;
function add_link_to_original($body, $question_id)
{
    $url = 'http://www.stackoverflow.com/questions/' . $question_id;
    $message = "<div style='border:2px solid green;'>See the original question at <a href='{$url}'>Stackoverflow</a></div>";
    return "{$message}{$body}";
}
function save_answer($elgg_question, $answer_body)
{
    $answer = new ElggObject();
    $answer->subtype = "answer";
    $answer->description = $answer_body;
Example #9
0
	</tr>
		<tr>
		<td valign="top">Comments 
		</td>
		<td><textarea name="comments" cols="40" rows="5"><?php 
    echo htmlspecialchars($defaults['comments']);
    ?>
</textarea>
		</td>
	</tr>
	<tr>
		<td colspan="2" align="center"><input type="submit" value="Submit Comments" /></td>
	</tr>
	</table>
	</form>
<?php 
}
if ($_POST) {
    $errors = validate_form($_POST);
    if ($errors) {
        echo "<p>Sorry, we are unable to process your submission because:</p><ul><li>", implode('</li><li>', $errors), "</li></ul>", "<p>Please correct your form below and re-submit it</p>";
        display_form($_POST);
    } else {
        save_comment($_POST) or die("Sorry, our guestbook is out of order. Please try again later");
        display_comments() or die("Sorry, our guestbook is out of order. Please try again later");
        display_form($defaults);
    }
} else {
    display_comments() or die("Sorry, our guestbook is out of order. Please try again later");
    display_form($defaults);
}