Changeset 3605ef4cbbdb0bce13d7f8f2d89564bdce062ab1
- Timestamp:
- 01/15/12 14:59:03 (4 months ago)
- Children:
- 28879c66921dd6a95bea71bfa032508c45bc6467
- Parents:
- e449ecc0f26cb90b41ca32d98ed3f37f762c9f5a
- git-committer:
- Xemle <xemle@phtagr.org> / 2012-01-15T14:59:03Z+0100
- Files:
-
- 36 modified
- 2 moved
-
Controller/AppController.php (modified) (4 diffs)
-
Controller/BrowserController.php (moved) (moved from controllers/browser_controller.php) (2 diffs)
-
Controller/Component/BaseFilterComponent.php (modified) (1 diff)
-
Controller/Component/CaptchaComponent.php (modified) (1 diff)
-
Controller/Component/CommandComponent.php (modified) (2 diffs)
-
Controller/Component/FastFileResponderComponent.php (modified) (1 diff)
-
Controller/Component/FeedComponent.php (modified) (3 diffs)
-
Controller/Component/FileCacheComponent.php (modified) (1 diff)
-
Controller/Component/FileManagerComponent.php (modified) (1 diff)
-
Controller/Component/FilterManagerComponent.php (modified) (3 diffs)
-
Controller/Component/ImageResizerComponent.php (modified) (2 diffs)
-
Controller/Component/MenuComponent.php (modified) (1 diff)
-
Controller/Component/PreviewManagerComponent.php (modified) (4 diffs)
-
Controller/Component/QueryBuilderComponent.php (modified) (2 diffs)
-
Controller/Component/SearchComponent.php (modified) (3 diffs)
-
Controller/Component/UpgradeSchemaComponent.php (modified) (2 diffs)
-
Controller/Component/UploadComponent.php (modified) (1 diff)
-
Controller/Component/VideoPreviewComponent.php (modified) (1 diff)
-
Controller/Component/ZipComponent.php (modified) (1 diff)
-
Controller/HomeController.php (modified) (1 diff)
-
Controller/MediaController.php (modified) (6 diffs)
-
Controller/SetupController.php (modified) (1 diff)
-
Model/AppModel.php (modified) (1 diff)
-
Model/Behavior/CipherBehavior.php (modified) (1 diff)
-
Model/Guest.php (moved) (moved from models/guest.php) (1 diff)
-
Model/Media.php (modified) (1 diff)
-
Model/User.php (modified) (1 diff)
-
View/Browser/index.ctp (modified) (1 diff)
-
View/Browser/sync.ctp (modified) (1 diff)
-
View/Elements/topnav.ctp (modified) (1 diff)
-
View/Helper/FileListHelper.php (modified) (5 diffs)
-
View/Helper/ImageDataHelper.php (modified) (1 diff)
-
View/Helper/SearchHelper.php (modified) (1 diff)
-
View/Layouts/backend.ctp (modified) (5 diffs)
-
View/Layouts/default.ctp (modified) (4 diffs)
-
View/Setup/admin_upgrade.ctp (modified) (2 diffs)
-
View/Users/login.ctp (modified) (2 diffs)
-
View/home/index.ctp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Controller/AppController.php
re449ecc0 r3605ef4 49 49 function _setMainMenu() { 50 50 $this->Menu->setCurrentMenu('main-menu'); 51 $this->Menu->addItem(__('Home' , true), "/");52 $this->Menu->addItem(__('Explorer' , true), array('controller' => 'explorer'));51 $this->Menu->addItem(__('Home'), "/"); 52 $this->Menu->addItem(__('Explorer'), array('controller' => 'explorer')); 53 53 if ($this->hasRole(ROLE_GUEST)) { 54 54 $user = $this->getUser(); 55 $this->Menu->addItem(__('My Photos' , true), array('controller' => 'explorer', 'action' => 'user', $user['User']['username']));55 $this->Menu->addItem(__('My Photos'), array('controller' => 'explorer', 'action' => 'user', $user['User']['username'])); 56 56 } 57 57 if ($this->hasRole(ROLE_USER)) { 58 $this->Menu->addItem(__('Upload' , true), array('controller' => 'browser', 'action' => 'quickupload'));58 $this->Menu->addItem(__('Upload'), array('controller' => 'browser', 'action' => 'quickupload')); 59 59 } 60 60 } … … 64 64 $role = $this->getUserRole(); 65 65 if ($role == ROLE_NOBODY) { 66 $this->Menu->addItem(__('Login' , true), array('controller' => 'users', 'action' => 'login'));66 $this->Menu->addItem(__('Login'), array('controller' => 'users', 'action' => 'login')); 67 67 if ($this->getOption('user.register.enable', 0)) { 68 $this->Menu->addItem(__('Sign Up' , true), array('controller' => 'users', 'action' => 'register'));68 $this->Menu->addItem(__('Sign Up'), array('controller' => 'users', 'action' => 'register')); 69 69 } 70 70 } else { 71 71 $user = $this->getUser(); 72 $this->Menu->addItem( sprintf(__('Howdy, %s!', true), $user['User']['username']), false);73 $this->Menu->addItem(__('Logout' , true), array('controller' => 'users', 'action' => 'logout'));74 $this->Menu->addItem(__('Dashboard' , true), array('controller' => 'options'));72 $this->Menu->addItem(__('Howdy, %s!', $user['User']['username']), false); 73 $this->Menu->addItem(__('Logout'), array('controller' => 'users', 'action' => 'logout')); 74 $this->Menu->addItem(__('Dashboard'), array('controller' => 'options')); 75 75 } 76 76 } … … 144 144 * @todo Check expired user */ 145 145 function _checkSession() { 146 $this->Session->activate();146 //$this->Session->activate(); 147 147 if (!$this->Session->check('Session.requestCount')) { 148 148 $this->Session->write('Session.requestCount', 1); … … 280 280 $parent->components[] = $componentName; 281 281 } 282 $this->Component->_loadComponents($parent); 283 $this->Component->initialize($this); 284 285 if (isset($parent->{$componentName})) { 286 return true; 287 } else { 282 $component = $this->Components->load($componentName); 283 if (!$component) { 288 284 Logger::warn("Could not load component $componentName"); 289 285 return false; 290 286 } 287 $parent->{$componentName} = $component; 288 $component->initialize(&$this); 289 290 return true; 291 291 } 292 292 -
Controller/BrowserController.php
r6aa1330 r3605ef4 356 356 // clear file cache 357 357 @clearstatcache(); 358 $start = $now = getMicrotime();358 $start = $now = microtime(true); 359 359 $executionTime = ini_get('max_execution_time') - 5; 360 360 … … 369 369 } 370 370 371 $now = getMicrotime();371 $now = microtime(true); 372 372 if ($now - $start > $executionTime) { 373 373 break; -
Controller/Component/BaseFilterComponent.php
re449ecc0 r3605ef4 22 22 */ 23 23 24 class BaseFilterComponent extends Object {24 class BaseFilterComponent extends Component { 25 25 26 26 var $components = array(); -
Controller/Component/CaptchaComponent.php
re449ecc0 r3605ef4 1 1 <?php 2 App:: import('vendor', 'kcaptcha');3 class CaptchaComponent extends Object2 App::uses('vendor', 'kcaptcha'); 3 class CaptchaComponent extends Component 4 4 { 5 5 function initialize(&$controller) { -
Controller/Component/CommandComponent.php
re449ecc0 r3605ef4 22 22 */ 23 23 24 class CommandComponent extends Object {24 class CommandComponent extends Component { 25 25 26 26 var $controller = null; … … 60 60 $this->lastCommand .= ' 2>&1'; 61 61 } 62 $t1 = getMicrotime();62 $t1 = microtime(true); 63 63 exec($this->lastCommand, &$output, &$result); 64 $t2 = getMicrotime();64 $t2 = microtime(true); 65 65 $this->output = $output; 66 66 Logger::debug("Command '{$this->lastCommand}' returned $result and required ".round($t2-$t1, 4)."ms"); -
Controller/Component/FastFileResponderComponent.php
re449ecc0 r3605ef4 22 22 */ 23 23 24 class FastFileResponderComponent extends Object {24 class FastFileResponderComponent extends Component { 25 25 var $controller = null; 26 26 var $components = array('Session', 'FileCache'); -
Controller/Component/FeedComponent.php
re449ecc0 r3605ef4 22 22 */ 23 23 24 class FeedComponent extends Object {24 class FeedComponent extends Component { 25 25 26 26 var $name = 'FeedComponent'; 27 27 28 28 var $controller = null; 29 29 … … 41 41 /** Set feeds output for layout */ 42 42 function beforeRender() { 43 App::import('Helper', 'Html'); 44 $html = new HtmlHelper(); 45 43 App::uses('HtmlHelper', 'View/Helper'); 44 App::uses('View', 'View'); 45 $View = new View($this->controller, false); 46 $Html = new HtmlHelper($View); 46 47 $output = ''; 47 48 foreach($this->_feeds as $url => $options) { … … 56 57 unset($options['url']); 57 58 } 58 $output .= $ html->meta($type, $url, $options);59 $output .= $Html->meta($type, $url, $options); 59 60 } 60 61 $this->controller->set('feeds_for_layout', $output); -
Controller/Component/FileCacheComponent.php
re449ecc0 r3605ef4 22 22 */ 23 23 24 class FileCacheComponent extends Object { 24 App::uses('Folder', 'Utility'); 25 26 class FileCacheComponent extends Component { 25 27 26 28 var $controller = null; -
Controller/Component/FileManagerComponent.php
re449ecc0 r3605ef4 22 22 */ 23 23 24 class FileManagerComponent extends Object {24 class FileManagerComponent extends Component { 25 25 26 26 var $controller = null; -
Controller/Component/FilterManagerComponent.php
re449ecc0 r3605ef4 22 22 */ 23 23 24 class FilterManagerComponent extends Object {24 class FilterManagerComponent extends Component { 25 25 26 26 var $controller = null; … … 51 51 return false; 52 52 } 53 $this->MyFile =& $controller->MyFile;54 $this->Media =& $controller->Media;55 53 $this->loadFilter(array('ImageFilter', 'SimpleImageFilter', 'VideoFilter', 'GpsFilter')); 56 54 } … … 76 74 return true; 77 75 } 78 $filter->MyFile =& $this->MyFile; 79 $filter->Media =& $this->Media; 80 $filter->FilterManager =& $this; 76 $filter->FilterManager = $this; 81 77 82 78 $filter->init(&$this); -
Controller/Component/ImageResizerComponent.php
re449ecc0 r3605ef4 21 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 22 22 */ 23 if (! App::import('Vendor', "phpthumb", true, array(), "phpthumb.class.php")) {23 if (!class_exists('phpThumb') && !App::import('Vendor', "phpthumb", true, array(), "phpthumb/phpthumb.class.php")) { 24 24 debug("Please install phpthumb properly"); 25 25 } 26 26 27 class ImageResizerComponent extends Object {27 class ImageResizerComponent extends Component { 28 28 29 29 var $controller = null; … … 96 96 } 97 97 98 $t0 = getMicrotime();98 $t0 = microtime(true); 99 99 if ($this->_semaphoreId) { 100 100 sem_acquire($this->_semaphoreId); 101 101 } 102 $t1 = getMicrotime();102 $t1 = microtime(true); 103 103 $result = $phpThumb->GenerateThumbnail(); 104 $t2 = getMicrotime();104 $t2 = microtime(true); 105 105 if ($this->_semaphoreId) { 106 106 sem_release($this->_semaphoreId); -
Controller/Component/MenuComponent.php
re449ecc0 r3605ef4 22 22 */ 23 23 24 class MenuComponent extends Object {24 class MenuComponent extends Component { 25 25 26 26 var $components = array('Session'); -
Controller/Component/PreviewManagerComponent.php
re449ecc0 r3605ef4 22 22 */ 23 23 24 class PreviewManagerComponent extends Object {24 class PreviewManagerComponent extends Component { 25 25 26 26 var $controller = null; … … 63 63 function initialize(&$controller) { 64 64 $this->controller =& $controller; 65 if (!isset($controller->M yFile) || !isset($controller->Media)) {65 if (!isset($controller->Media)) { 66 66 Logger::err("Model MyFile and Media is not found"); 67 67 return false; 68 68 } 69 $this->MyFile =& $controller->MyFile;70 $this->Media =& $controller->Media;71 69 } 72 70 73 71 /** Return image source file of the media */ 74 72 function _getImageSoureFilename($media) { 75 $type = $this-> Media->getType($media);73 $type = $this->controller->Media->getType($media); 76 74 if ($type != MEDIA_TYPE_IMAGE && $type != MEDIA_TYPE_VIDEO) { 77 Logger::err("Media type not supported: {$this-> Media->getType($media)}");75 Logger::err("Media type not supported: {$this->controller->Media->getType($media)}"); 78 76 return false; 79 77 } … … 82 80 return $this->VideoPreview->getPreviewFilename($media); 83 81 } 84 $file = $this-> Media->getFile($media, FILE_TYPE_IMAGE, false);82 $file = $this->controller->Media->getFile($media, FILE_TYPE_IMAGE, false); 85 83 if (!$file) { 86 84 Logger::err("No files are attached to media {$media['Media']['id']}"); 87 85 return false; 88 86 } 89 return $this-> Media->File->getFilename($file);87 return $this->controller->Media->File->getFilename($file); 90 88 } 91 89 … … 109 107 $src = $this->_getImageSoureFilename($media); 110 108 $config['clearMetaData'] = true; 111 $config['rotation'] = $this-> Media->getRotationInDegree($media);109 $config['rotation'] = $this->controller->Media->getRotationInDegree($media); 112 110 } 113 111 $dst = $this->FileCache->getFilePath($media, $name); 114 112 if (!$dst) { 115 Logger::err("Could not get cache file path for media {$this-> Media->toString($media)}");113 Logger::err("Could not get cache file path for media {$this->controller->Media->toString($media)}"); 116 114 return false; 117 115 } -
Controller/Component/QueryBuilderComponent.php
re449ecc0 r3605ef4 22 22 */ 23 23 24 App:: import('Core', array('Sanitize'));25 26 class QueryBuilderComponent extends Object24 App::uses('Sanitize', 'Utility'); 25 26 class QueryBuilderComponent extends Component 27 27 { 28 var $components = array();29 30 28 var $controller = null; 31 29 … … 57 55 function initialize(&$controller) { 58 56 $this->controller = &$controller; 59 $this->Sanitize = &new Sanitize();57 $this->Sanitize = new Sanitize(); 60 58 } 61 59 -
Controller/Component/SearchComponent.php
re449ecc0 r3605ef4 22 22 */ 23 23 24 App::import('Core', array('Validation')); 25 App::import('File', 'Search', array('file' => APP.'search.php')); 26 27 class SearchComponent extends Search 24 if (!App::uses('Validation', 'Utility')) { 25 CakeLog::write('error', 'Could not load validation'); 26 } 27 if (!class_exists('Search')) { 28 App::import('File', 'Search', array('file' => APP.'search.php')); 29 } 30 31 class SearchComponent extends Component 28 32 { 29 33 var $components = array('QueryBuilder'); 30 34 31 35 var $controller = null; 32 33 var $ Validation = null;36 37 var $_data; 34 38 35 39 /** Parameter validation array … … 82 86 function initialize(&$controller) { 83 87 $this->controller = &$controller; 84 $this->Validation =& Validation::getInstance(); 88 if (!$this->QueryBuilder->controller) { 89 $this->QueryBuilder->initialize(&$controller); 90 } 85 91 $this->clear(); 92 return true; 86 93 } 87 94 88 95 function clear() { 89 96 $this->_data = $this->defaults; 97 } 98 99 /** Returns all parameters 100 @return Parameter array */ 101 function getParams() { 102 return $this->_data; 103 } 104 105 /** Set all parameters 106 @param data Parameter array 107 @note The parameters are not validated! */ 108 function setParams($data = array()) { 109 $this->_data = $data; 110 } 111 112 /** Returns parameter 113 @param name Name of parameter 114 @param default Default value, if the parameter does not exists. Default 115 value is null */ 116 function getParam($name, $default = null) { 117 if (!empty($this->_data[$name])) { 118 return $this->_data[$name]; 119 } else { 120 return $default; 121 } 122 } 123 124 /** Set a singular parameter 125 @param name Parameter name 126 @param value Parameter value 127 @param validate Optional parameter to validate the parameter. Default is 128 true 129 @return True on success */ 130 function setParam($name, $value, $validate = true) { 131 if ($validate === false || $this->validate($name, $value)) { 132 $this->_data[$name] = $value; 133 return true; 134 } else { 135 return false; 136 } 137 } 138 139 /** Add a parameter to an array. 140 @param name Parameter name. 141 @param value Parameter value (which will be pluralized) 142 @param validate Optional parameter to validate the parameter. Default is 143 true 144 @note The name will be pluralized. */ 145 function addParam($name, $value, $validate = true) { 146 $name = Inflector::pluralize($name); 147 if (is_array($value)) { 148 foreach ($value as $v) { 149 $this->addParam($name, $v, $validate); 150 } 151 return; 152 } 153 154 if ((!isset($this->_data[$name]) || !in_array($value, $this->_data[$name])) && 155 ($validate === false || $this->validate($name, $value))) { 156 $this->_data[$name][] = $value; 157 } 158 } 159 160 function delParam($name, $value = false) { 161 if (!isset($this->_data[$name])) { 162 return; 163 } 164 165 if (!empty($value)) { 166 if (is_array($value)) { 167 foreach ($value as $v) { 168 $this->delParam($name, $v); 169 } 170 return; 171 } 172 // handle array 173 $key = array_search($value, $this->_data[$name]); 174 if ($key !== false) { 175 unset($this->_data[$name][$key]); 176 } 177 if (count($this->_data[$name]) == 0) { 178 unset($this->_data[$name]); 179 } 180 } else { 181 // handle single value 182 unset($this->_data[$name]); 183 } 184 } 185 186 function __call($name, $args) { 187 if (!preg_match('/^(get|set|add|del|delete)(.*)$/', $name, $matches)) { 188 $this->log("Undefined function $name"); 189 return; 190 } 191 $name = Inflector::underscore($matches[2]); 192 switch ($matches[1]) { 193 case 'get': 194 if (count($args) > 0) { 195 return $this->getParam($name, $args[0]); 196 } else { 197 return $this->getParam($name); 198 } 199 break; 200 case 'set': 201 if (count($args) == 1) { 202 return $this->setParam($name, $args[0]); 203 } elseif (count($args) == 2) { 204 return $this->setParam($name, $args[0], $args[1]); 205 } 206 break; 207 case 'add': 208 if (count($args) == 1) { 209 return $this->addParam($name, $args[0]); 210 } elseif (count($args) == 2) { 211 return $this->addParam($name, $args[0], $args[1]); 212 } 213 break; 214 case 'del': 215 case 'delete': 216 if (count($args) == 1) { 217 if (!isset($this->_data[$name])) { 218 $plural = Inflector::pluralize($name); 219 if (isset($this->_data[$plural])) { 220 $name = $plural; 221 } 222 } 223 $this->delParam($name, $args[0]); 224 } else { 225 $this->delParam($name); 226 } 227 break; 228 } 90 229 } 91 230 … … 156 295 if (method_exists(&$this, $rule)) { 157 296 $result = $this->dispatchMethod($rule, $params); 158 } elseif (method_exists( &$this->Validation, $rule)) {159 $result = $this->Validation->dispatchMethod($rule, $params);297 } elseif (method_exists('Validation', $rule)) { 298 $result = call_user_func_array(array('Validation', $rule), $params); 160 299 } else { 161 300 Logger::debug("Rule '$rule' could not be found"); -
Controller/Component/UpgradeSchemaComponent.php
re449ecc0 r3605ef4 22 22 */ 23 23 24 class UpgradeSchemaComponent extends Object{24 class UpgradeSchemaComponent extends Component { 25 25 26 26 var $controller = null; … … 42 42 } 43 43 44 App:: import('Core', 'ConnectionManager');44 App::uses('ConnectionManager', 'Model'); 45 45 $this->db =& ConnectionManager::getDataSource('default'); 46 46 if (!$this->db) { -
Controller/Component/UploadComponent.php
re449ecc0 r3605ef4 22 22 */ 23 23 24 class UploadComponent extends Object {24 class UploadComponent extends Component { 25 25 26 26 var $name = 'UploadComponent'; -
Controller/Component/VideoPreviewComponent.php
re449ecc0 r3605ef4 22 22 */ 23 23 24 class VideoPreviewComponent extends Object {24 class VideoPreviewComponent extends Component { 25 25 26 26 var $controller = null; -
Controller/Component/ZipComponent.php
re449ecc0 r3605ef4 22 22 */ 23 23 24 class ZipComponent extends Object { 24 App::uses('Folder', 'Utility'); 25 26 class ZipComponent extends Component { 25 27 26 28 var $name = 'ZipComponent'; -
Controller/HomeController.php
re449ecc0 r3605ef4 37 37 } 38 38 39 App:: import('Core', 'ConnectionManager');39 App::uses('ConnectionManager', 'Model'); 40 40 $db =& ConnectionManager::getDataSource('default'); 41 if ( empty($db->connection)) {41 if (!$db->enabled()) { 42 42 $this->redirect('/setup'); 43 43 } -
Controller/MediaController.php
re449ecc0 r3605ef4 21 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 22 22 */ 23 if (!App::import('Vendor', "phpthumb", true, array(), "phpthumb.class.php")) {24 debug("Please install phpthumb properly");25 }26 27 23 class MediaController extends AppController 28 24 { 29 25 var $name = 'Media'; 30 var $uses = array(' Media', 'MyFile');26 var $uses = array('User', 'Media', 'MyFile'); 31 27 var $layout = null; 32 28 var $config = array( … … 49 45 50 46 function beforeRender() { 51 parent::before Filter();52 $this->view = 'Media';47 parent::beforeRender(); 48 $this->viewClass = 'Media'; 53 49 } 54 50 … … 110 106 } 111 107 $conditions = $this->Media->buildAclConditions($user, 0, $flag); 112 $conditions[] = "Media.id = $id";113 $media = $this->Media->find( $conditions);108 $conditions[] = 'Media.id = ' . $id; 109 $media = $this->Media->find('first', array('conditions' => $conditions)); 114 110 if (!$media) { 115 111 Logger::verbose("Media not found or access denied for media $id"); … … 130 126 131 127 $this->set($this->MyFile->getMediaViewOptions($preview)); 132 $this->view = 'Media';128 $this->viewClass = 'Media'; 133 129 } 134 130 … … 175 171 $mediaOptions = $this->MyFile->getMediaViewOptions($filename); 176 172 $mediaOptions['download'] = true; 177 $this->view = 'Media';173 $this->viewClass = 'Media'; 178 174 $this->set($mediaOptions); 179 175 } … … 201 197 $mediaOptions = $this->MyFile->getMediaViewOptions($filename); 202 198 $mediaOptions['download'] = true; 203 $this->view = 'Media';199 $this->viewClass = 'Media'; 204 200 $this->set($mediaOptions); 205 201 } -
Controller/SetupController.php
re449ecc0 r3605ef4 292 292 $max = strlen($chars) - 1; 293 293 294 srand( getMicrotime()*1000);294 srand(microtime(true)*1000); 295 295 $salt = ''; 296 296 for($i = 0; $i < 40; $i++) { -
Model/AppModel.php
re449ecc0 r3605ef4 233 233 if (isset($data[$name])) { 234 234 return $data[$name]; 235 } else { 236 return null; 237 } 238 } 235 } 236 } 237 return parent::__get($name); 239 238 } 240 239 -
Model/Behavior/CipherBehavior.php
re449ecc0 r3605ef4 167 167 @return Randomly generated salt of the given lenth */ 168 168 function _generateSalt($value, $key = '9nHPrYcxmvTliA', $len = 4) { 169 srand( getMicrotime()*1000);169 srand(microtime(true)*1000); 170 170 $salt = ''; 171 171 $lenKey = strlen($key); -
Model/Guest.php
r7f46ca8 r3605ef4 94 94 95 95 function generateKey($data) { 96 srand( getMicrotime()*1000);96 srand(microtime(true)*1000); 97 97 $h = ''; 98 98 for ($i = 0; $i < 128; $i++) { -
Model/Media.php
re449ecc0 r3605ef4 241 241 } 242 242 243 $data['Media']['isOwner'] = ife($data['Media']['user_id'] == $user['User']['id'], true, false);243 $data['Media']['isOwner'] = ($data['Media']['user_id'] == $user['User']['id']) ? true : false; 244 244 $data['Media']['canWriteAcl'] = $this->checkAccess(&$data, &$user, 1, 0, &$groups); 245 $data['Media']['isDirty'] = ife(($data['Media']['flag'] & MEDIA_FLAG_DIRTY) > 0, true, false);245 $data['Media']['isDirty'] = (($data['Media']['flag'] & MEDIA_FLAG_DIRTY) > 0) ? true : false; 246 246 247 247 return $data; -
Model/User.php
re449ecc0 r3605ef4 205 205 @return User model data */ 206 206 function generateKey($data, $length = 10, $alphabet = false) { 207 srand( getMicrotime()*1000);207 srand(microtime(true)*1000); 208 208 209 209 if (!$alphabet || strlen(strval($alphabet)) < 10) { -
View/Browser/index.ctp
re449ecc0 r3605ef4 1 <h1><?php __('File Browser'); ?></h1>1 <h1><?php echo __('File Browser'); ?></h1> 2 2 3 <?php echo $ session->flash(); ?>3 <?php echo $this->Session->flash(); ?> 4 4 5 <?php echo $ form->create('Browser', array('action' => 'import/'.$path)); ?>5 <?php echo $this->Form->create('Browser', array('action' => 'import/'.$path)); ?> 6 6 7 <p><?php printf(__("Location %s", true), $fileList->location($path)); ?>7 <p><?php echo __("Location %s", $this->FileList->location($path)); ?> 8 8 <?php if ($isInternal) { 9 printf(__(" (%s or %s here)", true),10 $ html->link(__("Upload files", true), 'upload/'.$path),11 $ html->link(__("create folder", true), 'folder/'.$path));9 echo __(" (%s or %s here)", 10 $this->Html->link(__("Upload files"), 'upload/'.$path), 11 $this->Html->link(__("create folder"), 'folder/'.$path)); 12 12 } ?>. 13 13 14 <?php echo $ fileList->table($path, $dirs, $files, array('isInternal' => $isInternal)); ?>14 <?php echo $this->FileList->table($path, $dirs, $files, array('isInternal' => $isInternal)); ?> 15 15 16 <p><?php printf(__("Location %s", true), $fileList->location($path)); ?>16 <p><?php echo __("Location %s", $this->FileList->location($path)); ?> 17 17 <?php if ($isInternal) { 18 printf(__(" (%s or %s here)", true),19 $ html->link(__("Upload files", true), 'upload/'.$path),20 $ html->link(__("create folder", true), 'folder/'.$path));18 echo __(" (%s or %s here)", 19 $this->Html->link(__("Upload files"), 'upload/'.$path), 20 $this->Html->link(__("create folder"), 'folder/'.$path)); 21 21 } ?>. 22 22 </p> 23 23 24 24 <?php 25 echo $ form->submit(__('Import', true));26 echo $ form->end();25 echo $this->Form->submit(__('Import')); 26 echo $this->Form->end(); 27 27 ?> -
View/Browser/sync.ctp
re449ecc0 r3605ef4 1 <h1><?php __("Meta Data Synchronization"); ?></h1>1 <h1><?php echo __("Meta Data Synchronization"); ?></h1> 2 2 3 <?php echo $ session->flash(); ?>3 <?php echo $this->Session->flash(); ?> 4 4 5 <p><?php __("phTagr embedds meta data like tags, categories, or (geo) location information direct into the image video files."); ?></p>5 <p><?php echo __("phTagr embedds meta data like tags, categories, or (geo) location information direct into the image video files."); ?></p> 6 6 7 <p><?php __("Note: In case you are using phTagr with external paths it is recommended to synchronize your images to store this important information within the media file. After the synchronization these mata data could be read by other image programs or desktop search engines."); ?>7 <p><?php echo __("Note: In case you are using phTagr with external paths it is recommended to synchronize your images to store this important information within the media file. After the synchronization these mata data could be read by other image programs or desktop search engines."); ?> 8 8 9 9 <?php if ($this->data['action'] != 'run' && $this->data['unsynced'] > 0): ?> 10 <p><?php printf(__("You have %d unsynchronized media. Click %s to start the synchronization (this might take some time)", true), $this->data['unsynced'], $html->link(__("sync", true), 'sync/run')); ?></p>10 <p><?php echo __("You have %d unsynchronized media. Click %s to start the synchronization (this might take some time)", $this->data['unsynced'], $this->Html->link(__("sync", true), 'sync/run')); ?></p> 11 11 <?php endif; ?> 12 12 13 13 <?php if ($this->data['unsynced'] == 0): ?> 14 <div class="info"><?php __("All media are synchronized"); ?></div>14 <div class="info"><?php echo __("All media are synchronized"); ?></div> 15 15 <?php endif; ?> 16 16 17 17 <?php if (count($this->data['errors'])): ?> 18 <div class="error"><?php __("Some files could not be updated with new metadata. Mainly this happens if the files are write protected. Please have a look to the log files for details."); ?></div>18 <div class="error"><?php echo __("Some files could not be updated with new metadata. Mainly this happens if the files are write protected. Please have a look to the log files for details."); ?></div> 19 19 <?php endif; ?> 20 20 21 21 <?php if ($this->data['action'] == 'run'): ?> 22 22 <p><?php 23 printf(__("Synchronized %d media.", true), count($this->data['synced']));23 echo __("Synchronized %d media.", count($this->data['synced'])); 24 24 if ($this->data['unsynced']) { 25 printf(__(" %d media remains unsynced. Click %s to synchronize again", true), $this->data['unsynced'], $html->link(__('sync', true), 'sync/run'));25 echo __(" %d media remains unsynced. Click %s to synchronize again", $this->data['unsynced'], $this->Html->link(__('sync', 'sync/run'))); 26 26 } 27 27 ?></p> -
View/Elements/topnav.ctp
re449ecc0 r3605ef4 5 5 $name = $session->read('User.username'); 6 6 if ($role >= ROLE_SYSOP) { 7 echo $html->link(__('System' , true), "/admin/system/general")." | ";7 echo $html->link(__('System'), "/admin/system/general")." | "; 8 8 } 9 9 if ($role >= ROLE_USER) { 10 echo $html->link(__('Preferences' , true), "/options/profile")." | ";10 echo $html->link(__('Preferences'), "/options/profile")." | "; 11 11 } 12 echo $html->link(__("Logout" , true), "/users/logout"). " ($name)";12 echo $html->link(__("Logout"), "/users/logout"). " ($name)"; 13 13 } else { 14 echo $html->link(__("Login" , true), "/users/login");14 echo $html->link(__("Login"), "/users/login"); 15 15 if ($option->get('user.register.enable', 0)) { 16 16 echo ' | '.$html->link(__("Register", true), "/users/register"); -
View/Helper/FileListHelper.php
re449ecc0 r3605ef4 80 80 $actions = array(); 81 81 if ($options['isInternal']) { 82 $actions[] = $this->Html->link('delete', "delete/$path", array('style' => 'color: red', 'onclick' => "return confirm('" . sprintf(__('Delete folder %s?', true), $path) . "')"));82 $actions[] = $this->Html->link('delete', "delete/$path", array('style' => 'color: red', 'onclick' => "return confirm('" . __('Delete folder %s?', $path) . "')")); 83 83 } 84 84 $row[] = implode('', $actions); … … 93 93 if (isset($file['media_id'])) { 94 94 $mediaLink = $this->Html->link($file['media_id'], '/images/view/'.$file['media_id']); 95 $unlink = $this->Html->link('unlink', "unlink/$path/{$file['file']}", array('style' => 'color: red', 'title' => __('Unlink media from this file' , true)));95 $unlink = $this->Html->link('unlink', "unlink/$path/{$file['file']}", array('style' => 'color: red', 'title' => __('Unlink media from this file'))); 96 96 $row[] = $mediaLink.' '.$unlink; 97 97 } else { … … 103 103 // Download link for internal files and imported external files 104 104 if ($options['isInternal'] || $file['media_id'] > 0) { 105 $icon = $this->Html->image('icons/disk.png', array('alt' => 'download', 'title' => sprintf(__('Download %s', true), $file['file'])));105 $icon = $this->Html->image('icons/disk.png', array('alt' => 'download', 'title' => __('Download %s', $file['file']))); 106 106 $actions[] = $this->Html->link($icon, "index/$path/{$file['file']}", array('escape' => false)); 107 107 } … … 121 121 if ($path != '/') { 122 122 $parentPath = dirname($path); 123 $cells[] = $this->_dirRow($parentPath, __('(parent folder)' , true), array('checkBox' => false, 'isInternal' => false));123 $cells[] = $this->_dirRow($parentPath, __('(parent folder)'), array('checkBox' => false, 'isInternal' => false)); 124 124 } 125 $cells[] = $this->_dirRow($path, __('(this folder)' , true), $options);125 $cells[] = $this->_dirRow($path, __('(this folder)'), $options); 126 126 usort($dirs, array("FileListHelper", "_cmpFile")); 127 127 usort($files, array("FileListHelper", "_cmpFile")); … … 135 135 $out .= "<thead>\n"; 136 136 $out .= $this->Html->tableHeaders( 137 array('', __('Name' , true), __('Media', true), __('Size', true), __('Actions', true))137 array('', __('Name'), __('Media'), __('Size'), __('Actions')) 138 138 ); 139 139 $out .= "</thead>\n"; -
View/Helper/ImageDataHelper.php
re449ecc0 r3605ef4 22 22 */ 23 23 24 App:: import('Core', 'Sanitize');24 App::uses('Sanitize', 'Utility'); 25 25 26 26 class ImageDataHelper extends AppHelper { -
View/Helper/SearchHelper.php
re449ecc0 r3605ef4 22 22 */ 23 23 24 App::import('File', 'Search', array('file' => APP.'search.php')); 24 if (!class_exists('Search')) { 25 App::import('File', 'Search', array('file' => APP.'search.php')); 26 } 25 27 26 28 class SearchHelper extends Search { -
View/Layouts/backend.ctp
re449ecc0 r3605ef4 1 <?php echo $ html->docType('xhtml-strict'); ?>1 <?php echo $this->Html->docType('xhtml-strict'); ?> 2 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 3 … … 5 5 <title><?php echo $title_for_layout?></title> 6 6 <?php 7 echo $ html->charset('UTF-8')."\n";8 echo $ html->meta('icon')."\n";9 echo $ html->css('backend')."\n";10 echo $ html->script('phtagr');7 echo $this->Html->charset('UTF-8')."\n"; 8 echo $this->Html->meta('icon')."\n"; 9 echo $this->Html->css('backend')."\n"; 10 echo $this->Html->script('phtagr'); 11 11 echo $scripts_for_layout; 12 12 ?> … … 18 18 19 19 <div id="header"><div class="sub"> 20 <?php echo $ html->link(__('Gallery', true), '/'); ?>20 <?php echo $this->Html->link(__('Gallery', true), '/'); ?> 21 21 </div></div> 22 22 … … 26 26 <div class="box"> 27 27 <h1>Menu</h1> 28 <?php echo $ menu->menu('main'); ?>28 <?php echo $this->Menu->menu('main'); ?> 29 29 </div> 30 30 </div> … … 35 35 36 36 <div id="footer"><div class="sub"> 37 <p>© 2006-2011 by <?php echo $ html->link("Gallery phTagr", 'http://www.phtagr.org'); ?></p>37 <p>© 2006-2011 by <?php echo $this->Html->link("Gallery phTagr", 'http://www.phtagr.org'); ?></p> 38 38 </div></div> 39 39 </body> -
View/Layouts/default.ctp
re449ecc0 r3605ef4 1 <?php echo $ html->docType('xhtml-strict'); ?>1 <?php echo $this->Html->docType('xhtml-strict'); ?> 2 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 3 … … 5 5 <title><?php echo $title_for_layout?></title> 6 6 <?php 7 echo $ html->charset('UTF-8')."\n";8 echo $ html->meta('icon')."\n";9 echo $ html->css('default')."\n";10 echo $ html->script('jquery-1.5.1.min');7 echo $this->Html->charset('UTF-8')."\n"; 8 echo $this->Html->meta('icon')."\n"; 9 echo $this->Html->css('default')."\n"; 10 echo $this->Html->script('jquery-1.5.1.min'); 11 11 // jquery ui 12 echo $ html->css('custom-phtagr/jquery-ui-1.8.14.custom');13 echo $ html->script('jquery-ui-1.8.14.custom.min');12 echo $this->Html->css('custom-phtagr/jquery-ui-1.8.14.custom'); 13 echo $this->Html->script('jquery-ui-1.8.14.custom.min'); 14 14 15 echo $ html->script('jquery-phtagr');15 echo $this->Html->script('jquery-phtagr'); 16 16 echo $scripts_for_layout; 17 17 echo $feeds_for_layout; … … 22 22 23 23 <div id="header"><div class="sub"> 24 <h1><?php echo $ option->get('general.title', 'phTagr.'); ?></h1>25 <span class="subtitle"><?php echo $ option->get('general.subtitle', 'Tag Your Photos Once And Find Them Forever'); ?></span>26 <?php echo $ menu->menu('top-menu'); ?>24 <h1><?php echo $this->Option->get('general.title', 'phTagr.'); ?></h1> 25 <span class="subtitle"><?php echo $this->Option->get('general.subtitle', 'Tag Your Photos Once And Find Them Forever'); ?></span> 26 <?php echo $this->Menu->menu('top-menu'); ?> 27 27 </div></div><!-- #header/sub --> 28 28 29 29 <div id="main-menu"><div class="sub"> 30 <?php echo $ menu->menu('main-menu'); ?>30 <?php echo $this->Menu->menu('main-menu'); ?> 31 31 </div></div><!-- #main-menu/sub --> 32 32 … … 40 40 41 41 <div id="footer"><div class="sub"> 42 <p>© 2006-2011 by <?php echo $ html->link("Open Source Web Gallery phTagr", 'http://www.phtagr.org'); ?></p>42 <p>© 2006-2011 by <?php echo $this->Html->link("Open Source Web Gallery phTagr", 'http://www.phtagr.org'); ?></p> 43 43 </div></div><!-- #footer/sub --> 44 44 -
View/Setup/admin_upgrade.ctp
re449ecc0 r3605ef4 1 1 <h1><?php __("Database upgrade"); ?></h1> 2 2 3 <?php echo $ session->flash(); ?>3 <?php echo $this->Session->flash(); ?> 4 4 5 5 <div class="info"> … … 7 7 </div> 8 8 9 <?php echo $ html->link(__("Upgrade", true), '/admin/setup/upgrade/run'); ?> or10 <?php echo $ html->link(__("Cancel", true), '/'); ?>9 <?php echo $this->Html->link(__("Upgrade", true), '/admin/setup/upgrade/run'); ?> or 10 <?php echo $this->Html->link(__("Cancel", true), '/'); ?> 11 11 -
View/Users/login.ctp
re449ecc0 r3605ef4 1 <?php echo $ session->flash(); ?>1 <?php echo $this->Session->flash(); ?> 2 2 3 <?php echo $ form->create('User', array('action' => 'login', 'class' => 'login')); ?>3 <?php echo $this->Form->create('User', array('action' => 'login', 'class' => 'login')); ?> 4 4 <fieldset> 5 5 <legend><?php __('Login'); ?></legend> 6 6 <?php 7 echo $ form->input('User.username', array('label' => __('Username', true)));8 echo $ form->input('User.password', array('label' => __('Password', true)));7 echo $this->Form->input('User.username', array('label' => __('Username', true))); 8 echo $this->Form->input('User.password', array('label' => __('Password', true))); 9 9 ?> 10 10 </fieldset> … … 13 13 $signup = ''; 14 14 15 echo $ form->submit(__('Login', true), array('div' => false));15 echo $this->Form->submit(__('Login', true), array('div' => false)); 16 16 if ($register) { 17 echo " ".$ html->link(__('Sign Up', true), 'register', array('class' => 'button'))." ";17 echo " ".$this->Html->link(__('Sign Up', true), 'register', array('class' => 'button'))." "; 18 18 } 19 echo "<br/>".$ html->link(__('Forgot your password', true), 'password');19 echo "<br/>".$this->Html->link(__('Forgot your password', true), 'password'); 20 20 ?> 21 21 </div> 22 22 <?php 23 echo $ form->end();23 echo $this->Form->end(); 24 24 $script = <<<'JS' 25 25 (function($) { -
View/home/index.ctp
re449ecc0 r3605ef4 1 1 <div id="random-media"> 2 <h3><?php __("Random Media"); ?></h3>2 <h3><?php echo __("Random Media"); ?></h3> 3 3 <?php 4 4 if (count($randomMedia)) { 5 5 $media = $randomMedia[0]; 6 $params = '/'.$ search->serialize(array('sort' => 'random'));6 $params = '/'.$this->Search->serialize(array('sort' => 'random')); 7 7 8 $cite = "<cite>" . sprintf(__("%s by %s", true), h($media['Media']['name']), $html->link($media['User']['username'], '/explorer/user/' . $media['User']['username'])) . "</cite>";8 $cite = "<cite>" . __("%s by %s", h($media['Media']['name']), $this->Html->link($media['User']['username'], '/explorer/user/' . $media['User']['username'])) . "</cite>"; 9 9 10 echo $ html->tag('div',11 $ imageData->mediaLink($media, array('type' => 'preview', 'params' => $params, 'width' => 470)).$cite,10 echo $this->Html->tag('div', 11 $this->ImageData->mediaLink($media, array('type' => 'preview', 'params' => $params, 'width' => 470)).$cite, 12 12 array('class' => 'clip', 'escape' => false)); 13 13 14 $link = $ search->getUri(array('sort' => 'random'));15 echo "<p>" . sprintf(__("See more %s", true), $html->link(__('random media...', true), $link))."</p>";14 $link = $this->Search->getUri(array('sort' => 'random')); 15 echo "<p>" . __("See more %s", $this->Html->link(__('random media...', true), $link))."</p>"; 16 16 } 17 17 ?> … … 19 19 20 20 <div id="newest-media"> 21 <h3><?php __("Newest Media"); ?></h3>21 <h3><?php echo __("Newest Media"); ?></h3> 22 22 <?php 23 23 $links = array(); … … 29 29 } 30 30 $pos = $i + 1; 31 $page = ceil($pos / $ search->getShow(12));32 $params = '/'.$ search->serialize(array('sort' => 'newest', 'page' => $page, 'pos' => $pos), false, false, array('defaults' => array('pos' => 1)));33 $links[] = $ imageData->mediaLink($newMedia[$i], array('type' => 'mini', 'params' => $params));31 $page = ceil($pos / $this->Search->getShow(12)); 32 $params = '/'.$this->Search->serialize(array('sort' => 'newest', 'page' => $page, 'pos' => $pos), false, false, array('defaults' => array('pos' => 1))); 33 $links[] = $this->ImageData->mediaLink($newMedia[$i], array('type' => 'mini', 'params' => $params)); 34 34 } 35 echo $ html->tag('div', implode("\n", $links), array('class' => 'images', 'escape' => false));36 $link = $ search->getUri(array('sort' => 'newest'));37 echo "<p>" . sprintf(__("See %s", true), $html->link(__('all new media...', true), $link))."</p>";35 echo $this->Html->tag('div', implode("\n", $links), array('class' => 'images', 'escape' => false)); 36 $link = $this->Search->getUri(array('sort' => 'newest')); 37 echo "<p>" . __("See %s", $this->Html->link(__('all new media...', true), $link))."</p>"; 38 38 ?> 39 39 </div> 40 40 41 41 <div id="recent-comments"> 42 <h3><?php __("Recent Comments"); ?></h3>42 <h3><?php echo __("Recent Comments"); ?></h3> 43 43 <?php if ($comments): ?> 44 44 <div class="comments"> … … 46 46 <?php foreach ($comments as $comment): ?> 47 47 <div class="comment <?php echo ($count++ % 2) ? 'even' : 'odd'; ?>"> 48 <?php echo $ imageData->mediaLink($comment, array('type' => 'mini', 'div' => 'image')); ?>48 <?php echo $this->ImageData->mediaLink($comment, array('type' => 'mini', 'div' => 'image')); ?> 49 49 <div class="meta"> 50 50 <span class="from"><?php echo $comment['Comment']['name'] ?></span> said … … 58 58 <?php endforeach; /* comments */ ?> 59 59 </div><!-- comments --> 60 <p><?php echo $ html->link(__("Older comments...", true), "/comments", array('escape' => false));?></p>60 <p><?php echo $this->Html->link(__("Older comments..."), "/comments", array('escape' => false));?></p> 61 61 <?php endif; ?> 62 62 </div> 63 63 64 64 <div id="tag-cloud"> 65 <h3><?php __("Popular Tags"); ?></h3>65 <h3><?php echo __("Popular Tags"); ?></h3> 66 66 <div class="cloud"> 67 67 <?php 68 68 if (isset($cloudTags) && count($cloudTags)) { 69 echo $ cloud->cloud($cloudTags, '/explorer/tag/');69 echo $this->Cloud->cloud($cloudTags, '/explorer/tag/'); 70 70 } else { 71 71 echo '<p>' . __("No tags assigned") . '</p>'; … … 75 75 76 76 <div id="category-cloud"> 77 <h3><?php __("Popular Categories"); ?></h3>77 <h3><?php echo __("Popular Categories"); ?></h3> 78 78 <div class="cloud"> 79 79 <?php 80 80 if (isset($cloudCategories) && count($cloudCategories)) { 81 echo $ cloud->cloud($cloudCategories, '/explorer/category/');81 echo $this->Cloud->cloud($cloudCategories, '/explorer/category/'); 82 82 } else { 83 83 echo '<p>' . __("No categories assigned") . '</p>';
