Ejemplo n.º 1
0
 function urlToData($url)
 {
     $html = new HTML();
     $url = explode("/", $url);
     foreach ($url as $el) {
         $el = $html->sanatizeString($el);
         $el = strtolower($el);
         if (!$el) {
             continue;
         }
         if (IMAGE_CHANGE_CODE && substr($el, 0, 10) == 'changecode') {
             $data['changecode'] = substr($el, 11);
         }
         if ($this->isImage($el)) {
             $data['hash'] = $el;
         } else {
             if ($el == 'mp4' || $el == 'raw' || $el == 'preview' || $el == 'webm') {
                 $data[$el] = 1;
             } else {
                 if ($this->isSize($el)) {
                     $data['size'] = $el;
                 } else {
                     if ($this->isRotation($el)) {
                         $data['rotate'] = $el;
                     } else {
                         if ($this->isFilter($el)) {
                             $data['filter'][] = $el;
                         } else {
                             if ($legacy = $this->isLegacyThumbnail($el)) {
                                 $data['hash'] = $legacy['hash'];
                                 $data['size'] = $legacy['size'];
                             } else {
                                 if ($el == 'forcesize') {
                                     $data['forcesize'] = true;
                                 } else {
                                     if (strlen(MASTER_DELETE_CODE) > 10 && $el == 'delete_' . MASTER_DELETE_CODE) {
                                         $data['delete'] = true;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($data['delete'] && $data['hash']) {
         $this->deleteImage($data['hash']);
         return false;
     }
     if ($data['mp4']) {
         $hash = $data['hash'];
         if (!$hash || $this->getTypeOfHash($hash) != 'gif') {
             unset($data['mp4']);
         }
     }
     return $data;
 }
Ejemplo n.º 2
0
 public function getContent($file)
 {
     $writer = new HTML(@IOFactory::load($file));
     $html = $writer->getContent();
     // Remove <style> manually
     $html = preg_replace('/<style>.*<\\/style>/s', '', $html);
     // Remove HTML tags
     return strip_tags($html);
 }
Ejemplo n.º 3
0
 function createHiddenIDs()
 {
     $input = new HTML("input");
     $input->addAttr("type", "hidden");
     $input->addAttr("evalID", Request::option('evalID'));
     $input = new HTML("input");
     $input->addAttr("type", "hidden");
     $input->addAttr("itemID", Request::option('itemID'));
     $input = new HTML("input");
     $input->addAttr("type", "hidden");
     $input->addAttr("rangeID", Request::option("rangeID"));
     return;
 }
Ejemplo n.º 4
0
    public static function renderStyles(){
               
         if (count(self::$_styles) == 0)
               return FALSE;      
               
         self::$_styles = array_unique(self::$_styles);      
               
         switch ( Kohana::$environment){
           
              case Kohana::DEVELOPMENT:
              case Kohana::STAGING:
              case kohana::TESTING:     
              default:
                                      
                 foreach (self::$_styles as $style){
                       echo HTML::style("media/styles/".$style);
                 }
                  
                 break;
                 
             case Kohana::PRODUCTION:
               
               ?><link rel='stylesheet' type='text/css' href='<?php 
echo url::base();
?>
min/index.php?b=media/styles&amp;f=<?php 
echo implode(",", self::$_styles);
?>
' /><?

                 break;                        
          } 
          
    }
Ejemplo n.º 5
0
Archivo: index.php Proyecto: anqh/anqh
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        foreach ($this->_group_by_city() as $city => $venues) {
            ?>

<header>
	<h4><?php 
            echo HTML::chars($city);
            ?>
</h4>
</header>

<ul class="list-unstyled row">
<?php 
            foreach ($venues as $venue) {
                ?>

	<li class="col-xs-6 col-sm-4 col-md-3"><?php 
                echo HTML::anchor(Route::model($venue), HTML::chars($venue->name));
                ?>
</li>

<?php 
            }
            ?>
</ul>

<?php 
        }
        return ob_get_clean();
    }
Ejemplo n.º 6
0
 function summaryAsHTML($rev)
 {
     if (!($summary = $this->summary($rev))) {
         return '';
     }
     return HTML::strong(array('class' => 'wiki-summary'), "(", TransformLinks($summary, $rev->get('markup'), $rev->getPageName()), ")");
 }
Ejemplo n.º 7
0
 public static function create($view)
 {
     $view->tabs(function ($tabs) {
         $tabs->tab('Module Settings', function ($view) {
             $view->text('name', __('admin::module.create.form.name'), Input::old('name'));
             $view->actions(function ($view) {
                 $view->next_tab('Next up, add some schemas &nbsp; <i class="icon-arrow-right icon-white"></i>', 'primary');
             });
         });
         $tabs->tab('Schemas', function ($view) {
             $view->table(function ($table) {
                 $table->header(array('name' => array('title' => __('admin::account.read_multiple.table.name'), 'attributes' => array('class' => 'first big')), 'relationships', 'buttons' => array('attributes' => array('class' => 'buttons last'))));
                 $table->no_results(function ($table) {
                     $table->well(function ($table) {
                         $table->raw(__('admin::account.read_multiple.table.no_results'));
                     });
                 });
                 $table->display(array('relationships' => function ($schema) {
                     $relationships = '';
                     if (isset($schema->relationships)) {
                         foreach ($schema->relationships as $relationship) {
                             $relationships .= '<b>' . $relationship->name . '</b><br>' . $relationship->type;
                         }
                     }
                     return $relationships;
                 }, 'buttons' => function ($schema) {
                     return HTML::link(prefix('admin') . 'module/add/', '<span class="icon-pencil"></span>', array('class' => 'btn btn-small')) . HTML::link(prefix('admin') . 'module/add/', '<span class="icon-trash icon-white"></span>', array('class' => 'btn btn-primary'));
                 }));
             });
             $view->button('#add-schema', 'Add Schema', 'primary');
         });
     });
 }
Ejemplo n.º 8
0
 /**
  * Returns a new table of all work orders.
  *
  * @param WorkOrder|Builder $workOrder
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function table($workOrder)
 {
     return $this->table->of('work-orders', function (TableGrid $table) use($workOrder) {
         $table->with($workOrder)->paginate($this->perPage);
         $table->attributes(['class' => 'table table-hover table-striped']);
         $table->column('ID', 'id');
         $table->column('subject', function (Column $column) {
             $column->value = function (WorkOrder $workOrder) {
                 return link_to_route('maintenance.work-orders.show', $workOrder->subject, [$workOrder->getKey()]);
             };
         });
         $table->column('Created At', 'created_at');
         $table->column('created_by', function (Column $column) {
             $column->value = function (WorkOrder $workOrder) {
                 return $workOrder->user->fullname;
             };
         });
         $table->column('priority', function (Column $column) {
             $column->value = function (WorkOrder $workOrder) {
                 if ($workOrder->priority instanceof Priority) {
                     return $workOrder->priority->getLabel();
                 }
                 return HTML::create('em', 'None');
             };
         });
         $table->column('status', function (Column $column) {
             $column->value = function (WorkOrder $workOrder) {
                 if ($workOrder->status instanceof Status) {
                     return $workOrder->status->getLabel();
                 }
                 return HTML::create('em', 'None');
             };
         });
     });
 }
Ejemplo n.º 9
0
Archivo: list.php Proyecto: anqh/anqh
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        if (!$this->blog_entries) {
            return '';
        }
        ob_start();
        ?>

<ul class="list-unstyled">

	<?php 
        foreach ($this->blog_entries as $entry) {
            ?>
	<li><?php 
            echo __(':blog by :author', array(':blog' => HTML::anchor(Route::model($entry), HTML::chars($entry->name)), ':author' => HTML::user($entry->author())));
            ?>
</li>
	<?php 
        }
        ?>

</ul>

<?php 
        return ob_get_clean();
    }
Ejemplo n.º 10
0
Archivo: alert.php Proyecto: anqh/anqh
    /**
     * Render alert.
     *
     * @return  string
     */
    public function render()
    {
        ob_start();
        // Section attributes
        $attributes = array('class' => 'alert alert-block ' . $this->class);
        if ($this->header === true) {
            $this->header = self::generate_header();
        }
        ?>

<div <?php 
        echo HTML::attributes($attributes);
        ?>
>
	<?php 
        if ($this->header) {
            ?>
<strong><?php 
            echo HTML::chars($this->header);
            ?>
</strong><?php 
        }
        ?>

	<?php 
        echo $this->content;
        ?>
</div>

<?php 
        return ob_get_clean();
    }
Ejemplo n.º 11
0
Archivo: list.php Proyecto: anqh/blog
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        if (!$this->blog_entries) {
            return '';
        }
        ob_start();
        ?>

<ul class="unstyled">

	<?php 
        foreach ($this->blog_entries as $entry) {
            ?>
	<li><?php 
            echo HTML::anchor(Route::model($entry), HTML::chars($entry->name));
            ?>
</li>
	<?php 
        }
        ?>

</ul>

<?php 
        return ob_get_clean();
    }
Ejemplo n.º 12
0
 public function paginate($page = null, $link = null, $count = null)
 {
     if ($page == null) {
         $page = Arr::get($_GET, 'page', 1);
     }
     if (!empty($_GET['item_count'])) {
         $this->count = (int) Arr::get($_GET, 'item_count');
         $count = $this->count;
     } else {
         if ($count == null) {
             $count = $this->count;
         } else {
             $this->count = (int) $count;
         }
     }
     if ($link == null) {
         $link = Request::initial()->uri();
     }
     $count = (int) $count;
     $page = (int) $page;
     $start = $page * $count - $count;
     $max_page = $this->page_count();
     if ($page < 1) {
         $page = 1;
     } else {
         $page = min($page, $max_page);
     }
     $prev = $page == 1 ? false : true;
     $next = $page == $max_page ? false : true;
     $this->orm->limit($count)->offset($start);
     $this->view_vars = array('page' => $page, 'max_page' => $max_page, 'key' => $this->config->get('key', 'page'), 'count' => $count, 'link' => Security::xss_clean(HTML::chars($link)), 'next' => $next, 'prev' => $prev);
     return Security::xss_clean(HTML::chars($this));
 }
Ejemplo n.º 13
0
Archivo: list.php Proyecto: anqh/anqh
    /**
     * Render content.
     *
     * @return  string
     */
    public function content()
    {
        if (!$this->events) {
            return '';
        }
        ob_start();
        ?>

<ul class="list-unstyled">

	<?php 
        foreach ($this->events as $event) {
            ?>
	<li>
		<span title="<?php 
            echo Date::format(Date::DATETIME, $event->stamp_begin) . ($event->stamp_end ? ' - ' . Date::format(Date::TIME, $event->stamp_end) : '');
            ?>
"><?php 
            echo Date::format(Date::DM_PADDED, $event->stamp_begin);
            ?>
</span>
		<?php 
            echo HTML::anchor(Route::model($event), HTML::chars($event->name), array('class' => 'hoverable', 'title' => HTML::chars($event->name)));
            ?>
	</li>
	<?php 
        }
        ?>

</ul>

<?php 
        return ob_get_clean();
    }
Ejemplo n.º 14
0
function PurgePage(&$request)
{
    global $WikiTheme;
    $page = $request->getPage();
    $pagelink = WikiLink($page);
    if ($request->getArg('cancel')) {
        $request->redirect(WikiURL($page));
        // noreturn
    }
    $current = $page->getCurrentRevision();
    if (!$current or !($version = $current->getVersion())) {
        $html = HTML::p(array('class' => 'error'), _("Sorry, this page does not exist."));
    } elseif (!$request->isPost() || !$request->getArg('verify')) {
        $purgeB = Button('submit:verify', _("Purge Page"), 'wikiadmin');
        $cancelB = Button('submit:cancel', _("Cancel"), 'button');
        // use generic wiki button look
        $fieldset = HTML::fieldset(HTML::p(fmt("You are about to purge '%s'!", $pagelink)), HTML::form(array('method' => 'post', 'action' => $request->getPostURL()), HiddenInputs(array('currentversion' => $version, 'pagename' => $page->getName(), 'action' => 'purge')), HTML::div(array('class' => 'toolbar'), $purgeB, $WikiTheme->getButtonSeparator(), $cancelB)));
        $sample = HTML::div(array('class' => 'transclusion'));
        // simple and fast preview expanding only newlines
        foreach (explode("\n", firstNWordsOfContent(100, $current->getPackedContent())) as $s) {
            $sample->pushContent($s, HTML::br());
        }
        $html = HTML($fieldset, HTML::div(array('class' => 'wikitext'), $sample));
    } elseif ($request->getArg('currentversion') != $version) {
        $html = HTML(HTML::p(array('class' => 'error'), _("Someone has edited the page!")), HTML::p(fmt("Since you started the purge process, someone has saved a new version of %s.  Please check to make sure you still want to permanently purge the page from the database.", $pagelink)));
    } else {
        // Real purge.
        $pagename = $page->getName();
        $dbi = $request->getDbh();
        $dbi->purgePage($pagename);
        $dbi->touch();
        $html = HTML::div(array('class' => 'feedback'), fmt("Purged page '%s' successfully.", $pagename));
    }
    GeneratePage($html, _("Purge Page"));
}
Ejemplo n.º 15
0
 public function html()
 {
     $this->render_field->set('tag', 'option')->text($this->field->alias())->attr('value', HTML::entities($this->render_field->value));
     if ($this->field->parent()->val() == $this->render_field->value) {
         $this->render_field->attr('selected', 'selected');
     }
 }
Ejemplo n.º 16
0
 function linkUnknownWikiWord($wikiword, $linktext = '')
 {
     global $request;
     // Get rid of anchors on unknown wikiwords
     if (isa($wikiword, 'WikiPageName')) {
         $default_text = $wikiword->shortName;
         $wikiword = $wikiword->name;
     } else {
         $default_text = $wikiword;
     }
     $url = WikiURL($wikiword, array('action' => 'create'));
     //$link = HTML::span(HTML::a(array('href' => $url), '?'));
     $button = $this->makeButton('?', $url);
     $button->addTooltip(sprintf(_("Create: %s"), $wikiword));
     $link = HTML::span($button);
     if (!empty($linktext)) {
         $link->unshiftContent(HTML::u($linktext));
         $link->setAttr('class', 'named-wikiunknown');
     } else {
         $link->unshiftContent(HTML::u($this->maybeSplitWikiWord($default_text)));
         $link->setAttr('class', 'wikiunknown');
     }
     if ($request->getArg('frame')) {
         $link->setAttr('target', '_top');
     }
     return $link;
 }
 /**
  * @since v3.0.3
  */
 public function runActions()
 {
     $action = null;
     $action_index = 1;
     if (count($_GET) > 1) {
         $requested_action = HTML::sanitize(basename(key(array_slice($_GET, 1, 1, true))));
         if ($requested_action == OSCOM::getSiteApplication()) {
             $requested_action = null;
             if (count($_GET) > 2) {
                 $requested_action = HTML::sanitize(basename(key(array_slice($_GET, 2, 1, true))));
                 $action_index = 2;
             }
         }
         if (!empty($requested_action) && self::siteApplicationActionExists($requested_action)) {
             $this->_current_action = $action = $requested_action;
         }
     }
     if (isset($action)) {
         call_user_func(array('osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Application\\' . OSCOM::getSiteApplication() . '\\Action\\' . $action, 'execute'), $this);
         $action_index++;
         if ($action_index < count($_GET)) {
             $action = array($action);
             for ($i = $action_index, $n = count($_GET); $i < $n; $i++) {
                 $subaction = HTML::sanitize(basename(key(array_slice($_GET, $i, 1, true))));
                 if (!in_array($subaction, $this->_ignored_actions) && self::siteApplicationActionExists(implode('\\', $action) . '\\' . $subaction)) {
                     call_user_func(array('osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Application\\' . OSCOM::getSiteApplication() . '\\Action\\' . implode('\\', $action) . '\\' . $subaction, 'execute'), $this);
                     $action[] = $subaction;
                     $this->_current_action = $subaction;
                 } else {
                     break;
                 }
             }
         }
     }
 }
Ejemplo n.º 18
0
Archivo: list.php Proyecto: anqh/anqh
 /**
  * Render view.
  *
  * @return  string
  */
 public function content()
 {
     // Build short (friends) and long (others) user list
     $short = $long = array();
     $total = count($this->users);
     foreach ($this->users as $user) {
         $user = is_array($user) ? $user : Model_User::find_user_light($user);
         if ($total < 11 || Visitor::$user && Visitor::$user->is_friend($user)) {
             $short[mb_strtoupper($user['username'])] = HTML::user($user);
         } else {
             $long[mb_strtoupper($user['username'])] = HTML::user($user);
         }
     }
     ksort($long);
     // If no friends, pick random from long
     if (empty($short) && !empty($long)) {
         $shorts = (array) array_rand($long, min(10, count($long)));
         foreach ($shorts as $move) {
             $short[$move] = $long[$move];
             unset($long[$move]);
         }
     }
     ksort($short);
     ob_start();
     if (count($short)) {
         echo implode(', ', $short);
     }
     if (count($long)) {
         echo ' ', __('and'), ' ', HTML::anchor('#long', __(count($long) == 1 ? ':count other &#9662;' : ':count others &#9662;', array(':count' => count($long))), array('title' => __('Show all'), 'data-toggle' => 'collapse', 'data-target' => '#long', 'onclick' => 'return false;'));
         echo '<div id="long" class="collapse">', implode(', ', $long), '</div>';
     }
     return ob_get_clean();
 }
Ejemplo n.º 19
0
Archivo: ft.date.php Proyecto: nob/joi
 public function render()
 {
     $attributes = array('name' => $this->fieldname, 'id' => $this->field_id, 'class' => 'datepicker', 'tabindex' => $this->tabindex, 'value' => HTML::convertSpecialCharacters($this->field_data), 'data-value' => HTML::convertSpecialCharacters($this->field_data));
     $html = "<span class='ss-icon'>date</span>";
     $html .= HTML::makeInput('text', $attributes, $this->is_required);
     return $html;
 }
Ejemplo n.º 20
0
 /**
  * @param DocumentInterface $document
  * @param mixed $value
  *
  * @return mixed
  */
 public function onGetHeadlineValue(DocumentInterface $document, $value)
 {
     $documents = $document->getAttribute($this->getRelationName())->map(function (DocumentInterface $doc) {
         return \HTML::link($doc->getEditLink(), $doc->getTitle(), ['class' => 'popup']);
     })->all();
     return !empty($documents) ? implode(', ', $documents) : null;
 }
Ejemplo n.º 21
0
Archivo: report.php Proyecto: anqh/anqh
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        $gallery = $this->image->gallery();
        echo Form::open(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $this->image->id, 'action' => 'report')), array('class' => Request::current()->is_ajax() ? 'ajaxify' : ''));
        ?>

<fieldset>

	<?php 
        echo Form::control_group(Form::input('reason', null, array('class' => 'input-block-level')), array('name' => __('Reason')), null, __('You can enter an optional reason for reporting this image, e.g. why it should be removed'));
        ?>

</fieldset>

<fieldset class="form-actions">
	<?php 
        echo Form::button('save', __('Report'), array('type' => 'submit', 'class' => 'btn btn-danger btn-large'));
        ?>
	<?php 
        echo Request::current()->is_ajax() ? '' : HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $this->image->id, 'action' => '')), __('Cancel'), array('class' => 'cancel'));
        ?>

	<?php 
        echo Form::csrf();
        ?>
</fieldset>

<?php 
        return ob_get_clean();
    }
Ejemplo n.º 22
0
 public function setFilter($post, $db)
 {
     $cid = (int) $post['cid'];
     $fid = (int) $post['fid'];
     $cfh_id = (int) $post['cfh_id'];
     $filter = HTML::encode(trim($post['filter']));
     $fil_id = $db->createCommand("SELECT filter_id FROM idc_categories_filters WHERE filter = :filter")->bindValues([':filter' => $filter])->queryScalar();
     if ($cid && $fid && $filter && $cfh_id) {
         if (!$fil_id) {
             $db->createCommand("UPDATE idc_categories_filters AS cf\n                                        SET cf.filter = :filter\n                                        WHERE cf.filter_id = :fid")->bindValues([':filter' => $filter, ':fid' => $fid])->execute();
         } else {
             $db->createCommand("UPDATE idc_categories_filters_hooks AS cfh\n                                        SET cfh.filter_id = :fil_id\n                                        WHERE cfh.category_id = :cid\n                                        AND cfh.cfh_id = :cfh_id")->bindValues([':cid' => $cid, ':fil_id' => $fil_id, ':cfh_id' => $cfh_id])->execute();
         }
     } elseif ($cid && !$fid && $filter && !$cfh_id) {
         if (!$fil_id) {
             $db->createCommand()->insert('idc_categories_filters', ['filter' => $filter])->execute();
             $fid = $db->getLastInsertID();
         } else {
             $fid = $fil_id;
         }
         $db->createCommand()->insert('idc_categories_filters_hooks', ['category_id' => $cid, 'filter_id' => $fid])->execute();
         $cfh_id = $db->getLastInsertID();
         return ['cfh' => $cid, 'fid' => $fid, 'cfh_id' => $cfh_id];
     }
     return false;
 }
Ejemplo n.º 23
0
Archivo: forum.php Proyecto: anqh/forum
 /**
  * Construct controller
  */
 public function before()
 {
     parent::before();
     $this->page_title = __('Forum');
     // Generic page actions
     $this->page_actions['new-posts'] = array('link' => Route::url('forum'), 'text' => '<i class="icon-comment icon-white"></i> ' . __('New posts'));
     // Forum areas dropdown
     $groups = Model_Forum_Group::factory()->find_all();
     $areas = array();
     foreach ($groups as $group) {
         $divider = false;
         foreach ($group->areas() as $area) {
             if (Permission::has($area, Model_Forum_Area::PERMISSION_READ, self::$user)) {
                 $divider = true;
                 $areas[] = array('link' => Route::model($area), 'text' => HTML::entities($area->name));
             }
         }
         if ($divider) {
             $areas[] = array('divider' => true);
         }
     }
     array_pop($areas);
     $this->page_actions['areas'] = array('link' => Route::url('forum_group'), 'text' => '<i class="icon-folder-open icon-white"></i> ' . __('Areas'));
     $this->page_actions['area'] = array('link' => Route::url('forum_group'), 'text' => '', 'dropdown' => $areas);
     if (self::$user) {
         $this->page_actions['private-messages'] = array('link' => Forum::private_messages_url(), 'text' => '<i class="icon-envelope icon-white"></i> ' . __('Private messages'));
     }
 }
    /**
     * Display the content
     * @see PluginPanel::displayContent()
     */
    protected function displayContent()
    {
        echo $this->getStyle();
        echo '<div id="schuhe">';
        // TODO: Use data from shoe factory
        $inuse = true;
        $schuhe = DB::getInstance()->query('SELECT * FROM `' . PREFIX . 'shoe` WHERE accountid = ' . SessionAccountHandler::getId() . ' ORDER BY `inuse` DESC, `km` DESC')->fetchAll();
        foreach ($schuhe as $schuh) {
            $Shoe = new Shoe($schuh);
            if ($inuse && $Shoe->isInUse() == 0) {
                echo '<div id="hiddenschuhe" style="display:none;">';
                $inuse = false;
            }
            echo '<p style="position:relative;">
				<span class="right">' . $Shoe->getKmString() . '</span>
				<strong>' . ShoeFactory::getSearchLink($schuh['id']) . '</strong>
				' . $this->getShoeUsageImage($Shoe->getKm()) . '
			</p>';
        }
        if (empty($schuhe)) {
            echo HTML::em(__('You don\'t have any shoes'));
        }
        if (!$inuse) {
            echo '</div>';
        }
        echo '</div>';
        if (!$inuse) {
            echo Ajax::toggle('<a class="right" href="#schuhe" name="schuhe">' . __('Show unused shoes') . '</a>', 'hiddenschuhe');
        }
        echo HTML::clearBreak();
    }
Ejemplo n.º 25
0
 /**
  * Get newsfeed item as HTML
  *
  * @param   Model_NewsfeedItem  $item
  * @return  string
  */
 public static function get(Model_NewsfeedItem $item)
 {
     $text = '';
     switch ($item->type) {
         case self::TYPE_COMMENT:
             $gallery = Model_Gallery::factory($item->data['gallery_id']);
             $image = Model_Image::factory($item->data['image_id']);
             if ($gallery->loaded() && $image->loaded()) {
                 $text = __('commented to an image<br />:gallery', array(':gallery' => HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => '')), '<i class="icon-camera icon-white"></i> ' . HTML::chars($gallery->name), array('class' => 'hoverable'))));
             }
             break;
         case self::TYPE_COMMENT_FLYER:
             $flyer = Model_Flyer::factory($item->data['flyer_id']);
             if ($flyer->loaded()) {
                 $text = __('commented to a flyer<br />:flyer', array(':flyer' => HTML::anchor(Route::url('flyer', array('id' => $flyer->id)), '<i class="icon-picture icon-white"></i> ' . ($flyer->name ? HTML::chars($flyer->name) : __('flyer')), array('class' => 'hoverable'))));
             }
             break;
         case self::TYPE_FLYER_EDIT:
             $flyer = Model_Flyer::factory($item->data['flyer_id']);
             if ($flyer->loaded()) {
                 $text = __('updated flyer<br />:flyer', array(':flyer' => HTML::anchor(Route::url('flyer', array('id' => $flyer->id)), '<i class="icon-picture icon-white"></i> ' . ($flyer->name ? HTML::chars($flyer->name) : __('flyer')), array('class' => 'hoverable'))));
             }
             break;
         case self::TYPE_NOTE:
             $gallery = Model_Gallery::factory($item->data['gallery_id']);
             $image = Model_Image::factory($item->data['image_id']);
             $user = Model_User::find_user($item->data['user_id']);
             if ($gallery->loaded() && $image->loaded() && $user->loaded()) {
                 $text = __('tagged :user to an image<br />:gallery', array(':user' => HTML::user($user), ':gallery' => HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => '')), '<i class="icon-tag icon-white"></i> ' . HTML::chars($gallery->name), array('class' => 'hoverable'))));
             }
             break;
     }
     return $text;
 }
Ejemplo n.º 26
0
 public function action_create()
 {
     // form post handling
     if (isset($_POST) && Valid::not_empty($_POST)) {
         // validate
         $post = Validation::factory($_POST)->rule('email', 'not_empty')->rule('email', 'email')->rule('email', 'email_domain')->rule('username', 'not_empty')->rule('username', Kohana::$config->load('ko32example.account.create.username.format'))->rule('username', 'min_length', array(':value', Kohana::$config->load('ko32example.account.create.username.min_length')))->rule('username', 'max_length', array(':value', Kohana::$config->load('ko32example.account.create.username.max_length')))->rule('password', 'not_empty')->rule('password', 'min_length', array(':value', Kohana::$config->load('ko32example.account.create.password.min_length')))->rule('password', array($this, 'pwdneusr'), array(':validation', ':field', 'username'));
         if ($post->check()) {
             // save
             $model = ORM::factory('user');
             $model->values(array('email' => $post['email'], 'username' => HTML::entities(strip_tags($post['username'])), 'password' => $post['password']));
             try {
                 $model->save();
                 $model->add('roles', ORM::factory('role')->where('name', '=', 'login')->find());
                 $model->add('roles', ORM::factory('role')->where('name', '=', 'participant')->find());
                 // success login
                 if (Auth::instance()->login($post['username'], $post['password'])) {
                     if (Auth::instance()->logged_in('participant')) {
                         // sucessfully loged
                         $this->request->redirect('dashboard');
                     }
                 } else {
                     //TODO error
                 }
             } catch (ORM_Validation_Exception $e) {
                 $errors = $e->errors('user');
             }
         } else {
             $errors = $post->errors('user');
         }
     }
     // TODO i18n
     $this->template->title = __('Create an account');
     // display
     $this->template->content = View::factory('account/create')->bind('post', $post)->bind('errors', $errors);
 }
 private function getMagentoCategegories()
 {
     // init
     $this->set('success', false);
     $this->set('errormessage', 'No results found.');
     $_cached = false;
     $_output = false;
     $_languageCode = $this->get('languagecode');
     if ($this->__config->get('useMemcache')) {
         $_key = $this->__config->get('cacheKey') . '-CATEGORIES-' . $_languageCode;
         $_output = \PAJ\Library\Cache\Helper::getCachedString($_key, true);
     }
     if (!$_output) {
         $this->loadMagento($_languageCode);
         $_storeID = $this->get('storeid');
         $this->getCategoryCollection($_storeID);
         $_categories = $this->get('categories');
         if ($_categories) {
             // render html
             $_html = HTML::Categories($_categories, $this->get('categoriesproductcount'));
             $this->set('success', true);
             $_output = array('getMagentoCategories' => array('html' => $this->minify($_html, false, true)));
             $this->set('output', $_output + array('cached' => $_cached));
             if ($this->__config->get('useMemcache')) {
                 \PAJ\Library\Cache\Helper::setCachedString($_output, $_key, 3600);
             }
         } else {
             $this->set('errormessage', 'No results found.');
         }
     } else {
         $_cached = true;
         $this->set('success', true);
         $this->set('output', $_output + array('cached' => $_cached));
     }
 }
Ejemplo n.º 28
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        ?>

<h2 id="introduction">Introduction</h2>

<p>
	Welcome to the ridiculously short developer documentation for klubitus!
</p>

<h2 id="anqh">Anqh</h2>

<p>
	Klubitus is an <em>almost</em> vanilla version of <?php 
        echo HTML::anchor('http://github.com/anqh/anqh', 'Anqh ' . Anqh::VERSION, array('class' => 'label label-info'));
        ?>
,
	an open source <?php 
        echo HTML::anchor('http://php.net', 'PHP 5.3', array('class' => 'label label-info'));
        ?>
 project built on top of <?php 
        echo HTML::anchor('http://kohanaframework.org', 'Kohana ' . Kohana::VERSION, array('class' => 'label label-info'));
        ?>
.
</p>

<?php 
        return ob_get_clean();
    }
Ejemplo n.º 29
0
 /**
  * Creates a stylesheet link with LESS support
  *
  * @param   string  $style       file name
  * @param   array   $attributes  default attributes
  * @param   bool    $index       include the index page
  * @param   array   $imports     compare file date for these too, CSS and LESS in style @import
  * @return  string
  */
 public static function style($file, array $attributes = null, $index = false, $imports = null)
 {
     $imports = (array) $imports;
     // Compile only .less files
     if (substr_compare($file, '.less', -5, 5, false) === 0) {
         $css = substr_replace($file, 'css', -4);
         $compiled = is_file($css) ? filemtime($css) : 0;
         try {
             // Check if imported files have changed
             $compile = filemtime($file) > $compiled;
             if (!$compile && !empty($imports)) {
                 foreach ($imports as $import) {
                     if (filemtime($import) > $compiled) {
                         $compile = true;
                         break;
                     }
                 }
             }
             // Compile LESS
             if ($compile) {
                 $compiler = new self($file);
                 file_put_contents($css, $compiler->parse());
             }
             $file = $css;
         } catch (Exception $e) {
             Kohana::$log->add(Kohana::ERROR, __METHOD__ . ': Error compiling LESS file ' . $file . ', ' . $e->getMessage());
         }
     }
     return HTML::style($file . '?' . filemtime($file), $attributes, $index);
 }
Ejemplo n.º 30
0
 function run($dbi, $argstr, &$request, $basepage)
 {
     $request->setArg('action', false);
     $args = $this->getArgs($argstr, $request);
     extract($args);
     if ($goto = $request->getArg('goto')) {
         // The user has pressed 'Go'; process request
         $request->setArg('goto', false);
         $target = $goto['target'];
         if ($dbi->isWikiPage($target)) {
             $url = WikiURL($target, 0, 1);
         } else {
             $url = WikiURL($target, array('action' => 'edit'), 1);
         }
         $request->redirect($url);
         // User should see nothing after redirect
         return '';
     }
     $action = $request->getURLtoSelf();
     $form = HTML::form(array('action' => $action, 'method' => 'post'));
     $form->pushContent(HiddenInputs($request->getArgs()));
     $textfield = HTML::input(array('type' => 'text', 'size' => $size, 'name' => 'goto[target]'));
     $button = Button('submit:goto[go]', _("Go"), false);
     $form->pushContent($textfield, $button);
     return $form;
 }