Ejemplo n.º 1
0
    $email = $user->emails;
    $karma = $user->karma_com + $user->karma_de;
    //$num_com * 3 + $num_art * 50;
    $displayname = $user->user_nicename;
    $avatar = $user->avatar;
    # make it bigger!
    $avatar = str_replace("s=40", "s=96", $avatar);
    $avatar = str_replace("s%3D40", "s%3D96", $avatar);
    $avatar = str_replace("avatar-40", "avatar-96", $avatar);
    $avatar = str_replace("height='40'", "height='96'", $avatar);
    $avatar = str_replace("width='40'", "width='96'", $avatar);
    #error_log("Avatar: $avatar");
    #var_dump($user);
}
//Get user Language
$user_tmp = lhg_get_userdata_guid($guid);
$user = $user_tmp[0];
# Check if user has .de account -> add flag
if ($user->wpuid != 0) {
    $user_language_txt = lhg_get_locale_from_id($public_user_ID);
}
if ($user->wpuid != 0) {
    $user_language_flag = lhg_show_flag_by_lang($user_language_txt);
}
# Check if user has .de account -> add flag
if ($user->wpuid_de != 0) {
    $user_language_flag .= " " . lhg_show_flag_by_lang("de") . " ";
}
//get user registration date
$regdate = date("d. M Y", strtotime(get_userdata($public_user_ID)->user_registered));
//get number of contributed hardware articles
Ejemplo n.º 2
0
$myquery = $lhg_price_db->prepare("SELECT id, scandate, kversion, distribution, status FROM `lhgscansessions` WHERE sid = %s", $sid);
#$sql = "SELECT id FROM `lhgshops` WHERE region <> \"de\"";
$identified_scans = $lhg_price_db->get_results($myquery);
#var_dump($identified_scans);
$scandate = $identified_scans[0]->scandate;
$scandate_txt = gmdate("Y-m-d, H:i:s", $scandate);
$distribution = $txt_subscr_unknown;
#"unknown";
$kversion = $txt_subscr_unknown;
#"unkwnown";
$status = $identified_scans[0]->status;
$distribution = $identified_scans[0]->distribution;
$kversion = $identified_scans[0]->kversion;
$logo = get_distri_logo($distribution);
# get data from guid
$user_tmp = lhg_get_userdata_guid($uploader_guid);
$user = $user_tmp[0];
$user_nicename = $user->user_nicename;
$avatar = $user->avatar;
$wpuid_de = $user->wpuid_de;
$wpuid_com = $user->wpuid;
#	echo "<h2>".$txt_subscr_scanoverview.":</h2>";
#get and check session ID
#echo "Session ID: $sid <br>";
echo '<table id="registration" class="scanoverview-table">';
echo '<tr id="header">


                <td id="title-colhw">Scan</td>';
#if ($userknown == 1)
#echo '<td id="hwscan-col3" width="13%"><nobr>Add HW to your profile</nobr></td>';
Ejemplo n.º 3
0
function lhg_get_donation_target_by_date($guid, $timestamp)
{
    global $lhg_price_db;
    # 1 look if donation target is set in history DB
    $sql = "SELECT donation_target FROM `lhgtransverse_donations` WHERE guid = \"" . $guid . "\" AND timestamp < \"" . $timestamp . "\" ORDER BY timestamp DESC LIMIT 1 ";
    $result = $lhg_price_db->get_var($sql);
    #error_log("Test 1: $result for $guid");
    if ($result > 0) {
        return $result;
    }
    # 2 look if a later entry exists (i.e. donation target was never changed before)
    $sql = "SELECT donation_target FROM `lhgtransverse_donations` WHERE guid = \"" . $guid . "\" ORDER BY timestamp ASC LIMIT 1 ";
    $result = $lhg_price_db->get_var($sql);
    #error_log("Test 2: $result for $guid");
    if ($result > 0) {
        return $result;
    }
    # 3 look if value exists in transverse user DB
    $user_tmp = lhg_get_userdata_guid($guid);
    $user = $user_tmp[0];
    if ($user->donation_target_date_de > $user->donation_target_date_com) {
        $donation_target = $user->donation_target_de;
    }
    if ($user->donation_target_date_de <= $user->donation_target_date_com) {
        $donation_target = $user->donation_target_com;
    }
    #error_log("Test 3: $donation_target for $guid");
    if ($donation_target > 0) {
        return $donation_target;
    }
    #error_log("Test 4: default for $guid");
    return 1;
    # default value if nothing found
}
Ejemplo n.º 4
0
function lhg_donation_history($attr)
{
    global $lang;
    global $donation;
    $start = $attr['start'];
    $end = $attr['end'];
    list($endyear, $endmonth) = explode("-", $end);
    $enddate = "1-" . (intval($endmonth) + 1) . "-" . $endyear;
    $start_timestamp = strtotime($start);
    $end_timestamp = strtotime($enddate);
    #
    $total_points = 0;
    # collects all points collected in this time frame
    $donation_points = array();
    # collects all points per donation target in this time frame
    #
    # donation points by hardware scans
    #
    # donations to distribution was introduced after 09-2016
    # skip output otherwise
    if ($end_timestamp > strtotime("1-10-2016")) {
        $points_scan = lhg_points_from_hwscans($start_timestamp, $end_timestamp);
        foreach ($points_scan as $key => $points) {
            #error_log("Pts: $points -> $key");
            $total_points += $points;
            $donation_points[$key] += $points;
        }
    }
    # sort by points
    arsort($points_scan);
    $distri = lhg_get_distribution_array();
    $logo = $distri[$distri_name]["logo"];
    foreach ($points_scan as $key => $points) {
        $distri_name = lhg_get_distri_name($donation[$key]["Name"]);
        $logo = $distri[$distri_name]["logo"];
        $scan_output .= '<div class="donations-short-user-list">
                        		<div class="donations-short-user-list-avatar">' . "<img src=\"" . $logo . "\" width=45px>\n                                        </div>\n\n                                        " . '<div class="donations-short-user-list-text">
                                        	<center>' . $donation[$key]["Name"] . "<br><b>" . round($points / $total_points * 100) . "%</b> ({$points} points)\n                                        \t</center>\n                                        </div>\n\n                                </div>";
    }
    #
    # donation points collected by users
    list($list_guid, $list_points_guid) = cp_getAllQuarterlyPoints_transverse($start_timestamp, $end_timestamp);
    #print_r("LGUID:   $list_guid");
    $i = 0;
    if (sizeof($list_guid) > 0) {
        foreach ($list_guid as $guid) {
            $user_tmp = lhg_get_userdata_guid($guid);
            $user = $user_tmp[0];
            if ($user !== false) {
                #var_dump($user);
                #print sizeof($uid)."<p>";
                $user_nicename = $user->user_nicename;
                $points = $list_points_guid[$i];
                # get user's avatar
                $avatar = $user->avatar;
                # repair URL if linking to .de avatar on .com server
                if (strpos($avatar, "src='/avatars/") > 0) {
                    $avatar = str_replace("src='/avatars/", "src='http://www.linux-hardware-guide.de/avatars/", $avatar);
                }
                $wpuid_de = $user->wpuid_de;
                $wpuid_com = $user->wpuid;
                $user_language_txt = $user->language;
                $user_language_flag = lhg_show_flag_by_lang($user_language_txt);
                $total_karma = $user->karma_com + $user->karma_de;
                //$num_com * 3 + $num_art * 50;
                if ($lang == "de") {
                    $uid = $user->wpuid_de;
                }
                if ($lang == "com") {
                    $uid = $user->wpuid;
                }
                //registration date
                #$regdate = date("d. M Y", strtotime(get_userdata( $uid ) -> user_registered ) );
                //donates to
                # TODO:
                # to be updated, because we need the donation target at the end of the given time frame
                $donation_target = lhg_get_donation_target_by_date($guid, $end_timestamp);
                $total_points += $points;
                $donation_points[$donation_target] += $points;
                #$output .="User: $user_nicename -> Points: $points -> $donation_target <br>";
                ## show user info
                ##
                $user_list .= '<div class="donations-short-user-list">
                        		<div class="donations-short-user-list-avatar">';
                # TODO: localized hardware profile should be linked. Not US version
                # linked avatar to user page if on local server
                # link avatar to guser page, if user present on other servers
                if ($lang == "de") {
                    if ($user->wpuid_de != 0) {
                        $user_list .= '<a href="/hardware-profile/user' . $user->wpuid_de . '" class="recent-comments">';
                        $close0 = 1;
                        # remember that link has to be closed
                    } else {
                        $user_list .= '<a href="/hardware-profile/guser' . $guid . '" class="recent-comments">';
                        $close0 = 1;
                    }
                }
                if ($lang != "de") {
                    if ($user->wpuid != 0) {
                        $user_list .= '<a href="/hardware-profile/user' . $user->wpuid . '" class="recent-comments">';
                        $close0 = 1;
                        # remember that link has to be closed
                    } else {
                        $user_list .= '<a href="/hardware-profile/guser' . $guid . '" class="recent-comments">';
                        $close0 = 1;
                        # remember that link has to be closed
                    }
                }
                $user_list .= '    <div class="userlist-avatar">' . $avatar . '
			    </div> ';
                if ($close0 == 1) {
                    $user_list .= '</a></div>';
                }
                $user_list .= '<div class="donations-short-user-list-text"><center>';
                # show link to user page if on local server
                # link to guser page, if user present on other servers
                if ($lang == "de") {
                    if ($user->wpuid_de != 0) {
                        $user_list .= '		<a href="/hardware-profile/user' . $user->wpuid_de . '" class="recent-comments">';
                        $close1 = 1;
                        # remember that link has to be closed
                    } else {
                        $user_list .= '		<a href="/hardware-profile/guser' . $guid . '" class="recent-comments">';
                        $close1 = 1;
                    }
                }
                if ($lang != "de") {
                    if ($user->wpuid != 0) {
                        $user_list .= '		<a href="/hardware-profile/user' . $user->wpuid . '" class="recent-comments">';
                        $close1 = 1;
                    } else {
                        $user_list .= '		<a href="/hardware-profile/guser' . $guid . '" class="recent-comments">';
                        $close1 = 1;
                    }
                }
                $user_list .= "" . $user_nicename . "";
                if ($close1 == 1) {
                    $user_list .= '</a>';
                }
                $user_list .= "<br>{$points} Points\n                         to<br>" . $donation[$donation_target]["Name"] . "\n\n                        </center> </div>";
                $user_list .= "</div>";
            }
            $i++;
        }
    }
    #print "Scan results:";
    #var_dump($scans_donation_target);
    #$iendmonth= (int)$endmonth;
    $output .= "<h2>Donations from " . date("d M Y", $start_timestamp) . " to " . date("d M Y", $end_timestamp) . ":</h2>\n                        Collected Points: <b>{$total_points}</b><br>\n                        ";
    foreach ($donation_points as $key => $donation_point) {
        if ($donation_point > 0) {
            $output .= "Donations to " . $donation[$key]["Name"] . ": <b>" . round($donation_point / $total_points * 100) . "%</b> ({$donation_point} points)<br>";
        }
    }
    $output .= "<br>Users that collected and donated points:<br>\n        " . $user_list . "";
    # donations to distribution was introduced after 09-2016
    # skip output otherwise
    if ($end_timestamp > strtotime("1-10-2016")) {
        $output .= '<br clear=all>Hardware scan results:<br>' . $scan_output . "<br clear=all>";
    }
    return $output;
}
 /**
  * Displays the appropriate management page
  */
 public function subscribe_reloaded_manage($_posts = '', $_query = '')
 {
     global $current_user;
     $url = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $pieces = parse_url($url);
     $urlpath = $pieces['path'];
     #error_log("PATH: $urlpath");
     $hwprofpos = strpos($urlpath, "/hardware-profile/user");
     $hwprofpos_guid = strpos($urlpath, "/hardware-profile/guser");
     $hwscanpos = strpos($urlpath, "/hardware-profile/scan-");
     $hweditscanpos = strpos($urlpath, "/hardware-profile/editscan-");
     $hwsystempos = strpos($urlpath, "/hardware-profile/system-");
     $hwuidpos = strpos($urlpath, "/hardware-profile/uid-");
     //echo "<br>POS: $hwprofpos";
     if ($hwprofpos > 1) {
         //$include_post_content = show_public_profile();
         //echo "Test";
         //return $_posts;
         global $show_user_profile;
         $show_user_profile = 1;
     }
     if ($hwprofpos_guid > 1) {
         //$include_post_content = show_public_profile();
         //echo "Test";
         //return $_posts;
         global $show_user_profile;
         $show_user_profile = 1;
         global $show_guser_profile;
         $show_guser_profile = 1;
     }
     if ($hwsystempos > 1) {
         //$include_post_content = show_public_profile();
         //echo "Test";
         //return $_posts;
         #error_log("Show public!");
         global $show_public_profile;
         $show_public_profile = 1;
     }
     if ($hwscanpos > 1) {
         //$include_post_content = show_public_profile();
         //echo "Test";
         //return $_posts;
         global $show_scan_profile;
         $show_scan_profile = 1;
     }
     if ($hweditscanpos > 1) {
         //$include_post_content = show_public_profile();
         //echo "Test";
         //return $_posts;
         global $show_editscan_profile;
         $show_editscan_profile = 1;
     }
     if ($hwuidpos > 1) {
         //$include_post_content = show_public_profile();
         //echo "Test";
         //return $_posts;
         global $show_uid_profile;
         $show_uid_profile = 1;
     }
     if (!empty($_posts)) {
         return $_posts;
     }
     $post_ID = !empty($_POST['srp']) ? intval($_POST['srp']) : (!empty($_GET['srp']) ? intval($_GET['srp']) : 0);
     // Is the post_id passed in the query string valid?
     $target_post = get_post($post_ID);
     if ($post_ID > 0 && !is_object($target_post)) {
         return $_posts;
     }
     // Load localization files
     load_plugin_textdomain('subscribe-reloaded', WP_PLUGIN_DIR . '/lhg-hardware-profile-manager/langs', '/subscribe-to-comments-reloaded/langs');
     $action = !empty($_POST['sra']) ? $_POST['sra'] : (!empty($_GET['sra']) ? $_GET['sra'] : 0);
     $key = !empty($_POST['srk']) ? $_POST['srk'] : (!empty($_GET['srk']) ? $_GET['srk'] : 0);
     $email = $this->clean_email(!empty($_POST['sre']) ? urldecode($_POST['sre']) : (!empty($_GET['sre']) ? $_GET['sre'] : ''));
     if (empty($email) && !empty($current_user->user_email)) {
         $email = $this->clean_email($current_user->user_email);
     }
     // Subscribe without commenting
     if (!empty($action) && $action == 's' && $post_ID > 0) {
         $include_post_content = (include WP_PLUGIN_DIR . '/lhg-hardware-profile-manager/templates/subscribe.php');
     } elseif ($post_ID > 0 && $this->is_author($target_post->post_author)) {
         $include_post_content = (include WP_PLUGIN_DIR . '/lhg-hardware-profile-manager/templates/author.php');
     } elseif ($post_ID > 0 && !empty($email) && !empty($key) && !empty($action) && $this->is_user_subscribed($post_ID, $email, 'C') && $this->_is_valid_key($key, $email) && $action == 'c') {
         $include_post_content = (include WP_PLUGIN_DIR . '/lhg-hardware-profile-manager/templates/confirm.php');
     } elseif (!empty($email) && (!empty($key) && $this->_is_valid_key($key, $email) || current_user_can('read'))) {
         $include_post_content = (include WP_PLUGIN_DIR . '/lhg-hardware-profile-manager/templates/user.php');
     }
     if (empty($include_post_content)) {
         $include_post_content = (include WP_PLUGIN_DIR . '/lhg-hardware-profile-manager/templates/request-management-link.php');
     }
     if ($show_user_profile == 1) {
         $include_post_content = (include WP_PLUGIN_DIR . '/lhg-hardware-profile-manager/templates/user_public.php');
     }
     if ($show_scan_profile == 1) {
         $include_post_content = (include WP_PLUGIN_DIR . '/lhg-hardware-profile-manager/templates/scan.php');
     }
     if ($show_editscan_profile == 1) {
         $include_post_content = (include WP_PLUGIN_DIR . '/lhg-hardware-profile-manager/templates/scan.php');
     }
     if ($show_public_profile == 1) {
         $include_post_content = (include WP_PLUGIN_DIR . '/lhg-hardware-profile-manager/templates/scan.php');
     }
     if ($show_uid_profile == 1) {
         $include_post_content = (include WP_PLUGIN_DIR . '/lhg-hardware-profile-manager/templates/uid.php');
     }
     global $wp_query;
     $manager_page_title = html_entity_decode(get_option('subscribe_reloaded_manager_page_title', 'Manage subscriptions'), ENT_COMPAT, 'UTF-8');
     # Show alternative title, if this is the public profile of someone else
     $url = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $pieces = parse_url($url);
     $urlpath = $pieces['path'];
     $hwprofpos = strpos($urlpath, "/hardware-profile/user");
     $url_user_id = (int) substr($urlpath, $hwprofpos + 22);
     if (strpos($urlpath, "/hardware-profile/user") !== false or strpos($urlpath, "/hardware-profile/guser") !== false) {
         if (get_current_user_id() != $url_user_id) {
             # sets name for user profile
             $user = get_userdata($url_user_id);
             $name = $user->display_name;
             # sets name for guser profile
             if (strpos($urlpath, "/hardware-profile/guser") !== false) {
                 $hwprofposg = strpos($urlpath, "/hardware-profile/guser");
                 $url_guid = (int) substr($urlpath, $hwprofposg + 23);
                 $guser = lhg_get_userdata_guid($url_guid);
                 $name = $guser[0]->user_nicename;
                 #error_log("GUID: $url_guid -> name: $name");
             }
             global $txt_hwprof_of;
             $manager_page_title = $txt_hwprof_of . " " . $name;
         }
     }
     # set title for system scans
     if (strpos($urlpath, "/hardware-profile/system") !== false) {
         #extract SID
         $hwscanpos = strpos($urlpath, "/hardware-profile/system-");
         $pub_id = substr($urlpath, $hwscanpos + 25);
         $myquery = $lhg_price_db->prepare("SELECT sid FROM `lhgscansessions` WHERE pub_id = %s", $pub_id);
         $sid = $lhg_price_db->get_var($myquery);
         # get scan data for title
         $myquery = $lhg_price_db->prepare("SELECT id, scandate, kversion, distribution FROM `lhgscansessions` WHERE sid = %s", $sid);
         #$sql = "SELECT id FROM `lhgshops` WHERE region <> \"de\"";
         $identified_scans = $lhg_price_db->get_results($myquery);
         #var_dump($identified_scans);
         $scandate = $identified_scans[0]->scandate;
         $scandate_txt = gmdate("Y-m-d, H:i:s", $scandate);
         $distribution = $txt_subscr_unknown;
         #"unknown";
         $kversion = $txt_subscr_unknown;
         #"unkwnown";
         $distribution = $identified_scans[0]->distribution;
         $kversion = $identified_scans[0]->kversion;
         global $txt_subscr_hwscantitle;
         $manager_page_title = sanitize_text_field($txt_subscr_hwscantitle . " " . $distribution . " / " . $kversion . " / " . $scandate_txt);
     }
     if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
         $manager_page_title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($manager_page_title);
     }
     $posts[] = (object) array('ID' => '9999999', 'post_author' => '1', 'post_date' => '2001-01-01 11:38:56', 'post_date_gmt' => '2001-01-01 00:38:56', 'post_content' => $include_post_content, 'post_title' => $manager_page_title, 'post_excerpt' => '', 'post_status' => 'publish', 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_password' => '', 'to_ping' => '', 'pinged' => '', 'post_modified' => '2001-01-01 11:00:01', 'post_modified_gmt' => '2001-01-01 00:00:01', 'post_content_filtered' => '', 'post_parent' => '0', 'menu_order' => '0', 'post_type' => 'page', 'post_mime_type' => '', 'post_category' => '0', 'comment_count' => '0', 'filter' => 'raw', 'guid' => get_bloginfo('url') . '/?page_id=9999999', 'post_name' => get_bloginfo('url') . '/?page_id=9999999', 'ancestors' => array());
     // Make WP believe this is a real page, with no comments attached
     $wp_query->is_page = true;
     $wp_query->is_single = false;
     $wp_query->is_home = false;
     $wp_query->comments = false;
     // Discard 404 errors thrown by other checks
     unset($wp_query->query["error"]);
     $wp_query->query_vars["error"] = "";
     $wp_query->is_404 = false;
     // Seems like WP adds its own HTML formatting code to the content, we don't need that here
     remove_filter('the_content', 'wpautop');
     add_action('wp_head', array(&$this, 'add_custom_header_meta'));
     return $posts;
 }
function lhg_menu_hw_scans()
{
    global $lhg_price_db;
    if ($_POST != "") {
        lhg_db_update_scaninfo();
    }
    $res = lhg_db_get_scan_sids();
    print "<h1>Hardware Scans</h1>";
    print "<br>";
    #print "POST:";
    #var_dump ( $_POST );
    #var_dump( $res );
    print '<form action="admin.php?page=lhg_menu_hw_scans" method="post">';
    $user = wp_get_current_user();
    $userid = $user->ID;
    #defaults
    $show_new = true;
    $show_ongoing = true;
    $show_complete = false;
    $show_feedback = false;
    $show_new = get_user_meta($userid, 'lhg_scan_show_new', true);
    $show_ongoing = get_user_meta($userid, 'lhg_scan_show_ongoing', true);
    $show_complete = get_user_meta($userid, 'lhg_scan_show_complete', true);
    $show_feedback = get_user_meta($userid, 'lhg_scan_show_feedback', true);
    #not defined -> set defaults
    #if ($show_new      == "") {add_user_meta( $userid, 'lhg_scan_show_new',      true , true); $show_new      = true;}
    #if ($show_ongoing  == "") {add_user_meta( $userid, 'lhg_scan_show_ongoing',  true , true); $show_ongoing  = true;}
    #if ($show_complete == "") {add_user_meta( $userid, 'lhg_scan_show_complete', false, true); $show_complete = false;}
    print "Show: ";
    # $userid: $show_new - $show_ongoing - $show_complete";
    $show_new == true ? print '<input name="filter_show_new" type="checkbox" value="1" checked /> New ' : (print '<input name="filter_show_new" type="checkbox" value="1" /> New ');
    $show_ongoing == true ? print '<input name="filter_show_ongoing" type="checkbox" value="true" checked /> Ongoing ' : (print '<input name="filter_show_ongoing" type="checkbox" value="false" /> Ongoing ');
    $show_complete == true ? print '<input name="filter_show_complete" type="checkbox" value="true" checked /> Complete ' : (print '<input name="filter_show_complete" type="checkbox" value="false" /> Complete ');
    $show_feedback == true ? print '<input name="filter_show_feedback" type="checkbox" value="true" checked /> Feedback needed ' : (print '<input name="filter_show_feedback" type="checkbox" value="false" /> Feedback needed ');
    print "<table border=1><tr>";
    print "<td><b>Date</b></td><td><b>Link</b></td><td><b>Comment User</b></td> <td><b>Comment Admins</b></td> <td><b>Status</b></td> </tr>";
    foreach ($res as $resN) {
        $sid = $resN->sid;
        $status = $resN->status;
        if ($status == "" or $status == "duplicate" or $status == "new" && $show_new == true or $status == "ongoing" && $show_ongoing == true or $status == "feedback" && $show_feedback == true or $status == "complete" && $show_complete == true) {
            $pub_id = $resN->pub_id;
            if ($result->pub_id == "") {
                $pub_id = lhg_create_pub_id($sid);
            }
            $time = $resN->scandate;
            $date = gmdate("m/d/Y g:i:s A", $time);
            $acomment = $resN->admincomment;
            $ucomment = $resN->usercomment;
            #
            # check for comments on articles, i.e. cycle through all postids
            $myquery = $lhg_price_db->prepare("SELECT usercomment FROM `lhghwscans` WHERE sid = %s", $sid);
            $commentlist = $lhg_price_db->get_results($myquery);
            foreach ($commentlist as $usercomment) {
                if ($usercomment->usercomment != "") {
                    if ($ucomment == "") {
                        $ucomment .= $usercomment->usercomment;
                    } else {
                        $ucomment .= "; " . $usercomment->usercomment;
                    }
                }
            }
            $email = $resN->email;
            $ucomment_short = $ucomment;
            if (strlen($ucomment) > 50) {
                $ucomment_short = substr(sanitize_text_field($ucomment), 0, 50) . "...";
            }
            $distribution = $resN->distribution;
            $status = $resN->status;
            #$sid2 = $res[1]->sid;
            #var_dump ($sid ."--".$sid2);
            #print "SID: $sid<br>";
            #extract userdata
            $uploader_guid = lhg_get_scan_uploader_guid($sid);
            $usertxt = "";
            $duplicate_txt = "";
            if ($status == "duplicate") {
                $duplicate_txt = "dup";
            }
            if ($uploader_guid > 0) {
                $user_tmp = lhg_get_userdata_guid($uploader_guid);
                $user = $user_tmp[0];
                $user_nicename = $user->user_nicename;
                $avatar = $user->avatar;
                $wpuid_de = $user->wpuid_de;
                $wpuid_com = $user->wpuid;
                #Gravatar stored avatar image
                if (strpos($avatar, "gravatar") > 1) {
                    $start = strpos($avatar, "src='");
                    $imgurl = substr($avatar, $start + 5);
                    $tmp = explode("' class", $imgurl);
                    $imgurl = $tmp[0];
                    $usertxt = '<img src="' . $imgurl . '" width="20px" heigth="20px" title="User: '******'" alt="User: '******'">';
                } else {
                    if (strpos($avatar, "http://")) {
                        #local avatar .com
                        $start = strpos($avatar, 'src="');
                        $imgurl = substr($avatar, $start + 5);
                        $tmp = explode('" class', $imgurl);
                        $imgurl = $tmp[0];
                        $usertxt = '<img src="' . $imgurl . '" width="20px" heigth="20px" title="User: '******'" alt="User: '******'">';
                    } else {
                        #local avatar .de
                        $start = strpos($avatar, "src='");
                        $imgurl = substr($avatar, $start + 5);
                        $tmp = explode("' class", $imgurl);
                        $imgurl = $tmp[0];
                        $usertxt = '<img src="http://www.linux-hardware-guide.de' . $imgurl . '" width="20px" heigth="20px" title="User: '******'" alt="User: '******'">';
                    }
                }
            }
            $statusSelector = '
				<select name="status-' . $sid . '">';
            $statusSelector .= ($status == "new" or $status == "duplicate") ? '<option value="new" selected>New</option>' : '<option value="new">New</option>';
            $statusSelector .= $status == "ongoing" ? '<option value="ongoing" selected>Ongoing</option>' : '<option value="ongoing">Ongoing</option>';
            $statusSelector .= $status == "complete" ? '<option value="complete" selected>Complete</option>' : '<option value="complete">Complete</option>';
            $statusSelector .= $status == "feedback" ? '<option value="feedback" selected>Feedback needed</option>' : '<option value="feedback">Feedback needed</option>';
            $statusSelector .= '</select>';
            $distrilogo = get_distri_logo($distribution);
            if ($email == "") {
                $maillogo = '<span class="emailgrey" style="color: grey; font-weight: bold; font-size: 1.4em; position: relative; top: -3px;"> @</span>';
            }
            #<i class="icon-envelope icon-large2"></i>';
            if ($email != "") {
                $maillogo = '<span class="emailgreen" style="color: green; font-weight: bold; font-size: 1.4em; position: relative; top: -3px;">@</span>';
            }
            #<i class="icon-envelope icon-large2"></i>';
            $commentavail = '<span class="emailgrey" style="color: grey; font-weight: bold; font-size: 1.4em; position: relative; top: -3px;">C</span>';
            if ($ucomment != "") {
                $commentavail = '<span class="emailgreen" style="color: green; font-weight: bold; font-size: 1.4em; position: relative; top: -3px;">C</span>';
            }
            #<i class="icon-envelope icon-large2"></i>';
            $ratingavail = '<img src="/wp-content/plugins/wp-postratings/images/stars_crystal/rating_off.gif">';
            if ($rated != "") {
                $ratingavail = '<img src="/wp-content/plugins/wp-postratings/images/stars_crystal/rating_on.gif">';
            }
            print "<tr>";
            print "<td>{$date} </td>";
            print '<td><a href="/hardware-profile/editscan-' . $sid . '">' . $sid . '</a> (<a href="/hardware-profile/system-' . $pub_id . '">pub</a>)</td>';
            $tooltiptext = "Distribution: " . preg_replace("/\r|\n/", "", $resN->distribution) . "\nKernel: " . preg_replace("/\r|\n/", "", $resN->kversion);
            print '<td>
                          <img src="' . $distrilogo . '" alt="' . $tooltiptext . '" title="' . $tooltiptext . '" width=20>
                          ' . $maillogo . " " . $commentavail . " " . $ratingavail . " " . $usertxt . " " . $duplicate_txt . " " . $ucomment_short . "</td>";
            print '<td>
	        	        <input name="hwscan_acomment_' . $sid . '" type="text" size="20" value="' . $acomment . '">
	                       </td>';
            print "<td>{$statusSelector}</td>";
            print "</tr>";
        }
    }
    print "</tr></table>";
    print '<input type="submit" value="update">';
    print "</form>";
}