Skip to content

Commit 70afe4c

Browse files
committed
update v1
0 parents  commit 70afe4c

File tree

474 files changed

+42645
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

474 files changed

+42645
-0
lines changed

.htaccess

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# BEGIN Tatwerat
2+
3+
IndexIgnore *
4+
RewriteEngine On
5+
RewriteCond %{SCRIPT_FILENAME} !-d
6+
RewriteCond %{SCRIPT_FILENAME} !-f
7+
ErrorDocument 404 "<h1 style='color:#c00; text-align:center;'>404 <br> Page Not Found</h1>"
8+
RewriteRule ^login/redirect=(.*)$ ?page=login&redirect=$1
9+
RewriteRule ^login ?page=login
10+
RewriteRule ^fblogin ?page=fb-login
11+
RewriteRule ^logout ?page=logout
12+
RewriteRule ^register ?page=register
13+
RewriteRule ^logout ?page=logout
14+
RewriteRule ^forgot-password ?page=forgot-password
15+
RewriteRule ^edit-profile ?page=edit-profile
16+
RewriteRule ^edit-profile/id/(.*)$ ?page=edit-profile&id=$1
17+
#activeUser page
18+
RewriteRule ^active_user/user_key/(.*)$ ?page=active-account&user_key=$1
19+
RewriteRule ^active_user/id/(.*)$ ?page=active_user&user_id=$1
20+
RewriteRule ^active_user ?page=active_user
21+
#tickets
22+
RewriteRule ^tickets/create/user-id/(.*)$ ?page=create-ticket&user-id=$1
23+
RewriteRule ^tickets/create ?page=create-ticket
24+
RewriteRule ^tickets/view/(.*)$ ?page=view-ticket&id=$1
25+
#sms
26+
RewriteRule ^sms/create/user-id/(.*)$ ?page=create-sms&user-id=$1
27+
RewriteRule ^sms/create ?page=create-sms
28+
RewriteRule ^sms/view/(.*)$ ?page=view-sms&id=$1
29+
#get-ajax
30+
RewriteRule ^get-ajax/(.*)$ ?get-ajax=$1
31+
#admin-ajax
32+
RewriteRule ^ajax/(.*)$ ajax.php?function=$1
33+
RewriteRule ^ajax ajax.php
34+
#main pages
35+
RewriteRule ^main/(.*)$ ?main=show&sub_page=$1
36+
RewriteRule ^main ?main=show
37+
#setup-page
38+
RewriteRule ^setup controller/setup/setup.php
39+
# END Tatwerat

ajax.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
/*
4+
# Tatwerat Team FrameWork
5+
# By Abdo Hamoud
6+
*/
7+
8+
require_once (dirname(__file__) . '/controller/core.php');
9+
10+
// add ajax action
11+
do_action('ajax');
12+

config.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
/*
4+
# Tatwerat Team FrameWork
5+
# By Abdo Hamoud
6+
*/
7+
8+
error_reporting(E_ALL);
9+
10+
11+
// اتصال به دیتابیس
12+
define('DB_Name', ''); // نام دیتابیس
13+
define('DB_User', ''); // نام کاربری دیتابیس
14+
define('DB_Password', ''); // کلمه عبور دیتابیس
15+
define('DB_Host', 'localhost'); // DB Server Name
16+
define('DB_Charset', 'utf8'); // DB Charset Type
17+
define('DB_autoreset', TRUE); // DB Autoreset
18+
///
19+
// Available = [English, Française, Español, italiana, Deutsch, Nederlandse, português, русский, Türk, عربي, فارسي]
20+
define('Language', 'fa'); //->Set your Default Language [en, fr, es, it, de, nl, pr, ru, tr, ar, fa]
21+
22+
define('Debug', TRUE);

controller/MailChimp.class.php

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
<?php
2+
3+
/*
4+
*
5+
* MailChimp Subscribe PHP Class Form
6+
*
7+
* Let public visitors to subscribe your newsletter
8+
*
9+
* PHP Version 5.x
10+
*
11+
* Author Tatwerat-Team
12+
*
13+
* Author-Account http://themeforest.net/user/tatwerat-team
14+
*
15+
* Version 1.0
16+
*
17+
*/
18+
19+
class MailChimp_API extends AH_Model {
20+
21+
public $Key;
22+
public $ListID;
23+
public $Error;
24+
public $Email;
25+
public $FName;
26+
public $LName;
27+
public $Status = 'subscribed';
28+
public $FullData;
29+
30+
public function __construct($API_Key, $List_ID, $Full_Data = TRUE) {
31+
parent::__construct();
32+
$this->Key = $API_Key;
33+
$this->ListID = $List_ID;
34+
$this->FullData = $Full_Data;
35+
add_action('ajax', array($this, 'add_subscribe'));
36+
}
37+
38+
public function add_subscribe() {
39+
if ($this->request->http_isset('add_subscribe', 'post')) {
40+
$this->subscribed('', '', $this->request->http_post('email'));
41+
echo $this->message();
42+
}
43+
}
44+
45+
public function subscribed($fname, $lname, $email) {
46+
$this->FName = $fname;
47+
$this->LName = $lname;
48+
$this->Email = $email;
49+
$this->message();
50+
if (!$this->Error)
51+
$this->curlData($this->apiUrl(), $this->Key, $this->jsonData(), 'PUT');
52+
}
53+
54+
public function list_count() {
55+
$apiKey = $this->Key;
56+
$listId = $this->ListID;
57+
$memberId = $memberId = md5(strtolower($this->Email));
58+
$getapi = substr($this->escape($apiKey), strpos($this->escape($apiKey), '-') + 1);
59+
return 'https://' . $this->escape($getapi) . '.api.mailchimp.com/3.0/lists/d3a1b91aa7/members?offset=5&count=10';
60+
}
61+
62+
public function apiUrl() {
63+
$apiKey = $this->Key;
64+
$listId = $this->ListID;
65+
$memberId = $memberId = md5(strtolower($this->Email));
66+
$getapi = substr($this->escape($apiKey), strpos($this->escape($apiKey), '-') + 1);
67+
return 'https://' . $this->escape($getapi) . '.api.mailchimp.com/3.0/lists/' . $this->escape($listId) . '/members/' . $this->escape($memberId);
68+
}
69+
70+
public function jsonData() {
71+
return json_encode(array(
72+
'email_address' => $this->escape($this->Email),
73+
'status' => $this->escape($this->Status),
74+
'merge_fields' => array(
75+
'FNAME' => $this->escape($this->FName),
76+
'LNAME' => $this->escape($this->LName)
77+
)
78+
));
79+
}
80+
81+
public function curlData($url, $apiKey, $json, $type, $get = FALSE) {
82+
$ch = curl_init($url);
83+
curl_setopt($ch, CURLOPT_USERPWD, 'user:' . $apiKey);
84+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
85+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
86+
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
87+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type);
88+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
89+
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
90+
$result = curl_exec($ch);
91+
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
92+
curl_close($ch);
93+
if ($get)
94+
echo var_dump(json_decode($result));
95+
else
96+
$this->Error = ($httpCode != 200) ? "[error-" . $httpCode . "]" : '';
97+
}
98+
99+
public function validate() {
100+
if (empty($this->FName) and $this->FullData) {
101+
$this->Error = __('First name required');
102+
} elseif (empty($this->LName) and $this->FullData) {
103+
$this->Error = __('Last name required');
104+
} elseif (empty($this->Email)) {
105+
$this->Error = __('Email required');
106+
} elseif (!filter_var($this->Email, FILTER_VALIDATE_EMAIL)) {
107+
$this->Error = __('Invalid your email');
108+
}
109+
}
110+
111+
public function escape($string) {
112+
return htmlspecialchars(trim($string), ENT_QUOTES, 'UTF-8');
113+
}
114+
115+
public function message() {
116+
$this->validate();
117+
if (empty($this->Error)) {
118+
return __('Thank you for subscribe our newsletter');
119+
} else {
120+
if ($this->Error == "[error-0]") {
121+
return __('Bad request');
122+
} elseif ($this->Error == "[error-400]") {
123+
return __('Invalid your email');
124+
} elseif ($this->Error == "[error-401]") {
125+
return __('Invalid API key');
126+
} elseif ($this->Error == "[error-404]") {
127+
return __('Invalid list ID');
128+
}
129+
}
130+
}
131+
132+
}
133+
134+
$MailChimp_API = new MailChimp_API(get_option('MailChimp_API_KEY'), get_option('MailChimp_List_ID'), FALSE);
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* PHPMailer SPL autoloader.
4+
* PHP Version 5
5+
* @package PHPMailer
6+
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
7+
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
8+
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
9+
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
10+
* @author Brent R. Matzelle (original founder)
11+
* @copyright 2012 - 2014 Marcus Bointon
12+
* @copyright 2010 - 2012 Jim Jagielski
13+
* @copyright 2004 - 2009 Andy Prevost
14+
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
15+
* @note This program is distributed in the hope that it will be useful - WITHOUT
16+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17+
* FITNESS FOR A PARTICULAR PURPOSE.
18+
*/
19+
20+
/**
21+
* PHPMailer SPL autoloader.
22+
* @param string $classname The name of the class to load
23+
*/
24+
function PHPMailerAutoload($classname)
25+
{
26+
//Can't use __DIR__ as it's only in PHP 5.3+
27+
$filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
28+
if (is_readable($filename)) {
29+
require $filename;
30+
}
31+
}
32+
33+
if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
34+
//SPL autoloading was introduced in PHP 5.1.2
35+
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
36+
spl_autoload_register('PHPMailerAutoload', true, true);
37+
} else {
38+
spl_autoload_register('PHPMailerAutoload');
39+
}
40+
} else {
41+
/**
42+
* Fall back to traditional autoload for old PHP versions
43+
* @param string $classname The name of the class to load
44+
*/
45+
function __autoload($classname)
46+
{
47+
PHPMailerAutoload($classname);
48+
}
49+
}

0 commit comments

Comments
 (0)