コード例 #1
0
ファイル: supr.php プロジェクト: byrnereese/mt-plugin-supr
1. Upload supr.php to your website's root director
2. Please add these lines to your rewrite.conf or .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^[a-zA-Z0-9]{1,4}$ supr.php?supr=$0&blog_id=<mt:BlogID>&cgipath=<mt:CGIServerPath>
RewriteRule ^supr_settings.json$ supr.php?check_install=$0&blog_id=<mt:BlogID>&cgipath=<mt:CGIServerPath>
</IfModule>
*/
global $cgipath;
// $blog_id = <mt:BlogID>;
// $cgipath = "<mt:CGIServerPath>";
$blog_id = $_GET['blog_id'];
$cgipath = $_GET['cgipath'];
include "{$cgipath}/php/mt.php";
$mt = new MT($blog_id, "{$cgipath}/mt-config.cgi");
$ctx =& $mt->context();
$config = $ctx->mt->db->fetch_plugin_config('Supr', 'blog:' . $blog_id);
$login = $config['supr_username'];
$apikey = $config['supr_apikey'];
$blog = $ctx->mt->db->fetch_blog($blog_id);
$domain = $blog['blog_site_url'];
// supr CONFIG : replace with your info //
// $domain = "<mt:BlogURL>";
// $login = "******";
// $apikey = "xxxxxxx";
define('USER_AGENT', 'SuprMTPlugin');
require_once "{$cgipath}/plugins/Supr/php/extlib/urlopen.php";
if (!function_exists('json_decode')) {
    require_once "{$cgipath}/plugins/Supr/php/extlib/JSON.php";
    function json_decode($content, $assoc = false)
    {