當前位置: 首頁>>代碼示例>>PHP>>正文


PHP elFinder::getVolume方法代碼示例

本文整理匯總了PHP中elFinder::getVolume方法的典型用法代碼示例。如果您正苦於以下問題:PHP elFinder::getVolume方法的具體用法?PHP elFinder::getVolume怎麽用?PHP elFinder::getVolume使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在elFinder的用法示例。


在下文中一共展示了elFinder::getVolume方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: log


//.........這裏部分代碼省略.........
                $log .= "\tADDED: " . $elfinder->realpath($file['hash']) . "\n";
            }
        }
        if (!empty($result['changed'])) {
            foreach ($result['changed'] as $file) {
                $log .= "\tCHANGED: " . $elfinder->realpath($file['hash']) . "\n";
            }
        }
        if (!empty($result['added']) && in_array($cmd, array('mkdir', 'mkfile', 'put', 'upload', 'extract'))) {
            $mail = false;
            if (is_object($this->xoopsUser)) {
                if ($this->isAdmin) {
                    $mail = in_array(XOOPS_GROUP_ADMIN, $this->config['mail_notify_group']);
                } else {
                    $mail = array_intersect($this->config['mail_notify_group'], $this->mygids);
                }
            } else {
                $mail = $this->config['mail_notify_guest'];
            }
            //$log .= "\n\$mail=".($mail? 'On' : 'Off')."\n";
            if ($mail) {
                $config_handler = xoops_gethandler('config');
                $xoopsConfig = $config_handler->getConfigsByCat(XOOPS_CONF);
                $sep = "\n" . str_repeat('-', 40) . "\n";
                $self = XOOPS_MODULE_URL . '/' . $this->mydirname . '/connector.php';
                if (is_object($this->xoopsUser)) {
                    $uname = $this->xoopsUser->uname('n');
                    $uid = $this->xoopsUser->uid();
                } else {
                    $uname = $xoopsConfig['anonymous'];
                    $uid = 0;
                }
                $date = date('c');
                $head = <<<EOD
USER: {$uname}
UID: {$uid}
IP: {$_SERVER['REMOTE_ADDR']}
CMD: {$cmd}
DATE: {$date}
EOD;
                $msg = array();
                foreach ($result['added'] as $file) {
                    $url = 'unknown';
                    if (!empty($file['url'])) {
                        $url = $file['url'] != 1 ? $file['url'] : 'ondemand';
                    } else {
                        $url = $self . '?cmd=file&target=' . $file['hash'];
                    }
                    $dl = $self . '?cmd=file&download=1&target=' . $file['hash'];
                    $hash = $file['hash'];
                    $path = $elfinder->realpath($file['hash']);
                    $name = $file['name'];
                    $manager = XOOPS_MODULE_URL . '/' . $this->mydirname . '/manager.php#elf_' . $file['phash'];
                    $msg[] = <<<EOD
HASH: {$hash}
PATH: {$path}
NAME: {$name}
URL: {$url}
DOWNLOAD: {$dl}
MANAGER: {$manager}
EOD;
                }
                $sitename = $xoopsConfig['sitename'];
                $modname = $this->xoopsModule->getVar('name');
                $subject = '[' . $modname . '] Cmd: "' . $cmd . '" Report';
                $message = join($sep, $msg);
                if (strtoupper(_CHARSET) !== 'UTF-8') {
                    ini_set('default_charset', _CHARSET);
                    if (version_compare(PHP_VERSION, '5.6', '<')) {
                        ini_set('mbstring.internal_encoding', _CHARSET);
                    } else {
                        @ini_set('mbstring.internal_encoding', '');
                    }
                    $message = mb_convert_encoding($message, _CHARSET, 'UTF-8');
                }
                $xoopsMailer = getMailer();
                $xoopsMailer->useMail();
                $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
                $xoopsMailer->setFromName($sitename . ':' . $modname);
                $xoopsMailer->setSubject($subject);
                $xoopsMailer->setBody($head . $sep . $message);
                $xoopsMailer->setToEmails($xoopsConfig['adminmail']);
                $xoopsMailer->send();
                $xoopsMailer->reset();
                if (strtoupper(_CHARSET) !== 'UTF-8') {
                    ini_set('mbstring.internal_encoding', 'UTF-8');
                }
            }
        }
        $this->write($log);
        if (in_array($cmd, array('mkdir', 'mkfile', 'put', 'paste', 'upload', 'extract', 'resize'))) {
            if (!empty($result['changed'])) {
                if (($target = $result['changed'][0]['phash']) && ($volume = $elfinder->getVolume($target))) {
                    if ($parents = $volume->parents($target, true)) {
                        $result['changed'] = array_merge($result['changed'], $parents);
                    }
                }
            }
        }
    }
開發者ID:hmoritake,項目名稱:xelfinder,代碼行數:101,代碼來源:xoops_elFinder.class.php


注:本文中的elFinder::getVolume方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。