Ejemplo n.º 1
0
 static function image($image, $dir = '', $alt = '', $width = '100', $height = '', $thumb = false, $align = '', $link = true, $defaults = 0, $blank = false)
 {
     $imgdir = Util::value('imgdir');
     $output = '';
     $pattern = "/\\.gif\$|\\.jpeg\$|\\.tif\$|\\.jpg\$|\\.tiff\$|\\.png\$|\\.bmp\$/i";
     if (preg_match($pattern, $image) || $blank !== false) {
         $height_line = $height == '' ? '' : " height=" . $height;
         if ($defaults) {
             $width = '100';
         }
         if ($dir == '' && $imgdir != '') {
             $dir = $imgdir;
         }
         $image = $dir . $image;
         if ($align != '') {
             $align = 'align="' . $align . '"';
         }
         if ($image != '' && file_exists(getcwd() . '/' . $image)) {
             if ($link) {
                 $output .= '<a href="' . $image . '" target="_blank">';
             }
             if ($thumb) {
                 $output .= '<img src="thumb.php?f=' . $image . '&d=' . $dir . '" border="0" alt="' . $alt . '" title="' . $alt . '" width="' . $width . $height_line . '" ' . $align . ' />';
             } else {
                 $output .= '<img src="' . $image . '" border="0" alt="' . $alt . '" title="' . $alt . '" width="' . $width . $height_line . '" ' . $align . ' />';
             }
             if ($link) {
                 $output .= '</a>';
             }
         } elseif ($blank != '' && file_exists(getcwd() . '/' . $blank)) {
             $output .= '<img src="' . $blank . '" border="0" alt="' . $alt . '" title="' . $alt . '" width="' . $width . $height_line . '" ' . $align . ' />';
         } elseif ($image != '') {
             $output .= '<img src="' . $image . '" border="0" alt="' . $alt . '" title="' . $alt . '" width="' . $width . $height_line . '" ' . $align . ' />';
         } else {
             $output .= '<img src="noimage.png" border="0" alt="' . $alt . '" title="' . $alt . '" width="' . $width . $height_line . '" align="left" />';
         }
         return $output;
     } else {
         return $image;
     }
 }
Ejemplo n.º 2
0
 static function parachute(&$count, $max = '', $redirect = '', $log = false, $alert = false)
 {
     $max = DevValue::isNotNull($rcpt) ? $max : 400;
     if ($count >= $max) {
         $status = "Loop exceeded max count! Killing Process.\n";
         if ($alert) {
             Util::emailAdmin($status);
         }
         if ($log) {
             $logger = Log::instance(array('storage' => 'log'));
             $logger->push($status);
             $logger->write();
         }
         if (DevValue::isNotNull($redirect)) {
             HTTP::redirect($redirect, array('msg' => $status));
         } else {
             exit("A script on this page began to loop out of control. Process has been killed. If you are viewing this message, please alert the administrator.\n");
         }
     }
     $count++;
 }
Ejemplo n.º 3
0
 public function args()
 {
     global $argv, $argc;
     if ($argc > 1) {
         $this->_arguments[$this->_parameters[0]] = 'console';
         for ($i = 1; $i <= $argc - 1; $i++) {
             $this->_arguments[$this->_parameters[$i]] = $argv[$i];
         }
     } elseif (count($_GET) > 0 || count($_POST) > 0) {
         $args = $this->_parameters;
         foreach ($args as $arg) {
             $this->_arguments[$arg] = Util::value($arg);
         }
     } else {
         $request_parts = explode('/', $_SERVER['REQUEST_URI']);
         $parts = array_reverse($request_parts);
     }
     $this->_arguments[$this->_parameters[0]] = isset($this->_arguments[$this->_parameters[0]]) ? $this->_arguments[$this->_parameters[0]] : strtolower(isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET');
     $this->_arguments[$this->_parameters[1]] = isset($this->_arguments[$this->_parameters[1]]) ? $this->_arguments[$this->_parameters[1]] : $this->name();
     $this->_arguments[$this->_parameters[2]] = isset($this->_arguments[$this->_parameters[2]]) ? $this->_arguments[$this->_parameters[2]] : $this->_arguments[$this->_parameters[0]];
     return $this;
 }
Ejemplo n.º 4
0
 public function renderRecordSet($recordSet, $formatted = null)
 {
     $output = '';
     $count = 0;
     if (DevValue::isNull($formatted)) {
         $formatted = true;
     }
     foreach ($recordSet as $a) {
         $this->clear();
         $this->set($a, $formatted);
         $output .= $this->render();
         Util::parachute($count, $this->config('max_records'));
     }
     return $output;
 }