Ejemplo n.º 1
0
/**
 * Process CMS tags into HTML for comments.
 */
function cms_tag_comments($tag_attr, $tag_default)
{
    global $db, $row, $block, $Current_weblog, $Weblogs, $Paths;
    if (strlen($Weblogs[$Current_weblog]['comment_format']) > 1) {
        $format = $Weblogs[$Current_weblog]['comment_format'];
    } else {
        $format = "%anchor%<p>%comment%</p><p><small><b>%name%</b> %email% %url% - %date%</small></p>";
    }
    if (strlen($Weblogs[$Current_weblog]['comment_reply']) > 1) {
        $format_reply = $Weblogs[$Current_weblog]['comment_reply'];
    } else {
        $format_reply = "Reply on %name%";
    }
    if (strlen($Weblogs[$Current_weblog]['comment_forward']) > 1) {
        $format_forward = $Weblogs[$Current_weblog]['comment_forward'];
    } else {
        $format_forward = "Replied on by %name%";
    }
    if (strlen($Weblogs[$Current_weblog]['comment_backward']) > 1) {
        $format_backward = $Weblogs[$Current_weblog]['comment_backward'];
    } else {
        $format_backward = "This is a reply on %name%";
    }
    // If %editlink% is not present, insert it right after %date%..
    if (strpos($format, "%editlink%") == 0) {
        $format = str_replace("%date%", "%date% %editlink%", $format);
    }
    $content_code = get_attr_value('content_code', $tag_attr);
    $nocomments = get_attr_value('ifnocomments', $tag_attr);
    $comments = get_attr_value('ifcomments', $tag_attr);
    $order = get_attr_value('order', $tag_attr);
    $entrydate = $Weblogs[$Current_weblog]['fulldate_format'];
    if ($content_code == "") {
        $content_code = $row["code"];
    }
    $last_comment = "";
    if (isset($db->entry['comments']) && count($db->entry['comments']) > 0) {
        // first, make a list of comment-on-comments..
        $crosslink = array();
        foreach ($db->entry['comments'] as $count => $temp_row) {
            if (preg_match("/\\[(.*):([0-9]*)\\]/Ui", $temp_row['comment'], $matches)) {
                $crosslink[$count + 1] = $matches[2];
                // remove [name:1] from comment..
                $db->entry['comments'][$count]['comment'] = str_replace($matches[0], "", $db->entry['comments'][$count]['comment']);
            }
        }
        $last_count = count($db->entry['comments']) - 1;
        foreach ($db->entry['comments'] as $count => $temp_row) {
            /**
             * If we get here, this is a record we have to output in some form..
             */
            $temp_row['name'] = strip_tags($temp_row['name']);
            $temp_row['email'] = strip_tags($temp_row['email']);
            $temp_row['url'] = strip_tags($temp_row['url']);
            // Set the flag to display the 'awaiting moderation' text.
            if ($temp_row["moderate"] == 1) {
                $awaiting_moderation = true;
            }
            // Check if the comment is different than the last one, if the author's
            // IP isn't blocked, and if the comment isn't waiting for moderation.
            if ($temp_row["ip"] . $temp_row["comment"] != $last_comment && !ip_check_block($temp_row["ip"]) && ($temp_row["moderate"] != 1 || $temp_row['showpreview'] == 1)) {
                /**
                 * make email link..
                 */
                if (isemail($temp_row["email"]) && !$temp_row["discreet"]) {
                    $email_format = "(" . encodemail_link($temp_row["email"], lang('email'), $temp_row["name"]) . ")";
                    $emailtoname = encodemail_link($temp_row["email"], $temp_row["name"], $temp_row["name"]);
                } else {
                    $email_format = "";
                    $emailtoname = $temp_row["name"];
                }
                if (isemail($temp_row["email"])) {
                    $grav_email = $temp_row["email"];
                    $grav_default = $Weblogs[$Current_weblog]['comment_gravatardefault'];
                    $grav_html = stripslashes($Weblogs[$Current_weblog]['comment_gravatarhtml']);
                    $grav_size = $Weblogs[$Current_weblog]['comment_gravatarsize'];
                    if ($grav_default == "") {
                        $grav_default = "http://www.pivotlog.net/images/gravatar.gif";
                    }
                    if ($grav_html == "") {
                        $grav_html = '<img src="%img%" align="right" valign="top" hspace="2" vspace="2" />';
                    }
                    if ($grav_size == "") {
                        $grav_size = 48;
                    }
                    $grav_imgurl = "http://www.gravatar.com/avatar.php?gravatar_id=" . md5($grav_email) . "&amp;default=" . urlencode($grav_default) . "&amp;size=" . $grav_size;
                    $grav_url = str_replace("%img%", $grav_imgurl, $grav_html);
                } else {
                    $grav_url = "";
                }
                /**
                 * make url link..
                 */
                if (isurl($temp_row["url"])) {
                    if (strpos($temp_row["url"], "ttp://") < 1) {
                        $temp_row["url"] = "http://" . $temp_row["url"];
                    }
                    $target = $Weblogs[$Current_weblog]['target_blank'] == 1 ? " target='_blank'" : "";
                    $temp_row["url_title"] = str_replace('http://', '', $temp_row["url"]);
                    //perhaps redirect the link..
                    if (isset($Weblogs[$Current_weblog]['lastcomm_redirect']) && $Weblogs[$Current_weblog]['lastcomm_redirect'] == 1) {
                        $target .= " rel=\"nofollow\" ";
                    }
                    $url_format = sprintf("(<a href='%s' {$target} title='%s'>%s</a>)", $temp_row["url"], $temp_row["url_title"], lang('url'));
                    $urltoname = sprintf("<a href='%s' {$target} title='%s'>%s</a>", $temp_row["url"], $temp_row["url_title"], $temp_row['name']);
                } else {
                    $url_format = "";
                    $urltoname = $temp_row["name"];
                }
                /**
                 * Make 'edit' and 'delete' links..
                 */
                $editlink = get_editcommentlink($db->entry['code'], $count);
                /**
                 * make a 'registered user' span..
                 */
                if ($temp_row['registered'] == 1) {
                    $name = "<span class='registered'>[" . $temp_row["name"] . "]</span>";
                } else {
                    $name = $temp_row["name"];
                }
                /**
                 * make quote link..
                 */
                $quote = sprintf("<a href='#form' onclick='javascript:var pv=document.getElementsByName(\"piv_comment\");pv[0].value=\"[%s:%s] \"+pv[0].value;'>%s</a>", $temp_row["name"], $count + 1, $format_reply);
                // make backward link..
                if (isset($crosslink[$count + 1])) {
                    $to = $db->entry['comments'][$crosslink[$count + 1] - 1];
                    $backward_text = str_replace("%name%", $to['name'], $format_backward);
                    $backward_anchor = safe_string($to["name"], TRUE) . "-" . format_date($to["date"], "%ye%%month%%day%%hour24%%minute%");
                    $backward_link = sprintf("<a href='#%s'>%s</a>", $backward_anchor, $backward_text);
                } else {
                    $backward_link = "";
                }
                /**
                 * make forward link..
                 */
                $forward_link = "";
                foreach ($crosslink as $key => $val) {
                    if ($val - 1 == $count) {
                        $from = $db->entry['comments'][$key - 1];
                        $forward_text = str_replace("%name%", $from['name'], $format_forward);
                        $forward_anchor = safe_string($from["name"], TRUE) . "-" . format_date($from["date"], "%ye%%month%%day%%hour24%%minute%");
                        $forward_link .= sprintf("<a href='#%s'>%s</a> ", $forward_anchor, $forward_text);
                    }
                }
                /**
                 * make anchor
                 */
                $anchor = "<a id=\"" . safe_string($temp_row["name"], TRUE) . "-" . format_date($temp_row["date"], "%ye%%month%%day%%hour24%%minute%") . "\"></a>";
                /**
                 * substite all of the parameters into the comment, and add it to the output.
                 */
                $this_tag = $format;
                $this_tag = str_replace("%quote%", $quote, $this_tag);
                $this_tag = str_replace("%quoted-back%", $backward_link, $this_tag);
                $this_tag = str_replace("%quoted-forward%", $forward_link, $this_tag);
                $this_tag = str_replace("%count%", $count + 1, $this_tag);
                $this_tag = str_replace("%code%", $db->entry['code'], $this_tag);
                $this_tag = str_replace("%even-odd%", $count % 2 ? 'even' : 'odd', $this_tag);
                $this_tag = str_replace("%ip%", $temp_row["ip"], $this_tag);
                $this_tag = str_replace("%date%", format_date($temp_row["date"], $entrydate), $this_tag);
                $this_tag = str_replace("%comment%", comment_format($temp_row["comment"]), $this_tag);
                $this_tag = str_replace("%name%", $name, $this_tag);
                $this_tag = str_replace("%email%", $email_format, $this_tag);
                $this_tag = str_replace("%url%", $url_format, $this_tag);
                $this_tag = str_replace("%anchor%", $anchor, $this_tag);
                $this_tag = str_replace("%url-to-name%", $urltoname, $this_tag);
                $this_tag = str_replace("%email-to-name%", $emailtoname, $this_tag);
                $this_tag = str_replace("%gravatar%", $grav_url, $this_tag);
                $this_tag = str_replace("%editlink%", $editlink, $this_tag);
                if ($count == $last_count) {
                    $this_tag = '<a id="lastcomment"></a>' . $this_tag;
                }
                $last_comment = $temp_row["ip"] . $temp_row["comment"];
                // Outputting according to order:
                if ($order == 'ascending') {
                    $output .= $this_tag . "\n";
                } elseif ($order == 'descending') {
                    $output = $this_tag . "\n" . $output;
                }
            }
        }
    }
    // If there are comments waiting for moderation, append a note saying so.
    if ($awaiting_moderation) {
        $output .= sprintf("<p id='moderate_queue_waiting'>%s</p>", lang("comment", "moderate_waiting"));
    }
    return '<a id="comm"></a>' . "\n" . $output;
}
Ejemplo n.º 2
0
     $rssfeed = $row['rssfeed'];
     $maxnews = isid($row['maxnews'], 11) ? $row['maxnews'] : 10;
     $page_default = $row['defaultpage'];
     $pageurl = $row['pageurl'];
     $protectioncheck = $row['protectioncheck'];
     $maxnews_sidebar = $row['maxnews_sidebar'];
     $newssidebar_textlength = $row['newssidebar_textlength'];
     $spamFilter = $row['spamFilter'];
     $languageFilter = $row['languageFilter'];
     $blockLinks = $row['blockLinks'];
     $blockWords = $row['blockWords'];
     $mailRequired = $row['mailRequired'];
     $commentMinLength = $row['commentMinLength'];
     $commentsModerated = $row['commentsModerated'];
     $honeyPotKey = $row['honeyPotKey'];
     if (!isurl($pageurl) and !isdomain($pageurl)) {
         $pageurl = $page_url;
     }
 }
 $query = $sql->prepare("SELECT `active` FROM `modules` WHERE `type`='C' AND `get`='pn' AND `sub`='pn' LIMIT 1");
 $query->execute();
 $page_active = $query->fetchColumn();
 $page_active = active_check($page_active) ? $page_active : 'Y';
 $ewInstallPath = EASYWIDIR;
 $elements = (!empty($ewInstallPath) and strpos($ui->escaped('REQUEST_URI', 'server'), $ewInstallPath) === false) ? preg_split('/\\//', $ui->escaped('REQUEST_URI', 'server'), -1, PREG_SPLIT_NO_EMPTY) : preg_split('/\\//', substr($ui->escaped('REQUEST_URI', 'server'), strlen($ewInstallPath)), -1, PREG_SPLIT_NO_EMPTY);
 if (isset($seo) and $seo == 'Y' and isset($elements[0])) {
     $page_detect_language = $elements[0];
     if (!preg_match('/^[a-z]{2}+$/', $elements[0]) and !$ui->w('site', 50, 'get') and $elements[0] != 'index.php') {
         $throw404 = true;
     }
 }
Ejemplo n.º 3
0
         $code->seccodeconvert($_SESSION['seccode']);
         if (!$clientcode || strtolower($clientcode) != strtolower($_SESSION['seccode'])) {
             $_SESSION['seccode'] = random(6, 1);
             redirect('验证码错误,请返回重新输入.', $referer);
         }
     }
 }
 //取值
 $username = trim($_POST['username']);
 $password = $_POST['password'];
 $comfirpassword = $_POST['comfirpassword'];
 $email = trim($_POST['email']);
 $url = trim($_POST['url']);
 $referer = trim($_POST['referer']);
 //检测网址
 if (!isurl($url)) {
     redirect('网站URL错误');
 }
 //检测用户名
 if (!$username || getstrlen($username) > 20) {
     redirect('用户名为空或者超过20字节.', $reg_url);
 }
 if ($options['censoruser']) {
     $options['censoruser'] = str_replace(',', ',', $options['censoruser']);
     $banname = explode(',', $options['censoruser']);
     foreach ($banname as $value) {
         if (strpos($username, $value) !== false) {
             redirect('此用户名包含不可接受字符或被管理员屏蔽,请选择其它用户名.', $reg_url);
         }
     }
 }
Ejemplo n.º 4
0
     $what['mail_securitybreach'] = $data['mail_securitybreach'];
     $mail_securitybreach = $what['mail_securitybreach'];
 }
 if (isset($data['mail_serverdown']) and active_check($data['mail_serverdown'])) {
     $what['mail_serverdown'] = $data['mail_serverdown'];
     $mail_serverdown = $what['mail_serverdown'];
 }
 if (isset($data['mail_ticket']) and active_check($data['mail_ticket'])) {
     $what['mail_ticket'] = $data['mail_ticket'];
     $mail_ticket = $what['mail_ticket'];
 }
 if (isset($data['mail_vserver']) and active_check($data['mail_vserver'])) {
     $what['mail_vserver'] = $data['mail_vserver'];
     $mail_vserver = $what['mail_vserver'];
 }
 if (isset($data['fdlpath']) and isurl($data['fdlpath'])) {
     $what['fdlpath'] = $data['fdlpath'];
     $fdlpath = $what['fdlpath'];
 }
 if (isset($data['external_id']) and isExternalID($data['external_id']) != '') {
     $what['externalID'] = $data['external_id'];
 }
 $query = $sql->prepare("SELECT `groupID` FROM `userdata_groups` WHERE `userID`=? AND `resellerID`=?");
 $query->execute(array($localID, $resellerID));
 while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
     $foundGroupIDs[] = $row['groupID'];
 }
 $query = $sql->prepare("SELECT `id` FROM `usergroups` WHERE `active`='Y' AND `id`=? AND `resellerid`=? LIMIT 1");
 if (isset($data['groupID']) and isid($data['groupID'], 19)) {
     $query->execute(array($data['groupID'], $resellerID));
     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
Ejemplo n.º 5
0
if (!isset($admin_id) or $main != 1 or isset($admin_id) and !$pa['traffic']) {
    header('Location: admin.php');
    die('No Access');
}
$sprache = getlanguagefile('traffic', $user_language, $reseller_id);
if ($d == 'se' and $reseller_id == 0) {
    include EASYWIDIR . '/stuff/keyphrasefile.php';
    if ($ui->w('action', 4, 'post') and !token(true)) {
        $template_file = $spracheResponse->token;
    } else {
        if (isset($ui->post['type']) and $ui->w('action', 4, 'post') == 'md') {
            $error = 0;
            if (!isset($ui->post['type']) or !small_letters_check($ui->post['type'], '30')) {
                $error = 1;
            }
            if (!isset($ui->post['statip']) or !isip($ui->post['statip'], 'all') and !isurl($ui->post['statip'])) {
                $error = 1;
            }
            if (!isset($ui->post['dbname']) or !gamestring($ui->post['dbname'])) {
                $error = 1;
            }
            if (!isset($ui->post['dbuser']) or !gamestring($ui->post['dbuser'])) {
                $error = 1;
            }
            if (!isset($ui->post['dbpassword']) or !gamestring($ui->post['dbpassword'])) {
                $error = 1;
            }
            if (!isset($ui->post['table_name']) or !gamestring($ui->post['table_name'])) {
                $error = 1;
            }
            if (!isset($ui->post['column_sourceip']) or !gamestring($ui->post['column_sourceip'])) {
Ejemplo n.º 6
0
function add_comment_feeditem($item)
{
    global $db, $rss_items, $atom_items, $Cfg, $Weblogs, $Current_weblog, $Allow_RSS, $Paths;
    if (!siteurl_isset()) {
        $weblog = $Paths['host'] . $Paths['pivot_url'];
    } else {
        $weblog = $Weblogs[$Current_weblog]['siteurl'];
    }
    $entry = $db->read_entry($item['code']);
    $link = make_fileurl($item['uid'], "", "");
    $title = $db->entry['title'];
    $date = format_date($item['date'], "%year%-%month%-%day%T%hour24%:%minute%:00") . rss_offset();
    $description = htmlspecialchars(strip_tags($item['comment']));
    $description = str_replace("&nbsp;", " ", $description);
    $id = safe_string($item["name"], TRUE) . "-" . format_date($item["date"], "%ye%%month%%day%%hour24%%minute%");
    $tag = str_replace("_", "", strtolower(safe_string($Cfg['sitename'], TRUE))) . "," . date("Y") . ":" . $id;
    // make sure description is not too long..
    if (isset($Weblogs[$Current_weblog]['rss_full']) && $Weblogs[$Current_weblog]['rss_full'] == 0) {
        // don't put anything in the content.
        $content = "";
    } else {
        // put the introduction and body in the content..
        $content = str_replace("&nbsp;", " ", $introduction . $body);
    }
    if (isemail($item['email'])) {
        $email = "\n<email>" . $item['email'] . "</email>";
    } else {
        $email = "";
    }
    if (isurl($item['url'])) {
        if (strpos($item["url"], "ttp://") < 1) {
            $item["url"] = "http://" . $item["url"];
        }
        $url = "\n<uri>" . $item['url'] . "</uri>";
    } else {
        $url = "";
    }
    $atom_item = '
	<entry>
	    <title>%author% on %title%</title>
	    <link rel="alternate" type="text/html" href="%link%#%id%"/>
	    <updated>%date%</updated>
	    <published>%date%</published>
	    <id>tag:%tag%</id>
	    <summary type="text">%description%</summary>
	    <content type="html" xml:lang="%lang%" xml:base="%link%">
		<![CDATA[ 
			%content%
		]]>
	    </content>
	    <author>
		<name>%author%</name>%url%%email%
	    </author>
	</entry>
';
    $from = array("%title%", "%link%", "%id%", "%description%", "%content%", "%author%", "%guid%", "%date%", "%tag%", "%lang%", "%url%", "%email%");
    $to = array(htmlspecialchars(strip_tags($entry['title'])), $link, $id, RelativeToAbsoluteURLS($description), trim(comment_format($item['comment'])), htmlspecialchars(unentify($item['name'])), $item['uid'] . "@" . $weblog, $date, $tag, snippet_lang(), $url, $email);
    $atom_item = str_replace($from, $to, $atom_item);
    $atom_items[$date] = $atom_item;
}
Ejemplo n.º 7
0
 private function imageStringtoWinDeamon()
 {
     if (isurl($this->imageserver)) {
         return ftpStringToData($this->imageserver);
     }
     return false;
 }
Ejemplo n.º 8
0
     $error .= "Slots</br>";
 }
 if (!isid($lendtime, 4) or $lendtime > $maxtime or $lendtime < $mintime) {
     $fail = 1;
     $error .= "Time</br>";
 }
 if (!wpreg_check($rcon, 50)) {
     $error .= "Rcon</br>";
     $fail = 1;
 }
 if (!wpreg_check($password, 50)) {
     $error .= "Password</br>";
     $fail = 1;
 }
 if ($fail == 0) {
     if ($ftpupload == 'Y' and isurl($postedftpuploadpath) and $postedftpuploadpath != 'ftp://*****:*****@1.1.1.1/demos') {
         $split = preg_split('/\\//', $postedftpuploadpath, -1, PREG_SPLIT_NO_EMPTY);
         $split2 = preg_split('/@/', $split[1], -1, PREG_SPLIT_NO_EMPTY);
         if (isset($split2[1])) {
             $ftpipport = $split2[1];
             $userpass = explode(':', $split2[0]);
             $ftpuser = $userpass[0];
             $ftppass = isset($userpass[1]) ? $userpass[1] : '';
         } else {
             $ftpipport = $split2[0];
             $ftpuser = '******';
             $ftppass = '';
         }
         $ftpipport = preg_split('/:/', $ftpipport, -1, PREG_SPLIT_NO_EMPTY);
         if (checkFtpData($ftpipport[1], isset($ftpipport[1]) ? isset($ftpipport[1]) : 21, $ftpuser, $ftppass) === true) {
             $ftpuploadpath = $postedftpuploadpath;
Ejemplo n.º 9
0
/**
 * Display the screen to edit and delete comments.
 *
 * @param string $msg
 * @see submit_comment()
 */
function edit_comments($msg = "")
{
    global $Cfg, $Pivot_Vars, $Users;
    PageHeader(lang('userbar', 'comments'), 1);
    PageAnkeiler(lang('userbar', 'comments') . ' &raquo; ' . lang('userbar', 'comments_title'));
    $id = $Pivot_Vars['id'];
    $db = new db();
    // read entry if it's not in memory yet.
    $db->read_entry($id, true);
    printf("<p><strong>%s</strong>: %s<br />", lang('entries', 'title'), $db->entry['title']);
    printf("<strong>%s</strong>: %s<br />", lang('entries', 'author'), $db->entry['user']);
    printf("<strong>%s</strong>: %s</p><br />", lang('entries', 'date'), $db->entry['date']);
    if ($Pivot_Vars['user'] == $db->entry['user']) {
        // allowed to edit own comments
        MinLevel(2);
    } else {
        // allowed to edit comments on other people's entries
        MinLevel(3);
    }
    // print if there are no comments
    if (!$db->entry['comments'] || count($db->entry['comments']) < 1) {
        echo "<p><b>" . lang('notice', 'comment_none') . "</b><br /><br /></p>";
    } else {
        // perhaps delete a comment.
        if (isset($Pivot_Vars['del'])) {
            // Check if it's a link in the form of name@date..
            // If so, we'll have to walk the comments, selecting the correct one.
            if (strpos($Pivot_Vars['del'], "@") > 0) {
                list($delname, $deldate) = explode("@", $Pivot_Vars['del']);
                $Pivot_Vars['del'] = -1;
                foreach ($db->entry['comments'] as $key => $value) {
                    if ($value['name'] == $delname && $value['date'] == $deldate) {
                        $Pivot_Vars['del'] = $key;
                    }
                }
            }
            // Get the comment that we will delete..
            $del_comm = $db->entry['comments'][intval($Pivot_Vars['del'])];
            //remove the comment from last_comments if it's in there..
            if (file_exists("db/ser_lastcomm.php")) {
                $last_comms = load_serialize("db/ser_lastcomm.php", true, true);
            } else {
                $last_comms = array();
            }
            if ($last_comms !== false && count($last_comms) > 0) {
                foreach ($last_comms as $key => $last_comm) {
                    if ($last_comm['code'] == $db->entry['code'] && $last_comm['name'] == $del_comm['name'] && $last_comm['date'] == $del_comm['date']) {
                        unset($last_comms[$key]);
                        save_serialize("db/ser_lastcomm.php", $last_comms);
                        break;
                    }
                }
            }
            // *argh* evil hack to directly delete comments.. I should write a
            // proper wrapper
            unset($db->entry['comments'][$Pivot_Vars['del']]);
            unset($db->db_lowlevel->entry['comments'][$Pivot_Vars['del']]);
            $db->save_entry();
            // Rebuild the frontpage
            buildfrontpage_function();
            $msg = lang('notice', 'comment_deleted');
        }
        // perhaps add an ip-block for single ip.
        if (isset($Pivot_Vars['blocksingle'])) {
            $msg = "Added block for IP " . $Pivot_Vars['blocksingle'];
            add_block($Pivot_Vars['blocksingle']);
        }
        // perhaps add an ip-block for single ip.
        if (isset($Pivot_Vars['blockrange'])) {
            $iprange = make_mask($Pivot_Vars['blockrange']);
            $msg = "Added block for IP-range " . $iprange;
            add_block($iprange);
        }
        // perhaps remove an ip-block for single ip.
        if (isset($Pivot_Vars['unblocksingle'])) {
            $msg = "Removed block for IP " . $Pivot_Vars['unblocksingle'];
            rem_block($Pivot_Vars['unblocksingle']);
        }
        // perhaps remove an ip-block for single ip.
        if (isset($Pivot_Vars['unblockrange'])) {
            $iprange = make_mask($Pivot_Vars['unblockrange']);
            $msg = "Removed block for IP-range " . $iprange;
            rem_block($iprange);
        }
        // print a message, if there is one.
        if ($msg != "") {
            echo "<p><B>{$msg}</b><br /><br /></p>";
        }
        // show the edit form, to edit a comment..
        if (isset($Pivot_Vars['edit'])) {
            StartForm('submitcomment', 0);
            StartTable();
            $mycom = $db->entry['comments'][$Pivot_Vars['edit']];
            $settings = array();
            $settings[] = array('heading', lang('weblog_config', 'shortentry_template'), '', 8, '', 2, '');
            $settings[] = array('name', lang('weblog_text', 'name'), '', 0, unentify($mycom['name']), 30, '');
            $settings[] = array('orig_name', '', '', 7, unentify($mycom['name']), '', '');
            $settings[] = array('id', '', '', 7, $id, '', '');
            $settings[] = array('count', '', '', 7, $Pivot_Vars['edit'], '', '');
            $settings[] = array('email', lang('weblog_text', 'email'), '', 0, $mycom['email'], 60, '');
            $settings[] = array('url', lang('weblog_text', 'url'), '', 0, $mycom['url'], 60, '');
            $settings[] = array('moderate', lang('weblog_text', 'moderated'), '', 0, 1 - $mycom['moderate'], 10, '');
            $settings[] = array('registered', lang('weblog_text', 'registered'), '', 0, $mycom['registered'], 10, '');
            $settings[] = array('notify', lang('weblog_text', 'notify'), '', 0, $mycom['notify'], 10, '');
            $settings[] = array('ip', lang('weblog_text', 'ip'), '', 0, $mycom['ip'], 30, '');
            $settings[] = array('date', lang('weblog_text', 'date'), '', 0, $mycom['date'], 30, '');
            $settings[] = array('comment', lang('weblog_text', 'comment'), '', 5, $mycom['comment'], 60, 'rows=5');
            DisplaySettings($settings, 'blog_settings');
            EndForm(lang('weblog_config', 'save_comment'), 1);
        }
        // print out all the comments..
        foreach ($db->entry['comments'] as $key => $comment) {
            $myblock = block_type($comment['ip']);
            if ($myblock == "single" || $myblock == "range") {
                $strike = "style='text-decoration: line-through;'";
            } else {
                $strike = "";
            }
            // strip stuff from lamers' comments..
            $comment['name'] = strip_tags($comment['name']);
            $comment['email'] = strip_tags($comment['email']);
            $comment['url'] = strip_tags($comment['url']);
            if ($comment['registered'] == 1) {
                $comment['name'] = "<span style='background-color: #FF9;'>" . $comment['name'] . "</span>";
            }
            printf("<table border=0 cellpadding=2 cellspacing=2 width='95%%' style='border-bottom:" . " 2px solid #999;'><tr><td width='40%%' valign='top' id='a%s'>%s:&nbsp;<b %s>%s</b><br />", $comment['date'], lang('weblog_text', 'name'), $strike, stripslashes($comment['name']));
            if (strpos($comment['url'], "ttp://") < 1) {
                $comment['url'] = "http://" . $comment['url'];
            }
            if (isurl($comment['url'])) {
                $comment['url'] = sprintf("<a href='%s' target='_blank' %s>%s</a>", $comment['url'], $strike, trimtext($comment['url'], 40));
            }
            if (isemail($comment['email'])) {
                $comment['email'] = sprintf("<a href='mailto:%s' %s>%s</a>", $comment['email'], $strike, trimtext($comment['email'], 40));
            }
            if ($comment['notify'] == 1) {
                $comment['email'] = $comment['email'] . "(notify!)";
            }
            if ($comment['moderate'] == 1) {
                printf("<strong>%s</strong><br />", lang('weblog_text', 'waiting_moderation'));
            }
            printf("%s:&nbsp;%s<br />", lang('weblog_text', 'email'), $comment['email']);
            printf("%s:&nbsp;%s<br />", lang('weblog_text', 'url'), $comment['url']);
            printf("%s:&nbsp;%s<br />", lang('weblog_text', 'ip'), $comment['ip']);
            printf("%s:&nbsp;%s<br />", lang('weblog_text', 'date'), $comment['date']);
            printf("<td valign='top'><span %s>%s</span></td>", $strike, nl2br(htmlspecialchars($comment['comment'])));
            // only show the option to edit and delete links if the user is an advanced user.
            if ($Users[$Pivot_Vars['user']]['userlevel'] >= 2) {
                $link = sprintf("index.php?session=%s&amp;menu=entries&amp;func=editcomments&amp;", $Pivot_Vars['session']);
                $editlink = sprintf("%sid=%s&amp;edit=%s", $link, $db->entry['code'], $key);
                $dellink = sprintf("%sid=%s&amp;del=%s", $link, $db->entry['code'], $key);
                $reportpopup = sprintf("openReportComment('%s', '%s','%s','%s');", $Pivot_Vars['session'], $db->entry['code'], $key, $dellink);
                printf("</tr><tr class='tabular_line_odd'><td><a href='%s'>%s</a> /", $editlink, lang('entries', 'edit_comment'));
                printf(" <a href='%s'>%s</a> / ", $dellink, lang('entries', 'delete_comment'));
                // only ping.
                // printf(" <a href='#' onclick=\"%s\">%s</a>&nbsp;&nbsp;", $reportpopup, lang('entries', 'report_comment') );
                // ping and delete
                printf(" <a href='#' onclick=\"%s\">%s</a>&nbsp;&nbsp;", $reportpopup, lang('entries', 'report_comment'));
                echo "</td>";
            } else {
                printf("<td>&nbsp;</td>");
            }
            // only show the option to add or remove ip-blocks if the user is an administrator.
            if ($Users[$Pivot_Vars['user']]['userlevel'] >= 3) {
                if ($myblock == "none") {
                    $blocktext1 = str_replace("%s", $comment['ip'], lang('entries', 'block_single'));
                    $blocklink1 = sprintf("%sid=%s&blocksingle=%s", $link, $db->entry['code'], $comment['ip']);
                    $blocktext2 = str_replace("%s", make_mask($comment['ip']), lang('entries', 'block_range'));
                    $blocklink2 = sprintf("%sid=%s&blockrange=%s", $link, $db->entry['code'], $comment['ip']);
                    printf("<td><a href='%s'>%s</a> / ", $blocklink1, $blocktext1);
                    printf("<a href='%s'>%s</a></td>", $blocklink2, $blocktext2);
                } else {
                    if ($myblock == "single") {
                        $blocktext1 = str_replace("%s", $comment['ip'], lang('entries', 'unblock_single'));
                        $blocklink1 = sprintf("%sid=%s&unblocksingle=%s", $link, $db->entry['code'], $comment['ip']);
                        printf("<td><a href='%s'>%s</a></td>", $blocklink1, $blocktext1);
                    } else {
                        $blocktext1 = str_replace("%s", make_mask($comment['ip']), lang('entries', 'unblock_range'));
                        $blocklink1 = sprintf("%sid=%s&unblockrange=%s", $link, $db->entry['code'], $comment['ip']);
                        printf("<td><a href='%s'>%s</a></td>", $blocklink1, $blocktext1);
                    }
                }
            } else {
                printf("<td>&nbsp;</td>");
            }
            printf("</td></tr></table><br />");
        }
        // end of printing comments
    }
    // Table for editing the entry / trackbacks (this will be replaced after 1.30,
    // When we put the form-builder in place.
    echo '<table  width="95%"  border="0" cellpadding="5" cellspacing="0">';
    $link = sprintf("index.php?session=%s&amp;menu=entries&amp;func=modify&amp;id=%s", $Pivot_Vars['session'], $db->entry['code']);
    printf('<!-- edit entry --><tr><td width="32" valign="top">');
    print_icon('overview', 'new_entry', "<a href=\"" . $link . "\">");
    printf('</td><td><h3><a href="%s">%s</a></h3><p class="dim">%s</p></td></tr>', $link, lang('entries', 'edit_entry'), lang('entries', 'edit_entry_desc'));
    $link = sprintf("index.php?session=%s&amp;menu=entries&amp;func=edittrackbacks&amp;id=%s", $Pivot_Vars['session'], $db->entry['code']);
    printf('<!-- edit trackbacks --><tr><td width="32" valign="top">');
    print_icon('entry', 'edit_comments', "<a href=\"" . $link . "\">");
    printf('</td><td><h3><a href="%s">%s</a></h3><p class="dim">%s</p></td></tr>', $link, lang('entries', 'edit_trackback'), lang('entries', 'edit_trackback_desc'));
    $link = sprintf("index.php?session=%s&amp;menu=entries&amp;doaction=1&amp;action=delete&amp;check[%s]=1", $Pivot_Vars['session'], $db->entry['code']);
    printf('<!-- delete entry --><tr><td width="32" valign="top">');
    print_icon('entry', 'del_entry', "<a href=\"" . $link . "\">");
    printf('</td><td><h3><a href="%s">%s</a></h3><p class="dim">%s</p></td></tr>', $link, lang('entries', 'delete_entry'), lang('entries', 'delete_entry_desc'));
    echo "</table>";
    // End of table for editing the entry / trackbacks
    PageFooter();
    echo "<br /><br /><br /><br /><br /><br /><br /><br />";
}
Ejemplo n.º 10
0
 private function linuxCollectData($row, $force, $returnSuccessInAnyCase)
 {
     $absoluteGamePath = $this->masterserverDir . $row['shorten'];
     $updateLog = '/home/' . $this->sshuser . '/logs/update-' . $row['shorten'] . '.log';
     // Ensure we are in the home folder
     $this->shellScript .= 'cd /home/' . $this->sshuser . "\n";
     if ($row['supdates'] != 3 and $row['updates'] != 3) {
         // Create masterserver folder if it does not exists
         $this->shellScript .= 'if [ ! -d "' . $absoluteGamePath . '" ]; then mkdir -p "' . $absoluteGamePath . '"; fi' . "\n";
         // If template and app master configs allow sync
         if (in_array($row['supdates'], array(1, 4)) and in_array($row['updates'], array(1, 4))) {
             $this->serverSync($row['shorten'], $updateLog);
         }
         // If template and app master configs allow vendor update
         if (in_array($row['supdates'], array(1, 2)) and in_array($row['updates'], array(1, 2))) {
             //Steam updater
             if ($row['steamgame'] == 'S') {
                 $this->shellScript .= 'cd /home/' . $this->sshuser . '/masterserver/steamCMD/' . "\n";
                 $this->shellScript .= 'taskset -c 0 ${IONICE}nice -n +19 ./steamcmd.sh +login ';
                 if (strlen($this->steamAccount) > 0) {
                     $this->shellScript .= $this->steamAccount . ' ' . $this->steamPassword;
                 } else {
                     if (strlen($row['steamAcc']) > 0) {
                         $this->shellScript .= $row['steamAcc'] . ' ' . $row['steamPwd'];
                     } else {
                         $this->shellScript .= 'anonymous';
                     }
                 }
                 $this->shellScript .= ' +force_install_dir ' . $absoluteGamePath . ' ';
                 $fixedId = workAroundForValveChaos($row['appID'], $row['shorten'], false);
                 $this->shellScript .= $fixedId == 90 ? '+app_set_config 90 mod ' . $row['shorten'] . ' +app_update 90' : '+app_update ' . $fixedId;
                 $this->shellScript .= ' validate  +quit > ' . $updateLog . "\n";
             } else {
                 if ($row['steamgame'] == 'N' and $row['shorten'] == 'mc') {
                     if (!isurl($row['downloadPath'])) {
                         if (!function_exists('getMinecraftVersion')) {
                             require_once EASYWIDIR . '/stuff/methods/queries_updates.php';
                         }
                         $mcVersion = getMinecraftVersion();
                         if (isset($mcVersion['downloadPath']) and isurl($mcVersion['downloadPath'])) {
                             $row['downloadPath'] = $mcVersion['downloadPath'];
                         }
                     }
                     if (isurl($row['downloadPath'])) {
                         $this->shellScript .= 'cd ' . $absoluteGamePath . "\n";
                         $this->shellScript .= 'wget -q ' . $row['downloadPath'] . ' --output-document ' . $row['gamebinary'] . '.new' . "\n";
                         $this->shellScript .= 'if [ `stat -c %s ' . $row['gamebinary'] . '.new` -gt 0 ]; then' . "\n";
                         $this->shellScript .= 'mv ' . $row['gamebinary'] . '.new ' . $row['gamebinary'] . "\n";
                         $this->shellScript .= 'else' . "\n";
                         $this->shellScript .= 'rm -f ' . $row['gamebinary'] . '.new ' . "\n";
                         $this->shellScript .= 'fi' . "\n";
                         $this->shellScript .= 'chmod 750 ' . $row['gamebinary'] . "\n";
                     }
                 }
             }
         }
         // Housekeeping
         $this->houseKeeping($absoluteGamePath);
         $this->createFdlList($row);
         $this->sendUpdateSuccess($updateLog, $force, $row, $returnSuccessInAnyCase);
         $this->removeLogs[] = $updateLog;
         $this->updateAmount++;
     }
 }
Ejemplo n.º 11
0
     $supportnumber = $ui->description('supportnumber', 'post');
     $noservertag = $ui->id('noservertag', 1, 'post');
     $nopassword = $ui->id('nopassword', 1, 'post');
     $tohighslots = $ui->id('tohighslots', 1, 'post');
     $cronjobIPs = $ui->ips('cronjobIPs', 'post');
     $headerIcon = $ui->config('headerIcon', 'post');
     $headerText = $ui->escaped('headerText', 'post');
     $headerHref = $ui->url('headerHref', 'post');
     $template = $ui->folder('template', 'post') ? $ui->folder('template', 'post') : 'default';
     $lastCronWarnStatus = $ui->active('lastCronWarnStatus', 'post') ? $ui->active('lastCronWarnStatus', 'post') : 'Y';
     $lastCronWarnReboot = $ui->active('lastCronWarnReboot', 'post') ? $ui->active('lastCronWarnReboot', 'post') : 'Y';
     $lastCronWarnUpdates = $ui->active('lastCronWarnUpdates', 'post') ? $ui->active('lastCronWarnUpdates', 'post') : 'Y';
     $lastCronWarnJobs = $ui->active('lastCronWarnJobs', 'post') ? $ui->active('lastCronWarnJobs', 'post') : 'Y';
     $lastCronWarnCloud = $ui->active('lastCronWarnCloud', 'post') ? $ui->active('lastCronWarnCloud', 'post') : 'Y';
     foreach (preg_split('/\\r\\n/', $ui->escaped('imageserver', 'post'), -1, PREG_SPLIT_NO_EMPTY) as $imgserver) {
         if (isurl($imgserver) or isRsync($imgserver)) {
             $imageserver .= $imgserver . "\r\n";
         }
     }
     $query = $sql->prepare("UPDATE `settings` SET `header_icon`=?,`header_text`=?,`header_href`=?,`cronjob_ips`=?,`template`=?,`voice_autobackup`=?,`voice_autobackup_intervall`=?,`voice_maxbackup`=?,`language`=?,`imageserver`=?,`master`=?,`prefix1`=?,`prefix2`=?,`faillogins`=?,`brandname`=?,`timezone`=?,`supportnumber`=?,`noservertag`=?,`nopassword`=?,`tohighslots`=?,`down_checks`=?,`lastCronWarnStatus`=?,`lastCronWarnReboot`=?,`lastCronWarnUpdates`=?,`lastCronWarnJobs`=?,`lastCronWarnCloud`=? WHERE `resellerid`=? LIMIT 1");
     $query->execute(array($headerIcon, $headerText, $headerHref, $cronjobIPs, $template, $voice_autobackup, $voice_autobackup_intervall, $voice_maxbackup, $language, $imageserver, $master, $prefix1, $prefix2, $faillogins, $brandname, $timezone, $supportnumber, $noservertag, $nopassword, $tohighslots, $down_checks, $lastCronWarnStatus, $lastCronWarnReboot, $lastCronWarnUpdates, $lastCronWarnJobs, $lastCronWarnCloud, $reseller_id));
     if ($query->rowCount() > 0) {
         $loguseraction = "%mod% %settings%";
         $insertlog->execute();
         $template_file = $spracheResponse->table_add;
     } else {
         $template_file = $spracheResponse->error_table;
     }
 } else {
     $template_file = 'admin_404.tpl';
 }