]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
moving captcha and crontrigger plugins out of core
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 4 Jan 2011 02:25:04 +0000 (02:25 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 4 Jan 2011 02:25:04 +0000 (02:25 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7823 36083f99-b078-4883-b0ff-0f9b5a30f544

15 files changed:
mod/captcha/backgrounds/bg1.jpg [deleted file]
mod/captcha/backgrounds/bg2.jpg [deleted file]
mod/captcha/backgrounds/bg3.jpg [deleted file]
mod/captcha/backgrounds/bg4.jpg [deleted file]
mod/captcha/backgrounds/bg5.jpg [deleted file]
mod/captcha/captcha.php [deleted file]
mod/captcha/fonts/1.ttf [deleted file]
mod/captcha/fonts/Liberation_serif_License.txt [deleted file]
mod/captcha/languages/en.php [deleted file]
mod/captcha/manifest.xml [deleted file]
mod/captcha/start.php [deleted file]
mod/captcha/views/default/captcha/css.php [deleted file]
mod/captcha/views/default/input/captcha.php [deleted file]
mod/crontrigger/manifest.xml [deleted file]
mod/crontrigger/start.php [deleted file]

diff --git a/mod/captcha/backgrounds/bg1.jpg b/mod/captcha/backgrounds/bg1.jpg
deleted file mode 100644 (file)
index 0e16b22..0000000
Binary files a/mod/captcha/backgrounds/bg1.jpg and /dev/null differ
diff --git a/mod/captcha/backgrounds/bg2.jpg b/mod/captcha/backgrounds/bg2.jpg
deleted file mode 100644 (file)
index 3357164..0000000
Binary files a/mod/captcha/backgrounds/bg2.jpg and /dev/null differ
diff --git a/mod/captcha/backgrounds/bg3.jpg b/mod/captcha/backgrounds/bg3.jpg
deleted file mode 100644 (file)
index 96610ab..0000000
Binary files a/mod/captcha/backgrounds/bg3.jpg and /dev/null differ
diff --git a/mod/captcha/backgrounds/bg4.jpg b/mod/captcha/backgrounds/bg4.jpg
deleted file mode 100644 (file)
index 5123ed7..0000000
Binary files a/mod/captcha/backgrounds/bg4.jpg and /dev/null differ
diff --git a/mod/captcha/backgrounds/bg5.jpg b/mod/captcha/backgrounds/bg5.jpg
deleted file mode 100644 (file)
index 7ae7e6c..0000000
Binary files a/mod/captcha/backgrounds/bg5.jpg and /dev/null differ
diff --git a/mod/captcha/captcha.php b/mod/captcha/captcha.php
deleted file mode 100644 (file)
index c4b9135..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/**
- * Elgg captcha plugin graphics file generator
- *
- * @package ElggCaptcha
- */
-
-global $CONFIG;
-$token = get_input('captcha_token');
-
-//     Output captcha
-if ($token) {
-       // Set correct header
-       header("Content-type: image/jpeg");
-
-       // Generate captcha
-       $captcha = captcha_generate_captcha($token);
-
-       // Pick a random background image
-       $n = rand(1, $CONFIG->captcha_num_bg);
-       $image = imagecreatefromjpeg($CONFIG->pluginspath . "captcha/backgrounds/bg$n.jpg");
-
-       // Create a colour (black so its not a simple matter of masking out one colour and ocring the rest)
-       $colour = imagecolorallocate($image, 0,0,0);
-
-       // Write captcha to image
-       //imagestring($image, 5, 30, 4, $captcha, $black);
-       imagettftext($image, 30, 0, 10, 30, $colour, $CONFIG->pluginspath . "captcha/fonts/1.ttf", $captcha);
-
-       // Output image
-       imagejpeg($image);
-
-       // Free memory
-       imagedestroy($image);
-}
diff --git a/mod/captcha/fonts/1.ttf b/mod/captcha/fonts/1.ttf
deleted file mode 100644 (file)
index f5534f9..0000000
Binary files a/mod/captcha/fonts/1.ttf and /dev/null differ
diff --git a/mod/captcha/fonts/Liberation_serif_License.txt b/mod/captcha/fonts/Liberation_serif_License.txt
deleted file mode 100644 (file)
index 41751f2..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-LICENSE AGREEMENT AND LIMITED PRODUCT WARRANTY LIBERATION FONT SOFTWARE
-This agreement governs the use of the Software and any updates to the
-Software, regardless of the delivery mechanism. Subject to the following
-terms, Red Hat, Inc. ("Red Hat") grants to the user ("Client") a license to
-this collective work pursuant to the GNU General Public License v.2 with the
-exceptions set forth below and such other terms as our set forth in this End
-User License Agreement.
-1. The Software and License Exception. LIBERATION font software  (the
-"Software") consists of TrueType-OpenType formatted font software for
-rendering LIBERATION typefaces in sans serif, serif, and monospaced character
-styles. You are licensed to use, modify, copy, and distribute the Software
-pursuant to the GNU General Public License v.2 with the following exceptions:  
-1) As a special exception, if you create a document which uses this font, and
-embed this font or unaltered portions of this font into the document, this
-font does not by itself cause the resulting document to be covered by the GNU
-General Public License.  This exception does not however invalidate any other
-reasons why the document might be covered by the GNU General Public License. 
-If you modify this font, you may extend this exception to your version of the
-font, but you are not obligated to do so. If you do not wish to do so, delete
-this exception statement from your version. 
-
-2) As a further exception, any distribution of the object code of the Software
-in a physical product must provide you the right to access and modify the
-source code for the Software and to reinstall that modified version of the
-Software in object code form on the same physical product on which you
-received it.
-2. Intellectual Property Rights. The Software and each of its components,
-including the source code, documentation, appearance, structure and
-organization are owned by Red Hat and others and are protected under copyright
-and other laws. Title to the Software and any component, or to any copy,
-modification, or merged portion shall remain with the aforementioned, subject
-to the applicable license. The "LIBERATION" trademark is a trademark of Red
-Hat, Inc. in the U.S. and other countries. This agreement does not permit
-Client to distribute modified versions of the Software using Red Hat's
-trademarks. If Client makes a redistribution of a modified version of the
-Software, then Client must modify the files names to remove any reference to
-the Red Hat trademarks and must not use the Red Hat trademarks in any way to
-reference or promote the modified Software. 
-3. Limited Warranty. To the maximum extent permitted under applicable law, the
-Software is provided and licensed "as is" without warranty of any kind,
-expressed or implied, including the implied warranties of merchantability,
-non-infringement or fitness for a particular purpose. Red Hat does not warrant
-that the functions contained in the Software will meet Client's requirements
-or that the operation of the Software will be entirely error free or appear
-precisely as described in the accompanying documentation. 
-4. Limitation of Remedies and Liability.  To the maximum extent permitted by
-applicable law, Red Hat or any Red Hat authorized dealer will not be liable to
-Client for any incidental or consequential damages, including lost profits or
-lost savings arising out of the use or inability to use the Software, even if
-Red Hat or such dealer has been advised of the possibility of such damages. 
-5. Export Control. As required by U.S. law, Client represents and warrants
-that it: (a) understands that the Software is subject to export controls under
-the U.S. Commerce Department's Export Administration Regulations ("EAR"); (b)
-is not located in a prohibited destination country under the EAR or U.S.
-sanctions regulations (currently Cuba, Iran, Iraq, Libya, North Korea, Sudan
-and Syria); (c) will not export, re-export, or transfer the Software to any
-prohibited destination, entity, or individual without the necessary export
-license(s) or authorizations(s) from the U.S. Government; (d) will not use or
-transfer the Software for use in any sensitive nuclear, chemical or biological
-weapons, or missile technology end-uses unless authorized by the U.S.
-Government by regulation or specific license; (e) understands and agrees that
-if it is in the United States and exports or transfers the Software to
-eligible end users, it will, as required by EAR Section 740.17(e), submit
-semi-annual reports to the Commerce Department's Bureau of Industry & Security
-(BIS), which include the name and address (including country) of each
-transferee; and (f) understands that countries other than the United States
-may restrict the import, use, or export of encryption products and that it
-shall be solely responsible for compliance with any such import, use, or
-export restrictions.
-6. General. If any provision of this agreement is held to be unenforceable,
-that shall not affect the enforceability of the remaining provisions. This
-agreement shall be governed by the laws of the State of North Carolina and of
-the United States, without regard to any conflict of laws provisions, except
-that the United Nations Convention on the International Sale of Goods shall
-not apply.
-Copyright © 2007 Red Hat, Inc. All rights reserved. LIBERATION is a trademark
-of Red Hat, Inc.
diff --git a/mod/captcha/languages/en.php b/mod/captcha/languages/en.php
deleted file mode 100644 (file)
index 4b7514b..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-/**
- * Elgg diagnostics language pack.
- *
- * @package ElggDiagnostics
- */
-
-$english = array(
-
-       'captcha:entercaptcha' => 'Enter text from image',
-       'captcha:captchafail' => 'Sorry, the text that you entered didn\'t match the text in the image.',
-
-);
-
-add_translation("en", $english);
diff --git a/mod/captcha/manifest.xml b/mod/captcha/manifest.xml
deleted file mode 100644 (file)
index ba1b457..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin_manifest>
-       <field key="author" value="Curverider Ltd" />
-       <field key="version" value="1.8" />
-       <field key="description" value="Provides captcha support (Requires the php_gd library)." />
-       <field key="website" value="http://www.elgg.org/" />
-       <field key="copyright" value="(C) Curverider 2008-2010" />
-       <field key="licence" value="GNU Public License version 2" />
-       <field key="elgg_version" value="2010030101" />
-       <field key="admin_interface" value="advanced" />
-</plugin_manifest>
diff --git a/mod/captcha/start.php b/mod/captcha/start.php
deleted file mode 100644 (file)
index ec97d96..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-<?php
-/**
- * Elgg captcha plugin
- *
- * @package captcha
- */
-
-function captcha_init() {
-       global $CONFIG;
-
-       // Register page handler for captcha functionality
-       register_page_handler('captcha','captcha_page_handler');
-
-       // Extend CSS
-       elgg_extend_view('css/screen','captcha/css');
-
-       // Number of background images
-       $CONFIG->captcha_num_bg = 5;
-
-       // Default length
-       $CONFIG->captcha_length = 5;
-
-       // Register a function that provides some default override actions
-       elgg_register_plugin_hook_handler('actionlist', 'captcha', 'captcha_actionlist_hook');
-
-       // Register actions to intercept
-       $actions = array();
-       $actions = elgg_trigger_plugin_hook('actionlist', 'captcha', NULL, $actions);
-
-       if (($actions) && (is_array($actions))) {
-               foreach ($actions as $action) {
-                       elgg_register_plugin_hook_handler("action", $action, "captcha_verify_action_hook");
-               }
-       }
-}
-
-function captcha_page_handler($page) {
-       global $CONFIG;
-
-       if (isset($page[0])) {
-               set_input('captcha_token', $page[0]);
-       }
-
-       include($CONFIG->pluginspath . "captcha/captcha.php");
-}
-
-/**
- * Generate a token to act as a seed value for the captcha algorithm.
- */
-function captcha_generate_token() {
-       // Use action token plus some random for uniqueness
-       return md5(generate_action_token(time()) . rand());
-}
-
-/**
- * Generate a captcha based on the given seed value and length.
- *
- * @param string $seed_token
- * @return string
- */
-function captcha_generate_captcha($seed_token) {
-       global $CONFIG;
-
-       /*
-        * We generate a token out of the random seed value + some session data,
-        * this means that solving via pr0n site or indian cube farm becomes
-        * significantly more tricky (we hope).
-        * 
-        * We also add the site secret, which is unavailable to the client and so should
-        * make it very very hard to guess values before hand.
-        * 
-        */
-
-       return strtolower(substr(md5(generate_action_token(0) . $seed_token), 0, $CONFIG->captcha_length));
-}
-
-/**
- * Verify a captcha based on the input value entered by the user and the seed token passed.
- *
- * @param string $input_value
- * @param string $seed_token
- * @return bool
- */
-function captcha_verify_captcha($input_value, $seed_token) {
-       if (strcasecmp($input_value, captcha_generate_captcha($seed_token)) == 0) {
-               return TRUE;
-       }
-
-       return FALSE;
-}
-
-/**
- * Listen to the action plugin hook and check the captcha.
- *
- * @param string $hook
- * @param string $entity_type
- * @param mixed $returnvalue
- * @param array $params
- */
-function captcha_verify_action_hook($hook, $entity_type, $returnvalue, $params) {
-       $token = get_input('captcha_token');
-       $input = get_input('captcha_input');
-
-       if (($token) && (captcha_verify_captcha($input, $token))) {
-               return TRUE;
-       }
-
-       register_error(elgg_echo('captcha:captchafail'));
-
-       // forward to referrer or else action code sends to front page
-       forward(REFERER);
-
-       return FALSE;
-}
-
-/**
- * This function returns an array of actions the captcha will expect a captcha for.
- * Other plugins may add their own to this list thereby extending the use.
- *
- * @param string $hook
- * @param string $entity_type
- * @param mixed $returnvalue
- * @param array $params
- */
-function captcha_actionlist_hook($hook, $entity_type, $returnvalue, $params) {
-       if (!is_array($returnvalue)) {
-               $returnvalue = array();
-       }
-
-       $returnvalue[] = 'register';
-       $returnvalue[] = 'user/requestnewpassword';
-
-       return $returnvalue;
-}
-
-elgg_register_event_handler('init', 'system', 'captcha_init');
diff --git a/mod/captcha/views/default/captcha/css.php b/mod/captcha/views/default/captcha/css.php
deleted file mode 100644 (file)
index 861d26d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-/**
- * Elgg Captcha CSS
- * 
- * @package captcha
- */
-
-?>
\ No newline at end of file
diff --git a/mod/captcha/views/default/input/captcha.php b/mod/captcha/views/default/input/captcha.php
deleted file mode 100644 (file)
index c113d5b..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-/**
- * Elgg captcha plugin captcha hook view override.
- *
- * @package ElggCaptcha
- */
-
-// Generate a token which is then passed into the captcha algorithm for verification
-$token = captcha_generate_token();
-?>
-<div class="captcha">
-       <input type="hidden" name="captcha_token" value="<?php echo $token; ?>" />
-       <label>
-               <?php echo elgg_echo('captcha:entercaptcha'); ?>
-               <div class="captcha_image">
-                       <img class="captcha-input-image" alt="captcha" src="<?php echo elgg_get_site_url() . "pg/captcha/$token"; ?>" />
-               </div>
-               <div class="captcha_input">
-                       <?php echo elgg_view('input/text', array('internalname' => 'captcha_input')); ?>
-               </div>
-       </label>
-</div>
\ No newline at end of file
diff --git a/mod/crontrigger/manifest.xml b/mod/crontrigger/manifest.xml
deleted file mode 100644 (file)
index 8058ebb..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin_manifest>
-       <field key="author" value="Curverider Ltd" />
-       <field key="version" value="1.5" />
-       <field key="description" value="Provides a poor man's cron trigger to trigger cron scripts based on site visits." />
-       <field key="website" value="http://www.elgg.org/" />
-       <field key="copyright" value="(C) Curverider 2008-2010" />
-       <field key="licence" value="GNU Public License version 2" />
-       <field key="elgg_version" value="2009030702" />
-       <field key="admin_interface" value="advanced" />
-</plugin_manifest>
diff --git a/mod/crontrigger/start.php b/mod/crontrigger/start.php
deleted file mode 100644 (file)
index 2966d83..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-/**
- * Elgg Cron trigger.
- * When enabled this plugin provides "poor man's cron" functionality to trigger
- * elgg cron scripts without the need to install the cron script.
- *
- * Note, this is a substitute and not a replacement for the cron script.
- * It is recommended that you use the cron script where possible.
- *
- * @package ElggCronTrigger
- */
-
-elgg_register_event_handler('init', 'system', 'crontrigger_init');
-
-function crontrigger_init() {
-       elgg_register_event_handler('shutdown', 'system', 'crontrigger_shutdownhook');
-}
-
-function crontrigger_trigger($period) {
-       elgg_trigger_plugin_hook('cron', $period);
-}
-
-function crontrigger_minute() {
-       crontrigger_trigger('minute');
-}
-
-function crontrigger_fiveminute() {
-       crontrigger_trigger('fiveminute');
-}
-
-function crontrigger_fifteenmin() {
-       crontrigger_trigger('fifteenmin');
-}
-
-function crontrigger_halfhour() {
-       crontrigger_trigger('halfhour');
-}
-
-function crontrigger_hourly() {
-       crontrigger_trigger('hourly');
-}
-
-function crontrigger_daily() {
-       crontrigger_trigger('daily');
-}
-
-function crontrigger_weekly() {
-       crontrigger_trigger('weekly');
-}
-
-function crontrigger_monthly() {
-       crontrigger_trigger('monthly');
-}
-
-function crontrigger_yearly() {
-       crontrigger_trigger('yearly');
-}
-
-/**
- * Call cron hooks after a page has been displayed (so user won't notice any slowdown).
- *
- * If people are not viewing pages quickly enough, the scheduled triggers will
- * not occur.
- */
-function crontrigger_shutdownhook() {
-
-       $minute = 60;
-       $fiveminute = $minute * 5;
-       $fifteenmin = $minute * 15;
-       $halfhour = $minute * 30;
-       $hour = 3600;
-       $day = $hour * 24;
-       $week = $day * 7;
-       $month = $week * 4;
-       $year = $month * 12;
-
-       $now = time();
-
-       ob_start();
-       run_function_once('crontrigger_minute', $now - $minute);
-       run_function_once('crontrigger_fiveminute', $now - $fiveminute);
-       run_function_once('crontrigger_fifteenmin', $now - $fifteenmin);
-       run_function_once('crontrigger_halfhour', $now - $halfhour);
-       run_function_once('crontrigger_hourly', $now - $hour);
-       run_function_once('crontrigger_daily', $now - $day);
-       run_function_once('crontrigger_weekly', $now - $week);
-       run_function_once('crontrigger_monthly', $now - $month);
-       run_function_once('crontrigger_yearly', $now - $year);
-       ob_clean();
-}