Exemple #1
0
        setEventMessage($langs->trans("SetupIsReadyForUse"));
    }
}
/*
 * View
 */
// Set dir where external modules are installed
if (!dol_is_dir($dirins)) {
    dol_mkdir($dirins);
}
$dirins_ok = dol_is_dir($dirins);
$wikihelp = 'EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalación_-_Actualización';
llxHeader('', $langs->trans("Upgrade"), $wikihelp);
print_fiche_titre($langs->trans("Upgrade"), '', 'title_setup');
print $langs->trans("CurrentVersion") . ' : <b>' . DOL_VERSION . '</b><br>';
$result = getURLContent('http://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
$sfurl = simplexml_load_string($result['content']);
if ($sfurl) {
    $title = $sfurl->channel[0]->item[0]->title;
    function word_limiter($text, $limit = 30, $chars = '0123456789.')
    {
        if (strlen($text) > $limit) {
            $words = str_word_count($text, 2, $chars);
            $words = array_reverse($words, TRUE);
            foreach ($words as $length => $word) {
                if ($length + strlen($word) >= $limit) {
                    array_shift($words);
                } else {
                    break;
                }
Exemple #2
0
 /**
  * testProductCreate
  *
  * @return	void
  */
 public function testPaypalOk()
 {
     global $conf, $user, $langs, $db;
     $conf = $this->savconf;
     $user = $this->savuser;
     $langs = $this->savlangs;
     $db = $this->savdb;
     $urltotest = getPaypalPaymentUrl(1, 'free');
     print "urltotest=" . $urltotest . "\n";
     $result = getURLContent($urltotest, 'GET');
     print __METHOD__ . " result=" . $result . "\n";
     $this->assertLessThanOrEqual($result, 0);
     return $result;
 }
Exemple #3
0
 /**
  * Get XRDS response and set possible servers.
  *
  * @param	string	$url	Url of endpoint to request
  * @return 	string			First endpoint OpenID server found. False if it failed to found.
  */
 function sendDiscoveryRequestToGetXRDS($url = '')
 {
     global $conf;
     include_once DOL_DOCUMENT_ROOT . '/core/lib/geturl.lib.php';
     if (empty($url)) {
         $url = $conf->global->MAIN_AUTHENTICATION_OPENID_URL;
     }
     dol_syslog(get_class($this) . '::sendDiscoveryRequestToGetXRDS get XRDS');
     $addheaders = array('Accept: application/xrds+xml');
     $response = getURLContent($url, 'GET', '', 1, $addheaders);
     /* response should like this:
     		<?xml version="1.0" encoding="UTF-8"?>
     		<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)">
     		<XRD>
     		<Service priority="0">
     		<Type>http://specs.openid.net/auth/2.0/server</Type>
     		<Type>http://openid.net/srv/ax/1.0</Type>
     		...
     		<URI>https://www.google.com/accounts/o8/ud</URI>
     		</Service>
     		</XRD>
     		</xrds:XRDS>
     		*/
     $content = $response['content'];
     $server = '';
     if (preg_match('/' . preg_quote('<URI>', '/') . '(.*)' . preg_quote('</URI>', '/') . '/is', $content, $reg)) {
         $server = $reg[1];
     }
     if (empty($server)) {
         $this->ErrorStore('OPENID_NOSERVERSFOUND');
         return false;
     } else {
         dol_syslog(get_class($this) . '::sendDiscoveryRequestToGetXRDS found endpoint = ' . $server);
         $this->SetOpenIDServer($server);
         return $server;
     }
 }
/**
 * Check if new version is available
 *
 * @param $auto boolean: check done autically ? (if not display result)
 * @param $messageafterredirect boolean: use message after redirect instead of display
 *
 * @return string explaining the result
**/
function checkNewVersionAvailable($auto = true, $messageafterredirect = false)
{
    global $LANG, $CFG_GLPI;
    if (!$auto && !haveRight("check_update", "r")) {
        return false;
    }
    if (!$auto && !$messageafterredirect) {
        echo "<br>";
    }
    $error = "";
    $latest_version = getURLContent("http://glpi-project.org/latest_version", $error);
    if (strlen(trim($latest_version)) == 0) {
        if (!$auto) {
            if ($messageafterredirect) {
                addMessageAfterRedirect($error, true, ERROR);
            } else {
                echo "<div class='center'>{$error}</div>";
            }
        } else {
            return $error;
        }
    } else {
        $splitted = explode(".", trim($CFG_GLPI["version"]));
        if ($splitted[0] < 10) {
            $splitted[0] .= "0";
        }
        if ($splitted[1] < 10) {
            $splitted[1] .= "0";
        }
        $cur_version = $splitted[0] * 10000 + $splitted[1] * 100;
        if (isset($splitted[2])) {
            if ($splitted[2] < 10) {
                $splitted[2] .= "0";
            }
            $cur_version += $splitted[2];
        }
        $splitted = explode(".", trim($latest_version));
        if ($splitted[0] < 10) {
            $splitted[0] .= "0";
        }
        if ($splitted[1] < 10) {
            $splitted[1] .= "0";
        }
        $lat_version = $splitted[0] * 10000 + $splitted[1] * 100;
        if (isset($splitted[2])) {
            if ($splitted[2] < 10) {
                $splitted[2] .= "0";
            }
            $lat_version += $splitted[2];
        }
        if ($cur_version < $lat_version) {
            $config_object = new Config();
            $input["id"] = 1;
            $input["founded_new_version"] = $latest_version;
            $config_object->update($input);
            if (!$auto) {
                if ($messageafterredirect) {
                    addMessageAfterRedirect($LANG['setup'][301] . " " . $latest_version . $LANG['setup'][302]);
                } else {
                    echo "<div class='center'>" . $LANG['setup'][301] . " " . $latest_version . "</div>";
                    echo "<div class='center'>" . $LANG['setup'][302] . "</div>";
                }
            } else {
                if ($messageafterredirect) {
                    addMessageAfterRedirect($LANG['setup'][301] . " " . $latest_version);
                } else {
                    return $LANG['setup'][301] . " " . $latest_version;
                }
            }
        } else {
            if (!$auto) {
                if ($messageafterredirect) {
                    addMessageAfterRedirect($LANG['setup'][303]);
                } else {
                    echo "<div class='center'>" . $LANG['setup'][303] . "</div>";
                }
            } else {
                if ($messageafterredirect) {
                    addMessageAfterRedirect($LANG['setup'][303]);
                } else {
                    return $LANG['setup'][303];
                }
            }
        }
    }
    return 1;
}
Exemple #5
0
             if ($Form_ServerId == $keys[$i]) {
                 echo " selected=\"selected\"";
             }
             echo ">";
             echo $system["Servers"][$keys[$i]]["Nickname"] . " - " . $system["Servers"][$keys[$i]]["DB"] . " (" . $system["Servers"][$keys[$i]]["Name"] . ")";
             echo "</option>";
         }
     }
     echo "<select><br/><br/>";
 } else {
     $Form_ServerId = $system["Servers"][$system["serverId"]]["Default_Target"];
     echo "<input name=\"Form_ServerId\" type=\"hidden\" value=\"" . $Form_ServerId . "\">";
     echo $system["Servers"][$Form_ServerId]["DB"] . " (" . $system["Servers"][$Form_ServerId]["__Name__"] . ")<br/><br/>";
 }
 if (isset($system["Servers"][$Form_ServerId]) && $Form_ServerId != $system["serverId"]) {
     $response = getURLContent("http://localhost/core/index.php?mt", "POST", array("siteJob" => "remoteInfo", "callingServer" => $Form_ServerId));
     // $system["serverId"]
     echo "<pre>";
     //echo "Header:";
     //print_r($response["Header"]);
     echo htmlspecialchars($response["Content"]);
     $xmlData = xmlParse($response["Content"]);
     //print_r($xmlData);
     //echo $xmlData["values"][$xmlData["index"]["info"][0]]["value"];
     echo "</pre>";
     $transferData = $xmlData["values"][$xmlData["index"]["info"][0]]["value"];
     /*      $lmTypes = explode(" ",trim($system["Servers"][$system["serverId"]]["Master_Types"]));
           $NodeList = array();
           if(count($lmTypes) && $lmTypes[0]!="") {
             $dbQuery = "SELECT mt_main_Node_id,mt_main_Update,mt_ex_Date FROM mt_main";
             $dbQuery .= " LEFT JOIN mt_ex ON mt_main_Node_id=mt_ex_Node_id";