Welcome Guest, Not a member yet? Register   Sign In
Need help related to my codeigniter wallpaper script
#1
Sad 

Hi everyone!

I just bought the PHPWscript (_phpwscript.com) a week ago, which is made with codeigniter.

From the indian developer i have no support. Sad


So, maybe is anyone here that can help me to install the script, because i tried with 2 other friends that have more knowledge than me in webdev, but we can't make it work.

My domain is at _uhdwallpapers.org (the underscore in front is to not be hyperlink).

Now if you look returns some weird characters.

If there is someone here that knows to install this script write me a message in private to discuss details.


Thank you.

PS: Sorry if I posted in the wrong topic.
Reply
#2

(This post was last modified: 01-01-2018, 02:26 AM by Paradinight.)

(12-31-2017, 05:59 AM)stand Wrote: Hi everyone!

I just bought the PHPWscript (_phpwscript.com) a week ago, which is made with codeigniter.

From the indian developer i have no support. Sad


So, maybe is anyone here that can help me to install the script, because i tried with 2 other friends that have more knowledge than me in webdev, but we can't make it work.

My domain is at _uhdwallpapers.org (the underscore in front is to not be hyperlink).

Now if you look returns some weird characters.

If there is someone here that knows to install this script write me a message in private to discuss details.


Thank you.

PS: Sorry if I posted in the wrong topic.

Go to application/config/config.php and set $config['compress_output'] to false

I get ERR_CONTENT_DECODING_FAILED and not weird characters.

edit:

Codeigniter Version?
Reply
#3

(01-01-2018, 02:21 AM)Paradinight Wrote: Go to application/config/config.php and set $config['compress_output'] to false

I get ERR_CONTENT_DECODING_FAILED and not weird characters.

edit:

Codeigniter Version?

Thank you!

Indeed, now "weird" characters has gone.

I think if i'd look right in the codeigniter.php the version is this:

/**
 * CodeIgniter Version
 *
 * @var    string
 *
 */
    define('CI_VERSION', '3.1.0-dev');

/*

I still get some errors related to database i guess, but i will try to figure it out.
Reply
#4

(This post was last modified: 01-01-2018, 06:23 AM by stand.)

By the way if it is set $config['compress_output'] to false is there a downside effect?

Should be true or false? Smile
Reply
#5

(01-01-2018, 03:09 AM)stand Wrote: By the way if it is set $config['compress_output'] to false is there a downside effect?

Should be true or false? Smile

false is correct. You webserver does the job. you should update/downgrade codeigniter from 3.1.0-dev to 3.1.6.
Reply
#6

I thought to not open another topic...

Can anyone help me with this error?

Code:
A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BETWEEN0 AND 20 GROUP BY `wallpaper_seq_id`) wc) JOIN `WS_wallpapers` `w` ON `w`' at line 6

SELECT COUNT(*) AS `numrows` FROM ((SELECT *, sum(count) AS color_sum FROM `WS_wallpapers_colors` WHERE `saturation` BETWEEN 0.6 AND 1 AND `lightness` BETWEEN 0.39 AND 0.79 AND `hue` BETWEEN0 AND 20 GROUP BY `wallpaper_seq_id`) wc) JOIN `WS_wallpapers` `w` ON `w`.`wallpaper_seq_id` = `wc`.`wallpaper_seq_id` LEFT JOIN (SELECT `t2`.*, GROUP_CONCAT(c.category_slug order by c1.lvl desc SEPARATOR '/') AS cFullSlug, GROUP_CONCAT(c.category_name order by c1.lvl desc SEPARATOR '|') AS cFullName FROM `WS_closures` `c1` LEFT JOIN `WS_category` `c` ON `c`.`category_seq_id` = `c1`.`ancestor` LEFT JOIN `WS_category` `t2` ON `t2`.`category_seq_id` = `c1`.`descendant` GROUP BY `c1`.`descendant`) as c ON `c`.`category_seq_id` = `w`.`category_seq_id` WHERE `w`.`wallpaper_status` = 1 AND `w`.`wallpaper_approved` = 1

Filename: core/WS_Model.php

Line Number: 76


Thank you!
Reply
#7

On line 76 you will need to add a space.

Before:
BETWEEN0 AND 20 GROUP BY

After:
BETWEEN 0 AND 20 GROUP BY
Reply
#8

Yes you're right, but something is not right.

Not all colors returns an error.

Check in here https://uhdwallpapers.org/wallpaper/christmas-table_64/ to see what i mean. (first 2 colors from left not return an error, but not return this wallpaper that have this color and all other colors returns the above error)

Also at line 76 from core/WS_Model.php is this code:

Code:
   public function count()
   {
       $this->eachDay_newCache(); //line 74
       $this->ShutDownCache(); //line 75
       $return = $this->db->count_all_results(); // line 76
       $this->turnOnCache(); // line 77
       return $return; //line 78
   }


Not sure what could be wrong at line 76.

If helps you, this is the entire code for WS_Model.php.

Code:
<?php defined('BASEPATH') OR exit('No direct script access allowed');


class WS_model extends CI_Model
{
   var $cacheOffRequest = false;
   var $is_cache_on = true;

   public function __construct()
   {
       parent::__construct();
       if (!empty($this->db))
           $this->is_cache_on = $this->db->cache_on;
   }

   public function cacheOff()
   {
       $this->cacheOffRequest = true;
   }

   public function result()
   {
       $this->eachDay_newCache();
       $this->ShutDownCache();
       $query = $this->db->get();
       $this->turnOnCache();
       if ($query->num_rows())
           return $query->result();
       return false;
   }

   public function eachDay_newCache()
   {
       //$this->db->where('\'' . date('y-m-d H') . '\' = \'' . date('y-m-d H') . '\'');
   }

   public function ShutDownCache()
   {
       if ($this->is_cache_on && $this->cacheOffRequest)
           $this->db->cache_off();
   }

   public function turnOnCache()
   {
       if ($this->is_cache_on && $this->cacheOffRequest)
           $this->db->cache_on();
       $this->cacheOffRequest = false;
   }

   public function result_array()
   {
       $this->eachDay_newCache();
       $this->ShutDownCache();
       $query = $this->db->get();
       $this->turnOnCache();
       if ($query->num_rows())
           return $query->result_array();
       return false;
   }

   public function row()
   {
       $this->eachDay_newCache();
       $this->ShutDownCache();
       $query = $this->db->get();
       $this->turnOnCache();
       if ($query->num_rows())
           return $query->row();
       return false;
   }

   public function count()
   {
       $this->eachDay_newCache();
       $this->ShutDownCache();
       $return = $this->db->count_all_results();
       $this->turnOnCache();
       return $return;
   }

   public function insert_path_single_($insert_id, $category_id)
   {
       $this->db->select("$insert_id, ancestor");
       $this->db->from('closures');
       $this->db->where('descendant', ($category_id ? $category_id : 0));
       $sql = $this->sql();

       $query = 'INSERT INTO {PRE}wallpapers_path (wallpaper_seq_id, category_seq_id) ' . $sql . '';

       $this->db->query($query);
   }

   public function sql($eachDay = false)
   {
       if ($eachDay)
           $this->eachDay_newCache();
       return $this->db->return_query();
   }

   public function removeWallpaperPath_($wall_id)
   {
       $this->db->delete('wallpapers_path', array('wallpaper_seq_id' => $wall_id));
       return $this->db->affected_rows();
   }

   public function sql_md5()
   {
       return md5($this->sql(true));
   }

   public function wallpaperTemplate($select = true, $type = 'normal', $options = array())
   {
       $tags = isset($options['tag']) ? $options['tag'] : false;
       $colors = isset($options['colors']) ? $options['colors'] : false;
       $download_sql = $this->wallpaperDownloads();

       $category_sql = $this->wallCatTemplate();
       $tag_sql = $this->wallTagsTemplate();
       $views_sql = $this->wallpaperViews();
       $favourites_sql = $this->wallpaperFavourite();
       $count = isset($options['count']) ? $options['count'] : false;

       $vote_sql = $this->wallVotes();
       $tag_view_sql = $this->tag_view_sql($tags);

       if ($colors)
           $colorPath_sql = $this->color_sql($colors);

       if ($select)
           $this->db->select('w.*,c.category_name,c.category_slug,c.category_parent_id,c.category_status,c.cFullSlug,c.cFullName,u.user_name,u.user_email,t.tags,d.total_downloads,v.total_views,f.total_favourites,vo.vote_up,vo.vote_down');

       switch ($type) {
           case'by_user_downloads':
               $this->db->from('(SELECT * FROM {PRE}wallpapers_downloads where wd_uid = ' . $options['by_user_downloads'] . ' GROUP by wd_wid) bud');
               $this->db->join('wallpapers w', 'w.wallpaper_seq_id = bud.wd_wid');
               $this->db->join("($category_sql) as c", 'c.category_seq_id = w.category_seq_id', 'left');
               break;
           case'by_user_favourites':
               $this->db->from('(SELECT * FROM {PRE}wallpapers_favourites where wf_uid = ' . $options['by_user_favourites'] . ') buf');
               $this->db->join('wallpapers w', 'w.wallpaper_seq_id = buf.wf_wid');
               $this->db->join("($category_sql) as c", 'c.category_seq_id = w.category_seq_id', 'left');
               break;
           case'by_user_likes':
               $this->db->from('(SELECT * FROM {PRE}wallpapers_votes where vote_uid = ' . $options['by_user_likes'] . ' AND vote_up = 1) bul');
               $this->db->join('wallpapers w', 'w.wallpaper_seq_id = bul.vote_wid');
               $this->db->join("($category_sql) as c", 'c.category_seq_id = w.category_seq_id', 'left');
               break;
           case'by_user_dislikes':
               $this->db->from('(SELECT * FROM {PRE}wallpapers_votes where vote_uid = ' . $options['by_user_dislikes'] . ' AND vote_down = 1) bul');
               $this->db->join('wallpapers w', 'w.wallpaper_seq_id = bul.vote_wid');
               $this->db->join("($category_sql) as c", 'c.category_seq_id = w.category_seq_id', 'left');
               break;
           case'bypath':
               $this->db->from('wallpapers_path wp');
               $this->db->join('wallpapers w', 'w.wallpaper_seq_id = wp.wallpaper_seq_id');
               $this->db->join("($category_sql) as c", 'c.category_seq_id = wp.category_seq_id', 'left');
               break;
           case'color':
               $this->db->select('wc.*');
               $this->db->from('(' . $colorPath_sql . ') wc');
               $this->db->join('wallpapers w', 'w.wallpaper_seq_id = wc.wallpaper_seq_id');
               $this->db->join("($category_sql) as c", 'c.category_seq_id = w.category_seq_id', 'left');
               break;
           case 'tag':
               $this->db->from('(' . $tag_view_sql . ') wt');
               $this->db->join('wallpapers w', 'w.wallpaper_seq_id = wt.wallpaper_seq_id');
               $this->db->join("($category_sql) as c", 'c.category_seq_id = w.category_seq_id', 'left');
               break;
           case'normal':
               $this->db->from('wallpapers w');
               if (!$count)
                   $this->db->join("($category_sql) as c", 'c.category_seq_id = w.category_seq_id', 'left');
               break;
       }

       if (!$count) {
           $this->db->join("($tag_sql) as t", 't.tag_w_id = w.wallpaper_seq_id', 'left');
           $this->db->join("($download_sql) as d", 'd.wd_wid = w.wallpaper_seq_id', 'left');
           $this->db->join("($views_sql) as v", 'v.wv_wid = w.wallpaper_seq_id', 'left');
           $this->db->join("($favourites_sql) as f", 'f.wf_wid = w.wallpaper_seq_id', 'left');
           $this->db->join("($vote_sql) as vo", 'vo.vote_wid = w.wallpaper_seq_id', 'left');
           $this->db->join('user u', 'u.user_seq_id = w.user_seq_id', 'left');

       }
   }

   public function wallpaperDownloads()
   {
       $this->db->select('td_count AS total_downloads, td_wid as wd_wid');
       $this->db->from('wallpapers_temp_downloads');
       return $this->sql();
   }

   public function wallCatTemplate($return_sql = true)
   {
       $this->db->select("t2.*, GROUP_CONCAT(c.category_slug order by c1.lvl desc SEPARATOR '/') AS cFullSlug, GROUP_CONCAT(c.category_name order by c1.lvl desc SEPARATOR '|') AS cFullName");
       $this->db->from('closures c1');
       $this->db->join('category c', 'c.category_seq_id = c1.ancestor', 'left');
       $this->db->join('category t2', 't2.category_seq_id = c1.descendant', 'left');
       $this->db->group_by('c1.descendant');
       if ($return_sql)
           return $this->sql();
   }

   public function wallTagsTemplate()
   {
       $this->db->select("tt_wid as tag_w_id, tt_tagString as tags");
       $this->db->from('wallpapers_temp_tags');
       return $this->sql();
   }

   public function wallpaperViews()
   {
       $this->db->select('tv_views_count as total_views, tv_wid as wv_wid');
       $this->db->from('wallpapers_temp_views');
       return $this->sql();
   }

   public function wallpaperFavourite()
   {
       $this->db->select('tf_count AS total_favourites,tf_wid as wf_wid');
       $this->db->from('wallpapers_temp_favourites');
       return $this->sql();
   }

   public function wallVotes()
   {
       $this->db->select('tvd_up AS vote_up,tvd_down AS vote_down,tvd_wid vote_wid');
       $this->db->from('wallpapers_temp_votes');
       return $this->sql();
   }

   public function tag_view_sql($keyword)
   {
       $this->db->from('wallpapers_tags');
       $this->db->where('LOWER(tag_name)', strtolower($keyword));
       return $this->sql();
   }

   public function color_sql($filter)
   {
       $this->db->select('*, sum(count) AS color_sum');
       $this->db->from('wallpapers_colors');
       $this->db->where('saturation BETWEEN ' . (($filter['saturation'][0]) / 100) . ' AND ' . (($filter['saturation'][1]) / 100));
       $this->db->where('lightness BETWEEN ' . (($filter['lightness'][0]) / 100) . ' AND ' . (($filter['lightness'][1]) / 100));
       $this->db->where('hue BETWEEN ' . ($filter['hue'][0]) . ' AND ' . ($filter['hue'][1]));
       $this->db->group_by('wallpaper_seq_id');
       return $this->sql();
   }

   public function wallpaperColors()
   {
       $this->db->select("wallpaper_seq_id AS wid,GROUP_CONCAT(count, '|', hex_code ORDER BY count desc) AS colors", false);
       $this->db->from('wallpapers_colors');
       $this->db->where('count !=', '0.000000000000000');
       $this->db->group_by('wallpaper_seq_id');
       return $this->sql();
   }

   public function global_wallpaper()
   {
       if ($this->is_global_wallpaper_set()) {
           $screen_size = $this->session->userdata('SCREEN_SIZE');
           if ($screen_size['width'] && $screen_size['height']) {
               $this->db->where('w.wallpaper_width >=', $screen_size['width']);
               $this->db->where('w.wallpaper_height >=', $screen_size['height']);
           }
       }
   }

   public function is_global_wallpaper_set()
   {
       return $this->session->userdata('GLOBAL') && $this->session->userdata('SCREEN_SIZE') && !$this->config->item('is_administrator');
   }
}
Reply
#9

Okey, it's actually this code that generats an error.
PHP Code:
public function color_sql($filter)
{
   
$this->db->select('*, sum(count) AS color_sum');
   
$this->db->from('wallpapers_colors');
   
$this->db->where('saturation BETWEEN ' . (($filter['saturation'][0]) / 100) . ' AND ' . (($filter['saturation'][1]) / 100));
   
$this->db->where('lightness BETWEEN ' . (($filter['lightness'][0]) / 100) . ' AND ' . (($filter['lightness'][1]) / 100));
   
$this->db->where('hue BETWEEN ' . ($filter['hue'][0]) . ' AND ' . ($filter['hue'][1]));
   
$this->db->group_by('wallpaper_seq_id');
   return 
$this->sql();


Add:
var_dump($filter);
die();

So that you can see why one color works and not the other.
Reply
#10

GROUP BY should be the last statement in database queries.

Code:
Syntax:

The syntax for the GROUP BY clause in MySQL is:

SELECT expression1, expression2, ... expression_n,
      aggregate_function (expression)
FROM tables
[WHERE conditions]
GROUP BY expression1, expression2, ... expression_n;
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB