/**
  * add list data in db table
  *
  * @param array $data
  */
 function perform(&$data)
 {
     // get list messages attachment folder string
     $list_folder = commonUtil::unique_md5_str();
     if (!@mkdir(SF_BASE_DIR . '/data/earchive/' . $list_folder, SF_DIR_MODE)) {
         trigger_error("Cannot create list messages attachment folder! Contact the administrator.\n\nFILE: " . __FILE__ . "\nLINE: " . __LINE__, E_USER_ERROR);
         return FALSE;
     }
     $lid = $this->B->db->nextId($this->B->sys['db']['table_prefix'] . 'earchive_lists');
     if (MDB2::isError($lid)) {
         trigger_error($result->getMessage() . "\n\nINFO: " . $result->userinfo . "\n\nFILE: " . __FILE__ . "\nLINE: " . __LINE__, E_USER_ERROR);
         return FALSE;
     }
     $sql = '
         INSERT INTO 
             ' . $this->B->sys['db']['table_prefix'] . 'earchive_lists
             (lid,name,email,emailserver,description,folder,status)
         VALUES
             (' . $lid . ',
              "' . $data['name'] . '",
              "' . $data['email'] . '",
              "' . $data['emailserver'] . '",
              "' . $data['description'] . '",
              "' . $list_folder . '",
              ' . $data['status'] . ')';
     $result = $this->B->db->query($sql);
     if (MDB2::isError($result)) {
         trigger_error($result->getMessage() . "\n\nINFO: " . $result->userinfo . "\n\nFILE: " . __FILE__ . "\nLINE: " . __LINE__, E_USER_ERROR);
         return FALSE;
     }
     return TRUE;
 }
 /**
  * Update main options
  *
  * @access privat
  */
 function _update_main_options()
 {
     // init var - used if a config value has been modified
     $this->B->_modified = FALSE;
     // Empty all cache data
     if (isset($_POST['update_clean_cache'])) {
         // Delete cache data
         M(MOD_COMMON, 'cache_delete', array('group' => ''));
     } elseif (isset($_POST['update_main_options_email'])) {
         $this->B->sys['option']['email'] = $_POST['site_email'];
         $this->B->_modified = TRUE;
     } elseif (isset($_POST['update_main_options_title'])) {
         $this->B->sys['option']['site_title'] = htmlspecialchars(commonUtil::stripSlashes($_POST['site_title']), ENT_QUOTES);
         $this->B->sys['option']['site_desc'] = htmlspecialchars(commonUtil::stripSlashes($_POST['site_desc']), ENT_QUOTES);
         $this->B->_modified = TRUE;
     } elseif (isset($_POST['update_main_options_charset'])) {
         $this->B->sys['option']['charset'] = $_POST['charset'];
         $this->B->_modified = TRUE;
     } elseif (isset($_POST['update_main_options_tpl'])) {
         $this->B->sys['option']['tpl'] = $_POST['tplgroup'];
         $this->B->_modified = TRUE;
     } elseif (isset($_POST['update_main_options_view'])) {
         $this->B->sys['option']['view'] = $_POST['viewgroup'];
         $this->B->_modified = TRUE;
     }
 }
 /**
  * Delete email list message data and attachement folder
  *
  * @param array $data
  */
 function perform($data)
 {
     if (empty($data['mid'])) {
         return FALSE;
     }
     // get message folder and lid
     M(MOD_EARCHIVE, 'get_message', array('mid' => $data['mid'], 'var' => 'm_data', 'fields' => array('lid', 'folder')));
     // get list folder
     M(MOD_EARCHIVE, 'get_list', array('lid' => $this->B->m_data['lid'], 'var' => 'l_data', 'fields' => array('lid', 'folder')));
     // build whole path to message folder
     $path = SF_BASE_DIR . '/data/earchive/' . $this->B->l_data['folder'] . '/' . $this->B->m_data['folder'];
     if (!empty($this->B->m_data['folder']) && @is_dir($path)) {
         // delete attachements folder for this message
         commonUtil::delete_dir_tree($path);
     }
     // delete list messages
     $sql = "\n            DELETE FROM \n                {$this->B->sys['db']['table_prefix']}earchive_messages\n            WHERE\n                mid={$data['mid']}";
     $result = $this->B->db->query($sql);
     if (DB::isError($result)) {
         trigger_error($result->getMessage() . "\n\nINFO: " . $result->userinfo . "\n\nFILE: " . __FILE__ . "\nLINE: " . __LINE__, E_USER_ERROR);
     }
     // delete list messages
     $sql = "\n            DELETE FROM \n                {$this->B->sys['db']['table_prefix']}earchive_attach\n            WHERE\n                mid={$data['mid']}";
     $result = $this->B->db->query($sql);
     if (DB::isError($result)) {
         trigger_error($result->getMessage() . "\n\nINFO: " . $result->userinfo . "\n\nFILE: " . __FILE__ . "\nLINE: " . __LINE__, E_USER_ERROR);
     }
     // Delete message words from the search index
     M(MOD_EARCHIVE, 'word_indexer', array('delete_words' => TRUE, 'mid' => (int) $data['mid']));
     // Delete cache data
     M(MOD_COMMON, 'cache_delete', array('group' => 'earchive'));
     return TRUE;
 }
 /**
  * Delete email list data and attachement folder
  *
  * @param array $data
  */
 function perform($data)
 {
     if (empty($data['lid'])) {
         return FALSE;
     }
     // get list attachement folder
     $sql = "\n            SELECT\n                folder\n            FROM\n                {$this->B->sys['db']['table_prefix']}earchive_lists \n            WHERE\n                lid={$data['lid']}";
     $result = $this->B->db->query($sql);
     $row =& $result->FetchRow(DB_FETCHMODE_ASSOC);
     $folder = $row['folder'];
     $path = SF_BASE_DIR . 'data/earchive/' . $folder;
     if (!empty($folder) && @is_dir($path)) {
         // delete attachements folder for this list
         commonUtil::delete_dir_tree($path);
     }
     // delete list
     $sql = "\n            DELETE FROM \n                {$this->B->sys['db']['table_prefix']}earchive_lists\n            WHERE\n                lid={$data['lid']}";
     $this->B->db->query($sql);
     // delete list messages
     $sql = "\n            DELETE FROM \n                {$this->B->sys['db']['table_prefix']}earchive_messages\n            WHERE\n                lid={$data['lid']}";
     $this->B->db->query($sql);
     // delete list messages
     $sql = "\n            DELETE FROM \n                {$this->B->sys['db']['table_prefix']}earchive_attach\n            WHERE\n                lid={$data['lid']}";
     $this->B->db->query($sql);
     // Delete message words index of this list
     M(MOD_EARCHIVE, 'word_indexer', array('delete_words' => TRUE, 'lid' => (int) $data['lid']));
     // Delete cache data
     M(MOD_COMMON, 'cache_delete', array('group' => 'earchive'));
     return TRUE;
 }
 /**
  * Update main options
  *
  * @access privat
  */
 function _update_main_options()
 {
     // init var - used if a config value has been modified
     $this->B->_modified = FALSE;
     if (isset($_POST['update_main_options_email'])) {
         $this->B->sys['option']['email'] = $_POST['site_email'];
         $this->B->_modified = TRUE;
     } elseif (isset($_POST['update_main_options_title'])) {
         $search_array = array('\'', '"');
         $replace_array = array(''', '"');
         $this->B->sys['option']['site_title'] = str_replace($search_array, $replace_array, commonUtil::stripSlashes_special($_POST['site_title']));
         $this->B->sys['option']['site_desc'] = str_replace($search_array, $replace_array, commonUtil::stripSlashes_special($_POST['site_desc']));
         $this->B->_modified = TRUE;
     } elseif (isset($_POST['update_main_options_tpl'])) {
         $this->B->sys['option']['tpl'] = $_POST['tplgroup'];
         $this->B->_modified = TRUE;
     } elseif (isset($_POST['update_main_options_view'])) {
         $this->B->sys['option']['view'] = $_POST['viewgroup'];
         $this->B->_modified = TRUE;
     } elseif (isset($_POST['update_main_options_cache_enabled'])) {
         if (isset($_POST['cacheenabled'])) {
             $this->B->sys['option']['cache'] = TRUE;
         } else {
             $this->B->sys['option']['cache'] = FALSE;
         }
         $this->B->_modified = TRUE;
     } elseif (isset($_POST['update_main_options_cache_delete'])) {
         M(MOD_COMMON, 'cache_delete');
         $this->B->_modified = TRUE;
     }
 }
 function _reset_form_data()
 {
     $this->B->tpl_form = array();
     $this->B->tpl_form['forename'] = commonUtil::stripSlashes($_POST['forename']);
     $this->B->tpl_form['lastname'] = commonUtil::stripSlashes($_POST['lastname']);
     $this->B->tpl_form['login'] = commonUtil::stripSlashes($_POST['login']);
     $this->B->tpl_form['email'] = commonUtil::stripSlashes($_POST['email']);
 }
 /**
  * reset the form fields with old user data
  *
  * @access privat
  */
 function _reset_old_fields_data()
 {
     // if empty assign form field with old values
     $this->B->tpl_data['name'] = commonUtil::stripSlashes($_POST['name']);
     $this->B->tpl_data['emailserver'] = commonUtil::stripSlashes($_POST['emailserver']);
     $this->B->tpl_data['email'] = commonUtil::stripSlashes($_POST['email']);
     $this->B->tpl_data['description'] = commonUtil::stripSlashes($_POST['description']);
     $this->B->tpl_data['status'] = $_POST['status'];
 }
 /**
  * reset the form fields with old user data
  *
  * @access privat
  */
 function _reset_old_fields_data()
 {
     // if empty assign form field with old values
     $this->B->tpl_data['subject'] = commonUtil::stripSlashes($_POST['subject']);
     $this->B->tpl_data['body'] = commonUtil::stripSlashes($_POST['body']);
     $this->B->tpl_data['mid'] = $_POST['mid'];
     $this->B->tpl_data['lid'] = $_POST['lid'];
     $this->B->tpl_data['pageID'] = $_POST['pageID'];
 }
 /**
  * reset the form fields with old user data
  *
  * @access privat
  */
 function _reset_old_fields_data()
 {
     // if empty assign form field with old values
     $this->B->form_forename = htmlspecialchars(commonUtil::stripSlashes($_POST['forename']));
     $this->B->form_lastname = htmlspecialchars(commonUtil::stripSlashes($_POST['lastname']));
     $this->B->form_email = htmlspecialchars(commonUtil::stripSlashes($_POST['email']));
     $this->B->form_login = htmlspecialchars(commonUtil::stripSlashes($_POST['login']));
     $this->B->form_passwd = htmlspecialchars(commonUtil::stripSlashes($_POST['passwd']));
 }
Esempio n. 10
0
 /**
  * check if user is registered
  *
  * @access privat
  */
 function _auth()
 {
     if ($this->B->auth->is_user !== FALSE) {
         return TRUE;
     } else {
         $query = base64_encode(commonUtil::getQueryString());
         @header('Location: ' . SF_BASE_LOCATION . '/index.php?tpl=login&ret=' . $query);
         exit;
     }
 }
 /**
  * Check if version number has changed and perfom additional upgarde code
  * Furthermore assign array with module menu names for the top right
  * module html seletor
  *
  * @param array $data
  */
 function perform($data)
 {
     // get data of the client browser
     $this->_get_client_data();
     // get os related separator to set include path
     if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
         $tmp_separator = ';';
     } else {
         $tmp_separator = ':';
     }
     // set include path to the PEAR packages
     ini_set('include_path', SF_BASE_DIR . 'modules/common/PEAR' . $tmp_separator . ini_get('include_path'));
     unset($tmp_separator);
     // set charset to utf-8
     ini_set('default_charset', 'utf-8');
     @header('Content-type: text/html; charset=utf-8');
     // Define base location
     define('SF_BASE_LOCATION', commonUtil::base_location());
     // init system config array
     $this->B->sys = array();
     // include system config array $this->B->sys
     if (file_exists(SF_BASE_DIR . 'data/common/config/config.php')) {
         include_once SF_BASE_DIR . 'data/common/config/config.php';
     }
     // if setup was done
     if ($this->B->sys['info']['status'] == TRUE) {
         // here you may create db connection and start a session.
         // .... things, which are required by all other modules
         // include session class
         include_once SF_BASE_DIR . 'modules/common/includes/class.session.php';
         @ob_start();
         /* Create new object of session class */
         $this->B->session =& new session();
         @ob_end_flush();
     } else {
         // switch to the admin section if we comes from the public section
         if (SF_SECTION == 'public') {
             @header('Location: ' . SF_BASE_LOCATION . '/' . SF_CONTROLLER . '?' . SF_ADMIN_CODE . '=1');
             exit;
         }
         // launch setup screen
         M(MOD_SYSTEM, 'get_view', array('m' => 'setup', 'view' => 'index'));
         // Send the output buffer to the client
         ob_end_flush();
         exit;
     }
     // Check for upgrade
     if (MOD_COMMON_VERSION != (string) $this->B->sys['module']['common']['version']) {
         // set the new version num of this module
         $this->B->sys['module']['common']['version'] = MOD_COMMON_VERSION;
         $this->B->system_update_flag = TRUE;
         // include here additional upgrade code
     }
     return SF_IS_VALID_ACTION;
 }
 /**
  * Delete email list data and attachement folder
  *
  * @param array $data
  */
 function perform($data)
 {
     if (empty($data['lid'])) {
         return FALSE;
     }
     // get list attachement folder
     $sql = "\n            SELECT\n                folder\n            FROM\n                {$this->B->sys['db']['table_prefix']}earchive_lists \n            WHERE\n                lid={$data['lid']}";
     $result = $this->B->db->query($sql);
     if (MDB2::isError($result)) {
         trigger_error($result->getMessage() . "\n\nINFO: " . $result->userinfo . "\n\nFILE: " . __FILE__ . "\nLINE: " . __LINE__, E_USER_ERROR);
         return FALSE;
     }
     $row =& $result->fetchRow(MDB2_FETCHMODE_ASSOC);
     $folder = $row['folder'];
     $path = SF_BASE_DIR . 'data/earchive/' . $folder;
     if (!empty($folder) && @is_dir($path)) {
         // delete attachements folder for this list
         commonUtil::delete_dir_tree($path);
     }
     // delete list
     $sql = "\n            DELETE FROM \n                {$this->B->sys['db']['table_prefix']}earchive_lists\n            WHERE\n                lid={$data['lid']}";
     $result = $this->B->db->query($sql);
     if (MDB2::isError($result)) {
         trigger_error($result->getMessage() . "\n\nINFO: " . $result->userinfo . "\n\nFILE: " . __FILE__ . "\nLINE: " . __LINE__, E_USER_ERROR);
         return FALSE;
     }
     // delete list messages
     $sql = "\n            DELETE FROM \n                {$this->B->sys['db']['table_prefix']}earchive_messages\n            WHERE\n                lid={$data['lid']}";
     $result = $this->B->db->query($sql);
     if (MDB2::isError($result)) {
         trigger_error($result->getMessage() . "\n\nINFO: " . $result->userinfo . "\n\nFILE: " . __FILE__ . "\nLINE: " . __LINE__, E_USER_ERROR);
         return FALSE;
     }
     // delete list messages
     $sql = "\n            DELETE FROM \n                {$this->B->sys['db']['table_prefix']}earchive_attach\n            WHERE\n                lid={$data['lid']}";
     $result = $this->B->db->query($sql);
     if (MDB2::isError($result)) {
         trigger_error($result->getMessage() . "\n\nINFO: " . $result->userinfo . "\n\nFILE: " . __FILE__ . "\nLINE: " . __LINE__, E_USER_ERROR);
         return FALSE;
     }
     // delete list messages word indexes
     $sql = "\n            DELETE FROM \n                {$this->B->sys['db']['table_prefix']}earchive_words_crc32\n            WHERE\n                lid={$data['lid']}";
     $result = $this->B->db->query($sql);
     if (MDB2::isError($result)) {
         trigger_error($result->getMessage() . "\n\nINFO: " . $result->userinfo . "\n\nFILE: " . __FILE__ . "\nLINE: " . __LINE__, E_USER_ERROR);
         return FALSE;
     }
     return TRUE;
 }
 /**
  * Set options for this module
  *
  * @param array $data
  */
 function perform($data)
 {
     $fields = array('mid', 'lid', 'subject', 'body', 'sender');
     $result = $this->_get_all_messages($fields);
     if (FALSE !== $result) {
         while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) {
             $content = '';
             $content .= commonUtil::stripslashes($row['sender']);
             $content .= commonUtil::stripslashes($row['subject']);
             $content .= commonUtil::stripslashes($row['body']);
             M(MOD_EARCHIVE, 'word_indexer', array('content' => $content, 'mid' => $row['mid'], 'lid' => $row['lid'], 'rebuild' => true));
         }
         return TRUE;
     }
     return FALSE;
 }
 /**
  * Do setup for this module
  *
  * @param array $data
  */
 function perform($data = FALSE)
 {
     // launch setup
     if ($_POST['do_setup']) {
         if (FALSE == M(MOD_SETUP, 'sys_setup')) {
             $this->B->form_host = htmlspecialchars(commonUtil::stripSlashes($_POST['dbhost']));
             $this->B->form_user = htmlspecialchars(commonUtil::stripSlashes($_POST['dbuser']));
             $this->B->form_dbname = htmlspecialchars(commonUtil::stripSlashes($_POST['dbname']));
             $this->B->form_tableprefix = htmlspecialchars(commonUtil::stripSlashes($_POST['dbtablesprefix']));
             $this->B->form_sysname = htmlspecialchars(commonUtil::stripSlashes($_POST['sysname']));
             $this->B->form_syslastname = htmlspecialchars(commonUtil::stripSlashes($_POST['syslastname']));
             $this->B->form_syslogin = htmlspecialchars(commonUtil::stripSlashes($_POST['syslogin']));
         }
     }
     return TRUE;
 }
 /**
  * Do setup for this module
  *
  * @param array $data
  */
 function perform($data)
 {
     // launch setup
     if ($_POST['do_setup']) {
         $_data = array('dbhost' => (string) $_POST['dbhost'], 'dbuser' => (string) $_POST['dbuser'], 'dbpasswd' => (string) $_POST['dbpasswd'], 'dbname' => (string) $_POST['dbname'], 'dbtype' => (string) $_POST['dbtype'], 'dbtablesprefix' => (string) $_POST['dbtablesprefix'], 'dbcreate' => (string) $_POST['create_db'], 'charset' => (string) $_POST['charset'], 'userlogin' => (string) $_POST['userlogin'], 'username' => (string) $_POST['username'], 'userlastname' => (string) $_POST['userlastname'], 'userpasswd1' => (string) $_POST['userpasswd1'], 'userpasswd2' => (string) $_POST['userpasswd2']);
         if (FALSE == $this->B->M(MOD_SETUP, 'sys_setup', $_data)) {
             $this->B->form_host = htmlspecialchars(commonUtil::stripSlashes($_POST['dbhost']));
             $this->B->form_user = htmlspecialchars(commonUtil::stripSlashes($_POST['dbuser']));
             $this->B->form_dbname = htmlspecialchars(commonUtil::stripSlashes($_POST['dbname']));
             $this->B->form_tableprefix = htmlspecialchars(commonUtil::stripSlashes($_POST['dbtablesprefix']));
             $this->B->form_sysname = htmlspecialchars(commonUtil::stripSlashes($_POST['username']));
             $this->B->form_syslastname = htmlspecialchars(commonUtil::stripSlashes($_POST['userlastname']));
             $this->B->form_syslogin = htmlspecialchars(commonUtil::stripSlashes($_POST['userlogin']));
         }
     }
     return TRUE;
 }
 /**
  * Set options for this module
  *
  * @param array $data
  */
 function perform($data)
 {
     include_once SF_BASE_DIR . 'modules/common/includes/class.sfWordIndexer.php';
     $word_indexer =& new word_indexer();
     $fields = array('mid', 'lid', 'subject', 'body', 'sender');
     $result = $this->_get_all_messages($fields);
     if (FALSE !== $result) {
         while ($row =& $result->fetchRow(MDB2_FETCHMODE_ASSOC)) {
             $content = '';
             $content .= commonUtil::stripslashes($row['sender']);
             $content .= commonUtil::stripslashes($row['subject']);
             $content .= commonUtil::stripslashes($row['body']);
             $word_indexer->indexing_words($content, 'earchive_words_crc32', array('mid' => $row['mid'], 'lid' => $row['lid']), TRUE);
         }
         return TRUE;
     }
     return FALSE;
 }
 /**
  * add_registered_user_data
  *
  * @param int $uid user ID
  * @return mixed md5_str|false
  */
 function _add_registered_user_data($uid)
 {
     $md5_str = commonUtil::unique_md5_str();
     $_time = date("Y-m-d H:i:s", time());
     $sql = '
         INSERT INTO 
             ' . $this->B->sys['db']['table_prefix'] . 'user_registered
             (uid,md5_str,reg_date)
         VALUES
             (' . $uid . ',
              "' . $md5_str . '",
              "' . $_time . '")';
     $res = $this->B->db->query($sql);
     if (DB::isError($res)) {
         trigger_error($res->getMessage() . "\n" . $res->userinfo . "\n\nFILE: " . __FILE__ . "\nLINE: " . __LINE__, E_USER_ERROR);
         return FALSE;
     }
     return $md5_str;
 }
 /**
  * delete_dir_tree
  *
  * Delete directory and content recursive
  *
  * @param string $dir Directory
  */
 function delete_dir_tree($dir)
 {
     if (($handle = @opendir($dir)) != FALSE) {
         while (($file = readdir($handle)) != false) {
             if ($file == "." || $file == "..") {
                 continue;
             }
             if (@is_dir($dir . '/' . $file)) {
                 commonUtil::delete_dir_tree($dir . '/' . $file);
             } else {
                 if (@unlink($dir . '/' . $file) == FALSE) {
                     trigger_error("Can not delete content in dir tree: {$dir}/{$file}", E_USER_ERROR);
                 }
             }
         }
         @closedir($handle);
         if (@rmdir($dir) == FALSE) {
             trigger_error("Can not remvoe dir: {$dir}", E_USER_ERROR);
         }
     } else {
         trigger_error("Can not delete content dir: {$dir}", E_USER_ERROR);
     }
 }
 /**
  * reset the form fields with old user data
  *
  * @access privat
  */
 function _reset_old_fields_data()
 {
     $this->B->tpl_title = str_replace("'", "'", commonUtil::stripSlashes($_POST['title']));
     $this->B->tpl_body = commonUtil::stripSlashes($_POST['body']);
 }
Esempio n. 20
0
  <tr bgcolor="#666699">
    <td colspan="2"><span class="style1">&nbsp;&nbsp;&nbsp;Options Management</span></td>
  </tr>
  <tr>
    <td width="86%" align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="76%" align="left" valign="top">
    <form action="index.php?admin=1&m=option" method="post" name="email" id="email">
        <table width="100%"  border="0" cellspacing="4" cellpadding="4">
          <tr>
            <td colspan="2" align="left" valign="top"><span class="optiontitle">Administrator email</span></td>
          </tr>
          <tr>
            <td width="87%" align="left" valign="top">
              <input name="site_email" type="text" size="70" maxlength="1024" value="<?php 
echo htmlspecialchars(commonUtil::stripSlashes_special($B->sys['option']['email']));
?>
">
              &nbsp; 
            </td>
            <td width="13%" align="left" valign="top"><input type="submit" name="update_main_options_email" value="update" onclick="subok(this.form.update_main_options_email);"></td>
          </tr>
        </table>   
    </form> 
    <form action="index.php?admin=1&m=option" method="post" name="title" id="title">    
        <table width="100%"  border="0" cellspacing="4" cellpadding="4">
          <tr>
            <td colspan="2" align="left" valign="top"><span class="optiontitle">Site title and description </span></td>
          </tr>
          <tr>
            <td width="87%" align="left" valign="top">  
Esempio n. 21
0
    return FALSE;
}
// create table if it dosent exist
$sql = "CREATE TABLE IF NOT EXISTS {$this->B->conf_val['db']['table_prefix']}user_registered (\n        uid      INT(11) NOT NULL,\n        md5_str  CHAR(32) NOT NULL default '',\n        reg_date DATETIME NOT NULL default '0000-00-00 00:00:00')";
$result = $this->B->db->query($sql);
if (DB::isError($result)) {
    trigger_error($result->getMessage() . "\n" . $result->userinfo . "\n\nFILE: " . __FILE__ . "\nLINE: " . __LINE__, E_USER_ERROR);
    $this->B->setup_error[] = $result->getMessage() . "\n\nINFO: " . $result->userinfo . "\n\nFILE: " . __FILE__ . "\nLINE: " . __LINE__;
    $success = FALSE;
    return FALSE;
}
if ($success != FALSE) {
    // insert an administrator
    $forename = $this->B->db->quoteSmart(commonUtil::stripSlashes($_POST['sysname']));
    $lastename = $this->B->db->quoteSmart(commonUtil::stripSlashes($_POST['syslastname']));
    $login = $this->B->db->quoteSmart(commonUtil::stripSlashes($_POST['syslogin']));
    $passwd = $this->B->db->quoteSmart(md5($_POST['syspassword1']));
    $uid = $this->B->db->nextId($this->B->conf_val['db']['table_prefix'] . 'user_seq_add_user');
    if (DB::isError($uid)) {
        trigger_error($uid->getMessage() . "\n" . $uid->userinfo . "\n\nFILE: " . __FILE__ . "\nLINE: " . __LINE__, E_USER_ERROR);
        $success = FALSE;
        return FALSE;
    }
    $sql = 'INSERT INTO ' . $this->B->conf_val['db']['table_prefix'] . 'user_users 
                (uid,forename,lastname,login,passwd,status,rights) 
              VALUES 
                (' . $uid . ',' . $forename . ',' . $lastename . ',' . $login . ',' . $passwd . ',2,5)';
    $result = $this->B->db->query($sql);
    if (DB::isError($result)) {
        trigger_error($result->getMessage() . "\n" . $result->userinfo . "\n\nFILE: " . __FILE__ . "\nLINE: " . __LINE__, E_USER_ERROR);
        $this->B->setup_error[] = $result->getMessage() . "\n\nINFO: " . $result->userinfo . "\n\nFILE: " . __FILE__ . "\nLINE: " . __LINE__;
 /**
  * get child nodes sorted by order
  *
  * @param array $data
  */
 function &getChildren(&$data)
 {
     $tmp = array();
     foreach ($this->B->node as $key => $val) {
         if ($val['parent_id'] == $data['node']) {
             if (isset($data['status'])) {
                 if ($val['status'] == $data['status']) {
                     $tmp[$val['order']] = $key;
                 }
                 continue;
             }
             $tmp[$val['order']] = $key;
         }
     }
     // ordered
     ksort($tmp);
     $result = array();
     foreach ($tmp as $val) {
         $result[$val]['title'] = commonUtil::transform($this->B->node[$val]['title']);
         $result[$val]['status'] = $this->B->node[$val]['status'];
         $result[$val]['order'] = $this->B->node[$val]['order'];
         $result[$val]['parent_id'] = $this->B->node[$val]['parent_id'];
     }
     unset($tmp);
     return $result;
 }
 /**
  * delete message and all related data
  *
  * @param int $mid message id
  */
 function delete_message($mid)
 {
     // get attachments folder
     $fields = array('lid', 'folder');
     $data = $this->get_message($mid, $fields);
     $l_data = $this->get_list($data['lid'], $fields);
     $path = SF_BASE_DIR . '/data/earchive/' . $l_data['folder'] . '/' . $data['folder'];
     if (!empty($data['folder']) && @is_dir($path)) {
         // delete attachements folder for this list
         commonUtil::delete_dir_tree($path);
     }
     // delete list messages
     $sql = "\n            DELETE FROM \n                {$GLOBALS['B']->sys['db']['table_prefix']}earchive_messages\n            WHERE\n                mid={$mid}";
     $GLOBALS['B']->db->query($sql);
     // delete list messages
     $sql = "\n            DELETE FROM \n                {$GLOBALS['B']->sys['db']['table_prefix']}earchive_attach\n            WHERE\n                mid={$mid}";
     $GLOBALS['B']->db->query($sql);
     // delete list messages word indexes
     $sql = "\n            DELETE FROM \n                {$GLOBALS['B']->sys['db']['table_prefix']}earchive_words_crc32\n            WHERE\n                mid={$mid}";
     $GLOBALS['B']->db->query($sql);
 }
 /**
  * reset the form fields with old user data
  *
  * @access privat
  */
 function _reset_old_fields_data()
 {
     $this->B->tpl_data['forename'] = htmlspecialchars(commonUtil::stripSlashes($_POST['forename']));
     $this->B->tpl_data['lastname'] = htmlspecialchars(commonUtil::stripSlashes($_POST['lastname']));
     $this->B->tpl_data['email'] = htmlspecialchars(commonUtil::stripSlashes($_POST['email']));
     $this->B->tpl_data['login'] = htmlspecialchars(commonUtil::stripSlashes($_POST['_login']));
     $this->B->tpl_data['passwd'] = htmlspecialchars(commonUtil::stripSlashes($_POST['passwd']));
     $this->B->tpl_data['rights'] = $_POST['rights'];
     $this->B->tpl_data['status'] = $_POST['status'];
 }
 /**
  * create unique node id
  *
  * @return int
  */
 function &createUniqueId()
 {
     // make node id
     $node_id = commonUtil::unique_crc32();
     while (isset($this->B->node[$node_id])) {
         $node_id = commonUtil::unique_crc32();
     }
     return $node_id;
 }
Esempio n. 26
0
// Modify list data
if (isset($_POST['editlist'])) {
    // check if some fields are empty
    if (empty($_POST['name']) || empty($_POST['emailserver']) || empty($_POST['email'])) {
        $B->form_error = 'You have fill out all fields!';
    } else {
        // add new user
        $B->tmp_data = array('name' => $B->db->quoteSmart(commonUtil::stripSlashes($_POST['name'])), 'emailserver' => $B->db->quoteSmart(commonUtil::stripSlashes($_POST['emailserver'])), 'email' => $B->db->quoteSmart(commonUtil::stripSlashes($_POST['email'])), 'description' => $B->db->quoteSmart(commonUtil::stripSlashes($_POST['description'])), 'status' => (int) $_POST['status']);
        // update list data
        if (FALSE !== $B->earchive->update_list((int) $_REQUEST['lid'], $B->tmp_data)) {
            @header('Location: index.php?m=EARCHIVE');
            exit;
        } else {
            $B->form_error = 'Error during update. Try again!';
        }
    }
} else {
    // get list data
    $B->tmp_fields = array('lid', 'name', 'status', 'email', 'emailserver', 'description');
    $B->tpl_data = $B->earchive->get_list((int) $_REQUEST['lid'], $B->tmp_fields);
    unset($B->tmp_fields);
}
// if error restore the form fields values
if (!empty($B->form_error)) {
    // if empty assign form field with old values
    $B->tpl_data['name'] = commonUtil::stripSlashes($_POST['name']);
    $B->tpl_data['emailserver'] = commonUtil::stripSlashes($_POST['emailserver']);
    $B->tpl_data['email'] = commonUtil::stripSlashes($_POST['email']);
    $B->tpl_data['description'] = commonUtil::stripSlashes($_POST['description']);
    $B->tpl_data['status'] = $_POST['status'];
}
function earchive_event_handler($evt)
{
    global $B;
    switch ($evt["code"]) {
        case EVT_LOAD_MODULE:
            // earchive rights class
            include SF_BASE_DIR . '/admin/modules/earchive/class.rights.php';
            // check if the login user have rights to access this module
            // 4 or 5 required (editor or administrator)
            if (FALSE == earchive_rights::ask_access_to_list()) {
                @header('Location: ' . SF_BASE_LOCATION . '/admin/index.php');
                exit;
            }
            // load this module
            include SF_BASE_DIR . '/admin/modules/earchive/module_loader.php';
            break;
        case EVT_INIT:
            // check for install or upgrade
            if (MOD_EARCHIVE_VERSION != (string) $B->sys['module']['earchive']['version']) {
                // set the new version num of this module
                $B->sys['module']['earchive']['version'] = MOD_EARCHIVE_VERSION;
                $B->system_update_flag = TRUE;
            }
            break;
        case EVT_LOGOUT:
            break;
        case EVT_SET_OPTIONS:
            // set user options
            // this event comes from the option module (module_loader.php)
            if (isset($_POST['update_earchive_options_wordindex']) && !empty($_POST['earchive_rebuild_index'])) {
                // the earchive class
                include_once SF_BASE_DIR . '/admin/modules/earchive/class.earchive.php';
                $earchiver =& new earchive();
                include_once SF_BASE_DIR . '/admin/modules/common/class.sfWordIndexer.php';
                $word_indexer =& new word_indexer();
                $fields = array('mid', 'lid', 'subject', 'body', 'sender');
                $result = $earchiver->get_all_messages($fields);
                if (is_object($result)) {
                    while ($row =& $result->FetchRow(DB_FETCHMODE_ASSOC)) {
                        $content = '';
                        $content .= commonUtil::stripslashes($row['sender']);
                        $content .= commonUtil::stripslashes($row['subject']);
                        $content .= commonUtil::stripslashes($row['body']);
                        $word_indexer->indexing_words($content, 'earchive_words_crc32', array('mid' => $row['mid'], 'lid' => $row['lid']), TRUE);
                    }
                }
            }
            // set user options
            // this event comes from the option module (module_loader.php)
            if (isset($_POST['update_earchive_options_fetchemails']) && !empty($_POST['earchive_fetch_emails'])) {
                // the earchive class
                include_once SF_BASE_DIR . '/admin/modules/earchive/fetch_emails.php';
            }
            break;
        case EVT_GET_OPTIONS:
            // get earchive options template
            // to include in the option module
            $B->mod_option[] = SF_BASE_DIR . '/admin/modules/earchive/templates/option.tpl.php';
            break;
        case EVT_SETUP:
            $success = TRUE;
            include SF_BASE_DIR . '/admin/modules/earchive/_setup.php';
            return $success;
            break;
    }
}
Esempio n. 28
0
 $body = $msg->getBody($mid, $pid);
 $mbody = '';
 if ($body['ftype'] == 'text/plain') {
     $mess = str_replace("<", "&lt;", $body['message']);
     $mess = str_replace(">", "&gt;", $mess);
     $data['body'] = $this->B->db->quoteSmart(nl2br($this->B->e_util->html_activate_links($mess)));
 } else {
     $data['body'] = $this->B->db->quoteSmart($body['message']);
 }
 $mes_folder = FALSE;
 $is_attach = FALSE;
 // check if there are attachments attachments
 if (isset($msg->attachPid[$mid]) && count($msg->attachPid[$mid]) > 0) {
     $is_attach = TRUE;
     // get list messages attachment folder string
     $mes_folder = commonUtil::unique_md5_str();
     $data['folder'] = $this->B->db->quoteSmart($mes_folder);
 } else {
     $data['folder'] = '0';
 }
 $_content = '';
 if (FALSE === ($message_id = $this->B->earchive->add_message($data))) {
     trigger_error('Cannot add message: ' . var_export($data) . __FILE__ . ' ' . __LINE__, E_USER_ERROR);
     continue;
     // switch to next message
 }
 // index content
 $_content = $data['subject'] . ' ' . $data['sender'] . ' ' . $data['body'];
 $word_indexer->indexing_words($_content, 'earchive_words_crc32', array('mid' => $message_id, 'lid' => $account['lid']));
 // Now the attachments
 if (TRUE === $is_attach) {
Esempio n. 29
0
$B->form_rights = '';
$B->form_status = '';
// Check if some form fields are empty
if (empty($_POST['forename']) || empty($_POST['lastname']) || empty($_POST['email']) || empty($_POST['login']) || empty($_POST['passwd'])) {
    // if empty assign form field with old values
    $B->form_forename = htmlspecialchars(commonUtil::stripSlashes($_POST['forename']));
    $B->form_lastname = htmlspecialchars(commonUtil::stripSlashes($_POST['lastname']));
    $B->form_email = htmlspecialchars(commonUtil::stripSlashes($_POST['email']));
    $B->form_login = htmlspecialchars(commonUtil::stripSlashes($_POST['login']));
    $B->form_passwd = htmlspecialchars(commonUtil::stripSlashes($_POST['passwd']));
    $B->form_rights = $_POST['rights'];
    $B->form_status = $_POST['status'];
    $B->form_error = 'You have fill out all fields!';
} else {
    // add new user
    $B->tmp_data = array('forename' => $B->db->quoteSmart(commonUtil::stripSlashes($_POST['forename'])), 'lastname' => $B->db->quoteSmart(commonUtil::stripSlashes($_POST['lastname'])), 'email' => $B->db->quoteSmart(commonUtil::stripSlashes($_POST['email'])), 'login' => $B->db->quoteSmart(commonUtil::stripSlashes($_POST['login'])), 'passwd' => $B->db->quoteSmart(md5($_POST['passwd'])), 'rights' => (int) $_POST['rights'], 'status' => (int) $_POST['status']);
    if (FALSE !== $B->user->add_user($B->tmp_data)) {
        @header('Location: ' . SF_BASE_LOCATION . '/admin/index.php?m=USER');
        exit;
    } else {
        // on error during add user
        $B->form_forename = htmlspecialchars(commonUtil::stripSlashes($_POST['forename']));
        $B->form_lastname = htmlspecialchars(commonUtil::stripSlashes($_POST['lastname']));
        $B->form_email = htmlspecialchars(commonUtil::stripSlashes($_POST['email']));
        $B->form_login = htmlspecialchars(commonUtil::stripSlashes($_POST['login']));
        $B->form_passwd = htmlspecialchars(commonUtil::stripSlashes($_POST['passwd']));
        $B->form_rights = $_POST['rights'];
        $B->form_status = $_POST['status'];
        $B->form_error = 'This login exist. Chose an other one!';
    }
}
Esempio n. 30
0
          </tr>
        </table>   
    </form> 
    <form action="index.php?m=OPTION" method="post" name="title" id="title">    
        <table width="100%"  border="0" cellspacing="4" cellpadding="4">
          <tr>
            <td colspan="2" align="left" valign="top"><span class="optiontitle">Site title and description </span></td>
          </tr>
          <tr>
            <td width="87%" align="left" valign="top">  
                <input name="site_title" type="text" size="70" maxlength="1024" value="<?php 
echo htmlspecialchars(commonUtil::stripSlashes($B->sys['option']['site_title']));
?>
">
                <textarea name="site_desc" cols="50" rows="3" wrap="virtual"><?php 
echo htmlspecialchars(commonUtil::stripSlashes($B->sys['option']['site_desc']));
?>
</textarea>
                &nbsp; 
            </td>
            <td width="13%" align="left" valign="top"><input type="submit" name="update_main_options_title" value="update" onclick="subok(this.form.update_main_options_title);"></td>
          </tr>
        </table> 
    </form>  
    <form action="index.php?m=OPTION" method="post" name="charset" id="charset">              
        <table width="100%"  border="0" cellspacing="4" cellpadding="4">
          <tr>
            <td colspan="2" align="left" valign="top"><span class="optiontitle">Charset</span></td>
          </tr>
          <tr>
            <td width="37%" align="left" valign="top">