diff --git a/public/include/classes/mail.class.php b/public/include/classes/mail.class.php index ca1342aa..ea00cef6 100644 --- a/public/include/classes/mail.class.php +++ b/public/include/classes/mail.class.php @@ -15,6 +15,49 @@ class Mail extends Base { return true; } + /** + * Mail form contact site admin + * @param senderName string senderName + * @param senderEmail string senderEmail + * @param senderSubject string senderSubject + * @param senderMessage string senderMessage + * @param email string config Email address + * @param subject string header subject + * @return bool + **/ + public function contactform($senderName, $senderEmail, $senderSubject, $senderMessage) { + $this->debug->append("STA " . __METHOD__, 4); + if (preg_match('/[^a-z_\.\!\?\-0-9\\s ]/i', $senderName)) { + $this->setErrorMessage('Username may only contain alphanumeric characters'); + return false; + } + if (empty($senderEmail) || !filter_var($senderEmail, FILTER_VALIDATE_EMAIL)) { + $this->setErrorMessage( 'Invalid e-mail address' ); + return false; + } + if (preg_match('/[^a-z_\.\!\?\-0-9\\s ]/i', $senderSubject)) { + $this->setErrorMessage('Subject may only contain alphanumeric characters'); + return false; + } + if (strlen(strip_tags($senderMessage)) < strlen($senderMessage)) { + $this->setErrorMessage('Your message may only contain alphanumeric characters'); + return false; + } + $aData['senderName'] = $senderName; + $aData['senderEmail'] = $senderEmail; + $aData['senderSubject'] = $senderSubject; + $aData['senderMessage'] = $senderMessage; + $aData['email'] = $this->setting->getValue('website_email'); + $aData['subject'] = 'Contact From'; + if ($this->sendMail('contactform/body', $aData)) { + return true; + } else { + $this->setErrorMessage( 'Unable to send email' ); + return false; + } + return false; + } + public function sendMail($template, $aData) { $this->smarty->assign('WEBSITENAME', $this->setting->getValue('website_name')); $this->smarty->assign('SUBJECT', $aData['subject']); diff --git a/public/include/config/admin_settings.inc.php b/public/include/config/admin_settings.inc.php index 69b55e75..305f6c11 100644 --- a/public/include/config/admin_settings.inc.php +++ b/public/include/config/admin_settings.inc.php @@ -172,6 +172,13 @@ $aSettings['system'][] = array( 'name' => 'disable_api', 'value' => $setting->getValue('disable_api'), 'tooltip' => 'Enable or Disable the pool wide API functions. See API reference on Github for details.' ); +$aSettings['system'][] = array( + 'display' => 'Disable Contactform', 'type' => 'select', + 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'default' => 0, + 'name' => 'disable_contactform', 'value' => $setting->getValue('disable_contactform'), + 'tooltip' => 'Enable or Disable Contactform. Users will not be able to use the contact form.' +); $aSettings['recaptcha'][] = array( 'display' => 'Enable re-Captcha', 'type' => 'select', 'options' => array( 0 => 'No', 1 => 'Yes' ), diff --git a/public/include/pages/contactform.inc.php b/public/include/pages/contactform.inc.php new file mode 100644 index 00000000..e4f947c4 --- /dev/null +++ b/public/include/pages/contactform.inc.php @@ -0,0 +1,18 @@ +getValue('disable_contactform')) { + $_SESSION['POPUP'][] = array('CONTENT' => 'Contactform is currently disabled. Please try again later.', 'TYPE' => 'errormsg'); + $smarty->assign("CONTENT", "disabled.tpl"); +} else { + if ($setting->getValue('recaptcha_enabled')) { + require_once(INCLUDE_DIR . '/lib/recaptchalib.php'); + $smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key'))); + } + + // Tempalte specifics + $smarty->assign("CONTENT", "default.tpl"); +} +?> diff --git a/public/include/pages/contactform/contactform.inc.php b/public/include/pages/contactform/contactform.inc.php new file mode 100644 index 00000000..6ff2d84e --- /dev/null +++ b/public/include/pages/contactform/contactform.inc.php @@ -0,0 +1,51 @@ +getValue('recaptcha_enabled')) { + // Load re-captcha specific data + require_once(INCLUDE_DIR . '/lib/recaptchalib.php'); + $rsp = recaptcha_check_answer ( + $setting->getValue('recaptcha_private_key'), + $_SERVER["REMOTE_ADDR"], + $_POST["recaptcha_challenge_field"], + $_POST["recaptcha_response_field"] + ); +} + +if ($setting->getValue('disable_contactform')) { + $_SESSION['POPUP'][] = array('CONTENT' => 'Contactform is currently disabled. Please try again later.', 'TYPE' => 'errormsg'); +} else { + // Check if recaptcha is enabled, process form data if valid + if($setting->getValue('recaptcha_enabled') && $_POST["recaptcha_response_field"] && $_POST["recaptcha_response_field"]!=''){ + if ($rsp->is_valid) { + $smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key'))); + if ($user->contactform($_POST['senderName'], $_POST['senderEmail'], $_POST['senderSubject'], $_POST['senderMesage'])) { + $_SESSION['POPUP'][] = array('CONTENT' => 'Thanks for sending your message! We will get back to you shortly'); + } else { + $_SESSION['POPUP'][] = array('CONTENT' => 'There was a problem sending your message. Please try again.' . $user->getError(), 'TYPE' => 'errormsg'); + } + } else { + $smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key'), $rsp->error)); + $_SESSION['POPUP'][] = array('CONTENT' => 'Invalid Captcha, please try again. (' . $rsp->error . ')', 'TYPE' => 'errormsg'); + } + // Empty captcha + } else if ($setting->getValue('recaptcha_enabled')) { + $smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key'), $rsp->error)); + $_SESSION['POPUP'][] = array('CONTENT' => 'Empty Captcha, please try again.', 'TYPE' => 'errormsg'); + // Captcha disabled + } else { + if ($mail->contactform($_POST['senderName'], $_POST['senderEmail'], $_POST['senderSubject'], $_POST['senderMessage'])) { + $_SESSION['POPUP'][] = array('CONTENT' => 'Thanks for sending your message! We will get back to you shortly'); + } else { + $_SESSION['POPUP'][] = array('CONTENT' => 'There was a problem sending your message. Please try again. ' . $user->getError(), 'TYPE' => 'errormsg'); + } + } +} + +// Tempalte specifics +$smarty->assign("CONTENT", "default.tpl"); + +?> diff --git a/public/templates/mail/contactform/body.tpl b/public/templates/mail/contactform/body.tpl new file mode 100644 index 00000000..5f0d1b9f --- /dev/null +++ b/public/templates/mail/contactform/body.tpl @@ -0,0 +1,10 @@ + + +

{$WEBSITENAME} Message,

+

{$DATA.senderName} Sent you a message

+

Senders Email: {$DATA.senderEmail}

+

Subject: {$DATA.senderSubject}

+

Personal message:

{$DATA.senderMessage}

+

+ + diff --git a/public/templates/test/about/api/default.tpl b/public/templates/test/about/api/default.tpl new file mode 100644 index 00000000..888d3a24 --- /dev/null +++ b/public/templates/test/about/api/default.tpl @@ -0,0 +1,10 @@ +
+

API Reference

+
+
+ +

Please head over to the official documentation to learn about the API featured in mmcfe-ng.

+
+
+
+
diff --git a/public/templates/test/about/default.tpl b/public/templates/test/about/default.tpl new file mode 100644 index 00000000..f1369c6a --- /dev/null +++ b/public/templates/test/about/default.tpl @@ -0,0 +1,25 @@ +
+

About PPLNS Payout system, Facts and myths

+
+ + +

First of all if talking about PPLNS it is important to understand how it works. PPLNS is short for .Pay Per Last N Shares.. The current proportional reward system is round based. One round is the time between the first share after the last found block and the share which solves a block. PPLNS however means that we no longer consider valid shares of one round but we consider a number N of shares. No matter if they are part of the round or not. The number N is currently for each blockchain twice the difficulty (actually rounded down to an easy to calculate integer value).

+

Let me illustrate PPLNS using the image below. One round has an arbitrary number of shares which is solely based on sheer luck. On proportional reward system only shares of one round are considered for calculating rewards. However with PPLNS a quite constant number N of shares is considered for calculating rewards. This number N changes only with the difficulty. Please have a look at the image below:

+

PPLNS share per round

+

As you know the number of shares needed to solve a block within a round is different. Round one and three needed (difficulty * 2) shares to be solved. Round two and four are quite short rounds. There were less than (difficulty * 2) shares nessecary to solve them. Round five however is a very long round which means the pool needed more than (difficulty * 2) shares to solve the block. From this follows that:

+ +

Why do we need to switch the reward system at all?

+

PPLNS favors constant and/or occasional loyal pool members over pool hoppers. As you might have seen each time we find a LTC block the pools hashrate peaks instantly. This is due to pool hoppers starting to mine. They are betting for a .quick win. (like round two above) with low shares per round. If the round exceeds a certain amount of shares they .hop. to another proportional pool which started a new round more recently trying their luck on the other pool. This assures better rewards for pool hoppers over occasional or constant miners which are loyal to their pool. Pool hopping however implies that pool hoppers need to know when a round is started and how much shares are considered for reward. This is very easy with propotional reward system. Using PPLNS this is no longer true. On long rounds (like round five above) the pool hoppers shares won.t be considered for reward calculations in favor of loyal miners. This is due to the fact that pool hoppers only mine on the beginning of rounds. On short and normal rounds pool hoppers won.t loose their shares. But due to the fact that shares from previous rounds from loyal miners are considered twice (or even more often on extremely short rounds) the pool hopper won.t get the same reward as from proportional reward system.

+

I.m only an occasional miner. Will I loose shares if playing/being offline?

+

It depends. Even if you are a constant miner you.ll loose shares on very long rounds. On the other hand if you for example stop mining shortly before the end of round three from the image above you.ll be rewarded for round three. If you then start mining on the mid of round five you.ll be rewarded a bit for round four (despite the fact you haven.t submitted any shares as some of your shares from round three are considered for round four as well) and you.ll be fully rewarded for round five (you won.t loose any shares as you .skipped. the .red part. of shares which have been cut off due to the length of the round). The point however is no one (and thus the pool hopper as well) knows when a round ends in advance. Thus you deliberately can.t avoid cut offs. Sometimes you are lucky sometimes your are not. This however levels out over the time for non-hoppers. The important point is, that you as loyal pool member have an advantage over pool hoppers. Even if you are mining only occasionally in order to enjoy the silence within your mining room.

+

Isn.t it that you as pool operator earn more from PPLNS?

+

Short answer: No. As a pool operator I. In fact for a pool operator it doesn.t matter at all which reward system is used. I expect rounds to become a bit longer after PPLNS is activated as the pool hoppers will start to avoid the Pool. Thus revenues for me will be lower. But there were some loyal pool members who clearly stated that they want to get rid of the pool hoppers and I respect their wish. Furthermore I.m too an occasional miner on the Pool as I don.t want the miners to be running at night and from time to time I need them to test new Pool versions on development systems. Thus being a miner like you I like PPLNS better than proportional. But speaking as pool operator there is no difference between the reward systems.

+

Thanks to g2x3k/Poolx-eu for PPLNS description

+ +
+
+
diff --git a/public/templates/test/about/donors/default.tpl b/public/templates/test/about/donors/default.tpl new file mode 100644 index 00000000..bcbb65f5 --- /dev/null +++ b/public/templates/test/about/donors/default.tpl @@ -0,0 +1,31 @@ +
+

Pool Donors

+
+
+{include file="global/pagination.tpl"} + + + + + + + + +
+ +{section name=donor loop=$DONORS} + + + + + +{sectionelse} + + + +{/section} + +
Name%{$GLOBAL.config.currency} Total
{if $DONORS[donor].is_anonymous|default:"0" == 1}anonymous{else}{$DONORS[donor].username}{/if}{$DONORS[donor].donate_percent}{$DONORS[donor].donation|number_format:"2"}
No confirmed donations yet, please be patient!
+
+
+
diff --git a/public/templates/test/about/pool/default.tpl b/public/templates/test/about/pool/default.tpl new file mode 100644 index 00000000..ec0fbbcf --- /dev/null +++ b/public/templates/test/about/pool/default.tpl @@ -0,0 +1,32 @@ +
+

ThePool Collective

+
+ + +

After mining in other pools I have decided to setup my own pool, mostly for educational reason. I was curious how pools work, what is needed to get them started and what tools can be used to run them.

+

Lots of digging finally revealed that the following tools were required to run a Litecoin pool:

+ + + +

+The hardest part was finding all the information needed and applying it to a new setup. +Many tools exist and even those three took a while to get them to work. +Especially the difficulty adjustment would not have been possible (for me) if it wasn't +for the pushpool tenebrix branch allowing a custom target bit and reducing difficulty per share. +More adjustments in the PHP code were necessary to reflect those changes and, at least +close enough, properly display hashrates on the pool site. It is running well right now but +please keen in mind that neither the code nor functionaliy are supported. +I am not responsible for lost coins due to a pool crash or other malfunctions which +could be caused by by code or the tools used in this implementation. +

+ +
+
+
diff --git a/public/templates/test/about/pplns/default.tpl b/public/templates/test/about/pplns/default.tpl new file mode 100644 index 00000000..f1369c6a --- /dev/null +++ b/public/templates/test/about/pplns/default.tpl @@ -0,0 +1,25 @@ +
+

About PPLNS Payout system, Facts and myths

+
+ + +

First of all if talking about PPLNS it is important to understand how it works. PPLNS is short for .Pay Per Last N Shares.. The current proportional reward system is round based. One round is the time between the first share after the last found block and the share which solves a block. PPLNS however means that we no longer consider valid shares of one round but we consider a number N of shares. No matter if they are part of the round or not. The number N is currently for each blockchain twice the difficulty (actually rounded down to an easy to calculate integer value).

+

Let me illustrate PPLNS using the image below. One round has an arbitrary number of shares which is solely based on sheer luck. On proportional reward system only shares of one round are considered for calculating rewards. However with PPLNS a quite constant number N of shares is considered for calculating rewards. This number N changes only with the difficulty. Please have a look at the image below:

+

PPLNS share per round

+

As you know the number of shares needed to solve a block within a round is different. Round one and three needed (difficulty * 2) shares to be solved. Round two and four are quite short rounds. There were less than (difficulty * 2) shares nessecary to solve them. Round five however is a very long round which means the pool needed more than (difficulty * 2) shares to solve the block. From this follows that:

+ +

Why do we need to switch the reward system at all?

+

PPLNS favors constant and/or occasional loyal pool members over pool hoppers. As you might have seen each time we find a LTC block the pools hashrate peaks instantly. This is due to pool hoppers starting to mine. They are betting for a .quick win. (like round two above) with low shares per round. If the round exceeds a certain amount of shares they .hop. to another proportional pool which started a new round more recently trying their luck on the other pool. This assures better rewards for pool hoppers over occasional or constant miners which are loyal to their pool. Pool hopping however implies that pool hoppers need to know when a round is started and how much shares are considered for reward. This is very easy with propotional reward system. Using PPLNS this is no longer true. On long rounds (like round five above) the pool hoppers shares won.t be considered for reward calculations in favor of loyal miners. This is due to the fact that pool hoppers only mine on the beginning of rounds. On short and normal rounds pool hoppers won.t loose their shares. But due to the fact that shares from previous rounds from loyal miners are considered twice (or even more often on extremely short rounds) the pool hopper won.t get the same reward as from proportional reward system.

+

I.m only an occasional miner. Will I loose shares if playing/being offline?

+

It depends. Even if you are a constant miner you.ll loose shares on very long rounds. On the other hand if you for example stop mining shortly before the end of round three from the image above you.ll be rewarded for round three. If you then start mining on the mid of round five you.ll be rewarded a bit for round four (despite the fact you haven.t submitted any shares as some of your shares from round three are considered for round four as well) and you.ll be fully rewarded for round five (you won.t loose any shares as you .skipped. the .red part. of shares which have been cut off due to the length of the round). The point however is no one (and thus the pool hopper as well) knows when a round ends in advance. Thus you deliberately can.t avoid cut offs. Sometimes you are lucky sometimes your are not. This however levels out over the time for non-hoppers. The important point is, that you as loyal pool member have an advantage over pool hoppers. Even if you are mining only occasionally in order to enjoy the silence within your mining room.

+

Isn.t it that you as pool operator earn more from PPLNS?

+

Short answer: No. As a pool operator I. In fact for a pool operator it doesn.t matter at all which reward system is used. I expect rounds to become a bit longer after PPLNS is activated as the pool hoppers will start to avoid the Pool. Thus revenues for me will be lower. But there were some loyal pool members who clearly stated that they want to get rid of the pool hoppers and I respect their wish. Furthermore I.m too an occasional miner on the Pool as I don.t want the miners to be running at night and from time to time I need them to test new Pool versions on development systems. Thus being a miner like you I like PPLNS better than proportional. But speaking as pool operator there is no difference between the reward systems.

+

Thanks to g2x3k/Poolx-eu for PPLNS description

+ +
+
+
diff --git a/public/templates/test/contactform/contactform/default.tpl b/public/templates/test/contactform/contactform/default.tpl new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/public/templates/test/contactform/contactform/default.tpl @@ -0,0 +1 @@ + diff --git a/public/templates/test/contactform/default.tpl b/public/templates/test/contactform/default.tpl new file mode 100644 index 00000000..3734ec84 --- /dev/null +++ b/public/templates/test/contactform/default.tpl @@ -0,0 +1,29 @@ +
+

Contact Us

+
+
+ + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
{nocache}{$RECAPTCHA|default:""}{/nocache}
+ +
+
+
+
+
diff --git a/public/templates/test/contactform/disabled.tpl b/public/templates/test/contactform/disabled.tpl new file mode 100644 index 00000000..d56872ce --- /dev/null +++ b/public/templates/test/contactform/disabled.tpl @@ -0,0 +1,10 @@ +
+

Contact & Support

+
+
+ +

This product comes 'as-is' without any warranty. Please check the Apache License, Version 2.0, for details.

+
+
+
+
diff --git a/public/templates/test/gettingstarted/default.tpl b/public/templates/test/gettingstarted/default.tpl new file mode 100644 index 00000000..ac0ddfae --- /dev/null +++ b/public/templates/test/gettingstarted/default.tpl @@ -0,0 +1,80 @@ +
+

GettingStarted

+
+ + +

+

+
  • 1. Create account. +
    +
      +
    • Register here, or login if you already have account
    • +
    • Create a worker that will be used by the miner to login
    • +
    + +
  • 2. Download a miner. + +
  • +
  • 3. Configure your miner. +

    +Settings for Stratum (recommended): +
  • + +
    + + + + + + + +
    STRATUM:stratum+tcp://yourdomain.com
    PORT:3333
    Username:Weblogin.Worker
    Password:Worker Password
    + + +
    + If you use a command-line miner, type: +
    	./cgminer --scrypt -o stratum+tcp://yourdomain.com:3333 -u Weblogin.Worker -p Worker password
    +
    + If you want, you can create additional workers with usernames and passwords of your choice Here

    + +
  • 4. Create a Litecoin address to recieve payments. +
      +
    • Downloading the client & block chain: Download the Litecoin client from the here.
      + Generate a new address and input it on your account page to receive payments. +
    • + +
  • +
    + + +
  • 5. Advanced cgminer settings / FAQ +
      +
    • + Scrypt readme +
    • +
    • + Don't set intensity too high, I=11 is standard and safest. Higher intensity takes more GPU RAM. Check for hardware errors in cgminer (HW). HW=0 is good, otherwise lower intensity :) +
    • +
    • + Set shaders according to the readme (or look at your graphic cards specifications). Cgminer uses this value at first run to calculate thread-concurrency. + Easiest way to get this optimized is to use same settings as others have used here: here. +
    • +
    • + There's also an interesting project which gives you a GUI for cgminer. Windows only it seems. +
    • +
    • + Here's a great guide how to get up and running with Xubuntu. +
    • +
    +
  • + +
    +
    +
    diff --git a/public/templates/test/global/navigation.tpl b/public/templates/test/global/navigation.tpl index cde6d5e6..402ad7bb 100644 --- a/public/templates/test/global/navigation.tpl +++ b/public/templates/test/global/navigation.tpl @@ -24,6 +24,7 @@
  • News
  • {/if} + {if $smarty.session.AUTHENTICATED|default}

    Statistics

    + {else} +

    Statistics

    + + {/if} +

    Help

    +

    Other

    diff --git a/public/templates/test/support/default.tpl b/public/templates/test/support/default.tpl new file mode 100644 index 00000000..d56872ce --- /dev/null +++ b/public/templates/test/support/default.tpl @@ -0,0 +1,10 @@ +
    +

    Contact & Support

    +
    +
    + +

    This product comes 'as-is' without any warranty. Please check the Apache License, Version 2.0, for details.

    +
    +
    +
    +