date('Y')) { $show = false; } else if ($year == date('Y')) { if ($month > date('m')) { $show = false; } else if ($month < date('m')) { $show = true; } else if ($month == date('m')) { if ($day > date('d')) { $show = false; } else if ($day < date('d')) { $show = true; } else if ($day == date('d')) { if ($time[0] > date('h')) { $show = false; } else if ($time[0] < date('h')) { $show = true; } if ($time[0] == date('h')) { if ($time[1] > date('i')) { $show = false; } else if ($time[1] <= date('i')) { $show = true; } } } } } return $show; } function retrieveDirs($dirpath) { $dirpath = trim ($dirpath); if (is_dir($dirpath)) { $skrar = array(); if ($dir = @opendir($dirpath)) { $a = 0; while (($file = readdir($dir)) !== false) { if (is_file($dirpath.'/'.$file)) { array_push($skrar, $file); } } } return $skrar; } print $dirpath; print "Fann ekki client!"; die(); } $PATH = $path; function parser($line) { $start = 0; $buffer = $line; $val = ''; for (;;) { $val = ''; $pos = strpos($line, "%%", $start); if ($pos !== false) { $pos += 2; $i = 0; for (;;) { $character = $line[$pos]; if ($character === '%') { if ($line[$pos + 1] == '%') { $pos += 2; break; } else { print "Villa Ý html kˇ­a"; die(); } } $val .= $character; $pos++; } $buffer = str_replace("%%",'',$buffer); $commands = split(":",$buffer); return $commands; } else { return false; } } return false; } function includeHTML($handle) { global $siteid; global $PATH; global $uploadpath; global $GLOBALS; $CURRENTSECTION = 'main'; /* ob_start(); */ while (!feof($handle)) { $buffer = fgets($handle, 4096); if ($commands = parser($buffer)) { if ($commands[0] == 'plugin') { $modulename = $commands[1]; $moduleplugin = trim($commands[2]); $text = ""; $break = false; // $initcommand = $commands; $initcommand = array(); $commandnr = 0; $lastcommand = "ge"; foreach ($commands as $command) { if ($commandnr > 2) { if ($commandnr % 2 != 0) { $initcommand[$command] = " "; $lastcommand = $command; } else { $initcommand["$lastcommand"] = $command; } } $commandnr++; } $initcommand[0] = 'plugin'; for(;;) { $buffer = fgets($handle, 4096); $commands = parser($buffer); if (!$commands) { $text .= $buffer; } else if (trim($commands[0]) === 'endblock') { $break = true; } else { print $commands[0]; print "Error in theme"; die(); } if ($break) { /* Keyra upp m├│dulinn */ /* Fyrst um sinn har├░k├│├░um vi├░ */ $app = "/home/pakk/roskva/.public_html/app/$modulename/view/$moduleplugin.php"; if (file_exists($app)) { ob_start(); include ($app); $buffer = ob_get_contents(); ob_end_clean(); if (isset($GLOBALS['holder']['section'][$CURRENTSECTION])) { $GLOBALS['holder']['section'][$CURRENTSECTION] .= $buffer; } else { $GLOBALS['holder']['section'][$CURRENTSECTION] = $buffer; } } break; } } } else if (trim($commands[0]) === 'section') { $CURRENTSECTION = trim($commands[1]); } else if (trim($commands[0] == 'endsection')) { $CURRENTSECTION = ""; } else if (trim($commands[0] == 'include')) { $filename = $PATH.'/'.trim($commands[1]); if (file_exists($filename)) { ob_start(); include ($filename); $buffer = ob_get_contents(); ob_end_clean(); if (isset($GLOBALS['holder']['section'][$CURRENTSECTION])) { $GLOBALS['holder']['section'][$CURRENTSECTION] .= $buffer; } else { $GLOBALS['holder']['section'][$CURRENTSECTION] = $buffer; } } } else if (trim($commands[0] == 'theme')) { $filename = $PATH.'/'.trim($commands[1]); if (file_exists($filename)) { $handle = fopen($filename, "r"); includeHTML($handle); } else { print "Fann ekki ■emu"; die(); } } else if (trim($commands[0]) === 'addsec') { $SECTION = trim($commands[1]); $SECTION2 = trim($commands[2]); $TEXTINN = ""; if (isset($GLOBALS['holder']['section'][$SECTION])) { $TEXTINN = $GLOBALS['holder']['section'][$SECTION]; } if (isset($GLOBALS['holder']['section'][$SECTION2])) { $GLOBALS['holder']['section'][$SECTION2] .= $TEXTINN; } else { $GLOBALS['holder']['section'][$SECTION2] = $TEXTINN; } } else if (trim($commands[0]) === 'print') { $SECTION = trim($commands[1]); $TEXT = ""; if (isset($GLOBALS['holder']['section'][$SECTION])) { $TEXT = $GLOBALS['holder']['section'][$SECTION]; } if (isset($GLOBALS['holder']['section'][$CURRENTSECTION])) { $GLOBALS['holder']['section'][$CURRENTSECTION] .= $TEXT; } else { $GLOBALS['holder']['section'][$CURRENTSECTION] = $TEXT; } } } else { if (isset($GLOBALS['holder']['section'][$CURRENTSECTION])) { $GLOBALS['holder']['section'][$CURRENTSECTION] .= $buffer; } else { $GLOBALS['holder']['section'][$CURRENTSECTION] = $buffer; } } } /* $out = ob_get_contents(); print $out; ob_end_clean(); */ if (!isset($searchstring)) { $searchstring = false; } if (isset($GLOBALS['holder']['section']['html'])) { if ($searchstring != false) { print "HALLË"; $GLOBALS['holder']['section']['html'] = preg_replace ($searchstring, ' HAHA.. HEHE', $GLOBALS['holder']['section']['html']); } return $GLOBALS['holder']['section']['html']; } else { return ""; } } $action = 'index'; $allowed_actions = retrieveDirs($path); if (isset($_GET['action'])) { $get_action = strval(trim($_GET['action'])); foreach ($allowed_actions as $allowed_action) { if ($allowed_action === $get_action.'.html') { $action = $get_action; } } } function createimagewidth($name,$filename,$new_w){ $system=explode('.',$name); // $handle = imagick_readimage($name) ; list($old_x,$old_y) = GetImageSize($name); if ($old_x == $old_y) { $thumb_w=$new_w; $thumb_h=$new_w; } else { $thumb_w=$new_w; $aspect = ($old_y/$old_x); $thumb_h=$thumb_w * $aspect; } exec("convert -colorspace RGB -geometry ".$thumb_w."x".$thumb_h." -quality 100 compress jpeg $name $filename"); } function createimageheight($name,$filename,$new_h){ $system=explode('.',$name); list($old_x,$old_y) = GetImageSize($name); if ($old_x == $old_y) { $thumb_w=$new_h; $thumb_h=$new_h; } else { $thumb_h=$new_h; $aspect = ($old_x/$old_y); $thumb_w=$thumb_h * $aspect; } exec("convert -colorspace RGB -geometry ".$thumb_w."x".$thumb_h." -quality 100 compress jpeg $name $filename"); } function replace_img($text) { GLOBAL $uploadpath; $find = 0; $pos = strpos($text, '!!img:', $find); while (!($pos === false)) { $find = $pos; $endpos = strpos($text, ':img!!', $find); $diff = $endpos - ($pos +6) ; $diffwhole = ($endpos + 6) - ($pos) ; $wholeline = substr($text, $find, $diffwhole); $imgcommand = substr($text, $find + 6, $diff); $imgcommand = split(':',$imgcommand); $ori = $imgcommand[1]; $oriPX = $imgcommand[2]; $ORIGfilename = $imgcommand[0]; if ((substr($ORIGfilename, 0 ,1)) != "/" ) { $ORIGfilename = '/'.$ORIGfilename; } $filename = $uploadpath.'/resize/'.$ori.'_'.$oriPX.str_replace('/','_',$ORIGfilename); if ((substr($filename, 0 ,1)) != "/" ) { $checkfile = $filename; $filename = '/'.$filename; } else { $checkfile = substr($filename, 1); } if (!file_exists($checkfile)) { if (substr($uploadpath, 0 ,1) == "/") { $newdir = substr($uploadpath, 1).'/resize'; } else { $newdir = $uploadpath.'/resize'; } if (!is_dir($newdir)) { mkdir($newdir); } // B˙a til mynd mar $orig_filename = substr($ORIGfilename, 1); if ($ori == 'width') { createimagewidth($orig_filename,$checkfile,$oriPX); } else { createimageheight($orig_filename,$checkfile,$oriPX); } } $text = str_replace ($wholeline,$filename,$text); $find = $endpos; $pos = @strpos($text, '!!img', $find); } return $text; } $file = $path.'/'.$action.'.html'; if (is_file($file)) { $handle = fopen($file, "r"); $text = includeHTML ($handle); $text = replace_img($text); $text = str_replace('$$FULLURL$$', $GLOBALS['fullurl'], $text); $text = str_replace('$$id$$', $_GET['id'], $text); print $text; } ?>