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


PHP PMA_saveUserprefs函数代码示例

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


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

示例1: mb_substr

                     $params[$k] = mb_substr($q, $pos + 1);
                 }
             } else {
                 $return_url = 'prefs_manage.php';
             }
             // reload config
             $GLOBALS['PMA_Config']->loadUserPreferences();
             PMA_userprefsRedirect($return_url, $params);
             exit;
         } else {
             $error = $result;
         }
     }
 } else {
     if (isset($_POST['submit_clear'])) {
         $result = PMA_saveUserprefs(array());
         if ($result === true) {
             $params = array();
             if ($GLOBALS['PMA_Config']->get('fontsize') != '82%') {
                 $GLOBALS['PMA_Config']->removeCookie('pma_fontsize');
             }
             $GLOBALS['PMA_Config']->removeCookie('pma_collaction_connection');
             $GLOBALS['PMA_Config']->removeCookie('pma_lang');
             PMA_userprefsRedirect('prefs_manage.php', $params);
             exit;
         } else {
             $error = $result;
         }
         exit;
     }
 }
开发者ID:Dhrumil1808,项目名称:phpmyadmin,代码行数:31,代码来源:prefs_manage.php

示例2: PMA_persistOption

/**
 * Updates one user preferences option (loads and saves to database).
 *
 * No validation is done!
 *
 * @param string $path          configuration
 * @param mixed  $value         value
 * @param mixed  $default_value default value
 *
 * @return void
 */
function PMA_persistOption($path, $value, $default_value)
{
    $prefs = PMA_loadUserprefs();
    if ($value === $default_value) {
        if (isset($prefs['config_data'][$path])) {
            unset($prefs['config_data'][$path]);
        } else {
            return;
        }
    } else {
        $prefs['config_data'][$path] = $value;
    }
    PMA_saveUserprefs($prefs['config_data']);
}
开发者ID:wp-cloud,项目名称:phpmyadmin,代码行数:25,代码来源:user_preferences.lib.php

示例3: _processPageSettings

 /**
  * Process response to form
  *
  * @param FormDisplay      &$form_display Form
  * @param ConfigFile       &$cf           Configuration file
  * @param PMA_Message|null &$error        Error message
  *
  * @return void
  */
 private function _processPageSettings(&$form_display, &$cf, &$error)
 {
     if ($form_display->process(false) && !$form_display->hasErrors()) {
         // save settings
         $result = PMA_saveUserprefs($cf->getConfigArray());
         if ($result === true) {
             // reload page
             header('Location: ' . $_SERVER['REQUEST_URI']);
             exit;
         } else {
             $error = $result;
         }
     }
 }
开发者ID:FuhrerMalkovich,项目名称:Blogpost,代码行数:23,代码来源:page_settings.class.php

示例4: array

        continue;
    }
    $form_display->registerForm($form_name, $form, 1);
}
if (isset($_POST['revert'])) {
    // revert erroneous fields to their default values
    $form_display->fixErrors();
    // redirect
    $url_params = array('form' => $form_param);
    PMA_sendHeaderLocation('./prefs_forms.php' . URL::getCommonRaw($url_params));
    exit;
}
$error = null;
if ($form_display->process(false) && !$form_display->hasErrors()) {
    // save settings
    $result = PMA_saveUserprefs($cf->getConfigArray());
    if ($result === true) {
        // reload config
        $GLOBALS['PMA_Config']->loadUserPreferences();
        $tabHash = isset($_POST['tab_hash']) ? $_POST['tab_hash'] : null;
        $hash = ltrim($tabHash, '#');
        PMA_userprefsRedirect('prefs_forms.php', array('form' => $form_param), $hash);
        exit;
    } else {
        $error = $result;
    }
}
// display forms
$response = Response::getInstance();
$header = $response->getHeader();
$scripts = $header->getScripts();
开发者ID:phpmyadmin,项目名称:phpmyadmin,代码行数:31,代码来源:prefs_forms.php

示例5: testSaveUserprefs

 /**
  * Test for PMA_saveUserprefs
  *
  *  @return void
  */
 public function testSaveUserprefs()
 {
     $GLOBALS['server'] = 2;
     $_SESSION['relation'][2]['PMA_VERSION'] = PMA_VERSION;
     $_SESSION['relation'][2]['userconfigwork'] = null;
     unset($_SESSION['userconfig']);
     $result = PMA_saveUserprefs(array(1));
     $this->assertTrue($result);
     $this->assertCount(2, $_SESSION['userconfig']);
     $this->assertEquals(array(1), $_SESSION['userconfig']['db']);
     /* TODO: This breaks sometimes as there might be time difference! */
     $this->assertEquals(time(), $_SESSION['userconfig']['ts'], '', 2);
     $assert = true;
     if (isset($_SESSION['cache']['server_2']['userprefs'])) {
         $assert = false;
     }
     $this->assertTrue($assert);
     // case 2
     $_SESSION['relation'][$GLOBALS['server']]['userconfigwork'] = 1;
     $_SESSION['relation'][$GLOBALS['server']]['db'] = "pmadb";
     $_SESSION['relation'][$GLOBALS['server']]['userconfig'] = "testconf";
     $_SESSION['relation'][$GLOBALS['server']]['user'] = "user";
     $GLOBALS['controllink'] = null;
     $query1 = 'SELECT `username` FROM `pmadb`.`testconf` ' . 'WHERE `username` = \'user\'';
     $query2 = 'UPDATE `pmadb`.`testconf` SET `timevalue` = NOW(), `config_data` = \'' . json_encode(array(1)) . '\' WHERE `username` = \'user\'';
     $dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->once())->method('fetchValue')->with($query1, 0, 0, null)->will($this->returnValue(true));
     $dbi->expects($this->once())->method('tryQuery')->with($query2, null)->will($this->returnValue(true));
     $dbi->expects($this->any())->method('escapeString')->will($this->returnArgument(0));
     $GLOBALS['dbi'] = $dbi;
     $this->assertTrue(PMA_saveUserprefs(array(1)));
     // case 3
     $query1 = 'SELECT `username` FROM `pmadb`.`testconf` ' . 'WHERE `username` = \'user\'';
     $query2 = 'INSERT INTO `pmadb`.`testconf` (`username`, `timevalue`,`config_data`) ' . 'VALUES (\'user\', NOW(), \'' . json_encode(array(1)) . '\')';
     $dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->once())->method('fetchValue')->with($query1, 0, 0, null)->will($this->returnValue(false));
     $dbi->expects($this->once())->method('tryQuery')->with($query2, null)->will($this->returnValue(false));
     $dbi->expects($this->once())->method('getError')->with(null)->will($this->returnValue("err1"));
     $dbi->expects($this->any())->method('escapeString')->will($this->returnArgument(0));
     $GLOBALS['dbi'] = $dbi;
     $result = PMA_saveUserprefs(array(1));
     $this->assertEquals('Could not save configuration<br /><br />err1', $result->getMessage());
 }
开发者ID:phpmyadmin,项目名称:phpmyadmin,代码行数:48,代码来源:PMA_user_preferences_test.php

示例6: array

        continue;
    }
    $form_display->registerForm($form_name, $form, 1);
}
if (isset($_POST['revert'])) {
    // revert erroneous fields to their default values
    $form_display->fixErrors();
    // redirect
    $url_params = array('form' => $form_param);
    PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'prefs_forms.php' . PMA_generate_common_url($url_params, '&'));
    exit;
}
$error = null;
if ($form_display->process(false) && !$form_display->hasErrors()) {
    // save settings
    $result = PMA_saveUserprefs(ConfigFile::getInstance()->getConfigArray());
    if ($result === true) {
        // reload config
        $GLOBALS['PMA_Config']->loadUserPreferences();
        $hash = ltrim(filter_input(INPUT_POST, 'tab_hash'), '#');
        PMA_userprefsRedirect('prefs_forms.php', array('form' => $form_param), $hash);
        exit;
    } else {
        $error = $result;
    }
}
// display forms
$response = PMA_Response::getInstance();
$header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('config.js');
开发者ID:mindfeederllc,项目名称:openemr,代码行数:31,代码来源:prefs_forms.php


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