Example #1
0
function mod_set_config_all($idmod, $config = '')
{
    // Konfiguration in alle Templatekonfigurationen übernehmen?
    global $db, $cms_db;
    if ($idmod >= 1) {
        $sql = "SELECT idcontainer FROM " . $cms_db['container'] . " WHERE idmod='{$idmod}'";
        $db->query($sql);
        while ($db->next_record()) {
            $idcontainer_array[] = $db->f('idcontainer');
        }
        if (is_array($idcontainer_array)) {
            $sql = "UPDATE " . $cms_db['container_conf'] . " SET config='{$config}'\r\n                         \tWHERE idcontainer IN(" . implode(',', $idcontainer_array) . ")";
            $db->query($sql);
            mod_set_config_status($idmod);
        }
    }
}
 /**
  * repository::mod_import()
  *
  * install a Module in the $idclient Client and returns the new idmod
  *
  * @param string  $xmlstring Module Content
  * @param integer $idclient  Client Id
  */
 function mod_import($xmlstring = '', $idclient = '0', $override = false, $module = array(NULL), $cmodule = array(NULL), $smodule = array(NULL), $rmodule = array(NULL))
 {
     if ($xmlstring == '' || !is_array($xml_array = $this->cms_mod($xmlstring))) {
         return array('-7', false);
     }
     if ($xml_array['repository_id'] == '') {
         $xml_array['repository_id'] = $this->gen_new_mod($xml_array['name'], true);
     }
     $items = $this->rep_local_count($idclient, 'mod');
     //Debug me! print_r($items);
     list($type, $rid, $uid) = explode(":", $xml_array['repository_id']);
     $repid = $type . ':' . $rid;
     if ($idclient != '0' && count($items['rep']["{$idclient}"]["{$repid}"]) >= 1) {
         foreach ($items['rep']["{$idclient}"]["{$repid}"] as $modul) {
             if (lib_floatval($xml_array['version']) > lib_floatval($modul['version'])) {
                 if (!$override) {
                     return array('-1', $xml_array);
                 } else {
                     $idmod['update'][] = $modul['idmod'];
                 }
             } elseif (lib_floatval($xml_array['version']) == lib_floatval($modul['version'])) {
                 if (!$override) {
                     return array('-3', $xml_array);
                 } else {
                     $idmod['reinstall'][] = $modul['idmod'];
                 }
             }
         }
     } elseif ($idclient == '0' && count($items['rep']["{$repid}"]) >= 1) {
         foreach ($items['rep']["{$repid}"] as $modul) {
             if (lib_floatval($xml_array['version']) > lib_floatval($modul['version']) && $modul['idclient'] == '0') {
                 if (!$override) {
                     return array('-2', $xml_array);
                 } else {
                     $idmod['update'][] = $modul['idmod'];
                 }
             } elseif (lib_floatval($xml_array['version']) == lib_floatval($modul['version']) && $modul['idclient'] == '0') {
                 if (!$override) {
                     return array('-3', $xml_array);
                 } else {
                     $idmod['reinstall'][] = $modul['idmod'];
                 }
             }
         }
     }
     if (!$override) {
         return array($this->_mod_import($xml_array, $idclient), $xml_array);
     } elseif (is_array($idmod) && (is_array($module) || is_array($rmodule))) {
         if ($smodule[$repid]) {
             $this->_mod_import($xml_array, $idclient);
         }
         if (is_array($idmod['reinstall'])) {
             foreach ($idmod['reinstall'] as $uid) {
                 if ($rmodule["{$uid}"] == true) {
                     mod_lupdate($uid, $xml_array['repository_id'], $xml_array['name'], $xml_array['description'], $xml_array['version'], $xml_array['cat'], $xml_array['input'], $xml_array['output'], $xml_array['sql_install'], $xml_array['sql_uninstall'], $xml_array['sql_update'], $idclient, true);
                     if ($cmodule["{$uid}"] == false) {
                         mod_save_config($uid, $xml_array['config']);
                         mod_set_config_status($uid);
                     }
                 }
             }
             $return = '-5';
         }
         if (is_array($idmod['update'])) {
             foreach ($idmod['update'] as $uid) {
                 if ($module["{$uid}"] == true) {
                     mod_lupdate($uid, $xml_array['repository_id'], $xml_array['name'], $xml_array['description'], $xml_array['version'], $xml_array['cat'], $xml_array['input'], $xml_array['output'], $xml_array['sql_install'], $xml_array['sql_uninstall'], $xml_array['sql_update'], $idclient, true);
                     if ($cmodule["{$uid}"] == false) {
                         mod_save_config($uid, $xml_array['config']);
                         mod_set_config_status($uid);
                     }
                 }
             }
             $return = $return == '-5' ? '-6' : '-4';
         }
         return array($return, $xml_array);
     } elseif ($smodule[$repid] == true) {
         return array($this->_mod_import($xml_array, $idclient), $xml_array);
     } else {
         return;
     }
     return array($idmod, $xml_array);
 }
Example #3
0
                     } else {
                         mod_set_config_status($uid);
                     }
                     $errno = '0420';
                 }
             }
         }
         if (is_array($rmodule)) {
             foreach ($rmodule as $uid => $key) {
                 if ($rmodule["{$uid}"] == true) {
                     mod_lupdate($uid, $updatedata['repository_id'], $updatedata['name'], $updatedata['description'], $updatedata['version'], $updatedata['cat'], $updatedata['input'], $updatedata['output'], $updatedata['install_sql'], $updatedata['uninstall_sql'], $updatedata['update_sql'], $idclient);
                     if ($cmodule["{$uid}"] == false) {
                         mod_save_config($uid, $updatedata['config']);
                         mod_set_config_all($uid, $updatedata['config']);
                     } else {
                         mod_set_config_status($uid);
                     }
                     $errno = $errno == '0420' ? '0422' : '0421';
                 }
             }
         }
     }
     if (is_array($smodule) && $override == 'true') {
         if ($smodule[$sourceid] == 'true') {
             $errno2 = mod_copy($sourceid, '0', $client);
         }
     }
     break;
 } elseif ($sourceid && $idmod && !$override) {
     // Modul Update?
     $errno = '0417';