Exemple #1
0
 * @return string
 */
function addCustomMenuItem($name, $url)
{
    $pos = '10';
    // invariant
    // get current mantis custom menu entries
    $query = "SELECT value FROM `mantis_config_table` WHERE config_id = 'main_menu_custom_options'";
    $result = execQuery($query);
    $serialized = 0 != mysql_num_rows($result) ? mysql_result($result, 0) : NULL;
    // add entry
    if (NULL != $serialized && "" != $serialized) {
        $menuItems = unserialize($serialized);
    } else {
        $menuItems = array();
    }
    $menuItems[] = array($name, $pos, $url);
    $newSerialized = serialize($menuItems);
    // update mantis menu
    if (NULL != $serialized) {
        $query = "UPDATE `mantis_config_table` SET value = '{$newSerialized}' " . "WHERE config_id = 'main_menu_custom_options'";
    } else {
        $query = "INSERT INTO `mantis_config_table` (`config_id`, `value`, `type`, `access_reqd`) " . "VALUES ('main_menu_custom_options', '{$newSerialized}', '3', '90');";
    }
    $result = execQuery($query);
    return $newSerialized;
}
# ============= MAIN =============
removeCustomMenuItem('CodevTT');
addCustomMenuItem('CodevTT', Constants::$codevURL);
Exemple #2
0
if ("proceedStep3" == $action) {
    $installStepFailed = FALSE;
    echo "DEBUG 1/16 create Greasemonkey file<br/>";
    $errStr = createGreasemonkeyFile();
    if (NULL != $errStr) {
        echo "<span class='error_font'>" . $errStr . "</span><br/>";
        $installStepFailed = TRUE;
    }
    echo "DEBUG 2/16 create default Config variables<br/>";
    //setConfigItems();
    echo "DEBUG 3/16 update Mantis custom files<br/>";
    updateMantisCustomFiles();
    echo "DEBUG 4/16 add CodevTT to Mantis menu<br/>";
    removeCustomMenuItem('CodevTT');
    $tok = strtok($_SERVER["SCRIPT_NAME"], "/");
    addCustomMenuItem('CodevTT', '../' . $tok . '/index.php');
    #  ../codev/index.php
    echo "DEBUG 5/16 create CodevTT Custom Fields<br/>";
    if ('createExtID' == $groupExtID) {
        $isCreateExtIdField = TRUE;
    } else {
        if ('0' != $extIdCustomField) {
            // add existing to codev_config_table
            Config::getInstance()->setValue("customField_ExtId", $extIdCustomField, Config::configType_int);
            $isCreateExtIdField = FALSE;
        } else {
            // if none selected, create one...
            $isCreateExtIdField = TRUE;
        }
    }
    createCustomFields($isCreateExtIdField);
Exemple #3
0
 * @param $name
 * @param $url
 * @return string
 */
function addCustomMenuItem($serialized, $name, $url)
{
    $pos = '10';
    // invariant
    if (NULL != $serialized && "" != $serialized) {
        $menuItems = unserialize($serialized);
    } else {
        $menuItems = array();
    }
    $menuItems[] = array($name, $pos, $url);
    $newStr = serialize($menuItems);
    return $newStr;
}
#==== MAIN =====
$main_menu_custom_options = 'a:1:{i:0;a:3:{i:0;s:5:"CoDev";i:1;i:10;i:2;s:18:"../codev/index.php";}}';
echo "<html><head></head><body><h1>Tools: serialize</h1>";
$serialized = addCustomMenuItem(NULL, 'toto', 'http://toto.fr');
echo "serialized={$serialized}<br/>\n";
$serialized = addCustomMenuItem($serialized, 'titi', 'http://titi.fr');
echo "serialized={$serialized}<br/>\n";
#$serialized = addCustomMenuItem($serialized, 'CodevTT', '../codev/index.php');
#echo "serialized=$serialized<br/>\n";
$tok = strtok($_SERVER["SCRIPT_NAME"], "/");
echo "../" . $tok . "/index.php<br/>\n";
$serialized = addCustomMenuItem($serialized, 'CodevTT', '../' . $tok . '/index.php');
echo "serialized={$serialized}<br/>\n";
echo "</body></html>";