Recherche avancée

Médias (91)

Autres articles (106)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

Sur d’autres sites (10017)

  • 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.

  • FFMPEG command on Android Jave Process does not fully execute

    8 novembre 2014, par user2491598

    The issue I am having is very strange. I have an FFMPEG executable binary library installed on my Android and I am trying to execute this command

    ffmpeg -loop 1 -i /storage/emulated/0/image.jpg -i /storage/emulated/0/input.mov -filter_complex '[0:v][1:v] overlay' -shortest /storage/emulated/0/output.mp4

    and my JAVA code looks like

    try {
               Runtime.getRuntime().exec("chmod 700 " + mFfmpegPath);
               cmd.add(mFfmpegPath);
               cmd.add("-loop");
               cmd.add("1");
               cmd.add("-i");
               cmd.add("/storage/emulated/0/image.jpg");
               cmd.add("-i");
               cmd.add("/storage/emulated/0/pizza.mov");
               cmd.add("-filter_complex");
               cmd.add("'[0:v][1:v] overlay'");
               cmd.add("-shortest");
               cmd.add("-vcodec");
               cmd.add("-libx264");
               cmd.add("-strict");
               cmd.add("experimental");
               cmd.add("/storage/emulated/0/output22.mp4");

               final ProcessBuilder pb = new ProcessBuilder(cmd);
               pb.redirectErrorStream();
               final Process p = pb.start();
               Log.i("FFMPEG","stdError= " + getSTD(p.getErrorStream()));
               p.waitFor();
               return run;
           } catch (IOException e1) {
               // TODO Auto-generated catch block
               e1.printStackTrace();
           } catch (InterruptedException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
           }

    For some reason I the execution does not fully finish and it stops. It does not even create an output file in my Android storage. Here is the log file from the process stream

    11-07 20:34:21.636: I/FFMPEG(6259): stdError= WARNING: linker: /data/data/za.jamie.androidffmpegcmdline/app_bin/ffmpeg has text relocations. This is wasting memory and is a security risk. Please fix.
    11-07 20:34:21.636: I/FFMPEG(6259): ffmpeg version n2.4.2 Copyright (c) 2000-2014 the FFmpeg developers
    11-07 20:34:21.636: I/FFMPEG(6259):   built on Nov  8 2014 00:21:33 with gcc 4.8 (GCC)
    11-07 20:34:21.636: I/FFMPEG(6259):   configuration: --target-os=linux --cross-prefix=/home/ubuntu/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/ubuntu/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-avcodec --enable-avformat --enable-swresample --enable-swscale --enable-postproc --enable-avfilter --enable-avresample --disable-libfreetype --enable-libfribidi --disable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --enable-ffplay --enable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/ubuntu/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/ubuntu/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/ubuntu/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/ubuntu/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
    11-07 20:34:21.636: I/FFMPEG(6259):   libavutil      54.  7.100 / 54.  7.100
    11-07 20:34:21.636: I/FFMPEG(6259):   libavcodec     56.  1.100 / 56.  1.100
    11-07 20:34:21.636: I/FFMPEG(6259):   libavformat    56.  4.101 / 56.  4.101
    11-07 20:34:21.636: I/FFMPEG(6259):   libavdevice    56.  0.100 / 56.  0.100
    11-07 20:34:21.636: I/FFMPEG(6259):   libavfilter     5.  1.100 /  5.  1.100
    11-07 20:34:21.636: I/FFMPEG(6259):   libavresample   2.  1.  0 /  2.  1.  0
    11-07 20:34:21.636: I/FFMPEG(6259):   libswscale      3.  0.100 /  3.  0.100
    11-07 20:34:21.636: I/FFMPEG(6259):   libswresample   1.  1.100 /  1.  1.100
    11-07 20:34:21.636: I/FFMPEG(6259):   libpostproc    53.  0.100 / 53.  0.100
    11-07 20:34:21.636: I/FFMPEG(6259): Input #0, image2, from '/storage/emulated/0/image.jpg':
    11-07 20:34:21.636: I/FFMPEG(6259):   Duration: 00:00:00.04, start: 0.000000, bitrate: 35211 kb/s
    11-07 20:34:21.636: I/FFMPEG(6259):     Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg), 640x640 [SAR 1:1 DAR 1:1], 25 fps, 25 tbr, 25 tbn, 25 tbc
    11-07 20:34:21.636: I/FFMPEG(6259): Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/input.mov':
    11-07 20:34:21.636: I/FFMPEG(6259):   Metadata:
    11-07 20:34:21.636: I/FFMPEG(6259):     major_brand     : qt  
    11-07 20:34:21.636: I/FFMPEG(6259):     minor_version   : 537199360
    11-07 20:34:21.636: I/FFMPEG(6259):     compatible_brands: qt  
    11-07 20:34:21.636: I/FFMPEG(6259):     creation_time   : 2014-10-30 23:57:31
    11-07 20:34:21.636: I/FFMPEG(6259):     xmp             : <?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
    11-07 20:34:21.636: I/FFMPEG(6259):                     :
    11-07 20:34:21.636: I/FFMPEG(6259):                     :  
    11-07 20:34:21.636: I/FFMPEG(6259):                     :   FFMPEG(6259):                     :     xmlns:xmp="http://ns.adobe.com/xap/1.0/"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :     xmlns:xmpDM="http://ns.adobe.com/xmp/1.0/DynamicMedia/"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :     xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :     xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :     xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :     xmlns:creatorAtom="http://ns.adobe.com/creatorAtom/1.0/"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :     xmlns:dc="http://purl.org/dc/elements/1.1/"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmp:CreateDate="2014-10-30T16:57:31-07:00"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmp:ModifyDate="2014-10-30T15:57:57-07:00"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmp:CreatorTool="Adobe After Effects CC 2014 (Windows)"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmp:MetadataDate="2014-10-30T15:57:57-07:00"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpDM:startTimeScale="30"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpDM:startTimeSampleSize="1"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpDM:videoFrameRate="30.000000"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpDM:videoFieldOrder="Progressive"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpDM:videoPixelAspectRatio="1/1"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpDM:audioSampleRate="48000"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpDM:audioSampleType="16Int"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpDM:audioChannelType="Stereo"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpMM:InstanceID="xmp.iid:b791d2dc-6759-ee45-b5a2-692ecba2c4fd"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpMM:DocumentID="xmp.did:d3fde073-8716-144a-acbd-7676f27002a0"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpMM:OriginalDocumentID="xmp.
    11-07 20:34:21.836: E/ViewRootImpl(6259): sendUserActionEvent() mView == null

    Please help :(

  • FFMPEG command on Android Jave Process does fully execute

    8 novembre 2014, par user2491598

    The issue I am having is very strange. I have an FFMPEG executable binary library installed on my Android and I am trying to execute this command

    ffmpeg -loop 1 -i /storage/emulated/0/image.jpg -i /storage/emulated/0/input.mov -filter_complex '[0:v][1:v] overlay' -shortest /storage/emulated/0/output.mp4

    and my JAVA code looks like

    try {
               Runtime.getRuntime().exec("chmod 700 " + mFfmpegPath);
               cmd.add(mFfmpegPath);
               cmd.add("-loop");
               cmd.add("1");
               cmd.add("-i");
               cmd.add("/storage/emulated/0/image.jpg");
               cmd.add("-i");
               cmd.add("/storage/emulated/0/pizza.mov");
               cmd.add("-filter_complex");
               cmd.add("'[0:v][1:v] overlay'");
               cmd.add("-shortest");
               cmd.add("-vcodec");
               cmd.add("-libx264");
               cmd.add("-strict");
               cmd.add("experimental");
               cmd.add("/storage/emulated/0/output22.mp4");

               final ProcessBuilder pb = new ProcessBuilder(cmd);
               pb.redirectErrorStream();
               ProcessRunnable run =  new ProcessRunnable(pb);
               final Process p = pb.start();
               Log.i("FFMPEG","stdError= " + getSTD(p.getErrorStream()));
               p.waitFor();
               return run;
           } catch (IOException e1) {
               // TODO Auto-generated catch block
               e1.printStackTrace();
           } catch (InterruptedException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
           }

    For some reason I the execution does not fully finish and it stops. It does not even create an output file in my Android storage. Here is the log file from the process stream

    11-07 20:34:21.636: I/FFMPEG(6259): stdError= WARNING: linker: /data/data/za.jamie.androidffmpegcmdline/app_bin/ffmpeg has text relocations. This is wasting memory and is a security risk. Please fix.
    11-07 20:34:21.636: I/FFMPEG(6259): ffmpeg version n2.4.2 Copyright (c) 2000-2014 the FFmpeg developers
    11-07 20:34:21.636: I/FFMPEG(6259):   built on Nov  8 2014 00:21:33 with gcc 4.8 (GCC)
    11-07 20:34:21.636: I/FFMPEG(6259):   configuration: --target-os=linux --cross-prefix=/home/ubuntu/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/ubuntu/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-avcodec --enable-avformat --enable-swresample --enable-swscale --enable-postproc --enable-avfilter --enable-avresample --disable-libfreetype --enable-libfribidi --disable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --enable-ffplay --enable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/ubuntu/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/ubuntu/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/ubuntu/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/ubuntu/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
    11-07 20:34:21.636: I/FFMPEG(6259):   libavutil      54.  7.100 / 54.  7.100
    11-07 20:34:21.636: I/FFMPEG(6259):   libavcodec     56.  1.100 / 56.  1.100
    11-07 20:34:21.636: I/FFMPEG(6259):   libavformat    56.  4.101 / 56.  4.101
    11-07 20:34:21.636: I/FFMPEG(6259):   libavdevice    56.  0.100 / 56.  0.100
    11-07 20:34:21.636: I/FFMPEG(6259):   libavfilter     5.  1.100 /  5.  1.100
    11-07 20:34:21.636: I/FFMPEG(6259):   libavresample   2.  1.  0 /  2.  1.  0
    11-07 20:34:21.636: I/FFMPEG(6259):   libswscale      3.  0.100 /  3.  0.100
    11-07 20:34:21.636: I/FFMPEG(6259):   libswresample   1.  1.100 /  1.  1.100
    11-07 20:34:21.636: I/FFMPEG(6259):   libpostproc    53.  0.100 / 53.  0.100
    11-07 20:34:21.636: I/FFMPEG(6259): Input #0, image2, from '/storage/emulated/0/image.jpg':
    11-07 20:34:21.636: I/FFMPEG(6259):   Duration: 00:00:00.04, start: 0.000000, bitrate: 35211 kb/s
    11-07 20:34:21.636: I/FFMPEG(6259):     Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg), 640x640 [SAR 1:1 DAR 1:1], 25 fps, 25 tbr, 25 tbn, 25 tbc
    11-07 20:34:21.636: I/FFMPEG(6259): Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/input.mov':
    11-07 20:34:21.636: I/FFMPEG(6259):   Metadata:
    11-07 20:34:21.636: I/FFMPEG(6259):     major_brand     : qt  
    11-07 20:34:21.636: I/FFMPEG(6259):     minor_version   : 537199360
    11-07 20:34:21.636: I/FFMPEG(6259):     compatible_brands: qt  
    11-07 20:34:21.636: I/FFMPEG(6259):     creation_time   : 2014-10-30 23:57:31
    11-07 20:34:21.636: I/FFMPEG(6259):     xmp             : <?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
    11-07 20:34:21.636: I/FFMPEG(6259):                     :
    11-07 20:34:21.636: I/FFMPEG(6259):                     :  
    11-07 20:34:21.636: I/FFMPEG(6259):                     :   FFMPEG(6259):                     :     xmlns:xmp="http://ns.adobe.com/xap/1.0/"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :     xmlns:xmpDM="http://ns.adobe.com/xmp/1.0/DynamicMedia/"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :     xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :     xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :     xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :     xmlns:creatorAtom="http://ns.adobe.com/creatorAtom/1.0/"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :     xmlns:dc="http://purl.org/dc/elements/1.1/"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmp:CreateDate="2014-10-30T16:57:31-07:00"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmp:ModifyDate="2014-10-30T15:57:57-07:00"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmp:CreatorTool="Adobe After Effects CC 2014 (Windows)"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmp:MetadataDate="2014-10-30T15:57:57-07:00"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpDM:startTimeScale="30"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpDM:startTimeSampleSize="1"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpDM:videoFrameRate="30.000000"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpDM:videoFieldOrder="Progressive"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpDM:videoPixelAspectRatio="1/1"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpDM:audioSampleRate="48000"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpDM:audioSampleType="16Int"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpDM:audioChannelType="Stereo"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpMM:InstanceID="xmp.iid:b791d2dc-6759-ee45-b5a2-692ecba2c4fd"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpMM:DocumentID="xmp.did:d3fde073-8716-144a-acbd-7676f27002a0"
    11-07 20:34:21.636: I/FFMPEG(6259):                     :    xmpMM:OriginalDocumentID="xmp.
    11-07 20:34:21.836: E/ViewRootImpl(6259): sendUserActionEvent() mView == null

    Please help :(