From: Andrey Kutejko Date: Tue, 23 Jul 2013 17:31:13 +0000 (+0300) Subject: cleanup X-Git-Tag: 0.5~154 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=9d3ef21621a0ddbdffdec8702c30963613f6bfe0;p=ipf.git cleanup --- diff --git a/ipf/admin/views.php b/ipf/admin/views.php index 527e460..f471f26 100644 --- a/ipf/admin/views.php +++ b/ipf/admin/views.php @@ -397,27 +397,24 @@ function IPF_Admin_Views_FileBrowser($request, $match) continue; if (($curr_dir=='') && ($file=='..')) continue; - if (filetype($_dir . $file)=='dir'){ + + if (filetype($_dir . $file)=='dir') { $dirs[] = array('id'=>$id, 'name'=>$file); $id++; - } - else{ - + } else { $sx = getimagesize($_dir.$file); - if ($sx){ + if ($sx) { $image = '1'; $type = str_replace('image/','',$sx['mime']).' '.$sx[0].'x'.$sx[1]; - if ($sx[0]<=200){ + if ($sx[0]<=200) { $zw = $sx[0]; $zh = $sx[1]; - } - else { + } else { $zw = 200; $prop = (float)$sx[1] / (float)$sx[0]; $zh = (int)(200.0 * $prop); } - } - else { + } else { $image = '0'; $type = 'binary'; $zw = 200; diff --git a/ipf/auth/app.php b/ipf/auth/app.php index 8ff7be8..9f362d8 100644 --- a/ipf/auth/app.php +++ b/ipf/auth/app.php @@ -1,9 +1,5 @@ loadAllModels(); @@ -173,3 +169,4 @@ class IPF_Auth_App extends IPF_Application return $app->getTitle().' | '.$admin->verbose_name().' | '.ucfirst($parts[2]); } } + diff --git a/ipf/orm/table.php b/ipf/orm/table.php index 706cfc4..416102a 100644 --- a/ipf/orm/table.php +++ b/ipf/orm/table.php @@ -45,8 +45,10 @@ class IPF_ORM_Table extends IPF_ORM_Configurable implements Countable public function __construct($name, IPF_ORM_Connection $conn, $initDefinition = false) { - $this->_conn = $conn; + if (empty($name) || !class_exists($name)) + throw new IPF_ORM_Exception("Couldn't find class " . $name); + $this->_conn = $conn; $this->setParent($this->_conn); $this->_options['name'] = $name; @@ -70,9 +72,6 @@ class IPF_ORM_Table extends IPF_ORM_Configurable implements Countable public function initDefinition() { $name = $this->_options['name']; - if ( ! class_exists($name) || empty($name)) { - throw new IPF_ORM_Exception("Couldn't find class " . $name); - } $record = new $name($this); $names = array(); @@ -82,17 +81,15 @@ class IPF_ORM_Table extends IPF_ORM_Configurable implements Countable // get parent classes do { - if ($class === 'IPF_ORM_Record') { + if ($class === 'IPF_ORM_Record') break; - } $name = $class; $names[] = $name; } while ($class = get_parent_class($class)); - if ($class === false) { + if ($class === false) throw new IPF_ORM_Exception('Class "' . $name . '" must be a child class of IPF_ORM_Record'); - } // reverse names $names = array_reverse($names);