Exemplo n.º 1
0
 function ShowIf($title, $str)
 {
     global $ns, $style;
     $style = 'debug';
     if (!isset($ns)) {
         echo "Why did ns go away?<br />";
         $ns = new e107table();
     }
     if (strlen($str)) {
         $ns->tablerender($title, $str);
     }
 }
Exemplo n.º 2
0
function show_emessage($mode, $message, $line = 0, $file = "")
{
    global $tp;
    // For critical errors where no theme is available.
    $errorHead = '
			<!doctype html>
		<html lang="en">
		<head>
		<meta charset="utf-8" />
		<title>Error</title>
		<link rel="stylesheet" media="all" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" />
		<link rel="stylesheet" media="all" type="text/css" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" />
		<link rel="stylesheet" media="all" type="text/css" href="/e107_web/css/e107.css" />
		</head>
		<body >
		<div class="container" style="margin-top:100px">';
    $errorFoot = "</div></body></html>";
    if (is_numeric($message)) {
        if (!defined('e_LANGUAGE')) {
            define('e_LANGUAGE', 'English');
        }
        if (!defined('e_LANGUAGEDIR')) {
            define('e_LANGUAGEDIR', 'e107_languages/');
        }
        $path = e_LANGUAGEDIR . e_LANGUAGE . "/lan_error.php";
        if (is_readable($path)) {
            include $path;
        }
        //	include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_error.php");
        global $mySQLdefaultdb;
        $emessage[1] = "<b>" . LAN_ERROR_25 . "</b>";
        $emessage[2] = "<b>" . LAN_ERROR_26 . "</b>";
        $emessage[3] = "<b>" . LAN_ERROR_27 . "</b>";
        $emessage[4] = "<b>" . LAN_ERROR_28 . "</b>";
        $emessage[5] = LAN_ERROR_29;
        $emessage[6] = "<b>" . LAN_ERROR_30 . "</b>";
        $emessage[7] = "<b>" . $tp->lanVars(LAN_ERROR_31, $mySQLdefaultdb) . "</b>";
        /*$emessage[8] = "
        		<div style='text-align:center; font: 12px Verdana, Tahoma'><b>".LAN_ERROR_32." </b><br /><br />
        		".chr(36)."ADMIN_DIRECTORY = \"e107_admin/\";<br />
        		".chr(36)."FILES_DIRECTORY = \"e107_files/\";<br />
        		".chr(36)."IMAGES_DIRECTORY = \"e107_images/\"; <br />
        		".chr(36)."THEMES_DIRECTORY = \"e107_themes/\"; <br />
        		".chr(36)."PLUGINS_DIRECTORY = \"e107_plugins/\"; <br />
        		".chr(36)."HANDLERS_DIRECTORY = \"e107_handlers/\"; <br />
        		".chr(36)."LANGUAGES_DIRECTORY = \"e107_languages/\"; <br />
        		".chr(36)."HELP_DIRECTORY = \"e107_docs/help/\";  <br />
        		".chr(36)."DOWNLOADS_DIRECTORY =  \"e107_files/downloads/\";\n
        		</div>";*/
        //v2.x
        $emessage[8] = '<b>' . LAN_ERROR_32 . ' </b><br /><br /><pre>
$ADMIN_DIRECTORY     = "e107_admin/";
$IMAGES_DIRECTORY    = "e107_images/";
$THEMES_DIRECTORY    = "e107_themes/";
$PLUGINS_DIRECTORY   = "e107_plugins/";
$HANDLERS_DIRECTORY  = "e107_handlers/";
$LANGUAGES_DIRECTORY = "e107_languages/";
$HELP_DIRECTORY	     = "e107_docs/help/";
$MEDIA_DIRECTORY     = "e107_media/";
$SYSTEM_DIRECTORY    = "e107_system/";</pre>

		';
    }
    if (class_exists('e107table')) {
        $ns = new e107table();
    }
    switch ($mode) {
        case "CRITICAL_ERROR":
            $message = !empty($emessage[$message]) ? $emessage[$message] : $message;
            //FIXME - this breaks class2 pref check!!! ?
            if (is_readable(e_THEME . 'error.html')) {
                require_once e_THEME . 'error.html';
                exit;
            }
            if (!defined('HEADERF')) {
                echo $errorHead;
            }
            echo "<div class='alert alert-block alert-error alert-danger' style='font: 11px verdana, tahoma, arial, helvetica, sans-serif;'><h4>CRITICAL ERROR: </h4>";
            echo !empty($line) ? "Line {$line} " : "";
            echo !empty($file) ? $file : "";
            echo "<div>Error reported as: " . $message . "</div>";
            echo "</div>";
            if (!defined('FOOTERF')) {
                echo $errorFoot;
            }
            break;
        case "MESSAGE":
            if (strstr(e_SELF, "forum_post.php")) {
                return;
            }
            $ns->tablerender("", "<div class='alert alert-block' style='text-align:center'><b>{$message}</b></div>");
            break;
        case "ADMIN_MESSAGE":
            $ns->tablerender("Admin Message", "<div class='alert'><b>{$message}</b></div>");
            break;
        case "ALERT":
            $message = $emessage[$message] ? $emessage[$message] : $message;
            echo "<noscript>{$message}</noscript><script type='text/javascript'>alert(\"" . $tp->toJS($message) . "\"); window.history.go(-1); </script>\n";
            exit;
            break;
        case "P_ALERT":
            echo "<script type='text/javascript'>alert(\"" . $tp->toJS($message) . "\"); </script>\n";
            break;
        case 'POPUP':
            $mtext = "<html><head><title>Message</title><link rel=stylesheet href=" . THEME . "style.css></head><body style=padding-left:2px;padding-right:2px;padding:2px;padding-bottom:2px;margin:0px;align;center marginheight=0 marginleft=0 topmargin=0 leftmargin=0><table width=100% align=center style=width:100%;height:99%padding-bottom:2px class=bodytable height=99% ><tr><td width=100% style='text-align:center'><b>--- Message ---</b><br /><br />" . $message . "<br /><br /><form><input class=button type=submit onclick=self.close() value = ok /></form></td></tr></table></body></html> ";
            echo "\n\t\t\t<script type='text/javascript'>\n\t\t\twinl=(screen.width-200)/2;\n\t\t\twint = (screen.height-100)/2;\n\t\t\twinProp = 'width=200,height=100,left='+winl+',top='+wint+',scrollbars=no';\n\t\t\twindow.open('javascript:document.write(\"" . $mtext . "\");', \"message\", winProp);\n\t\t\t</script >";
            break;
    }
}
Exemplo n.º 3
0
 /**
  * Display the comment editing form
  *
  * @param unknown_type $action
  * @param unknown_type $table
  * @param unknown_type $id
  * @param unknown_type $subject
  * @param unknown_type $content_type
  * @param unknown_type $return
  * @param unknown_type $rating
  * @return unknown
  */
 function form_comment($action, $table, $id, $subject, $content_type, $return = FALSE, $rating = FALSE, $tablerender = TRUE, $pid = false)
 {
     //rating	: boolean, to show rating system in comment
     $pref = e107::getPref();
     $sql = e107::getDb();
     $tp = e107::getParser();
     if (vartrue($pref['comments_disabled']) || $this->engine != 'e107') {
         return null;
     }
     if ($user_func = e107::getOverride()->check($this, 'form_comment')) {
         return call_user_func($user_func, array('action' => $action, 'table' => $table, 'id' => $id, 'subject' => $subject, 'content_type' => $content_type, 'return' => $return, 'rating' => $rating, 'tablerender' => $tablerender, 'pid' => $pid));
     }
     // 	require_once(e_HANDLER."ren_help.php");
     if ($this->getCommentPermissions() == 'rw') {
         $itemid = $id;
         $ns = new e107table();
         if ($action == "reply" && substr($subject, 0, 4) != "Re: ") {
             $subject = COMLAN_325 . ' ' . $subject;
         }
         //FIXME - e_REQUEST_URI?
         //e_SELF."?".e_QUERY
         if (vartrue($_GET['comment']) == 'edit') {
             $eaction = 'edit';
             $id = $_GET['comment_id'];
         } elseif (strpos(e_QUERY, 'edit.') !== FALSE) {
             $eaction = 'edit';
             $tmp = explode(".", e_QUERY);
             $count = 0;
             foreach ($tmp as $t) {
                 if ($t == "edit") {
                     $id = $tmp[$count + 1];
                     break;
                 }
                 $count++;
             }
         }
         if (isset($eaction) && $eaction == "edit") {
             // Get existing comment
             $id = intval($id);
             $sql->db_Select("comments", "*", "comment_id='{$id}' ");
             $ecom = $sql->db_Fetch();
             if (isset($ecom['comment_author'])) {
                 // Old comment DB format
                 list($prid, $pname) = explode(".", $ecom['comment_author'], 2);
             } else {
                 $prid = $ecom['comment_author_id'];
                 $pname = $ecom['comment_author_name'];
             }
             if ($prid != USERID || !USER) {
                 // Editing not allowed
                 echo "<div style='text-align: center;'>" . COMLAN_329 . "</div>";
                 require_once FOOTERF;
                 exit;
             }
             $caption = COMLAN_318;
             $comval = $tp->toForm($ecom['comment_comment']);
             $comval = preg_replace("#\\[ " . COMLAN_319 . ".*\\]#si", "", $comval);
         } else {
             // New comment - blank form
             $caption = COMLAN_9;
             $comval = "";
         }
         //add the rating select box/result ?
         /*
         $rate = "";
         if ($rating == TRUE && !(ANON == TRUE && USER == FALSE))
         {
         	global $rater;
         	require_once(e_HANDLER."rate_class.php");
         	if (!is_object($rater))
         	{
         		$rater = new rater;
         	}
         	$rate = $rater->composerating($table, $itemid, $enter = TRUE, USERID, TRUE);
         	
         
         } //end rating area
         */
         // -------------------------------------------------------------
         $indent = $action == 'reply' ? " class='media col-md-offset-1 offset1' " : " class='media' ";
         $formid = $action == 'reply' ? "e-comment-form-reply" : "e-comment-form";
         $text = "\n<div{$indent}>\n" . e107::getMessage()->render('postcomment', true, false, false);
         //temporary here
         //	$text .= "Indent = ".$indent;
         $text .= "<form id='{$formid}' method='post' action='" . str_replace('http:', '', $_SERVER['REQUEST_URI']) . "'  >";
         $data = array('action' => $action, 'subject' => $subject, 'table' => $table, 'comval' => strip_tags(trim($comval)), 'itemid' => $itemid, 'pid' => $pid, 'eaction' => varset($eaction), 'rate' => $rating);
         e107::getScBatch('comment')->setVars($data);
         e107::getScBatch('comment')->setMode('edit');
         $text .= $tp->parseTemplate($this->template['form'], TRUE, e107::getScBatch('comment'));
         $text .= "\n<div>\n";
         // All Hidden Elements.
         $text .= varset($action) == "reply" && $pid ? "<input type='hidden' name='pid' value='{$pid}' />" : '';
         $text .= isset($eaction) && $eaction == "edit" ? "<input type='hidden' name='editpid' value='{$id}' />" : "";
         $text .= isset($content_type) && $content_type ? "<input type='hidden' name='content_type' value='{$content_type}' />" : '';
         //	$text .= (!$pref['nested_comments']) ? "<input type='hidden' name='subject' value='".$tp->toForm($subject)."'  />\n" : "";
         $text .= "\n\t\t\t<input type='hidden' name='subject' value='" . $tp->toForm($subject) . "'  />\n\t\t\t<input type='hidden' name='e-token' value='" . e_TOKEN . "' />\n\t\t\t<input type='hidden' name='table' value='" . $table . "' />\n\t\t\t<input type='hidden' name='itemid' value='" . $itemid . "' />\n\t\t\t\n\t\t\t</div>\n\t\t\t</form>\n";
         $text .= "</div>";
         if ($tablerender) {
             $text = $ns->tablerender($caption, $text, '', TRUE);
         }
     } else {
         // Comment entry not allowed - point to signup link
         $text = "<br /><div style='text-align:center'><b>" . COMLAN_6 . " <a href='" . e_SIGNUP . "'>" . COMLAN_321 . "</a> " . COMLAN_322 . "</b></div>";
     }
     if ($return) {
         return $text;
     } else {
         echo $text;
     }
 }
Exemplo n.º 4
0
function show_emessage($mode, $message, $line = 0, $file = "")
{
    global $tp;
    if (is_numeric($message)) {
        include_lan(e_LANGUAGEDIR . e_LANGUAGE . "/lan_error.php");
        $emessage[1] = "<b>" . LAN_ERROR_25 . "</b>";
        $emessage[2] = "<b>" . LAN_ERROR_26 . "</b>";
        $emessage[3] = "<b>" . LAN_ERROR_27 . "</b>";
        $emessage[4] = "<b>" . LAN_ERROR_28 . "</b>";
        $emessage[5] = LAN_ERROR_29;
        $emessage[6] = "<b>" . LAN_ERROR_30 . "</b>";
        $emessage[7] = "<b>" . LAN_ERROR_31 . "</b>";
        $emessage[8] = "\n\t\t<div style='text-align:center; font: 12px Verdana, Tahoma'><b>" . LAN_ERROR_32 . " </b><br /><br />\n\t\t" . chr(36) . "ADMIN_DIRECTORY = \"e107_admin/\";<br />\n\t\t" . chr(36) . "FILES_DIRECTORY = \"e107_files/\";<br />\n\t\t" . chr(36) . "IMAGES_DIRECTORY = \"e107_images/\"; <br />\n\t\t" . chr(36) . "THEMES_DIRECTORY = \"e107_themes/\"; <br />\n\t\t" . chr(36) . "PLUGINS_DIRECTORY = \"e107_plugins/\"; <br />\n\t\t" . chr(36) . "HANDLERS_DIRECTORY = \"e107_handlers/\"; <br />\n\t\t" . chr(36) . "LANGUAGES_DIRECTORY = \"e107_languages/\"; <br />\n\t\t" . chr(36) . "HELP_DIRECTORY = \"e107_docs/help/\";  <br />\n\t\t" . chr(36) . "DOWNLOADS_DIRECTORY =  \"e107_files/downloads/\";\n\n\t\t</div>";
    }
    if (class_exists('e107table')) {
        $ns = new e107table();
    }
    switch ($mode) {
        case "CRITICAL_ERROR":
            $message = $emessage[$message] ? $emessage[$message] : $message;
            //FIXME - this breaks class2 pref check!!!
            if (is_readable(e_THEME . 'index.html')) {
                require_once e_THEME . 'index.html';
                exit;
            }
            echo "<div style='text-align:center; font: 11px verdana, tahoma, arial, helvetica, sans-serif;'><b>CRITICAL_ERROR: </b><br />Line {$line} {$file}<br /><br />Error reported as: " . $message . "</div>";
            break;
        case "MESSAGE":
            if (strstr(e_SELF, "forum_post.php")) {
                return;
            }
            $ns->tablerender("", "<div style='text-align:center'><b>{$message}</b></div>");
            break;
        case "ADMIN_MESSAGE":
            $ns->tablerender("Admin Message", "<div style='text-align:center'><b>{$message}</b></div>");
            break;
        case "ALERT":
            $message = $emessage[$message] ? $emessage[$message] : $message;
            echo "<noscript>{$message}</noscript><script type='text/javascript'>alert(\"" . $tp->toJS($message) . "\"); window.history.go(-1); </script>\n";
            exit;
            break;
        case "P_ALERT":
            echo "<script type='text/javascript'>alert(\"" . $tp->toJS($message) . "\"); </script>\n";
            break;
        case 'POPUP':
            $mtext = "<html><head><title>Message</title><link rel=stylesheet href=" . THEME . "style.css></head><body style=padding-left:2px;padding-right:2px;padding:2px;padding-bottom:2px;margin:0px;align;center marginheight=0 marginleft=0 topmargin=0 leftmargin=0><table width=100% align=center style=width:100%;height:99%padding-bottom:2px class=bodytable height=99% ><tr><td width=100% style='text-align:center'><b>--- Message ---</b><br /><br />" . $message . "<br /><br /><form><input class=button type=submit onclick=self.close() value = ok /></form></td></tr></table></body></html> ";
            echo "\n\t\t<script type='text/javascript'>\n\t\twinl=(screen.width-200)/2;\n\t\twint = (screen.height-100)/2;\n\t\twinProp = 'width=200,height=100,left='+winl+',top='+wint+',scrollbars=no';\n\t\twindow.open('javascript:document.write(\"" . $mtext . "\");', \"message\", winProp);\n\t\t</script >";
            break;
    }
}
Exemplo n.º 5
0
/**
* Add comments to a plugins
* <p>This method returns the HTML for a comment form. In addition, it will post comments to the e107v7
* comments database and get any existing comments for the current item.</p>
* @param   string   a unique ID for this plugin, maximum of 10 character
* @param   int      id of the item comments are allowed for
* @return  string   HTML for existing comments for an item and the comments form to allow new comments to be posted
*/
function ebGetComment($pluginid, $id)
{
    global $pref, $e107cache, $tp;
    // Include the comment class. Normally, this file is included at a global level, so we need to make the variable
    // it decalares global so it is available inside the comment class
    require_once e_HANDLER . "comment_class.php";
    require e_FILE . "shortcode/batch/comment_shortcodes.php";
    $GLOBALS["comment_shortcodes"] = $comment_shortcodes;
    $pid = 0;
    // What is this w.r.t. comment table? Parent ID?
    // Define a comment object
    $cobj = new comment();
    // See if we need to post a comment to the database
    if (isset($_POST['commentsubmit'])) {
        $cobj->enter_comment($_POST['author_name'], $_POST['comment'], $pluginid, $id, $pid, $_POST['subject']);
        if ($pref['cachestatus']) {
            $e107cache->clear("comment.{$pluginid}.{$sub_action}");
        }
    }
    // Specific e107 0.617 processing to render existing comments
    if (!isV07()) {
        $query = $pref['nested_comments'] ? "comment_item_id='{$id}' AND comment_type='{$pluginid}' AND comment_pid='0' ORDER BY comment_datestamp" : "comment_item_id='{$id}' AND comment_type='{$pluginid}' ORDER BY comment_datestamp";
        unset($text);
        $mysql = new db();
        if ($comment_total = $mysql->db_Select("comments", "*", $query)) {
            $width = 0;
            while ($row = $mysql->db_Fetch()) {
                // ** Need to sort out how to do nested comments here
                if ($pref['nested_comments']) {
                    $text .= $cobj->render_comment($row, $pluginid, "comment", $id, $width, $subject, true);
                } else {
                    $text .= $cobj->render_comment($row, $pluginid, "comment", $id, $width, $subject, true);
                }
            }
            if (ADMIN && getperms("B")) {
                $text .= "<div style='text-align:right'><a href='" . e_ADMIN . "modcomment.php?{$pluginid}.{$id}'>" . LAN_314 . "</a></div>";
            }
        }
    }
    // Get comment form - e107 sends this to the output buffer so we must grab it and assign to our return string
    ob_start();
    if (isV07()) {
        // e107 0.7
        $cobj->compose_comment($pluginid, "comment", $id, $width, $subject, false);
    } else {
        // e107 0.617
        if (strlen($text) > 0) {
            $ns = new e107table();
            $ns->tablerender(LAN_5, $text);
        }
        $cobj->form_comment("comment", $pluginid, $id, $subject, $content_type);
    }
    $text = ob_get_contents();
    ob_end_clean();
    return $text;
}