Proyectos de Subversion LeadersLinked - Services

Rev

Rev 345 | Rev 598 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 345 Rev 347
Línea 662... Línea 662...
662
            $feed->total_comments    = 0;
662
            $feed->total_comments    = 0;
663
            $feed->total_shared     = 0;
663
            $feed->total_shared     = 0;
Línea 664... Línea 664...
664
 
664
 
-
 
665
            
665
            
666
            $storage = Storage::getInstance($this->config, $this->adapter);
Línea 666... Línea -...
666
            $storage = Storage::getInstance($this->config, $this->adapter);
-
 
667
            $storage->setCurrentFilename('file');
667
            $storage->setFiles($this->getRequest()->getFiles()->toArray());
668
            
-
 
669
            
-
 
670
            
-
 
671
            $files = $this->getRequest()->getFiles()->toArray();
-
 
672
            
-
 
673
            
-
 
674
            if (isset($files['file']) && empty($files['file']['error'])) {
-
 
675
                
-
 
676
               
-
 
677
                
-
 
678
                
-
 
679
                $feed_tmp_filename  = $files['file']['tmp_name'];
-
 
680
                $feed_filename      = \LeadersLinked\Library\Functions::normalizeStringFilename($files['file']['name']);
-
 
681
                
-
 
682
                $mime_type = mime_content_type($feed_tmp_filename);
-
 
683
                if ($mime_type == 'image/jpg' || $mime_type == 'image/jpeg' || $mime_type == 'image/png') {
-
 
684
                    $file_type = Storage::FILE_TYPE_IMAGE;
-
 
685
                } else if ($mime_type == 'video/quicktime' ||  $mime_type == 'video/webm' || $mime_type == 'video/mpeg' || $mime_type == 'video/mpg' || $mime_type == 'video/mp4') {
-
 
686
                    $file_type = Storage::FILE_TYPE_VIDEO;
-
 
687
                } else if ($mime_type == 'application/pdf') {
-
 
Línea 688... Línea 668...
688
                    $file_type = Storage::FILE_TYPE_DOCUMENT;
668
            $storage->setCurrentFilename('file');
689
                }
669
            
Línea 1503... Línea 1483...
1503
    {
1483
    {
Línea 1504... Línea 1484...
1504
 
1484
 
1505
        $currentUserPlugin = $this->plugin('currentUserPlugin');
1485
        $currentUserPlugin = $this->plugin('currentUserPlugin');
Línea 1506... Línea 1486...
1506
        $currentUser = $currentUserPlugin->getUser();
1486
        $currentUser = $currentUserPlugin->getUser();
1507
 
1487
 
Línea 1508... Línea 1488...
1508
        $currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
1488
        //$currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
Línea 1509... Línea 1489...
1509
        $network = $currentNetworkPlugin->getNetwork();
1489
       // $network = $currentNetworkPlugin->getNetwork();
Línea 1755... Línea 1735...
1755
            }
1735
            }
1756
            if ($sharedFeed->file_type == Storage::FILE_TYPE_DOCUMENT) {
1736
            if ($sharedFeed->file_type == Storage::FILE_TYPE_DOCUMENT) {
1757
                $item['shared_file_document'] = $storage->getGenericFile($path, $sharedFeed->uuid, $sharedFeed->file_name);
1737
                $item['shared_file_document'] = $storage->getGenericFile($path, $sharedFeed->uuid, $sharedFeed->file_name);
1758
            }
1738
            }
1759
            if ($sharedFeed->file_type == Storage::FILE_TYPE_VIDEO) {
1739
            if ($sharedFeed->file_type == Storage::FILE_TYPE_VIDEO) {
1760
                $path = $this->storage->getPathFeed();
1740
                $path = $storage->getPathFeed();
1761
                $item['shared_file_image_preview'] = $storage->getGenericImage($path, $sharedFeed->uuid, $sharedFeed->file_image_preview);
1741
                $item['shared_file_image_preview'] = $storage->getGenericImage($path, $sharedFeed->uuid, $sharedFeed->file_image_preview);
1762
                $item['shared_file_video'] = $storage->getGenericFile($path, $sharedFeed->uuid, $sharedFeed->file_name);
1742
                $item['shared_file_video'] = $storage->getGenericFile($path, $sharedFeed->uuid, $sharedFeed->file_name);
Línea 1763... Línea 1743...
1763
               
1743
               
Línea 1784... Línea 1764...
1784
                $item['shared_name'] = $sharedGroup->name;
1764
                $item['shared_name'] = $sharedGroup->name;
1785
            } else {
1765
            } else {
1786
                $sharedUser = $userMapper->fetchOne($sharedFeed->user_id);
1766
                $sharedUser = $userMapper->fetchOne($sharedFeed->user_id);
Línea 1787... Línea 1767...
1787
                
1767
                
1788
                $item['shared_url'] = $this->url()->fromRoute('profile/view', ['id' => $sharedUser->uuid]);
1768
                $item['shared_url'] = $this->url()->fromRoute('profile/view', ['id' => $sharedUser->uuid]);
1789
                $item['shared_image'] = $this->storage->getUserImage($sharedUser); 
1769
                $item['shared_image'] = $storage->getUserImage($sharedUser); 
1790
                $item['shared_name'] = $sharedUser->first_name . ' ' . $sharedUser->last_name;
1770
                $item['shared_name'] = $sharedUser->first_name . ' ' . $sharedUser->last_name;
1791
            }
1771
            }
Línea 1821... Línea 1801...
1821
                array_push($comments , [
1801
                array_push($comments , [
1822
                    'unique' => uniqid(),
1802
                    'unique' => uniqid(),
1823
                    'user_url' => $this->url()->fromRoute('profile/view', ['id' => $user->uuid],['force_canonical' => true]),
1803
                    'user_url' => $this->url()->fromRoute('profile/view', ['id' => $user->uuid],['force_canonical' => true]),
1824
                    'user_name' => $user->first_name . ' ' . $user->last_name,
1804
                    'user_name' => $user->first_name . ' ' . $user->last_name,
1825
                    'company' => $owner,
1805
                    'company' => $owner,
1826
                    'user_image' => $this->storage->getUserImage($user),
1806
                    'user_image' => $storage->getUserImage($user),
1827
                    'time_elapsed' => Functions::timeAgo($record->added_on, $now),
1807
                    'time_elapsed' => Functions::timeAgo($record->added_on, $now),
1828
                    'comment' => $record->comment,
1808
                    'comment' => $record->comment,
1829
                    'link_abuse_report' => $user->id == $currentUser->id ? '' : $this->url()->fromRoute('helpers/abuse-report', ['type' => 'comment', 'id' => $record->uuid], ['force_canonical' => true]),
1809
                    'link_abuse_report' => $user->id == $currentUser->id ? '' : $this->url()->fromRoute('helpers/abuse-report', ['type' => 'comment', 'id' => $record->uuid], ['force_canonical' => true]),
1830
                    'link_delete' => $link_delete
1810
                    'link_delete' => $link_delete
1831
                ]);
1811
                ]);
Línea 1843... Línea 1823...
1843
     * @param int $comment_id
1823
     * @param int $comment_id
1844
     * @return array
1824
     * @return array
1845
     */
1825
     */
1846
    private function renderComment($comment_id, $now)
1826
    private function renderComment($comment_id, $now)
1847
    {
1827
    {
-
 
1828
        $storage = Storage::getInstance($this->config, $this->adapter);
-
 
1829
        
1848
        $currentUserPlugin = $this->plugin('currentUserPlugin');
1830
        $currentUserPlugin = $this->plugin('currentUserPlugin');
1849
        $currentUser = $currentUserPlugin->getUser();
1831
        $currentUser = $currentUserPlugin->getUser();
Línea 1850... Línea 1832...
1850
        
1832
        
Línea 1862... Línea 1844...
1862
            $userMapper = UserMapper::getInstance($this->adapter);
1844
            $userMapper = UserMapper::getInstance($this->adapter);
Línea 1863... Línea 1845...
1863
 
1845
 
Línea 1864... Línea 1846...
1864
            $user = $userMapper->fetchOne($record->user_id);
1846
            $user = $userMapper->fetchOne($record->user_id);
1865
 
1847
 
1866
            $item['unique'] = uniqid();
1848
            $item['unique'] = uniqid();
1867
            $item['user_image'] = $this->storage->getUserImage($user);
1849
            $item['user_image'] = $storage->getUserImage($user);
1868
            $item['user_url'] = $this->url()->fromRoute('profile', ['id' => $user->uuid]);
1850
            $item['user_url'] = $this->url()->fromRoute('profile', ['id' => $user->uuid]);
1869
            $item['user_name'] = $user->first_name . ' ' . $user->last_name;
1851
            $item['user_name'] = $user->first_name . ' ' . $user->last_name;
1870
            $item['time_elapsed'] = Functions::timeAgo($record->added_on, $now);
1852
            $item['time_elapsed'] = Functions::timeAgo($record->added_on, $now);