Skip to content

Commit

Permalink
Config structure updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemKo7v committed Apr 4, 2017
1 parent 02ed557 commit 746f293
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 118 deletions.
4 changes: 4 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ RewriteRule ^top$ page627210.html
RewriteRule ^about$ page627364.html
RewriteRule ^privacy$ page627373.html

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^js/config.js$ config.php [L,QSA]

RewriteRule ^widgets$ widgets.html

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^tx/(.*) index.php [L,QSA]
Expand Down
83 changes: 24 additions & 59 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@
$codeVersion = "141";

require dirname(__FILE__) . '/service/lib/ethplorer.php';
$esCfg = require_once dirname(__FILE__) . '/service/config.php';
$esCfg['mongo'] = FALSE; // No mongo connection
$es = Ethplorer::db($esCfg);
$es = Ethplorer::db(array());

$error = TRUE;
$header = "";
$uri = $_SERVER['REQUEST_URI'];

// Uri to lowercase
if(preg_match("/[A-Z]+/", $uri)){
if(preg_match("/[A-Z]+/", $uri) && (FALSE === strpos($uri, '1dea4'))){
header("Location: " . strtolower($uri));
die();
}
Expand Down Expand Up @@ -81,6 +79,7 @@
<script src="/js/bignumber.js"></script>
<script src="/js/ethplorer.js?v=<?=$codeVersion?>"></script>
<script src="/js/ethplorer-search.js?v=<?=$codeVersion?>"></script>
<script src="/js/config.js"></script>
<script src="/js/md5.min.js"></script>
</head>
<body>
Expand Down Expand Up @@ -567,28 +566,6 @@
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<?php /*
<div class="navbar navbar-inverse footer" role="navigation" style="background:#0f0f0f;">
<div class="container">
<div class="text-center">
<a href="/about.html" style="color: white;">About</a>
&nbsp;&nbsp;&nbsp;
<a href="/about.html#disqus_thread" style="color: white;">Discuss ethplorer</a>
&nbsp;&nbsp;&nbsp;
<a href="https://github.com/EverexIO/Ethplorer" target="_blank">Sources</a>
&nbsp;&nbsp;&nbsp;
<a href="https://github.com/EverexIO/Ethplorer/wiki/Ethplorer-API" target="_blank">API</a>
</div>
<div class="copyrights">
<span style="color:white;">(c) 2016</span> <a href="https://everex.one" target="_blank">Everex</a>
&nbsp;&nbsp;&nbsp;
<a href="mailto://[email protected]">[email protected]</a><br>
<a href="/privacy.html">Privacy & Terms</a>
</div>
</div>
</div>
*/ ?>
<div class="footer">
<div class="container">
<div class="row">
Expand All @@ -604,7 +581,6 @@
<div class="col-xs-6 col-sm-3">
<div class="footer-links" style="color: #ffffff;">
<ul>
<li><span style="font-weight: 600;"><a href="/about">About</a> </span></li>
<li><a href="/widgets" style="" rel=""><strong>Widgets</strong></a></li>
<li><span style="font-weight: 600;"><a href="/about#disqus_thread">Discuss ethplorer</a></span></li>
<li><span style="font-weight: 600;"><a href="https://github.com/EverexIO/Ethplorer">Sources</a></span></li>
Expand All @@ -625,39 +601,28 @@
</div>
</div>
<script>
<?php
// Build JS config from PHP code
echo "Ethplorer.Config = " . json_encode($esCfg['client'], JSON_OBJECT_AS_ARRAY);
?>
$(document).ready(function(){
$.fn.bootstrapBtn = $.fn.button.noConflict();
Ethplorer.init();
});
if(Ethplorer.Config.ga){
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

$(document).ready(function(){
$.fn.bootstrapBtn = $.fn.button.noConflict();
Ethplorer.init();
});
if(Ethplorer.Config.ga){
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', Ethplorer.Config.ga, 'auto');
ga('send', 'pageview');
}
</script>
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '1629579527306661');
fbq('track', 'PageView');
ga('create', Ethplorer.Config.ga, 'auto');
ga('send', 'pageview');
}
if(Ethplorer.Config.fb){
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','https://connect.facebook.net/en_US/fbevents.js');
fbq('init', Ethplorer.Config.fb);
fbq('track', 'PageView');
}
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=1629579527306661&ev=PageView&noscript=1"
/></noscript>
<!-- DO NOT MODIFY -->
<!-- End Facebook Pixel Code -->
</body>
</html>
3 changes: 3 additions & 0 deletions js/ethplorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ Ethplorer = {
searchCache: {},
saveData: function(){},
init: function(){
if('undefined' !== typeof(ethplorerConfig)){
Ethplorer.Config = ethplorerConfig;
}
Ethplorer.isProd = ('ethplorer.io' === document.location.host);
BigNumber.config({ ERRORS: false });
Ethplorer.Nav.init();
Expand Down
1 change: 1 addition & 0 deletions robots.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
User-Agent: *
Host: ethplorer.io
Disallow: /service/csv.php
3 changes: 3 additions & 0 deletions service/config.sample.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
return array(

'ga' => '',
'fb' => '',
"mongo" => array(
"server" => "mongodb://127.0.0.1:27017",
"dbName" => "everex-db",
Expand Down
8 changes: 4 additions & 4 deletions service/lib/ethplorer.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ protected function __construct(array $aConfig){
);

$this->oCache = new evxCache($this->aSettings['cacheDir']);
if(!isset($this->aSettings['ethereum'])){
throw new Exception("Ethereum configuration not found");
}
if(isset($this->aSettings['mongo']) && (FALSE !== $this->aSettings['mongo'])){
if(isset($this->aSettings['mongo']) && is_array($this->aSettings['mongo'])){
if(class_exists("MongoClient")){
$oMongo = new MongoClient($this->aSettings['mongo']['server']);
$oDB = $oMongo->{$this->aSettings['mongo']['dbName']};
Expand Down Expand Up @@ -1203,6 +1200,9 @@ public function countChainy($useFilter = TRUE){
* @return array
*/
protected function _callRPC($method, $params = array()){
if(!isset($this->aSettings['ethereum'])){
throw new Exception("Ethereum configuration not found");
}
$data = array(
'jsonrpc' => "2.0",
'id' => time(),
Expand Down
69 changes: 14 additions & 55 deletions widgets.html
Original file line number Diff line number Diff line change
Expand Up @@ -594,24 +594,13 @@ <h3>Top Tokens by Activity</h3>
</div>
<div id="disqus_thread" class="container"></div>
<script>

/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables */
/*
var disqus_config = function () {
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
*/
(function () { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = '//https-ethplorer-io.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<div class="footer">
<div class="container">
<div class="row">
Expand All @@ -627,7 +616,6 @@ <h3>Top Tokens by Activity</h3>
<div class="col-xs-6 col-sm-3">
<div class="footer-links" style="color: #ffffff;">
<ul>
<li><span style="font-weight: 600;"><a href="/about">About</a> </span></li>
<li><a href="/widgets" style="" rel=""><strong>Widgets</strong></a></li>
<li><span style="font-weight: 600;"><a href="/about#disqus_thread">Discuss ethplorer</a></span></li>
<li><span style="font-weight: 600;"><a href="https://github.com/EverexIO/Ethplorer">Sources</a></span></li>
Expand All @@ -651,53 +639,24 @@ <h3>Top Tokens by Activity</h3>
$(document).ready(function () {
EthplorerSearch.init($('#search-form'), $('#search'), Ethplorer.search);
});
if (false && Ethplorer.Config.ga) {
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
if(Ethplorer.Config.ga){
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', Ethplorer.Config.ga, 'auto');
ga('send', 'pageview');
}
if(Ethplorer.Config.fb){
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','https://connect.facebook.net/en_US/fbevents.js');
fbq('init', Ethplorer.Config.fb);
fbq('track', 'PageView');
}
</script>
<!-- Facebook Pixel Code -->
<script>
/*
!function (f, b, e, v, n, t, s) {
if (f.fbq)
return;
n = f.fbq = function () {
n.callMethod ?
n.callMethod.apply(n, arguments) : n.queue.push(arguments)
};
if (!f._fbq)
f._fbq = n;
n.push = n;
n.loaded = !0;
n.version = '2.0';
n.queue = [];
t = b.createElement(e);
t.async = !0;
t.src = v;
s = b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t, s)
}(window,
document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '1629579527306661');
fbq('track', 'PageView');
*/
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=1629579527306661&ev=PageView&noscript=1"
/></noscript>
<!-- DO NOT MODIFY -->
<!-- End Facebook Pixel Code -->
</body>
</html>

0 comments on commit 746f293

Please sign in to comment.