/** * AmazonURLを取得 * * @return str Amazon URL * @access public */ function getAmazonURL($query) { $query['Service'] = "AWSECommerceService"; $query['AWSAccessKeyId'] = rawurlencode(COMP_AWS_ACCESS_KEY_ID); $query['AssociateTag'] = rawurlencode(COMP_AWS_ASSOCIATE_TAG); $query['Timestamp'] = rawurlencode(gmdate("Y-m-d\\TH:i:s\\Z")); $query['Version'] = rawurlencode('2010-06-01'); ksort($query); $parameters = array(); foreach ($query as $key => $value) { $parameters[] = "{$key}={$value}"; } $queryString = implode('&', $parameters); /* 正規化リクエスト */ $signatureRequestUrl = sprintf(COMP_AWS_REST, $queryString); include_once MAPLE_DIR . "/includes/pear/PHP/Compat.php"; PHP_Compat::loadFunction('hash_hmac'); /* sha256 ハッシュ計算 */ if (function_exists("hash_hmac")) { $hashString = base64_encode(hash_hmac("sha256", $signatureRequestUrl, COMP_AWS_SECRET_KEY_ID, true)); $signature = rawurlencode($hashString); $url = COMP_AWS_URL . "?" . $queryString . "&Signature=" . $signature; } else { $url = COMP_AWS_URL . "?" . $queryString; } return $url; }
/** * Load a constant, or array of constants * * @param string|array $constant The constant or constants to load. * @return bool|array true if loaded, false if not */ function loadConstant($constant) { if (is_array($constant)) { $res = array(); foreach ($constant as $singleconst) { $res[] = PHP_Compat::loadConstant($singleconst); } return $res; } else { if (!defined($constant)) { $file = sprintf('PHP/Compat/Constant/%s.php', $constant); if (@(include_once $file) !== false) { return true; } } return false; } }
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * @package Piece_Unity * @copyright 2006-2009 KUBO Atsuhiro <*****@*****.**> * @license http://www.opensource.org/licenses/bsd-license.php BSD License (revised) * @version GIT: $Id: ba74cb919149ac704dccee1da2146eb008a68d32 $ * @since File available since Release 0.2.0 */ require_once 'PHPUnit.php'; require_once 'Piece/Unity/Context.php'; require_once 'Piece/Unity/Plugin/Factory.php'; require_once 'Piece/Unity/Error.php'; require_once 'PHP/Compat.php'; require_once 'PEAR/ErrorStack.php'; PHP_Compat::loadFunction('scandir'); // {{{ GLOBALS $GLOBALS['PIECE_UNITY_Plugin_Renderer_HTML_CompatibilityTests_hasWarnings'] = false; // }}} // {{{ Piece_Unity_Plugin_Renderer_HTML_CompatibilityTests /** * Renderer_HTML compatibility tests. * * @package Piece_Unity * @copyright 2006-2009 KUBO Atsuhiro <*****@*****.**> * @license http://www.opensource.org/licenses/bsd-license.php BSD License (revised) * @version Release: 1.7.1 * @since Class available since Release 0.2.0 */ class Piece_Unity_Plugin_Renderer_HTML_CompatibilityTests extends PHPUnit_TestCase {
function file_put_contents($file_name, $content, $options = array()) { $default_options = array('ftp' => defined('AK_UPLOAD_FILES_USING_FTP') && AK_UPLOAD_FILES_USING_FTP, 'base_path' => AK_BASE_DIR); $options = array_merge($default_options, $options); if (!function_exists('file_put_contents')) { include_once AK_CONTRIB_DIR . DS . 'pear' . DS . 'PHP' . DS . 'Compat.php'; PHP_Compat::loadFunction(array('file_put_contents')); } $file_name = trim(str_replace($options['base_path'], '', $file_name), DS); if ($options['ftp']) { require_once AK_LIB_DIR . DS . 'AkFtp.php'; $file_name = trim(str_replace(array(DS, '//'), array('/', '/'), $file_name), '/'); if (!AkFtp::is_dir(dirname($file_name))) { AkFtp::make_dir(dirname($file_name)); } return AkFtp::put_contents($file_name, $content); } else { if (!is_dir(dirname($options['base_path'] . DS . $file_name))) { Ak::make_dir(dirname($options['base_path'] . DS . $file_name), $options); } if (!($result = file_put_contents($options['base_path'] . DS . $file_name, $content))) { if (!empty($content)) { Ak::trace("Could not write to file: \"" . $options['base_path'] . DS . "{$file_name}\". Please change file/dir permissions or enable FTP file handling by" . " setting the following on your config/" . AK_ENVIRONMENT . ".php file \n<pre>define('AK_UPLOAD_FILES_USING_FTP', true);\n" . "define('AK_READ_FILES_USING_FTP', false);\n" . "define('AK_DELETE_FILES_USING_FTP', true);\n" . "define('AK_FTP_PATH', 'ftp://*****:*****@example.com/path_to_the_framework');\n" . "define('AK_FTP_AUTO_DISCONNECT', true);\n</pre>"); } } return $result; } }
/** * Load components for a PHP version * * @param string $version PHP Version to load * @return array An associative array of component names loaded */ function loadVersion($version = null) { // Include list of components require 'PHP/Compat/Components.php'; // Include version_compare to work with older versions PHP_Compat::loadFunction('version_compare'); // Init $phpversion = phpversion(); $methods = array('function' => 'loadFunction', 'constant' => 'loadConstant'); $res = array(); // Iterate each component foreach ($components as $type => $slice) { foreach ($slice as $component => $compversion) { if ($version === null && 1 === version_compare($compversion, $phpversion) || (0 === version_compare($compversion, $version) || 1 === version_compare($compversion, $phpversion))) { // C > PHP $res[$type][$component] = call_user_func(array('PHP_Compat', $methods[$type]), $component); } } } return $res; }
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | // | GNU General Public License for more details. | // | | // | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to the Free Software Foundation, | // | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | // | | // +---------------------------------------------------------------------------+ // // this file can't be used on its own if (strpos($_SERVER['PHP_SELF'], 'gf_showtopic.php') !== false) { die('This file can not be used on its own.'); } if (!function_exists('str_ireplace')) { require_once 'PHP/Compat.php'; PHP_Compat::loadFunction('str_ireplace'); } include $_CONF['path'] . 'system/lib-user.php'; function showtopic($showtopic, $mode = '', $onetwo = 1, $page = 1) { global $CONF_FORUM, $_CONF, $_TABLES, $_USER, $LANG_GF01, $LANG_GF02; global $fromblock, $highlight; global $oldPost, $forumfiles; $oldPost = 0; //$mytimer = new timerobject(); //$mytimer->setPercision(2); //$mytimer->startTimer(); //$intervalTime = $mytimer->stopTimer(); //COM_errorLog("Show Topic Display Time1: $intervalTime"); if (!class_exists('StringParser')) { require_once $_CONF['path_html'] . 'forum/include/bbcode/stringparser_bbcode.class.php';
/** * load PEAR for error handling. */ require_once 'PEAR.php'; /** * load PHP_Compat for PHP backward compatibility. */ require_once 'PHP/Compat.php'; /** * is_a(), since PHP 4.2.0 */ @PHP_Compat::loadFunction('is_a'); /** * image_type_to_mime_type, since PHP 4.3.0 */ @PHP_Compat::loadFunction('image_type_to_mime_type'); // }}} // {{{ Constants /** * Image_Tools error, indicating that the given tool was not found. * * @name IMAGE_TOOLS_BASE_ERR_CLASS_INVALID * @access public */ define('IMAGE_TOOLS_BASE_ERR_CLASS_INVALID', -1); /** * Image_Tools error, indicating that the given tool object could not be * instanciated. * * @name IMAGE_TOOLS_BASE_ERR_INSTANCIATION_FAILED * @access public
* http://www.php.net/license/3_0.txt. If you did not receive a copy of * the PHP License and are unable to obtain it through the web, please * send a note to license@php.net so we can mail you a copy immediately. * * @category Image * @package Image_Barcode * @author Ryan Briones <*****@*****.**> * @copyright 2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version CVS: $Id: Code39.php,v 1.4 2006/12/13 19:29:30 cweiske Exp $ * @link http://pear.php.net/package/Image_Barcode */ require_once "Image/Barcode.php"; if (!function_exists('str_split')) { require_once 'PHP/Compat.php'; PHP_Compat::loadFunction('str_split'); } /** * Image_Barcode_Code39 class * * Package which provides a method to create Code39 using GD library. * * @category Image * @package Image_Barcode * @author Ryan Briones <*****@*****.**> * @copyright 2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version Release: @package_version@ * @link http://pear.php.net/package/Image_Barcode * @since Image_Barcode 0.5 */
* @category HTML * @package HTML_Progress2 * @author Laurent Laville <*****@*****.**> * @copyright 2005-2007 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id: Progress2.php,v 1.33 2007/01/03 16:44:05 farell Exp $ * @link http://pear.php.net/package/HTML_Progress2 * @since File available since Release 2.0.0RC1 */ require_once 'HTML/Common.php'; require_once 'HTML/CSS.php'; require_once 'Event/Dispatcher.php'; if (version_compare(phpversion(), '5.0.0', '<')) { include_once 'PHP/Compat.php'; PHP_Compat::loadFunction('ob_get_clean'); PHP_Compat::loadConstant('PHP_EOL'); } /**#@+ * Progress Bar shape types * * @var integer * @since 2.0.0 */ define('HTML_PROGRESS2_BAR_HORIZONTAL', 1); define('HTML_PROGRESS2_BAR_VERTICAL', 2); define('HTML_PROGRESS2_POLYGONAL', 3); define('HTML_PROGRESS2_CIRCLE', 4); /**#@-*/ /**#@+ * Progress Bar label types *
* * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: * http://www.php.net/license/3_0.txt. If you did not receive a copy of * the PHP License and are unable to obtain it through the web, please * send a note to license@php.net so we can mail you a copy immediately. * * @author Martin Jansen <*****@*****.**> * @copyright 2005 The PEAR Group * @version CVS: $Id: make-partial.php 197121 2005-09-28 15:47:51Z techtonik $ */ // NOTE: originally from peardoc:/make-partial.php ; // these files should be kept in sync if (substr(PHP_VERSION, 0, 1) == "4") { require_once "PHP/Compat.php"; $components = PHP_Compat::loadVersion('5.0.0'); } require_once "Console/Getopt.php"; $console = new Console_Getopt(); $args = $console->getopt($console->readPHPArgv(), array(), array("format=", "include=", "help")); // {{{ gather arguments $format = "html"; $sections = array(); $incflag = false; foreach ($args[0] as $arg) { if ($arg[0] == "--help") { showHelp(); exit(0); } elseif ($arg[0] == "--format") { $format = $arg[1]; } elseif ($arg[0] == '--include') {
define('DOC_ROOT_DIR', ROOT_DIR . 'www/'); define('BIN_DIR', ROOT_DIR . 'bin/'); define('CACHE_DIR', ROOT_DIR . 'cache/'); define('DB_BACKUP_DIR', ROOT_DIR . 'backup/'); define('BASE_LIB_DIR', ROOT_DIR . 'lib/'); define('TESTS_DIR', BASE_DIR . 'tests/'); define('FIXTURES_DIR', TESTS_DIR . 'fixtures/'); define('TESTUNIT_DIR', TESTS_DIR . 'unit/'); // mb_string mb_internal_encoding('UTF-8'); // language mb_language('Japanese'); // compatibility require_once 'PHP/Compat.php'; PHP_Compat::loadFunction('file_get_contents'); PHP_Compat::loadFunction('file_put_contents'); require_once BASE_DIR . 'lib/DATE.php'; // session lifetime /* $session_lifetime = 60 * 60 * 24 * 7; ini_set('session.cookie_lifetime', $session_lifetime); ini_set('session.gc_maxlifetime', $session_lifetime); */ // autoload ini_set('unserialize_callback_func', 'autoload'); function autoload() { include_once BASE_DIR . 'lib/dataobject/Member.php'; } // locale define('LOCALE_DETECT', true);
/** * @return void */ function _loadPHPCompat() { if (version_compare(phpversion(), '5.0.0', '<')) { PHP_Compat::loadFunction('file_put_contents'); //PHP_Compat::loadFunction('clone'); PHP_Compat::loadFunction('scandir'); PHP_Compat::loadFunction('http_build_query'); // 第3引数には対応していない //PHP_Compat::loadFunction('array_walk_recursive'); } }