当前位置: 首页>>代码示例>>PHP>>正文


PHP versioncompare函数代码示例

本文整理汇总了PHP中versioncompare函数的典型用法代码示例。如果您正苦于以下问题:PHP versioncompare函数的具体用法?PHP versioncompare怎么用?PHP versioncompare使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了versioncompare函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLoginPageOptions

    public function getLoginPageOptions($parameters, &$object, &$action, HookManager $hookManager)
    {
        global $langs;
        require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
        require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
        $langs->load('otp@otp');
        if (versioncompare(versiondolibarrarray(), array('3', '8', '0')) >= 0) {
            $this->results = array('options' => array('table' => '<tr>
<td class="nowrap center valignmiddle"><input type="text" name="otp" class="flat" size="20" id="otp" tabindex="3" placeholder="' . $langs->trans('OTPCode') . '"></td></tr>'));
        } else {
            $this->results = array('options' => array('table' => '<tr>
<td>
<label for="otp"><strong>' . $langs->trans('OTPCode') . '</strong></label></td><td><input type="text" name="otp" class="flat" size="15" id="otp" tabindex="3"></td></tr>'));
        }
    }
开发者ID:Getron,项目名称:dolibarr-otp,代码行数:15,代码来源:actions_otp.class.php

示例2: array

                         print '<td align="right">' . $langs->trans("Failed") . '</td></tr>';
                         $db->rollback();
                     }
                 }
             } else {
                 print '<div class="error">' . $langs->trans("Error") . ' ' . $db->lasterror() . '</div>';
             }
         }
     }
 }
 /*
  * Remove deprecated indexes and constraints for Mysql
  */
 if ($ok && preg_match('/mysql/', $db->type)) {
     $versioncommande = array(4, 0, 0);
     if (count($versioncommande) && count($versionarray) && versioncompare($versioncommande, $versionarray) <= 0) {
         // Suppression vieilles contraintes sans noms et en doubles
         // Les contraintes indesirables ont un nom qui commence par 0_ ou se termine par ibfk_999
         $listtables = array(MAIN_DB_PREFIX . 'adherent_options', MAIN_DB_PREFIX . 'bank_class', MAIN_DB_PREFIX . 'c_ecotaxe', MAIN_DB_PREFIX . 'c_methode_commande_fournisseur', MAIN_DB_PREFIX . 'c_input_method');
         $listtables = $db->DDLListTables($conf->db->name, '');
         foreach ($listtables as $val) {
             // Database prefix filter
             if (preg_match('/^' . MAIN_DB_PREFIX . '/', $val)) {
                 //print "x".$val."<br>";
                 $sql = "SHOW CREATE TABLE " . $val;
                 $resql = $db->query($sql);
                 if ($resql) {
                     $values = $db->fetch_array($resql);
                     $i = 0;
                     $createsql = $values[1];
                     while (preg_match('/CONSTRAINT `(0_[0-9a-zA-Z]+|[_0-9a-zA-Z]+_ibfk_[0-9]+)`/i', $createsql, $reg) && $i < 100) {
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:31,代码来源:upgrade.php

示例3: preg_split

 $versionfrom = $migarray['from'];
 $versionto = $migarray['to'];
 $versionarray = preg_split('/[\\.-]/', $version);
 $dolibarrversionfromarray = preg_split('/[\\.-]/', $versionfrom);
 $dolibarrversiontoarray = preg_split('/[\\.-]/', $versionto);
 // Define string newversionxxx that are used for text to show
 $newversionfrom = preg_replace('/(\\.[0-9]+)$/i', '.*', $versionfrom);
 $newversionto = preg_replace('/(\\.[0-9]+)$/i', '.*', $versionto);
 $newversionfrombis = '';
 if (versioncompare($dolibarrversiontoarray, $versionarray) < -2) {
     $newversionfrombis = ' ' . $langs->trans("or") . ' ' . $versionto;
 }
 if ($ok) {
     if (count($dolibarrlastupgradeversionarray) >= 2) {
         // Now we check if this is the first qualified choice
         if ($allowupgrade && empty($foundrecommandedchoice) && (versioncompare($dolibarrversiontoarray, $dolibarrlastupgradeversionarray) > 0 || versioncompare($dolibarrversiontoarray, $versionarray) < -2)) {
             $foundrecommandedchoice = 1;
             // To show only once
             $recommended_choice = true;
         }
     } else {
         // We can not recommand a choice.
         // A version of install may be known, but we need last upgrade.
     }
 }
 $choice .= '<tr class="listofchoices ' . ($recommended_choice ? 'choiceselected' : '') . '">';
 $choice .= '<td class="listofchoices nowrap" align="center"><b>' . $langs->trans("Upgrade") . '<br>' . $newversionfrom . $newversionfrombis . ' -> ' . $newversionto . '</b></td>';
 $choice .= '<td class="listofchoices">';
 $choice .= $langs->trans("UpgradeDesc");
 if ($recommended_choice) {
     $choice .= '<br>';
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:31,代码来源:check.php

示例4: Activate

/**
 *  Enable a module
 *  @param      value       Name of module to activate
 *  @param      withdeps    Activate/Disable also all dependencies
 *  @return     string      Error message or '';
 */
function Activate($value,$withdeps=1)
{
    global $db, $modules, $langs, $conf;

    $modName = $value;

    $ret='';

    // Activate module
    if ($modName)
    {
        $modFile = $modName . ".class.php";

        // Loop on each directory
        $found=false;
    	foreach ($conf->file->dol_document_root as $type => $dirroot)
        {
            $modulesdir[] = $dirroot."/includes/modules/";
            
            if ($type == 'alt')
			{	
				$handle=@opendir($dirroot);
				if (is_resource($handle))
				{
					while (($file = readdir($handle))!==false)
					{
					    if (is_dir($dirroot.'/'.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && $file != 'includes')
					    {
					    	if (is_dir($dirroot . '/' . $file . '/includes/modules/'))
					    	{
					    		$modulesdir[] = $dirroot . '/' . $file . '/includes/modules/';
					    	}
					    }
					}
					closedir($handle);
				}
			}
        }

        foreach ($modulesdir as $dir)
        {
        	if (file_exists($dir.$modFile))
        	{
        		$found=@include_once($dir.$modFile);
        		if ($found) break;
        	}
        }

        $objMod = new $modName($db);

        // Test if PHP version ok
        $verphp=versionphparray();
        $vermin=isset($objMod->phpmin)?$objMod->phpmin:0;
        if (is_array($vermin) && versioncompare($verphp,$vermin) < 0)
        {
            return $langs->trans("ErrorModuleRequirePHPVersion",versiontostring($vermin));
        }

        // Test if Dolibarr version ok
        $verdol=versiondolibarrarray();
        $vermin=isset($objMod->need_dolibarr_version)?$objMod->need_dolibarr_version:0;
        //print 'eee'.versioncompare($verdol,$vermin).join(',',$verdol).' - '.join(',',$vermin);exit;
        if (is_array($vermin) && versioncompare($verdol,$vermin) < 0)
        {
            return $langs->trans("ErrorModuleRequireDolibarrVersion",versiontostring($vermin));
        }

        // Test if javascript requirement ok
        if (! empty($objMod->need_javascript_ajax) && empty($conf->use_javascript_ajax))
        {
            return $langs->trans("ErrorModuleRequireJavascript");
        }

        $result=$objMod->init();
        if ($result <= 0) $ret=$objMod->error;
    }

    if (! $ret && $withdeps)
    {
        if (is_array($objMod->depends) && !empty($objMod->depends))
        {
            // Activation des modules dont le module depend
            for ($i = 0; $i < sizeof($objMod->depends); $i++)
            {
                if (file_exists(DOL_DOCUMENT_ROOT."/includes/modules/".$objMod->depends[$i].".class.php"))
                {
                    Activate($objMod->depends[$i]);
                }
            }
        }

        if (isset($objMod->conflictwith) && is_array($objMod->conflictwith))
        {
            // Desactivation des modules qui entrent en conflit
//.........这里部分代码省略.........
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:admin.lib.php

示例5: versioncompare

            // Define string newversionxxx that are used for text to show
            $newversionfrom=preg_replace('/(\.[0-9]+)$/i','.*',$versionfrom);
            $newversionto=preg_replace('/(\.[0-9]+)$/i','.*',$versionto);
            $newversionfrombis='';
            if (versioncompare($dolibarrversiontoarray,$versionarray) < -2)	// From x.y.z -> x.y.z+1
            {
            	$newversionfrombis=' '.$langs->trans("or").' '.$versionto;
            }

            if ($ok)
            {
                if (count($dolibarrlastupgradeversionarray) >= 2)	// If a database access is available and last upgrade version is known
                {
                    // Now we check if this is the first qualified choice
                    if ($allowupgrade && empty($foundrecommandedchoice) &&
                        (versioncompare($dolibarrversiontoarray,$dolibarrlastupgradeversionarray) > 0 || versioncompare($dolibarrversiontoarray,$versionarray) < -2)
                    )
                    {
                        $foundrecommandedchoice=1;	// To show only once
                        $recommended_choice = true;
                    }
                }
                else {
                    // We can not recommand a choice.
                    // A version of install may be known, but we need last upgrade.
                }
            }

            $choice .= '<tr class="listofchoices '.($recommended_choice ? 'choiceselected' : '').'">';
            $choice .= '<td class="listofchoices nowrap" align="center"><b>'.$langs->trans("Upgrade").'<br>'.$newversionfrom.$newversionfrombis.' -> '.$newversionto.'</b></td>';
            $choice .= '<td class="listofchoices">';
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:31,代码来源:check.php

示例6: dol_syslog

    require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
}
// Need 22ko memory
// If install or upgrade process not done or not completely finished, we call the install page.
if (!empty($conf->global->MAIN_NOT_INSTALLED) || !empty($conf->global->MAIN_NOT_UPGRADED)) {
    dol_syslog("main.inc: A previous install or upgrade was not complete. Redirect to install page.", LOG_WARNING);
    header("Location: " . DOL_URL_ROOT . "/install/index.php");
    exit;
}
// If an upgrade process is required, we call the install page.
if (!empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && $conf->global->MAIN_VERSION_LAST_UPGRADE != DOL_VERSION || empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && !empty($conf->global->MAIN_VERSION_LAST_INSTALL) && $conf->global->MAIN_VERSION_LAST_INSTALL != DOL_VERSION) {
    $versiontocompare = empty($conf->global->MAIN_VERSION_LAST_UPGRADE) ? $conf->global->MAIN_VERSION_LAST_INSTALL : $conf->global->MAIN_VERSION_LAST_UPGRADE;
    require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
    $dolibarrversionlastupgrade = preg_split('/[.-]/', $versiontocompare);
    $dolibarrversionprogram = preg_split('/[.-]/', DOL_VERSION);
    $rescomp = versioncompare($dolibarrversionprogram, $dolibarrversionlastupgrade);
    if ($rescomp > 0) {
        dol_syslog("main.inc: database version " . $versiontocompare . " is lower than programs version " . DOL_VERSION . ". Redirect to install page.", LOG_WARNING);
        header("Location: " . DOL_URL_ROOT . "/install/index.php");
        exit;
    }
}
// Creation of a token against CSRF vulnerabilities
if (!defined('NOTOKENRENEWAL')) {
    $token = dol_hash(uniqid(mt_rand(), TRUE));
    // Generates a hash of a random number
    // roulement des jetons car cree a chaque appel
    if (isset($_SESSION['newtoken'])) {
        $_SESSION['token'] = $_SESSION['newtoken'];
    }
    $_SESSION['newtoken'] = $token;
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:31,代码来源:main.inc.php

示例7: explode

             $db->commit();
         } else {
             print '<tr><td>' . $langs->trans("RemoveDuplicates") . '</td>';
             print '<td align="right">' . $langs->trans("Failed") . '</td></tr>';
             $db->rollback();
         }
     }
 } else {
     print '<div class="error">' . $langs->trans("Error") . '</div>';
 }
 /*
  * Remove deprecated indexes and constraints for Mysql
  */
 if ($ok && preg_match('/mysql/', $db->type)) {
     $versioncommande = explode('.', '4.0');
     if (sizeof($versioncommande) && sizeof($versionarray) && versioncompare($versioncommande, $versionarray) <= 0) {
         // Suppression vieilles contraintes sans noms et en doubles
         // Les contraintes indesirables ont un nom qui commence par 0_ ou se termine par ibfk_999
         $listtables = array(MAIN_DB_PREFIX . 'adherent_options', MAIN_DB_PREFIX . 'bank_class', MAIN_DB_PREFIX . 'c_ecotaxe', MAIN_DB_PREFIX . 'c_methode_commande_fournisseur', MAIN_DB_PREFIX . 'c_input_method');
         $listtables = $db->DDLListTables($conf->db->name, '');
         foreach ($listtables as $val) {
             // Database prefix filter
             if (preg_match('/^' . MAIN_DB_PREFIX . '/', $val)) {
                 //print "x".$val."<br>";
                 $sql = "SHOW CREATE TABLE " . $val;
                 $resql = $db->query($sql);
                 if ($resql) {
                     $values = $db->fetch_array($resql);
                     $i = 0;
                     $createsql = $values[1];
                     while (preg_match('/CONSTRAINT `(0_[0-9a-zA-Z]+|[_0-9a-zA-Z]+_ibfk_[0-9]+)`/i', $createsql, $reg) && $i < 100) {
开发者ID:netors,项目名称:dolibarr,代码行数:31,代码来源:upgrade.php

示例8: versioncompare

			}
		}
	}
	else
	{
		print '<div class="error">'.$langs->trans("Error").'</div>';
	}

	/*
	 * Remove deprecated indexes and constraints for Mysql
	 */
	if ($ok && preg_match('/mysql/',$db->type))
	{
		$versioncommande=explode('.','4.0');
		if (sizeof($versioncommande) && sizeof($versionarray)
			&& versioncompare($versioncommande,$versionarray) <= 0)	// Si mysql >= 4.0
		{
			// Suppression vieilles contraintes sans noms et en doubles
			// Les contraintes indesirables ont un nom qui commence par 0_ ou se termine par ibfk_999
			$listtables=array(  'llx_adherent_options',
								'llx_bank_class',
								'llx_c_ecotaxe',
								'llx_c_methode_commande_fournisseur',   // table renamed
    		                    'llx_c_input_method');

			$listtables = $db->DDLListTables($conf->db->name,'');
		    foreach ($listtables as $val)
			{
				//print "x".$val."<br>";
				$sql = "SHOW CREATE TABLE ".$val;
				$resql = $db->query($sql);
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:upgrade.php

示例9: addOrderLine

 /**
  * Adds a product to the order
  *
  * @param Commande $object Order object
  * @param Product $prod Product to add
  * @param int $qty Quantity of the product
  * @throws Exception
  */
 public static function addOrderLine(Commande $object, Product $prod, $qty)
 {
     global $db, $conf, $mysoc, $langs;
     require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
     $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
     $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
     if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($object->thirdparty->price_level)) {
         $pu_ht = $prod->multiprices[$object->thirdparty->price_level];
         $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
         $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
         if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) {
             $tva_tx = $prod->multiprices_tva_tx[$object->thirdparty->price_level];
         }
         if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) {
             $tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level];
         }
     } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
         require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
         $prodcustprice = new Productcustomerprice($db);
         $filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id);
         $result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
         if ($result >= 0) {
             if (count($prodcustprice->lines) > 0) {
                 $pu_ht = price($prodcustprice->lines[0]->price);
                 $pu_ttc = price($prodcustprice->lines[0]->price_ttc);
                 $price_base_type = $prodcustprice->lines[0]->price_base_type;
                 $prod->tva_tx = $prodcustprice->lines[0]->tva_tx;
             } else {
                 $pu_ht = $prod->price;
                 $pu_ttc = $prod->price_ttc;
                 $price_base_type = $prod->price_base_type;
             }
         } else {
             throw new Exception($prodcustprice->error);
         }
     } else {
         $pu_ht = $prod->price;
         $pu_ttc = $prod->price_ttc;
         $price_base_type = $prod->price_base_type;
     }
     // if price ht is forced (ie: calculated by margin rate and cost price)
     if (!empty($price_ht)) {
         $pu_ht = price2num($price_ht, 'MU');
         $pu_ttc = price2num($pu_ht * (1 + $tva_tx / 100), 'MU');
     } elseif ($tva_tx != $prod->tva_tx) {
         if ($price_base_type != 'HT') {
             $pu_ht = price2num($pu_ttc / (1 + $tva_tx / 100), 'MU');
         } else {
             $pu_ttc = price2num($pu_ht * (1 + $tva_tx / 100), 'MU');
         }
     }
     // Define output language
     if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
         $outputlangs = $langs;
         $newlang = '';
         if (empty($newlang) && GETPOST('lang_id')) {
             $newlang = GETPOST('lang_id');
         }
         if (empty($newlang)) {
             $newlang = $object->thirdparty->default_lang;
         }
         if (!empty($newlang)) {
             $outputlangs = new Translate("", $conf);
             $outputlangs->setDefaultLang($newlang);
         }
         $desc = !empty($prod->multilangs[$outputlangs->defaultlang]["description"]) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description;
     } else {
         $desc = $prod->description;
     }
     // Add custom code and origin country into description
     if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (!empty($prod->customcode) || !empty($prod->country_code))) {
         $tmptxt = '(';
         if (!empty($prod->customcode)) {
             $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
         }
         if (!empty($prod->customcode) && !empty($prod->country_code)) {
             $tmptxt .= ' - ';
         }
         if (!empty($prod->country_code)) {
             $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
         }
         $tmptxt .= ')';
         $desc = dol_concatdesc($desc, $tmptxt);
     }
     //3.9.0 version added support for price units
     if (versioncompare(versiondolibarrarray(), array(3, 9, 0)) >= 0) {
         $fk_unit = $prod->fk_unit;
     } else {
         $fk_unit = null;
     }
     // Local Taxes
     $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty);
//.........这里部分代码省略.........
开发者ID:marcosgdf,项目名称:dolibarr-importorderlines,代码行数:101,代码来源:Utils.php

示例10: explode

						$versioncommande = explode('.', $reg[1]);
						//print var_dump($versioncommande);
						//print var_dump($versionarray);
						if (count($versioncommande) && count($versionarray)
								&& versioncompare($versioncommande, $versionarray) <= 0) {
							// Version qualified, delete SQL comments
							$buf = preg_replace('/^--\sV([0-9\.]+)/i', '', $buf);
							//print "Ligne $i qualifiee par version: ".$buf.'<br>';
						}
					}
					if ($choix == 2 && preg_match('/^--\sPOSTGRESQL\sV([0-9\.]+)/i', $buf, $reg)) {
						$versioncommande = explode('.', $reg[1]);
						//print var_dump($versioncommande);
						//print var_dump($versionarray);
						if (count($versioncommande) && count($versionarray)
								&& versioncompare($versioncommande, $versionarray) <= 0) {
							// Version qualified, delete SQL comments
							$buf = preg_replace('/^--\sPOSTGRESQL\sV([0-9\.]+)/i', '', $buf);
							//print "Ligne $i qualifiee par version: ".$buf.'<br>';
						}
					}

					// Ajout ligne si non commentaire
					if (!preg_match('/^--/i', $buf))
						$buffer .= $buf;
				}
				fclose($fp);

				// Si plusieurs requetes, on boucle sur chaque
				$listesql = explode(';', $buffer);
				foreach ($listesql as $req) {
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:etape2.php

示例11: migrate_reload_menu

/**
 * Reload menu if dynamic menus, if modified by version
 *
 * @param	DoliDB		$db			Database handler
 * @param	Translate	$langs		Object langs
 * @param	Conf		$conf		Object conf
 * @param	string		$versionto	Version target
 * @return	void
 */
function migrate_reload_menu($db, $langs, $conf, $versionto)
{
    global $conf;
    dolibarr_install_syslog("upgrade2::migrate_reload_menu");
    // Define list of menu handlers to initialize
    $listofmenuhandler = array();
    $versiontoarray = explode('.', $versionto);
    // Script for VX (X<2.9) -> V2.9
    $afterversionarray = explode('.', '2.8.9');
    $beforeversionarray = explode('.', '2.9.9');
    if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
        $listofmenuhandler['auguria'] = 1;
        // We set here only dynamic menu handlers
    }
    // Script for VX (X<3.2) -> V3.2
    $afterversionarray = explode('.', '3.1.9');
    $beforeversionarray = explode('.', '3.2.9');
    if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
        $listofmenuhandler['auguria'] = 1;
        // We set here only dynamic menu handlers
    }
    foreach ($listofmenuhandler as $key => $val) {
        print '<tr><td colspan="4">';
        //print "x".$key;
        print '<br>';
        print '<b>' . $langs->trans('Upgrade') . '</b>: ' . $langs->trans('MenuHandler') . " " . $key . "<br>\n";
        // Load sql ini_menu_handler.sql file
        $dir = DOL_DOCUMENT_ROOT . "/core/menus/";
        $file = 'init_menu_' . $key . '.sql';
        if (file_exists($dir . $file)) {
            $result = run_sql($dir . $file, 1, '', 1, $key);
        }
        print '</td></tr>';
    }
}
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:44,代码来源:upgrade2.php

示例12: dol_buildpath

            if ($row['rowid'] == $user->id) {
                echo '<strong>';
            }
            echo $row['firstname'] . ' ' . $row['lastname'] . ' :';
            echo '<PRE>' . dol_buildpath('cdav/server.php', 2) . '/calendars/' . $user->login . '/' . $row['rowid'] . '-cal-' . $row['login'] . '</PRE><br/>';
            if ($row['rowid'] == $user->id) {
                echo '</strong>';
            }
        }
    } else {
        echo '<PRE>' . dol_buildpath('cdav/server.php', 2) . '/calendars/' . $user->login . '/' . $user->id . '-cal-' . $user->login . '</PRE>';
    }
} elseif ($type == 'ICS') {
    echo '<h3>' . $langs->trans('URLforICS') . '</h3>';
    if (isset($user->rights->agenda->allactions->read) && $user->rights->agenda->allactions->read) {
        if (versioncompare(versiondolibarrarray(), array(3, 7, 9)) > 0) {
            $fk_soc_fieldname = 'fk_soc';
        } else {
            $fk_soc_fieldname = 'fk_societe';
        }
        $sql = 'SELECT u.rowid, u.login, u.firstname, u.lastname
			FROM ' . MAIN_DB_PREFIX . 'user u WHERE ' . $fk_soc_fieldname . ' IS NULL
			ORDER BY login';
        $result = $db->query($sql);
        while ($row = $db->fetch_array($result)) {
            echo '<h4>' . $row['firstname'] . ' ' . $row['lastname'] . ' :</h4>';
            echo "<PRE>" . $langs->trans('Full') . " :\n" . dol_buildpath('cdav/ics.php', 2) . '?token=' . base64url_encode(mcrypt_ecb(MCRYPT_BLOWFISH, CDAV_URI_KEY, $row['rowid'] . '+ø+full', MCRYPT_ENCRYPT)) . "\n\n";
            echo $langs->trans('NoLabel') . " :\n" . dol_buildpath('cdav/ics.php', 2) . '?token=' . base64url_encode(mcrypt_ecb(MCRYPT_BLOWFISH, CDAV_URI_KEY, $row['rowid'] . '+ø+nolabel', MCRYPT_ENCRYPT)) . '</PRE><br/>';
        }
    } else {
        echo "<PRE>" . $langs->trans('Full') . " :\n" . dol_buildpath('cdav/ics.php', 2) . '?token=' . base64url_encode(mcrypt_ecb(MCRYPT_BLOWFISH, CDAV_URI_KEY, $user->id . '+ø+full', MCRYPT_ENCRYPT)) . "\n\n";
开发者ID:aternatik,项目名称:cdav,代码行数:31,代码来源:cdavurls.php

示例13: getURLContent

print '<ul>';
print '<li><strong>' . DOL_VERSION . '</strong>';
$result = getURLContent('http://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
$sfurl = simplexml_load_string($result['content']);
if ($sfurl) {
    $i = 0;
    $version = '0.0';
    while (!empty($sfurl->channel[0]->item[$i]->title) && $i < 10000) {
        $title = $sfurl->channel[0]->item[$i]->title;
        if (preg_match('/([0-9]+\\.([0-9\\.]+))/', $title, $reg)) {
            $newversion = $reg[1];
            $newversionarray = explode('.', $newversion);
            $versionarray = explode('.', $version);
            //var_dump($newversionarray);var_dump($versionarray);
            if (versioncompare($newversionarray, $versionarray) > 0) {
                $version = $newversion;
            }
        }
        $i++;
    }
    // Show version
    if ($version != '0.0') {
        print ' (' . $langs->trans("LastStableVersion") . ': <b>' . $version . '</b>';
        if (DOL_VERSION == $version) {
            $youuselaststable = 1;
            print $langs->trans("YouUseLastStableVersion");
        }
        print ')';
    }
    print ' / <a href="http://www.gnu.org/copyleft/gpl.html">GNU-GPL v3+</a></li>';
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:about.php

示例14: img_picto

							print "<td align=\"center\">\n";
							//if ($conf->global->COMPANY_ADDON_PDF != "$name")
							//{
								print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
								print img_picto($langs->trans("Enabled"),'on');
								print '</a>';
							//}
							//else
							//{
							//	print img_picto($langs->trans("Enabled"),'on');
							//}
							print "</td>";
						}
						else
						{
							if (versioncompare($module->phpmin,versionphparray()) > 0)
							{
								print "<td align=\"center\">\n";
								print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion",join('.',$module->phpmin))),'off');
								print "</td>";
							}
							else
							{
								print "<td align=\"center\">\n";
								print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
								print "</td>";
							}
						}

						// Info
						$htmltooltip =    ''.$langs->trans("Name").': '.$module->name;
开发者ID:remyyounes,项目名称:dolibarr,代码行数:31,代码来源:societe.php

示例15: activateModule

/**
 *  Enable a module
 *
 *  @param      string		$value      Name of module to activate
 *  @param      int			$withdeps   Activate/Disable also all dependencies
 *  @return     string      			Error message or '';
 */
function activateModule($value, $withdeps = 1)
{
    global $db, $modules, $langs, $conf;
    // Check parameters
    if (empty($value)) {
        return 'ErrorBadParameter';
    }
    $ret = '';
    $modName = $value;
    $modFile = $modName . ".class.php";
    // Loop on each directory to fill $modulesdir
    $modulesdir = dolGetModulesDirs();
    // Loop on each modulesdir directories
    $found = false;
    foreach ($modulesdir as $dir) {
        if (file_exists($dir . $modFile)) {
            $found = @(include_once $dir . $modFile);
            if ($found) {
                break;
            }
        }
    }
    $objMod = new $modName($db);
    // Test if PHP version ok
    $verphp = versionphparray();
    $vermin = isset($objMod->phpmin) ? $objMod->phpmin : 0;
    if (is_array($vermin) && versioncompare($verphp, $vermin) < 0) {
        return $langs->trans("ErrorModuleRequirePHPVersion", versiontostring($vermin));
    }
    // Test if Dolibarr version ok
    $verdol = versiondolibarrarray();
    $vermin = isset($objMod->need_dolibarr_version) ? $objMod->need_dolibarr_version : 0;
    //print 'eee '.versioncompare($verdol,$vermin).' - '.join(',',$verdol).' - '.join(',',$vermin);exit;
    if (is_array($vermin) && versioncompare($verdol, $vermin) < 0) {
        return $langs->trans("ErrorModuleRequireDolibarrVersion", versiontostring($vermin));
    }
    // Test if javascript requirement ok
    if (!empty($objMod->need_javascript_ajax) && empty($conf->use_javascript_ajax)) {
        return $langs->trans("ErrorModuleRequireJavascript");
    }
    $result = $objMod->init();
    if ($result <= 0) {
        $ret = $objMod->error;
    }
    if (!$ret && $withdeps) {
        if (isset($objMod->depends) && is_array($objMod->depends) && !empty($objMod->depends)) {
            // Activation des modules dont le module depend
            $num = count($objMod->depends);
            for ($i = 0; $i < $num; $i++) {
                foreach ($modulesdir as $dir) {
                    if (file_exists($dir . $objMod->depends[$i] . ".class.php")) {
                        activateModule($objMod->depends[$i]);
                    }
                }
            }
        }
        if (isset($objMod->conflictwith) && is_array($objMod->conflictwith) && !empty($objMod->conflictwith)) {
            // Desactivation des modules qui entrent en conflit
            $num = count($objMod->conflictwith);
            for ($i = 0; $i < $num; $i++) {
                foreach ($modulesdir as $dir) {
                    if (file_exists($dir . $objMod->conflictwith[$i] . ".class.php")) {
                        unActivateModule($objMod->conflictwith[$i], 0);
                    }
                }
            }
        }
    }
    return $ret;
}
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:77,代码来源:admin.lib.php


注:本文中的versioncompare函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。