Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by deZender.Net
- * @ deZender (PHP5 Decoder for ionCube Encoder)
- *
- * @ Version : 1.1.3.0
- * @ Author : DeZender
- * @ Release on : 17.05.2011
- * @ Official site : http://DeZender.Net
- *
- */
- class users {
- var $id = null;
- var $error = null;
- var $clean = null;
- var $settings = null;
- var $array = null;
- var $tmp = null;
- function users($id = 0) {
- global $db;
- if ($id) {
- $this->id = $id;
- $this->array = array( );
- $this->array = $db->fetchAssoc( 'select * from ' . TABLE_USERS . ' where id=' . $id );
- foreach ($this->array as $key => $value) {
- $this->array[$key] = clean( $value );
- }
- }
- }
- function getid() {
- return $this->id;
- }
- function delete($id = 0) {
- global $db;
- global $config_abs_path;
- global $config_demo;
- if ($config_demo == 1) {
- return null;
- }
- if (!$id) {
- $id = $this->id;
- }
- $username = $this->getUsername( $id );
- $res_del = $db->query( 'delete from ' . TABLE_USERS . ' where id="' . $id . '"' );
- $listings = new listings( );
- $listings->deleteUser( $id );
- auth::deleteloginhistory( $username );
- users_packages::deleteuser( $id );
- global $ads_settings;
- if ($ads_settings['saved_searches_enabled']) {
- require_once( $config_abs_path . '/classes/searches.php' );
- searches::deleteuser( $id );
- }
- require_once( $config_abs_path . '/classes/actions.php' );
- actions::deleteuser( $id );
- require_once( $config_abs_path . '/classes/coupons.php' );
- coupons::deleteuser( $id );
- $res_del = $db->query( 'delete from ' . TABLE_OPTIONS . ( '' . ' where `object_id`=\'' . $id . '\' and `option`=\'store\'' ) );
- }
- function deleteusers($group) {
- global $db;
- $arr = $db->fetchRowList( 'select id from ' . TABLE_USERS . ( '' . ' where `group`=' . $group ) );
- foreach ($arr as $row) {
- $this->delete( $row );
- }
- return 1;
- }
- function enable($id = 0) {
- global $db;
- global $config_demo;
- if ($config_demo == 1) {
- return null;
- }
- $array = $db->fetchAssoc( 'select ' . TABLE_USERS . '.*, (' . TABLE_USERS . '.active=0 && ' . TABLE_USER_GROUPS . '.admin_verification=1 ) as pending from ' . TABLE_USERS . ' left join ' . TABLE_USER_GROUPS . ' on ' . TABLE_USERS . '.`group` = ' . TABLE_USER_GROUPS . '.`id` where ' . TABLE_USERS . ( '' . '.`id` =' . $id ) );
- if (!$id) {
- $id = $this->id;
- }
- $res = $db->query( 'update ' . TABLE_USERS . ' set active=1 where id="' . $id . '"' );
- if ($array['pending']) {
- global $config_abs_path;
- require_once( $config_abs_path . '/classes/mails.php' );
- require_once( $config_abs_path . '/classes/mail_templates.php' );
- $mail2send = new mails( );
- $mail2send->init( $array['email'], $array['contact_name'] );
- $array_subject = array( );
- $array_message = array( 'user' => $array, 'username' => $array['username'] );
- $mail2send->composeAndSend( 'registration', $array_message, $array_subject );
- }
- }
- function enablestore($id) {
- global $db;
- $db->query( 'update ' . TABLE_USERS . ( '' . ' set `store` = 1 where `id`=\'' . $id . '\'' ) );
- global $ads_settings;
- $days_expires = $ads_settings['store_availability'];
- $timestamp = date( 'Y-m-d H:i:s' );
- if ($days_expires) {
- $str_expires = '' . ' `date_expires` = date_add(\'' . $timestamp . '\', interval \'' . $days_expires . '\' day)';
- } else {
- $str_expires = ' `date_expires` = \'\'';
- }
- $db->query( 'delete from ' . TABLE_OPTIONS . ( '' . ' where `object_id` = ' . $id . ' and `option` like \'store\'' ) );
- $db->query( 'insert into ' . TABLE_OPTIONS . ( '' . ' set `object_id` = \'' . $id . '\', `option` = \'store\', `date_added` = \'' . $timestamp . '\', ' . $str_expires . ' ' ) );
- return 1;
- }
- function disablestore($id) {
- global $db;
- $db->query( 'update ' . TABLE_USERS . ( '' . ' set `store` = 0 where `id`=\'' . $id . '\'' ) );
- return 1;
- }
- function enablependingstore($id) {
- global $db;
- global $lng;
- global $ads_settings;
- $days_expires = $ads_settings['store_availability'];
- $timestamp = date( 'Y-m-d H:i:s' );
- if ($days_expires) {
- $str_expires = '' . '`date_expires` = date_add(\'' . $timestamp . '\', interval \'' . $days_expires . '\' day)';
- } else {
- $str_expires = '`date_expires` = \'\'';
- }
- $db->query( 'update ' . TABLE_USERS . ( '' . ' set `store` = 1 where `id`=\'' . $id . '\'' ) );
- $db->query( 'delete from ' . TABLE_OPTIONS . ( '' . ' where `object_id` = ' . $id . ' and `option` like \'store\'' ) );
- $db->query( 'insert into ' . TABLE_OPTIONS . ( '' . ' set `object_id` = \'' . $id . '\', `option` = \'store\', `date_added` = \'' . $timestamp . '\', ' . $str_expires . ' ' ) );
- $db->query( 'update ' . TABLE_ACTIONS . ( '' . ' set pending=0 where type=\'store\' and `user_id` = ' . $id ) );
- global $config_abs_path;
- require_once( $config_abs_path . '/classes/mails.php' );
- require_once( $config_abs_path . '/classes/mail_templates.php' );
- $user = new users( );
- $user_details = $user->getUser( $id );
- $username = $user_details['username'];
- $user_email = $user_details['email'];
- $user_contact = $user_details['contact_name'];
- if (!$user_contact) {
- $user_contact = $username;
- }
- $mail2send = new mails( );
- $mail2send->init( $user_email, $user_contact );
- $array_subject = array( );
- $array_message = array( 'id' => $id, 'username' => $username, 'contact_name' => $user_contact, 'days' => $ads_settings['store_availability'], 'admin_activated' => 1, 'status' => $lng['general']['active'] );
- $mail2send->composeAndSend( 'buy_store_status', $array_message, $array_subject );
- return 1;
- }
- function enablebulkuploads($id) {
- global $db;
- $db->query( 'update ' . TABLE_USERS . ( '' . ' set `bulk_uploads` = 1 where `id`=\'' . $id . '\'' ) );
- return 1;
- }
- function disablebulkuploads($id) {
- global $db;
- $db->query( 'update ' . TABLE_USERS . ( '' . ' set `bulk_uploads` = 0 where `id`=\'' . $id . '\'' ) );
- return 1;
- }
- function disable($id = 0) {
- global $db;
- global $config_demo;
- if ($config_demo == 1) {
- return null;
- }
- if (!$id) {
- $id = $this->id;
- }
- $res = $db->query( 'update ' . TABLE_USERS . ' set active=0 where id="' . $id . '"' );
- }
- function block($id) {
- global $db;
- global $config_demo;
- if ($config_demo == 1) {
- return null;
- }
- $ip = $this->getIp( $id );
- $res = $db->query( 'delete from ' . TABLE_BLOCKED_IPS . ' where ip like "' . $ip . '"' );
- $res1 = $db->query( 'insert into ' . TABLE_BLOCKED_IPS . ' values ("' . $ip . '")' );
- }
- function unblock($id) {
- global $db;
- global $config_demo;
- if ($config_demo == 1) {
- return null;
- }
- $ip = $this->getIp( $id );
- $res = $db->query( 'delete from ' . TABLE_BLOCKED_IPS . ' where ip like "' . $ip . '"' );
- }
- function activate_link($username, $activation) {
- global $db;
- global $lng;
- $res = $db->query( 'select active from ' . TABLE_USERS . ( '' . ' where username like \'' . $username . '\'' ) );
- if (!$db->numRows( $res )) {
- $this->addError( $lng['users']['errors']['invalid_account_or_activation'] );
- return 0;
- }
- if ($db->fetchRow( ) == 1) {
- $this->addError( $lng['users']['errors']['account_already_active'] );
- return 0;
- }
- $res = $db->query( 'select id from ' . TABLE_USERS . ( '' . ' where username like \'' . $username . '\' and activation like \'' . $activation . '\'' ) );
- if (!$db->numRows( $res )) {
- $this->addError( $lng['users']['errors']['invalid_account_or_activation'] );
- return 0;
- }
- $res = $db->query( 'update ' . TABLE_USERS . ( '' . ' set active=1 where username like \'' . $username . '\'' ) );
- return 1;
- }
- function getusername($id = '') {
- global $db;
- if (!$id) {
- $id = $this->id;
- }
- $uname = $db->fetchRow( 'select username from ' . TABLE_USERS . ' where id="' . $id . '"' );
- return $uname;
- }
- function getpasshash($id = '') {
- global $db;
- if (!$id) {
- $id = $this->id;
- }
- $pass = $db->fetchRow( 'select password from ' . TABLE_USERS . ' where id="' . $id . '"' );
- return $pass;
- }
- function getuserid($username, $identity = '') {
- global $db;
- $str = '';
- if ($identity) {
- $str = '' . ' and `identity`=\'' . $identity . '\'';
- }
- $id = $db->fetchRow( 'select id from ' . TABLE_USERS . ' where username like "' . $username . '"' . $str );
- if (!$id) {
- return 0;
- }
- return $id;
- }
- function getgroup($id) {
- global $db;
- $id = $db->fetchRow( 'select `group` from ' . TABLE_USERS . ( '' . ' where id=' . $id ) );
- if (!$id) {
- return 0;
- }
- return $id;
- }
- ...............................
- ...............
- .......
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement