mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-29 11:57:55 +00:00
Updated addons MCV stuff
This commit is contained in:
parent
d7c3fe2fd4
commit
e5f44b882b
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* SVN FILE: $Id: bootstrap.php,v 1.1 2006/08/14 23:54:56 sancus%off.net Exp $ */
|
||||
/* SVN FILE: $Id: bootstrap.php,v 1.2 2006/08/18 04:26:43 fligtar%gmail.com Exp $ */
|
||||
/**
|
||||
* Short description for file.
|
||||
*
|
||||
@ -21,9 +21,9 @@
|
||||
* @package cake
|
||||
* @subpackage cake.app.config
|
||||
* @since CakePHP v 0.10.8.2117
|
||||
* @version $Revision: 1.1 $
|
||||
* @version $Revision: 1.2 $
|
||||
* @modifiedby $LastChangedBy: phpnut $
|
||||
* @lastmodified $Date: 2006/08/14 23:54:56 $
|
||||
* @lastmodified $Date: 2006/08/18 04:26:43 $
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
/**
|
||||
@ -42,5 +42,16 @@
|
||||
* $controllerPaths = array('this path to controllers', 'second full path to controllers', 'etc...');
|
||||
*
|
||||
*/
|
||||
|
||||
//Path defines - no trailing slashes
|
||||
define('REPO_PATH', WWW_ROOT.'/files'); // XPI/JAR repository path
|
||||
define('FTP_URL', 'http://ftp.mozilla.org/pub/mozilla.org'); // FTP
|
||||
|
||||
//Addontype ids
|
||||
define('ADDON_EXTENSION', '1');
|
||||
define('ADDON_THEME', '2');
|
||||
define('ADDON_DICTIONARY', '3');
|
||||
define('ADDON_SEARCH', '4');
|
||||
|
||||
//EOF
|
||||
?>
|
||||
?>
|
||||
|
@ -9,7 +9,6 @@ class AddonsController extends AppController
|
||||
*
|
||||
*/
|
||||
function index() {
|
||||
$this->layout = 'developers';
|
||||
$this->set('addons', $this->Addon->findall());
|
||||
}
|
||||
|
||||
@ -18,8 +17,54 @@ class AddonsController extends AppController
|
||||
* @param int $id
|
||||
*/
|
||||
function add($id = 0) {
|
||||
$this->layout = 'developers';
|
||||
|
||||
if (isset($this->data['Addon']['add_step1'])) {
|
||||
$this->render('add_step2');
|
||||
if ($this->data['Addon']['file']['error'] === 0) {
|
||||
$uploadedFile = $this->data['Addon']['file']['tmp_name'];
|
||||
$tempLocation = REPO_PATH.'/temp/'.$this->data['Addon']['file']['name'];
|
||||
|
||||
if (move_uploaded_file($uploadedFile, $tempLocation)) {
|
||||
$uploadedFile = $tempLocation;
|
||||
chmod($uploadedFile, 0644);
|
||||
}
|
||||
else {
|
||||
$this->set('fileError', 'Could not move file');
|
||||
$this->render('add_step1');
|
||||
}
|
||||
|
||||
$manifestExists = false;
|
||||
|
||||
if ($zip = @zip_open($uploadedFile)) {
|
||||
while ($zipEntry = zip_read($zip)) {
|
||||
if (zip_entry_name($zipEntry) == 'install.rdf') {
|
||||
$manifestExists = true;
|
||||
if (zip_entry_open($zip, $zipEntry, 'r')) {
|
||||
$manifestData = zip_entry_read($zipEntry, zip_entry_filesize($zipEntry));
|
||||
zip_entry_close($zipEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
zip_close($zip);
|
||||
}
|
||||
|
||||
if ($manifestExists === true) {
|
||||
|
||||
}
|
||||
|
||||
$this->render('add_step2');
|
||||
}
|
||||
else {
|
||||
$this->Addon->invalidate('file');
|
||||
$fileErrors = array('1' => 'Exceeds maximum upload size',
|
||||
'2' => 'Exceeds maximum upload size',
|
||||
'3' => 'Incomplete transfer',
|
||||
'4' => 'No file uploaded'
|
||||
);
|
||||
$fileError = $fileErrors[$this->data['Addon']['file']['error']];
|
||||
$this->set('fileError', $fileError);
|
||||
$this->render('add_step1');
|
||||
}
|
||||
}
|
||||
elseif (isset($this->data['Addon']['add_step2'])) {
|
||||
$this->render('add_step3');
|
||||
@ -28,6 +73,7 @@ class AddonsController extends AppController
|
||||
$this->render('add_step4');
|
||||
}
|
||||
else {
|
||||
$this->set('fileError', '');
|
||||
$this->render('add_step1');
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?=$html->formTag('/addons/add/')?>
|
||||
<?=$html->formTag('/addons/add/', 'post', array('enctype'=>'multipart/form-data'))?>
|
||||
<?=$html->hidden('Addon/add_step1')?>
|
||||
<?=$html->file('Addon/file')?>
|
||||
<?=$html->tagErrorMsg('Addon/file', 'Please upload your add-on file.')?>
|
||||
Max upload size: <?=ini_get('upload_max_filesize')?><BR />
|
||||
Add-on File: <?=$html->file('Addon/file')?><BR />
|
||||
<?=$html->tagErrorMsg('Addon/file', 'File error: '.$fileError)?>
|
||||
<?=$html->submit()?>
|
||||
|
@ -5,13 +5,13 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" version="-//W3C//DTD XHTML 1.1//EN" xml:lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<link rel="stylesheet" href="css/screen.css"
|
||||
type="text/css" media="screen" />
|
||||
<?=$html->css('screen')?>
|
||||
<?=$html->css('developers')?>
|
||||
<title>Mozilla Add-ons :: Add Features to Mozilla Software</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div style="text-align: center;"><img src="images/remora2.png" /></div>
|
||||
<div style="text-align: center;"><?=$html->image('remora2.png')?></div>
|
||||
<?php echo $content_for_layout ?>
|
||||
<!-- included for sake of consistency with current site -->
|
||||
<div style="clear:both"><br /></div>
|
||||
|
4
webtools/remora/app/webroot/css/developers.css
Normal file
4
webtools/remora/app/webroot/css/developers.css
Normal file
@ -0,0 +1,4 @@
|
||||
.error_message {
|
||||
font-weight: bold;
|
||||
color: red;
|
||||
}
|
Loading…
Reference in New Issue
Block a user