Ejemplo n.º 1
0
 private static function getRightListSub($rights, $setRights, $rid, $modul, $modul_name, $template, $RIGHT)
 {
     $str = '';
     reset($rights);
     while (list($key, $val) = each($rights)) {
         if ($val['mr_parent_id'] == $rid && $val['mr_mod_id'] == $modul) {
             $tmp = self::getRightListSub($rights, $setRights, $val['mr_id'], $modul, $modul_name, $template, $RIGHT);
             if (!empty($setRights) && array_key_exists($val['mr_id'], $setRights)) {
                 $checked = 'checked';
                 $value = $setRights[$val['mr_id']];
             } else {
                 $checked = '';
                 $value = 0;
             }
             page::assign("subright", $tmp);
             page::assign("right", $val['mr_name']);
             page::assign("right_id", $val['mr_id']);
             page::assign("checked", $checked);
             page::assign("value", $value);
             $pos = strpos($val['mr_name'], ' ');
             if ($pos) {
                 $lang_id = substr($val['mr_name'], 0, $pos);
                 $domain_id = substr($val['mr_name'], $pos + 1, strlen($val['mr_name']) - $pos);
                 $domain = new domain($domain_id);
                 $lang = new language($lang_id);
                 page::assign("right_name", $domain->getName() . ' (' . $lang->getName() . ')');
             } else {
                 $right_name = isset($RIGHT[$modul_name][$val['mr_name']]) ? $RIGHT[$modul_name][$val['mr_name']] : $val['mr_name'];
                 page::assign("right_name", $right_name);
             }
             $str .= page::parse($template);
         }
     }
     return $str;
 }
Ejemplo n.º 2
0
 /**
  * Un pério est ouvert à la recherche si il possède au moins un article ou une notice de bulletin
  * @return int
  */
 public function is_open_to_search()
 {
     if (!isset($this->open_to_search)) {
         global $dbh;
         $this->open_to_search = 0;
         //Droits d'accès
         if (is_null($this->dom_2)) {
             $acces_j = '';
             $statut_j = ',notice_statut';
             $statut_r = "and statut=id_notice_statut and ((notice_visible_opac=1 and notice_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (notice_visible_opac_abon=1 and notice_visible_opac=1)" : "") . ")";
         } else {
             $acces_j = $this->dom_2->getJoin($_SESSION['id_empr_session'], 4, 'notice_id');
             $statut_j = "";
             $statut_r = "";
         }
         //Articles
         $req = "SELECT bulletin_id FROM bulletins \n\t\t\t\t\tJOIN analysis ON analysis_bulletin=bulletin_id \n\t\t\t\t\tJOIN notices ON analysis_notice=notice_id \n\t\t\t\t\t" . $acces_j . " " . $statut_j . " \n\t\t\t\t\tWHERE bulletin_notice='" . $this->id . "' \n\t\t\t\t\t" . $statut_r . "";
         $res = pmb_mysql_query($req, $dbh);
         if ($res) {
             $this->open_to_search += pmb_mysql_num_rows($res);
         }
         //Notices de bulletin
         $req = "SELECT bulletin_id FROM bulletins \n\t\t\t\t\tJOIN notices ON notice_id=num_notice AND num_notice!=0 \n\t\t\t\t\t" . $acces_j . " " . $statut_j . " \n\t\t\t\t\tWHERE bulletin_notice='" . $this->id . "' \n\t\t\t\t\t" . $statut_r . "";
         $res = pmb_mysql_query($req, $dbh);
         if ($res) {
             $this->open_to_search += pmb_mysql_num_rows($res);
         }
     }
     return $this->open_to_search;
 }
Ejemplo n.º 3
0
 /**
  * Instance class
  * @return class
  */
 public static function instance()
 {
     if (self::$_instance === NULL) {
         self::$_instance = new domain();
     }
     return self::$_instance;
 }
 public function addDomain($v67b3dba8bc6778101892eb77249db32e, $v78e6dd7a49f5b0cb2106a3a434dd5c86, $vf62baf4c4ead98d50d516eca0ac5a746 = false)
 {
     if ($v662cbf1253ac7d8750ed9190c52163e5 = $this->getDomainId($v67b3dba8bc6778101892eb77249db32e)) {
         return $v662cbf1253ac7d8750ed9190c52163e5;
     } else {
         cacheFrontend::getInstance()->flush();
         $vac5c74b64b4b8352ef2f181affb5ac2a = "INSERT INTO cms3_domains VALUES()";
         l_mysql_query($vac5c74b64b4b8352ef2f181affb5ac2a);
         $v662cbf1253ac7d8750ed9190c52163e5 = l_mysql_insert_id();
         $this->domains[$v662cbf1253ac7d8750ed9190c52163e5] = $vad5f82e879a9c5d6b5b442eb37e50551 = new domain($v662cbf1253ac7d8750ed9190c52163e5);
         $vad5f82e879a9c5d6b5b442eb37e50551->setHost($v67b3dba8bc6778101892eb77249db32e);
         $vad5f82e879a9c5d6b5b442eb37e50551->setIsDefault($vf62baf4c4ead98d50d516eca0ac5a746);
         $vad5f82e879a9c5d6b5b442eb37e50551->setDefaultLangId($v78e6dd7a49f5b0cb2106a3a434dd5c86);
         if ($vf62baf4c4ead98d50d516eca0ac5a746) {
             $this->setDefaultDomain($v662cbf1253ac7d8750ed9190c52163e5);
         }
         $vad5f82e879a9c5d6b5b442eb37e50551->commit();
         return $v662cbf1253ac7d8750ed9190c52163e5;
     }
 }
Ejemplo n.º 5
0
 static function addform($parent, $class, $typetd = null)
 {
     $res = domain::getDnsTemplateList($parent);
     $vlist['nname'] = null;
     $vlist['description'] = null;
     $iplist = $parent->getIpaddress(array('localhost'));
     if (!$iplist) {
         $iplist = getAllIpaddress();
     }
     $vlist['ipaddress'] = array('s', $iplist);
     //$vlist['dbtype_list'] = null;
     $vlist['dnstemplate'] = array('s', $res);
     //$vlist['share_status'] = null;
     $vlist['__c_subtitle_quota'] = "Quota";
     $qvlist = getQuotaListForClass('domain', array());
     $vlist = lx_array_merge(array($vlist, $qvlist));
     $vlist['__c_subtitle_mail'] = "Mail";
     $vlist['catchall'] = array('s', array('--bounce--', 'postmaster', 'Delete'));
     $ret['action'] = "add";
     $ret['variable'] = $vlist;
     return $ret;
 }
Ejemplo n.º 6
0
	domains/edit-process.php

	access:
		namedadmins

	Updates or creates a domain name
*/
// includes
require "../include/config.php";
require "../include/amberphplib/main.php";
require "../include/application/main.php";
if (user_permissions_get('namedadmins')) {
    /*
    	Form Input
    */
    $obj_domain = new domain();
    $obj_domain->id = security_form_input_predefined("int", "id_domain", 0, "");
    // are we editing an existing domain or adding a new one?
    if ($obj_domain->id) {
        if (!$obj_domain->verify_id()) {
            log_write("error", "process", "The domain you have attempted to edit - " . $obj_name_server->id . " - does not exist in this system.");
        } else {
            // load existing data
            $obj_domain->load_data();
            // fetch domain data
            $obj_domain->data["domain_name"] = security_form_input_predefined("any", "domain_name", 1, "");
            $obj_domain->data["domain_description"] = security_form_input_predefined("any", "domain_description", 0, "");
        }
    } else {
        // new domain, can have some special input like IPV4 reverse
        $obj_domain->data["domain_type"] = security_form_input_predefined("any", "domain_type", 1, "");
Ejemplo n.º 7
0
	domains/delete-process.php

	access:
		namedadmins

	Deletes an unwanted domain.
*/
// includes
require "../include/config.php";
require "../include/amberphplib/main.php";
require "../include/application/main.php";
if (user_permissions_get('namedadmins')) {
    /*
    	Form Input
    */
    $obj_domain = new domain();
    $obj_domain->id = security_form_input_predefined("int", "id_domain", 1, "");
    // for error return if needed
    @security_form_input_predefined("any", "domain_name", 0, "");
    @security_form_input_predefined("any", "domain_description", 0, "");
    // confirm deletion
    @security_form_input_predefined("any", "delete_confirm", 1, "You must confirm the deletion");
    /*
    	Verify Data
    */
    // verify the selected domain exists
    if (!$obj_domain->verify_id()) {
        log_write("error", "process", "The domain you have attempted to delete - " . $obj_domain->id . " - does not exist in this system.");
    }
    /*
    	Process Data
Ejemplo n.º 8
0
function expand_domain()
{
    writelogs("receive requests", __FUNCTION__, __FILE__);
    $domain = $_GET["expand_domain"];
    $mailbox = new MailBoxes();
    $html = "<table style='width:250%' align='center' border=0 class='table_little' style='border:1px solid #CCCCCC'>\n\t<tr>\n\t<td align='center' style='border-bottom:1px solid #CCCCCC'>&nbsp;</td>\n\t<td align='center' style='border-bottom:1px solid #CCCCCC'>{expand_domain}</td>\n\t<td align='center' style='border-bottom:1px solid #CCCCCC'>{expand_domain_goto}</td>\n\t<td align='center' style='border-bottom:1px solid #CCCCCC'>{expand_domain_object}</td>\n\t<td align='center' style='border-bottom:1px solid #CCCCCC'>{expand_domain_mailbox}</td>\n\t<td align='center' style='border-bottom:1px solid #CCCCCC'>{expand_domain_target}</td>\n\t<td align='center' style='border-bottom:1px solid #CCCCCC'>&nbsp;</td>\n\t";
    $transport = $mailbox->Get_Transport_maps($domain);
    writelogs("if there is a transport for {$domain} ???->{$transport}", __FUNCTION__, __FILE__);
    if ($transport != null) {
        $transport = str_replace("smtp:", '', $transport);
        $html = $html . "<tr>\n\t\t<td style='width:50px'  valign='MIDDLE' align='center'>&nbsp;<a href=\"javascript:edit_transport('{$domain}');\"  onMouseOver=\"javascript:AffBulle('{js_edit_transport}');\" OnMouseOut=\"javascript:HideBulle();\">\n\t\t\t<img src='img/edit.jpg'>&nbsp;</td>\n\t\t<td style='width:50px'  valign='MIDDLE' align='center'>&nbsp;{$domain}&nbsp;</td>\n\t\t<td style='width:50px' valign='MIDDLE' align='center'>&nbsp;<img src='img/forwd_22.gif'>&nbsp;</td>\n\t\t<td style='width:50px' valign='MIDDLE' align='center'>&nbsp;<img src='img/computer.gif'>&nbsp;</td>\n\t\t<td valign='MIDDLE'  style='width:50px' align='center'>&nbsp;{$transport}</td>\n\t\t<td valign='MIDDLE'  style='width:50px' align='center'>&nbsp;\n\t\t<a href=\"javascript:delete_transport('{$domain}');\"  onMouseOver=\"javascript:AffBulle('{js_del_transport}');\" OnMouseOut=\"javascript:HideBulle();\"><img src='img/deluser.gif'>&nbsp;</td>\n\t\t</tr>";
        $html = $html . "</table>";
        $tpl = new Templates();
        echo $tpl->_parse_body($html);
        exit;
    }
    $virtual_domain = new domain();
    $hash = $mailbox->Hash_get_mailbox_list($domain);
    if (!is_array($hash)) {
        writelogs("INFOS:Array is returned empty by Hash_get_mailbox_list({$domain})", __FUNCTION__, __FILE__);
        return null;
    }
    while (list($num, $ligne) = each($hash)) {
        $address = $ligne["address"];
        $s_address = $ligne["address"];
        $tbl = explode('@', $address);
        if ($tbl[0] == null) {
            $address = "*{$address}";
        }
        $goto = $ligne["goto"];
        $tbl = explode('@', $goto);
        $s_goto = $ligne["goto"];
        if ($mailbox->enable_storage == true) {
            if ($virtual_domain->IsLocalDomain($tbl[1])) {
                $gotourl = "<a href=\"javascript:MailBoxStorage('{$goto}','{$tbl[1]}');\"\n\t\t\t\tonMouseOver=\"javascript:AffBulle('{js_edit_mailbox_storage}');\" \n\t\t\t\tOnMouseOut=\"javascript:HideBulle();\" >";
                if ($mailbox->MailBoxes_isExists($goto)) {
                    $icon_mailbox = "<img src='img/mailbox_sorage.gif'>";
                } else {
                    $icon_mailbox = "&nbsp;";
                }
            }
        }
        if ($tbl[0] == null) {
            $gotourl = null;
            $goto = "*{$goto}";
        }
        $html = $html . "<tr>\n\t\t<td style='width:50px'  valign='MIDDLE' align='center'>&nbsp;\n\t\t\t<a href=\"javascript:adduser('{$domain}','{$s_address}');\" onMouseOver=\"javascript:AffBulle('{js_edit_alias}');\" OnMouseOut=\"javascript:HideBulle();\">\n\t\t\t\t<img src='img/edit.jpg'>&nbsp;\n\t\t</td>\n\t\t<td style='width:50px'  valign='MIDDLE' align='left'>&nbsp;{$address}&nbsp;</td>\n\t\t<td style='width:50px' valign='MIDDLE' align='center'>&nbsp;<img src='img/forwd_22.gif'>&nbsp;</td>\n\t\t<td style='width:50px' valign='MIDDLE' align='center'>&nbsp;<img src='img/mailbox.gif'>&nbsp;</td>\n\t\t<td style='width:50px' valign='MIDDLE' align='center'>&nbsp;{$icon_mailbox}&nbsp;</td>\n\t\t<td valign='MIDDLE'  style='width:50px' align='left'>&nbsp;{$gotourl}{$goto}</a></td>\n\t\t<td valign='MIDDLE'  style='width:50px' align='center'>&nbsp;\n\t\t<a href=\"javascript:delete_alias('{$s_address}','{$domain}');\"  onMouseOver=\"javascript:AffBulle('{js_del_alias}');\" OnMouseOut=\"javascript:HideBulle();\"><img src='img/deluser.gif'>&nbsp;</td>\n\t\t</tr>";
    }
    $html = $html . "</table>";
    $tpl = new Templates();
    echo $tpl->_parse_body($html);
    exit;
}
 public function saveEditedDomainMirrows($v8d777f385d3dfec8815d20f7496026dc, $vcc86ffa55f0ab6b9ddbf32c1a3d24d67)
 {
     $vdb6d9b451b818ccc9a449383f2f0c450 = domainsCollection::getInstance();
     $vad5f82e879a9c5d6b5b442eb37e50551 = $vdb6d9b451b818ccc9a449383f2f0c450->getDomain(getRequest('param0'));
     if (is_array($v8d777f385d3dfec8815d20f7496026dc)) {
         foreach ($v8d777f385d3dfec8815d20f7496026dc as $vb80bb7740288fda1f201890375a60c8f => $vcaf9b6b99962bf5c2264824231d7a40c) {
             $v67b3dba8bc6778101892eb77249db32e = getArrayKey($vcaf9b6b99962bf5c2264824231d7a40c, 'host');
             if ($vb80bb7740288fda1f201890375a60c8f == "new") {
                 $v67b3dba8bc6778101892eb77249db32e = domain::filterHostName($v67b3dba8bc6778101892eb77249db32e);
                 if ($v67b3dba8bc6778101892eb77249db32e) {
                     if ($vdb6d9b451b818ccc9a449383f2f0c450->getDomainId($v67b3dba8bc6778101892eb77249db32e)) {
                         throw new publicAdminException(getLabel('error-domain-already-exists'));
                     }
                     $vad5f82e879a9c5d6b5b442eb37e50551->addMirrow($v67b3dba8bc6778101892eb77249db32e);
                 }
             } else {
                 if (!$v67b3dba8bc6778101892eb77249db32e) {
                     continue;
                 }
                 $v447b7147e84be512208dcc0995d67ebc = $vad5f82e879a9c5d6b5b442eb37e50551->getMirrow($vb80bb7740288fda1f201890375a60c8f);
                 if ($v447b7147e84be512208dcc0995d67ebc instanceof iDomainMirrow) {
                     $v447b7147e84be512208dcc0995d67ebc->setHost($v67b3dba8bc6778101892eb77249db32e);
                     $v447b7147e84be512208dcc0995d67ebc->commit();
                 } else {
                     throw new coreException("Domain #{$vb80bb7740288fda1f201890375a60c8f} doesn't exists");
                 }
             }
         }
     }
     if (is_array($vcc86ffa55f0ab6b9ddbf32c1a3d24d67)) {
         foreach ($vcc86ffa55f0ab6b9ddbf32c1a3d24d67 as $vb80bb7740288fda1f201890375a60c8f) {
             $vad5f82e879a9c5d6b5b442eb37e50551->delMirrow($vb80bb7740288fda1f201890375a60c8f);
         }
     }
     $vad5f82e879a9c5d6b5b442eb37e50551->setIsUpdated();
     $vad5f82e879a9c5d6b5b442eb37e50551->commit();
 }
Ejemplo n.º 10
0
 static function continueForm($parent, $class, $param, $continueaction)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $vlist = null;
     self::validate_client_name($param['nname']);
     // and issue #657 - Client user names with "__" are displayed with missing end
     if (stristr($param['nname'], '__')) {
         throw new lxexception("{$param['nname']}_use_double_underscore", 'nname');
     }
     // also check if /home/<client> exists --> prevent use like 'httpd' as client
     /*
     	if (lxfile_exists("/home/{$param['nname']}")) {
     		throw new lxexception("{$param['nname']}_dir_exists_under_home_dir", 'nname');
     
     	}
     */
     $reserved = array('apache', 'lighttpd', 'nginx', 'httpd', 'kloxo', 'lxadmin', 'lxlabs', 'lxcenter', 'nouser', 'tinydns', 'axfrdns', 'dnscache', 'dnslog', 'bind', 'named');
     foreach ($reserved as $r) {
         if ($param['nname'] === $r) {
             throw new lxexception("{$param['nname']}_dir_as_reserved_under_home_dir", 'nname');
         }
     }
     $param['nname'] = trim($param['nname']);
     if ($continueaction === 'server') {
         if (isOn($param['send_welcome_f'])) {
             if (!$param['contactemail']) {
                 throw new lxexception("sending_welcome_needs_contactemail", array('contactemail', 'send_welcome_f'), '');
             }
             // accept to more contact mail - http://forum.lxcenter.org/index.php?t=msg&goto=89118
             $contact = implode(",", str_replace(" ", "", $param['contactemail']));
             foreach ($contact as $c) {
                 if (!validate_email($c)) {
                     throw new lxexception("contactemail_is_not_valid_email_address", 'contactemail', '');
                 }
             }
         }
         dprintr($param);
         if ($param['resourceplan_f'] !== 'continue_without_plan') {
             $param['use_resourceplan_f'] = 'On';
             $ret['param'] = $param;
             $ret['action'] = 'addnow';
             return $ret;
         }
         $array = client::getPserverListPriv();
         foreach ((array) $array as $a) {
             $v = "{$a}_list";
             if (!$parent->listpriv->{$v}) {
                 //throw new lxException ("no_server_pool", $v);
             }
             $param["listpriv_s_{$a}_list"] = $parent->listpriv->{$v};
         }
         // This is a hack... This should now only happen in kloxo and not in hypervm.
         if (isset($param['listpriv_s_webpserver_list'])) {
             $weblist = $param['listpriv_s_webpserver_list'];
             $param['listpriv_s_ipaddress_list'] = $parent->getIpaddress($weblist);
             $nlist = domain::getDnsTemplateList($parent);
             $param['dnstemplate_list'] = $nlist;
         }
         $qvlist = getQuotaListForClass('client', $param);
         $vlist = lx_merge_good($vlist, $qvlist);
         $ret['action'] = "add";
         //$ret['continueaction'] = 'server';
         $ret['variable'] = $vlist;
         $ret['param'] = $param;
     }
     return $ret;
 }
Ejemplo n.º 11
0
    /**
     * Retourne les infos de documents numériques associés à la notice
     * @return array
     */
    public function get_explnums_datas()
    {
        if (!isset($this->explnums_datas)) {
            global $dbh;
            global $charset;
            global $opac_url_base;
            global $opac_visionneuse_allow;
            global $opac_photo_filtre_mimetype;
            global $opac_explnum_order;
            global $opac_show_links_invisible_docnums;
            global $gestion_acces_active, $gestion_acces_empr_notice, $gestion_acces_empr_docnum;
            $this->explnums_datas = array('nb_explnums' => 0, 'explnums' => array(), 'visionneuse_script' => '
								<script type="text/javascript">
									if(typeof(sendToVisionneuse) == "undefined"){
										var sendToVisionneuse = function (explnum_id){
											document.getElementById("visionneuseIframe").src = "visionneuse.php?"+(typeof(explnum_id) != "undefined" ? "explnum_id="+explnum_id : "");
										}
									}
								</script>');
            global $_mimetypes_bymimetype_, $_mimetypes_byext_;
            if (!count($_mimetypes_bymimetype_)) {
                create_tableau_mimetype();
            }
            $this->get_bul_info();
            // récupération du nombre d'exemplaires
            $query = "SELECT explnum_id, explnum_notice, explnum_bulletin, explnum_nom, explnum_mimetype, explnum_url, explnum_vignette, explnum_nomfichier, explnum_extfichier, explnum_docnum_statut FROM explnum WHERE ";
            if ($this->get_niveau_biblio() != 'b') {
                $query .= "explnum_notice='" . $this->id . "' ";
            } else {
                $query .= "explnum_bulletin='" . $this->parent['bulletin_id'] . "' or explnum_notice='" . $this->id . "' ";
            }
            $query .= "union SELECT explnum_id, explnum_notice, explnum_bulletin, explnum_nom, explnum_mimetype, explnum_url, explnum_vignette, explnum_nomfichier, explnum_extfichier, explnum_docnum_statut\n\t\t\tFROM explnum, bulletins\n\t\t\tWHERE bulletin_id = explnum_bulletin\n\t\t\tAND bulletins.num_notice='" . $this->id . "'";
            if ($opac_explnum_order) {
                $query .= " order by " . $opac_explnum_order;
            } else {
                $query .= " order by explnum_mimetype, explnum_nom, explnum_id ";
            }
            $res = pmb_mysql_query($query, $dbh);
            $nb_explnums = pmb_mysql_num_rows($res);
            $docnum_visible = true;
            if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) {
                $docnum_visible = $this->dom_2->getRights($_SESSION['id_empr_session'], $this->id, 16);
            } else {
                $query = "SELECT explnum_visible_opac, explnum_visible_opac_abon FROM notices, notice_statut WHERE notice_id ='" . $this->id . "' and id_notice_statut=statut ";
                $result = pmb_mysql_query($query, $dbh);
                if ($result && pmb_mysql_num_rows($result)) {
                    $statut_temp = pmb_mysql_fetch_object($result);
                    if (!$statut_temp->explnum_visible_opac) {
                        $docnum_visible = false;
                    }
                    if ($statut_temp->explnum_visible_opac_abon && !$_SESSION['id_empr_session']) {
                        $docnum_visible = false;
                    }
                } else {
                    $docnum_visible = false;
                }
            }
            if ($nb_explnums && ($docnum_visible || $opac_show_links_invisible_docnums)) {
                // on récupère les données des exemplaires
                global $search_terms;
                while ($expl = pmb_mysql_fetch_object($res)) {
                    // couleur de l'img en fonction du statut
                    if ($expl->explnum_docnum_statut) {
                        $rqt_st = "SELECT * FROM explnum_statut WHERE  id_explnum_statut='" . $expl->explnum_docnum_statut . "' ";
                        $Query_statut = pmb_mysql_query($rqt_st, $dbh) or die($rqt_st . " " . pmb_mysql_error());
                        $r_statut = pmb_mysql_fetch_object($Query_statut);
                        $explnum_class = 'docnum_' . $r_statut->class_html;
                        if ($expl->explnum_docnum_statut > 1) {
                            $explnum_opac_label = $r_statut->opac_libelle;
                        } else {
                            $explnum_opac_label = '';
                        }
                    } else {
                        $explnum_class = 'docnum_statutnot1';
                        $explnum_opac_label = '';
                    }
                    $explnum_docnum_visible = true;
                    $explnum_docnum_consult = true;
                    if ($gestion_acces_active == 1 && $gestion_acces_empr_docnum == 1) {
                        $explnum_docnum_visible = $this->dom_3->getRights($_SESSION['id_empr_session'], $expl->explnum_id, 16);
                        $explnum_docnum_consult = $this->dom_3->getRights($_SESSION['id_empr_session'], $expl->explnum_id, 4);
                    } else {
                        $requete = "SELECT explnum_visible_opac, explnum_visible_opac_abon, explnum_consult_opac, explnum_consult_opac_abon FROM explnum, explnum_statut WHERE explnum_id ='" . $expl->explnum_id . "' and id_explnum_statut=explnum_docnum_statut ";
                        $myQuery = pmb_mysql_query($requete, $dbh);
                        if (pmb_mysql_num_rows($myQuery)) {
                            $statut_temp = pmb_mysql_fetch_object($myQuery);
                            if (!$statut_temp->explnum_visible_opac) {
                                $explnum_docnum_visible = false;
                            }
                            if (!$statut_temp->explnum_consult_opac) {
                                $explnum_docnum_consult = false;
                            }
                            if ($statut_temp->explnum_visible_opac_abon && !$_SESSION['id_empr_session']) {
                                $explnum_docnum_visible = false;
                            }
                            if ($statut_temp->explnum_consult_opac_abon && !$_SESSION['id_empr_session']) {
                                $explnum_docnum_consult = false;
                            }
                        } else {
                            $explnum_docnum_visible = false;
                        }
                    }
                    if ($explnum_docnum_visible || $opac_show_links_invisible_docnums) {
                        $this->explnums_datas['nb_explnums']++;
                        $explnum_datas = array('id' => $expl->explnum_id, 'name' => $expl->explnum_nom, 'mimetype' => $expl->explnum_mimetype, 'url' => $expl->explnum_url, 'filename' => $expl->explnum_nomfichier, 'extension' => $expl->explnum_extfichier, 'statut' => $expl->explnum_docnum_statut, 'consultation' => $explnum_docnum_consult);
                        if ($expl->explnum_vignette) {
                            $explnum_datas['thumbnail_url'] = $opac_url_base . 'vig_num.php?explnum_id=' . $expl->explnum_id;
                        } else {
                            // trouver l'icone correspondant au mime_type
                            $explnum_datas['thumbnail_url'] = get_url_icon('mimetype/' . icone_mimetype($expl->explnum_mimetype, $expl->explnum_extfichier), 1);
                        }
                        $words_to_find = "";
                        if ($expl->explnum_mimetype == 'application/pdf' || $expl->explnum_mimetype == 'URL' && strpos($expl->explnum_nom, '.pdf') !== false) {
                            if (is_array($search_terms)) {
                                $words_to_find = "#search=\"" . trim(str_replace('*', '', implode(' ', $search_terms))) . "\"";
                            }
                        }
                        $explnum_datas['access_datas'] = array('script' => '', 'href' => '#', 'onclick' => '');
                        //si l'affichage du lien vers les documents numériques est forcé et qu'on est pas connecté, on propose l'invite de connexion!
                        if (!$explnum_docnum_visible && $opac_show_links_invisible_docnums && !$_SESSION['id_empr_session']) {
                            if ($opac_visionneuse_allow) {
                                $allowed_mimetype = explode(",", str_replace("'", "", $opac_photo_filtre_mimetype));
                            }
                            if ($allowed_mimetype && in_array($expl->explnum_mimetype, $allowed_mimetype)) {
                                $explnum_datas['access_datas']['script'] = "\n\t\t\t\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\t\t\t\tfunction sendToVisionneuse_" . $expl->explnum_id . "(){\n\t\t\t\t\t\t\t\t\t\topen_visionneuse(sendToVisionneuse," . $expl->explnum_id . ");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</script>";
                                $explnum_datas['access_datas']['onclick'] = "auth_popup('./ajax.php?module=ajax&categ=auth&callback_func=sendToVisionneuse_" . $expl->explnum_id . "');";
                            } else {
                                $explnum_datas['access_datas']['onclick'] = "auth_popup('./ajax.php?module=ajax&categ=auth&new_tab=1&callback_url=" . rawurlencode($opac_url_base . "doc_num.php?explnum_id=" . $expl->explnum_id) . "')";
                            }
                        } else {
                            if ($opac_visionneuse_allow) {
                                $allowed_mimetype = explode(",", str_replace("'", "", $opac_photo_filtre_mimetype));
                            }
                            if ($allowed_mimetype && in_array($expl->explnum_mimetype, $allowed_mimetype)) {
                                $explnum_datas['access_datas']['onclick'] = "open_visionneuse(sendToVisionneuse," . $expl->explnum_id . ");return false;";
                            } else {
                                $explnum_datas['access_datas']['href'] = $opac_url_base . 'doc_num.php?explnum_id=' . $expl->explnum_id;
                            }
                        }
                        if ($_mimetypes_byext_[$expl->explnum_extfichier]["label"]) {
                            $explnum_datas['mimetype_label'] = $_mimetypes_byext_[$expl->explnum_extfichier]["label"];
                        } elseif ($_mimetypes_bymimetype_[$expl->explnum_mimetype]["label"]) {
                            $explnum_datas['mimetype_label'] = $_mimetypes_bymimetype_[$expl->explnum_mimetype]["label"];
                        } else {
                            $explnum_datas['mimetype_label'] = $expl->explnum_mimetype;
                        }
                        $this->explnums_datas['explnums'][] = $explnum_datas;
                    }
                }
            }
        }
        return $this->explnums_datas;
    }
Ejemplo n.º 12
0
 public function setHost($v67b3dba8bc6778101892eb77249db32e)
 {
     $this->host = domain::filterHostName($v67b3dba8bc6778101892eb77249db32e);
     $this->setIsUpdated();
 }
Ejemplo n.º 13
0
<?php

$url= $_GET['url'];
$link="http://";
$site=$link.$url;
include("domain.class.php");
include("LIB_http.php");
include("LIB_parse.php");
include("LIB_resolve_addresses.php");
include("LIB_exclusion_list.php");
include("LIB_simple_spider.php");
include("LIB_download_images.php");

$domain=new domain($site);


if($domain->is_available()){
$status = "<h3>domain $site is available</h3>";
echo $status;
$data = file_get_contents($site);

$dom = new DOMDocument();
$dom->loadHTML($data);
$xpath = new DOMXPath($dom);
$hrefs = $xpath->evaluate("/html/body//a");

echo "<h3>Results:</h3>";
echo "<br><hr>";


for ($k = 0; $k < $hrefs->length; $k++) {
function ds_domains_admin()
{
    global $wpdb;
    if (false == ds_site_admin()) {
        // paranoid? moi?
        return false;
    }
    ds_maybe_create_db();
    echo '<h2>' . __('Domain Sync cPanel: cPanel Configuration', 'wp-domain-sync-cpanel') . '</h2>';
    if (empty($_POST['action'])) {
        //initial sync whenever user entering this page
        $sync_status = ds_domain_sync_wp_cpanel();
        if (!empty($sync_status)) {
            ?>
 <div id="message" class="updated fade"><p><strong><?php 
            _e('Sync finished. Everything is now synced.', 'wp-domain-sync-cpanel');
            ?>
</strong></p></div> <?php 
        }
        if (empty($sync_status)) {
            ?>
 <div id="message" class="updated fade"><p><strong><?php 
            _e('Sync finished. But nothing need to be synced.', 'wp-domain-sync-cpanel');
            ?>
</strong></p></div> <?php 
        }
    }
    if (!empty($_POST['action'])) {
        check_admin_referer('domain_sync');
        $cpanel_host = strtolower($_POST['cpanel_host']);
        switch ($_POST['action']) {
            case "sync":
                //ds_create_all_obj(); //moved to every looping action
                $sync_status = ds_domain_sync_wp_cpanel();
                //print_r($sync_status); exit;
                if (!empty($sync_status)) {
                    ?>
 <div id="message" class="updated fade"><p><strong><?php 
                    _e('Sync finished. Everything is now synced.', 'wp-domain-sync-cpanel');
                    ?>
</strong></p></div> <?php 
                }
                if (empty($sync_status)) {
                    ?>
 <div id="message" class="updated fade"><p><strong><?php 
                    _e('Sync finished. But nothing need to be synced.', 'wp-domain-sync-cpanel');
                    ?>
</strong></p></div> <?php 
                }
                break;
            case "edit":
                $row = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->dstable} WHERE cpanel_host = %s", $cpanel_host));
                if ($row) {
                    ds_edit_cpanel($row);
                } else {
                    echo "<h3>" . __('cPanel not found', 'wp-domain-sync-cpanel') . "</h3>";
                }
                break;
            case "save":
                if (!empty($_POST['cpanel_host']) and !empty($_POST['cpanel_user']) and !empty($_POST['cpanel_pass']) and !empty($_POST['cpanel_port']) and !empty($_POST['cpanel_theme'])) {
                    $check = new domain($_POST['cpanel_host'], $_POST['cpanel_user'], $_POST['cpanel_pass'], $_POST['cpanel_port'], true, $_POST['cpanel_theme'], '');
                    if (!$check->checkLogin()) {
                        ?>
 <div id="message" class="updated-nag"><p><strong><?php 
                        _e('The cPanel config you have entered is invalid. Please check and enter again.');
                        ?>
</strong></p></div> <?php 
                    } else {
                        if ($_POST['orig_cpanel_host'] == '' and null == $wpdb->get_var($wpdb->prepare("SELECT cpanel_host FROM {$wpdb->dstable} WHERE cpanel_host = %s", $cpanel_host))) {
                            $wpdb->query($wpdb->prepare("INSERT INTO {$wpdb->dstable} ( `cpanel_host`, `cpanel_user`, `cpanel_pass`, `cpanel_port`, `cpanel_theme` ) VALUES ( %s, %s, %s, %d, %s )", $cpanel_host, $_POST['cpanel_user'], $_POST['cpanel_pass'], $_POST['cpanel_port'], $_POST['cpanel_theme']));
                            //sync immediately when added
                            ds_alias_sync_wp_cpanel($check);
                            echo "<p><strong>" . __('cPanel Added and Synced', 'wp-domain-sync-cpanel') . "</strong></p>";
                        } else {
                            $wpdb->query($wpdb->prepare("UPDATE {$wpdb->dstable} SET cpanel_host = %s, cpanel_user = %s, cpanel_pass = %s, cpanel_port = %d, cpanel_theme = %s WHERE cpanel_host = %s", $cpanel_host, $_POST['cpanel_user'], $_POST['cpanel_pass'], $_POST['cpanel_port'], $_POST['cpanel_theme'], $_POST['orig_cpanel_host']));
                            //sync immediately when edited
                            ds_alias_sync_wp_cpanel($check);
                            echo "<p><strong>" . __('cPanel Updated and Synced', 'wp-domain-sync-cpanel') . "</strong></p>";
                        }
                    }
                }
                break;
            case "del":
                $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->dstable} WHERE cpanel_host = %s", $cpanel_host));
                echo "<p><strong>" . __('cPanel Deleted', 'wp-domain-sync-cpanel') . "</strong></p>";
                break;
        }
    }
    ds_edit_cpanel();
    $rows = $wpdb->get_results("SELECT * FROM {$wpdb->dstable} ORDER BY cpanel_id DESC LIMIT 0,20");
    ds_cpanel_listing($rows);
    //echo '<p>' . sprintf( __( '<strong>Note:</strong> %s', 'wp-domain-sync-cpanel' ), ds_idn_warning() ) . "</p>";
}
Ejemplo n.º 15
0
 $obj_domain->action_update_serial();
 $obj_domain->action_update_ns();
 // clear messages & replace with custom one
 $_SESSION["notification"]["message"] = array("Domain updated successfully - name servers scheduled to reload with new domain configuration");
 // clear the form_session as the update has been successfully updated
 $_SESSION['form']['domain_records']['form_session'] = 0;
 /*
 	Update reverse domains (if appropiate)
 
 	If there are any reverse domain PTR records set, we will need to update the 
 	serial on the domain to reflect the changes.
 */
 log_write("debug", "process", "Updating serials for reverse domains");
 if ($data["reverse"]) {
     foreach ($data["reverse"] as $id_domain) {
         $obj_reverse = new domain();
         $obj_reverse->id = $id_domain;
         $obj_reverse->load_data();
         $obj_reverse->action_update_serial();
         log_write("notification", "process", "Updating serials for reverse domain " . $obj_reverse->data["domain_name"] . "");
     }
 }
 $data["reverse"][] = $obj_record->id;
 if (!error_check()) {
     $sql_obj->trans_commit();
 } else {
     // error encountered
     log_write("error", "process", "An unexpected error occured, the domain remains unchanged");
     $sql_obj->trans_rollback();
 }
 // display updated details
Ejemplo n.º 16
0
     // overload the error form data with the data from the form
     $_SESSION["error"]["form"]["domain_import"] = "failed";
     $_SESSION["error"] = $data;
     // return
     header("Location: ../index.php?page=domains/import.php&mode=2");
     exit(0);
 } elseif ($mode == 2) {
     /*
     	MODE 2 :: ENTER ZONE RECORD
     
     	After records have been validated, they are posted back to this page for final processing and importing into the database.
     */
     /*
     	Domain Object Init
     */
     $obj_domain = new domain();
     $obj_domain->id = security_form_input_predefined("int", "id_domain", 0, "");
     /*
     	Domain Details Validation
     */
     // new domain, can have some special input like IPV4 reverse
     $obj_domain->data["domain_type"] = security_form_input_predefined("any", "domain_type", 1, "");
     if ($obj_domain->data["domain_type"] == "domain_standard") {
         $obj_domain->data["domain_name"] = security_form_input_predefined("any", "domain_name", 1, "");
         $obj_domain->data["domain_description"] = security_form_input_predefined("any", "domain_description", 0, "");
     } elseif ($obj_domain->data["domain_type"] == "domain_reverse_ipv4") {
         // fetch domain data
         $obj_domain->data["ipv4_network"] = security_form_input_predefined("ipv4_cidr", "ipv4_network", 1, "Must supply full IPv4 network address");
         $obj_domain->data["domain_description"] = security_form_input_predefined("any", "domain_description", 0, "");
         // check CIDR
         $matches = explode("/", $obj_domain->data["ipv4_network"]);
Ejemplo n.º 17
0
 protected function exportDomain(domain $vad5f82e879a9c5d6b5b442eb37e50551)
 {
     $v72ee76c5c29383b7c9f9225c1fa4d10b = $vad5f82e879a9c5d6b5b442eb37e50551->getId();
     if (isset($this->exported_domains[$v72ee76c5c29383b7c9f9225c1fa4d10b])) {
         return false;
     }
     if ($this->limit) {
         if ($this->position >= $this->limit) {
             $this->break = true;
             return false;
         }
     }
     $v4a8a08f09d37b73795649038408b5f33 = $this->doc->createElement('domain');
     $this->translateEntity($vad5f82e879a9c5d6b5b442eb37e50551, $v4a8a08f09d37b73795649038408b5f33);
     $v0bb5aff4a4154504d1117c453c35edd8 = $this->relations->getOldDomainIdRelation($this->source_id, $v72ee76c5c29383b7c9f9225c1fa4d10b);
     if ($v0bb5aff4a4154504d1117c453c35edd8 === false) {
         $this->relations->setDomainIdRelation($this->source_id, $v72ee76c5c29383b7c9f9225c1fa4d10b, $v72ee76c5c29383b7c9f9225c1fa4d10b);
         $v0bb5aff4a4154504d1117c453c35edd8 = $v72ee76c5c29383b7c9f9225c1fa4d10b;
     } else {
         $v4a8a08f09d37b73795649038408b5f33->setAttribute('id', $v0bb5aff4a4154504d1117c453c35edd8);
     }
     $vf585b7f018bb4ced15a03683a733e50b = $vad5f82e879a9c5d6b5b442eb37e50551->getDefaultLangId();
     if ($this->exportLang($vf585b7f018bb4ced15a03683a733e50b)) {
         if ($this->limit && $this->position >= $this->limit) {
             $this->break = true;
             return true;
         }
     }
     $v392cdf2310e931972f2459edc1ea2ff2 = $this->relations->getOldLangIdRelation($this->source_id, $vf585b7f018bb4ced15a03683a733e50b);
     $v4a8a08f09d37b73795649038408b5f33->setAttribute('lang-id', $v392cdf2310e931972f2459edc1ea2ff2);
     $v4b9c7061b34a64924383494f4cd28b13 = $vad5f82e879a9c5d6b5b442eb37e50551->getMirrowsList();
     foreach ($v4b9c7061b34a64924383494f4cd28b13 as $v95be0a2e6132b4fa2294808f7dbcc52a) {
         $v6f8f57715090da2632453988d9a1501b = $this->doc->createElement('domain-mirror');
         $v4a8a08f09d37b73795649038408b5f33->appendChild($v6f8f57715090da2632453988d9a1501b);
         $this->translateEntity($v95be0a2e6132b4fa2294808f7dbcc52a, $v6f8f57715090da2632453988d9a1501b);
         $v1834e28d86200a836697541c12fa09bd = $v95be0a2e6132b4fa2294808f7dbcc52a->getId();
         $ve788cc9c8ff1d105698156a7628ff6ef = $this->relations->getOldDomainMirrorIdRelation($this->source_id, $v1834e28d86200a836697541c12fa09bd);
         if ($ve788cc9c8ff1d105698156a7628ff6ef === false) {
             $this->relations->setDomainMirrorIdRelation($this->source_id, $v1834e28d86200a836697541c12fa09bd, $v1834e28d86200a836697541c12fa09bd);
             $ve788cc9c8ff1d105698156a7628ff6ef = $v1834e28d86200a836697541c12fa09bd;
         } else {
             $v6f8f57715090da2632453988d9a1501b->setAttribute('id', $ve788cc9c8ff1d105698156a7628ff6ef);
         }
     }
     $this->domains_container->appendChild($v4a8a08f09d37b73795649038408b5f33);
     $this->exported_domains[$v72ee76c5c29383b7c9f9225c1fa4d10b] = $v0bb5aff4a4154504d1117c453c35edd8;
     $this->position++;
     return true;
 }
Ejemplo n.º 18
0
 function updateform($subaction, $param)
 {
     global $gbl, $sgbl, $login, $ghtml;
     switch ($subaction) {
         case "installatron":
             $vlist['__v_button'] = array();
             return $vlist;
         case "ostemplatelist":
             getResourceOstemplate($vlist, 'all');
             $vlist['__v_updateall_button'] = array();
             return $vlist;
         case "createinvoice_m":
             $vlist['month'] = null;
             return $vlist;
         case "createinvoice_s":
             $vlist['month'] = array('s', $this->getInvoiceMonthList());
             return $vlist;
         case "search_engine":
             $vlist['se_url'] = array('M', "http://");
             $vlist['se_email'] = null;
             return $vlist;
         case "cron_mailto":
             $vlist['cron_mailto'] = null;
             return $vlist;
         case "default_domain":
             $vlist['default_domain'] = array('s', add_disabled(get_namelist_from_objectlist($this->getList('domain'))));
             return $vlist;
         case "shell_access":
             $res[] = "/bin/bash";
             $res[] = "/usr/bin/lxjailshell";
             $res = add_disabled($res);
             $vlist['nname'] = array('M', null);
             $vlist['disable_system_flag'] = null;
             $vlist['shell'] = array('s', $res);
             $vlist['__v_updateall_button'] = array();
             return $vlist;
         case "generate_csr":
             include "lib/countrycode.inc";
             foreach ($gl_country_code as $key => $name) {
                 $temp[$key] = $name;
             }
             $s = new sslcert(null, null, null);
             $this->ssl_data_b = new ssl_data_b(null, null, null);
             $vlist['contactemail'] = array('M', null);
             $vlist["ssl_data_b_s_commonName_r"] = null;
             $vlist["ssl_data_b_s_emailAddress_r"] = null;
             $vlist["ssl_data_b_s_countryName_r"] = array('A', $temp);
             $vlist["ssl_data_b_s_stateOrProvinceName_r"] = null;
             $vlist["ssl_data_b_s_localityName_r"] = null;
             $vlist["ssl_data_b_s_organizationName_r"] = null;
             $vlist["ssl_data_b_s_organizationalUnitName_r"] = null;
             return $vlist;
         case "domainpserver":
             if ($this->isAdmin()) {
                 $parent = $this;
             } else {
                 $parent = $this->getParentO();
             }
             self::getDomainServerVlist($parent, $this, $vlist);
             return $vlist;
         case "forcedeletepserver":
             if_not_admin_complain_and_exit();
             $list = get_namelist_from_objectlist($this->getList('pserver'));
             $vlist['pserver_delete_f'] = array('s', array_remove($list, "localhost"));
             return $vlist;
         case "deleteorphanedvps":
             $sq = new Sqlite(null, 'vps');
             $slist = get_namelist_from_objectlist($this->getList('pserver'));
             $res = $sq->getTable(array('nname', 'syncserver', 'parent_clname'));
             $list = null;
             foreach ($res as $r) {
                 if (!array_search_bool($r['syncserver'], $slist)) {
                     $list[$r['nname']] = "{$r['nname']} ({$r['syncserver']}) (orphaned)";
                 }
             }
             if ($list) {
                 $vlist['vps_delete_f'] = array('A', $list);
             } else {
                 $vlist['vps_delete_f'] = array('M', 'No Orphaned vm');
             }
             return $vlist;
         case "multivpscreate":
             $vlist['vps_basename_f'] = null;
             $vlist['vps_admin_password_f'] = null;
             $vlist['vps_count_f'] = null;
             $vlist['vps_template_name_f'] = array('s', get_namelist_from_objectlist($this->getList('vpstemplate')));
             return $vlist;
         case "disable_url":
             $vlist['disable_url'] = array('m', array('pretext' => 'http://'));
             return $vlist;
         case "message":
             $vlist['wall_from_f'] = array('M', $login->nname);
             $vlist['send_to_f'] = array('M', $this->nname);
             $vlist['wall_subject_f'] = null;
             $vlist['wall_message_f'] = null;
             $vlist['__v_button'] = 'Send';
             return $vlist;
         case "skeleton":
             $vlist['skeletonarchive'] = array('M', null);
             $vlist['skeletonarchive_f'] = null;
             return $vlist;
         case "wall":
             $vlist['wall_from_f'] = array('M', $this->nname);
             //Can't do this. If he has 10000 client, this itelf will hang the machine.
             //$vlist['send_to_f'] = array('M', $namlist);
             $vlist['wall_subject_f'] = null;
             $vlist['wall_message_f'] = null;
             $vlist['__v_button'] = 'Send';
             return $vlist;
         case "dnstemplatelist":
             $parent = $this->getParentO();
             $nlist = domain::getDnsTemplateList($parent);
             $vlist['dnstemplate_list'] = array('U', $nlist);
             $vlist['__v_updateall_button'] = array();
             return $vlist;
         case "information":
             $vlist['nname'] = array('M', $this->nname);
             if ($this->isAdmin()) {
                 $gen = $login->getObject('general');
                 $this->disable_admin = $gen->disable_admin;
                 $vlist['disable_admin'] = null;
             }
             if ($this->isLogin()) {
                 $vlist['cttype'] = array('M', $this->cttype);
             } else {
                 $parent = $this->getParentO();
                 $res = null;
                 if (check_if_many_server()) {
                     $ctlist = array('reseller', 'customer', 'wholesale');
                 } else {
                     $ctlist = array('reseller', 'customer');
                 }
                 foreach ($ctlist as $v) {
                     if ($parent->isGte($v)) {
                         continue;
                     }
                     $res[] = $v;
                 }
                 if ($res) {
                     $vlist['cttype'] = array('s', $res);
                 } else {
                     $vlist['cttype'] = array('M', $this->cttype);
                 }
             }
             $vlist['ddate'] = array('M', @date('d-m-Y', $this->ddate));
             if (!$this->isAdmin()) {
                 $vlist['parent_name_f'] = array('M', $this->getParentName());
             }
             $vlist['contactemail'] = "";
             if (!$this->isLogin()) {
                 $vlist['text_comment'] = null;
             }
             return $vlist;
         case "license":
             $lic = $login->getObject('license')->licensecom_b;
             if ($login->isAdmin()) {
                 $vlist['lic_pserver_num_f'] = array('M', $lic->lic_pserver_num);
                 $vlist['lic_client_num_f'] = array('M', $lic->lic_client_num);
                 $vlist['lic_maindomain_num_f'] = array('M', $lic->lic_maindomain_num);
             } else {
                 $vlist['lic_node_num_f'] = array('M', $lic->node_num);
             }
             $vlist['lic_live_support_f'] = array('M', $lic->lic_live_support);
             //$vlist['lic_ipaddress_f'] = array('M', $lic->lic_ipaddress);
             $vlist['lic_client_f'] = array('M', $lic->lic_client);
             //$vlist['lic_current_f'] = array('t', lfile_get_contents('__path_program_etc/license.txt'));
             $vlist['license_upload_f'] = null;
             return $vlist;
         case "ipaddress":
             $parent = $this->getParentO();
             if ($this->isLogin() || !$this->isRightParent()) {
                 $vlist['ipaddress_list'] = array('M', $this->getIpaddress($this->listpriv->webpserver_list));
                 $vlist['__v_button'] = array();
             } else {
                 if (check_if_many_server()) {
                     dprintr($this->listpriv->webpserver_list);
                     $iplist = $parent->getIpaddress($this->listpriv->webpserver_list);
                 } else {
                     $iplist = $parent->getIpaddress(array('localhost'));
                 }
                 dprintr($iplist);
                 $vlist['ipaddress_list'] = array('Q', $iplist);
             }
             return $vlist;
         case "pserver_s":
             $parent = $this->getParentO();
             $list = null;
             $serverlist = client::getPserverListPriv();
             if ($this->isLogin() || !$this->isRightParent()) {
                 foreach ($serverlist as $s) {
                     $slist = "{$s}_list";
                     $vlist["{$s}_list"] = array('M', $this->listpriv->{$slist});
                 }
                 $vlist['__v_button'] = array();
                 //$vlist['dbtype_list'] = array('M', $this->listpriv->dbtype_list);
                 return $vlist;
             } else {
                 $vlist['server_detail_f'] = null;
                 foreach ($serverlist as $s) {
                     $slist = "{$s}_list";
                     // Hack.. Actually, admin's listpriv should be empty so that the __get inside the listpriv will get automatically called.
                     if ($parent->isAdmin()) {
                         unset($parent->listpriv->{$slist});
                     }
                     $vlist["{$s}_list"] = null;
                     $list = lx_array_merge(array($list, $parent->getServerList(strtilfirst($s, "pserver"))));
                 }
                 $sinfo = pservercore::createServerInfo($list);
                 $sinfo = get_warning_for_server_info($parent, $sinfo);
                 $vlist['server_detail_f'] = array('M', $sinfo);
                 //$vlist['dbtype_list'] = null;
                 return $vlist;
             }
         case "description":
             $vlist['description'] = null;
             //$vlist['share_status'] = null;
             if (!$this->isRightParent()) {
                 $this->convertToUnmodifiable($vlist);
             }
             return $vlist;
     }
     return parent::updateform($subaction, $param);
 }
Ejemplo n.º 19
0
 static function continueForm($parent, $class, $param, $continueaction)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $vlist = null;
     self::validate_client_name($param['nname']);
     $param['nname'] = trim($param['nname']);
     if ($continueaction === 'server') {
         if (isOn($param['send_welcome_f'])) {
             if (!$param['contactemail']) {
                 throw new lxexception("sending_welcome_needs_contactemail", array('contactemail', 'send_welcome_f'), '');
             }
             if (!validate_email($param['contactemail'])) {
                 throw new lxexception("contactemail_is_not_valid_email_address", 'contactemail', '');
             }
         }
         dprintr($param);
         if ($param['resourceplan_f'] !== 'continue_without_plan') {
             $param['use_resourceplan_f'] = 'On';
             $ret['param'] = $param;
             $ret['action'] = 'addnow';
             return $ret;
         }
         $array = client::getPserverListPriv();
         foreach ((array) $array as $a) {
             $v = "{$a}_list";
             if (!$parent->listpriv->{$v}) {
                 //throw new lxException ("no_server_pool", $v);
             }
             $param["listpriv_s_{$a}_list"] = $parent->listpriv->{$v};
         }
         // This is a hack... This should now only happen in kloxo and not in hypervm.
         if (isset($param['listpriv_s_webpserver_list'])) {
             $weblist = $param['listpriv_s_webpserver_list'];
             $param['listpriv_s_ipaddress_list'] = $parent->getIpaddress($weblist);
             $nlist = domain::getDnsTemplateList($parent);
             $param['dnstemplate_list'] = $nlist;
         }
         $qvlist = getQuotaListForClass('client', $param);
         $vlist = lx_merge_good($vlist, $qvlist);
         $ret['action'] = "add";
         //$ret['continueaction'] = 'server';
         $ret['variable'] = $vlist;
         $ret['param'] = $param;
     }
     return $ret;
 }
Ejemplo n.º 20
0
 private function changeDomainInfo($TEMPLATE)
 {
     if (system::issetUrl(2) && system::url(2) == 'edit') {
         if (isset($_POST['error_msg']) && isset($_POST['offline_msg'])) {
             // Обработчик изменения свойств домена
             $domain = new domain(system::url(3));
             $domain->setErrorMsg($_POST['error_msg']);
             $domain->setOfflineMsg($_POST['offline_msg']);
             $domain->save();
             $form = new uiMultiForm('mirrors');
             function changeMirror($id, $data, $form_name, $domain)
             {
                 return $domain->changeMirror($data['d_name'], $id);
             }
             function delMirror($id, $form_name, $domain)
             {
                 $domain->delMirror($id);
             }
             $form->process('changeMirror', 'delMirror', $domain);
         } else {
             // Форма редактирования домена
             $domain = new domain(system::url(3));
             page::assign('error_msg', $domain->getErrorMsg());
             page::assign('offline_msg', $domain->getOfflineMsg());
             $form = new uiMultiForm('mirrors');
             $form->insideForm();
             $form->setData($domain->getMirrors());
             $form->addColumn('d_name', lang::get('CONFIG_FORM_FIELD', 31), 260);
             page::assign('mirrors_list', $form->getHTML());
             echo page::parse($TEMPLATE['domain_frame']);
         }
         die;
     }
 }
Ejemplo n.º 21
0
 protected function importDomainMirror(DOMElement $vcaf9b6b99962bf5c2264824231d7a40c, domain $vad5f82e879a9c5d6b5b442eb37e50551)
 {
     $v61ce6a78cb3c8547fed20990c92edfe3 = $vcaf9b6b99962bf5c2264824231d7a40c->getAttribute('id');
     $v67b3dba8bc6778101892eb77249db32e = $vcaf9b6b99962bf5c2264824231d7a40c->hasAttribute('host') ? $vcaf9b6b99962bf5c2264824231d7a40c->getAttribute('host') : null;
     if (!strlen($v61ce6a78cb3c8547fed20990c92edfe3)) {
         $this->reportError($this->getLabel('label-cannot-create-domain-mirror') . " \"{$v67b3dba8bc6778101892eb77249db32e}\" " . $this->getLabel('label-with-empty-id'));
         return false;
     }
     $ve2fa538867c3830a859a5b17ab24644b = false;
     $v1834e28d86200a836697541c12fa09bd = $this->relations->getNewDomainMirrorIdRelation($this->source_id, $v61ce6a78cb3c8547fed20990c92edfe3);
     if (!$v1834e28d86200a836697541c12fa09bd) {
         if (!is_null($v67b3dba8bc6778101892eb77249db32e)) {
             $v1834e28d86200a836697541c12fa09bd = $vad5f82e879a9c5d6b5b442eb37e50551->getMirrowId($v67b3dba8bc6778101892eb77249db32e);
             if ($v1834e28d86200a836697541c12fa09bd) {
                 $this->relations->setDomainMirrorIdRelation($this->source_id, $v61ce6a78cb3c8547fed20990c92edfe3, $v1834e28d86200a836697541c12fa09bd);
             }
         }
     }
     if ($v1834e28d86200a836697541c12fa09bd && $this->update_ignore) {
         $this->writeLog($this->getLabel('label-domain') . " \"" . $v67b3dba8bc6778101892eb77249db32e . "\" (#{$v61ce6a78cb3c8547fed20990c92edfe3}) " . $this->getLabel('label-already-exists'));
         return $vad5f82e879a9c5d6b5b442eb37e50551->getMirrow($v1834e28d86200a836697541c12fa09bd);
     }
     if (!$v1834e28d86200a836697541c12fa09bd) {
         if (is_null($v67b3dba8bc6778101892eb77249db32e)) {
             $v67b3dba8bc6778101892eb77249db32e = $v61ce6a78cb3c8547fed20990c92edfe3;
         }
         $v1834e28d86200a836697541c12fa09bd = $vad5f82e879a9c5d6b5b442eb37e50551->addMirrow($v67b3dba8bc6778101892eb77249db32e);
         $this->relations->setDomainMirrorIdRelation($this->source_id, $v61ce6a78cb3c8547fed20990c92edfe3, $v1834e28d86200a836697541c12fa09bd);
         $ve2fa538867c3830a859a5b17ab24644b = true;
     }
     $v95be0a2e6132b4fa2294808f7dbcc52a = $vad5f82e879a9c5d6b5b442eb37e50551->getMirrow($v1834e28d86200a836697541c12fa09bd);
     if (!$v95be0a2e6132b4fa2294808f7dbcc52a instanceof domainMirrow) {
         $this->reportError($this->getLabel('label-cannot-detect-domain-mirror') . " \"{$v67b3dba8bc6778101892eb77249db32e}\"");
         return false;
     }
     if ($ve2fa538867c3830a859a5b17ab24644b) {
         $this->created_domain_mirrors++;
         $this->writeLog($this->getLabel('label-domain-mirror') . " \"" . $v67b3dba8bc6778101892eb77249db32e . "\" (#" . $v61ce6a78cb3c8547fed20990c92edfe3 . ") " . $this->getLabel('label-has-been-created-n'));
     } elseif ($v95be0a2e6132b4fa2294808f7dbcc52a->getIsUpdated()) {
         $this->updated_domain_mirrors++;
         $this->writeLog($this->getLabel('label-domain-mirror') . " \"" . $v67b3dba8bc6778101892eb77249db32e . "\" (#" . $v61ce6a78cb3c8547fed20990c92edfe3 . ") " . $this->getLabel('label-has-been-updated-n'));
     }
     return $v95be0a2e6132b4fa2294808f7dbcc52a;
 }
Ejemplo n.º 22
0
 function action_delete()
 {
     log_debug("name_server", "Executing action_delete()");
     /*
     	Start Transaction
     */
     $sql_obj = new sql_query();
     $sql_obj->trans_begin();
     /*
     	Delete Name Server
     */
     $sql_obj->string = "DELETE FROM name_servers WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     $sql_obj->string = "DELETE FROM cloud_zone_map WHERE id='" . $this->id . "'";
     $sql_obj->execute();
     /*
     	Un-associated any matched log entries
     */
     $sql_obj->string = "UPDATE logs SET id_server='0' WHERE id_server='" . $this->id . "'";
     $sql_obj->execute();
     /*
     	Update NS records
     
     	We need to run through all the domains and update the records - if the nameserver was an automated entry for all the domains,
     	after deleting the name server we should remove it from all the domains.
     */
     $obj_domain = new domain();
     $obj_domain->load_data_all();
     foreach ($obj_domain->data as $data_domain) {
         $obj_domain_sub = new domain();
         $obj_domain_sub->id = $data_domain["id"];
         $obj_domain_sub->load_data();
         $obj_domain_sub->action_update_ns();
         $obj_domain_sub->action_update_serial();
     }
     /*
     	Commit
     */
     if (error_check()) {
         $sql_obj->trans_rollback();
         log_write("error", "name_server", "An error occured whilst trying to delete the name server.");
         return 0;
     } else {
         $sql_obj->trans_commit();
         log_write("notification", "name_server", "Name server has been successfully deleted.");
         return 1;
     }
 }
Ejemplo n.º 23
0
 function fetch_records($id_domain)
 {
     log_write("debug", "api_namedmanager", "Executing fetch_records()");
     if ($this->auth_online) {
         // verify input
         $id_domain = @security_script_input_predefined("int", $id_domain);
         if (!$id_domain || $id_domain == "error") {
             throw new SoapFault("Sender", "INVALID_INPUT");
         }
         // verify domain
         $obj_domain = new domain();
         $obj_domain->id = $id_domain;
         if (!$obj_domain->verify_id()) {
             throw new SoapFault("Sender", "INVALID_INPUT");
         }
         // if querying for a name server, we filter the NS records
         // to only members of that name server group.
         if ($this->auth_group) {
             $group_nameservers = array();
             $obj_ns_sql = new sql_query();
             $obj_ns_sql->string = "SELECT server_name FROM name_servers WHERE id_group='" . $this->auth_group . "' AND server_record='1'";
             $obj_ns_sql->execute();
             $obj_ns_sql->fetch_array();
             foreach ($obj_ns_sql->data as $data_ns) {
                 $group_nameservers[] = $data_ns["server_name"];
             }
             unset($obj_ns_sql);
         }
         // fetch domain records
         $obj_domain->load_data_record_all();
         if ($obj_domain->data["records"]) {
             foreach ($obj_domain->data["records"] as $data_record) {
                 // filter to NS records that apply for the selected domain group only
                 if ($this->auth_group) {
                     if ($data_record["type"] == "NS") {
                         if (!in_array($data_record["content"], $group_nameservers)) {
                             // Current NS record isn't in the domain group list. If the nameserver exists in
                             // other domain groups, we should exclude it to avoid contaminating across groups.
                             //
                             // However if the nameserver does *not* exist in NamedManager, then it must be an
                             // NS record for an external domain, so we should include it, so that external
                             // delegation works correcty.
                             $obj_ns_sql = new sql_query();
                             $obj_ns_sql->string = "SELECT id FROM name_servers WHERE server_name='" . $data_record["content"] . "' LIMIT 1";
                             $obj_ns_sql->execute();
                             if ($obj_ns_sql->num_rows()) {
                                 // nameserver exists in other groups, we should exclude this NS record.
                                 continue;
                             }
                         }
                     }
                 }
                 // add record to return array
                 $return_tmp = array();
                 $return_tmp["id_record"] = $data_record["id_record"];
                 $return_tmp["record_name"] = $data_record["name"];
                 $return_tmp["record_type"] = $data_record["type"];
                 $return_tmp["record_content"] = $data_record["content"];
                 $return_tmp["record_ttl"] = $data_record["ttl"];
                 $return_tmp["record_prio"] = $data_record["prio"];
                 $return[] = $return_tmp;
             }
             return $return;
         }
         return 0;
     } else {
         throw new SoapFault("Sender", "ACCESS_DENIED");
     }
 }
Ejemplo n.º 24
0
/**
 * Sets the default domain.
 */
function _textdomain($domain)
{
    domain::$default_domain = $domain;
}