Example #1
0
function add_comment($moderator_email)
{
    $caller = strtolower($_POST["url"]);
    //$_SERVER['HTTP_REFERER'];
    $filename = md5($caller);
    $abs_comment_file = realpath('.') . '/' . $filename . '.xml';
    $date_value = time();
    $comment_id = $date_value . '-' . rand(1, 100000000);
    $author_value = processText($_POST["name"]);
    $subject_value = trim(processText($_POST["subject"]));
    $msg_value = processText($_POST["message"]);
    $email = processText($_POST["email"]);
    $site = processText($_POST["site"]);
    $title = processText($_POST["title"]);
    $parent_id = processText($_POST["id"]);
    $dom_id = processText($_POST["domid"]);
    $moderate = processText($_POST["moderate"]);
    // 0 No moderate, 1: waiting for moderate 2: trash 3: spamn 4: approved
    $max_reply = intval(processText($_POST["max"]));
    $secured = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
    $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $secured;
    $ec_path = $protocol . '://' . $_SERVER['HTTP_HOST'] . processText($_POST["path"]);
    if (empty($parent_id)) {
        $parent_id = null;
    }
    $ip = $_SERVER["REMOTE_ADDR"];
    $ret = addComment($abs_comment_file, $caller, $title, $dom_id, $comment_id, $date_value, $author_value, $subject_value, $email, $site, $msg_value, $ip, $moderate, $parent_id, $max_reply);
    $msg_value = str_replace(array("\r", "\n"), "<br />", $msg_value);
    echo json_encode(array("id" => $comment_id, "comment" => '<li class="ec-comment" id="' . $comment_id . '">' . '   <div class="avatar"></div>' . '   <span class="user-name author">' . $author_value . '</span> <br/>' . '   <span class="comment-html">' . (empty($subject_value) ? '' : '      <strong>' . $subject_value . '</strong><br /><br />') . $msg_value . '   </span><br/>' . '   <span class="comment-time">' . ago(time() - $date_value * 1) . '</span><br/>' . ($ret ? '   <button name="reply" id="reply_' . $comment_id . '">Reply</button>' : "") . '</li>'));
    // send email to moderator
    if ($moderate == "1") {
        $body = 'A new comment is waiting for your approval:<br /><br />' . 'Author:' . $author_value . '(IP: ' . $ip . ')<br/>' . 'Email:' . $email . '<br/>' . 'URL:' . $site . '<br/>' . 'Subject:' . $subject_value . '<br/>' . 'Whois:<a href="http://whois.arin.net/rest/ip/' . $ip . '" target="_blank">http://whois.arin.net/rest/ip/' . $ip . '</a><br/>' . 'Comment:<br/>' . '<blockquote>' . $msg_value . '</blockquote><br/>' . 'To moderate this message, click <a href="' . $ec_path . 'ec-dashboard.html">' . $ec_path . 'ec-dashboard.html</a><br/>' . '<br/>' . 'Thanks for choosing EastComment<br/><br/>' . '<a href="http://www.jswidget.com/lab/easy-comment.html" target="_blank">http://www.jswidget.com/lab/easy-comment.html</a>';
        sendEmail($moderator_email, $body);
    }
}
 function GetServerURL()
 {
     $s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
     $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
     $port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
     return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port;
 }
Example #3
0
function selfURL()
{
    $s = empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != "on" ? '' : 's';
    $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
    $port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
    return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'];
}
Example #4
0
function baseURL()
{
    $s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
    $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
    $port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
    return implode("/", explode("/", $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'], -1));
}
Example #5
0
function selfURL()
{
    $s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
    $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
    $port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
    return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?'));
}
Example #6
0
function get_current_URL()
{
    $s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
    $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
    $port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
    return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'];
}
Example #7
0
function selfURL()
{
    $s = empty($_SERVER['HTTPS']) ? '' : $_SERVER['HTTPS'] == 'on' ? 's' : '';
    $protocol = strleft(strtolower($_SERVER['SERVER_PROTOCOL']), '/') . $s;
    $port = $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT'];
    return $protocol . '://' . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'];
}
Example #8
0
function selfURL()
{
    // get complete url for current page
    // http://www.weberdev.com/get_example-4291.html
    $s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
    $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
    $port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
    return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'];
}
Example #9
0
function selfURL()
{
    if (!isset($_SERVER['REQUEST_URI'])) {
        $serverrequri = $_SERVER['PHP_SELF'];
    } else {
        $serverrequri = $_SERVER['REQUEST_URI'];
    }
    $s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
    $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
    $port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
    $_SESSION['ref'] = $protocol . "://>/" . $_SERVER['SERVER_NAME'] . $port . $serverrequri;
}
function getCurrentPath()
{
    $path = "";
    $path .= strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/");
    $path .= (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? "s" : "") . "://";
    $path .= $_SERVER['SERVER_NAME'];
    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
        if ($_SERVER['SERVER_PORT'] != '443') {
            $path .= ":" . $_SERVER['SERVER_PORT'];
        }
    } else {
        if ($_SERVER['SERVER_PORT'] != '80') {
            $path .= ":" . $_SERVER['SERVER_PORT'];
        }
    }
    $path .= $_SERVER['REQUEST_URI'];
    return dirname($path) . "/";
}
Example #11
0
function hostURL()
{
    $s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
    $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
    $scriptname = isset($_SERVER['ORIG_SCRIPT_NAME']) ? $_SERVER['ORIG_SCRIPT_NAME'] : $_SERVER['SCRIPT_NAME'];
    $location = substr($scriptname, 0, strpos($scriptname, "/index.php"));
    $port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
    return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $location;
}
Example #12
0
function selfURL()
{
    global $_GET;
    $url = $_SERVER['PHP_SELF'];
    if ($_GET) {
        $url .= "?";
    }
    $x = 1;
    foreach ($_GET as $key => $value) {
        $url .= "{$key}={$value}";
        if ($x < count($_GET)) {
            $url .= "&";
        }
        $x++;
    }
    $s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
    $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
    $port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
    return $protocol . "://" . $_SERVER['HTTP_HOST'] . $port . $url;
}
Example #13
0
function current_url($skip_ajax = false, $no_get = false)
{
    $u = false;
    if ($skip_ajax == true) {
        $is_ajax = is_ajax();
        if ($is_ajax == true) {
            if ($_SERVER['HTTP_REFERER'] != false) {
                $u = $_SERVER['HTTP_REFERER'];
            }
        }
    }
    if ($u == false) {
        if (!isset($_SERVER['REQUEST_URI'])) {
            $serverrequri = $_SERVER['PHP_SELF'];
        } else {
            $serverrequri = $_SERVER['REQUEST_URI'];
        }
        $s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
        $protocol = 'http';
        $port = 80;
        if (isset($_SERVER["SERVER_PROTOCOL"])) {
            $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
        }
        if (isset($_SERVER["SERVER_PORT"])) {
            $port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
        }
        if (isset($_SERVER["HTTP_HOST"])) {
            $u = $protocol . "://" . $_SERVER['HTTP_HOST'] . $port . $serverrequri;
        } else {
            if (isset($_SERVER["SERVER_PORT"])) {
                $u = $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $serverrequri;
            }
        }
    }
    if ($no_get == true) {
        $u = strtok($u, '?');
    }
    return $u;
}
Example #14
0
}
require_once dirname(__FILE__) . '/common/rememberme.php';
if (!isset($_SESSION['userId']) || !is_numeric($_SESSION['userId'])) {
    addError("Access denied");
    redirect('./index.php');
}
if (!is_numeric($_REQUEST['diagramId'])) {
    print "Wrond Diagram";
    exit;
}
$delegate = new Delegate();
$loggedUser = $delegate->userGetById($_SESSION['userId']);
$diagram = $delegate->diagramGetById($_REQUEST['diagramId']);
$selfUrl = selfURL();
//find full URL to this script
$url = strleft($selfUrl, '/exportDiagram.php');
//find the URL of the application
$WEBADDRESS = $delegate->settingsGetByKeyNative('WEBADDRESS');
//$svgLink = $WEBADDRESS . '/editor/raster.php?type=svg&diagramId=' . $diagram->id;
$pngLink = $WEBADDRESS . '/editor/png.php?type=png&diagramId=' . $diagram->id;
//$jpgLink = $WEBADDRESS . '/editor/raster.php?type=jpg&diagramId=' . $diagram->id;
$dmoLink = $WEBADDRESS . '/editor/dmo.php?diagramId=' . $diagram->id;
$page = 'export';
$rawLicense = $delegate->settingsGetByKeyNative('LICENSE');
$l = new License();
if (trim($rawLicense) != '') {
    $l->load($rawLicense);
}
$currentHost = $_SERVER['HTTP_HOST'];
if (strpos($currentHost, ':')) {
    $currentHost = substr($currentHost, 0, strpos($currentHost, ':'));
Example #15
0
function getCurrentURL()
{
    $s = empty($_SERVER["HTTPS"]) ? "" : $_SERVER["HTTPS"] == "on" ? "s" : "";
    $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
    $port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
    return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . str_replace(basename(cleanurl($_SERVER['PHP_SELF'])), "", $_SERVER['REQUEST_URI']);
}
Example #16
0
 static function selfURL($encode = true)
 {
     if (!isset($_SERVER['REQUEST_URI'])) {
         $serverrequri = $_SERVER['PHP_SELF'];
     } else {
         $serverrequri = $_SERVER['REQUEST_URI'];
     }
     $s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
     $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
     $port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
     $url = $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $serverrequri;
     return $encode ? base64_encode($url) : $url;
 }
Example #17
0
function gotoStep($step, $args = null)
{
    if (is_array($args)) {
        foreach ($args as $k => $v) {
            $extra .= "&{$k}={$v}";
        }
    }
    $s = empty($_SERVER["HTTPS"]) ? "" : $_SERVER["HTTPS"] == "on" ? "s" : "";
    $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
    $port = $_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : '';
    $location = $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['SCRIPT_NAME'] . "?step={$step}{$extra}";
    header("Location: {$location}");
    exit;
}