]> git.mxchange.org Git - friendica.git/commitdiff
Merge branch 'develop' into issue-1574
authorfabrixxm <fabrix.xm@gmail.com>
Sun, 24 May 2015 08:26:21 +0000 (10:26 +0200)
committerfabrixxm <fabrix.xm@gmail.com>
Sun, 24 May 2015 08:26:21 +0000 (10:26 +0200)
include/items.php
mod/videos.php
view/templates/video_top.tpl
view/theme/quattro/quattro.less

index 85d02ab60d55ef4a1eba1e3c392ed38c7c001bab..66307573d964a5fb5a672bed33ec37590c13f5e9 100644 (file)
@@ -4745,6 +4745,18 @@ function drop_item($id,$interactive = true) {
                        // ignore the result
                }
 
+               // If item has attachments, drop them
+
+               foreach(explode(",",$item['attach']) as $attach){
+                       preg_match("|attach/(\d+)|", $attach, $matches);
+                       q("DELETE FROM `attach` WHERE `id` = %d AND `uid` = %d",
+                               intval($matches[1]),
+                               local_user()
+                       );
+                       // ignore the result
+               }
+
+
                // clean up item_id and sign meta-data tables
 
                /*
@@ -4821,6 +4833,7 @@ function drop_item($id,$interactive = true) {
                        // Add a relayable_retraction signature for Diaspora.
                        store_diaspora_retract_sig($item, $a->user, $a->get_baseurl());
                }
+
                $drop_id = intval($item['id']);
 
                // send the notification upstream/downstream as the case may be
index 0f29e631bdcc99f8350de85baaea87f7cd4537b5..607c900eb5cbccadf7a2be326a9105e884f5d0b2 100644 (file)
@@ -43,12 +43,12 @@ function videos_init(&$a) {
                if(count($albums)) {
                        $a->data['albums'] = $albums;
 
-                       $albums_visible = ((intval($a->data['user']['hidewall']) && (! local_user()) && (! remote_user())) ? false : true);     
+                       $albums_visible = ((intval($a->data['user']['hidewall']) && (! local_user()) && (! remote_user())) ? false : true);
 
                        if($albums_visible) {
                                $o .= '<div id="side-bar-photos-albums" class="widget">';
                                $o .= '<h3>' . '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '">' . t('Photo Albums') . '</a></h3>';
-                                       
+
                                $o .= '<ul>';
                                foreach($albums as $album) {
 
@@ -57,7 +57,7 @@ function videos_init(&$a) {
 
                                        if((! strlen($album['album'])) || ($album['album'] === 'Contact Photos') || ($album['album'] === t('Contact Photos')))
                                                continue;
-                                       $o .= '<li>' . '<a href="photos/' . $a->argv[1] . '/album/' . bin2hex($album['album']) . '" >' . $album['album'] . '</a></li>'; 
+                                       $o .= '<li>' . '<a href="photos/' . $a->argv[1] . '/album/' . bin2hex($album['album']) . '" >' . $album['album'] . '</a></li>';
                                }
                                $o .= '</ul>';
                        }
@@ -92,9 +92,76 @@ function videos_init(&$a) {
 
 function videos_post(&$a) {
 
-       return;
+       $owner_uid = $a->data['user']['uid'];
+
+       if (local_user() != $owner_uid) goaway($a->get_baseurl() . '/videos/' . $a->data['user']['nickname']);
+
+       if(($a->argc == 2) && x($_POST,'delete') && x($_POST, 'id')) {
+
+               // Check if we should do HTML-based delete confirmation
+               if(!x($_REQUEST,'confirm')) {
+                       if(x($_REQUEST,'canceled')) goaway($a->get_baseurl() . '/videos/' . $a->data['user']['nickname']);
+
+                       $drop_url = $a->query_string;
+                       $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), array(
+                               '$method' => 'post',
+                               '$message' => t('Do you really want to delete this video?'),
+                               '$extra_inputs' => [
+                                       ['name'=>'id', 'value'=> $_POST['id']],
+                                       ['name'=>'delete', 'value'=>'x']
+                               ],
+                               '$confirm' => t('Delete Video'),
+                               '$confirm_url' => $drop_url,
+                               '$confirm_name' => 'confirm', // Needed so that confirmation will bring us back into this if statement
+                               '$cancel' => t('Cancel'),
+
+                       ));
+                       $a->error = 1; // Set $a->error so the other module functions don't execute
+                       return;
+               }
+
+               $video_id = $_POST['id'];
+
+
+               $r = q("SELECT `id`  FROM `attach` WHERE `uid` = %d AND `id` = '%s' LIMIT 1",
+                       intval(local_user()),
+                       dbesc($video_id)
+               );
+
+               if(count($r)) {
+                       q("DELETE FROM `attach` WHERE `uid` = %d AND `id` = '%s'",
+                               intval(local_user()),
+                               dbesc($video_id)
+                       );
+                       $i = q("SELECT * FROM `item` WHERE `attach` like '%%attach/%s%%' AND `uid` = %d LIMIT 1",
+                               dbesc($video_id),
+                               intval(local_user())
+                       );
+                       #echo "<pre>"; var_dump($i); killme();
+                       if(count($i)) {
+                               q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
+                                       dbesc(datetime_convert()),
+                                       dbesc(datetime_convert()),
+                                       dbesc($i[0]['uri']),
+                                       intval(local_user())
+                               );
+                               create_tags_from_itemuri($i[0]['uri'], local_user());
+                               delete_thread_uri($i[0]['uri'], local_user());
+
+                               $url = $a->get_baseurl();
+                               $drop_id = intval($i[0]['id']);
+
+                               if($i[0]['visible'])
+                                       proc_run('php',"include/notifier.php","drop","$drop_id");
+                       }
+               }
+
+               goaway($a->get_baseurl() . '/videos/' . $a->data['user']['nickname']);
+               return; // NOTREACHED
+       }
+
+    goaway($a->get_baseurl() . '/videos/' . $a->data['user']['nickname']);
 
-       // DELETED -- look at mod/photos.php if you want to implement
 }
 
 
@@ -115,8 +182,8 @@ function videos_content(&$a) {
                notice( t('Public access denied.') . EOL);
                return;
        }
-       
-       
+
+
        require_once('include/bbcode.php');
        require_once('include/security.php');
        require_once('include/conversation.php');
@@ -131,7 +198,7 @@ function videos_content(&$a) {
        $_SESSION['video_return'] = $a->cmd;
 
        //
-       // Parse arguments 
+       // Parse arguments
        //
 
        if($a->argc > 3) {
@@ -233,7 +300,7 @@ function videos_content(&$a) {
 
        // tabs
        $_is_owner = (local_user() && (local_user() == $owner_uid));
-       $o .= profile_tabs($a,$_is_owner, $a->data['user']['nickname']);        
+       $o .= profile_tabs($a,$_is_owner, $a->data['user']['nickname']);
 
        //
        // dispatch request
@@ -251,7 +318,7 @@ function videos_content(&$a) {
                return; // no albums for now
 
                // DELETED -- look at mod/photos.php if you want to implement
-       }       
+       }
 
 
        if($datatype === 'video') {
@@ -307,20 +374,21 @@ function videos_content(&$a) {
                                        'name'  => $name_e,
                                        'alt'   => t('View Album'),
                                ),
-                               
+
                        );
                }
        }
-       
-       $tpl = get_markup_template('videos_recent.tpl'); 
+
+       $tpl = get_markup_template('videos_recent.tpl');
        $o .= replace_macros($tpl, array(
                '$title' => t('Recent Videos'),
                '$can_post' => $can_post,
                '$upload' => array(t('Upload New Videos'), $a->get_baseurl().'/videos/'.$a->data['user']['nickname'].'/upload'),
                '$videos' => $videos,
+        '$delete_url' => (($can_post)?$a->get_baseurl().'/videos/'.$a->data['user']['nickname']:False)
        ));
 
-       
+
        $o .= paginate($a);
        return $o;
 }
index 3a8680fd9dd24bede6a608a2bbaa5e77c572a1fc..8348d702cd37f45c2b757f68328151a2b2a15bfd 100644 (file)
@@ -9,5 +9,11 @@
        </video>
 
        {{*<div class="video-top-album-name"><a href="{{$video.album.link}}" class="video-top-album-link" title="{{$video.album.alt}}" >{{$video.album.name}}</a></div>*}}
+       {{if $delete_url }}
+               <form method="post" action="{{$delete_url}}">
+               <input type="submit" name="delete" value="X" class="video-delete"></input>
+               <input type="hidden" name="id" value="{{$video.id}}"></input>
+               </form>
+       {{/if}}
 </div>
 
index dded1514a54e81d41fd4c023661311a82a69fdaf..480effd501d5a6aace92a0beff0cba7778cb5645 100644 (file)
@@ -36,7 +36,7 @@ h4 { font-size: 1.1em }
        -o-transition: all @d ease-in-out;
        -ms-transition: all @d ease-in-out;
        transition: all @d ease-in-out;
-}      
+}
 
 
 a, a:link { color: @Link; text-decoration: none; }
@@ -68,7 +68,7 @@ code {
        background: #EEE;
        color: #444;
        padding: 10px;
-       margin-top: 20px; 
+       margin-top: 20px;
 }
 
 #panel {
@@ -86,7 +86,9 @@ code {
 }
 
 
+
 /* tool */
+
 .tool {
        height: auto; overflow: auto;
        .label { float: left;}
@@ -95,6 +97,8 @@ code {
 }
 
 
+
+
 /* popup notifications */
 #jGrowl.top-right {
        top: 30px;
@@ -140,7 +144,6 @@ header {
                #logo-text { font-size: 22px }
        }
 }
-
 /* nav */
 nav { 
        width: 100%; height: 32px;
@@ -299,6 +302,8 @@ ul.menu-popup {
 }
 
 
+
+
 /* aside 230px*/
 aside { 
        display: table-cell;
@@ -1031,6 +1036,7 @@ span[id^="showmore-wrap"] {
 }
 
 
+
 #acl-wrapper {
        width: 690px;
        float:left;
@@ -1172,6 +1178,7 @@ ul.tabs {
        overflow: auto;
        width: 100%;
 
+
        label {
                float: left;
                width: 200px;
@@ -1193,6 +1200,7 @@ ul.tabs {
                
        }
 
+
        .onoff {
                float: left;
                width: 80px;
@@ -1577,6 +1585,7 @@ footer { height: 100px; display: table-row; }
 }
 
 /* edit buttons for comments */
+
 .icon.dim { opacity: 0.3;filter:alpha(opacity=30); }
 .comment-edit-bb {
        list-style: none;
@@ -1660,3 +1669,4 @@ footer { height: 100px; display: table-row; }
        border: 0px;
        color: @FieldHelpColor;
 }
+