diff --git a/htdocs/application/config/routes.php b/htdocs/application/config/routes.php index f4e31f2..1aa6b26 100644 --- a/htdocs/application/config/routes.php +++ b/htdocs/application/config/routes.php @@ -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'; diff --git a/htdocs/application/controllers/main.php b/htdocs/application/controllers/main.php index 8fe14f5..a39fcc3 100644 --- a/htdocs/application/controllers/main.php +++ b/htdocs/application/controllers/main.php @@ -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(); diff --git a/htdocs/application/models/pastes.php b/htdocs/application/models/pastes.php index b351bc8..2200dec 100644 --- a/htdocs/application/models/pastes.php +++ b/htdocs/application/models/pastes.php @@ -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; } diff --git a/htdocs/static/qr/index.php b/htdocs/static/qr/index.php deleted file mode 100644 index 3f4f596..0000000 --- a/htdocs/static/qr/index.php +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/htdocs/themes/default/views/view/qr.php b/htdocs/themes/default/views/view/qr.php new file mode 100644 index 0000000..6259812 --- /dev/null +++ b/htdocs/themes/default/views/view/qr.php @@ -0,0 +1,14 @@ +