summaryrefslogtreecommitdiffstats
path: root/lib/class
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-26 03:32:13 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-26 03:32:13 +0000
commit00417ad9658bd68f347f45e1ef8c5327fed95648 (patch)
treef3b18fef0de27c0e0a54538179f2fce4cd576257 /lib/class
parentc56aeb1b7003ed10da98a8bbc8305a5cb90357a6 (diff)
downloadampache-00417ad9658bd68f347f45e1ef8c5327fed95648.tar.gz
ampache-00417ad9658bd68f347f45e1ef8c5327fed95648.tar.bz2
ampache-00417ad9658bd68f347f45e1ef8c5327fed95648.zip
fixed preg on file pattern, some work on flagging, editing stuff actually flags thing again...
Diffstat (limited to 'lib/class')
-rw-r--r--lib/class/flag.class.php42
-rw-r--r--lib/class/vainfo.class.php1
2 files changed, 10 insertions, 33 deletions
diff --git a/lib/class/flag.class.php b/lib/class/flag.class.php
index 56256a39..f27d7fc6 100644
--- a/lib/class/flag.class.php
+++ b/lib/class/flag.class.php
@@ -26,7 +26,6 @@
*/
class Flag {
- /* DB based variables */
public $id;
public $user;
public $object_id;
@@ -46,25 +45,17 @@ class Flag {
*/
public function __construct($flag_id=0) {
- $this->id = intval($flag_id);
+ if (!$flag_id) { return false; }
- if (!$this->id) { return false; }
+ $info = $this->_get_info($flag_id);
- $info = $this->_get_info();
+ foreach ($info as $key=>$value) {
+ $this->$key = $value;
+ }
- $this->user = $info['user'];
- $this->object_id = $info['object_id'];
- $this->object_type = $info['object_type'];
- $this->comment = $info['comment'];
- $this->flag = $info['flag'];
- $this->date = $info['date'];
- $this->approved = $info['approved'];
- $f_user = $this->format_user();
- $this->f_user_fullname = $f_user['fullname'];
- $this->f_user_username = $f_user['username'];
return true;
- } // flag
+ } // Constructor
/**
* _get_info
@@ -72,7 +63,7 @@ class Flag {
*/
private function _get_info() {
- $id = Dba::escape($this->id);
+ $id = Dba::escape($flag_id);
$sql = "SELECT * FROM `flagged` WHERE `id`='$id'";
$db_results = Dba::query($sql);
@@ -121,7 +112,7 @@ class Flag {
} // get_total
/**
- * get_flagged
+ * get_all
* This returns an array of ids of flagged songs if no limit is passed
* it gets everything
*/
@@ -182,7 +173,7 @@ class Flag {
$approved = '0';
/* If they are an content manager or higher, it's auto approved */
- if ($GLOBALS['user']->has_access('75')) { $approved = '1'; }
+ if (Access::check('interface','75')) { $approved = '1'; }
$sql = "INSERT INTO `flagged` (`object_id`,`object_type`,`flag`,`comment`,`date`,`approved`,`user`) VALUES " .
" ('$id','$type','$flag','$comment','$time','$approved','$user')";
@@ -221,21 +212,6 @@ class Flag {
} // approve
/**
- * format_user
- * This formats username etc
- */
- function format_user() {
-
- $sql = "SELECT * FROM user WHERE id = '$this->user'";
- $db_results = mysql_query($sql, dbh());
-
- $f_user = mysql_fetch_assoc($db_results);
-
- return $f_user;
-
- } // format_user
-
- /**
* format_name
* This function formats and sets the $this->name variable and $this->title
*/
diff --git a/lib/class/vainfo.class.php b/lib/class/vainfo.class.php
index 34447277..5a595f2b 100644
--- a/lib/class/vainfo.class.php
+++ b/lib/class/vainfo.class.php
@@ -482,6 +482,7 @@ class vainfo {
$preg_pattern = preg_quote($pattern);
$preg_pattern = preg_replace("/\%\w/","(.+)",$preg_pattern);
$preg_pattern = str_replace("/","\/",$preg_pattern);
+ $preg_pattern = str_replace(" ","\s",$preg_pattern);
$preg_pattern = "/" . $preg_pattern . "\..+$/";
preg_match($preg_pattern,$filename,$matches);
/* Cut out the Full line, we don't need that */