Exemplo n.º 1
0
 function SF_PAGE_Catinfos()
 {
     //set singelton
     $this->_API_setObjectIsSingleton(true);
     // constructor
     $this->cache = sf_factoryGetObjectCache('UTILS', 'DbCache');
     $this->db = sf_factoryGetObjectCache('DATABASE', 'Ado');
 }
Exemplo n.º 2
0
 /**
  * Constructor, init common values.
  */
 public function __construct()
 {
     $this->cache = sf_factoryGetObjectCache('UTILS', 'DbCache');
     $this->db = sf_factoryGetObjectCache('DATABASE', 'Ado');
     $this->cfg = sf_api('LIB', 'Config');
     //set singelton
     $this->_API_setObjectIsSingleton(true);
 }
Exemplo n.º 3
0
 function generate()
 {
     global $cfg_client, $perm, $cms_db, $db, $auth;
     //check dependencies
     if ($this->config['idlang'] < 1 || $this->config['is_generated']) {
         return false;
     }
     if (sf_factoryObjectExistsInCache('PAGE', 'Catinfos')) {
         $this->catinfos = sf_factoryGetObjectCache('PAGE', 'Catinfos');
     } else {
         $this->catinfos = sf_factoryGetObject('PAGE', 'Catinfos');
         $this->catinfos->setIdlang($this->config['idlang']);
         $this->catinfos->generate();
     }
     $catinfos = $this->catinfos->getCatinfoDataArrayByRef();
     //check perm: user have perm to see pages with the protected flag
     //$sql_hide_protected_pages = ( $perm->have_perm(2, 'area_frontend', 0) || $this->config['check_frontend_prems']) ? '': 'AND (F.online & 0x04) = 0x00';
     $sql_hide_protected_pages = '';
     if ($auth->auth['uid'] == 'nobody') {
         $sql_hide_protected_pages = 'AND (F.online & 0x04) = 0x00';
     }
     //check perms for user with advanced frontend perms
     $check_frontendperms_in_page = $auth->auth['uid'] != 'nobody' && $this->config['check_frontend_prems'];
     $check_backendperms_in_page = $this->config['check_backend_prems'];
     $sql = "SELECT\n\t\t\t\t\tD.idcatside, D.idcat, D.sortindex, D.is_start,\n\t\t\t\t\tE.idside,\n\t\t\t\t\tIF ((F.online & 0x03) = 0x01 OR ((F.online & 0x02) = 0x02 AND (UNIX_TIMESTAMP(NOW()) BETWEEN F.start AND F.end)) ,'1' ,'0') AS online,\n\t\t\t\t\tIF ( ((F.online & 0x04) = 0x04) ,'1' ,'0') AS protected,\n\t\t\t\t\tF.title, F.start, F.rewrite_use_automatic, F.rewrite_url, F.end, F.idsidelang, F.created, F.lastmodified,\n\t\t\t\t\tF.idtplconf, F.is_https\n\t\t\t\tFROM\n\t\t\t\t\t" . $cms_db['cat_side'] . " D LEFT JOIN\n\t\t\t\t\t" . $cms_db['side'] . " E USING(idside) LEFT JOIN\n\t\t\t\t\t" . $cms_db['side_lang'] . " F USING(idside)\n\t\t\t\tWHERE \n\t\t\t\t\tD.idcat IN (" . implode(',', array_keys($catinfos)) . ")\n\t\t\t\t\tAND  F.idlang   = '" . $this->config['idlang'] . "'\n\t\t\t\t\t{$sql_hide_protected_pages}\n\t\t\t\t\tORDER BY D.idcatside";
     //try cache - on success jump out with return true
     $cache_key = $sql . '|' . $this->config['link_extra_urlstring'] . '|' . implode(',', $perm->get_group()) . '|' . $this->config['check_frontend_prems'] . '|' . $this->config['check_backend_prems'];
     if ($data = $this->cache->getCacheEntry($cache_key)) {
         $this->data = $data;
         return true;
     }
     $rs = $this->db->Execute($sql);
     if ($rs === false) {
         return true;
     }
     while (!$rs->EOF) {
         $idcatside_loop = $rs->fields['idcatside'];
         $idcat_loop = $rs->fields['idcat'];
         if ($check_frontendperms_in_page) {
             if ($rs->fields['protected'] == 1 && !$perm->have_perm(18, 'frontendpage', $idcatside_loop, $idcat_loop)) {
                 $rs->MoveNext();
                 continue;
             }
         }
         if ($check_backendperms_in_page) {
             if (!$perm->have_perm(17, 'side', $idcatside_loop, $idcat_loop)) {
                 $rs->MoveNext();
                 continue;
             }
         }
         $link_loop = 'cms://idcatside=' . $idcatside_loop;
         $this->data['data'][$idcatside_loop] = array('link' => $link_loop, 'idcat' => $idcat_loop, 'sortindex' => $rs->fields['sortindex'], 'idside' => $rs->fields['idside'], 'name' => $rs->fields['title'], 'created' => $rs->fields['created'], 'lastmodified' => $rs->fields['lastmodified'], 'online' => $rs->fields['online'], 'idsidelang' => $rs->fields['idsidelang'], 'is_start' => $rs->fields['is_start'], 'idtplconf' => $rs->fields['idtplconf'], 'rewrite_use_automatic' => $rs->fields['rewrite_use_automatic'], 'rewrite_url' => $rs->fields['rewrite_url'], 'user_protected' => $rs->fields['user_protected']);
         $rs->MoveNext();
     }
     //insert cache
     $this->cache->insertCacheEntry($cache_key, $this->data, 'frontend', 'tree');
     return true;
 }
Exemplo n.º 4
0
 function SF_UTILS_DbCache()
 {
     global $cfg_cms, $cfg_client;
     $this->_API_objectIsSingleton(true);
     $this->db = sf_factoryGetObjectCache('DATABASE', 'Ado');
     $this->is_active = $cfg_client['db_cache_enabled'] != '0' && $cfg_cms['db_cache_enabled'] == '1' ? true : false;
     $this->now = time();
     $this->_garbage();
     //$this->cache_groups = ( is_array( $cfg_client['db_cache_groups'] ) ) ? array_merge( $cfg_cms['db_cache_groups'], $cfg_client['db_cache_groups'] ) : $cfg_cms['db_cache_groups'];
     //$this->cache_items = ( is_array( $cfg_client['db_cache_items'] ) ) ? array_merge( $cfg_cms['db_cache_items'], $cfg_client['db_cache_items'] ) : $cfg_cms['db_cache_items'];
 }
Exemplo n.º 5
0
 $db->query($sql);
 while ($db->next_record()) {
     $container[$db->f('container')] = array($db->f('config'), $db->f('view'), $db->f('edit'), $db->f('name'), $db->f('output'), $db->f('idmod'), $db->f('verbose'));
 }
 // Content-Array erstellen
 $sql = "SELECT A.idcontent, container, number, idtype, typenumber, value FROM {$cms_db['content']} A LEFT JOIN {$cms_db['side_lang']} B USING(idsidelang) WHERE B.idside='{$idside}' AND B.idlang='{$lang}' ORDER BY number";
 $db->query($sql);
 while ($db->next_record()) {
     $content[$db->f('container')][$db->f('number')][$db->f('idtype')][$db->f('typenumber')] = array($db->f('idcontent'), $db->f('value'));
 }
 // Layout suchen
 $sql = "SELECT \n\t\t\t\tidlay\n\t\t\tFROM \n\t\t\t\t" . $cms_db['tpl'] . " \n\t\t\tWHERE \n\t\t\t\tidtpl='{$idtpl}'";
 $db->query($sql);
 $db->next_record();
 $idlay = $db->f('idlay');
 $SF_layout =& sf_factoryGetObjectCache('HEADER', 'Headerinfos');
 $layout = $SF_layout->getCode($idlay);
 $layout = str_replace('<CMSPHP:CACHE>', '<?PHP ', $layout);
 $layout = str_replace('</CMSPHP:CACHE>', ' ?>', $layout);
 $layout = $SF_layout->SF_Switch_Doctype($idlay) . $layout;
 // Container generieren
 $list = extract_cms_tags($layout);
 if (is_array($list)) {
     foreach ($list as $cms_mod['container']) {
         // Head-Container?
         if ($cms_mod['container']['type'] == 'head') {
             // head Meta-Tags generieren
             $code = '';
             $code .= '<CMSPHP> if ($cfg_client[\'url_rewrite\'] == \'2\') echo \'<base href="\'.htmlspecialchars(str_replace(\'{%http_host}\',  $_SERVER[\'HTTP_HOST\'], $cfg_client[\'url_rewrite_basepath\']), ENT_COMPAT, \'utf-8\').\'"' . $SF_layout->SF_Slash_Closing_Tag($idlay) . '>\'."\\n"; </CMSPHP>';
             $code .= "    <meta name=\"generator\" content=\"Sefrengo / www.sefrengo.org\" " . $SF_layout->SF_Slash_Closing_Tag($idlay) . ">\n";
             $code .= '    <?PHP if ($SF_pageinfos->getMetaAuthor($idcatside)!= \'\') echo \'<meta name="author" content="\'.htmlspecialchars($SF_pageinfos->getMetaAuthor($idcatside), ENT_COMPAT, \'utf-8\').\'"' . $SF_layout->SF_Slash_Closing_Tag($idlay) . '>\'."\\n"; ?>';
Exemplo n.º 6
0
 /**
  * Constructor initialize the database object
  */
 function SF_ADMINISTRATION_LogItem()
 {
     $this->db = sf_factoryGetObjectCache('DATABASE', 'Ado');
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->cache =& sf_factoryGetObjectCache('UTILS', 'DbCache');
     $this->db =& sf_factoryGetObjectCache('DATABASE', 'Ado');
 }
Exemplo n.º 8
0
    function pageDoubletExists($idside)
    {
        if (!is_int($idside)) {
            return false;
        }
        return count($this->idsideStore[$idside]) > 1;
    }
}
$sefrengoPDA = new cmsPageDoubletAudit();
// CatInfo-Objekt erstellen
$SF_catinfos = sf_factoryGetObjectCache('PAGE', 'Catinfos');
$SF_catinfos->setIdlang($lang);
$SF_catinfos->setCheckBackendperms(TRUE);
$SF_catinfos->generate();
// PageInfo-Objekt erstellen
$SF_pageinfos = sf_factoryGetObjectCache('PAGE', 'Pageinfos');
$SF_pageinfos->setIdlang($lang);
$SF_pageinfos->setCheckBackendperms(TRUE);
$SF_pageinfos->generate();
/******************************************************************************
 2. Eventuelle Actions/ Funktionen abarbeiten
******************************************************************************/
if ($change_show_tree == 'delete_cache') {
    $action = 'delete_cache';
} else {
    if ($change_show_tree == 'regenerate_rewrite_urls') {
        $action = 'regenerate_rewrite_urls';
    }
}
if ($action && $view && $perm->have_perm(3, 'area_frontend', 3)) {
    switch ($action) {
Exemplo n.º 9
0
 function _buildTree()
 {
     global $cms_db;
     $sql = "SELECT \n\t\t\tidcat, parent, sortindex\n\t\tFROM\n\t\t\t" . $cms_db['cat'] . " \n\t\tWHERE \n\t\t\tidclient = '" . $this->config['idclient'] . "'  \n\t\tORDER BY \n\t\t\tparent, sortindex";
     //try cache or generate data
     $cache =& sf_factoryGetObjectCache('UTILS', 'DbCache');
     if ($data = $cache->getCacheEntry($sql)) {
         $this->data =& $data;
         return true;
     } else {
         $db =& sf_factoryGetObjectCache('DATABASE', 'Ado');
         $rs = $db->Execute($sql);
         while (!$rs->EOF) {
             $this->data['rawdata'][$rs->fields['parent']][$rs->fields['sortindex']] = $rs->fields['idcat'];
             $this->data['parents'][$rs->fields['idcat']] = $rs->fields['parent'];
             $rs->MoveNext();
         }
         $rs->Close();
         $this->_treeOrder(0);
         $cache->insertCacheEntry($sql, $this->data, 'frontend', 'tree');
     }
     return true;
 }
Exemplo n.º 10
0
 public function __construct()
 {
     $this->cache = sf_factoryGetObjectCache('UTILS', 'DbCache');
     $this->db = sf_factoryGetObjectCache('DATABASE', 'Ado');
     $this->cfg = sf_api('LIB', 'Config');
 }
Exemplo n.º 11
0
 /**
  * Erstellt das Rechtepanel für die Darstellung bei der Bearbeitung von Objekten
  *
  * Ermittelt alle Rechtenamen und Rechtebitmasken aus der Tabelle cms_values und gibt die Information als Panel
  * unter Verwendung der lokalisierten Textstring aus den Language-Files und der Datenbank aus
  *
  * Baut aus der Liste der Rechtenamen einen Tabelle mit allen Rechten und jeweils zwei Radiobuttons
  *
  * Änderung der Schnittstelle, weil in Mozilla dynamische Formulare, die aus JS erstellt werden, nicht mit JS angesprochen
  * werden können. Schnittstelle gibt jetzt den Inhalt für das Rechtepanel zurück anstatt einer Liste der Rechtenamen und
  * Rechtewerte.
  *
  * @param	string 	$type	 		Anzuzeigender Rechtetyp
  * @param	string 	$rights 		Array mit Gruppennamen, Gruppenids und Gruppenrechte
  * @param	string 	$countRights 	Referenz zur Aufnahme der Anzahl der ausgelesenen Rechte
  * @param	string 	$prefix 		Prefix für Formularvariablen, damit mehrere Formulare auf einer Seite dargestellt werden können
  *
  * @global  $lang_dir
  * @global  $cms_lang
  *
  * @return	string	HTML-Konstrukt einer Tabelle mit Auswahlliste der Gruppen und Rechteliste mit Radiobuttons
  *
  * @author	Jürgen Brändle
  * @since	CMS 0.96.00 / BETA
  * @version 0.3 / 20040425
  **/
 function _get_right_names_and_values($type, $rights, &$countRights, $prefix)
 {
     global $cms_lang, $lang_dir, $lang_defdir;
     include (file_exists($lang_dir . 'lang_user_perms.php') ? $lang_dir : $lang_defdir) . 'lang_user_perms.php';
     // Erstelle Rechteliste aus cms_values
     $sql = 'SELECT conf_desc_langstring AS lang_desc, value AS bitmask ';
     $sql .= 'FROM ' . $this->cms_db['values'] . ' ';
     $sql .= "WHERE group_name = 'user_perms'";
     $sql .= " AND  key1       = '{$type}'";
     $sql .= ' AND  idclient   = 0 ';
     $sql .= ' AND  idlang     = 0 ';
     $sql .= 'ORDER BY conf_sortindex ASC, idvalues DESC';
     $countRights = 0;
     $rights_list = "";
     $this->db->query($sql);
     while ($this->db->next_record()) {
         $rights_list .= '<tr onmouseover="this.style[\'background\']=\'#FFF5CE\';" onmouseout="this.style[\'background\']=\'#FFFFFF\';">' . "\n";
         $rights_list .= '  <td class="first nowrap" align="left">' . $cms_lang[$this->db->f('lang_desc')] . '</td>' . "\n";
         $rights_list .= '  <td align="center" width=\'50\'>';
         $rights_list .= '<input type="radio" name="' . $prefix . 'uright' . $countRights . '" value="-' . $this->db->f('bitmask') . '" /></td>' . "\n";
         $rights_list .= '  <td align="center" width=\'50\'>';
         $rights_list .= '<input type="radio" name="' . $prefix . 'uright' . $countRights . '" value="' . $this->db->f('bitmask') . '" /></td>' . "\n";
         $rights_list .= '</tr>' . "\n";
         $countRights++;
     }
     //checkbox - vorhandene rechte ueberschreiben
     if (!is_object($this->perm_addon[$type])) {
         $addon =& sf_factoryGetObjectCache('ADMINISTRATION', 'PermAddonFactory');
         $this->perm_addon[$type] =& $addon->getAddonObject();
     }
     if ($this->perm_addon[$type]->showDeleteChildsCheckbox($type)) {
         $rights_list .= '<tr onmouseover="this.style[\'background\']=\'#FFF5CE\';" onmouseout="this.style[\'background\']=\'#FFFFFF\';">';
         $rights_list .= '  <td class="first nowrap" align="left">' . '<i>Vorhandene Rechte zur&uuml;cksetzen</i>' . '</td>';
         $rights_list .= '  <td align="center">' . "\n";
         $rights_list .= '</td>';
         $rights_list .= '  <td align="center" bgcolor="#EBD5C7"><input type="checkbox" name="' . $prefix . 'rmueberschreiben" id="' . $prefix . 'rmueberschreiben" value="1" /></td>' . "\n";
         $rights_list .= '</tr>';
     } else {
         $rights_list .= '<input type="hidden" name="' . $prefix . 'rmueberschreiben" id="' . $prefix . 'rmueberschreiben" value="" />' . "\n";
     }
     // Erzeuge Kopf des Panels - Überschrift, Gruppen-DropDown
     $panel = "\n" . '<div id="rightsmenucoat">' . "\n";
     // Überschrift
     $panel .= '  <h2>' . $cms_lang['panel_grouphead'] . '</h2>' . "\n";
     // Dropdown der Benutzergruppen
     $panel .= '<p>' . "\n";
     $panel .= '    <select class="groupselect" name="' . $prefix . 'rmgruppe" id="rmgruppe" onchange="' . $prefix . 'cms_rm.showRightsOfGroup(' . $countRights . ')">';
     $panel .= $this->_create_group_dropdown($rights['groups'], $rights['groupids']);
     $panel .= '    </select>';
     $panel .= '</p>' . "\n";
     // Checkbox Rechte des Vorgängers benutzen
     $panel .= '<p>' . "\n";
     $panel .= '    <input type="checkbox" name="' . $prefix . 'rmerben" id="' . $prefix . 'rmerben" value="1" onclick="' . $prefix . 'cms_rm.handleRadioReadonly()" /> <label for="' . $prefix . 'rmerben">Rechte vom Vorg&auml;nger erben</label>' . "\n";
     $panel .= '</p>' . "\n";
     // Spaltenüberschriften
     $panel .= '<table>' . "\n";
     $panel .= '<tr>' . "\n";
     $panel .= '  <th class=\'first\'>' . $cms_lang['panel_rechte'] . '</th>' . "\n";
     $panel .= '  <th width=\'50\' align="center">' . $cms_lang['panel_denied'] . '</th>' . "\n";
     $panel .= '  <th width=\'50\' align="center">' . $cms_lang['panel_granted'] . '</th>' . "\n";
     $panel .= '</tr>';
     $panel .= '</table>' . "\n";
     $panel .= '<div class="rightsscrolldiv">' . "\n";
     $panel .= '<table>' . "\n";
     // Rechtezeilen
     $panel .= $rights_list;
     $panel .= '</table>' . "\n";
     $panel .= '</div>' . "\n";
     // Zeile für alle Rechte, zunächst noch gesperrt ...
     //		$panel .= '<!--tr onmouseover="this.style[\'background\']=\'#C7D5EB\';" onmouseout="this.style[\'background\']=\'#DBE3EF\';">';
     //		$panel .= '  <td class="rightsname nowrap" align="left">' . $cms_lang['panel_all_rights'] . '</td>';
     //		$panel .= '  <td class="rightscell" align="center">';
     //		$panel .= '<a href="javascript:void(0)" onclick="'.$prefix.'cms_rm.setAllRights(-1);">' . $cms_lang['panel_all_rights_denied'] . '</a></td>';
     //		$panel .= '  <td class="rightscell" align="center">';
     //		$panel .= '<a href="javascript:void(0)" onclick="'.$prefix.'cms_rm.setAllRights(1);">' . $cms_lang['panel_all_rights_granted'] . '</a></td>';
     //		$panel .= '</tr-->';
     //		// Zeile für Rechte auf Unterelemente vererben, zunächst noch gesperrt ...
     //		$panel .= '<!--tr onmouseover="this.style[\'background\']=\'#C7D5EB\';" onmouseout="this.style[\'background\']=\'#DBE3EF\';">';
     //		$panel .= '  <td class="rightsname nowrap" align="left">' . $cms_lang['panel_all_rights'] . '</td>';
     //		$panel .= '  <td class="rightscell" align="center">';
     //		$panel .= '<a href="javascript:void(0)" onclick="'.$prefix.'cms_rm.setAllRights(-1);">' . $cms_lang['panel_all_rights_denied'] . '</a></td>';
     //		$panel .= '  <td class="rightscell" align="center">';
     //		$panel .= '<a href="javascript:void(0)" onclick="'.$prefix.'cms_rm.setAllRights(1);">' . $cms_lang['panel_all_rights_granted'] . '</a></td>';
     //		$panel .= '</tr-->';
     // Buttonzeile
     $panel .= '<div class="submit">' . "\n";
     $panel .= '    <!-- input type="button" onclick="' . $prefix . 'cms_rm.addUser()" name="NewUser"';
     $panel .= ' value="' . $cms_lang['panel_addbutton'] . '" --> ';
     $panel .= '<input class="sf_buttonAction" type="button" onclick="' . $prefix . 'cms_rm.saveRights(true, ' . $countRights . ')" name="Okay"';
     $panel .= ' value="' . $cms_lang['panel_closebutton2'] . '" onmouseover="this.className=\'sf_buttonActionOver\'" onmouseout="this.className=\'sf_buttonAction\'" /> ' . "\n";
     $panel .= '<input class="sf_buttonAction" type="button" onclick="' . $prefix . 'cms_rm.saveRights(false,' . $countRights . ' )" name="Apply"';
     $panel .= ' value="' . $cms_lang['panel_savebutton'] . '" onmouseover="this.className=\'sf_buttonActionOver\'" onmouseout="this.className=\'sf_buttonAction\'" /> ' . "\n";
     $panel .= '<input class="sf_buttonAction" type="button" onclick="' . $prefix . 'cms_rm.cancelRights(true)" name="Cancel"';
     $panel .= ' value="' . $cms_lang['panel_closebutton'] . '" onmouseover="this.className=\'sf_buttonActionCancelOver\'" onmouseout="this.className=\'sf_buttonAction\'" /> ' . "\n";
     $panel .= '</div>' . "\n" . '</div>' . "\n";
     return $panel;
 }
 function SF_ADMINISTRATION_PermAddonDirectory()
 {
     global $client;
     $this->dtree =& sf_factoryGetObjectCache('ASSETS', 'DbDirectorytree');
     $this->dtree->setIdclient($client);
     $this->dtree->generate();
 }
 function SF_ADMINISTRATION_User()
 {
     $this->db =& sf_factoryGetObjectCache('DATABASE', 'Ado');
 }
Exemplo n.º 14
0
 function getValueStyled($config = array(), $styler = 'html', $_args = array())
 {
     $out = '';
     $styler = strtolower($styler);
     if (!array_key_exists($styler, $this->styler)) {
         switch ($styler) {
             case 'html':
                 $GLOBALS['sf_factory']->requireClass('GUI', 'ContentStylerPlain');
                 $this->styler[$styler] = sf_factoryGetObjectCache('GUI', 'ContentStylerHTML');
                 break;
             case 'plain':
                 $this->styler[$styler] = sf_factoryGetObjectCache('GUI', 'ContentStylerPlain');
             default:
                 return $out;
         }
     }
     $methodname = 'get' . ucfirst($this->defaults['typename']);
     if (!method_exists($this->styler[$styler], $methodname)) {
         return $out;
     }
     if (array_key_exists('2', $_args)) {
         $out = $this->styler[$styler]->{$methodname}($this->getValue(), $_args['1'], $_args['2'], $config);
     } else {
         if (array_key_exists('1', $_args)) {
             $out = $this->styler[$styler]->{$methodname}($this->getValue(), $_args['1'], $config);
         } else {
             $out = $this->styler[$styler]->{$methodname}($this->getValue(), $config);
         }
     }
     return $out;
 }
Exemplo n.º 15
0
function rewriteGetCatRewriteAlias($idcat, $idlang)
{
    global $con_tree, $cms_db, $sf_lang_stack, $lang;
    $out = '';
    if (is_array($con_tree) && $lang == $idlang) {
        if ($con_tree[$idcat]['rewrite_alias'] == '') {
            $string = rewriteGenerateUrlString($con_tree[$idcat]['name']);
            $string = rewriteMakeUniqueStringForLang('idcat', $idcat, $string);
            rewriteSaveUrlString($idlang, 'idcat', $idcat, $string);
            $con_tree[$idcat]['rewrite_alias'] = $string;
        }
        $out = $con_tree[$idcat]['rewrite_alias'];
    } else {
        $ado =& sf_factoryGetObjectCache('DATABASE', 'Ado');
        $sql = "SELECT *\n\t\t\t\tFROM\n\t\t\t\t\t" . $cms_db['cat_lang'] . " CL LEFT JOIN\n\t\t\t\t\t" . $cms_db['cat'] . " C USING(idcat)\n\t\t\t\tWHERE \n\t\t\t\t\tCL.idcat = '" . $idcat . "'\n\t\t\t\t\tAND CL.idlang   = '" . $idlang . "'";
        $rs = $ado->Execute($sql);
        if ($rs === false) {
            return false;
        }
        if ($rs->EOF) {
            return false;
        }
        $out = $rs->fields['rewrite_alias'];
    }
    return $out;
}
 function _buildTree()
 {
     global $cms_db;
     $sql = "SELECT \n\t\t\tiddirectory, parentid, dirname\n\t\tFROM\n\t\t\t" . $cms_db['directory'] . " \n\t\tWHERE \n\t\t\tidclient = '" . $this->config['idclient'] . "'  \n\t\tORDER BY \n\t\t\tdirname";
     $db =& sf_factoryGetObjectCache('DATABASE', 'Ado');
     $rs = $db->Execute($sql);
     while (!$rs->EOF) {
         array_push($this->data['items_levelorder'], $rs->fields['iddirectory']);
         $this->data['rawdata'][$rs->fields['parentid']][] = $rs->fields['iddirectory'];
         $this->data['parents'][$rs->fields['iddirectory']] = $rs->fields['parentid'];
         $level = substr_count($rs->fields['dirname'], '/') - 1;
         $this->data['items_level'][$rs->fields['iddirectory']] = $level;
         $this->_incrementLevelCount($level);
         if ($level > $this->data['level_max']) {
             $this->data['level_max'] = $level;
         }
         $rs->MoveNext();
     }
     $rs->Close();
     return true;
 }
Exemplo n.º 17
0
 /**
  * @return obj|boolen new cat object or false
  */
 function &copy($target_idcat, $title = '', $options = array())
 {
     global $cfg_cms, $perm;
     //option values are: default, yes, no
     //special: 'set_startflag': if_first
     //'set_online' (default|yes|no) default is copy flag from source
     //'set_copy' (default|yes|no) default is copy flag from source
     //'set_startflag' (default|from_source) default set the startflag if page in category haven't a valid startpage,
     //                                      from_source copys flag from source
     //'perms' bool (true|false)
     $options_default = array('set_online' => 'default', 'set_protected' => 'default', 'set_startflag' => 'from_source', 'perms' => true);
     $options = array_merge($options_default, $options);
     $target_idcat = (int) $target_idcat;
     $return = false;
     if ($target_idcat < 0) {
         return $return;
     }
     $catinfos = sf_factoryGetObjectCache('PAGE', 'Catinfos');
     //copy rootcat
     $cat_copy = sf_factoryGetObject('PAGE', 'Cat');
     $cat_copy->data = $this->data;
     $cat_copy->data['sql']['cat_lang']['idcatlang'] = false;
     $cat_copy->data['sql']['cat_lang']['idcat'] = false;
     $cat_copy->data['sql']['cat']['idcat'] = false;
     $cat_copy->data['sql']['cat']['parent'] = $target_idcat;
     $cat_copy->data['sql']['cat']['sortindex'] = false;
     //name
     if ($title != '') {
         $cat_copy->data['sql']['cat_lang']['name'] = $title;
     } else {
         $title = $cat_copy->data['sql']['cat_lang']['name'];
     }
     //online
     $visible = $cat_copy->data['sql']['cat_lang']['visible'];
     //print_r($options);
     //echo $visible.'<br>';
     if ($options['set_online'] == 'yes') {
         $visible = $visible | 0x1;
     } else {
         if ($options['set_online'] == 'no') {
             $visible = $visible & 0xfe;
         }
     }
     //echo $visible.'<br>';
     //protected
     if ($options['set_protected'] == 'yes') {
         $visible = $visible | 0x4;
     } else {
         if ($options['set_protected'] == 'no') {
             $visible = $visible & 0xfb;
         }
     }
     $cat_copy->data['sql']['cat_lang']['visible'] = $visible;
     //set langprefix on other langs then the default lang
     $cat_copy->_set_langprefix_on_save_if_new = true;
     $cat_copy->dirty = true;
     $cat_copy->save();
     //copy templates
     $copy_idtplconf = $this->_copyTemplateConfig($this->getIdcat(), $cat_copy->getIdcat());
     //echo "$target_idcat $title";exit;
     $cat_copy->data['sql']['cat_lang']['idtplconf'] = $copy_idtplconf;
     $cat_copy->dirty = true;
     //rewrite url
     include_once $cfg_cms['path_base'] . $cfg_cms['path_backend_rel'] . "inc/fnc.mod_rewrite.php";
     rewriteGenerateMapping();
     $rewrite_url = rewriteGenerateUrlString($title);
     $rewrite_url = rewriteMakeUniqueStringForLang('idcat', $cat_copy->getIdcat(), $rewrite_url, '', $cat_copy->getParent());
     $cat_copy->data['sql']['cat_lang']['rewrite_use_automatic'] = 1;
     $cat_copy->data['sql']['cat_lang']['rewrite_alias'] = $rewrite_url;
     $cat_copy->save();
     //copy rootcat perms
     if ($options['perms']) {
         $arr_langs = $this->_getLangInfoArray();
         foreach ($arr_langs['order'] as $current_lang) {
             $perm->xcopy_perm($this->getIdcat(), 'cat', $cat_copy->getIdcat(), 'cat', 4294967295.0, 0, $current_lang, false);
             $perm->xcopy_perm($this->getIdcat(), 'frontendcat', $cat_copy->getIdcat(), 'frontendcat', 4294967295.0, 0, $current_lang, false);
         }
     }
     //copy pages of rotcat
     include_once $cfg_cms['path_base'] . $cfg_cms['path_backend_rel'] . "inc/fnc.con.php";
     $arr_idcatsides = $this->_getIdcatsides($this->getIdcat());
     foreach ($arr_idcatsides as $v) {
         //echo '<br>---X'.$cat_copy->getIdcat();
         con_copy_page($this->_getIdclient(), $this->getIdlang(), $v, '', $cat_copy->getIdcat(), $options['perms'], $options);
     }
     //copy childcats
     $cattree = sf_factoryGetObjectCache('PAGE', 'Cattree');
     $cattree->setIdclient($this->_getIdclient());
     $cattree->generate();
     $this_idcat = $this->getIdcat();
     $new_parent = $cat_copy->getIdcat();
     $arr_childs = $cattree->getChilds($this_idcat);
     //print_r($arr_childs);
     foreach ($arr_childs as $v) {
         $cat_child = sf_factoryGetObject('PAGE', 'Cat');
         if ($cat_child->loadByIdcatIdlang($v, $this->getIdlang())) {
             $cat_child->copy($new_parent, '', $options);
         }
     }
     return $cat_copy;
 }
Exemplo n.º 18
0
 function SF_UTILS_Tracker()
 {
     $this->db = sf_factoryGetObjectCache('DATABASE', 'Ado');
 }
Exemplo n.º 19
0
 /**
  * Set styler for the content
  *
  * @Args: string $styler -> Definiert den Styler fuer die Ausgabe
  * @Access public
  */
 function setStyler($styler)
 {
     $this->_SF_styler = sf_factoryGetObjectCache('GUI', $styler);
 }
 function SF_PAGE_Catinfos()
 {
     // constructor
     $this->cache =& sf_factoryGetObjectCache('UTILS', 'DbCache');
     $this->db =& sf_factoryGetObjectCache('DATABASE', 'Ado');
 }