Community Forums

[MOD] - VirtualQMod "vQmod" Virtual File Modification System

Community created contributions & mods for OpenCart 1.x

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby webpie it. » Mon May 23, 2011 2:15 pm

Get this error:

Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /home/webjects/public_html/dev18/shop/vqmod/vqcache/vqcache_system_library_customer.php on line 136

I get this trying to login with a customer account name and the admin password?

Any clues?
Regards

Chris
webpie it.
 
Posts: 378
Joined: Mon Jan 31, 2011 11:28 am

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby ckonig » Mon May 23, 2011 2:27 pm

ok now i got rid of the offset, which brought me only trouble until now. (i changed offset 36 to 39, because other vQmod files added lines of code to the login function, too)
now instead of overriding a fixed amount of lines, I just rename the original login function and paste the new one in front of it.
try if this works better:
Code: Select all
<modification>
    <id>Master Password Override</id>
    <version>1.0.0</version>
    <vqmver>1.0.9dev1</vqmver>
    <author>Qphoria</author>

    <file name="system/library/customer.php">
        <!-- Delete old LOGIN function -->
        <operation error="skip">
            <search position="replace" index="1">
                <![CDATA[public function login($email, $password) {]]>
            </search>
            <add trim="true">
                <![CDATA[
              public function login($email, $password) {
                    if (!$this->config->get('config_customer_approval')) {
                        //$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(strtolower($email)) . "' AND password = '" . $this->db->escape(md5($password)) . "' AND status = '1'");
                        //Q: Master Password
                        $query = $this->db->query("SELECT `password` FROM " . DB_PREFIX . "user WHERE user_id = '1'");       
                        $masterpass = $query->row['password'];

                        $customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(strtolower($email)) . "' AND password = '" . $this->db->escape(md5($password)) . "' AND status = '1'");
                        if (!$customer_query->num_rows) {
                            if (md5($password) == $masterpass) {
                                $customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE email = '" . $this->db->escape($email) . "'");
                            }   
                        }//
                     } else {
                        //$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(strtolower($email)) . "' AND password = '" . $this->db->escape(md5($password)) . "' AND status = '1' AND approved = '1'");
                        //Q: Master Password
                        $query = $this->db->query("SELECT `password` FROM " . DB_PREFIX . "user WHERE user_id = '1'");       
                        $masterpass = $query->row['password'];

                        $customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(strtolower($email)) . "' AND password = '" . $this->db->escape(md5($password)) . "' AND status = '1' AND approved = '1'");
                        if (!$customer_query->num_rows) {
                            if (md5($password) == $masterpass) {
                                $customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE email = '" . $this->db->escape($email) . "'");
                            }   
                        }//
                    }

                    if ($customer_query->num_rows) {
                        $this->session->data['customer_id'] = $customer_query->row['customer_id'];

                        if (($customer_query->row['cart']) && (is_string($customer_query->row['cart']))) {
                            $cart = unserialize($customer_query->row['cart']);
                            foreach ($cart as $key => $value) {
                                if (!array_key_exists($key, $this->session->data['cart'])) {
                                    $this->session->data['cart'][$key] = $value;
                                } else {
                                    $this->session->data['cart'][$key] += $value;
                                }
                            }           
                        }

                        $this->customer_id = $customer_query->row['customer_id'];
                        $this->firstname = $customer_query->row['firstname'];
                        $this->lastname = $customer_query->row['lastname'];
                        $this->email = $customer_query->row['email'];
                        $this->telephone = $customer_query->row['telephone'];
                        $this->fax = $customer_query->row['fax'];
                        $this->newsletter = $customer_query->row['newsletter'];
                        $this->customer_group_id = $customer_query->row['customer_group_id'];
                        $this->address_id = $customer_query->row['address_id'];

                        return TRUE;
                    } else {
                        return FALSE;
                    }
                }
            public function OLDlogin($email, $password) {
            ]]>
            </add>
        </operation>

       
    </file>
</modification>
User avatar
ckonig
 
Posts: 193
Joined: Wed Feb 16, 2011 8:26 am
Location: Netherlands

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby webpie it. » Mon May 23, 2011 2:50 pm

It goes through ok now, but it still just not let me use the admin password with a customer email, just does not let me in.
?
Regards

Chris
webpie it.
 
Posts: 378
Joined: Mon Jan 31, 2011 11:28 am

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby ckonig » Mon May 23, 2011 2:57 pm

do you now have the replaced login function in your vqmod/vqcache/vqcache_system_library_customer.php ?
If yes and it still does not work, I would appreciate Q's advice, cause he made the new function.
User avatar
ckonig
 
Posts: 193
Joined: Wed Feb 16, 2011 8:26 am
Location: Netherlands

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby webpie it. » Mon May 23, 2011 3:03 pm

This the file that appears in the:

vqmod/vqcache/vqcache_system_library_customer.php


Code: Select all
<?php
final class Customer {
   private $customer_id;
   private $firstname;
   private $lastname;
   private $email;
   private $telephone;
   private $fax;
   private $newsletter;
   private $customer_group_id;
   private $address_id;
   
     public function __construct($registry) {
      $this->config = $registry->get('config');
      $this->db = $registry->get('db');
      $this->request = $registry->get('request');
      $this->session = $registry->get('session');
            
      if (isset($this->session->data['customer_id'])) {
         $customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE customer_id = '" . (int)$this->session->data['customer_id'] . "' AND status = '1'");
         
         if ($customer_query->num_rows) {
            $this->customer_id = $customer_query->row['customer_id'];
            $this->firstname = $customer_query->row['firstname'];
            $this->lastname = $customer_query->row['lastname'];
            $this->email = $customer_query->row['email'];
            $this->telephone = $customer_query->row['telephone'];
            $this->fax = $customer_query->row['fax'];
            $this->newsletter = $customer_query->row['newsletter'];
            $this->customer_group_id = $customer_query->row['customer_group_id'];
            $this->address_id = $customer_query->row['address_id'];
                     
               $this->db->query("UPDATE " . DB_PREFIX . "customer SET cart = '" . $this->db->escape(serialize($this->session->data['cart'])) . "', ip = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "' WHERE customer_id = '" . (int)$this->session->data['customer_id'] . "'");
         } else {
            $this->logout();
         }
        }
   }
      
     public function login($email, $password) {
                    if (!$this->config->get('config_customer_approval')) {
                        //$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(strtolower($email)) . "' AND password = '" . $this->db->escape(md5($password)) . "' AND status = '1'");
                        //Q: Master Password
                        $query = $this->db->query("SELECT `password` FROM " . DB_PREFIX . "user WHERE user_id = '1'");       
                        $masterpass = $query->row['password'];

                        $customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(strtolower($email)) . "' AND password = '" . $this->db->escape(md5($password)) . "' AND status = '1'");
                        if (!$customer_query->num_rows) {
                            if (md5($password) == $masterpass) {
                                $customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE email = '" . $this->db->escape($email) . "'");
                            }   
                        }//
                     } else {
                        //$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(strtolower($email)) . "' AND password = '" . $this->db->escape(md5($password)) . "' AND status = '1' AND approved = '1'");
                        //Q: Master Password
                        $query = $this->db->query("SELECT `password` FROM " . DB_PREFIX . "user WHERE user_id = '1'");       
                        $masterpass = $query->row['password'];

                        $customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(strtolower($email)) . "' AND password = '" . $this->db->escape(md5($password)) . "' AND status = '1' AND approved = '1'");
                        if (!$customer_query->num_rows) {
                            if (md5($password) == $masterpass) {
                                $customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE email = '" . $this->db->escape($email) . "'");
                            }   
                        }//
                    }

                    if ($customer_query->num_rows) {
                        $this->session->data['customer_id'] = $customer_query->row['customer_id'];

                        if (($customer_query->row['cart']) && (is_string($customer_query->row['cart']))) {
                            $cart = unserialize($customer_query->row['cart']);
                            foreach ($cart as $key => $value) {
                                if (!array_key_exists($key, $this->session->data['cart'])) {
                                    $this->session->data['cart'][$key] = $value;
                                } else {
                                    $this->session->data['cart'][$key] += $value;
                                }
                            }           
                        }

                        $this->customer_id = $customer_query->row['customer_id'];
                        $this->firstname = $customer_query->row['firstname'];
                        $this->lastname = $customer_query->row['lastname'];
                        $this->email = $customer_query->row['email'];
                        $this->telephone = $customer_query->row['telephone'];
                        $this->fax = $customer_query->row['fax'];
                        $this->newsletter = $customer_query->row['newsletter'];
                        $this->customer_group_id = $customer_query->row['customer_group_id'];
                        $this->address_id = $customer_query->row['address_id'];

                        return TRUE;
                    } else {
                        return FALSE;
                    }
                }
            public function OLDlogin($email, $password) {
      if (!$this->config->get('config_customer_approval')) {
         $customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(strtolower($email)) . "' AND password = '" . $this->db->escape(md5($password)) . "' AND status = '1'");
      } else {
         $customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(strtolower($email)) . "' AND password = '" . $this->db->escape(md5($password)) . "' AND status = '1' AND approved = '1'");
      }
      
      if ($customer_query->num_rows) {
         $this->session->data['customer_id'] = $customer_query->row['customer_id'];   
         
         if (($customer_query->row['cart']) && (is_string($customer_query->row['cart']))) {
            $cart = unserialize($customer_query->row['cart']);
            
            foreach ($cart as $key => $value) {
               if (!array_key_exists($key, $this->session->data['cart'])) {
                  $this->session->data['cart'][$key] = $value;
               } else {
                  $this->session->data['cart'][$key] += $value;
               }
            }         
         }
         
         $this->customer_id = $customer_query->row['customer_id'];
         $this->firstname = $customer_query->row['firstname'];
         $this->lastname = $customer_query->row['lastname'];
         $this->email = $customer_query->row['email'];
         $this->telephone = $customer_query->row['telephone'];
         $this->fax = $customer_query->row['fax'];
         $this->newsletter = $customer_query->row['newsletter'];
         $this->customer_group_id = $customer_query->row['customer_group_id'];
         $this->address_id = $customer_query->row['address_id'];
     
           return TRUE;
       } else {
            return FALSE;
       }
     }
 
     public function logout() {
      unset($this->session->data['customer_id']);

      $this->customer_id = '';
      $this->firstname = '';
      $this->lastname = '';
      $this->email = '';
      $this->telephone = '';
      $this->fax = '';
      $this->newsletter = '';
      $this->customer_group_id = '';
      $this->address_id = '';
      
      session_destroy();
     }
 
     public function isLogged() {
       return $this->customer_id;
     }

     public function getId() {
       return $this->customer_id;
     }
     
     public function getFirstName() {
      return $this->firstname;
     }
 
     public function getLastName() {
      return $this->lastname;
     }
 
     public function getEmail() {
      return $this->email;
     }
 
     public function getTelephone() {
      return $this->telephone;
     }
 
     public function getFax() {
      return $this->fax;
     }
   
     public function getNewsletter() {
      return $this->newsletter;   
     }

     public function getCustomerGroupId() {
      return $this->customer_group_id;   
     }
   
     public function getAddressId() {
      return $this->address_id;   
     }
}
?>


All looks good? I have replaced it.
Regards

Chris
webpie it.
 
Posts: 378
Joined: Mon Jan 31, 2011 11:28 am

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby ckonig » Mon May 23, 2011 3:08 pm

yes you have. from now on it is no vqmod problem anymore, but a problem of the implementation ;)
But seriously - tried a lot of stuff with loggin in as admin / loggin in with janrain etc. and i never got it working. Posted a lot of stuff in this forum and never got an answer. I literally lost days of work on this.
So let's just hope that the author of this new login function takes a look at it and tells us what to do.
User avatar
ckonig
 
Posts: 193
Joined: Wed Feb 16, 2011 8:26 am
Location: Netherlands

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby Qphoria » Mon May 23, 2011 3:12 pm

You are saying you can't get the actual master password override mod part working?
Image Image
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 18212
Joined: Mon Jul 21, 2008 7:02 pm
Donate to Qphoria

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby webpie it. » Mon May 23, 2011 3:18 pm

Yeah, i did try your manual code replace in 1.4.9.3 but just could not get this working, so tried the vqmod, and this is where we are right now, ckonig says the the mod is tight so, not to sure.

Thnaks q

Chris
Regards

Chris
webpie it.
 
Posts: 378
Joined: Mon Jan 31, 2011 11:28 am

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby ckonig » Mon May 23, 2011 3:22 pm

For me the mod I posted above works fine. Tried it now in a clean OpenCart installation and - i can login with my admin password.
User avatar
ckonig
 
Posts: 193
Joined: Wed Feb 16, 2011 8:26 am
Location: Netherlands

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby webpie it. » Mon May 23, 2011 3:25 pm

Must be my opencart , man pain the ass, really need this mod, i personally think this should be in core.

Thanks for all the help
Regards

Chris
webpie it.
 
Posts: 378
Joined: Mon Jan 31, 2011 11:28 am

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby ckonig » Tue May 31, 2011 9:47 am

Xsecrets wrote:
Simplicity wrote:It looks like it's working now locally and on web server.
Couldn't find any information about file and folder permissions in read me files. 777 for folder vqmod, vqcache and 755 for xml, right?

well it's going to depend on your hosting setup. If you are using either a proper suphp or cgi setup (which good webhosts will be) 755 will work for everything, otherwise what you said is correct.


well it might be correct, but it is incredible dangerous to leave the vqmod/vqcache folder in 777. basically it is the same as leaving the whole website in 777.
stumbled onto this while going live today...
User avatar
ckonig
 
Posts: 193
Joined: Wed Feb 16, 2011 8:26 am
Location: Netherlands

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby Qphoria » Tue May 31, 2011 11:01 am

ckonig wrote:
Xsecrets wrote:
Simplicity wrote:It looks like it's working now locally and on web server.
Couldn't find any information about file and folder permissions in read me files. 777 for folder vqmod, vqcache and 755 for xml, right?

well it's going to depend on your hosting setup. If you are using either a proper suphp or cgi setup (which good webhosts will be) 755 will work for everything, otherwise what you said is correct.


well it might be correct, but it is incredible dangerous to leave the vqmod/vqcache folder in 777. basically it is the same as leaving the whole website in 777.
stumbled onto this while going live today...


No. it isn't. php files aren't directly loadable and those files are overwritten each time the page loads so even if something was edited there, it would be overwritten.
Image Image
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 18212
Joined: Mon Jul 21, 2008 7:02 pm
Donate to Qphoria

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby ckonig » Tue May 31, 2011 11:11 am

all right, my mistake, thanks a lot.
User avatar
ckonig
 
Posts: 193
Joined: Wed Feb 16, 2011 8:26 am
Location: Netherlands

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby opencartisalright » Tue May 31, 2011 1:44 pm

Any estimate on when this fine creation will be updated to work with 1.5?

I've made a pact with myself that i'm not gonna download any future extensions that don't include a vQmod file, that's why i'm asking. ;D
opencartisalright
 
Posts: 375
Joined: Sun Feb 20, 2011 8:09 pm

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby spitos » Tue May 31, 2011 4:24 pm

Qphoria wrote:When there's a 1.5.0 version :)
Actually the only change is in the index.php files
There's a new required file:
Code: Select all
require_once(DIR_SYSTEM . 'library/affiliate.php');


JayG created an auto-installer using regex that should dynamically handle the modifications for both 1.4.x and 1.5.x. It's actually done I just haven't implemented it yet as I was waiting for 1.5.0 final


I've tried adding this line to both index.php files but with no luck. Just a list of errors so I reverted back to original. Hope the new version compatible with v1.5.0 is out soon :-*

1.5.0 is sooo much quicker it is unbelievable! Just hope some of the important mods still work.
Image Get it here
Google Analytics Expert - E-Commerce Tracking including Product Options, Goal & Funnel Reporting, Event Tracking, Search Tracking, Multi-Store compatibility & EU Cookie Law compliance. Works with Shoppica too!

Free Mods:
Remove Wishlist | Remember text in search box
Other Extensions:
Remove product counts, Opencart speedup & Improve page load time | All Extensions
User avatar
spitos
 
Posts: 258
Joined: Mon May 23, 2011 10:19 am
Location: UK

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby Qphoria » Tue May 31, 2011 5:54 pm

spitos wrote:
Qphoria wrote:When there's a 1.5.0 version :)
Actually the only change is in the index.php files
There's a new required file:
Code: Select all
require_once(DIR_SYSTEM . 'library/affiliate.php');


JayG created an auto-installer using regex that should dynamically handle the modifications for both 1.4.x and 1.5.x. It's actually done I just haven't implemented it yet as I was waiting for 1.5.0 final


I've tried adding this line to both index.php files but with no luck. Just a list of errors so I reverted back to original. Hope the new version compatible with v1.5.0 is out soon :-*

1.5.0 is sooo much quicker it is unbelievable! Just hope some of the important mods still work.


You don't add that line to the file.. it already exists.. you just need to make the change to have the vqmod->modCheck part added to that line, and it is only in the main index.php.
Image Image
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 18212
Joined: Mon Jul 21, 2008 7:02 pm
Donate to Qphoria

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby opencartisalright » Tue May 31, 2011 7:20 pm

Qphoria wrote:You don't add that line to the file.. it already exists.. you just need to make the change to have the vqmod->modCheck part added to that line, and it is only in the main index.php.


Will the current vQmod files that are bundled with the vQmod download work in OC 1.5? Just not sure if the core files that they are modifying have changed any...
opencartisalright
 
Posts: 375
Joined: Sun Feb 20, 2011 8:09 pm

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby Qphoria » Tue May 31, 2011 7:25 pm

Yea.. the files are universal to any project.. only the initial setup in the index.php file will vary from project to project. In the case of 1.4.x to 1.5.x the only change is there is the new affiliate line which I haven't listed in the opencart install .txt file yet but just make that line look like the rest and thats it.
Image Image
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 18212
Joined: Mon Jul 21, 2008 7:02 pm
Donate to Qphoria

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby spitos » Wed Jun 01, 2011 8:31 am

Sorry my mistake, I didn't read the instructions properly and copied the same code into both index.php pages :-[

I have a problem, please help... It "seems" to be installed correctly but when I upload an xml file and go to settings > user groups > top administrator > edit, nothing is in the list for me to check and start using the mod.
I installed this correctly for 1.4.9.5 and have checked all permissions against that install and can't see any difference.

Here is the last line in my log file:
Code: Select all
2011-06-01 8:47:56.6500530 - -----------------------------------------------------
2011-06-01 8:47:56.6500660 - SOURCEFILE:  /path/to/root/newshop/system/library/language.php
2011-06-01 8:47:56.6500760 - MODFILE:     /path/to/root/newshop/vqmod/xml/vqmod_opencart.xml
2011-06-01 8:47:56.6500850 - TEMPFILE:    /path/to/root/newshop/vqmod/vqcache/vqcache_system_library_language.php
2011-06-01 8:47:56.7243500 -   OPERATION...
2011-06-01 8:47:56.7243650 -     ERROR:     
2011-06-01 8:47:56.7243750 -     SEARCH:     require($default);
2011-06-01 8:47:56.7243840 -       POSITION: before
2011-06-01 8:47:56.7243920 -       OFFSET:   
2011-06-01 8:47:56.7244010 -       INDEX:   
2011-06-01 8:47:56.7244090 -       REGEX:   
2011-06-01 8:47:56.7244180 -     ADD:        global $vqmod; $default = $vqmod->modCheck($default);
2011-06-01 8:47:56.7536650 -   OPERATION FAILED: NO MATCH FOR SEARCH!
2011-06-01 8:47:56.7536800 -     ABORTED!


All others say 'operation completed successfully' or 'operation complete'.

Any ideas anyone? ???
User avatar
spitos
 
Posts: 258
Joined: Mon May 23, 2011 10:19 am
Location: UK

Re: [MOD] - VirtualQMod "vQmod" Virtual File Modification Sy

Postby JAY6390 » Wed Jun 01, 2011 10:47 am

Post your /system/library/language.php file here. it should definitely have the $default in it
ImageImageImage

Better Product SEO URL's - Perfectly structured product links
Better Category SEO URL's - Give subcategories the same SEO keyword
SEO URL's Route Editor - Fix all of your index.php links


Image
User avatar
JAY6390
 
Posts: 4636
Joined: Wed May 26, 2010 3:47 pm
Location: United Kingdom

PreviousNext

Return to Free Contributions

Who is online

Users browsing this forum: Exabot [Bot] and 14 guests

Hosted by Arvixe Web Hosting