mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixes #3305, Console i18n extract using wrong paths.
Closes #3396, i18n fixes Fixed TranslateBehavior::_getLocale() throwing error if I18n class had not been loaded Added [P]roject to bake Updated locale pot file Removed css and js directories from skel git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5809 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
6e848de479
commit
e78fc1e90c
15 changed files with 1113 additions and 452 deletions
|
@ -55,9 +55,10 @@ class BakeShell extends Shell {
|
|||
$this->out('[M]odel');
|
||||
$this->out('[V]iew');
|
||||
$this->out('[C]ontroller');
|
||||
$this->out('[P]roject');
|
||||
$this->out('[Q]uit');
|
||||
|
||||
$classToBake = strtoupper($this->in('What would you like to Bake?', array('D', 'M', 'V', 'C', 'Q')));
|
||||
$classToBake = strtoupper($this->in('What would you like to Bake?', array('D', 'M', 'V', 'C', 'P', 'Q')));
|
||||
switch($classToBake) {
|
||||
case 'D':
|
||||
$this->DbConfig->execute();
|
||||
|
@ -71,6 +72,9 @@ class BakeShell extends Shell {
|
|||
case 'C':
|
||||
$this->Controller->execute();
|
||||
break;
|
||||
case 'P':
|
||||
$this->Project->execute();
|
||||
break;
|
||||
case 'Q':
|
||||
exit(0);
|
||||
break;
|
||||
|
|
|
@ -84,7 +84,21 @@ class ExtractTask extends Shell{
|
|||
if (isset($this->params['path'])) {
|
||||
$this->path = $this->params['path'];
|
||||
} else {
|
||||
$this->path = ROOT . DS . APP_DIR;
|
||||
$response = '';
|
||||
while ($response == '') {
|
||||
$response = $this->in("What is the full path you would like to extract?\nExample: " . $this->params['root'] . DS . "myapp\n[Q]uit", null, 'Q');
|
||||
if (strtoupper($response) === 'Q') {
|
||||
$this->out('Extract Aborted');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
if (is_dir($response)) {
|
||||
$this->path = $response;
|
||||
} else {
|
||||
$this->err('The directory path you supplied was not found. Please try again.');
|
||||
$this->initialize();
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->params['debug'])) {
|
||||
|
@ -95,7 +109,21 @@ class ExtractTask extends Shell{
|
|||
if (isset($this->params['output'])) {
|
||||
$this->__output = $this->params['output'];
|
||||
} else {
|
||||
$this->__output = APP . 'locale' . DS;
|
||||
$response = '';
|
||||
while ($response == '') {
|
||||
$response = $this->in("What is the full path you would like to output?\nExample: " . $this->path . DS . "locale\n[Q]uit", null, $this->path . DS . "locale");
|
||||
if (strtoupper($response) === 'Q') {
|
||||
$this->out('Extract Aborted');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
if (is_dir($response)) {
|
||||
$this->__output = $response . DS;
|
||||
} else {
|
||||
$this->err('The directory path you supplied was not found. Please try again.');
|
||||
$this->initialize();
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->files)) {
|
||||
|
@ -413,6 +441,23 @@ class ExtractTask extends Shell{
|
|||
} else {
|
||||
$fileList = 'No version information was available in the source files.';
|
||||
}
|
||||
|
||||
if (is_file($this->__output . $file)) {
|
||||
$response = '';
|
||||
while ($response == '') {
|
||||
$response = $this->in("\n\nError: ".$file . ' already exists in this location. Overwrite?', array('y','n', 'q'), 'n');
|
||||
if (strtoupper($response) === 'Q') {
|
||||
$this->out('Extract Aborted');
|
||||
exit();
|
||||
} elseif (strtoupper($response) === 'N') {
|
||||
$response = '';
|
||||
while ($response == '') {
|
||||
$response = $this->in("What would you like to name this file?\nExample: new_" . $file, null, "new_" . $file);
|
||||
$file = $response;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$fp = fopen($this->__output . $file, 'w');
|
||||
fwrite($fp, str_replace('--VERSIONS--', $fileList, join('', $content)));
|
||||
fclose($fp);
|
||||
|
|
|
@ -87,8 +87,19 @@ class ProjectTask extends Shell {
|
|||
while ($response == false && is_dir($project) === true && config('core') === true) {
|
||||
$response = $this->in('A project already exists in this location: '.$project.' Overwrite?', array('y','n'), 'n');
|
||||
if (low($response) === 'n') {
|
||||
$this->out('Bake Aborted');
|
||||
exit();
|
||||
$response = false;
|
||||
|
||||
while (!$response) {
|
||||
$response = $this->in("What is the full path for this app including the app directory name?\nExample: ".$this->params['root'] . DS . "myapp\n[Q]uit", null, 'Q');
|
||||
if (strtoupper($response) === 'Q') {
|
||||
$this->out('Bake Aborted');
|
||||
exit();
|
||||
}
|
||||
$this->params['working'] = null;
|
||||
$this->params['app'] = null;
|
||||
$this->execute($response);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -187,6 +198,8 @@ class ProjectTask extends Shell {
|
|||
} elseif (low($looksGood) == 'q' || low($looksGood) == 'quit') {
|
||||
$this->out('Bake Aborted.');
|
||||
} else {
|
||||
$this->params['working'] = null;
|
||||
$this->params['app'] = null;
|
||||
$this->execute(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ class Dispatcher extends Object {
|
|||
Router::setRequestInfo(array($this->params, array('base' => $this->base, 'webroot' => $this->webroot)));
|
||||
|
||||
return $this->cakeError('error404', array(array('url' => strtolower($controller),
|
||||
'message' => 'Was not found on this server',
|
||||
'message' => __('Was not found on this server'),
|
||||
'base' => $this->base)));
|
||||
} else {
|
||||
Router::setRequestInfo(array($this->params, array('base' => $this->base, 'webroot' => $this->webroot)));
|
||||
|
|
|
@ -166,7 +166,7 @@ class AuthComponent extends Object {
|
|||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $loginError = 'Login failed. Invalid username or password.';
|
||||
var $loginError = '';
|
||||
/**
|
||||
* Error to display when user attempts to access an object or action to which they do not have
|
||||
* acccess.
|
||||
|
@ -174,7 +174,7 @@ class AuthComponent extends Object {
|
|||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $authError = 'You are not authorized to access that location.';
|
||||
var $authError = '';
|
||||
/**
|
||||
* Determines whether AuthComponent will automatically redirect and exit if login is successful.
|
||||
*
|
||||
|
@ -229,6 +229,8 @@ class AuthComponent extends Object {
|
|||
$this->params = $controller->params;
|
||||
$crud = array('create', 'read', 'update', 'delete');
|
||||
$this->actionMap = am($this->actionMap, array_combine($crud, $crud));
|
||||
$this->loginError = __('Login failed. Invalid username or password.', true);
|
||||
$this->authError = __('You are not authorized to access that location.', true);
|
||||
|
||||
$admin = Configure::read('Routing.admin');
|
||||
if (!empty($admin)) {
|
||||
|
@ -367,7 +369,7 @@ class AuthComponent extends Object {
|
|||
*/
|
||||
function __setDefaults() {
|
||||
if (empty($this->userModel)) {
|
||||
trigger_error(__('Could not find $userModel. Please set AuthComponent::$userModel in beforeFilter().', true), E_USER_WARNING);
|
||||
trigger_error(__("Could not find \$userModel. Please set AuthComponent::\$userModel in beforeFilter().", true), E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
if (empty($this->loginAction)) {
|
||||
|
|
|
@ -546,12 +546,12 @@ class Controller extends Object {
|
|||
call_user_func_array(array(&$this, $action), $args);
|
||||
}
|
||||
/**
|
||||
* contoroller callback to tie into Auth component.
|
||||
* controller callback to tie into Auth component.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function isAuthorized() {
|
||||
trigger_error(__($this->name.'::isAuthorized() is not defined.', true), E_USER_WARNING);
|
||||
trigger_error(sprintf(__('%s::isAuthorized() is not defined.', true), $this->name), E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -130,7 +130,7 @@ class ErrorHandler extends Object{
|
|||
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
$this->error(array('code' => '404',
|
||||
'name' => 'Not found',
|
||||
'name' => __('Not found', true),
|
||||
'message' => sprintf(__("The requested address %s was not found on this server.", true), $url, $message),
|
||||
'base' => $base));
|
||||
exit();
|
||||
|
|
|
@ -276,6 +276,9 @@ class TranslateBehavior extends ModelBehavior {
|
|||
*/
|
||||
function _getLocale(&$model) {
|
||||
if (!isset($model->locale) || is_null($model->locale)) {
|
||||
if (!class_exists('I18n')) {
|
||||
uses('i18n');
|
||||
}
|
||||
$I18n =& I18n::getInstance();
|
||||
$model->locale = $I18n->l10n->locale;
|
||||
}
|
||||
|
|
|
@ -541,7 +541,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
*/
|
||||
function setparent(&$model, $parentId = null , $created = null) {
|
||||
extract($this->settings[$model->name]);
|
||||
if ($created ===false && $parentId == $model->field($parent)) {
|
||||
if ($created === false && $parentId == $model->field($parent)) {
|
||||
return true;
|
||||
}
|
||||
return $model->saveField($parent, $parentId);
|
||||
|
@ -641,11 +641,11 @@ class TreeBehavior extends ModelBehavior {
|
|||
|
||||
if (empty ($parentNode)) {
|
||||
return false;
|
||||
}
|
||||
elseif (($model->id == $parentId)) {
|
||||
|
||||
} elseif (($model->id == $parentId)) {
|
||||
return false;
|
||||
}
|
||||
elseif (($node[$left] < $parentNode[$left]) && ($parentNode[$right] < $node[$right])) {
|
||||
|
||||
} elseif (($node[$left] < $parentNode[$left]) && ($parentNode[$right] < $node[$right])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -922,9 +922,13 @@ class FormHelper extends AppHelper {
|
|||
* @param array $options
|
||||
* @return string A HTML submit button
|
||||
*/
|
||||
function submit($caption = 'Submit', $options = array()) {
|
||||
function submit($caption = null, $options = array()) {
|
||||
if (!$caption) {
|
||||
$caption = __('Submit');
|
||||
}
|
||||
$options['value'] = $caption;
|
||||
$secured = null;
|
||||
|
||||
if (isset($this->params['_Token']) && !empty($this->params['_Token'])) {
|
||||
$secured = $this->secure($this->fields);
|
||||
$this->fields = array();
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
<h1><?php echo sprintf(__('Missing Method in %s', true), $controller);?></h1>
|
||||
<p class="error"><?php echo sprintf(__('You are seeing this error because the action <em>%1$s</em> is not defined in controller <em>%2$s</em>', true), $action, $controller);?></p>
|
||||
<p><span class="notice"><?php echo sprintf(__('If you want to customize this error message, create %s.', true), APP_DIR.DS."views".DS."errors".DS."missing_action.ctp");?></span></p>
|
||||
<p><span class="notice"><strong><?php __('Fatal'); ?></strong>
|
||||
<?php echo sprintf(__(': Confirm you have created the %1$s::%2$s in file : %3$s.', true), $controller, $action, APP_DIR.DS."controllers".DS.Inflector::underscore($controller).".php");?></span></p>
|
||||
<p><span class="notice"><strong><?php __('Fatal') ?>: </strong>
|
||||
<?php echo sprintf(__('Confirm you have created the %1$s::%2$s in file : %3$s.', true), $controller, $action, APP_DIR.DS."controllers".DS.Inflector::underscore($controller).".php");?></span></p>
|
||||
<p><?php<br />
|
||||
class <?php echo $controller;?> extends AppController {<br />
|
||||
<strong>function <?php echo $action;?>() {<br />
|
||||
|
|
|
@ -47,7 +47,7 @@ endif;
|
|||
__('Your cache is set up and initialized properly.');
|
||||
$settings = Cache::settings();
|
||||
echo '<p>';
|
||||
echo sprintf(__('%s is being used to cache, to change this edit config'.DS.'core.php ', true), $settings['engine'] . 'Engine');
|
||||
echo sprintf(__('%s is being used to cache, to change this edit config/core.php ', true), $settings['engine'] . 'Engine');
|
||||
echo '</p>';
|
||||
|
||||
echo 'Settings: <ul>';
|
||||
|
@ -60,7 +60,7 @@ endif;
|
|||
__('Your cache is NOT working.');
|
||||
echo '<br />';
|
||||
if (is_writable(TMP . 'cache')):
|
||||
__('Edit: config'.DS.'core.php to insure you have the newset version of this file and the variable $cakeCache set properly');
|
||||
__('Edit: config/core.php to insure you have the newset version of this file and the variable $cakeCache set properly');
|
||||
else:
|
||||
__('Your cache directory is not writable');
|
||||
endif;
|
||||
|
@ -78,7 +78,7 @@ endif;
|
|||
else:
|
||||
__('Your database configuration file is NOT present.');
|
||||
echo '<br/>';
|
||||
__('Rename config'.DS.'database.php.default to config'.DS.'database.php');
|
||||
__('Rename config/database.php.default to config/database.php');
|
||||
endif;
|
||||
?>
|
||||
</span>
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue