Version Notes
0.3.0
Download this release
Release Info
Developer | Magento Core Team |
Extension | LinkDirectory |
Version | 0.3.0 |
Comparing to | |
See all releases |
Code changes from version 0.2.9 to 0.3.0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Block/Adminhtml/Linkdirectory.php +0 -0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Block/Adminhtml/Linkdirectory/Edit.php +0 -0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Block/Adminhtml/Linkdirectory/Edit/Form.php +0 -0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Block/Adminhtml/Linkdirectory/Edit/Tab/Form.php +0 -0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Block/Adminhtml/Linkdirectory/Edit/Tabs.php +0 -0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Block/Adminhtml/Linkdirectory/Grid.php +0 -0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Block/Linkdirectory.php +29 -3
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Helper/Data.php +0 -0
- app/code/community/Magestore/LinkDirectory/Helper/Url.php +323 -0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Model/Category.php +0 -0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Model/Linkdirectory.php +0 -0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Model/Mysql4/Linkdirectory.php +0 -0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Model/Mysql4/Linkdirectory/Collection.php +0 -0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Model/Status.php +0 -0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/controllers/Adminhtml/LinkdirectoryController.php +0 -0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/controllers/IndexController.php +0 -0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/controllers/InterfaceController.php +0 -0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/controllers/TestController.php +0 -0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/etc/config.xml +1 -1
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/etc/system.xml +0 -0
- app/code/community/Magestore/{Linkdirectory → LinkDirectory}/sql/linkdirectory_setup/mysql4-install-0.1.0.php +0 -0
- app/etc/modules/{Magestore_Linkdirectory.xml → Magestore_LinkDirectory.xml} +0 -0
- package.xml +7 -7
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Block/Adminhtml/Linkdirectory.php
RENAMED
File without changes
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Block/Adminhtml/Linkdirectory/Edit.php
RENAMED
File without changes
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Block/Adminhtml/Linkdirectory/Edit/Form.php
RENAMED
File without changes
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Block/Adminhtml/Linkdirectory/Edit/Tab/Form.php
RENAMED
File without changes
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Block/Adminhtml/Linkdirectory/Edit/Tabs.php
RENAMED
File without changes
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Block/Adminhtml/Linkdirectory/Grid.php
RENAMED
File without changes
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Block/Linkdirectory.php
RENAMED
@@ -46,8 +46,21 @@ class Magestore_Linkdirectory_Block_Linkdirectory extends Mage_Core_Block_Templa
|
|
46 |
$url = Mage::helper('linkdirectory')->getServerUrl();
|
47 |
|
48 |
$url .= '/linkdirectory/service/getHtmlLinks';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
-
Mage::helper('linkdirectory')->sendDataToUrl($data,$url);
|
51 |
}
|
52 |
|
53 |
public function getLinkDetailHTML()
|
@@ -68,8 +81,21 @@ class Magestore_Linkdirectory_Block_Linkdirectory extends Mage_Core_Block_Templa
|
|
68 |
$data['refine_url_view'] = $link;
|
69 |
|
70 |
$data['code_authentication'] = Mage::helper('linkdirectory')->getCodeAuthentication();
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
}
|
46 |
$url = Mage::helper('linkdirectory')->getServerUrl();
|
47 |
|
48 |
$url .= '/linkdirectory/service/getHtmlLinks';
|
49 |
+
|
50 |
+
//use new get content method
|
51 |
+
$options = array('method'=>'post',
|
52 |
+
'return_info' => true,
|
53 |
+
'post_data' => $data,
|
54 |
+
);
|
55 |
+
$content = Mage::helper('linkdirectory/url')->load($url,$options);
|
56 |
+
|
57 |
+
if(isset($content['body']) && $content['body'])
|
58 |
+
echo $content['body'];
|
59 |
+
else
|
60 |
+
echo $this->__('Not found data!');
|
61 |
+
//End use new get content method
|
62 |
|
63 |
+
//Mage::helper('linkdirectory')->sendDataToUrl($data,$url);
|
64 |
}
|
65 |
|
66 |
public function getLinkDetailHTML()
|
81 |
$data['refine_url_view'] = $link;
|
82 |
|
83 |
$data['code_authentication'] = Mage::helper('linkdirectory')->getCodeAuthentication();
|
84 |
+
|
85 |
+
//use new get content method
|
86 |
+
$options = array('method'=>'post',
|
87 |
+
'return_info' => true,
|
88 |
+
'post_data' => $data,
|
89 |
+
);
|
90 |
+
$content = Mage::helper('linkdirectory/url')->load($url,$options);
|
91 |
+
|
92 |
+
if(isset($content['body']) && $content['body'])
|
93 |
+
echo $content['body'];
|
94 |
+
else
|
95 |
+
echo $this->__('Not found data!');
|
96 |
+
//End use new get content method
|
97 |
+
|
98 |
+
//Mage::helper('linkdirectory')->sendDataToUrl($data,$url);
|
99 |
}
|
100 |
|
101 |
}
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Helper/Data.php
RENAMED
File without changes
|
app/code/community/Magestore/LinkDirectory/Helper/Url.php
ADDED
@@ -0,0 +1,323 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Magestore_Linkdirectory_Helper_Url extends Mage_Core_Helper_Abstract {
|
3 |
+
|
4 |
+
function load($url,$options=array())
|
5 |
+
{
|
6 |
+
$default_options = array(
|
7 |
+
'method' => 'get',
|
8 |
+
'post_data' => false,
|
9 |
+
'return_info' => false,
|
10 |
+
'return_body' => true,
|
11 |
+
'cache' => false,
|
12 |
+
'referer' => '',
|
13 |
+
'headers' => array(),
|
14 |
+
'session' => false,
|
15 |
+
'session_close' => false,
|
16 |
+
);
|
17 |
+
// Sets the default options.
|
18 |
+
foreach($default_options as $opt=>$value) {
|
19 |
+
if(!isset($options[$opt])) $options[$opt] = $value;
|
20 |
+
}
|
21 |
+
|
22 |
+
$url_parts = parse_url($url);
|
23 |
+
$ch = false;
|
24 |
+
$info = array(//Currently only supported by curl.
|
25 |
+
'http_code' => 200
|
26 |
+
);
|
27 |
+
$response = '';
|
28 |
+
|
29 |
+
$send_header = array(
|
30 |
+
'Accept' => 'text/*',
|
31 |
+
'User-Agent' => 'BinGet/1.00.A (http://www.bin-co.com/php/scripts/load/)'
|
32 |
+
) + $options['headers']; // Add custom headers provided by the user.
|
33 |
+
|
34 |
+
if($options['cache']) {
|
35 |
+
$cache_folder = joinPath(sys_get_temp_dir(), 'php-load-function');
|
36 |
+
if(isset($options['cache_folder'])) $cache_folder = $options['cache_folder'];
|
37 |
+
if(!file_exists($cache_folder)) {
|
38 |
+
$old_umask = umask(0); // Or the folder will not get write permission for everybody.
|
39 |
+
mkdir($cache_folder, 0777);
|
40 |
+
umask($old_umask);
|
41 |
+
}
|
42 |
+
|
43 |
+
$cache_file_name = md5($url) . '.cache';
|
44 |
+
$cache_file = joinPath($cache_folder, $cache_file_name); //Don't change the variable name - used at the end of the function.
|
45 |
+
|
46 |
+
if(file_exists($cache_file)) { // Cached file exists - return that.
|
47 |
+
$response = file_get_contents($cache_file);
|
48 |
+
|
49 |
+
//Seperate header and content
|
50 |
+
$separator_position = strpos($response,"\r\n\r\n");
|
51 |
+
$header_text = substr($response,0,$separator_position);
|
52 |
+
$body = substr($response,$separator_position+4);
|
53 |
+
|
54 |
+
foreach(explode("\n",$header_text) as $line) {
|
55 |
+
$parts = explode(": ",$line);
|
56 |
+
if(count($parts) == 2) $headers[$parts[0]] = chop($parts[1]);
|
57 |
+
}
|
58 |
+
$headers['cached'] = true;
|
59 |
+
|
60 |
+
if(!$options['return_info']) return $body;
|
61 |
+
else return array('headers' => $headers, 'body' => $body, 'info' => array('cached'=>true));
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
if(isset($options['post_data'])) { //There is an option to specify some data to be posted.
|
66 |
+
$options['method'] = 'post';
|
67 |
+
|
68 |
+
if(is_array($options['post_data'])) { //The data is in array format.
|
69 |
+
$post_data = array();
|
70 |
+
foreach($options['post_data'] as $key=>$value) {
|
71 |
+
$post_data[] = "$key=" . urlencode($value);
|
72 |
+
}
|
73 |
+
$url_parts['query'] = implode('&', $post_data);
|
74 |
+
} else { //Its a string
|
75 |
+
$url_parts['query'] = $options['post_data'];
|
76 |
+
}
|
77 |
+
} elseif(isset($options['multipart_data'])) { //There is an option to specify some data to be posted.
|
78 |
+
$options['method'] = 'post';
|
79 |
+
$url_parts['query'] = $options['multipart_data'];
|
80 |
+
|
81 |
+
}
|
82 |
+
|
83 |
+
///////////////////////////// Curl /////////////////////////////////////
|
84 |
+
//If curl is available, use curl to get the data.
|
85 |
+
if(function_exists("curl_init")
|
86 |
+
and (!(isset($options['use']) and $options['use'] == 'fsocketopen'))) { //Don't use curl if it is specifically stated to use fsocketopen in the options
|
87 |
+
|
88 |
+
if(isset($options['post_data'])) { //There is an option to specify some data to be posted.
|
89 |
+
$page = $url;
|
90 |
+
$options['method'] = 'post';
|
91 |
+
|
92 |
+
if(is_array($options['post_data'])) { //The data is in array format.
|
93 |
+
$post_data = array();
|
94 |
+
foreach($options['post_data'] as $key=>$value) {
|
95 |
+
$post_data[] = "$key=" . urlencode($value);
|
96 |
+
}
|
97 |
+
$url_parts['query'] = implode('&', $post_data);
|
98 |
+
|
99 |
+
} else { //Its a string
|
100 |
+
$url_parts['query'] = $options['post_data'];
|
101 |
+
}
|
102 |
+
} else {
|
103 |
+
if(isset($options['method']) and $options['method'] == 'post') {
|
104 |
+
$page = $url_parts['scheme'] . '://' . $url_parts['host'] . $url_parts['path'];
|
105 |
+
} else {
|
106 |
+
$page = $url;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
if($options['session'] and isset($GLOBALS['_binget_curl_session'])) $ch = $GLOBALS['_binget_curl_session']; //Session is stored in a global variable
|
111 |
+
else $ch = curl_init($url_parts['host']);
|
112 |
+
|
113 |
+
curl_setopt($ch, CURLOPT_URL, $page) or die("Invalid cURL Handle Resouce");
|
114 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //Just return the data - not print the whole thing.
|
115 |
+
curl_setopt($ch, CURLOPT_HEADER, true); //We need the headers
|
116 |
+
curl_setopt($ch, CURLOPT_NOBODY, !($options['return_body'])); //The content - if true, will not download the contents. There is a ! operation - don't remove it.
|
117 |
+
$tmpdir = NULL; //This acts as a flag for us to clean up temp files
|
118 |
+
if(isset($options['method']) and $options['method'] == 'post' and isset($url_parts['query'])) {
|
119 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
120 |
+
if(is_array($url_parts['query'])) {
|
121 |
+
//multipart form data (eg. file upload)
|
122 |
+
$postdata = array();
|
123 |
+
foreach ($url_parts['query'] as $name => $data) {
|
124 |
+
if (isset($data['contents']) && isset($data['filename'])) {
|
125 |
+
if (!isset($tmpdir)) { //If the temporary folder is not specifed - and we want to upload a file, create a temp folder.
|
126 |
+
// :TODO:
|
127 |
+
$dir = sys_get_temp_dir();
|
128 |
+
$prefix = 'load';
|
129 |
+
|
130 |
+
if (substr($dir, -1) != '/') $dir .= '/';
|
131 |
+
do {
|
132 |
+
$path = $dir . $prefix . mt_rand(0, 9999999);
|
133 |
+
} while (!mkdir($path, $mode));
|
134 |
+
|
135 |
+
$tmpdir = $path;
|
136 |
+
}
|
137 |
+
$tmpfile = $tmpdir.'/'.$data['filename'];
|
138 |
+
file_put_contents($tmpfile, $data['contents']);
|
139 |
+
$data['fromfile'] = $tmpfile;
|
140 |
+
}
|
141 |
+
if (isset($data['fromfile'])) {
|
142 |
+
// Not sure how to pass mime type and/or the 'use binary' flag
|
143 |
+
$postdata[$name] = '@'.$data['fromfile'];
|
144 |
+
} elseif (isset($data['contents'])) {
|
145 |
+
$postdata[$name] = $data['contents'];
|
146 |
+
} else {
|
147 |
+
$postdata[$name] = '';
|
148 |
+
}
|
149 |
+
}
|
150 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
|
151 |
+
} else {
|
152 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $url_parts['query']);
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
//Set the headers our spiders sends
|
157 |
+
curl_setopt($ch, CURLOPT_USERAGENT, $send_header['User-Agent']); //The Name of the UserAgent we will be using ;)
|
158 |
+
$custom_headers = array("Accept: " . $send_header['Accept'] );
|
159 |
+
if(isset($options['modified_since']))
|
160 |
+
array_push($custom_headers,"If-Modified-Since: ".gmdate('D, d M Y H:i:s \G\M\T',strtotime($options['modified_since'])));
|
161 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $custom_headers);
|
162 |
+
if($options['referer']) curl_setopt($ch, CURLOPT_REFERER, $options['referer']);
|
163 |
+
|
164 |
+
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/binget-cookie.txt"); //If ever needed...
|
165 |
+
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
166 |
+
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
|
167 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
168 |
+
|
169 |
+
$custom_headers = array();
|
170 |
+
unset($send_header['User-Agent']); // Already done (above)
|
171 |
+
foreach ($send_header as $name => $value) {
|
172 |
+
if (is_array($value)) {
|
173 |
+
foreach ($value as $item) {
|
174 |
+
$custom_headers[] = "$name: $item";
|
175 |
+
}
|
176 |
+
} else {
|
177 |
+
$custom_headers[] = "$name: $value";
|
178 |
+
}
|
179 |
+
}
|
180 |
+
if(isset($url_parts['user']) and isset($url_parts['pass'])) {
|
181 |
+
$custom_headers[] = "Authorization: Basic ".base64_encode($url_parts['user'].':'.$url_parts['pass']);
|
182 |
+
}
|
183 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $custom_headers);
|
184 |
+
|
185 |
+
$response = curl_exec($ch);
|
186 |
+
|
187 |
+
if(isset($tmpdir)) {
|
188 |
+
//rmdirr($tmpdir); //Cleanup any temporary files :TODO:
|
189 |
+
}
|
190 |
+
|
191 |
+
$info = curl_getinfo($ch); //Some information on the fetch
|
192 |
+
|
193 |
+
if($options['session'] and !$options['session_close']) $GLOBALS['_binget_curl_session'] = $ch; //Dont close the curl session. We may need it later - save it to a global variable
|
194 |
+
else curl_close($ch); //If the session option is not set, close the session.
|
195 |
+
|
196 |
+
//////////////////////////////////////////// FSockOpen //////////////////////////////
|
197 |
+
} else { //If there is no curl, use fsocketopen - but keep in mind that most advanced features will be lost with this approch.
|
198 |
+
|
199 |
+
if(!isset($url_parts['query']) || (isset($options['method']) and $options['method'] == 'post'))
|
200 |
+
$page = $url_parts['path'];
|
201 |
+
else
|
202 |
+
$page = $url_parts['path'] . '?' . $url_parts['query'];
|
203 |
+
|
204 |
+
if(!isset($url_parts['port'])) $url_parts['port'] = ($url_parts['scheme'] == 'https' ? 443 : 80);
|
205 |
+
$host = ($url_parts['scheme'] == 'https' ? 'ssl://' : '').$url_parts['host'];
|
206 |
+
$fp = fsockopen($host, $url_parts['port'], $errno, $errstr, 30);
|
207 |
+
if ($fp) {
|
208 |
+
$out = '';
|
209 |
+
if(isset($options['method']) and $options['method'] == 'post' and isset($url_parts['query'])) {
|
210 |
+
$out .= "POST $page HTTP/1.1\r\n";
|
211 |
+
} else {
|
212 |
+
$out .= "GET $page HTTP/1.0\r\n"; //HTTP/1.0 is much easier to handle than HTTP/1.1
|
213 |
+
}
|
214 |
+
$out .= "Host: $url_parts[host]\r\n";
|
215 |
+
foreach ($send_header as $name => $value) {
|
216 |
+
if (is_array($value)) {
|
217 |
+
foreach ($value as $item) {
|
218 |
+
$out .= "$name: $item\r\n";
|
219 |
+
}
|
220 |
+
} else {
|
221 |
+
$out .= "$name: $value\r\n";
|
222 |
+
}
|
223 |
+
}
|
224 |
+
$out .= "Connection: Close\r\n";
|
225 |
+
|
226 |
+
//HTTP Basic Authorization support
|
227 |
+
if(isset($url_parts['user']) and isset($url_parts['pass'])) {
|
228 |
+
$out .= "Authorization: Basic ".base64_encode($url_parts['user'].':'.$url_parts['pass']) . "\r\n";
|
229 |
+
}
|
230 |
+
|
231 |
+
//If the request is post - pass the data in a special way.
|
232 |
+
if(isset($options['method']) and $options['method'] == 'post') {
|
233 |
+
if(is_array($url_parts['query'])) {
|
234 |
+
//multipart form data (eg. file upload)
|
235 |
+
|
236 |
+
// Make a random (hopefully unique) identifier for the boundary
|
237 |
+
srand((double)microtime()*1000000);
|
238 |
+
$boundary = "---------------------------".substr(md5(rand(0,32000)),0,10);
|
239 |
+
|
240 |
+
$postdata = array();
|
241 |
+
$postdata[] = '--'.$boundary;
|
242 |
+
foreach ($url_parts['query'] as $name => $data) {
|
243 |
+
$disposition = 'Content-Disposition: form-data; name="'.$name.'"';
|
244 |
+
if (isset($data['filename'])) {
|
245 |
+
$disposition .= '; filename="'.$data['filename'].'"';
|
246 |
+
}
|
247 |
+
$postdata[] = $disposition;
|
248 |
+
if (isset($data['type'])) {
|
249 |
+
$postdata[] = 'Content-Type: '.$data['type'];
|
250 |
+
}
|
251 |
+
if (isset($data['binary']) && $data['binary']) {
|
252 |
+
$postdata[] = 'Content-Transfer-Encoding: binary';
|
253 |
+
} else {
|
254 |
+
$postdata[] = '';
|
255 |
+
}
|
256 |
+
if (isset($data['fromfile'])) {
|
257 |
+
$data['contents'] = file_get_contents($data['fromfile']);
|
258 |
+
}
|
259 |
+
if (isset($data['contents'])) {
|
260 |
+
$postdata[] = $data['contents'];
|
261 |
+
} else {
|
262 |
+
$postdata[] = '';
|
263 |
+
}
|
264 |
+
$postdata[] = '--'.$boundary;
|
265 |
+
}
|
266 |
+
$postdata = implode("\r\n", $postdata)."\r\n";
|
267 |
+
$length = strlen($postdata);
|
268 |
+
$postdata = 'Content-Type: multipart/form-data; boundary='.$boundary."\r\n".
|
269 |
+
'Content-Length: '.$length."\r\n".
|
270 |
+
"\r\n".
|
271 |
+
$postdata;
|
272 |
+
|
273 |
+
$out .= $postdata;
|
274 |
+
} else {
|
275 |
+
$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
|
276 |
+
$out .= 'Content-Length: ' . strlen($url_parts['query']) . "\r\n";
|
277 |
+
$out .= "\r\n" . $url_parts['query'];
|
278 |
+
}
|
279 |
+
}
|
280 |
+
$out .= "\r\n";
|
281 |
+
|
282 |
+
fwrite($fp, $out);
|
283 |
+
while (!feof($fp)) {
|
284 |
+
$response .= fgets($fp, 128);
|
285 |
+
}
|
286 |
+
fclose($fp);
|
287 |
+
}
|
288 |
+
}
|
289 |
+
|
290 |
+
//Get the headers in an associative array
|
291 |
+
$headers = array();
|
292 |
+
|
293 |
+
if($info['http_code'] == 404) {
|
294 |
+
$body = "";
|
295 |
+
$headers['Status'] = 404;
|
296 |
+
} else {
|
297 |
+
//Seperate header and content
|
298 |
+
$header_text = substr($response, 0, $info['header_size']);
|
299 |
+
$body = substr($response, $info['header_size']);
|
300 |
+
|
301 |
+
foreach(explode("\n",$header_text) as $line) {
|
302 |
+
$parts = explode(": ",$line);
|
303 |
+
if(count($parts) == 2) {
|
304 |
+
if (isset($headers[$parts[0]])) {
|
305 |
+
if (is_array($headers[$parts[0]])) $headers[$parts[0]][] = chop($parts[1]);
|
306 |
+
else $headers[$parts[0]] = array($headers[$parts[0]], chop($parts[1]));
|
307 |
+
} else {
|
308 |
+
$headers[$parts[0]] = chop($parts[1]);
|
309 |
+
}
|
310 |
+
}
|
311 |
+
}
|
312 |
+
|
313 |
+
}
|
314 |
+
|
315 |
+
if(isset($cache_file)) { //Should we cache the URL?
|
316 |
+
file_put_contents($cache_file, $response);
|
317 |
+
}
|
318 |
+
|
319 |
+
if($options['return_info']) return array('headers' => $headers, 'body' => $body, 'info' => $info, 'curl_handle'=>$ch);
|
320 |
+
return $body;
|
321 |
+
}
|
322 |
+
}
|
323 |
+
?>
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Model/Category.php
RENAMED
File without changes
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Model/Linkdirectory.php
RENAMED
File without changes
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Model/Mysql4/Linkdirectory.php
RENAMED
File without changes
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Model/Mysql4/Linkdirectory/Collection.php
RENAMED
File without changes
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/Model/Status.php
RENAMED
File without changes
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/controllers/Adminhtml/LinkdirectoryController.php
RENAMED
File without changes
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/controllers/IndexController.php
RENAMED
File without changes
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/controllers/InterfaceController.php
RENAMED
File without changes
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/controllers/TestController.php
RENAMED
File without changes
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/etc/config.xml
RENAMED
@@ -10,7 +10,7 @@
|
|
10 |
</default>
|
11 |
<modules>
|
12 |
<Magestore_Linkdirectory>
|
13 |
-
<version>0.
|
14 |
</Magestore_Linkdirectory>
|
15 |
</modules>
|
16 |
<frontend>
|
10 |
</default>
|
11 |
<modules>
|
12 |
<Magestore_Linkdirectory>
|
13 |
+
<version>0.3.0</version>
|
14 |
</Magestore_Linkdirectory>
|
15 |
</modules>
|
16 |
<frontend>
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/etc/system.xml
RENAMED
File without changes
|
app/code/community/Magestore/{Linkdirectory → LinkDirectory}/sql/linkdirectory_setup/mysql4-install-0.1.0.php
RENAMED
File without changes
|
app/etc/modules/{Magestore_Linkdirectory.xml → Magestore_LinkDirectory.xml}
RENAMED
File without changes
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>LinkDirectory</name>
|
4 |
-
<version>0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>
|
10 |
-
<description>
|
11 |
-
<notes>
|
12 |
<authors><author><name>Magestore</name><user>auto-converted</user><email>magestore@gmail.com</email></author></authors>
|
13 |
-
<date>2010-
|
14 |
-
<time>
|
15 |
-
<contents><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="magestore"><file name="linkdirectory.css" hash="7b8cecd80aadae9f9c13f87930aa77bf"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="magestore"><file name="linkdirectory.css" hash="7b14278eee542adc1a27ee6dcfbaed0d"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="linkdirectory.xml" hash="c633ccc83146b59d5053a40f28ddbaf8"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="linkdirectory.xml" hash="bf1f83fe59e6a90bf1db5ac35ac828bd"/></dir><dir name="template"><dir name="linkdirectory"><file name="linkdirectory.phtml" hash="6848a496c53a7870456d968083d23abe"/><file name="view.phtml" hash="e4d0ee9bb50bc3b451105867434b13d8"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Magestore"><dir name="
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>LinkDirectory</name>
|
4 |
+
<version>0.3.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Link Directory for magento store</summary>
|
10 |
+
<description>Link Directory for magento store</description>
|
11 |
+
<notes>0.3.0</notes>
|
12 |
<authors><author><name>Magestore</name><user>auto-converted</user><email>magestore@gmail.com</email></author></authors>
|
13 |
+
<date>2010-03-12</date>
|
14 |
+
<time>08:46:39</time>
|
15 |
+
<contents><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="magestore"><file name="linkdirectory.css" hash="7b8cecd80aadae9f9c13f87930aa77bf"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="magestore"><file name="linkdirectory.css" hash="7b14278eee542adc1a27ee6dcfbaed0d"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="linkdirectory.xml" hash="c633ccc83146b59d5053a40f28ddbaf8"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="linkdirectory.xml" hash="bf1f83fe59e6a90bf1db5ac35ac828bd"/></dir><dir name="template"><dir name="linkdirectory"><file name="linkdirectory.phtml" hash="6848a496c53a7870456d968083d23abe"/><file name="view.phtml" hash="e4d0ee9bb50bc3b451105867434b13d8"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Magestore"><dir name="LinkDirectory"><dir name="Block"><file name="Linkdirectory.php" hash="b9f3f48ce757af549d2898696ba04c93"/><dir name="Adminhtml"><file name="Linkdirectory.php" hash="b0f0a3b5b0e451ba506f293db39ce206"/><dir name="Linkdirectory"><file name="Edit.php" hash="096c0be020735294d7969a92c958be72"/><file name="Grid.php" hash="65b30428617f0c072c1c26664659a79a"/><dir name="Edit"><file name="Form.php" hash="c1d3b997e0226ab121c3118a1ed43386"/><file name="Tabs.php" hash="592df7527d982201f0a6506e68fd798a"/><dir name="Tab"><file name="Form.php" hash="c617ec5f9f7600fca8b554542ab65f79"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="9624140b3f2fc38406712c6824667006"/><file name="InterfaceController.php" hash="ce52f7eb2d66c4b37c06424089479643"/><file name="TestController.php" hash="4a01b8d0b1b1ed4cf6a2ecac19d0cbda"/><dir name="Adminhtml"><file name="LinkdirectoryController.php" hash="6268c2fc0e21ea38912eca10278ca183"/></dir></dir><dir name="etc"><file name="config.xml" hash="cfaa6f56799a413aae08b50d907007d8"/><file name="system.xml" hash="dadd60552eb211660569888dee36b317"/></dir><dir name="Helper"><file name="Data.php" hash="f6bc6257e09b7e5584c47e1b01d27a7e"/><file name="Url.php" hash="8bbb768060a756476e46e9bdd3ae61cb"/></dir><dir name="Model"><file name="Category.php" hash="1c48be452c0fb72e15e08ca3ef43a5f6"/><file name="Linkdirectory.php" hash="7e59160d2b42f31420193f642e502eed"/><file name="Status.php" hash="6e7a64b24c69b8c8b6aa5599586d394a"/><dir name="Mysql4"><file name="Linkdirectory.php" hash="d7d5de3f6a1f94c3e48f638891ffc425"/><dir name="Linkdirectory"><file name="Collection.php" hash="90f606e20a41bd5739be211c79ef9443"/></dir></dir></dir><dir name="sql"><dir name="linkdirectory_setup"><file name="mysql4-install-0.1.0.php" hash="f84214fc43f665c79b92dc7a092b364f"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magestore_LinkDirectory.xml" hash="e51513991f8764be69446373c5ff366c"/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|