7 public function __construct($message){
8 $this->Message
= new Message
;
11 public function setFollowLines($file){
12 $handle = fopen($file, "r");
13 while (($line = fgets($handle)) !== false) {
15 $this->array[$line] = $line;
19 public function getFollowLines($value){
21 return $this->array[$value];
27 public function addLines($value, $firsttime = FALSE){
29 file_put_contents($this->filename
, $value.PHP_EOL
);
31 file_put_contents($this->filename
, $value.PHP_EOL
,FILE_APPEND
);
35 public function removeID($array, $value){
36 unset($array[$value]);
37 $array = implode(PHP_EOL
, $array);
38 $array = (empty($array)) ?
trim($array) : $array.PHP_EOL
;
40 file_put_contents($this->filename
, $array);
44 public function checkFollow($userID){
48 $npath = $this->Message
->GetPath(FDB_PATH
, "FDB");
53 $this->filename
= $npath."/follow.txt";
55 if(file_exists($this->filename
)){
56 static::setFollowLines($this->filename
);
57 $value = static::getFollowLines($userID);
58 return ($value!=NULL) ?
TRUE : FALSE;
60 //create a file please.
62 $fh = fopen($this->filename
, 'w');