<commit_before><?php

// Response json for errors
$json = array();

/**
 * Send position to allowed devices
 */
if (isset($_GET["message"]) && isset($_GET["allowed"])) {
    $message = $_GET["message"];
    $allowed = explode(";", $_GET["allowed"]);
    
    // Include db connect class
    require_once __DIR__ . '/db_connect.php';
    
    // Connecting to db
    $db = new DB_CONNECT();
    
    // Include gcm class
    include_once './gcm.php';
    
    // Get all users
    $users = mysql_query("SELECT * FROM users");
    
    // Check if we got an result
    if ($users) {
        // Get all rows
        $no_of_users = mysql_num_rows($users);
        
        // Array for the gcm ids of the allowed users 
        $receivers_gcm_ids = array();
        
        // Go throw every row and check if the user was allowed to get the update
        while ($row = mysql_fetch_array($users)) {
            if (array_search($row["number"], $allowed) !== false) {
                // Add the users gcm id to the receivers
                array_push($receivers_gcm_ids, $row["gcm"]);
            }
        }
        
        // When there more than on receiver send the update to google cloud messaging 
        if (count($receivers_gcm_ids) > 0) {
            // Add the message
            $message = array(
                "message" => $message
            );
            
            // Send it!
            echo GCM::send_notification($receivers_gcm_ids, $message);
        }
    } else {
        // Database error
        $response["success"] = 0;
        $response["message"] = "Database error!";
        
        // Echoing JSON response
        echo json_encode($response);
    }
} else {
    // Required field is missing
    $response["success"] = 0;
    $response["message"] = "Required field(s) is missing!";
    
    // Echoing JSON response
    echo json_encode($response);
}

?><commit_msg>Added error message when known numbers is empty<commit_after><?php

// Response json for errors
$json = array();

/**
 * Send position to allowed devices
 */
if (isset($_GET["message"]) && isset($_GET["allowed"])) {
    $message = $_GET["message"];
    $allowed = explode(";", $_GET["allowed"]);
    
    // Include db connect class
    require_once __DIR__ . '/db_connect.php';
    
    // Connecting to db
    $db = new DB_CONNECT();
    
    // Include gcm class
    include_once './gcm.php';
    
    // Get all users
    $users = mysql_query("SELECT * FROM users");
    
    // Check if we got an result
    if ($users) {
        // Get all rows
        $no_of_users = mysql_num_rows($users);
        
        // Array for the gcm ids of the allowed users 
        $receivers_gcm_ids = array();
        
        // Go throw every row and check if the user was allowed to get the update
        while ($row = mysql_fetch_array($users)) {
            if (array_search($row["number"], $allowed) !== false) {
                // Add the users gcm id to the receivers
                array_push($receivers_gcm_ids, $row["gcm"]);
            }
        }
        
        // When there more than on receiver send the update to google cloud messaging 
        if (count($receivers_gcm_ids) > 0) {
            // Add the message
            $message = array(
                "message" => $message
            );
            
            // Send it!
            echo GCM::send_notification($receivers_gcm_ids, $message);
        } else {
			// Database error
			$response["success"] = 0;
			$response["message"] = "No allowed number!";
			
			// Echoing JSON response
			echo json_encode($response);
		}
    } else {
        // Database error
        $response["success"] = 0;
        $response["message"] = "Database error!";
        
        // Echoing JSON response
        echo json_encode($response);
    }
} else {
    // Required field is missing
    $response["success"] = 0;
    $response["message"] = "Required field(s) is missing!";
    
    // Echoing JSON response
    echo json_encode($response);
}

?>
{'fraction_non_alphanumeric': 0.1288312982805881, 'fraction_numerical': 0.00174433092449539, 'mean_word_length': 1.8856937455068297, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5680154', 'n_tokens_mistral': 1177, 'n_tokens_neox': 1138, 'n_words': 339}