function cmtx_delete_replies($id) { //delete replies of comment global $cmtx_mysql_table_prefix; $query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `reply_to` = '{$id}'"); while ($comments = cmtx_db_fetch_assoc($query)) { $id = $comments["id"]; cmtx_db_query("DELETE FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `id` = '{$id}'"); cmtx_db_query("DELETE FROM `" . $cmtx_mysql_table_prefix . "voters` WHERE `comment_id` = '{$id}'"); cmtx_db_query("DELETE FROM `" . $cmtx_mysql_table_prefix . "reporters` WHERE `comment_id` = '{$id}'"); cmtx_delete_replies($id); } }
echo CMTX_RATE_NO_PAGE; return; } //check if user has already rated as a poster $query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `page_id` = '{$id}' AND `ip_address` = '{$ip_address}' AND `rating` != '0'"); $count = cmtx_db_num_rows($query); if ($count > 0) { echo CMTX_RATE_ALREADY_RATED; return; } //check if user has already rated as a guest $query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "ratings` WHERE `page_id` = '{$id}' and `ip_address` = '{$ip_address}'"); $count = cmtx_db_num_rows($query); if ($count > 0) { echo CMTX_RATE_ALREADY_RATED; return; } //check if user is banned $query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "bans` WHERE `ip_address` = '{$ip_address}'"); $count = cmtx_db_num_rows($query); if ($count > 0) { echo CMTX_RATE_BANNED; return; } cmtx_db_query("INSERT INTO `" . $cmtx_mysql_table_prefix . "ratings` (`page_id`, `rating`, `ip_address`, `dated`) values ('{$id}', '{$rating}', '{$ip_address}', NOW())"); $result = cmtx_db_query("SELECT AVG(`rating`) \r\n\tFROM ( \r\n\tSELECT `rating` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `is_approved` = '1' AND `rating` != '0' AND `page_id` = '{$id}' \r\n\tUNION ALL \r\n\tSELECT `rating` FROM `" . $cmtx_mysql_table_prefix . "ratings` WHERE `page_id` = '{$id}' \r\n\t) \r\n\tAS `average`\r\n\t"); $average = cmtx_db_fetch_assoc($result); $average = $average["AVG(`rating`)"]; $average = round($average, 0); echo $average; }
} if (isset($_POST['to_reply'])) { cmtx_db_query("UPDATE `" . $cmtx_mysql_table_prefix . "subscribers` SET `to_reply` = '1' WHERE `token` = '{$token}'"); } else { cmtx_db_query("UPDATE `" . $cmtx_mysql_table_prefix . "subscribers` SET `to_reply` = '0' WHERE `token` = '{$token}'"); } ?> <div class="success"><?php echo CMTX_SUB_MSG_SETTINGS_SAVED; ?> </div><?php ?> <div style="clear:left"></div><?php } $subscriber = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "subscribers` WHERE `token` = '{$token}'"); $subscriber = cmtx_db_fetch_assoc($subscriber); ?> <div class="subscription_info_block"> <label class="subscription_info_label"><?php echo CMTX_SUB_NAME; ?> </label> <?php echo $subscriber['name']; ?> <br/> <label class="subscription_info_label"><?php echo CMTX_SUB_EMAIL; ?> </label> <?php echo $subscriber['email'];
function cmtx_get_question() { //get captcha question and answer global $cmtx_mysql_table_prefix; //globalise variables $query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "questions` ORDER BY Rand() LIMIT 1"); $result = cmtx_db_fetch_assoc($query); $question = array($result['question'], $result['answer']); return $question; }
echo CMTX_MSG_SAVED; ?> </div> <div style="clear: left;"></div> <?php } ?> <?php } } ?> <?php $administrator = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "admins` WHERE `id` = '{$admin_id}'"); $administrator = cmtx_db_fetch_assoc($administrator); $username = $administrator["username"]; $email = $administrator["email"]; $receive_email_new_ban = $administrator["receive_email_new_ban"]; $receive_email_new_comment_approve = $administrator["receive_email_new_comment_approve"]; $receive_email_new_comment_okay = $administrator["receive_email_new_comment_okay"]; $receive_email_new_flag = $administrator["receive_email_new_flag"]; ?> <p /> <?php echo CMTX_DESC_SETTINGS_ADMIN; ?> <p />
</th> <th><?php echo CMTX_TABLE_DATE_TIME; ?> </th> <th><?php echo CMTX_TABLE_ACTION; ?> </th> </tr> </thead> <tbody> <?php $administrators = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "admins` ORDER BY `id` ASC"); while ($administrator = cmtx_db_fetch_assoc($administrators)) { ?> <tr> <td><input type="checkbox" name="bulk[]" value="<?php echo $administrator["id"]; ?> " onclick="bulk_check();"/></td> <td><?php echo $administrator["username"]; ?> </td> <td><?php echo $administrator["email"]; ?> </td> <td><?php
</th> <th><?php echo CMTX_TABLE_ANSWER; ?> </th> <th><?php echo CMTX_TABLE_ACTION; ?> </th> </tr> </thead> <tbody> <?php $questions = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "questions`"); while ($question = cmtx_db_fetch_assoc($questions)) { ?> <tr> <td><input type="checkbox" name="bulk[]" value="<?php echo $question["id"]; ?> " onclick="bulk_check();"/></td> <td><?php echo $question["question"]; ?> </td> <td><?php echo $question["answer"]; ?> </td> <td>
?> <div class="success"><?php echo CMTX_MSG_BAN_UPDATED; ?> </div> <div style="clear: left;"></div> <?php } } ?> <?php $id = $_GET['id']; $id_san = cmtx_sanitize($id); $ban_query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "bans` WHERE `id` = '{$id_san}'"); $ban_result = cmtx_db_fetch_assoc($ban_query); $ip_address = $ban_result["ip_address"]; $reason = $ban_result["reason"]; $time = cmtx_format_date(date(CMTX_TIME_FORMAT, strtotime($ban_result["dated"]))); $date = cmtx_format_date(date(CMTX_DATE_FORMAT, strtotime($ban_result["dated"]))); ?> <p /> <form name="edit_ban" id="edit_ban" action="index.php?page=edit_ban&id=<?php echo $id; ?> " method="post"> <label class='edit_ban'><?php echo CMTX_FIELD_LABEL_IP_ADDRESS; ?>
</th> <th><?php echo CMTX_TABLE_DATE_TIME; ?> </th> <th><?php echo CMTX_TABLE_ACTION; ?> </th> </tr> </thead> <tbody> <?php $bans = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "bans` WHERE `unban` = '0' ORDER BY `dated` DESC"); while ($ban = cmtx_db_fetch_assoc($bans)) { ?> <tr> <td><input type="checkbox" name="bulk[]" value="<?php echo $ban["id"]; ?> " onclick="bulk_check();"/></td> <td><?php echo $ban["ip_address"]; ?> </td> <td><?php echo $ban["reason"]; ?> </td> <td><span style="display:none;"><?php
if (cmtx_setting('show_social_linkedin')) { echo '<a href="http://www.linkedin.com/shareArticle?mini=true&url=' . $cmtx_social_url . '&title=' . $cmtx_social_title . '" rel="nofollow"' . $cmtx_social_attribute . '><img src="' . cmtx_commentics_url() . 'images/social/linkedin.png" class="cmtx_social_image" title="LinkedIn" alt="LinkedIn"/></a>'; } echo '</div>'; } echo '</div>'; echo '<div style="clear: both;"></div>'; /* *** Comments *** */ echo '<div class="cmtx_height_above_comment_boxes"></div>'; $cmtx_sort = cmtx_get_sort_by(); $cmtx_comments_query = cmtx_db_query("SELECT `id` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `reply_to` = '0' AND `is_approved` = '1' AND `page_id` = '{$cmtx_page_id}' ORDER BY {$cmtx_sort};"); //get comments from database $cmtx_loop_counter = 0; $cmtx_comment_counter = 0; $cmtx_exit_loop = false; while ($cmtx_comments = cmtx_db_fetch_assoc($cmtx_comments_query)) { //while there are comments cmtx_get_comment_and_replies($cmtx_comments['id']); if ($cmtx_exit_loop) { break; } } echo '<div class="cmtx_height_below_comment_boxes"></div>'; /* *** RSS *** */ echo '<div class="cmtx_rss_block">'; if (cmtx_setting('show_rss')) { ?> <a href="<?php echo cmtx_commentics_url() . 'rss.php?id=' . $cmtx_page_id; ?> " rel="nofollow"><img src="<?php
<hr class="title"/> <?php if (isset($_POST['submit']) && cmtx_setting('is_demo')) { ?> <div class="warning"><?php echo CMTX_MSG_DEMO; ?> </div> <div style="clear: left;"></div> <?php } else { if (isset($_POST['submit'])) { cmtx_check_csrf_form_key(); $all_tables = cmtx_db_query("SHOW TABLES"); while ($table = cmtx_db_fetch_assoc($all_tables)) { foreach ($table as $db => $table_name) { cmtx_db_query("OPTIMIZE TABLE " . $table_name); } } ?> <div class="success"><?php echo CMTX_MSG_OPTIMIZED; ?> </div> <div style="clear: left;"></div> <?php } } ?>
if ($type == 'like' && cmtx_setting('show_like')) { cmtx_db_query("UPDATE `" . $cmtx_mysql_table_prefix . "comments` SET `likes` = `likes` + 1 WHERE `id` = '{$id}'"); cmtx_db_query("INSERT INTO `" . $cmtx_mysql_table_prefix . "voters` (`comment_id`, `ip_address`, `dated`) values ('{$id}', '{$ip_address}', NOW())"); } else { if ($type == 'dislike' && cmtx_setting('show_dislike')) { cmtx_db_query("UPDATE `" . $cmtx_mysql_table_prefix . "comments` SET `dislikes` = `dislikes` + 1 WHERE `id` = '{$id}'"); cmtx_db_query("INSERT INTO `" . $cmtx_mysql_table_prefix . "voters` (`comment_id`, `ip_address`, `dated`) values ('{$id}', '{$ip_address}', NOW())"); } } if ($type == 'like') { $result = cmtx_db_query("SELECT `likes` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `id` = '{$id}'"); if (cmtx_db_num_rows($result)) { $row = cmtx_db_fetch_assoc($result); $likes = $row['likes']; } else { $likes = 0; } echo '<img src="' . cmtx_commentics_url() . 'images/buttons/like.png" alt="Like" title="' . CMTX_TITLE_LIKE . '"/><span id="cmtx_flash_like_' . $id . '">' . $likes . '</span>'; } else { if ($type == 'dislike') { $result = cmtx_db_query("SELECT `dislikes` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `id` = '{$id}'"); if (cmtx_db_num_rows($result)) { $row = cmtx_db_fetch_assoc($result); $dislikes = $row['dislikes']; } else { $dislikes = 0; } echo '<img src="' . cmtx_commentics_url() . 'images/buttons/dislike.png" alt="Dislike" title="' . CMTX_TITLE_DISLIKE . '"/><span id="cmtx_flash_dislike_' . $id . '">' . $dislikes . '</span>'; } } }
?> <div class="success"><?php echo CMTX_MSG_QUESTION_UPDATED; ?> </div> <div style="clear: left;"></div> <?php } } ?> <?php $id = $_GET['id']; $id_san = cmtx_sanitize($id); $question_query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "questions` WHERE `id` = '{$id_san}'"); $question_result = cmtx_db_fetch_assoc($question_query); $question = $question_result["question"]; $answer = $question_result["answer"]; ?> <p /> <form name="edit_question" id="edit_question" action="index.php?page=edit_question&id=<?php echo $id; ?> " method="post"> <label class='edit_question'><?php echo CMTX_FIELD_LABEL_QUESTION; ?> </label> <input type="text" required name="question" size="50" value="<?php echo $question;
} echo ' <generator>Commentics</generator>'; if (cmtx_setting('rss_image_enabled')) { echo ' <image> <url>' . cmtx_url_encode(cmtx_setting('rss_image_url')) . '</url> <title>' . cmtx_encode(cmtx_setting('rss_title')) . '</title> <link>' . cmtx_url_encode(cmtx_setting('rss_link')) . '</link> <width>' . cmtx_setting('rss_image_width') . '</width> <height>' . cmtx_setting('rss_image_height') . '</height> </image>'; } while ($comments = cmtx_db_fetch_assoc($result)) { $pages_query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "pages` WHERE `id` = '" . $comments["page_id"] . "'"); $pages = cmtx_db_fetch_assoc($pages_query); $title = sprintf(CMTX_RSS_POSTER, $comments["name"]); $link = cmtx_get_permalink($comments["id"], $pages["url"]); $comment = $comments["comment"]; $dated = date("r", strtotime($comments["dated"])); $guid = $comments["id"]; echo ' <item> <title>' . $title . '</title> <link>' . $link . '</link> <description><![CDATA[' . $comment . ']]></description> <pubDate>' . $dated . '</pubDate> <guid isPermaLink="false">' . $guid . '</guid> </item>'; } echo '
cmtx_db_query("UPDATE `" . $cmtx_mysql_table_prefix . "admins` SET `detect_method` = '{$detect_method_san}' WHERE `id` = '{$admin_id}'"); cmtx_db_query("UPDATE `" . $cmtx_mysql_table_prefix . "admins` SET `ip_address` = '{$ip_address_san}' WHERE `id` = '{$admin_id}'"); ?> <div class="success"><?php echo CMTX_MSG_SAVED; ?> </div> <div style="clear: left;"></div> <?php } } ?> <?php $detection = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "admins` WHERE `id` = '{$admin_id}'"); $detection = cmtx_db_fetch_assoc($detection); $detect_admin = $detection["detect_admin"]; $detect_method = $detection["detect_method"]; $ip_address = $detection["ip_address"]; $cookie_key = $detection["cookie_key"]; ?> <p /> <?php echo CMTX_DESC_SETTINGS_ADMIN_DETECTION; ?> <p /> <form name="settings_admin_detection" id="settings_admin_detection" action="index.php?page=settings_admin_detection" method="post">
</th> <th><?php echo CMTX_TABLE_TYPE; ?> </th> <th><?php echo CMTX_TABLE_DATE_TIME; ?> </th> </tr> </thead> <tbody> <?php $versions = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "version` ORDER BY `dated` DESC"); while ($version = cmtx_db_fetch_assoc($versions)) { ?> <tr> <td><?php echo $version["version"]; ?> </td> <td><?php echo $version["type"]; ?> </td> <td><span style="display:none;"><?php echo date("YmdHis", strtotime($version["dated"])); ?> </span><?php echo cmtx_format_date(date(CMTX_DATE_FORMAT, strtotime($version['dated']))) . ' ' . cmtx_format_date(date(CMTX_TIME_FORMAT, strtotime($version['dated'])));
<tr> <td><input type="checkbox" name="bulk[]" value="<?php echo $comment["id"]; ?> " onclick="bulk_check();"/></td> <?php $id = $comment["id"]; ?> <td><?php echo $comment["name"]; ?> </td> <?php $page_id = $comment["page_id"]; $page_reference_query = cmtx_db_query("SELECT `reference` FROM `" . $cmtx_mysql_table_prefix . "pages` WHERE `id` = '{$page_id}'"); $page_reference_result = cmtx_db_fetch_assoc($page_reference_query); ?> <td><?php echo $page_reference_result["reference"]; ?> </td> <?php $comment1 = $comment["comment"]; $comment1 = str_ireplace("<br />", " ", $comment1); $comment1 = str_ireplace("<p></p>", " ", $comment1); $comment1 = strip_tags($comment1); $comment1 = cmtx_decode($comment1); $comment1 = substr($comment1, 0, 75); $comment1 = htmlspecialchars($comment1, ENT_NOQUOTES, 'UTF-8'); ?> <td><?php
<div style="clear: left;"></div> <div style='margin-top: 10px;'> <a href="index.php?page=manage_comments"><?php echo CMTX_LINK_BACK; ?> </a> <?php die; } ?> <?php $id = $_GET['id']; $id = cmtx_sanitize($id); $comment_query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `id` = '{$id}'"); $comment_result = cmtx_db_fetch_assoc($comment_query); $name = $comment_result["name"]; $email = $comment_result["email"]; $website = $comment_result["website"]; ?> <p /> <form name="spam" id="spam" action="index.php?page=manage_comments" method="post"> <input type="hidden" name="id" value="<?php echo $id; ?> "/> <input type="radio" checked="checked" name="delete" value="delete_this"/> <?php echo CMTX_FIELD_VALUE_SPAM_DELETE_THIS; ?>
' value='<?php echo CMTX_RESET_BUTTON; ?> '/> </fieldset> </form> <div style="text-align:center; margin-top:10px;"> <?php if (isset($_POST['email'])) { if (cmtx_setting('is_demo')) { echo '<span class="negative">' . CMTX_RESET_DEMO . '</span><p />'; } else { $email = cmtx_sanitize($_POST['email']); if (cmtx_db_num_rows(cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "admins` WHERE `email` = '{$email}'"))) { $admin_query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "admins` WHERE `email` = '{$email}'"); $admin_result = cmtx_db_fetch_assoc($admin_query); $resets = $admin_result['resets']; if ($resets >= 5) { echo '<span class="negative">' . CMTX_RESET_LIMIT . '</span><p />'; } else { $resets++; cmtx_db_query("UPDATE `" . $cmtx_mysql_table_prefix . "admins` SET `resets` = '{$resets}' WHERE `email` = '{$email}'"); $username = $admin_result['username']; $password = cmtx_get_random_key(10); if (file_exists($cmtx_path . 'includes/emails/' . cmtx_setting('language_frontend') . '/admin/custom/reset_password.txt')) { $reset_password_email_file = $cmtx_path . 'includes/emails/' . cmtx_setting('language_frontend') . '/admin/custom/reset_password.txt'; //build path to custom reset password email file } else { $reset_password_email_file = $cmtx_path . 'includes/emails/' . cmtx_setting('language_frontend') . '/admin/reset_password.txt'; //build path to reset password email file }
function cmtx_flood_control_maximum() { //check amount of comments does not exceed set maximum within set period global $cmtx_mysql_table_prefix, $cmtx_page_id; //globalise variables $ip_address = cmtx_get_ip_address(); $now = strtotime(date('Y-m-d H:i:s')); //get current time $earlier = $now - 3600 * cmtx_setting('flood_control_maximum_period'); //subtract time period from current time $earlier = date('Y-m-d H:is', $earlier); //convert to normal date //count number of comments (if any) within past period by current user if (cmtx_setting('flood_control_maximum_all_pages')) { //for all pages $query = cmtx_db_query("SELECT COUNT(*) as `amount` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `ip_address` = '{$ip_address}' AND `dated` > '{$earlier}'"); } else { //for current page $query = cmtx_db_query("SELECT COUNT(*) as `amount` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `ip_address` = '{$ip_address}' AND `page_id` = '{$cmtx_page_id}' AND `dated` > '{$earlier}'"); } $result = cmtx_db_fetch_assoc($query); $amount = $result['amount']; if ($amount >= cmtx_setting('flood_control_maximum_amount')) { //if comment amount exceeds allowed amount cmtx_error(CMTX_ERROR_MESSAGE_FLOOD_CONTROL_MAXIMUM); //reject user for too many comments within past period } }
</th> <th><?php echo CMTX_TABLE_DATE_TIME; ?> </th> <th><?php echo CMTX_TABLE_ACTION; ?> </th> </tr> </thead> <tbody> <?php $pages = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "pages` ORDER BY `id` ASC"); while ($page = cmtx_db_fetch_assoc($pages)) { ?> <tr> <td><input type="checkbox" name="bulk[]" value="<?php echo $page["id"]; ?> " onclick="bulk_check();"/></td> <td><?php echo $page["identifier"]; ?> </td> <td><?php echo $page["reference"]; ?> </td> <td><?php
function cmtx_calc_permalink($id) { //calculate the page of the permalink global $cmtx_mysql_table_prefix, $cmtx_page_id, $cmtx_perm_counter, $cmtx_exit_loop; $cmtx_perm_counter++; $cmtx_perm = (int) $_GET['cmtx_perm']; if ($cmtx_perm == $id) { $cmtx_page = ceil($cmtx_perm_counter / cmtx_setting('comments_per_page')); $_GET['cmtx_page'] = strval($cmtx_page); $cmtx_exit_loop = true; //exit the loop to save on performance } if (cmtx_comment_has_reply($id)) { //get all of its replies $reply_q = cmtx_db_query("SELECT `id` FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `reply_to` = '{$id}' AND `is_approved` = '1' AND `page_id` = '{$cmtx_page_id}' ORDER BY `dated` ASC"); while ($replies = cmtx_db_fetch_assoc($reply_q)) { //while there are replies cmtx_calc_permalink($replies['id']); //re-call this function to calculate the reply AND any replies it may have } } }
echo CMTX_FIELD_LABEL_REPLY_TO; ?> </label> <select name="reply_to"> <option value="0"<?php if (!$reply_to) { echo " selected='selected'"; } ?> ><?php echo CMTX_FIELD_VALUE_NOBODY; ?> </option> <?php $comments = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `page_id` = '{$page_id_san}' AND `id` != '{$id_san}' ORDER BY `dated` DESC"); while ($comment = cmtx_db_fetch_assoc($comments)) { echo "<option value='" . $comment['id'] . "'"; if ($reply_to == $comment['id']) { echo " selected='selected'"; } echo ">" . $comment['name'] . " - " . date("jS M Y", strtotime($comment["dated"])) . " - " . date("g:ia", strtotime($comment["dated"])) . "</option>"; } ?> </select> <p /> <hr class="separator"/><br /> <label class='edit_comment'><?php echo CMTX_FIELD_LABEL_APPROVED;
</th> <th><?php echo CMTX_TABLE_PAGE_URL; ?> </th> <th><?php echo CMTX_TABLE_LAST_ACTIVITY; ?> </th> </tr> </thead> <tbody> <?php $viewers = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "viewers` ORDER BY `timestamp` DESC"); while ($viewer = cmtx_db_fetch_assoc($viewers)) { ?> <tr> <?php echo cmtx_get_viewer($viewer["user_agent"]); ?> <td><?php echo $viewer["ip_address"]; ?> </td> <td><?php echo $viewer["page_reference"]; ?> </td> <td><?php echo "<a href='" . $viewer["page_url"] . "' target='_blank'>" . $viewer["page_url"] . "</a>";
$issue = true; } } ?> </div> </div> <div class="dashboard_block"> <div class="dashboard_title"><?php echo CMTX_DASH_LAST_LOGIN; ?> </div> <div class="dashboard_content"> <?php $last_login_query = cmtx_db_query("SELECT `dated` FROM `" . $cmtx_mysql_table_prefix . "logins` ORDER BY `dated` ASC LIMIT 1"); $last_login_result = cmtx_db_fetch_assoc($last_login_query); $last_login = $last_login_result["dated"]; printf(CMTX_DASH_LAST_LOGIN_DETAILS, cmtx_format_date(date(CMTX_TIME_FORMAT, strtotime($last_login))), cmtx_format_date(date(CMTX_DATE_FORMAT, strtotime($last_login)))); ?> </div> </div> <div class="dashboard_block"> <div class="dashboard_title"><?php echo CMTX_DASH_STATISTICS; ?> </div> <div class="dashboard_content"> <?php $approve_comments = cmtx_db_num_rows(cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `is_approved` = '0'")); $flagged_comments = cmtx_db_num_rows(cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `reports` >= " . cmtx_setting('flag_min_per_comment')));
</th> <th><?php echo CMTX_TABLE_PAGE; ?> </th> <th><?php echo CMTX_TABLE_DATE_TIME; ?> </th> </tr> </thead> <tbody> <?php $access_log = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "access` ORDER BY `dated` DESC"); while ($access = cmtx_db_fetch_assoc($access_log)) { ?> <tr> <td><?php echo $access["username"]; ?> </td> <td><?php if (cmtx_setting('is_demo')) { echo "(<i>" . CMTX_TABLE_IP_HIDDEN . "</i>)"; } else { echo $access["ip_address"]; } ?> </td> <td><?php
function cmtx_setting($title) { //gets a setting global $cmtx_mysql_table_prefix; $result = cmtx_db_query("SELECT `value` FROM `" . $cmtx_mysql_table_prefix . "settings` WHERE `title` = '{$title}'"); $result = cmtx_db_fetch_assoc($result); return $result['value']; }
$comment_query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `id` = '{$id}'"); $comment_result = cmtx_db_fetch_assoc($comment_query); $page_id = $comment_result['page_id']; $page_query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "pages` WHERE `id` = '{$page_id}'"); $page_result = cmtx_db_fetch_assoc($page_query); $page_reference = cmtx_decode($page_result['reference']); $page_url = cmtx_decode($page_result['url']); $comment_url = cmtx_decode(cmtx_get_permalink($id, $page_result['url'])); //get the permalink of the comment $poster = cmtx_decode($comment_result['name']); $comment = cmtx_prepare_comment_for_email($comment_result['comment'], false); $admin_link = cmtx_url_encode_spaces(cmtx_setting('commentics_url') . cmtx_setting('admin_folder')) . '/'; //build admin panel link //convert email variables with actual variables $body = str_ireplace('[page reference]', $page_reference, $body); $body = str_ireplace('[page url]', $page_url, $body); $body = str_ireplace('[comment url]', $comment_url, $body); $body = str_ireplace('[poster]', $poster, $body); $body = str_ireplace('[comment]', $comment, $body); $body = str_ireplace('[admin link]', $admin_link, $body); $body = str_ireplace('[signature]', cmtx_setting('signature'), $body); //select administrators from database $admins = cmtx_db_query("SELECT `email` FROM `" . $cmtx_mysql_table_prefix . "admins` WHERE `receive_email_new_flag` = '1' AND `is_enabled` = '1'"); while ($admin = cmtx_db_fetch_assoc($admins)) { //while there are administrators $email = $admin['email']; //get administrator email address cmtx_email($email, null, cmtx_setting('admin_new_flag_subject'), $body, cmtx_setting('admin_new_flag_from_email'), cmtx_setting('admin_new_flag_from_name'), cmtx_setting('admin_new_flag_reply_to')); } } }