selfUrl() public static method

Returns a session-id-ified version of $SCRIPT_NAME resp. $PHP_SELF.
public static selfUrl ( boolean $script_params = false, boolean $nocache = true, boolean $full = false, boolean $force_ssl = false ) : Horde_Url
$script_params boolean Include script parameters like QUERY_STRING and PATH_INFO? (Deprecated: use Horde::selfUrlParams() instead.)
$nocache boolean Include a cache-buster parameter in the URL?
$full boolean Return a full URL?
$force_ssl boolean Ignore $conf['use_ssl'] and force creation of a SSL URL?
return Horde_Url The requested URL.
コード例 #1
0
ファイル: Thread.php プロジェクト: raz0rsdge/horde
 /**
  */
 protected function _content()
 {
     /* Return empty if we don't have a thread set. */
     if (empty($this->_params['thread_id'])) {
         return '';
     }
     /* Set up the message object. */
     list($forum_id, $message_id) = explode('.', $this->_params['thread_id']);
     $messages = $GLOBALS['injector']->getInstance('Agora_Factory_Driver')->create('agora', $forum_id);
     /* Check if valid thread, otherwise show forum list. */
     if ($messages instanceof PEAR_Error || empty($messages)) {
         throw new Horde_Exception(_("Unable to fetch selected thread."));
     }
     /* Get the sorting. */
     $sort_by = Agora::getSortBy('threads');
     $sort_dir = Agora::getSortDir('threads');
     $view_bodies = $GLOBALS['prefs']->getValue('thread_view_bodies');
     /* Get the message array and the sorted thread list. */
     $threads_list = $messages->getThreads($messages->getThreadRoot($message_id), true, $sort_by, $sort_dir, $view_bodies, Horde::selfUrl());
     /* Set up the column headers. */
     $col_headers = array(array('message_thread' => _("Thread"), 'message_subject' => _("Subject")), 'message_author' => _("Posted by"), 'message_timestamp' => _("Date"));
     $col_headers = Agora::formatColumnHeaders($col_headers, $sort_by, $sort_dir, 'threads');
     /* Set up the template tags. */
     $view = new Agora_View();
     $view->col_headers = $col_headers;
     $view->threads_list = $threads_list;
     $view->threads_list_header = _("Thread List");
     $view->thread_view_bodies = $view_bodies;
     return $view->render('block/thread');
 }
コード例 #2
0
ファイル: Threads.php プロジェクト: jubinpatel/horde
 /**
  */
 protected function _content()
 {
     if (!isset($this->_params['forum_id'])) {
         throw new Horde_Exception(_("No forum selected"));
     }
     if (empty($this->_threads)) {
         $this->_threads = $GLOBALS['injector']->getInstance('Agora_Factory_Driver')->create('agora', $this->_params['forum_id']);
         if ($this->_threads instanceof PEAR_Error) {
             throw new Horde_Exception(_("Unable to fetch threads for selected forum."));
         }
     }
     /* Get the sorting. */
     $sort_by = Agora::getSortBy('threads');
     $sort_dir = Agora::getSortDir('threads');
     /* Get a list of threads and display only the most recent if
      * preference is set. */
     $threads_list = $this->_threads->getThreads(0, false, $sort_by, $sort_dir, false, Horde::selfUrl(), null, 0, !empty($this->_params['thread_display']) ? $this->_params['thread_display'] : null);
     /* Show a message if no available threads. Don't raise an error
      * as it is not an error to have no threads. */
     if (empty($threads_list)) {
         return _("No available threads.");
     }
     /* Set up the column headers. */
     $col_headers = array('message_subject' => _("Subject"), 'message_author' => _("Posted by"), 'message_timestamp' => _("Date"));
     $col_headers = Agora::formatColumnHeaders($col_headers, $sort_by, $sort_dir, 'threads');
     /* Set up the template tags. */
     $view = new Agora_View();
     $view->col_headers = $col_headers;
     $view->threads = $threads_list;
     return $view->render('block/threads');
 }
コード例 #3
0
ファイル: Actions.php プロジェクト: horde/horde
 /**
  * Helper function for generating the gallery actions selection widget.
  *
  * @param Horde_View $view  The view object.
  */
 protected function _getGalleryActions(&$view)
 {
     global $registry, $conf;
     $id = $this->_view->gallery->id;
     $galleryurl = Horde::url('gallery.php')->add('gallery', $id);
     $selfurl = Horde::selfUrl(true, false, true);
     $view->count = $count = $this->_view->gallery->countImages();
     $date = $this->_view->gallery->getDate();
     // Buid the url parameters to the zip link
     $view_params = array('gallery' => $this->_view->gallery->id, 'view' => 'Gallery', 'slug' => $this->_view->gallery->get('slug'), 'page' => !empty($this->_view->_params['page']) ? $this->_view->_params['page'] : 0);
     // Append the date information to the parameters if we need it
     $view_params = array_merge($view_params, $date);
     // Bookmark link
     if ($registry->hasMethod('bookmarks/getAddUrl')) {
         $api_params = array('url' => Ansel::getUrlFor('view', $view_params, true), 'title' => $this->_view->gallery->get('name'));
         try {
             $view->bookmark_url = new Horde_Url($registry->bookmarks->getAddUrl($api_params));
         } catch (Horde_Exception $e) {
         }
     }
     // Download as ZIP link
     if (!empty($conf['gallery']['downloadzip']) && $this->_view->gallery->canDownload() && $count && $this->_view->gallery->hasFeature('zipdownload')) {
         $zip_params = array_merge(array('actionID' => 'downloadzip'), $date);
         $view->zip_url = $galleryurl->copy()->add($zip_params)->link(array('class' => 'widget'));
     }
     // Image upload, subgalleries, captions etc..
     if ($this->_view->gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
         $view->hasEdit = true;
         $view->properties_url = $galleryurl->copy()->add(array('actionID' => 'modify', 'url' => $selfurl))->link(array('class' => 'widget'));
         if ($count) {
             if ($this->_view->gallery->hasFeature('image_captions')) {
                 $params = array_merge(array('gallery' => $id), $date);
                 $view->captions_url = Horde::url('gallery/captions.php')->add($params)->link(array('class' => 'widget'));
             }
             if ($this->_view->gallery->hasFeature('sort_images')) {
                 $view->sort_url = Horde::url('gallery/sort.php')->add(array_merge(array('gallery' => $id), $date))->link(array('class' => 'widget'));
                 $view->resetsort_url = Horde::url('gallery/sort.php')->add(array_merge(array('gallery' => $id, 'action' => 'Reset'), $date))->link(array('class' => 'widget'));
             }
             $view->regenerate_url = $galleryurl->copy()->add(array('actionID' => 'generateThumbs'))->link(array('class' => 'widget'));
             $view->regenerate_all = $galleryurl->copy()->add(array('actionID' => 'deleteCache'))->link(array('class' => 'widget'));
             if ($conf['faces']['driver'] && $conf['faces']['driver'] !== 'user' && $this->_view->gallery->hasFeature('faces')) {
                 $view->faces_url = Horde::url('faces/gallery.php')->add(array_merge($date, array('gallery' => $id, 'page' => !empty($this->_view->_params['page']) ? $this->_view->_params['page'] : 0)))->link(array('class' => 'widget'));
             }
         }
         if ($this->_view->gallery->hasFeature('stacks')) {
             $view->gendefault_url = $galleryurl->copy()->add(array('actionID' => 'generateDefault', 'url' => $selfurl))->link(array('class' => 'widget'));
         }
     }
     if ($registry->getAuth() && $this->_view->gallery->get('owner') == $registry->getAuth()) {
         $url = new Horde_Url('#');
         $view->perms_link = $url->link(array('class' => 'popup widget', 'onclick' => Horde::popupJs(Horde::url('perms.php'), array('params' => array('cid' => $this->_view->gallery->id), 'urlencode' => true)) . 'return false;'));
     } elseif (!empty($conf['report_content']['driver']) && ($conf['report_content']['allow'] == 'authenticated' && $registry->isAuthenticated() || $conf['report_content']['allow'] == 'all')) {
         $view->report_url = Horde::url('report.php')->add('gallery', $id)->link(array('class' => 'widget'));
     }
     if ($this->_view->gallery->hasPermission($registry->getAuth(), Horde_Perms::DELETE)) {
         $view->have_delete = true;
         $view->deleteall_url = $galleryurl->copy()->add('actionID', 'empty')->link(array('class' => 'widget'));
         $view->deletegallery_url = $galleryurl->copy()->add('actionID', 'delete')->link(array('class' => 'widget'));
     }
 }
コード例 #4
0
ファイル: Manager.php プロジェクト: jubinpatel/horde
 /**
  * Constructor.
  *
  * @param Horde_Core_Block_Collection $collection  TODO
  */
 public function __construct(Horde_Core_Block_Collection $collection)
 {
     $this->_collection = $collection;
     $this->_editUrl = Horde::selfUrl();
     $this->_layout = $collection->getLayout();
     // Fill the _covered caches and empty rows.
     $rows = count($this->_layout);
     $emptyrows = array();
     for ($row = 0; $row < $rows; $row++) {
         $cols = count($this->_layout[$row]);
         if (!isset($emptyrows[$row])) {
             $emptyrows[$row] = true;
         }
         for ($col = 0; $col < $cols; ++$col) {
             if (isset($this->_layout[$row][$col]) && is_array($this->_layout[$row][$col])) {
                 $field = $this->_layout[$row][$col];
                 $emptyrows[$row] = false;
                 if (isset($field['width'])) {
                     for ($i = 1; $i < $field['width']; ++$i) {
                         $this->_layout[$row][$col + $i] = 'covered';
                     }
                 }
                 if (isset($field['height'])) {
                     if (!isset($field['width'])) {
                         $field['width'] = 1;
                     }
                     for ($i = 1; $i < $field['height']; ++$i) {
                         $this->_layout[$row + $i][$col] = 'covered';
                         for ($j = 1; $j < $field['width']; $j++) {
                             $this->_layout[$row + $i][$col + $j] = 'covered';
                         }
                         $emptyrows[$row + $i] = false;
                     }
                 }
             }
         }
         // Strip empty blocks from the end of the rows.
         for ($col = $cols - 1; $col >= 0; --$col) {
             if (isset($this->_layout[$row][$col]) && $this->_layout[$row][$col] != 'empty') {
                 break;
             }
             unset($this->_layout[$row][$col]);
         }
         $this->_columns = max($this->_columns, count($this->_layout[$row]));
     }
     // Fill all rows up to the same length.
     $layout = array();
     for ($row = 0; $row < $rows; ++$row) {
         $cols = count($this->_layout[$row]);
         if ($cols < $this->_columns) {
             for ($col = $cols; $col < $this->_columns; ++$col) {
                 $this->_layout[$row][$col] = 'empty';
             }
         }
         $layout[] = $this->_layout[$row];
     }
     $this->_layout = $layout;
 }
コード例 #5
0
ファイル: OtherGalleries.php プロジェクト: horde/horde
 /**
  * Build the HTML for this widget.
  *
  * @return string  The HTML representing this widget.
  */
 public function html()
 {
     $view = $GLOBALS['injector']->getInstance('Horde_View');
     $view->addTemplatePath(ANSEL_TEMPLATES . '/widgets');
     $view->title = $this->_title;
     $view->background = $this->_style->background;
     $view->toggle_url = Horde::selfUrl(true, true)->add('actionID', 'show_othergalleries')->link(array('id' => 'othergalleries-toggle', 'class' => $GLOBALS['prefs']->getValue('show_othergalleries') ? 'hide' : 'show'));
     $this->_getOtherGalleries($view);
     return $view->render('othergalleries');
 }
コード例 #6
0
ファイル: LoginTasks.php プロジェクト: jubinpatel/horde
 /**
  */
 public function runTasks(array $opts = array())
 {
     if (!isset($opts['url'])) {
         $opts['url'] = Horde::selfUrl(true, true, true);
     }
     if ($this->_app != 'horde' && $GLOBALS['session']->get('horde', 'logintasks') !== true) {
         $GLOBALS['injector']->getInstance('Horde_Core_Factory_LoginTasks')->create('horde')->runTasks($opts);
     }
     parent::runTasks($opts);
 }
コード例 #7
0
ファイル: Test.php プロジェクト: horde/horde
 /**
  */
 public function appTests()
 {
     $ret = '<h1>Mail Server Support Test</h1>';
     $vars = Horde_Variables::getDefaultVariables();
     if ($vars->user && $vars->passwd) {
         $ret .= $this->_doConnectionTest($vars);
     }
     $self_url = Horde::selfUrl()->add('app', 'imp');
     Horde::startBuffer();
     require IMP_TEMPLATES . '/test/mailserver.inc';
     return $ret . Horde::endBuffer();
 }
コード例 #8
0
ファイル: Application.php プロジェクト: horde/horde
 public function sidebar($sidebar)
 {
     global $registry, $session;
     $sidebar->addNewButton(_("_New Ticket"), Horde::url('ticket/create.php'));
     $sidebar->containers['queries'] = array('header' => array('id' => 'whups-toggle-queries', 'label' => _("Saved Queries")));
     $manager = new Whups_Query_Manager();
     $queries = $manager->listQueries($registry->getAuth(), true);
     foreach ($queries as $id => $query) {
         $row = array('selected' => strpos(strval(Horde::selfUrl()), $registry->get('webroot') . '/query') === 0 && $id == $session->get('whups', 'query'), 'cssClass' => 'whups-sidebar-query', 'url' => Whups::urlFor('query', empty($query['slug']) ? array('id' => $id) : array('slug' => $query['slug'])), 'label' => $query['name']);
         $sidebar->addRow($row, 'queries');
     }
 }
コード例 #9
0
ファイル: Test.php プロジェクト: DSNS-LAB/Dmail
 /**
  * Any application specific tests that need to be done.
  *
  * @return string  HTML output.
  */
 public function appTests()
 {
     $ret = '<h1>LDAP Support Test</h1>';
     $params = array('server' => Horde_Util::getPost('server'), 'port' => Horde_Util::getPost('port', 389), 'basedn' => Horde_Util::getPost('basedn'), 'user' => Horde_Util::getPost('user'), 'passwd' => Horde_Util::getPost('passwd'), 'filter' => Horde_Util::getPost('filter'), 'proto' => Horde_Util::getPost('proto'));
     if (!empty($params['server']) && !empty($params['basedn']) && !empty($params['filter'])) {
         $ret .= $this->_doConnectionTest($params);
     }
     $self_url = Horde::selfUrl()->add('app', 'turba');
     Horde::startBuffer();
     require TURBA_TEMPLATES . '/test/ldapserver.inc';
     return $ret . Horde::endBuffer();
 }
コード例 #10
0
ファイル: ChannelDelete.php プロジェクト: jubinpatel/horde
 /**
  * Expects:
  *   $vars
  *   $registry
  *   $notification
  */
 public function run()
 {
     extract($this->_params, EXTR_REFS);
     /* Set up the form variables and the form. */
     $form_submit = $vars->get('submitbutton');
     $channel_id = $vars->get('channel_id');
     try {
         $channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($channel_id);
     } catch (Exception $e) {
         Horde::log($e, 'ERR');
         $notification->push(_("Invalid channel specified for deletion."), 'horde.message');
         Horde::url('channels')->redirect();
         exit;
     }
     /* If not yet submitted set up the form vars from the fetched channel. */
     if (empty($form_submit)) {
         $vars = new Horde_Variables($channel);
     }
     /* Check permissions and deny if not allowed. */
     if (!Jonah::checkPermissions(Jonah::typeToPermName($channel['channel_type']), Horde_Perms::DELETE, $channel_id)) {
         $notification->push(_("You are not authorised for this action."), 'horde.warning');
         throw new Horde_Exception_AuthenticationFailure();
     }
     $title = sprintf(_("Delete News Channel \"%s\"?"), $vars->get('channel_name'));
     $form = new Horde_Form($vars, $title);
     $form->setButtons(array(_("Delete"), _("Do not delete")));
     $form->addHidden('', 'channel_id', 'int', true, true);
     $msg = _("Really delete this News Channel? All stories created in this channel will be lost!");
     $form->addVariable($msg, 'confirm', 'description', false);
     if ($form_submit == _("Delete")) {
         if ($form->validate($vars)) {
             $form->getInfo($vars, $info);
             try {
                 $delete = $GLOBALS['injector']->getInstance('Jonah_Driver')->deleteChannel($info);
                 $notification->push(_("The channel has been deleted."), 'horde.success');
                 Horde::url('channels')->redirect();
                 exit;
             } catch (Exception $e) {
                 $notification->push(sprintf(_("There was an error deleting the channel: %s"), $e->getMessage()), 'horde.error');
             }
         }
     } elseif (!empty($form_submit)) {
         $notification->push(_("Channel has not been deleted."), 'horde.message');
         Horde::url('channels')->redirect();
         exit;
     }
     $GLOBALS['page_output']->header(array('title' => $title));
     $notification->notify(array('listeners' => 'status'));
     $form->renderActive(null, $vars, Horde::selfUrl(), 'post');
     $GLOBALS['page_output']->footer();
 }
コード例 #11
0
ファイル: Language.php プロジェクト: jubinpatel/horde
 /**
  * Render the language selection.
  *
  * @return string  The HTML selection box.
  */
 public static function render()
 {
     global $prefs, $registry, $session;
     $html = '';
     if (!$prefs->isLocked('language')) {
         $session->set('horde', 'language', $registry->preferredLang());
         $html = sprintf('<form name="language" action="%s">', Horde::url($registry->get('webroot', 'horde') . '/services/language.php', false, -1));
         $html .= '<input type="hidden" name="url" value="' . @htmlspecialchars(Horde::selfUrl(false, false, true)) . '" />';
         $html .= '<select name="new_lang" onchange="document.language.submit()">';
         foreach ($registry->nlsconfig->languages as $key => $val) {
             $sel = $key == $session->get('horde', 'language') ? ' selected="selected"' : '';
             $html .= "<option value=\"{$key}\"{$sel}>{$val}</option>";
         }
         $html .= '</select></form>';
     }
     return $html;
 }
コード例 #12
0
ファイル: Topbar.php プロジェクト: DSNS-LAB/Dmail
 /**
  * Constructor.
  *
  * @param array $config  Configuration key-value pairs.
  */
 public function __construct($config = array())
 {
     global $injector, $prefs, $registry;
     if (empty($config['templatePath'])) {
         $config['templatePath'] = $registry->get('templates', 'horde') . '/topbar';
     }
     parent::__construct($config);
     $this->addHelper('Text');
     /* Logo. */
     $this->portalUrl = $registry->getServiceLink('portal', $registry->getApp());
     if (class_exists('Horde_Bundle')) {
         $this->version = Horde_Bundle::SHORTNAME . ' ' . Horde_Bundle::VERSION;
     } else {
         $this->version = $registry->getVersion('horde');
     }
     /* Main menu. */
     $topbar = $injector->getInstance('Horde_Core_Factory_Topbar')->create('Horde_Tree_Renderer_Menu', array('nosession' => true));
     $this->menu = $topbar->getTree();
     /* Search form. */
     $this->searchAction = '#';
     $this->searchIcon = Horde_Themes::img('search-topbar.png');
     $this->searchLabel = _("Search");
     /* Login/Logout. */
     if ($registry->getAuth()) {
         if ($registry->showService('logout')) {
             $this->logoutUrl = $registry->getServiceLink('logout', $registry->getApp())->setRaw(false);
         }
     } else {
         if ($registry->showService('login')) {
             $this->loginUrl = $registry->getServiceLink('login', $registry->getApp())->setRaw(false)->add('url', Horde::selfUrl(true, true, true));
         }
     }
     /* Sub bar. */
     $this->date = strftime($prefs->getValue('date_format'));
     $pageOutput = $injector->getInstance('Horde_PageOutput');
     $pageOutput->addScriptPackage('Horde_Core_Script_Package_Datejs');
     $pageOutput->addScriptFile('topbar.js', 'horde');
     $pageOutput->addInlineJsVars(array('HordeTopbar.conf' => array('URI_AJAX' => $registry->getServiceLink('ajax', 'horde')->url, 'app' => $registry->getApp(), 'format' => Horde_Core_Script_Package_Datejs::translateFormat($prefs->getValue('date_format')), 'hash' => $topbar->getHash(), 'refresh' => intval($prefs->getValue('menu_refresh_time')))));
     /* Sidebar. */
     $this->sidebarWidth = $prefs->getValue('sidebar_width');
 }
コード例 #13
0
ファイル: Form.php プロジェクト: jubinpatel/horde
 protected function _content()
 {
     $vars = Horde_Variables::getDefaultVariables();
     $formname = $vars->get('formname');
     $done = false;
     $form = new Horde_Form($vars);
     $fields = $GLOBALS['injector']->getInstance('Ulaform_Factory_Driver')->create()->getFields($this->_params['form_id']);
     foreach ($fields as $field) {
         /* In case of these types get array from stringlist. */
         if ($field['field_type'] == 'link' || $field['field_type'] == 'enum' || $field['field_type'] == 'multienum' || $field['field_type'] == 'radio' || $field['field_type'] == 'set' || $field['field_type'] == 'sorter') {
             $field['field_params']['values'] = Ulaform::getStringlistArray($field['field_params']['values']);
         }
         /* Setup the field with all the parameters. */
         $form->addVariable($field['field_label'], $field['field_name'], $field['field_type'], $field['field_required'], $field['field_readonly'], $field['field_desc'], $field['field_params']);
     }
     if ($formname) {
         $form->validate($vars);
         if ($form->isValid() && $formname) {
             $form->getInfo($vars, $info);
             $info['form_id'] = $this->_params['form_id'];
             try {
                 $submit = $GLOBALS['ulaform_driver']->submitForm($info);
                 $GLOBALS['notification']->push(_("Form submitted successfully."), 'horde.success');
                 $done = true;
             } catch (Horde_Exception $e) {
                 $GLOBALS['notification']->push(sprintf(_("Error submitting form. %s."), $e->getMessage()), 'horde.error');
             }
         }
     }
     /* Render active or inactive, depending if submitted or
      * not. */
     $render_type = $done ? 'renderInactive' : 'renderActive';
     /* Render the form. */
     $renderer = new Horde_Form_Renderer();
     $renderer->showHeader(false);
     Horde::startBuffer();
     $form->{$render_type}($renderer, $vars, Horde::selfUrl(true), 'post');
     return Horde::endBuffer();
 }
コード例 #14
0
ファイル: DeliveryHtml.php プロジェクト: horde/horde
 /**
  * $registry
  * $notification
  * $conf
  * $criteria
  *
  */
 public function run()
 {
     extract($this->_params, EXTR_REFS);
     $templates = Horde::loadConfiguration('templates.php', 'templates', 'jonah');
     /* Get requested channel. */
     try {
         $channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($criteria['feed']);
     } catch (Exception $e) {
         Horde::log($e, 'ERR');
         $notification->push(_("Invalid channel."), 'horde.error');
         Horde::url('delivery/index.php', true)->redirect();
         exit;
     }
     $title = sprintf(_("HTML Delivery for \"%s\""), $channel['channel_name']);
     $options = array();
     foreach ($templates as $key => $info) {
         $options[] = '<option value="' . $key . '"' . ($key == $criteria['format'] ? ' selected="selected"' : '') . '>' . $info['name'] . '</option>';
     }
     $template = new Horde_Template();
     $template->setOption('gettext', 'true');
     $template->set('url', Horde::selfUrl());
     $template->set('session', Horde_Util::formInput());
     $template->set('channel_id', $criteria['feed']);
     $template->set('channel_name', $channel['channel_name']);
     $template->set('format', $criteria['format']);
     $template->set('options', $options);
     // @TODO: This is ugly. storage driver shouldn't be rendering any display
     // refactor this to use individual views possibly with a choice of different templates
     $template->set('stories', $GLOBALS['injector']->getInstance('Jonah_Driver')->renderChannel($criteria['feed'], $criteria['format']));
     // Buffer the notifications and send to the template
     Horde::startBuffer();
     $GLOBALS['notification']->notify(array('listeners' => 'status'));
     $template->set('notify', Horde::endBuffer());
     $GLOBALS['page_output']->header(array('title' => $title));
     echo $template->fetch(JONAH_TEMPLATES . '/delivery/html.html');
     $GLOBALS['page_output']->footer();
 }
コード例 #15
0
ファイル: Test.php プロジェクト: jubinpatel/horde
 /**
  * Obtain information on the PHP version.
  *
  * @return object stdClass  TODO
  */
 public function getPhpVersionInformation()
 {
     $output = new stdClass();
     $vers_check = true;
     $testscript = Horde::selfUrl(true);
     $output->phpinfo = $testscript->copy()->add('mode', 'phpinfo');
     $output->extensions = $testscript->copy()->add('mode', 'extensions');
     $output->version = PHP_VERSION;
     $output->major = $this->_phpver['major'];
     if (isset($this->_phpver['minor'])) {
         $output->minor = $this->_phpver['minor'];
     }
     if (isset($this->_phpver['subminor'])) {
         $output->subminor = $this->_phpver['subminor'];
     }
     $output->class = $this->_phpver['class'];
     $output->status_color = 'red';
     if ($output->major < '5.3') {
         $output->status = 'This version of PHP is not supported. You need to upgrade to a more recent version.';
         $vers_check = false;
     } elseif ($output->major == '5.3') {
         $output->status = 'You are using an old, deprecated version of PHP. It is highly recommended that you upgrade to at least PHP 5.4 for performance, stability, and security reasons.';
         $output->status_color = 'orange';
     } elseif (in_array($output->major, $this->_supported)) {
         $output->status = 'You are running a supported version of PHP.';
         $output->status_color = 'green';
     } else {
         $output->status = 'This version of PHP has not been fully tested with this version of Horde.';
         $output->status_color = 'orange';
     }
     if (!$vers_check) {
         $output->version_check = 'Horde requires PHP 5.3.0 or greater.';
     }
     return $output;
 }
コード例 #16
0
ファイル: Vcard.php プロジェクト: raz0rsdge/horde
 /**
  * Return the rendered inline version of the Horde_Mime_Part object.
  *
  * @return array  See parent::render().
  */
 protected function _renderInline()
 {
     $browser = $this->getConfigParam('browser');
     $notification = $this->getConfigParam('notification');
     $prefs = $this->getConfigParam('prefs');
     $registry = $this->getConfigParam('registry');
     $data = $this->_mimepart->getContents();
     $html = '';
     $title = Horde_Core_Translation::t("vCard");
     $iCal = new Horde_Icalendar();
     if (!$iCal->parsevCalendar($data, 'VCALENDAR', $this->_mimepart->getCharset())) {
         $notification->push(Horde_Core_Translation::t("There was an error reading the contact data."), 'horde.error');
     }
     if (Horde_Util::getFormData('import') && Horde_Util::getFormData('source') && $registry->hasMethod('contacts/import')) {
         $source = Horde_Util::getFormData('source');
         $count = 0;
         foreach ($iCal->getComponents() as $c) {
             if ($c->getType() == 'vcard') {
                 try {
                     $registry->call('contacts/import', array($c, null, $source));
                     ++$count;
                 } catch (Horde_Exception $e) {
                     $notification->push(Horde_Core_Translation::t("There was an error importing the contact data:") . ' ' . $e->getMessage(), 'horde.error');
                 }
             }
         }
         $notification->push(sprintf(Horde_Core_Translation::ngettext("%d contact was successfully added to your address book.", "%d contacts were successfully added to your address book.", $count), $count), 'horde.success');
     }
     $html .= '<table class="horde-table" style="width:100%">';
     foreach ($iCal->getComponents() as $i => $vc) {
         if ($i > 0) {
             $html .= '<tr><td colspan="2">&nbsp;</td></tr>';
         }
         $addresses = $vc->getAllAttributes('EMAIL');
         $html .= '<tr><td colspan="2" class="header">';
         if (($fullname = $vc->getAttributeDefault('FN', false)) === false) {
             $fullname = count($addresses) ? $addresses[0]['value'] : Horde_Core_Translation::t("[No Label]");
         }
         $html .= htmlspecialchars($fullname) . '</td></tr>';
         $n = $vc->printableName();
         if (!empty($n)) {
             $html .= $this->_row(Horde_Core_Translation::t("Name"), $n);
         }
         try {
             $html .= $this->_row(Horde_Core_Translation::t("Alias"), implode("\n", $vc->getAttributeValues('ALIAS')));
         } catch (Horde_Icalendar_Exception $e) {
         }
         try {
             $birthdays = $vc->getAttributeValues('BDAY');
             $birthday = new Horde_Date($birthdays[0]);
             $html .= $this->_row(Horde_Core_Translation::t("Birthday"), $birthday->strftime($prefs->getValue('date_format')));
         } catch (Horde_Icalendar_Exception $e) {
         }
         $photos = $vc->getAllAttributes('PHOTO');
         foreach ($photos as $p => $photo) {
             if (isset($photo['params']['VALUE']) && Horde_String::upper($photo['params']['VALUE']) == 'URI') {
                 $html .= $this->_row(Horde_Core_Translation::t("Photo"), '<img src="' . htmlspecialchars($photo['value']) . '" />', false);
             } elseif (isset($photo['params']['ENCODING']) && Horde_String::upper($photo['params']['ENCODING']) == 'B' && isset($photo['params']['TYPE'])) {
                 if ($browser->hasFeature('datauri') === true || $browser->hasFeature('datauri') >= strlen($photo['value'])) {
                     $html .= $this->_row(Horde_Core_Translation::t("Photo"), '<img src="' . Horde_Url_Data::create($photo['params']['TYPE'], base64_decode($photo['value'])) . '" />', false);
                 } elseif ($this->_imageUrl) {
                     $html .= $this->_row(Horde_Core_Translation::t("Photo"), '<img src="' . $this->_imageUrl->add(array('c' => $i, 'p' => $p)) . '" />', false);
                 }
             }
         }
         $labels = $vc->getAllAttributes('LABEL');
         foreach ($labels as $label) {
             if (isset($label['params']['TYPE'])) {
                 if (!is_array($label['params']['TYPE'])) {
                     $label['params']['TYPE'] = array($label['params']['TYPE']);
                 }
             } else {
                 $label['params']['TYPE'] = array_keys($label['params']);
             }
             $types = array();
             foreach ($label['params']['TYPE'] as $type) {
                 switch (Horde_String::upper($type)) {
                     case 'HOME':
                         $types[] = Horde_Core_Translation::t("Home Address");
                         break;
                     case 'WORK':
                         $types[] = Horde_Core_Translation::t("Work Address");
                         break;
                     case 'DOM':
                         $types[] = Horde_Core_Translation::t("Domestic Address");
                         break;
                     case 'INTL':
                         $types[] = Horde_Core_Translation::t("International Address");
                         break;
                     case 'POSTAL':
                         $types[] = Horde_Core_Translation::t("Postal Address");
                         break;
                     case 'PARCEL':
                         $types[] = Horde_Core_Translation::t("Parcel Address");
                         break;
                     case 'PREF':
                         $types[] = Horde_Core_Translation::t("Preferred Address");
                         break;
                 }
             }
             if (!count($types)) {
                 $types = array(Horde_Core_Translation::t("Address"));
             }
             $html .= $this->_row(implode('/', $types), $label['value']);
         }
         $adrs = $vc->getAllAttributes('ADR');
         foreach ($adrs as $item) {
             if (isset($item['params']['TYPE'])) {
                 if (!is_array($item['params']['TYPE'])) {
                     $item['params']['TYPE'] = array($item['params']['TYPE']);
                 }
             } else {
                 $item['params']['TYPE'] = array_keys($item['params']);
             }
             $address = $item['values'];
             $a = array();
             $a_list = array(Horde_Icalendar_Vcard::ADR_STREET, Horde_Icalendar_Vcard::ADR_LOCALITY, Horde_Icalendar_Vcard::ADR_REGION, Horde_Icalendar_Vcard::ADR_POSTCODE, Horde_Icalendar_Vcard::ADR_COUNTRY);
             foreach ($a_list as $val) {
                 if (isset($address[$val])) {
                     $a[] = $address[$val];
                 }
             }
             $types = array();
             foreach ($item['params']['TYPE'] as $type) {
                 switch (Horde_String::upper($type)) {
                     case 'HOME':
                         $types[] = Horde_Core_Translation::t("Home Address");
                         break;
                     case 'WORK':
                         $types[] = Horde_Core_Translation::t("Work Address");
                         break;
                     case 'DOM':
                         $types[] = Horde_Core_Translation::t("Domestic Address");
                         break;
                     case 'INTL':
                         $types[] = Horde_Core_Translation::t("International Address");
                         break;
                     case 'POSTAL':
                         $types[] = Horde_Core_Translation::t("Postal Address");
                         break;
                     case 'PARCEL':
                         $types[] = Horde_Core_Translation::t("Parcel Address");
                         break;
                     case 'PREF':
                         $types[] = Horde_Core_Translation::t("Preferred Address");
                         break;
                 }
             }
             if (!count($types)) {
                 $types = array(Horde_Core_Translation::t("Address"));
             }
             $html .= $this->_row(implode('/', $types), implode("\n", $a));
         }
         $numbers = $vc->getAllAttributes('TEL');
         foreach ($numbers as $number) {
             if (isset($number['params']['TYPE'])) {
                 if (!is_array($number['params']['TYPE'])) {
                     $number['params']['TYPE'] = array($number['params']['TYPE']);
                 }
                 foreach ($number['params']['TYPE'] as $type) {
                     $number['params'][Horde_String::upper($type)] = true;
                 }
             }
             if (isset($number['params']['FAX'])) {
                 $html .= $this->_row(Horde_Core_Translation::t("Fax"), $number['value']);
             } else {
                 if (isset($number['params']['HOME'])) {
                     $html .= $this->_row(Horde_Core_Translation::t("Home Phone"), $number['value']);
                 } elseif (isset($number['params']['WORK'])) {
                     $html .= $this->_row(Horde_Core_Translation::t("Work Phone"), $number['value']);
                 } elseif (isset($number['params']['CELL'])) {
                     $html .= $this->_row(Horde_Core_Translation::t("Cell Phone"), $number['value']);
                 } else {
                     $html .= $this->_row(Horde_Core_Translation::t("Phone"), $number['value']);
                 }
             }
         }
         $emails = array();
         foreach ($addresses as $address) {
             if (isset($address['params']['TYPE'])) {
                 if (!is_array($address['params']['TYPE'])) {
                     $address['params']['TYPE'] = array($address['params']['TYPE']);
                 }
                 foreach ($address['params']['TYPE'] as $type) {
                     $address['params'][Horde_String::upper($type)] = true;
                 }
             }
             $email = '<a href="';
             if ($registry->hasMethod('mail/compose')) {
                 $email .= $registry->call('mail/compose', array(array('to' => $address['value'])));
             } else {
                 $email .= 'mailto:' . htmlspecialchars($address['value']);
             }
             $email .= '">' . htmlspecialchars($address['value']) . '</a>';
             if (isset($address['params']['PREF'])) {
                 array_unshift($emails, $email);
             } else {
                 $emails[] = $email;
             }
         }
         if (count($emails)) {
             $html .= $this->_row(Horde_Core_Translation::t("Email"), implode("\n", $emails), false);
         }
         try {
             $title = $vc->getAttributeValues('TITLE');
             $html .= $this->_row(Horde_Core_Translation::t("Title"), $title[0]);
         } catch (Horde_Icalendar_Exception $e) {
         }
         try {
             $role = $vc->getAttributeValues('ROLE');
             $html .= $this->_row(Horde_Core_Translation::t("Role"), $role[0]);
         } catch (Horde_Icalendar_Exception $e) {
         }
         try {
             $org = $vc->getAttributeValues('ORG');
             $html .= $this->_row(Horde_Core_Translation::t("Company"), $org[0]);
             if (isset($org[1])) {
                 $html .= $this->_row(Horde_Core_Translation::t("Department"), $org[1]);
             }
         } catch (Horde_Icalendar_Exception $e) {
         }
         try {
             $notes = $vc->getAttributeValues('NOTE');
             $html .= $this->_row(Horde_Core_Translation::t("Notes"), $notes[0]);
         } catch (Horde_Icalendar_Exception $e) {
         }
         try {
             $url = $vc->getAttributeValues('URL');
             $html .= $this->_row(Horde_Core_Translation::t("URL"), '<a href="' . htmlspecialchars($url[0]) . '" target="_blank">' . htmlspecialchars($url[0]) . '</a>', false);
         } catch (Horde_Icalendar_Exception $e) {
         }
     }
     $html .= '</table>';
     if ($registry->hasMethod('contacts/import') && $registry->hasMethod('contacts/sources')) {
         $html .= '<div class="horde-form-buttons"><form action="' . Horde::selfUrl() . '" method="get" name="vcard_import" id="vcard_import">' . Horde_Util::formInput();
         foreach ($_GET as $key => $val) {
             $html .= '<input type="hidden" name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($val) . '" />';
         }
         $sources = $registry->call('contacts/sources', array(true));
         if (count($sources) > 1) {
             $html .= '<input type="submit" class="horde-default" name="import" value="' . Horde_Core_Translation::t("Add to address book:") . '" />' . ' <label for="add_source" class="hidden">' . Horde_Core_Translation::t("Address Book") . '</label>' . '<select id="add_source" name="source">';
             foreach ($sources as $key => $label) {
                 $selected = $key == $prefs->getValue('add_source') ? ' selected="selected"' : '';
                 $html .= '<option value="' . htmlspecialchars($key) . '"' . $selected . '>' . htmlspecialchars($label) . '</option>';
             }
             $html .= '</select>';
         } else {
             reset($sources);
             $html .= '<input type="submit" class="horde-default" name="import" value="' . Horde_Core_Translation::t("Add to my address book") . '" />' . '<input type="hidden" name="source" value="' . htmlspecialchars(key($sources)) . '" />';
         }
         $html .= '</form></div>';
     }
     Horde::startBuffer();
     $notification->notify(array('listeners' => 'status'));
     return $this->_renderReturn(Horde::endBuffer() . $html, 'text/html; charset=' . $this->getConfigParam('charset'));
 }
コード例 #17
0
ファイル: Event.php プロジェクト: DSNS-LAB/Dmail
 public function getLink($datetime = null, $icons = true, $from_url = null, $full = false, $encoded = true)
 {
     global $prefs;
     if (is_null($datetime)) {
         $datetime = $this->start;
     }
     if (is_null($from_url)) {
         $from_url = Horde::selfUrl(true, false, true);
     }
     $event_title = $this->getTitle();
     $view_url = $this->getViewUrl(array('datetime' => $datetime->strftime('%Y%m%d%H%M%S'), 'url' => $from_url), $full, $encoded);
     $read_permission = $this->hasPermission(Horde_Perms::READ);
     $link = '<span' . $this->getCSSColors() . '>';
     if ($read_permission && $view_url) {
         $link .= Horde::linkTooltip($view_url, $event_title, $this->getStatusClass(), '', '', $this->getTooltip(), '', array('style' => $this->getCSSColors(false)));
     }
     $link .= htmlspecialchars($event_title);
     if ($read_permission && $view_url) {
         $link .= '</a>';
     }
     if ($icons && $prefs->getValue('show_icons')) {
         $icon_color = $this->_foregroundColor == '#000' ? '000' : 'fff';
         $status = '';
         if ($this->alarm) {
             if ($this->alarm % 10080 == 0) {
                 $alarm_value = $this->alarm / 10080;
                 $title = sprintf(ngettext("Alarm %d week before", "Alarm %d weeks before", $alarm_value), $alarm_value);
             } elseif ($this->alarm % 1440 == 0) {
                 $alarm_value = $this->alarm / 1440;
                 $title = sprintf(ngettext("Alarm %d day before", "Alarm %d days before", $alarm_value), $alarm_value);
             } elseif ($this->alarm % 60 == 0) {
                 $alarm_value = $this->alarm / 60;
                 $title = sprintf(ngettext("Alarm %d hour before", "Alarm %d hours before", $alarm_value), $alarm_value);
             } else {
                 $alarm_value = $this->alarm;
                 $title = sprintf(ngettext("Alarm %d minute before", "Alarm %d minutes before", $alarm_value), $alarm_value);
             }
             $status .= Horde::fullSrcImg('alarm-' . $icon_color . '.png', array('attr' => array('alt' => $title, 'title' => $title, 'class' => 'iconAlarm')));
         }
         if ($this->recurs()) {
             $title = Kronolith::recurToString($this->recurrence->getRecurType());
             $status .= Horde::fullSrcImg('recur-' . $icon_color . '.png', array('attr' => array('alt' => $title, 'title' => $title, 'class' => 'iconRecur')));
         } elseif ($this->baseid) {
             $title = _("Exception");
             $status .= Horde::fullSrcImg('exception-' . $icon_color . '.png', array('attr' => array('alt' => $title, 'title' => $title, 'class' => 'iconRecur')));
         }
         if ($this->private) {
             $title = _("Private event");
             $status .= Horde::fullSrcImg('private-' . $icon_color . '.png', array('attr' => array('alt' => $title, 'title' => $title, 'class' => 'iconPrivate')));
         }
         if (!empty($this->attendees)) {
             $status .= Horde::fullSrcImg('attendees-' . $icon_color . '.png', array('attr' => array('alt' => _("Meeting"), 'title' => _("Meeting"), 'class' => 'iconPeople')));
         }
         $space = ' ';
         if (!empty($this->icon)) {
             $link = $status . '<img class="kronolithEventIcon" src="' . $this->icon . '" /> ' . $link;
         } elseif (!empty($status)) {
             $link .= ' ' . $status;
             $space = '';
         }
         if ((!$this->private || $this->creator == $GLOBALS['registry']->getAuth()) && Kronolith::getDefaultCalendar(Horde_Perms::EDIT)) {
             $url = $this->getEditUrl(array('datetime' => $datetime->strftime('%Y%m%d%H%M%S'), 'url' => $from_url), $full);
             if ($url) {
                 $link .= $space . $url->link(array('title' => sprintf(_("Edit %s"), $event_title), 'class' => 'iconEdit')) . Horde::fullSrcImg('edit-' . $icon_color . '.png', array('attr' => array('alt' => _("Edit")))) . '</a>';
                 $space = '';
             }
         }
         if ($this->hasPermission(Horde_Perms::DELETE)) {
             $url = $this->getDeleteUrl(array('datetime' => $datetime->strftime('%Y%m%d%H%M%S'), 'url' => $from_url), $full);
             if ($url) {
                 $link .= $space . $url->link(array('title' => sprintf(_("Delete %s"), $event_title), 'class' => 'iconDelete')) . Horde::fullSrcImg('delete-' . $icon_color . '.png', array('attr' => array('alt' => _("Delete")))) . '</a>';
             }
         }
     }
     return $link . '</span>';
 }
コード例 #18
0
ファイル: user.php プロジェクト: DSNS-LAB/Dmail
    $page_output->addInlineJsVars(array('HordeAdminUserUpdate.pass_error' => _("Passwords must match.")));
}
$page_output->header(array('title' => _("User Administration")));
require HORDE_TEMPLATES . '/admin/menu.inc';
if (isset($update_form) && $auth->hasCapability('list')) {
    $identity = $injector->getInstance('Horde_Core_Factory_Identity')->create($f_user_name);
    require HORDE_TEMPLATES . '/admin/user/update.inc';
} elseif (isset($remove_form) && $auth->hasCapability('list') && $auth->hasCapability('remove')) {
    require HORDE_TEMPLATES . '/admin/user/remove.inc';
} elseif (isset($clear_form)) {
    require HORDE_TEMPLATES . '/admin/user/clear.inc';
} elseif (isset($removequeued_form)) {
    require HORDE_TEMPLATES . '/admin/user/removequeued.inc';
} elseif ($auth->hasCapability('add')) {
    $vars->form = 'add';
    $addForm->renderActive(new Horde_Form_Renderer(), $vars, Horde::selfUrl(), 'post');
    if ($conf['signup']['allow'] && $conf['signup']['approve']) {
        require HORDE_TEMPLATES . '/admin/user/approve.inc';
    }
} else {
    require HORDE_TEMPLATES . '/admin/user/noadd.inc';
}
if ($auth->hasCapability('list')) {
    /* If we aren't supplied with a page number, default to page 0. */
    $page = $vars->get('page', 0);
    $search_pattern = $vars->get('search_pattern', '');
    try {
        $users = $auth->listUsers();
        /* Returns only users that match the specified pattern. */
        $users = preg_grep('/' . $search_pattern . '/', $users);
        sort($users);
コード例 #19
0
ファイル: feed.php プロジェクト: horde/horde
$options = array();
foreach ($templates as $key => $info) {
    $options[] = '<option value="' . $key . '"' . ($key == $criteria['channel_format'] ? ' selected="selected"' : '') . '>' . $info['name'] . '</option>';
}
if (empty($criteria['channel_id']) && !empty($criteria['feed'])) {
    $criteria['channel_id'] = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannelId($criteria['feed']);
}
if (empty($criteria['channel_id'])) {
    $notification->push(_("No valid feed name or ID requested."), 'horde.error');
} else {
    $stories = $GLOBALS['injector']->getInstance('Jonah_Driver')->getStories($criteria);
}
if (!empty($stories)) {
    die(print_r($stories, true));
}
$template = new Horde_Template();
$template->setOption('gettext', 'true');
$template->set('url', Horde::selfUrl());
$template->set('session', Horde_Util::formInput());
$template->set('channel_id', $criteria['channel_id']);
$template->set('channel_name', $channel['channel_name']);
$template->set('format', $criteria['channel_format']);
$template->set('options', $options);
$template->set('stories', $news->renderChannel($criteria['channel_id'], $criteria['channel_format']));
// Buffer the notifications and send to the template
Horde::startBuffer();
$GLOBALS['notification']->notify(array('listeners' => 'status'));
$template->set('notify', Horde::endBuffer());
$page_output->header();
echo $template->fetch(JONAH_TEMPLATES . '/delivery/html.html');
$page_output->footer();
コード例 #20
0
ファイル: Help.php プロジェクト: raz0rsdge/horde
 /**
  * Process a help node.
  *
  * @param DOMElement $node  A help node.
  *
  * @return string  HTML string.
  */
 protected function _processNode(DOMElement $node)
 {
     $out = '';
     foreach ($node->childNodes as $child) {
         if ($child instanceof DOMElement) {
             switch ($child->tagName) {
                 case 'ref':
                     $out .= Horde::link(Horde::selfUrl()->add(array('module' => $child->getAttribute('module'), 'show' => 'entry', 'topic' => $child->getAttribute('entry')))) . $child->textContent . '</a>';
                     break;
                 case 'text':
                     $out .= $child->textContent;
                     break;
                 case 'eref':
                     $out .= Horde::link($child->getAttribute('url'), null, '', '_blank') . $child->textContent . '</a>';
                     break;
                 case 'href':
                     $out .= Horde::link(Horde::url($GLOBALS['registry']->get('webroot', $child->getAttribute('app') . '/' . $child->getAttribute('url'))), null, '', '_blank') . $child->textContent . '</a>';
                     break;
                 case 'b':
                     $out .= '<strong>' . $this->_processNode($child) . '</strong>';
                     break;
                 case 'i':
                     $out .= '<em>' . $this->_processNode($child) . '</em>';
                     break;
                 case 'pre':
                     $out .= '<pre>' . $this->_processNode($child) . '</pre>';
                     break;
                 case 'css':
                     $out .= '<span class="' . $child->getAttribute('class') . '">' . $this->_processNode($child) . '</span>';
                     break;
             }
         } else {
             $out .= $child->textContent;
         }
     }
     return $out;
 }
コード例 #21
0
ファイル: upload.php プロジェクト: raz0rsdge/horde
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author Chuck Hagenbuch <*****@*****.**>
 */
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('ansel');
$gallery_id = Horde_Util::getFormData('gallery');
try {
    $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($gallery_id);
} catch (Ansel_Exception $e) {
    $notification->push(sprintf(_("Gallery %s not found."), $gallery_id), 'horde.error');
    Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
    exit;
}
if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
    $notification->push(_("You are not authorized to upload photos to this gallery."), 'horde.error');
    Ansel::getUrlFor('view', array('view' => 'List'), true)->redirect();
}
$page = Horde_Util::getFormData('page', 0);
$return_url = Ansel::getUrlFor('view', array('gallery' => $gallery_id, 'slug' => $gallery->get('slug'), 'view' => 'Gallery', 'page' => $page), true);
$view = new Ansel_View_Upload(array('forceNoScript' => $prefs->getValue('force_old_uploader', false), 'browse_button' => 'pickfiles', 'target' => Horde::selfUrl()->setRaw(true), 'drop_target' => 'filelist', 'upload_button' => 'uploadfiles', 'gallery' => $gallery, 'return_target' => $return_url->toString(true, true)));
if (!$prefs->getValue('force_old_uploader', 'false')) {
    $view->run();
    $nojs = '';
} else {
    $nojs = $view->handleLegacy();
}
$page_output->header(array('title' => _("Add Photo")));
echo '<div class="header" id="galleryHeader"><span class="breadcrumbs">' . Ansel::getBreadCrumbs($gallery) . '</span></div>';
require ANSEL_TEMPLATES . '/image/plupload.inc';
$page_output->footer();
コード例 #22
0
ファイル: moderate.php プロジェクト: raz0rsdge/horde
    Horde::url('forums.php', true)->redirect();
} elseif (empty($messages_list)) {
    $messages_count = 0;
    $notification->push(_("No messages are waiting for moderation."), 'horde.message');
} else {
    $messages_count = count($messages_list);
    $messages_list = array_slice($messages_list, $messages_start, $messages_per_page);
}
/* Set up the column headers. */
$col_headers = array('forum_id' => _("Forum"), 'message_subject' => _("Subject"), 'message_author' => _("Posted by"), 'message_body' => _("Body"), 'message_timestamp' => _("Date"));
$col_headers = Agora::formatColumnHeaders($col_headers, $sort_by, $sort_dir, 'moderate');
/* Set up the template tags. */
$view = new Agora_View();
$view->col_headers = $col_headers;
$view->messages = $messages_list;
$view->buttons = array(_("Approve"), _("Delete"));
$view->session_tag = Horde_Util::formInput();
Horde::startBuffer();
$notification->notify(array('listeners' => 'status'));
$view->notify = Horde::endBuffer();
/* Set up pager. */
$vars = Horde_Variables::getDefaultVariables();
$pager_ob = new Horde_Core_Ui_Pager('moderate_page', $vars, array('num' => $messages_count, 'url' => Horde::selfUrl(true), 'perpage' => $messages_per_page));
$pager_ob->preserve('agora', Horde_Util::getFormData('agora'));
$view->pager = $pager_ob->render();
if (isset($api_call)) {
    return $view->render('moderate');
}
$page_output->header(array('title' => _("Messages Awaiting Moderation")));
echo $view->render('moderate');
$page_output->footer();
コード例 #23
0
ファイル: Summary.php プロジェクト: raz0rsdge/horde
 /**
  */
 protected function _content()
 {
     global $conf, $prefs, $registry;
     $html = '';
     if (!empty($this->_params['show_alarms'])) {
         $messages = array();
         try {
             $alarmList = Nag::listAlarms($_SERVER['REQUEST_TIME']);
         } catch (Nag_Exception $e) {
             return '<em>' . htmlspecialchars($e->getMessage()) . '</em>';
         }
         foreach ($alarmList as $task) {
             $differential = $task->getNextDue()->timestamp() - $_SERVER['REQUEST_TIME'];
             $key = $differential;
             while (isset($messages[$key])) {
                 $key++;
             }
             $viewurl = Horde::url('view.php', true)->add(array('task' => $task->id, 'tasklist' => $task->tasklist));
             $link = $viewurl->link() . (!empty($task->name) ? htmlspecialchars($task->name) : _("[none]")) . '</a>';
             if ($differential >= -60 && $differential < 60) {
                 $messages[$key] = sprintf(_("%s is due now."), $link);
             } elseif ($differential >= 60) {
                 $messages[$key] = sprintf(_("%s is due in %s"), $link, Nag::secondsToString($differential));
             }
         }
         ksort($messages);
         foreach ($messages as $message) {
             $html .= '<tr><td class="control">' . Horde::img('alarm_small.png') . '&nbsp;&nbsp;<strong>' . $message . '</strong></td></tr>';
         }
         if (!empty($messages)) {
             $html .= '</table><br /><table cellspacing="0" width="100%" class="linedRow">';
         }
     }
     $i = 0;
     try {
         $tasks = Nag::listTasks(array('tasklists' => isset($this->_params['show_tasklists']) ? $this->_params['show_tasklists'] : array_keys(Nag::listTasklists(false, Horde_Perms::READ)), 'completed' => empty($this->_params['show_completed']) ? Nag::VIEW_INCOMPLETE : Nag::VIEW_ALL, 'include_history' => false));
     } catch (Nag_Exception $e) {
         return '<em>' . htmlspecialchars($e->getMessage()) . '</em>';
     }
     $tasks->reset();
     while ($task = $tasks->each()) {
         $due = $task->due ? $task->getNextDue() : null;
         // Only print tasks due in the past if the show_overdue flag is on.
         if ($due && $due->before($_SERVER['REQUEST_TIME']) && empty($this->_params['show_overdue'])) {
             continue;
         }
         if ($task->completed) {
             $class = 'closed';
         } elseif ($due && $due->before($_SERVER['REQUEST_TIME'])) {
             $class = 'overdue';
         } else {
             $class = '';
         }
         $style = ' style="background-color:' . $task->backgroundColor() . ';color:' . $task->foregroundColor() . '"';
         $html .= '<tr class="' . $class . '">';
         if (!empty($this->_params['show_actions'])) {
             $taskurl = Horde::url('task.php', true)->add(array('task' => $task->id, 'tasklist' => $task->tasklist, 'url' => Horde::selfUrl(true)));
             $label = sprintf(_("Edit \"%s\""), $task->name);
             $html .= '<td width="1%"' . $style . '>' . $taskurl->copy()->add('actionID', 'modify_task')->link() . Horde::img('edit-sidebar-' . substr($task->foregroundColor(), 1) . '.png', $label) . '</a></td>';
             if ($task->completed) {
                 $html .= '<td width="1%">' . $style . '' . Horde::img('checked.png', _("Completed")) . '</td>';
             } else {
                 $label = sprintf(_("Complete \"%s\""), $task->name);
                 $html .= '<td width="1%"' . $style . '>' . Horde::url($conf['urls']['pretty'] == 'rewrite' ? 't/complete' : 'task/complete.php')->add(array('task' => $task->id, 'tasklist' => $task->tasklist, 'url' => Horde::selfUrl(true)))->link() . Horde::img('unchecked.png', $label) . '</a></td>';
             }
         }
         if (!empty($this->_params['show_pri'])) {
             $html .= '<td align="center"' . $style . '>&nbsp;' . Nag::formatPriority($task->priority) . '&nbsp;</td>';
         }
         if (!empty($this->_params['show_tasklist'])) {
             $html .= '<td width="1%" class="nowrap"' . $style . '>' . htmlspecialchars(Nag::getLabel($GLOBALS['injector']->getInstance('Horde_Core_Factory_Share')->create()->getShare($task->tasklist))) . '&nbsp;</td>';
         }
         $html .= '<td' . $style . '>';
         $viewurl = Horde::url('view.php', true)->add(array('task' => $task->id, 'tasklist' => $task->tasklist));
         $html .= $task->treeIcons() . $viewurl->link(array('title' => $task->desc, 'style' => 'color:' . $task->foregroundColor())) . (!empty($task->name) ? htmlspecialchars($task->name) : _("[none]")) . '</a>';
         if ($due && empty($task->completed) && !empty($this->_params['show_due'])) {
             $html .= ' (' . $due->strftime($prefs->getValue('date_format')) . ')';
         }
         $html .= '</td>';
         $html .= "</tr>\n";
     }
     if (empty($html)) {
         return '<em>' . _("No tasks to display") . '</em>';
     }
     return '<table cellspacing="0" width="100%" class="linedRow">' . $html . '</table>';
 }
コード例 #24
0
ファイル: Html.php プロジェクト: jubinpatel/horde
 /**
  * Generate a link URL tag.
  *
  * @param string $node_id  The node ID.
  *
  * @return string  The link tag.
  */
 protected function _generateUrlTag($node_id)
 {
     return Horde::selfUrl()->add(Horde_Tree::TOGGLE . $this->_tree->instance, $node_id)->link();
 }
コード例 #25
0
ファイル: activesync.php プロジェクト: horde/horde
            $device = $state->loadDeviceInfo($deviceID);
            $device->blocked = false;
            $device->save(false);
            break;
    }
}
switch (Horde_Util::getPost('searchBy')) {
    case 'username':
        $devices = $state->listDevices(Horde_Util::getPost('searchInput'));
        break;
    default:
        $devices = $state->listDevices(null, array(Horde_Util::getPost('searchBy') => Horde_Util::getPost('searchInput')));
}
$view = new Horde_View(array('templatePath' => array(HORDE_TEMPLATES . '/admin', HORDE_TEMPLATES . '/activesync')));
$view->addHelper('Tag');
$selfurl = Horde::selfUrl();
$view->reset = $selfurl->copy()->add('reset', 1);
$devs = array();
$js = array();
$collections = array();
foreach (array_values($devices) as $device) {
    $dev = $state->loadDeviceInfo($device['device_id'], $device['device_user']);
    try {
        $dev = $GLOBALS['injector']->getInstance('Horde_Core_Hooks')->callHook('activesync_device_modify', 'horde', array($dev));
    } catch (Horde_Exception_HookNotSet $e) {
    }
    $syncCache = new Horde_ActiveSync_SyncCache($state, $dev->id, $dev->user, $injector->getInstance('Horde_Log_Logger'));
    $dev->hbinterval = $syncCache->hbinterval ? $syncCache->hbinterval : ($syncCache->wait ? $syncCache->wait * 60 : _("Unavailable"));
    $js[$dev->id . ':' . $dev->user] = array('id' => $dev->id, 'user' => $dev->user);
    $devs[] = $dev;
    $collection = array();
コード例 #26
0
ファイル: login.php プロジェクト: Artea/freebeer
            }
            require HORDE_TEMPLATES . '/index/frames_index.inc';
            exit;
        }
    }
}
if (Auth::isAuthenticated()) {
    if ($browser->isMobile()) {
        require HORDE_BASE . '/services/portal/mobile.php';
    } else {
        require HORDE_BASE . '/services/portal/index.php';
    }
    exit;
}
$login_screen = $auth->_getLoginScreen();
if (Util::removeParameter($login_screen, array('url', 'nocache')) != Util::removeParameter(Horde::url(Horde::selfUrl(), true), array('url', 'nocache'))) {
    if ($url_param) {
        $login_screen = Util::addParameter($login_screen, 'url', $url_param);
    }
    $login_screen = Util::addParameter($login_screen, 'frameset', Util::getFormData('frameset'));
    header('Location: ' . $login_screen);
    exit;
}
if ($browser->isMobile()) {
    require_once HORDE_LIBS . 'Horde/Mobile.php';
    require HORDE_TEMPLATES . '/login/mobile.inc';
    exit;
}
/* Build the <select> widget containing the available languages. */
if (!$prefs->isLocked('language')) {
    $_SESSION['horde_language'] = NLS::select();
コード例 #27
0
ファイル: comics.php プロジェクト: jubinpatel/horde
        if (count($klutz_driver->listDates($next_month))) {
            $next_month_url = $url->copy()->add('date', $next_month);
        }
        $page_output->header(array('title' => $title));
        require KLUTZ_TEMPLATES . '/comics/nav_bar.inc';
        if (!empty($imageApp)) {
            $page_output->addScriptFile('popup.js', 'horde');
        }
        $name = $klutz->getProperty($index, 'name');
        $author = $klutz->getProperty($index, 'author');
        $homepage = $klutz->getProperty($index, 'homepage');
        $title = sprintf(_("%s by %s"), $name, $author);
        foreach (array_reverse($klutz_driver->listDates($date)) as $date) {
            if ($klutz_driver->imageExists($index, $date)) {
                $size = $klutz_driver->imageSize($index, $date);
                $url = Horde::selfUrl(false, false)->add(array('actionID' => 'image', 'date' => $date, 'index' => $index));
                // We have a comic, build a link to save to a gallery.
                if (!empty($imageApp)) {
                    $popupUrl = Horde::url('savecomic.php')->add(array('date' => $date, 'index' => $index));
                    $saveImgLink = Horde::link('#', _("Save Comic to Gallery"), null, null, 'popup(\'' . $popupUrl . '\', 450, 290); return false;') . '<img src="' . $registry->get('icon', $imageApp) . '" alt="' . _("Save Comic to Gallery") . '" /></a>';
                }
                require KLUTZ_TEMPLATES . '/comics/comic.inc';
            } elseif ($klutz->getProperty($index, 'days') == 'random' || !in_array(Horde_String::lower(date('D', $date)), $klutz->getProperty($index, 'days'))) {
                continue;
            } else {
                require KLUTZ_TEMPLATES . '/comics/missing.inc';
            }
        }
        require KLUTZ_TEMPLATES . '/comics/nav_bar.inc';
        break;
}
コード例 #28
0
ファイル: index.php プロジェクト: horde/horde
 * did not receive this file, see http://www.horde.org/licenses/bsdl.php.
 *
 * @author Chuck Hagenbuch <*****@*****.**>
 */
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('whups', array('permission' => array('whups:admin', Horde_Perms::EDIT)));
Whups::addTopbarSearch();
// Set up the page config vars.
$showExtraForm = null;
// Setup vars with all relevant info.
$vars = Horde_Variables::getDefaultVariables();
if (!$vars->exists('action')) {
    $vars->set('action', 'queue');
}
// Admin actions.
$adminurl = Horde::selfUrl(false, false);
$tabs = new Horde_Core_Ui_Tabs('action', $vars);
$tabs->addTab(_("_Edit Queues"), $adminurl, 'queue');
$tabs->addTab(_("Edit _Types"), $adminurl, 'type');
$tabs->addTab(_("Queue/Type Matri_x"), $adminurl, 'mtmatrix');
$tabs->addTab(_("Sen_d Reminders"), $adminurl, 'reminders');
$renderer = new Horde_Form_Renderer();
// start the page
function _open($isopened = false)
{
    global $notification, $vars;
    static $opened;
    if ($isopened) {
        return $opened;
    }
    if (is_null($opened)) {
コード例 #29
0
ファイル: Api.php プロジェクト: jubinpatel/horde
 /**
  * @TODO
  *
  * @param <type> $name
  * @param <type> $params
  * @return string
  */
 public static function getTableData($name, $params)
 {
     switch ($name) {
         case 'hours':
             $time_data = $GLOBALS['injector']->getInstance('Hermes_Driver')->getHours($params);
             $subtotal_column = null;
             if ($search_mode = $GLOBALS['session']->get('hermes', 'search_mode')) {
                 switch ($search_mode) {
                     case 'date':
                         $subtotal_column = 'date';
                         break;
                     case 'employee':
                         $subtotal_column = 'employee';
                         break;
                     case 'client':
                         $subtotal_column = '_client_name';
                         break;
                     case 'jobtype':
                         $subtotal_column = '_type_name';
                         break;
                     case 'costobject':
                         $subtotal_column = '_costobject_name';
                         break;
                 }
                 $clients = Hermes::listClients();
                 $column = array();
                 foreach ($time_data as $key => $row) {
                     if (empty($row['client'])) {
                         $time_data[$key]['_client_name'] = _("no client");
                     } elseif (isset($clients[$row['client']])) {
                         $time_data[$key]['_client_name'] = $clients[$row['client']];
                     } else {
                         $time_data[$key]['_client_name'] = $row['client'];
                     }
                     if (!is_null($subtotal_column)) {
                         $column[$key] = $time_data[$key][$subtotal_column] . $time_data[$key]['date'];
                     }
                 }
                 if (!is_null($subtotal_column)) {
                     array_multisort($column, SORT_ASC, $time_data);
                 }
             }
             $total_hours = 0.0;
             $total_billable_hours = 0.0;
             $subtotal_hours = 0.0;
             $subtotal_billable_hours = 0.0;
             $subtotal_control = null;
             $result['data'] = array();
             foreach ($time_data as $k => $vals) {
                 // Initialize subtotal break value.
                 if (is_null($subtotal_control) && isset($vals[$subtotal_column])) {
                     $subtotal_control = $vals[$subtotal_column];
                 }
                 if (!empty($subtotal_column) && $vals[$subtotal_column] != $subtotal_control) {
                     Hermes_Api::renderSubtotals($result['data'], $subtotal_hours, $subtotal_billable_hours, $subtotal_column == 'date' ? strftime("%m/%d/%Y", $subtotal_control) : $subtotal_control);
                     $subtotal_hours = 0.0;
                     $subtotal_billable_hours = 0.0;
                     $subtotal_control = $vals[$subtotal_column];
                 }
                 // Set up edit/delete icons.
                 if (Hermes::canEditTimeslice($vals['id'])) {
                     $edit_link = Horde::url('entry.php', true)->add(array('id' => $vals['id'], 'url' => Horde::selfUrl(true, true, true)));
                     $vals['icons'] = Horde::link($edit_link, _("Edit Entry")) . Horde::img('edit.png', _("Edit Entry"), '') . '</a>';
                     if (empty($vals['submitted'])) {
                         $vals['checkbox'] = '<input type="checkbox" name="item[' . htmlspecialchars($vals['id']) . ']" checked="checked" />';
                     } else {
                         $vals['checkbox'] = '';
                     }
                 }
                 // Add to totals.
                 $subtotal_hours += (double) $vals['hours'];
                 $total_hours += (double) $vals['hours'];
                 if ($vals['billable']) {
                     $subtotal_billable_hours += (double) $vals['hours'];
                     $total_billable_hours += (double) $vals['hours'];
                 }
                 // Localize hours.
                 $vals['hours'] = sprintf('%.02f', $vals['hours']);
                 $result['data'][] = $vals;
             }
             if (!empty($subtotal_column)) {
                 Hermes_Api::renderSubtotals($result['data'], $subtotal_hours, $subtotal_billable_hours, $subtotal_column == 'date' ? strftime("%m/%d/%Y", $subtotal_control) : $subtotal_control);
             }
             // Avoid a divide by zero.
             if ($total_hours == 0.0) {
                 $billable_pct = 0.0;
             } else {
                 $billable_pct = round($total_billable_hours / $total_hours * 100.0);
             }
             $descr = _("Billable Hours") . ' (' . $billable_pct . '%)';
             $result['footer'] = array();
             $result['footer'][] = array('hours' => sprintf('%.02f', $total_billable_hours), 'description' => $descr);
             $descr = _("Non-billable Hours") . ' (' . (100.0 - $billable_pct) . '%)';
             $result['footer'][] = array('hours' => sprintf('%.02f', $total_hours - $total_billable_hours), 'description' => $descr);
             $result['footer'][] = array('hours' => sprintf('%.02f', $total_hours), 'description' => _("Total Hours"), 'approval' => '<div id="approval">' . _("Approved By:") . ' ________________________________________ ' . '&nbsp;</div>');
             break;
     }
     return $result;
 }
コード例 #30
0
ファイル: Application.php プロジェクト: raz0rsdge/horde
 /**
  * Adds additional items to the sidebar.
  *
  * @param Horde_View_Sidebar $sidebar  The sidebar object.
  */
 public function sidebar($sidebar)
 {
     /* Let authenticated users create new galleries. */
     if ($GLOBALS['registry']->isAdmin() || !$GLOBALS['injector']->getInstance('Horde_Perms')->exists('ansel') && $GLOBALS['registry']->getAuth() || $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('ansel', $GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
         $sidebar->addNewButton(_("_New Gallery"), Horde::url('gallery.php')->add('url', Horde::selfUrl(true, false, true))->add('actionID', 'add'));
     }
 }