├── .gitignore ├── LICENSE ├── README.md ├── tools ├── misc │ ├── create_version.pl │ └── extract_metadata.pl └── uploads │ ├── html │ ├── index.php │ ├── rescan.php │ ├── showdata.php │ ├── uploadfiles.php │ └── uploadrequest.php │ └── scan_hw_upload.pl ├── wp-admin ├── admin-ajax.php ├── includes │ └── template.php ├── menu.php └── user-edit.php ├── wp-content ├── plugins │ ├── add-local-avatar │ │ └── avatars.php │ ├── comment-attachment │ │ └── comment-attachment-init.php │ ├── cubepoints │ │ ├── cp_lhg_widgets.php │ │ └── cubepoints.php │ ├── daves-wordpress-live-search │ │ ├── DavesWordPressLiveSearch.php │ │ └── DavesWordPressLiveSearchResults.php │ ├── lhg-hardware-profile-manager │ │ ├── images │ │ │ ├── Manjaro-logo.png │ │ │ ├── OpenSUSE_Logo.png │ │ │ ├── aldos-logo.png │ │ │ ├── alt-linux-logo.png │ │ │ ├── antergos-logo.png │ │ │ ├── arch-linux-logo.png │ │ │ ├── black-panther-logo.png │ │ │ ├── bodhi-logo.png │ │ │ ├── bunsenlabs-logo.png │ │ │ ├── centos-logo.png │ │ │ ├── chakra-logo.png │ │ │ ├── debian-logo.jpg │ │ │ ├── devuan-logo.png │ │ │ ├── elementary-os-logo.png │ │ │ ├── fedora-logo.jpg │ │ │ ├── funtoo-logo.png │ │ │ ├── gentoo-logo.png │ │ │ ├── handylinux-logo.png │ │ │ ├── kalilinux-logo.png │ │ │ ├── kde-neon-logo.png │ │ │ ├── korora-logo.jpg │ │ │ ├── linux-from-scratch-logo.png │ │ │ ├── linuxmint-logo.png │ │ │ ├── mageia-logo.png │ │ │ ├── mx-linux-logo.png │ │ │ ├── netrunner-logo.png │ │ │ ├── parabola-logo.png │ │ │ ├── pclinuxos-logo.png │ │ │ ├── pisi-linux-logo.png │ │ │ ├── point-linux-logo.png │ │ │ ├── raspbian-logo.png │ │ │ ├── simply-linux-logo.png │ │ │ ├── slackware-logo.png │ │ │ ├── solyd-xk-logo.png │ │ │ ├── tanglu-logo.png │ │ │ ├── ubuntu-logo.png │ │ │ ├── ultimate-edition-logo.png │ │ │ ├── unknown-logo.jpg │ │ │ ├── unknown-logo.png │ │ │ └── zorin-logo.png │ │ ├── lhg-hardware-profile-manager.php │ │ ├── lhg-scanresults-jquery.php │ │ ├── lhg-scanresults.php │ │ └── templates │ │ │ ├── request-management-link.php │ │ │ ├── scan.php │ │ │ ├── uid.php │ │ │ ├── user.php │ │ │ └── user_public.php │ ├── lhg-pricedb │ │ ├── backend │ │ │ ├── html │ │ │ │ └── lhgupdatedb.php │ │ │ └── includes │ │ │ │ ├── amazon_price.pl │ │ │ │ └── amazon_search.pl │ │ ├── css │ │ │ ├── backend.css │ │ │ ├── lhg_widget_article_summary.css │ │ │ └── lhg_widget_article_summary_admin.css │ │ ├── images │ │ │ └── lhg_logo_16x16.png │ │ ├── includes │ │ │ ├── lhg.conf.example │ │ │ ├── lhg_ajax_routines.php │ │ │ ├── lhg_auto_finder.php │ │ │ ├── lhg_autocreate.php │ │ │ ├── lhg_chat.php │ │ │ ├── lhg_donations.php │ │ │ ├── lhg_json.php │ │ │ ├── lhg_menu_tags.php │ │ │ ├── lhg_post_history.php │ │ │ ├── lhg_pricedb_functions.php │ │ │ ├── lhg_pricedb_update.php │ │ │ ├── lhg_sanity_checks.php │ │ │ ├── lhg_scan_overview.php │ │ │ ├── lhg_shop_button.php │ │ │ ├── lhg_shortcodes.php │ │ │ ├── lhg_user_hardware.php │ │ │ ├── lhg_user_management.php │ │ │ ├── lhg_user_management_authorship.php │ │ │ ├── lhg_widget_article_summary.php │ │ │ ├── lhg_widget_featured_article.php │ │ │ └── lhg_widget_supplier_overview.php │ │ └── lhg-pricedb.php │ ├── lhg-product-post │ │ ├── inc │ │ │ ├── amazon-product-in-a-post-options.php │ │ │ └── amazon-product-in-a-post-tools.php │ │ └── lhg-product-post.php │ ├── pie-highchart-jquery │ │ └── insert-it-at-head.php │ ├── related-posts-thumbnails │ │ └── related-posts-thumbnails.php │ ├── syntaxhighlighter │ │ └── syntaxhighlighter3 │ │ │ └── styles │ │ │ └── shCore.css │ ├── user-avatar │ │ └── user-avatar-pic.php │ ├── vb-wp-move-comments │ │ └── vb-wp-move-comments.php │ ├── wordpress-popular-posts │ │ └── wordpress-popular-posts.php │ ├── wp-postratings │ │ └── wp-postratings.php │ └── wpsmart-mobile │ │ └── wpsmart.php └── themes │ └── blue-and-grey │ ├── footer.php │ ├── functions.php │ ├── header.php │ ├── lhg_currency_functions.php │ ├── lhg_functions.php │ ├── single.php │ └── style.css └── wp-includes ├── comment-template.php ├── default-widgets.php └── link-template.php /.gitignore: -------------------------------------------------------------------------------- 1 | lhg.conf 2 | *~ 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # linuxhardwareguide 2 | 3 | Collects the source code of the Linux Hardware Guide web pages (http://www.linux-hardware-guide.com) and related tools. 4 | 5 | ## LHG PriceDB: `wp-content/plugins/lhg-pricedb/` 6 | Collection of LHG specific routines. Visualization of hardware uploads, communication with price database (priceDB), automatic creation of articles out of uploaded raw hardware data, and several modifications of the backend's appearance. 7 | 8 | ## LHG Manage Hardware Profile: `wp-content/plugins/lhg-hardware-profile-manager` 9 | Plugin for user management of hardware profiles. Visualization of registered hardware components, importing of uploaded hardware data to the database. This plugin's origin is the "Subscribe to comments reloaded" plugin (http://wordpress.org/plugins/subscribe-to-comments-reloaded/). 10 | 11 | ## LHG Blue and Grey Theme: `wp-content/themes/blue-and-grey/` 12 | We use a adapted version of the "Blue and Grey" theme (https://wordpress.org/themes/blue-and-grey/), e.g. modified to support with variable site width and multilanguage support 13 | -------------------------------------------------------------------------------- /tools/misc/create_version.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # Creates version number from latest code release and makes it public 4 | 5 | my $git_commit_nr = `cd ~/git/linuxhardwareguide/ && git describe --tags --long`; 6 | 7 | 8 | 9 | my $file="/var/www/wordpress/version.php"; 10 | open(my $fh, '>', $file) or die "Could not open file '$filename' $!"; 11 | print $fh "\n"; 15 | close $fh; 16 | 17 | exit 0; 18 | 19 | sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s }; 20 | -------------------------------------------------------------------------------- /tools/misc/extract_metadata.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # Scan through all posts and find metadata needed for hardware recognition 4 | # implemented functions: 5 | # - extract subsystem ID from articles 6 | 7 | no warnings experimental::smartmatch; 8 | 9 | $option = $ARGV[0]; 10 | 11 | 12 | use DBI; 13 | 14 | our $host = "192.168.56.14"; 15 | # choose correct sql address 16 | use Net::Address::IP::Local; 17 | my $address = Net::Address::IP::Local->public; 18 | if ($address eq "192.168.3.115") { 19 | print "On Test Server \n"; 20 | $host = "192.168.3.114"; 21 | } 22 | 23 | our $database = "DBI:mysql:lhgpricedb;host=$host"; 24 | require ("/var/www/uploads/lhg.conf"); 25 | #our $user = "USERNAME"; 26 | #our $pw = "PASSWORD"; 27 | 28 | 29 | # get list of all published posts 30 | $lhg_db = DBI->connect($database, $user, $pw); 31 | $myquery = "SELECT * FROM `lhgtransverse_posts` WHERE ( (status_com = 'published') OR (status_com = '') ) ORDER BY postid_com DESC"; 32 | $sth_glob = $lhg_db->prepare($myquery); 33 | $sth_glob->execute(); 34 | #($num) = $sth_glob->fetchrow(); 35 | 36 | # single Postid update 37 | if ($option =~ "-p") { 38 | $postid = $ARGV[1]; 39 | print "Updating postid: $postid\n"; 40 | if ($postid == "") { 41 | exit; 42 | }else{ 43 | $lhg_db = DBI->connect($database, $user, $pw); 44 | $myquery = "SELECT * FROM `lhgtransverse_posts` WHERE ( ( (status_com = 'published') OR (status_com = '') ) AND postid_com = ? ) "; 45 | $sth_glob = $lhg_db->prepare($myquery ); 46 | $sth_glob->execute( $postid ); 47 | } 48 | } 49 | 50 | #my @row; 51 | while ($row = $sth_glob->fetchrow_hashref) { # retrieve one row 52 | #print join(", ", @row), "\n"; 53 | 54 | $content = $row-> { postcontent_com }; 55 | $pid = $row-> { postid_com }; 56 | $id = $row-> { id }; 57 | $product = $row-> { product }; 58 | #@db_pciids = split(",",$row-> { pciids }); 59 | $db_pciids = $row-> { pciids }; 60 | print $row-> { id }."/".$pid.": ".$product."\n"; 61 | 62 | #get arrays of pciids and corresponding subsystem ids 63 | $pciarray_ref = ""; 64 | $subsystemidarray_ref = ""; 65 | ($pciarray_ref, $subsystemidarray_ref) = parse_content_for_subsystem_id($content); 66 | 67 | #create list corresponding to database PCI IDs 68 | $subsystemids = create_subsystem_list($db_pciids, $pciarray_ref, $subsystemidarray_ref); 69 | 70 | #print " PCI: $db_pciids \n"; 71 | #print " Sub: $subsystemids \n"; 72 | #print " ----- \n"; 73 | 74 | # for debug usage: 75 | # print PCI IDs and Subsystem IDs in table formatting 76 | #niceprint($db_pciids, $subsystemids); 77 | 78 | #store to DB if not empty 79 | if ( ($subsystemids =~ /[a-f]/) or ($subsystemids =~ /[0-9]/) ){ 80 | store_to_db( $subsystemids, $id); 81 | } 82 | 83 | # Debug counter 84 | $i++; 85 | 86 | if ($option ne "-a") { 87 | # check/update only 50 latest articles 88 | if ($i > 50) { 89 | exit 0; 90 | } 91 | } 92 | } 93 | 94 | exit 0; 95 | 96 | sub parse_content_for_subsystem_id { 97 | my $_content = shift; 98 | 99 | my $_lastline = ""; 100 | my $pciid = ""; 101 | my @text = split(/\n/, $_content); 102 | my @pciid_array = qw(); 103 | my @subsystemid_array = qw(); 104 | 105 | #print "Text: $_content $text[3]\n"; 106 | 107 | foreach( @text) { 108 | #check for subsystem line 109 | #print $_; 110 | 111 | if ($_ =~ m/Subsystem:/) { 112 | 113 | $pciline = $_lastline; 114 | $pciline =~ m/\w\w\w\w:\w\w\w\w/; 115 | 116 | if ($-[0]>1) { 117 | 118 | $pciid = substr($pciline,$-[0],9); 119 | #print " PCIID at $-[0] : $pciid\n"; 120 | 121 | }else{ 122 | # check one line more (e.g. if DeviceName was printed) 123 | #print " second try\n"; 124 | $pciline = $_lastline2; 125 | $pciline =~ m/\w\w\w\w:\w\w\w\w/; 126 | 127 | if ($-[0]>1) { 128 | $pciid = substr($pciline,$-[0],9); 129 | #print " PCIID at $-[0] try2 : $pciid\n"; 130 | 131 | }else{ 132 | #print " No PCIID found\n"; 133 | } 134 | } 135 | 136 | $subsystemline = $_; 137 | $subsystemline =~ m/\w\w\w\w:\w\w\w\w/; 138 | $subsystemid = substr($subsystemline,$-[0],9); 139 | #print " SID: $subsystemid\n"; 140 | #print " PID: $pciid\n"; 141 | #\n----\n"; 142 | 143 | # write both IDs to array 144 | push ( @pciid_array, $pciid); 145 | push ( @subsystemid_array, $subsystemid); 146 | 147 | #print "Found: $pciid--$subsystemid\n"; 148 | 149 | 150 | } 151 | $_lastline2 = $_lastline; 152 | $_lastline = $_; 153 | $pciid = ""; 154 | $subsystemid = ""; 155 | } 156 | 157 | #return the references to these arrays 158 | return (\@pciid_array, \@subsystemid_array); 159 | } 160 | 161 | sub create_subsystem_list { 162 | # retrieves comma separated list of pciids 163 | # creates corresponding list of subsystem ids 164 | 165 | my $_db_pcis = shift; 166 | my $pciid_array_ref = shift; 167 | my $subid_array_ref = shift; 168 | 169 | # return list of subsystem ids, comma separated 170 | $returnlist = ""; 171 | 172 | @pciids = @$pciid_array_ref; 173 | @subids = @$subid_array_ref; 174 | 175 | $num = scalar @pciids; 176 | 177 | @db_pciids = split(/,/,$_db_pcis); 178 | 179 | foreach( @db_pciids ) { 180 | # cycle through all PCIIDs stored in the data base 181 | #print "Search $_ > "; 182 | 183 | $index = search_in_array($_, \@pciids); 184 | #my $match = first_index { /$_/ } @pciids; 185 | #print "Match id: ".$index." = ".@pciids[$index]."\n"; 186 | if ($index eq "") { 187 | #no matching index found 188 | $returnlist .="," ; 189 | }else{ 190 | $returnlist .= @subids[$index].","; 191 | } 192 | } 193 | 194 | #remove tailing comma 195 | return substr($returnlist,0,-1); 196 | } 197 | 198 | sub search_in_array { 199 | my $_searchfor = shift; 200 | my $_pciids_ref = shift; 201 | @_pciids = @$_pciids_ref; 202 | 203 | 204 | my $_num = scalar @_pciids; 205 | #print "NUM2! $_num -- "; 206 | 207 | # return the index where the given string was found in the array 208 | for (my $i=0; $i< $_num ; $i++) { 209 | if( $_searchfor eq @_pciids[$i]) { 210 | return $i; 211 | } 212 | } 213 | return ""; 214 | } 215 | 216 | 217 | sub niceprint { 218 | my $a = shift; 219 | my $b = shift; 220 | @_a = split(/,/,$a); 221 | @_b = split(/,/,$b); 222 | 223 | for (my $i=0; $i< scalar @_a ; $i++) { 224 | print "$i: @_a[$i] -> @_b[$i] \n"; 225 | 226 | } 227 | } 228 | 229 | sub store_to_db { 230 | my $string = shift; 231 | my $id = shift; 232 | 233 | $lhg_db = DBI->connect($database, $user, $pw); 234 | my $myquery_upd = "UPDATE `lhgtransverse_posts` SET subids = ? WHERE id = ?"; 235 | my $sth_glob_upd = $lhg_db->prepare($myquery_upd); 236 | $sth_glob_upd->execute($string, $id); 237 | 238 | } 239 | 240 | -------------------------------------------------------------------------------- /tools/uploads/html/index.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/tools/uploads/html/index.php -------------------------------------------------------------------------------- /tools/uploads/html/rescan.php: -------------------------------------------------------------------------------- 1 | "; 21 | echo "(short: ".substr($ref,0,21)."
"; 22 | 23 | if ( (substr($ref,0,21) == "http://192.168.3.113/") or 24 | (substr($ref,0,21) == "http://192.168.56.13/") or 25 | (substr($ref,0,21) == "http://www.linux-hard") ) 26 | { 27 | 28 | print "executing rescan
"; 29 | $out = shell_exec('cd /var/www/uploads/ && ./scan_hw_upload.pl '.$sid.' -r'); 30 | print "OUT:
 $out 
"; 31 | if ( strpos( $ref, "/scan-") > 0 ) { 32 | print 'back to HW overview
'; 33 | } else { 34 | print 'back to HW overview
'; 35 | } 36 | } 37 | 38 | 39 | ?> 40 | -------------------------------------------------------------------------------- /tools/uploads/html/showdata.php: -------------------------------------------------------------------------------- 1 | 22 | -------------------------------------------------------------------------------- /tools/uploads/html/uploadfiles.php: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | '; 31 | 32 | exit; 33 | } 34 | 35 | //otherwise check uploaded files 36 | 37 | # v0.2 38 | 39 | #echo "Files received\n"; 40 | 41 | $allfiles = array("alsa_cards.txt","alsa_devices.txt","aplay.txt","cpuinfo.txt", 42 | "dd.err.txt","dd.txt","dmesg.txt","lsb_release.txt","lspci.txt", 43 | "lsusb.txt","lsusb_v.err.txt","lsusb_v.txt","scanimage.txt", 44 | "version.txt","hdparm.txt","hdparm_direct.txt"); 45 | 46 | 47 | # 1. check if we received the right files 48 | $i=0; 49 | foreach ($allfiles as &$value) { 50 | $i++; 51 | #echo "Checking $i \n"; 52 | if ($value == $_FILES["file".$i]["name"]) 53 | { 54 | #echo "File $i ($value) correct \n"; 55 | }else{ 56 | echo "unknown files\n"; 57 | exit; 58 | } 59 | } 60 | 61 | 62 | # 2. move files 63 | $sid = $_GET['SID']; 64 | $i=0; 65 | foreach ($allfiles as &$value) { 66 | $i++; 67 | 68 | if ( $_FILES["file".$i]["error"] == UPLOAD_ERR_OK) { 69 | $tmp_name = $_FILES["file".$i]["tmp_name"]; 70 | $name = $_FILES["file".$i]["name"]; 71 | move_uploaded_file($tmp_name, "/var/www/uploads/".$sid."/".$name); 72 | }else{ 73 | echo "File broken\n"; 74 | exit; 75 | } 76 | } 77 | 78 | echo "All files uploaded"; 79 | 80 | # All files received. start scanning 81 | shell_exec('/var/www/uploads/scan_hw_upload.pl $sid'); 82 | 83 | 84 | exit; 85 | 86 | function check_sid(){ 87 | #check if SID exists 88 | # ToDo: more intelligent check. E.g., if corresponding directory exists 89 | $sid = $_GET['SID']; 90 | 91 | if ($sid == "") { 92 | echo "unknown request. Ignoring"; 93 | exit; 94 | } 95 | 96 | } 97 | 98 | 99 | ?> 100 | -------------------------------------------------------------------------------- /tools/uploads/html/uploadrequest.php: -------------------------------------------------------------------------------- 1 | 27 | -------------------------------------------------------------------------------- /wp-admin/menu.php: -------------------------------------------------------------------------------- 1 | " . number_format_i18n($update_data['counts']['total']) . "" ), 'update_core', 'update-core.php'); 38 | } 39 | 40 | $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' ); 41 | 42 | $menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'div' ); 43 | $submenu['edit.php'][5] = array( __('All Posts'), 'edit_posts', 'edit.php' ); 44 | /* translators: add new post */ 45 | $submenu['edit.php'][10] = array( _x('Add New', 'post'), 'edit_posts', 'post-new.php' ); 46 | 47 | $i = 15; 48 | foreach ( get_taxonomies( array(), 'objects' ) as $tax ) { 49 | if ( ! $tax->show_ui || ! in_array('post', (array) $tax->object_type, true) ) 50 | continue; 51 | 52 | $submenu['edit.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name ); 53 | } 54 | unset($tax); 55 | 56 | $menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'div' ); 57 | $submenu['upload.php'][5] = array( __('Library'), 'upload_files', 'upload.php'); 58 | /* translators: add new file */ 59 | if ( !$is_iphone ) 60 | $submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php'); 61 | 62 | $menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'div' ); 63 | $submenu['link-manager.php'][5] = array( _x('All Links', 'admin menu'), 'manage_links', 'link-manager.php' ); 64 | /* translators: add new links */ 65 | $submenu['link-manager.php'][10] = array( _x('Add New', 'link'), 'manage_links', 'link-add.php' ); 66 | $submenu['link-manager.php'][15] = array( __('Link Categories'), 'manage_categories', 'edit-tags.php?taxonomy=link_category' ); 67 | 68 | $menu[20] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page', '', 'menu-top menu-icon-page', 'menu-pages', 'div' ); 69 | $submenu['edit.php?post_type=page'][5] = array( __('All Pages'), 'edit_pages', 'edit.php?post_type=page' ); 70 | /* translators: add new page */ 71 | $submenu['edit.php?post_type=page'][10] = array( _x('Add New', 'page'), 'edit_pages', 'post-new.php?post_type=page' ); 72 | $i = 15; 73 | foreach ( get_taxonomies( array(), 'objects' ) as $tax ) { 74 | if ( ! $tax->show_ui || ! in_array('page', (array) $tax->object_type, true) ) 75 | continue; 76 | 77 | $submenu['edit.php?post_type=page'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&post_type=page' ); 78 | } 79 | unset($tax); 80 | 81 | $awaiting_mod = wp_count_comments(); 82 | $awaiting_mod = $awaiting_mod->moderated; 83 | # LHG: changed so that everybody can see the comment overview page 84 | $menu[25] = array( sprintf( __('Comments %s'), "" . number_format_i18n($awaiting_mod) . "" ), 'read', 'edit-comments.php', '', 'menu-top menu-icon-comments', 'menu-comments', 'div' ); 85 | 86 | $current_user = wp_get_current_user(); 87 | 88 | # LHG: changed so that everybody can see the comment overview page 89 | if ($current_user->ID != 1) $menu[25] = array( sprintf( __('Comments %s'), "" . number_format_i18n($awaiting_mod) . "" ), 'read', 'edit-comments.php?comment_status=approved', '', 'menu-top menu-icon-comments', 'menu-comments', 'div' ); 90 | 91 | unset($awaiting_mod); 92 | 93 | # LHG: changed so that everybody can see the comment overview page 94 | $submenu[ 'edit-comments.php' ][0] = array( __('All Comments'), 'read', 'edit-comments.php' ); 95 | 96 | $_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group 97 | 98 | foreach ( (array) get_post_types( array('show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ) as $ptype ) { 99 | $ptype_obj = get_post_type_object( $ptype ); 100 | // Check if it should be a submenu. 101 | if ( $ptype_obj->show_in_menu !== true ) 102 | continue; 103 | $ptype_menu_position = is_int( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : ++$_wp_last_object_menu; // If we're to use $_wp_last_object_menu, increment it first. 104 | $ptype_for_id = sanitize_html_class( $ptype ); 105 | if ( is_string( $ptype_obj->menu_icon ) ) { 106 | $menu_icon = esc_url( $ptype_obj->menu_icon ); 107 | $ptype_class = $ptype_for_id; 108 | } else { 109 | $menu_icon = 'div'; 110 | $ptype_class = 'post'; 111 | } 112 | 113 | // if $ptype_menu_position is already populated or will be populated by a hard-coded value below, increment the position. 114 | $core_menu_positions = array(59, 60, 65, 70, 75, 80, 85, 99); 115 | while ( isset($menu[$ptype_menu_position]) || in_array($ptype_menu_position, $core_menu_positions) ) 116 | $ptype_menu_position++; 117 | 118 | $menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class, 'menu-posts-' . $ptype_for_id, $menu_icon ); 119 | $submenu["edit.php?post_type=$ptype"][5] = array( $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype"); 120 | $submenu["edit.php?post_type=$ptype"][10] = array( $ptype_obj->labels->add_new, $ptype_obj->cap->edit_posts, "post-new.php?post_type=$ptype" ); 121 | 122 | $i = 15; 123 | foreach ( get_taxonomies( array(), 'objects' ) as $tax ) { 124 | if ( ! $tax->show_ui || ! in_array($ptype, (array) $tax->object_type, true) ) 125 | continue; 126 | 127 | $submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&post_type=$ptype" ); 128 | } 129 | } 130 | unset($ptype, $ptype_obj, $ptype_class, $ptype_for_id, $ptype_menu_position, $menu_icon, $i, $tax); 131 | 132 | $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' ); 133 | 134 | if ( current_user_can( 'switch_themes') ) { 135 | $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' ); 136 | $submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php'); 137 | if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) 138 | $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php'); 139 | } else { 140 | $menu[60] = array( __('Appearance'), 'edit_theme_options', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' ); 141 | $submenu['themes.php'][5] = array(__('Themes'), 'edit_theme_options', 'themes.php'); 142 | if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) 143 | $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php' ); 144 | } 145 | 146 | // Add 'Editor' to the bottom of the Appearance menu. 147 | if ( ! is_multisite() ) 148 | add_action('admin_menu', '_add_themes_utility_last', 101); 149 | function _add_themes_utility_last() { 150 | // Must use API on the admin_menu hook, direct modification is only possible on/before the _admin_menu hook 151 | add_submenu_page('themes.php', _x('Editor', 'theme editor'), _x('Editor', 'theme editor'), 'edit_themes', 'theme-editor.php'); 152 | } 153 | 154 | $menu_perms = get_site_option( 'menu_items', array() ); 155 | if ( ! is_multisite() || is_super_admin() || ! empty( $menu_perms['plugins'] ) ) { 156 | if ( ! isset( $update_data ) ) 157 | $update_data = wp_get_update_data(); 158 | 159 | $count = ''; 160 | if ( ! is_multisite() && current_user_can( 'update_plugins' ) ) 161 | $count = "" . number_format_i18n($update_data['counts']['plugins']) . ""; 162 | 163 | $menu[65] = array( sprintf( __('Plugins %s'), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'div' ); 164 | 165 | $submenu['plugins.php'][5] = array( __('Installed Plugins'), 'activate_plugins', 'plugins.php' ); 166 | 167 | if ( ! is_multisite() ) { 168 | /* translators: add new plugin */ 169 | $submenu['plugins.php'][10] = array( _x('Add New', 'plugin'), 'install_plugins', 'plugin-install.php' ); 170 | $submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' ); 171 | } 172 | } 173 | unset($menu_perms, $update_data); 174 | 175 | if ( current_user_can('list_users') ) 176 | $menu[70] = array( __('Users'), 'list_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'div' ); 177 | else 178 | $menu[70] = array( __('Profile'), 'read', 'profile.php', '', 'menu-top menu-icon-users', 'menu-users', 'div' ); 179 | 180 | if ( current_user_can('list_users') ) { 181 | $_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php. 182 | $submenu['users.php'][5] = array(__('All Users'), 'list_users', 'users.php'); 183 | if ( current_user_can('create_users') ) 184 | $submenu['users.php'][10] = array(_x('Add New', 'user'), 'create_users', 'user-new.php'); 185 | else 186 | $submenu['users.php'][10] = array(_x('Add New', 'user'), 'promote_users', 'user-new.php'); 187 | 188 | $submenu['users.php'][15] = array(__('Your Profile'), 'read', 'profile.php'); 189 | } else { 190 | $_wp_real_parent_file['users.php'] = 'profile.php'; 191 | $submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.php'); 192 | if ( current_user_can('create_users') ) 193 | $submenu['profile.php'][10] = array(__('Add New User'), 'create_users', 'user-new.php'); 194 | else 195 | $submenu['profile.php'][10] = array(__('Add New User'), 'promote_users', 'user-new.php'); 196 | } 197 | 198 | $menu[75] = array( __('Tools'), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'div' ); 199 | $submenu['tools.php'][5] = array( __('Available Tools'), 'edit_posts', 'tools.php' ); 200 | $submenu['tools.php'][10] = array( __('Import'), 'import', 'import.php' ); 201 | $submenu['tools.php'][15] = array( __('Export'), 'export', 'export.php' ); 202 | if ( is_multisite() && !is_main_site() ) 203 | $submenu['tools.php'][25] = array( __('Delete Site'), 'manage_options', 'ms-delete-site.php' ); 204 | if ( ! is_multisite() && defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE ) 205 | $submenu['tools.php'][50] = array(__('Network Setup'), 'manage_options', 'network.php'); 206 | 207 | $menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'div' ); 208 | $submenu['options-general.php'][10] = array(_x('General', 'settings screen'), 'manage_options', 'options-general.php'); 209 | $submenu['options-general.php'][15] = array(__('Writing'), 'manage_options', 'options-writing.php'); 210 | $submenu['options-general.php'][20] = array(__('Reading'), 'manage_options', 'options-reading.php'); 211 | $submenu['options-general.php'][25] = array(__('Discussion'), 'manage_options', 'options-discussion.php'); 212 | $submenu['options-general.php'][30] = array(__('Media'), 'manage_options', 'options-media.php'); 213 | $submenu['options-general.php'][35] = array(__('Privacy'), 'manage_options', 'options-privacy.php'); 214 | $submenu['options-general.php'][40] = array(__('Permalinks'), 'manage_options', 'options-permalink.php'); 215 | $submenu['options-general.php'][45] = array(__('Security'), 'manage_options', 'options-security.php'); 216 | 217 | 218 | $_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group 219 | 220 | $menu[99] = array( '', 'read', 'separator-last', '', 'wp-menu-separator' ); 221 | 222 | // Back-compat for old top-levels 223 | $_wp_real_parent_file['post.php'] = 'edit.php'; 224 | $_wp_real_parent_file['post-new.php'] = 'edit.php'; 225 | $_wp_real_parent_file['edit-pages.php'] = 'edit.php?post_type=page'; 226 | $_wp_real_parent_file['page-new.php'] = 'edit.php?post_type=page'; 227 | $_wp_real_parent_file['wpmu-admin.php'] = 'tools.php'; 228 | $_wp_real_parent_file['ms-admin.php'] = 'tools.php'; 229 | 230 | // ensure we're backwards compatible 231 | $compat = array( 232 | 'index' => 'dashboard', 233 | 'edit' => 'posts', 234 | 'post' => 'posts', 235 | 'upload' => 'media', 236 | 'link-manager' => 'links', 237 | 'edit-pages' => 'pages', 238 | 'page' => 'pages', 239 | 'edit-comments' => 'comments', 240 | 'options-general' => 'settings', 241 | 'themes' => 'appearance', 242 | ); 243 | 244 | require_once(ABSPATH . 'wp-admin/includes/menu.php'); 245 | 246 | ?> 247 | -------------------------------------------------------------------------------- /wp-content/plugins/cubepoints/cubepoints.php: -------------------------------------------------------------------------------- 1 | base_prefix . 'cp'); 16 | define('CP_PATH', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__))); 17 | 18 | /** Set CubePoints Version **/ 19 | add_option('cp_ver', CP_VER); 20 | 21 | /** Loads the plugin's translated strings */ 22 | load_plugin_textdomain('cp', false, dirname(plugin_basename(__FILE__)).'/languages'); 23 | 24 | /** Includes commons */ 25 | require_once 'cp_common.php'; 26 | 27 | /** Includes install script */ 28 | require_once 'cp_install.php'; 29 | 30 | /** Includes upgrade script */ 31 | require_once 'cp_upgrade.php'; 32 | 33 | /** Includes core functions */ 34 | require_once 'cp_core.php'; 35 | 36 | /** Includes plugin hooks */ 37 | require_once 'cp_hooks.php'; 38 | 39 | /** Includes plugin APIs */ 40 | require_once 'cp_api.php'; 41 | 42 | /** Includes widgets */ 43 | require_once 'cp_widgets.php'; 44 | 45 | /** Includes widgets */ 46 | require_once 'cp_lhg_widgets.php'; 47 | 48 | /** Includes logs display */ 49 | require_once 'cp_logs.php'; 50 | 51 | /** Includes admin pages */ 52 | require_once 'cp_admin.php'; 53 | 54 | /** Hook for plugin installation */ 55 | register_activation_hook( __FILE__ , 'cp_activate' ); 56 | function cp_activate(){ 57 | cp_install(); 58 | } 59 | 60 | /** Include all modules in the modules folder */ 61 | add_action('plugins_loaded','cp_modules_include',2); 62 | 63 | /** Checks if modules have been updated and run activation hook */ 64 | add_action('init', 'cp_modules_updateCheck'); 65 | 66 | ?> -------------------------------------------------------------------------------- /wp-content/plugins/daves-wordpress-live-search/DavesWordPressLiveSearchResults.php: -------------------------------------------------------------------------------- 1 | results = array(); 25 | $this->populate($source, $searchTerms, $displayPostMeta, $maxResults); 26 | $this->displayPostMeta = $displayPostMeta; 27 | 28 | } 29 | 30 | /** 31 | * 32 | * @global type $wp_locale 33 | * @global type $wp_query 34 | * @param int $source SEARCH_ constant 35 | * @param type $wpQueryResults 36 | * @param type $displayPostMeta 37 | * @param string $maxResults 38 | */ 39 | private function populate($source, $wpQueryResults, $displayPostMeta, $maxResults) { 40 | 41 | global $wp_locale; 42 | global $wp_query; 43 | 44 | $dateFormat = get_option('date_format'); 45 | 46 | // Some other plugin threw a fit once if I didn't instantiate 47 | // WP_Query once to initialize everything and then call it 48 | // for real. Might have been "Search Everything". I think there's 49 | // a comment about it in an old version of DWLS. 50 | $wp_query = $wpQueryResults = new WP_Query(); 51 | $wp_query = $wpQueryResults = new WP_Query(); 52 | 53 | if (function_exists('relevanssi_do_query')) { 54 | // Relevanssi isn't treating 0 as "unlimited" results 55 | // like WordPress's native search does. So we'll replace 56 | // $maxResults with a really big number, the biggest one 57 | // PHP knows how to represent, if $maxResults == -1 58 | // (unlimited) 59 | if (-1 == $maxResults) { 60 | $maxResults = PHP_INT_MAX; 61 | } 62 | } 63 | 64 | $wpQueryParams = $_GET; 65 | $wpQueryParams['showposts'] = $maxResults; 66 | if(self::SEARCH_WPCOMMERCE === $source) { 67 | $wpQueryParams['post_type'] = 'wpsc-product'; 68 | } 69 | else { 70 | # LHG: was "any", but now limited to HW posts 71 | $wpQueryParams['post_type'] = 'post'; 72 | } 73 | $wpQueryParams['post_status'] = 'publish'; 74 | $queryString = http_build_query($wpQueryParams); 75 | 76 | $wpQueryResults->query($queryString); 77 | 78 | $this->searchTerms = $wpQueryResults->query_vars['s']; 79 | 80 | $wpQueryResults = apply_filters('dwls_alter_results', $wpQueryResults, $maxResults); 81 | 82 | foreach ($wpQueryResults->posts as $result) { 83 | // Add author names & permalinks 84 | if ($displayPostMeta) { 85 | $result->post_author_nicename = $this->authorName($result->post_author); 86 | } 87 | 88 | $result->permalink = lhg_translate_search_url( get_permalink($result->ID) ); 89 | 90 | if (function_exists('get_post_thumbnail_id')) { 91 | // Support for WP 2.9 post thumbnails 92 | $postImageID = get_post_thumbnail_id($result->ID); 93 | $postImageData = wp_get_attachment_image_src($postImageID, apply_filters('post_image_size', 'thumbnail')); 94 | $hasThumbnailSet = ($postImageData !== false); 95 | } 96 | else { 97 | // No support for post thumbnails 98 | $hasThumbnailSet = false; 99 | } 100 | 101 | if($hasThumbnailSet) { 102 | $result->attachment_thumbnail = $postImageData[0]; 103 | } else { 104 | // If no post thumbnail, grab the first image from the post 105 | $applyContentFilter = get_option('daves-wordpress-live-search_apply_content_filter', false); 106 | $content = $result->post_content; 107 | if($applyContentFilter) { 108 | $content = apply_filters('the_content', $content); 109 | } 110 | $content = str_replace(']]>', ']]>', $content); 111 | $result->attachment_thumbnail = $this->firstImg($content); 112 | } 113 | 114 | $result->attachment_thumbnail = apply_filters('dwls_attachment_thumbnail', $result->attachment_thumbnail); 115 | 116 | $result->post_excerpt = $this->excerpt($result); 117 | 118 | $result->post_date = date_i18n($dateFormat, strtotime($result->post_date)); 119 | $result->post_date = apply_filters('dwls_post_date', $result->post_date); 120 | 121 | // We don't want to send all this content to the browser 122 | unset($result->post_content); 123 | 124 | // xLocalization 125 | $result->post_title = apply_filters("localization", $result->post_title); 126 | 127 | $result->post_title = apply_filters('dwls_post_title', $result->post_title); 128 | 129 | global $lang; 130 | if ($lang != "de") $pt = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($result->post_title); 131 | if ($lang == "de") $pt = ($result->post_title); 132 | 133 | $result->post_title = $pt."
".the_ratings_results($result->ID,0,0,0,10); #."
".$pt; 134 | 135 | $result->show_more = true; 136 | 137 | $this->results[] = $result; 138 | } 139 | } 140 | 141 | private function excerpt($result) { 142 | 143 | static $excerptLength = null; 144 | // Only grab this value once 145 | if (null == $excerptLength) { 146 | $excerptLength = intval(get_option('daves-wordpress-live-search_excerpt_length')); 147 | } 148 | // Default value 149 | if (0 == $excerptLength) { 150 | $excerptLength = 100; 151 | } 152 | 153 | if (empty($result->post_excerpt)) { 154 | $content = apply_filters("localization", $result->post_content); 155 | $excerpt = explode(" ", strrev(substr(strip_tags($content), 0, $excerptLength)), 2); 156 | $excerpt = strrev($excerpt[1]); 157 | $excerpt .= " [...]"; 158 | } else { 159 | $excerpt = apply_filters("localization", $result->post_excerpt); 160 | } 161 | 162 | $excerpt = apply_filters('the_excerpt', $excerpt); 163 | $excerpt = apply_filters('dwls_the_excerpt', $excerpt); 164 | 165 | return $excerpt; 166 | } 167 | 168 | /** 169 | * @return string 170 | */ 171 | private function authorName($authorID) { 172 | static $authorCache = array(); 173 | 174 | if (array_key_exists($authorID, $authorCache)) { 175 | $authorName = $authorCache[$authorID]; 176 | } else { 177 | $authorData = get_userdata($authorID); 178 | $authorName = $authorData->display_name; 179 | $authorCache[$authorID] = $authorName; 180 | } 181 | 182 | $authorName = apply_filters('dwls_author_name', $authorName); 183 | 184 | return $authorName; 185 | } 186 | 187 | public function firstImg($post_content) { 188 | $matches = array(); 189 | $output = preg_match_all('//i', $post_content, $matches); 190 | if(isset($matches[1][0])) { 191 | $first_img = $matches[1][0]; 192 | } 193 | 194 | if (empty($first_img)) { 195 | return '/wp-uploads/2013/03/noimage130.jpg'; 196 | } 197 | return $first_img; 198 | } 199 | 200 | public function ajaxSearch() { 201 | $maxResults = intval(get_option('daves-wordpress-live-search_max_results')); 202 | if ($maxResults === 0) 203 | $maxResults = -1; 204 | 205 | $cacheLifetime = intval(get_option('daves-wordpress-live-search_cache_lifetime')); 206 | if (!is_user_logged_in() && 0 < $cacheLifetime) { 207 | $doCache = TRUE; 208 | } else { 209 | $doCache = FALSE; 210 | } 211 | 212 | if ($doCache) { 213 | $cachedResults = DWLSTransients::get($_REQUEST['s']); 214 | } 215 | 216 | if ((!$doCache) || (FALSE === $cachedResults)) { 217 | 218 | // Initialize the $wp global object 219 | // See class WP in classes.php 220 | // The Relevanssi plugin is using this instead of 221 | // the global $wp_query object 222 | $wp = & new WP(); 223 | $wp->init(); // Sets up current user. 224 | $wp->parse_request(); 225 | 226 | $displayPostMeta = (bool) get_option('daves-wordpress-live-search_display_post_meta'); 227 | if (array_key_exists('search_source', $_REQUEST)) { 228 | $searchSource = $_GET['search_source']; 229 | } else { 230 | $searchSource = intval(get_option('daves-wordpress-live-search_source')); 231 | } 232 | 233 | $results = new DavesWordPressLiveSearchResults($searchSource, $_GET['s'], $displayPostMeta, $maxResults); 234 | 235 | if ($doCache) { 236 | DWLSTransients::set($_REQUEST['s'], $results, $cacheLifetime); 237 | } 238 | } else { 239 | // Found it in the cache. Return the results. 240 | $results = $cachedResults; 241 | } 242 | 243 | $json = json_encode($results); 244 | 245 | // If we don't output the text we want outputted here and 246 | // then die(), the wp_ajax code will die(0) or die(-1) after 247 | // this function returns and that value will get echoed out 248 | // to the browser, resulting in a JSON parsing error. 249 | die($json); 250 | } 251 | 252 | } 253 | 254 | // Set up the AJAX hooks 255 | add_action("wp_ajax_dwls_search", array("DavesWordPressLiveSearchResults", "ajaxSearch")); 256 | add_action("wp_ajax_nopriv_dwls_search", array("DavesWordPressLiveSearchResults", "ajaxSearch")); 257 | -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/Manjaro-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/Manjaro-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/OpenSUSE_Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/OpenSUSE_Logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/aldos-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/aldos-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/alt-linux-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/alt-linux-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/antergos-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/antergos-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/arch-linux-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/arch-linux-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/black-panther-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/black-panther-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/bodhi-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/bodhi-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/bunsenlabs-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/bunsenlabs-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/centos-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/centos-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/chakra-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/chakra-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/debian-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/debian-logo.jpg -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/devuan-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/devuan-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/elementary-os-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/elementary-os-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/fedora-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/fedora-logo.jpg -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/funtoo-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/funtoo-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/gentoo-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/gentoo-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/handylinux-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/handylinux-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/kalilinux-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/kalilinux-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/kde-neon-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/kde-neon-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/korora-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/korora-logo.jpg -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/linux-from-scratch-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/linux-from-scratch-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/linuxmint-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/linuxmint-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/mageia-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/mageia-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/mx-linux-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/mx-linux-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/netrunner-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/netrunner-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/parabola-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/parabola-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/pclinuxos-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/pclinuxos-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/pisi-linux-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/pisi-linux-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/point-linux-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/point-linux-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/raspbian-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/raspbian-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/simply-linux-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/simply-linux-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/slackware-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/slackware-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/solyd-xk-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/solyd-xk-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/tanglu-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/tanglu-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/ubuntu-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/ubuntu-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/ultimate-edition-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/ultimate-edition-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/unknown-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/unknown-logo.jpg -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/unknown-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/unknown-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/images/zorin-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/images/zorin-logo.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/lhg-scanresults.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/lhg-scanresults.php -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/templates/request-management-link.php: -------------------------------------------------------------------------------- 1 | clean_email($email); 26 | $subscriber_salt = $wp_subscribe_reloaded->generate_key($clean_email); 27 | $post_permalink = get_permalink($post_ID); 28 | 29 | $headers = "MIME-Version: 1.0\n"; 30 | $headers .= "From: $from_name <$from_email>\n"; 31 | $content_type = (get_option('subscribe_reloaded_enable_html_emails', 'no') == 'yes')?'text/html':'text/plain'; 32 | $headers .= "Content-Type: $content_type; charset=".get_bloginfo('charset'); 33 | 34 | $manager_link .= (strpos($manager_link, '?') !== false)?'&':'?'; 35 | $manager_link .= "sre=".urlencode($clean_email)."&srk=$subscriber_salt"; 36 | 37 | // Replace tags with their actual values 38 | $subject = str_replace('[blog_name]', get_bloginfo('name'), $subject); 39 | $message = str_replace('[blog_name]', get_bloginfo('name'), $message); 40 | $message = str_replace('[manager_link]', $manager_link, $message); 41 | 42 | // QTranslate support 43 | if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')){ 44 | $subject = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($subject); 45 | $message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($message); 46 | } 47 | if($content_type == 'text/html') 48 | $message = $wp_subscribe_reloaded->wrap_html_message($message, $subject); 49 | 50 | wp_mail($clean_email, $subject, $message, $headers); 51 | 52 | $message = str_replace('[post_permalink]', $post_permalink, html_entity_decode(stripslashes(get_option('subscribe_reloaded_request_mgmt_link_thankyou')), ENT_COMPAT, 'UTF-8')); 53 | if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')){ 54 | $message = str_replace('[post_title]', qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($post->post_title), $message); 55 | $message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($message); 56 | } 57 | else 58 | $message = str_replace('[post_title]', $post->post_title, $message); 59 | 60 | echo $message; 61 | } else { 62 | $message = html_entity_decode(stripslashes(get_option('subscribe_reloaded_request_mgmt_link')), ENT_COMPAT, 'UTF-8'); 63 | if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) 64 | $message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($message); 65 | ?> 66 |

67 |
68 |
69 |

70 | 71 |

72 |
73 |
74 | -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/templates/scan.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/templates/scan.php -------------------------------------------------------------------------------- /wp-content/plugins/lhg-hardware-profile-manager/templates/uid.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-hardware-profile-manager/templates/uid.php -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/backend/html/lhgupdatedb.php: -------------------------------------------------------------------------------- 1 | /home/ronny/LinuxHardwareGuide/wp-content/plugins/lhg-pricedb/backend/includes/amazon_price.pl -a $aid com
"; 28 | system("/home/ronny/LinuxHardwareGuide/wp-content/plugins/lhg-pricedb/backend/includes/amazon_price.pl -a $aid $region 2> /tmp/test.txt", $output_tmp ); 29 | #print "
OUT: $output"; 30 | #$output = "
".$output_tmp."
";#InProgress"; 31 | }elseif ( $mode == "productsearch"){ 32 | print "Testsearch: $product"; 33 | system("/home/ronny/LinuxHardwareGuide/wp-content/plugins/lhg-pricedb/backend/includes/amazon_search.pl $region \"$product\" 2> /tmp/test.txt", $output_tmp ); 34 | # Debug 35 | #print "OUT: $output"; 36 | #$output = "Debug:
".$output_tmp."
";#InProgress"; 37 | 38 | }else{ 39 | 40 | //insert into DB 41 | $output = system("/home/ronny/LinuxHardwareGuide/wp-content/plugins/lhg-pricedb/backend/filldb-shop-".$sid.".pl $aid"); 42 | 43 | } 44 | echo "$output"; 45 | 46 | } else { 47 | echo "Requesting Host unknown. Ignoring"; 48 | } 49 | ?> 50 | -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/backend/includes/amazon_price.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # usage: ./amazon_price.pl ASIN Countrycode 4 | # supported countrycodes: 5 | # "de" ... Amazon.de 6 | 7 | use File::Basename; 8 | use warnings; 9 | use LWP::UserAgent; 10 | use XML::Simple; 11 | #use YAML::Syck; 12 | use Data::Dumper; 13 | #use strict; 14 | 15 | 16 | 17 | my $dir = dirname(__FILE__); 18 | require "$dir/APA.pm"; 19 | #require "/var/www/cgi-bin/APA.pm"; 20 | 21 | # catch option -a 22 | if ($ARGV[0] eq "-a") { 23 | 24 | $ItemID = $ARGV[1]; 25 | $region = $ARGV[2]; 26 | $complete_output = 1; 27 | $return_url = 0; 28 | 29 | } else { 30 | 31 | $ItemID = $ARGV[0]; 32 | $region = $ARGV[1]; 33 | $return_url = 0; 34 | } 35 | 36 | if ($ItemID eq "") { 37 | #$ItemID = "B000EHIA06"; 38 | $ItemID = "B00IWRX14A"; 39 | } 40 | if ($region eq "") { 41 | #$region = "de"; 42 | $region = "com"; 43 | } 44 | 45 | if (defined( $ARGV[2] ) ) { 46 | if ($ARGV[2] eq "URL") { $return_url = 1; } 47 | } 48 | 49 | $AssociateTag = "unknown"; 50 | if ($region eq "ca"){ 51 | $aws_partner_ids[0] ="linuhardgui01-20"; 52 | }elsif ($region eq "co.uk") { 53 | $aws_partner_ids[0] ="linuhardguid-21"; 54 | }elsif ($region eq "de"){ 55 | $aws_partner_ids[0] ="linuxnetmagor-21"; 56 | }elsif ($region eq "fr"){ 57 | $aws_partner_ids[0] ="linuhardgui01-21"; 58 | }elsif ($region eq "es"){ 59 | $aws_partner_ids[0] ="linuhardgu061-21"; 60 | }elsif ($region eq "it"){ 61 | $aws_partner_ids[0] ="linuhardgui05-21"; 62 | }elsif ($region eq "co.jp"){ 63 | $aws_partner_ids[0] ="linuhardgui22-22"; 64 | # //}elseif ($region == "com.br"){ 65 | #// $aws_partner_id ="linuhardgui22-22"; 66 | }elsif ($region eq "cn"){ 67 | $aws_partner_ids[0] ="linuhardgui23-23"; 68 | }elsif ($region eq "in"){ 69 | $aws_partner_ids[0] ="linuxhardwagu-21"; 70 | }elsif ($region eq "all"){ 71 | $mode = "all"; 72 | @regions = ("com", "de", "fr", "co.uk"); 73 | $aws_partner_ids[0] ="linuhardguid-20"; 74 | $aws_partner_ids[1] ="linuxnetmagor-21"; 75 | $aws_partner_ids[2] ="linuhardgui01-21"; 76 | $aws_partner_ids[3] ="linuhardguid-21"; 77 | }else { #// com as default 78 | $aws_partner_ids[0] ="linuhardguid-20"; 79 | } 80 | 81 | 82 | #print "ID: $ItemID"; 83 | 84 | #use strict; 85 | 86 | $public_key = "abc"; 87 | $private_key = "abcd"; 88 | require ("$dir/lhg.conf"); 89 | 90 | 91 | $i=-1; 92 | foreach $aws_partner_id (@aws_partner_ids) { 93 | 94 | 95 | # get region corresponding to partner ID 96 | $i++; 97 | if ($region eq "all") { 98 | $region = "com"; 99 | } 100 | if ($i > 0) { 101 | $region = $regions[$i]; 102 | } 103 | 104 | 105 | $AssociateTag = $aws_partner_id; 106 | 107 | # print "I: $i -> $region 108 | # ID: $aws_partner_id 109 | # 110 | # "; 111 | 112 | 113 | # use URI::Amazon::APA; # instead of URI 114 | my $u = URI::Amazon::APA->new('http://webservices.amazon.'.$region.'/onca/xml'); 115 | $u->query_form( 116 | Service => 'AWSECommerceService', 117 | Operation => 'ItemLookup', 118 | ItemId => $ItemID, 119 | AssociateTag=> $AssociateTag, 120 | ResponseGroup => 'Offers', 121 | ); 122 | 123 | if ($return_url eq 1) { 124 | $u->query_form( 125 | Service => 'AWSECommerceService', 126 | Operation => 'ItemLookup', 127 | ItemId => $ItemID, 128 | AssociateTag=> $AssociateTag, 129 | ResponseGroup => 'Medium', 130 | ); 131 | } 132 | 133 | #return all infos 134 | if ($complete_output eq 1) { 135 | $u->query_form( 136 | Service => 'AWSECommerceService', 137 | Operation => 'ItemLookup', 138 | ItemId => $ItemID, 139 | AssociateTag=> $AssociateTag, 140 | ResponseGroup => 'Images,Medium,Offers', 141 | ); 142 | } 143 | 144 | $u->sign( 145 | key => $public_key, 146 | secret => $private_key, 147 | ); 148 | 149 | my $ua = LWP::UserAgent->new; 150 | my $r = $ua->get($u); 151 | if ( $r->is_success ) { 152 | #print "A:"; 153 | $xmloutput = XMLin($r->content); 154 | #print Dumper( $xmloutput ); 155 | #print YAML::Syck::Dump( XMLin( $r->content ) ); 156 | 157 | #print Dumper ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'OfferSummary' } ); #->{ 'LowestNewPrice' } );#->{ 'FormattedPrice' } ); 158 | #print Dumper ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'OfferSummary' } ); #->{ 'LowestNewPrice' } );#->{ 'FormattedPrice' } ); 159 | 160 | $lowestNewPrice = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'OfferSummary' }->{ 'LowestNewPrice' }->{ 'FormattedPrice' } ); #["OperationRequest"]; 161 | # only used product available? 162 | if ($lowestNewPrice eq "") { 163 | $lowestNewPrice = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'OfferSummary' }->{ 'LowestUsedPrice' }->{ 'FormattedPrice' } ); #["OperationRequest"]; 164 | } 165 | 166 | $url = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'DetailPageURL' } ); #["OperationRequest"]; 167 | #$medium_image = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ImageSets' }->{ 'ImageSet' }->[0]->{MediumImage}->{URL} ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 168 | $medium_image_tmp = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ImageSets' }->{ 'ImageSet' } ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 169 | $label = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ItemAttributes' }->{ 'Label' } ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 170 | $title = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ItemAttributes' }->{ 'Title' } ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 171 | $brand = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ItemAttributes' }->{ 'Brand' } ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 172 | #print Dumper( $medium_image_tmp ); 173 | 174 | if ( ref($medium_image_tmp) eq 'ARRAY' ) { 175 | #print "IS AN ARRAY!"; 176 | # The last element contains the main image. Therefore, we have to look at all images 177 | $medium_image1 = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ImageSets' }->{ 'ImageSet' }->[0]->{MediumImage}->{URL} ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 178 | $medium_image2 = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ImageSets' }->{ 'ImageSet' }->[1]->{MediumImage}->{URL} ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 179 | $medium_image3 = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ImageSets' }->{ 'ImageSet' }->[2]->{MediumImage}->{URL} ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 180 | $medium_image4 = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ImageSets' }->{ 'ImageSet' }->[3]->{MediumImage}->{URL} ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 181 | $medium_image5 = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ImageSets' }->{ 'ImageSet' }->[4]->{MediumImage}->{URL} ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 182 | $medium_image6 = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ImageSets' }->{ 'ImageSet' }->[5]->{MediumImage}->{URL} ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 183 | $medium_image7 = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ImageSets' }->{ 'ImageSet' }->[6]->{MediumImage}->{URL} ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 184 | $medium_image8 = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ImageSets' }->{ 'ImageSet' }->[7]->{MediumImage}->{URL} ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 185 | 186 | if (defined($medium_image8)) { 187 | $medium_image = $medium_image8; 188 | }elsif (defined($medium_image7)) { 189 | $medium_image = $medium_image7; 190 | }elsif (defined($medium_image6)) { 191 | $medium_image = $medium_image6; 192 | }elsif (defined($medium_image5)) { 193 | $medium_image = $medium_image5; 194 | }elsif (defined($medium_image4)) { 195 | $medium_image = $medium_image4; 196 | }elsif (defined($medium_image3)) { 197 | $medium_image = $medium_image3; 198 | }elsif (defined($medium_image2)) { 199 | $medium_image = $medium_image2; 200 | } 201 | 202 | } else { 203 | #print "IS NOT AN ARRAY!"; 204 | $medium_image = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ImageSets' }->{ 'ImageSet' }->{MediumImage}->{URL} ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 205 | } 206 | #$medium_image = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ImageSets' }->{ 'ImageSet' }->{MediumImage}->{URL} ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 207 | } 208 | else { 209 | print $r->status_line, $r->as_string; 210 | } 211 | 212 | if ($mode eq "all"){ 213 | if ($medium_image1 eq "") { 214 | # go to next server 215 | next; 216 | } 217 | } 218 | 219 | if ($return_url eq 1) { 220 | if ( defined($url) ) { 221 | print $url; 222 | } 223 | }elsif ($complete_output eq 1) { 224 | #if ( defined($url) ) { 225 | #print "A".$medium_image->{MediumImage}[0]; 226 | # print Dumper($medium_image->[0]); 227 | # print Dumper($medium_image->{MediumImage}->{URL}); 228 | #print "\nOutput: \n"; 229 | print "Image: $medium_image;;URL: $url;;Price: $lowestNewPrice;;Title: $title;;Label: $label;;Brand: $brand;;"; 230 | 231 | if ( defined($medium_image1)) { print "Image2: $medium_image1;;"; } 232 | if ( defined($medium_image2)) { print "Image3: $medium_image2;;"; } 233 | if ( defined($medium_image3)) { print "Image4: $medium_image3;;"; } 234 | if ( defined($medium_image4)) { print "Image5: $medium_image4;;"; } 235 | if ( defined($medium_image5)) { print "Image6: $medium_image5;;"; } 236 | if ( defined($medium_image6)) { print "Image7: $medium_image6;;"; } 237 | if ( defined($medium_image7)) { print "Image8: $medium_image7;;"; } 238 | if ( defined($medium_image8)) { print "Image8: $medium_image8;;"; } 239 | 240 | # Image3: $medium_image3;; 241 | # Image4: $medium_image4;; 242 | # Image5: $medium_image5;;"; 243 | 244 | #print "Image: ".join(" - ", @medium_image); 245 | #} 246 | 247 | if ($mode eq "all"){ 248 | if ($medium_image1 ne "") { 249 | # found something -> exit 250 | exit; 251 | } 252 | } 253 | 254 | 255 | }else{ 256 | print $lowestNewPrice; 257 | } 258 | 259 | } 260 | 261 | -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/backend/includes/amazon_search.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # usage: ./amazon_price.pl ASIN Countrycode 4 | # supported countrycodes: 5 | # "de" ... Amazon.de 6 | 7 | use File::Basename; 8 | use warnings; 9 | use LWP::UserAgent; 10 | use XML::Simple; 11 | #use YAML::Syck; 12 | use Data::Dumper; 13 | #use strict; 14 | 15 | 16 | my $dir = dirname(__FILE__); 17 | require "$dir/APA.pm"; 18 | #require "/var/www/cgi-bin/APA.pm"; 19 | 20 | $region = $ARGV[0]; 21 | $product = $ARGV[1]; 22 | 23 | if ($region eq "") { $region = "com"; } 24 | if ($product eq "") { 25 | #$product = "Intel Core i5 2500 CPU"; 26 | $product = "HP DVD DH16ACSH"; 27 | } 28 | $product =~ s/__/ /g; 29 | 30 | $AssociateTag = "unknown"; 31 | if ($region eq "ca"){ 32 | $aws_partner_id ="linuhardgui01-20"; 33 | }elsif ($region eq "co.uk") { 34 | $aws_partner_id ="linuhardguid-21"; 35 | }elsif ($region eq "de"){ 36 | $aws_partner_id ="linuxnetmagor-21"; 37 | }elsif ($region eq "fr"){ 38 | $aws_partner_id ="linuhardgui01-21"; 39 | }elsif ($region eq "es"){ 40 | $aws_partner_id ="linuhardgu061-21"; 41 | }elsif ($region eq "it"){ 42 | $aws_partner_id ="linuhardgui05-21"; 43 | }elsif ($region eq "co.jp"){ 44 | $aws_partner_id ="linuhardgui22-22"; 45 | # //}elseif ($region == "com.br"){ 46 | #// $aws_partner_id ="linuhardgui22-22"; 47 | }elsif ($region eq "cn"){ 48 | $aws_partner_id ="linuhardgui23-23"; 49 | }elsif ($region eq "in"){ 50 | $aws_partner_id ="linuxhardwagu-21"; 51 | }else { #// com as default 52 | $aws_partner_id ="linuhardguid-20"; 53 | } 54 | 55 | $AssociateTag = $aws_partner_id; 56 | 57 | #print "ID: $ItemID"; 58 | 59 | #use strict; 60 | 61 | $public_key = "abc"; 62 | $private_key = "abcd"; 63 | require ("$dir/lhg.conf"); 64 | 65 | # use URI::Amazon::APA; # instead of URI 66 | my $u = URI::Amazon::APA->new('http://webservices.amazon.'.$region.'/onca/xml'); 67 | $u->query_form( 68 | Service => 'AWSECommerceService', 69 | Operation => 'ItemSearch', 70 | Keywords => $product, 71 | AssociateTag=> $AssociateTag, 72 | SearchIndex => 'PCHardware', 73 | ); 74 | 75 | 76 | $u->sign( 77 | key => $public_key, 78 | secret => $private_key, 79 | ); 80 | 81 | my $ua = LWP::UserAgent->new; 82 | my $r = $ua->get($u); 83 | if ( $r->is_success ) { 84 | #print "A:"; 85 | $xmloutput = XMLin($r->content); 86 | #print Dumper( $xmloutput ); 87 | #print YAML::Syck::Dump( XMLin( $r->content ) ); 88 | #print "length:"; 89 | 90 | #print Dumper ($xmloutput->{ 'Items' }->{ 'Item' }->{ 'ASIN' } ); 91 | 92 | if ( ref($xmloutput->{ 'Items' }->{ 'Item' }) eq "ARRAY" ) { 93 | $item1_ASIN = ( $xmloutput->{ 'Items' }->{ 'Item' }->[0]->{ 'ASIN' });# ->{ 'ItemLinks' }; #->{ 'LowestNewPrice' }->{ 'FormattedPrice' } ); #["OperationRequest"]; 94 | $item2_ASIN = ( $xmloutput->{ 'Items' }->{ 'Item' }->[1]->{ 'ASIN' });# ->{ 'ItemLinks' }; #->{ 'LowestNewPrice' }->{ 'FormattedPrice' } ); #["OperationRequest"]; 95 | $item3_ASIN = ( $xmloutput->{ 'Items' }->{ 'Item' }->[2]->{ 'ASIN' });# ->{ 'ItemLinks' }; #->{ 'LowestNewPrice' }->{ 'FormattedPrice' } ); #["OperationRequest"]; 96 | 97 | $Title1 = ( $xmloutput->{ 'Items' }->{ 'Item' }->[0] ->{ 'ItemAttributes' } ->{ 'Title' }); #->{ 'LowestNewPrice' }->{ 'FormattedPrice' } ); #["OperationRequest"]; 98 | $Title2 = ( $xmloutput->{ 'Items' }->{ 'Item' }->[2] ->{ 'ItemAttributes' } ->{ 'Title' }); #->{ 'LowestNewPrice' }->{ 'FormattedPrice' } ); #["OperationRequest"]; 99 | $Title3 = ( $xmloutput->{ 'Items' }->{ 'Item' }->[3] ->{ 'ItemAttributes' } ->{ 'Title' }); #->{ 'LowestNewPrice' }->{ 'FormattedPrice' } ); #["OperationRequest"]; 100 | 101 | 102 | print " 103 | ASIN1: $item1_ASIN 104 | Title1: $Title1 105 | ASIN2: $item2_ASIN 106 | Title2: $Title2 107 | ASIN3: $item3_ASIN 108 | Title3: $Title3 109 | "; 110 | 111 | }else{ 112 | #only one search result provided 113 | $item1_ASIN = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ASIN' });# ->{ 'ItemLinks' }; #->{ 'LowestNewPrice' }->{ 'FormattedPrice' } ); #["OperationRequest"]; 114 | $Title1 = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ItemAttributes' } ->{ 'Title' }); #->{ 'LowestNewPrice' }->{ 'FormattedPrice' } ); #["OperationRequest"]; 115 | print " 116 | ASIN1: $item1_ASIN 117 | Title1: $Title1 118 | "; 119 | } 120 | #print Dumper( $Title1 ); 121 | #print Dumper( $item2 ); 122 | 123 | # $lowestNewPrice = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'OfferSummary' }->{ 'LowestNewPrice' }->{ 'FormattedPrice' } ); #["OperationRequest"]; 124 | #$url = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'DetailPageURL' } ); #["OperationRequest"]; 125 | #$medium_image = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ImageSets' }->{ 'ImageSet' }->[0]->{MediumImage}->{URL} ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 126 | #$medium_image_tmp = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ImageSets' }->{ 'ImageSet' } ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 127 | #$label = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ItemAttributes' }->{ 'Label' } ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 128 | #$title = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ItemAttributes' }->{ 'Title' } ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 129 | #$brand = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ItemAttributes' }->{ 'Brand' } ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 130 | #print Dumper( $medium_image_tmp ); 131 | 132 | if ( ref($medium_image_tmp) eq 'ARRAY' ) { 133 | #print "IS AN ARRAY!"; 134 | $medium_image = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ImageSets' }->{ 'ImageSet' }->[0]->{MediumImage}->{URL} ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 135 | 136 | } else { 137 | #print "IS NOT AN ARRAY!"; 138 | $medium_image = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ImageSets' }->{ 'ImageSet' }->{MediumImage}->{URL} ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 139 | } 140 | #$medium_image = ( $xmloutput->{ 'Items' }->{ 'Item' }->{ 'ImageSets' }->{ 'ImageSet' }->{MediumImage}->{URL} ); # ->{ 'MediumImage' } ); #->{ 'URL' } ); 141 | } 142 | else { 143 | print $r->status_line, $r->as_string; 144 | } 145 | 146 | 147 | if ($return_url eq 1) { 148 | if ( defined($url) ) { 149 | print $url; 150 | } 151 | }else{ 152 | print $lowestNewPrice; 153 | } 154 | -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/css/backend.css: -------------------------------------------------------------------------------- 1 | table#quarterly-points-table { 2 | width: auto; 3 | border: 1px solid #DFDFDF !important; 4 | border-radius: 3px; 5 | border-spacing: 0px; 6 | background: none !important; 7 | margin-left: auto; 8 | margin-right: auto; 9 | } 10 | 11 | tr#quarterly-points-header-row { 12 | margin-left: -2px; 13 | height: 41px; 14 | background-image: -moz-linear-gradient(center top , rgb(249, 249, 249), rgb(236, 236, 236)) !important; 15 | width: auto; 16 | background-color: rgb(241,241,241); 17 | font-weight: bold; 18 | } 19 | 20 | .qrtly-1, .qrtly-2, .qrtly-3, .qrtly-4, .qrtly-5 { 21 | padding: 5px; 22 | } 23 | 24 | .qrtly-1, .qrtly-2, .qrtly-4, .qrtly-5 { 25 | padding-left: 25px; 26 | } 27 | 28 | .qrtly-1 { 29 | font-weight: bold; 30 | } 31 | 32 | .qrtly-3 { 33 | min-width: 110px; 34 | } 35 | .amz-ajax-image { 36 | float: right; 37 | } 38 | 39 | .amz-ajax-image img { 40 | width: 100px; 41 | } 42 | 43 | .amz-ajax-found { 44 | color: green; 45 | } 46 | 47 | div#amz-info-reload-box { 48 | float: right; 49 | margin-top: -36px; 50 | } 51 | 52 | .ajax-amazon-table table tr td{ 53 | border: solid 1px; 54 | } 55 | 56 | .ajax-amazon-table { 57 | float: right; 58 | } 59 | 60 | .attachment-40x40 { 61 | width: 40px; 62 | height: 40px; 63 | } 64 | 65 | .table-pci-selector { 66 | // border: 1px solid; 67 | } 68 | 69 | .pci-selector-1 { 70 | width: 90px; 71 | } 72 | 73 | .table-pci-selector td { 74 | border-top: 1px solid #e7e7e7; 75 | } 76 | 77 | .create-fingerprint { 78 | width: 120px; 79 | } 80 | 81 | .small-ajax-indicator { 82 | width: 15px; 83 | } 84 | 85 | .image-selector-az { 86 | border: solid 1px; 87 | float: left; 88 | margin-left: 10px; 89 | padding: 3px; 90 | } 91 | 92 | .selector-images { 93 | max-width: 130px; 94 | max-height: 130px; 95 | } 96 | 97 | -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/css/lhg_widget_article_summary.css: -------------------------------------------------------------------------------- 1 | .wp_one_post_widget a { font-weight:bold;} 2 | 3 | .wp_one_post_widget .left {float: left;margin-right:5px;} 4 | 5 | .wp_one_post_widget .right {float: right;margin-left:5px;} 6 | 7 | .wp_one_post_widget .top {clear:both;display:block;margin:0 auto 5px auto;} 8 | -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/css/lhg_widget_article_summary_admin.css: -------------------------------------------------------------------------------- 1 | #autocomplete, 2 | #custom_title, 3 | #readmore { 4 | border:solid 1px #DFDFDF; 5 | background-color:#F9F9F9; 6 | -webkit-border-horizontal-spacing:0; 7 | -webkit-border-vertical-spacing:0; 8 | margin:0; 9 | padding-left:3px; 10 | padding-right:3px; 11 | width:100%; 12 | clear:both; 13 | } 14 | 15 | #language.manage-column.column-language{ 16 | width: 7%; 17 | } 18 | 19 | .new-comment-alarm { 20 | color: #008D00 !important; 21 | float: left; 22 | font-weight: bold; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/images/lhg_logo_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-pricedb/images/lhg_logo_16x16.png -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/includes/lhg.conf.example: -------------------------------------------------------------------------------- 1 | global $lhg_price_db; 2 | $lhg_price_db = new wpdb("wordpress", "PASSWORD", "lhgpricedb", "192.168.1.2"); 3 | -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/includes/lhg_auto_finder.php: -------------------------------------------------------------------------------- 1 | ..."; 35 | #print "PID: $pid - ID: $id - Session: $session
"; 36 | 37 | $title = get_the_title ( $pid ); 38 | # drive titles are sometimes shortened -> repair them 39 | if ($type == "drive") { 40 | $searchstring = lhg_search_string_from_drive_title ( $title, $session ); 41 | $title_mod = str_replace(" ","__",$searchstring); 42 | } 43 | 44 | if ($type == "cpu") { 45 | $title_mod = str_replace(" ","__",$title); 46 | } 47 | $tmp = explode("(",$title_mod); 48 | #$title_mod = $tmp[0]; 49 | #error_log("Tit: $title_mod"); 50 | $returnarray = lhg_amazon_search_by_title ( $title_mod , $search_region ); 51 | 52 | #var_dump($returnarray); 53 | 54 | if ( isset($returnarray[0]) ) $asin1 = $returnarray[0]; 55 | if ( isset($returnarray[1]) ) $title1 = $returnarray[1]; 56 | if ( isset($returnarray[2]) ) $asin2 = $returnarray[2]; 57 | if ( isset($returnarray[3]) ) $title2 = $returnarray[3]; 58 | if ( isset($returnarray[4]) ) $asin3 = $returnarray[4]; 59 | if ( isset($returnarray[5]) ) $title3 = $returnarray[5]; 60 | 61 | $output1 = lhg_aws_get_price($asin1, $search_region); 62 | $output2 = lhg_aws_get_price($asin2, $search_region); 63 | $output3 = lhg_aws_get_price($asin3, $search_region); 64 | 65 | #var_dump($output1); 66 | 67 | list($image_url_com1, $product_url_com1, $price_com1 , $product_title) = split(";;",$output1); 68 | list($image_url_com2, $product_url_com2, $price_com2 , $product_title) = split(";;",$output2); 69 | list($image_url_com3, $product_url_com3, $price_com3 , $product_title) = split(";;",$output3); 70 | 71 | $image_url_com1 = str_replace("Image: ","", $image_url_com1); 72 | $image_url_com2 = str_replace("Image: ","", $image_url_com2); 73 | $image_url_com3 = str_replace("Image: ","", $image_url_com3); 74 | 75 | $product_url_com1 = str_replace("URL: ","", $product_url_com1); 76 | $product_url_com2 = str_replace("URL: ","", $product_url_com2); 77 | $product_url_com3 = str_replace("URL: ","", $product_url_com3); 78 | 79 | $price_com1 = str_replace("Price: ","", $price_com1); 80 | $price_com2 = str_replace("Price: ","", $price_com2); 81 | $price_com3 = str_replace("Price: ","", $price_com3); 82 | 83 | 84 | #, $title1, $asin2, $title2, $asin3, $title3) = $returnarray; 85 | 86 | print " 87 | 88 | 89 | "; 90 | 91 | # 92 | # 93 | # 94 | # 95 | # 96 | # 97 | # 98 | 99 | 100 | print " 102 | "; #, $title1
"; 109 | 110 | if ($asin2 != "") print " 112 | 113 | "; #, $title1
"; 120 | 121 | 122 | if ($asin2 != "") print " 124 | 125 | "; #, $title1
"; 132 | #print "ASIN2: $asin2, $title2
"; 133 | #print "ASIN3: $asin3, $title3
"; 134 | #print "Searchresult: $result
"; 135 | print "
ImageTitlePriceASINselect
$title1 101 |
Price: $price_com1
ASIN: $asin1
103 | 104 | 105 | 106 | 107 | select 108 |
$title2 111 |
Price: $price_com2
ASIN: $asin2
114 | 115 | 116 | 117 | 118 | select 119 |
$title3 123 |
Price: $price_com3
ASIN: $asin3
126 | 127 | 128 | 129 | 130 | select 131 |
"; 136 | 137 | die(); 138 | } 139 | 140 | # 141 | # Update an article based on the ASIN returned by the search tool 142 | # 143 | # 144 | 145 | //find Amazon data based on uploaded product 146 | add_action('wp_ajax_lhg_update_article_by_amazon_search', 'lhg_update_article_by_amazon_search'); 147 | 148 | function lhg_update_article_by_amazon_search() { 149 | 150 | 151 | $search_region = "com"; #which AMAZON server to ask 152 | $pid = absint( $_REQUEST['pid'] ); 153 | $id = absint( $_REQUEST['id'] ); 154 | $session = $_REQUEST['session'] ; 155 | $mode = lhg_get_autocreate_mode($pid); # first implementation for CPU only 156 | 157 | $asin[1] = $_REQUEST['asin1'] ; 158 | $asin[2] = $_REQUEST['asin2'] ; 159 | $asin[3] = $_REQUEST['asin3'] ; 160 | 161 | $title[1] = $_REQUEST['title1'] ; 162 | $title[2] = $_REQUEST['title2'] ; 163 | $title[3] = $_REQUEST['title3'] ; 164 | 165 | $produrl[1] = $_REQUEST['produrl1'] ; 166 | $produrl[2] = $_REQUEST['produrl2'] ; 167 | $produrl[3] = $_REQUEST['produrl3'] ; 168 | 169 | $imgurl[1] = $_REQUEST['imgurl1'] ; 170 | $imgurl[2] = $_REQUEST['imgurl2'] ; 171 | $imgurl[3] = $_REQUEST['imgurl3'] ; 172 | 173 | #$asin1 = $_REQUEST['asin1'] ; 174 | #$asin2 = $_REQUEST['asin2'] ; 175 | #$asin3 = $_REQUEST['asin3'] ; 176 | $option = $_REQUEST['option'] ; 177 | $type = $_REQUEST['type'] ; # i.e. "cpu", "mainboard",... 178 | 179 | #print "Title: ".$title[$option]."
IURL: ".$imgurl[$option]." 180 | #
PURL: ".$produrl[$option]."
ASIN: ".$asin[$option]."
"; 181 | 182 | #error_log("DEB: ".$title[$option]); 183 | 184 | # Update tags by Amazon title 185 | lhg_update_tags_by_string($pid, $title[$option], $mode); 186 | lhg_update_categories_by_string($pid, $title[$option], $mode); 187 | lhg_update_title_by_string($pid, $title[$option], $mode); 188 | 189 | if ($mode == "drive") lhg_correct_drive_name($pid, $session); 190 | 191 | die(); 192 | 193 | } 194 | 195 | 196 | function lhg_amazon_search_by_title( $title, $region ) { 197 | 198 | #get price from LHG-PriceDB via URL 199 | # http://192.168.3.114/lhgupdatedb.php?mode=getprice&aid=B000EHIA06 200 | #returns URL, Image, Price 201 | 202 | if ( ($_SERVER['SERVER_ADDR'] == "192.168.56.12") or ($_SERVER['SERVER_ADDR'] == "192.168.56.13") ) 203 | $lhg_price_db_ip = "192.168.56.14"; 204 | 205 | if ( ($_SERVER['SERVER_ADDR'] == "192.168.3.112") or ($_SERVER['SERVER_ADDR'] == "192.168.3.113") ) 206 | $lhg_price_db_ip = "192.168.3.114"; 207 | 208 | $product=sanitize_text_field($title); 209 | $searchresult = file_get_contents('http://'.$lhg_price_db_ip.'/lhgupdatedb.php?mode=productsearch®ion='.$region.'&product='.$product); 210 | #error_log("Prod: $product"); 211 | 212 | # parse result 213 | $resultarray = explode("\n",$searchresult,100); 214 | 215 | foreach ($resultarray as $result) { 216 | #print "Res: $result
"; 217 | #print "POS: ".strpos($result,"Title1:")."
"; 218 | 219 | if (strpos($result,"itle1:") == 1 ) $title1=substr($result,7); 220 | if (strpos($result,"itle2:") == 1 ) $title2=substr($result,7); 221 | if (strpos($result,"itle3:") == 1 ) $title3=substr($result,7); 222 | 223 | if (strpos($result,"SIN1:") == 1 ) $asin1=substr($result,7); 224 | if (strpos($result,"SIN2:") == 1 ) $asin2=substr($result,7); 225 | if (strpos($result,"SIN3:") == 1 ) $asin3=substr($result,7); 226 | 227 | } 228 | 229 | $searchresult = array( $asin1, $title1, $asin2, $title2, $asin3, $title3); 230 | return $searchresult; 231 | } 232 | 233 | function lhg_get_correct_drive_name ( $title, $sid ) { 234 | 235 | global $dmesg_content_from_library; 236 | 237 | if ( $dmesg_content_from_library == "" ) { 238 | #error_log( "Download: $sid" ); 239 | $url="http://library.linux-hardware-guide.com/showdata.php?sid=".$sid."&file=dmesg.txt"; 240 | $dmesg_content_from_library = file_get_contents($url); 241 | } 242 | 243 | $dmesg_content_array = split("\n",$dmesg_content_from_library); 244 | #error_log( "Count: ".count($dmesg_content_array) ); 245 | 246 | # Seagate drives - remove 247 | if ( strpos($title,"Seagate") !== false ) { 248 | 249 | # extract main ID of HDD 250 | $part1 = "Seagate"; 251 | $searchfor = str_replace("Seagate ","", $title); 252 | #get HD name 253 | if (strpos($searchfor,"-") !== false) { 254 | $tmp = explode("-",$searchfor); 255 | $searchfor = $tmp[0]; 256 | } 257 | 258 | # check for full name 259 | $length = strlen($searchfor); 260 | $searchresult_array = preg_grep("/".$searchfor."/i",$dmesg_content_array); 261 | foreach($searchresult_array as $line) { 262 | $words = explode(" ",$line); 263 | $words_filtered = preg_grep("/".$searchfor."/i",$words); 264 | foreach ($words_filtered as $word) { 265 | if (substr($word,-1) == ",") $word = substr($word,0,-1); 266 | # check if we have more details 267 | if ( strlen($word) > $length ) { 268 | $length = strlen($word); 269 | $searchfor = $word; 270 | } 271 | } 272 | #error_log("found $line"); 273 | } 274 | $part2 = $searchfor; 275 | $title = $part1." ".$part2; 276 | }else { 277 | #error_log("OT: $title"); 278 | # Misc corrections 279 | $title = str_replace(" A "," ",$title); 280 | $title = str_replace("hp ","HP ",$title); 281 | $title = str_replace(" DVD "," ",$title); 282 | $title = str_replace(" "," ",$title); 283 | } 284 | 285 | //$dmi_line = implode("\n",$dmi_array); 286 | //$dmi_line = str_replace("[ 0.000000]","",$dmi_line); 287 | 288 | 289 | #error_log("Real name: $title"); 290 | 291 | return $title; 292 | } 293 | 294 | function lhg_correct_drive_name ( $pid, $sid ) { 295 | # updated drive title 296 | $title = get_the_title( $pid ); 297 | $tmp = explode("(",$title); 298 | $title_main = $tmp[0]; 299 | $title_props = " (".$tmp[1]; 300 | 301 | $corr = lhg_get_correct_drive_name ( $title_main , $sid ).$title_props; 302 | $corr = str_replace(" "," ",$corr); 303 | #error_log("Corr: $title_main -> $corr"); 304 | 305 | $my_post = array( 306 | 'ID' => $pid, 307 | 'post_title' => "".$corr."" 308 | ); 309 | wp_update_post ( $my_post ); 310 | 311 | } 312 | 313 | 314 | function lhg_search_string_from_drive_title ( $title, $sid ) { 315 | 316 | # could return multiple possible search strings 317 | # currently only one implemented. 318 | 319 | # use drive name correction 320 | $title = lhg_get_correct_drive_name ( $title, $sid); 321 | return $title; 322 | 323 | } 324 | 325 | # Which type of article are we working on? 326 | # cpu, drive, ... 327 | function lhg_get_autocreate_mode ( $pid ) { 328 | 329 | $categories = get_the_category( $pid ); 330 | foreach ($categories as $category) { 331 | if ( $category->term_id == 874 ) $type = "cpu"; 332 | if ( $category->term_id == 478 ) $type = "drive"; 333 | } 334 | 335 | return $type; 336 | } 337 | 338 | ?> 339 | -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/includes/lhg_chat.php: -------------------------------------------------------------------------------- 1 | 9 | 58 | 59 | -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/includes/lhg_json.php: -------------------------------------------------------------------------------- 1 | prepare( $sql, $guid ); 62 | $password = $lhg_price_db->get_var($safe_sql); 63 | 64 | if ( $password == $data["password"] ) { 65 | # password valid 66 | } else { 67 | lhg_json_error("invalid_password", ""); 68 | } 69 | 70 | }else{ 71 | lhg_json_error("invalid_password", ""); 72 | } 73 | 74 | 75 | #check postid server 76 | if ( ( $data["postid_server"] == "com" ) OR ( $data["postid_server"] == "de" ) ) { 77 | # either "com" or "de" server indicated as origin 78 | }else{ 79 | lhg_json_error("unknown_server", $data["postid_server"] ); 80 | } 81 | 82 | 83 | #check postid 84 | if ( is_numeric( $data["postid"] ) ) { 85 | 86 | if ( $data["postid_server"] == "com" ) $sql = "SELECT id FROM `lhgtransverse_posts` WHERE postid_com = \"%s\" "; 87 | if ( $data["postid_server"] == "de" ) $sql = "SELECT id FROM `lhgtransverse_posts` WHERE postid_de = \"%s\" "; 88 | $safe_sql = $lhg_price_db->prepare( $sql, $data["postid"] ); 89 | $dbid = $lhg_price_db->get_var($safe_sql); 90 | 91 | # check if postid exists in DB 92 | if ( $dbid > 0 ) { 93 | # postid exists 94 | } else { 95 | lhg_json_error("unknown_postid", $data["postid"] ); 96 | } 97 | 98 | # check if article already translated 99 | if ( $data["postid_server"] == "com" ) $sql = "SELECT postid_de FROM `lhgtransverse_posts` WHERE postid_com = \"%s\" "; 100 | if ( $data["postid_server"] == "de" ) $sql = "SELECT postid_com FROM `lhgtransverse_posts` WHERE postid_de = \"%s\" "; 101 | $safe_sql = $lhg_price_db->prepare( $sql, $data["postid"] ); 102 | $transverse_postid = $lhg_price_db->get_var($safe_sql); 103 | 104 | if ($request_type == "create") { 105 | 106 | if ( $transverse_postid == 0 ) { 107 | # post not yet translated 108 | } else { 109 | lhg_json_error("article_translated", $transverse_postid ); 110 | } 111 | } 112 | 113 | if ($request_type == "update" ) $update_allowed = lhg_check_update_by_json_allowed( $transverse_postid, $data["postid_server"], $data ); 114 | 115 | # all tests passed - start translation 116 | if ($request_type == "create") lhg_create_article_translation( $data["postid"], $data["postid_server"], $data ); 117 | if ( ($request_type == "update") && ($update_allowed === true) ) lhg_update_article_translation( $data["postid"], $data["postid_server"], $data ); 118 | 119 | 120 | }else{ 121 | lhg_json_error("unknown_postid", $data["postid"] ); 122 | } 123 | 124 | } 125 | 126 | function lhg_json_request_move_comment( $data ) { 127 | 128 | #error_log("autocreate: $request_type"); 129 | 130 | global $lhg_price_db; 131 | 132 | #check guid 133 | # auto translation only allowed from "admin" 134 | if ($_SERVER['SERVER_ADDR'] == "192.168.56.12") { 135 | $allowed_guid = 9; 136 | } 137 | 138 | if ($_SERVER['SERVER_ADDR'] == "192.168.56.13") { 139 | $allowed_guid = 9; 140 | } 141 | 142 | if ($_SERVER['SERVER_ADDR'] == "192.168.3.112") { 143 | $allowed_guid = 22; 144 | } 145 | 146 | if ($_SERVER['SERVER_ADDR'] == "192.168.3.113") { 147 | $allowed_guid = 22; 148 | } 149 | 150 | if ( ($data["comment_id"]) > 0) { 151 | # $guid = $allowed_guid; 152 | }else{ 153 | lhg_json_error("no_comment_id", $data["comment_id"] ); 154 | } 155 | 156 | 157 | #check password 158 | if ( $data["password"] != "" ) { 159 | $sql = "SELECT json_password FROM `lhgtransverse_users` WHERE id = \"%s\" "; 160 | $safe_sql = $lhg_price_db->prepare( $sql, $allowed_guid ); 161 | $password = $lhg_price_db->get_var($safe_sql); 162 | 163 | if ( $password == $data["password"] ) { 164 | # password valid 165 | } else { 166 | lhg_json_error("invalid_password", ""); 167 | } 168 | 169 | }else{ 170 | lhg_json_error("invalid_password", ""); 171 | } 172 | 173 | 174 | #check postid server 175 | if ( ( $data["commentid_server"] == "com" ) OR ( $data["commentid_server"] == "de" ) ) { 176 | # either "com" or "de" server indicated as origin 177 | }else{ 178 | lhg_json_error("unknown_server", $data["commentid_server"] ); 179 | } 180 | 181 | 182 | #check postid 183 | if ( is_numeric( $data["comment_postid"] ) ) { 184 | 185 | # check if original article exists 186 | if ( $data["commentid_server"] == "com" ) $sql = "SELECT id FROM `lhgtransverse_posts` WHERE postid_com = \"%s\" "; 187 | if ( $data["commentid_server"] == "de" ) $sql = "SELECT id FROM `lhgtransverse_posts` WHERE postid_de = \"%s\" "; 188 | $safe_sql = $lhg_price_db->prepare( $sql, $data["comment_postid"] ); 189 | $dbid = $lhg_price_db->get_var($safe_sql); 190 | 191 | 192 | # check if postid exists in DB 193 | if ( $dbid > 0 ) { 194 | # postid exists 195 | } else { 196 | lhg_json_error("unknown_postid", $data["comment_postid"] ); 197 | } 198 | 199 | # check if article already translated 200 | if ($request_type == "create") { 201 | if ( $data["commentid_server"] == "com" ) $sql = "SELECT postid_de FROM `lhgtransverse_posts` WHERE postid_com = \"%s\" "; 202 | if ( $data["commentid_server"] == "de" ) $sql = "SELECT postid_com FROM `lhgtransverse_posts` WHERE postid_de = \"%s\" "; 203 | $safe_sql = $lhg_price_db->prepare( $sql, $data["comment_postid"] ); 204 | $transverse_postid = $lhg_price_db->get_var($safe_sql); 205 | 206 | if ( $transverse_postid == 0 ) { 207 | lhg_json_error("article_not_translated", $transverse_postid ); 208 | } else { 209 | # 210 | } 211 | } 212 | 213 | # all tests passed - start translation 214 | lhg_create_comment_by_json_request( $data ); 215 | 216 | }else{ 217 | lhg_json_error("unknown_comment", $data["comment_id"] ); 218 | } 219 | 220 | } 221 | 222 | 223 | function lhg_json_error( $type , $value ) { 224 | 225 | if ($type == "invalid_password") { 226 | $data = array ( 227 | 'error_code' => 1, 228 | 'error_message' => "Invalid password" 229 | ); 230 | 231 | } elseif ($type == "invalid_guid") { 232 | $data = array ( 233 | 'error_code' => 2, 234 | 'error_message' => "Invalid GUID: $value" 235 | ); 236 | 237 | } elseif ($type == "unknown_postid") { 238 | $data = array ( 239 | 'error_code' => 3, 240 | 'error_message' => "Unknown post ID: $value" 241 | ); 242 | 243 | } elseif ($type == "unknown_server") { 244 | $data = array ( 245 | 'error_code' => 4, 246 | 'error_message' => "Unknown server: $value" 247 | ); 248 | 249 | } elseif ($type == "article_translated") { 250 | $data = array ( 251 | 'error_code' => 5, 252 | 'error_message' => "Article is already translated: $value" 253 | ); 254 | 255 | } elseif ($type == "no_comment_id") { 256 | $data = array ( 257 | 'error_code' => 6, 258 | 'error_message' => "No comment ID provided: $value" 259 | 260 | ); 261 | 262 | } elseif ($type == "article_not_translated") { 263 | $data = array ( 264 | 'error_code' => 7, 265 | 'error_message' => "Article is not yet translated: $value" 266 | ); 267 | 268 | } elseif ($type == "unknown_comment") { 269 | $data = array ( 270 | 'error_code' => 8, 271 | 'error_message' => "Unknown comment: $value" 272 | ); 273 | 274 | 275 | } elseif ($type == "update_check_failed") { 276 | $data = array ( 277 | 'error_code' => 9, 278 | 'error_message' => "Article can not be updated. Check failed for post ID: $value" 279 | ); 280 | 281 | 282 | } else { 283 | $data = array ( 284 | 'error_code' => 999, 285 | 'error_message' => "Unknown error: $type, $value" 286 | ); 287 | } 288 | 289 | # General logging disabled due to high amount of messages 290 | # only useful for debugging 291 | error_log("JSON error: ".json_encode($data)); 292 | 293 | print json_encode($data); 294 | exit; 295 | } 296 | 297 | 298 | # check if we can overwrite an article with an automatic translation 299 | # input: postid of local server (not the original one) 300 | function lhg_check_update_by_json_allowed( $postid, $postid_server, $data ) { 301 | 302 | global $lang; 303 | global $lhg_price_db; 304 | 305 | 306 | # get last date of article editing 307 | if ($lang != "de") $sql = "SELECT MAX(timestamp) FROM `lhgtransverse_post_history` WHERE change_type = \"%s\" AND guid > 0 AND postid_com = \"%s\" "; 308 | if ($lang == "de") $sql = "SELECT MAX(timestamp) FROM `lhgtransverse_post_history` WHERE change_type = \"%s\" AND guid > 0 AND postid_de = \"%s\" "; 309 | $safe_sql = $lhg_price_db->prepare( $sql, "article_edited", $postid ); 310 | $timestamp_last_edit = $lhg_price_db->get_var($safe_sql); 311 | 312 | # get last date of automatic translation 313 | if ($lang != "de") $sql = "SELECT MAX(timestamp) FROM `lhgtransverse_post_history` WHERE change_type = \"%s\" AND postid_com = \"%s\" "; 314 | if ($lang == "de") $sql = "SELECT MAX(timestamp) FROM `lhgtransverse_post_history` WHERE change_type = \"%s\" AND postid_de = \"%s\" "; 315 | if ($lang == "de") $safe_sql = $lhg_price_db->prepare( $sql, "auto_translation_en->de", $postid ); 316 | if ($lang != "de") $safe_sql = $lhg_price_db->prepare( $sql, "auto_translation_de->en", $postid ); 317 | $timestamp_autotranslation = $lhg_price_db->get_var($safe_sql); 318 | 319 | # get last date of automatic translation update 320 | if ($lang != "de") $sql = "SELECT MAX(timestamp) FROM `lhgtransverse_post_history` WHERE change_type = \"%s\" AND postid_com = \"%s\" "; 321 | if ($lang == "de") $sql = "SELECT MAX(timestamp) FROM `lhgtransverse_post_history` WHERE change_type = \"%s\" AND postid_de = \"%s\""; 322 | if ($lang == "de") $safe_sql = $lhg_price_db->prepare( $sql, "auto_translation_update_en->de", $postid ); 323 | if ($lang != "de") $safe_sql = $lhg_price_db->prepare( $sql, "auto_translation_update_de->en", $postid ); 324 | $timestamp_autoupdate = $lhg_price_db->get_var($safe_sql); 325 | 326 | #error_log("PID: $postid TLE: $timestamp_last_edit - TAU: $timestamp_autoupdate TAT: $timestamp_autotranslation "); 327 | 328 | 329 | if ($timestmap_autotranslation == "") $timestmap_autotranslation = 0; 330 | if ($timestmap_autoupdate == "") $timestmap_autoupdate = 0; 331 | if ($timestmap_last_edit == "") $timestmap_last_edit = 0; 332 | 333 | $update_allowed = false; # failsave mode 334 | 335 | if ( $timestamp_last_edit > max( $timestmap_autotranslation, $timestamp_autoupdate ) ) { 336 | # article was already manually edited 337 | # Do not overwrite 338 | $update_allowed = false; 339 | #error_log("1"); 340 | } 341 | 342 | if ( $timestamp_last_edit < max($timestmap_autotranslation, $timestamp_autoupdate ) ) { 343 | # current article status is based on atomatic translation 344 | # can be updated 345 | $update_allowed = true; 346 | #error_log("2"); 347 | } 348 | 349 | if ( ($timestamp_last_edit == 0 ) && ($timestamp_autoupdate == 0) && ($timestamp_autotranslation == 0) ) { 350 | # Unknown status - nothing found in history database 351 | # Do not overwrite 352 | $update_allowed = false; 353 | #error_log("3"); 354 | 355 | } 356 | 357 | if ( ($timestamp_last_edit == 0 ) && ($timestamp_autoupdate > 0) && ($timestamp_autotranslation == 0) ) { 358 | # Unknown status - nothing found in history database 359 | # Do not overwrite 360 | $update_allowed = true; 361 | #error_log("4"); 362 | 363 | } 364 | 365 | if ( ($timestamp_last_edit == 0 ) && ($timestamp_autoupdate == 0) && ($timestamp_autotranslation > 0) ) { 366 | # Unknown status - nothing found in history database 367 | # Do not overwrite 368 | $update_allowed = true; 369 | #error_log("5"); 370 | 371 | } 372 | 373 | #error_log("TLE: $timestamp_last_edit - TAU: $timestamp_autoupdate TAT: $timestamp_autotranslation "); 374 | 375 | if ($update_allowed === false) lhg_json_error("update_check_failed", $postid ); 376 | 377 | return $update_allowed; 378 | 379 | } 380 | 381 | ?> 382 | -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/includes/lhg_menu_tags.php: -------------------------------------------------------------------------------- 1 | 0 ) && ( $_POST[id_de] > 0) ) lhg_link_tags($_POST[id_com],$_POST[id_de]); 8 | 9 | 10 | 11 | #if ($_POST != "") lhg_db_update_scaninfo(); 12 | 13 | 14 | # $res = lhg_db_get_scan_sids (); 15 | print "

Tag overview

"; 16 | print "
"; 17 | 18 | 19 | global $wpdb; 20 | 21 | $sql1 = "SELECT $wpdb->terms.term_id, $wpdb->terms.name, $wpdb->terms.slug 22 | FROM $wpdb->terms"; 23 | 24 | $sql2 = "SELECT $wpdb->term_taxonomy.term_id, $wpdb->term_taxonomy.taxonomy, $wpdb->term_taxonomy.term_taxonomy_id 25 | FROM $wpdb->term_taxonomy"; 26 | 27 | # works but everything included 28 | #$sql = "SELECT $wpdb->terms.term_id, $wpdb->terms.name, $wpdb->terms.slug 29 | # FROM $wpdb->terms"; 30 | 31 | #$sql = "SELECT $wpdb->term_taxonomy.term_id, $wpdb->term_taxonomy.name, $wpdb->term_taxonomy.slug 32 | # FROM $wpdb->term_taxonomy"; 33 | $safe_sql1 = $wpdb->prepare( $sql1 ); 34 | $results1 = $wpdb->get_results( $safe_sql1, OBJECT ); 35 | 36 | $safe_sql2 = $wpdb->prepare( $sql2 ); 37 | $results2 = $wpdb->get_results( $safe_sql2, OBJECT ); 38 | 39 | #$sql = ("SELECT term_id FROM $wpdb->wp_term_taxonomy"); 40 | #$result = $wpdb->get_results($sql); 41 | 42 | #if (0 < $numtags) $numtags = number_format($numtags); 43 | #echo $numtags . ''; 44 | #print "Tag List"; 45 | #var_dump($results2); 46 | 47 | 48 | 49 | #print "POST:"; 50 | #var_dump ( $_POST ); 51 | 52 | #var_dump( $res ); 53 | 54 | 55 | 56 | $i=0; 57 | foreach ($results2 as $result) { 58 | $i++; 59 | $tid = $result->term_id; 60 | $ttid = $result->term_taxonomy_id; 61 | #$name = $result->name; 62 | $tax = $result->taxonomy; 63 | 64 | 65 | $slug = lhg_get_slug_by_termid($tid); 66 | $name = lhg_get_name_by_termid($tid); 67 | 68 | 69 | 70 | #$date = gmdate("m/d/Y g:i:s A", $time); 71 | #$acomment = $resN->admincomment; 72 | #$ucomment = $resN->usercomment; 73 | #$ucomment_short = $ucomment; 74 | #if (strlen($ucomment) > 50) 75 | # $ucomment_short = substr(sanitize_text_field($ucomment),0,50)."..."; 76 | # 77 | #$status = $resN->status; 78 | #$sid2 = $res[1]->sid; 79 | #var_dump ($sid ."--".$sid2); 80 | #print "SID: $sid
"; 81 | 82 | if ($tax == "post_tag") { 83 | global $lang; 84 | #print "TID: $tid -- $ttid -- $name -- $slug -- $tax
"; 85 | if ($lang == "en") lhg_check_slug_com_available( $slug ); 86 | if ($lang == "de") lhg_check_slug_de_available( $slug ); 87 | } else { 88 | # skip 89 | } 90 | # print ""; 91 | # 92 | # print "$date "; 93 | # print ''.$sid.''; 94 | # print "$ucomment_short"; 95 | # print ' 96 | # 97 | # '; 98 | # print "$status"; 99 | # 100 | # print ""; 101 | 102 | } 103 | 104 | # 105 | # Linking table 106 | # 107 | 108 | global $lhg_price_db; 109 | 110 | $sql = "SELECT * FROM `lhgtransverse_tags` WHERE `slug_de` = 0 OR `slug_com` = 0 ORDER BY slug_de, slug_com DESC "; 111 | $result = $lhg_price_db->get_results($sql); 112 | 113 | #echo "FOUND:"; 114 | #var_dump($result); 115 | 116 | print '
'; 117 | print ' 118 | 119 | 120 | 121 | 122 | 123 | '; 124 | 125 | 126 | for ($i=0; $islug_com == "") or ($result[$i]->slug_de == "") ) { 129 | 130 | print ""; 131 | print ""; 132 | print ""; 133 | 134 | print ''; 137 | 138 | print ''; 141 | 142 | 143 | print ""; 144 | } 145 | } 146 | 147 | echo "
Slug COMSlug DE
".$result[$i]->slug_com."".$result[$i]->slug_de."'; 135 | if ($result[$i]->slug_com != "") echo ''; 136 | print ''; 139 | if ($result[$i]->slug_de != "") echo ''; 140 | print '
"; 148 | 149 | echo ""; 150 | echo "
"; 151 | 152 | } 153 | 154 | function lhg_check_slug_com_available( $slug ) { 155 | # check if slug is in DB, otherwise -> add 156 | 157 | global $lhg_price_db; 158 | 159 | $sql = "SELECT id FROM `lhgtransverse_tags` WHERE slug_com = \"".$slug."\""; 160 | $result = $lhg_price_db->get_var($sql); 161 | 162 | #echo "RES: -- $result --"; 163 | #var_dump($result); 164 | 165 | if ($result == "" ) { 166 | #echo "create $slug ... "; 167 | $sql = "INSERT INTO lhgtransverse_tags (slug_com) VALUES ('".$slug."')"; 168 | $result = $lhg_price_db->query($sql); 169 | $error = $lhg_price_db->last_error; 170 | if ($error != "") var_dump($error); 171 | #echo "done
"; 172 | }else{ 173 | #echo "$slug exists
"; 174 | } 175 | 176 | return $result; 177 | 178 | 179 | } 180 | 181 | function lhg_check_slug_de_available( $slug ) { 182 | # check if slug is in DB, otherwise -> add 183 | 184 | global $lhg_price_db; 185 | 186 | $sql = "SELECT id FROM `lhgtransverse_tags` WHERE slug_de = \"".$slug."\""; 187 | $result = $lhg_price_db->get_var($sql); 188 | 189 | #echo "RES: -- $result --"; 190 | #var_dump($result); 191 | 192 | if ($result == "" ) { 193 | echo "create $slug ... "; 194 | $sql = "INSERT INTO lhgtransverse_tags (slug_de) VALUES ('".$slug."')"; 195 | $result = $lhg_price_db->query($sql); 196 | $error = $lhg_price_db->last_error; 197 | if ($error != "") var_dump($error); 198 | echo "done
"; 199 | }else{ 200 | echo "$slug exists
"; 201 | } 202 | 203 | return $result; 204 | 205 | 206 | } 207 | 208 | 209 | function lhg_get_slug_by_termid ( $tid) { 210 | 211 | #print "TID: $tid"; 212 | 213 | global $wpdb; 214 | $sql1 = "SELECT $wpdb->terms.slug 215 | FROM $wpdb->terms WHERE $wpdb->terms.term_id = ".$tid; 216 | 217 | $safe_sql1 = $wpdb->prepare( $sql1 ); 218 | $results1 = $wpdb->get_results( $safe_sql1, OBJECT ); 219 | #var_dump($results1); 220 | return $results1[0]->slug; 221 | } 222 | 223 | function lhg_get_name_by_termid ( $tid) { 224 | 225 | #print "TID: $tid"; 226 | 227 | global $wpdb; 228 | $sql1 = "SELECT $wpdb->terms.name 229 | FROM $wpdb->terms WHERE $wpdb->terms.term_id = ".$tid; 230 | 231 | $safe_sql1 = $wpdb->prepare( $sql1 ); 232 | $results1 = $wpdb->get_results( $safe_sql1, OBJECT ); 233 | #var_dump($results1); 234 | return $results1[0]->name; 235 | } 236 | 237 | function lhg_link_tags ( $id_com, $id_de ) { 238 | global $lhg_price_db; 239 | 240 | echo "Link the tags ... $id_com - $id_de
"; 241 | 242 | # 1. add slug_de to slug_com 243 | 244 | $sql = "SELECT slug_de FROM `lhgtransverse_tags` WHERE id = \"".$id_de."\""; 245 | $slug_de = $lhg_price_db->get_var($sql); 246 | 247 | $sql = "UPDATE `lhgtransverse_tags` SET slug_de = '".$slug_de."' WHERE id = \"".$id_com."\""; 248 | $result = $lhg_price_db->query($sql); 249 | 250 | # 2. delete slug_de 251 | $sql = "DELETE FROM lhgtransverse_tags WHERE `id` = $id_de "; 252 | $result = $lhg_price_db->query($sql); 253 | 254 | } 255 | -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/includes/lhg_post_history.php: -------------------------------------------------------------------------------- 1 | prepare( $sql, $guid, $timestamp-1, $results[0]->donation_target_com); 40 | #$result = $lhg_price_db->query($safe_sql); 41 | 42 | } 43 | 44 | if ( ($lang_from == "en") && ($lang_to == "de") ) { 45 | $timestamp = time(); 46 | $sql = "INSERT INTO lhgtransverse_post_history ( timestamp, postid_com, postid_de, change_type, change_comment, guid) VALUES ('%s', '%s', '%s', '%s', '%s', '%s') "; 47 | $safe_sql = $lhg_price_db->prepare( $sql, $timestamp, $postid_from, $postid_to, "auto_translation_en->de", "Automatic translation from ".$postid_from." to ".$postid_to, $guid); 48 | $result = $lhg_price_db->query($safe_sql); 49 | } 50 | 51 | return; 52 | } 53 | 54 | function lhg_post_history_translation_update( $lang_from, $lang_to, $postid_from, $postid_to, $guid) { 55 | 56 | global $lhg_price_db; 57 | 58 | if ( ($lang_from == "de") && ($lang_to == "en") ) { 59 | #$sql = "INSERT INTO lhgtransverse_post_history ( timestamp, postid_com, postid_de, change_type, change_comment, guid) VALUES ('%s', '%s', '%s', '%s', '%s', '%s') "; 60 | #$safe_sql = $lhg_price_db->prepare( $sql, $guid, $timestamp-1, $results[0]->donation_target_com); 61 | #$result = $lhg_price_db->query($safe_sql); 62 | 63 | } 64 | 65 | if ( ($lang_from == "en") && ($lang_to == "de") ) { 66 | $timestamp = time(); 67 | $sql = "INSERT INTO lhgtransverse_post_history ( timestamp, postid_com, postid_de, change_type, change_comment, guid) VALUES ('%s', '%s', '%s', '%s', '%s', '%s') "; 68 | $safe_sql = $lhg_price_db->prepare( $sql, $timestamp, $postid_from, $postid_to, "auto_translation_update_en->de", "Automatic translation update from ".$postid_from." to ".$postid_to, $guid); 69 | $result = $lhg_price_db->query($safe_sql); 70 | } 71 | 72 | return; 73 | } 74 | 75 | 76 | # article was created by hardware scan 77 | # we save only the scan's session ID since the link to its 78 | # user could change at any given time 79 | function lhg_post_history_scancreate( $postid, $sid ) { 80 | 81 | global $lhg_price_db; 82 | global $lang; 83 | $timestamp = time(); 84 | 85 | if ($lang == "de") $sql = "INSERT INTO lhgtransverse_post_history ( timestamp, postid_de, change_type, change_comment) VALUES ('%s', '%s', '%s', '%s') "; 86 | if ($lang != "de") $sql = "INSERT INTO lhgtransverse_post_history ( timestamp, postid_com, change_type, change_comment) VALUES ('%s', '%s', '%s', '%s') "; 87 | 88 | $safe_sql = $lhg_price_db->prepare( $sql, $timestamp, $postid, "article_created_by_scan", $sid ); 89 | $result = $lhg_price_db->query($safe_sql); 90 | 91 | $error = $lhg_price_db->last_error; 92 | if ($error != "") { var_dump($error); exit; } 93 | 94 | return; 95 | } 96 | 97 | 98 | function lhg_post_history_published( $postid, $guid) { 99 | 100 | if ($postid == "") { 101 | error_log("Empty postid lhg_post_history_published()"); 102 | return; 103 | } 104 | 105 | global $lhg_price_db; 106 | global $lang; 107 | $timestamp = time(); 108 | 109 | # check if article was already published 110 | if ($lang == "de") $sql = "SELECT id FROM lhgtransverse_post_history WHERE postid_de = '%s' AND change_type = '%s'"; 111 | if ($lang != "de") $sql = "SELECT id FROM lhgtransverse_post_history WHERE postid_com = '%s' AND change_type = '%s' "; 112 | $safe_sql = $lhg_price_db->prepare( $sql, $postid, "article_published" ); 113 | $result = $lhg_price_db->get_var($safe_sql); 114 | 115 | if ( ($result > 0) ) return; # post exists, we do not need to create corresponding history entry 116 | 117 | 118 | 119 | # write to DB 120 | if ($lang == "de") $sql = "INSERT INTO lhgtransverse_post_history ( timestamp, postid_de, change_type, change_comment, guid) VALUES ('%s', '%s', '%s', '%s', '%s') "; 121 | if ($lang != "de") $sql = "INSERT INTO lhgtransverse_post_history ( timestamp, postid_com, change_type, change_comment, guid) VALUES ('%s', '%s', '%s', '%s', '%s') "; 122 | 123 | $safe_sql = $lhg_price_db->prepare( $sql, $timestamp, $postid, "article_published", "Article ".$postid." was published by ".$guid, $guid); 124 | $result = $lhg_price_db->query($safe_sql); 125 | 126 | $error = $lhg_price_db->last_error; 127 | if ($error != "") { var_dump($error); exit; } 128 | 129 | 130 | return; 131 | } 132 | 133 | function lhg_post_history_edit( $postid, $guid) { 134 | 135 | global $lhg_price_db; 136 | global $lang; 137 | $timestamp = time(); 138 | 139 | # check if this edit request is coming together with a publishing 140 | # (Wordpress initiates publishing action and immediately afterwards the editing ection) 141 | # In this case published and edited article are identical 142 | # dirty hack: 143 | 144 | if ($lang == "de") $sql = "SELECT MAX(timestamp) FROM lhgtransverse_post_history WHERE postid_de = '%s' AND change_type = '%s'"; 145 | if ($lang != "de") $sql = "SELECT MAX(timestamp) FROM lhgtransverse_post_history WHERE postid_com = '%s' AND change_type = '%s' "; 146 | $safe_sql = $lhg_price_db->prepare( $sql, $postid, "article_published" ); 147 | $result = $lhg_price_db->get_var($safe_sql); 148 | 149 | if ( ($timestamp - $result) < 4 ) { 150 | # No one can edit the article this quickly 151 | return; 152 | } 153 | 154 | 155 | # write to DB 156 | if ($lang == "de") $sql = "INSERT INTO lhgtransverse_post_history ( timestamp, postid_de, change_type, change_comment, guid) VALUES ('%s', '%s', '%s', '%s', '%s') "; 157 | if ($lang != "de") $sql = "INSERT INTO lhgtransverse_post_history ( timestamp, postid_com, change_type, change_comment, guid) VALUES ('%s', '%s', '%s', '%s', '%s') "; 158 | 159 | $safe_sql = $lhg_price_db->prepare( $sql, $timestamp, $postid, "article_edited", "Article ".$postid." was edited by ".$guid, $guid); 160 | $result = $lhg_price_db->query($safe_sql); 161 | 162 | $error = $lhg_price_db->last_error; 163 | if ($error != "") { var_dump($error); exit; } 164 | 165 | return; 166 | } 167 | 168 | 169 | 170 | # 171 | # 172 | ## hook related functions 173 | 174 | 175 | function lhg_post_history_save_post( $postid ) { 176 | 177 | 178 | #if ( wp_is_post_revision( $postid ) ) return; 179 | 180 | #error_log("post $postid saved"); 181 | } 182 | 183 | function lhg_post_history_edit_post( $postid ) { 184 | #error_log("post $postid modified"); 185 | 186 | $uid = get_current_user_id(); 187 | $guid = lhg_get_guid_from_uid( $uid ); 188 | 189 | # write to history that article was published 190 | lhg_post_history_edit ( $postid, $guid); 191 | 192 | } 193 | 194 | function lhg_post_history_publish_post( $post ) { 195 | 196 | $postid = $post->ID; 197 | $uid = get_current_user_id(); 198 | $guid = lhg_get_guid_from_uid( $uid ); 199 | 200 | # write to history that article was published 201 | lhg_post_history_published ( $postid, $guid); 202 | } 203 | 204 | function lhg_post_history_created_post( $postid, $post ) { 205 | 206 | 207 | #if ( wp_is_post_revision( $postid ) ) error_log("cond1"); 208 | #if ( !wp_is_post_revision( $postid ) ) error_log("cond2"); 209 | # 210 | #error_log("post $postid created? $update"); 211 | } 212 | 213 | 214 | 215 | ?> 216 | -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/includes/lhg_pricedb_functions.php: -------------------------------------------------------------------------------- 1 | 0 ORDER BY shop_last_price_float"; 25 | $result = $lhg_price_db->get_var($sql); 26 | #print "
SQL: $sql"; 27 | if ($result == "") $result = 0; 28 | return $result; 29 | 30 | } 31 | 32 | # Create row for Amazon price in DB 33 | function lhg_amazon_create_db_entry( $region, $postid, $asin ){ 34 | 35 | #print "Reg: $region"; 36 | #print "PID: $postid"; 37 | #print "AID: $asin
"; 38 | #print "Pr: $price
"; 39 | #print "URL: $url
"; 40 | #print "Date: $time
"; 41 | 42 | $shopid = 0; 43 | 44 | # Amazon shop ids 45 | # could be extracted from DB, if needed for flexibility 46 | if ($region == "de") $shopid = 4; 47 | if ($region == "it") $shopid = 6; 48 | if ($region == "com") $shopid = 7; 49 | if ($region == "co.uk") $shopid = 8; 50 | if ($region == "ca") $shopid = 9; 51 | if ($region == "fr") $shopid = 10; 52 | if ($region == "in") $shopid = 11; 53 | if ($region == "co.jp") $shopid = 12; 54 | if ($region == "cn") $shopid = 13; 55 | if ($region == "es") $shopid = 14; 56 | 57 | if ($shopid == 0) return; 58 | 59 | # check if entry exists 60 | $DBid = lhg_amazon_db_entry_exists($shopid, $postid, $asin); 61 | #print "
DBID: $DBid"; 62 | 63 | if ($DBid > 0) { 64 | # Update DB entry 65 | # nothing to do 66 | }else{ 67 | #create new entry but without price information 68 | $time = 1; # ensures update by script 69 | global $lhg_price_db; 70 | $sql = "INSERT INTO lhgprices (lhg_article_id, shop_id, shop_article_id, last_update) 71 | VALUES ('$postid', '$shopid', '$asin', '$time' )"; 72 | $result = $lhg_price_db->query($sql); 73 | $error = $lhg_price_db->last_error; 74 | if ($error != "") var_dump($error); 75 | 76 | # Create DB entry 77 | #lhg_create_amazon_db_entry($shopid, $postid, $asin, $price, $url, $time); 78 | } 79 | } 80 | 81 | function lhg_amazon_price_to_db($region, $postid, $asin, $price, $url, $time){ 82 | 83 | #print "Reg: $region"; 84 | #print "PID: $postid"; 85 | #print "AID: $asin
"; 86 | #print "Pr: $price
"; 87 | #print "URL: $url
"; 88 | #print "Date: $time
"; 89 | 90 | $shopid = 0; 91 | 92 | # Amazon shop ids 93 | # could be extracted from DB, if needed for flexibility 94 | if ($region == "de") $shopid = 4; 95 | if ($region == "it") $shopid = 6; 96 | if ($region == "com") $shopid = 7; 97 | if ($region == "co.uk") $shopid = 8; 98 | if ($region == "ca") $shopid = 9; 99 | if ($region == "fr") $shopid = 10; 100 | if ($region == "in") $shopid = 11; 101 | if ($region == "co.jp") $shopid = 12; 102 | if ($region == "cn") $shopid = 13; 103 | if ($region == "es") $shopid = 14; 104 | 105 | if ($shopid == 0) return; 106 | 107 | # check if entry exists 108 | $DBid = lhg_amazon_db_entry_exists($shopid, $postid, $asin); 109 | #print "
DBID: $DBid"; 110 | 111 | if ($DBid > 0) { 112 | # Update DB entry 113 | lhg_update_amazon_db_entry($DBid, $price, $url, $time); 114 | }else{ 115 | # Create DB entry 116 | lhg_create_amazon_db_entry($shopid, $postid, $asin, $price, $url, $time); 117 | } 118 | } 119 | 120 | 121 | # Check if DB entry already exists. Return id of entry. 122 | # 0 means: no entry found 123 | function lhg_amazon_db_entry_exists($shopid, $postid, $asin){ 124 | 125 | global $lhg_price_db; 126 | $sql = "SELECT id FROM `lhgprices` WHERE (lhg_article_id = ".$postid." AND shop_id = ".$shopid.") AND shop_article_id = '".$asin."'"; 127 | $result = $lhg_price_db->get_var($sql); 128 | #print "
SQL: $sql"; 129 | if ($result == "") $result = 0; 130 | return $result; 131 | } 132 | 133 | # create entry in lhgprices DB 134 | function lhg_create_amazon_db_entry($shopid, $postid, $asin, $price, $url, $time){ 135 | 136 | global $lhg_price_db; 137 | $sql = "INSERT INTO lhgprices (lhg_article_id, shop_id, shop_url, shop_article_id, last_update, shop_last_price) 138 | VALUES ('$postid', '$shopid', '$url', '$asin', '$time' , '$price' )"; 139 | 140 | $result = $lhg_price_db->query($sql); 141 | 142 | $error = $lhg_price_db->last_error; 143 | if ($error != "") var_dump($error); 144 | 145 | return $result; 146 | 147 | } 148 | 149 | # update existing price entry 150 | function lhg_update_amazon_db_entry($id, $price, $url, $time){ 151 | 152 | #print "
UPDATE"; 153 | 154 | global $lhg_price_db; 155 | $sql = "UPDATE lhgprices SET shop_url = '$url' , last_update = '$time', shop_last_price = '$price' 156 | WHERE id = $id"; 157 | 158 | $result = $lhg_price_db->query($sql); 159 | 160 | $error = $lhg_price_db->last_error; 161 | if ($error != "") var_dump($error); 162 | 163 | return $result; 164 | 165 | } 166 | 167 | 168 | ?> 169 | -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/includes/lhg_pricedb_update.php: -------------------------------------------------------------------------------- 1 | Updating data base.."; 74 | 75 | $result = lhg_db_update( $shop_article_id, "shop_article_id", $lhg_db_id); 76 | 77 | 78 | //echo "$result"; 79 | echo ".. done"; 80 | 81 | echo "
refresh database.."; 82 | lhg_refresh_database_entry($lhg_db_id, $shop_id); 83 | echo "..done"; 84 | 85 | 86 | lhg_show_update_table ($shop_id, $post_id, $lhg_db_id); 87 | 88 | } 89 | 90 | 91 | function lhg_show_update_table($shop_id, $post_id, $lhg_db_id) { 92 | echo "

Update properties:

"; 93 | 94 | echo '
'; 95 | echo ''; 96 | 97 | //ToDo: nonce check missing! 98 | 99 | echo ""; 100 | 101 | $title=get_the_title ( $post_id ); 102 | $art_image=get_the_post_thumbnail( $post_id, array(55,55) ); 103 | 104 | $shop_img = lhg_get_shop_small_icon($shop_id); 105 | 106 | 107 | echo ""; 108 | echo ""; 109 | 110 | 111 | echo ""; 112 | echo ""; 113 | 114 | echo ""; 115 | echo ''; 116 | echo ""; 117 | 118 | echo "'; 119 | echo ''; 120 | echo ""; 121 | 122 | echo "'; 125 | echo ""; 126 | 127 | //get article ID 128 | $shop_article_id = lhg_db_get_shop_article_id ( $post_id, $shop_id); 129 | 130 | echo ''; 131 | echo ""; 132 | 133 | $price = lhg_db_get_shop_price ($post_id, $shop_id); 134 | echo ""; 135 | echo ""; 136 | 137 | $aff_url = lhg_db_get_shop_url ($post_id, $shop_id); 138 | echo ""; 139 | 140 | echo "
Title:$title
Image:$art_image
Post ID:$post_id
Shop ID:$shop_id".'
LHG DB ID:$lhg_db_id"; 123 | echo ' 124 |
Article ID of shop:
Price:$price
Affiliate URL:$aff_url
"; 141 | 142 | echo ''; 143 | 144 | echo "
"; 145 | } 146 | 147 | function lhg_show_create_table($shop_id, $post_id) { 148 | 149 | echo "

Create Entry:

"; 150 | 151 | echo '
'; 152 | echo ''; 153 | 154 | 155 | //ToDo: nonce check missing! 156 | 157 | echo ""; 158 | 159 | $title=get_the_title ( $post_id ); 160 | $art_image=get_the_post_thumbnail( $post_id, array(55,55) ); 161 | $shop_img = lhg_get_shop_small_icon($shop_id); 162 | 163 | 164 | echo ""; 165 | echo ""; 166 | 167 | 168 | echo ""; 169 | echo ""; 170 | 171 | echo ""; 172 | echo ''; 173 | echo ""; 174 | 175 | echo "'; 176 | echo ''; 177 | echo ""; 178 | 179 | echo ""; 180 | echo ""; 181 | 182 | echo ''; 183 | echo ""; 184 | 185 | echo ""; 186 | echo ""; 187 | 188 | $aff_url = lhg_db_get_shop_url ($post_id, $shop_id); 189 | echo ""; 190 | 191 | echo "
Title:$title
Image:$art_image
Post ID:$post_id
Shop ID:$shop_id".'
LHG DB ID:Will be created
Article ID of shop:
Price:Will be created
Affiliate URL:Will be created
"; 192 | 193 | echo ''; 194 | 195 | echo "
"; 196 | 197 | } 198 | 199 | function lhg_show_created_table() { 200 | 201 | $shop_id = $_POST ["shop_id"]; 202 | $post_id = $_POST ["post_id"]; 203 | $shop_article_id = $_POST ["shop_article_id"]; 204 | 205 | //var_dump ($_POST); 206 | echo "
Create data base entry.."; 207 | 208 | $result = lhg_db_create_entry( $post_id, $shop_id, $shop_article_id ); 209 | 210 | //echo "$result"; 211 | echo ".. done"; 212 | 213 | //get newly created lhg_db_id 214 | 215 | $lhg_db_id = lhg_db_get_id ( $post_id, $shop_id); 216 | lhg_refresh_database_entry($lhg_db_id,$shop_id); 217 | lhg_show_update_table ($shop_id, $post_id, $lhg_db_id); 218 | 219 | } 220 | 221 | function lhg_show_notavail_table($shop_id, $post_id) { 222 | 223 | 224 | global $lhg_price_db; 225 | $time = time(); 226 | echo "TIME: $time"; 227 | 228 | $shop_article_id = "NOT_AVAILABLE"; 229 | $result = lhg_db_create_entry( $post_id, $shop_id, $shop_article_id ); 230 | echo ".. done"; 231 | 232 | //get newly created lhg_db_id 233 | $lhg_db_id = lhg_db_get_id ( $post_id, $shop_id); 234 | 235 | 236 | $sql = "UPDATE lhgprices SET `last_update` = $time WHERE `id` = $lhg_db_id " ; 237 | $result = $lhg_price_db->query($sql); 238 | 239 | echo "

Not Available:

"; 240 | 241 | #echo '
'; 242 | #echo ''; 243 | 244 | 245 | //ToDo: nonce check missing! 246 | 247 | echo ""; 248 | 249 | $title=get_the_title ( $post_id ); 250 | $art_image=get_the_post_thumbnail( $post_id, array(55,55) ); 251 | $shop_img = lhg_get_shop_small_icon($shop_id); 252 | 253 | 254 | echo ""; 255 | echo ""; 256 | 257 | 258 | echo ""; 259 | echo ""; 260 | 261 | echo ""; 262 | echo ''; 263 | echo ""; 264 | 265 | echo "'; 266 | echo ''; 267 | echo ""; 268 | 269 | echo ''; 270 | echo ""; 271 | 272 | echo "
Title:$title
Image:$art_image
Post ID:$post_id
Shop ID:$shop_id".'
Article ID of shop:Not Available
"; 273 | 274 | } 275 | 276 | 277 | function lhg_refresh_database_entry($shop_article_id,$shop_id) { 278 | 279 | //echo "
1 (send update request)"; 280 | 281 | //$r = new HttpRequest( '192.168.3.114/updatedb.pl?aid='.$shop_aricle_id); 282 | if ( ($_SERVER['SERVER_ADDR'] == "192.168.56.12") or ($_SERVER['SERVER_ADDR'] == "192.168.56.13") ) 283 | $url = 'http://192.168.56.14/lhgupdatedb.php?aid='.$shop_article_id."&sid=".$shop_id; 284 | 285 | if ( ($_SERVER['SERVER_ADDR'] == "192.168.3.112") or ($_SERVER['SERVER_ADDR'] == "192.168.3.113") ) 286 | $url = 'http://192.168.3.114/lhgupdatedb.php?aid='.$shop_article_id."&sid=".$shop_id; 287 | 288 | //echo "
URL $url"; 289 | 290 | $respTMP = wp_remote_post( $url ); 291 | $resp = $respTMP["body"]; 292 | //echo "
2 Response:
"; 293 | //print_r($resp); 294 | return $resp; 295 | 296 | } 297 | 298 | 299 | function lhg_show_missing_links () { 300 | echo "

Checking missing links:

"; 301 | 302 | global $lhg_price_db; 303 | 304 | $sql = "SELECT * FROM `lhgtransverse_posts` WHERE (postid_de = 0 OR postid_com = 0) AND (status_com = \"published\" OR status_com = \"\") ORDER BY product"; 305 | $result = $lhg_price_db->get_results($sql); 306 | 307 | #$result = $lhg_price_db->query($sql); 308 | #$result = $lhg_price_db->get_var($sql); 309 | 310 | #$aa=$result[0]; 311 | # 312 | #print_r($aa); 313 | #echo "Extract"; 314 | #echo "ID: ".$aa->id; 315 | 316 | 317 | 318 | //ToDo: nonce check missing! 319 | 320 | if ( ($_POST[id_com] > 0) && ($_POST[id_de] >0) ) 321 | lhg_link_articles($_POST[id_com],$_POST[id_de]); 322 | #echo "postid_com: $_POST[postid_com]
"; 323 | #echo "postid_de: $_POST[postid_de]
"; 324 | 325 | echo ''; 326 | 327 | echo ""; 328 | 329 | echo ""; 330 | echo ""; 331 | 332 | if ( ($_SERVER['SERVER_ADDR'] == "192.168.56.12") or ($_SERVER['SERVER_ADDR'] == "192.168.56.13") ) { 333 | $urltranslate = 'http://www.linux-hardware-guide.de/wp-admin/admin.php?page=lhg_menu_settings_page&mode=translate_comde'; 334 | $urledit_com = 'http://www.linux-hardware-guide.com/wp-admin/post.php?post='; 335 | } 336 | 337 | if ( ($_SERVER['SERVER_ADDR'] == "192.168.3.112") or ($_SERVER['SERVER_ADDR'] == "192.168.3.113") ) { 338 | $urltranslate = 'http://192.168.3.112/wp-admin/admin.php?page=lhg_menu_settings_page&mode=translate_comde'; 339 | $urledit_com = 'http://192.168.3.113/wp-admin/post.php?post='; 340 | } 341 | 342 | 343 | for ($i=0; $i"; 345 | print ""; 346 | #print ""; 347 | #print ""; 348 | 349 | ( $result[$i]->postid_com != 0 ) ? print '' : 350 | print ''; 351 | 352 | ( $result[$i]->postid_de != 0 ) ? print '' : 353 | print ''; 354 | 355 | print ''; 358 | 359 | print ''; 362 | 363 | 364 | print ""; 365 | } 366 | 367 | echo "
Title:URL comURL de
".$result[$i]->product."".$result[$i]->postid_com." ".$result[$i]->postid_de." '.$result[$i]->postid_com.' (view) -'.$result[$i]->postid_de.' translate'; 356 | if ($result[$i]->postid_com != "0") echo ''; 357 | print ''; 360 | if ($result[$i]->postid_de != "0") echo ''; 361 | print '
"; 368 | 369 | echo ""; 370 | echo "
"; 371 | 372 | #echo "
dump:
"; 373 | #print_r($result); 374 | 375 | 376 | } 377 | 378 | function lhg_link_articles ( $id_com, $id_de ) { 379 | 380 | #echo "postid_com: $postid_com
"; 381 | #echo "postid_de: $postid_de
"; 382 | echo "id_com: $id_com
"; 383 | echo "id_de: $id_de
"; 384 | 385 | // -- get postid_com and _de values 386 | global $lhg_price_db; 387 | $sql = "SELECT postid_com FROM `lhgtransverse_posts` WHERE id = $id_com "; 388 | $postid_com = $lhg_price_db->get_var($sql); 389 | 390 | $sql = "SELECT postid_de FROM `lhgtransverse_posts` WHERE id = $id_de "; 391 | $postid_de = $lhg_price_db->get_var($sql); 392 | 393 | 394 | echo "postid_com: $postid_com
"; 395 | echo "postid_de: $postid_de
"; 396 | 397 | // -- add de id to com 398 | $sql = "UPDATE lhgtransverse_posts SET `postid_de` = $postid_de WHERE `id` = $id_com"; 399 | $result = $lhg_price_db->query($sql); 400 | 401 | #echo "
LQ: ".var_dump($lhg_price_db->last_query) ."ERREND
"; 402 | #echo "
LER: ".var_dump($lhg_price_db->last_error) ."ERREND
"; 403 | 404 | 405 | // -- remove de entry 406 | $sql = "DELETE FROM lhgtransverse_posts WHERE `id` = $id_de "; 407 | $result = $lhg_price_db->query($sql); 408 | 409 | //$sql = "SELECT * FROM `lhgtransverse_posts` WHERE postid_de = 0 OR postid_com = 0 ORDER BY product"; 410 | 411 | #echo "
LQ: ".var_dump($lhg_price_db->last_query) ."ERREND
"; 412 | #echo "
LER: ".var_dump($lhg_price_db->last_error) ."ERREND
"; 413 | } 414 | 415 | 416 | ?> -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/includes/lhg_sanity_checks.php: -------------------------------------------------------------------------------- 1 | Test 1: Redcoon Products"; 7 | echo "Sanity Check:
Look for Products at Redcoon.de, copy to .it & .nl
"; 8 | lhg_sanity_redcoon(); 9 | 10 | echo "

Update all ratings and comments

"; 11 | #echo "Sanity Check:
Look for Products at Redcoon.de, copy to .it & .nl
"; 12 | lhg_sanity_ratings(); 13 | 14 | } 15 | 16 | function lhg_sanity_ratings ( ) { 17 | 18 | global $lang; 19 | global $lhg_price_db; 20 | 21 | #write for com pages only 22 | if ($lang != "de") { 23 | 24 | $sql = "SELECT postid_com FROM `lhgtransverse_posts` WHERE `status_com` != 'draft'"; 25 | $results = $lhg_price_db->get_results($sql); 26 | 27 | foreach ($results as $result) { 28 | 29 | if ($result->postid_com != 0) { 30 | 31 | # store ratings of ".com" articles 32 | # 33 | # 34 | 35 | $pid = intval($result->postid_com); 36 | 37 | $post_ratings_users = get_post_meta($result->postid_com, 'ratings_users'); 38 | $post_ratings_score = get_post_meta($result->postid_com, 'ratings_score'); 39 | $post_ratings_average = get_post_meta($result->postid_com, 'ratings_average'); 40 | 41 | # ignore empty ratings 42 | if ( ($post_ratings_users[0] != 0 ) && ($post_ratings_users[0] != "" )) { 43 | print "Post ID ".$result->postid_com." -> ".$post_ratings_users[0].", ".$post_ratings_score[0].", ".$post_ratings_average[0]." -- "; 44 | 45 | lhg_store_ratings ( $pid, 46 | $post_ratings_users[0], 47 | $post_ratings_score[0], 48 | $post_ratings_average[0] ); 49 | } 50 | 51 | 52 | # store comments of ".com" articles 53 | lhg_store_comment_numbers_by_post_id( $pid ); 54 | 55 | } 56 | 57 | } 58 | } 59 | if ($lang == "de") { 60 | 61 | $sql = "SELECT postid_de FROM `lhgtransverse_posts` WHERE `status_com` != 'draft'"; 62 | $results = $lhg_price_db->get_results($sql); 63 | 64 | foreach ($results as $result) { 65 | 66 | if ($result->postid_de != 0) { 67 | 68 | # store ratings of ".de" articles 69 | # 70 | # 71 | 72 | $pid = intval($result->postid_de); 73 | 74 | $post_ratings_users = get_post_meta($result->postid_de, 'ratings_users'); 75 | $post_ratings_score = get_post_meta($result->postid_de, 'ratings_score'); 76 | $post_ratings_average = get_post_meta($result->postid_de, 'ratings_average'); 77 | 78 | # ignore empty ratings 79 | if ( ($post_ratings_users[0] != 0 ) && ($post_ratings_users[0] != "" )) { 80 | print "Post ID ".$result->postid_de." -> ".$post_ratings_users[0].", ".$post_ratings_score[0].", ".$post_ratings_average[0]."
"; 81 | 82 | lhg_store_ratings ( $pid, 83 | $post_ratings_users[0], 84 | $post_ratings_score[0], 85 | $post_ratings_average[0] ); 86 | } 87 | 88 | # store comments of ".de" articles 89 | lhg_store_comment_numbers_by_post_id( $pid ); 90 | 91 | } 92 | 93 | } 94 | } 95 | 96 | } 97 | 98 | 99 | function lhg_sanity_redcoon ( ) { 100 | #echo "Searching for SID 1"; 101 | 102 | 103 | $sid = 1; 104 | global $lhg_price_db; 105 | $sql = "SELECT lhg_article_id FROM `lhgprices` WHERE `shop_id` = 1 AND `shop_article_id` != 'NOT_AVAILABLE'"; 106 | $results = $lhg_price_db->get_results($sql); 107 | 108 | #print "
Results: "; 109 | #var_dump($results); 110 | #return $result; 111 | 112 | foreach ($results as $result) { 113 | $print_me = 0; 114 | 115 | $sql = "SELECT shop_article_id FROM `lhgprices` WHERE `shop_id` = 1 AND `lhg_article_id` = ".$result->lhg_article_id; 116 | $shop_article_id = $lhg_price_db->get_var($sql); 117 | 118 | $sql = "SELECT permalink_de FROM `lhgtransverse_posts` WHERE `postid_de` = ".$result->lhg_article_id; 119 | $shop_article_url_de = $lhg_price_db->get_var($sql); 120 | 121 | $sql = "SELECT permalink_com FROM `lhgtransverse_posts` WHERE `postid_com` = ".$result->lhg_article_id; 122 | $shop_article_url_com = $lhg_price_db->get_var($sql); 123 | 124 | #print "
Res: "; var_dump($result); 125 | if ($shop_article_url_de != "") $output = '
ID_de: '. $result->lhg_article_id .""; 126 | if ($shop_article_url_de == "") $output = '
ID_de: '. $result->lhg_article_id; 127 | 128 | $sql = "SELECT postid_com FROM `lhgtransverse_posts` WHERE `postid_de` = ".$result->lhg_article_id; 129 | $pid_com = $lhg_price_db->get_var($sql); 130 | if ($shop_article_url_com != "") $output .= ' -> ID_com: '.$pid_com.""; 131 | if ($shop_article_url_com == "") $output .= ' -> ID_com: '.$pid_com; 132 | 133 | if ($pid_com != 0) { 134 | #check if available 135 | $output .= "-> check if already available (it:"; 136 | 137 | $sql = "SELECT id FROM `lhgprices` WHERE `lhg_article_id` = ".$pid_com." AND shop_id = 5"; 138 | $price_id_it = $lhg_price_db->get_var($sql); 139 | 140 | if ($price_id_it != "") $output .= " $price_id_it) "; 141 | if ($price_id_it == "") $output .= " none) "; 142 | if ($price_id_it == "") $print_me = 1; 143 | 144 | $output .= " (nl:"; 145 | $sql = "SELECT id FROM `lhgprices` WHERE `lhg_article_id` = ".$pid_com." AND shop_id = 15"; 146 | $price_id_nl = $lhg_price_db->get_var($sql); 147 | 148 | if ($price_id_nl != "") $output .= " $price_id_nl) "; 149 | if ($price_id_nl == "") $output .= " none) "; 150 | if ($price_id_nl == "") $print_me = 1; 151 | 152 | 153 | #create entry 154 | if ($price_id_it == "") { 155 | $output .= "
  -> create entry IT "; 156 | 157 | $shop_id = 5; 158 | $post_id = $pid_com; 159 | $result = lhg_db_create_entry( $post_id, $shop_id, $shop_article_id ); 160 | $output .= ".. done"; 161 | //get newly created lhg_db_id 162 | $lhg_db_id = lhg_db_get_id ( $post_id, $shop_id); 163 | lhg_refresh_database_entry($lhg_db_id,$shop_id); 164 | $print_me = 1; 165 | } 166 | if ($price_id_nl == "") { 167 | $output .= "
  -> create entry NL "; 168 | 169 | $shop_id = 15; 170 | $post_id = $pid_com; 171 | $result = lhg_db_create_entry( $post_id, $shop_id, $shop_article_id ); 172 | $output .= ".. done"; 173 | //get newly created lhg_db_id 174 | $lhg_db_id = lhg_db_get_id ( $post_id, $shop_id); 175 | lhg_refresh_database_entry($lhg_db_id,$shop_id); 176 | $print_me = 1; 177 | } 178 | 179 | 180 | 181 | }else{ 182 | $output .= "-> Product not found in COM DB"; 183 | $print_me = 1; 184 | 185 | } 186 | 187 | if ($print_me == 1) print $output; 188 | } 189 | } 190 | 191 | -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/includes/lhg_shop_button.php: -------------------------------------------------------------------------------- 1 | "; 23 | 24 | $shopid = lhg_db_get_cheapest_supplier_id($postid); 25 | $products = lhg_get_sorted_products($shopid,$postid,false); 26 | $url = $products[0]["url"]; 27 | $price = $products[0]["price"]; #+$products[0]["shipping"]; 28 | 29 | #$price_total = $products[0]["price"]+$products[0]["shipping"]; 30 | $shipping = $products[0]["shipping"]; 31 | 32 | $shipping = lhg_float_to_currency_string( $shipping , $region ); 33 | $price = lhg_float_to_currency_string( $price , $region ); 34 | $name = lhg_get_shop_long_name($shopid); 35 | $txt_currency = lhg_get_currency_symbol( $region ); 36 | 37 | 38 | 39 | //format button depending on availability 40 | if ($shopid != "") { 41 | 42 | //product available at a shop 43 | 44 | $price_meta = "USD"; 45 | if ($region == "de") $price_meta = "EUR"; 46 | if ($region == "it") $price_meta = "EUR"; 47 | if ($region == "fr") $price_meta = "EUR"; 48 | if ($region == "nl") $price_meta = "EUR"; 49 | if ($region == "es") $price_meta = "EUR"; 50 | if ($region == "com") $price_meta = "USD"; 51 | if ($region == "co.uk") $price_meta = "GBP"; 52 | if ($region == "co.jp") $price_meta = "JPY"; 53 | if ($region == "cn") $price_meta = "CNY"; 54 | if ($region == "ca") $price_meta = "CAD"; 55 | if ($region == "in") $price_meta = "INR"; 56 | 57 | 58 | $schema_start = '
'; 59 | $schema_end = '
'; 60 | 61 | $button_string = ' '.$txt_buy_from.' '.$name; 62 | $price_string = $txt_price.': '.$txt_currency.' '.$price.' 63 | 64 | 65 | 66 | 67 | ('.$txt_on_stock.') 68 | '; 69 | 70 | $shipping_string = ' 71 | (+ '.$txt_shipping_costs.': '.$txt_currency.' '.$shipping.') 72 | '; 73 | 74 | //unknown shipping costs for Amazon, add warning 75 | if (strpos($name,"mazon") > 0) 76 | $shipping_string = ' 77 | ('.$txt_shipping.') 78 | '.tooltip($tooltip).' 79 | '; 80 | 81 | //no shipping costs in DB 82 | if (strpos($products[0]["shipping"],"ULL") > 0) 83 | $shipping_string = ' 84 | ('.$txt_shipping.') 85 | '; 86 | 87 | 88 | }elseif($region == "nl"){ 89 | //currently no Amazon.de shown 90 | 91 | 92 | }else{ 93 | 94 | // see if we have "Check Amazon for pricing" 95 | $meta="price-amazon.".$region; 96 | $aprice = get_post_meta($postid,$meta,true); 97 | 98 | #print "AP: $aprice"; 99 | 100 | if ($aprice != "Check Amazon For Pricing"){ 101 | 102 | $aid = get_id(); 103 | 104 | //nowhere available! not even in Amazon catalog 105 | // 106 | $region_tmp = $region; 107 | if ($region == "nl") $region_tmp = "de"; 108 | 109 | $price_string = '('.$txt_out_of_stock.') 110 |
'. 111 | $txt_never_avail_at.' 112 | 113 | Amazon.'.$region_tmp.' 114 | 115 |
'; 116 | 117 | 118 | $button_string = ' '.$txt_search_at.' Amazon.'.$region_tmp; 119 | $url = 'http://www.amazon.'.$region_tmp.'/?_encoding=UTF8&camp=15121&creative=390961&linkCode=ur2&tag='.$aid; 120 | 121 | $shipping_string = ""; #'('.$txt_shipping.') 122 | #'.tooltip($tooltip).' 123 | #'; 124 | 125 | 126 | // Check if at least a Amazon URL exists?! 127 | // 128 | $meta="url-amazon.".$region; 129 | $pageurl=get_post_meta($postid,$meta,true); 130 | if ($pageurl != "") { 131 | 132 | 133 | // not possible because we have no price ... 134 | //$schema_start = '
'; 135 | //$schema_end = '
'; 136 | 137 | $region_tmp = $region; 138 | if ($region == "nl") $region_tmp = "de"; 139 | 140 | //$price_string = '('.$txt_out_of_stock.') 141 | $price_string = '('.$txt_out_of_stock.') 142 |
'. 143 | $txt_not_avail_at.' 144 | 145 | Amazon.'.$region_tmp.' 146 | 147 |
'; 148 | 149 | $button_string = ' '.$txt_preorder.' Amazon.'.$region_tmp; 150 | $url = $pageurl; 151 | } 152 | 153 | $do_not_show = 1; 154 | 155 | }else{ 156 | 157 | //echo "AAA"; 158 | 159 | $schema_start = '
'; 160 | $schema_end = '
'; 161 | 162 | //Check Amazon for pricing returned 163 | 164 | $meta="url-amazon.".$region; 165 | $pageurl=get_post_meta($postid,$meta,true); 166 | 167 | $price_string = ' 168 | 169 | '.$txt_on_stock.' at Amazon.com 170 | '; 171 | 172 | $region_tmp = $region; 173 | if ($region == "nl") $region_tmp = "de"; 174 | 175 | $button_string = ' Check Price at Amazon.'.$region_tmp; 176 | $url = $pageurl; 177 | 178 | 179 | 180 | 181 | } 182 | 183 | 184 | } 185 | 186 | 187 | 188 | 189 | 190 | $button .= ' 191 |
192 | '. 193 | $schema_start . 194 | 195 | $price_string.' 196 |
'; 197 | 198 | if ($shipping_string != "") 199 | $button .= ' 200 |
'. 201 | $shipping_string.' 202 |
203 | 204 |
'; 205 | 206 | 207 | $button .= ' 208 | 209 | '. 210 | $button_string.' 211 | 212 | '. 213 | $schema_end 214 | .' 215 |
216 | 217 |
218 | '; 219 | 220 | if ( ($region == "nl") and ($shopid == "") ) $button = ""; 221 | if ( $do_not_show == 1 ) $button = ""; 222 | 223 | return $button; 224 | 225 | } 226 | 227 | ?> -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/includes/lhg_shortcodes.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-pricedb/includes/lhg_shortcodes.php -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/includes/lhg_user_hardware.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT sid FROM `lhgscansessions` WHERE wp_uid = %s", $user_id); 14 | if ($lang == "de") $myquery = $lhg_price_db->prepare("SELECT sid FROM `lhgscansessions` WHERE wp_uid_de = %s", $user_id); 15 | $results = $lhg_price_db->get_results($myquery); 16 | 17 | #print_r($results); 18 | #error_log("SIDS: $results"); 19 | 20 | foreach ($results as $result) { 21 | $sid = $result->sid; 22 | #error_log("User: $user_id -> $sid"); 23 | 24 | # check if user uploaded this hardware 25 | $result2 = lhg_check_sid_contains_article( $sid, $post_id ); 26 | #error_log("Found HW in $sid"); 27 | if ($result2 == true) return true; 28 | } 29 | 30 | # hardware does not belong to user 31 | return false; 32 | } 33 | 34 | function lhg_check_sid_contains_article( $sid, $post_id ) { 35 | # check if this article was uploaded as part of the given scan session ID 36 | 37 | global $lhg_price_db; 38 | global $lang; 39 | 40 | $myquery = $lhg_price_db->prepare("SELECT id FROM `lhghwscans` WHERE sid = %s AND postid = %s", $sid, $post_id); 41 | $results = $lhg_price_db->get_results($myquery); 42 | 43 | if ( !empty($results) ) return true; 44 | 45 | # nothing found -> ohh! 46 | return false; 47 | } 48 | 49 | 50 | 51 | ?> -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/includes/lhg_user_management.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/plugins/lhg-pricedb/includes/lhg_user_management.php -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/includes/lhg_user_management_authorship.php: -------------------------------------------------------------------------------- 1 | 30 |
Search for user: 31 | 32 |
33 | '; 34 | 35 | ?> 36 |

37 |
38 |
...
39 |
:
40 | 41 |
42 |
43 |
44 |
45 |
46 | 47 |
48 | 49 | 50 |
51 | : 52 |
53 | 54 |
55 |
:
56 |
:
57 |
58 | 59 | 60 | 61 | 62 |
:
63 |
64 |
65 |
66 |
67 | 68 |
69 |
70 | 71 | "; 75 | print "or UID
"; 76 | print "or GUID
"; 77 | print "Set role (submitter, publisher, translator)
"; 78 | 79 | print "show history of changes"; 80 | 81 | ?> 82 | 211 | -------------------------------------------------------------------------------- /wp-content/plugins/lhg-pricedb/includes/lhg_widget_featured_article.php: -------------------------------------------------------------------------------- 1 | __( 'Show featured article', 'text_domain' ) ) // Args 26 | # ); 27 | #} 28 | 29 | #public $defaults = array(); 30 | 31 | 32 | function lhg_widget_featured_article(){ 33 | $widget_ops = array( 34 | 'classname' => 'lhg_widget_featured_article_class', 35 | 'description' => 'Show featured article' 36 | ); 37 | 38 | parent::WP_Widget( 'lhg_widget_featured_article', $name = 'Featured Article', $widget_ops ); 39 | } 40 | 41 | // widget settings 42 | public function form($lhg_instance){ 43 | #echo "OLD: "; 44 | #var_dump($lhg_instance); 45 | 46 | #echo "
"; 47 | $lhg_defaults = array( 48 | 'title' => 'please reload', 49 | 'artid' => "please reload" 50 | ); 51 | 52 | if ($lhg_instance['title'] == "") $lhg_instance['title']=$lhg_defaults['title']; 53 | if ($lhg_instance['artid'] == "") $lhg_instance['artid']=$lhg_defaults['artid']; 54 | 55 | #$instance = wp_parse_args( $lhg_instance, $lhg_defaults ); 56 | #echo "DEF:
"; 57 | #var_dump($lhg_defaults); 58 | #echo "
FIN:
"; 59 | #extract($instance); 60 | #var_dump($lhg_instance); 61 | 62 | $title = $lhg_instance['title']; 63 | $artid = $lhg_instance['artid']; 64 | ?> 65 |

Title: 66 | 70 | 71 | 72 |

Post ID: 73 | 77 | 78 | 79 | posts 127 | WHERE ID = ".$artid; 128 | 129 | $last_update = $wpdb->get_var($sql); 130 | $wpdf=get_option('date_format'); 131 | $lupdate = date($wpdf,strtotime($last_update)); 132 | 133 | // get comments 134 | $cn=lhg_get_comments_number($artid); 135 | 136 | if ($cn > 0) { 137 | //Comment tooltip 138 | $txt_comments=$txt_cpl_comments; //"Kommentare"; 139 | //if ($lang == "en") $txt_comments="comments"; 140 | 141 | if ($cn == 1) { 142 | $txt_comments=$txt_cpl_comment;//"Kommentar"; 143 | //if ($lang == "en") $txt_comments="comment"; 144 | } 145 | 146 | $coutInv=''; //'; 147 | $cout=' 148 |

149 | 150 | '.($cn).' 151 |
152 | '; 153 | }else{ 154 | $coutInv=""; 155 | $cout=""; 156 | } 157 | 158 | //ratings 159 | $ratings = the_ratings_results($artid,0,0,0,10); 160 | 161 | 162 | 163 | #var_dump($last_update); 164 | #var_dump($wpdf); 165 | 166 | #$sql = "SELECT post_modified 167 | # FROM $wpdb->posts 168 | # WHERE post_id ='".$artid."'"; 169 | #$last_update = $wdpb->get_var( $sql ); 170 | #echo( "Last updated $lupdate ." ); 171 | 172 | #$date = get_the_modified_date($artid) 173 | 174 | $permalink = get_permalink($artid); 175 | $image = get_the_post_thumbnail($artid, array(130,130) ); 176 | 177 | #echo "ARGS: $args"; 178 | #var_dump($args); 179 | extract($args); 180 | 181 | #var_dump($instance); 182 | #echo "TIT: ".$instance['title']; 183 | 184 | echo "$before_widget"; 185 | #$title = apply_filters ( 'widget_title', $instance['title'] ); 186 | #$artid = empty( $instance['artid'] ) ? ' ' : $instance['artid']; 187 | 188 | #if ( !empty( $title ) ) { 189 | echo $before_title . $title . $after_title; 190 | #}; 191 | 192 | echo '"; 205 | echo $after_widget; 206 | } 207 | 208 | 209 | } 210 | 211 | #register_widget('lhg_widget_featured_article'); 212 | 213 | 214 | function lhg_clean_extract($text,$length) { 215 | 216 | $text = wp_strip_all_tags ( $text ); 217 | 218 | $search1='/\[code.*\]/'; 219 | $search2='/\[\/code*\]/'; 220 | $text = preg_replace($search1,"",$text); 221 | $text = preg_replace($search2,"",$text); 222 | $text = substr($text,0,$length); 223 | return $text; 224 | } 225 | 226 | -------------------------------------------------------------------------------- /wp-content/plugins/pie-highchart-jquery/insert-it-at-head.php: -------------------------------------------------------------------------------- 1 | 100) $lhg_chart_id = 1; 47 | update_option ("lhg_pie_chart_id", $lhg_chart_id); 48 | 49 | //mark as updated 50 | update_option ("lhg_pie_chart_update", 0); 51 | 52 | //$top_users[$i]["Karma"]=$y['points']; 53 | 54 | // get voted donation 55 | global $donation_total; 56 | global $donation; 57 | global $top_users; 58 | 59 | // get Top 3 donation targets and percentage 60 | $karma_total = $top_users[1]["Karma"] + $top_users[2]["Karma"] + $top_users[3]["Karma"]; 61 | 62 | //echo "Karma Total: $karma_total"; 63 | 64 | $donationID1 = get_user_meta($top_users[1]["ID"],'user_donation_target',true); 65 | $donationID2 = get_user_meta($top_users[2]["ID"],'user_donation_target',true); 66 | $donationID3 = get_user_meta($top_users[3]["ID"],'user_donation_target',true); 67 | 68 | //echo "DID: ".$top_users[1]["ID"]; 69 | //echo "DID: $donationID1"; 70 | if ($donationID1 == "") $donationID1 = 1; 71 | if ($donationID2 == "") $donationID2 = 1; 72 | if ($donationID3 == "") $donationID3 = 1; 73 | 74 | if ($karma_total != 0) { 75 | $percent1= $top_users[1]["Karma"] / $karma_total*0.75; 76 | $percent2= $top_users[2]["Karma"] / $karma_total*0.75; 77 | $percent3= $top_users[3]["Karma"] / $karma_total*0.75; 78 | }else{ 79 | $percent1= 0; #$top_users[1]["Karma"] / $karma_total*0.75; 80 | $percent2= 0; #$top_users[2]["Karma"] / $karma_total*0.75; 81 | $percent3= 0; #$top_users[3]["Karma"] / $karma_total*0.75; 82 | 83 | } 84 | 85 | //print $donation[1]["Name"]; 86 | //print $donation[1]["Percentage"]; 87 | 88 | //print "P1: $percent1 -- "; 89 | 90 | //most voted by users: 91 | $topvotes = lhg_voted_donation(); 92 | $most_voted = lhg_most_voted ($topvotes); 93 | 94 | 95 | //$script_lang = "fr"; 96 | global $lang_array; 97 | global $lang; 98 | 99 | //print "Test"; 100 | 101 | foreach ($lang_array as &$script_lang) { 102 | //print "LG: $script_lang"; 103 | $filename = "/var/www/charts/pie/piechart-donation.js.".$lhg_chart_id.".".$script_lang; 104 | $piechart = lhg_create_pie_script($script_lang, $percent1, $percent2, $percent3 , $donationID1, $donationID2, $donationID3, $most_voted); 105 | lhg_create_file($filename, $piechart); 106 | } 107 | 108 | # also create .de chart 109 | $filename = "/var/www/charts/pie/piechart-donation.js.".$lhg_chart_id.".de"; 110 | $piechart = lhg_create_pie_script("de", $percent1, $percent2, $percent3 , $donationID1, $donationID2, $donationID3, $most_voted); 111 | lhg_create_file($filename, $piechart); 112 | 113 | }else{ 114 | // print "no update needed"; 115 | } 116 | 117 | 118 | 119 | 120 | global $region; 121 | //echo "LANG_web: $region"; 122 | $lhg_chart_id = get_option ("lhg_pie_chart_id"); 123 | 124 | $langfile=$region; 125 | if ($region=="co.jp") $langfile="ja"; 126 | if ($region=="co.uk") $langfile="uk"; 127 | if ($region=="cn") $langfile="zh"; 128 | 129 | //echo ""; 130 | 131 | echo ""; 132 | //echo ""; 133 | echo ""; 134 | } 135 | 136 | add_action('wp_footer', 'highChartsAction'); 137 | 138 | //[highchart] 139 | function highchartAction( $atts ){ 140 | return "
"; 141 | } 142 | add_shortcode( 'highchart', 'highchartAction' ); 143 | 144 | 145 | function highchartAction_quarterly( $atts ){ 146 | return "
"; 147 | } 148 | add_shortcode( 'highchart_quarterly', 'highchartAction_quarterly' ); 149 | 150 | 151 | function lhg_create_pie_script($scriptlang , $percent1, $percent2, $percent3, $donationID1, $donationID2, $donationID3, $most_voted) { 152 | 153 | //echo "Perce1: $percent1"; 154 | //echo "SL: $scriptlang"; 155 | 156 | global $donation_total; 157 | global $donation; 158 | global $top_users; 159 | 160 | $txt_chart_all = "voted by all users"; 161 | $txt_chart_vote_by = "voted by"; 162 | 163 | 164 | if ($scriptlang == "fr") { 165 | $txt_chart_all = "voté par tous les utilisateurs"; 166 | $txt_chart_vote_by = "voté par "; 167 | } 168 | if ($scriptlang == "es") { 169 | $txt_chart_all = "votado por todos los usuarios"; 170 | $txt_chart_vote_by = "votado por"; 171 | } 172 | if ($scriptlang == "it") { 173 | $txt_chart_all = "votato da tutti gli utenti"; 174 | $txt_chart_vote_by = "votado da"; 175 | } 176 | if ($scriptlang == "zh") { 177 | $txt_chart_all = "所有用户投票"; 178 | $txt_chart_vote_by = "通过投票"; 179 | } 180 | if ($scriptlang == "ja") { 181 | $txt_chart_all = "すべてのユーザーによる投票 "; 182 | $txt_chart_vote_by = "による投票"; 183 | } 184 | 185 | list($top_donation_target_names, $top_donation_target_points, $donation_users) = lhg_return_donation_targets(); 186 | 187 | #print "Test:
"; 188 | #var_dump($donation_users); 189 | #var_dump($top_donation_target_names); 190 | 191 | $piechart= 192 | " 193 | jQuery(function () { 194 | jQuery('#container').highcharts({ 195 | chart: { 196 | plotBackgroundColor: null, 197 | plotBorderWidth: null, 198 | plotShadow: false 199 | }, 200 | title: { 201 | text: '' 202 | }, 203 | tooltip: { 204 | pointFormat: '{series.name}: EUR {point.y:.2f}' 205 | }, 206 | plotOptions: { 207 | pie: { 208 | allowPointSelect: true, 209 | cursor: 'pointer', 210 | dataLabels: { 211 | enabled: true, 212 | format: '{point.name}
EUR {point.y:.2f}', 213 | style: { 214 | color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black' 215 | } 216 | } 217 | } 218 | }, 219 | series: [{ 220 | type: 'pie', 221 | name: 'Donation', 222 | data: [ 223 | { 224 | name: '".$donation[$most_voted]["NameShort"]."
(".$txt_chart_all.")', 225 | y: ".(0.25*$donation_total).", 226 | sliced: true, selected: true 227 | }, 228 | 229 | 230 | ['".$donation[$donationID1]["NameShort"]."
(".$txt_chart_vote_by." ".$top_users[1]["DisplayName"].")', ".$percent1*$donation_total."], 231 | ['".$donation[$donationID2]["NameShort"]."
(".$txt_chart_vote_by." ".$top_users[2]["DisplayName"].")', ".$percent2*$donation_total."], 232 | ['".$donation[$donationID3]["NameShort"]."
(".$txt_chart_vote_by." ".$top_users[3]["DisplayName"].")', ".$percent3*$donation_total."] 233 | ] 234 | }] 235 | }); 236 | 237 | 238 | // Quarterly Pie Chart 239 | jQuery('#container-quarterly').highcharts({ 240 | chart: { 241 | plotBackgroundColor: null, 242 | plotBorderWidth: null, 243 | plotShadow: false 244 | }, 245 | title: { 246 | text: '' 247 | }, 248 | tooltip: { 249 | pointFormat: 'Quarterly Collected Points: {point.y:.0f}
Donation Percentage: {point.percentage:.0f}%' 250 | }, 251 | plotOptions: { 252 | pie: { 253 | allowPointSelect: true, 254 | cursor: 'pointer', 255 | dataLabels: { 256 | enabled: true, 257 | format: '{point.name}
Points: {point.y:.0f}', 258 | style: { 259 | color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black' 260 | } 261 | } 262 | } 263 | }, 264 | series: [{ 265 | type: 'pie', 266 | name: 'Donation', 267 | data: [ 268 | { 269 | name: '".$top_donation_target_names[0]."', 270 | y: ".$top_donation_target_points[0].", 271 | sliced: false, selected: true 272 | }, 273 | "; 274 | $j=1; 275 | while ( $top_donation_target_names[$j] != "" ) { 276 | if ($top_donation_target_points[$j] > 0 ) 277 | $piechart .= "['".$top_donation_target_names[$j]."', ".$top_donation_target_points[$j]."],"; 278 | 279 | $j++; 280 | } 281 | $piechart .= " 282 | ] 283 | }] 284 | }); 285 | 286 | 287 | }); 288 | "; 289 | return $piechart; 290 | } 291 | 292 | function lhg_create_file($filename, $piechart) { 293 | 294 | $handle = fopen($filename, "w"); 295 | 296 | if (is_writable($filename)) { 297 | 298 | 299 | if (!$handle = fopen($filename, "w")) { 300 | print "Kann die Datei $filename nicht öffnen"; 301 | exit; 302 | } 303 | if (!fwrite($handle, $piechart)) { 304 | print "Kann in die Datei $filename nicht schreiben"; 305 | exit; 306 | } 307 | 308 | //print "Fertig, in Datei $filename wurde $somecontent geschrieben"; 309 | 310 | fclose($handle); 311 | } else { 312 | print "Die Datei $filename ist nicht schreibbar"; 313 | } 314 | } 315 | 316 | ?> 317 | -------------------------------------------------------------------------------- /wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/styles/shCore.css: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | .syntaxhighlighter a, 18 | .syntaxhighlighter div, 19 | .syntaxhighlighter code, 20 | .syntaxhighlighter table, 21 | .syntaxhighlighter table td, 22 | .syntaxhighlighter table tr, 23 | .syntaxhighlighter table tbody, 24 | .syntaxhighlighter table thead, 25 | .syntaxhighlighter table caption, 26 | .syntaxhighlighter textarea { 27 | -moz-border-radius: 0 0 0 0 !important; 28 | -webkit-border-radius: 0 0 0 0 !important; 29 | background: none !important; 30 | border: 0 !important; 31 | bottom: auto !important; 32 | float: none !important; 33 | height: auto !important; 34 | left: auto !important; 35 | line-height: 1.1em !important; 36 | margin: 0 !important; 37 | outline: 0 !important; 38 | overflow: visible !important; 39 | padding: 0 !important; 40 | position: static !important; 41 | right: auto !important; 42 | text-align: left !important; 43 | top: auto !important; 44 | vertical-align: baseline !important; 45 | width: auto !important; 46 | box-sizing: content-box !important; 47 | font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; 48 | font-weight: normal !important; 49 | font-style: normal !important; 50 | font-size: 1em !important; 51 | /*min-height: inherit !important; */ 52 | /*min-height: auto !important;*/ 53 | direction: ltr !important; 54 | } 55 | 56 | .syntaxhighlighter { 57 | width: 100% !important; 58 | margin: 1em 0 1em 0 !important; 59 | position: relative !important; 60 | overflow: auto !important; 61 | overflow-y: hidden !important; 62 | font-size: 1em !important; 63 | } 64 | .syntaxhighlighter code { 65 | display: inline !important; 66 | } 67 | .syntaxhighlighter.source { 68 | overflow: hidden !important; 69 | } 70 | .syntaxhighlighter .bold { 71 | font-weight: bold !important; 72 | } 73 | .syntaxhighlighter .italic { 74 | font-style: italic !important; 75 | } 76 | .syntaxhighlighter .line { 77 | white-space: pre !important; 78 | } 79 | .syntaxhighlighter table { 80 | width: 100% !important; 81 | } 82 | .syntaxhighlighter table caption { 83 | text-align: left !important; 84 | padding: .5em 0 0.5em 1em !important; 85 | } 86 | .syntaxhighlighter table td.code { 87 | width: 100% !important; 88 | } 89 | .syntaxhighlighter table td.code .container { 90 | position: relative !important; 91 | } 92 | .syntaxhighlighter table td.code .container textarea { 93 | box-sizing: border-box !important; 94 | position: absolute !important; 95 | left: 0 !important; 96 | top: 0 !important; 97 | width: 100% !important; 98 | height: 100% !important; 99 | border: none !important; 100 | background: white !important; 101 | padding-left: 1em !important; 102 | overflow: hidden !important; 103 | white-space: pre !important; 104 | } 105 | .syntaxhighlighter table td.gutter .line { 106 | text-align: right !important; 107 | padding: 2px 0.5em 0 1em !important; 108 | } 109 | .syntaxhighlighter table td.code .line { 110 | padding: 1px 1em !important; 111 | } 112 | .syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { 113 | padding-left: 0em !important; 114 | } 115 | .syntaxhighlighter.show { 116 | display: block !important; 117 | } 118 | .syntaxhighlighter.collapsed table { 119 | display: none !important; 120 | } 121 | .syntaxhighlighter.collapsed .toolbar { 122 | padding: 0.1em 0.8em 0em 0.8em !important; 123 | font-size: 1em !important; 124 | position: static !important; 125 | width: auto !important; 126 | height: auto !important; 127 | } 128 | .syntaxhighlighter.collapsed .toolbar span { 129 | display: inline !important; 130 | margin-right: 1em !important; 131 | } 132 | .syntaxhighlighter.collapsed .toolbar span a { 133 | padding: 0 !important; 134 | display: none !important; 135 | } 136 | .syntaxhighlighter.collapsed .toolbar span a.expandSource { 137 | display: inline !important; 138 | } 139 | .syntaxhighlighter .toolbar { 140 | position: absolute !important; 141 | right: 1px !important; 142 | top: 1px !important; 143 | width: 11px !important; 144 | height: 11px !important; 145 | font-size: 10px !important; 146 | z-index: 10 !important; 147 | } 148 | .syntaxhighlighter .toolbar span.title { 149 | display: inline !important; 150 | } 151 | .syntaxhighlighter .toolbar a { 152 | display: block !important; 153 | text-align: center !important; 154 | text-decoration: none !important; 155 | padding-top: 1px !important; 156 | } 157 | .syntaxhighlighter .toolbar a.expandSource { 158 | display: none !important; 159 | } 160 | .syntaxhighlighter.ie { 161 | font-size: .9em !important; 162 | padding: 1px 0 1px 0 !important; 163 | } 164 | .syntaxhighlighter.ie .toolbar { 165 | line-height: 8px !important; 166 | } 167 | .syntaxhighlighter.ie .toolbar a { 168 | padding-top: 0px !important; 169 | } 170 | .syntaxhighlighter.printing .line.alt1 .content, 171 | .syntaxhighlighter.printing .line.alt2 .content, 172 | .syntaxhighlighter.printing .line.highlighted .number, 173 | .syntaxhighlighter.printing .line.highlighted.alt1 .content, 174 | .syntaxhighlighter.printing .line.highlighted.alt2 .content { 175 | background: none !important; 176 | } 177 | .syntaxhighlighter.printing .line .number { 178 | color: #bbbbbb !important; 179 | } 180 | .syntaxhighlighter.printing .line .content { 181 | color: black !important; 182 | } 183 | .syntaxhighlighter.printing .toolbar { 184 | display: none !important; 185 | } 186 | .syntaxhighlighter.printing a { 187 | text-decoration: none !important; 188 | } 189 | .syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { 190 | color: black !important; 191 | } 192 | .syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { 193 | color: #008200 !important; 194 | } 195 | .syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { 196 | color: blue !important; 197 | } 198 | .syntaxhighlighter.printing .keyword { 199 | color: #006699 !important; 200 | font-weight: bold !important; 201 | } 202 | .syntaxhighlighter.printing .preprocessor { 203 | color: gray !important; 204 | } 205 | .syntaxhighlighter.printing .variable { 206 | color: #aa7700 !important; 207 | } 208 | .syntaxhighlighter.printing .value { 209 | color: #009900 !important; 210 | } 211 | .syntaxhighlighter.printing .functions { 212 | color: #ff1493 !important; 213 | } 214 | .syntaxhighlighter.printing .constants { 215 | color: #0066cc !important; 216 | } 217 | .syntaxhighlighter.printing .script { 218 | font-weight: bold !important; 219 | } 220 | .syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { 221 | color: gray !important; 222 | } 223 | .syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { 224 | color: #ff1493 !important; 225 | } 226 | .syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { 227 | color: red !important; 228 | } 229 | .syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { 230 | color: black !important; 231 | } 232 | -------------------------------------------------------------------------------- /wp-content/themes/blue-and-grey/footer.php: -------------------------------------------------------------------------------- 1 | '; 15 | 16 | ?> 17 | 18 | 19 | 106 | 107 | 131 | 132 | '; 133 | 134 | wp_footer(); 135 | 136 | ?> 137 | 138 | 139 | -------------------------------------------------------------------------------- /wp-content/themes/blue-and-grey/lhg_currency_functions.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/themes/blue-and-grey/lhg_currency_functions.php -------------------------------------------------------------------------------- /wp-content/themes/blue-and-grey/lhg_functions.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cptpike/linuxhardwareguide/a495c5f623eeb9fb9370290e293ee8381d2030f1/wp-content/themes/blue-and-grey/lhg_functions.php -------------------------------------------------------------------------------- /wp-content/themes/blue-and-grey/single.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
id="post-"> 7 |

8 | 9 | 25 |

26 |

27 | 28 | 29 | 30 | 31 | cat_name; 34 | $category_name2 = $the_cat[1]->cat_name; 35 | $category_link = get_category_link( $the_cat[0]->cat_ID ); 36 | $category_link2 = get_category_link( $the_cat[1]->cat_ID ); 37 | ?> 38 | 39 | 40 | 41 | 42 | 43 | term_id != 981 ) { 50 | $count++; 51 | $tagstring .= ''.$tag->name.', '; 52 | if( $count >8 ) break; 53 | } 54 | } 55 | } 56 | echo substr($tagstring,0,-2); 57 | ?> 58 |

59 | 60 | Read the rest of this entry »

'); 61 | 62 | ?> 63 | 64 | 67 | 68 | '

Pages: ', 'after' => '

', 'next_or_number' => 'number')); ?> 69 | 70 | ', '

'); ?> 71 |
72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | --------------------------------------------------------------------------------