|
| copy ($db) |
| make a copy of a page More...
|
|
| create ($db, $alias, $menuID, $locked, $blogid, $plugin) |
| create a new page More...
|
|
| delete ($db) |
| delete a page More...
|
|
| deleteContent ($dirprefix) |
| delete a static content page More...
|
|
| getContent ($db, $lang) |
| get and include static page content More...
|
|
| getCurrentLanguageByID ($db, $id) |
|
| getProperty ($db, $id, $property) |
| get any requested page property More...
|
|
| loadProperties ($db, $alias) |
| load page properties and store as object properties More...
|
|
| loadPropertiesByID ($db, $id) |
| load page properties and store as object properties More...
|
|
| readContent ($dirPrefix) |
| read content from static page More...
|
|
| save ($db) |
| save a static page including all settings More...
|
|
| toggleLock ($db, $id, $locked) |
| toggle page lock to avoid unintended changes More...
|
|
| toggleOffline ($db, $id, $published, $title) |
| toggle page status online or offline (plus corresponding menu entries) More...
|
|
| writeContent ($content) |
| write content to static page More...
|
|
The default pages class. Provide all functions to handle static pages.
The default pages class. Provide all functions to handle static html pages.
All functions that are required to handle a page. Methods are: create, save, edit, delete and many more.
Class covers both, backend & frontend functionality. See Methods Summary for Details!
- Author
- Daniel Retzl danie.nosp@m.lret.nosp@m.zl@gm.nosp@m.ail..nosp@m.com
- Copyright
- 2009-2016 Daniel Retzl @license https://opensource.org/licenses/MIT
- Version
- 1.0.0
Definition at line 19 of file page.php.
YAWK\page::create |
( |
|
$db, |
|
|
|
$alias, |
|
|
|
$menuID, |
|
|
|
$locked, |
|
|
|
$blogid, |
|
|
|
$plugin |
|
) |
| |
create a new page
- Parameters
-
object | $db | database |
string | $alias | page filename |
int | $menuID | menu ID |
int | $locked | 0|1 page lock status |
int | $blogid | blog ID, if any |
int | $plugin | plugin ID, if any |
- Returns
- bool
- Parameters
-
Definition at line 511 of file page.php.
515 $this->menu = $menuID;
536 $ersetze = array(
"/ä/",
"/ü/",
"/ö/",
"/Ä/",
"/Ü/",
"/Ö/",
"/ß/");
537 $umlaute = array(
"ae",
"ue",
"oe",
"Ae",
"Ue",
"Oe",
"ss");
545 $link =
"$alias" .
".html";
548 if ($menuID !==
"empty") {
550 if (
$res =
$db->query(
"SELECT MAX(id) FROM {menu}"))
552 $row = mysqli_fetch_row(
$res);
553 if (!isset($row[0])) {
562 sys::setSyslog(
$db, 7, 1,
"failed to fetch MAX(id) FROM {menu}", 0, 0, 0, 0);
563 alert::draw(
"danger",
"Error:",
"Could not fetch MAX(id) FROM {menu}",
"page=page-new",
"4300");
566 if (
$res =
$db->query(
"SELECT MAX(sort) FROM {menu} WHERE menuID = '" . $menuID .
"'"))
568 $row = mysqli_fetch_row(
$res);
581 sys::setSyslog(
$db, 7, 1,
"failed to fetch MAX(id) FROM {menu} WHERE menuID = $menuID", 0, 0, 0, 0);
582 alert::draw(
"danger",
"Error:",
"Could not fetch MAX(id) FROM {menu} WHERE menuID = $menuID",
"page=page-new",
"4300");
600 if (!
$res =
$db->query(
"INSERT INTO {menu} (id,sort,menuID,published,title,text,href,blogid, menuLanguage)
601 VALUES('" .
$id .
"',
604 '" . $menu_published .
"',
605 '" . $titleText .
"',
609 '" . $this->language .
"')"))
611 sys::setSyslog(
$db, 23, 1,
"failed to insert data into {menu}", 0, 0, 0, 0);
612 alert::draw(
"danger",
"Error:",
"could not insert menu data",
"page=page-new",
"4300");
616 sys::setSyslog(
$db, 21, 0,
"added new menu: $title (id: $id)", 0, 0, 0, 0);
627 $content =
"<?php \$blog_id = $blogid; include 'system/plugins/blog/blog.php'; ?>";
633 $plugin = array(
"tos", $_POST[
'signup_tospage'], $_POST[
'signup_terms-long']);
642 else if (strlen(
$plugin) >= 1) {
645 $content =
"<?php include 'system/plugins/$plugin/$plugin.php'; ?>";
653 if (
$res =
$db->query(
"SELECT MAX(id) FROM {pages}"))
655 $row = mysqli_fetch_row(
$res);
661 sys::setSyslog(
$db, 7, 1,
"failed to select MAX(id) from pages db", 0, 0, 0, 0);
666 if (!
$db->query(
"INSERT INTO {pages} (id,published,date_created,date_changed,date_publish,date_unpublish,alias,title,locked,blogid,plugin,lang)
667 VALUES ('" .
$id .
"',
678 '".$this->language.
"')"))
680 sys::setSyslog(
$db, 7, 2,
"unable to add page $alias into database.", 0, 0, 0, 0);
681 alert::draw(
"danger",
"Error!",
"unable to add new page ($alias) id: $id into pages database.",
"", 4300);
685 if (isset($this->language) && (!empty($this->language)))
688 if (!is_dir($this->path.$this->language)){
689 if (!mkdir($this->path.$this->language)){
690 sys::setSyslog(
$db, 7, 2,
"failed to create language folder: $this->path.$this->language");
709 sys::setSyslog(
$db, 5, 0,
"created $filename", 0, 0, 0, 0);
static encodeChars($string)
convert german special chars and vowels into legal html
References YAWK\page\$alias, YAWK\page\$blogid, $content, YAWK\page\$date_created, $db, $filename, YAWK\page\$id, YAWK\page\$locked, YAWK\page\$plugin, YAWK\page\$published, $res, YAWK\page\$title, alias, blogid, date, YAWK\alert\draw(), and YAWK\sys\encodeChars().
YAWK\page::getContent |
( |
|
$db, |
|
|
|
$lang |
|
) |
| |
get and include static page content
- Parameters
-
object | $db | database |
object | $lang | language obj |
- Returns
- mixed
@noinspection PhpIncludeInspection
@noinspection PhpIncludeInspection
@noinspection PhpIncludeInspection
@noinspection PhpIncludeInspection
Definition at line 1116 of file page.php.
References $_GET, $db, $lang, YAWK\page\$language, $now, YAWK\page\$path, date, die, exit, YAWK\controller\filterfilename(), and YAWK\settings\getSetting().
YAWK\page::loadProperties |
( |
|
$db, |
|
|
|
$alias |
|
) |
| |
load page properties and store as object properties
- Parameters
-
object | $db | database |
string | $alias | page filename |
- Parameters
-
Definition at line 952 of file page.php.
957 $res =
$db->query(
"SELECT * FROM {pages} WHERE alias = '".
$alias.
"'");
958 if ($row = mysqli_fetch_assoc(
$res))
960 $this->
id = $row[
'id'];
961 $this->date_created = $row[
'date_created'];
965 $this->
gid = $row[
'gid'];
966 $this->
title = $row[
'title'];
967 $this->ownerid = $row[
'owner'];
968 $this->menu = $row[
'menu'];
969 $this->
bgimage = $row[
'bgimage'];
970 $this->locked = $row[
'locked'];
971 $this->
blogid = $row[
'blogid'];
972 $this->plugin = $row[
'plugin'];
973 $this->language = $row[
'lang'];
980 if ($this->
alias ==
"content/errors/404")
982 if (isset($_SESSION[
'uid']) && (!empty($_SESSION[
'uid'])))
984 sys::setSyslog(
$db, 7, 2,
"404: file not found - displayed $alias instead", $_SESSION[
'uid'], 0, 0, 0);
988 sys::setSyslog(
$db, 7, 2,
"404: file not found - displayed $alias instead", 0, 0, 0, 0);
995 sys::setSyslog(
$db, 7, 2,
"failed to load properties because page alias was not set", 0, 0, 0, 0);
if(!isset($blog)) if(!isset($language)||(!isset($lang))) if(!isset($db)) $blog published
print $page meta_keywords
print $page date_unpublish
References YAWK\page\$alias, $db, $res, alias, bgimage, blogid, date_publish, date_unpublish, gid, meta_keywords, meta_local, published, and title.
YAWK\page::loadPropertiesByID |
( |
|
$db, |
|
|
|
$id |
|
) |
| |
load page properties and store as object properties
- Parameters
-
object | $db | database |
string | $id | page id |
- Parameters
-
Definition at line 1004 of file page.php.
1007 if (isset(
$id) && (!empty(
$id)))
1009 $res =
$db->query(
"SELECT * FROM {pages} WHERE id = '".
$id.
"'");
1010 if ($row = mysqli_fetch_assoc(
$res))
1012 $this->
id = $row[
'id'];
1013 $this->date_created = $row[
'date_created'];
1017 $this->
gid = $row[
'gid'];
1018 $this->
alias = $row[
'alias'];
1019 $this->
title = $row[
'title'];
1020 $this->ownerid = $row[
'owner'];
1021 $this->menu = $row[
'menu'];
1022 $this->
bgimage = $row[
'bgimage'];
1023 $this->locked = $row[
'locked'];
1024 $this->
blogid = $row[
'blogid'];
1025 $this->plugin = $row[
'plugin'];
1026 $this->language = $row[
'lang'];
1032 if ($this->
alias ==
"content/errors/404")
1034 if (isset($_SESSION[
'uid']) && (!empty($_SESSION[
'uid'])))
1036 sys::setSyslog(
$db, 7, 2,
"404: file not found - displayed $this->alias instead", $_SESSION[
'uid'], 0, 0, 0);
1040 sys::setSyslog(
$db, 7, 2,
"404: file not found - displayed $this->alias instead", 0, 0, 0, 0);
1047 sys::setSyslog(
$db, 7, 2,
"failed to load properties because page ID was not set", 0, 0, 0, 0);
References $db, YAWK\page\$id, $res, alias, bgimage, blogid, date_publish, date_unpublish, gid, meta_keywords, meta_local, published, and title.
save a static page including all settings
- Parameters
-
- Returns
- bool
- Parameters
-
Definition at line 718 of file page.php.
721 $date_changed =
date(
"Y-m-d G:i:s");
725 $this->
alias = str_replace(
" ",
"-", $this->
alias);
727 $umlaute = array(
"/ä/",
"/ü/",
"/ö/",
"/Ä/",
"/Ü/",
"/Ö/",
"/ß/");
728 $ersetze = array(
"ae",
"ue",
"oe",
"ae",
"ue",
"oe",
"ss");
729 $this->
alias = preg_replace($umlaute, $ersetze, $this->
alias);
730 $this->
alias = preg_replace(
"/[^a-z0-9\-\/]/i",
"", $this->
alias);
734 $oldAlias = substr($this->searchstring, 0, -5);
756 if (!
$db->query(
"UPDATE {pages}
757 SET published = '" . $this->published .
"',
758 gid = '" . $this->gid .
"',
759 date_changed = '" . $date_changed .
"',
760 date_publish = '" . $this->date_publish .
"',
761 date_unpublish = NULL,
762 title = '" . $this->title .
"',
763 alias = '" . $this->alias .
"',
764 bgimage = '" . $this->bgimage .
"',
765 lang = '" . $this->language .
"',
766 meta_local = '" . $this->meta_local .
"',
767 meta_keywords = '" . $this->meta_keywords .
"'
768 WHERE id = '" . $this->id .
"'"))
771 sys::setSyslog(
$db, 23, 1,
"failed to update database of page $this->title", 0, 0, 0, 0);
779 sys::setSyslog(
$db, 5, 0,
"updated $this->alias", 0, 0, 0, 0);
786 if (!
$db->query(
"UPDATE {pages}
787 SET published = '" . $this->published .
"',
788 gid = '" . $this->gid .
"',
789 date_changed = '" . $date_changed .
"',
790 date_publish = '" . $this->date_publish .
"',
791 date_unpublish = '" . $this->date_unpublish .
"',
792 title = '" . $this->title .
"',
793 alias = '" . $this->alias .
"',
794 bgimage = '" . $this->bgimage .
"',
795 lang = '" . $this->language .
"',
796 meta_local = '" . $this->meta_local .
"',
797 meta_keywords = '" . $this->meta_keywords .
"'
798 WHERE id = '" . $this->id .
"'"))
801 sys::setSyslog(
$db, 23, 1,
"failed to update page $this->title", 0, 0, 0, 0);
802 alert::draw(
"warning",
"Warning",
"failed to store data of $this->alias in database.",
"", 6200);
808 sys::setSyslog(
$db, 5, 0,
"updated $this->alias", 0, 0, 0, 0);
References $db, alias, date, date_unpublish, and YAWK\alert\draw().