示例#1
0
 /**
  * Plugin initialization
  */
 public function init()
 {
     // check requirements first
     if (!class_exists('ZipArchive', false)) {
         rcmail::raise_error(array('code' => 520, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "php_zip extension is required for the zipdownload plugin"), true, false);
         return;
     }
     $rcmail = rcmail::get_instance();
     $this->load_config();
     $this->charset = $rcmail->config->get('zipdownload_charset', RCUBE_CHARSET);
     $this->add_texts('localization');
     if ($rcmail->config->get('zipdownload_attachments', 1) > -1 && ($rcmail->action == 'show' || $rcmail->action == 'preview')) {
         $this->add_hook('template_object_messageattachments', array($this, 'attachment_ziplink'));
     }
     $this->register_action('plugin.zipdownload.zip_attachments', array($this, 'download_attachments'));
     $this->register_action('plugin.zipdownload.zip_messages', array($this, 'download_selection'));
     $this->register_action('plugin.zipdownload.zip_folder', array($this, 'download_folder'));
     if ($rcmail->config->get('zipdownload_folder', false) || $rcmail->config->get('zipdownload_selection', false)) {
         $this->include_script('zipdownload.js');
         $this->api->output->set_env('zipdownload_selection', $rcmail->config->get('zipdownload_selection', false));
         if ($rcmail->config->get('zipdownload_folder', false) && ($rcmail->action == '' || $rcmail->action == 'show')) {
             $zipdownload = $this->api->output->button(array('command' => 'plugin.zipdownload.zip_folder', 'type' => 'link', 'classact' => 'active', 'content' => $this->gettext('downloadfolder')));
             $this->api->add_content(html::tag('li', array('class' => 'separator_above'), $zipdownload), 'mailboxoptions');
         }
     }
 }
示例#2
0
 /**
  * Plugin initialization
  */
 public function init()
 {
     // check requirements first
     if (!class_exists('ZipArchive', false)) {
         rcmail::raise_error(array('code' => 520, 'file' => __FILE__, 'line' => __LINE__, 'message' => "php_zip extension is required for the zipdownload plugin"), true, false);
         return;
     }
     $rcmail = rcmail::get_instance();
     $this->load_config();
     $this->charset = $rcmail->config->get('zipdownload_charset', RCUBE_CHARSET);
     $this->add_texts('localization');
     if ($rcmail->config->get('zipdownload_attachments', 1) > -1 && ($rcmail->action == 'show' || $rcmail->action == 'preview')) {
         $this->add_hook('template_object_messageattachments', array($this, 'attachment_ziplink'));
     }
     $this->register_action('plugin.zipdownload.attachments', array($this, 'download_attachments'));
     $this->register_action('plugin.zipdownload.messages', array($this, 'download_messages'));
     if (!$rcmail->action && $rcmail->config->get('zipdownload_selection')) {
         $this->download_menu();
     }
 }
示例#3
0
while ($redirects < 5) {
    // execute a plugin action
    if ($RCMAIL->plugins->is_plugin_task($RCMAIL->task)) {
        if (!$RCMAIL->action) {
            $RCMAIL->action = 'index';
        }
        $RCMAIL->plugins->exec_action($RCMAIL->task . '.' . $RCMAIL->action);
        break;
    } else {
        if (preg_match('/^plugin\\./', $RCMAIL->action)) {
            $RCMAIL->plugins->exec_action($RCMAIL->action);
            break;
        } else {
            if (($stepfile = $RCMAIL->get_action_file()) && is_file($incfile = INSTALL_PATH . 'program/steps/' . $RCMAIL->task . '/' . $stepfile)) {
                // include action file only once (in case it don't exit)
                include_once $incfile;
                $redirects++;
            } else {
                break;
            }
        }
    }
}
if ($RCMAIL->action == 'refresh') {
    $RCMAIL->plugins->exec_hook('refresh', array('last' => intval(rcube_utils::get_input_value('_last', rcube_utils::INPUT_GPC))));
}
// parse main template (default)
$OUTPUT->send($RCMAIL->task);
// if we arrive here, something went wrong
rcmail::raise_error(array('code' => 404, 'type' => 'php', 'line' => __LINE__, 'file' => __FILE__, 'message' => "Invalid request"), true, true);
示例#4
0
/**
 * Local callback function for PEAR errors
 */
function __pear_error($err)
{
    rcmail::raise_error(array('code' => $err->getCode(), 'message' => $err->getMessage()));
}
示例#5
0
function raise_error($arg = array(), $log = false, $terminate = false)
{
    rcmail::raise_error($arg, $log, $terminate);
}
示例#6
0
function raise_error($arg = array(), $log = false, $terminate = false)
{
    _deprecation_warning(__FUNCTION__);
    rcmail::raise_error($arg, $log, $terminate);
}