index cbebb11ea2207fb96391581e689b35a3fb6a9b01..c32be66ae6821f9ddc0803b84ccebfa239378808 100644 (file)
$this->s_error = "";
$this->i_pointer = 0;
- $this->get_new_id();
-
/* Check file accessibility */
if(!file_exists($this->s_queue_file)){
$this->set_error(sprintf(_("Can't locate gotomasses queue file '%s'."),$this->s_queue_file));
continue;
}
- $entry_id = $task_id= 0;
+ $entry_id = $task_id= "";
/* Comment must be set correctly */
if(empty($comment)){
$desc = "";
}else{
- $task_id =preg_replace("/^.*taskid:([0-9]*).*$/","\\1",$comment);
- $entry_id=preg_replace("/^.*entryid:([0-9]*).*$/","\\1",$comment);
+ $task_id =preg_replace("/^.*taskid:([0-9a-z]*).*$/i","\\1",$comment);
+ $entry_id=preg_replace("/^.*entryid:([0-9a-z]*).*$/i","\\1",$comment);
$desc =preg_replace("/^.*desc:(.*)$/","\\1",$comment);
}
- if($task_id == 0 || empty($task_id)){
- $task_id = preg_replace("/[^0-9]*/","",microtime());
+ if($task_id == "" || empty($task_id)){
+ $task_id = $this->get_new_id();
}
- if($entry_id == 0 || empty($entry_id)){
- $entry_id = preg_replace("/[^0-9]*/","",microtime());
+ if($entry_id == "" || empty($entry_id)){
+ $entry_id = $this->get_new_id();
}
/* Get unige id */
while(in_array($entry_id,$used_ids)){
- $entry_id = preg_replace("/[^0-9]*/","",microtime());
+ $entry_id = $this->get_new_id();
}
$used_ids[] = $entry_id;
}
$entry['Comment'] = $desc;
$this->a_queue[] = $entry;
-
}
+ $comment = "";
}
/* Udpate ENTRY_ID -> id mapping */
return(TRUE);
}
- private function _add_entry($entry,$task_id = 0)
+ private function _add_entry($entry,$task_id = "")
{
- if($task_id == 0 || empty($task_id)){
- $task_id=preg_replace("/[^0-9]*/","",microtime());
+ if($task_id == "" || empty($task_id)){
+ $task_id = $this->get_new_id();
}
$entry['TASK_ID'] = $task_id;
if(!isset($entry['ID']) || empty($entry['ID']) || !isset($entry['ID']) || empty($entry['ID'])){
- $entry['ID'] = preg_replace("/[^0-9]*/","",microtime());
+ $entry['ID'] = $this->get_new_id();
}
$this->a_queue[] = $entry;
public function add_multiple($array)
{
- $task_id = preg_replace("/[^0-9]*/","",microtime());
+ $task_id = $this->get_new_id();
foreach($array as $entry){
if(!$this->_add_entry($entry,$task_id)){
return(FALSE);
private function get_new_id()
{
+ $mt = microtime();
+ $sec = preg_replace("/^0.([0-9]*) ([0-9]*)$/","\\2",$mt);
+ $msec = preg_replace("/^0.([0-9]*) ([0-9]*)$/","\\1",$mt);
+ return(strtoupper(base_convert($sec,10,36).base_convert($msec,10,36)));
}
public function min_entry_priority($id)