[ Index ] |
|
Code source de Cr@wltr@ck 2.2.1 |
1 <?php 2 //---------------------------------------------------------------------- 3 // CrawlTrack 2.2.1 4 //---------------------------------------------------------------------- 5 // Crawler Tracker for website 6 //---------------------------------------------------------------------- 7 // Author: Jean-Denis Brun 8 //---------------------------------------------------------------------- 9 // Website: www.crawltrack.fr 10 //---------------------------------------------------------------------- 11 // That script is distributed under GNU GPL license 12 //---------------------------------------------------------------------- 13 // file:seo-graph.php 14 //---------------------------------------------------------------------- 15 // this graph is made with artichow website: www.artichow.org 16 //---------------------------------------------------------------------- 17 error_reporting(0); 18 //initialize array 19 $listlangcrawlt=array(); 20 //get graph info 21 $typegraph = $_GET['typegraph']; 22 $period = $_GET['period']; 23 $graphname= $_GET['graphname']; 24 25 //database connection 26 include "../include/configconnect.php"; 27 $connexion = mysql_connect($crawlthost,$crawltuser,$crawltpassword) or die("MySQL connection to database problem"); 28 $selection = mysql_select_db($crawltdb) or die("MySQL database selection problem"); 29 //get the listlang files 30 include "../include/listlang.php"; 31 //get the functions files 32 $times=0;//give value just to avoid error in functions.php 33 $firstdayweek='Monday'; //give value just to avoid error in functions.php 34 include "../include/functions.php"; 35 36 //get graph values 37 $sql = "SELECT graph_values FROM crawlt_graph 38 WHERE name='".sql_quote($graphname)."'"; 39 40 $requete = mysql_query($sql, $connexion) or die("MySQL query error"); 41 42 $nbrresult=mysql_num_rows($requete); 43 if($nbrresult>=1) 44 { 45 $ligne = mysql_fetch_array($requete,MYSQL_ASSOC); 46 $data = $ligne['graph_values']; 47 } 48 else 49 { 50 echo"<h1>No Graph values availabe !!!!</h1>"; 51 exit(); 52 } 53 $datatransfert= unserialize(urldecode(stripslashes($data))); 54 55 //get language to use 56 $crawltlang = $_GET['crawltlang']; 57 58 //language file include 59 if(file_exists("../language/".$crawltlang.".php") && in_array($crawltlang,$listlangcrawlt)) 60 { 61 include "../language/".$crawltlang.".php"; 62 } 63 else 64 { 65 echo"<h1>No language files available !!!!</h1>"; 66 exit(); 67 } 68 69 //legend and title text 70 $legend0= $language['ask']; 71 $legend1 = $language['google']; 72 $legend2= $language['msn']; 73 $legend3= $language['yahoo']; 74 75 foreach ($datatransfert as $key => $value) 76 { 77 $axex[] = $key; 78 } 79 if($period==1 or ($period>=300 && $period<400)) 80 { 81 $today1=date("d", strtotime("today")); 82 } 83 if($period==3) 84 { 85 $today1=date("m", strtotime("today")); 86 } 87 else 88 { 89 $today1=date("d-m-y", strtotime("today")); 90 } 91 92 93 94 if($typegraph =='link') 95 { 96 $titlegraph = $language['nbr_tot_link']; 97 $i=0; 98 foreach($axex as $data) 99 { 100 if($period==1) 101 { 102 $data2=explode(' ',$data); 103 $data3=$data2[1]; 104 if($today1<7 && $data3>25) 105 { 106 $data3=$data3-31; 107 } 108 if($data3<=$today1) 109 { 110 $cutdata=explode("-",$datatransfert[$data]); 111 $msn[$i]=$cutdata[1]; 112 $yahoo[$i]=$cutdata[0]; 113 } 114 } 115 elseif($period==2) 116 { 117 if($data<=$today1) 118 { 119 $cutdata=explode("-",$datatransfert[$data]); 120 $msn[$i]=$cutdata[1]; 121 $yahoo[$i]=$cutdata[0]; 122 } 123 } 124 elseif($period==3) 125 { 126 $data2=explode('/',$data); 127 $data3=$data2[0]; 128 if($data3<=$today1) 129 { 130 $cutdata=explode("-",$datatransfert[$data]); 131 $msn[$i]=$cutdata[1]; 132 $yahoo[$i]=$cutdata[0]; 133 } 134 } 135 else 136 { 137 $cutdata=explode("-",$datatransfert[$data]); 138 $msn[$i]=$cutdata[1]; 139 $yahoo[$i]=$cutdata[0]; 140 } 141 $google[$i]=0; 142 $i++; 143 } 144 } 145 elseif($typegraph =='bookmark') 146 { 147 $titlegraph = $language['nbr_tot_bookmark']; 148 $i=0; 149 foreach($axex as $data) 150 { 151 if($period==1) 152 { 153 $data2=explode(' ',$data); 154 $data3=$data2[1]; 155 if($today1<7 && $data3>25) 156 { 157 $data3=$data3-31; 158 } 159 if($data3<=$today1) 160 { 161 $delicious[$i]=$datatransfert[$data]; 162 } 163 } 164 elseif($period==2) 165 { 166 167 if($data<=$today1) 168 { 169 $delicious[$i]=$datatransfert[$data]; 170 } 171 } 172 elseif($period==3) 173 { 174 $data2=explode('/',$data); 175 $data3=$data2[0]; 176 if($data3<=$today1) 177 { 178 $delicious[$i]=$datatransfert[$data]; 179 } 180 } 181 else 182 { 183 $delicious[$i]=$datatransfert[$data]; 184 } 185 $google[$i]=0; 186 $i++; 187 } 188 } 189 elseif($typegraph =='entry' OR $typegraph =='email') 190 { 191 $titlegraph = $language['nbr_tot_visit_seo']; 192 foreach($axex as $data) 193 { 194 $cutdata=explode("-",$datatransfert[$data]); 195 $google[]=$cutdata[0]; 196 $msn[]=$cutdata[1]; 197 $yahoo[]=$cutdata[2]; 198 $ask[]=$cutdata[3]; 199 } 200 } 201 else 202 { 203 $titlegraph = $language['nbr_tot_pages_index']; 204 $i=0; 205 foreach($axex as $data) 206 { 207 if($period==1) 208 { 209 $data2=explode(' ',$data); 210 $data3=$data2[1]; 211 if($today1<7 && $data3>25) 212 { 213 $data3=$data3-31; 214 } 215 if($data3<=$today1) 216 { 217 $cutdata=explode("-",$datatransfert[$data]); 218 $msn[$i]=$cutdata[1]; 219 $yahoo[$i]=$cutdata[0]; 220 } 221 } 222 elseif($period==2) 223 { 224 if($data<=$today1) 225 { 226 $cutdata=explode("-",$datatransfert[$data]); 227 $msn[$i]=$cutdata[1]; 228 $yahoo[$i]=$cutdata[0]; 229 } 230 } 231 elseif($period==3) 232 { 233 $data2=explode('/',$data); 234 $data3=$data2[0]; 235 if($data3<=$today1) 236 { 237 $cutdata=explode("-",$datatransfert[$data]); 238 $msn[$i]=$cutdata[1]; 239 $yahoo[$i]=$cutdata[0]; 240 } 241 } 242 else 243 { 244 $cutdata=explode("-",$datatransfert[$data]); 245 $msn[$i]=$cutdata[1]; 246 $yahoo[$i]=$cutdata[0]; 247 } 248 $google[$i]=0; 249 $i++; 250 } 251 252 } 253 254 //graph creation 255 256 257 258 //graph creation 259 260 261 //test to see if ttf font is available 262 $fontttf= gd_info(); 263 264 if( @$fontttf['FreeType Linkage']=='with freetype') 265 { 266 $ttf='ok'; 267 } 268 else 269 { 270 $ttf='no-ok'; 271 } 272 273 274 require_once "artichow/BarPlot.class.php"; 275 276 $graph = new Graph(900, 300); 277 278 279 $graph->title->set($titlegraph); 280 if ($ttf=='ok') 281 { 282 $graph->title->setFont(new Tuffy(12)); 283 } 284 else 285 { 286 $graph->title->setFont(new Font(3)); 287 } 288 289 290 $graph->title->setColor(new DarkBlue); 291 292 293 $group = new PlotGroup(); 294 295 $group->setBackgroundColor(new Color(173, 216, 230, 60)); 296 297 $group->setSpace(2, 2, 0.1, 0); 298 299 300 $group->setPadding(50, 20, 30, 90); 301 if($typegraph =='link' OR $typegraph =='page') 302 { 303 require_once "artichow/LinePlot.class.php"; 304 if(function_exists('imageantialias')) 305 { 306 $graph->setAntiAliasing(TRUE); 307 } 308 else 309 { 310 $graph->setAntiAliasing(FALSE); 311 } 312 $plot = new LinePlot($msn); 313 // Change line color 314 $plot->setColor(new Color(0, 128, 0)); 315 // Change mark type 316 $plot->mark->setType(MARK_SQUARE); 317 $plot->mark->border->show(); 318 $plot->setThickness(4); 319 $group->add($plot); 320 $group->legend->add($plot, $language['msn'], LEGEND_LINE); 321 322 $plot = new LinePlot($yahoo); 323 // Change line color 324 $plot->setColor(new Color(0, 0, 150)); 325 // Change mark type 326 $plot->mark->setType(MARK_CIRCLE); 327 $plot->mark->border->show(); 328 $plot->setThickness(4); 329 $group->add($plot); 330 $group->legend->add($plot, $language['yahoo'], LEGEND_LINE); 331 332 333 $plot = new LinePlot($google); 334 $group->add($plot); 335 $group->legend->setBackgroundColor(new Color(255,255,255,0)); 336 $group->legend->setModel(LEGEND_MODEL_BOTTOM); 337 $group->legend->setPosition(NULL, 0.87); 338 if ($ttf=='ok') 339 { 340 $group->legend->setTextFont(new Tuffy(10)); 341 } 342 else 343 { 344 $group->legend->setTextFont(new Font(2)); 345 } 346 } 347 elseif($typegraph =='bookmark' ) 348 { 349 require_once "artichow/LinePlot.class.php"; 350 if(function_exists('imageantialias')) 351 { 352 $graph->setAntiAliasing(TRUE); 353 } 354 else 355 { 356 $graph->setAntiAliasing(FALSE); 357 } 358 $plot = new LinePlot($delicious); 359 // Change line color 360 $plot->setColor(new Color(0, 128, 0)); 361 // Change mark type 362 $plot->mark->setType(MARK_SQUARE); 363 $plot->mark->border->show(); 364 $plot->setThickness(4); 365 $group->add($plot); 366 $group->legend->add($plot, $language['delicious'], LEGEND_LINE); 367 368 $plot = new LinePlot($google); 369 $group->add($plot); 370 $group->legend->setBackgroundColor(new Color(255,255,255,0)); 371 $group->legend->setModel(LEGEND_MODEL_BOTTOM); 372 $group->legend->setPosition(NULL, 0.87); 373 if ($ttf=='ok') 374 { 375 $group->legend->setTextFont(new Tuffy(10)); 376 } 377 else 378 { 379 $group->legend->setTextFont(new Font(2)); 380 } 381 } 382 else 383 { 384 385 //ask 386 387 388 $plot = new BarPlot($ask,1,4); 389 390 391 $debut = new Color(255, 255,0 ); 392 $fin = new Color(215, 200, 0); 393 394 395 $plot->setBarGradient( 396 new LinearGradient( 397 $debut, 398 $fin, 399 90 400 ) 401 ); 402 403 $plot->setXAxisZero(TRUE); 404 405 406 407 $plot->setSpace(2, 2, 20, 0); 408 409 $plot->barShadow->setSize(2); 410 $plot->barShadow->setPosition(SHADOW_RIGHT_TOP); 411 $plot->barShadow->setColor(new Color(180, 180, 180, 10)); 412 $plot->barShadow->smooth(TRUE); 413 414 415 //legend 416 417 $group->legend->add($plot, $legend0, LEGEND_BACKGROUND); 418 419 $group->add($plot); 420 //google 421 422 423 $plot = new BarPlot($google,2,4); 424 425 426 $debut = new Color(0, 128, 0); 427 $fin = new Color(144, 238, 144); 428 429 430 $plot->setBarGradient( 431 new LinearGradient( 432 $debut, 433 $fin, 434 90 435 ) 436 ); 437 438 $plot->setXAxisZero(TRUE); 439 440 441 442 $plot->setSpace(2, 2, 20, 0); 443 444 $plot->barShadow->setSize(2); 445 $plot->barShadow->setPosition(SHADOW_RIGHT_TOP); 446 $plot->barShadow->setColor(new Color(180, 180, 180, 10)); 447 $plot->barShadow->smooth(TRUE); 448 449 450 //legend 451 452 $group->legend->add($plot, $legend1, LEGEND_BACKGROUND); 453 454 $group->add($plot); 455 456 457 //msn 458 459 460 $plot = new BarPlot($msn,3,4); 461 462 463 $debut = new Color(255, 0, 0); 464 $fin = new Color(255, 215, 0); 465 466 467 $plot->setBarGradient( 468 new LinearGradient( 469 $debut, 470 $fin, 471 90 472 ) 473 ); 474 475 476 $plot->setXAxisZero(TRUE); 477 478 479 480 $plot->setSpace(2, 2, 20, 0); 481 482 $plot->barShadow->setSize(2); 483 $plot->barShadow->setPosition(SHADOW_RIGHT_TOP); 484 $plot->barShadow->setColor(new Color(180, 180, 180, 10)); 485 $plot->barShadow->smooth(TRUE); 486 487 //legend 488 $group->legend->add($plot, $legend2, LEGEND_BACKGROUND); 489 if ($ttf=='ok') 490 { 491 $group->legend->setTextFont(new Tuffy(10)); 492 } 493 else 494 { 495 $group->legend->setTextFont(new Font(2)); 496 } 497 498 $group->add($plot); 499 500 501 502 //yahoo 503 504 505 $plot = new BarPlot($yahoo,4,4); 506 507 $debut = new Color(0, 51, 153); 508 $fin = new Color(0, 191, 255); 509 510 $plot->setBarGradient( 511 new LinearGradient( 512 $debut, 513 $fin, 514 90 515 ) 516 ); 517 518 $plot->setXAxisZero(TRUE); 519 520 521 $plot->setSpace(2, 2, 20, 0); 522 523 $plot->barShadow->setSize(2); 524 $plot->barShadow->setPosition(SHADOW_RIGHT_TOP); 525 $plot->barShadow->setColor(new Color(180, 180, 180, 10)); 526 $plot->barShadow->smooth(TRUE); 527 528 529 530 //legend 531 $group->legend->add($plot, $legend3, LEGEND_BACKGROUND); 532 533 $group->add($plot); 534 535 536 $group->legend->setBackgroundColor(new Color(255,255,255,0)); 537 $group->legend->setModel(LEGEND_MODEL_BOTTOM); 538 $group->legend->setPosition(NULL, 0.87); 539 540 } 541 //X axis label 542 $group->axis->bottom->setLabelText($axex); 543 if($period==2 OR ($period>=100 && $period<200)) 544 { 545 $group->axis->bottom->label->setAngle(45); 546 } 547 548 549 if ($ttf=='ok') 550 { 551 $group->axis->left->label->setFont(new Tuffy(8)); 552 $group->axis->bottom->label->setFont(new Tuffy(8)); 553 } 554 else 555 { 556 $group->axis->left->label->setFont(new Font(2)); 557 $group->axis->bottom->label->setFont(new Font(2)); 558 } 559 560 561 if ($ttf=='ok') 562 { 563 $group->axis->bottom->label->move(-10, 0); 564 } 565 else 566 { 567 $group->axis->bottom->label->move(20, 0); 568 } 569 570 571 $graph->add($group); 572 $graph->draw(); 573 574 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Sep 6 14:14:11 2007 | par Balluche grâce à PHPXref 0.7 |