Beispiel #1
0
#$sql = "SELECT id FROM `lhgshops` WHERE region <> \"de\"";
#$multi_identified_hw = $lhg_price_db->get_results($myquery);
#var_dump( $multi_identified_hw );
#while ( ($id, $postid) = $sth_glob->fetchrow_array() ){
#
#        print "ID: $id - PID: $postid <br>";
#
#}
$result = $lhg_price_db->get_var($sql);
#print "<br># Results:";
#print_r( count($identified_hw) );
#print "<br>";
#print '<b>Scan Overview</b>';
#Thank you for using our Linux-Hardware-Guide scanning software</b> (see <a href="https://github.com/paralib5/lhg_scanner">GitHub</a> for more details).<br>
#This way we can fill our Linux Hardware Database with valuable information for the Linux community.</b>';
$email = lhg_get_hwscanmail($sid);
if ($email != "") {
    $userknown = 1;
}
#$buttontext = "Submit";
#if ($userknown == 1) $buttontext = "Update";
#print "";
#print '
#<br>&nbsp;<br>
#<h2>Contact information</h2>
#<form action="?" method="post">
#       Please leave us your email address in order to contact you in case of questions regarding your hardware scan results:<br>
#       <b>Email</b>: <input name="email" type="text" size="30" maxlength="50" value="'.$email.'">
#       <input type="submit" name="email-login" value="'.$buttontext.'" class="hwscan-email-button-'.$buttontext.'" />
#</form>
#';
Beispiel #2
0
function lhg_scan_check_changes($sid)
{
    #ä user submitted something
    #print "Changes identified!<br>";
    #var_dump($_POST);
    # check which id number he submitted
    $keys = array_keys($_POST);
    #echo $keys[0];
    if (substr($keys[0], 0, 8) == "comment-") {
        $commentid = substr($keys[0], 8);
        #print "ID: $commentid";
        lhg_scan_updateid($sid, $commentid);
    }
    if (substr($keys[0], 0, 20) == "usercomment-feedback") {
        # feedback was provided. Write to DB
        $comment_text = $_POST["usercomment-feedback"];
        $uid = get_current_user_id();
        if ($_POST["usercomment-feedback"] != "") {
            lhg_create_feedbackcomment($sid, $comment_text, $uid);
        }
    }
    #print substr($keys[0], 0, 17);
    #var_dump($keys);
    if (substr($keys[0], 0, 17) == "usercomment_multi") {
        $commentid = substr($keys[0], 18);
        #print "ID multi: $commentid - Text:".$_POST["usercomment_multi_".$commentid];
        lhg_update_usercomment_multi($sid, $_POST["usercomment_multi_" . $commentid], $commentid);
    }
    print "<br>";
    #check if values are updated
    if ($_POST["email"] != "") {
        lhg_scan_check_mail($sid);
    }
    $db_email = lhg_get_hwscanmail($sid);
    if ($db_email != $_POST["email"] and $_POST["email"] != "") {
        lhg_update_mail($sid, $_POST["email"]);
    }
    $db_usercomment = lhg_get_usercomment($sid);
    if ($db_usercomment != $_POST["usercomment"] and $_POST["usercomment"] != "") {
        lhg_update_usercomment($sid, $_POST["usercomment"]);
    }
    $db_mb_usercomment = lhg_get_mb_usercomment($sid);
    if ($db_mb_usercomment != $_POST["mb-usercomment"] and $_POST["mb-usercomment"] != "") {
        lhg_update_mb_usercomment($sid, $_POST["mb-usercomment"]);
    }
    $db_url_mb = lhg_get_mb_url($sid);
    if ($db_url_mb != $_POST["url-mb"] and $_POST["url-mb"] != "") {
        lhg_update_mb_url($sid, $_POST["url-mb"]);
    }
    #$db_usercomment_multi = lhg_get_usercomment_multi ($sid);
    #if ( ($db_usercomment != $_POST["usercomment"]) and ($_POST["usercomment"] != "") ) lhg_update_usercomment( $sid, $_POST["usercomment"] );
}
function lhg_db_update_status($sid, $value, $uid)
{
    //if initiated by ajax, we need some functions from scan.php
    require_once WP_PLUGIN_DIR . '/lhg-hardware-profile-manager/templates/scan.php';
    global $lhg_price_db;
    # retrieve old status
    $sql = "SELECT status FROM `lhgscansessions` WHERE sid = \"" . $sid . "\"";
    $old_status = $lhg_price_db->get_var($sql);
    if ($old_status == "") {
        $old_status = "new";
    }
    if ($old_status == $value) {
        return;
    }
    # nothing to do! Do not waste time with id transformations
    # write status changelog: status was change at ... from ... to ... by ...
    $comment_text = $old_status . " -> " . $value;
    $sql = $lhg_price_db->prepare("INSERT INTO `lhgscan_comments` (comment_text, comment_date, scanid, user, commenttype)\n                       VALUES  (%s, %s, %s, %s, %s)", $comment_text, time(), $sid, $uid, "status_change");
    $id = $lhg_price_db->query($sql);
    # store new status
    $sql = "SELECT id FROM `lhgscansessions` WHERE sid = \"" . $sid . "\"";
    $id = $lhg_price_db->get_var($sql);
    $sql = "UPDATE `lhgscansessions` SET status = \"" . $value . "\" WHERE id = \"" . $id . "\"";
    $result = $lhg_price_db->get_var($sql);
    if ($value == "complete" && $old_value != "complete") {
        #get mail address
        $myquery = $lhg_price_db->prepare("SELECT email FROM `lhgscansessions` WHERE sid = %s ", $sid);
        $email = $lhg_price_db->get_var($myquery);
        if ($email == "") {
            $email = lhg_get_hwscanmail($sid);
        }
        #send mail notification to user
        if ($email != "") {
            $subject = "LHG Hardware Scan - Finished";
            $headers[] = 'Reply-To: Linux Hardware Guide <*****@*****.**>';
            $message = 'Hello,

Thank you for uploading your hardware data to the Linux-Hardware-Guide.
Your scan data was processed and added to the web page. You can find your scan results at
http://www.linux-hardware-guide.com/hardware-profile/scan-' . $sid . '

Please visit this page and rate the Linux compatibility of your hardware components and also leave
comments (e.g., if additional steps are needed for the hardware or if everything works out of the box).

In case of further questions do not hesitate to contact us under webmaster@linux-hardware-guide.com.

Best regards,
Linux-Hardware-Guide Team
';
            error_log("Complete mail: {$email}");
            wp_mail($email, $subject, $message, $headers);
        }
    }
}