Ejemplo n.º 1
1
	public function _reset_quota($owner_id){
		$date = date("Y-m-d");// current date
		$insert = array('id'=>get_uuid(),
						'owner_id'=>$owner_id,
						'sms_available'=>$this->default_sms_amount,
						'period_start'=>date( 'Y-m-d H:i:s', time()),
						'period_end'=>date("Y-m-d H:i:s", strtotime(Date("Y-m-d H:i:s") . " +1 month")),
						'active'=>1
						);
		$this->db->where('owner_id',$owner_id);
		$this->db->update('billing',array('active'=>0));

		$this->db->insert('billing',$insert);
	}
Ejemplo n.º 2
0
 /**
  * OPTIONAL; Anything in this function will be run before each test
  * Good for doing cleanup: resetting sessions, renewing objects, etc.
  */
 function _pre()
 {
     unset($this->ids);
     $this->ids = array();
     $this->date = date("Y-m-d");
     $this->load->model('user_model');
     $this->data['user']['fake_email'] = "*****@*****.**";
     $this->data['user']['password'] = "******";
     $this->data['user']['timezone'] = "UP10";
     $this->ids[] = $this->user_model->register($this->data['user']['fake_email'], $this->data['user']['password'], $this->data['user']['timezone']);
     $insert_id = get_uuid();
     //gc
     $this->ids[] = $insert_id;
     $this->data['quota'] = array('id' => $insert_id, 'owner_id' => $this->ids[0], 'sms_available' => 10, 'period_start' => date('Y-m-d H:i:s', time()), 'period_end' => date("Y-m-d H:i:s", strtotime($this->date . " +1 month")), 'active' => 1);
 }
Ejemplo n.º 3
0
	function save_template($owner_id, $template_name, $template_text, $fields_required){
		$new_template_id = get_uuid();
		$template['owner_id'] = $owner_id;
		if($template_text == ""){
			$this->errors[] = "Template text must be entered.";
			return false;
		}
		if($template_name == ""){
			$this->errors[] = "Template name must be entered.";
			return false;
		}
		$template['id'] = $new_template_id;
		$template['name'] = $template_name;
		$template['text'] = $template_text;
		
		foreach($fields_required as $field_required)
		{
			$insert = array();
			$insert['template_id'] = $new_template_id;
			$insert['id'] = get_uuid();
			$insert['name'] = $field_required;
			$this->db->insert('template_fields',$insert);
		}
		$this->db->insert('templates',$template);


		return $new_template_id;
	}
Ejemplo n.º 4
0
 public function uuid()
 {
     for ($i = 0; $i < 10; $i++) {
         echo get_uuid() . "<br />";
     }
 }
Ejemplo n.º 5
0
function register_new_member(Member $member)
{
    if (!is_member($member->email)) {
        $connection = connect();
        $member->password = md5($member->password);
        $sql = "INSERT INTO team_members (member_id, first_name, last_name, email, password, dob, official_dob, reset_code) VALUES (NULL, '" . $member->first_name . "', '" . $member->last_name . "', '" . $member->email . "' , '" . $member->password . "', '3000-01-01', '" . $member->official_dob . "','" . get_uuid() . "')";
        $result = $connection->query($sql);
        disconnect($connection);
        if ($result == true) {
            $member_id_result = query_sql("SELECT `member_id` FROM `team_members` WHERE `email` = '" . $member->email . "'");
            $member_id = get_query_result($member_id_result, 'member_id');
            $result = array("registered" => true, "status_code" => 200, "member_id" => $member_id);
        } else {
            $result = array("registered" => false, "status_code" => 401, "error" => "Registration failed due to internal error");
        }
    } else {
        $result = array("registered" => false, "status_code" => 409, "error" => "Member already Registered");
    }
    return $result;
}
Ejemplo n.º 6
0
// 'uuid' and if so, exit.
$xpath = new \DOMXPath($dom);
$existing_uuid_identifiers = $xpath->query("//mods:identifier[@type='uuid']");
if ($existing_uuid_identifiers->length > 0) {
    exit;
}
// If there were none, continue.
// Make a backup copy of the MODS file.
if (!copy($mods_XML_path, $mods_XML_path . '.bak')) {
    print "Could not copy {$mods_XML_path} to {$mods_XML_path}.bak\n";
    exit(1);
}
// Build the <identifier> element we are adding.
$type = $dom->createAttribute('type');
$type->value = 'uuid';
$uuid_identifier = $dom->createElement('identifier', get_uuid());
$uuid_identifier->appendChild($type);
// Figure out where to add it. If one ore more <identifier> elements
// exist in the document, add the new one before the first existing one.
$identifiers = $dom->getElementsByTagName('identifier');
if ($identifiers->length) {
    $dom->documentElement->insertBefore($uuid_identifier, $identifiers->item(0));
} else {
    // If none exist, append it to the end of the document.
    $dom->documentElement->appendChild($uuid_identifier);
}
$mods_xml = $dom->saveXML();
file_put_contents($mods_XML_path, $mods_xml);
/**
 * Gets the UUID by calling 'uuidgen' via the shell.
 */