Skip to content

Commit

Permalink
little correct url fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sabotag committed Apr 24, 2013
1 parent 898f17a commit 4a4bf27
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea/
application/cache/
application/logs/
source/
source/
test.php
2 changes: 1 addition & 1 deletion application/classes/controller/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function get_novelty ()
{
$comments = $polls = array();

$materials = Jelly::query ('material')->where('on_index', '=', 1)->order_by('novelty_index', 'DESC')->order_by('date', 'DESC')->limit(16)->select_all();
$materials = Jelly::query ('material')->where('on_index', '=', 1)->order_by('novelty_index', 'ASC')->order_by('date', 'DESC')->limit(16)->select_all();

$mids = array();

Expand Down
10 changes: 5 additions & 5 deletions application/classes/model/material.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public static function initialize(Jelly_Meta $meta)
'label' => 'material.field.url'
)),

'fix_url' => Jelly::field('string', array(
'url_fix' => Jelly::field('string', array(
'default' => false,
'label' => 'material.field.fix_url'
'label' => 'material.field.url_fix'
)),

'tags' => Jelly::field('manytomany'),
Expand Down Expand Up @@ -131,7 +131,7 @@ public function file()

$url = $this->url;

if( ! $this->fix_url AND $url)
if( ! $this->url_fix AND $url)
{
$headers = @get_headers($url);

Expand All @@ -141,7 +141,7 @@ public function file()
}
}

$this->fix_url = true;
$this->url_fix = true;

$this->save();

Expand Down Expand Up @@ -360,4 +360,4 @@ public function total_recount()
return false;
}

}
}
3 changes: 1 addition & 2 deletions application/views/material/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ function setLimit(begin, end)
<?if($material->video):?>
<div id="player"></div>
<?else:?>
<?=$material->file()?>
<!-- <img src="/--><?//=$material->file()?><!--" alt=""/>-->
<img src="/<?=$material->file()?>" alt=""/>
<?endif;?>
</div>
<div class="wrapper">
Expand Down
2 changes: 1 addition & 1 deletion application/views/material/show.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<?if($material->video):?>
<div id="player"></div>
<?else:?>
<img src="<?=($material->fix_url? '/' : '')?><?=$material->file()?>" alt=""/>
<img src="<?=($material->url_fix || !$material->url ? '/' : '')?><?=$material->file()?>" alt=""/>
<?endif;?>
</div>
<div class="views-info">
Expand Down
15 changes: 14 additions & 1 deletion test.php
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
adas
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111
111111111111

0 comments on commit 4a4bf27

Please sign in to comment.