function Test_Create_Session_Table()
 {
     $attribute_changer_tablename = $this->AttributeChangerData['attribute_changer_tablename'];
     if (!Sql_Check_For_Table($attribute_changer_tablename)) {
         Sql_create_Table($attribute_changer_tablename, $this->AttributeChangerData['attribute_changer_table_structure']);
     }
 }
Exemplo n.º 2
0
function formStart($additional = '')
{
    global $form_action, $page, $p;
    # depending on server software we can post to the directory, or need to pass on the page
    if ($form_action) {
        $html = sprintf('<form method="post" action="%s" %s>', $form_action, $additional);
        # retain all get variables as hidden ones
        foreach (array('p', 'page') as $key) {
            $val = $_REQUEST[$key];
            if ($val) {
                $html .= sprintf('<input type="hidden" name="%s" value="%s" />', $key, htmlspecialchars($val));
            }
        }
    } else {
        $html = sprintf('<form method="post" action="" %s>', $additional);
    }
    if (!empty($_SESSION['logindetails']['id'])) {
        ## create the token table, if necessary
        if (!Sql_Check_For_Table('admintoken')) {
            createTable('admintoken');
        }
        $key = md5(time() . mt_rand(0, 10000));
        Sql_Query(sprintf('insert into %s (adminid,value,entered,expires) values(%d,"%s",%d,date_add(now(),interval 1 hour))', $GLOBALS['tables']['admintoken'], $_SESSION['logindetails']['id'], $key, time()), 1);
        $html .= sprintf('<input type="hidden" name="formtoken" value="%s" />', $key);
        ## keep the token table empty
        Sql_Query(sprintf('delete from %s where expires < now()', $GLOBALS['tables']['admintoken']), 1);
    }
    return $html;
}
Exemplo n.º 3
0
 public function phplist_I18N()
 {
     $this->basedir = dirname(__FILE__) . '/locale/';
     $this->defaultlanguage = $GLOBALS['default_system_language'];
     $this->language = $GLOBALS['default_system_language'];
     if (isset($_SESSION['adminlanguage']) && isset($GLOBALS['LANGUAGES'][$_SESSION['adminlanguage']['iso']])) {
         $this->language = $_SESSION['adminlanguage']['iso'];
         $this->dir = $_SESSION['adminlanguage']['dir'];
     } else {
         unset($_SESSION['adminlanguage']);
         $this->language = $GLOBALS['default_system_language'];
     }
     if (function_exists('gettext')) {
         $this->hasGettext = true;
     }
     if (isset($_SESSION['hasI18Ntable'])) {
         $this->hasDB = $_SESSION['hasI18Ntable'];
     } elseif (Sql_Check_For_Table('i18n')) {
         $_SESSION['hasI18Ntable'] = true;
         $this->hasDB = true;
     } else {
         $_SESSION['hasI18Ntable'] = false;
     }
     if (isset($_GET['origpage']) && !empty($_GET['ajaxed'])) {
         ## used in ajaxed requests
         $page = basename($_GET['origpage']);
     } elseif (isset($_GET['page'])) {
         $page = basename($_GET['page']);
     } else {
         $page = 'home';
     }
     ## as we're including things, let's make sure it's clean
     $page = preg_replace('/\\W/', '', $page);
     if (!empty($_GET['pi'])) {
         $plugin_languagedir = $this->getPluginBasedir();
         if (is_dir($plugin_languagedir)) {
             $this->basedir = $plugin_languagedir;
             if (isset($GLOBALS['plugins'][$_GET['pi']])) {
                 $plugin = $GLOBALS['plugins'][$_GET['pi']];
                 if ($plugin->enabled && $plugin->needI18N && $plugin->i18nLanguageDir()) {
                     $this->basedir = $plugin->i18nLanguageDir();
                 }
             }
         }
     }
     $lan = array();
     if (is_file($this->basedir . $this->language . '/' . $page . '.php')) {
         @(include $this->basedir . $this->language . '/' . $page . '.php');
     } elseif (!isset($GLOBALS['developer_email'])) {
         @(include $this->basedir . $this->defaultlanguage . '/' . $page . '.php');
     }
     $this->lan = $lan;
     $lan = array();
     if (is_file($this->basedir . $this->language . '/common.php')) {
         @(include $this->basedir . $this->language . '/common.php');
     } elseif (!isset($GLOBALS['developer_email'])) {
         @(include $this->basedir . $this->defaultlanguage . '/common.php');
     }
     $this->lan += $lan;
     $lan = array();
     if (is_file($this->basedir . $this->language . '/frontend.php')) {
         @(include $this->basedir . $this->language . '/frontend.php');
     } elseif (!isset($GLOBALS['developer_email'])) {
         @(include $this->basedir . $this->defaultlanguage . '/frontend.php');
     }
     $this->lan += $lan;
 }