Skip to content
Snippets Groups Projects
Commit cf87a178 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

dev #26470 fix rt comments

parent 96ac4aba
Branches
Tags
2 merge requests!990Dev#26470 setup domain url,!977Dev#26470 setup domain url
<h2><?php echo $this->traduire('Version');?>&nbsp;:
<a href='http://git.afi-sa.fr/afi/opacce/blob/master/VERSIONS'><?php echo BOKEH_RELEASE_NUMBER ?></a>
</h2>
<a href='http://git.afi-sa.fr/afi/opacce/blob/master/VERSIONS'><?php echo BOKEH_RELEASE_NUMBER ?></a>
</h2>
<h2><?php echo $this->traduire('Paramètres du site');?>&nbsp;:</h2>
<h2><?php echo $this->traduire('Paramètres du site');?>&nbsp;:</h2>
<?php
$profil = Class_Profil::getCurrentProfil();
$lien_edit_site = $lien = '';
......@@ -17,9 +17,16 @@ if ($this->user->isAdmin()) {
}
echo $this->ligneInfos("Etat du site", $this->etat_site . $lien)
. $this->ligneInfos("Profil", $profil->getLibelle() . $lien_edit_site)
. $this->ligneInfos("Thème", $profil->getSkin());
. $this->ligneInfos("Profil", $profil->getLibelle() . $lien_edit_site)
. $this->ligneInfos("Thème", $profil->getSkin())
. $this->ligneInfos('Nom du domaine',
Class_AdminVar::get('NOM_DOMAINE') . $this->tagAnchor($this->url(['module' => 'admin',
'controller' => 'index',
'action' => 'adminvaredit',
'cle'=> 'NOM_DOMAINE']),
'» Modifier «',
['style' => 'margin-left: 30px;',
'data-popup' => 'true']));
?>
<h2><?php echo $this->traduire('Accès');?>&nbsp;:</h2>
......@@ -39,9 +46,9 @@ echo $this->url(array('module' => 'opac',
'controller' => 'rss',
'action' => 'moderations'));
?>"><img src="<?php echo URL_ADMIN_IMG;?>/rss.gif" alt="RSS"/></a>
</h2>
</h2>
<?php
$moderer = new Class_Moderer();
$moderer = new Class_Moderer();
$modstats = $moderer->getModerationStats();
foreach ($modstats as $stat) {
$nombre = ($stat['count']) ? $stat['count'] : 'aucun';
......@@ -57,19 +64,19 @@ foreach ($modstats as $stat) {
<h2>Participez à la communauté !</h2>
<div class='ligne_info'><a onclick="window.open(this.href); return false" href="https://groups.google.com/group/utilisateurs-bokeh">Google group Bokeh</a></div>
<div class='ligne_info'><a onclick="window.open(this.href); return false" href="http://wiki.bokeh-library-portal.org">Wiki Bokeh</a></div>
<div class='ligne_info'><a onclick="window.open(this.href); return false" href="http://wiki.bokeh-library-portal.org">Wiki Bokeh</a></div>
<h2>Forum Bokeh :</h2>
<iframe id="forum_embed"
src="javascript:void(0)"
scrolling="no"
frameborder="0"
width="700"
height="700">
</iframe>
<h2>Forum Bokeh :</h2>
<iframe id="forum_embed"
src="javascript:void(0)"
scrolling="no"
frameborder="0"
width="700"
height="700">
</iframe>
<script type="text/javascript">
document.getElementById("forum_embed").src =
<script type="text/javascript">
document.getElementById("forum_embed").src =
"https://groups.google.com/forum/embed/?place=forum/utilisateurs-bokeh" +
"&showsearch=true&hl=fr&hideforumtitle=true&showpopout=true";
</script>
......@@ -77,12 +84,12 @@ foreach ($modstats as $stat) {
<script>
(function() {
function supportsCanvas() {
return !!document.createElement('canvas').getContext;
}
function supportsCanvas() {
return !!document.createElement('canvas').getContext;
}
if (!supportsCanvas())
showNotification({message: 'Votre navigateur ne permet pas d\'utiliser pleinement l\'interface d\'administration. Pour un fonctionnement optimal, nous recommandons d\'utiliser une version récente de Firefox, Chrome, Safari ou Internet Explorer',
type: 'error'});
if (!supportsCanvas())
showNotification({message: 'Votre navigateur ne permet pas d\'utiliser pleinement l\'interface d\'administration. Pour un fonctionnement optimal, nous recommandons d\'utiliser une version récente de Firefox, Chrome, Safari ou Internet Explorer',
type: 'error'});
})();
</script>
......@@ -25,11 +25,12 @@ class Class_Url {
public static function getForbidenUrls() {
if(!defined('FORBIDEN_URLS'))
return static::$_forbiden_urls = null ;
$forbiden_urls = [];
if(defined('FORBIDEN_URLS'))
$forbiden_urls = unserialize(FORBIDEN_URLS);
  • Laurent @llaffont ·
    Owner

    Je suis relou :) j'aime pas FORBIDEN_URLS.... AUTO_UPDATE_DOMAIN_EXCLUDE_URLS ?

  • Please register or sign in to reply
if(!static::$_forbiden_urls)
return static::$_forbiden_urls = unserialize(FORBIDEN_URLS);
return static::$_forbiden_urls = $forbiden_urls; // php compatibility define not compatbile with array (until php 5.7) use : defineConstante('NOM_DOMAINE', serialize(array()));
return static::$_forbiden_urls;
}
......@@ -47,19 +48,6 @@ class Class_Url {
}
public static function isAllowedDomain($forbiden_urls, $url) {
if(!$forbiden_urls)
return true;
foreach($forbiden_urls as $forbiden_url ) {
if(strpos($url, $forbiden_url ) !== false)
return false;
}
return true;
}
public static function baseUrl() {
$parts = array_diff(array_filter(explode('/', $_SERVER['SCRIPT_NAME'])),
['index.php']);
......
......@@ -21,13 +21,28 @@
class ZendAfi_Controller_Plugin_SetupDomain extends Zend_Controller_Plugin_Abstract {
public function preDispatch(Zend_Controller_Request_Abstract $request) {
$current = Class_Adminvar::get('NOM_DOMAINE');
if(Class_Adminvar::get('NOM_DOMAINE'))
return;
$site_url = Class_Url::siteUrl();
if(!Class_Url::isAllowedDomain(Class_Url::getForbidenUrls(), $site_url))
if(!self::isAllowedDomain(Class_Url::getForbidenUrls(), $site_url))
return;
Class_Adminvar::set('NOM_DOMAINE', $site_url);
}
protected static function isAllowedDomain($forbiden_urls, $url) {
if(!$forbiden_urls)
return true;
foreach($forbiden_urls as $forbiden_url ) {
if(strpos($url, $forbiden_url ) !== false)
return false;
}
return true;
}
}
?>
\ No newline at end of file
......@@ -116,9 +116,6 @@ function setupConstants() {
defineConstant('IMAGE_MAGICK_PATH', 'convert');
defineConstant('PATCH_PATH', ROOT_PATH . '/cosmogramme/sql/patch/');
defineConstant('FORBIDEN_URLS', serialize(['opac3.pergame.net',
'web.afi-sa.net']));
}
......
......@@ -24,6 +24,11 @@ require_once 'AdminAbstractControllerTestCase.php';
class IndexControllerIndexTest extends Admin_AbstractControllerTestCase {
public function setUp() {
parent::setUp();
$this->fixture('Class_AdminVar',
['id' => 'NOM_DOMAINE',
'clef' => 'NOM_DOMAINE',
'valeur' => 'http://bokeh-library-portal.org']);
$this->dispatch('/admin/index/index', true);
}
......@@ -39,6 +44,18 @@ class IndexControllerIndexTest extends Admin_AbstractControllerTestCase {
public function embedForumShouldBePresent() {
$this->assertXPathContentContains('//script', 'embed/?place=forum/utilisateurs-bokeh');
}
/** @test */
public function domaineNameShouldPresent() {
$this->assertXPathContentContains('//div/b', 'http://bokeh-library-portal.org');
}
/** @test */
public function editDomaineNameLinkShouldBePresent() {
$this->assertXPathContentContains('//a[contains(@href, "/admin/index/adminvaredit/cle/NOM_DOMAINE")]','Modifier', $this->_response->getBody());
}
}
......
......@@ -42,7 +42,7 @@ class IndexControllerSetupDomainTest extends AbstractControllerTestCase {
'clef' => 'NOM_DOMAINE',
'valeur' => 'http://bokeh-library-protal.org']);
$this->dispatch('/');
$this->assertEquals('http://bokeh-library-protal.org', Class_AdminVar::get('NOM_DOMAINE'));
$this->assertEquals('http://bokeh-library-protal.org', Class_Url::siteUrl());
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment