Installing existing site Navigation into blog script? - css

You will probably consider me a spoil sport for not working with wordpress for this purpose.
However I just want to use a flatfile blog system for a small site. I am using ozjournals-3.2 blog system.
I am seeking to install a header and a site navigation at the top of the blog page so that it coordinates with the existing site. I have had some success with the header but the navigation is making me struggle! I want navigation to position underneath the header as attached image demonstrates. Currently the task is presenting two problems that i need to find a work around for:
Nav will not center on page but keeps left even when I margin:auto; ?
Cannot get it to position at the foot of the header image!
My nav css is as follows:
.nav {
width: 950px;
float: left;
margin: 0 0 1em 0;
padding: 0;
background-color: #3b3b44; /*Navigation Active Background*/
border-top: 1px solid #ccf;
border-bottom: 1px solid #ccf;}
.nav ol {
list-style: none;
width: 950px;
margin: 0 auto;
padding: 0; }
.nav li {
float: left; }
.nav li a {
display: block;
padding: 2px 20px;
text-decoration: none;
font-family: Helvetica, arial, sans-serif;
font-size: 16px;
font-weight: bold;
color: #fff; /*Active Text Color*/
border-right: 1px solid #ccf; }
.nav li:first-child a {
border-left: 0px solid #ccf; }
.nav li a:hover {
color: #000; /*Active Hover Color*/
background-color: #8db3ff; } /*Navigation Hover Background*/
#header {
height: 185px;
margin-top: 15px;
background: url(zitemplateChange.jpg);
border-bottom: 30px solid #cc0; /*showing where I want navigation to position*/
}
and the index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="themes/default/zitemplateChange.css" type="text/css" media="screen" />
</head>
<body>
<div class="nav">
<ol>
<li>Home</li>
<li>About</li>
<li>Book Preview</li>
<li>Guestbook</li> <li>Tell a Friend</li>
<li>Contact</li>
<li>Support</li>
</ol>
</div>
<?php
/********************************************************************************************************
OZJournals Version 3.2 released by Online Zone <https://sites.google.com/site/onlinezonejournals>
Copyright (C) 2006-2011 Elaine Aquino <elaineaqs#gmail.com>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your option)
any later version.
********************************************************************************************************/
# For the session
ob_start();
# For function file inclusion
include "functions.php";
# For language file inclusion
$langfile = file_get_contents("lang/index.php");
$eachlang = explode("\t", $langfile);
$oklang = $eachlang[1];
$uselang = file_get_contents("lang/$oklang.php");
$lang = explode("\n", $uselang);
# Clean the GET variablezzz
$clean['show'] = string_filter_nospace($_GET['show']);
$clean['id'] = int_filter($_GET['id']);
$clean['p'] = string_filter_nospace($_GET['p']);
$clean['f'] = int_filter($_GET['f']);
$clean['pn'] = int_filter($_GET['pn']);
# Printer-friendly view
if($clean['show'] == "printpreview") {
if(isset($clean['id'])) {
$id = super_filter($clean['id']);
if(file_exists("$datadirectory/$id.php")) {
$pfile = file_get_contents("$datadirectory/$id.php");
$what = explode("\t", $pfile);
die("<html><head><title>$what[1]</title></head><body onload=\"window.print()\"><h1>$what[1]</h1><h5>Posted by $what[4] [ $what[5] ]<br />Date: ".date($timeformat, $what[2])."<br />Category: $what[6]</h5><p>$what[3]</p><h5>Source URL: <script>document.writeln(self.location)</script></h5></body></html>");
}
}
}
# RSS view
if($clean['show'] == "rss") {
die(generaterss());
}
# Theme Picker
$themefile = file_get_contents("themes/index.php");
$eachtheme = explode("\t", $themefile);
$oktheme = $eachtheme[1];
include "themes/$oktheme/advanced.php";
$header = implode(" ", file("themes/$oktheme/header.php"));
$header = str_replace("{blogtitle}", $blogtitle, $header);
$header = str_replace("{subtitle}", subtitle($clean["show"], $clean["p"], $clean["f"]), $header);
$header = str_replace("{metakeywords}", $metakeywords, $header);
$header = str_replace("{metadescription}", $metadescription, $header);
$header = str_replace("{author}", $auth, $header);
//$header = str_replace("{header}", $blogheader, $header);
$header = str_replace("{mainlinks}", $mainlinks, $header);
$header = str_replace("{add-ons}", $addons, $header);
$header = str_replace("{search}", $search, $header);
$header = str_replace("{categories}", $categories, $header);
$header = str_replace("{archives}", $archives, $header);
$header = str_replace("{miscellaneous}", $miscellaneous, $header);
$header = str_replace("{adminmenu}", "", $header);
$header = str_replace("{usermenu}", "", $header);
$header = str_replace("{footer}", $blogfooter, $header);
echo $header;
# Signing out Initial
if($clean['show'] == "signout") {
session_start();
session_destroy();
header("Location: index.php?show=signout2");
}
# Signing out Part 2
if($clean['show'] == "signout2") {
adminpanel("$lang[1]<br /><br />");
}
# Sign-in
elseif($clean['show'] == "signin") {
echo "<h3>$lang[2]</h3>\n";
echo "<form name=\"e\" method=\"post\" action=\"index.php?show=signinok\">\n";
echo "<table border=\"0\">\n";
echo "<tr><td width=\"40%\">$lang[3]</td>";
echo "<td width=\"60%\"><input type=\"radio\" name=\"mode\" value=\"admin\" checked=\"checked\" /> $lang[4] \n";
echo "<input type=\"radio\" name=\"mode\" value=\"user\"> $lang[5] </td></tr>\n";
echo "<tr><td width=\"40%\"> $lang[6] </td>";
echo "<td width=\"60%\"><input type=\"text\" name=\"username\" /></td></tr>\n";
echo "<tr><td width=\"40%\"> $lang[7] </td>";
echo "<td width=\"60%\"><input type=\"password\" name=\"password\" /></td></tr>\n";
echo "</table><br />\n";
echo "<button type=\"submit\"> $lang[8] </button> \n";
echo "<button type=\"reset\"> $lang[9] </button> \n";
echo "</form><br /><br />\n";
}
# Blog
elseif($clean['show'] == "" OR $clean['show'] == "main" OR $clean['show'] == "index") {
$fortitle=$tagline;
$pn = $clean['pn'];
if($total > 0) {
if($total >= $displaynumber) {
if($pn == "") {
$pn = $total;
echo display ($displaynumber, $datadirectory, $total, $pn);
echo "<p> </p>\n";
}
else {
$pn = $clean['pn'];
echo display ($displaynumber, $datadirectory, $total, $pn);
echo "<p> </p>\n";
}
}
else {
echo display ($displaynumber, $datadirectory, $total, $pn);
echo "<p> </p>\n";
}
}
else {
blogviewer("$lang[10]<br />\n\n", $blogtitle);
}
}
# Pages
elseif($clean['show'] == "pages") {
$totalpages = countfiles("pages");
$currentpage = super_filter($clean['f']);
if(file_exists("pages/$currentpage.php")) {
$cc = file_get_contents("pages/$currentpage.php");
$eachcc = explode("\t", $cc);
if($totalpages > 0) {
echo "<h3>".$eachcc[1]."</h3>\n";
echo "<h5>$lang[12] ".$eachcc[4]." $lang[11] ".date($timeformat, $eachcc[2])." </h5>\n";
echo "<p> ".stripslashes($eachcc[3])." </p>\n\n";
}
else {
blogviewer("$lang[13]<br />\n\n", $blogtitle);
}
}
else {
blogviewer("$lang[81]<br />\n\n", $lang[80]);
}
}
# Complete archives
elseif($clean['show'] == "archives") {
if($total > 0) {
$theyear = int_filter($_GET['y']);
$themonth = $_GET['m'];
$thecategory = $_GET['c'];
$p = $clean['p'];
if($p == "main") {
echo adisplayall ($datadirectory, $total);
}
else {
if(isset($theyear) AND isset($themonth)) {
echo adisplaymonthandyear ($datadirectory, $total, $themonth, $theyear);
}
elseif(isset($thecategory)) {
echo adisplaycategory ($datadirectory, $total, $thecategory);
}
elseif(file_exists("$datadirectory/$p.php")) {
for($e=1; $e <= $total; $e++) {
if($p == $e) {
echo displayeach($datadirectory, $p);
}
}
}
else {
blogviewer("$lang[81]<br />\n\n", $lang[80]);
}
}
}
else {
blogviewer("$lang[14]<br />\n\n", $blogtitle);
}
}
# Comment poster
elseif($clean['show'] == "postcomments") {
$date = date_and_time($timezone, "", "", "", "", "", "", "");
$name = string_filter($_POST['vname']);
$vemail = string_filter_email($_POST['vemail']);
$location = string_filter_url($_POST['vlocation']);
$comment = string_filter_comment($_POST['vcomment']);
$verify = string_filter_nospace($_POST['verify']);
$p = $clean['p'];
// (1) Block if there's no name, email and comment
if($name !== "" && $vemail !== "" && $comment !== "") {
// (2) Block if it doesn't have a valid email addie
if(ValidEmail($vemail)) {
$filecont = file_get_contents("comments/$p.php");
if($location == "") {
$all = "<?php /*\t".str_replace("\r\n", "<br />", $comment)."\t".$name."\t".$date."\tnone\t".$vemail."\t*/ ?>\n";
}
else {
if(substr($location, 0, 7)!=="http://") {
$all = "<?php /*\t".str_replace("\r\n", "<br />", $comment)."\t".$name."\t".$date."\thttp://".$location."\t".$vemail."\t*/ ?>\n";
}
else {
$all = "<?php /*\t".str_replace("\r\n", "<br />", $comment)."\t".$name."\t".$date."\t".$location."\t".$vemail."\t*/ ?>\n";
}
}
// (3) Block if the referrer is different from blog address in settings
if($_SERVER["HTTP_REFERER"]=="$blog/index.php?show=archives&p=$p") {
// (4) Verify session first before posting the comment.
if($verify!=="") {
session_start();
if($verify==$_SESSION['verify']) {
// (5) Block comment if it contains bad words
if(!strpos($comment, $badwords)) {
// (6) Do not post comment if the exact same comment and name already exists.
if(!preg_match("/\\t$comment\\t$name/", file_get_contents("comments/$p.php"))) {
$handle = fopen ("comments/$p.php", "a+");
fwrite ($handle, $all);
fclose ($handle);
// Email after comment has been posted. Negative (-) if not emailed.
if($emailcomments!=="yes") {
blogviewer($name.", $lang[15]<br />$lang[16]. -<br />\n\n", $blogtitle);
}
else {
$comment = str_replace("<br />", "\r\n", $comment);
if(mail($vemail, $lang[84], "$lang[85] $user,\r\n\r\n$name ($vemail) $lang[86] ($blogtitle). $lang[87]:\r\n\r\n------------\r\n\r\n$comment\r\n\r\n------------\r\n\r\n$lang[88]:\r\n$blog/admin.php?show=editdeletecomments\r\n\r\n$lang[89]\r\n\r\n$lang[90]", "From: $blogtitle <$email>")) {
blogviewer($name.", $lang[15]<br />$lang[16]. +<br />\n\n", $blogtitle);
}
else {
blogviewer($name.", $lang[15]<br />$lang[16]. -<br />\n\n", $blogtitle);
}
}
}
else {
blogviewer("$name, $lang[92]<br />$lang[21]<br />\n", $blogtitle);
}
}
else {
blogviewer("$name, $lang[93]<br />$lang[21]<br />\n", $blogtitle);
}
}
else {
blogviewer("$lang[17]<br />$lang[21]<br />\n", $blogtitle);
$session_degenerate_id;
}
}
else {
blogviewer("$lang[18]<br />$lang[21]<br />\n", $blogtitle);
$session_degenerate_id;
}
}
else {
blogviewer("$lang[19]<br />$lang[21]<br />\n", $blogtitle);
$session_degenerate_id;
}
}
else {
blogviewer("$lang[20]<br /><br />$lang[21]<br />\n", "$blogtitle");
$session_degenerate_id;
}
}
else {
blogviewer("$lang[22] <b>$lang[23]</b>, <b>$lang[24]</b>, $lang[25] <b>$lang[26]</b>.<br /> $lang[27]<br /><br />$lang[21]", "$blogtitle");
}
}
# Signed in
elseif($clean['show'] == "signinok") {
$mode = string_filter_nospace($_POST['mode']);
if($_POST['username'] !== '' AND $_POST['password'] !== '') {
# Administrator Mode
if($mode == "admin") {
$newsessionuser = md5($_POST['username'].mktime());
$newsessionpass = md5($_POST['password'].mktime());
if($newsessionuser == md5($user.mktime()) AND $newsessionpass == md5($pass.mktime())) {
session_destroy();
session_start();
$_SESSION['user'] = $user;
$_SESSION['mode'] = "admin";
adminpanel("$lang[28], <b>$auth</b>! <br /><br /> $lang[29]<br />$lang[30] $lang[31].<br />\n\n");
session_write_close();
}
else {
adminpanel ("$lang[32]<br />$lang[33] $lang[34].<br />\n\n");
$session_degenerate_id;
}
}
# User Mode
elseif($mode == "user") {
$usersdb = file_get_contents("usersdb.php");
$ida = explode($_POST['username']."\t", $usersdb);
$idb = str_replace("<?php /*\t", "", $ida[0]);
$idc = $idb - 1;
$passa = explode("\n", $usersdb);
$passb = explode("\t", $passa[$idc]);
$passc = $passb[4];
if(strpos($usersdb, $_POST['username']) !== FALSE AND $passc == md5($_POST['password'])) {
session_destroy();
session_start();
$_SESSION['user'] = $_POST['username'];
$_SESSION['mode'] = "user";
blogviewer("$lang[28], <b>".$_SESSION['user']."</b>! <br /><br /> $lang[29]<br /> $lang[30] $lang[35].<br />\n\n", "User's Panel");
session_write_close();
}
else {
blogviewer("$lang[32]<br />$lang[33] $lang[34].<br />\n\n", "User's Panel");
$session_degenerate_id;
}
}
# Anything else is invalid
else {
blogviewer("$lang[83] <br />\n\n", $lang[82]);
}
}
else {
blogviewer("$lang[36] <br />$lang[33] $lang[34].<br />\n\n", $lang[82]);
}
}
# Load 404 Page
else {
blogviewer("$lang[81]<br />\n\n", $lang[80]);
}
# Simple statistics
if(file_exists("counter.php")) {
$counterfile = file_get_contents("counter.php");
$counterdata = explode("|", $counterfile);
$countermagic = count($counterdata);
$h = fopen("counter.php", "a+");
fwrite($h, $_SERVER['REMOTE_ADDR']."|");
}
# Footer
$footer = implode(" ", file("themes/$oktheme/footer.php"));
$footer = str_replace("{blogtitle}", $blogtitle, $footer);
$header = str_replace("{subtitle}", subtitle($clean["show"], $clean["p"], $clean["f"]), $header);
$footer = str_replace("{metakeywords}", $metakeywords, $footer);
$footer = str_replace("{metadescription}", $metadescription, $footer);
$header = str_replace("{author}", $auth, $header);
$footer = str_replace("{header}", $blogheader, $footer);
$footer = str_replace("{mainlinks}", $mainlinks, $footer);
$footer = str_replace("{add-ons}", $addons, $footer);
$footer = str_replace("{search}", $search, $footer);
$footer = str_replace("{categories}", $categories, $footer);
$footer = str_replace("{archives}", $archives, $footer);
$footer = str_replace("{miscellaneous}", $miscellaneous, $footer);
$footer = str_replace("{adminmenu}", "", $footer);
$footer = str_replace("{usermenu}", "", $footer);
$footer = str_replace("{footer}", $blogfooter, $footer);
echo $footer;
# End flush for the session
ob_end_flush();
?>
All help appreciated.

Here's a fiddle with what I think is working.
Your problem was you had the div with a width of 950px, and inside that was a ol of 950px. When there's no room for a margin, auto will pick 0.
To fix this, remove the float from the outside div and set it to width:100%;. Then put all the background stuff in the ol. Finally put something at the end of the ol with clear: both;. A <br /> is the most common choice.
UPDATE:
Here's a full screen preview, in case the regular fiddle doesn't give you 950px.

Related

Gallery metabox doesn´t show new images / save changes since Wordpress 6.0

I use the code below to display images in posts. It basically works, but changes made via "Add Image" are no longer saved since WP 6.0 or 6.1.
The manual variant via the "post_banner_image" field below by entering the image ID still works.
here a front-end screenshot
<?php
// Add Meta Box to post
add_action( 'add_meta_boxes', 'multi_media_uploader_meta_box' );
function multi_media_uploader_meta_box() {
add_meta_box( 'my-post-box', 'Media Field', 'multi_media_uploader_meta_box_func', 'post', 'normal', 'high' );
}
function multi_media_uploader_meta_box_func($post) {
$banner_img = get_post_meta($post->ID,'post_banner_img', true);
?>
<style type="text/css">
.multi-upload-medias ul li .delete-img { position: absolute; right: 3px; top: 2px; background: aliceblue; border-radius: 50%; cursor: pointer; font-size: 14px; line-height: 20px; color: red; }
.multi-upload-medias ul li { width: 120px; display: inline-block; vertical-align: middle; margin: 5px; position: relative; }
.multi-upload-medias ul li img { width: 100%; }
</style>
<table cellspacing="10" cellpadding="10">
<tr>
<td>Banner Image</td>
<td>
<?php echo multi_media_uploader_field( 'post_banner_img', $banner_img ); ?>
</td>
</tr>
</table>
<script type="text/javascript">
jQuery(function($) {
$('body').on('click', '.wc_multi_upload_image_button', function(e) {
e.preventDefault();
var button = $(this),
custom_uploader = wp.media({
title: 'Insert image',
button: { text: 'Use this image' },
multiple: true
}).on('select', function() {
var attech_ids = '';
attachments
var attachments = custom_uploader.state().get('selection'),
attachment_ids = new Array(),
i = 0;
attachments.each(function(attachment) {
attachment_ids[i] = attachment['id'];
attech_ids += ',' + attachment['id'];
if (attachment.attributes.type == 'image') {
$(button).siblings('ul').append('<li data-attechment-id="' + attachment['id'] + '"><img class="true_pre_image" src="' + attachment.attributes.url + '" /><i class=" dashicons dashicons-no delete-img"></i></li>');
} else {
$(button).siblings('ul').append('<li data-attechment-id="' + attachment['id'] + '"><img class="true_pre_image" src="' + attachment.attributes.icon + '" /><i class=" dashicons dashicons-no delete-img"></i></li>');
}
i++;
});
var ids = $(button).siblings('.attechments-ids').attr('value');
if (ids) {
var ids = ids + attech_ids;
$(button).siblings('.attechments-ids').attr('value', ids);
} else {
$(button).siblings('.attechments-ids').attr('value', attachment_ids);
}
$(button).siblings('.wc_multi_remove_image_button').show();
})
.open();
});
$('body').on('click', '.wc_multi_remove_image_button', function() {
$(this).hide().prev().val('').prev().addClass('button').html('Add Media');
$(this).parent().find('ul').empty();
return false;
});
});
jQuery(document).ready(function() {
jQuery(document).on('click', '.multi-upload-medias ul li i.delete-img', function() {
var ids = [];
var this_c = jQuery(this);
jQuery(this).parent().remove();
jQuery('.multi-upload-medias ul li').each(function() {
ids.push(jQuery(this).attr('data-attechment-id'));
});
jQuery('.multi-upload-medias').find('input[type="hidden"]').attr('value', ids);
});
})
</script>
<?php
}
function multi_media_uploader_field($name, $value = '') {
$image = '">Add Media';
$image_str = '';
$image_size = 'full';
$display = 'none';
$value = explode(',', $value);
if (!empty($value)) {
foreach ($value as $values) {
if ($image_attributes = wp_get_attachment_image_src($values, $image_size)) {
$image_str .= '<li data-attechment-id=' . $values . '><img src="' . $image_attributes[0] . '" /><i class="dashicons dashicons-no delete-img"></i></li>';
}
}
}
if($image_str){
$display = 'inline-block';
}
return '<div class="multi-upload-medias"><ul>' . $image_str . '</ul>Remove media</div>';
}
// Save Meta Box values.
add_action( 'save_post', 'wc_meta_box_save' );
function wc_meta_box_save( $post_id ) {
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
if( !current_user_can( 'edit_post' ) ){
return;
}
if( isset( $_POST['post_banner_img'] ) ){
update_post_meta( $post_id, 'post_banner_img', $_POST['post_banner_img'] );
}
}
?>
Can someone help me to get the other part working again?
current_user_can('edit_post') is no longer valid in WordPress 6.1. Here's the relevant core trac ticket.
You must now use one of these formats:
current_user_can( 'edit_posts' );
current_user_can( 'edit_post', $post->ID );
current_user_can( 'edit_post_meta', $post->ID, $meta_key );

Save dark mode in php cookies

I worked on a simple little code for black mode
I would just like to store the theme for the user in cookies for x time
My Dark Theme in css :
body {
padding: 0px;
color: black;
font-size: 25px;
background-color: white;
}
.dark-mode .mainSection {
background-color: black;
color: white;
padding: 600px;
padding-top: 470px;
}
Html
<div id="dark-mode">
<li><font size="2">
<a class="nav-link" onclick="myFunction()">Dark Mode</font
</li>
</div>
Javascript :
function myFunction() {
var element = document.body;
element.classList.toggle("dark-mode");
}
Thank you
Simply set the cookie using javascript, and the next time the client makes the request to server, the cookies will be send along with it. The below code should work
function createCookie(name, value, timeInSeconds) {
var date = new Date();
date.setTime(date.getTime()+(timeInSeconds*1000));
var expires = "; expires="+date.toGMTString();
document.cookie = name+"="+value+expires+"; path=/";
}
function getCookie(cname) {
let name = cname + "=";
let decodedCookie = decodeURIComponent(document.cookie);
let ca = decodedCookie.split(';');
for(let i = 0; i <ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
function myFunction() {
var element = document.body;
const isDarkModeOn = element.classList.toggle("dark-mode");
createCookie("isDarkModeOn", isDarkMode.toString(), 60 * 60 * 24); // 1 day expiry date
}
window.onload = function () {
const isDarkModeOn = getCookie("isDarkModeOn");
if(isDarkModeOn === "true") document.body.classList.add("dark-mode");
}
After that simply check the cookie in PHP,
<?php
$isDarkModeOn = $_COOKIE["isDarkModeOn"] === "true";
if($isDarkModeOn) {
echo "Dark Mode is on";
}
?>

How to implement CSS to powershell conver to html Output?

I have found interesting code that highlights a rows in table if the output is not desired
Source - https://www.youtube.com/watch?v=QdK3qM5jnYw&feature=youtu.be
$headLinkcheck += #'
<style>
body
{
background-color:white;
font-family:Arial;
font-size:8pt;
}
td,th
{
border:1px solid black;
border-collapse:collapse;
}
th
{
color:white;
background-color:black;
}
table, tr, td, th {padding:5px; margin: 0px;}
table {margin-left:50px;width: 80%;height:35%}
.danger {background-color:yellow;font-weight:bold}
.warn {background-color:blue}
</style>
'#
Ok now i have code that checks webistes and their status
function GetSiteStatus(){
[CmdletBinding()]
param(
[Parameter(ValueFromPipeline)]
[hashtable]$WebSiteInfo
)
process{
$Response = New-Object System.Collections.ArrayList
$WebSiteInfo.GetEnumerator() | %{
$Item = $_
try{
$status = Invoke-WebRequest -Uri $_.Value | %{
if(#('404','503','403') -match $_.StatusCode){
"$($Item.Key) The Site may be down, please check. - status is $($_.StatusCode)"
}else{
"OK"
}
}
$Response.Add([PSCustomObject]#{"Name"= $Item.Key; "Value"=$Item.Value; "Status"=$Status; "Link"=$($Item.value)}) | out-null
}catch{
$Status = "$($Item.Key), $_."
$Response.Add([PSCustomObject]#{"Name"= $Item.Key; "Value"=$Item.Value; "Status"=$Status; "Link"=$($Item.value)}) | out-null
}
}
return $Response
}
}
$html_url1 = #{
"Calendar" = "http:/";
} | GetSiteStatus | ConvertTo-Html -Head $headLinkcheck -Property Name,Value,Status,#{Label="Link";Expression={"<a href='$($_.Value)'>$($_.Name)</a>"}}
Add-Type -AssemblyName System.Web
[System.Web.HttpUtility]::HtmlDecode($html_url) | Out-File "\\servertest\xpbuild$\IT\Level0\scresult\servicecheck$global:servicecheckdate.htm" -Append # have to use it to creates clickable links
Now the last piece is second part of code which i found ,that checks each line in rows -theorically
[array]$html_url += $html_url1 i quess this might help code below to read values
[xml]$html = $html_url | ConvertTo-Html -Fragment
for ($i = 1; $i -le $html.table.tr.Count-1;$i++){
$class = $html.CreateAttribute("class")
if(($html.table.tr[$i].td[-1]) -ne "OK"){
$class.Value = "danger"
$html.table.tr[$i].attributes.append($class) | Out-Null
}
}
$body += #"
$($html.innerxml)
"#
Now the problem with this is i am not sure how to implement this last part to my code
I got variable- $html_url1 that contains all needed values from my function that checks webistes.
I am not sure how to add this piece - should I add it to my $html_url1 pipe? I tried and it fails. Can you suggest hopw to implement this ?
You can always just make the page from scratch and build whatever you want from there an example
$Sites = #{
"Google"="http://google.com";
"ErrorTest"="I Am Fake";
"Yahoo" = "http://Yahoo.com";
}
$OutFile = "C:\Test\Test.htm"
function GetSiteStatus(){
[CmdletBinding()]
param(
[Parameter(ValueFromPipeline)]
[hashtable]$WebSiteInfo
)
process{
$WebSiteInfo.GetEnumerator() | %{
$Item = $_
$Type
try{
$status = Invoke-WebRequest -Uri $_.Value | %{
if(#('404','503','403') -match $_.StatusCode){
"$($Item.Key) The Site may be down, please check. - status is $($_.StatusCode)"
$Type = "Warning"
}else{
"OK"
$Type = "Good"
}
}
return [PSCustomObject]#{"Name"= $Item.Key; "Value"=$Item.Value; "Status"=$Status; "Link"=$($Item.value); "Type"=$Type}
}catch{
$Type = "Error"
$Status = "$($Item.Key), $_."
return [PSCustomObject]#{"Name"= $Item.Key; "Value"=$Item.Value; "Status"=$Status; "Link"=$($Item.value); "Type"=$Type}
}
}
}
}
$HTML = #"
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
body{
background-color:white;
font-family:Arial;
font-size:8pt;
}
td,th{
border:1px solid black;
border-collapse:collapse;
}
th{
color:white;
background-color:black;
}
table, tr, td, th {
padding:5px;
margin: 0px;
}
table {
margin-left:50px;
width: 80%;
height:35%
}
.Warning {
background-color:yellow;
font-weight:bold
}
.Error {
background-color:#d9534f;
color:#ffffff;
}
</style>
</head>
<body>
<table>
<colgroup>
<col>
<col>
<col>
<col>
</colgroup>
<tbody>
<tr>
<th>Name</th>
<th>Value</th>
<th>Status</th>
<th>Link</th>
</tr>
$($Sites | GetSiteStatus | %{
$item = $_
switch($_.Type){
"Good" {
"<tr class='Good'><td>$($item.Name)</td><td>$($item.Value)</td><td>$($item.Status)</td><td><a href='$($item.Value)'>$($item.Name)</a></td></tr>"
}
"Warning" {
"<tr class='Warning'><td>$($item.Name)</td><td>$($item.Value)</td><td>$($item.Status)</td><td><a href='$($item.Value)'>$($_item.Name)</a></td></tr>"
}
"Error" {
"<tr class='Error'><td>$($item.Name)</td><td>$($item.Value)</td><td>$($item.Status)</td><td><a href='$($item.Value)'>$($item.Name)</a></td></tr>"
}
}
})
</tbody>
</table>
</body>
</html>
"# | out-file $OutFile

CSS 'bottom' position not working in Firefox only

I'm attempting to position these icons to the bottom left of my page using CSS to align them. It works perfectly in all browser but Firefox. I've tried many things but cannot get it to work. You can check out the fiddle script and though it looks bad, you can see the icons are in fact positioned in the correct spot. When you load the actual webpage in Firefox, you can see the icons are actually more in the middle of the page. Can anyone tell me what's going on? I've tried rearranging the code many different ways and changing the position field but to no avail. Thanks
<!DOCTYPE html>
<html lang="en">
<head>
<!--Blacklist-->
<?php
$file = file('blacklist.txt');
foreach ($file as $line)
{
if ($_SERVER['REMOTE_ADDR'] == $line) {
die;
}
}
?>
<!--IP Logger-->
<?php
if (getenv("REMOTE_ADDR") != "192.168.1.1")
{
$filename = "iplog.txt" ;
$file = file($filename);
$file = array_unique($file);
$fd = fopen ($filename , "r");
$fstring = fread ($fd , filesize ($filename)) ;
fclose($fd);
$fd = fopen ($filename , "w");
$fcounted = $fstring."\n".getenv("REMOTE_ADDR");
$fout= fwrite ($fd , $fcounted );
fclose($fd);
}
?>
<!--Hit Counter-->
<?php
if (getenv("REMOTE_ADDR") != "192.168.1.1")
{
$datei = fopen("counter.txt","r");
$count = fgets($datei, 1000);
fclose($datei);
$count=$count + 1 ;
$datei = fopen("counter.txt","w");
fwrite($datei, $count);
fclose($datei);
}
?>
<title>Endure Box</title>
<link rel="icon" type="image/ico" href="/images/favicon.ico">
<meta charset="UTF-8">
<meta name="author" content="">
<meta name="description" content="">
<meta name="keywords" content="">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="js/jquery.interactive_bg.js"></script>
<script type="text/javascript" language="javascript" src="tooltip/tooltipscript.js"></script>
<link rel="stylesheet" href="tooltip/tooltipstyle.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<!--Disable Right Clicks-->
<script language="javascript">
document.onmousedown = disableclick;
function disableclick(event)
{
if (event.button == 2)
{
return false;
}
}
</script>
<!--View-->
<script type="text/javascript">
$(document).ready(function(){
$('#Page').fadeIn(500).removeClass('hidden');
resize();
});
window.onresize = function(event) {
resize();
};
function resize(){
if ($(window).width() < 800)
{
$("#Page").removeClass("Normal");
$("#Page").addClass("Small");
$("#IconBar").removeClass("Normal");
$("#IconBar").addClass("Small");
}
if ($(window).width() > 800)
{
$("#Page").removeClass("Small");
$("#Page").addClass("Normal");
$("#IconBar").removeClass("Small");
$("#IconBar").addClass("Normal");
}
}
</script>
<!--Animations-->
<script type="text/javascript">
$(document).ready(function(){
$("#Page").animate({opacity: 1}, 800);
$("#IconBar").animate({opacity: 1}, 850);
$("#hid").change(function() {
if(document.getElementById("hid").value)
{
$('#Form').fadeIn(500).removeClass('hidden');
$('#upload_button').removeClass('hidden');
$("#upload_button").animate({opacity: 1}, 400);
}
else
{
$('#Form').fadeOut(500).addClass('hidden');
$('#upload_button').addClass('hidden');
$("#upload_button").animate({opacity: 0}, 0);
}
});
$(".Box").mouseover(function(){
$(this).stop().animate({opacity: .95, height: 235, width: 235}, 150);
$("#OpenText").stop().animate({opacity: .85}, 400);
});
$(".Box").mouseout(function(){
$(this).stop().animate({opacity: .85, height: 220, width: 220}, 150);
$("#OpenText").stop().animate({opacity: 0}, 400);
});
$(".Icons").hover(function(){
$(this).animate({opacity: 1, height: 35, width: 35}, 100);
}, function(){
$(this).animate({opacity: .95, height: 32, width: 32}, 100);
});
});
function uploadstatus(uploading){
if (uploading)
{
$("#choosefile").addClass("hidden");
$("#Loading").removeClass("hidden");
$("#upload_button").addClass("hidden");
$("#upload_button").animate({opacity: 1}, 350);
$("#Form").animate({opacity: 0}, 0);
}
else
{
$("#Loading").addClass("hidden");
$("#upload_button").animate({opacity: 0}, 0);
$("#upload_button").removeClass("hidden");
$("#choosefile").removeClass("hidden");
}
}
</script>
<!--Body-->
<body oncontextmenu="return false">
<!--Input Parser-->
<script language="javascript">
String.prototype.ucfirst = function()
{
return this.charAt(0).toUpperCase() + this.substr(1);
}
$("document").ready(function(){
$("#hid").change(function() {
<!--Get File Name-->
var path = document.getElementById("hid").value;
var fileName = "" + path.match(/[^\/\\]+$/);
<!--Get Title-->
var titlelength = fileName.indexOf('.');
var truncatedtitle = fileName.substring(0, titlelength).ucfirst();;
document.getElementById('Title').value = truncatedtitle;
});
});
</script>
<!--Cleanup-->
<script language="javascript">
$("document").ready(function(){
$("#hid").change(function() {
if (document.getElementById("SuccessText") || document.getElementById("ErrorText") || document.getElementById("NameText"))
{
if (document.getElementById('SuccessText'))
{
var SuccessText = document.getElementById('SuccessText');
SuccessText.parentNode.removeChild(SuccessText);
}
if (document.getElementById('NameText'))
{
var NameText = document.getElementById('NameText');
NameText.parentNode.removeChild(NameText);
}
if (document.getElementById('ErrorText'))
{
var ErrorText = document.getElementById('ErrorText');
ErrorText.parentNode.removeChild(ErrorText);
}
}
});
});
</script>
<!--Body-->
<div class="bg" data-ibg-bg="/images/background.jpg">
<div class="display" id="Page" style="opacity:0;" align="center">
</br></br></br>
<img src="/images/logo.png">
</br></br></br>
<img style="opacity:.8;cursor:default" src="/images/box.png" class="Box" id="Box">
</br></br>
<p class="OpenText" id="OpenText" style="opacity:0;cursor:default">Open the box</p>
</br>
<!--Form-->
<form action="index.php" method="post" enctype="multipart/form-data">
<div id="choosefile">
<div id="doit">
<img src="images/choose_file.png"/>
</div>
<input id="hid" name="file" type="file" size=1></div>
</br>
<img src="images/loading.gif" id="Loading" class="hidden" width="85" height="85">
<div class="FormText hidden" id="Form" style="cursor:default">
File Name:
</br>
<input class="InfoText" type="text" id="Title" name="Title" value="" size="30">
</br></br>
Private:
</br>
<select class="InfoText" id="Private" name="Private" style="width:150px">
<option value="Public">Public</option>
<option value="Private">Private</option>
</select>
</br></br>
<input type="image" src="/images/upload_button.png" id="upload_button" value="Submit" class="hotspot hidden" onmouseover="tooltip.show('Your IP is <?php echo getenv(REMOTE_ADDR); ?>');" onmouseout="tooltip.hide();" onclick="uploadstatus(true);"/>
</br>
</div>
</form>
<!--Upload-->
<?php
if ($_POST)
{
if (strpos(($_FILES["file"]["name"]), 'php') == TRUE || strpos(($_FILES["file"]["name"]), 'jsp') == TRUE)
{
echo "<p class='ErrorText' id='ErrorText'>Filetype Banned!</p>";
}
else
{
$path = $_FILES['file']['name'];
$ext = pathinfo($path, PATHINFO_EXTENSION);
if ($_POST['Private'] == "Private")
{
if (!file_exists('contents/private/' . getenv(REMOTE_ADDR)))
{
mkdir('contents/private/' . getenv(REMOTE_ADDR), 0777, true);
}
$folder = "contents/private/" . getenv(REMOTE_ADDR);
}
else
{
$folder = "contents/public/";
}
$temp = explode(".", $_FILES["file"]["name"]);
$newfilename = $_POST['Title'] . '.' . end($temp);
move_uploaded_file($_FILES["file"]["tmp_name"], $folder . '/' . $newfilename);
$uploadStatus = true;
}
}
if ($uploadStatus)
{
if ($_FILES["file"]["error"] > 0)
{
echo "<p class='ErrorText' id='ErrorText'>Upload Failed!</p>";
if ($_FILES["file"]["error"] == 1)
{
echo "<p class='ErrorText' id='ErrorText'>File exceeds PHP upload limit (4 GB)</p>";
}
else if ($_FILES["file"]["error"] == 2)
{
echo "<p class='ErrorText' id='ErrorText'>File exceeds HTML upload limit (4 GB)</p>";
}
else if ($_FILES["file"]["error"] == 3)
{
echo "<p class='ErrorText' id='ErrorText'>The file was only partially uploaded (network interruption?)</p>";
}
else if ($_FILES["file"]["error"] == 4)
{
echo "<p class='ErrorText' id='ErrorText'>No file was selected!</p>";
}
else if ($_FILES["file"]["error"] == 6)
{
echo "<p class='ErrorText' id='ErrorText'>The temporary folder is missing! Contact administrator!</p>";
}
else if ($_FILES["file"]["error"] == 7)
{
echo "<p class='ErrorText' id='ErrorText'>Failed to write file to disk (Permission error?)</p>";
}
else if ($_FILES["file"]["error"] == 8)
{
echo "<p class='ErrorText' id='ErrorText'>A PHP extension has stopped the upload!</p>";
}
}
else
{
echo '<script type="text/javascript">', 'uploadstatus(false); ', '</script>';
echo "<p class='SuccessText' id='SuccessText'>Upload Successful!</p>";
echo "<p class='FileText' id='NameText'>" . $_FILES["file"]["name"] ." uploaded!</p></br>";
$ipLog="uploadlog.txt";
$friendly_name = $_FILES["file"]["name"];
$file_size = $_FILES["file"]["size"] / 1024 / 1024 . " MB";
$register_globals = (bool) ini_get('register_gobals');
$ip = getenv(REMOTE_ADDR);
$date = date ('m-d-Y H:i:s');
$log = fopen("$ipLog", "a+");
if (preg_match("/\bhtm\b/i", $ipLog) || preg_match("/\bhtml\b/i", $ipLog))
{
fputs($log, "File: $friendly_name | Size: $file_size | IP Address: $ip | Date Uploaded: $date <br>");
}
else
{
fputs($log, "File: $friendly_name | Size: $file_size | IP Address: $ip | Date Uploaded: $date \n");
}
fclose($log);
$uploadStatus = false;
}
}
?>
</div>
</div>
<!--Background Resize Manager-->
<script type="text/javascript">
$(".bg").interactive_bg();
$(window).resize(function(){$(".bg > .ibg-bg").css({width: $(window).outerWidth(),height: $(window).outerHeight()})})
</script>
</body>
<!--Icons-->
<div id="IconBar" style="opacity:0;">
<img src="/images/info.png" class="hotspot Icons" onmouseover="tooltip.show('We respect your privacy, but we do not hold any responsibilty for any damages uploaded to the box. If there is an issue with any content, including personal and copyright complaints, please feel free to email me for corrections.');" onmouseout="tooltip.hide();";
style="position:fixed;
float:left;
left:12px;
bottom:6px;
z-index:1;">
<a href="/contents/private/index.php?dir=<?php echo getenv(REMOTE_ADDR); ?>"><img src="/images/lock.png" class="hotspot Icons" onmouseover="tooltip.show('View your private files assciated with: <?php echo getenv(REMOTE_ADDR); ?>');" onmouseout="tooltip.hide();";
style="position:fixed;
float:left;
left:54px;
bottom:6px;
z-index:1;">
</a>
<a href="http://box.endurehosting.com/printscreensharp/PrintScreen%23.exe"><img src="/images/printscreensharp.png" class="hotspot Icons" onmouseover="tooltip.show('Download the latest version of PrintScreen#, the automatic screensnapper');" onmouseout="tooltip.hide();";
style="position:fixed;
float:left;
left:96px;
bottom:6px;
z-index:1;">
</a>
<a href="http://helpdesk.endurehosting.com/"><img src="/images/email.png" class="hotspot Icons" onmouseover="tooltip.show('If you have any suggestions, questions, or comments, feel free to shoot me an email at Kinlough#EndureMail.com or use our helpdesk');" onmouseout="tooltip.hide();";
style="position:fixed;
float:left;
left:138px;
bottom:6px;
z-index:1;">
</a>
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BQLLXSL2AMZS8"><img src="/images/donate.png" class="hotspot Icons" onmouseover="tooltip.show('Buy me a coffee!');" onmouseout="tooltip.hide();";
style="position:fixed;
float:left;
left:180px;
bottom:6px;
z-index:1;">
</a>
</div>
</html>
If I remove the -moz-transform: scale(1); on the .Normal class, it appears like it does in Chrome on FireFox:
.Normal {
zoom: 1;
/*-moz-transform: scale(1);*/
}
That line can be found in the file: http://box.endurehosting.com/css/style.css
Updated fiddle: http://jsfiddle.net/uw8f9/2326/

Issues with image alignment in CSS & PHP

I'm very new to the process of CSS & PHP but with Wordpress & the widgets I'm trying to get better with my plugins.
I am trying to get my little twitter bird to appear next to my twitter content message, but it continues to be at the top of the messages.
An example of what I'm trying to achieve can be located here. http://globe-trekking.com/twitter_ideal.jpg (can't add image because this is my first post)
How can I over come this.
My relevant PHP code is:
$widgetContent .= "<span class='entry-content'><img class='twitter_bird' src='http://globe-trekking.com/running/wp-content/themes/newscast/images/bird_blue_16.png'>{$entryContent}</span>";
the full PHP code is:
$widgetContent .= '<ul>';
if ( ! is_array( $tweets ) || count( $tweets ) == 0 ) {
$widgetContent .= '<li class="wpTwitterWidgetEmpty">' . __( 'No Tweets Available', $this->_slug ) . '</li>';
} else {
$count = 0;
foreach ( $tweets as $tweet ) {
// Set our "ago" string which converts the date to "# ___(s) ago"
$tweet->ago = $this->_timeSince( strtotime( $tweet->created_at ), $args['showts'], $args['dateFormat'] );
//$entryContent .= '<li>';
$entryContent = apply_filters( 'widget_twitter_content', $tweet->text, $tweet );
$widgetContent .= "<span class='entry-content'><img class='twitter_bird' src='http://globe-trekking.com/running/wp-content/themes/newscast/images/bird_blue_16.png'>{$entryContent}</span>";
$widgetContent .= " <span class='entry-meta'>";
$widgetContent .= "<span class='time-meta'>";
$linkAttrs = array(
'href' => "http://twitter.com/{$tweet->user->screen_name}/statuses/{$tweet->id_str}"
);
$widgetContent .= $this->_buildLink( $tweet->ago, $linkAttrs );
$widgetContent .= '</span>';
if ( 'true' != $args['hidefrom'] ) {
$from = sprintf( __( 'from %s', $this->_slug ), str_replace( '&', '&', $tweet->source ) );
$widgetContent .= " <span class='from-meta'>{$from}</span>";
}
if ( !empty( $tweet->in_reply_to_screen_name ) ) {
$rtLinkText = sprintf( __( 'in reply to %s', $this->_slug ), $tweet->in_reply_to_screen_name );
$widgetContent .= ' <span class="in-reply-to-meta">';
$linkAttrs = array(
'href' => "http://twitter.com/{$tweet->in_reply_to_screen_name}/statuses/{$tweet->in_reply_to_status_id_str}",
'class' => 'reply-to'
);
$widgetContent .= $this->_buildLink( $rtLinkText, $linkAttrs );
$widgetContent .= '</span>';
}
$widgetContent .= '</span>';
if ( 'true' == $args['showintents'] ) {
$widgetContent .= ' <span class="intent-meta">';
$lang = $this->_getTwitterLang();
if ( !empty( $lang ) )
$linkAttrs['data-lang'] = $lang;
$linkText = __( 'Reply', $this->_slug );
$linkAttrs['href'] = "http://twitter.com/intent/tweet?in_reply_to={$tweet->id_str}";
$linkAttrs['class'] = 'in-reply-to';
$linkAttrs['title'] = $linkText;
$widgetContent .= $this->_buildLink( $linkText, $linkAttrs );
$linkText = __( 'Retweet', $this->_slug );
$linkAttrs['href'] = "http://twitter.com/intent/retweet?tweet_id={$tweet->id_str}";
$linkAttrs['class'] = 'retweet';
$linkAttrs['title'] = $linkText;
$widgetContent .= $this->_buildLink( $linkText, $linkAttrs );
$linkText = __( 'Favorite', $this->_slug );
$linkAttrs['href'] = "http://twitter.com/intent/favorite?tweet_id={$tweet->id_str}";
$linkAttrs['class'] = 'favorite';
$linkAttrs['title'] = $linkText;
$widgetContent .= $this->_buildLink( $linkText, $linkAttrs );
$widgetContent .= '</span>';
}
//$widgetContent .= '</li>';
if ( ++$count >= $args['items'] )
break;
}
}
$widgetContent .= '</ul>';
My CSS code is:
.widget_twitter div {
padding:0;
width:280px;
}
.widget_twitter ul li {
margin-bottom:5px;
margin-left:0px;
clear:both;
}
.widget_twitter a {
text-decoration:none;
color:#333333;
margin: 0 10px 10px 0;
}
.widget_twitter a:visited {
text-decoration:underline;
color:#FF00FF;
}
.widget_twitter a:hover {
text-decoration:underline;
color:#0000CC;
}
.widget_twitter .follow-button,
.widget_twitter .xavisys-link {
margin:0 10px 10px 25px;
}
.widget_twitter .entry-content {
width:260px;
display: inline-block;
line-height:22px;
margin-top:10px;
margin-left: 13px;
}
.widget_twitter .entry-content twitter_bird {
vertical-align:middle;
}
.widget_twitter .entry-meta {
display:block;
font-size:80%;
margin-bottom: 10px;
margin-left: 13px;
}
.widget_twitter .intent-meta a {
background-image: url('images/everything-spritev2.png'); /** from Twitter resources */
display: inline-block;
text-indent: -9999px;
margin: 0 10px 10px 0;
height: 16px;
width: 16px;
}
.widget_twitter .in-reply-to-meta {
margin: 0 10px 10px 0;
}
.widget_twitter .intent-meta a.in-reply-to {
background-position: 0 center;
}
.widget_twitter .intent-meta a:hover.in-reply-to {
background-position: -16px center;
}
.widget_twitter .intent-meta a.favorite {
background-position: -32px center;
}
.widget_twitter .intent-meta a:hover.favorite {
background-position: -48px center;
}
.widget_twitter .intent-meta a.retweet {
background-position: -80px center;
}
.widget_twitter .intent-meta a:hover.retweet {
background-position: -96px center;
}
Any assistance would be greatly appreciated. I've managed to get it to a "decent" appearance, but otherwise, this is the last step that I've tried a number of things on.
Regards,
Daniël
Sorry for fast answer, may be me wrong, but try to use float:left for bird image.

Resources