This commit is contained in:
Nicolas Le Goff
2011-12-20 19:58:10 +01:00
10 changed files with 141 additions and 48 deletions

View File

@@ -397,7 +397,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
*/ */
public function set_email($email) public function set_email($email)
{ {
if (!trim($email)) if (trim($email) == '')
$email = null; $email = null;
$test_user = User_Adapter::get_usr_id_from_email($email); $test_user = User_Adapter::get_usr_id_from_email($email);
@@ -873,6 +873,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public static function get_usr_id_from_email($email) public static function get_usr_id_from_email($email)
{ {
if(is_null($email))
return false;
$conn = connection::getPDOConnection(); $conn = connection::getPDOConnection();
$sql = 'SELECT usr_id FROM usr $sql = 'SELECT usr_id FROM usr
WHERE usr_mail = :email WHERE usr_mail = :email

View File

@@ -36,9 +36,44 @@ class module_console_systemUpgrade extends Command
public function execute(InputInterface $input, OutputInterface $output) public function execute(InputInterface $input, OutputInterface $output)
{ {
if(!setup::is_installed()) if (!setup::is_installed())
{ {
throw new RuntimeException('Phraseanet is not set up');
if (file_exists(dirname(__FILE__) . "/../../../../config/connexion.inc")
&& !file_exists(dirname(__FILE__) . "/../../../../config/config.inc")
&& file_exists(dirname(__FILE__) . "/../../../../config/_GV.php"))
{
$output->writeln('This version of Phraseanet requires a config/config.inc');
$output->writeln('Would you like it to be created based on your settings ?');
$dialog = $this->getHelperSet()->get('dialog');
do
{
$continue = mb_strtolower($dialog->ask($output, '<question>' . _('Create automatically') . ' (Y/n)</question>', 'y'));
}
while (!in_array($continue, array('y', 'n')));
if ($continue == 'y')
{
require __DIR__ . "/../../../../config/_GV.php";
$datas = '<?php'."\n"
.'$servername = "'.GV_ServerName.'";'."\n"
.'$maintenance=false;'."\n"
.'$debug=false;'."\n"
.'$debug=true;'."\n"
.'';
file_put_contents(__DIR__ . "/../../../../config/config.inc", $datas);
}
else
{
throw new RuntimeException('Phraseanet is not set up');
}
}
} }
require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php'; require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php';
@@ -59,12 +94,12 @@ class module_console_systemUpgrade extends Command
{ {
$output->write('<info>Upgrading...</info>', true); $output->write('<info>Upgrading...</info>', true);
$appbox = appbox::get_instance(); $appbox = appbox::get_instance();
if(count(User_Adapter::get_wrong_email_users($appbox)) > 0) if (count(User_Adapter::get_wrong_email_users($appbox)) > 0)
{ {
return $output->writeln(sprintf('<error>You have to fix your database before upgrade with the system:mailCheck command </error>')); return $output->writeln(sprintf('<error>You have to fix your database before upgrade with the system:mailCheck command </error>'));
} }
$upgrader = new Setup_Upgrade($appbox); $upgrader = new Setup_Upgrade($appbox);
$advices = $appbox->forceUpgrade($upgrader); $advices = $appbox->forceUpgrade($upgrader);
} }

View File

@@ -1541,6 +1541,7 @@ class task_period_archive extends task_abstract
$record->set_metadatas($meta['metadatas']); $record->set_metadatas($meta['metadatas']);
$record->set_binary_status(databox_status::operation_or($stat0, $stat1)); $record->set_binary_status(databox_status::operation_or($stat0, $stat1));
$record->rebuild_subdefs(); $record->rebuild_subdefs();
$record->reindex();
$rid = $record->get_record_id(); $rid = $record->get_record_id();
$this->log(sprintf((' (recordId %s)'), $rid)); $this->log(sprintf((' (recordId %s)'), $rid));
$this->archivedFiles++; $this->archivedFiles++;
@@ -1881,6 +1882,7 @@ class task_period_archive extends task_abstract
$record->set_metadatas($meta['metadatas']); $record->set_metadatas($meta['metadatas']);
$record->set_binary_status(databox_status::operation_or(databox_status::operation_or($stat0, $stat1), databox_status::hex2bin($hexstat))); $record->set_binary_status(databox_status::operation_or(databox_status::operation_or($stat0, $stat1), databox_status::hex2bin($hexstat)));
$record->rebuild_subdefs(); $record->rebuild_subdefs();
$record->reindex();
$rid = $record->get_record_id(); $rid = $record->get_record_id();
if ($grp_rid !== NULL) if ($grp_rid !== NULL)

View File

@@ -38,6 +38,7 @@ Entities\Basket:
validation: validation:
targetEntity: ValidationSession targetEntity: ValidationSession
mappedBy: basket mappedBy: basket
cascade: ["remove"]
oneToMany: oneToMany:
elements: elements:
targetEntity: BasketElement targetEntity: BasketElement

View File

@@ -36,7 +36,7 @@ Entities\ValidationSession:
participants: participants:
targetEntity: ValidationParticipant targetEntity: ValidationParticipant
mappedBy: session mappedBy: session
cascade: ["remove"]

49
lib/unitTest/userTest.php Normal file
View File

@@ -0,0 +1,49 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2010 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once dirname(__FILE__) . '/PhraseanetPHPUnitAbstract.class.inc';
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class userTest extends PhraseanetPHPUnitAbstract
{
public function testMail()
{
$this->assertFalse(User_Adapter::get_usr_id_from_email(null));
try
{
$appbox = appbox::get_instance();
self::$user->set_email(null);
$this->assertFalse(User_Adapter::get_usr_id_from_email(null));
self::$user->set_email('');
$this->assertFalse(User_Adapter::get_usr_id_from_email(null));
self::$user->set_email('noonealt1@example.com');
$this->assertEquals(self::$user->get_id(), User_Adapter::get_usr_id_from_email('noonealt1@example.com'));
}
catch(Exception $e)
{
$this->fail($e->getMessage());
}
$this->assertFalse(User_Adapter::get_usr_id_from_email(null));
}
}

View File

@@ -86,6 +86,8 @@ $parm = $request->get_parms('section');
$twig = new supertwig(); $twig = new supertwig();
$twig->display('admin/index.html.twig', array( $twig->display('admin/index.html.twig', array(
'module' => 'admin' 'module' => 'admin'
,'events'=> eventsmanager_broker::getInstance($appbox)
,'module_name' => 'Admin'
, 'feature' => $feature , 'feature' => $feature
, 'featured' => $featured , 'featured' => $featured
, 'databoxes' => $databoxes , 'databoxes' => $databoxes

View File

@@ -82,4 +82,10 @@ if(!$task->getGraphicForm())
$twig = new supertwig(); $twig = new supertwig();
$twig->addFilter(array('stripdoublequotes'=>'stripdoublequotes')); $twig->addFilter(array('stripdoublequotes'=>'stripdoublequotes'));
if(!$task->getGraphicForm())
{
$parm['view'] = 'XML';
}
$twig->display('admin/task.html', array('task'=>$task, 'view'=>$parm['view'])); $twig->display('admin/task.html', array('task'=>$task, 'view'=>$parm['view']));

View File

@@ -1,41 +1,36 @@
jQuery(document).ready(function(){
jQuery(document).ready(function(){ var date = new Date();
var date = new Date(); date.setMonth(date.getMonth() + 2);
date.setMonth(date.getMonth() + 2); jQuery.cookie('screen', screen.width+"x"+screen.height, { path: '/', expires: date });
<<<<<<< HEAD
$.cookie('screen', screen.width+"x"+screen.height, { path: '/', expires: date }); var test_cookie = date.getTime();
======= jQuery.cookie('test_cookie'+test_cookie, 'accepted', { path: '/', expires: date });
jQuery.cookie('screen', screen.width+"x"+screen.height, { path: '/', expires: date }); if(!jQuery.cookie('test_cookie'+test_cookie))
>>>>>>> FixHome {
jQuery('.notice.notice_cookie').show();
var test_cookie = date.getTime(); }
jQuery.cookie('test_cookie'+test_cookie, 'accepted', { path: '/', expires: date }); else
if(!jQuery.cookie('test_cookie'+test_cookie)) {
{ date.setMonth(date.getMonth() - 5);
jQuery('.notice.notice_cookie').show(); jQuery.cookie('test_cookie'+test_cookie, '', { path: '/', expires: date });
} }
else
{ return false;
date.setMonth(date.getMonth() - 5); });
jQuery.cookie('test_cookie'+test_cookie, '', { path: '/', expires: date });
} function setLanguage()
{
return false; var date = new Date();
}); date.setMonth(date.getMonth() + 2);
jQuery.cookie('locale', jQuery('#lng-select')[0].value, { path: '/', expires: date });
function setLanguage() window.location.replace(window.location.protocol+"//"+window.location.host+window.location.pathname);
{ }
var date = new Date();
date.setMonth(date.getMonth() + 2); function setTab(tab,el)
jQuery.cookie('locale', jQuery('#lng-select')[0].value, { path: '/', expires: date }); {
window.location.replace(window.location.protocol+"//"+window.location.host+window.location.pathname); jQuery('.tab').removeClass('click');
} jQuery(el).addClass('click');
jQuery('.tab-content').hide();
function setTab(tab,el) jQuery('#id-'+tab).show();
{ }
jQuery('.tab').removeClass('click');
jQuery(el).addClass('click');
jQuery('.tab-content').hide();
jQuery('#id-'+tab).show();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

After

Width:  |  Height:  |  Size: 127 KiB