MyBB Community Forums

Full Version: Script to Update Plugins for 1.6.5
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10
Would you make it compatible with be 1.6.5

thax
<?php
/**
 * MyBBSayac 1.0 For MyBB 1.6*
 * Copyright ® 2009 DeLLy
 *
 * Website: http://www.tufyta.com
 *
 */
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$plugins->add_hook("global_start", "istatistik_tut");
$plugins->add_hook('admin_tools_action_handler', 'mybbsayac_dosyasi'); 
$plugins->add_hook('admin_tools_menu', 'mybbsayac_tools'); 

function mybbsayac_info()
{
    global $lang;
    $lang->load("tools_mybbsayac");
	return array(
		"name"			=> "<img border=\"0\" src=\"../inc/plugins/mybbsayac/mybbsayac.gif\"> MyBB Sayaç Eklentisi",
		"description"	=> $lang->mybbsayac_desc,
		"website"		=> "http://www.mybb.com.tr",
        "author"        => "DeLLy",
		"authorsite"	=> "http://www.tufyta.com",
		"version"		=> "1.0",
		"guid" 			=> "",
		"compatibility" => "16*"
	);
}

function mybbsayac_install() 
    {
        global $db;
        //Ziyaretçi Tablosunu Oluşturuyoruz
        $db->query("CREATE TABLE `".TABLE_PREFIX."sayac_ziyaretciler` (
        `id` int(255) NOT NULL auto_increment,
        `ip` varchar(50) NOT NULL,
        `useragent` varchar(250) NOT NULL,
        `date` date NOT NULL,
        `time` datetime NOT NULL,
        `timestamp` int(50) NOT NULL,
        `referer` varchar(255) NOT NULL,
        `lastpage` varchar(255) NOT NULL,
         PRIMARY KEY  (`id`)
         ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=0");
         // Anahtar Kelime Tablosunu Oluşturuyoruz.
        $db->query("CREATE TABLE IF NOT EXISTS `".TABLE_PREFIX."sayac_kelimeler` (
        `id` int(11) NOT NULL auto_increment,
        `tarih` date NOT NULL,
        `kelime` varchar(250) NOT NULL,
        `aranma` int(11) NOT NULL default '1',
        `toparanma` int(11) NOT NULL default '1',
        PRIMARY KEY  (`id`)
        )ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=0;");
        //Referans Site Tablosunu Oluşturuyoruz.
       $db->query("CREATE TABLE IF NOT EXISTS `".TABLE_PREFIX."sayac_siteler` (
       `id` int(11) NOT NULL auto_increment,
       `tarih` date NOT NULL,
       `site` varchar(250) NOT NULL,
       `aranma` int(11) NOT NULL default '1',
       `toparanma` int(11) NOT NULL default '1',
       PRIMARY KEY  (`id`)
       ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=125 ;");
       //Tarih Hit Tablosunu Oluşturuyoruz.
      $db->query ("CREATE TABLE IF NOT EXISTS `".TABLE_PREFIX."sayac_tarih_hit` (
      `id` int(11) NOT NULL auto_increment,
      `tarih` date NOT NULL,
      `tekil` int(11) NOT NULL,
      `hit` int(11) NOT NULL,
      PRIMARY KEY  (`id`)
      ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=0;");
     $db->query("CREATE TABLE IF NOT EXISTS `".TABLE_PREFIX."sayac_ip2con` (
     `fromip` bigint(12) NOT NULL default '0',
     `toip` bigint(12) NOT NULL default '0',
     `ccode` char(2) NOT NULL default '',
     `cname` varchar(50) NOT NULL default ''
     ) ENGINE=MyISAM DEFAULT CHARSET=utf8;"); 
    $ip2con=file("../inc/plugins/mybbsayac/ip2con.sql");
    //Ülke IP aralıklarının Kayıtlı Olduğu Sql DOsyasını İçeri Aktarıyoruz.
    foreach($ip2con AS $line) {
        $line=str_replace("ip2con","".TABLE_PREFIX."sayac_ip2con",$line);
    $db->query($line);
    }
    }

function mybbsayac_is_installed() 
    {
        global $db;
        if ($db->table_exists("sayac_ziyaretciler")) 
        {
        return true;
        }
        return false;
}

function mybbsayac_uninstall() 
    {
        global $db;
    $db->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."sayac_ziyaretciler`, `".TABLE_PREFIX."sayac_tarih_hit`, `".TABLE_PREFIX."sayac_siteler`, `".TABLE_PREFIX."sayac_ip2con`, `".TABLE_PREFIX."sayac_kelimeler`");
    }
    
    function mybbsayac_tools($ref) {
        global $lang;
        $lang->load("tools_mybbsayac");
        $ref[] = array("id" => "mybbsayac", "title" => $lang->mybbsayac, "link" => "index.php?module=tools_mybbsayac");
   }
   
   function mybbsayac_dosyasi($ref) {
       // Plugini Tek Klasorde Vermek istediğim için boyle bişey yapmak zorundaydım :)
       //I want give plugin in a one folder for easyly installing (:
   $ref['mybbsayac'] = array('active' => 'mybbsayac', 'file' =>'../../../inc/plugins/mybbsayac/mybbsayac.php');
   }
    
    function istatistik_tut () {
        global $db;
    function tekniktemizlik($gelen) 
        {
            $gelen=stripslashes($gelen);
            $gelen=mysql_real_escape_string($gelen);
            return $gelen;
        }

function kelimebuls($agent) {
    $ref=$agent;
    $ref = str_replace("aq","",$ref);
    $ref = str_replace("oq","",$ref);
    $query_string = false;   
    $querystruct = array();
    $querystruct[] = array("google.", "q", "Google");
    $querystruct[] = array("ask.com", "q", "Ask.com");
    $querystruct[] = array("ask.co.uk", "ask", "Ask.co.uk");
    $querystruct[] = array("comcast.net", "q", "Comcast");
    $querystruct[] = array("yahoo", "p", "Yahoo");
    $querystruct[] = array("aol.com", "query", "AOL");
    $querystruct[] = array("msn.com", "q", "MSN");
    $querystruct[] = array("live.com", "q", "Live.com");
    $querystruct[] = array("netscape.com", "query", "Netscape");
    $querystruct[] = array("netzero.net", "query", "NetZero");
    $querystruct[] = array("altavista.com", "q", "Altavista");
    $querystruct[] = array("mywebsearch.com", "searchfor", "Mywebsearch");
    $querystruct[] = array("alltheweb.com", "q", "Alltheweb");
    $querystruct[] = array("cnn.com", "query", "CNN");
    $querystruct[] = array("myspace.com", "q", "MySpace");
    
    for($i=0,$size=sizeof($querystruct);$i<$size;$i++){
        if (stristr($ref,$querystruct[$i][0]) ) {
            $symbol = $querystruct[$i][1];
            $temp1 = explode("$symbol=",$ref,2);
            $temp2 = explode("&",$temp1[1]);
            $string = $temp2[0];
            $query_string =urldecode($string);
        }
    }
    return $query_string;
}

$ip         =tekniktemizlik($_SERVER['REMOTE_ADDR']);
$referer    =tekniktemizlik($_SERVER['HTTP_REFERER']);
$loca       =tekniktemizlik($_SERVER['REQUEST_URI']);
$useragent  =tekniktemizlik($_SERVER['HTTP_USER_AGENT']);
$bugun=date('d-m-Y');
$time=time()+300;

$gunsor=$db->query("SELECT *FROM ".TABLE_PREFIX."sayac_tarih_hit WHERE tarih='$bugun'");
$gunsay=$db->num_rows($gunsor);

if($gunsay=="0") 
    {
        $db->query("INSERT INTO ".TABLE_PREFIX."sayac_tarih_hit (tarih) VALUES (now())");
    }

    $ipsor=$db->query("SELECT ip FROM ".TABLE_PREFIX."sayac_ziyaretciler WHERE ip='$ip' AND date='$bugun'");
    $ipsay=$db->num_rows($ipsor);
if ($ipsay=="0") 
    {
        $db->query("INSERT INTO ".TABLE_PREFIX."sayac_ziyaretciler (ip,useragent,date,time,timestamp,referer,lastpage) VALUES ('$ip','$useragent',now(),now(),'$time','$referer','$loca')");
        $db->query("UPDATE ".TABLE_PREFIX."sayac_tarih_hit SET tekil=tekil+1,hit=hit+1 WHERE tarih='$bugun'");
    
        $bugun=date("Y-m-d");
        $kelime=kelimebuls($referer);
if ($kelime) 
    {
        $kelimesay=$db->query("SELECT *FROM ".TABLE_PREFIX."sayac_kelimeler WHERE kelime='$kelime' AND tarih='$bugun'");
        $varmi=$db->num_rows($kelimesay);
    if ($varmi<1) 
        {
            $db->query("INSERT INTO ".TABLE_PREFIX."sayac_kelimeler (tarih,kelime) VALUES (now(),'$kelime')");
            }
            else 
            {
                $db->query("UPDATE ".TABLE_PREFIX."sayac_kelimeler SET aranma=aranma+1 WHERE kelime='$kelime' AND tarih='$bugun'");
                $db->query("UPDATE ".TABLE_PREFIX."sayac_kelimeler SET toparanma=toparanma+1 WHERE kelime='$kelime'"); 
            }
    }

    $refparse=parse_url($referer);
    $site=$refparse[host];
    if ($site)  
        {
            $sitesay=$db->query("SELECT *FROM ".TABLE_PREFIX."sayac_siteler WHERE site='$site' AND tarih='$bugun'");
            $sitevarmi=$db->num_rows($sitesay);
    if ($sitevarmi<1) 
        {
            $db->query("INSERT INTO ".TABLE_PREFIX."sayac_siteler (tarih,site) VALUES (now(),'$site')");
            }else 
            {
                $db->query("UPDATE ".TABLE_PREFIX."sayac_siteler SET aranma=aranma+1 WHERE site='$site' AND tarih='$bugun'");
                $db->query("UPDATE ".TABLE_PREFIX."sayac_siteler SET toparanma=toparanma+1 WHERE site='$site'"); 
                }
                }
                }
                else {
                    $db->query("UPDATE ".TABLE_PREFIX."sayac_ziyaretciler SET timestamp='$time',useragent='$useragent',lastpage='$loca' WHERE ip='$ip' AND date='$bugun'");
                    $db->query("UPDATE ".TABLE_PREFIX."sayac_tarih_hit SET hit=hit+1 WHERE tarih='$bugun'");
                    } 
                    }
?>
It is indeed compatible for it.
[Image: 7fmfs.png]
I guess there might be something wrong in the mybbsayac.php plugin/file. What's that?
This plugin here
[attachment=26449]
this thread is not for support for your specific plugin except for making it compatible with 1.6.5 or later. Please start another thread or contact the plugin author directly.
Not sure if it'll help solve my issue (i guess I'll get back if not), but at least the script has applied successfully all updates and changes, without any errors, just as the first post by pavemen indicates, so thank you a lot my friend for doing this nice job for noobs like me.
Regards
Pages: 1 2 3 4 5 6 7 8 9 10