diff --git a/setup/data/base/base_nav_main1.sql b/setup/data/base/base_nav_main1.sql index 504ea65..a23604d 100644 --- a/setup/data/base/base_nav_main1.sql +++ b/setup/data/base/base_nav_main1.sql @@ -1,6 +1,6 @@ DELETE FROM !PREFIX!_nav_main WHERE idnavm < 10000; -INSERT INTO !PREFIX!_nav_main VALUES('5', 'administration', 'navigation/administration/main'); -INSERT INTO !PREFIX!_nav_main VALUES('4', 'statistic', 'navigation/statistic/main'); -INSERT INTO !PREFIX!_nav_main VALUES('2', 'style', 'navigation/style/main'); -INSERT INTO !PREFIX!_nav_main VALUES('1', 'content', 'navigation/content/main'); -INSERT INTO !PREFIX!_nav_main VALUES('3', 'extra', 'navigation/extra/main'); \ No newline at end of file +INSERT INTO !PREFIX!_nav_main VALUES('5', 'navigation/administration/main', 'administration'); +INSERT INTO !PREFIX!_nav_main VALUES('4', 'navigation/statistic/main', 'statistic'); +INSERT INTO !PREFIX!_nav_main VALUES('2', 'navigation/style/main', 'style'); +INSERT INTO !PREFIX!_nav_main VALUES('1', 'navigation/content/main', 'content'); +INSERT INTO !PREFIX!_nav_main VALUES('3', 'navigation/extra/main', 'extra'); \ No newline at end of file diff --git a/setup/data/standard/standard_modules1.sql b/setup/data/standard/standard_modules1.sql index a76f5de..1ed68a7 100644 --- a/setup/data/standard/standard_modules1.sql +++ b/setup/data/standard/standard_modules1.sql @@ -3,10 +3,6 @@ INSERT INTO !PREFIX!_mod VALUES('4', '1', 'CL Flex Slider', 'media', 'none', '', INSERT INTO !PREFIX!_mod VALUES('5', '1', 'CL Portal Buttons', 'navigation', 'none', '', '', '?> array(\n ''href'' => ''http://forum.conlite.org'',\n ''label''=> mi18n("CL-User-Forum")\n ),\n ''faq'' => array(\n ''href'' => ''http://faq.conlite.org'',\n ''label''=> mi18n("CL-FAQ")\n ),\n ''bugtracker'' => array(\n ''href'' => ''http://dev.conlite.org/tickets'',\n ''label''=> mi18n("CL-Bugtracker")\n )\n);\n\n$oLink = new cHTMLLink();\n$oLink->setClass("buttonlink");\n\nforeach($aButtons as $aButton) {\n $oLink->setAttribute(''title'', mi18n("to")." ".$aButton[''label'']);\n $oLink->setLink($aButton[''href'']);\n $oLink->setContent($aButton[''label'']);\n echo $oLink->render();\n $oLink->advanceID();\n}\nunset($oLink);\n?>', '', '0', '', '', '48a365b4ce1e322a55ae9017f3daf0c0', '2016-05-23 14:55:40', '2017-08-11 12:41:45'); INSERT INTO !PREFIX!_mod VALUES('6', '1', 'CL Headline', 'content', 'none', '', '', '?>\n * @license http://www.gnu.de/documents/gpl.de.html GPL v3\n * @link http://conlite.org ConLite Portal\n * \n * \n * $Id$\n */\nif (!isset($oTpl) || !is_object($oTpl)) {\n $oTpl = new Template();\n}\n\n$sText = "CMS_HTMLHEAD[1]";\n$sTemplate = "headline_h1.html";\n\n$oTpl->reset();\nif (cRegistry::isBackendEditMode()) {\n $oTpl->set(''s'', ''HEADLINE'', $sText);\n $oTpl->generate($sTemplate);\n} else {\n if(!empty($sText)) {\n $oTpl->set(''s'', ''HEADLINE'', strip_tags($sText));\n $oTpl->generate($sTemplate);\n }\n}\n?>', '', '0', '', '', '48a365b4ce1e322a55ae9017f3daf0c0', '2016-05-23 15:01:13', '2017-08-11 12:41:45'); INSERT INTO !PREFIX!_mod VALUES('7', '1', 'CL Subheadline', 'content', 'none', '', '', '?>\n * @license http://www.gnu.de/documents/gpl.de.html GPL v3\n * @link http://conlite.org ConLite Portal\n * \n * \n * $Id$\n */\nif (!isset($oTpl) || !is_object($oTpl)) {\n $oTpl = new Template();\n}\n\n$sText = "CMS_HTMLHEAD[2]";\n$sTemplate = "subheadline_h2.html";\n\n$oTpl->reset();\nif (cRegistry::isBackendEditMode()) {\n $oTpl->set(''s'', ''SUBHEADLINE'', $sText);\n $oTpl->generate($sTemplate);\n} else {\n if(!empty($sText)) {\n $oTpl->set(''s'', ''SUBHEADLINE'', strip_tags($sText));\n $oTpl->generate($sTemplate);\n }\n}\n?>', '', '0', '', '', '48a365b4ce1e322a55ae9017f3daf0c0', '2016-05-23 15:01:51', '2017-08-11 12:41:45'); -INSERT INTO !PREFIX!_mod VALUES('8', '1', 'CL Contact Form', 'form', 'none', '', '', '?>', '', '0', '', '', '48a365b4ce1e322a55ae9017f3daf0c0', '2016-05-23 15:02:21', '2017-08-11 12:41:45'); -INSERT INTO !PREFIX!_mod VALUES('9', '1', 'CL Newsletter Subscription', 'form', 'none', '', '', '?>', '', '0', '', '', '48a365b4ce1e322a55ae9017f3daf0c0', '2016-05-23 15:03:10', '2017-08-11 12:41:45'); -INSERT INTO !PREFIX!_mod VALUES('10', '1', 'CL Newsletter Handler', 'apps', 'none', '', '', '?>', '', '0', '', '', '48a365b4ce1e322a55ae9017f3daf0c0', '2016-05-23 15:04:05', '2017-08-11 12:41:45'); INSERT INTO !PREFIX!_mod VALUES('11', '1', 'CL HTML Text', 'content', 'none', '', '', '?>\n * @license http://www.gnu.de/documents/gpl.de.html GPL v3\n * @link http://conlite.org ConLite Portal\n * \n * \n * $Id$\n */\nif (!isset($oTpl) || !is_object($oTpl)) {\n $oTpl = new Template();\n}\n\n$oTpl->reset();\n$oTpl->set(''s'', ''text'', "CMS_HTML[1]");\n$oTpl->generate(''text_html.html'');\n?>', '', '0', '', '', '48a365b4ce1e322a55ae9017f3daf0c0', '2016-05-23 15:29:56', '2017-08-11 12:41:45'); INSERT INTO !PREFIX!_mod VALUES('12', '1', 'CL Cookie Directive', 'navigation', 'none', '', '', '?>\n * @license http://www.gnu.de/documents/gpl.de.html GPL v3\n * @link http://conlite.org ConLite Portal\n * \n * \n * $Id$\n */\n\ndefined("CON_FRAMEWORK") || die(''Illegal call: Missing framework initialization - request aborted.'');\n\n$aCfgMod = array(\n ''debug'' => FALSE\n);\n\n$aCookieOpt = array(\n ''explicitConsent'' => ''false'',\n ''position'' => ''top'',\n ''message'' => mi18n("This site uses cookies. Some of the cookies we use are essential for parts of the site to operate and have already been set."),\n ''message'' => mi18n("We have placed cookies on your computer to help make this website better."),\n// Messages\n ''multipleCookieScriptBeginningLabel'' => mi18n("We use"),\n ''and'' => '' ''.mi18n("and").'' '',\n ''multipleCookieScriptEndLabel'' => '' ''.mi18n("scripts, which all set cookies.").'' '',\n ''singleCookieScriptBeginningLabel'' => ''!!! ''.mi18n("We use a").'' '',\n ''singleCookieScriptEndLabel'' => '' ''.mi18n("script which sets cookies."),\n ''explicitCookieDeletionWarning'' => mi18n("You may delete and block all cookies from this site, but parts of the site will not work."),\n ''explicitFindOutMore'' => mi18n("To find out more about cookies on this website, see our"),\n ''privacyPolicyLinkText'' => '' ''.mi18n("privacy policy"),\n ''explicitCheckboxLabel'' => mi18n("You must tick the \\"I accept cookies from this site\\" box to accept"),\n ''explicitCookieAcceptanceLabel'' => mi18n("I accept cookies from this site"),\n ''explicitCookieAcceptButtonText'' => mi18n("Continue"),\n ''impliedDisclosureText'' => '' ''.mi18n("More details can be found in our"),\n ''impliedSubmitText'' => mi18n("Do not show this message again")\n);\n?>\n', '', '0', '', '', '48a365b4ce1e322a55ae9017f3daf0c0', '2016-07-18 15:20:44', '2017-08-11 12:41:45'); INSERT INTO !PREFIX!_mod VALUES('13', '1', 'CL Social Media Links', 'navigation', 'none', '', '', '?>\n * @license http://www.gnu.de/documents/gpl.de.html GPL v3\n * @link http://conlite.org ConLite Portal\n * \n * \n * $Id$\n */\n\ndefined("CON_FRAMEWORK") || die(''Illegal call: Missing framework initialization - request aborted.'');\n\n$aCfgMod = array(\n ''debug'' => FALSE\n);\n\n$aSupportedSocialNets = array(\n ''xing'',\n ''twitter'',\n ''google-plus'',\n ''pinterest'',\n ''youtube'',\n ''flickr'',\n ''rss'',\n ''vimeo'',\n ''dribble'',\n ''linkedin''\n);\n\n$aLinks = array(\n ''twitter'' => array(\n ''href'' => ''https://twitter.com/conlite_cms'',\n ''label'' => mi18n("Meet us on Twitter")\n ),\n ''xing'' => array(\n ''href'' => ''https://www.xing.com/communities/groups/conlite-the-lightweight-and-userfriendly-cms-cec9-1045289'',\n ''label'' => mi18n("Link in Modul-Output")\n )\n);\n\n$aUserLinks = getEffectiveSettingsByType("social-media-links");\n$aUserLinksArray = array();\nif (count($aUserLinks) > 0) {\n foreach ($aUserLinks as $key => $value) {\n $sKey = strtolower(trim($key));\n if (in_array($sKey, $aSupportedSocialNets)) {\n $aValues = explode("::", $value);\n $sLabel = (isset($aValues[1]) && !empty($aValues[1])) ? $aValues[1] : "";\n $aUserLinksArray[$sKey] = array(\n ''href'' => $aValues[0],\n ''label'' => $sLabel\n );\n }\n }\n}\n\n$aLinks = array_merge($aLinks, $aUserLinksArray);\n\n$oTpl = new Template();\n\nforeach ($aLinks as $sName => $aEntry) {\n $oTpl->set(''d'', ''SM_CSS_WHAT'', $sName);\n $oTpl->set(''d'', ''SM_HREF'', $aEntry[''href'']);\n $oTpl->set(''d'', ''SM_LABEL'', $aEntry[''label'']);\n $oTpl->next();\n}\n\n$oTpl->generate("cl_social_media_links.html");\n?>', '', '0', '', '', '48a365b4ce1e322a55ae9017f3daf0c0', '2016-07-19 12:54:20', '2017-08-11 12:41:45'); -INSERT INTO !PREFIX!_mod VALUES('15', '1', 'CL Ratings', 'community', 'none', '\r\n\r\nAutor:\r\nVersion:', '', '?>Bewertung

''."\\n";\nif ($Showroomoption=="auswahl") {\n echo ''''.mi18n("Bewertungen für den Artikel zulassen").''  ''.mi18n("Keine Bewertungen für den Artikel zulassen").'''';\n} else {\n echo ''''.mi18n("Bewertungen für den Artikel zulassen").''  ''.mi18n("Keine Bewertungen für den Artikel zulassen").'''';\n}\necho ''''."\\n";\necho ''''."\\n";\n?>
Sie können Bewertungen für der Artikel zulassen. Dafür wechseln Sie in die Konfiguration des Artikels und wählen Sie "Bewertungen für den Artikel zulassen".

";\n}\n?>\n\n_seArticle();\n $this->_setSperrzeit($iSperrzeit);\n $this->_setRemoteAddr($_SERVER[''REMOTE_ADDR'']);\n $this->_setTimestamp();\n $this->_setMaxSterne($iMaxSterne);\n }\n\n private function _seArticle() {\n global $idart;\n\n $this->_oArticle = new cApiArticle($idart);\n }\n\n private function _getArticle() {\n return $this->_oArticle;\n }\n\n private function _setSperrzeit($iSperrzeit) {\n $this->_iSperrzeit = $iSperrzeit;\n }\n\n private function _getSperrzeit() {\n return $this->_iSperrzeit;\n }\n\n private function _setRemoteAddr($sRemoteAddr) {\n $this->_sRemoteAddr = $sRemoteAddr;\n }\n\n private function _getRemoteAddr() {\n return $this->_sRemoteAddr;\n }\n\n private function _setTimestamp() {\n $this->_iTimestamp = time();\n }\n\n private function _getTimestamp() {\n return $this->_iTimestamp;\n }\n\n private function _setBewerter() {\n $aBewerter = $this->_getBewerter();\n\n $aBewerter[$this->_getRemoteAddr()] = $this->_getTimestamp();\n\n $this->_getArticle()->setProperty(''Artikelbewertung'', ''bewerter'', base64_encode(serialize($aBewerter)));\n }\n\n private function _getBewerter() {\n return unserialize(base64_decode($this->_getArticle()->getProperty(''Artikelbewertung'', ''bewerter'')));\n }\n\n private function _setSterne($iSterne) {\n $this->_getArticle()->setProperty(''Artikelbewertung'', ''sterne'', $this->getSterne()+$iSterne);\n }\n\n public function getSterne() {\n return $this->_getArticle()->getProperty(''Artikelbewertung'', ''sterne'');\n }\n\n private function _setBewertungen() {\n $this->_getArticle()->setProperty(''Artikelbewertung'', ''bewertungen'', $this->getBewertungen()+1);\n }\n\n public function getBewertungen() {\n return $this->_getArticle()->getProperty(''Artikelbewertung'', ''bewertungen''); \n }\n\n private function _setGesamtbewertung() {\n $this->_getArticle()->setProperty(''Artikelbewertung'', ''gesamtbewertung'', round(bcdiv($this->getSterne(), $this->getBewertungen(), 2), 0));\n }\n\n public function getGesamtbewertung() {\n $iGesamtbewertung = $this->_getArticle()->getProperty(''Artikelbewertung'', ''gesamtbewertung'');\n \n return ($iGesamtbewertung >= 1 ? $iGesamtbewertung : 0);\n }\n\n private function _setMaxSterne($iMaxSterne) {\n $this->_iMaxSterne = $iMaxSterne;\n }\n\n public function getMaxSterne() {\n return $this->_iMaxSterne;\n }\n\n private function _checkSperre() {\n // Bewerter dieses Artikels auslesen\n $aBewerter = $this->_getBewerter();\n\n return (bcadd($aBewerter[$this->_getRemoteAddr()], $this->_getSperrzeit()) < $this->_getTimestamp() ? true : false);\n }\n \n public function getcheckSperre() {\n $aBewerter = $this->_getBewerter();\n return (bcadd($aBewerter[$this->_getRemoteAddr()], $this->_getSperrzeit()) < $this->_getTimestamp() ? true : false);\n }\n\n private function _checkSterne($iSterne) {\n return ($iSterne > 0 && $iSterne <= $this->getMaxSterne() ? true : false);\n }\n\n public function rate($iSterne) {\n // überprüfen ob ein zugelassener Wert übergeben wurde\n if ($this->_checkSterne($iSterne)) {\n // überprüfen ob die letzte Wertung mehr als x Sekunden her ist\n if ($this->_checkSperre()) {\n\n $this->_setBewerter();\n $this->_setSterne($iSterne);\n $this->_setBewertungen();\n $this->_setGesamtbewertung();\n\n }\n }\n }\n }\n\n$Showroomoption="CMS_VALUE[9922]";\nif ($Showroomoption == "auswahl") {\n\n /***************\n ARTIKEL-BEWERTUNG\n ****************/\n\n // Configuration\n $iSperrzeit = 24*60*60; /* 1 Tag */\n // $iSperrzeit = 60; /* 1 Minute */\n $iMaxSterne = 5;\n\n // neues Objekte zur Templateverwendung initialisieren\n (!isset($oTemplate) ? $oTemplate = new Template() : $oTemplate->reset());\n\n // Objekt zur Artikelbewertung initialisieren\n $oArtikelbewertung = new wtArtikelbewertung($iSperrzeit, $iMaxSterne);\n\n // dem Artikel eine Bewertung geben\n // Abfragen ob von der eigenen Webseite\n if (strpos($_SERVER[''HTTP_REFERER''], ''ferien-motzen.de'') !== false) {\n $oArtikelbewertung->rate(Contenido_Security::toInteger($_GET[''article_rate'']));\n }\n\n // Sterne ausgeben\n for ($i = 1; $i <= $oArtikelbewertung->getMaxSterne(); $i++) {\n $oTemplate->set(''d'', ''bewertungslink'', Contenido_Url::getInstance()->build(array(''idart'' => $idart, ''lang'' => $lang, ''client'' => $client, ''article_rate'' => $i)));\n $oTemplate->set(''d'', ''empty_full'', ($i <= $oArtikelbewertung->getGesamtbewertung() ? ''full'' : ''empty''));\n $oTemplate->next();\n }\n \n // Anzahl der Stimmen\n $iBewertungen = $oArtikelbewertung->getBewertungen();\n $oTemplate->set(''s'', ''bewerteranzahl'', $iBewertungen);\n \n // Namen ausgeben\n $headlinedesartikel = "CMS_HTMLHEAD[1]"; \n $headlinedesartikel = capiStrTrimAfterWord($headlinedesartikel, 52).'''';\n $oTemplate->set(''s'', ''kategorie'', strip_tags($headlinedesartikel));\n // $keinname = "";\n // $oTemplate->set(''s'', ''kategorie'', $keinname);\n\n // Anzahl der maximalen Sterneanzahl ans Template übergeben\n $oTemplate->set(''s'', ''maxsterne'', $iMaxSterne);\n\n // Bewertung des Artikels an das Template übergeben\n $oTemplate->set(''s'', ''gesamtbewertung'', $oArtikelbewertung->getGesamtbewertung());\n \n // Überprüfung ob IP-Sperre aktiv ist\n $ipsperreaktiv = $oArtikelbewertung->getcheckSperre();\n // echo $sperresache; \n if ($ipsperreaktiv == "1") {\n // echo "keine Speere";\n // Template zum Bewerten\n $oTemplate->generate(''templates/bewertung.html'', false, true);\n } else {\n // echo "Speere aktiv";\n // Template - Bewertung nicht möglich\n $oTemplate->generate(''templates/bewertung-empty.html'', false, true);\n }\n \n } else {};\n\n?>', '', '0', '', '', '48a365b4ce1e322a55ae9017f3daf0c0', '2017-07-14 13:35:32', '2017-08-11 12:41:45'); \ No newline at end of file diff --git a/setup/data/tables.txt b/setup/data/tables.txt index 809247e..1775052 100644 --- a/setup/data/tables.txt +++ b/setup/data/tables.txt @@ -291,8 +291,8 @@ "mod_translations";"original";"text";"NO";"";"";"";"" "mod_translations";"translation";"text";"NO";"";"";"";"" "nav_main";"idnavm";"int(10)";"NO";"PRI";"0";"";"1" -"nav_main";"name";"varchar(255)";"NO";"";"";"";"" "nav_main";"location";"varchar(255)";"NO";"";"";"";"" +"nav_main";"name";"varchar(255)";"NO";"";"";"";"" "nav_sub";"idnavs";"int(10)";"NO";"PRI";"0";"";"1" "nav_sub";"idnavm";"int(10)";"NO";"";"0";"";"" "nav_sub";"idarea";"int(10)";"NO";"";"0";"";"" diff --git a/setup/lib/functions.system.php b/setup/lib/functions.system.php index f39eb9d..32c6785 100644 --- a/setup/lib/functions.system.php +++ b/setup/lib/functions.system.php @@ -1,4 +1,5 @@ query(sprintf($sSql, $sTable)); if ($db->next_record()) { return true; } } - + return false; } @@ -87,237 +86,211 @@ function checkExistingPlugin($db, $sPluginname) { * @param string $table db-table name */ function updateSystemProperties($db, $table) { - $aStandardvalues = array ( array('type' => 'pw_request', 'name' => 'enable', 'value' => 'true'), - array('type' => 'system', 'name' => 'mail_sender_name', 'value' => 'noreply%40conlite.org'), - array('type' => 'system', 'name' => 'mail_sender', 'value' => 'ConLite+Backend'), - array('type' => 'system', 'name' => 'mail_host', 'value' => 'localhost'), - array('type' => 'maintenance', 'name' => 'mode', 'value' => 'disabled'), - array('type' => 'edit_area', 'name' => 'activated', 'value' => 'true'), - array('type' => 'update', 'name' => 'check', 'value' => 'false'), - array('type' => 'update', 'name' => 'news_feed', 'value' => 'false'), - array('type' => 'update', 'name' => 'check_period', 'value' => '60'), - array('type' => 'system', 'name' => 'clickmenu', 'value' => 'false'), - array('type' => 'versioning', 'name' => 'activated', 'value' => 'true'), - array('type' => 'versioning', 'name' => 'prune_limit', 'value' => '0'), - array('type' => 'versioning', 'name' => 'path', 'value' => ''), - array('type' => 'system', 'name' => 'insight_editing_activated', 'value' => 'true') - ); - + $aStandardvalues = array(array('type' => 'pw_request', 'name' => 'enable', 'value' => 'true'), + array('type' => 'system', 'name' => 'mail_sender_name', 'value' => 'noreply%40conlite.org'), + array('type' => 'system', 'name' => 'mail_sender', 'value' => 'ConLite+Backend'), + array('type' => 'system', 'name' => 'mail_host', 'value' => 'localhost'), + array('type' => 'maintenance', 'name' => 'mode', 'value' => 'disabled'), + array('type' => 'edit_area', 'name' => 'activated', 'value' => 'true'), + array('type' => 'update', 'name' => 'check', 'value' => 'false'), + array('type' => 'update', 'name' => 'news_feed', 'value' => 'false'), + array('type' => 'update', 'name' => 'check_period', 'value' => '60'), + array('type' => 'system', 'name' => 'clickmenu', 'value' => 'false'), + array('type' => 'versioning', 'name' => 'activated', 'value' => 'true'), + array('type' => 'versioning', 'name' => 'prune_limit', 'value' => '0'), + array('type' => 'versioning', 'name' => 'path', 'value' => ''), + array('type' => 'system', 'name' => 'insight_editing_activated', 'value' => 'true') + ); + foreach ($aStandardvalues as $aData) { - $sql = "SELECT value FROM %s WHERE type='".$aData['type']."' AND name='".$aData['name']."'"; - $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db))); + $sql = "SELECT value FROM %s WHERE type='" . $aData['type'] . "' AND name='" . $aData['name'] . "'"; + $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db))); if ($db->next_record()) { $sValue = $db->f('value'); if ($sValue == '') { $sql = "UPDATE %s SET value = '%s' WHERE type='%s' AND name='%s'"; - $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db), $aData['value'], $aData['type'], $aData['name'])); + $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db), $aData['value'], $aData['type'], $aData['name'])); } } else { $id = $db->nextid($table); $sql = "INSERT INTO %s SET idsystemprop = '%s', type='%s', name='%s', value='%s'"; - $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db), $id, $aData['type'], $aData['name'], $aData['value'])); + $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db), $id, $aData['type'], $aData['name'], $aData['value'])); } } } -function updateContenidoVersion ($db, $table, $version) -{ - $sql = "SELECT idsystemprop FROM %s WHERE type='system' AND name='version'"; - $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db))); - - if ($db->next_record()) - { - $sql = "UPDATE %s SET value = '%s' WHERE type='system' AND name='version'"; - $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db), Contenido_Security::escapeDB($version, $db))); - } else { - $id = $db->nextid($table); - $sql = "INSERT INTO %s SET idsystemprop = '%s', type='system', name='version', value='%s'"; - $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db), $id, Contenido_Security::escapeDB($version, $db))); - } +function updateContenidoVersion($db, $table, $version) { + $sql = "SELECT idsystemprop FROM %s WHERE type='system' AND name='version'"; + $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db))); + + if ($db->next_record()) { + $sql = "UPDATE %s SET value = '%s' WHERE type='system' AND name='version'"; + $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db), Contenido_Security::escapeDB($version, $db))); + } else { + $id = $db->nextid($table); + $sql = "INSERT INTO %s SET idsystemprop = '%s', type='system', name='version', value='%s'"; + $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db), $id, Contenido_Security::escapeDB($version, $db))); + } } -function getContenidoVersion ($db, $table) -{ - $sql = "SELECT value FROM %s WHERE type='system' AND name='version'"; - $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db))); - - if ($db->next_record()) - { - return $db->f("value"); - } else { - return false; - } +function getContenidoVersion($db, $table) { + $sql = "SELECT value FROM %s WHERE type='system' AND name='version'"; + $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db))); + + if ($db->next_record()) { + return $db->f("value"); + } else { + return false; + } } -function updateSysadminPassword ($db, $table, $password) -{ - $sql = "SELECT password FROM %s WHERE username='sysadmin'"; - $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db))); +function updateSysadminPassword($db, $table, $password) { + $sql = "SELECT password FROM %s WHERE username='sysadmin'"; + $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db))); - if ($db->next_record()) - { - $sql = "UPDATE %s SET password='%s' WHERE username='sysadmin'"; - $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db), md5($password))); - return true; - } else { - - return false; - } + if ($db->next_record()) { + $sql = "UPDATE %s SET password='%s' WHERE username='sysadmin'"; + $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db), md5($password))); + return true; + } else { + + return false; + } } -function listClients ($db, $table) -{ - $sql = "SELECT idclient, name, frontendpath, htmlpath FROM %s"; - - $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db))); - - $clients = array(); - - while ($db->next_record()) - { - $clients[$db->f("idclient")] = array("name" => $db->f("name"), "frontendpath" => $db->f("frontendpath"), "htmlpath" => $db->f("htmlpath")); - } - - return $clients; +function listClients($db, $table) { + $sql = "SELECT idclient, name, frontendpath, htmlpath FROM %s"; + + $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db))); + + $clients = array(); + + while ($db->next_record()) { + $clients[$db->f("idclient")] = array("name" => $db->f("name"), "frontendpath" => $db->f("frontendpath"), "htmlpath" => $db->f("htmlpath")); + } + + return $clients; } -function updateClientPath ($db, $table, $idclient, $frontendpath, $htmlpath) -{ - $sql = "UPDATE %s SET frontendpath='%s', htmlpath='%s' WHERE idclient='%s'"; - - $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db), Contenido_Security::escapeDB($frontendpath, $db), Contenido_Security::escapeDB($htmlpath, $db), Contenido_Security::escapeDB($idclient, $db))); +function updateClientPath($db, $table, $idclient, $frontendpath, $htmlpath) { + $sql = "UPDATE %s SET frontendpath='%s', htmlpath='%s' WHERE idclient='%s'"; + + $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db), Contenido_Security::escapeDB($frontendpath, $db), Contenido_Security::escapeDB($htmlpath, $db), Contenido_Security::escapeDB($idclient, $db))); } -function stripLastSlash ($sInput) -{ - if (substr($sInput, strlen($sInput)-1,1) == "/") - { - $sInput = substr($sInput, 0, strlen($sInput)-1); - } - - return $sInput; +function stripLastSlash($sInput) { + if (substr($sInput, strlen($sInput) - 1, 1) == "/") { + $sInput = substr($sInput, 0, strlen($sInput) - 1); + } + + return $sInput; } -function getSystemDirectories ($bOriginalPath = false) -{ - - $root_path = __FILE__; +function getSystemDirectories($bOriginalPath = false) { - $root_path = str_replace("\\", "/", $root_path); - - $root_path = dirname(dirname(dirname($root_path))); - $root_http_path = dirname(dirname($_SERVER["PHP_SELF"])); - - $root_path = str_replace("\\", "/", $root_path); - $root_http_path = str_replace("\\", "/", $root_http_path); - - $port = ""; - $protocol = "http://"; - - if ($_SERVER["SERVER_PORT"] != 80) - { - if ($_SERVER["SERVER_PORT"] == 443) - { - $protocol = "https://"; - } else { - $port = ":".$_SERVER["SERVER_PORT"]; - - } - } - - $root_http_path = $protocol . $_SERVER["SERVER_NAME"].$port . $root_http_path; - - if (substr($root_http_path, strlen($root_http_path)-1,1) == "/") - { - $root_http_path = substr($root_http_path, 0, strlen($root_http_path)-1); + $root_path = __FILE__; + + $root_path = str_replace("\\", "/", $root_path); + + $root_path = dirname(dirname(dirname($root_path))); + $root_http_path = dirname(dirname($_SERVER["PHP_SELF"])); + + $root_path = str_replace("\\", "/", $root_path); + $root_http_path = str_replace("\\", "/", $root_http_path); + + $port = ""; + $protocol = "http://"; + + if ($_SERVER["SERVER_PORT"] != 80) { + if ($_SERVER["SERVER_PORT"] == 443) { + $protocol = "https://"; + } else { + $port = ":" . $_SERVER["SERVER_PORT"]; } - - if ($bOriginalPath == true) - { - return array($root_path, $root_http_path); - } - - if (isset($_SESSION["override_root_path"])) - { - $root_path = $_SESSION["override_root_path"]; - } - - if (isset($_SESSION["override_root_http_path"])) - { - $root_http_path = $_SESSION["override_root_http_path"]; - } - - $root_path = stripLastSlash($root_path); - $root_http_path = stripLastSlash($root_http_path); - + } + + $root_http_path = $protocol . $_SERVER["SERVER_NAME"] . $port . $root_http_path; + + if (substr($root_http_path, strlen($root_http_path) - 1, 1) == "/") { + $root_http_path = substr($root_http_path, 0, strlen($root_http_path) - 1); + } + + if ($bOriginalPath == true) { return array($root_path, $root_http_path); + } + + if (isset($_SESSION["override_root_path"])) { + $root_path = $_SESSION["override_root_path"]; + } + + if (isset($_SESSION["override_root_http_path"])) { + $root_http_path = $_SESSION["override_root_http_path"]; + } + + $root_path = stripLastSlash($root_path); + $root_http_path = stripLastSlash($root_http_path); + + return array($root_path, $root_http_path); } -function findSimilarText ($string1, $string2) -{ - for ($i=0;$iquery($sql); + $db->query($sql); - while ($db->next_record()) - { - $cfgClient["set"] = "set"; - $cfgClient[$db->f("idclient")]["path"]["frontend"] = $db->f("frontendpath"); - $cfgClient[$db->f("idclient")]["path"]["htmlpath"] = $db->f("htmlpath"); - $errsite_idcat[$db->f("idclient")] = $db->f("errsite_cat"); - $errsite_idart[$db->f("idclient")] = $db->f("errsite_art"); + while ($db->next_record()) { + $cfgClient["set"] = "set"; + $cfgClient[$db->f("idclient")]["path"]["frontend"] = $db->f("frontendpath"); + $cfgClient[$db->f("idclient")]["path"]["htmlpath"] = $db->f("htmlpath"); + $errsite_idcat[$db->f("idclient")] = $db->f("errsite_cat"); + $errsite_idart[$db->f("idclient")] = $db->f("errsite_art"); - $cfgClient[$db->f("idclient")]["images"] = $db->f("htmlpath")."images/"; - $cfgClient[$db->f("idclient")]["upload"] = "upload/"; + $cfgClient[$db->f("idclient")]["images"] = $db->f("htmlpath") . "images/"; + $cfgClient[$db->f("idclient")]["upload"] = "upload/"; - $cfgClient[$db->f("idclient")]["htmlpath"]["frontend"] = $cfgClient[$db->f("idclient")]["path"]["htmlpath"]; - $cfgClient[$db->f("idclient")]["upl"]["path"] = $cfgClient[$db->f("idclient")]["path"]["frontend"]."upload/"; - $cfgClient[$db->f("idclient")]["upl"]["htmlpath"] = $cfgClient[$db->f("idclient")]["htmlpath"]["frontend"]."upload/"; - $cfgClient[$db->f("idclient")]["upl"]["frontendpath"] = "upload/"; - $cfgClient[$db->f("idclient")]["css"]["path"] = $cfgClient[$db->f("idclient")]["path"]["frontend"]."css/"; - $cfgClient[$db->f("idclient")]["js"]["path"] = $cfgClient[$db->f("idclient")]["path"]["frontend"]."js/"; - $cfgClient[$db->f("idclient")]["tpl"]["path"] = $cfgClient[$db->f("idclient")]["path"]["frontend"]."templates/"; - } + $cfgClient[$db->f("idclient")]["htmlpath"]["frontend"] = $cfgClient[$db->f("idclient")]["path"]["htmlpath"]; + $cfgClient[$db->f("idclient")]["upl"]["path"] = $cfgClient[$db->f("idclient")]["path"]["frontend"] . "upload/"; + $cfgClient[$db->f("idclient")]["upl"]["htmlpath"] = $cfgClient[$db->f("idclient")]["htmlpath"]["frontend"] . "upload/"; + $cfgClient[$db->f("idclient")]["upl"]["frontendpath"] = "upload/"; + $cfgClient[$db->f("idclient")]["css"]["path"] = $cfgClient[$db->f("idclient")]["path"]["frontend"] . "css/"; + $cfgClient[$db->f("idclient")]["js"]["path"] = $cfgClient[$db->f("idclient")]["path"]["frontend"] . "js/"; + $cfgClient[$db->f("idclient")]["tpl"]["path"] = $cfgClient[$db->f("idclient")]["path"]["frontend"] . "templates/"; + } } + ?> \ No newline at end of file diff --git a/setup/lib/release.php b/setup/lib/release.php deleted file mode 100644 index fa798b2..0000000 --- a/setup/lib/release.php +++ /dev/null @@ -1,258 +0,0 @@ - - * @license http://www.contenido.org/license/LIZENZ.txt - * @link http://www.4fb.de - * @link http://www.contenido.org - * - * - * - * {@internal - * created 2005-10-06 - * modified 2008-07-07, bilal arslan, added security fix - * modified 2010-05-20, Murat Purc, standardized Contenido startup and security check invocations, see [#CON-307] - * - * $Id: release.php 279 2013-11-21 14:34:53Z oldperl $: - * }} - * - */ - -if (!defined('CON_FRAMEWORK')) { - die('Illegal call'); -} - -// Contenido startup process -include_once ('../../conlite/includes/startup.php'); - -cInclude("includes", "functions.database.php"); - -?> - - - - - Contenido - Release Toolkit - - - - - - - - - -
- Contenido -

Contenido - Release Toolkit

-
-
-loadData("release.xml"); - -$aReleaseInfo = $cApiXml2Array->getResult(); - -/* Extract version information */ -$sTargetVersion = $aReleaseInfo["release"]["version"][0]["content"]; -$sSourcePrefix = $aReleaseInfo["release"]["sqlfiles"][0]["@sourceprefix"]; -$sTargetPrefix = $aReleaseInfo["release"]["sqlfiles"][0]["@targetprefix"]; -$sLinesPerFile = $aReleaseInfo["release"]["sqlfiles"][0]["@linesperfile"]; - -$db = new DB_Contenido; - -echo "

Execute scripts and prepare file contents

\n"; - -foreach ($aReleaseInfo["release"]["sqlfiles"][0]["rules"] as $rules) -{ - $group = $rules["@group"]; - - $groupfiles[$group] = array(); - echo "
Parsing group $group
\n"; - - foreach ($rules["rule"] as $rule) - { - $mcount = 1; - - $file = $rule["@file"]; - - echo " Preparing file $file
\n"; - $prerun = ""; - - if (is_array($rule["prerun"])) - { - foreach ($rule["prerun"] as $preruns) - { - $sqlchunks[$group."/".$file.$mcount.".sql"][] = $preruns["content"]; - $groupfiles[$group][] = $group."/".$file.$mcount.".sql"; - } - } - - $source = ""; - - if (is_array($rule["source"])) - { - foreach ($rule["source"] as $sources) - { - $source = $sources["content"]; - - $source = str_replace($sTargetPrefix, $sSourcePrefix, $source); - - $db->query($source); - echo " Executing
$source

\n"; - - $sqlcount = 0; - while ($db->next_record()) - { - /* Extract the table name */ - $sTableName = mysql_field_table($db->Query_ID, '0'); - $sTableName = str_replace($sSourcePrefix."_", $sTargetPrefix."_", $sTableName); - - $targetSQL = "INSERT INTO %s VALUES(%s);"; - - $aInsert = array(); - for ($i=0;$i<$db->num_fields();$i++) - { - $data = $db->f($i); - $rootpath = str_replace("/conlite/", "/", $cfg['path']['contenido']); - $webpath = str_replace("/conlite/", "/", $cfg['path']['contenido_fullhtml']); - - $data = str_replace($rootpath, '/', $data); - $data = str_replace($webpath, '/', $data); - - $data = str_replace("\\", "\\\\", $data); - $data = str_replace("\n", "\\n", $data); - $data = str_replace("\r", "\\r", $data); - $data = str_replace("'", "''", $data); - $aInsert[] = "'".$data."'"; - } - - $sqlchunks[$group."/".$file.$mcount.".sql"][] = sprintf($targetSQL, $sTableName, implode(", ", $aInsert)); - - $groupfiles[$group][] = $group."/".$file.$mcount.".sql"; - $sqlcount++; - - if ($sqlcount > $sLinesPerFile) - { - $sqlcount = 0; - $mcount++; - } - } - } - } - } -} - -echo "

Writing data files

\n"; - -foreach ($sqlchunks as $file => $sqlchunk) -{ - echo "Writing ".$cfg["path"]["contenido"]."../setup/data/".$file."
\n"; - @mkdir(dirname($cfg["path"]["contenido"]."../setup/data/".$file)); - file_put_contents($cfg["path"]["contenido"]."../setup/data/".$file, implode(PHP_EOL, $sqlchunk)); -} - -echo "

Writing setup variants files

\n"; - -foreach ($groupfiles as $group => $files) -{ - $filename = $group.".txt"; - $filecontents = implode(PHP_EOL, array_unique($files)); - - file_put_contents($cfg["path"]["contenido"]."../setup/data/".$filename, $filecontents); - - echo "Writing ".$cfg["path"]["contenido"]."../setup/data/".$filename."
\n"; -} - -echo "

Exporting table structures

\n"; - -$dbexport = new DB_Contenido; -$rawtext = true; - -foreach ($cfg["tab"] as $key => $value) -{ - echo "Exporting table $value
\n"; - $tArray[$value] = dbDumpStructure($dbexport, $value, $rawtext); -} - -$csv = new CSV; -$row = 1; -ksort($tArray); - -foreach ($tArray as $table) -{ - foreach ($table as $field) - { - $row++; - $cell = 1; - foreach ($field as $entry) - { - $cell++; - $csv->setCell($row, $cell, $entry); - } - } -} - -file_put_contents($cfg["path"]["contenido"]."../setup/data/tables.txt", $csv->make()); -?> -

Finished

- - diff --git a/setup/lib/release.xml b/setup/lib/release.xml deleted file mode 100644 index baf0fae..0000000 --- a/setup/lib/release.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - 2.0 Beta - - - - UPDATE !PREFIX!_phplib_auth_user_md5 SET password=md5('sysadmin') WHERE username="sysadmin"; - SELECT * FROM !PREFIX!_phplib_auth_user_md5 WHERE username="sysadmin"; - - - - - - SELECT * FROM !PREFIX!_actions - - - - SELECT * FROM !PREFIX!_area - - - - SELECT * FROM !PREFIX!_chartable - - - - SELECT * FROM !PREFIX!_files - - - - SELECT * FROM !PREFIX!_frame_files - - - - SELECT * FROM !PREFIX!_meta_type - - - - SELECT * FROM !PREFIX!_nav_main - - - - SELECT * FROM !PREFIX!_nav_sub - - - - SELECT * FROM !PREFIX!_type - - - - - - - - SELECT * FROM !PREFIX!_clients; - SELECT * FROM !PREFIX!_clients_lang; - SELECT * FROM !PREFIX!_lang; - SELECT * FROM !PREFIX!_phplib_auth_user_md5 WHERE username="admin"; - - - - - SELECT * FROM !PREFIX!_art; - SELECT * FROM !PREFIX!_art_lang; - - - UPDATE !PREFIX!_cat_art SET createcode='1'; - SELECT * FROM !PREFIX!_cat; - SELECT * FROM !PREFIX!_cat_art; - SELECT * FROM !PREFIX!_cat_lang; - SELECT * FROM !PREFIX!_cat_tree; - - - SELECT * FROM !PREFIX!_container; - SELECT * FROM !PREFIX!_container_conf; - - - SELECT * FROM !PREFIX!_content; - - - SELECT * FROM !PREFIX!_lay; - SELECT * FROM !PREFIX!_template; - SELECT * FROM !PREFIX!_template_conf; - SELECT * FROM !PREFIX!_upl; - SELECT * FROM !PREFIX!_keywords; - SELECT * FROM !PREFIX!_properties; - SELECT * FROM !PREFIX!_frontendusers; - SELECT * FROM !PREFIX!_frontendpermissions; - SELECT * FROM !PREFIX!_frontendgroups; - SELECT * FROM !PREFIX!_frontendgroupmembers; - - - - - SELECT * FROM !PREFIX!_mod; - - - SELECT * FROM !PREFIX!_mod_translations; - - - - \ No newline at end of file