38 if (
$db->query(
"UPDATE {tips} SET published = '".$published.
"' WHERE id = '".
$id.
"'"))
44 \YAWK\sys::setSyslog(
$db, 3, 1,
"failed to set tip of the day ID #$this->id to published state 0",0, 0, 0, 0);
71 if (
$db->query(
"INSERT INTO {tips} (published, tipClass, tipHeading, tipText, tipLink)
91 public function getRandomTipData(
$db)
100 $sql =
"WHERE published = 1";
103 if (
$res =
$db->query(
"SELECT * FROM {tips} $sql ORDER BY rand() LIMIT 1"))
106 $row = mysqli_fetch_assoc(
$res);
108 if (is_array($row) && (!empty($row)))
110 foreach ($row as $property =>
$value)
112 $this->$property =
$value;
135 public function getNextTipData(
$db)
139 if (
$res =
$db->query(
"SELECT * FROM {tips} WHERE published = 1 ORDER BY id ASC LIMIT 1"))
142 $row = mysqli_fetch_assoc(
$res);
144 if (is_array($row) && (!empty($row)))
146 foreach ($row as $property =>
$value)
148 $this->$property =
$value;
158 if (
$db->query(
"UPDATE {tips} SET published = 1"))
161 $this->getNextTipData(
$db);
183 $this->getNextTipData(
$db);
187 if (isset($this->tipLink) && (!empty($this->tipLink)))
189 if (filter_var($this->tipLink, FILTER_VALIDATE_URL))
191 $this->tipText .=
"<br><a href=\"#\">$this->tipLink</a>";
194 if (isset($this->tipHeading) && (empty($this->tipHeading)))
199 else if (isset($this->tipText) && (empty($this->tipText)))
206 if($this->setPublished(
$db, $this->
id, 0) ==
false)
208 return "failed to set tip to zero";
212 return alert::draw(
"tipofday",
"Tip #$this->id - $this->tipHeading",
"$this->tipText",
'', 10000);
print $lang['FILEMAN_UPLOAD']
Throws a fancy Bootstrap Alert (success, info, warning or danger)
static draw($type, $title, $text, $redirect, $delay)
static getSetting($db, $property)
Get and return value for property from settings database.
TipOfDay class serve functions to get and draw a tip of the day.
drawTip($db, $lang)
Draw tip of the day.
This class serves methods to create backup from files.