Ejemplo n.º 1
0
 /**
  * @brief serve opds feed for given directory
  *
  * @param string $dir full path to directory
  * @param int $id requested id
  */
 public static function serveFeed($dir, $id)
 {
     if (isset($_SERVER['HTTP_ACCEPT']) && stristr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) {
         header('Content-Type: application/atom+xml');
     } else {
         header('Content-Type: text/xml; charset=UTF-8');
     }
     $sortAttribute = 'name';
     $sortDirection = false;
     $defaults = new \OC_Defaults();
     $tmpl = new \OCP\Template('files_opds', 'feed');
     $tmpl->assign('files', Files::formatFileInfos(Files::getFiles($dir, $sortAttribute, $sortDirection)));
     $tmpl->assign('bookshelf', Files::formatFileInfos(Bookshelf::get()));
     $tmpl->assign('bookshelf-count', Bookshelf::count());
     $tmpl->assign('feed_id', self::getFeedId());
     $tmpl->assign('id', $id);
     $tmpl->assign('dir', $dir);
     $tmpl->assign('user', \OCP\User::getDisplayName());
     $tmpl->assign('feed_title', Config::get('feed_title', \OCP\User::getDisplayName() . "'s Library"));
     $tmpl->assign('feed_subtitle', Config::getApp('feed_subtitle', $defaults->getName() . " OPDS catalog"));
     $tmpl->assign('feed_updated', time());
     $tmpl->printPage();
 }
Ejemplo n.º 2
0
            return $strip_white ? trim((string) $simplexml_obj) : (string) $simplexml_obj;
        }
        $attr = array();
        foreach ($simplexml_obj as $k => $val) {
            if (!empty($array_tags) && in_array($k, $array_tags)) {
                $attr[] = simplexml_to_array($val, $array_tags, $strip_white);
            } else {
                $attr[$k] = simplexml_to_array($val, $array_tags, $strip_white);
            }
        }
        return $attr;
    }
    return FALSE;
}
//Show all files at exchange
$exchange_files = $file->getFiles(DATA_PATH . "exchange" . DS);
if (!empty($exchange_files)) {
    foreach ($exchange_files as $key => $val) {
        //read file
        $xml = simplexml_to_array(simplexml_load_file(DATA_PATH . "exchange" . DS . $val['name'], "SimpleXMLElement", LIBXML_NOCDATA));
        $items[str_replace('.xml', '', $val['name'])] = $xml['Title'];
    }
}
if (isset($_POST['do'])) {
    $do = trim($_POST['do']);
    switch ($do) {
        case "import":
            //upload file.
            uses("attachment");
            $attachment = new Attachment('tb_file');
            if (!empty($_FILES['tb_file']['name'])) {
Ejemplo n.º 3
0
     if (!empty($G['setting']['thumb_small'])) {
         list($item['small_width'], $item['small_height']) = explode($attachment_controller->seperator, $G['setting']['thumb_small']);
     } else {
         list($item['small_width'], $item['small_height']) = explode($attachment_controller->seperator, $attachment_controller->small_scale);
     }
     if (!empty($G['setting']['thumb_middle'])) {
         list($item['middle_width'], $item['middle_height']) = explode($attachment_controller->seperator, $G['setting']['thumb_middle']);
     } else {
         list($item['middle_width'], $item['middle_height']) = explode($attachment_controller->seperator, $attachment_controller->middle_scale);
     }
     if (!empty($G['setting']['thumb_large'])) {
         list($item['large_width'], $item['large_height']) = explode($attachment_controller->seperator, $G['setting']['thumb_large']);
     } else {
         list($item['large_width'], $item['large_height']) = explode($attachment_controller->seperator, $attachment_controller->large_scale);
     }
     $face_list = $folder->getFiles(DATA_PATH . "fonts" . DS);
     if (!empty($face_list)) {
         foreach ($face_list as $val) {
             $tmp_arr[$val['name']] = "data/fonts/" . $val['name'];
         }
         setvar("DefaultFace", $folder->fontFace);
         setvar("FontFaces", $tmp_arr);
     }
     $tpl_file = "setting.attach";
     break;
 case "basic_contact":
     $tpl_file = "setting.basic.contact";
     break;
 case "datetime":
     if (isset($item['DATE_FORMAT'])) {
         $tmp_str = explode("-", $item['DATE_FORMAT']);
Ejemplo n.º 4
0
        // Delete the duplicated from the Data table
        $data = new Data();
        $data->deleteItems($source['id']);
        // Delete the source settings
        $properties = new SourcesProperties(array(Properties::KEY => $source['id']));
        $properties->deleteAllProperties();
        // Remove the source
        $sdb->deleteSource($source['id']);
        // We should also delete the associated comments
        $comments = new Comments();
        $comments->deleteComments($source['id']);
    }
}
// Delete all user files
$fdb = new Files();
$files = $fdb->getFiles();
if ($files && count($files) > 0) {
    foreach ($files as $file) {
        $fdb->deleteFile($file->key);
    }
}
// Delete all stories
$stdb = new Stories();
$stories = $stdb->getStories();
if ($stories && count($stories) > 0) {
    foreach ($stories as $story) {
        $stdb->deleteStory($story['id']);
    }
}
// Delete all widgets
$wdb = new Widgets();
Ejemplo n.º 5
0
if (isset($_GET['do'])) {
    $do = trim($_GET['do']);
    if (!empty($_GET['id'])) {
        $id = intval($_GET['id']);
    }
    if ($do == "del" && !empty($id)) {
        $deleted = $userpage->del($id);
        $cache->writeCache("userpage", "userpage");
    }
    if ($do == "edit") {
        if (!empty($id)) {
            $res = $userpage->read("*", $id);
            setvar("item", $res);
        }
        setvar("tplext", $smarty->tpl_ext);
        $tmp_pagetemplets = $file->getFiles(PHPB2B_ROOT . "templates" . DS . $theme_name);
        if (!empty($tmp_pagetemplets)) {
            $page_templets = "<optgroup label='" . L("other_templet", "tpl") . "'>";
            foreach ($tmp_pagetemplets as $p_val) {
                if (strstr($p_val['name'], "page.")) {
                    $page_templets .= "<option value=" . $p_val['name'] . ">" . $p_val['name'] . "</option>";
                }
            }
            $page_templets .= "</optgroup>";
            setvar("other_templets", $page_templets);
        }
        $tpl_file = "userpage.edit";
        template($tpl_file);
        exit;
    }
}
Ejemplo n.º 6
0
/**
 * Created by PhpStorm.
 * User: Praktikant
 * Date: 20.01.2016
 * Time: 11:35
 */
include_once "classes/Files.php";
session_start();
if (!isset($_SESSION['userid'])) {
    die('Bitte zuerst <a href="login.php">einloggen</a>');
}
//Abfrage der Nutzer ID vom Login
$userid = $_SESSION['userid'];
$username = $_SESSION['username'];
$oFiles = new Files();
$aUserFiles = $oFiles->getFiles($_SESSION['userid']);
$output = "<html>\n  <head>\n  <meta charset='utf-8'>\n  <title>User restricted- Area</title>\n  <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>\n  <script src='js/func.user_area.js' type='text/javascript'></script>\n</head>\n</html>\n<body>\nEingeloogt als User: "******"<strong> " . $username . "</strong>\n<a href='index.php?redirect=logout'>Logout</a>\n<br/>\n\n<div>\n<h2>File upload - overview</h2><br/>\n<form action='user_area.php?upload=1' method='post' name='upload' enctype='multipart/form-data'>\n Wählen Sie hier eine Datei, die Sie uploaden möchten:<br/>\n <input type='file' name='upload' size='100'>\n <input type='submit' name='fileuploader' value='Upload'>\n\n</form>\n</div>";
// here call function to insert new data
if (isset($_GET['upload'])) {
    $filename = $_FILES['upload']['name'];
    $type = $_FILES['upload']['type'];
    $size = $_FILES['upload']['size'];
    $created = date('Y-m-d H:i:s');
    $oFiles->newFile($filename, $type, $size, $created);
    header('Location: user_area.php');
}
// actions von GET abfragen
if (isset($_GET['action']) && $_GET['action'] == "delete") {
    $oFiles->deleteFile($_GET['id']);
    header('Location: user_area.php');
}