Recherche avancée

Médias (1)

Mot : - Tags -/belgique

Autres articles (34)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

  • Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs

    12 avril 2011, par

    La manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
    Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

Sur d’autres sites (7101)

  • iPhone video PHP upload. Windows to HTML5 tag

    21 août 2012, par zeshin

    As those of you with an iPhone know, the iCloud uploads all pictures and videos taken on the iPhone to the cloud and, thereafter, your home PC.

    I am uploading videos to my web page through a PHP function, which are then displayed as embedded HTML5 videos with the tag. The problem I am running into is that videos taken on the iPhone in portrait are showing up on both my PC and website in landscape view.

    Due to the fact that uploads come from multiple sources, I need a sever-side solution to recognize the orientation of the video and rotate it as needed.

    Does anyone know of a way to accomplish this without using additional plugins such as ffmpeg ?

  • corrupted frames when returned to a frame array

    24 mai 2016, par Kindermann

    when running the following code, I encountered corrupted frames.They were valid frames during frame decoding process,

    (gdb) print frame->side_data
    $2 = (AVFrameSideData **) 0x1a2ad40
    (gdb) print frame->side_data->type
    $3 = AV_FRAME_DATA_MOTION_VECTORS

    however, when they were returned to AVFrame array, I found corrupted frames inside array, which means, the pointers were still there but I couldn’t access what the pointers actually pointed to :

    (gdb) print frames_video1[1]->side_data
    $4 = (AVFrameSideData **) 0x1a21bc0
    (gdb) print frames_video1[1]->side_data->type
    Cannot access memory at address 0x0

    code I think responsible for it has been demonstrated as follows :

    AVFrame frames_video1[3];
    char *src_filename1;

    int main()
    {
    ...
       decode_video(src_filename1, frames_video1);
    ...    
    }

    int decode_video(char *src_filename, AVFrame frames_video[])
    {
    ...
       video_dec_ctx->flags2 |= AV_CODEC_FLAG2_EXPORT_MVS;
    ...
       decode_packet(&got_frame, 0, frames_video);
    ...
    }

    static int decode_packet(int *got_frame, int cached, AVFrame frames_video[])
    {
       int ret = 0;
       int decoded = pkt.size;
       *got_frame = 0;
       if (pkt.stream_index == video_stream_idx) {
               /* decode video frame */
           ret = avcodec_decode_video2(video_dec_ctx, frame, got_frame, &pkt);
           if (ret < 0) {
               fprintf(stderr, "Error decoding video frame (%s)\n", av_err2str(ret));
               return ret;
           }
           if (*got_frame) {
               if(video_frame_count < FRAME_TO_COMPARE_NUM){
               AVFrame tmp;
               tmp = *frame; //here I inserted a breakpoint, frames here are still valid...
               frames_video[video_frame_count] = tmp;
           }
           video_frame_count++;
       }
       return decoded;
    }

    can someone perhaps tell me how to soundly return a frame array so that pointers inside a frame are still valid pointers ?

    I want to hear your response, whether I’ve not described the issue clearly, so you don’t understand it thoroughly, then I’d like to explain it in more detail, or you’ve not come across this kind of issue before ?

  • How to verify user permissions – Introducing the Piwik Platform

    9 novembre 2014, par Thomas Steur — Development

    This is the next post of our blog series where we introduce the capabilities of the Piwik platform (our previous post was How to make your plugin multilingual). This time you’ll learn how to verify user permissions. For this tutorial you will need to have basic knowledge of PHP and the Piwik platform.

    When should a plugin verify permissions ?

    Usually you want to do this before executing any action – such as deleting or fetching data – and before rendering any sensitive information that should not be accessible by everyone. For instance in an API method or Controller action. You sometimes also need to verify permissions before registering menu items or widgets.

    How does Piwik’s user management work ?

    It is quite simple as it only differentiates between a few roles : View permission, Admin permission and Super User permission. If you manage multiple websites with Piwik a user can be assigned to different roles as a user might have no permission for some websites but view or admin permission for another set of websites.

    Worth mentioning is that roles inherit from each other. This means the role admin automatically includes the role view and a super user automatically covers the view and admin role.

    Getting started

    In this post, we assume that you have already set up your development environment and created a plugin. If not, visit the Piwik Developer Zone where you’ll find the tutorial Setting up Piwik and other Guides that help you to develop a plugin.

    Verifying user permissions

    To protect your data the platform offers many convenient methods in the \Piwik\Piwik class. There you will find methods that either start with check, is or has. While methods that start with check throw an exception in case a condition is not met, the other methods return a boolean true or false.

    Use methods that throw an exception if you want to stop any further execution in case a user does not have an appropriate role. The platform will catch the exception and display an error message or ask the user to log in.

    1. public function deleteAllMessages()
    2. {
    3.     // delete messages only if user has super user access, otherwise show an error message
    4.     Piwik::checkUserSuperUserAccess();
    5.  
    6.     $this->getModel()->deleteAllMessages();
    7. }

    Télécharger

    Use methods that return a boolean for instance when registering menu items or widgets.

    1. public function configureAdminMenu(MenuAdmin $menu)
    2. {
    3.     if (Piwik::hasUserSuperUserAccess()) {
    4.         $menu->addPlatformItem('Plugins', $this->urlForDefaultAction());
    5.     }
    6. }

    Télécharger

    It is important to be aware that just because the menu item won’t be displayed in the UI a user can still open the registered URL manually. Therefore you have to check for permissions in the actual controller action as well.

    View permission

    A user having a view permission should be only able to view reports but not make any changes apart from his personal settings. The methods that end with UserHasSomeViewAccess make sure a user has at least view permission for one website whereas the methods *UserHasViewAccess($idSites = array(1,2,3)) check whether a user has view access for all of the given websites.

    1. Piwik::checkUserHasSomeViewAccess();
    2.  
    3. Piwik::checkUserHasViewAccess($idSites = array(1,2,3));

    Télécharger

    As a plugin developer you would usually use the latter example to verify the permissions for specific websites. Use the first example in case you develop something like an “All Websites Dashboard” where you only want to make sure the user has a view permission for at least one website.

    Admin permission

    A user having an admin permission cannot only view reports but also change website related settings. The methods to check for this role are similar to the ones before, just swap the term View with Admin.

    1. Piwik::checkUserHasSomeAdminAccess();
    2.  
    3. Piwik::checkUserHasAdminAccess($idSites = array(1,2,3));

    Télécharger

    Super user permission

    A user having the super user permission is allowed to access all of the data stored in Piwik and change any settings. To check if a user has this role use one of the methods that end with UserSuperUserAccess.

    Piwik::checkUserHasSuperUserAccess();

    As a plugin developer you would check for this permission for instance in places where your plugin shows an activity log over all users or where it offers the possibility to change any system wide settings.

    Getting information about the currently logged in user

    Sometimes you might want to know which user is currently logged in. This can be useful if you want to persist user related information in the database or if you want to send an email to the currently logged in user. You can easily get this information by calling the following methods :

    1. $login = Piwik::getCurrentUserLogin()
    2. $email = Piwik::getCurrentUserEmail()

    Télécharger

    Advanced features

    Of course there is more that you can do. For instance you can verify whether a user is an anonymous user or whether a user has a specific role. You can also perform any operation in the context of a super user even if the current user does not have this role. Would you like to know more about those features ? Check out the Piwik class reference, the Security guide and the Manage Users user guide.

    If you have any feedback regarding our APIs or our guides in the Developer Zone feel free to send it to us.