Location: PHPKode > projects > photolibrary > function.general.php
<?PHP
/*
   [Start: Program Information Header]

    Name    : Photolibrary: General functions
    Purpose : Multi
    Syntax  :

   [End: Program Information Header]

   [Start: Author Information Header]

    Name    : James D. Forrester
    E-mail  : hide@address.com

    Name    : Ed Sanders
    E-mail  : hide@address.com

   [End: Author Information Header]
*/

function getInt($var, $alt = 0)
{
  return isset($_GET[$var]) ? intval($_GET[$var]) : $alt;
}

function postInt($var, $alt = 0)
{
  return isset($_POST[$var]) ? intval($_POST[$var]) : $alt;
}

function getFloat($var, $alt = 0)
{
  return isset($_GET[$var]) ? floatval($_GET[$var]) : $alt;
}

function postFloat($var, $alt = 0)
{
  return isset($_POST[$var]) ? floatval($_POST[$var]) : $alt;
}

function getString($var, $alt = '')
{
  return isset($_GET[$var]) ? uncomment($_GET[$var]) : $alt;
}

function postString($var, $alt = '')
{
  return isset($_POST[$var]) ? uncomment($_POST[$var]) : $alt;
}

function getCheck($var, $alt = false)
{
  return isset($_GET[$var]) ? $_GET[$var] == 'on' : $alt;
}

function postCheck($var, $alt = false)
{
  return isset($_POST[$var]) ? $_POST[$var] == 'on' : $alt;
}

function selected($var1, $var2)
{
  if($var1 == $var2)
    return ' selected="selected"';
}

function uncomment($text)
{
  return addslashes(htmlentities($text, ENT_QUOTES));
}

function stylesheet($page)
{
  format_html('<link rel="stylesheet" type="text/css" href="css/style.php?page='.$page.'" />');
}

function suggest_box_text($text_name, $id_name, $i, $function, $value = false, $class = 'suggest_box_text')
{
  format_html('<input type="text" name="'.$text_name.'" id="sb'.$i.'"'.($value ? ' value="'.$value.'"' : '').' class="'.$class.'" tabindex="'.intval($i).'" onKeyUp="findName(\''.$i.'\', event.keyCode, '.$function.');" onBlur="hideDelay(\''.$i.'\')" autocomplete="off" />');
  format_html('<input type="hidden" name="'.$id_name.'" id="pid'.$i.'" />');
}

function suggest_box_drop($i)
{
  format_html('<div class="suggest_box_container">');
  format_html('<div id="nameList'.$i.'" class="suggest_box"></div>');
  format_html('</div>');
}

function exif_rotation($exif_r)
{
  // The following is from the EXIF 2.2 specification:
  // 1 = The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.
  // 2 = The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.
  // 3 = The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.
  // 4 = The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.
  // 5 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual top.
  // 6 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual top.
  // 7 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.
  // 8 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.
  // Other = reserved
  switch($exif_r)
  {
    case 1: return 0; break;
    case 3: return 2; break;
    case 6: return 1; break;
    case 8: return 3; break;
    default: return 0; break;
  }
  // Cases 2, 4, 5 and 7 deal with reflections.
}

function gcd($n, $m)
{
  if(!$m)
    return $n;
  return gcd($m, $n % $m);
}
?>
Return current item: photolibrary