[ Index ]
 

Code source de phpMyVisites 2.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/core/include/ -> PdfConfigDb.class.php (source)

   1  <?php
   2  /* 

   3   * phpMyVisites : website statistics and audience measurements

   4   * Copyright (C) 2002 - 2006

   5   * http://www.phpmyvisites.net/ 

   6   * phpMyVisites is free software (license GNU/GPL)

   7   * Authors : phpMyVisites team

   8  */
   9  
  10  // $Id: PdfConfigDb.class.php 29 2006-08-18 07:35:21Z matthieu_ $

  11  
  12  require_once  INCLUDE_PATH."/core/include/PdfConfig.class.php";
  13  
  14  define("PDF_INDEX_KEY", 0);
  15  define("PDF_INDEX_ALL", 1);
  16  define("PDF_INDEX_INT", 2);
  17  define("PDF_INDEX_AUTRE", 3);
  18  define("PDF_KEY_FREE_PAGE", "PG8");
  19  
  20  
  21  define("PDF_FLD_PUBLIC", "public");
  22  define("PDF_FLD_PARAM", "param");
  23  
  24  class PdfConfigDb {
  25      var $siteId;
  26      var $lstPdf;
  27      var $cookie;
  28      var $isload = false;
  29  
  30  	function PdfConfigDb($idSite, $selectAll = false) 
  31      {
  32          $this->siteId = $idSite;
  33  
  34          $user =& User::getInstance();
  35          if (($selectAll) || ($user->suPermission)) {
  36              $q = "SELECT PDFSU.idsite, PDFC.idpdf, PDFC.name_pdf, PDFC.params_pdf, PDFSU.login "
  37                      ." FROM ".T_PDF_CONFIG." PDFC, ".T_PDF_SITE_USER." PDFSU "
  38                      ." WHERE (PDFSU.idsite = ".$this->siteId." OR PDFSU.idsite = 0)"
  39                      ." AND PDFSU.idpdf = PDFC.idpdf "
  40                      ." ORDER BY PDFSU.idsite, PDFC.name_pdf"
  41                      ;
  42          }
  43          else 
  44          {
  45              $q = "SELECT PDFSU.idsite, PDFC.idpdf, PDFC.name_pdf, PDFC.params_pdf, PDFSU.login "
  46                      ." FROM ".T_PDF_CONFIG." PDFC, ".T_PDF_SITE_USER." PDFSU "
  47                      ." WHERE (PDFSU.idsite = ".$this->siteId." OR PDFSU.idsite = 0) "
  48                      ." AND PDFSU.idpdf = PDFC.idpdf "
  49                      ." AND PDFSU.login = '".$user->getLogin()."' "
  50                      ." ORDER BY PDFSU.idsite, PDFC.name_pdf"
  51                      ;
  52          }
  53          
  54          $r = query($q);
  55          
  56          $this->lstPdf = array();
  57          if($r)
  58          {
  59              while($l = mysql_fetch_assoc($r))
  60              {
  61                  $tabParam = @unserialize(base64_decode($l['params_pdf']));
  62                  $isPublic = false;
  63                  if (is_array($tabParam)) {
  64                      if (isset($tabParam[PDF_FLD_PUBLIC])) {
  65                          $isPublic = $tabParam[PDF_FLD_PUBLIC];
  66                          $tabParam = $tabParam[PDF_FLD_PARAM];
  67                      }
  68                  }
  69                  $this->lstPdf[$l['idpdf']] = new PdfConfig($l['name_pdf'], $tabParam, $l['login'], $isPublic);
  70              }
  71          }
  72          $this->isload = true;
  73          /*

  74          foreach ($this->lstPdf as $key2 => $info2) {

  75              print("conf : ".$key2." : ".$info2->pdfName."<br>");

  76              

  77              foreach ($info2->pdfParam as $key => $info) {

  78                  print ("  conf : ".$key." : int : ".$info[PDF_INDEX_INT]." all : ".$info[PDF_INDEX_ALL]);

  79                  if (isset($info[PDF_INDEX_AUTRE])) {

  80                      print(", autre : ".$info[PDF_INDEX_AUTRE]);

  81                  }

  82                  print("<br>");

  83              }

  84          }

  85          */
  86  
  87      }
  88  	function addPdf($namePdf, $paramPdf, $isPublic = false) {
  89  //        $idPdf = count($this->lstPdf);

  90  //        $this->lstPdf[$idPdf] = new PdfConfig($namePdf, $paramPdf);

  91          
  92          $tabParam = array();
  93          $tabParam[PDF_FLD_PUBLIC] = $isPublic;
  94          $tabParam[PDF_FLD_PARAM] = $paramPdf;
  95          $content = serialize($tabParam);
  96          $content = base64_encode ($content);
  97          
  98          // Insert PDF

  99          $r = query("INSERT 
 100                      INTO ".T_PDF_CONFIG."    (name_pdf, params_pdf) 
 101                      VALUES ('$namePdf', '$content')
 102                      ");
 103          //Get id of pdf

 104          $r = query("SELECT idpdf FROM ".T_PDF_CONFIG."
 105                      ORDER BY idpdf DESC
 106                      ");
 107          if ($l = mysql_fetch_assoc($r)) {
 108              $idPdf = $l['idpdf'];
 109              $user =& User::getInstance();
 110              if ($user->suPermission) {
 111                  $login = PDF_LOGIN_ADMIN;
 112              }
 113              else {
 114                  $login = $user->getLogin();
 115              }
 116              // Insert link

 117              if ($isPublic)
 118              {
 119                  $r = query("INSERT 
 120                              INTO ".T_PDF_SITE_USER."    (idsite, idpdf, login) 
 121                              VALUES (0, $idPdf, '$login')
 122                              ");
 123              }
 124              else
 125              {
 126                  $r = query("INSERT 
 127                              INTO ".T_PDF_SITE_USER."    (idsite, idpdf, login) 
 128                              VALUES (".$this->siteId.", $idPdf, '$login')
 129                              ");
 130              }
 131          }
 132      }
 133      
 134  	function updatePdf($idPdf, $namePdf, $paramPdf, $isPublic = false) {
 135  //        $this->lstPdf[$idPdf]->pdfName = $namePdf;

 136  //        $this->lstPdf[$idPdf]->pdfParam = $paramPdf;

 137          
 138          $tabParam = array();
 139          $tabParam[PDF_FLD_PUBLIC] = $isPublic;
 140          $tabParam[PDF_FLD_PARAM] = $paramPdf;
 141          $content = serialize($tabParam);
 142          $content = base64_encode ($content);
 143          $r = query("UPDATE ".T_PDF_CONFIG."
 144                      SET name_pdf = '$namePdf', params_pdf='$content'
 145                      WHERE idpdf = $idPdf
 146                      ");
 147  
 148          $user =& User::getInstance();
 149          if ($user->suPermission) {
 150              $login = PDF_LOGIN_ADMIN;
 151          }
 152          else {
 153              $login = $user->getLogin();
 154          }
 155  
 156          if ($isPublic)
 157          {
 158              $r = query("UPDATE ".T_PDF_SITE_USER." set login='$login', idsite = 0" .
 159                      " WHERE idpdf = $idPdf");
 160          }
 161          else
 162          {
 163              $r = query("UPDATE ".T_PDF_SITE_USER." set login='$login', idsite=".$this->siteId .
 164                      " WHERE idpdf = $idPdf");
 165          }
 166      }
 167      
 168  	function deletePdf($idPdf) {
 169          if (isset ($this->lstPdf[$idPdf])) {
 170              unset ($this->lstPdf[$idPdf]);
 171              // Delete all link to this pdf

 172              $r = query("DELETE 
 173                      FROM ".T_PDF_SITE_USER."
 174                      WHERE idpdf = $idPdf
 175                      ");
 176              // Delete config

 177              $r = query("DELETE 
 178                      FROM ".T_PDF_CONFIG."
 179                      WHERE idpdf = $idPdf
 180                      ");
 181  
 182          }
 183      }
 184  	function getPdf($idPdf) {
 185          if (! isset ($this->lstPdf[$idPdf])) {
 186              $this->lstPdf[$idPdf] = new PdfConfig($GLOBALS['lang']['admin_get_default_pdfdefault'], $this->getDefaultPdf(), PDF_LOGIN_ADMIN);
 187          }
 188          $ret = $this->lstPdf[$idPdf];
 189          return $ret;
 190      }
 191  
 192  	function getListPdf() {
 193          return $this->lstPdf;
 194      }
 195      
 196      
 197  	function getChoixPdf() {
 198          return $this->listChapter;
 199      }
 200      
 201  	function getDefaultPdf() {
 202          return $this->defaultSelectChapter;
 203      }
 204  
 205  // TIT : Chapter title

 206  // FCT : Function name

 207  // INT : Has interest bloc

 208  // ALL : Can show all data

 209  
 210  var $listChapter = array (
 211          "PG0" => array (
 212              "TIT" => "summary_title",
 213              "PAG" => "true"),
 214          "SUM" => array (
 215              "TIT"  => "pdf_page_summary",
 216              "FCT" => "setPageSummary",
 217              "INT"  => "false",
 218              "ALL"  => "false"),
 219          "PG1" => array (
 220              "TIT" => "visites_titre",
 221              "PAG" => "true"),
 222          "VS1" => array (
 223              "TIT"  => "visites_statistiques",
 224              "FCT" => "setVisitsStatistics",
 225              "INT"  => "false",
 226              "ALL"  => "false"),
 227          "VS2" => array (
 228              "TIT"  => "visites_recapperiode",
 229              "FCT" => "setVisitsPeriodSummaries",
 230              "INT"  => "false",
 231              "ALL"  => "false"),
 232          "VS3" => array (
 233              "TIT"  => "visites_grapghrecap",
 234              "FCT" => "setVisitsPeriodSummariesGraph",
 235              "INT"  => "false",
 236              "ALL"  => "false"),
 237          "VS4" => array (
 238              "TIT"  => "visites_grapghrecaplongterm",
 239              "FCT" => "setVisitsAllPeriodSummaryGraph",
 240              "INT"  => "false",
 241              "ALL"  => "false"),
 242          "VS5" => array (
 243              "TIT"  => "visites_graphtempsvisites",
 244              "FCT" => "setVisitsTimeVisitsGraph",
 245              "INT"  => "false",
 246              "ALL"  => "false"),
 247          "VS6" => array (
 248              "TIT"  => "visites_graphheureserveur",
 249              "FCT" => "setVisitsServerTimeGraph",
 250              "INT"  => "false",
 251              "ALL"  => "false"),
 252          "VS7" => array (
 253              "TIT"  => "visites_graphheurevisiteur",
 254              "FCT" => "setVisitsLocalTimeGraph",
 255              "INT"  => "false",
 256              "ALL"  => "false"),
 257          "PG2" => array (
 258              "TIT" => "frequence_titre",
 259              "PAG" => "true"),
 260          "FQ1" => array (
 261              "TIT"  => "visites_statistiques",
 262              "FCT" => "setFrequencyStatistics",
 263              "INT"  => "false",
 264              "ALL"  => "false"),
 265          "FQ2" => array (
 266              "TIT"  => "frequence_nouveauxconnus",
 267              "FCT" => "setFrequencyNewReturnVisits",
 268              "INT"  => "false",
 269              "ALL"  => "false"),
 270          "FQ3" => array (
 271              "TIT"  => "frequence_nouveauxconnusgraph",
 272              "FCT" => "setFrequencyGraphNewReturnVisits",
 273              "INT"  => "false",
 274              "ALL"  => "false"),
 275          "FQ4" => array (
 276              "TIT"  => "pagesvues_vispervisgraph",
 277              "FCT" => "setFrequencyGraphNbVisitsPerVisitor",
 278              "INT"  => "false",
 279              "ALL"  => "false"),
 280          "PG3" => array (
 281              "TIT" => "pagesvues_titre",
 282              "PAG" => "true"),
 283          "PZ1" => array (
 284              "TIT"  => "pagesvues_titre",
 285              "FCT" => "setPagesZoomTab1",
 286              "INT"  => "false",
 287              "ALL"  => "false"),
 288          "PZ2" => array (
 289              "TIT"  => "pagesvues_pagesvues",
 290              "FCT" => "setPagesZoomTab2",
 291              "INT"  => "false",
 292              "ALL"  => "true"),
 293          "PZ3" => array (
 294              "TIT"  => "pagesvues_tempsparpage",
 295              "FCT" => "setPagesZoomTpsParPage",
 296              "INT"  => "false",
 297              "ALL"  => "true"),
 298          "PZ4" => array (
 299              "TIT"  => "pagesvues_graphsnbpages",
 300              "FCT" => "setPagesByVisitGraph",
 301              "INT"  => "false",
 302              "ALL"  => "false"),
 303          "PG4" => array (
 304              "TIT" => "suivi_titre",
 305              "PAG" => "true"),
 306          "FW1" => array (
 307              "TIT"  => "suivi_pageentree",
 308              "FCT" => "setFollowUpEntryPages",
 309              "INT"  => "false",
 310              "ALL"  => "true"),
 311          "FW2" => array (
 312              "TIT"  => "suivi_pagesortie",
 313              "FCT" => "setFollowUpExitPages",
 314              "INT"  => "false",
 315              "ALL"  => "true"),
 316          "FW3" => array (
 317              "TIT"  => "suivi_singlepage",
 318              "FCT" => "setFollowUpSinglePages",
 319              "INT"  => "false",
 320              "ALL"  => "true"),
 321          "PG5" => array (
 322              "TIT" => "provenance_titre",
 323              "PAG" => "true"),
 324          "SR1" => array (
 325              "TIT" => "provenance_mappemonde",
 326              "FCT" => "setWorldMap",
 327              "INT" => "false",
 328              "ALL" => "false",
 329              "PAR1" => "cont"),
 330          "SR2" => array (
 331              "TIT" => "provenance_recappays",
 332              "FCT" => "setSourceCountry",
 333              "INT" => "true",
 334              "ALL" => "true"),
 335          "SR3" => array (
 336              "TIT" => "provenance_fai",
 337              "FCT" => "setSourceProviders",
 338              "INT" => "false",
 339              "ALL" => "true"),
 340          "PG6" => array (
 341              "TIT" => "configurations_titre",
 342              "PAG" => "true"),
 343          "ST1" => array (
 344              "TIT" => "configurations_configurations",
 345              "FCT" => "setSettingsConfig",
 346              "INT" => "false",
 347              "ALL" => "true"),
 348          "ST2" => array (
 349              "TIT" => "configurations_os",
 350              "FCT" => "setSettingsOs",
 351              "INT" => "true",
 352              "ALL" => "true"),
 353          "ST3" => array (
 354              "TIT" => "configurations_navigateursbytype",
 355              "FCT" => "setSettingsBrowsersType",
 356              "INT" => "false",
 357              "ALL" => "false"),
 358          "ST4" => array (
 359              "TIT" => "configurations_navigateurs",
 360              "FCT" => "setSettingsBrowsersInterest",
 361              "INT" => "true",
 362              "ALL" => "true"),
 363          "ST5" => array (
 364              "TIT" => "configurations_plugins",
 365              "FCT" => "setSettingsPlugins",
 366              "INT" => "false",
 367              "ALL" => "false"),
 368          "ST6" => array (
 369              "TIT" => "configurations_resolutions",
 370              "FCT" => "setSettingsResolutionsInterest",
 371              "INT" => "true",
 372              "ALL" => "true"),
 373          "ST7" => array (
 374              "TIT" => "configurations_rapport",
 375              "FCT" => "setSettingsNormalWidescreen",
 376              "INT" => "false",
 377              "ALL" => "false"),
 378          "PG7" => array (
 379              "TIT" => "affluents_titre",
 380              "PAG" => "true"),
 381          "RF1" => array (
 382              "TIT" => "affluents_recapimg",
 383              "FCT" => "setReferersTypeInterest",
 384              "INT" => "true",
 385              "ALL" => "false"),
 386          "RF2" => array (
 387              "TIT" => "affluents_moteurs",
 388              "FCT" => "setReferersSearchEnginesInterest",
 389              "INT" => "true",
 390              "ALL" => "true"),
 391          "RF3" => array (
 392              "TIT" => "affluents_motscles",
 393              "FCT" => "setReferersKeywordsInterest",
 394              "INT" => "true",
 395              "ALL" => "true"),
 396          "RF4" => array (
 397              "TIT" => "affluents_sitesinternet",
 398              "FCT" => "setReferersSitesInterest",
 399              "INT" => "true",
 400              "ALL" => "true"),
 401          "RF5" => array (
 402              "TIT" => "affluents_partenaires",
 403              "FCT" => "setReferersPartnersInterest",
 404              "INT" => "true",
 405              "ALL" => "true"),
 406          "RF6" => array (
 407              "TIT" => "affluents_newsletters",
 408              "FCT" => "setReferersNewslettersInterest",
 409              "INT" => "true",
 410              "ALL" => "true"),
 411          "RF7" => array (
 412              "TIT" => "affluents_entreedirecte",
 413              "FCT" => "setReferersDirect",
 414              "INT" => "false",
 415              "ALL" => "false"),
 416          "PG8" => array (  //PDF_KEY_FREE_PAGE
 417              "TIT" => "pdf_free_page",
 418              "PAG" => "true",
 419              "PAR1" => "txt"),
 420          "SP1" => array (
 421              "TIT" => "pdf_free_chapter",
 422              "FCT" => "setPersonalChapter",
 423              "INT" => "false",
 424              "ALL" => "false",
 425              "PAR1" => "txt"),
 426          "SP2" => array (
 427              "TIT" => "pdf_page_break",
 428              "FCT" => "setPageBreak",
 429              "INT" => "false",
 430              "ALL" => "false")
 431          );
 432  
 433  var $defaultSelectChapter = array (
 434          array ("PG0", "false","false"),
 435          array ("SUM", "false","false"),
 436          
 437          array ("PG1", "false","false"),
 438          array ("VS1", "false","false"),
 439          array ("VS2", "false","false"),
 440          array ("VS3", "false","false"),
 441          array ("VS4", "false","false"),
 442          array ("VS5", "false","false"),
 443          array ("VS6", "false","false"),
 444          array ("VS7", "false","false"),
 445          
 446          array ("PG2", "false","false"),
 447          array ("FQ1", "false","false"),
 448          array ("FQ2", "false","false"),
 449          array ("FQ3", "false","false"),
 450          array ("FQ4", "false","false"),
 451          
 452          array ("PG3", "false","false"),
 453          array ("PZ1", "false","false"),
 454          array ("PZ2", "false","false"),
 455          array ("PZ3", "false","false"),
 456          array ("PZ4", "false","false"),
 457          
 458          array ("PG4", "false","false"),
 459          array ("FW1", "false","false"),
 460          array ("FW2", "false","false"),
 461          array ("FW3", "false","false"),
 462          
 463          array ("PG5", "false","false"),
 464          array ("SR1", "false","false"),
 465          array ("SR2", "false","true"),
 466          array ("SR3", "false","false"),
 467          
 468          array ("PG6", "false","false"),
 469          array ("ST1", "false","false"),
 470          array ("ST2", "false","true"),
 471          array ("ST3", "false","false"),
 472          array ("ST4", "false","true"),
 473          array ("ST5", "false","false"),
 474          array ("ST6", "false","true"),
 475          array ("ST7", "false","false"),
 476          
 477          array ("PG7", "false","false"),
 478          array ("RF1", "false","true"),
 479          array ("RF2", "false","true"),
 480          array ("RF3", "false","true"),
 481          array ("RF4", "false","true"),
 482          array ("RF5", "false","true"),
 483          array ("RF6", "false","true"),
 484          array ("RF7", "false","false")
 485          );    
 486  
 487          
 488  }
 489  ?>


Généré le : Mon Nov 26 14:10:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics