mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-25 04:21:17 -05:00
display qr code in-place, doesn't require writeable dir and saves space
This commit is contained in:
parent
a06480d248
commit
63b8233d0c
@ -46,6 +46,7 @@ $route['cron/:any'] = "main/cron";
|
||||
$route['view/raw/:any'] = 'main/raw';
|
||||
$route['view/rss/:any'] = 'main/rss';
|
||||
$route['view/embed/:any'] = 'main/embed';
|
||||
$route['view/qr/:any'] = 'main/qr';
|
||||
$route['view/download/:any'] = 'main/download';
|
||||
$route['view/captcha'] = 'main/captcha';
|
||||
$route['view/:any'] = 'main/view';
|
||||
|
@ -8,6 +8,7 @@
|
||||
* - raw()
|
||||
* - rss()
|
||||
* - embed()
|
||||
* - qr()
|
||||
* - download()
|
||||
* - lists()
|
||||
* - trends()
|
||||
@ -472,6 +473,13 @@ class Main extends CI_Controller
|
||||
}
|
||||
}
|
||||
|
||||
function qr()
|
||||
{
|
||||
$this->load->model('pastes');
|
||||
$data = $this->pastes->getPaste(3);
|
||||
$this->load->view('view/qr', $data);
|
||||
}
|
||||
|
||||
function download()
|
||||
{
|
||||
$this->_valid_authentication();
|
||||
|
@ -127,16 +127,6 @@ class Pastes extends CI_Model
|
||||
}
|
||||
$data['ip_address'] = $this->input->ip_address();
|
||||
$this->db->insert('pastes', $data);
|
||||
|
||||
$pngPath = dirname(dirname(dirname(__FILE__))) . '/static/qr/' . $data['pid'] . '.png';
|
||||
if (!file_exists($pngPath)) {
|
||||
require_once(dirname(dirname(__FILE__)) . '/libraries/phpqrcode/qrlib.php');
|
||||
$qrurl = $this->_get_url($data['pid']);
|
||||
if ( $data['snipurl'] !== false ) {
|
||||
$qrurl = $data['snipurl'];
|
||||
}
|
||||
QRcode::png($qrurl, $pngPath);
|
||||
}
|
||||
return 'view/' . $data['pid'];
|
||||
}
|
||||
private
|
||||
@ -250,16 +240,6 @@ class Pastes extends CI_Model
|
||||
$data['hits_updated'] = $row['hits_updated'];
|
||||
$data['snipurl'] = $row['snipurl'];
|
||||
$inreply = $row['replyto'];
|
||||
|
||||
$pngPath = dirname(dirname(dirname(__FILE__))) . '/static/qr/' . $data['pid'] . '.png';
|
||||
if (!file_exists($pngPath)) {
|
||||
require_once(dirname(dirname(__FILE__)) . '/libraries/phpqrcode/qrlib.php');
|
||||
$qrurl = $this->_get_url($data['pid']);
|
||||
if ( $data['snipurl'] != false ) {
|
||||
$qrurl = $data['snipurl'];
|
||||
}
|
||||
QRcode::png($qrurl, $pngPath);
|
||||
}
|
||||
}
|
||||
|
||||
if ($inreply)
|
||||
@ -597,10 +577,6 @@ class Pastes extends CI_Model
|
||||
{
|
||||
$this->db->where('pid', $pid);
|
||||
$this->db->delete('pastes');
|
||||
$pngPath = dirname(dirname(dirname(__FILE__))) . '/static/qr/' . $pid . '.png';
|
||||
if (file_exists($pngPath)) {
|
||||
unlink($pngPath);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
/* This file prevents Apache from listing the files located in the "qr" folder */
|
||||
?>
|
14
htdocs/themes/default/views/view/qr.php
Normal file
14
htdocs/themes/default/views/view/qr.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Class and Function List:
|
||||
* Function list:
|
||||
* Classes list:
|
||||
*/
|
||||
require_once ('./application/libraries/phpqrcode/qrlib.php');
|
||||
$qrurl = $url;
|
||||
|
||||
if ($snipurl != false)
|
||||
{
|
||||
$qrurl = $snipurl;
|
||||
}
|
||||
QRcode::png($qrurl);
|
@ -44,7 +44,7 @@ if(isset($insert)){
|
||||
</span>
|
||||
</div>
|
||||
<div class="qr">
|
||||
<img src="<?php echo site_url('static/qr/' . $pid . '.png'); ?>">
|
||||
<img src="<?php echo site_url('view/qr/' . $pid); ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user