Changeset 17758 for extensions/EStat/estat_ajax_export.php
- Timestamp:
- Sep 5, 2012, 4:15:54 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/EStat/estat_ajax_export.php
r17737 r17758 238 238 239 239 // prepare an EStat_IdList to buid a list of unique Id 240 $idList=new EStat_IdList(array('catId', 'imageId', 'tagsId', 'userId' , 'IPadress'));240 $idList=new EStat_IdList(array('catId', 'imageId', 'tagsId', 'userId')); 241 241 // $idAssoc will get the label associated to the id 242 242 $idAssoc=array( … … 244 244 'imageId'=>array(), 245 245 'tagsId'=>array(), 246 'userId'=>array(), 247 'IPadress'=>array() 246 'userId'=>array() 248 247 ); 249 248 … … 256 255 'imageId' => $row['imageId'], 257 256 'tagsId' => $row['tagsId'], 258 'userId' => $row['userId'], 259 'IPadress' => $row['IPadress'] 257 'userId' => $row['userId'] 260 258 ) 261 259 ); … … 274 272 if(count($idList->getItems('userId')) > 0) 275 273 $this->prepareIdList($idAssoc, 'userId', "SELECT id, username AS name FROM ".USERS_TABLE." WHERE id IN (".implode(',', $idList->getItems('userId')).") ORDER BY id;"); 276 277 // for reverse DNS278 if($this->config['logs.ipCountry']=='y')279 $this->getIpInfos($idAssoc, $idList->getItems('IPadress'));280 274 281 275 $data=array(); … … 283 277 foreach($result as $row) 284 278 { 285 $ipInfo=$this->getId($idAssoc, 'IPadress', $row['IPadress'], '?');286 287 279 $userAgentNfo=GPCUserAgent::getProperties( 288 280 array( … … 298 290 if($userAgentNfo[UA_DATA_OS_NAME]=='Unknown') $userAgentNfo[UA_DATA_OS_NAME]='ua_Unknown'; 299 291 300 $country=l10n('estat_country_'.strtoupper($ ipInfo['country']));292 $country=l10n('estat_country_'.strtoupper($row['country'])); 301 293 if(isset($lang[$country])) 302 294 { … … 314 306 'UserId' => $row['userId'], 315 307 'UserName' => $this->getId($idAssoc, 'userId', $row['userId'], '?', 'name'), 316 'countryId' => $ ipInfo['country'],308 'countryId' => $row['country'], 317 309 'country' => $country, 318 310 'catId' => $row['catId'], … … 345 337 $export->setOptions( 346 338 array( 347 'separator' => ';',348 'decimalDot' => ',',349 'useQuotes' => true,350 'lineFeed' => 'unix'339 'separator' => $this->config['export.csv.separator'], 340 'decimalDot' => $this->config['export.csv.decimalDot'], 341 'useQuotes' => ($this->config['export.csv.useQuotes']=='y')?true:false, 342 'lineFeed' => $this->config['export.csv.lineFeed'], 351 343 ) 352 344 ); … … 386 378 array( 387 379 'sheetName' => l10n('estat_history'), 388 'fileTitle' => '',380 'fileTitle' => $this->config['export.ods.fileTitle'], 389 381 'fileSubject' => sprintf(l10n('estat_fileODSSubject'), l10n('estat_history')), 390 'keywords' => '',382 'keywords' => $this->config['export.ods.keywords'], 391 383 'comments' => sprintf(l10n('estat_fileODSComments_1'), date('Y-m-d@H:i:s'), ESTAT_VERSION, PHPWG_VERSION) 392 384 ) … … 460 452 } 461 453 $export->setFileName($name.$extension); 462 $export->setFileDir( GPCCore::getPiwigoSystemPath().'/'.PWG_LOCAL_DIR.self::EXPORT_DIRECTORY);454 $export->setFileDir($this->fileExportDir); 463 455 464 456 if($export->write($data)) 465 457 { 466 $file= GPCCore::getPiwigoSystemPath().'/'.PWG_LOCAL_DIR.self::EXPORT_DIRECTORY.$export->getFileName();458 $file=$this->fileExportDir.$export->getFileName(); 467 459 468 460 if($compression!='none') … … 623 615 $export->setOptions( 624 616 array( 625 'separator' => ';',626 'decimalDot' => ',',627 'useQuotes' => true,628 'lineFeed' => 'unix'617 'separator' => $this->config['export.csv.separator'], 618 'decimalDot' => $this->config['export.csv.decimalDot'], 619 'useQuotes' => ($this->config['export.csv.useQuotes']=='y')?true:false, 620 'lineFeed' => $this->config['export.csv.lineFeed'], 629 621 ) 630 622 ); … … 646 638 array( 647 639 'sheetName' => l10n('estat_ipAdress'), 648 'fileTitle' => '',640 'fileTitle' => $this->config['export.ods.fileTitle'], 649 641 'fileSubject' => sprintf(l10n('estat_fileODSSubject'), l10n('estat_by_ip')), 650 'keywords' => '',642 'keywords' => $this->config['export.ods.keywords'], 651 643 'comments' => sprintf(l10n('estat_fileODSComments_1'), date('Y-m-d@H:i:s'), ESTAT_VERSION, PHPWG_VERSION) 652 644 ) … … 668 660 $export->setOptions( 669 661 array( 670 'tableName' => ' history'662 'tableName' => 'ipAdress' 671 663 ) 672 664 ); … … 684 676 } 685 677 $export->setFileName($name.$extension); 686 $export->setFileDir( GPCCore::getPiwigoSystemPath().'/'.PWG_LOCAL_DIR.self::EXPORT_DIRECTORY);678 $export->setFileDir($this->fileExportDir); 687 679 688 680 if($export->write($data)) 689 681 { 690 $file= GPCCore::getPiwigoSystemPath().'/'.PWG_LOCAL_DIR.self::EXPORT_DIRECTORY.$export->getFileName();682 $file=$this->fileExportDir.$export->getFileName(); 691 683 692 684 if($compression!='none') … … 852 844 $export->setOptions( 853 845 array( 854 'separator' => ';',855 'decimalDot' => ',',856 'useQuotes' => true,857 'lineFeed' => 'unix'846 'separator' => $this->config['export.csv.separator'], 847 'decimalDot' => $this->config['export.csv.decimalDot'], 848 'useQuotes' => ($this->config['export.csv.useQuotes']=='y')?true:false, 849 'lineFeed' => $this->config['export.csv.lineFeed'], 858 850 ) 859 851 ); … … 873 865 $export->setOptions( 874 866 array( 875 'sheetName' => l10n('estat_ ipAdress'),876 'fileTitle' => '',877 'fileSubject' => sprintf(l10n('estat_fileODSSubject'), l10n('estat_by_ ip')),878 'keywords' => '',867 'sheetName' => l10n('estat_category'), 868 'fileTitle' => $this->config['export.ods.fileTitle'], 869 'fileSubject' => sprintf(l10n('estat_fileODSSubject'), l10n('estat_by_category')), 870 'keywords' => $this->config['export.ods.keywords'], 879 871 'comments' => sprintf(l10n('estat_fileODSComments_1'), date('Y-m-d@H:i:s'), ESTAT_VERSION, PHPWG_VERSION) 880 872 ) … … 895 887 $export->setOptions( 896 888 array( 897 'tableName' => ' history'889 'tableName' => 'album' 898 890 ) 899 891 ); … … 910 902 } 911 903 $export->setFileName($name.$extension); 912 $export->setFileDir( GPCCore::getPiwigoSystemPath().'/'.PWG_LOCAL_DIR.self::EXPORT_DIRECTORY);904 $export->setFileDir($this->fileExportDir); 913 905 914 906 if($export->write($data)) 915 907 { 916 $file= GPCCore::getPiwigoSystemPath().'/'.PWG_LOCAL_DIR.self::EXPORT_DIRECTORY.$export->getFileName();908 $file=$this->fileExportDir.$export->getFileName(); 917 909 918 910 if($compression!='none') … … 1090 1082 $export->setOptions( 1091 1083 array( 1092 'separator' => ';',1093 'decimalDot' => ',',1094 'useQuotes' => true,1095 'lineFeed' => 'unix'1084 'separator' => $this->config['export.csv.separator'], 1085 'decimalDot' => $this->config['export.csv.decimalDot'], 1086 'useQuotes' => ($this->config['export.csv.useQuotes']=='y')?true:false, 1087 'lineFeed' => $this->config['export.csv.lineFeed'], 1096 1088 ) 1097 1089 ); … … 1113 1105 $export->setOptions( 1114 1106 array( 1115 'sheetName' => l10n('estat_i pAdress'),1116 'fileTitle' => '',1117 'fileSubject' => sprintf(l10n('estat_fileODSSubject'), l10n('estat_by_i p')),1118 'keywords' => '',1107 'sheetName' => l10n('estat_image'), 1108 'fileTitle' => $this->config['export.ods.fileTitle'], 1109 'fileSubject' => sprintf(l10n('estat_fileODSSubject'), l10n('estat_by_image')), 1110 'keywords' => $this->config['export.ods.keywords'], 1119 1111 'comments' => sprintf(l10n('estat_fileODSComments_1'), date('Y-m-d@H:i:s'), ESTAT_VERSION, PHPWG_VERSION) 1120 1112 ) … … 1137 1129 $export->setOptions( 1138 1130 array( 1139 'tableName' => ' history'1131 'tableName' => 'image' 1140 1132 ) 1141 1133 ); … … 1154 1146 } 1155 1147 $export->setFileName($name.$extension); 1156 $export->setFileDir( GPCCore::getPiwigoSystemPath().'/'.PWG_LOCAL_DIR.self::EXPORT_DIRECTORY);1148 $export->setFileDir($this->fileExportDir); 1157 1149 1158 1150 if($export->write($data)) 1159 1151 { 1160 $file= GPCCore::getPiwigoSystemPath().'/'.PWG_LOCAL_DIR.self::EXPORT_DIRECTORY.$export->getFileName();1152 $file=$this->fileExportDir.$export->getFileName(); 1161 1153 1162 1154 if($compression!='none') … … 1185 1177 private function ajax_estat_export_admin_loadFile($name, $deleteFile=true) 1186 1178 { 1187 $file= GPCCore::getPiwigoSystemPath().'/'.PWG_LOCAL_DIR.self::EXPORT_DIRECTORY.$name;1179 $file=$this->fileExportDir.$name; 1188 1180 if(!file_exists($file)) 1189 1181 do_error(404, "Requested file not readable - $name");
Note: See TracChangeset
for help on using the changeset viewer.