Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   ZenTracker (http://www.bvlist.com/forumdisplay.php?f=81)
-   -   php page modification needed (http://www.bvlist.com/showthread.php?t=12590)

Giorgatzelos 14th September 2022 22:50

php page modification needed
 
how can i modify this page so partage/ajouter (uploads) are for admins only?

PHP Code:

<!DOCTYPE html>
<html lang="<?=$sf_user->getCulture()?>">
  <head>
    <?php include_http_metas() ?>
    <?php include_metas() ?>
    <meta name="msapplication-task" content="name=<?=__('Add your upload')?>;action-uri=/partage/ajouter;icon-uri=/images/jumplist/add.ico" />
    <meta name="msapplication-task" content="name=<?=__('Forums')?>;action-uri=/forums;icon-uri=/images/jumplist/comments.ico" />
    <meta name="msapplication-task" content="name=<?=__('Members')?>;action-uri=/membres;icon-uri=/images/jumplist/group.ico" />
    <meta name="msapplication-task" content="name=<?=__('News')?>;action-uri=/news;icon-uri=/images/jumplist/newspaper.ico" />
    <meta name="msapplication-task" content="name=<?=__('Polls')?>;action-uri=/sondages;icon-uri=/images/jumplist/chart_bar.ico" />
    <?php include_title() ?>
    <link rel="shortcut icon" href="http://<?=sfConfig::get('app_host_cdn')?>/favicon.ico" />
    <?php include_javascripts() ?>
    <?php include_stylesheets() ?>
    <script type="text/javascript" src="/js/zt_interface.js?<?=filemtime("js/zt_interface.js")?>"></script>
    <link rel="stylesheet" id="colorstyle" type="text/css" media="screen" href="/css/main_black.css" />
    <script type="text/javascript" src="http://bt.anippon.com/js/fancybox.pack.js"></script>
    <script type="text/javascript">
    if($.cookie("style")) {
      $("#colorstyle").attr("href", "/css/"+$.cookie("style"));
    }
    
    $(function() {
      alignLabels();
      // Nouveau commentaire pour la shout
      $('#newshtcom, #newtorcom').live("click", function() {
        if ($(this).val() == "<?=__('Write a new comment')?>") {
          $(this).val("");
        }
      });
      $('#newshtcom').live("keypress", function(e) {
        if (e.which == '13') {
          e.preventDefault();
          $(this).parent().submit();
        }
      });
      $('.js_ddl').live("click", function(e) {
        e.preventDefault();
        $.get($(this).attr('href'));
        changerPage(location.hash);
      });
      // Quand on a soumis une nouvelle shout
      $('.shtsub').live('click', function(e){
        // On n'envoit rien
        e.preventDefault();
        // On désactive les champs
        $('.sht input, .sht textarea').attr('disabled', 'disabled');
        // On passe par l'AJAX
        $.post($('.sht').attr('action'), {sht_txt: $('.sht textarea').val()});
        // On récupère de suite les nouvelles shouts
        actualiserShout();
        // On vide le champ
        $('.sht textarea').val("");
        // On les réactives
        $('.sht input, .sht textarea').removeAttr('disabled');
      });
      $('.sht textarea[name=sht_txt]').live("keypress", function(e) {
        if (e.which == '13') {
          // On n'envoit rien
          e.preventDefault();
          // On désactive les champs
          $('.sht input, .sht textarea').attr('disabled', 'disabled');
          // On passe par l'AJAX
          $.post($('.sht').attr('action'), {sht_txt: $('.sht textarea').val()});
          // On récupère de suite les nouvelles shouts
          actualiserShout();
          // On vide le champ
          $('.sht textarea').val("");
          // On les réactives
          $('.sht input, .sht textarea').removeAttr('disabled');
        }
      });
    });

      <?php if (url_for('@homepage') == $_SERVER['REQUEST_URI']): ?>
        var timerShout = setInterval('actualiserShout()', 10000);   
      <?php endif; if ($sf_user->isAuthenticated()): ?>
        var timerNotif = setInterval('actualiserNotif("<?=sfConfig::get("app_name")?>")', 30000);
      <?php endif; ?>
      // Synchronisation de la date du client avec celle du serveur
      var dateClient = new Date();
      var offsetTime = dateClient.getTime() - <?=time()?>*1000;
    </script>
  </head>
  <body onload="chargerPage();">
    <noscript class="general"><?=__('Javascript must be enabled !')?></noscript>
    
    <div id="gauche">
      <a href="<?=url_for("@homepage")?>" id="homepage" title="<?=__("Back to homepage")?>"></a>
        <?php // On injecte les catégories
        
include_component("main""categories");
        
include_component("main""sidebar"); ?>
    </div>

    <?php echo $sf_content ?>
    
    <?php if ($sf_user->hasFlash('notice')): ?>
      <div class="flash_notice"><?php echo $sf_user->getFlash('notice'?></div>
    <?php endif ?>
     
    <?php if ($sf_user->hasFlash('error')): ?>
      <div class="flash_error"><?php echo $sf_user->getFlash('error'?></div>
    <?php endif ?>
      
    <div id="loader" style="display: none"></div>

    <script type="text/javascript">
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-2529978-4']);
      _gaq.push(['_trackPageview']);
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
      var cl = new CanvasLoader('loader');
      cl.setDiameter(100);
      cl.setDensity(70);
      cl.setRange(0.5);
      cl.setSpeed(3);
      cl.setFPS(50);
      cl.setColor('#5c98ff');
      $(function() { $('.fancybox').fancybox(); });
    </script>
  </body>
</html>

Tried this so i get a message but had no effect to simple user

PHP Code:

if ($sf_user->hasCredential("adm") <meta name="msapplication-task" content="name=<?=__('Add your upload')?>;action-uri=/partage/ajouter;icon-uri=/images/jumplist/add.ico" /> else { $this->getUser()->setFlash("notice", "Your privilleges aren't sufficient to upload !"); $this->redirect("@homepage"); return sfView::NONE; }

Bump: Thank for all the help. I did all the modifications as you said and the website is perfect! Thank you!


All times are GMT +2. The time now is 18:15.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.