当前位置: 首页>>代码示例>>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;未经允许,请勿转载。