url() публичный статический Метод

If a full URL is requested, all parameter separators get converted to "&", otherwise to "&".
public static url ( mixed $uri, boolean $full = false, mixed $opts = [] ) : Horde_Url
$uri mixed The URI to be modified (either a string or any object with a __toString() function).
$full boolean Generate a full (http://server/path/) URL.
$opts mixed Additional options. If a string/integer, it is taken to be the 'append_session' option. If an array, one of the following: - app: (string) Use this app for the webroot. DEFAULT: current application - append_session: (integer) 0 = only if needed [DEFAULT], 1 = always, -1 = never. - force_ssl: (boolean) Ignore $conf['use_ssl'] and force creation of a SSL URL? DEFAULT: false
Результат Horde_Url The URL with the session id appended (if needed).
Пример #1
0
 /**
  * Sends a message to an email address supposed to be added to the
  * identity.
  *
  * A message is send to this address containing a time-sensitive link to
  * confirm that the address really belongs to that user.
  *
  * @param integer $id       The identity's ID.
  * @param string $old_addr  The old From: address.
  *
  * @throws Horde_Mime_Exception
  */
 public function verifyIdentity($id, $old_addr)
 {
     global $injector, $notification, $registry;
     $hash = strval(new Horde_Support_Randomid());
     $pref = $this->_confirmEmail();
     $pref[$hash] = $this->get($id);
     $pref[$hash][self::EXPIRE] = time() + self::EXPIRE_SECS;
     $this->_confirmEmail($pref);
     $new_addr = $this->getValue($this->_prefnames['from_addr'], $id);
     $confirm = Horde::url($registry->getServiceLink('emailconfirm')->add('h', $hash)->setRaw(true), true);
     $message = sprintf(Horde_Core_Translation::t("You have requested to add the email address \"%s\" to the list of your personal email addresses.\n\nGo to the following link to confirm that this is really your address:\n%s\n\nIf you don't know what this message means, you can delete it."), $new_addr, $confirm);
     $msg_headers = new Horde_Mime_Headers();
     $msg_headers->addHeaderOb(Horde_Mime_Headers_MessageId::create());
     $msg_headers->addHeaderOb(Horde_Mime_Headers_UserAgent::create());
     $msg_headers->addHeaderOb(Horde_Mime_Headers_Date::create());
     $msg_headers->addHeader('To', $new_addr);
     $msg_headers->addHeader('From', $old_addr);
     $msg_headers->addHeader('Subject', Horde_Core_Translation::t("Confirm new email address"));
     $body = new Horde_Mime_Part();
     $body->setType('text/plain');
     $body->setContents(Horde_String::wrap($message, 76));
     $body->setCharset('UTF-8');
     $body->send($new_addr, $msg_headers, $injector->getInstance('Horde_Mail'));
     $notification->push(sprintf(Horde_Core_Translation::t("A message has been sent to \"%s\" to verify that this is really your address. The new email address is activated as soon as you confirm this message."), $new_addr), 'horde.message');
 }
Пример #2
0
 public function processRequest(Horde_Controller_Request $request, Horde_Controller_Response $response)
 {
     $id = Horde_Util::getFormData('bookmark');
     $gateway = $this->getInjector()->getInstance('Trean_Bookmarks');
     $notification = $this->getInjector()->getInstance('Horde_Notification');
     try {
         $bookmark = $gateway->getBookmark($id);
         $old_url = $bookmark->url;
         $bookmark->url = Horde_Util::getFormData('bookmark_url');
         $bookmark->title = Horde_Util::getFormData('bookmark_title');
         $bookmark->description = Horde_Util::getFormData('bookmark_description');
         $bookmark->tags = Horde_Util::getFormData('treanBookmarkTags');
         if ($old_url != $bookmark->url) {
             $bookmark->http_status = '';
         }
         $bookmark->save();
         $result = array('data' => 'saved');
     } catch (Horde_Exception $e) {
         $notification->push(sprintf(_("There was an error saving the bookmark: %s"), $e->getMessage()), 'horde.error');
         $result = array('error' => $e->getMessage());
     }
     if (Horde_Util::getFormData('format') == 'json') {
         $response->setContentType('application/json');
         $response->setBody(json_encode($result));
     } else {
         $response->setRedirectUrl(Horde_Util::getFormData('url', Horde::url('browse.php', true)));
     }
 }
Пример #3
0
 /**
  * Renders this page in content mode.
  *
  * @return string  The page content.
  * @throws Wicked_Exception
  */
 public function content()
 {
     global $wicked;
     $days = (int) Horde_Util::getGet('days', 3);
     $summaries = $wicked->getRecentChanges($days);
     if (count($summaries) < 10) {
         $summaries = $wicked->mostRecent(10);
     }
     $bydate = array();
     $changes = array();
     foreach ($summaries as $page) {
         $page = new Wicked_Page_StandardPage($page);
         $createDate = $page->versionCreated();
         $tm = localtime($createDate, true);
         $createDate = mktime(0, 0, 0, $tm['tm_mon'], $tm['tm_mday'], $tm['tm_year'], $tm['tm_isdst']);
         $version_url = $page->pageUrl()->add('version', $page->version());
         $diff_url = Horde::url('diff.php')->add(array('page' => $page->pageName(), 'v1' => '?', 'v2' => $page->version()));
         $diff_alt = sprintf(_("Show changes for %s"), $page->version());
         $diff_img = Horde::img('diff.png', $diff_alt);
         $pageInfo = array('author' => $page->author(), 'name' => $page->pageName(), 'url' => $page->pageUrl(), 'version' => $page->version(), 'version_url' => $version_url, 'version_alt' => sprintf(_("Show version %s"), $page->version()), 'diff_url' => $diff_url, 'diff_alt' => $diff_alt, 'diff_img' => $diff_img, 'created' => $page->formatVersionCreated(), 'change_log' => $page->changeLog());
         $bydate[$createDate][$page->versionCreated()][$page->version()] = $pageInfo;
     }
     krsort($bydate);
     foreach ($bydate as $bysecond) {
         $day = array();
         krsort($bysecond);
         foreach ($bysecond as $pageList) {
             krsort($pageList);
             $day = array_merge($day, array_values($pageList));
         }
         $changes[] = array('date' => $day[0]['created'], 'pages' => $day);
     }
     return $changes;
 }
Пример #4
0
 /**
  */
 public function menu($menu)
 {
     $scope = Horde_Util::getGet('scope', 'agora');
     /* Agora Home. */
     $url = Horde::url('forums.php')->add('scope', $scope);
     $menu->add($url, _("_Forums"), 'forums.png', null, null, null, dirname($_SERVER['PHP_SELF']) == $GLOBALS['registry']->get('webroot') && basename($_SERVER['PHP_SELF']) == 'index.php' ? 'current' : null);
     /* Thread list, if applicable. */
     if (isset($GLOBALS['forum_id'])) {
         $menu->add(Agora::setAgoraId($GLOBALS['forum_id'], null, Horde::url('threads.php')), _("_Threads"), 'threads.png');
         if ($scope == 'agora' && $GLOBALS['registry']->getAuth()) {
             $menu->add(Agora::setAgoraId($GLOBALS['forum_id'], null, Horde::url('messages/edit.php')), _("New Thread"), 'newmessage.png');
         }
     }
     if ($scope == 'agora' && Agora_Driver::hasPermission(Horde_Perms::DELETE, 0, $scope)) {
         $menu->add(Horde::url('editforum.php'), _("_New Forum"), 'newforum.png', null, null, null, Horde_Util::getFormData('agora') ? '__noselection' : null);
     }
     if (Agora_Driver::hasPermission(Horde_Perms::DELETE, 0, $scope)) {
         $url = Horde::url('moderate.php')->add('scope', $scope);
         $menu->add($url, _("_Moderate"), 'moderate.png');
     }
     if ($GLOBALS['registry']->isAdmin()) {
         $menu->add(Horde::url('moderators.php'), _("_Moderators"), 'hot.png');
     }
     $url = Horde::url('search.php')->add('scope', $scope);
     $menu->add($url, _("_Search"), 'search.png');
 }
Пример #5
0
 /**
  * Constructs a correctly-pathed tag to an image.
  *
  * @param mixed $src   The image file (either a string or a
  *                     Horde_Themes_Image object).
  * @param array $opts  Additional options:
  *   - alt: (string) Text describing the image.
  *   - attr: (mixed) Any additional attributes for the image tag. Can be a
  *           pre-built string or an array of key/value pairs that will be
  *           assembled and html-encoded.
  *   - fullsrc: (boolean) TODO
  *   - imgopts: (array) TODO
  *
  * @return string  The full image tag.
  */
 public static function tag($src, array $opts = array())
 {
     global $browser, $conf;
     $opts = array_merge(array('alt' => '', 'attr' => array(), 'fullsrc' => false, 'imgopts' => array()), $opts);
     /* If browser does not support images, simply return the ALT text. */
     if (!$browser->hasFeature('images')) {
         return htmlspecialchars($opts['alt']);
     }
     $xml = new SimpleXMLElement('<root><img ' . (is_array($opts['attr']) ? '' : $opts['attr']) . '/></root>');
     $img = $xml->img;
     if (is_array($opts['attr'])) {
         foreach ($opts['attr'] as $key => $val) {
             $img->addAttribute($key, $val);
         }
     }
     if (strlen($opts['alt'])) {
         $img->addAttribute('alt', $opts['alt']);
     }
     /* If no directory has been specified, get it from the registry. */
     if (!$src instanceof Horde_Themes_Image && substr($src, 0, 1) != '/') {
         $src = Horde_Themes::img($src, $opts['imgopts']);
     }
     if (empty($conf['nobase64_img'])) {
         $src = self::base64ImgData($src);
     }
     if ($opts['fullsrc'] && substr($src, 0, 10) != 'data:image') {
         $src = Horde::url($src, true, array('append_session' => -1));
     }
     $img->addAttribute('src', $src);
     return $img->asXML();
 }
Пример #6
0
    public function html($active = true)
    {
        if (!$this->contact) {
            echo '<h3>' . _("The requested contact was not found.") . '</h3>';
            return;
        }
        if (!$this->contact->hasPermission(Horde_Perms::DELETE)) {
            if (!$this->contact->hasPermission(Horde_Perms::READ)) {
                echo '<h3>' . _("You do not have permission to view this contact.") . '</h3>';
                return;
            } else {
                echo '<h3>' . _("You only have permission to view this contact.") . '</h3>';
                return;
            }
        }
        echo '<div id="DeleteContact"' . ($active ? '' : ' style="display:none"') . '>';
        ?>
        <form action="<?php 
        echo Horde::url('delete.php');
        ?>
" method="post">
        <?php 
        echo Horde_Util::formInput();
        ?>
        <input type="hidden" name="url" value="<?php 
        echo htmlspecialchars(Horde_Util::getFormData('url'));
        ?>
" />
        <input type="hidden" name="source" value="<?php 
        echo htmlspecialchars($this->contact->driver->getName());
        ?>
" />
        <input type="hidden" name="key" value="<?php 
        echo htmlspecialchars($this->contact->getValue('__key'));
        ?>
" />
        <div class="headerbox" style="padding: 8px">
         <p><?php 
        echo _("Permanently delete this contact?");
        ?>
</p>
         <input type="submit" class="horde-delete" name="delete" value="<?php 
        echo _("Delete");
        ?>
" />
        </div>
        </form>
        </div>
        <?php 
        if ($active && $GLOBALS['browser']->hasFeature('dom')) {
            if ($this->contact->hasPermission(Horde_Perms::READ)) {
                $view = new Turba_View_Contact($this->contact);
                $view->html(false);
            }
            if ($this->contact->hasPermission(Horde_Perms::EDIT)) {
                $delete = new Turba_View_EditContact($this->contact);
                $delete->html(false);
            }
        }
    }
Пример #7
0
 protected function _hours()
 {
     $hours_html = '';
     $dayWidth = round(100 / $this->_days);
     $week = $this->_start->weekOfYear();
     $span = (7 - $week) % 7 + 1;
     $span_left = $this->_days;
     $t = new Horde_Date($this->_start);
     while ($span_left > 0) {
         $span_left -= $span;
         $week_label = Horde::url('#')->link(array('onclick' => 'return switchDateView(\'Week\',' . $t->dateString() . ');')) . "Week" . ' ' . $week . '</a>';
         $hours_html .= sprintf('<th colspan="%d" width="%s%%">%s</th>', $span, $dayWidth, $week_label);
         $week++;
         $t->mday += 7;
         $span = min($span_left, 7);
     }
     $hours_html .= '</tr><tr><td width="100" class="label">&nbsp;</td>';
     for ($i = 0; $i < $this->_days; $i++) {
         $t = new Horde_Date(array('month' => $this->_start->month, 'mday' => $this->_start->mday + $i, 'year' => $this->_start->year));
         $day_label = Horde::url('#')->link(array('onclick' => 'return switchDateView(\'Day\',' . $t->dateString() . ');')) . ($i + 1) . '.</a>';
         $hours_html .= sprintf('<th width="%s%%">%s</th>', $dayWidth, $day_label);
     }
     for ($i = 0; $i < $this->_days; $i++) {
         $start = new Horde_Date(array('hour' => $this->_startHour, 'month' => $this->_start->month, 'mday' => $this->_start->mday + $i, 'year' => $this->_start->year));
         $end = new Horde_Date(array('hour' => $this->_endHour, 'month' => $this->_start->month, 'mday' => $this->_start->mday + $i, 'year' => $this->_start->year));
         $this->_timeBlocks[] = array($start, $end);
     }
     return $hours_html;
 }
Пример #8
0
 /**
  * Add base javascript variables to the page.
  */
 protected function _addBaseVars()
 {
     global $conf, $injector, $prefs, $registry;
     $auth_name = $registry->getAuth();
     $has_tasks = Kronolith::hasApiPermission('tasks');
     $identity = $injector->getInstance('Horde_Core_Factory_Identity')->create();
     $app_urls = $js_vars = array();
     if (isset($conf['menu']['apps']) && is_array($conf['menu']['apps'])) {
         foreach ($conf['menu']['apps'] as $app) {
             $app_urls[$app] = strval(Horde::url($registry->getInitialPage($app), true));
         }
     }
     /* Variables used in core javascript files. */
     $js_vars['conf'] = array_filter(array('URI_CALENDAR_EXPORT' => str_replace(array('%23', '%2523', '%7B', '%257B', '%7D', '%257D'), array('#', '#', '{', '{', '}', '}'), strval($registry->downloadUrl('#{calendar}.ics', array('actionID' => 'export', 'all_events' => 1, 'exportID' => Horde_Data::EXPORT_ICALENDAR, 'exportCal' => 'internal_#{calendar}'))->setRaw(true))), 'URI_RESOURCE_EXPORT' => str_replace(array('%23', '%2523', '%7B', '%257B', '%7D', '%257D'), array('#', '#', '{', '{', '}', '}'), strval($registry->downloadUrl('#{calendar}.ics', array('actionID' => 'export', 'all_events' => 1, 'exportID' => Horde_Data::EXPORT_ICALENDAR, 'exportCal' => 'resource_#{calendar}'))->setRaw(true))), 'URI_EVENT_EXPORT' => str_replace(array('%23', '%7B', '%7D'), array('#', '{', '}'), Horde::url('event.php', true)->add(array('view' => 'ExportEvent', 'eventID' => '#{id}', 'calendar' => '#{calendar}', 'type' => '#{type}'))), 'images' => array('alarm' => strval(Horde_Themes::img('alarm-fff.png')), 'attendees' => strval(Horde_Themes::img('attendees-fff.png')), 'exception' => strval(Horde_Themes::img('exception-fff.png')), 'new_event' => strval(Horde_Themes::img('new.png')), 'new_task' => strval(Horde_Themes::img('new_task.png')), 'recur' => strval(Horde_Themes::img('recur-fff.png'))), 'new_event' => $injector->getInstance('Kronolith_View_Sidebar')->newLink . $injector->getInstance('Kronolith_View_Sidebar')->newText . '</a>', 'new_task' => $injector->getInstance('Kronolith_View_SidebarTasks')->newLink . $injector->getInstance('Kronolith_View_SidebarTasks')->newText . '</a>', 'user' => $registry->convertUsername($auth_name, false), 'name' => $identity->getName(), 'email' => strval($identity->getDefaultFromAddress()), 'prefs_url' => strval($registry->getServiceLink('prefs', 'kronolith')->setRaw(true)), 'app_urls' => $app_urls, 'name' => $registry->get('name'), 'has_tasks' => intval($has_tasks), 'has_resources' => intval(!empty($conf['resource']['driver'])), 'login_view' => $prefs->getValue('defaultview') == 'workweek' ? 'week' : $prefs->getValue('defaultview'), 'default_calendar' => 'internal|' . Kronolith::getDefaultCalendar(Horde_Perms::EDIT), 'max_events' => intval($prefs->getValue('max_events')), 'date_format' => Horde_Core_Script_Package_Datejs::translateFormat(Horde_Nls::getLangInfo(D_FMT)), 'time_format' => $prefs->getValue('twentyFour') ? 'HH:mm' : 'hh:mm tt', 'import_file' => Horde_Data::IMPORT_FILE, 'import_url' => Horde_Data::IMPORT_URL, 'show_time' => Kronolith::viewShowTime(), 'default_alarm' => intval($prefs->getValue('default_alarm')), 'status' => array('cancelled' => Kronolith::STATUS_CANCELLED, 'confirmed' => Kronolith::STATUS_CONFIRMED, 'free' => Kronolith::STATUS_FREE, 'tentative' => Kronolith::STATUS_TENTATIVE), 'recur' => array(Horde_Date_Recurrence::RECUR_NONE => 'None', Horde_Date_Recurrence::RECUR_DAILY => 'Daily', Horde_Date_Recurrence::RECUR_WEEKLY => 'Weekly', Horde_Date_Recurrence::RECUR_MONTHLY_DATE => 'Monthly', Horde_Date_Recurrence::RECUR_MONTHLY_WEEKDAY => 'Monthly', Horde_Date_Recurrence::RECUR_YEARLY_DATE => 'Yearly', Horde_Date_Recurrence::RECUR_YEARLY_DAY => 'Yearly', Horde_Date_Recurrence::RECUR_YEARLY_WEEKDAY => 'Yearly'), 'perms' => array('all' => Horde_Perms::ALL, 'show' => Horde_Perms::SHOW, 'read' => Horde_Perms::READ, 'edit' => Horde_Perms::EDIT, 'delete' => Horde_Perms::DELETE, 'delegate' => Kronolith::PERMS_DELEGATE), 'tasks' => $has_tasks ? $registry->tasks->ajaxDefaults() : null));
     /* Make sure this value is not optimized out by array_filter(). */
     $js_vars['conf']['week_start'] = intval($prefs->getValue('week_start_monday'));
     /* Gettext strings. */
     $js_vars['text'] = array('alarm' => _("Alarm:"), 'alerts' => _("Notifications"), 'allday' => _("All day"), 'delete_calendar' => _("Are you sure you want to delete this calendar and all the events in it?"), 'delete_tasklist' => _("Are you sure you want to delete this task list and all the tasks in it?"), 'external_category' => _("Other events"), 'fix_form_values' => _("Please enter correct values in the form first."), 'geocode_error' => _("Unable to locate requested address"), 'hidelog' => _("Hide Notifications"), 'import_warning' => _("Importing calendar data. This may take a while..."), 'more' => _("more..."), 'no_assignee' => _("None"), 'no_calendar_title' => _("The calendar title must not be empty."), 'no_parent' => _("No parent task"), 'no_tasklist_title' => _("The task list title must not be empty."), 'no_url' => _("You must specify a URL."), 'prefs' => _("Preferences"), 'searching' => sprintf(_("Events matching \"%s\""), '#{term}'), 'shared' => _("Shared"), 'tasks' => _("Tasks"), 'unknown_resource' => _("Unknown resource."), 'wrong_auth' => _("The authentication information you specified wasn't accepted."), 'wrong_date_format' => sprintf(_("You used an unknown date format \"%s\". Please try something like \"%s\"."), '#{wrong}', '#{right}'), 'wrong_time_format' => sprintf(_("You used an unknown time format \"%s\". Please try something like \"%s\"."), '#{wrong}', '#{right}'));
     for ($i = 1; $i <= 12; ++$i) {
         $js_vars['text']['month'][$i - 1] = Horde_Nls::getLangInfo(constant('MON_' . $i));
     }
     for ($i = 1; $i <= 7; ++$i) {
         $js_vars['text']['weekday'][$i] = Horde_Nls::getLangInfo(constant('DAY_' . $i));
     }
     foreach (array_diff(array_keys($js_vars['conf']['recur']), array(Horde_Date_Recurrence::RECUR_NONE)) as $recurType) {
         $js_vars['text']['recur'][$recurType] = Kronolith::recurToString($recurType);
     }
     $js_vars['text']['recur']['exception'] = _("Exception");
     // Maps
     $js_vars['conf']['maps'] = $conf['maps'];
     return $js_vars;
 }
Пример #9
0
 /**
  * @throws Kronolith_Exception
  */
 public function execute()
 {
     if ($this->_vars->get('submitbutton') == _("Cancel")) {
         Horde::url($GLOBALS['prefs']->getValue('defaultview') . '.php', true)->redirect();
     }
     return Kronolith::unsubscribeRemoteCalendar($this->_vars->get('url'));
 }
Пример #10
0
 /**
  * @throws Turba_Exception
  */
 public function execute()
 {
     // If cancel was clicked, return false.
     if ($this->_vars->get('submitbutton') == _("Cancel")) {
         Horde::url('', true)->redirect();
     }
     if (!$GLOBALS['registry']->getAuth() || $this->_addressbook->get('owner') != $GLOBALS['registry']->getAuth()) {
         throw new Turba_Exception(_("You do not have permissions to delete this address book."));
     }
     $driver = $GLOBALS['injector']->getInstance('Turba_Factory_Driver')->create($this->_addressbook->getName());
     if ($driver->hasCapability('delete_all')) {
         try {
             $driver->deleteAll();
         } catch (Turba_Exception $e) {
             Horde::log($e->getMessage(), 'ERR');
             throw $e;
         }
     }
     // Address book successfully deleted from backend, remove the share.
     try {
         $GLOBALS['injector']->getInstance('Turba_Shares')->removeShare($this->_addressbook);
     } catch (Horde_Share_Exception $e) {
         Horde::log($e->getMessage(), 'ERR');
         throw new Turba_Exception($e);
     }
     if ($GLOBALS['session']->get('turba', 'source') == Horde_Util::getFormData('deleteshare')) {
         $GLOBALS['session']->remove('turba', 'source');
     }
 }
Пример #11
0
 protected function _hours()
 {
     global $prefs;
     $hours_html = '';
     $dayWidth = round(100 / $this->_days);
     $span = floor(($this->_endHour - $this->_startHour) / 3);
     if (($this->_endHour - $this->_startHour) % 3) {
         $span++;
     }
     $date_format = $prefs->getValue('date_format');
     for ($i = 0; $i < $this->_days; $i++) {
         $t = new Horde_Date(array('month' => $this->_start->month, 'mday' => $this->_start->mday + $i, 'year' => $this->_start->year));
         $day_label = Horde::url('#')->link(array('onclick' => 'return switchDateView(\'Day\',' . $t->dateString() . ');')) . $t->strftime($date_format) . '</a>';
         $hours_html .= sprintf('<th colspan="%d" width="%s%%">%s</th>', $span, $dayWidth, $day_label);
     }
     $hours_html .= '</tr><tr><td width="100" class="label">&nbsp;</td>';
     $width = round(100 / ($span * $this->_days));
     for ($i = 0; $i < $this->_days; $i++) {
         for ($h = $this->_startHour; $h < $this->_endHour; $h += 3) {
             $start = new Horde_Date(array('hour' => $h, 'month' => $this->_start->month, 'mday' => $this->_start->mday + $i, 'year' => $this->_start->year));
             $end = new Horde_Date($start);
             $end->hour += 2;
             $end->min = 59;
             $this->_timeBlocks[] = array($start, $end);
             $hour = $start->strftime($prefs->getValue('twentyFour') ? '%H:00' : '%I:00');
             $hours_html .= sprintf('<th width="%d%%">%s</th>', $width, $hour);
         }
     }
     return $hours_html;
 }
Пример #12
0
 /**
  */
 protected function _handle(Horde_Variables $vars)
 {
     global $injector, $prefs;
     $faces = $injector->getInstance('Ansel_Faces');
     $image_id = intval($vars->image_id);
     $results = $faces->getImageFacesData($image_id);
     // Attempt to get faces from the picture if we don't already have
     // results, or if we were asked to explicitly try again.
     if (empty($results)) {
         $image = $injector->getInstance('Ansel_Storage')->getImage($image_id);
         $image->createView('screen', null, $prefs->getValue('watermark_auto') ? $prefs->getValue('watermark_text', '') : '');
         $results = $faces->getFromPicture($image_id, true);
     }
     if (empty($results)) {
         $results = new stdClass();
         $results->response = _("No faces found");
         return new Horde_Core_Ajax_Response($results);
     }
     $customurl = Horde::url('faces/custom.php');
     Horde::startBuffer();
     include ANSEL_TEMPLATES . '/faces/image.inc';
     $response = new stdClass();
     $response->response = Horde::endBuffer();
     return new Horde_Core_Ajax_Response($response);
 }
Пример #13
0
 /**
  */
 protected function _content()
 {
     try {
         $channels = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannels();
     } catch (Jonah_Exception $e) {
         $channels = array();
     }
     $html = '';
     foreach ($channels as $key => $channel) {
         /* Link for HTML delivery. */
         $url = Horde::url('delivery/html.php')->add('channel_id', $channel['channel_id']);
         $label = sprintf(_("\"%s\" stories in HTML"), $channel['channel_name']);
         $html .= '<tr><td width="140">' . Horde::img('story_marker.png') . ' ' . $url->link(array('title' => $label)) . htmlspecialchars($channel['channel_name']) . '</a></td>';
         $html .= '<td>' . ($channel['channel_updated'] ? date('M d, Y H:i', (int) $channel['channel_updated']) : '-') . '</td>';
         /* Link for feed delivery. */
         $url = Horde::url('delivery/rss.php', true, -1)->add('channel_id', $channel['channel_id']);
         $label = sprintf(_("RSS Feed of \"%s\""), $channel['channel_name']);
         $html .= '<td align="right" class="nowrap">' . $url->link(array('title' => $label)) . Horde::img('feed.png') . '</a> ';
     }
     if ($html) {
         return '<table cellspacing="0" width="100%" class="linedRow striped">' . $html . '</table>';
     } else {
         return '<p><em>' . _("No feeds are available.") . '</em></p>';
     }
 }
Пример #14
0
 /**
  * @throws Kronolith_Exception
  */
 public function execute()
 {
     if ($this->_vars->get('submitbutton') == _("Cancel")) {
         Horde::url($GLOBALS['prefs']->getValue('defaultview') . '.php', true)->redirect();
     }
     Kronolith::deleteShare($this->_calendar);
 }
Пример #15
0
 /**
  */
 protected function _create($mbox, $subject, $body)
 {
     global $notification, $registry;
     $list = str_replace(self::TASKLIST_EDIT, '', $mbox);
     /* Create a new iCalendar. */
     $vCal = new Horde_Icalendar();
     $vCal->setAttribute('PRODID', '-//The Horde Project//IMP ' . $registry->getVersion() . '//EN');
     $vCal->setAttribute('METHOD', 'PUBLISH');
     /* Create a new vTodo object using this message's contents. */
     $vTodo = Horde_Icalendar::newComponent('vtodo', $vCal);
     $vTodo->setAttribute('SUMMARY', $subject);
     $vTodo->setAttribute('DESCRIPTION', $body);
     $vTodo->setAttribute('PRIORITY', '3');
     /* Get the list of editable tasklists. */
     $lists = $this->getTasklists(true);
     /* Attempt to add the new vTodo item to the requested tasklist. */
     try {
         $res = $registry->call('tasks/import', array($vTodo, 'text/calendar', $list));
     } catch (Horde_Exception $e) {
         $notification->push($e);
         return;
     }
     if (!$res) {
         $notification->push(_("An unknown error occured while creating the new task."), 'horde.error');
     } elseif (!empty($lists)) {
         $name = '"' . htmlspecialchars($subject) . '"';
         /* Attempt to convert the object name into a hyperlink. */
         if ($registry->hasLink('tasks/show')) {
             $name = sprintf('<a href="%s">%s</a>', Horde::url($registry->link('tasks/show', array('uid' => $res))), $name);
         }
         $notification->push(sprintf(_("%s was successfully added to \"%s\"."), $name, htmlspecialchars($lists[$list]->get('name'))), 'horde.success', array('content.raw'));
     }
 }
Пример #16
0
 /**
  * Queues the user's submitted registration info for later admin approval.
  *
  * @param mixed $info  Reference to array of parameters to be passed
  *                     to hook.
  *
  * @throws Horde_Exception
  * @throws Horde_Mime_Exception
  */
 public function queueSignup(&$info)
 {
     /* @var $conf array */
     /* @var $injector Horde_Injector */
     /* @var $registry Horde_Registry */
     global $conf, $injector, $registry;
     // Perform any preprocessing if requested.
     $this->_preSignup($info);
     // If it's a unique username, go ahead and queue the request.
     $signup = $this->newSignup($info['user_name']);
     if (!empty($info['extra'])) {
         $signup->setData($info['extra']);
     }
     $signup->setData(array_merge($signup->getData(), array('dateReceived' => time(), 'password' => $info['password'])));
     $this->_queueSignup($signup);
     try {
         $injector->getInstance('Horde_Core_Hooks')->callHook('signup_queued', 'horde', array($info['user_name'], $info));
     } catch (Horde_Exception_HookNotSet $e) {
     }
     if (!empty($conf['signup']['email'])) {
         $link = Horde::url($registry->get('webroot', 'horde') . '/admin/signup_confirm.php', true, -1)->setRaw(true)->add(array('u' => $signup->getName(), 'h' => hash_hmac('sha1', $signup->getName(), $conf['secret_key'])));
         $message = sprintf(Horde_Core_Translation::t("A new account for the user \"%s\" has been requested through the signup form."), $signup->getName()) . "\n\n" . Horde_Core_Translation::t("Approve the account:") . "\n" . $link->copy()->add('a', 'approve') . "\n" . Horde_Core_Translation::t("Deny the account:") . "\n" . $link->copy()->add('a', 'deny');
         $mail = new Horde_Mime_Mail(array('body' => $message, 'Subject' => sprintf(Horde_Core_Translation::t("Account signup request for \"%s\""), $signup->getName()), 'To' => $conf['signup']['email'], 'From' => $conf['signup']['email']));
         $mail->send($injector->getInstance('Horde_Mail'));
     }
 }
Пример #17
0
 public function execute()
 {
     parent::execute();
     $this->getInfo($this->_vars, $info);
     $next_page = Horde::url('edit.php', true)->add(array('source' => $info['source'], 'original_source' => $info['original_source'], 'objectkeys' => $info['objectkeys'], 'url' => $info['url'], 'actionID' => 'groupedit'));
     $objectkey = array_search($info['source'] . ':' . $info['key'], $info['objectkeys']);
     $submitbutton = $this->_vars->get('submitbutton');
     if ($submitbutton == _("Finish")) {
         $next_page = Horde::url('browse.php', true);
         if ($info['original_source'] == '**search') {
             $next_page->add('key', $info['original_source']);
         } else {
             $next_page->add('source', $info['original_source']);
         }
     } elseif ($submitbutton == _("Previous") && $info['source'] . ':' . $info['key'] != $info['objectkeys'][0]) {
         /* Previous contact */
         list(, $previous_key) = explode(':', $info['objectkeys'][$objectkey - 1]);
         $next_page->add('key', $previous_key);
         if ($this->getOpenSection()) {
             $next_page->add('__formOpenSection', $this->getOpenSection());
         }
     } elseif ($submitbutton == _("Next") && $info['source'] . ':' . $info['key'] != $info['objectkeys'][count($info['objectkeys']) - 1]) {
         /* Next contact */
         list(, $next_key) = explode(':', $info['objectkeys'][$objectkey + 1]);
         $next_page->add('key', $next_key);
         if ($this->getOpenSection()) {
             $next_page->add('__formOpenSection', $this->getOpenSection());
         }
     }
     $next_page->redirect();
 }
Пример #18
0
 public static function bookmarkletLink()
 {
     $view = $GLOBALS['injector']->createInstance('Horde_View');
     $view->url = Horde::url('add.php', true, array('append_session' => -1))->add('popup', 1);
     $view->image = Horde::img('add.png');
     return $view->render('bookmarklet');
 }
Пример #19
0
 /**
  * Add additional items to the sidebar.
  *
  * @param Horde_View_Sidebar $sidebar  The sidebar object.
  */
 public function sidebar($sidebar)
 {
     $perms = $GLOBALS['injector']->getInstance('Horde_Core_Perms');
     if (Sesha::isAdmin(Horde_Perms::READ) || $perms->hasPermission('sesha:addStock', $GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
         $sidebar->addNewButton(_("_Add Stock"), Horde::url('stock.php')->add('actionId', 'add_stock'));
     }
 }
Пример #20
0
/**
 * Copyright 2001-2016 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author Jon Parise <*****@*****.**>
 * @author Jan Schneider <*****@*****.**>
 */
function _delete($task_id, $tasklist_id)
{
    global $injector, $nag_shares, $notification, $registry;
    if (!empty($task_id)) {
        try {
            $task = Nag::getTask($tasklist_id, $task_id);
            $task->loadChildren();
            try {
                $share = $nag_shares->getShare($tasklist_id);
            } catch (Horde_Share_Exception $e) {
                throw new Nag_Exception($e);
            }
            if (!$share->hasPermission($registry->getAuth(), Horde_Perms::DELETE)) {
                $notification->push(_("Access denied deleting task."), 'horde.error');
            } else {
                $storage = $injector->getInstance('Nag_Factory_Driver')->create($tasklist_id);
                try {
                    $storage->delete($task_id);
                } catch (Nag_Exception $e) {
                    $notification->push(sprintf(_("There was a problem deleting %s: %s"), $task->name, $e->getMessage()), 'horde.error');
                }
                $notification->push(sprintf(_("Deleted %s."), $task->name), 'horde.success');
            }
        } catch (Nag_Exception $e) {
            $notification->push(sprintf(_("Error deleting task: %s"), $e->getMessage()), 'horde.error');
        }
    }
    /* Return to the last page or to the task list. */
    if ($url = Horde_Util::getFormData('url')) {
        header('Location: ' . $url);
        exit;
    }
    Horde::url('list.php', true)->redirect();
}
Пример #21
0
 /**
  * Return the HTML representing this widget.
  *
  * @return string  The HTML for this widget.
  */
 public function html()
 {
     if (!$GLOBALS['conf']['faces']['driver']) {
         return '';
     }
     $this->_faces = $GLOBALS['injector']->getInstance('Ansel_Faces');
     $this->_owner = $this->_view->gallery->get('owner');
     try {
         $this->_count = $this->_faces->countOwnerFaces($this->_owner);
     } catch (Ansel_Exception $e) {
         Horde::log($e->getMessage(), 'ERR');
         $this->_count = 0;
     }
     if (empty($this->_count)) {
         return null;
     }
     $this->_title = Horde::url('faces/search/owner.php')->add('owner', $this->_owner)->link() . sprintf(_("People in galleries owned by %s (%d of %d)"), $this->_owner, min(12, $this->_count), number_format($this->_count)) . '</a>';
     $html = $this->_htmlBegin();
     $results = $this->_faces->ownerFaces($this->_owner, 0, 12, true);
     $html .= '<div style="display: block' . ';background:' . $this->_style->background . ';width:100%;max-height:300px;overflow:auto;" id="faces_widget_content" >';
     foreach ($results as $face) {
         $facename = htmlspecialchars($face['face_name']);
         $html .= '<a href="' . Ansel_Faces::getLink($face) . '" title="' . $facename . '">' . '<img src="' . $this->_faces->getFaceUrl($face['image_id'], $face['face_id'], 'mini') . '" style="padding-bottom: 5px; padding-left: 5px" alt="' . $facename . '" /></a>';
     }
     return $html . '</div>' . $this->_htmlEnd();
 }
Пример #22
0
 public function html($active = true)
 {
     global $browser, $vars;
     if (!$this->contact) {
         echo '<h3>' . _("The requested contact was not found.") . '</h3>';
         return;
     }
     if (!$this->contact->hasPermission(Horde_Perms::EDIT)) {
         if (!$this->contact->hasPermission(Horde_Perms::READ)) {
             echo '<h3>' . _("You do not have permission to view this contact.") . '</h3>';
             return;
         } else {
             echo '<h3>' . _("You only have permission to view this contact.") . '</h3>';
             return;
         }
     }
     echo '<div id="EditContact"' . ($active ? '' : ' style="display:none"') . '>';
     $form = new Turba_Form_EditContact($vars, $this->contact);
     $form->renderActive($form->getRenderer(), $vars, Horde::url('edit.php'), 'post');
     echo '</div>';
     if ($active && $browser->hasFeature('dom')) {
         if ($this->contact->hasPermission(Horde_Perms::READ)) {
             $view = new Turba_View_Contact($this->contact);
             $view->html(false);
         }
         if ($this->contact->hasPermission(Horde_Perms::DELETE)) {
             $delete = new Turba_View_DeleteContact($this->contact);
             $delete->html(false);
         }
     }
 }
Пример #23
0
 public function execute()
 {
     if ($this->_vars->get('submitbutton') == _("Cancel")) {
         Horde::url('list.php', true)->redirect();
     }
     Nag::deleteTasklist($this->_tasklist);
 }
Пример #24
0
 /**
  */
 protected function _content()
 {
     global $registry, $prefs;
     if (!empty($this->_params['show_notepad'])) {
         $shares = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Share')->create();
     }
     $html = '';
     $memos = Mnemo::listMemos($prefs->getValue('sortby'), $prefs->getValue('sortdir'));
     foreach ($memos as $id => $memo) {
         $html .= '<tr>';
         if (!empty($this->_params['show_actions'])) {
             $editImg = Horde_Themes::img('edit.png');
             $editurl = Horde::url('memo.php')->add(array('memo' => $memo['memo_id'], 'memolist' => $memo['memolist_id']));
             $html .= '<td width="1%">' . Horde::link(htmlspecialchars(Horde::url($editurl, true)->add('actionID', 'modify_memo')), _("Edit Note")) . Horde::img($editImg, _("Edit Note")) . '</a></td>';
         }
         if (!empty($this->_params['show_notepad'])) {
             $html .= '<td>' . htmlspecialchars(Mnemo::getLabel($shares->getShare($memo['memolist_id']))) . '</td>';
         }
         $viewurl = Horde::url('view.php')->add(array('memo' => $memo['memo_id'], 'memolist' => $memo['memolist_id']));
         $html .= '<td>' . Horde::linkTooltip(htmlspecialchars(Horde::url($viewurl, true)), '', '', '', '', $memo['body'] != $memo['desc'] ? Mnemo::getNotePreview($memo) : '') . (strlen($memo['desc']) ? htmlspecialchars($memo['desc']) : '<em>' . _("Empty Note") . '</em>') . '</a> <ul class="horde-tags">';
         foreach ($memo['tags'] as $tag) {
             $html .= '<li>' . htmlspecialchars($tag) . '</li>';
         }
         $html .= '</ul></td></tr>';
     }
     if (!$memos) {
         return '<p><em>' . _("No notes to display") . '</em></p>';
     }
     return '<table cellspacing="0" width="100%" class="linedRow">' . $html . '</table>';
 }
Пример #25
0
 /**
  * @param array $opts  Options:
  *   - buid: (string) BUID of message.
  *   - full: (boolean) Full URL?
  *   - mailbox: (string) Mailbox of message.
  */
 public static function url(array $opts = array())
 {
     $url = Horde::url('basic.php')->add('page', 'listinfo')->unique()->setRaw(!empty($opts['full']));
     if (!empty($opts['mailbox'])) {
         $url->add(array('buid' => $opts['buid'], 'mailbox' => IMP_Mailbox::get($opts['mailbox'])->form_to));
     }
     return $url;
 }
Пример #26
0
 /**
  * The title to go in this block.
  *
  * @return string   The title text.
  */
 function _title()
 {
     global $registry;
     $title = isset($this->_params['title']) ? $this->_params['title'] : $this->_params['iframe'];
     $html = Horde::link($this->_params['iframe'], $title, 'header') . $title . '</a>';
     $html .= Horde::link($this->_params['iframe'], _("Open in a new window"), 'smallheader', '_new') . Horde::img('webserver.gif', _("Open in a new window"), 'hspace="5"', Horde::url($registry->getParam('graphics'), true, -1)) . _("Open in a new window") . '</a>';
     return $html;
 }
Пример #27
0
 /**
  */
 protected function _title()
 {
     $url = Horde::url($GLOBALS['registry']->getInitialPage(), true);
     if (isset($this->_params['calendar']) && $this->_params['calendar'] != '__all') {
         $url->add('display_cal', $this->_params['calendar']);
     }
     return $url->link() . _("Upcoming Events") . '</a>';
 }
Пример #28
0
 public function testBug9712()
 {
     $GLOBALS['registry'] = new Registry();
     $GLOBALS['conf']['server']['name'] = 'example.com';
     $GLOBALS['conf']['server']['port'] = 1443;
     $GLOBALS['conf']['use_ssl'] = 2;
     $this->assertEquals('https://example.com:1443/foo', strval(Horde::url('https://example.com:1443/foo', true, array('append_session' => -1))));
 }
Пример #29
0
 /**
  */
 function setExtraFields($channel_id = null)
 {
     $this->addVariable(_("Description"), 'channel_desc', 'text', false);
     $this->addVariable(_("Channel Slug"), 'channel_slug', 'text', true, false, sprintf(_("Slugs allows direct access to this channel's content by visiting: %s. <br /> Slug names may contain only letters, numbers or the _ (underscore) character."), Horde::url('slugname')), array('/^[a-zA-Z1-9_]*$/'));
     $this->addVariable(_("Include full story content in syndicated feeds?"), 'channel_full_feed', 'boolean', false);
     $this->addVariable(_("Channel URL if not the default one. %c gets replaced by the feed ID."), 'channel_link', 'text', false);
     $this->addVariable(_("Channel URL for further pages, if not the default one. %c gets replaced by the feed ID, %n by the story offset."), 'channel_page_link', 'text', false);
     $this->addVariable(_("Story URL if not the default one. %c gets replaced by the feed ID, %s by the story ID."), 'channel_story_url', 'text', false);
 }
Пример #30
0
 /**
  */
 public function __get($name)
 {
     switch ($name) {
         case 'linked':
             return $this instanceof IMP_Compose_Attachment_Linked;
         case 'link_url':
             return $this->linked ? Horde::url('attachment.php', true, array('append_session' => -1))->add(array('id' => $this->_id, 'u' => $this->_user)) : null;
     }
 }