/**
  * This callback function adds a box below the message content
  * if there is a vcard attachment available
  */
 function html_output($p)
 {
     $attach_script = false;
     $icon = 'plugins/vcard_attachments/' . $this->local_skin_path() . '/vcard_add_contact.png';
     foreach ($this->vcard_parts as $part) {
         $vcards = rcube_vcard::import($this->message->get_part_content($part));
         // successfully parsed vcards?
         if (empty($vcards)) {
             continue;
         }
         // remove part's body
         if (in_array($part, $this->vcard_bodies)) {
             $p['content'] = '';
         }
         $style = 'margin:0.5em 1em; padding:0.2em 0.5em; border:1px solid #999; ' . 'border-radius:4px; -moz-border-radius:4px; -webkit-border-radius:4px; width: auto';
         foreach ($vcards as $idx => $vcard) {
             $display = $vcard->displayname;
             if ($vcard->email[0]) {
                 $display .= ' <' . $vcard->email[0] . '>';
             }
             // add box below messsage body
             $p['content'] .= html::p(array('style' => $style), html::a(array('href' => "#", 'onclick' => "return plugin_vcard_save_contact('" . JQ($part . ':' . $idx) . "')", 'title' => $this->gettext('addvcardmsg')), html::img(array('src' => $icon, 'style' => "vertical-align:middle"))) . ' ' . html::span(null, Q($display)));
         }
         $attach_script = true;
     }
     if ($attach_script) {
         $this->include_script('vcardattach.js');
     }
     return $p;
 }
Beispiel #2
0
 /**
  * ****************************************************
  * HOME
  * ****************************************************
  */
 function index()
 {
     $vars = array();
     $img = array();
     $vars['img'] =& $img;
     $img['up'] = 'images/icons/up.png';
     $img['down'] = 'images/icons/down.png';
     $img['edit'] = 'images/icons/edit.png';
     $img['delete'] = 'images/icons/delete.png';
     // action & id
     $action = $this->validate->get->getRaw('action');
     $action_list = array();
     if (in_array($action, $action_list)) {
         $this->{$action}();
     }
     $vars['nagavitor'] = $this->forum->get_nagavitor();
     $vars['board_move_data'] = $this->forum->get_redirect_data();
     $cats = $this->forum->get_category();
     $vars['cats'] = array();
     foreach ($cats as $key => $cat) {
         $newcat = array();
         $newcat['up'] = $newcat['down'] = '';
         if ($key - 1 >= 0) {
             $newcat['up'] = html::anchor('forum.php?c=admin&amp;m=movecat&amp;cat1=' . $cat['cat_id'] . '&amp;order1=' . $cat['cat_order'] . '&amp;cat2=' . $cats[$key - 1]['cat_order'] . '&amp;order2=' . $cats[$key - 1]['cat_order'], html::img($img['up']));
         }
         if ($key + 2 <= count($cats)) {
             $newcat['down'] = html::anchor('forum.php?c=admin&amp;m=movecat&amp;cat1=' . $cat['cat_id'] . '&amp;order1=' . $cat['cat_order'] . '&amp;cat2=' . $cats[$key + 1]['cat_id'] . '&amp;order2=' . $cats[$key + 1]['cat_order'], html::img($img['down']));
         }
         $newcat['id'] = $cat['cat_id'];
         $newcat['name'] = $cat['name'];
         $vars['cats'][$key] = $newcat;
         unset($newcat);
         $vars['cats'][$key]['boards'] = array();
         $catkey = $key;
         // get the board data
         $boards = array();
         $this->forum->get_board_list2($cat['cat_id'], 0, $boards);
         foreach ($boards as $key => $board) {
             $newboard = array();
             $newboard['up'] = $newboard['down'] = '';
             $min_order = $this->forum->get_board_min_order($cat['cat_id'], $board['child_level'], $board['parent_id']);
             $max_order = $this->forum->get_board_max_order($cat['cat_id'], $board['child_level'], $board['parent_id']);
             if ($board['board_order'] > $min_order) {
                 $newboard['up'] = html::anchor('forum.php?c=admin&amp;m=moveboard&amp;board1=' . $board['board_id'] . '&amp;order1=' . $board['board_order'] . '&amp;board2=' . $boards[$key - 1]['board_id'] . '&amp;order2=' . $boards[$key - 1]['board_order'], html::img($img['up']));
             }
             if ($board['board_order'] < $max_order) {
                 $newboard['down'] = html::anchor('forum.php?c=admin&amp;m=moveboard&amp;board1=' . $board['board_id'] . '&amp;order1=' . $board['board_order'] . '&amp;board2=' . $boards[$key + 1]['board_id'] . '&amp;order2=' . $boards[$key + 1]['board_order'], html::img($img['down']));
             }
             $newboard['level'] = $board['child_level'];
             $newboard['id'] = $board['board_id'];
             $newboard['name'] = $board['name'];
             $newboard['child_level'] = $board['name'];
             $newboard['parent'] = $board['parent_id'];
             $vars['cats'][$catkey]['boards'][] = $newboard;
             unset($newboard);
         }
     }
     $this->view->render('admin/index', $vars);
 }
Beispiel #3
0
 function startup_chbox($args)
 {
     $this->add_texts('localization');
     $rcmail = rcmail::get_instance();
     $icon = 'plugins/chbox/' . $this->local_skin_path() . '/columncheck.png';
     $chboxicon = html::img(array('src' => $icon, 'id' => 'selectmenulink', 'title' => $this->gettext('chbox'), 'alt' => $this->gettext('chbox')));
     $rcmail->output->add_label('chbox.chbox');
     $rcmail->output->set_env('chboxicon', $chboxicon);
     $this->include_stylesheet($this->local_skin_path() . '/chbox.css');
     return $args;
 }
Beispiel #4
0
 /**
  * Captcha
  *
  * @param array $options
  * @return string
  */
 public static function captcha($options = [])
 {
     $captcha_link = $options['id'] ?? 'default';
     // validation
     if (!empty($options['validate'])) {
         return self::validate($captcha_link, $options['password']);
     }
     // generating password
     $password = self::generate_password($captcha_link, $options['password_letters'] ?? null, $options['password_length'] ?? 5);
     array_key_unset($options, ['password_letters', 'password_length']);
     $image_options = ['src' => 'data:image/png;base64,' . base64_encode(self::draw($password, ['return_image' => true])), 'style' => $options['img_style'] ?? 'vertical-align: middle;'];
     if (!empty($options['only_image'])) {
         return html::img($image_options);
     } else {
         return '<table width="100%"><tr><td>' . html::input($options) . '</td><td width="1%">&nbsp;</td><td width="1%">' . html::img($image_options) . '</td></tr></table>';
     }
 }
 /**
  * This callback function adds a box below the message content
  * if there is a vcard attachment available
  */
 function html_output($p)
 {
     if ($this->vcard_part) {
         $vcard = new rcube_vcard($this->message->get_part_content($this->vcard_part));
         // successfully parsed vcard
         if ($vcard->displayname) {
             $display = $vcard->displayname;
             if ($vcard->email[0]) {
                 $display .= ' <' . $vcard->email[0] . '>';
             }
             // add box below messsage body
             $p['content'] .= html::p(array('style' => "margin:1em; padding:0.5em; border:1px solid #999; border-radius:4px; -moz-border-radius:4px; -webkit-border-radius:4px; width: auto;"), html::a(array('href' => "#", 'onclick' => "return plugin_vcard_save_contact('" . JQ($this->vcard_part) . "')", 'title' => $this->gettext('addvardmsg')), html::img(array('src' => $this->url('vcard_add_contact.png'), 'align' => "middle"))) . ' ' . html::span(null, Q($display)));
             $this->include_script('vcardattach.js');
         }
     }
     return $p;
 }
Beispiel #6
0
 public function testHTML()
 {
     $expected = '<img src="myimage.jpg" width="100" height="200">';
     $this->assertEquals($expected, html::tag('img', null, array('src' => 'myimage.jpg', 'width' => 100, 'height' => 200)));
     $expected = '<a href="http://google.com" title="Google">Google</a>';
     $this->assertEquals($expected, html::tag('a', 'Google', array('href' => 'http://google.com', 'title' => 'Google')));
     $expected = '<p>Nice Paragraph</p>';
     $this->assertEquals($expected, html::tag('p', 'Nice Paragraph'));
     $expected = '<br>';
     $this->assertEquals($expected, html::tag('br'));
     $expected = '<a href="http://google.com" title="Google">Google</a>';
     $this->assertEquals($expected, html::a('http://google.com', 'Google', array('title' => 'Google')));
     $expected = '<img src="myimage.jpg" alt="myimage" width="100" height="200">';
     $this->assertEquals($expected, html::img('myimage.jpg', array('width' => 100, 'height' => 200)));
     $expected = '<!--[if lt IE 9]>' . PHP_EOL;
     $expected .= '<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>' . PHP_EOL;
     $expected .= '<![endif]-->' . PHP_EOL;
     $this->assertEquals($expected, html::shiv());
 }
 * @copyright (c) 2014 Asoc. Coop. Tecnologia Terabyte 124, RL.
 * @Extension: [yii2-adminlte-advanced].
 * @Themes: AdminLTE - Views [Frontend - layouts/_userpanel].
 * @since 1.0
 */
use yii\helpers\Html;
?>

<?php 
echo Html::beginTag('div', ['class' => 'user-panel']);
?>
    <?php 
echo Html::beginTag('div', ['class' => 'pull-left image']);
?>
        <?php 
echo html::img(\yii::$app->params['Images_Url_60'], $options = ['class' => 'img-rounded', 'aria-expanded' => 'false']);
?>
    <?php 
echo Html::endTag('div');
?>
    <?php 
echo Html::beginTag('div', ['class' => 'pull-left info']);
?>
        <?php 
echo html::tag('p', \yii::$app->user->identity->username);
?>
            <?php 
echo Html::a(Html::tag('i', '', ['class' => 'fa fa-circle text-success']), '#');
?>
            <?php 
echo Html::tag('i', Yii::t('adminlte', 'On Line'));
    if ($file && empty($srcset)) {
        $srcset = kirby_get_srcset($file);
    }
    // sizes builder
    if ($file && empty($sizes)) {
        $classes = !empty($tag->attr('imgclass')) ? explode(' ', $tag->attr('imgclass')) : '';
        $sizes = kirby_get_sizes($file, $tag->attr('width'), $classes);
    }
    // allows src attribute to be overwritten
    $defaultsource = kirby()->option('responsiveimages.defaultsource');
    if (isset($sources[$defaultsource])) {
        $url = thumb($file, $sources[$defaultsource])->url();
    }
    // image builder
    $_image = function ($class) use($tag, $url, $alt, $title, $srcset, $sizes) {
        return html::img($url, array('width' => $tag->attr('width'), 'height' => $tag->attr('height'), 'class' => $class, 'title' => $title, 'alt' => $alt, 'srcset' => $srcset, 'sizes' => $sizes));
    };
    if (kirby()->option('kirbytext.image.figure') or !empty($caption)) {
        $image = $_link($_image($tag->attr('imgclass')));
        $figure = new Brick('figure');
        $figure->addClass($tag->attr('class'));
        $figure->append($image);
        if (!empty($caption)) {
            $figure->append('<figcaption>' . html($caption) . '</figcaption>');
        }
        return $figure;
    } else {
        $class = trim($tag->attr('class') . ' ' . $tag->attr('imgclass'));
        return $_link($_image($class));
    }
}));
Beispiel #9
0
<div class="box box-primary box-solid">
    <div class="box-header">
        <h3 class="box-title"><i class="fa fa-home"></i> <?php 
echo Html::encode($this->title);
?>
</h3>  
    </div>
    <div class="box-body">

    

    <p>
        <?php 
echo Html::a('แก้ไข', ['update', 'id' => $model->id], ['class' => 'btn btn-success']);
?>
        <?php 
echo Html::a('ลบ', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
?>
    </p>
    <div class="text-center">
        <?php 
echo html::img('uploads/room/' . $model->photo, ['class' => 'circle']);
?>

    </div>
    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['name', 'description:ntext', 'photo', ['attribute' => 'color', 'format' => 'html', 'value' => '<span style="color:' . $model->color . ';">' . $model->color . '</span>']]]);
?>

    </div>
</div>
 /**
  * Callback function for parsing an xml command tag
  * and turn it into real html content
  *
  * @param  array Matches array of preg_replace_callback
  * @return string Tag/Object content
  */
 protected function xml_command($matches)
 {
     $command = strtolower($matches[1]);
     $attrib = html::parse_attrib_string($matches[2]);
     // empty output if required condition is not met
     if (!empty($attrib['condition']) && !$this->check_condition($attrib['condition'])) {
         return '';
     }
     // execute command
     switch ($command) {
         // return a button
         case 'button':
             if ($attrib['name'] || $attrib['command']) {
                 return $this->button($attrib);
             }
             break;
             // frame
         // frame
         case 'frame':
             return $this->frame($attrib);
             break;
             // show a label
         // show a label
         case 'label':
             if ($attrib['expression']) {
                 $attrib['name'] = $this->eval_expression($attrib['expression']);
             }
             if ($attrib['name'] || $attrib['command']) {
                 // @FIXME: 'noshow' is useless, remove?
                 if ($attrib['noshow']) {
                     return '';
                 }
                 $vars = $attrib + array('product' => $this->config->get('product_name'));
                 unset($vars['name'], $vars['command']);
                 $label = $this->app->gettext($attrib + array('vars' => $vars));
                 $quoting = !empty($attrib['quoting']) ? strtolower($attrib['quoting']) : (rcube_utils::get_boolean((string) $attrib['html']) ? 'no' : '');
                 switch ($quoting) {
                     case 'no':
                     case 'raw':
                         break;
                     case 'javascript':
                     case 'js':
                         $label = rcube::JQ($label);
                         break;
                     default:
                         $label = html::quote($label);
                         break;
                 }
                 return $label;
             }
             break;
             // include a file
         // include a file
         case 'include':
             $old_base_path = $this->base_path;
             if (!empty($attrib['skin_path'])) {
                 $attrib['skinpath'] = $attrib['skin_path'];
             }
             if ($path = $this->get_skin_file($attrib['file'], $skin_path, $attrib['skinpath'])) {
                 $this->base_path = preg_replace('!plugins/\\w+/!', '', $skin_path);
                 // set base_path to core skin directory (not plugin's skin)
                 $path = realpath($path);
             }
             if (is_readable($path)) {
                 if ($this->config->get('skin_include_php')) {
                     $incl = $this->include_php($path);
                 } else {
                     $incl = file_get_contents($path);
                 }
                 $incl = $this->parse_conditions($incl);
                 $incl = $this->parse_xml($incl);
                 $incl = $this->fix_paths($incl);
                 $this->base_path = $old_base_path;
                 return $incl;
             }
             break;
         case 'plugin.include':
             $hook = $this->app->plugins->exec_hook("template_plugin_include", $attrib);
             return $hook['content'];
             // define a container block
         // define a container block
         case 'container':
             if ($attrib['name'] && $attrib['id']) {
                 $this->command('gui_container', $attrib['name'], $attrib['id']);
                 // let plugins insert some content here
                 $hook = $this->app->plugins->exec_hook("template_container", $attrib);
                 return $hook['content'];
             }
             break;
             // return code for a specific application object
         // return code for a specific application object
         case 'object':
             $object = strtolower($attrib['name']);
             $content = '';
             // we are calling a class/method
             if (($handler = $this->object_handlers[$object]) && is_array($handler)) {
                 if (is_object($handler[0]) && method_exists($handler[0], $handler[1]) || is_string($handler[0]) && class_exists($handler[0])) {
                     $content = call_user_func($handler, $attrib);
                 }
             } else {
                 if (function_exists($handler)) {
                     $content = call_user_func($handler, $attrib);
                 } else {
                     if ($object == 'doctype') {
                         $content = html::doctype($attrib['value']);
                     } else {
                         if ($object == 'logo') {
                             $attrib += array('alt' => $this->xml_command(array('', 'object', 'name="productname"')));
                             if ($logo = $this->config->get('skin_logo')) {
                                 if (is_array($logo)) {
                                     if ($template_logo = $logo[$this->template_name]) {
                                         $attrib['src'] = $template_logo;
                                     } elseif ($template_logo = $logo['*']) {
                                         $attrib['src'] = $template_logo;
                                     }
                                 } else {
                                     $attrib['src'] = $logo;
                                 }
                             }
                             $content = html::img($attrib);
                         } else {
                             if ($object == 'productname') {
                                 $name = $this->config->get('product_name', 'Roundcube Webmail');
                                 $content = html::quote($name);
                             } else {
                                 if ($object == 'version') {
                                     $ver = (string) RCMAIL_VERSION;
                                     if (is_file(RCUBE_INSTALL_PATH . '.svn/entries')) {
                                         if (preg_match('/Revision:\\s(\\d+)/', @shell_exec('svn info'), $regs)) {
                                             $ver .= ' [SVN r' . $regs[1] . ']';
                                         }
                                     } else {
                                         if (is_file(RCUBE_INSTALL_PATH . '.git/index')) {
                                             if (preg_match('/Date:\\s+([^\\n]+)/', @shell_exec('git log -1'), $regs)) {
                                                 if ($date = date('Ymd.Hi', strtotime($regs[1]))) {
                                                     $ver .= ' [GIT ' . $date . ']';
                                                 }
                                             }
                                         }
                                     }
                                     $content = html::quote($ver);
                                 } else {
                                     if ($object == 'steptitle') {
                                         $content = html::quote($this->get_pagetitle());
                                     } else {
                                         if ($object == 'pagetitle') {
                                             if ($this->devel_mode && !empty($_SESSION['username'])) {
                                                 $title = $_SESSION['username'] . ' :: ';
                                             } else {
                                                 if ($prod_name = $this->config->get('product_name')) {
                                                     $title = $prod_name . ' :: ';
                                                 } else {
                                                     $title = '';
                                                 }
                                             }
                                             $title .= $this->get_pagetitle();
                                             $content = html::quote($title);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             // exec plugin hooks for this template object
             $hook = $this->app->plugins->exec_hook("template_object_{$object}", $attrib + array('content' => $content));
             return $hook['content'];
             // return code for a specified eval expression
         // return code for a specified eval expression
         case 'exp':
             return html::quote($this->eval_expression($attrib['expression']));
             // return variable
         // return variable
         case 'var':
             $var = explode(':', $attrib['name']);
             $name = $var[1];
             $value = '';
             switch ($var[0]) {
                 case 'env':
                     $value = $this->env[$name];
                     break;
                 case 'config':
                     $value = $this->config->get($name);
                     if (is_array($value) && $value[$_SESSION['storage_host']]) {
                         $value = $value[$_SESSION['storage_host']];
                     }
                     break;
                 case 'request':
                     $value = rcube_utils::get_input_value($name, rcube_utils::INPUT_GPC);
                     break;
                 case 'session':
                     $value = $_SESSION[$name];
                     break;
                 case 'cookie':
                     $value = htmlspecialchars($_COOKIE[$name]);
                     break;
                 case 'browser':
                     $value = $this->browser->{$name};
                     break;
             }
             if (is_array($value)) {
                 $value = implode(', ', $value);
             }
             return html::quote($value);
         case 'form':
             return $this->form_tag($attrib);
     }
     return '';
 }
Beispiel #11
0
 public function testImg()
 {
     $expected = '<img src="myimage.jpg" alt="myimage" width="100" height="200">';
     $this->assertEquals($expected, html::img('myimage.jpg', array('width' => 100, 'height' => 200)));
 }
Beispiel #12
0
<?php

foreach ($this->results as $result) {
    if (isset($result->Medium->uri)) {
        echo "<div>";
        echo html::img($result->Medium->uri) . "<br />";
        echo "<div>";
    }
}
 /**
  * Handler for attachment uploads
  */
 public function attachment_upload($session_key, $id_prefix = '')
 {
     // Upload progress update
     if (!empty($_GET['_progress'])) {
         $this->rc->upload_progress();
     }
     $recid = $id_prefix . rcube_utils::get_input_value('_id', rcube_utils::INPUT_GPC);
     $uploadid = rcube_utils::get_input_value('_uploadid', rcube_utils::INPUT_GPC);
     if (!is_array($_SESSION[$session_key]) || $_SESSION[$session_key]['id'] != $recid) {
         $_SESSION[$session_key] = array();
         $_SESSION[$session_key]['id'] = $recid;
         $_SESSION[$session_key]['attachments'] = array();
     }
     // clear all stored output properties (like scripts and env vars)
     $this->rc->output->reset();
     if (is_array($_FILES['_attachments']['tmp_name'])) {
         foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath) {
             // Process uploaded attachment if there is no error
             $err = $_FILES['_attachments']['error'][$i];
             if (!$err) {
                 $attachment = array('path' => $filepath, 'size' => $_FILES['_attachments']['size'][$i], 'name' => $_FILES['_attachments']['name'][$i], 'mimetype' => rcube_mime::file_content_type($filepath, $_FILES['_attachments']['name'][$i], $_FILES['_attachments']['type'][$i]), 'group' => $recid);
                 $attachment = $this->rc->plugins->exec_hook('attachment_upload', $attachment);
             }
             if (!$err && $attachment['status'] && !$attachment['abort']) {
                 $id = $attachment['id'];
                 // store new attachment in session
                 unset($attachment['status'], $attachment['abort']);
                 $_SESSION[$session_key]['attachments'][$id] = $attachment;
                 if (($icon = $_SESSION[$session_key . '_deleteicon']) && is_file($icon)) {
                     $button = html::img(array('src' => $icon, 'alt' => $this->rc->gettext('delete')));
                 } else {
                     $button = rcube::Q($this->rc->gettext('delete'));
                 }
                 $content = html::a(array('href' => "#delete", 'class' => 'delete', 'onclick' => sprintf("return %s.remove_from_attachment_list('rcmfile%s')", rcmail_output::JS_OBJECT_NAME, $id), 'title' => $this->rc->gettext('delete'), 'aria-label' => $this->rc->gettext('delete') . ' ' . $attachment['name']), $button);
                 $content .= rcube::Q($attachment['name']);
                 $this->rc->output->command('add2attachment_list', "rcmfile{$id}", array('html' => $content, 'name' => $attachment['name'], 'mimetype' => $attachment['mimetype'], 'classname' => rcube_utils::file2class($attachment['mimetype'], $attachment['name']), 'complete' => true), $uploadid);
             } else {
                 // upload failed
                 if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) {
                     $msg = $this->rc->gettext(array('name' => 'filesizeerror', 'vars' => array('size' => $this->rc->show_bytes(parse_bytes(ini_get('upload_max_filesize'))))));
                 } else {
                     if ($attachment['error']) {
                         $msg = $attachment['error'];
                     } else {
                         $msg = $this->rc->gettext('fileuploaderror');
                     }
                 }
                 $this->rc->output->command('display_message', $msg, 'error');
                 $this->rc->output->command('remove_from_attachment_list', $uploadid);
             }
         }
     } else {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             // if filesize exceeds post_max_size then $_FILES array is empty,
             // show filesizeerror instead of fileuploaderror
             if ($maxsize = ini_get('post_max_size')) {
                 $msg = $this->rc->gettext(array('name' => 'filesizeerror', 'vars' => array('size' => $this->rc->show_bytes(parse_bytes($maxsize)))));
             } else {
                 $msg = $this->rc->gettext('fileuploaderror');
             }
             $this->rc->output->command('display_message', $msg, 'error');
             $this->rc->output->command('remove_from_attachment_list', $uploadid);
         }
     }
     $this->rc->output->send('iframe');
 }
Beispiel #14
0
 if ($text = $tag->attr('text')) {
     $alt = $text;
 }
 // try to get the title from the image object and use it as alt text
 if ($file) {
     if (empty($alt) and $file->alt() != '') {
         $alt = $file->alt();
     }
     if (empty($title) and $file->title() != '') {
         $title = $file->title();
     }
 }
 if (empty($alt)) {
     $alt = pathinfo($url, PATHINFO_FILENAME);
 }
 $image = html::img($url, array('width' => $tag->attr('width'), 'height' => $tag->attr('height'), 'class' => $tag->attr('imgclass'), 'title' => html($title), 'alt' => html($alt)));
 if ($tag->attr('link')) {
     // build the href for the link
     if ($link == 'self') {
         $href = $url;
     } else {
         if ($file and $link == $file->filename()) {
             $href = $file->url();
         } else {
             $href = $link;
         }
     }
     $image = html::a(url($href), $image, array('rel' => $tag->attr('rel'), 'class' => $tag->attr('linkclass'), 'title' => html($tag->attr('title')), 'target' => $tag->target()));
 }
 $figure = new Brick('figure');
 $figure->addClass($tag->attr('class'));
Beispiel #15
0
        }
        // build the href for the link
        if ($link == 'self') {
            $href = $url;
        } else {
            if ($file and $link == $file->filename()) {
                $href = $file->url();
            } else {
                $href = $link;
            }
        }
        return html::a(url($href), $image, array('rel' => $tag->attr('rel'), 'class' => $tag->attr('linkclass'), 'title' => $tag->attr('title'), 'target' => $tag->target()));
    };
    // image builder
    $_image = function ($class) use($tag, $url, $alt, $title) {
        return html::img($url, array('width' => $tag->attr('width'), 'height' => $tag->attr('height'), 'class' => $class, 'title' => $title, 'alt' => $alt));
    };
    if (kirby()->option('kirbytext.image.figure') or !empty($caption)) {
        $image = $_link($_image($tag->attr('imgclass')));
        $figure = new Brick('figure');
        $figure->addClass($tag->attr('class'));
        $figure->append($image);
        if (!empty($caption)) {
            $figure->append('<figcaption>' . html($caption) . '</figcaption>');
        }
        return $figure;
    } else {
        $class = trim($tag->attr('class') . ' ' . $tag->attr('imgclass'));
        return $_link($_image($class));
    }
});
Beispiel #16
0
 /**
  * Handler for template_object_messagebody hook.
  * This callback function adds a box below the message content
  * if there is a key/cert attachment available
  */
 function message_output($p)
 {
     $attach_script = false;
     foreach ($this->keys_parts as $part) {
         // remove part's body
         if (in_array($part, $this->keys_bodies)) {
             $p['content'] = '';
         }
         $style = "margin:0 1em; padding:0.2em 0.5em; border:1px solid #999; width: auto" . " border-radius:4px; -moz-border-radius:4px; -webkit-border-radius:4px";
         // add box below message body
         $p['content'] .= html::p(array('style' => $style), html::a(array('href' => "#", 'onclick' => "return " . rcmail_output::JS_OBJECT_NAME . ".enigma_import_attachment('" . rcube::JQ($part) . "')", 'title' => $this->gettext('keyattimport')), html::img(array('src' => $this->url('skins/classic/key_add.png'), 'style' => "vertical-align:middle"))) . ' ' . html::span(null, $this->gettext('keyattfound')));
         $attach_script = true;
     }
     if ($attach_script) {
         $this->include_script('enigma.js');
     }
     return $p;
 }
 private function _rule_row($rule_table, $name, $wb, $active, $id, $attrib)
 {
     $rule_table->add(array('class' => 'rule', 'onclick' => 'wb_edit(' . $id . ',"' . $wb . '");'), $name);
     $white_button = html::img(array('src' => $attrib['whiteicon'], 'alt' => "W", 'border' => 0));
     $black_button = html::img(array('src' => $attrib['blackicon'], 'alt' => "B", 'border' => 0));
     if ($wb == "W") {
         $rule_table->add(array('class' => 'control'), $white_button);
     } else {
         $rule_table->add(array('class' => 'control'), $black_button);
     }
     $enable_button = html::img(array('src' => $attrib['enableicon'], 'alt' => $this->gettext('enabled'), 'border' => 0));
     $disable_button = html::img(array('src' => $attrib['disableicon'], 'alt' => $this->gettext('disabled'), 'border' => 0));
     if ($active == 'y') {
         $status_button = $enable_button;
     } else {
         $status_button = $disable_button;
     }
     $rule_table->add(array('class' => 'control'), '&nbsp;' . $status_button);
     $del_button = $this->api->output->button(array('command' => 'plugin.ispconfig3_wblist.del', 'prop' => $id . '\',\'' . $wb, 'type' => 'image', 'image' => $attrib['deleteicon'], 'alt' => $this->gettext('delete'), 'title' => $this->gettext('delete')));
     $rule_table->add(array('class' => 'control'), $del_button);
     return $rule_table;
 }
 private function _prefs_block($part, $attrib)
 {
     $rcmail = rcube::get_instance();
     $no_override = array_flip($rcmail->config->get('sauserprefs_dont_override'));
     $locale_info = localeconv();
     switch ($part) {
         // General tests
         case 'general':
             $out = '';
             $data = '';
             $table = new html_table(array('class' => 'generalprefstable', 'cols' => 2));
             if (!isset($no_override['required_hits'])) {
                 $field_id = 'rcmfd_spamthres';
                 $input_spamthres = new html_select(array('name' => '_spamthres', 'id' => $field_id));
                 $input_spamthres->add($this->gettext('defaultscore'), '');
                 $decPlaces = 0;
                 if ($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc') > 0) {
                     $decPlaces = strlen($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc')) - 2;
                 }
                 $score_found = false;
                 for ($i = 1; $i <= 10; $i = $i + $rcmail->config->get('sauserprefs_score_inc')) {
                     $input_spamthres->add(number_format($i, $decPlaces, $locale_info['decimal_point'], ''), number_format($i, $decPlaces, '.', ''));
                     if (!$score_found && $this->user_prefs['required_hits'] && (double) $this->user_prefs['required_hits'] == (double) $i) {
                         $score_found = true;
                     }
                 }
                 if (!$score_found && $this->user_prefs['required_hits']) {
                     $input_spamthres->add(str_replace('%s', $this->user_prefs['required_hits'], $this->gettext('otherscore')), (double) $this->user_prefs['required_hits']);
                 }
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('spamthres'))));
                 $table->add(null, $input_spamthres->show(number_format($this->user_prefs['required_hits'], $decPlaces, '.', '')));
                 $table->add(array('colspan' => 2), rcmail::Q($this->gettext('spamthresexp')));
             }
             if (!isset($no_override['rewrite_header Subject'])) {
                 $field_id = 'rcmfd_spamsubject';
                 $input_spamsubject = new html_inputfield(array('name' => '_spamsubject', 'id' => $field_id, 'value' => $this->user_prefs['rewrite_header Subject'], 'style' => 'width:200px;'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('spamsubject'))));
                 $table->add(null, $input_spamsubject->show());
                 $table->add('title', "&nbsp;");
                 $table->add(null, rcmail::Q($this->gettext('spamsubjectblank')));
             }
             if ($table->size() > 0) {
                 $out .= html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $table->show());
             }
             if (!isset($no_override['ok_languages']) || !isset($no_override['ok_locales'])) {
                 $data = html::p(null, rcmail::Q($this->gettext('spamlangexp')));
                 $table = new html_table(array('class' => 'langprefstable', 'cols' => 1));
                 $select_all = $this->api->output->button(array('command' => 'plugin.sauserprefs.select_all_langs', 'type' => 'link', 'label' => 'all'));
                 $select_none = $this->api->output->button(array('command' => 'plugin.sauserprefs.select_no_langs', 'type' => 'link', 'label' => 'none'));
                 $select_invert = $this->api->output->button(array('command' => 'plugin.sauserprefs.select_invert_langs', 'type' => 'link', 'label' => 'invert'));
                 $table->add(array('id' => 'listcontrols'), $this->gettext('select') . ":&nbsp;&nbsp;" . $select_all . "&nbsp;&nbsp;" . $select_invert . "&nbsp;&nbsp;" . $select_none);
                 $lang_table = new html_table(array('id' => 'spam-langs-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 2));
                 $lang_table->add_header(array('colspan' => 2), $this->gettext('language'));
                 if (!isset($no_override['ok_locales'])) {
                     if ($this->user_prefs['ok_locales'] == "all") {
                         $ok_locales = $this->sa_locales;
                     } else {
                         $ok_locales = explode(" ", $this->user_prefs['ok_locales']);
                     }
                 } else {
                     $ok_locales = array();
                 }
                 if (!isset($no_override['ok_languages'])) {
                     if ($this->user_prefs['ok_languages'] == "all") {
                         $ok_languages = array_keys($rcmail->config->get('sauserprefs_languages'));
                     } else {
                         $ok_languages = explode(" ", $this->user_prefs['ok_languages']);
                     }
                 } else {
                     $tmp_array = $rcmail->config->get('sauserprefs_languages');
                     $rcmail->config->set('sauserprefs_languages', array_intersect_key($tmp_array, array_flip($this->sa_locales)));
                     $ok_languages = array();
                 }
                 $i = 0;
                 $locales_langs = array_merge($ok_locales, $ok_languages);
                 foreach ($rcmail->config->get('sauserprefs_languages') as $lang_code => $name) {
                     if (in_array($lang_code, $locales_langs)) {
                         $button = $this->api->output->button(array('command' => 'plugin.sauserprefs.message_lang', 'prop' => $lang_code, 'type' => 'link', 'class' => 'enabled', 'id' => 'spam_lang_' . $i, 'title' => 'sauserprefs.enabled', 'content' => ' '));
                     } else {
                         $button = $this->api->output->button(array('command' => 'plugin.sauserprefs.message_lang', 'prop' => $lang_code, 'type' => 'link', 'class' => 'disabled', 'id' => 'spam_lang_' . $i, 'title' => 'sauserprefs.disabled', 'content' => ' '));
                     }
                     $input_spamlang = new html_checkbox(array('style' => 'display: none;', 'name' => '_spamlang[]', 'value' => $lang_code));
                     $lang_table->add('lang', $name);
                     $lang_table->add('tick', $button . $input_spamlang->show(in_array($lang_code, $locales_langs) ? $lang_code : ''));
                     $i++;
                 }
                 $table->add('scroller', html::div(array('id' => 'spam-langs-cont'), $lang_table->show()));
                 $out .= html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('langoptions'))) . $data . $table->show());
             }
             break;
             // Header settings
         // Header settings
         case 'headers':
             $data = html::p(null, rcmail::Q($this->gettext('headersexp')));
             $table = new html_table(array('class' => 'headersprefstable', 'cols' => 3));
             if (!isset($no_override['fold_headers'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("fold_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamfoldheaders';
                 $input_spamreport = new html_checkbox(array('name' => '_spamfoldheaders', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('foldheaders'))));
                 $table->add(null, $input_spamreport->show($this->user_prefs['fold_headers']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'fold_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('foldhelp')));
             }
             if (!isset($no_override['add_header all Level'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("level_help");', 'title' => $this->gettext('help')), $help_button);
                 if ($this->user_prefs['remove_header all'] != 'Level') {
                     $enabled = "1";
                     $char = $this->user_prefs['add_header all Level'];
                     $char = substr($char, 7, 1);
                 } else {
                     $enabled = "0";
                     $char = "*";
                 }
                 $field_id = 'rcmfd_spamlevelstars';
                 $input_spamreport = new html_checkbox(array('name' => '_spamlevelstars', 'id' => $field_id, 'value' => '1', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.sauserprefs_toggle_level_char(this)'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('spamlevelstars'))));
                 $table->add(null, $input_spamreport->show($enabled));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'level_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('levelhelp')));
                 $field_id = 'rcmfd_spamlevelchar';
                 $input_spamsubject = new html_inputfield(array('name' => '_spamlevelchar', 'id' => $field_id, 'value' => $char, 'style' => 'width:20px;', 'disabled' => $enabled ? 0 : 1));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('spamlevelchar'))));
                 $table->add(null, $input_spamsubject->show());
                 $table->add('help', '&nbsp;');
             }
             $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $data . $table->show());
             break;
             // Test settings
         // Test settings
         case 'tests':
             $data = html::p(null, rcmail::Q($this->gettext('spamtestssexp')));
             $table = new html_table(array('class' => 'testsprefstable', 'cols' => 3));
             if (!isset($no_override['use_razor1'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("raz1_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamuserazor1';
                 $input_spamtest = new html_checkbox(array('name' => '_spamuserazor1', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('userazor1'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_razor1']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'raz1_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('raz1help')));
             }
             if (!isset($no_override['use_razor2'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("raz2_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamuserazor2';
                 $input_spamtest = new html_checkbox(array('name' => '_spamuserazor2', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('userazor2'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_razor2']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'raz2_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('raz2help')));
             }
             if (!isset($no_override['use_pyzor'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("pyz_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamusepyzor';
                 $input_spamtest = new html_checkbox(array('name' => '_spamusepyzor', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('usepyzor'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_pyzor']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'pyz_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('pyzhelp')));
             }
             if (!isset($no_override['use_dcc'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("dcc_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamusedcc';
                 $input_spamtest = new html_checkbox(array('name' => '_spamusedcc', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('usedcc'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_dcc']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'dcc_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('dcchelp')));
             }
             if (!isset($no_override['skip_rbl_checks'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("rbl_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamskiprblchecks';
                 $enabled = $this->user_prefs['skip_rbl_checks'] == "1" ? "0" : "1";
                 $input_spamtest = new html_checkbox(array('name' => '_spamskiprblchecks', 'id' => $field_id, 'value' => '1'));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('skiprblchecks'))));
                 $table->add(null, $input_spamtest->show($enabled));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'rbl_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('rblhelp')));
             }
             $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $data . $table->show());
             break;
             // Bayes settings
         // Bayes settings
         case 'bayes':
             $data = html::p(null, rcmail::Q($this->gettext('bayeshelp')));
             $table = new html_table(array('class' => 'bayesprefstable', 'cols' => 3));
             if (!isset($no_override['use_bayes'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("bayes_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spamusebayes';
                 $input_spamtest = new html_checkbox(array('name' => '_spamusebayes', 'id' => $field_id, 'value' => '1', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.sauserprefs_toggle_bayes(this)'));
                 if ($rcmail->config->get('sauserprefs_bayes_delete', false)) {
                     $delete_link = "&nbsp;&nbsp;&nbsp;" . html::span(array('id' => 'listcontrols'), $this->api->output->button(array('command' => 'plugin.sauserprefs.purge_bayes', 'type' => 'link', 'label' => 'sauserprefs.purgebayes', 'title' => 'sauserprefs.purgebayesexp')));
                 }
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('usebayes'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_bayes']) . $delete_link);
                 $table->add('help', '&nbsp;');
                 $table->set_row_attribs(array('id' => 'bayes_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('bayeshelp')));
             }
             if (!isset($no_override['use_bayes_rules'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("bayesrules_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spambayesrules';
                 $input_spamtest = new html_checkbox(array('name' => '_spambayesrules', 'id' => $field_id, 'value' => '1', 'disabled' => $this->user_prefs['use_bayes'] ? 0 : 1));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('bayesrules'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['use_bayes_rules']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'bayesrules_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('bayesruleshlp')));
             }
             if (!isset($no_override['bayes_auto_learn'])) {
                 $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;'));
                 $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("bayesauto_help");', 'title' => $this->gettext('help')), $help_button);
                 $field_id = 'rcmfd_spambayesautolearn';
                 $input_spamtest = new html_checkbox(array('name' => '_spambayesautolearn', 'id' => $field_id, 'value' => '1', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.sauserprefs_toggle_bayes_auto(this)', 'disabled' => $this->user_prefs['use_bayes'] ? 0 : 1));
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('bayesautolearn'))));
                 $table->add(null, $input_spamtest->show($this->user_prefs['bayes_auto_learn']));
                 $table->add('help', $help_button);
                 $table->set_row_attribs(array('id' => 'bayesauto_help', 'style' => 'display: none;'));
                 $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('bayesautohelp')));
             }
             if ($table->size() > 0) {
                 $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $table->show());
             }
             $table = new html_table(array('class' => 'bayesprefstable', 'cols' => 2));
             $data = "";
             if (!isset($no_override['bayes_auto_learn_threshold_nonspam'])) {
                 $field_id = 'rcmfd_bayesnonspam';
                 $input_bayesnthres = new html_select(array('name' => '_bayesnonspam', 'id' => $field_id, 'disabled' => !$this->user_prefs['bayes_auto_learn'] || !$this->user_prefs['use_bayes'] ? 1 : 0));
                 $input_bayesnthres->add($this->gettext('defaultscore'), '');
                 $decPlaces = 1;
                 //if ($rcmail->config->get('sauserprefs_score_inc') - (int)$rcmail->config->get('sauserprefs_score_inc') > 0)
                 //	$decPlaces = strlen($rcmail->config->get('sauserprefs_score_inc') - (int)$rcmail->config->get('sauserprefs_score_inc')) - 2;
                 $score_found = false;
                 for ($i = -1; $i <= 1; $i = $i + 0.1) {
                     $input_bayesnthres->add(number_format($i, $decPlaces, $locale_info['decimal_point'], ''), number_format($i, $decPlaces, '.', ''));
                     if (!$score_found && $this->user_prefs['bayes_auto_learn_threshold_nonspam'] && (double) $this->user_prefs['bayes_auto_learn_threshold_nonspam'] == (double) $i) {
                         $score_found = true;
                     }
                 }
                 if (!$score_found && $this->user_prefs['bayes_auto_learn_threshold_nonspam']) {
                     $input_bayesnthres->add(str_replace('%s', $this->user_prefs['bayes_auto_learn_threshold_nonspam'], $this->gettext('otherscore')), (double) $this->user_prefs['bayes_auto_learn_threshold_nonspam']);
                 }
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('bayesnonspam'))));
                 $table->add(null, $input_bayesnthres->show(number_format($this->user_prefs['bayes_auto_learn_threshold_nonspam'], $decPlaces, '.', '')));
                 $table->add(array('colspan' => '2'), rcmail::Q($this->gettext('bayesnonspamexp')));
             }
             if (!isset($no_override['bayes_auto_learn_threshold_spam'])) {
                 $field_id = 'rcmfd_bayesspam';
                 $input_bayesthres = new html_select(array('name' => '_bayesspam', 'id' => $field_id, 'disabled' => !$this->user_prefs['bayes_auto_learn'] || !$this->user_prefs['use_bayes'] ? 1 : 0));
                 $input_bayesthres->add($this->gettext('defaultscore'), '');
                 $decPlaces = 0;
                 if ($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc') > 0) {
                     $decPlaces = strlen($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc')) - 2;
                 }
                 $score_found = false;
                 for ($i = 1; $i <= 20; $i = $i + $rcmail->config->get('sauserprefs_score_inc')) {
                     $input_bayesthres->add(number_format($i, $decPlaces, $locale_info['decimal_point'], ''), number_format($i, $decPlaces, '.', ''));
                     if (!$score_found && $this->user_prefs['bayes_auto_learn_threshold_spam'] && (double) $this->user_prefs['bayes_auto_learn_threshold_spam'] == (double) $i) {
                         $score_found = true;
                     }
                 }
                 if (!$score_found && $this->user_prefs['required_hits']) {
                     $input_bayesthres->add(str_replace('%s', $this->user_prefs['bayes_auto_learn_threshold_spam'], $this->gettext('otherscore')), (double) $this->user_prefs['bayes_auto_learn_threshold_spam']);
                 }
                 $table->add('title', html::label($field_id, rcmail::Q($this->gettext('bayesspam'))));
                 $table->add(null, $input_bayesthres->show(number_format($this->user_prefs['bayes_auto_learn_threshold_spam'], $decPlaces, '.', '')));
                 $table->add(array('colspan' => '2'), rcmail::Q($this->gettext('bayesspamexp')));
             }
             if ($table->size() > 0) {
                 $out .= html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('bayesautooptions'))) . $table->show());
             }
             break;
             // Report settings
         // Report settings
         case 'report':
             $data = html::p(null, rcmail::Q($this->gettext('spamreport')));
             $table = new html_table(array('class' => 'reportprefstable', 'cols' => 2));
             if (!isset($no_override['report_safe'])) {
                 $field_id = 'rcmfd_spamreport';
                 $input_spamreport0 = new html_radiobutton(array('name' => '_spamreport', 'id' => $field_id . '_0', 'value' => '0'));
                 $table->add('title', html::label($field_id . '_0', rcmail::Q($this->gettext('spamreport0'))));
                 $table->add(null, $input_spamreport0->show($this->user_prefs['report_safe']));
                 $input_spamreport1 = new html_radiobutton(array('name' => '_spamreport', 'id' => $field_id . '_1', 'value' => '1'));
                 $table->add('title', html::label($field_id . '_1', rcmail::Q($this->gettext('spamreport1'))));
                 $table->add(null, $input_spamreport1->show($this->user_prefs['report_safe']));
                 $data .= $input_spamreport1->show($this->user_prefs['report_safe']) . "&nbsp;" . html::label($field_id . '_1', rcmail::Q($this->gettext('spamreport1'))) . "<br />";
                 $input_spamreport2 = new html_radiobutton(array('name' => '_spamreport', 'id' => $field_id . '_2', 'value' => '2'));
                 $table->add('title', html::label($field_id . '_2', rcmail::Q($this->gettext('spamreport2'))));
                 $table->add(null, $input_spamreport2->show($this->user_prefs['report_safe']));
             }
             $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $table->show());
             break;
             // Address settings
         // Address settings
         case 'addresses':
             $data = html::p(null, rcmail::Q($this->gettext('whitelistexp')));
             if ($rcmail->config->get('sauserprefs_whitelist_sync')) {
                 $data .= rcmail::Q($this->gettext('autowhitelist')) . "<br /><br />";
             }
             $table = new html_table(array('class' => 'addressprefstable', 'cols' => 4));
             $field_id = 'rcmfd_spamaddressrule';
             $input_spamaddressrule = new html_select(array('name' => '_spamaddressrule', 'id' => $field_id));
             $input_spamaddressrule->add($this->gettext('whitelist_from'), 'whitelist_from');
             $input_spamaddressrule->add($this->gettext('blacklist_from'), 'blacklist_from');
             $input_spamaddressrule->add($this->gettext('whitelist_to'), 'whitelist_to');
             $field_id = 'rcmfd_spamaddress';
             $input_spamaddress = new html_inputfield(array('name' => '_spamaddress', 'id' => $field_id, 'style' => 'width:200px;'));
             $field_id = 'rcmbtn_add_address';
             $button_addaddress = $this->api->output->button(array('command' => 'plugin.sauserprefs.addressrule_add', 'type' => 'input', 'class' => 'button', 'label' => 'sauserprefs.addrule'));
             $table->add('ruletype', $input_spamaddressrule->show());
             $table->add('address', $input_spamaddress->show());
             $table->add('action', $button_addaddress);
             $table->add(null, "&nbsp;");
             $import = $this->api->output->button(array('command' => 'plugin.sauserprefs.import_whitelist', 'type' => 'link', 'label' => 'import', 'title' => 'sauserprefs.importfromaddressbook'));
             $delete_all = $this->api->output->button(array('command' => 'plugin.sauserprefs.whitelist_delete_all', 'type' => 'link', 'label' => 'sauserprefs.deleteall'));
             $table->add(array('colspan' => 4, 'id' => 'listcontrols'), $import . "&nbsp;&nbsp;" . $delete_all);
             $address_table = new html_table(array('id' => 'address-rules-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 3));
             $address_table->add_header('rule', $this->gettext('rule'));
             $address_table->add_header('email', $this->gettext('email'));
             $address_table->add_header('control', '&nbsp;');
             $this->_address_row($address_table, null, null, $attrib);
             if (sizeof($this->user_prefs['addresses']) > 0) {
                 $norules = 'display: none;';
             }
             $address_table->set_row_attribs(array('style' => $norules));
             $address_table->add(array('colspan' => '3'), rcube_utils::rep_specialchars_output($this->gettext('noaddressrules')));
             $this->api->output->set_env('address_rule_count', sizeof($this->user_prefs['addresses']));
             foreach ($this->user_prefs['addresses'] as $address) {
                 $this->_address_row($address_table, $address['field'], $address['value'], $attrib);
             }
             $table->add(array('colspan' => 4, 'class' => 'scroller'), html::div(array('id' => 'address-rules-cont'), $address_table->show()));
             if ($table->size()) {
                 $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $data . $table->show());
             }
             break;
         default:
             $out = '';
     }
     return $out;
 }
Beispiel #19
0
		</ul>
	</fieldset>

	<fieldset>
		<legend><?php 
echo __('Detailed information');
?>
</legend>
		<ul>

			<?php 
echo form::upload_wrap('logo', '', '', __('Logo'), $errors);
?>
			<?php 
echo $values['default_image_id'] ? '<li>' . html::img(new Image_Model($values['default_image_id']), 'thumb') . '</li>' : '';
?>

			<?php 
echo form::input_wrap(array('name' => 'description', 'maxlength' => 250), $values, '', __('Short description'), $errors);
?>

			<?php 
echo form::textarea_wrap(array('name' => 'info', 'rows' => 3, 'cols' => 25), $values, '', true, __('Long description'), $errors);
?>

			<?php 
echo form::textarea_wrap(array('name' => 'hours', 'rows' => 3, 'cols' => 25), $values, '', true, __('Opening hours'), $errors);
?>

			<?php 
Beispiel #20
0
 /**
  * Callback function for parsing an xml command tag
  * and turn it into real html content
  *
  * @param  array Matches array of preg_replace_callback
  * @return string Tag/Object content
  */
 private function xml_command($matches)
 {
     $command = strtolower($matches[1]);
     $attrib = parse_attrib_string($matches[2]);
     // empty output if required condition is not met
     if (!empty($attrib['condition']) && !$this->check_condition($attrib['condition'])) {
         return '';
     }
     // execute command
     switch ($command) {
         // return a button
         case 'button':
             if ($attrib['name'] || $attrib['command']) {
                 return $this->button($attrib);
             }
             break;
             // show a label
         // show a label
         case 'label':
             if ($attrib['name'] || $attrib['command']) {
                 $vars = $attrib + array('product' => $this->config['product_name']);
                 unset($vars['name'], $vars['command']);
                 $label = rcube_label($attrib + array('vars' => $vars));
                 return !$attrib['noshow'] ? get_boolean((string) $attrib['html']) ? $label : Q($label) : '';
             }
             break;
             // include a file
         // include a file
         case 'include':
             if (!$this->plugin_skin_path || !is_file($path = realpath($this->plugin_skin_path . $attrib['file']))) {
                 $path = realpath(($attrib['skin_path'] ? $attrib['skin_path'] : $this->config['skin_path']) . $attrib['file']);
             }
             if (is_readable($path)) {
                 if ($this->config['skin_include_php']) {
                     $incl = $this->include_php($path);
                 } else {
                     $incl = file_get_contents($path);
                 }
                 $incl = $this->parse_conditions($incl);
                 return $this->parse_xml($incl);
             }
             break;
         case 'plugin.include':
             $hook = $this->app->plugins->exec_hook("template_plugin_include", $attrib);
             return $hook['content'];
             break;
             // define a container block
         // define a container block
         case 'container':
             if ($attrib['name'] && $attrib['id']) {
                 $this->command('gui_container', $attrib['name'], $attrib['id']);
                 // let plugins insert some content here
                 $hook = $this->app->plugins->exec_hook("template_container", $attrib);
                 return $hook['content'];
             }
             break;
             // return code for a specific application object
         // return code for a specific application object
         case 'object':
             $object = strtolower($attrib['name']);
             $content = '';
             // we are calling a class/method
             if (($handler = $this->object_handlers[$object]) && is_array($handler)) {
                 if (is_object($handler[0]) && method_exists($handler[0], $handler[1]) || is_string($handler[0]) && class_exists($handler[0])) {
                     $content = call_user_func($handler, $attrib);
                 }
             } else {
                 if (function_exists($handler)) {
                     $content = call_user_func($handler, $attrib);
                 } else {
                     if ($object == 'logo') {
                         $attrib += array('alt' => $this->xml_command(array('', 'object', 'name="productname"')));
                         if ($this->config['skin_logo']) {
                             $attrib['src'] = $this->config['skin_logo'];
                         }
                         $content = html::img($attrib);
                     } else {
                         if ($object == 'productname') {
                             $name = !empty($this->config['product_name']) ? $this->config['product_name'] : 'Roundcube Webmail';
                             $content = Q($name);
                         } else {
                             if ($object == 'version') {
                                 $ver = (string) RCMAIL_VERSION;
                                 if (is_file(INSTALL_PATH . '.svn/entries')) {
                                     if (preg_match('/Revision:\\s(\\d+)/', @shell_exec('svn info'), $regs)) {
                                         $ver .= ' [SVN r' . $regs[1] . ']';
                                     }
                                 }
                                 $content = Q($ver);
                             } else {
                                 if ($object == 'steptitle') {
                                     $content = Q($this->get_pagetitle());
                                 } else {
                                     if ($object == 'pagetitle') {
                                         if (!empty($this->config['devel_mode']) && !empty($_SESSION['username'])) {
                                             $title = $_SESSION['username'] . ' :: ';
                                         } else {
                                             if (!empty($this->config['product_name'])) {
                                                 $title = $this->config['product_name'] . ' :: ';
                                             } else {
                                                 $title = '';
                                             }
                                         }
                                         $title .= $this->get_pagetitle();
                                         $content = Q($title);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             // exec plugin hooks for this template object
             $hook = $this->app->plugins->exec_hook("template_object_{$object}", $attrib + array('content' => $content));
             return $hook['content'];
             // return code for a specified eval expression
         // return code for a specified eval expression
         case 'exp':
             $value = $this->parse_expression($attrib['expression']);
             return eval("return Q({$value});");
             // return variable
         // return variable
         case 'var':
             $var = explode(':', $attrib['name']);
             $name = $var[1];
             $value = '';
             switch ($var[0]) {
                 case 'env':
                     $value = $this->env[$name];
                     break;
                 case 'config':
                     $value = $this->config[$name];
                     if (is_array($value) && $value[$_SESSION['imap_host']]) {
                         $value = $value[$_SESSION['imap_host']];
                     }
                     break;
                 case 'request':
                     $value = get_input_value($name, RCUBE_INPUT_GPC);
                     break;
                 case 'session':
                     $value = $_SESSION[$name];
                     break;
                 case 'cookie':
                     $value = htmlspecialchars($_COOKIE[$name]);
                     break;
                 case 'browser':
                     $value = $this->browser->{$name};
                     break;
             }
             if (is_array($value)) {
                 $value = implode(', ', $value);
             }
             return Q($value);
             break;
     }
     return '';
 }
Beispiel #21
0
if (count($venue->images->find_all()) > 1) {
    ?>
		<article class="pictures lightboxed">
			<header>
				<h3><?php 
    echo __('Pictures');
    ?>
</h3>
			</header>

			<?php 
    foreach ($venue->images->find_all() as $image) {
        if ($image->id != $venue->default_image_id) {
            ?>
				<?php 
            echo html::anchor($image->url('normal'), html::img($image, 'thumb', __('Picture')), array('title' => html::chars($venue->name)));
            ?>
			<?php 
        }
    }
    ?>

		</article>
		<?php 
}
?>
	</div>
</section>

<div class="lightbox" id="slideshow">
	<a class="prev" title="<?php 
Beispiel #22
0
 function render_box($p)
 {
     $this->add_texts('localization');
     $rcmail = rcmail::get_instance();
     if (!$attrib['id']) {
         $attrib['id'] = 'bounce-box';
         $attrib['class'] = 'popupmenu';
     }
     $button = new html_inputfield(array('type' => 'button'));
     $submit = new html_inputfield(array('type' => 'submit'));
     $table = new html_table(array('cols' => 2, 'id' => 'form'));
     $table->add('title', html::label('_to', Q(rcube_label('to'))));
     $table->add('editfield', html::tag('textarea', array('spellcheck' => 'false', 'id' => '_to', 'name' => '_to', 'cols' => '50', 'rows' => '2', 'tabindex' => '2', 'class' => 'editfield', 'onclick' => 'select_field(this)')));
     $table->set_row_attribs(array('id' => 'compose-cc'));
     $table->add('title', html::a(array('href' => '#cc', 'onclick' => 'return rcmail_ui.hide_header_form(\'cc\')'), html::img(array('src' => $rcmail->config->get('skin_path') . '/images/icons/minus.gif', 'title' => rcube_label('delete'), 'alt' => rcube_label('delete')))) . '&nbsp;' . html::label('_cc', Q(rcube_label('cc'))));
     $table->add(null, html::tag('textarea', array('spellcheck' => 'false', 'id' => '_cc', 'name' => '_cc', 'cols' => '50', 'rows' => '2', 'value' => '', 'class' => 'editfield', 'onclick' => 'select_field(this)')));
     $table->set_row_attribs(array('id' => 'compose-bcc'));
     $table->add('title', html::a(array('href' => '#bcc', 'onclick' => 'return rcmail_ui.hide_header_form(\'bcc\')'), html::img(array('src' => $rcmail->config->get('skin_path') . '/images/icons/minus.gif', 'title' => rcube_label('delete'), 'alt' => rcube_label('delete')))) . '&nbsp;' . html::label('_bcc', Q(rcube_label('bcc'))));
     $table->add(null, html::tag('textarea', array('spellcheck' => 'false', 'id' => '_bcc', 'cols' => '50', 'name' => '_bcc', 'rows' => '2', 'value' => '', 'class' => 'editfield', 'onclick' => 'select_field(this)')));
     $table->add(null, null);
     $table->add(formlinks, html::a(array('href' => '#cc', 'onclick' => 'return rcmail_ui.show_header_form(\'cc\')', 'id' => 'cc-link'), Q(rcube_label('addcc'))) . '<span class="separator">|</span>' . html::a(array('href' => '#bcc', 'onclick' => 'return rcmail_ui.show_header_form(\'bcc\')', 'id' => 'bcc-link'), Q(rcube_label('addbcc'))));
     $target_url = $_SERVER['REQUEST_URI'];
     $rcmail->output->add_footer(html::div($attrib, $rcmail->output->form_tag(array('name' => 'bounceform', 'method' => 'post', 'action' => './', 'enctype' => 'multipart/form-data'), html::tag('input', array('type' => "hidden", 'name' => '_action', 'value' => 'bounce')) . html::div('bounce-title', Q($this->gettext('bouncemessage'))) . html::div('bounce-body', $table->show() . html::div('buttons', $button->show(rcube_label('close'), array('class' => 'button', 'onclick' => "\$('#{$attrib['id']}').hide()")) . ' ' . $button->show(Q($this->gettext('bounce')), array('class' => 'button mainaction', 'onclick' => JS_OBJECT_NAME . ".command('plugin.bounce.send', this.bounceform)")))))));
     $rcmail->output->add_label('norecipientwarning');
     $rcmail->output->add_gui_object('bouncebox', $attrib['id']);
     $rcmail->output->add_gui_object('bounceform', 'bounceform');
     $this->include_stylesheet('bounce.css');
     $rcmail->output->set_env('autocomplete_min_length', $rcmail->config->get('autocomplete_min_length'));
     $rcmail->output->add_gui_object('messageform', 'bounceform');
 }
Beispiel #23
0
     $thumburl = thumb($image, array('width' => $thumbwidth, 'height' => $thumbheight, 'quality' => $quality, 'crop' => $crop), false);
     // [1] Regular image; resized thumb (thumb.dev.width)
     if ($lazyload == false && c::get('resrc') == false) {
         $imagethumb = html::img($thumburl, array('class' => $class, 'alt' => html($alt)));
     }
     // [2] Lazyload image; resized thumb (thumb.dev.width)
     if ($lazyload == true && c::get('resrc') == false) {
         $imagethumb = html::img('/assets/images/loader.gif', array('data-src' => $thumburl, 'class' => $class, 'alt' => html($alt)));
     }
     // [3] Resrc image; full size thumb (let resrc resize and optimize the biggest possible thumb!)
     if ($lazyload == false && c::get('resrc') == true) {
         $imagethumb = html::img('', array('data-src' => 'http://' . c::get('resrc.plan') . '/' . c::get('resrc.params') . '/' . $thumburl, 'class' => $class . ' resrc', 'alt' => html($alt)));
     }
     // [4] Lazyload + resrc image; full size thumb (let resrc resize and optimize the biggest possible thumb!)
     if ($lazyload == true && c::get('resrc') == true) {
         $imagethumb = html::img('/assets/images/loader.gif', array('data-src' => 'http://' . c::get('resrc.plan') . '/' . c::get('resrc.params') . '/' . $thumburl, 'class' => $class . ' js-resrcIsLazy', 'alt' => html($alt)));
     }
     // Output different markup, depending on lazyload or not
     if ($lazyload == true) {
         $lazydiv->append($imagethumb);
         if (isset($griddiv)) {
             $griddiv->append($lazydiv);
             $figure->append($griddiv);
         } else {
             $figure->append($lazydiv);
         }
     } else {
         $figure->append($imagethumb);
     }
     $i++;
 }
Beispiel #24
0
 /**
  * Generates and returns the full html tag for the thumbnail
  *
  * @param array $attr An optional array of attributes, which should be added to the image tag
  * @return string
  */
 public function tag($attr = array())
 {
     if ($this->options['inline-size'] && !$this->options['srcset-only']) {
         //if srcset-only, then no inline-size possible
         return html::img($this->thumbs['1x']->result->url(), array_merge(array('alt' => isset($this->options['alt']) ? $this->options['alt'] : $this->sourcePath->name(), 'width' => $this->thumbs['1x']->result->width(), 'height' => $this->thumbs['1x']->result->height(), 'class' => isset($this->options['class']) ? $this->options['class'] : null, 'srcset' => $this->srcset_string()), $attr));
     } else {
         if ($this->options['srcset-only']) {
             return $this->srcset_string();
         } else {
             return html::img($this->thumbs['1x']->result->url(), array_merge(array('alt' => isset($this->options['alt']) ? $this->options['alt'] : $this->sourcePath->name(), 'class' => isset($this->options['class']) ? $this->options['class'] : null, 'srcset' => $this->srcset_string()), $attr));
         }
     }
 }
Beispiel #25
0
 private function img_tag($ico, $title)
 {
     $path = './program/js/tiny_mce/plugins/emotions/img/';
     return html::img(array('src' => $path . $ico, 'title' => $title));
 }
Beispiel #26
0
 /**
  * Show user photo
  *
  * @param array $attrib
  * @return string
  */
 function userphoto($args)
 {
     $photo_img = $this->rc->url(array('_task' => 'addressbook', '_action' => 'photo', '_email' => $this->current_username()));
     $args['content'] = html::img(array('src' => $photo_img));
     return $args;
 }
Beispiel #27
0
<?php

require_once '_toolkit/main.php';
//var_export($_FILES);
if ($_FILES) {
    $file = file::upload('image', 'data/image/' . $_FILES['image']['name']);
    $ext = $file->getExtension();
    $file->rename('background' . $ext);
    $file->move('backgrounds/1/');
    echo $file->getBaseName() . html::br();
    echo $file->getFolder() . html::br();
    echo $file->getPath() . html::br();
    $img = $file->getImage();
    if ($img !== false) {
        $img->resize(100, 75);
    }
    //echo $img->htmlTag();
    echo html::img($file);
    //$file->delete();
} else {
    echo form::init(NULL, NULL, 'multipart/form-data');
    echo new Field('image', 'file');
    echo form::submit();
    echo '</form>';
}
 public function __toString()
 {
     if (file_exists($this->to_path)) {
         $filename = $this->toFilename();
     } else {
         $filename = $this->thumb->filename();
     }
     return html::img($this->to_url, array('alt' => $this->thumb->name()));
 }
 function save_data()
 {
     $COMPOSE_ID = rcube_utils::get_input_value('_id', rcube_utils::INPUT_GPC);
     $COMPOSE = null;
     if ($COMPOSE_ID && $_SESSION['compose_data_' . $COMPOSE_ID]) {
         $SESSION_KEY = 'compose_data_' . $COMPOSE_ID;
         $COMPOSE =& $_SESSION[$SESSION_KEY];
     }
     if (!$COMPOSE) {
         die("Invalid session var!");
     }
     $uploadid = rcube_utils::get_input_value('_uploadid', rcube_utils::INPUT_POST);
     $files = rcube_utils::get_input_value('files', rcube_utils::INPUT_POST);
     $RCMAIL = rcmail::get_instance();
     $RCMAIL->output->reset();
     //rcube::write_log('dropbox_attachments', $files);
     if (is_array($files)) {
         $multiple = count($files) > 1;
         foreach ($files as $i => $file) {
             /*File checks*/
             $err = false;
             if ($file['is_dir'] == 'true') {
                 $err = "UPLOAD_ERR_DIRECTORY";
             }
             // Fetch file
             $filepath = $this->download_fopen($file['link']);
             //rcube::write_log('dropbox_attachments', link);
             //rcube::write_log('dropbox_attachments', $filepath);
             rcube::write_log('dropbox_attachments', $file['link']);
             if (!$filepath) {
                 $err = "UPLOAD_ERR_FETCH";
             }
             if (!$err) {
                 $attachment = $this->move_file(array('path' => $filepath, 'size' => $file['bytes'], 'name' => $file['name'], 'mimetype' => rcube_mime::file_content_type($filepath, $file['name']), 'group' => $COMPOSE_ID));
             }
             //rcube::write_log('dropbox_attachments', $attachment);
             if (!$err && $attachment['status'] && !$attachment['abort']) {
                 $id = $attachment['id'];
                 // store new attachment in session
                 unset($attachment['status'], $attachment['abort']);
                 $RCMAIL->session->append($SESSION_KEY . '.attachments', $id, $attachment);
                 if (($icon = $COMPOSE['deleteicon']) && is_file($icon)) {
                     $button = html::img(array('src' => $icon, 'alt' => $RCMAIL->gettext('delete')));
                 } else {
                     if ($COMPOSE['textbuttons']) {
                         $button = rcube::Q($RCMAIL->gettext('delete'));
                     } else {
                         $button = '';
                     }
                 }
                 $content = html::a(array('href' => "#delete", 'onclick' => sprintf("return %s.command('remove-attachment','rcmfile%s', this)", rcmail_output::JS_OBJECT_NAME, $id), 'title' => $RCMAIL->gettext('delete'), 'class' => 'delete'), $button);
                 $content .= rcube::Q($attachment['name']);
                 $RCMAIL->output->command('add2attachment_list', "rcmfile{$id}", array('html' => $content, 'name' => $attachment['name'], 'mimetype' => $attachment['mimetype'], 'classname' => rcube_utils::file2class($attachment['mimetype'], $attachment['name']), 'complete' => true), $uploadid);
             } else {
                 // upload failed
                 if ($err == "UPLOAD_ERR_DIRECTORY") {
                     $msg = "Directory upload not allowed.";
                 } else {
                     if ($err == "UPLOAD_ERR_FETCH") {
                         $msg = "Failed to download file from Dropbox";
                     } else {
                         if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) {
                             $size = $RCMAIL->show_bytes(parse_bytes(ini_get('upload_max_filesize')));
                             $msg = $RCMAIL->gettext(array('name' => 'filesizeerror', 'vars' => array('size' => $size)));
                         } else {
                             if ($attachment['error']) {
                                 $msg = $attachment['error'];
                             } else {
                                 $msg = $RCMAIL->gettext('fileuploaderror');
                             }
                         }
                     }
                 }
                 if ($attachment['error'] || $err != UPLOAD_ERR_NO_FILE) {
                     $RCMAIL->output->command('display_message', $msg, 'error');
                     $RCMAIL->output->command('remove_from_attachment_list', $uploadid);
                 }
             }
         }
     }
     $RCMAIL->output->command('auto_save_start', 'false');
     $RCMAIL->output->send();
 }
Beispiel #30
0
$data = ArrayHelper::map(\app\models\Tooltypes::find()->all(), 'type_name', 'type_name');
?>
        
        <?php 
echo Html::dropDownList('tooltypes', null, $data, ['prompt' => '- เลือกประเภท -', 'onchange' => '
                        $.pjax.reload({
                            url: "' . Url::to(['index4']) . '&ToolsSearch[tooltype_id]="+$(this).val(),
                            container: "#pjax-gridview",
                            timeout: 1000,
                        });
                    ', 'class' => 'form-control']);
?>

    </div><br>
<?php 
Pjax::begin(['id' => 'pjax-gridview']);
?>
    <?php 
echo \kartik\grid\GridView::widget(['dataProvider' => $dataProvider, 'formatter' => ['class' => 'yii\\i18n\\Formatter', 'nullDisplay' => '-'], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'pictool', 'format' => 'html', 'value' => function ($model) {
    return html::img('pictools/' . $model->pictool, ['class' => 'thumbnail-responsive', 'style' => 'width: 80px;']);
}], ['attribute' => 'registool_id', 'value' => 'registool.name_list'], ['attribute' => 'tooltype_id', 'value' => 'tooltypetool.type_name'], ['label' => 'เลขครุภัณฑ์', 'attribute' => 'fnumber', 'value' => function ($model) {
    return $model->fnumber . '-' . $model->lnumber;
}], ['attribute' => 'department_id', 'value' => 'deptool.name'], ['class' => 'yii\\grid\\ActionColumn', 'options' => ['style' => 'width:140px;'], 'buttonOptions' => ['class' => 'btn btn-default'], 'template' => '<div class="btn-group btn-group-sm text-center" role="group">
                            {view} {update} {delete} </div>']]]);
Pjax::end();
?>
        </div> 
    </div>        
</div>