diff --git a/conlite/classes/cApi/class.nav.main.php b/conlite/classes/cApi/class.nav.main.php
index 5d10255..b1863b5 100644
--- a/conlite/classes/cApi/class.nav.main.php
+++ b/conlite/classes/cApi/class.nav.main.php
@@ -1,4 +1,5 @@
_setItemClass("cApiNavMain");
}
+
+ public function create($sName, $sLocation, $iId = NULL) {
+ $oItem = $this->createNewItem($iId);
+ if ($oItem->isLoaded()) {
+ $oItem->set('name', $name);
+ $oItem->set('location', $location);
+ $oItem->store();
+ return $oItem;
+ }
+ }
+
}
class cApiNavMain extends Item {
+
public function __construct($mId = false) {
global $cfg;
parent::__construct(cRegistry::getConfigValue('tab', 'nav_main'), 'idnavm');
@@ -28,4 +41,5 @@ class cApiNavMain extends Item {
$this->loadByPrimaryKey($mId);
}
}
-}
\ No newline at end of file
+
+}
diff --git a/conlite/classes/class.genericdb.php b/conlite/classes/class.genericdb.php
index d9788c8..1a2d387 100644
--- a/conlite/classes/class.genericdb.php
+++ b/conlite/classes/class.genericdb.php
@@ -1153,7 +1153,14 @@ abstract class ItemCollection extends cItemBaseAbstract
public function createNewItem($aData = NULL)
{ /* @var $oDb DB_ConLite */
$oDb = $this->_getSecondDBInstance();
- $iNextId = $oDb->nextid($this->table);
+ if(is_null($aData) || empty($aData)) {
+ $iNextId = $oDb->nextid($this->table);
+ } else if(is_array($aData) && key_exists($this->primaryKey, $aData)) {
+ $iNextId = (int) $aData[$this->primaryKey];
+ } else {
+ $iNextId = (int) $aData;
+ }
+
$sql = 'INSERT INTO `%s` (%s) VALUES (%d)';
$oDb->query($sql, $this->table, $this->primaryKey, $iNextId);
return $this->loadItem($iNextId);
diff --git a/conlite/classes/class.navigation.php b/conlite/classes/class.navigation.php
index eedb3b6..42bafd4 100644
--- a/conlite/classes/class.navigation.php
+++ b/conlite/classes/class.navigation.php
@@ -1,4 +1,5 @@
plugxml->valueOf($xpath);
-
} else {
$caption = $this->xml->valueOf($location);
}
@@ -137,20 +133,19 @@ class Contenido_Navigation {
return $caption;
}
-
- /**
- * Reads and fills the navigation structure data
- *
- * @return void
- */
+ /**
+ * Reads and fills the navigation structure data
+ *
+ * @return void
+ */
function _buildHeaderData() {
global $cfg, $perm, $belang;
- $db = new DB_ConLite();
+ $db = new DB_ConLite();
$db2 = new DB_ConLite();
# Load main items
- $sql = "SELECT idnavm, location FROM ".$cfg['tab']['nav_main']." ORDER BY idnavm";
+ $sql = "SELECT idnavm, location FROM " . $cfg['tab']['nav_main'] . " ORDER BY idnavm";
$db->query($sql);
@@ -166,9 +161,9 @@ class Contenido_Navigation {
$sql = "SELECT
a.location AS location, b.name AS area, b.relevant
FROM
- ".$cfg['tab']['nav_sub']." AS a, ".$cfg['tab']['area']." AS b
+ " . $cfg['tab']['nav_sub'] . " AS a, " . $cfg['tab']['area'] . " AS b
WHERE
- a.idnavm = '".$db->f('idnavm')."' AND
+ a.idnavm = '" . $db->f('idnavm') . "' AND
a.level = '0' AND
b.idarea = a.idarea AND
a.online = '1' AND
@@ -180,13 +175,12 @@ class Contenido_Navigation {
while ($db2->next_record()) {
$area = $db2->f('area');
- if ($perm->have_perm_area_action($area) || $db2->f('relevant') == 0){
+ if ($perm->have_perm_area_action($area) || $db2->f('relevant') == 0) {
# Extract names from the XML document.
$name = $this->getName($db2->f('location'));
$this->data[$db->f('idnavm')][] = array($name, $area);
}
}
-
}
# debugging information
@@ -195,7 +189,6 @@ class Contenido_Navigation {
}
}
-
/**
* Function to build the Contenido header document for backend
*
@@ -208,7 +201,7 @@ class Contenido_Navigation {
$this->_buildHeaderData();
$main = new Template();
- $sub = new Template();
+ $sub = new Template();
$cnt = 0;
$t_sub = '';
@@ -224,7 +217,7 @@ class Contenido_Navigation {
foreach ($item as $key => $value) {
if (is_array($value)) {
- $sub->set('s', 'SUBID', 'sub_'.$id);
+ $sub->set('s', 'SUBID', 'sub_' . $id);
// create sub menu link
$link = new cHTMLLink();
@@ -236,7 +229,7 @@ class Contenido_Navigation {
$link->setContent($value[0]);
if ($cfg['help'] == true) {
- $sJsEvents .= "\n\t" . '$("#sub_' . $value[1] . '").click(function(){ $("#help").attr("data", "'.$value[1].'"); });';
+ $sJsEvents .= "\n\t" . '$("#sub_' . $value[1] . '").click(function(){ $("#help").attr("data", "' . $value[1] . '"); });';
}
$sub->set('d', 'CAPTION', $link->render());
@@ -257,7 +250,6 @@ class Contenido_Navigation {
$main->next();
$numSubMenus++;
-
} else {
# first entry in array is a main menu item
}
@@ -266,7 +258,7 @@ class Contenido_Navigation {
$t_sub .= $sub->generate($cfg['path']['templates'] . $cfg['templates']['submenu'], true);
$cnt ++;
}
-
+
if ($cfg['help'] == true) {
$sJsEvents .= "\n\t" . 'help.setArea("mycontenido");';
}
@@ -284,8 +276,8 @@ class Contenido_Navigation {
$oMyConLink->setTargetFrame('content');
$oMyConLink->attachEventDefinition('help_mycontenido', 'onclick', 'help.setArea("mycontenido")');
$oMyConLink->setLink($sess->url("frameset.php?area=mycontenido&frame=4"));
- $oMyConLink->setContent('');
- $main->set('s', 'MYCONTENIDO', $oMyConLink->render());
+ $oMyConLink->setContent('
');
+ $main->set('s', 'MYCONLITE', $oMyConLink->render());
// info link
$oInfoLink = new cHTMLLink();
@@ -293,7 +285,7 @@ class Contenido_Navigation {
$oInfoLink->setTargetFrame('content');
$oInfoLink->attachEventDefinition('help_info', 'onclick', 'help.setArea("info")');
$oInfoLink->setLink($sess->url('frameset.php?area=info&frame=4'));
- $oInfoLink->setContent('
');
+ $oInfoLink->setContent('
');
$main->set('s', 'INFO', $oInfoLink->render());
$main->set('s', 'LOGOUT', $sess->url('logout.php'));
@@ -305,7 +297,7 @@ class Contenido_Navigation {
$oHelpLink->setClass('main');
$oHelpLink->setLink('javascript://');
$oHelpLink->setEvent('click', 'callHelp($(\'#help\').attr(\'data\'));');
- $oHelpLink->setContent('
');
+ $oHelpLink->setContent('
');
$main->set('s', 'HELP', $oHelpLink->render());
} else {
$main->set('s', 'HELP', '');
@@ -321,9 +313,9 @@ class Contenido_Navigation {
} else {
// set delay menu
$mouseOver = getEffectiveSetting('system', 'delaymenu_mouseover', 300);
- $mouseOot = getEffectiveSetting('system', 'delaymenu_mouseout', 1000);
+ $mouseOot = getEffectiveSetting('system', 'delaymenu_mouseout', 1000);
$main->set('s', 'HEADER_MENU_OBJ', 'HeaderDelayMenu');
- $main->set('s', 'HEADER_MENU_OPTIONS', '{menuId: "main_0", subMenuId: "sub_0", mouseOverDelay: '.$mouseOver.', mouseOutDelay: '.$mouseOot.'}');
+ $main->set('s', 'HEADER_MENU_OPTIONS', '{menuId: "main_0", subMenuId: "sub_0", mouseOverDelay: ' . $mouseOver . ', mouseOutDelay: ' . $mouseOot . '}');
}
$main->set('s', 'ACTION', $sess->url('index.php'));
@@ -334,30 +326,30 @@ class Contenido_Navigation {
if (strlen($sClientName) > 25) {
$sClientName = capiStrTrimHard($sClientName, 25);
}
-
- $client = Contenido_Security::toInteger($client);
- if ( $client == 0 ) {
- $sClientNameTemplate = '' . i18n("Client") . ': %s';
- $main->set('s', 'CHOSENCLIENT', sprintf($sClientNameTemplate, $sClientName));
- } else {
- $sClientNameTemplate = '' . i18n("Client") . ': %s';
-
- $sClientName = $classclient->getClientName($client).' ('.$client.')';
- $sClientUrl = $cfgClient[$client]["path"]["htmlpath"];
- if ($clientImage !== false && $clientImage != "" && file_exists($cfgClient[$client]['path']['frontend'].$clientImage)) {
- $sClientImageTemplate = '
';
-
- $sThumbnailPath = capiImgScale($cfgClient[$client]['path']['frontend'].$clientImage, 80, 25, 0, 1);
- $sClientImageTag = sprintf($sClientImageTemplate, $sThumbnailPath, $sClientName, $sClientName);
-
- $main->set('s', 'CHOSENCLIENT', sprintf($sClientNameTemplate, $sClientUrl, $sClientImageTag));
- } else {
- $main->set('s', 'CHOSENCLIENT', sprintf($sClientNameTemplate, $sClientUrl, $sClientName));
- }
- }
-
- $main->set('s', 'CHOSENUSER', "".i18n("User").": ".$classuser->getRealname($auth->auth["uid"], true));
+ $client = Contenido_Security::toInteger($client);
+ if ($client == 0) {
+ $sClientNameTemplate = '' . i18n("Client") . ': %s';
+ $main->set('s', 'CHOSENCLIENT', sprintf($sClientNameTemplate, $sClientName));
+ } else {
+ $sClientNameTemplate = '' . i18n("Client") . ': %s';
+
+ $sClientName = $classclient->getClientName($client) . ' (' . $client . ')';
+ $sClientUrl = $cfgClient[$client]["path"]["htmlpath"];
+
+ if ($clientImage !== false && $clientImage != "" && file_exists($cfgClient[$client]['path']['frontend'] . $clientImage)) {
+ $sClientImageTemplate = '
';
+
+ $sThumbnailPath = capiImgScale($cfgClient[$client]['path']['frontend'] . $clientImage, 80, 25, 0, 1);
+ $sClientImageTag = sprintf($sClientImageTemplate, $sThumbnailPath, $sClientName, $sClientName);
+
+ $main->set('s', 'CHOSENCLIENT', sprintf($sClientNameTemplate, $sClientUrl, $sClientImageTag));
+ } else {
+ $main->set('s', 'CHOSENCLIENT', sprintf($sClientNameTemplate, $sClientUrl, $sClientName));
+ }
+ }
+
+ $main->set('s', 'CHOSENUSER', "" . i18n("User") . ": " . $classuser->getRealname($auth->auth["uid"], true));
$main->set('s', 'SID', $sess->id);
$main->set('s', 'MAINLOGINLINK', $sess->url("frameset.php?area=mycontenido&frame=4"));
@@ -371,7 +363,6 @@ class Contenido_Navigation {
$main->generate($cfg['path']['templates'] . $cfg['templates']['header']);
}
-
/**
* Renders the language select box
*
@@ -379,8 +370,7 @@ class Contenido_Navigation {
*
* @return string
*/
- function _renderLanguageSelect()
- {
+ function _renderLanguageSelect() {
global $cfg, $client, $lang;
$tpl = new Template();
@@ -402,13 +392,13 @@ class Contenido_Navigation {
if ($availableLanguages->count() > 0) {
while ($myLang = $availableLanguages->nextAccessible()) {
- $key = $myLang->get('idlang');
+ $key = $myLang->get('idlang');
$value = $myLang->get('name');
// I want to get rid of such silly constructs very soon :)
- $sql = "SELECT idclient FROM ".$cfg['tab']['clients_lang']." WHERE
- idlang = '".Contenido_Security::toInteger($key)."'";
+ $sql = "SELECT idclient FROM " . $cfg['tab']['clients_lang'] . " WHERE
+ idlang = '" . Contenido_Security::toInteger($key) . "'";
$db->query($sql);
@@ -425,7 +415,7 @@ class Contenido_Navigation {
}
$tpl->set('d', 'VALUE', $key);
- $tpl->set('d', 'CAPTION', $value.' ('.$key.')');
+ $tpl->set('d', 'CAPTION', $value . ' (' . $key . ')');
$tpl->next();
}
}
@@ -438,4 +428,5 @@ class Contenido_Navigation {
return $tpl->generate($cfg['path']['templates'] . $cfg['templates']['generic_select'], true);
}
+
}
diff --git a/conlite/plugins/mod_rewrite/classes/class.modrewrite.php b/conlite/plugins/mod_rewrite/classes/class.modrewrite.php
index 260715f..03a8777 100644
--- a/conlite/plugins/mod_rewrite/classes/class.modrewrite.php
+++ b/conlite/plugins/mod_rewrite/classes/class.modrewrite.php
@@ -53,7 +53,6 @@ class ModRewrite extends ModRewriteBase {
*/
public static function initialize($clientId) {
mr_loadConfiguration($clientId, true);
- parent::initialize();
self::$_db = new DB_Contenido();
self::$_lookupTable = array();
}
diff --git a/conlite/scripts/contextMenu.js b/conlite/scripts/contextMenu.js
deleted file mode 100644
index 2a44f75..0000000
--- a/conlite/scripts/contextMenu.js
+++ /dev/null
@@ -1,112 +0,0 @@
-var display_url;
-
-function createMenu (menuname, items, links)
-{
- document.writeln('