src/libraries/controllers/ApiPhotoController.php
/**
    * Display a confirmation page for the upload
    *
    * @return string Standard JSON envelope
    */
Display a confirmation page for the upload
@return string Standard JSON envelope
Display a confirmation page for the upload @return string Standard JSON envelope
public function uploadConfirm()
  {
    $params = $_POST;
    $params['successIds'] = $params['duplicateIds'] = array();
    if(isset($params['success']) && !empty($params['success']))
    {
      foreach($params['success'] as $p)
        $params['successIds'][] = $p['id'];
    }
    if(isset($params['duplicates']) && !empty($params['duplicates']))
    {
      foreach($params['duplicate'] as $p)
        $params['duplicateIds'][] = $params['successIds'][] = $p['id'];
    }
    $params['successIds'] = implode(',', $params['successIds']);
    $params['duplicateIds'] = implode(',', $params['duplicateIds']);
    $params['successPhotos'] = $params['duplicatePhotos'] = array();
    if(count($params['successIds']) > 0)
    {
      $photosResp = $this->api->invoke('/photos/list.json', EpiRoute::httpGet, array('_GET' => array('pageSize' => '0', 'ids' => $params['successIds'], 'returnSizes' => '100x100xCR')));
      if($photosResp['code'] === 200 && $photosResp['result'][0]['totalRows'] > 0)
        $params['successPhotos'] = $photosResp['result'];
    }
    if(count($params['duplicateIds']) > 0)
    {
      $photosResp = $this->api->invoke('/photos/list.json', EpiRoute::httpGet, array('_GET' => array('pageSize' => '0', 'ids' => $params['duplicateIds'], 'returnSizes' => '100x100xCR')));
      if($photosResp['code'] === 200 && $photosResp['result'][0]['totalRows'] > 0)
        $params['duplicatePhotos'] = $photosResp['result'];
    }
    $params['facebookId'] = false;
    if($this->plugin->isActive('FacebookConnect'))
    {
      $fbConf = $this->plugin->loadConf('FacebookConnect');
      $params['facebookId'] = $fbConf['id'];
    }
    if(count($params['ids']) > 0)
    {
      $ids = implode(',', $params['ids']);
      $params['url'] = $this->url->photosView("ids-{$ids}", false);
      $resourceMapResp = $this->api->invoke('/s/create.json', EpiRoute::httpPost, array('_POST' => array('uri' => $params['url'], 'method' => 'GET')));
      if($resourceMapResp['code'] === 201)
        $params['url'] = $this->url->resourceMap($resourceMapResp['result']['id'], false);
    }
    $template = sprintf('%s/uploadConfirm.php', $this->config->paths->templates);
    $body = $this->template->get($template, $params);
    return $this->success('Photos uploaded successfully', $body);
  }
public function uploadConfirm ( ) { $ params = $ _POST ; $ params [ 'successIds' ] = $ params [ 'duplicateIds' ] = array ( ) ; if ( isset ( $ params [ 'success' ] ) && ! empty ( $ params [ 'success' ] ) ) { foreach ( $ params [ 'success' ] as $ p ) $ params [ 'successIds' ] [ ] = $ p [ 'id' ] ; } if ( isset ( $ params [ 'duplicates' ] ) && ! empty ( $ params [ 'duplicates' ] ) ) { foreach ( $ params [ 'duplicate' ] as $ p ) $ params [ 'duplicateIds' ] [ ] = $ params [ 'successIds' ] [ ] = $ p [ 'id' ] ; } $ params [ 'successIds' ] = implode ( ',' , $ params [ 'successIds' ] ) ; $ params [ 'duplicateIds' ] = implode ( ',' , $ params [ 'duplicateIds' ] ) ; $ params [ 'successPhotos' ] = $ params [ 'duplicatePhotos' ] = array ( ) ; if ( count ( $ params [ 'successIds' ] ) > 0 ) { $ photosResp = $ this -> api -> invoke ( '/photos/list.json' , EpiRoute :: httpGet , array ( '_GET' => array ( 'pageSize' => '0' , 'ids' => $ params [ 'successIds' ] , 'returnSizes' => '100x100xCR' ) ) ) ; if ( $ photosResp [ 'code' ] === 200 && $ photosResp [ 'result' ] [ 0 ] [ 'totalRows' ] > 0 ) $ params [ 'successPhotos' ] = $ photosResp [ 'result' ] ; } if ( count ( $ params [ 'duplicateIds' ] ) > 0 ) { $ photosResp = $ this -> api -> invoke ( '/photos/list.json' , EpiRoute :: httpGet , array ( '_GET' => array ( 'pageSize' => '0' , 'ids' => $ params [ 'duplicateIds' ] , 'returnSizes' => '100x100xCR' ) ) ) ; if ( $ photosResp [ 'code' ] === 200 && $ photosResp [ 'result' ] [ 0 ] [ 'totalRows' ] > 0 ) $ params [ 'duplicatePhotos' ] = $ photosResp [ 'result' ] ; } $ params [ 'facebookId' ] = false ; if ( $ this -> plugin -> isActive ( 'FacebookConnect' ) ) { $ fbConf = $ this -> plugin -> loadConf ( 'FacebookConnect' ) ; $ params [ 'facebookId' ] = $ fbConf [ 'id' ] ; } if ( count ( $ params [ 'ids' ] ) > 0 ) { $ ids = implode ( ',' , $ params [ 'ids' ] ) ; $ params [ 'url' ] = $ this -> url -> photosView ( " ids- { $ ids } " , false ) ; $ resourceMapResp = $ this -> api -> invoke ( '/s/create.json' , EpiRoute :: httpPost , array ( '_POST' => array ( 'uri' => $ params [ 'url' ] , 'method' => 'GET' ) ) ) ; if ( $ resourceMapResp [ 'code' ] === 201 ) $ params [ 'url' ] = $ this -> url -> resourceMap ( $ resourceMapResp [ 'result' ] [ 'id' ] , false ) ; } $ template = sprintf ( '%s/uploadConfirm.php' , $ this -> config -> paths -> templates ) ; $ body = $ this -> template -> get ( $ template , $ params ) ; return $ this -> success ( 'Photos uploaded successfully' , $ body ) ; }
Display a confirmation page for the upload
 @return string Standard JSON envelope
Display a confirmation page for the upload @return string Standard JSON envelope