Пример #1
0
function inverseHex($color)
{
    $color = TRIM($color);
    $prependHash = FALSE;
    if (STRPOS($color, '#') !== FALSE) {
        $prependHash = TRUE;
        $color = STR_REPLACE('#', NULL, $color);
    }
    switch ($len = STRLEN($color)) {
        case 3:
            $color = PREG_REPLACE("/(.)(.)(.)/", "\\1\\1\\2\\2\\3\\3", $color);
        case 6:
            break;
        default:
            TRIGGER_ERROR("Invalid hex length ({$len}). Must be (3) or (6)", E_USER_ERROR);
    }
    if (!PREG_MATCH('/[a-f0-9]{6}/i', $color)) {
        $color = HTMLENTITIES($color);
        TRIGGER_ERROR("Invalid hex string #{$color}", E_USER_ERROR);
    }
    $r = DECHEX(255 - HEXDEC(SUBSTR($color, 0, 2)));
    $r = STRLEN($r) > 1 ? $r : '0' . $r;
    $g = DECHEX(255 - HEXDEC(SUBSTR($color, 2, 2)));
    $g = STRLEN($g) > 1 ? $g : '0' . $g;
    $b = DECHEX(255 - HEXDEC(SUBSTR($color, 4, 2)));
    $b = STRLEN($b) > 1 ? $b : '0' . $b;
    return ($prependHash ? '#' : NULL) . $r . $g . $b;
}
function ENCRYPT_DECRYPT($Str_Message)
{
    //Function : encrypt/decrypt a string message v.1.0  without a known key
    //Author   : Aitor Solozabal Merino (spain)
    //Email    : aitor-3@euskalnet.net
    //Date     : 01-04-2005
    $Len_Str_Message = STRLEN($Str_Message);
    $Str_Encrypted_Message = "";
    for ($Position = 0; $Position < $Len_Str_Message; $Position++) {
        // long code of the function to explain the algoritm
        //this function can be tailored by the programmer modifyng the formula
        //to calculate the key to use for every character in the string.
        $Key_To_Use = $Len_Str_Message + $Position + 1;
        // (+5 or *3 or ^2)
        //after that we need a module division because can´t be greater than 255
        $Key_To_Use = (255 + $Key_To_Use) % 255;
        $Byte_To_Be_Encrypted = SUBSTR($Str_Message, $Position, 1);
        $Ascii_Num_Byte_To_Encrypt = ORD($Byte_To_Be_Encrypted);
        $Xored_Byte = $Ascii_Num_Byte_To_Encrypt ^ $Key_To_Use;
        //xor operation
        $Encrypted_Byte = CHR($Xored_Byte);
        $Str_Encrypted_Message .= $Encrypted_Byte;
        //short code of  the function once explained
        //$str_encrypted_message .= chr((ord(substr($str_message, $position, 1))) ^ ((255+(($len_str_message+$position)+1)) % 255));
    }
    return $Str_Encrypted_Message;
}
Пример #3
0
 function FUNCDEF_OVERRIDE($MATCHES)
 {
     $this->RECORD($MATCHES[0], 'KEYWORD');
     $this->POS_SHIFT(STRLEN($MATCHES[0]));
     $this->skip_whitespace();
     if ($this->SCAN('/[a-z_]\\w*/i')) {
         $this->RECORD($this->MATCH(), 'USER_FUNCTION');
         $this->user_defs[$this->MATCH()] = 'FUNCTION';
     }
 }
Пример #4
0
 public function funcdefOverride($MATCHES)
 {
     $this->RECORD($MATCHES[0], 'KEYWORD');
     $this->POSSHIFT(STRLEN($MATCHES[0]));
     $this->SKIPWHITESPACE();
     if ($this->SCAN('/[a-z_]\\w*/i')) {
         $this->RECORD($this->MATCH(), 'USER_FUNCTION');
         $this->userDefs[$this->MATCH()] = 'FUNCTION';
     }
 }
Пример #5
0
 public static function PHONE($N)
 {
     $N = PREG_REPLACE("/[^0-9]/", "", $N);
     if (STRLEN($N) == 7) {
         return PREG_REPLACE("/([0-9]{3})([0-9]{4})/", "\$1-\$2", $N);
     } else {
         if (STRLEN($N) == 10) {
             return PREG_REPLACE("/([0-9]{3})([0-9]{3})([0-9]{4})/", "(\$1) \$2-\$3", $N);
         } else {
             return $N;
         }
     }
 }
Пример #6
0
 public function output(Pagemill_Data $data, Pagemill_Stream $stream)
 {
     $data = $data->fork();
     if (!empty($this->attributes['menuplugid'])) {
         $menuplugid = $this->attributes['menuplugid'];
         $db = Typeframe::Database();
         $base = substr(Typeframe::CurrentPage()->uri(), STRLEN(TYPEF_WEB_DIR));
         if ($base == '') {
             $base = '/';
         }
         $search = new Model_Nav();
         $search->where('plugid = ?', $menuplugid);
         $search->where('url = ? OR url = ? OR url = ? OR url = ? OR url = ? OR url = ? OR pageid = ?', "~{$base}", "~{$base}/", "/{$base}", "/{$base}/", TYPEF_WEB_DIR . $base, TYPEF_WEB_DIR . $base . '/', Typeframe::CurrentPage()->pageid());
         foreach ($search->select() as $current) {
             $current['url'] = $this->_convertUrl($current['url']);
             $data->set('current', $current);
             $parentid = $current['parent'];
             $siblings = new Model_Nav();
             $siblings->where('plugid = ?', $menuplugid);
             $siblings->where('parent = ?', $parentid);
             $siblings->order('sortnum');
             $data['siblings'] = $siblings;
             /*$sibArray = array();
             		foreach ($siblings->select() as $sib) {
             			$sib['url'] = $this->_convertUrl($sib['url']);
             			$sibArray[] = $sib;
             		}
             		$data['siblings'] = $sibArray;*/
             if (!empty($this->attributes['showparent'])) {
                 $parent = $db->execute('SELECT * FROM #__nav WHERE itemid = ' . $parentid);
                 foreach ($parent as $par) {
                     $par['url'] = $this->_convertUrl($par['url']);
                     $data->set('parent', $par);
                 }
             }
             if (!empty($this->attributes['showchildren'])) {
                 $childArray = array();
                 $children = $db->execute('SELECT * FROM #__nav WHERE plugid = ' . $menuplugid . ' AND parent = ' . $current['itemid'] . ' ORDER BY sortnum');
                 foreach ($children as $chi) {
                     $chi['url'] = $this->_convertUrl($chi['url']);
                     $childArray[] = $chi;
                 }
                 $data['children'] = $childArray;
             }
         }
     }
     $this->pluginTemplate = "navigation/submenu.plug.html";
     parent::output($data, $stream);
 }
Пример #7
0
function MySQLDateToSeconds($dt)
{
    $tempdate = split('[- :]', $dt);
    $year = $tempdate[0];
    $month = $tempdate[1];
    $daynum = $tempdate[2];
    if (STRLEN($dt) < 19) {
        $hour = "00";
        $minute = "00";
        $second = "00";
    } else {
        $hour = $tempdate[3];
        $minute = $tempdate[4];
        $second = $tempdate[5];
    }
    return mktime($hour, $minute, $second, $month, $daynum, $year);
}
function ENCRYPT_DECRYPT($Str_Message)
{
    $Len_Str_Message = STRLEN($Str_Message);
    $Str_Encrypted_Message = "";
    for ($Position = 0; $Position < $Len_Str_Message; $Position++) {
        $Key_To_Use = $Len_Str_Message + $Position + 1;
        // (+5 or *3 or ^2)
        $Key_To_Use = (255 + $Key_To_Use) % 255;
        $Byte_To_Be_Encrypted = SUBSTR($Str_Message, $Position, 1);
        $Ascii_Num_Byte_To_Encrypt = ORD($Byte_To_Be_Encrypted);
        $Xored_Byte = $Ascii_Num_Byte_To_Encrypt ^ $Key_To_Use;
        //xor operation
        $Encrypted_Byte = CHR($Xored_Byte);
        $Str_Encrypted_Message .= $Encrypted_Byte;
    }
    return $Str_Encrypted_Message;
}
Пример #9
0
 function ENCRYPT_DECRYPT($Str_Message)
 {
     $Len_Str_Message = STRLEN($Str_Message);
     $Str_Encrypted_Message = "";
     for ($Position = 0; $Position < $Len_Str_Message; $Position++) {
         // long code of the function to explain the algoritm
         //this function can be tailored by the programmer modifyng the formula
         //to calculate the key to use for every character in the string.
         $Key_To_Use = ($Len_Str_Message + $Position) * 230;
         // (+5 or *3 or ^2)
         //after that we need a module division because can´t be greater than 255
         //$Key_To_Use = (255+$Key_To_Use) % 255;
         $Key_To_Use = (168 + $Key_To_Use) % 168;
         $Byte_To_Be_Encrypted = SUBSTR($Str_Message, $Position, 1);
         $Ascii_Num_Byte_To_Encrypt = ORD($Byte_To_Be_Encrypted);
         $Xored_Byte = $Ascii_Num_Byte_To_Encrypt ^ $Key_To_Use;
         //xor operation
         $Encrypted_Byte = CHR($Xored_Byte);
         $Str_Encrypted_Message .= $Encrypted_Byte;
         //short code of  the function once explained
         //$str_encrypted_message .= chr((ord(substr($str_message, $position, 1))) ^ ((255+(($len_str_message+$position)+1)) % 255));
     }
     return $Str_Encrypted_Message;
 }
Пример #10
0
 public function Modifica_Autorizaciones($t_id, $autorizador, $lugar)
 {
     $query = "SELECT t_ruta_autorizacion FROM tramites WHERE t_id = {$t_id}";
     $rst = parent::consultar($query);
     $aux = explode("|", mysql_result($rst, 0, 't_ruta_autorizacion'));
     $t_autorizaciones = "";
     for ($i = 0; $i < count($aux); $i++) {
         if ($lugar == 0) {
             if ($lugar == $i) {
                 $t_autorizaciones .= $autorizador;
                 break;
             } else {
                 $t_autorizaciones .= $aux[$i];
             }
         } else {
             if ($lugar == $i) {
                 $t_autorizaciones .= "|" . $autorizador;
                 break;
             } else {
                 $t_autorizaciones .= "|" . $aux[$i];
             }
         }
     }
     $t_autorizaciones = SUBSTR($t_autorizaciones, 0, 1) == "|" ? SUBSTR($t_autorizaciones, 1, STRLEN($t_autorizaciones)) : $t_autorizaciones;
     $query = "UPDATE tramites SET t_autorizaciones = '{$t_autorizaciones}', t_fecha_ultima_modificacion = NOW() WHERE t_id='{$t_id}'";
     parent::insertar($query);
 }
Пример #11
0
 /**
  * Short description.
  */
 public function cut($str, $from, $to, $direct = 'out')
 {
     //echo "$str n $from n $to n";
     //$from = """; $to = """;
     $frompos = STRPOS($str, $from);
     $topos = STRPOS($str, $to, $frompos + STRLEN($from));
     if ($direct == 'in') {
         $start = $frompos + STRLEN($from);
         $end = $topos - $start;
         $txt = SUBSTR($str, $start, $end);
     } else {
         $start = $frompos;
         $end = $topos + STRLEN($to) - $frompos;
         $txt = SUBSTR($str, $start, $end);
     }
     return $txt;
 }
Пример #12
0
 function getTimeDiff($dtime, $atime)
 {
     $dtime = substr($dtime, 0, 5);
     $atime = substr($atime, 0, 5);
     $nextDay = $dtime > $atime ? 1 : 0;
     $dep = EXPLODE(':', $dtime);
     $arr = EXPLODE(':', $atime);
     $diff = ABS(MKTIME($dep[0], $dep[1], 0, DATE('n'), DATE('j'), DATE('y')) - MKTIME($arr[0], $arr[1], 0, DATE('n'), DATE('j') + $nextDay, DATE('y')));
     $hours = FLOOR($diff / (60 * 60));
     $mins = FLOOR(($diff - $hours * 60 * 60) / 60);
     $secs = FLOOR($diff - ($hours * 60 * 60 + $mins * 60));
     if (STRLEN($hours) < 2) {
         $hours = "0" . $hours;
     }
     if (STRLEN($mins) < 2) {
         $mins = "0" . $mins;
     }
     if (STRLEN($secs) < 2) {
         $secs = "0" . $secs;
     }
     return $hours . ':' . $mins . ':' . $secs;
 }
Пример #13
0
}
shuffle($wyniki);
if (count($wyniki) > 0) {
    $i = 0;
    foreach ($wyniki as $r) {
        if ($i < 8) {
            $i++;
            $rand = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
            $color = '#' . $rand[rand(0, 15)] . $rand[rand(0, 15)] . $rand[rand(0, 15)] . $rand[rand(0, 15)] . $rand[rand(0, 15)] . $rand[rand(0, 15)];
            $hashlesscolor = STR_REPLACE('#', NULL, $color);
            $rr = DECHEX(255 - HEXDEC(SUBSTR($hashlesscolor, 0, 2)));
            $rr = STRLEN($rr) > 1 ? $rr : '0' . $rr;
            $gg = DECHEX(255 - HEXDEC(SUBSTR($hashlesscolor, 2, 2)));
            $gg = STRLEN($gg) > 1 ? $gg : '0' . $gg;
            $bb = DECHEX(255 - HEXDEC(SUBSTR($hashlesscolor, 4, 2)));
            $bb = STRLEN($bb) > 1 ? $bb : '0' . $bb;
            $invcolor = '#' . $rr . $gg . $bb;
            echo "<div class=\"col-md-3 col-centered\"style=\"text-align:center;padding: 2.5% 2.5% 2.5% 2.5%;\">";
            echo "<div class=\"circle\" style=\"text-shadow: -1px 0 #444444, 0 1px #444444, 1px 0 #444444, 0 -1px #444444; border: 1px solid black;color:" . $invcolor . "; background-color:" . $color . "\">";
            echo "<a href=\"sesja.php?sesja=" . $r['id_sesji'] . "\">";
            echo "<h2>" . $r['lokalizacja'] . "</h2>";
            echo "<p>" . $r['data'] . "</p>";
            echo "</a>";
            echo "</div>";
            echo "</div>";
        } else {
            break;
        }
    }
} else {
    echo '<p style="text-align:center;">Aktualnie w systemie nie ma &#380;adnych dodanych przez fotografów sesji zdj&#281;ciowych.</p>';
Пример #14
0
 function fetchOngoingProjects($id)
 {
     try {
         global $dbh;
         $query = $dbh->prepare('SELECT projectID as `pid`, 
                 projectName as `pn`,   
                 duedate as `dd`,
                 FLOOR(totalNumHours/60) as `h`,
                 MOD(totalNumHours, 60) as `m`
                 FROM project 
                 WHERE draftsmanID = :id
                 AND status = "ongoing"');
         $query->bindParam(':id', $id);
         $query->execute();
         while ($row = $query->fetch()) {
             if (STRLEN($row['m']) > 2) {
                 $row['m'] = substr($row['m'], 0, 2);
             }
             $d = date("F d, Y", strtotime($row['dd']));
             echo "<tr>";
             echo "<td>" . $row['pn'] . "</td>";
             echo "<td>" . $d . "</td>";
             echo "<td>" . $row['h'] . " hours and " . $row['m'] . " minutes</td>";
             echo '<td><a href="viewLogs2.php?pid=' . $row['pid'] . '"><button class="btn btn-info btn-sm" style="width:100%;" type="submit"><span class="glyphicon glyphicon-stats"></span> View Logs</button></a></td>';
             echo "</tr>";
         }
     } catch (PDOException $ex) {
     }
 }
Пример #15
0
 function getHourDiff($firstHour, $secondHour)
 {
     $dtime = substr($firstHour, 0, 5);
     $atime = substr($secondHour, 0, 5);
     $nextDay = $dtime > $atime ? 1 : 0;
     $dep = EXPLODE(':', $dtime);
     $arr = EXPLODE(':', $atime);
     $diff = ABS(MKTIME($dep[0], $dep[1], 0, DATE('n'), DATE('j'), DATE('y')) - MKTIME($arr[0], $arr[1], 0, DATE('n'), DATE('j') + $nextDay, DATE('y')));
     $hours = FLOOR($diff / (60 * 60));
     $mins = FLOOR(($diff - $hours * 60 * 60) / 60);
     $secs = FLOOR($diff - ($hours * 60 * 60 + $mins * 60));
     if (STRLEN($hours) < 2) {
         $hours = "0" . $hours;
     }
     if (STRLEN($mins) < 2) {
         $mins = "0" . $mins;
     }
     if (STRLEN($secs) < 2) {
         $secs = "0" . $secs;
     }
     $temp = floatval($mins / 60);
     $temp += $hours;
     return $temp;
 }
Пример #16
0
<?php

require_once "controllerPaginas.php";
$cPaginas = new controllerPaginas();
$conteudo_pagina = null;
$requisicao_pagina = STR_REPLACE(".php", "", empty($_SERVER['REQUEST_URI']) ? 'index' : SUBSTR($_SERVER['REQUEST_URI'], 1, STRLEN($_SERVER['REQUEST_URI'])));
if (strpos($requisicao_pagina, "/") >= 0) {
    $arrayRequisicao = explode("/", $requisicao_pagina);
    $requisicao_pagina = empty($arrayRequisicao[1]) ? 'index' : $arrayRequisicao[1];
}
$arrayPaginas = $cPaginas->listaPaginas();
foreach ($arrayPaginas as $pagina) {
    if ($pagina['link_pagina'] == strtolower($requisicao_pagina)) {
        $conteudo_pagina = $pagina['conteudo_pagina'];
    }
}
/*
if( empty($conteudo_pagina) ) {
    echo "<script type='text/javascript'>window.location.href='error-page.html';</script>";
    exit;
}
*/
?>
<!DOCTYPE html>
<html lang="pt">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="web-files/lib/bootstrap/dist/css/bootstrap.min.css" media="all">
        <link rel="stylesheet" href="web-files/css/themes/bootstrap.min.css" media="all">
        <link rel="stylesheet" href="web-files/css/styleWebsite.css" media="all">
Пример #17
0
 private function _timeDiff($firstTime, $lastTime)
 {
     // convert to unix timestamps
     $firstTime = strtotime($firstTime);
     $lastTime = strtotime($lastTime);
     // perform subtraction to get the difference (in seconds) between times
     $diff = $lastTime - $firstTime;
     $hours = FLOOR($diff / (60 * 60));
     $mins = FLOOR(($diff - $hours * 60 * 60) / 60);
     $secs = FLOOR($diff - ($hours * 60 * 60 + $mins * 60));
     if (STRLEN($hours) < 2) {
         $hours = "0" . $hours;
     }
     if (STRLEN($mins) < 2) {
         $mins = "0" . $mins;
     }
     if (STRLEN($secs) < 2) {
         $secs = "0" . $secs;
     }
     // return $diff;
     return $hours . ' hr ' . $mins . ' min ' . $secs . ' sec ';
     // return the difference
     // return $timeDiff;
 }
Пример #18
0
// load the image from the file specified:
$im = imagecreatefrompng("csi.png");
// if there's an error, stop processing the page:
if (!$im) {
    die("");
}
// define some colours to use with the image
$yellow = imagecolorallocate($im, 255, 255, 0);
$black = imagecolorallocate($im, 0, 0, 0);
// get the width and the height of the image
$width = imagesx($im);
$height = imagesy($im);
// draw a black rectangle across the bottom, say, 20 pixels of the image:
imagefilledrectangle($im, 0, $height - 20, $width, $height, $black);
// now we want to write in the centre of the rectangle:
$font = 4;
// store the int ID of the system font we're using in $font
$text = "vdhri.net";
// store the text we're going to write in $text
// calculate the left position of the text:
$leftTextPos = ($width - imagefontwidth($font) * STRLEN($text)) / 2;
// finally, write the string:
imagestring($im, $font, $leftTextPos, $height - 18, $text, $yellow);
// output the image
// tell the browser what we're sending it
HEADER('Content-type: image/png');
// output the image as a png
imagepng($im);
// tidy up
imagedestroy($im);
Пример #19
0
 $parsed_query_string = substr($parsed_query_string, strpos($parsed_query_string, " WHERE ") + 7);
 // i.e. taking the part of the query_string following "WHERE" clause.
 $parsed_query_string = substr($query_string_backup, stripos($query_string_backup, $parsed_query_string));
 // taking the part of the query string following "WHERE" in the actual case as provided.
 $parsed_query_string = trim_all($parsed_query_string);
 echo "<script>alert('" . $parsed_query_string . "');</script>";
 //
 if (stripos($parsed_query_string, " and ") !== FALSE || stripos($parsed_query_string, " or ") !== FALSE) {
     die("<script>alert('Composite condition check in \\'WHERE\\' clause in \\'SELECT\\' query is not yet programmed.');</script>");
 } else {
     // checking if any of the following is present- ">", "<", "=", ">=", "<="
     if (strpos($parsed_query_string, ">") === FALSE && strpos($parsed_query_string, "<") === FALSE && strpos($parsed_query_string, "=") === FALSE) {
         // i.e. if no conditional operator is used in the condition
         die("<script>alert('No valid condition is given in \\'WHERE\\' clause.');</script>");
     }
     if (strrpos($parsed_query_string, ">") === strlen($parsed_query_string) - 1 || strrpos($parsed_query_string, "<") === STRLEN($parsed_query_string) - 1 && strrpos($parsed_query_string, "=") === STRLEN($parsed_query_string) - 1) {
         die("<script>alert('\\'select\\' query terminated incorrectly.');</script>");
     }
     $parsed_query_string = trim_all(substr($parsed_query_string, strlen("WHERE")));
     // taking the part of the query_string following "WHERE". $parsed_query_string now has the condition to be checked for.
     //checking for occurrence of multiple relational operators in the query_string.
     if (substr_count($parsed_query_string, ">") > 1 || substr_count($parsed_query_string, "<") > 1 || substr_count($parsed_query_string, "=") > 1) {
         die("<script>alert('\\'SELECT\\' query is not in proper format');</script>");
     }
     if (strrpos($parsed_query_string, ">") !== FALSE) {
         if (substr_count($parsed_query_string, ">") > 1 || strrpos($parsed_query_string, "<") !== FALSE || strrpos($parsed_query_string, ">=") === FALSE && strrpos($parsed_query_string, "=") !== FALSE) {
             die("<script>alert('\\'SELECT\\' query is not in proper format');</script>");
         }
     }
     if (strrpos($parsed_query_string, "<") !== FALSE) {
         if (substr_count($parsed_query_string, "<") > 1 || strrpos($parsed_query_string, ">") !== FALSE || strrpos($parsed_query_string, "<=") === FALSE && strrpos($parsed_query_string, "=") !== FALSE) {
Пример #20
0
 private function processCollectorQueryResult($r2, $lName, $fName, $mName)
 {
     //echo "\nInput to processCollectorQueryResult:\nlName: ".$lName."\nfName: ".$fName."\nmName: ".$mName,"\n";
     $firstName = $r2->firstName;
     $middleInitial = $r2->middleName;
     if (strlen($fName) == 1 && strlen($firstName) > 1) {
         $firstName = substr($firstName, 0, 1);
     }
     if (strlen($mName) == 1 && strlen($middleInitial) > 1) {
         $middleInitial = substr($middleInitial, 0, 1);
     }
     if (STRLEN($firstName) > 0 && strcmp($firstName, $fName) == 0) {
         if (STRLEN($middleInitial) > 0 && STRLEN($mName) > 0) {
             // TODO: Check if downstream consumers can substitute agentID for collectorID.
             if (strcasecmp($middleInitial, $mName) == 0) {
                 return array('agentID' => $r2->agentid, 'collectorID' => $r2->agentid, 'familyName' => $lName, 'collectorName' => $r2->firstName . " " . $middleInitial . " " . $lName);
             }
         } else {
             return array('agentID' => $r2->agentid, 'collectorID' => $r2->agentid, 'familyName' => $lName, 'collectorName' => $r2->firstName . " " . $lName);
         }
     }
     return array();
 }
Пример #21
0
        }
        ///////////////////////////////
        if (isset($dtime)) {
            ///////////////////////////////////////////////////////
            $atime = substr($time->time, 0, 5);
            $nextDay = $dtime > $atime ? 1 : 0;
            $dep = EXPLODE(':', $dtime);
            $arr = EXPLODE(':', $atime);
            $diff = ABS(MKTIME($dep[0], $dep[1], 0, DATE('n'), DATE('j'), DATE('y')) - MKTIME($arr[0], $arr[1], 0, DATE('n'), DATE('j') + $nextDay, DATE('y')));
            $hours = FLOOR($diff / (60 * 60));
            $mins = FLOOR(($diff - $hours * 60 * 60) / 60);
            $secs = FLOOR($diff - ($hours * 60 * 60 + $mins * 60));
            if (STRLEN($hours) < 2) {
                $hours = "0" . $hours;
            }
            if (STRLEN($mins) < 2) {
                $mins = "0" . $mins;
            }
            $hours += $mins / 60;
            ///////////////////////////////////////////
            if ($flagw == 1 && $hours > 3 || $flagw == 0 && $hours >= 0.5) {
                $timedata['currenttime'] = $time->time;
                $timedata['flagw'] = $flagw;
                $timedata['type'] = "Snack";
                ?>
					<?php 
                $this->load->view('users/eating_journal/journal_error', $timedata);
                ?>
					<?php 
            }
        }
Пример #22
0
 $row_element = $returnsystemprivateconfig['row_element'];
 $bottom_element = $returnsystemprivateconfig['bottom_element'];
 $action_model = $returnsystemprivateconfig['action_model'];
 $action_search = $returnsystemprivateconfig['action_search'];
 $systemorder = $returnsystemprivateconfig['systemorder'];
 $已配置信息 = $returnsystemprivateconfig['已配置信息'];
 //专业科科长,以及副科长权限时进行生成,所有系统只能有查看权限
 //2010-4-3加入分管校长的查看权限,并行使用SUNSHINE_BANJI_LIST属性
 //在INI文件由系统进行对action_model row_element bottom_element等几个变量进行重新定义
 if ($_SESSION['SUNSHINE_BANJI_LIST'] == "N") {
     $_SESSION['SUNSHINE_BANJI_LIST'] = "";
 }
 if ($_SESSION['LOGIN_PHPSESSID'] == "N") {
     $_SESSION['LOGIN_PHPSESSID'] = "";
 }
 if (STRLEN($_SESSION['SUNSHINE_BANJI_LIST']) > 4 && $_SESSION['LOGIN_USER_ID'] != "admin") {
     $row_element_array = explode(',', $row_element);
     if (in_array("view:view_default", $row_element_array)) {
         $row_element = 'view:view_default';
     }
     if (in_array("view:view_customer", $row_element_array)) {
         $row_element = 'view:view_customer';
     }
     $action_model = '';
     $bottom_element = '';
     $_GET['系统说明'] = "备注:以下仅是针对" . $_SESSION['SUNSHINE_BANJI_LIST'] . "相关的信息,仅用于综合信息查询模块.";
 }
 //session_register("指定人员");
 //session_register("指定人员_FILENAME");
 $PHP_SELF_ARRAY = explode('/', $_SERVER['PHP_SELF']);
 $PHP_SELF_FILE = array_pop($PHP_SELF_ARRAY);
Пример #23
0
 /**
  * creates a thumbnail and put it in the THUMBS dir, or print it.
  *
  * @param string $src reference to the original file
  * @param int $maxY max height of thumb
  * @param int $maxX max width of thumb
  * @return true if success, false if error
  */
 static function createThumbnail($src, $writeToFile = true, $maxY = false, $maxX = false)
 {
     if (!$maxY && !$maxX) {
         return false;
     }
     $file = open_image($src);
     if ($file) {
         $oldX = imagesx($file);
         $oldY = imagesy($file);
         $x = 0;
         $y = 0;
         $assumedY = $maxX * ($oldY / $oldX);
         $assumedX = $maxY * ($oldX / $oldY);
         if ($assumedX > $maxX) {
             $x = $maxX;
             $y = $assumedY;
         }
         if ($assumedY > $maxY) {
             $x = $assumedX;
             $y = $maxY;
         }
         $img = imagecreatetruecolor($x, $y);
         imagecopyresampled($img, $file, 0, 0, 0, 0, $x, $y, $oldX, $oldY);
         $filename = strtolower(strtr(substr($src, STRLEN(IMAGES) + 1), '/', '_'));
         $destination = THUMBS . '/' . $filename;
         if ($writeToFile) {
             imagejpeg($img, $destination, 40);
         } else {
             header('content-type: image/jpeg');
             imagejpeg($img);
         }
     }
     return true;
 }