/** * Display */ public function display() { if (is_null($this->Exporter)) { echo HTML::error(__('The chosen exporter could not be located.')); } else { $this->Exporter->display(); } }
/** * Display */ public function display() { if (empty(self::$IDs)) { echo HTML::error(__('No activities for editing were set.')); } else { $this->displayEditor(); $this->displayNavigation(); } }
/** * Display */ public function display() { if (!$this->Context->activity()->isPublic()) { echo HTML::error(__('This training is private and cannot be shared.')); return; } $Linklist = new BlocklinkList(); $Linklist->addCompleteLink($this->externalLink($this->getUrl(), __('Share!'))); $Linklist->display(); echo HTML::info(__('You will be forwarded to Facebook, where you can define which text shall be displayed.')); $this->throwLinkErrorForLocalhost(); }
/** * Display */ public function display() { if (!$this->Context->activity()->isPublic()) { echo HTML::error(__('This training is private and cannot be shared.')); return; } $url = 'https://plus.google.com/share?url=' . urlencode($this->getPublicURL()) . '&h1=de'; $Linklist = new BlocklinkList(); $Linklist->addCompleteLink($this->externalLink($url, __('Share +1'))); $Linklist->display(); echo HTML::info(__('You will be forwared to Google+, where you can define which text shall be displayed.')); $this->throwLinkErrorForLocalhost(); }
/** * Display */ public final function display() { $this->setFileContent(); $this->writeFile(); if (count($this->getAllErrors()) > 0) { foreach ($this->getAllErrors() as $Error) { echo HTML::error($Error); } } else { echo HTML::info(' ' . __('Your activity has been exported.') . '<br> <br> <a href="inc/export/files/' . $this->getFilename() . '"><strong>' . __('Download') . ': ' . $this->getFilename() . '</strong></a> '); } }
<?php /** * File for displaying sum data for each week or month * Call: call/window.plotSumData.php */ require '../inc/class.Frontend.php'; $Frontend = new Frontend(); if (!isset($_GET['y'])) { $_GET['y'] = PlotSumData::LAST_12_MONTHS; } if (!isset($_GET['type'])) { $_GET['type'] = 'month'; } if ($_GET['type'] == 'week') { $Plot = new PlotWeekSumData(); $Plot->display(); } elseif ($_GET['type'] == 'month') { $Plot = new PlotMonthSumData(); $Plot->display(); } else { echo HTML::error(__('There was a problem.')); }
/** * Throw error: This training is private */ protected function throwErrorForPrivateTraining() { echo HTML::h1(__('Error')); echo HTML::error(sprintf('<strong>%s</strong>', __('Private activity')) . '<br><br>' . __('This activity is private. The user does not allow you to see it.')); $this->displayLinkToRunalyze(); }
/** * Create Anqh styles form input wrapped in list * * @param string $input * @param string|array $name * @param string $label * @param string|array $error * @param string|array $tip * @param bool $label_after * @return string */ public static function wrap($input, $name, $label = null, $error = null, $tip = null, $label_after = false) { // Find the input error if any $error = HTML::error($error, $name); $wrap = empty($error) ? '<li>' : '<li class="error">' . $error; // Input label if any if ($label) { $wrap .= is_array($label) ? Form::label(key($label), current($label)) : Form::label($name, $label); } // Input tip if any if ($tip) { $tip = '<p class="tip">' . (is_array($tip) ? Arr::get($tip, $name) : $tip) . '</p>'; } return ($label_after ? $input . $wrap : $wrap . $input) . $tip . "</li>\n"; }
$minLng = 180; $maxLng = -180; while ($RouteData = $Routes->fetch()) { $Route = new Model\Route\Entity($RouteData); $MinCoordinate = (new League\Geotools\Geohash\Geohash())->decode($RouteData['min'])->getCoordinate(); $MaxCoordinate = (new League\Geotools\Geohash\Geohash())->decode($RouteData['max'])->getCoordinate(); $minLat = $MinCoordinate->getLatitude() != 0 ? min($minLat, $MinCoordinate->getLatitude()) : $minLat; $minLng = $MinCoordinate->getLongitude() != 0 ? min($minLng, $MinCoordinate->getLongitude()) : $minLng; $maxLat = $MaxCoordinate->getLatitude() != 0 ? max($maxLat, $MaxCoordinate->getLatitude()) : $maxLat; $maxLng = $MaxCoordinate->getLongitude() != 0 ? max($maxLng, $MaxCoordinate->getLongitude()) : $maxLng; $Path = new Leaflet\Activity('route-' . $RouteData['id'], $Route, null, false); $Path->addOption('hoverable', false); $Path->addOption('autofit', false); $Map->addRoute($Path); } if (!isset($Route)) { echo HTML::error(__('There are no routes matching the criterias.')); } $Map->setBounds(array('lat.min' => $minLat, 'lat.max' => $maxLat, 'lng.min' => $minLng, 'lng.max' => $maxLng)); $Map->display(); ?> <p class="info"> <?php echo sprintf(__('The map contains your %s most recent routes matching the criterias.'), RunalyzePluginStat_Strecken::MAX_ROUTES_ON_NET); ?> <?php _e('More routes are not possible at the moment due to performance issues.'); ?> </p> </div>
/** * Check write permissions * * Will show an error if folder is not writable * * @param string $folder path relative to runalyze/ */ public static function checkWritePermissions($folder) { $realfolder = FRONTEND_PATH . '../' . $folder; if (!is_writable($realfolder)) { echo HTML::error(sprintf(__('The directory <strong>%s</strong> is not writable. <em>(chmod = %s)</em>'), $folder, substr(decoct(fileperms($realfolder)), 1))); } }
/** * Display failures */ protected function displayFailures() { foreach ($this->failures as $message) { echo HTML::error($message); } }
/** * Create Anqh styles form input wrapped in list * * @param string $input * @param string|array $name * @param string $label * @param string|array $error * @param string|array $tip * @param boolean $label_after * @param array $attributes * @return string */ public static function wrap($input, $name, $label = null, $error = null, $tip = null, $label_after = false, array $attributes = null) { // Find the input error if any $error = HTML::error($error, $name); if (!empty($error)) { $attributes['class'] = trim('error ' . Arr::get($attributes, 'class')); } $attributes['class'] .= ' control-group'; // Label if ($label) { $label = is_array($label) ? Form::label(key($label), current($label), array('class' => 'control-label')) : Form::label($name, $label, array('class' => 'control-label')); } // Tip if ($tip) { $tip = '<p class="help-block">' . (is_array($tip) ? Arr::get($tip, $name) : $tip) . '</p>'; } return '<div' . HTML::attributes($attributes) . '>' . ($label_after ? $input . $label : $label . $input) . $error . $tip . "</div>\n"; }
<?php /** * File for uninstalling plugins. * Call: call.Plugin.uninstall.php?key= */ require '../inc/class.Frontend.php'; $Pluginkey = filter_input(INPUT_GET, 'key'); $Frontend = new Frontend(); $Installer = new PluginInstaller($Pluginkey); echo '<h1>' . __('Uninstall') . ' ' . $Pluginkey . '</h1>'; if ($Installer->uninstall()) { echo HTML::okay(__('The plugin has been uninstalled.')); PluginFactory::clearCache(); Ajax::setReloadFlag(Ajax::$RELOAD_ALL); echo Ajax::getReloadCommand(); } else { echo HTML::error(__('There was a problem, the plugin could not be uninstalled.')); } echo '<ul class="blocklist">'; echo '<li>'; echo Ajax::window('<a href="' . ConfigTabPlugins::getExternalUrl() . '">' . Icon::$TABLE . ' ' . __('back to list') . '</a>'); echo '</li>'; echo '</ul>';
/** * Try to change password */ private function tryToChangePassword() { if ($_POST['new_pw'] == $_POST['new_pw_repeat']) { $Account = DB::getInstance()->query('SELECT `password`, `salt` FROM `' . PREFIX . 'account`' . ' WHERE id = ' . SessionAccountHandler::getId())->fetch(); if (AccountHandler::comparePasswords($_POST['old_pw'], $Account['password'], $Account['salt'])) { if (strlen($_POST['new_pw']) < AccountHandler::$PASS_MIN_LENGTH) { ConfigTabs::addMessage(HTML::error(sprintf(__('The password has to contain at least %s characters.'), AccountHandler::$PASS_MIN_LENGTH))); } else { AccountHandler::setNewPassword(SessionAccountHandler::getUsername(), $_POST['new_pw']); ConfigTabs::addMessage(HTML::okay(__('Your password has been changed.'))); } } else { ConfigTabs::addMessage(HTML::error(__('You current password is wrong.'))); } } else { ConfigTabs::addMessage(HTML::error(__('The passwords have to be the same.'))); } }
/** * Throw error: This training is private */ protected function throwErrorForPrivateList() { echo HTML::h1(__('Error')); echo HTML::error(sprintf('<strong>%s</strong>', __('This list is private')) . '<br><br>' . __('The user does not share his activity list.')); $this->displayLinkToRunalyze(); }
/** * Display errors */ private function displayErrors() { if (!empty($this->Errors)) { echo '<div class="panel-content">'; foreach ($this->Errors as $Error) { echo HTML::error($Error); } echo '</div>'; } }
/** * Send results to Multi Editor */ protected function sendResultsToMultiEditor() { $IDs = array(); foreach ($this->Trainings as $data) { $IDs[] = $data['id']; } $_POST['ids'] = implode(',', $IDs); $Factory = new PluginFactory(); $MultiEditor = $Factory->newInstance('RunalyzePluginTool_MultiEditor'); if ($MultiEditor) { $MultiEditor->display(); } else { echo HTML::error(__('The multi editor could not be located.')); } echo Ajax::wrapJS('$("#search").remove();$("#ajax").removeClass("big-window");'); }
/** * Throw error for localhost */ protected final function throwLinkErrorForLocalhost() { if (System::isAtLocalhost()) { echo HTML::error(__('Runalyze is running on a local server.') . ' ' . __('Linking your activity in a social network does not make sense - nobody will be able to see your activity.')); } }
/** * Display an error message causing a fatal error * @param string $message */ public function displayFatalErrorMessage($message) { // TODO: Per jQuery Overlay if (!$this->header_sent) { include 'tpl/tpl.Frontend.header.php'; } echo '<div class="panel">'; echo '<div class="panel-heading">'; echo '<h1>' . __('Fatal error') . '</h1>'; echo '</div>'; echo '<div class="panel-content">'; echo HTML::error($message); echo '</div>'; echo '</div>'; if (!$this->footer_sent) { include 'tpl/tpl.Frontend.footer.php'; } exit; }
<?php /** * File for displaying plugins. * Call: call.Plugin.display.php?id= [&sport= &jahr= &dat= ] */ require '../inc/class.Frontend.php'; $Frontend = new Frontend(); $Factory = new PluginFactory(); try { $Plugin = $Factory->newInstanceFor(filter_input(INPUT_GET, 'id')); } catch (Exception $E) { $Plugin = null; echo HTML::error(__('The plugin could not be found.')); } if ($Plugin !== null) { if ($Plugin instanceof PluginPanel) { $Plugin->setSurroundingDivVisible(false); } $Plugin->display(); }
<?php /** * Delete Account * Call: call/window.delete.php */ require '../inc/class.Frontend.php'; $Frontend = new Frontend(); $Errors = array(); AccountHandler::setAndSendDeletionKeyFor($Errors); echo HTML::h1(__('Delete your account.')); if (!empty($Errors)) { foreach ($Errors as $Error) { echo HTML::error($Error); } } else { echo HTML::info(__('<em>A confirmation has been sent via mail.</em><br>' . 'How sad, that you\'ve decided to delete your account.<br>' . 'Your account will be deleted as soon as you click on the confirmation link in your mail.')); }
?> </label> <input id="new_pw_again" name="new_pw_again" class="middle-size" type="password"> </div> <?php } else { ?> <?php echo HTML::error(__('The link is not valid anymore.')); ?> <?php } ?> <?php if (is_array($errors) && !empty($errors)) { foreach ($errors as $error) { echo HTML::error($error); } } ?> </fieldset> <div class="c"> <input type="submit" value="<?php _e('Change password'); ?> " name="submit"> </div> </form> </div>