Example #1
0
										break;
							}
							$status_message=__('This comment is marked as %s.\nAre you sure you want to mark it as %s?', 'sk');
						?>
								<div class="row-actions">
								<span class='edit'><a href="<?php echo add_query_arg( array('paged'=>$page, 'mode' => 'edit', 'id' => $comment->id) );?>" class='edit'><?php _e('Edit', 'sk') ?></a></span>
								<?php if($comment->status!=SK_HAM) { ?><span> | <a href="<?php echo add_query_arg( array('paged'=>$page, 'mode_x' => 'set_ham_x', 'id' => $comment->id, 'tid' => $tid) ) ;?>" class="edit" onclick="javascript:check=confirm( '<?php printf($status_message, $act_message, $ham_message); ?>');if(check==false) return false;"><?php _e('Accept', 'sk'); ?></a>
									</span><?php } ?>
											<?php if($comment->status==SK_MOOT || $comment->status==SK_HAM) { ?><span> | <a href="<?php echo add_query_arg( array('paged'=>$page, 'mode_x' => 'set_black_x', 'id' => $comment->id, 'tid' => $tid) );?>" class="edit" onclick="javascript:check=confirm( '<?php printf($status_message, $act_message, $black_message); ?>');if(check==false) return false;"><?php _e('Reject', 'sk'); ?></a>
												</span><?php } ?>
														<?php if($comment->status==SK_MOOT || $comment->status==SK_HAM) { ?><span> | <a href="<?php echo add_query_arg( array('paged'=>$page, 'mode_x' => 'set_spam_x', 'id' => $comment->id, 'tid' => $tid ) );?>" class="edit" onclick="javascript:check=confirm( '<?php printf($status_message, $act_message, $spam_message); ?>');if(check==false) return false;"><?php _e('Spam', 'sk'); ?></a>
															</span><?php } ?>
																	<?php if($data->id!=$comment->id) { ?><span class='delete'> | <a href="<?php echo add_query_arg( array('paged'=>$page, 'mode_x' => 'delete_x', 'id' => $comment->id, 'tid' => $tid) ); ?>" class="delete" onclick="javascript:check=confirm( '<?php _e("Delete this Comment?",'sk')?>');if(check==false) return false;"><?php _e('Delete', 'sk') ?></a></span><?php } ?>
																			<span class='tracking'> | <a href="<?php echo add_query_arg( array( 'mode' => 'tracking', 'tid' => $comment->id) ); ?>" class="tracking"><?php _e('Tracking', 'sk') ?></a></span><?php
																					if($select==SK_BLACK) { ?>
																						<?php if($block_id=sk_is_blacklisted($comment->user_id)) { ?><span> | <a href="<?php echo add_query_arg( array('paged'=>$page, 'mode_x' => 'unlock_x', 'id' => $block_id, 'tid' => $tid) ); ?>" class="edit" onclick="javascript:check=confirm( '<?php _e("Are you sure you want to unlock this PC?",'sk')?>');if(check==false) return false;"><?php _e('Unlock PC', 'sk') ?></a></span><?php } else { ?>
																							<span> | <a href="<?php echo add_query_arg( array('paged'=>$page, 'mode_x' => 'lock_x', 'id' => $comment->id, 'tid' => $tid) ); ?>" class="edit" onclick="javascript:check=confirm( '<?php _e("Are you sure you want to lock this PC?",'sk')?>');if(check==false) return false;"><?php _e('Lock PC', 'sk') ?></a></span>
																									<?php } 
																					} ?>
																							</div>
					</td>
				</tr><?php 
				} ?>
			</tbody>
		</table>			
			
		<div class="tablenav"><?php 
			if ( $page_links ) { ?>
			<div class="tablenav-pages"><?php 
				$page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s', 'sk' ) . '</span>%s',
					number_format_i18n( $start ),
Example #2
0
/**
* Function to show the shoutbox. Can be used in the template files.
*
* @access private
*/
function sk_codeShoutbox($size = false)
{
    global $wpdb, $current_user;
    $options = get_option('sk_options');
    //Size
    if (!$size) {
        $size = $options['items'];
    }
    if (isset($options['replies'])) {
        sk_activate();
    }
    if (!is_numeric($size) || $size < 1) {
        $size = 5;
    }
    $sk_size = $size;
    //Our random number
    $rand = mt_rand(111111, 999999);
    $answer = "";
    //Create the nonce
    $nonce = wp_create_nonce('sk' . $rand);
    //Get current user
    get_currentuserinfo();
    /************** This is huge *******************/
    $sk_page = 1;
    $sk_for = false;
    $sk_id = $sk_for = false;
    if (isset($_GET['sk_id'])) {
        $sk_id = $_GET['sk_id'];
    }
    if ($sk_id) {
        $sk_page = sk_page_by_id($sk_id);
    }
    if (isset($_GET['sk_for'])) {
        $sk_for = $_GET['sk_for'];
    }
    if ($sk_for) {
        $sk_page = sk_page_by_id($sk_for);
    }
    $first_comments = sk_show_comments($size, $sk_page, false, $rand);
    $first_page_selector = sk_page_selector($size, $sk_page, $rand);
    $options = get_option('sk_options');
    $avatar = $options['avatar'];
    $req = sk_require_name_and_email();
    //Get maxchars
    $maxchars = 255;
    if (isset($options['maxchars'])) {
        $maxchars = $options['maxchars'];
    }
    //Update blacklist dates
    sk_blacklist_update();
    //Set name and email on cookie name
    $alias = "";
    $email = "";
    if ($_COOKIE['comment_author_' . COOKIEHASH]) {
        $alias = $_COOKIE['comment_author_' . COOKIEHASH];
        $email = $_COOKIE['comment_author_email_' . COOKIEHASH];
    }
    $anonymous_avatar = sk_plugin_url('/img/anonymous.jpg');
    $uri_sk = sk_plugin_url('/ajax/content.php');
    $uri_skadd = sk_plugin_url('/ajax/add_comment.php');
    $uri_img = sk_plugin_url('/img/loading.gif');
    $uri_out = wp_logout_url(get_permalink());
    if (is_home()) {
        $uri_out = wp_logout_url(get_option('home'));
    }
    $time = $options['refresh'] * 1000;
    $show_timer = "";
    if ($options['refresh'] > 0) {
        $show_timer = "\nsk_timer{$rand}();";
    }
    $ask_email = "";
    if ($req) {
        /*desc: This is a javascript alert message, use \\n for new line and \\' for apostrophe. */
        $ask_email = "if(!check_email(email)) {\r\n\t\t\talert('" . __("E-mail is required", "sk") . "');\r\n\t\t\treturn false;\r\n\t\t}";
    }
    $email_in_text = "";
    if ($options['alert_about_emails']) {
        /*desc: This is a javascript alert message, use \\n for new line and \\' for apostrophe. */
        $email_in_text = "if(email_intext ( text ) ) {\r\n\t\t\tcheck=confirm('" . __("To prevent identification theft, we recomend\\nthat you do not include e-mail adresses.\\nDo you want to continue?", "sk") . "');\r\n\t\t\tif(!check) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}";
    }
    $message = false;
    //Do we need moderation?
    $require_moderation = true;
    if ($options['moderation'] == SK_MODERATION_CONFIG) {
        if (!get_option('comment_moderation')) {
            $require_moderation = false;
        }
    }
    if ($options['moderation'] == SK_MODERATION_NO) {
        $require_moderation = false;
    }
    if (1 == $require_moderation && !current_user_can(SK_CAP)) {
        /*desc: This is a javascript alert message, use \\n for new line and \\' for apostrophe. */
        $message = __('Your message has been sent. Comments have\\nto be approved before posted.', 'sk');
    }
    if (sk_is_blacklisted()) {
        /*desc: This is a javascript alert message, use \\n for new line and \\' for apostrophe. */
        $message = __('Your message has been sent but this PC was blacklisted.\\nComments have to be approved before posted.', 'sk');
    }
    if ($message) {
        $message = "alert(\"{$message}\");\r\n\t\tthis.disabled=true;";
    }
    $form_button = "";
    $form_table = "<a name='sk_top'></a><table border='0' class='sk-table'>\r\n\t<tr><td width='20'></td><td width='100%'></td></tr>";
    $sk_count = sk_count(SK_HAM);
    $hidden = "<input type='hidden' id='sk_timer{$rand}' value=''/><input type='hidden' id='sk_count{$rand}' name='sk_count{$rand}' value='{$sk_count}' /><input type='hidden' id='sk_page{$rand}' name='sk_page{$rand}' value='{$sk_page}' /><input type='hidden' id='sk_size{$rand}' name='sk_size{$rand}' value='{$sk_size}' />";
    if (sk_only_registered_users() && $current_user->ID == 0) {
        $url = !empty($_SERVER['HTTPS']) ? "https://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] : "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
        $form_table .= "<tr>\r\n\t\t\t<td colspan='2' id='skwarning'>\r\n\t\t\t\t{$hidden}" . sprintf(__('You must be <a href="%s">signed in</a> to post a comment', 'sk'), wp_login_url($url)) . "\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table>";
    } else {
        if (sk_is_blacklisted()) {
            if (sk_can_not_accept_more_messages()) {
                $form_table .= "<tr>\r\n\t\t\t\t\t<td colspan='2'>" . __("This PC was blacklisted. At this time comments cannot be posted.", "sk") . "</td>\r\n\t\t\t\t<tr>";
            }
        }
        if ($current_user->ID == 0) {
            $form_table .= "<tr class='sk-rowname'>\r\n\t\t\t\t<td nowrap='nowrap'>" . __('Name', 'sk') . ":</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t<input class='sk-text' type='text' id='sk_alias{$rand}' name='sk_alias{$rand}' value='{$alias}'/>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr class='sk-rowemail'>\r\n\t\t\t\t<td nowrap='nowrap'>" . __('Email', 'sk') . ":</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t<input class='sk-text' type='text' id='sk_email{$rand}' name='sk_email{$rand}' value='{$email}'/>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>";
        }
        $form_table .= "<tr class='sk-for-nai' id='sk_for_tr{$rand}'>\r\n\t\t\t<td nowrap='nowrap'>" . __('For', 'sk') . ":</td>\r\n\t\t\t<td><span id='sk_for_name{$rand}'></span>&nbsp;<img src='" . sk_plugin_url('/img/clear.png') . "' align='top' border='0' alt='' onclick='for_delete{$rand}();' /><input id='sk_for_id{$rand}' name='sk_for_id{$rand}' type='hidden' size='5' value='0'/></td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td colspan='2' align='right'><textarea rows='0' cols='0' class='sk-area' name='sk_text{$rand}' id='sk_text{$rand}' onkeypress='\r\n\t\t\t\tvar key;\r\n\t\t\t\tif(window.event)\r\n\t\t\t\t\tkey = window.event.keyCode; //IE\r\n\t\t\t\telse\r\n\t\t\t\t\tkey = event.keyCode;\r\n\t\t\t\tif(this.value.length>{$maxchars}-1 &amp;&amp; !(key==8 || key==37 || key==38 || key==39 || key==40) )\r\n\t\t\t\treturn false;'></textarea></td>\r\n\t\t</tr>\r\n\t\t</table>";
        $sk_allowed = sk_allowed_messages();
        $submit = __('Submit', 'sk');
        $for = __('For', 'sk');
        $button = "<div class='sk-box-text'>";
        if ($current_user->ID == 0) {
            $button .= __('Mail will not be published', 'sk') . "<br/>";
            if ($req) {
                $button .= __("(but it's required)", "sk");
            } else {
                if ($avatar) {
                    $button .= __("(but it's used for avatar)", "sk");
                }
            }
        } else {
            $button .= sprintf(__('Logged in as %s', 'sk'), $current_user->display_name);
            $button .= "<br/><a href='{$uri_out}' title='" . __('Log out', 'sk') . "'>" . __('Log out', 'sk') . "</a>\r\n\t\t\t\t<input id='sk_alias{$rand}' name='sk_alias{$rand}' type='hidden' value='{$current_user->display_name}' />\r\n\t\t\t\t<input id='sk_email{$rand}' name='sk_email{$rand}' type='hidden' value='{$current_user->user_email}' />";
        }
        $button .= "</div>";
        $form_button = "<table class='sk-table'>\t\t\r\n\t\t\t<tr>\r\n\t\t\t\t<td colspan='2' class='sk-little'>\r\n\t\t\t\t\t<div class='sk-box-message'></div>\r\n\t\t\t\t\t<div class='sk-box-button'>\r\n\t\t\t\t\t\t{$hidden}<input type='button' class='sk-button sk-button-size' value='{$submit}' id='sk_button{$rand}' onclick='\r\n\t\t\t\t\t\tsk_enabled = document.getElementById(\"sk_enabled%rand%\").value;\r\n\t\t\t\t\t\tsk_allowed = document.getElementById(\"sk_allowed%rand%\").value;\r\n\t\t\t\t\t\tif(sk_enabled == 1 ) {\r\n\t\t\t\t\t\t\tthis.disabled = true;\r\n\t\t\t\t\t\t\tsk_pressButton{$rand}();%message%\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\talert(document.getElementById(\"sk_message%rand%\").value);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t'/>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t{$button}\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t</table>";
    }
    $have_for = "";
    if ($sk_for) {
        $have_for = "for_set{$rand}({$sk_for}, '" . sk_name_by_id($sk_for) . "');";
    }
    $lenght = __("The lenght of the message is bigger than the allowed size.", "sk");
    $chat = "false";
    $qa = "false";
    $sk_general = "%form_table%%form_button%<div id='sk_content%rand%'>%first_comments%\t%first_page_selector%</div>";
    switch ($options['layout']) {
        case SK_LAYOUT_CHAT:
            $sk_general = "<div id='sk_content%rand%'>%first_comments%%first_page_selector%</div>%form_table%%form_button%";
            $chat = "true";
            break;
        case SK_LAYOUT_QA:
            $qa = "true";
            break;
    }
    /******************* End of the hughe part where we are debuging now *************/
    $file = ABSPATH . "wp-content/plugins/schreikasten/templates/sk_widget.php";
    if ($fop = @fopen($file, 'r')) {
        $answer = null;
        while (!feof($fop)) {
            $answer .= fread($fop, 1024);
        }
        fclose($fop);
    }
    $blacklisted_pc = 'false';
    if (sk_is_blacklisted()) {
        $blacklisted_pc = 'true';
    }
    $answer = str_replace('%allowed%', sk_allowed_messages(), $answer);
    $answer = str_replace('%blocked_pc%', $blacklisted_pc, $answer);
    $answer = str_replace('%sk_general%', $sk_general, $answer);
    $answer = str_replace('%nonce%', $nonce, $answer);
    $answer = str_replace('%chat%', $chat, $answer);
    $answer = str_replace('%qa%', $qa, $answer);
    $answer = str_replace('%answer%', __('Answer', 'sk'), $answer);
    $answer = str_replace('%sk_id%', $sk_id, $answer);
    $answer = str_replace('%sk_page%', $sk_page, $answer);
    $answer = str_replace('%sk_for%', $sk_for, $answer);
    $answer = str_replace('%first_comments%', $first_comments, $answer);
    $answer = str_replace('%first_page_selector%', $first_page_selector, $answer);
    $answer = str_replace('%maxchars%', $maxchars, $answer);
    $answer = str_replace('%alias%', $alias, $answer);
    $answer = str_replace('%email%', $email, $answer);
    $answer = str_replace('%uri_sk%', $uri_sk, $answer);
    $answer = str_replace('%uri_skadd%', $uri_skadd, $answer);
    $answer = str_replace('%uri_img%', $uri_img, $answer);
    $answer = str_replace('%time%', $time, $answer);
    $answer = str_replace('%show_timer%', $show_timer, $answer);
    $answer = str_replace('%ask_email%', $ask_email, $answer);
    $answer = str_replace('%email_in_text%', $email_in_text, $answer);
    $answer = str_replace('%lenght%', $lenght, $answer);
    $answer = str_replace('%form_table%', $form_table, $answer);
    $answer = str_replace('%form_button%', $form_button, $answer);
    $answer = str_replace('%message%', $message, $answer);
    $answer = str_replace('%submit%', $submit, $answer);
    $answer = str_replace('%button%', $button, $answer);
    $answer = str_replace('%have_for%', $have_for, $answer);
    $answer = str_replace('%for%', $for, $answer);
    $answer = str_replace('%rand%', $rand, $answer);
    return $answer;
}
Example #3
0
        ?>
');if(check==false) return false;"><?php 
        _e('Delete', 'sk');
        ?>
</a></span>
							<span class='tracking'> | <a href="<?php 
        echo add_query_arg(array('text' => $text, 'mode' => 'tracking', 'paged' => 1, 'tid' => $comment->id));
        ?>
" class="tracking"><?php 
        _e('Tracking', 'sk');
        ?>
</a></span><?php 
        if ($select == SK_BLACK) {
            ?>
							<?php 
            if ($block_id = sk_is_blacklisted($comment->user_id)) {
                ?>
<span> | <a href="<?php 
                echo add_query_arg(array('paged' => $page, 'text' => $text, 'mode_x' => 'unlock_x', 'id' => $block_id));
                ?>
" class="edit" onclick="javascript:check=confirm( '<?php 
                _e("Are you sure you want to unlock this PC?", 'sk');
                ?>
');if(check==false) return false;"><?php 
                _e('Unlock PC', 'sk');
                ?>
</a></span><?php 
            } else {
                ?>
							<span> | <a href="<?php 
                echo add_query_arg(array('paged' => $page, 'text' => $text, 'mode_x' => 'lock_x', 'id' => $comment->id));