[Owncloud] Public page in a app

Tharindu Dhananjaya Galappaththi tdgalappaththi at gmail.com
Wed Jun 26 05:11:23 UTC 2013


$files = \OCA\CloudToCloud\CloudToCloudShare::getFiles($email,$dir);  //
this is called from the 'public' page



    public static function getFiles($email,$dir){
        $query = \OC_DB::prepare("SELECT * FROM *PREFIX*c2c_share WHERE
`email`=? ORDER BY `stime`");
        $result = $query->execute(array($email));
        $files = array();

        if($dir == ""){
            while ($aFile = $result->fetchRow()) {
                if($aFile['item_type'] == "file"){
                   $name = $aFile['file_target'];
                   $path =
\OC\Files\Filesystem::getPath($aFile['item_source']);
                   $parent_path = substr($path,0,strrpos($path,'/')+1);
                   $dir_content =
\OC\Files\Filesystem::getDirectoryContent($parent_path);

                    foreach($dir_content as $i){
                        if($i['name'] == $name && $i['type']=="file"){
                            $files[] = $i;
                            break;
                        }
                    }
                }else{
                    $name = $aFile['file_target'];
                    $path =
\OC\Files\Filesystem::getPath($aFile['item_source']);
                    $parent_path = substr($path,0,strrpos($path,'/')+1);
                    $dir_content =
\OC\Files\Filesystem::getDirectoryContent($parent_path);
                    foreach($dir_content as $i){
                        if($i['name'] == $name && $i['type']=="dir"){
                            $files[] = $i;
                            break;
                        }
                    }
                }
            }
        }else{
            while($aFile = $result->fetchRow()){
                if($aFile['item_type'] == "dir" && $aFile['file_target'] ==
$dir){
                    $path =
\OC\Files\Filesystem::getPath($aFile['item_source']);
                    $dir_content =
\OC\Files\Filesystem::getDirectoryContent($path);
                    foreach($dir_content as $i){
                            $files[] = $i;
                    }
                }
            }

        }
        return $files;
    }


On Wed, Jun 26, 2013 at 3:26 AM, Bernhard Posselt <nukeawhale at gmail.com>wrote:

> File functions? Can you elaborate or show some code?
>
> On 06/25/2013 09:28 PM, Tharindu Dhananjaya Galappaththi wrote:
> > Without logging in to owncloud, I want to display some file info on the
> > public page. Is it possible to call file functions without logging in to
> > owncloud? It is giving me errors.
> > Please help
> >
> >
> > On Sun, Jun 23, 2013 at 4:37 PM, Bernhard Posselt <nukeawhale at gmail.com
> >wrote:
> >
> >> Its very easy: use a guest template (
> >>
> >>
> http://doc.owncloud.org/server/5.0/developer_manual/app/app/api/templates.html#OC_Template::printGuestPage
> >> )
> >> and dont check if the user is logged in
> >>
> >> On 06/23/2013 10:29 AM, Tharindu Dhananjaya Galappaththi wrote:
> >>> Hi,
> >>> I'm trying to create a page in a app, that can be accessed with out
> >> logging
> >>> in to owncloud.
> >>> I followed the procedure mentioned in :
> >>> http://owncloud.org/apps/public-php-and-remote-php/ , but it is not
> >>> working.
> >>> Please help me with this.
> >>> Thank You
> >>>
> >>>
> >>>
> >>> _______________________________________________
> >>> Owncloud mailing list
> >>> Owncloud at kde.org
> >>> https://mail.kde.org/mailman/listinfo/owncloud
> >> _______________________________________________
> >> Owncloud mailing list
> >> Owncloud at kde.org
> >> https://mail.kde.org/mailman/listinfo/owncloud
> >>
> >
> >
> > _______________________________________________
> > Owncloud mailing list
> > Owncloud at kde.org
> > https://mail.kde.org/mailman/listinfo/owncloud
>
> _______________________________________________
> Owncloud mailing list
> Owncloud at kde.org
> https://mail.kde.org/mailman/listinfo/owncloud
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/owncloud/attachments/20130626/99e6d264/attachment.html>


More information about the Owncloud mailing list