コード例 #1
0
ファイル: File_Manager.php プロジェクト: HaldunA/phpwebsite
 public function clearLink()
 {
     $js_vars['label'] = dgettext('filecabinet', 'Clear file');
     $js_vars['id'] = $this->session_id;
     $js_vars['img'] = str_replace("'", "\\'", $this->placeHolder());
     $add_vars = $this->linkInfo();
     $add_vars['fop'] = 'open_file_manager';
     $add_vars['fid'] = 0;
     $js_vars['authkey'] = Current_User::getAuthKey(PHPWS_Text::saltArray($add_vars));
     return javascriptMod('filecabinet', 'clear_file', $js_vars);
 }
コード例 #2
0
ファイル: Image.php プロジェクト: HaldunA/phpwebsite
    public function rowTags()
    {
        static $folder = null;
        if (empty($folder)) {
            $folder = new Folder($this->folder_id);
        }
        if (Current_User::allow('filecabinet', 'edit_folders', $this->folder_id, 'folder')) {
            $links[] = $folder->uploadLink('icon', null, null, $this->id);
            $authkey = \Current_User::getAuthKey(\PHPWS_Text::saltArray(array('iop' => 'delete_image', 'file_id' => $this->id, 'folder_id' => $this->folder_id)));
            $links[] = <<<EOF
<i style='cursor:pointer' class='fa fa-trash-o delete-file' data-folder-id='{$this->folder_id}' data-id='{$this->id}' data-type='iop' data-command='delete_image' data-authkey='{$authkey}'></i>
EOF;
        }
        if (isset($links)) {
            $tpl['ACTION'] = implode('', $links);
        }
        $tpl['SIZE'] = $this->getSize(TRUE);
        $tpl['FILE_NAME'] = $this->file_name;
        $tpl['THUMBNAIL'] = $this->lightboxThumb();
        $tpl['TITLE'] = htmlspecialchars($this->title, ENT_QUOTES);
        $tpl['DIMENSIONS'] = sprintf('%s x %s', $this->width, $this->height);
        return $tpl;
    }
コード例 #3
0
ファイル: Link.php プロジェクト: par-orillonsoft/phpwebsite
 public function getAuthKey()
 {
     // if not secure, authkey irrelevant
     if (!$this->secure || !class_exists('Current_User')) {
         return null;
     }
     if ($this->salted) {
         // Have to make them strings because GET will change them on the
         // other side.
         return Current_User::getAuthKey(PHPWS_Text::saltArray($this->values));
     } else {
         $result = Current_User::getAuthKey();
         return $result;
     }
 }
コード例 #4
0
ファイル: Forms.php プロジェクト: HaldunA/phpwebsite
    /**
     * Lists the contents of a folder for adminstrative changes.
     * @param object $folder
     * @param boolean $pick_image
     */
    public function folderContents($folder)
    {
        $links = array();
        javascript('jquery');
        $src = PHPWS_SOURCE_HTTP . 'mod/filecabinet/javascript/folder_options/contents.js';
        \Layout::addJSHeader("<script type='text/javascript' src='{$src}'></script>", 'folder-options');
        Layout::addStyle('filecabinet');
        PHPWS_Core::initCoreClass('DBPager.php');
        $dir_write = true;
        if (!is_writable($folder->getFullDirectory())) {
            $this->cabinet->message .= dgettext('filecabinet', 'Warning: this folder\'s directory is not writable.');
            $dir_write = false;
        }
        if ($folder->ftype == IMAGE_FOLDER) {
            javascript('lightbox');
            PHPWS_Core::initModClass('filecabinet', 'Image.php');
            $pager = new DBPager('images', 'PHPWS_Image');
            $pager->setTemplate('Forms/image_grid.tpl');
            $limits[9] = 9;
            $limits[16] = 16;
            $limits[25] = 25;
            $operation = 'iop';
            $command = 'upload_image_form';
            $label = _('Add image');
        } elseif ($folder->ftype == DOCUMENT_FOLDER) {
            PHPWS_Core::initModClass('filecabinet', 'Document.php');
            $pager = new DBPager('documents', 'PHPWS_Document');
            $pager->setTemplate('Forms/file_list.tpl');
            $limits[10] = 10;
            $limits[25] = 25;
            $limits[50] = 50;
            $operation = 'dop';
            $label = _('Add document');
            $command = 'upload_document_form';
            $pager->addSortHeader('downloaded', sprintf('<abbr title="%s">%s</abbr>', dgettext('filecabinet', 'Downloaded'), dgettext('filecabinet', 'DL')));
        } elseif ($folder->ftype = MULTIMEDIA_FOLDER) {
            PHPWS_Core::initModClass('filecabinet', 'Multimedia.php');
            $pager = new DBPager('multimedia', 'PHPWS_Multimedia');
            $pager->setTemplate('Forms/multimedia_grid.tpl');
            $limits[9] = 9;
            $limits[16] = 16;
            $limits[25] = 25;
            $label = _('Add media');
            $command = 'upload_multimedia_form';
            $operation = 'mop';
        }
        if (Current_User::allow('filecabinet', 'edit_folders', $folder->id, 'folder')) {
            if ($dir_write) {
                $links[] = $folder->uploadLink('button');
            }
            if ($folder->ftype == MULTIMEDIA_FOLDER) {
                //$links[] = $folder->rtmpLink();
                $salt = array('mop' => 'edit_rtmp', 'folder_id' => $folder->id);
                $authkey = \Current_User::getAuthKey(PHPWS_Text::saltArray($salt));
                $links[] = <<<EOF
<button class="btn btn-default show-modal" data-authkey="{$authkey}" data-command="edit_rtmp" data-operation="{$operation}" data-folder-id="{$folder->id}"><i class="fa fa-cloud"></i> Add RTMP video</button>
EOF;
            }
            //$links[] = $folder->editLink();
            $salt = array($operation => 'edit_folder', 'folder_id' => $folder->id);
            $authkey = \Current_User::getAuthKey(PHPWS_Text::saltArray($salt));
            $links[] = <<<EOF
<button class="btn btn-default show-modal" data-authkey="{$authkey}" data-command="edit_folder_modal" data-operation="aop" data-folder-id="{$folder->id}"><i class="fa fa-edit"></i> Edit</button>
EOF;
        }
        if ($this->cabinet->panel) {
            $pagetags['BACK'] = PHPWS_Text::moduleLink('<i class="fa fa-reply"></i> ' . dgettext('filecabinet', 'Back to folder list'), 'filecabinet', array('tab' => $this->cabinet->panel->getCurrentTab()), null, null, 'btn btn-default');
        }
        if (!empty($links)) {
            $pagetags['ADMIN_LINKS'] = implode(' ', $links);
        }
        $pagetags['MODAL'] = $this->getModal();
        $pagetags['ACTION_LABEL'] = dgettext('filecabinet', 'Action');
        $pager->setLimitList($limits);
        $pager->setSearch('file_name', 'title', 'description');
        $pager->addWhere('folder_id', $folder->id);
        $pager->setOrder('title', 'asc', true);
        $pager->setModule('filecabinet');
        $pager->addPageTags($pagetags);
        $pager->addRowTags('rowTags');
        $pager->addSortHeader('title', dgettext('filecabinet', 'Title'));
        $pager->addSortHeader('file_name', dgettext('filecabinet', 'File name'));
        $pager->addSortHeader('file_type', dgettext('filecabinet', 'File type'));
        $pager->addSortHeader('size', dgettext('filecabinet', 'Size'));
        $pager->setEmptyMessage(dgettext('filecabinet', 'Folder is empty.'));
        $this->cabinet->content = $pager->get();
    }