80 if (!isset($template)){
81 $template =
new template();
104 $result =
$db->query(
"SELECT name FROM {templates} WHERE name = '".
$name.
"'");
108 sys::setSyslog(
$db, 45, 0,
"template $name not found in database", 0, 0, 0, 0);
113 sys::setSyslog(
$db, 45, 0,
"template $name updated", 0, 0, 0, 0);
119 sys::setSyslog(
$db, 45, 0,
"template param $name not set or wrong type", 0, 0, 0, 0);
139 if (!isset($status) || (!is_numeric($status))) {
144 if (
$db->query(
"UPDATE {template_settings}
145 SET value = '" . $status .
"'
161 static function getTemplatePositions(
object $db)
168 if (
$res =
$db->query(
"SELECT positions
170 WHERE id = '" . $tpl_id .
"'")
173 while ($row =
$res->fetch_assoc()) {
176 $pos = $posArray[0][
'positions'];
183 sys::setSyslog(
$db, 47, 1,
"failed to get template positions of template id: <b>$tpl_id</b> ", 0, 0, 0, 0);
205 $replace = array(
"/ä/",
"/ü/",
"/ö/",
"/Ä/",
"/Ü/",
"/Ö/",
"/ß/");
206 $chars = array(
"ae",
"ue",
"oe",
"Ae",
"Ue",
"Oe",
"ss");
207 $this->newTplName = preg_replace($replace, $chars, $this->newTplName);
209 $this->newTplName = preg_replace(
"/[^a-z0-9\-\/]/i",
"", $this->newTplName);
211 $this->
name = preg_replace($replace, $chars, $this->
name);
213 $this->
name = preg_replace(
"/[^a-z0-9\-\/]/i",
"", $this->
name);
218 if (
$res = $db->query(
"INSERT INTO {templates} (name, positions, description, releaseDate, author, authorUrl, weblink, subAuthor, subAuthorUrl, modifyDate, version, framework, license)
219 VALUES('" . $this->newTplName .
"',
220 '" . $this->positions .
"',
221 '" . $this->description .
"',
223 '" . $this->author .
"',
224 '" . $this->authorUrl .
"',
225 '" . $this->weblink .
"',
226 '" . $this->subAuthor .
"',
227 '" . $this->subAuthorUrl .
"',
229 '" . $this->version .
"',
230 '" . $this->framework .
"',
231 '" . $this->license .
"')"))
237 sys::setSyslog(
$db, 47, 1,
"failed to save <b>$this->newTplName</b> as new template", 0, 0, 0, 0);
243 if (is_dir(dirname(
"../system/templates/$this->name")))
246 sys::xcopy(
"../system/templates/$this->name",
"../system/templates/$this->newTplName");
247 sys::setSyslog(
$db, 47, 1,
"copy template folder from ../system/templates/$this->name to ../system/templates/$this->newTplName", 0, 0, 0, 0);
253 sys::setSyslog(
$db, 47, 1,
"failed to copy template - template name $this->name does not exist", 0, 0, 0, 0);
267 $res =
$db->query(
"SELECT * FROM {templates} WHERE id = '" .
$id .
"'");
268 if ($row = mysqli_fetch_assoc(
$res)) {
269 $this->
id = $row[
'id'];
270 $this->active = $row[
'active'];
271 $this->
name = $row[
'name'];
272 $this->positions = $row[
'positions'];
274 $this->releaseDate = $row[
'releaseDate'];
275 $this->author = $row[
'author'];
276 $this->authorUrl = $row[
'authorUrl'];
277 $this->weblink = $row[
'weblink'];
278 $this->subAuthor = $row[
'subAuthor'];
279 $this->subAuthorUrl = $row[
'subAuthorUrl'];
280 $this->modifyDate = $row[
'modifyDate'];
281 $this->version = $row[
'version'];
282 $this->framework = $row[
'framework'];
283 $this->license = $row[
'license'];
287 sys::setSyslog(
$db, 47, 1,
"failed to load properties of template <b>$this->name</b> (id: <b>$id</b>)", 0, 0, 0, 0);
303 $res =
$db->query(
"SELECT * FROM {templates} WHERE id = '" .
$id .
"'");
304 if ($row = mysqli_fetch_assoc(
$res))
306 if (!is_array($row) || (empty($row)))
317 sys::setSyslog(
$db, 47, 1,
"failed to load properties of template id <b>$id</b> into array", 0, 0, 0, 0);
331 $res =
$db->query(
"SELECT * FROM {template_settings} WHERE templateID = '" .
$id .
"'");
332 while ($row = mysqli_fetch_assoc(
$res))
343 sys::setSyslog(
$db, 47, 1,
"failed to load template_settings of template id <b>$id</b> into array", 0, 0, 0, 0);
359 if (!isset(
$data) || (!isset(
$id))) {
371 if (fnmatch(
'*-longValue', $property))
381 if ($property !=
"save" && ($property !=
"customCSS") && ($property !=
"testText")) {
388 $this->setTemplateSetting(
$db,
$id, $property,
$value, $longValue);
404 $res =
$db->query(
"SELECT * FROM {template_settings_types}");
405 while ($row = mysqli_fetch_assoc(
$res))
407 $settingsTypes[] = $row;
409 if (isset($settingsTypes) && (is_array($settingsTypes) && (!empty($settingsTypes))))
411 return $settingsTypes;
415 sys::setSyslog(
$db, 47, 1,
"failed to load template_settings_types into array", 0, 0, 0, 0);
430 $mysqlRes =
$db->query(
"SELECT id, name
433 while ($row = mysqli_fetch_assoc($mysqlRes)) {
439 sys::setSyslog(
$db, 47, 1,
"failed get template id and name ", 0, 0, 0, 0);
450 static function countTemplateSettings(
object $db,
int $templateID): int
454 $res =
$db->query(
"SELECT id FROM {template_settings}
456 return mysqli_num_rows(
$res);
465 public static function getTemplateNameById(
object $db,
int $templateID): ?string
472 if (
$res =
$db->query(
"SELECT name from {templates} WHERE id = $templateID")) {
473 if ($row = mysqli_fetch_row(
$res)) {
477 sys::setSyslog(
$db, 47, 1,
"failed to get template name by id <b>$templateID</b> ", 0, 0, 0, 0);
490 public static function getTemplateIdByName(
object $db,
string $name): ?int
498 if (
$res =
$db->query(
"SELECT id from {templates} WHERE name = '$name'"))
500 if ($row = mysqli_fetch_row(
$res))
508 sys::setSyslog(
$db, 47, 1,
"failed to get template ID by name <b>$name</b> ", 0, 0, 0, 0);
522 public static function getCurrentTemplateName(
object $db,
string $location,
int $templateID)
525 if (!isset($location) || (empty($location))) {
526 $location =
"frontend";
529 if ($location ==
"frontend") {
543 $tpldir =
$prefix .
"system/templates/";
544 if (
$res =
$db->query(
"SELECT name FROM {templates}
545 WHERE id = $templateID")
547 if ($row = mysqli_fetch_row(
$res)) {
548 if (!$dir = @opendir(
"$tpldir" . $row[0])) {
549 sys::setSyslog(
$db, 47, 1,
"failed to load template directory of template id: <b>$templateID</b>", 0, 0, 0, 0);
550 return "<b>Oh-oh! There was a big error. . .</b> <u>you shall not see this!</u><br><br>Unable to load template " . $row[0] .
". I am deeply sorry.<br> I am sure my administrator is hurry to fix that problem.<br> yours,<br>YaWK <i><small>(Yet another Web Kit)</i></small>";
557 return "template ID $templateID not in database...?";
572 public function writeTemplateCssFile(
object $db,
int $tplId,
string $content,
int $minify): bool
576 if (!isset($tplId) || (empty($tplId))) {
580 $filename = self::getSettingsCSSFilename(
$db,
"backend", $tplId);
582 if (isset($minify) && (!empty($minify))) {
588 sys::setSyslog(
$db, 47, 1,
"failed to minify template css <b>$filename</b>", 0, 0, 0, 0);
595 sys::setSyslog(
$db, 48, 2,
"failed to write <b>$filename</b> Please check file / folder owner or group permissions", 0, 0, 0, 0);
596 alert::draw(
"danger",
"Error!",
"Could not template CSS file $filename<br>Please check your file / owner or group permissions.",
"", 4200);
598 if (!fclose($handle)) {
599 sys::setSyslog(
$db, 47, 1,
"failed to close <b>$filename</b>", 0, 0, 0, 0);
600 alert::draw(
"warning",
"Warning!",
"Failed to template CSS file close $filename<br>Please try again and / or expect some errors.",
"", 4200);
603 sys::setSyslog(
$db, 47, 1,
"failed to chmod 775 to template CSS file <b>$filename</b>", 0, 0, 0, 0);
604 alert::draw(
"warning",
"Warning!",
"Failed to chmod(775) $filename<br>Please check file / folder / owner / group permissions!",
"", 4200);
625 if (isset($minify) && (!empty($minify))) {
631 sys::setSyslog(
$db, 47, 1,
"failed to minify file <b>$filename</b>", 0, 0, 0, 0);
639 alert::draw(
"danger",
"Error!",
"Could not write custom css $filename<br>Please check your file / owner or group permissions.",
"", 4200);
641 if (!fclose($handle)) {
642 alert::draw(
"warning",
"Warning!",
"Failed to close custom css $filename<br>Please try again and / or expect some errors.",
"", 4200);
645 alert::draw(
"warning",
"Warning!",
"Failed to chmod(775) custom css $filename<br>Please check file / folder / owner / group permissions!",
"", 4200);
666 if (isset($minify) && (!empty($minify))) {
672 sys::setSyslog(
$db, 47, 1,
"failed to minify file <b>$filename</b>", 0, 0, 0, 0);
680 alert::draw(
"danger",
"Error!",
"failed to write file $filename<br>Please check your file / owner or group permissions.",
"", 4200);
682 if (!fclose($handle)) {
683 alert::draw(
"warning",
"Warning!",
"Failed to close custom js $filename<br>Please try again and / or expect some errors.",
"", 4200);
686 alert::draw(
"warning",
"Warning!",
"Failed to chmod(775) custom js $filename<br>Please check file / folder / owner / group permissions!",
"", 4200);
723 public function getSettingsCSSFilename(
object $db,
string $location,
int $templateID): string
730 if (!isset($location) || (empty($location))) {
731 $location =
"Backend";
733 $tplName = self::getCurrentTemplateName(
$db, $location,
$templateID);
735 $filename =
"../system/templates/$tplName/css/" . $alias .
".css";
746 public function getCustomCSSFilename(
object $db,
string $location,
int $templateID): string
750 $tplName = self::getCurrentTemplateName(
$db, $location,
$templateID);
752 $filename =
"../system/templates/$tplName/css/" . $alias .
".css";
767 $tplName = self::getCurrentTemplateName(
$db, $location,
$templateID);
769 $filename =
"../system/templates/$tplName/js/" . $alias .
".js";
782 if (
$res =
$db->query(
"SELECT MAX(id) from {templates}")) {
783 if ($row = mysqli_fetch_row(
$res)) {
786 sys::setSyslog(
$db, 47, 1,
"failed to get MAX(id) from template db", 0, 0, 0, 0);
807 sys::setSyslog(
$db, 47, 1,
"failed to delete file <b>$filename</b>", 0, 0, 0, 0);
808 alert::draw(
"danger",
"Error!",
"Failed to unlink $filename<br>Please delete this file and check file / folder / owner or group permissions!",
"", 6200);
814 sys::setSyslog(
$db, 47, 1,
"failed to delete settings css file because it does not exist.", 0, 0, 0, 0);
827 function setTemplateSetting(
$db,
$id, $property,
$value, $longValue)
830 $property =
$db->quote($property);
832 $longValue =
$db->quote($longValue);
834 $longValue = strip_tags($longValue);
835 if ($longValue ===
"1") {
841 if (
$res =
$db->query(
"UPDATE {template_settings}
843 WHERE property = '" . $property .
"'
844 AND templateID = '" .
$id .
"'")
848 sys::setSyslog(
$db, 47, 1,
"failed to set template #$id setting <b>$value</b> of <b>$property</b> ", 0, 0, 0, 0);
867 if (!
$res =
$db->query(
"UPDATE {templates} SET active = 0 WHERE active != 0")) {
870 if (
$res =
$db->query(
"UPDATE {templates}
872 WHERE id = $templateID")
876 sys::setSyslog(
$db, 47, 1,
"failed to set template #$templateID active ", 0, 0, 0, 0);
888 public static function copyTemplateSettings(
$db,
$templateID, $newID)
892 $res =
$db->query(
"INSERT INTO {template_settings}
893 (templateID, property, value, valueDefault, longValue, type, activated, sort, label, fieldClass, fieldType,
894 options, placeholder, description, icon, heading, subtext)
895 SELECT '" . $newID .
"', property, value, valueDefault, longValue, type, activated, sort, label, fieldClass, fieldType,
896 options, placeholder, description, icon, heading, subtext
897 FROM {template_settings}
901 sys::setSyslog(
$db, 47, 1,
"failed to copy template settings of template #$templateID ", 0, 0, 0, 0);
902 alert::draw(
"danger",
"Could not copy settings",
"please try again.",
"", 5000);
904 alert::draw(
"success",
"Settings copied",
"successful",
"", 5000);
906 $update =
$db->query(
"UPDATE {template_settings} SET templateID='" . $newID .
"' WHERE templateID=0");
908 alert::draw(
"success",
"Settings are set-up",
"successful",
"", 5000);
910 sys::setSyslog(
$db, 47, 1,
"failed to set new template settings of template #$templateID ", 0, 0, 0, 0);
911 alert::draw(
"warning",
"Could not set new template settings",
"unable to alter IDs.",
"", 5000);
938 function addTemplateSetting(
$db, $property,
$value, $valueDefault, $label, $fieldclass, $placeholder)
945 $property =
$db->quote($property);
947 $valueDefault =
$db->quote($valueDefault);
948 $label =
$db->quote($label);
949 $fieldclass =
$db->quote($fieldclass);
950 $placeholder =
$db->quote($placeholder);
951 if (
$res =
$db->query(
"INSERT INTO {template_settings} (templateID, property, value, valueDefault, label, activated, sort, fieldClass, placeholder)
952 VALUES('" .
$templateID .
"','" . $property .
"', '" .
$value .
"', '" . $valueDefault .
"', '" . $label .
"', '" .
$active .
"', '" . $sort .
"', '" . $fieldclass .
"', '" . $placeholder .
"')")
956 sys::setSyslog(
$db, 47, 1,
"failed to add template setting $property:$value ", 0, 0, 0, 0);
976 sys::setSyslog(
$db, 47, 1,
"failed to set template details", 0, 0, 0, 0);
992 sys::setSyslog(
$db, 47, 1,
"failed to delete template because templateID was missing.", 0, 0, 0, 0);
1001 $templateFolder = template::getCurrentTemplateName(
$db,
"backend",
$templateID);
1004 if (is_dir(dirname(__dir__.
"../system/templates/".$templateFolder.
"")))
1009 sys::setSyslog(
$db, 47, 1,
"failed to delete recursive ../system/templates/$templateFolder", 0, 0, 0, 0);
1016 if (!
$res =
$db->query(
"DELETE FROM {template_settings} WHERE templateID = $templateID"))
1018 sys::setSyslog(
$db, 47, 1,
"failed to delete template settings of ID: $templateID", 0, 0, 0, 0);
1023 if (!
$res =
$db->query(
"DELETE FROM {assets} WHERE templateID = $templateID"))
1025 sys::setSyslog(
$db, 47, 1,
"failed to delete template assets of ID: $templateID", 0, 0, 0, 0);
1030 if (!
$res =
$db->query(
"DELETE FROM {templates} WHERE id = $templateID"))
1032 sys::setSyslog(
$db, 47, 1,
"failed to delete template ID: $templateID from database", 0, 0, 0, 0);
1038 if (
$res =
$db->query(
"SELECT MAX(id) FROM {templates}"))
1040 $row = mysqli_fetch_row(
$res);
1041 if (!
$res =
$db->query(
"ALTER TABLE {templates} AUTO_INCREMENT $row[0]"))
1043 sys::setSyslog(
$db, 47, 1,
"failed alter auto increment templates table ", 0, 0, 0, 0);
1063 if (!isset($user) || empty($user))
1070 if ($user->overrideTemplate == 1) {
1071 $sql =
"SELECT ts.property, ts.value, ts.longValue, ts.valueDefault, ts.type, ts.label, ts.sort, ts.fieldClass, ts.fieldType, ts.placeholder, ts.description, ts.options, ts.activated, ts.icon, ts.heading, ts.subtext
1072 FROM {template_settings} ts
1073 JOIN {users} u on u.templateID = ts.templateID
1074 WHERE ts.activated = 1 && u.id = $user->id
1077 $sql =
"SELECT ts.property, ts.value, ts.longValue, ts.valueDefault, ts.type, ts.label, ts.sort, ts.fieldClass, ts.fieldType, ts.placeholder, ts.description, ts.options, ts.activated, ts.icon, ts.heading, ts.subtext
1078 FROM {template_settings} ts
1079 JOIN {settings} s on s.value = ts.templateID
1080 WHERE ts.activated = 1 && s.property = 'selectedTemplate'
1084 sys::setSyslog(
$db, 47, 1,
"failed to get template settings array - user is not set or empty", 0, 0, 0, 0);
1091 $settingsArray = array();
1092 while ($row =
$res->fetch_assoc()) {
1093 $settingsArray[$row[
'property']] = $row;
1096 sys::setSyslog(
$db, 5, 1,
"failed to query template settings", 0, 0, 0, 0);
1102 if (is_array($settingsArray) && (!empty($settingsArray))) {
1103 return $settingsArray;
1120 global $currentpage;
1121 if (isset($row) && (!empty($row))) {
1123 $startRow =
"<div class=\"row\">";
1135 if (
$positions[
"pos-$position-enabled"] ===
"1")
1137 if (
$indicators[
"pos-$position-indicator"] ===
"1")
1139 $indicatorStyle =
"style=\"border: 1px solid red;\"";
1140 $indicatorText =
"<i><b>$position</b></i>";
1144 $indicatorStyle =
'';
1145 $indicatorText =
'';
1150 echo
"<div class=\"$bootstrapGrid pos-$position\" id=\"$position\" $indicatorStyle>$indicatorText";
1172 echo
'Template settings are missing. Please re-install template.';
1180 if (!isset($setting[
'fieldType']) && (empty($fieldType)))
1182 $setting[
'fieldType'] =
"input";
1187 if ($setting[
'type'] ===
"$type" && ($setting[
'activated'] ===
"1"))
1191 if (isset($setting[
'icon']) && (!empty($setting[
'icon'])))
1193 $setting[
'icon'] =
"<i class=\"$setting[icon]\"></i>";
1197 $setting[
'icon'] =
'';
1202 if (isset($setting[
'label']) && (!empty($setting[
'label'])))
1204 $setting[
'label'] =
$lang[$setting[
'label']];
1208 $setting[
'label'] =
'sorry, there is not label set. meh!';
1213 if (isset($setting[
'heading']) && (!empty($setting[
'heading'])))
1215 $setting[
'heading'] =
$lang[$setting[
'heading']];
1219 $setting[
'heading'] =
'';
1224 if (isset($setting[
'subtext']) && (!empty($setting[
'subtext'])))
1226 $setting[
'subtext'] =
$lang[$setting[
'subtext']];
1230 $setting[
'subtext'] =
'';
1235 if (isset($setting[
'description']) && (!empty($setting[
'description'])))
1237 $setting[
'description'] =
$lang[$setting[
'description']];
1238 $setting[
'description'] =
" <small><i class=\"fa fa-question-circle-o text-info\" data-placement=\"auto right\" data-toggle=\"tooltip\" title=\"$setting[description]\"></i></small>";
1242 if ($setting[
'fieldType'] ===
"select")
1244 if (!empty($setting[
'icon']) || (!empty($setting[
'heading']) || (!empty($setting[
'subtext']))))
1246 echo
"<br><h4 class=\"box-title\">$setting[icon] $setting[heading] <small>$setting[subtext]</small></h4>";
1249 echo
"<label for=\"$setting[property]\">$setting[label] $setting[description]
1250 <small><i class=\"small\" style=\"font-weight:normal\">$lang[DEFAULT]: $setting[valueDefault]</i></small></label>
1251 <select style=\"margin-bottom:10px;\" class=\"form-control\" id=\"$setting[property]\" name=\"$setting[property]\">";
1252 echo
"<option value=\"$setting[value]\">$lang[SETTING_CURRENT] $setting[value]</option>";
1254 $optionValues = explode(
":", $setting[
'options']);
1255 foreach ($optionValues as
$value)
1260 $optionDesc = preg_replace(
'/.*,(.*)/',
'$1',
$value);
1261 $optionValue = preg_split(
"/,[a-zA-Z0-9]*/",
$value);
1263 echo
"<option value=\"$optionValue[0]\">$optionDesc</option>";
1269 else if ($setting[
'fieldType'] ===
"radio")
1271 if (!empty($setting[
'icon']) || (!empty($setting[
'heading']) || (!empty($setting[
'subtext']))))
1273 echo
"<br><h4 class=\"box-title\">$setting[icon] $setting[heading] <small>$setting[subtext]</small></h4>";
1275 echo
"<label for=\"$setting[property]\">$setting[label] $setting[description] </label>
1276 <input style=\"margin-bottom:10px;\" type=\"radio\" id=\"$setting[property]\" name=\"$setting[property]\">";
1277 echo
"<input type=\"radio\" value=\"$setting[value]\">$lang[SETTING_CURRENT] $setting[value]</option>";
1280 $optionValues = explode(
":", $setting[
'options']);
1281 foreach ($optionValues as
$value)
1284 $optionValue = preg_replace(
"/,[a-zA-Z0-9]*/",
"",
$value);
1286 $optionDesc = preg_replace(
'/.*,(.*)/',
'$1',
$value);
1288 echo
"<option value=\"$optionValue\">$optionDesc</option>";
1294 else if ($setting[
'fieldType'] ===
"checkbox")
1296 if ($setting[
'value'] ===
"1")
1298 $checked =
"checked";
1304 if (!empty($setting[
'icon']) || (!empty($setting[
'heading']) || (!empty($setting[
'subtext']))))
1306 echo
"<br><h4 class=\"box-title\">$setting[icon] $setting[heading] <small>$setting[subtext]</small></h4>";
1308 echo
"<input type=\"hidden\" name=\"$setting[property]\" value=\"0\">
1309 <input type=\"checkbox\" id=\"$setting[property]\" name=\"$setting[property]\" value=\"1\" $checked>
1310 <label style=\"margin-bottom:10px;\" for=\"$setting[property]\"> $setting[label] $setting[description] </label>";
1314 else if ($setting[
'fieldType'] ===
"checkbox toggle")
1317 if ($setting[
'value'] ===
"1")
1319 $checked =
"checked";
1326 if (!empty($setting[
'icon']) || (!empty($setting[
'heading']) || (!empty($setting[
'subtext']))))
1328 echo
"<br><h4 class=\"box-title\">$setting[icon] $setting[heading] <small>$setting[subtext]</small></h4>";
1330 echo
"<input type=\"hidden\" name=\"$setting[property]\" value=\"0\">
1331 <input type=\"checkbox\" data-on=\"$lang[ON_]\" data-off=\"$lang[OFF_]\" data-toggle=\"toggle\" data-onstyle=\"success\" data-offstyle=\"danger\" id=\"$setting[property]\" name=\"$setting[property]\" value=\"1\" $checked>
1332 <label for=\"$setting[property]\"> $setting[label] $setting[description] </label><hr>";
1336 else if ($setting[
'fieldType'] ===
"textarea")
1338 $placeholder = $setting[
'placeholder'];
1340 if (isset($setting[
'longValue']) && (!empty($setting[
'longValue'])))
1342 $setting[
'longValue'] = nl2br($setting[
'longValue']);
1343 if (!empty($setting[
'icon']) || (!empty($setting[
'heading']) || (!empty($setting[
'subtext']))))
1345 echo
"<h4 class=\"box-title\">$setting[icon] $setting[heading] <small>$setting[subtext]</small></h4>";
1347 echo
"<label for=\"$setting[property]\">$setting[label] $setting[description] </label>
1348 <textarea style=\"margin-bottom:10px;\" cols=\"64\" rows=\"4\" class=\"$setting[fieldClass]\" placeholder=\"$lang[$placeholder]\" id=\"$setting[property]\" name=\"$setting[property]\">$setting[longValue]</textarea>";
1352 $setting[
'value'] = nl2br($setting[
'value']);
1353 if (!empty($setting[
'icon']) || (!empty($setting[
'heading']) || (!empty($setting[
'subtext']))))
1355 echo
"<br><h4 class=\"box-title\">$setting[icon] $setting[heading] <small>$setting[subtext]</small></h4>";
1357 echo
"<label for=\"$setting[property]-long\">$setting[label] $setting[description] </label>
1358 <textarea style=\"margin-bottom:10px;\" cols=\"64\" rows=\"4\" class=\"$setting[fieldClass]\" placeholder=\"$lang[$placeholder]\" id=\"$setting[property]\" name=\"$setting[property]\">$setting[value]</textarea>";
1363 else if ($setting[
'fieldType'] ===
"password")
1365 $placeholder = $setting[
'placeholder'];
1367 if (!empty($setting[
'icon']) || (!empty($setting[
'heading']) || (!empty($setting[
'subtext']))))
1369 echo
"<br><h4 class=\"box-title\">$setting[icon] $setting[heading] <small>$setting[subtext]</small></h4>";
1371 echo
"<label for=\"$setting[property]\">$setting[label]</label> $setting[description]
1372 <input style=\"margin-bottom:10px;\" type=\"password\" class=\"$setting[fieldClass]\" id=\"$setting[property]\" name=\"$setting[property]\"
1373 value=\"$setting[value]\" placeholder=\"$lang[$placeholder]\">";
1376 else if ($setting[
'fieldType'] ===
"input")
1378 $placeholder = $setting[
'placeholder'];
1380 if (!empty($setting[
'icon']) || (!empty($setting[
'heading']) || (!empty($setting[
'subtext']))))
1382 echo
"<br><h4 class=\"box-title\">$setting[icon] $setting[heading] <small>$setting[subtext]</small></h4>";
1384 echo
"<label for=\"$setting[property]\">$setting[label] $setting[description]
1385 <small><i class=\"small\" style=\"font-weight:normal\">$lang[DEFAULT]: $setting[valueDefault]</i></small></label>
1386 <input style=\"margin-bottom:10px;\" type=\"text\" class=\"$setting[fieldClass]\" id=\"$setting[property]\" name=\"$setting[property]\"
1387 value=\"$setting[value]\" placeholder=\"$lang[$placeholder]\">";
1391 else if ($setting[
'fieldType'] ===
"color")
1393 $placeholder = $setting[
'placeholder'];
1394 if (!empty($setting[
'icon']) || (!empty($setting[
'heading']) || (!empty($setting[
'subtext']))))
1396 echo
"<br><h4 class=\"box-title\">$setting[icon] $setting[heading] <small>$setting[subtext]</small></h4>";
1398 echo
"<label for=\"$setting[property]\">$setting[label] $setting[description]
1399 <small><i class=\"small\" style=\"font-weight:normal\">$lang[DEFAULT]: $setting[valueDefault]</i></small></label>
1400 <input style=\"margin-bottom:10px;\" type=\"text\" class=\"$setting[fieldClass]\" id=\"$setting[property]\" name=\"$setting[property]\"
1401 value=\"$setting[value]\" placeholder=\"$lang[$placeholder]\">";
1405 else if ($setting[
'fieldType'] ===
"select template")
1409 if (!empty($setting[
'icon']) || (!empty($setting[
'heading']) || (!empty($setting[
'subtext']))))
1411 echo
"<br><h4 class=\"box-title\">$setting[icon] $setting[heading] <small>$setting[subtext]</small></h4>";
1414 echo
"<label for=\"$setting[property]\">$setting[label] $setting[description]
1415 <small><i class=\"small\" style=\"font-weight:normal\">$lang[DEFAULT]: $setting[valueDefault]</i></small></label>
1416 <select style=\"margin-bottom:10px;\" class=\"form-control\" id=\"$setting[property]\" name=\"$setting[property]\">";
1417 $activeTemplateName = \YAWK\template::getTemplateNameById(
$db, (
int)$setting[
'value']);
1418 echo
"<option value=\"$setting[value]\">$lang[SETTING_CURRENT] $activeTemplateName</option>";
1420 $optionValues = explode(
":", $setting[
'options']);
1421 foreach ($templateArray as $template)
1423 if ($setting[
'value'] != $template[
'id']) {
1424 echo
"<option value=\"".$template[
'id'].
"\"".$markup.
">".$template[
'name'].
"</option>";
1432 $placeholder = $setting[
'placeholder'];
1434 if (!empty($setting[
'icon']) || (!empty($setting[
'heading']) || (!empty($setting[
'subtext']))))
1436 echo
"<br><h4 class=\"box-title\">$setting[icon] $setting[heading] <small>$setting[subtext]</small></h4>";
1438 if (!isset(
$lang[$placeholder]) ||(empty(
$lang[$placeholder]))){ $phMarkup =
""; }
else { $phMarkup =
" placeholder=\"$lang[$placeholder]\""; }
1439 echo
"<label for=\"$setting[property]\">$setting[label] $setting[description]
1440 <small><i class=\"small\" style=\"font-weight:normal\">$lang[DEFAULT]: $setting[valueDefault]</i></small></label>
1441 <input style=\"margin-bottom:10px;\" type=\"text\" class=\"$setting[fieldClass]\" id=\"$setting[property]\" name=\"$setting[property]\"
1442 value=\"$setting[value]\"$phMarkup\">";
1463 $fontRowSize =
"$fontRow-size";
1464 $fontRowColor =
"$fontRow-fontcolor";
1465 $fontRowFontfamily =
"$fontRow-fontfamily";
1466 $fontRowFontShadowSize =
"$fontRow-fontshadowsize";
1467 $fontRowFontShadowColor =
"$fontRow-fontshadowcolor";
1468 $fontRowFontWeight =
"$fontRow-fontweight";
1469 $fontRowFontStyle =
"$fontRow-fontstyle";
1470 $fontRowTextdecoration =
"$fontRow-textdecoration";
1471 $fontRowALinkColor =
"$fontRow-alink";
1472 $fontRowAHoverColor =
"$fontRow-ahover";
1473 $fontRowAVisitedColor =
"$fontRow-avisited";
1474 $fontRowLinkFontWeight =
"$fontRow-linkfontweight";
1475 $fontRowLinkFontStyle =
"$fontRow-linkfontstyle";
1476 $fontRowLinkTextDecoration =
"$fontRow-linktextdecoration";
1477 $fontRowHoverTextDecoration =
"$fontRow-hovertextdecoration";
1478 $fontRowSmallColor =
"$fontRow-smallcolor";
1479 $fontRowSmallShadowSize =
"$fontRow-smallshadowsize";
1480 $fontRowSmallShadowColor =
"$fontRow-smallshadowcolor";
1482 if ($fontRow ===
"globaltext" xor ($fontRow ===
"menufont")) {
1488 $FONT_ROW = strtoupper($fontRow);
1489 $labelFontSize =
"TPL_" . $FONT_ROW .
"_SIZE";
1490 $labelFontColor =
"TPL_" . $FONT_ROW .
"_COLOR";
1491 $labelSmallColor =
"TPL_" . $FONT_ROW .
"_SMALLCOLOR";
1498 $fontRowFamilyInfoBtn =
" <small><i class=\"fa fa-question-circle-o text-info\" data-placement=\"auto right\" data-toggle=\"tooltip\" title=\"$fontRowFamilyDesc\"></i></small>";
1500 $fontRowFamilyInfoBtn =
'';
1504 $fontRowFamilyDefault =
"<i class=\"h6 small\">default: " .
$templateSettings[$fontRowFontfamily][
'valueDefault'] .
"</i>";
1506 $fontRowFamilyDefault =
'';
1511 $fontRowSizeDefault =
"<i class=\"h6 small\">(" .
$templateSettings[$fontRowSize][
'valueDefault'] .
")</i>";
1513 $fontRowSizeDefault =
'';
1517 <div class=\"col-md-$col\">
1518 <div class=\"$previewClass\" id=\"$fontRow-preview\" style=\"height: auto; overflow:hidden; font-size: " .
$templateSettings[$fontRowSize][
'value'] .
"; color: #" .
$templateSettings[$fontRowColor][
'value'] .
";\">$fontRow Heading</div>
1520 <label for=\"$fontRowFontfamily\">$FONT_ROW $lang[TPL_FONTFAMILY] $fontRowFamilyInfoBtn</label>";
1524 <label for=\"$fontRowSize\">$lang[$labelFontSize] $fontRowSizeDefault</label>
1525 <input style=\"margin-bottom:10px;\" id=\"$fontRowSize\" name=\"$fontRowSize\" value=\"" .
$templateSettings[$fontRowSize][
'value'] .
"\" class=\"form-control\">
1527 <label for=\"$fontRowColor\">$lang[$labelFontColor]</label>
1528 <input style=\"margin-bottom:10px;\" id=\"$fontRowColor\" name=\"$fontRowColor\" class=\"form-control color\" value=\"" .
$templateSettings[$fontRowColor][
'value'] .
"\">
1530 <label for=\"$fontRowFontShadowSize\">$lang[TPL_FONTSHADOWSIZE]</label>
1531 <input style=\"margin-bottom:10px;\" id=\"$fontRowFontShadowSize\" name=\"$fontRowFontShadowSize\" class=\"form-control\" value=\"" .
$templateSettings[$fontRowFontShadowSize][
'value'] .
"\" placeholder=\"2px 2px\">
1533 <label for=\"$fontRowFontShadowColor\">$lang[TPL_FONTSHADOWCOLOR]</label>
1534 <input style=\"margin-bottom:10px;\" id=\"$fontRowFontShadowColor\" name=\"$fontRowFontShadowColor\" value=\"" .
$templateSettings[$fontRowFontShadowColor][
'value'] .
"\" class=\"form-control color\">
1536 <label for=\"$fontRowFontWeight\">$lang[TPL_FONTWEIGHT]</label>
1537 <select style=\"margin-bottom:10px;\" id=\"$fontRowFontWeight\" name=\"$fontRowFontWeight\" class=\"form-control\">";
1539 $fontweightStyles = array(
"normal",
"bold",
"bolder",
"lighter",
"100",
"200",
"300",
"400 [normal]",
"500",
"600",
"700 [bold]",
"800",
"900",
"initial",
"inherit");
1540 foreach ($fontweightStyles as $weight) {
1541 $currentFontWeight =
"$fontRow-fontweight";
1543 $selected =
"selected aria-selected=\"true\"";
1547 $html .=
"<option value=\"$weight\" $selected>$weight</option>";
1551 <label for=\"$fontRowFontStyle\">$lang[TPL_FONTSTYLE]</label>
1552 <select style=\"margin-bottom:10px;\" id=\"$fontRowFontStyle\" name=\"$fontRowFontStyle\" class=\"form-control\">";
1554 $fontStyles = array(
"normal",
"italic",
"oblique",
"initial",
"inherit");
1555 foreach ($fontStyles as $style) {
1556 $currentFontStyle =
"$fontRow-fontstyle";
1558 $selected =
"selected aria-selected=\"true\"";
1562 $html .=
"<option value=\"$style\" $selected>$style</option>";
1567 <label for=\"$fontRowTextdecoration\">$lang[TPL_TEXTDECORATION]</label>
1568 <select style=\"margin-bottom:10px;\" id=\"$fontRowTextdecoration\" name=\"$fontRowTextdecoration\" class=\"form-control\">";
1570 $textdecorationTypes = array(
"none",
"underline",
"overline",
"line-through",
"intial",
"inherit");
1571 foreach ($textdecorationTypes as $decoration) {
1572 $currentFontDecoration =
"$fontRow-textdecoration";
1574 $selected =
"selected aria-selected=\"true\"";
1578 $html .=
"<option value=\"$decoration\" $selected>$decoration</option>";
1580 $html .=
"</select>";
1585 <label for=\"$fontRowLinkTextDecoration\">$lang[TPL_LINK_TEXTDECORATION]</label>
1586 <select style=\"margin-bottom:10px;\" id=\"$fontRowLinkTextDecoration\" name=\"$fontRowLinkTextDecoration\" class=\"form-control\">";
1588 foreach ($textdecorationTypes as $decoration) {
1589 $currentLinkTextDecoration =
"$fontRow-linktextdecoration";
1591 $selected =
"selected aria-selected=\"true\"";
1595 $html .=
"<option value=\"$decoration\" $selected>$decoration</option>";
1598 <label for=\"$fontRow-alink\">$lang[TPL_LINK_COLOR]</label>
1599 <input style=\"margin-bottom:10px;\" id=\"$fontRow-alink\" name=\"$fontRow-alink\" value=\"" .
$templateSettings[$fontRowALinkColor][
'value'] .
"\" class=\"form-control color\">
1601 <label for=\"$fontRow-avisited\">$lang[TPL_LINK_VISITED_COLOR]</label>
1602 <input style=\"margin-bottom:10px;\" id=\"$fontRow-avisited\" name=\"$fontRow-avisited\" value=\"" .
$templateSettings[$fontRowAVisitedColor][
'value'] .
"\" class=\"form-control color\">
1604 <label for=\"$fontRow-ahover\">$lang[TPL_LINK_HOVER_COLOR]</label>
1605 <input style=\"margin-bottom:10px;\" id=\"$fontRow-ahover\" name=\"$fontRow-ahover\" value=\"" .
$templateSettings[$fontRowAHoverColor][
'value'] .
"\" class=\"form-control color\">
1607 <label for=\"$fontRowLinkFontWeight\">$lang[TPL_LINK_TEXTDECORATION]</label>
1608 <select style=\"margin-bottom:10px;\" id=\"$fontRowLinkFontWeight\" name=\"$fontRowLinkFontWeight\" class=\"form-control\">";
1610 foreach ($fontweightStyles as $weight) {
1611 $currentLinkFontWeight =
"$fontRow-linkfontweight";
1613 $selected =
"selected aria-selected=\"true\"";
1617 $html .=
"<option value=\"$weight\" $selected>$weight</option>";
1621 <label for=\"$fontRowLinkFontStyle\">$lang[TPL_LINK_FONTSTYLE]</label>
1622 <select style=\"margin-bottom:10px;\" id=\"$fontRowLinkFontStyle\" name=\"$fontRowLinkFontStyle\" class=\"form-control\">";
1624 foreach ($fontStyles as $style) {
1625 $currentLinkFontStyle =
"$fontRow-linkfontstyle";
1627 $selected =
"selected aria-selected=\"true\"";
1631 $html .=
"<option value=\"$style\" $selected>$style</option>";
1635 <label for=\"$fontRowHoverTextDecoration\">$lang[TPL_HOVER_TEXTDECORATION]</label>
1636 <select style=\"margin-bottom:10px;\" id=\"$fontRowHoverTextDecoration\" name=\"$fontRowHoverTextDecoration\" class=\"form-control\">";
1638 foreach ($textdecorationTypes as $decoration) {
1639 $currentFontDecoration =
"$fontRow-hovertextdecoration";
1641 $selected =
"selected aria-selected=\"true\"";
1645 $html .=
"<option value=\"$decoration\" $selected>$decoration</option>";
1647 $html .=
"</select>";
1651 $html .=
"<label for=\"$fontRowSmallColor\">$lang[TPL_SMALLCOLOR]</label>
1652 <input style=\"margin-bottom:10px;\" id=\"$fontRowSmallColor\" name=\"$fontRowSmallColor\" class=\"form-control color\" value=\"" .
$templateSettings[$fontRowSmallColor][
'value'] .
"\">";
1655 $html .=
"<label for=\"$fontRowSmallShadowSize\">$lang[TPL_SMALLSHADOWSIZE]</label>
1656 <input style=\"margin-bottom:10px;\" id=\"$fontRowSmallShadowSize\" name=\"$fontRowSmallShadowSize\" class=\"form-control\" value=\"" .
$templateSettings[$fontRowSmallShadowSize][
'value'] .
"\" placeholder=\"2px 2px\">";
1658 $html .=
"<label for=\"$fontRowSmallShadowColor\">$lang[TPL_SMALLSHADOWCOLOR]</label>
1659 <input style=\"margin-bottom:10px;\" id=\"$fontRowSmallShadowColor\" name=\"$fontRowSmallShadowColor\" value=\"" .
$templateSettings[$fontRowSmallShadowColor][
'value'] .
"\" class=\"form-control color\">";
1684 return "Folder <b>$folder</b> is not a valid folder";
1691 $iterator = new \DirectoryIterator(
$folder);
1693 foreach ($iterator as $file) {
1695 if (!$file->isDot()) {
1696 if ($file->getExtension() ===
"ttf") {
1700 if ($file->getExtension() ===
"otf") {
1704 if ($file->getExtension() ===
"woff") {
1708 if ($file->getExtension() ===
"WOFF") {
1717 return "No fonts found in $folder";
1730 function getSetting(
$db, $filter, $special, $readonly, $user)
1736 if ($filter !=
'%-color') {
1737 $sql =
"&& ts.property NOT RLIKE '.*-color'";
1739 if ($filter !=
'%-bgcolor') {
1740 $sql =
"&& ts.property NOT RLIKE '.*-bgcolor'";
1745 if (isset($readonly)) {
1746 switch ($readonly) {
1748 $readonly =
"readonly=\"readonly\"";
1757 if ($user->overrideTemplate == 1) {
1758 $sql =
"SELECT ts.property, ts.value, ts.longValue, ts.valueDefault, ts.label, ts.fieldClass, ts.placeholder
1759 FROM {template_settings} ts
1760 JOIN {users} u on u.templateID = ts.templateID
1761 WHERE ts.activated = 1 && u.id = $user->id && ts.property
1762 LIKE '$filter' && ts.property NOT RLIKE '.*-pos' $sql ORDER BY ts.sort";
1764 $sql =
"SELECT ts.property, ts.value, ts.longValue, ts.valueDefault, ts.label, ts.fieldClass, ts.placeholder
1765 FROM {template_settings} ts
1766 JOIN {settings} s on s.value = ts.templateID
1767 WHERE ts.activated = 1 && s.property = 'selectedTemplate' && ts.property
1768 LIKE '$filter' && ts.property NOT RLIKE '.*-pos' $sql ORDER BY ts.sort";
1771 sys::setSyslog(
$db, 47, 1,
"failed to get template setting - user is not set or empty.", 0, 0, 0, 0);
1778 while ($row = mysqli_fetch_assoc(
$res)) {
1779 $property = $row[
'property'];
1784 if ($filter ==
"h%-fontsize") {
1786 echo
"<div style=\"display:inline-block;\"><label for=\"" . htmlentities($row[
'property']) .
"\">";
1788 echo
"<input type=\"text\" id=\"h" . $x .
"-fontsize\" class=\"form-control\" name=\"" . htmlentities($row[
'property']) .
"\" value=\"" . htmlentities($row[
'value']) .
"\" />";
1789 echo
"<div id=\"slider$x\"></legend></div>";
1792 if (fnmatch(
'*-longValue', $filter)) {
1794 echo
"<label for=\"" . $row[
'property'] .
"\"><small>" . $row[
'label'] .
" <i class=\"h6 small\">default: " . $row[
'valueDefault'] .
"</i></small></label><br>";
1795 echo
"<div style=\"display:inline-block; width:90%;\"><label for=\"" . htmlentities($row[
'property']) .
"\">";
1796 echo
"<input type=\"hidden\" name=\"$row[property]-long\" id=\"longValue\" value=\"1\">";
1797 echo
"<textarea cols=\"85\" rows=\"12\" id=\"" . $row[
'property'] .
"\" $readonly class=\"form-control\" style=\"font-weight:normal;\" name=\"" . htmlentities($row[
'property']) .
"\">" . $row[
'longValue'] .
"</textarea>";
1799 echo
"<label for=\"" . $row[
'property'] .
"\"><small>" . $row[
'label'] .
" <i class=\"h6 small\">default: " . $row[
'valueDefault'] .
"</i></small></label><br>";
1800 echo
"<div style=\"display:inline-block; \">";
1801 echo
"<input id=\"";
1802 echo $row[
'property'];
1803 echo
"\" placeholder=\"";
1804 echo $row[
'placeholder'];
1805 echo
"\" class=\"form-control ";
1806 echo $row[
'fieldClass'];
1807 echo
"\" type=\"text\" size=\"88\" maxlength=\"255\"";
1809 echo
"name=\"" . htmlentities($row[
'property']) .
"\" value=\"" . htmlentities($row[
'value']) .
"\" /><br>";
1812 if ($special ==
"slider") {
1814 echo
"<div id=\"slider-";
1815 echo $row[
'property'];
1818 echo
"</div></label>";
1821 sys::setSyslog(
$db, 47, 1,
"failed to query template setting ", 0, 0, 0, 0);
1843 if (isset($defaultValue) && (!empty($defaultValue))) {
1844 $defaultValueOption =
"<option value=\"$defaultValue\" selected aria-selected=\"true\">$defaultValue</option>";
1846 $defaultValueOption =
'';
1851 <select style=\"margin-bottom:10px;\" id=\"$selectName\" name=\"$selectName\" class=\"form-control\">
1852 $defaultValueOption;
1853 <optgroup label=\"System Sans-Serif Fonts\"></optgroup>
1854 <option value=\"Arial, Helvetica, sans-serif\"> Arial, Helvetica, sans-serif</option>
1855 <option value=\"Arial Black\"> Arial Black</option>
1856 <option value=\"Comic Sans MS, cursive, sans-serif\"> Comic Sans</option>
1857 <option value=\"Impact, Charcoal, sans-serif\"> Impact, Charcoal, sans-serif</option>
1858 <option value=\"Lucida Sans Unicode, Lucida Grande, sans-serif\"> Lucida Sans Unicode, Lucida Grande, sans-serif</option>
1859 <option value=\"Tahoma, Geneva, sans-serif\"> Tahoma, Geneva, sans-serif</option>
1860 <option value=\"Trebuchet MS, Helvetica, sans-serif\"> Trebuchet MS, Helvetica, sans-serif</option>
1861 <option value=\"Verdana, Geneava, sans-serif\"> Verdana, Geneava, sans-serif</option>
1862 <optgroup label=\"System Serif Fonts\"></optgroup>
1863 <option value=\"Georgia, serif\"> Georgia, serif</option>
1864 <option value=\"Palatino Linotype, Book Antiqua, Palatino, serif\"> Palatino Linotype, Book Antiqua, Palatino, serif</option>
1865 <option value=\"Times New Roman, Times, serif\"> Times New Roman, Times, serif</option>
1866 <optgroup label=\"System Monospace Fonts\"></optgroup>
1867 <option value=\"Courier New, Courier, monospace\"> Courier New, Courier, monospace</option>
1868 <option value=\"Lucida Console, Monaco, monospace\"> Lucida Console, Monaco, monospace</option>";
1873 if (is_dir($this->ttfPath))
1875 $dir = new \DirectoryIterator($this->ttfPath);
1876 $ttfFonts = array();
1877 $otfFonts = array();
1878 $woffFonts = array();
1880 foreach ($dir as
$item) {
1882 && (!
$item->isDir())
1886 if (strtolower(substr(
$item, -3)) ===
"ttf") {
1891 $ttfFonts[] =
"<option value=\"$item\"> $item</option>";
1894 if (strtolower(substr(
$item, -3)) ===
"otf") {
1897 $otfFonts[] =
"<option value=\"$item\"> $item</option>";
1900 if (strtolower(substr(
$item, -4)) ===
"woff") {
1904 $woffFonts[] =
"<option value=\"$item\"> $item</option>";
1910 $selectField .=
"<optgroup label=\"True Type Fonts (system/fonts/*.ttf)\"></optgroup>";
1911 foreach ($ttfFonts as $ttfFont) {
1912 $selectField .= $ttfFont;
1915 $selectField .=
"<optgroup label=\"Open Type Fonts (system/fonts/*.otf)\"></optgroup>";
1916 foreach ($otfFonts as $otfFont) {
1917 $selectField .= $otfFont;
1920 $selectField .=
"<optgroup label=\"Web Open Font Format (system/fonts/*.woff)\"></optgroup>";
1921 foreach ($woffFonts as $woffFont) {
1922 $selectField .= $woffFont;
1930 $selectField .=
"<optgroup label=\"Google Fonts\"></optgroup>";
1934 $selectField .=
"<option value=\"$gFont-gfont\"> $gFont (Google Font)</option>";
1937 $selectField .=
"</select>";
1940 return $selectField;
1954 if (
$sql =
$db->query(
"SELECT font FROM {gfonts} ORDER BY font")) {
1955 while ($row = mysqli_fetch_array(
$sql)) {
1980 if (
$res =
$db->query(
"SELECT ts.property, ts.value, ts.description
1981 FROM {template_settings} ts
1982 JOIN {settings} s on s.value = ts.templateID
1983 WHERE ts.activated = 1 && s.property = 'selectedTemplate' && ts.property = '$item'
1987 while ($row = mysqli_fetch_assoc(
$res)) {
1988 $gfontID = $row[
'value'];
1989 if ($gfontID ===
'0') {
1990 $nc =
"checked=\"checked\"";
1995 echo
"<div id=\"nogooglefont\">
1996 <label for=\"fontType\">$lang[FONT_TYPE_SELECTOR]</label>
1997 <select id=\"fontType\" name=\"fontType\" class=\"form-control\">
1998 <optgroup label=\"System Fonts\">
1999 <option value=\"helvetica\">Helvetica</option>
2000 <option value=\"arial\">Arial</option>
2001 <option value=\"verdana\">Verdana</option>
2002 <optgroup label=\"Own TrueType Font (system/fonts)\">
2009 echo
"<div id=\"googlefontcontainer\">";
2011 if (
$res =
$db->query(
"SELECT id, font, description, activated
2017 while ($row = mysqli_fetch_array(
$res)) {
2022 if ($gfontID ===
"$id") {
2023 $checked =
"checked=\"checked\"";
2028 echo
"<link href=\"http://fonts.googleapis.com/css?family=$row[1]\" rel=\"stylesheet\" type=\"text/css\">";
2029 echo
"<div id=\"googlefont\">
2030 <a class=\"pull-right\" data-confirm=\"Google Font «$value» wirklich löschen?\" href='index.php?page=template-edit&deletegfont=1&gfontid=$id'><i style=\"margin-bottom:5px;\" class=\"fa fa-trash-o\"></i></a>
2031 <input type=\"radio\" $checked name=\"" .
$item .
"\" value=\"$id\">
2032 | <span style=\"font-family:$row[1]; font-size:18px;\">$description</span>
2040 sys::setSyslog(
$db, 47, 1,
"failed to get google fonts from database ", 0, 0, 0, 0);
2055 public static function deleteGfont(
$db, $gfontid, $gfont)
2060 if (!isset($gfontid) || (empty($gfontid))) {
2061 if (isset($gfont) && (!empty($gfont))) {
2063 if (
$res =
$db->query(
"DELETE from {gfonts}
2064 WHERE font LIKE '%" . $gfont .
"%'")
2068 sys::setSyslog(
$db, 47, 1,
"failed to delete google font ID: $gfontid ", 0, 0, 0, 0);
2073 if (
$res =
$db->query(
"DELETE from {gfonts}
2074 WHERE id = '" . $gfontid .
"'")
2078 sys::setSyslog(
$db, 47, 1,
"failed to delete google font ID: $gfontid ", 0, 0, 0, 0);
2095 if (empty($gfont)) {
2101 $gfont =
$db->quote($gfont);
2104 if (
$res =
$db->query(
"SELECT MAX(id) FROM {gfonts}")) {
2105 $row = mysqli_fetch_row(
$res);
2107 if (
$res =
$db->query(
"INSERT INTO {gfonts} (id, font, description)
2112 sys::setSyslog(
$db, 47, 1,
"failed to insert new google font to database", 0, 0, 0, 0);
2116 sys::setSyslog(
$db, 47, 1,
"failed to get MAX(id) from google fonts database", 0, 0, 0, 0);
2129 $bodyFontFaceCSS =
'';
2130 $fontFamily = $tplSettings[
"$cssTagName-fontfamily"];
2132 $fontType = substr($fontFamily, -4);
2134 if ($fontType ===
"-ttf") {
2135 $filename = str_replace(
"-ttf",
".ttf", $fontFamily);
2136 $bodyFontFaceCSS =
"@font-face {
2137 font-family: $fontFamily;
2138 src: url('../../../fonts/$filename');
2140 } elseif ($fontType ===
"-otf") {
2141 $filename = str_replace(
"-otf",
".otf", $fontFamily);
2142 $bodyFontFaceCSS =
"@font-face {
2143 font-family: $fontFamily;
2144 src: url('../../../fonts/$filename');
2146 } elseif ($fontType ===
"woff") {
2147 $filename = str_replace(
"-woff",
".woff", $fontFamily);
2148 $bodyFontFaceCSS =
"@font-face {
2149 font-family: $fontFamily;
2150 src: url('../../../fonts/$filename') !important;
2153 return $bodyFontFaceCSS;
2164 $aLink = $tplSettings[
"$cssTagName-alink"];
2165 $aVisited = $tplSettings[
"$cssTagName-avisited"];
2166 $aHover = $tplSettings[
"$cssTagName-ahover"];
2167 $aWeight = $tplSettings[
"$cssTagName-linkfontweight"];
2168 $aStyle = $tplSettings[
"$cssTagName-linkfontstyle"];
2169 $aDecoration = $tplSettings[
"$cssTagName-linktextdecoration"];
2170 $hoverDecoration = $tplSettings[
"$cssTagName-hovertextdecoration"];
2172 /* TODO: must be out of body */
2175 font-weight: $aWeight;
2176 font-style: $aStyle;
2177 text-decoration: $aDecoration;
2184 text-decoration: $hoverDecoration;
2187 return $bodyLinkTags;
2198 $smallColor = $tplSettings[
"$cssTagName-smallcolor"];
2199 $smallShadowSize = $tplSettings[
"$cssTagName-smallshadowsize"];
2200 $smallShadowColor = $tplSettings[
"$cssTagName-smallshadowcolor"];
2202 $bodySmallTags =
"small,
2205 font-weight: normal;
2207 color: #$smallColor;
2208 text-shadow: $smallShadowSize #$smallShadowColor;
2211 return $bodySmallTags;
2222 $fontFamily = $tplSettings[
"$cssTagName-fontfamily"];
2223 $fontSize = $tplSettings[
"$cssTagName-size"];
2224 $fontColor = $tplSettings[
"$cssTagName-fontcolor"];
2225 $fontShadowSize = $tplSettings[
"$cssTagName-fontshadowsize"];
2226 $fontShadowColor = $tplSettings[
"$cssTagName-fontshadowcolor"];
2227 $fontWeight = $tplSettings[
"$cssTagName-fontweight"];
2228 $fontStyle = $tplSettings[
"$cssTagName-fontstyle"];
2229 $fontTextDecoration = $tplSettings[
"$cssTagName-textdecoration"];
2231 if (substr($fontFamily, -6) ===
"-gfont") {
2232 $googleFont = substr($fontFamily, 0, -6);
2234 font-family: $googleFont !important;
2235 font-size: $fontSize;
2237 text-shadow: $fontShadowSize #$fontShadowColor;
2238 font-weight: $fontWeight;
2239 font-style: $fontStyle;
2240 text-decoration: $fontTextDecoration;
2244 font-family: $fontFamily;
2245 font-size: $fontSize;
2247 text-shadow: $fontShadowSize #$fontShadowColor;
2248 font-weight: $fontWeight;
2249 font-style: $fontStyle;
2250 text-decoration: $fontTextDecoration;
2253 return $bodyFontCSS;
2264 $fontFamily = $tplSettings[
"$cssTagName-fontfamily"];
2265 $fontSize = $tplSettings[
"$cssTagName-size"];
2266 $fontColor = $tplSettings[
"$cssTagName-fontcolor"];
2267 $fontShadowSize = $tplSettings[
"$cssTagName-fontshadowsize"];
2268 $fontShadowColor = $tplSettings[
"$cssTagName-fontshadowcolor"];
2269 $fontWeight = $tplSettings[
"$cssTagName-fontweight"];
2270 $fontStyle = $tplSettings[
"$cssTagName-fontstyle"];
2271 $fontTextDecoration = $tplSettings[
"$cssTagName-textdecoration"];
2272 $aLink = $tplSettings[
"$cssTagName-alink"];
2273 $aVisited = $tplSettings[
"$cssTagName-avisited"];
2274 $aHover = $tplSettings[
"$cssTagName-ahover"];
2275 $aWeight = $tplSettings[
"$cssTagName-linkfontweight"];
2276 $aStyle = $tplSettings[
"$cssTagName-linkfontstyle"];
2277 $aDecoration = $tplSettings[
"$cssTagName-linktextdecoration"];
2278 $hoverDecoration = $tplSettings[
"$cssTagName-hovertextdecoration"];
2279 $smallColor = $tplSettings[
"$cssTagName-smallcolor"];
2280 $smallShadowSize = $tplSettings[
"$cssTagName-smallshadowsize"];
2281 $smallShadowColor = $tplSettings[
"$cssTagName-smallshadowcolor"];
2284 $fontType = substr($fontFamily, -4);
2286 if ($fontType ===
"-ttf") {
2287 $filename = str_replace(
"-ttf",
".ttf", $fontFamily);
2288 $fontCSS =
"@font-face {
2289 font-family: $fontFamily;
2290 src: url('../../../fonts/$filename');
2294 font-family: $fontFamily !important;
2295 font-size: $fontSize;
2297 text-shadow: $fontShadowSize #$fontShadowColor;
2298 font-weight: $fontWeight;
2299 font-style: $fontStyle;
2300 text-decoration: $fontTextDecoration;
2302 $cssTagName a:link { /* LINK SETTINGS */
2304 font-weight: $aWeight;
2305 font-style: $aStyle;
2306 text-decoration: $aDecoration;
2308 $cssTagName a:visited {
2311 $cssTagName a:hover {
2313 text-decoration: $hoverDecoration;
2318 font-weight: normal;
2320 color: #$smallColor;
2321 text-shadow: $smallShadowSize #$smallShadowColor;
2324 } elseif ($fontType ===
"-otf") {
2325 $filename = str_replace(
"-otf",
".otf", $fontFamily);
2326 $fontCSS =
"@font-face {
2327 font-family: $fontFamily;
2328 src: url('../../../fonts/$filename');
2332 font-family: $fontFamily !important;
2333 font-size: $fontSize;
2335 text-shadow: $fontShadowSize #$fontShadowColor;
2336 font-weight: $fontWeight;
2337 font-style: $fontStyle;
2338 text-decoration: $fontTextDecoration;
2340 $cssTagName a:link { /* LINK SETTINGS */
2342 font-weight: $aWeight;
2343 font-style: $aStyle;
2344 text-decoration: $aDecoration;
2346 $cssTagName a:visited {
2349 $cssTagName a:hover {
2351 text-decoration: $hoverDecoration;
2356 font-weight: normal;
2358 color: #$smallColor;
2359 text-shadow: $smallShadowSize #$smallShadowColor;
2362 } elseif ($fontType ===
"woff") {
2363 $filename = str_replace(
"-woff",
".woff", $fontFamily);
2364 $fontCSS =
"@font-face {
2365 font-family: $fontFamily;
2366 src: url('../../../fonts/$filename') !important;
2370 font-family: $fontFamily !important;
2371 font-size: $fontSize;
2373 text-shadow: $fontShadowSize #$fontShadowColor;
2374 font-weight: $fontWeight;
2375 font-style: $fontStyle;
2376 text-decoration: $fontTextDecoration;
2378 $cssTagName a:link { /* LINK SETTINGS */
2380 font-weight: $aWeight;
2381 font-style: $aStyle;
2382 text-decoration: $aDecoration;
2384 $cssTagName a:visited {
2387 $cssTagName a:hover {
2389 text-decoration: $hoverDecoration;
2394 font-weight: normal;
2396 color: #$smallColor;
2397 text-shadow: $smallShadowSize #$smallShadowColor;
2401 elseif (substr($fontFamily, -6) ===
"-gfont") {
2402 $googleFont = substr($fontFamily, 0, -6);
2406 font-family: $googleFont !important;
2407 font-size: $fontSize;
2409 text-shadow: $fontShadowSize #$fontShadowColor;
2410 font-weight: $fontWeight;
2411 font-style: $fontStyle;
2412 text-decoration: $fontTextDecoration;
2415 $cssTagName a:link { /* LINK SETTINGS */
2417 font-weight: $aWeight;
2418 font-style: $aStyle;
2419 text-decoration: $aDecoration;
2421 $cssTagName a:visited {
2424 $cssTagName a:hover {
2426 text-decoration: $hoverDecoration;
2431 font-weight: normal;
2433 color: #$smallColor;
2434 text-shadow: $smallShadowSize #$smallShadowColor;
2441 font-family: $fontFamily;
2442 font-size: $fontSize;
2444 text-shadow: $fontShadowSize #$fontShadowColor;
2445 font-weight: $fontWeight;
2446 font-style: $fontStyle;
2447 text-decoration: $fontTextDecoration;
2450 $cssTagName a:link { /* LINK SETTINGS */
2452 font-weight: $aWeight;
2453 font-style: $aStyle;
2454 text-decoration: $aDecoration;
2456 $cssTagName a:visited {
2459 $cssTagName a:hover {
2461 text-decoration: $hoverDecoration;
2466 font-weight: normal;
2468 color: #$smallColor;
2469 text-shadow: $smallShadowSize #$smallShadowColor;
2484 $bodyFont = template::getTemplateSetting(
$db,
"value",
"globaltext-fontfamily", $user, $template);
2485 $bodyFontFamily =
"font-family: $bodyFont";
2486 return $bodyFontFamily;
2499 if (
$res =
$db->query(
"SELECT id, font, setting
2502 AND id = (SELECT ts.value
2503 FROM {template_settings} ts
2504 JOIN {settings} s on s.value = ts.templateID
2505 WHERE ts.activated = 1 && s.property = 'selectedTemplate' && ts.property = '$property')")
2507 while ($row = mysqli_fetch_array(
$res)) {
2509 if ($row[1] ===
"0") {
2510 return "font-family: Arial";
2513 if ($status ==
"url") {
2514 if (isset($row[2]) || (!empty($row[2]))) {
2516 <link rel=\"stylesheet\" href=\"http://fonts.googleapis.com/css?family=$row[1]:$row[2]\" type=\"text/css\" media=\"all\">";
2519 <link rel=\"stylesheet\" href=\"http://fonts.googleapis.com/css?family=$row[1]\" type=\"text/css\" media=\"all\">";
2522 return "font-family: $row[1];";
2526 return "could not get active google font";
2539 $googleFontFamilyString =
'';
2540 if (
$sql =
$db->query(
"SELECT value FROM {template_settings} WHERE property LIKE '%-fontfamily'")) {
2541 while ($row = mysqli_fetch_row(
$sql)) {
2545 foreach ($fonts as $googleFont) {
2546 if (substr($googleFont, -6) ===
"-gfont") {
2548 $googleFont = rtrim($googleFont,
"gfont");
2549 $googleFont = rtrim($googleFont,
"-");
2551 $googleFontFamilyString .= $googleFont;
2553 $googleFontFamilyString .=
"|";
2556 if (!empty($googleFontFamilyString)) {
2558 $googleFontFamilyString = rtrim($googleFontFamilyString,
"|");
2559 echo
"<link rel=\"dns-prefetch\" href=\"//fonts.googleapis.com\">";
2560 echo
"<link href=\"https://fonts.googleapis.com/css?family=$googleFontFamilyString\" rel=\"stylesheet\">";
2572 static function getTemplateSetting(
$db,
$field, $property, $user, $template)
2579 if ($row =
$db->query(
"SELECT $field
2580 FROM {template_settings}
2581 WHERE property = '" . $property .
"'
2582 AND templateID = '" . $validTemplateID .
"'"))
2584 $res = mysqli_fetch_row($row);
2609 if (isset($user) && (isset($template)))
2612 if ($user->overrideTemplate == 1)
2614 if (!empty($user->templateID))
2616 $validTemplateID = $user->templateID;
2620 if (!empty($template->selectedTemplate))
2622 $validTemplateID = $template->selectedTemplate;
2628 if (!empty($template->selectedTemplate))
2630 $validTemplateID = $template->selectedTemplate;
2639 if (!isset($validTemplateID) || (empty($validTemplateID)))
2644 return $validTemplateID;
2654 global $currentpage;
2657 echo
"<title>" . $currentpage->title .
"</title>
2658 <meta http-equiv=\"Content-Type\" content=\"text/html; charset=\"utf-8\">
2659 <link rel=\"shortcut icon\" href=\"favicon.ico\" type=\"image/x-icon\">
2660 <base href=\"" .
$host .
"/\">";
2661 $get_localtags =
$db->query(
"SELECT name, content
2663 WHERE page = '" . $currentpage->id .
"'");
2664 while ($row = mysqli_fetch_row($get_localtags)) {
2665 if (isset($row[
'1']) && !empty($row[
'1'])) {
2666 echo
"<meta name=\"" . $row[0] .
"\" content=\"" . $row[1] .
"\" />";
2668 $get_globaltags =
$db->query(
"SELECT content
2670 WHERE name = 'description'");
2671 $row = mysqli_fetch_row($get_globaltags);
2673 echo
"<meta name=\"description\" content=\"" . $row[0] .
"\" />";
2689 $sql =
$db->query(
"SELECT property, value
2690 FROM {template_settings}
2691 WHERE property LIKE 'pos-%-enabled' AND
2693 while ($row = mysqli_fetch_assoc(
$sql)) {
2694 $prop = $row[
'property'];
2695 $array[$prop] = $row[
'value'];
2697 if (is_array($array) && (!empty($array))) {
2700 die(
"Positions array not set");
2712 $markedPositions = array();
2713 $sql =
$db->query(
"SELECT property, value
2714 FROM {template_settings}
2716 LIKE 'pos-%-indicator'
2718 while ($row = mysqli_fetch_assoc(
$sql)) {
2719 $prop = $row[
'property'];
2720 $markedPositions[$prop] = $row[
'value'];
2722 if (!empty($markedPositions)) {
2723 return $markedPositions;
2739 $globalmenu_set = 0;
2742 if (empty($setting)) {
2749 if (isset(
$_GET[
'user'])) {
2751 if (empty(
$_GET[
'user'])) {
2752 echo
"<h2>Show all users</h2>";
2756 echo
"<h2>Show Profile of user $_GET[user]</h2>";
2759 elseif (isset(
$_GET[
'blogid'])) {
2760 $blog = new \YAWK\PLUGINS\BLOG\blog();
2767 echo
"<div id=\"$position\">";
2768 $currentpage->getContent(
$db,
$lang);
2777 $globalmenu_set = 1;
2780 if (!$globalmenu_set == 1) {
2781 echo
"<div id=\"$position\">";
2801 $res =
$db->query(
"SELECT property, value, longValue
2802 FROM {template_settings}
2803 WHERE templateID = $templateID");
2805 while ($row = mysqli_fetch_assoc(
$res)) {
2806 $prop = $row[
'property'];
2807 $array[$prop] = $row[
'value'];
2808 $array[$prop] .= $row[
'longValue'];
2822 if (!isset(
$_GET[
'hideWrapper'])) {
2826 <!-- Content Wrapper. Contains page content -->
2827 <div class=\"content-wrapper\" id=\"content-FX\">
2828 <!-- Content Header (Page header) -->
2829 <section class=\"content-header\">";
2831 echo \YAWK\backend::getTitle(
$lang[$title],
$lang[$subtitle]);
2832 echo
"<ol class=\"breadcrumb\">
2833 <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
2834 <li><a href=\"index.php?page=users\" class=\"active\" title=\"$lang[USERS]\"> $lang[USERS]</a></li>
2837 <!-- Main content -->
2838 <section class=\"content\">";
2843 if (
$_GET[
'hideWrapper'] === 1) {
2865 $typeSQLCode =
"AND type = '$type'";
2881 WHERE published = '1'
2882 $typeSQLCode ORDER by sortation, asset");
2884 while ($row = mysqli_fetch_assoc(
$res)) {
2885 $prop = $row[
'asset'];
2886 $assets[$prop][
"asset"] = $prop;
2887 $assets[$prop][
"property"] = $row[
'property'];
2888 $assets[$prop][
"internal"] = $row[
'internal'];
2889 $assets[$prop][
"url1"] = $row[
'url1'];
2890 $assets[$prop][
"url2"] = $row[
'url2'];
2891 $assets[$prop][
"url3"] = $row[
'url3'];
2892 $assets[$prop][
"sortation"] = $row[
'sortation'];
2895 if (is_array($assets)) {
2898 die (
'unable to return assets array - maybe database is corrupt or missing.');
2916 if (
$res =
$db->query(
"SELECT asset, link FROM {assets}
2920 while ($row = mysqli_fetch_assoc(
$res)) {
2922 if (strpos($row[
'link'],
'http://') !==
false || (strpos($row[
'link'],
'https://') !==
false)) {
2923 $icon =
"fa fa-cloud";
2924 $title =
"$lang[EXTERNAL]";
2926 $icon =
"fa fa-server";
2927 $title =
"$lang[INTERNAL]";
2929 $qString = rawurlencode($row[
'asset']);
2931 echo
"<small><a href=\"index.php?page=template-assets\" data-toggle=\"tooltip\" title=\"$title\"><i class=\"$icon text-info\"></i></a></small> $row[asset] <small><a href=\"https://www.google.at/search?q=$qString\" target=\"_blank\" data-toggle=\"tooltip\" title=\"$row[asset] $lang[GOOGLE_THIS]\"><i class=\"fa fa-question-circle-o\"></i></a></small><br>";
2966 foreach ($assets as $asset => $property) {
2967 $resInternal =
$db->query(
"SELECT link from {assets}
2969 AND link = '" . $property[
'internal'] .
"'");
2971 $resUrl1 =
$db->query(
"SELECT link from {assets}
2973 AND link = '" . $property[
'url1'] .
"'");
2975 $resUrl2 =
$db->query(
"SELECT link from {assets}
2977 AND link = '" . $property[
'url2'] .
"'");
2979 $resUrl3 =
$db->query(
"SELECT link from {assets}
2981 AND link = '" . $property[
'url3'] .
"'");
2983 $row = mysqli_fetch_assoc($resInternal);
2984 if (isset($property[
'internal']) && isset($row[
'link']) && $row[
'link'] === $property[
'internal']) {
2985 $selectedInternal =
" selected";
2987 $selectedInternal =
'';
2990 $row = mysqli_fetch_assoc($resUrl1);
2991 if (isset($property[
'url1']) && isset($row[
'link']) && $row[
'link'] === $property[
'url1']) {
2992 $selectedUrl1 =
" selected";
2997 $row = mysqli_fetch_assoc($resUrl2);
2999 if (isset($property[
'url2']) && isset($row[
'link']) && $row[
'link'] === $property[
'url2']) {
3000 $selectedUrl2 =
" selected";
3005 $row = mysqli_fetch_assoc($resUrl3);
3006 if (isset($property[
'url3']) && isset($row[
'link']) && $row[
'link'] === $property[
'url3']) {
3007 $selectedUrl3 =
" selected";
3012 echo
"<label for=\"include-$property[property]\">$property[asset]</label>
3013 <input name=\"title-$property[property]\" value=\"$property[asset]\" type=\"hidden\">
3014 <input name=\"sortation-$property[property]\" value=\"$property[sortation]\" type=\"hidden\">
3016 <select id=\"include-$property[property]\" name=\"include-$property[property]\" class=\"form-control\">
3017 <option name=\"null\" value=\"\">inactive</option>
3018 <optgroup label=\"internal\">internal</optgroup>
3019 <option name=\"value\"$selectedInternal>$property[internal]</option>
3020 <optgroup label=\"external\">external</optgroup>
3021 <option name=\"value\"$selectedUrl1>$property[url1]</option>";
3022 if (!empty($property[
'url2'])) {
3024 <option name=\"value\"$selectedUrl2>$property[url2]</option>";
3026 if (!empty($property[
'url3'])) {
3028 <option name=\"value\"$selectedUrl3>$property[url3]</option>";
3055 if (
$res =
$db->query(
"SELECT type, asset, link FROM {assets} WHERE templateID = '" .
$templateID .
"' ORDER BY sortation ASC"))
3058 while ($row = mysqli_fetch_assoc(
$res))
3061 if (stristr($row[
'link'],
'http://') || (stristr($row[
'link'],
'https://')) === FALSE) {
3067 $url = $row[
'link'];
3070 if ($row[
'type'] ===
"js")
3073 <!--load JS: $row[asset] -->
3074 <script src = \"" .
$url .
"\"></script>";
3076 else if ($row[
'type'] ===
"css")
3079 <!-- load CSS: $row[asset] -->
3080 <link rel=\"stylesheet\" href=\"" .
$url .
"\" type=\"text/css\" media=\"all\">";
3094 if (
$sql =
$db->query(
"SELECT * FROM {assets} WHERE templateID = '" .
$templateID .
"'"))
3096 while ($row = mysqli_fetch_assoc(
$sql)) {
3100 if (isset($assets) && (is_array($assets) && (!empty($assets))))
3126 $res =
$db->query(
"INSERT INTO {assets} (templateID, type, sortation, asset, link)
3127 SELECT '" . $newID .
"', type, sortation, asset, link
3133 sys::setSyslog(
$db, 48, 2,
"failed to copy assets of template #$templateID", 0, 0, 0, 0);
3134 alert::draw(
"danger",
"Could not copy assets",
"please try again.",
"", 5000);
3138 alert::draw(
"success",
"Assets copied",
"successful",
"", 5000);
3141 $update =
$db->query(
"UPDATE {assets} SET templateID='" . $newID .
"' WHERE templateID=0");
3144 alert::draw(
"success",
"Assets are set-up",
"successful",
"", 5000);
3146 sys::setSyslog(
$db, 48, 2,
"failed to copy assets of template #$templateID", 0, 0, 0, 0);
3147 alert::draw(
"warning",
"Could not copy template assets",
"unable to alter IDs.",
"", 5000);
3161 if (
$sql =
$db->query(
"SELECT asset FROM {assets} WHERE templateID = '" .
$templateID .
"' AND asset LIKE '%Bootstrap%CSS'")) {
3162 while ($row = mysqli_fetch_row(
$sql)) {
3168 if (isset($asset) && (is_array($asset) && (!empty($asset[0][0]))))
3170 if ($asset[0][0] ===
"Bootstrap 4 CSS")
3175 else if ($asset[0][0] ===
"Bootstrap 3 CSS")
3198 if (
$sql =
$db->query(
"SELECT asset FROM {assets} WHERE templateID = '" .
$templateID .
"' AND asset LIKE '%Bootstrap%CSS'")) {
3199 while ($row = mysqli_fetch_row(
$sql)) {
3213 if (isset($asset) && (is_array($asset) && (!empty($asset[0][0]))))
3217 if ($this->framework ==
"bootstrap3") {
3219 if (strstr($asset[0][0],
"3")) {
3222 sys::setSyslog(
$db, 48, 2,
"wrong Bootstrap version loaded - template <b>$this->name</b> requires <b>$this->framework</b>", $_SESSION[
'uid'], 0, 0, 0);
3226 elseif ($this->framework ==
"bootstrap4") {
3228 if (strstr($asset[0][0],
"4")) {
3231 sys::setSyslog(
$db, 48, 2,
"wrong Bootstrap version loaded - template <b>$this->name</b> requires <b>$this->framework</b>", $_SESSION[
'uid'], 0, 0, 0);
3235 sys::setSyslog(
$db, 48, 2,
"template <b>$this->name</b> requires framework: [<b>$this->framework</b>] - UNABLE TO DETECT CURRENT FRAMEWORK.", $_SESSION[
'uid'], 0, 0, 0);
3240 sys::setSyslog(
$db, 48, 2,
"template <b>$this->name</b> requires <b>$this->framework</b>, but no corresponding asset is loaded.", $_SESSION[
'uid'], 0, 0, 0);
3247 foreach(glob($this->tmpFolder.
"*") as $file)
3271 if (!isset($postData)
3272 || (empty($postData)
3273 || (!is_array($postData))))
3277 if (!isset($postFiles[
'templateFile'])
3278 || (empty($postFiles[
'templateFile'])
3279 || (!is_array($postFiles[
'templateFile']))))
3288 if (!is_dir(dirname($this->tmpFolder)))
3291 if (!mkdir($this->tmpFolder))
3299 if (is_writeable(dirname($this->folder)))
3302 if (is_dir(dirname($this->tmpFolder)))
3304 $this->uploadFile = $this->tmpFolder.$postFiles[
'templateFile'][
'name'];
3307 if ($postFiles[
'templateFile'][
'error'] !== 0)
3309 sys::setSyslog(
$db, 48, 2,
"failed to upload file - unknown error (".$postFiles[
'templateFile'][
'error'].
") processing file ".$postFiles[
'templateFile'][
'name'].
"", 0, 0, 0, 0);
3314 if (!move_uploaded_file($postFiles[
'templateFile'][
'tmp_name'], $this->uploadFile))
3316 sys::setSyslog(
$db, 48, 2,
"failed to move upload file $this->uploadFile to folder ".$postFiles[
'templateFile'][
'tmp_name'].
"", 0, 0, 0, 0);
3322 if (is_file($this->uploadFile))
3326 $zip = new \ZipArchive;
3328 $res = $zip->open($this->uploadFile);
3332 $zip->extractTo($this->tmpFolder);
3338 if (is_file($this->tmpFolder.
'template.ini'))
3341 if (!$iniFile = parse_ini_file($this->tmpFolder.
"template.ini"))
3343 sys::setSyslog(
$db, 48, 2,
"failed to parse ini file ".$this->tmpFolder.
"template.ini ", 0, 0, 0, 0);
3349 sys::setSyslog(
$db, 48, 2,
"failed to parse ini file ".$this->tmpFolder.
"template.ini - file not found", 0, 0, 0, 0);
3354 $this->targetPath = $iniFile[
'TARGET_PATH'];
3356 $this->subFolder = $iniFile[
'SUBFOLDER'].
"/";
3359 if (is_file($this->tmpFolder.$this->subFolder.
'assets.json'))
3361 $assets = json_decode(file_get_contents($this->tmpFolder.$this->subFolder.
'assets.json'),
true);
3366 sys::setSyslog(
$db, 48, 1,
"failed to get ".$this->tmpFolder.$this->subFolder.
"assets.json - file not found", 0, 0, 0, 0);
3370 if (is_file($this->tmpFolder.$this->subFolder.
'template_settings.json'))
3372 $templateSettings = json_decode(file_get_contents($this->tmpFolder.$this->subFolder.
'template_settings.json'),
true);
3377 sys::setSyslog(
$db, 48, 1,
"failed to get ".$this->tmpFolder.$this->subFolder.
"template_settings.json - file not found", 0, 0, 0, 0);
3381 if (is_file($this->tmpFolder.$this->subFolder.
'template_settings_types.json'))
3383 $templateSettingsTypes = json_decode(file_get_contents($this->tmpFolder.$this->subFolder.
'template_settings_types.json'),
true);
3387 $templateSettingsTypes =
'';
3388 sys::setSyslog(
$db, 48, 1,
"failed to get ".$this->tmpFolder.$this->subFolder.
"template_settings_types.json - file not found", 0, 0, 0, 0);
3392 if (is_file($this->tmpFolder.$this->subFolder.
'templates.json'))
3394 $templates = json_decode(file_get_contents($this->tmpFolder.$this->subFolder.
'templates.json'),
true);
3399 sys::setSyslog(
$db, 48, 1,
"failed to get ".$this->tmpFolder.$this->subFolder.
"templates.json - file not found", 0, 0, 0, 0);
3418 $this->
id = self::getTemplateIdByName(
$db, $iniFile[
'NAME']);
3424 foreach ($assets as &$asset)
3432 $templateSetting[
'templateID'] =
$this->id;
3435 if (
$db->query(
"UPDATE {templates}
3436 SET id = '".$this->id.
"',
3438 name = '".$iniFile[
'NAME'].
"',
3439 positions ='outerTop:outerLeft:outerRight:intro:globalmenu:top:leftMenu:mainTop:mainTopLeft:mainTopCenter:mainTopRight:main:mainBottom:mainBottomLeft:mainBottomCenter:mainBottomRight:mainFooter:mainFooterLeft:mainFooterCenter:mainFooterRight:rightMenu:bottom:footer:hiddentoolbar:debug:outerBottom',
3440 description = '".$iniFile[
'DESCRIPTION'].
"',
3441 modifyDate = '".$iniFile[
'DATE'].
"',
3442 author = '".$iniFile[
'AUTHOR'].
"',
3443 authorUrl = '".$iniFile[
'AUTHOR_URL'].
"',
3444 weblink = '".$iniFile[
'WEBLINK'].
"',
3445 subAuthor = '".$iniFile[
'SUB_AUTHOR'].
"',
3446 subAuthorUrl = '".$iniFile[
'SUB_AUTHOR_URL'].
"',
3447 version = '".$iniFile[
'VERSION'].
"',
3448 framework = '".$iniFile[
'FRAMEWORK'].
"',
3449 license = '".$iniFile[
'LICENSE'].
"'
3450 WHERE name = '".$iniFile[
'NAME'].
"'"))
3457 sys::setSyslog(
$db, 47, 0,
"failed to update template $iniFile[NAME] - templates db NOT updated", 0, 0, 0, 0);
3461 foreach ($assets as $asset)
3463 if (
$db->query(
"UPDATE {assets}
3464 SET templateID = '".$this->id.
"',
3465 type = '".$asset[
'type'].
"',
3466 sortation = '".$asset[
'sortation'].
"',
3467 asset = '".$asset[
'asset'].
"',
3468 link = '".$asset[
'link'].
"'
3469 WHERE link = '".$asset[
'link'].
"' AND templateID = '".$iniFile[
'ID'].
"'"))
3476 sys::setSyslog(
$db, 47, 0,
"failed to update template $iniFile[NAME] - assets db NOT updated", 0, 0, 0, 0);
3485 if (
$db->query(
"UPDATE {template_settings}
3486 SET templateID = '".$this->id.
"',
3487 property = '".$templateSetting[
'property'].
"',
3488 value = '".$templateSetting[
'value'].
"',
3489 valueDefault = '".$templateSetting[
'valueDefault'].
"',
3490 longValue = '".$templateSetting[
'longValue'].
"',
3491 type = '".$templateSetting[
'type'].
"',
3492 activated = '".$templateSetting[
'activated'].
"',
3493 sort = '".$templateSetting[
'sort'].
"',
3494 label = '".$templateSetting[
'label'].
"',
3495 fieldClass = '".$templateSetting[
'fieldClass'].
"',
3496 fieldType = '".$templateSetting[
'fieldType'].
"',
3497 options = '".$templateSetting[
'options'].
"',
3498 placeholder = '".$templateSetting[
'placeholder'].
"',
3499 description = '".$templateSetting[
'description'].
"',
3500 icon = '".$templateSetting[
'icon'].
"',
3501 heading = '".$templateSetting[
'heading'].
"',
3502 subtext = '".$templateSetting[
'subtext'].
"'
3503 WHERE property = '".$templateSetting[
'property'].
"' AND templateID = '".$iniFile[
'ID'].
"'"))
3510 sys::setSyslog(
$db, 47, 0,
"failed to update property $templateSetting[property] of template $iniFile[NAME] - template_settings db NOT updated", 0, 0, 0, 0);
3515 foreach ($templateSettingsTypes as $templateSettingsType)
3517 if (
$db->query(
"UPDATE {template_settings_types}
3518 SET type = '".$templateSettingsType[
'type'].
"'
3519 WHERE type = '".$templateSettingsType[
'type'].
"'"))
3526 sys::setSyslog(
$db, 47, 0,
"failed to update type $templateSettingsType[type] - template_settings_types db NOT updated", 0, 0, 0, 0);
3531 if (!unlink ($this->tmpFolder.$this->subFolder.
"assets.json"))
3533 sys::setSyslog(
$db, 47, 0,
"failed to delete ".$this->tmpFolder.$this->subFolder.
"assets.json", 0, 0, 0, 0);
3535 if (!unlink ($this->tmpFolder.$this->subFolder.
"template_settings.json"))
3537 sys::setSyslog(
$db, 47, 0,
"failed to delete ".$this->tmpFolder.$this->subFolder.
"template_settings.json", 0, 0, 0, 0);
3539 if (!unlink ($this->tmpFolder.$this->subFolder.
"template_settings_types.json"))
3541 sys::setSyslog(
$db, 47, 0,
"failed to delete ".$this->tmpFolder.$this->subFolder.
"template_settings_types.json", 0, 0, 0, 0);
3543 if (!unlink ($this->tmpFolder.$this->subFolder.
"templates.json"))
3545 sys::setSyslog(
$db, 47, 0,
"failed to delete ".$this->tmpFolder.$this->subFolder.
"templates.json", 0, 0, 0, 0);
3549 sys::xcopy($this->tmpFolder.$this->subFolder, $this->folder.$this->subFolder);
3554 sys::setSyslog(
$db, 47, 0,
"failed to remove tmp folder $this->tmpFolder", 0, 0, 0, 0);
3558 mkdir($this->tmpFolder);
3577 if (
$res =
$db->query(
"INSERT INTO {templates} (active, name, positions, description, releaseDate, modifyDate, author, authorUrl, weblink, subAuthor, subAuthorUrl, version, framework, license)
3579 '".$iniFile[
'NAME'].
"',
3580 'outerTop:outerLeft:outerRight:intro:globalmenu:top:leftMenu:mainTop:mainTopLeft:mainTopCenter:mainTopRight:main:mainBottom:mainBottomLeft:mainBottomCenter:mainBottomRight:mainFooter:mainFooterLeft:mainFooterCenter:mainFooterRight:rightMenu:bottom:footer:hiddentoolbar:debug:outerBottom',
3581 '".$iniFile[
'DESCRIPTION'].
"',
3582 '".$iniFile[
'DATE'].
"',
3583 '".$iniFile[
'DATE'].
"',
3584 '".$iniFile[
'AUTHOR'].
"',
3585 '".$iniFile[
'AUTHOR_URL'].
"',
3586 '".$iniFile[
'WEBLINK'].
"',
3587 '".$iniFile[
'SUB_AUTHOR'].
"',
3588 '".$iniFile[
'SUB_AUTHOR_URL'].
"',
3589 '".$iniFile[
'VERSION'].
"',
3590 '".$iniFile[
'FRAMEWORK'].
"',
3591 '".$iniFile[
'LICENSE'].
"')"))
3595 $this->
id = self::getTemplateIdByName(
$db, $iniFile[
'NAME']);
3598 foreach ($assets as $asset)
3600 $db->query(
"INSERT INTO {assets} (templateID, type, sortation, asset, link)
3603 '".$asset[
'type'].
"',
3604 '".$asset[
'sortation'].
"',
3605 '".$asset[
'asset'].
"',
3606 '".$asset[
'link'].
"'
3613 $db->query(
"INSERT INTO {template_settings}
3614 (templateID, property, value, valueDefault, longValue, type, activated, sort, label, fieldClass, fieldType, options, placeholder, description, icon, heading, subtext)
3615 VALUES ('".$this->
id.
"',
3616 '".$templateSetting[
'property'].
"',
3617 '".$templateSetting[
'value'].
"',
3618 '".$templateSetting[
'valueDefault'].
"',
3619 '".$templateSetting[
'longValue'].
"',
3620 '".$templateSetting[
'type'].
"',
3621 '".$templateSetting[
'activated'].
"',
3622 '".$templateSetting[
'sort'].
"',
3623 '".$templateSetting[
'label'].
"',
3624 '".$templateSetting[
'fieldClass'].
"',
3625 '".$templateSetting[
'fieldType'].
"',
3626 '".$templateSetting[
'options'].
"',
3627 '".$templateSetting[
'placeholder'].
"',
3628 '".$templateSetting[
'description'].
"',
3629 '".$templateSetting[
'icon'].
"',
3630 '".$templateSetting[
'heading'].
"',
3631 '".$templateSetting[
'subtext'].
"')");
3635 if (!unlink ($this->tmpFolder.$this->subFolder.
"assets.json"))
3637 sys::setSyslog(
$db, 47, 0,
"failed to delete ".$this->tmpFolder.$this->subFolder.
"assets.json", 0, 0, 0, 0);
3639 if (!unlink ($this->tmpFolder.$this->subFolder.
"template_settings.json"))
3641 sys::setSyslog(
$db, 47, 0,
"failed to delete ".$this->tmpFolder.$this->subFolder.
"template_settings.json", 0, 0, 0, 0);
3643 if (!unlink ($this->tmpFolder.$this->subFolder.
"template_settings_types.json"))
3645 sys::setSyslog(
$db, 47, 0,
"failed to delete ".$this->tmpFolder.$this->subFolder.
"template_settings_types.json", 0, 0, 0, 0);
3647 if (!unlink ($this->tmpFolder.$this->subFolder.
"templates.json"))
3649 sys::setSyslog(
$db, 47, 0,
"failed to delete ".$this->tmpFolder.$this->subFolder.
"templates.json", 0, 0, 0, 0);
3653 sys::xcopy($this->tmpFolder.$this->subFolder, $this->folder.$this->subFolder);
3658 sys::setSyslog(
$db, 47, 0,
"failed to remove tmp folder $this->tmpFolder", 0, 0, 0, 0);
3662 mkdir($this->tmpFolder);
3665 sys::setSyslog(
$db, 45, 0,
"added template <b>$iniFile[NAME] ID: ".$this->
id.
"</b> to templates db", 0, 0, 0, 0);
3671 sys::setSyslog(
$db, 47, 0,
"failed to insert new template: $iniFile[NAME] - templates db NOT updated", 0, 0, 0, 0);
3680 sys::setSyslog(
$db, 46, 3,
"uploaded template package $this->uploadFile successfully", 0, 0, 0, 0);
3684 sys::setSyslog(
$db, 48, 1,
"failed to check uploaded file upload file: $this->uploadFile not found", 0, 0, 0, 0);
3691 sys::setSyslog(
$db, 48, 1,
"failed to uploaded tempalte: ../system/templates/tmp/ does not exist or is not accessable", 0, 0, 0, 0);
3697 sys::setSyslog(
$db, 48, 1,
"failed to uploaded template: $this->folder is not writeable", 0, 0, 0, 0);
3717 if (!isset($templateFolder) || (empty($templateFolder) || (!is_string($templateFolder))))
3723 $this->subFolder = $templateFolder;
3724 $this->
name = $templateFolder;
3736 if (!is_dir(dirname($this->tmpFolder)))
3739 if (!mkdir(dirname($this->tmpFolder)))
3748 if (is_writeable(dirname($this->tmpFolder)))
3751 if (!is_dir(dirname($this->tmpFolder.$this->subFolder)))
3754 if (!mkdir(dirname($this->tmpFolder.$this->subFolder)))
3756 sys::setSyslog(
$db, 47, 0,
"failed to create ".$this->tmpFolder.$this->subFolder.
"", 0, 0, 0, 0);
3762 if (
sys::xcopy($this->folder.$this->subFolder.
"/", $this->tmpFolder.$this->subFolder) ===
false)
3764 sys::setSyslog(
$db, 47, 0,
"failed to copy template into tmp folder: ".$this->tmpFolder.$this->subFolder.
"", 0, 0, 0, 0);
3769 if (is_writeable($this->tmpFolder.$this->subFolder))
3779 $templateData = json_encode($templateData);
3780 $templateAssets = json_encode($templateAssets);
3782 $templateSettingsTypes = json_encode($templateSettingsTypes);
3786 if (!file_put_contents($this->tmpFolder.$this->subFolder.
"/".
"templates.json", $templateData))
3788 sys::setSyslog(
$db, 48, 0,
"failed to write ".$this->tmpFolder.$this->subFolder.
"templates.json", 0, 0, 0, 0);
3791 if (!file_put_contents($this->tmpFolder.$this->name.
"/".
"assets.json", $templateAssets))
3793 sys::setSyslog(
$db, 48, 0,
"failed to write ".$this->tmpFolder.$this->subFolder.
"assets.json", 0, 0, 0, 0);
3796 if (!file_put_contents($this->tmpFolder.$this->name.
"/".
"template_settings.json",
$templateSettings))
3798 sys::setSyslog(
$db, 48, 0,
"failed to write ".$this->tmpFolder.$this->subFolder.
"template_settings.json", 0, 0, 0, 0);
3801 if (!file_put_contents($this->tmpFolder.$this->name.
"/".
"template_settings_types.json", $templateSettingsTypes))
3803 sys::setSyslog(
$db, 48, 0,
"failed to write ".$this->tmpFolder.$this->subFolder.
"template_settings_types.json", 0, 0, 0, 0);
3809 $year = (substr($this->releaseDate, 0, 4));
3811 require_once(
'../system/classes/licenses.php');
3813 $license = new \YAWK\licenses($this->license, $this->
description, $year, $this->author, $this->tmpFolder.$this->name.
"/");
3815 if (
$license->writeLicenseFile() ===
false)
3817 sys::setSyslog(
$db, 47, 0,
"failed to write license file ($this->license license) to ".$this->tmpFolder.$this->subFolder.
"", 0, 0, 0, 0);
3822 if (is_file($this->tmpFolder.$this->subFolder.
'/assets.json')
3823 && (is_file($this->tmpFolder.$this->subFolder.
'/templates.json')
3824 && (is_file($this->tmpFolder.$this->subFolder.
'/template_settings.json')
3825 && (is_file($this->tmpFolder.$this->subFolder.
'/template_settings_types.json')))))
3832 $destination = $this->tmpFolder.$this->name.
'.zip';
3839 $iniData[
'TARGET_PATH'] = $this->folder.$this->subFolder.
"/";
3855 sys::setSyslog(
$db, 47, 0,
"failed to write ".$this->tmpFolder.
"template.ini ", 0, 0, 0, 0);
3862 if (extension_loaded(
'zip'))
3865 if (!is_dir(dirname($source)))
3871 $zip = new \ZipArchive();
3874 if (!$zip->open($destination, \ZIPARCHIVE::CREATE))
3880 $source = str_replace(
'\\',
'/', realpath($source));
3883 if (is_dir($source) ===
true)
3886 $elements = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($source), \RecursiveIteratorIterator::SELF_FIRST);
3889 foreach ($elements as $file)
3892 $file = str_replace(
'\\',
'/', $file);
3895 if( in_array(substr($file, strrpos($file,
'/')+1), array(
'.',
'..')) )
3899 $file = realpath($file);
3902 if (is_dir($file) ===
true)
3904 $zip->addEmptyDir(str_replace($source .
'/',
'', $file .
'/'));
3907 else if (is_file($file) ===
true)
3909 $zip->addFromString(str_replace($source .
'/',
'', $file), file_get_contents($file));
3914 else if (is_file($source) ===
true)
3916 $zip->addFromString(basename($source), file_get_contents($source));
3922 if (is_file($destination))
3928 sys::setSyslog(
$db, 47, 0,
"failed to delete tmp folder ".$this->tmpFolder.$this->subFolder.
"", 0, 0, 0, 0);
3933 if (isset(
$_GET[
'id']) && (!empty(
$_GET[
'id'])))
3935 $downloadTemplateLink =
"#downloadTemplateLink-".$_GET[
'id'];
3937 $downloadFile = $destination;
3941 <script type='text/javascript'>
3942 $(document).ready(function()
3943 { // change href attribute for this archive to direct donwload file
3944 var oldLink = $('$downloadTemplateLink').attr('href');
3945 $('$downloadTemplateLink').attr('href', '$downloadFile')
3946 // emulate a users click to force direct download
3947 $('$downloadTemplateLink')[0].click();
3948 // if this is not working, the user have to click on that link.
3957 sys::setSyslog(
$db, 52, 2,
"failed to create template $this->name.zip package - zip file not there", 0, 0, 0, 0);
3963 sys::setSyslog(
$db, 52, 2,
"failed to create template .zip package: PHP zip extension not loaded.", 0, 0, 0, 0);
3969 sys::setSyslog(
$db, 52, 2,
".json files missing: $this->folder$this->subFolder/*.json not found", 0, 0, 0, 0);
3975 sys::setSyslog(
$db, 52, 2,
"create template .zip package failed: folder $this->folder is not writeable. Please check folder group permissions", 0, 0, 0, 0);
print $lang['FILEMAN_UPLOAD']
if(!isset($language)||(!isset($lang))) $item
static draw($type, $title, $text, $redirect, $delay)
static recursiveRemoveDirectory($directory)
Delete a directory recursive.
static getSetting($db, $property)
Get and return value for property from settings database.
static xcopy($source, $dest, $permissions=0755)
Copy a file, or recursively copy a folder and its contents.
static minifyCSS($input)
Minify any string: removes spaces, tabs and linebreaks.
static replacePreTags($replace, $customCSS)
removes all unnecessary HTML tags from custom.css
static recurseRmdir($dir)
remove a directory recurse
static minifyJs($input)
Minify any string: removes spaces, tabs and linebreaks.
static writeIniFile($array, $file)
write ini file
static now()
returns the current datetime
The template controller - get and set template settings.
static checkWrapper($lang, $title, $subtitle)
check if an admin LTE wrapper should be loaded around the backend content. This function must be call...
static setCssBodyFontSettings($cssTagName, $tplSettings)
set body font settings css code
static getAllSettingsIntoArray($db, $user)
Returns an array with all template settings.
static setPosition($db, $lang, $position, $currentpage, $user, $template)
set template position and output the correct data depending on position
static getAssetsByType($db, $type)
Return a multidimensional array with all assets by requested type.
static setCssFontSettings($cssTagName, $tplSettings)
set font settings css code
loadAllSettingsIntoArray(object $db, int $id)
load template settings of ID and return as array
static getTemplateSettingsArray($db, $templateID)
get all template settings into an array and return it
static getPositionIndicatorStatusArray($db, $templateID)
get the position indicators. This is used on index.php to mark indicated positions
downloadTemplate($db, $templateFolder, $templateID, $user)
Create a zip file from template and force direct download.
switchPositionIndicators(object $db, int $templateID, int $status)
switch all positions indicators on or off
loadSettingsTypesIntoArray(object $db)
load template_settings_types and return as array
checkIfTemplateAlreadyExists(object $db, string $name)
Check if a template with given name already exists, return true or false.
static getCurrentTemplateId(object $db)
return ID of current (active) template
loadActiveAssets($db, $templateID, $host)
Load Active Assets.
static getPositionStatesArray($db, $templateID)
get the position states of all templates. This is used on index.php to render only templates that are...
static setCssBodyLinkTags($cssTagName, $tplSettings)
set css code for body link styling
drawFontFamilySelectField($db, $lang, $selectName, $defaultValue)
return a select option list with all fonts:
static getValidTemplateID($db, $user, $template)
check the current template ID, considering if user is logged in, allowed to override template and so ...
uploadTemplate($db, $postData, $postFiles, $lang)
Upload a template (install / update)
static getTemplateIds(object $db)
return array with all template id's + names.
static returnCurrentBootstrapVersion($db, $templateID)
Return which Bootstrap version is currently loaded in given template.
static loadGoogleFonts($db)
get settings for heading, menu and text font and output html to load font
saveAs(object $db)
save a template as new. It copies the tpl folder and all settings into a new one.
saveProperties(object $db, int $id, array $data, array $oldTplSettings)
save new template properties into database
static setCssBodyFontFace($cssTagName, $tplSettings)
set css code for custom fonts (ttf / otf / woff)
getCustomJSFile(object $db, int $templateID)
return the content of custom.js
getCustomCSSFile(object $db, int $templateID)
return the content of custom.css
static getActivegfont($db, $status, $property)
return currently active google font
getFormElements($db, $settings, $type, $lang, $user)
return html form field, depending on fieldClass
getFontRow($db, $lang, $fontRow, $previewClass, $templateSettings)
return font edit row including preview
static getMaxId($db)
return biggest ID from template database
loadProperties($db, $id)
load properties into template object
static getPositionDivBox($db, $lang, $position, $row, $bootstrapGrid, $positions, $indicators, $user, $template)
return div box with postition settings
static getGoogleFontsArray($db)
get all google fonts into an array and return array
loadPropertiesIntoArray(object $db, int $id)
load template properties and return as array
static drawAssetsTitles($db, $templateID, $lang)
Draw a list with all assets that are used in this template.
static getFontsFromFolder($folder)
get fonts from folder and return as array
loadActiveAssetsIntoArray($db, $templateID)
static getActiveBodyFont($db, $user, $template)
Get and return current active google font.
static setCssBodySmallFontSettings($cssTagName, $tplSettings)
set small font settings css code
static drawAssetsSelectFields($db, $type, $templateID, $lang)
Draw asset select fields.
static includeHeader($db)
include header for html page *outdated? *moved to sys?
deleteSettingsCSSFile($db, $filename)
The default user class. Provide all functions to handle the user object.
static getUserList($db)
output a list of all users (who have not activated privacy switch)
$template selectedTemplate
This class serves methods to create backup from files.
if(isset($_POST['save'])) $settings
if(isset($_GET) &&(!empty($_GET))) $googleFonts
if(isset($_GET['positionIndicatorStatus'])) $templateSettings
if(!isset($db)) if(!isset($lang)) $update