Example #1
0
function load_tickets($user, $pass, $sanad_record_ids)
{
    $tmp_arr = array();
    $my = new mysql_class();
    $u = new user_class();
    $u->loadByUser($user);
    $customer_id = $u->customer_id;
    $my->ex_sql("select * from ticket where customer_id={$customer_id} and  sanad_record_id in ({$sanad_record_ids})", $q);
    foreach ($q as $r) {
        $tick = new ticket_class();
        //$tick->id = (int)$r['id'];
        unset($tick->sanad_record_id);
        $tick->fname = $r["fname"];
        $tick->lname = $r["lname"];
        $tick->tel = $r["tel"];
        $tick->adult = (int) $r["adult"];
        $tick->rahgiri = (int) $r["sanad_record_id"];
        $tick->parvaz_det_id = (int) $r["parvaz_det_id"];
        $tick->customer_id = (int) $r["customer_id"];
        $tick->user_id = (int) $r["user_id"];
        $tick->shomare = (int) $r["shomare"];
        $tick->typ = (int) $r["typ"];
        $tick->en = (int) $r["en"];
        $tick->regtime = $r["regtime"];
        $tick->mablagh = (int) $r["mablagh"];
        $tick->tour_mablagh = (int) $r["tour_mablagh"];
        $tick->poorsant = (int) $r["poorsant"];
        $tick->gender = (int) $r["gender"];
        $tmp_arr[] = $tick;
    }
    $out = xml_class::export($tmp_arr);
    return $out;
}
Example #2
0
function reserve_tmp_time($user, $enc_pass, $reserve_tmp_ids)
{
    $out = "auth_error";
    if (user_class::is_authonticated($enc_pass, $user)) {
        $out = reserve_tmp_class::load_reserve_tmp_times_by_ids($reserve_tmp_ids);
    }
    return $out;
}
Example #3
0
function reserve_tmp_remove($user, $enc_pass, $tmp_ids)
{
    $out = "auth_error";
    if (user_class::is_authonticated($enc_pass, $user)) {
        ticket_class::removeTmp($tmp_ids);
        $out = "OK";
    }
    return $out;
}
Example #4
0
function reserve_tmp($user, $enc_pass, $parvaz_det_ids, $tedad)
{
    $out = "auth_error";
    if (user_class::is_authonticated($enc_pass, $user)) {
        $u = new user_class();
        $u->loadByUser($user);
        $timeout = 5;
        $parvaz_det_ids_array = explode(',', $parvaz_det_ids);
        $out_array = array();
        foreach ($parvaz_det_ids_array as $parvaz_det_id) {
            $out_array[] = ticket_class::addTmp($parvaz_det_id, $tedad, $timeout, $u->customer_id);
            $p = new parvaz_det_class($parvaz_det_id);
            $p->setZarfiat($tedad, $u->customer_id);
        }
        $out = count($out_array) > 0 ? implode('|', $out_array) : 'false';
    }
    return $out;
}
Example #5
0
function city($user, $pass)
{
    $out = 'auth_error';
    if (user_class::is_authonticated($pass, $user)) {
        $tmp_arr = array();
        $my = new mysql_class();
        $my->ex_sql("select * from shahr order by name", $q);
        $out = xml_class::export($q);
    }
    return $out;
}
Example #6
0
function dabel($user, $enc_pass, $id)
{
    $id = (int) $id;
    $out = "auth_error";
    if (user_class::is_authonticated($enc_pass, $user)) {
        $my = new mysql_class();
        $my->ex_sql("select jid from parvaz_jid where parvaz_det_id = {$id}", $q);
        $out = xml_class::export($q);
    }
    return $out;
}
Example #7
0
function search($user, $enc_pass, $st_date, $en_date, $st_city_id, $en_city_id, $load_go_return, $load_both_ways, $load_phone)
{
    $out = "auth_error";
    if (user_class::is_authonticated($enc_pass, $user)) {
        $fieldsArray = array('parvaz_det.id', 'ghimat', 'zarfiat', 'mabda_id', 'maghsad_id', 'shomare', 'havapiema_id', 'sherkat_id', 'tarikh', 'saat', 'saat_kh', 'j_id');
        $fields = implode(',', $fieldsArray);
        $whereClause = '';
        $leftJoin = FALSE;
        $hasOr = (int) trim($load_both_ways) == 1 || trim($load_both_ways) == '';
        if (trim($st_date) != '' && strtotime(trim($st_date)) > strtotime(date("Y-m-d"))) {
            $whereClause .= ($whereClause == '' ? '' : ' and ') . '  date(tarikh) >= \'' . date("Y-m-d", strtotime($st_date)) . '\'';
        } else {
            $whereClause .= ($whereClause == '' ? '' : ' and ') . '  date(tarikh) >= \'' . date("Y-m-d") . '\'';
        }
        if (trim($en_date) != '') {
            $whereClause .= ($whereClause == '' ? '' : ' and ') . '  date(tarikh) <= \'' . date("Y-m-d", strtotime($en_date)) . '\'';
        }
        if ((int) trim($st_city_id) > 0) {
            $whereClause .= ($whereClause == '' ? '' : ' and ') . ($hasOr ? '((' : '') . '  mabda_id = ' . trim($st_city_id) . ' ' . ($hasOr && (int) trim($en_city_id) <= 0 ? ') or (' : '');
            $leftJoin = TRUE;
        }
        if ((int) trim($en_city_id) > 0) {
            $whereClause .= ($whereClause == '' ? '' : ' and ') . ($hasOr && (int) trim($st_city_id) <= 0 ? '((' : '') . '  maghsad_id = ' . trim($en_city_id) . ' ' . ($hasOr ? ') or (' : '');
            $leftJoin = TRUE;
        }
        if ($hasOr) {
            if ((int) trim($st_city_id) > 0) {
                $whereClause .= '  maghsad_id = ' . trim($st_city_id) . ' ' . ($hasOr && (int) trim($en_city_id) <= 0 ? '))' : '');
            }
            if ((int) trim($en_city_id) > 0) {
                $whereClause .= ($whereClause != '' && (int) trim($st_city_id) > 0 ? ' and ' : '') . '  mabda_id = ' . trim($en_city_id) . ' ' . ($hasOr ? '))' : '');
            }
        }
        $whereClause = ' where ' . $whereClause;
        $searchQuery = "select {$fields} from parvaz_det left join parvaz on (parvaz.id=parvaz_id)  {$whereClause}";
        $my = new mysql_class();
        $my->ex_sql($searchQuery, $q);
        /*
        			foreach($q as $in=>$r)
        			{
        				$r['jid'] = (int)trim($r['jid']);
        				$q[$in] = $r;
        			}
        			//$out = $q;
        */
        $out = xml_class::export($q);
        //$searchQuery
    }
    //return($searchQuery);
    return $out;
}
Example #8
0
function havapeima($user, $pass)
{
    $out = 'auth_error';
    if (user_class::is_authonticated($pass, $user)) {
        $tmp_arr = array();
        $my = new mysql_class();
        $my->ex_sql("select * from havapeima order by name", $q);
        foreach ($q as $r) {
            $tmp_arr[] = array('id' => $r['id'], 'name' => $r['name']);
        }
        $out = xml_class::export($tmp_arr);
    }
    return $out;
}
Example #9
0
function flight($user, $pass, $flight_id)
{
    $out = 'auth_error';
    if (user_class::is_authonticated($pass, $user)) {
        $tmp_arr = array();
        $fieldsArray = array('parvaz_det.id', 'ghimat', 'zarfiat', 'mabda_id', 'maghsad_id', 'shomare', 'havapiema_id', 'sherkat_id', 'tarikh', 'saat', 'saat_kh', 'j_id');
        $my = new mysql_class();
        $feildStr = '';
        foreach ($fieldsArray as $i => $str) {
            $feildStr .= ($feildStr == '' ? '' : ',') . $str;
        }
        $my->ex_sql("select {$feildStr} from parvaz_det left join parvaz on (parvaz_det.parvaz_id=parvaz.id) where parvaz_det.id={$flight_id}  order by tarikh", $q);
        //foreach($q as $r)
        $out = xml_class::export($q);
    }
    return $out;
}
Example #10
0
 public function insertUser()
 {
     $a = user_class::checkAvalibility(mysql_real_escape_string($this->username));
     if ($a == 0) {
         return "Username id alredy exsist";
     } else {
         $con = getConnection::connectToDatabase();
         getConnection::selectDatabase($con);
         try {
             $this->password = sha1($this->password);
             $this->mysqlfor();
             $sql = "INSERT INTO `user` (`username`, `password`, `role_id`) VALUES ('{$this->username}', '{$this->password}', '{$this->role_id}');";
             if (!mysqli_query($con, $sql)) {
                 throw new Exception("Cannot Insert Data");
             } else {
                 return 1;
             }
         } catch (Exception $e) {
             return 'Message: ' . $e->getMessage();
         }
         getConnection::closeConnection($con);
     }
 }
Example #11
0
<?php

//if(!isset($_SERVER['HTTP_REFERER'])){
//    header("location: ../../access_denied.php?data=You don't have direct access to this page");
//}
require_once 'db/user_class.php';
$a = user_class::getRoles();
if ($a === 0) {
    die("There is no roles in database, insert role first");
}
?>
<form method="post" id="addform" name="addform" action="server/users/add_user_server.php"> 

      <label for="userName">Username<span style="color:red;">*</span>:</label>
      <input type="text" id="userName" name="userName" class="text ui-widget-content ui-corner-all"  required maxlength="10" /><button id="check" onclick="checkuname()" type="button">check availability</button><samp id="result" style="color:red"></samp>
	  
      <label for="password">Password<span style="color:red;">*</span>: (8 to 10 character , one special character and one number is required) </label>
      <input type="password" name="password" id="password" pattern="^(?=.*\d+)(?=.*[a-zA-Z])[0-9a-zA-Z!@#$%]{8,10}$" class="text ui-widget-content ui-corner-all" required />
	  
      <label for="confirmPassword">Confirm Password<span style="color:red;">*</span>:</label>
      <input type="password" name="confirmPassword" id="confirmPassword" pattern="^(?=.*\d+)(?=.*[a-zA-Z])[0-9a-zA-Z!@#$%]{8,10}$" class="text ui-widget-content ui-corner-all" required />
      <label for="roleId">Role ID<span style="color:red;">*</span>:</label>
      <select name="roles" id="roles" name="roles" class="text ui-widget-content ui-corner-all" required="true">    
       <?php 
foreach ($a as $x => $x_value) {
    echo '<option value="' . $x . '">' . $x_value . '</option>';
}
?>
    </select><br />
      <button type="submit">Submit</button>
      <button type="reset">Reset</button>
Example #12
0
<?php

if (!isset($_SERVER['HTTP_REFERER'])) {
    header("location: ../../access_denied.php?data=You don't have direct access to this page");
}
require_once '../../db/user_class.php';
require_once '../../db/site_log_class.php';
require_once '../../db/user_class.php';
session_start();
if (!isset($_GET['uname'])) {
    die("go to user management page");
}
$ti = $_GET['uname'];
session_start();
$a = user_class::deleteUser($ti);
$_SESSION['answer'] = $a;
$l = new site_log(NULL, NULL, $_SESSION['user']->username, $_SERVER['REMOTE_ADDR'], $ti . " user details deleted");
$l->insertlog();
header('Location: ../../user_manage_detail.php');
Example #13
0
           <div style="margin-left:10px;">
            <br />
 Search By: <br />
 
        username :<input type="radio" name="search" id="username" value="username" onclick="dispDropdown()"  />
        &nbsp;&nbsp;&nbsp;Date:<input type="radio" name="search" id="calender" value="calender" onclick="dispCalender()"  />
      &nbsp;&nbsp;&nbsp;
       All: <input type="radio" name="search" id="all" value="all" onclick="dispAll(this.value)"  />
        <br/><br/>
        
        <div id="drpDiv" style="display: none">
            <select id="usrDropdown" onchange="userDetails(this.value)">
            <option value="0">--SELECT USERNAME--</option>
            <?php 
require_once 'db/user_class.php';
$users = user_class::getAllUsers();
foreach ($users as $u) {
    echo "<option value=" . $u->username . ">{$u->username}</option>";
}
?>
        </select>
        </div>
        
        <div id="calcDiv" style="display: none">
            <input type="date" id="calc" onchange="loaddate(this.value)" />
        </div>
        <br/><br/>
        
        <div class="CSSTable" id="tableDiv">
            
            
Example #14
0
 /**
  *	Constructor
  */
 public function __construct()
 {
     parent::__construct();
     if (!(getperms('4') || getperms('0'))) {
         return;
     }
     $this->isAdmin = TRUE;
     // We have full class management rights
     $pref = e107::getPref();
     $style = $pref['admincss'] == 'admin_dark.css' ? ' icon-white' : '';
     $this->top_icon = "<i class='icon-user{$style}'></i> ";
 }
Example #15
0
<?php

if (!isset($_SERVER['HTTP_REFERER'])) {
    header("location: ../../access_denied.php?data=You don't have direct access to this page");
}
if (isset($_GET['uname']) && $_GET['uname'] != "") {
    require_once '../../db/user_class.php';
    $r = user_class::checkAvalibility($_GET['uname']);
    echo $r;
} else {
    die("Enter Username First.");
}
Example #16
0
 $changedEUFData = array();
 if (isset($_POST['ue'])) {
     $eufVals = $ue->userExtendedValidateAll($_POST['ue'], varset($_POST['hide'], TRUE));
     // Validate the extended user fields
     $changedEUFData['data'] = validatorClass::findChanges($eufVals['data'], $udata, FALSE);
 }
 // Determine whether we have an error
 $error = isset($allData['errors']) && count($allData['errors']) || isset($eufVals['errors']) && count($eufVals['errors']) || count($extraErrors);
 // Update Userclass - only if its the user changing their own data (admins can do it another way)
 if (isset($allData['data']['user_class'])) {
     unset($changedUserData['user_class']);
     // We always recalculate this
     if (FALSE === $adminEdit) {
         // Make sure admin can't edit another's user classes
         if (!is_object($e_userclass)) {
             $e_userclass = new user_class();
         }
         $ucList = $e_userclass->get_editable_classes(USERCLASS_LIST, TRUE);
         // List of classes which this user can edit
         if (count($ucList)) {
             $nid = $e_userclass->mergeClassLists($udata['user_class'], $ucList, $allData['data']['user_class'], TRUE);
             $nid = $e_userclass->stripFixedClasses($nid);
             $nid = implode(',', $nid);
             //	echo "Userclass data - new: {$nid}, old: {$udata['user_baseclasslist']}, editable: ".implode(',',$ucList).", entered: {$allData['data']['user_class']}<br />";
             if ($nid != $udata['user_baseclasslist']) {
                 if (US_DEBUG) {
                     $admin_log->e_log_event(10, debug_backtrace(), "DEBUG", "Usersettings test", "Write back classes; old list: {$udata['user_class']}; new list: " . $nid, false, LOG_TO_ROLLING);
                 }
                 $changedUserData['user_class'] = $nid;
             }
         }
Example #17
0
 * Search Administration
 *
*/
require_once '../class2.php';
if (!getperms('X')) {
    header('location:' . e_BASE . 'index.php');
    exit;
}
include_lan(e_LANGUAGEDIR . e_LANGUAGE . '/admin/lan_' . e_PAGE);
$e_sub_cat = 'search';
require_once 'auth.php';
require_once e_HANDLER . 'userclass_class.php';
require_once e_HANDLER . 'search_class.php';
$frm = e107::getForm();
$mes = e107::getMessage();
$e_userclass = new user_class();
$query = explode('.', e_QUERY);
$search_prefs = $sysprefs->getArray('search_prefs');
//$search_handlers['news'] = ADLAN_0; // Moved to Plugin
$search_handlers['comments'] = ADLAN_114;
$search_handlers['users'] = SEALAN_7;
//$search_handlers['downloads'] = ADLAN_24; // Moved to Plugin
// $search_handlers['pages'] = SEALAN_39; // Moved to Plugin
foreach ($pref['e_search_list'] as $file) {
    if (!e107::isInstalled($file)) {
        continue;
    }
    if (is_readable(e_PLUGIN . $file . "/e_search.php") && !isset($search_prefs['plug_handlers'][$file])) {
        $search_prefs['plug_handlers'][$file] = array('class' => 0, 'pre_title' => 1, 'pre_title_alt' => '', 'chars' => 150, 'results' => 10);
        $save_search = TRUE;
    }
Example #18
0
        echo $binary_data;
        exit;
    } else {
        header("location:" . e_UPLOAD . str_replace("dl.", "", e_QUERY));
        exit;
    }
}
require_once e_HANDLER . 'upload_handler.php';
require_once "auth.php";
require_once e_HANDLER . 'userclass_class.php';
$gen = new convert();
require_once e_HANDLER . 'form_handler.php';
$rs = new form();
// Need the userclass object for class selectors
if (!is_object($e_userclass)) {
    $e_userclass = new user_class();
}
if (isset($_POST['optionsubmit'])) {
    $temp = array();
    $temp['upload_storagetype'] = $_POST['upload_storagetype'];
    $temp['upload_maxfilesize'] = $_POST['upload_maxfilesize'];
    $temp['upload_class'] = $_POST['upload_class'];
    $temp['upload_enabled'] = FILE_UPLOADS ? $_POST['upload_enabled'] : 0;
    if ($temp['upload_enabled'] && !$sql->db_Select("links", "*", "link_url='upload.php' ")) {
        $sql->db_Insert("links", "0, '" . LAN_UPLOAD . "', 'upload.php', '', '', 1,0,0,0,0");
    }
    if (!$temp['upload_enabled'] && $sql->db_Select("links", "*", "link_url='upload.php' ")) {
        $sql->db_Delete("links", "link_url='upload.php' ");
    }
    if ($admin_log->logArrayDiffs($temp, $pref, 'UPLOAD_02')) {
        save_prefs();
Example #19
0
 /**
  * Render Field Value
  * @param string $field field name
  * @param mixed $value field value
  * @param array $attributes field attributes including render parameters, element options - see e_admin_ui::$fields for required format
  * @return string
  */
 function renderValue($field, $value, $attributes, $id = 0)
 {
     if (!empty($attributes['multilan']) && is_array($value)) {
         $value = varset($value[e_LANGUAGE], '');
     }
     $parms = array();
     if (isset($attributes['readParms'])) {
         if (!is_array($attributes['readParms'])) {
             parse_str($attributes['readParms'], $attributes['readParms']);
         }
         $parms = $attributes['readParms'];
     }
     if (vartrue($attributes['inline'])) {
         $parms['editable'] = true;
     }
     // attribute alias
     if (vartrue($attributes['sort'])) {
         $parms['sort'] = true;
     }
     // attribute alias
     if (!empty($parms['type'])) {
         $attributes['type'] = $parms['type'];
     }
     $this->renderValueTrigger($field, $value, $parms, $id);
     $tp = e107::getParser();
     switch ($field) {
         case 'options':
             if (varset($attributes['type']) == "method") {
                 $attributes['mode'] = "read";
                 if (isset($attributes['method']) && $attributes['method'] && method_exists($this, $attributes['method'])) {
                     $method = $attributes['method'];
                     return $this->{$method}($parms, $value, $id, $attributes);
                 } elseif (method_exists($this, 'options')) {
                     //return  $this->options($field, $value, $attributes, $id);
                     // consistent method arguments, fixed in admin cron administration
                     return $this->options($parms, $value, $id, $attributes);
                     // OLD breaks admin->cron 'options' column
                 }
             }
             if (!$value) {
                 parse_str(str_replace('&amp;', '&', e_QUERY), $query);
                 //FIXME - FIX THIS
                 // keep other vars in tact
                 $query['action'] = 'edit';
                 $query['id'] = $id;
                 //$edit_query = array('mode' => varset($query['mode']), 'action' => varset($query['action']), 'id' => $id);
                 $query = http_build_query($query);
                 $value = "<div class='btn-group'>";
                 if (vartrue($parms['sort'])) {
                     $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
                     $from = intval(vartrue($_GET['from'], 0));
                     $value .= "<a class='e-sort sort-trigger btn btn-default' style='cursor:move' data-target='" . e_SELF . "?mode={$mode}&action=sort&ajax_used=1&from={$from}' title='" . LAN_RE_ORDER . "'>" . ADMIN_SORT_ICON . "</a> ";
                 }
                 $cls = false;
                 if (varset($parms['editClass'])) {
                     $cls = deftrue($parms['editClass']) ? constant($parms['editClass']) : $parms['editClass'];
                 }
                 if ((false === $cls || check_class($cls)) && varset($parms['edit'], 1) == 1) {
                     /*
                     						$value .= "<a href='".e_SELF."?{$query}' class='e-tip btn btn-large' title='".LAN_EDIT."' data-placement='left'>
                     <img class='icon action edit list' src='".ADMIN_EDIT_ICON_PATH."' alt='".LAN_EDIT."' /></a>";
                     */
                     $value .= "<a href='" . e_SELF . "?{$query}' class='btn btn-default' title='" . LAN_EDIT . "' data-toggle='tooltip' data-placement='left'>\r\n\t\t\t\t\t\t" . ADMIN_EDIT_ICON . "</a>";
                 }
                 $delcls = vartrue($attributes['noConfirm']) ? ' no-confirm' : '';
                 if (varset($parms['deleteClass']) && varset($parms['delete'], 1) == 1) {
                     $cls = deftrue($parms['deleteClass']) ? constant($parms['deleteClass']) : $parms['deleteClass'];
                     if (check_class($cls)) {
                         $value .= $this->submit_image('etrigger_delete[' . $id . ']', $id, 'delete', LAN_DELETE . ' [ ID: ' . $id . ' ]', array('class' => 'action delete btn btn-default' . $delcls));
                     }
                 } else {
                     $value .= $this->submit_image('etrigger_delete[' . $id . ']', $id, 'delete', LAN_DELETE . ' [ ID: ' . $id . ' ]', array('class' => 'action delete btn btn-default' . $delcls));
                 }
             }
             //$attributes['type'] = 'text';
             $value .= "</div>";
             return $value;
             break;
         case 'checkboxes':
             $value = $this->checkbox(vartrue($attributes['toggle'], 'multiselect') . '[' . $id . ']', $id);
             //$attributes['type'] = 'text';
             return $value;
             break;
     }
     switch ($attributes['type']) {
         case 'number':
             if (!$value) {
                 $value = '0';
             }
             if ($parms) {
                 if (!isset($parms['sep'])) {
                     $value = number_format($value, $parms['decimals']);
                 } else {
                     $value = number_format($value, $parms['decimals'], vartrue($parms['point'], '.'), vartrue($parms['sep'], ' '));
                 }
             }
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
                 $value = "<a class='e-tip e-editable editable-click' data-name='" . $field . "' title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='text' data-pk='" . $id . "' data-url='" . e_SELF . "?mode={$mode}&action=inline&id={$id}&ajax_used=1' href='#'>" . $value . "</a>";
             }
             $value = vartrue($parms['pre']) . $value . vartrue($parms['post']);
             // else same
             break;
         case 'ip':
             //$e107 = e107::getInstance();
             $value = e107::getIPHandler()->ipDecode($value);
             // else same
             break;
         case 'templates':
         case 'layouts':
             $pre = vartrue($parms['pre']);
             $post = vartrue($parms['post']);
             unset($parms['pre'], $parms['post']);
             if ($parms) {
                 $attributes['writeParms'] = $parms;
             } elseif (isset($attributes['writeParms'])) {
                 if (is_string($attributes['writeParms'])) {
                     parse_str($attributes['writeParms'], $attributes['writeParms']);
                 }
             }
             $attributes['writeParms']['raw'] = true;
             $tmp = $this->renderElement($field, '', $attributes);
             // Inline Editing.  //@SecretR - please FIXME!
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
                 $source = str_replace('"', "'", json_encode($wparms));
                 $value = "<a class='e-tip e-editable editable-click' data-name='" . $field . "' data-source=\"" . $source . "\" title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='select' data-pk='" . $id . "' data-url='" . e_SELF . "?mode=&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>" . $value . "</a>";
             }
             //	$value = $pre.vartrue($tmp[$value]).$post; // FIXME "Fatal error: Only variables can be passed by reference" featurebox list page.
             break;
         case 'checkboxes':
         case 'comma':
         case 'dropdown':
             // XXX - should we use readParams at all here? see writeParms check below
             if ($parms && is_array($parms)) {
                 //FIXME return no value at all when 'editable=1' is a readParm. See FAQs templates.
                 //	$value = vartrue($parms['pre']).vartrue($parms[$value]).vartrue($parms['post']);
                 //	break;
             }
             // NEW - multiple (array values) support
             // FIXME - add support for multi-level arrays (option groups)
             if (!is_array($attributes['writeParms'])) {
                 parse_str($attributes['writeParms'], $attributes['writeParms']);
             }
             $wparms = $attributes['writeParms'];
             if (!is_array(varset($wparms['__options']))) {
                 parse_str($wparms['__options'], $wparms['__options']);
             }
             if (!empty($wparms['optArray'])) {
                 $fopts = $wparms;
                 $wparms = $fopts['optArray'];
                 unset($fopts['optArray']);
                 $wparms['__options'] = $fopts;
             }
             $opts = $wparms['__options'];
             unset($wparms['__options']);
             $_value = $value;
             if ($attributes['type'] == 'checkboxes' || $attributes['type'] == 'comma') {
                 $opts['multiple'] = true;
             }
             if (vartrue($opts['multiple'])) {
                 $ret = array();
                 $value = is_array($value) ? $value : explode(',', $value);
                 foreach ($value as $v) {
                     if (isset($wparms[$v])) {
                         $ret[] = $wparms[$v];
                     }
                 }
                 $value = implode(', ', $ret);
             } else {
                 $ret = '';
                 if (isset($wparms[$value])) {
                     $ret = $wparms[$value];
                 }
                 $value = $ret;
             }
             $value = $value ? vartrue($parms['pre']) . defset($value, $value) . vartrue($parms['post']) : '';
             // Inline Editing.
             // Inline Editing with 'comma' @SecretR - please FIXME - empty values added. @see news 'render type' or 'media-manager' category for test examples.
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 $xtype = $attributes['type'] == 'dropdown' ? 'select' : 'checklist';
                 //	$value = "<a class='e-tip e-editable editable-click' data-name='".$field."' data-value='{$_value}' data-source=\"".$source."\" title=\"".LAN_EDIT." ".$attributes['title']."\" data-type='".$xtype."' data-pk='".$id."' data-url='".e_SELF."?mode=&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>".$value."</a>";
                 $value = $this->renderInline($field, $id, $attributes['title'], $_value, $value, $xtype, $wparms);
             }
             // return ;
             break;
         case 'radio':
             if ($parms && is_array($parms)) {
                 $value = vartrue($parms['pre']) . vartrue($parms[$value]) . vartrue($parms['post']);
                 break;
             }
             if (!is_array($attributes['writeParms'])) {
                 parse_str($attributes['writeParms'], $attributes['writeParms']);
             }
             $value = vartrue($attributes['writeParms']['__options']['pre']) . vartrue($attributes['writeParms'][$value]) . vartrue($attributes['writeParms']['__options']['post']);
             break;
         case 'tags':
             if (!empty($parms['constant'])) {
                 $value = defset($value, $value);
             }
             if (vartrue($parms['truncate'])) {
                 $value = $tp->text_truncate($value, $parms['truncate'], '...');
             } elseif (vartrue($parms['htmltruncate'])) {
                 $value = $tp->html_truncate($value, $parms['htmltruncate'], '...');
             }
             if (vartrue($parms['wrap'])) {
                 $value = $tp->htmlwrap($value, (int) $parms['wrap'], varset($parms['wrapChar'], ' '));
             }
             if (vartrue($parms['link']) && $id) {
                 $link = str_replace('[id]', $id, $parms['link']);
                 $link = $tp->replaceConstants($link);
                 // SEF URL is not important since we're in admin.
                 $dialog = vartrue($parms['target']) == 'dialog' ? " e-dialog" : "";
                 // iframe
                 $ext = vartrue($parms['target']) == 'blank' ? " rel='external' " : "";
                 // new window
                 $modal = vartrue($parms['target']) == 'modal' ? " data-toggle='modal' data-cache='false' data-target='#uiModal' " : "";
                 if ($parms['link'] == 'sef' && $this->getController()->getListModel()) {
                     $model = $this->getController()->getListModel();
                     // copy url config
                     if (!$model->getUrl()) {
                         $model->setUrl($this->getController()->getUrl());
                     }
                     // assemble the url
                     $link = $model->url();
                 } elseif (vartrue($data[$parms['link']])) {
                     $link = $tp->replaceConstants(vartrue($data[$parms['link']]));
                 }
                 // in case something goes wrong...
                 if ($link) {
                     $value = "<a class='e-tip{$dialog}' {$ext} href='" . $link . "' {$modal} title='Quick View' >" . $value . "</a>";
                 }
             }
             if (empty($value)) {
                 $value = '-';
                 $setValue = "data-value=''";
             } else {
                 $setValue = "";
                 if ($attributes['type'] == 'tags' && !empty($value)) {
                     $setValue = "data-value='" . $value . "'";
                     $value = str_replace(",", ", ", $value);
                     // add spaces so it wraps, but don't change the actual values.
                 }
             }
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 $options['selectize'] = array('create' => true, 'maxItems' => 7, 'mode' => 'multi', 'e_editable' => $field . '_' . $id);
                 $tpl = $this->text($field, $value, 80, $options);
                 $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
                 $value = "<a id='" . $field . '_' . $id . "' class='e-tip e-editable editable-click editable-tags' data-emptytext='-' data-tpl='" . str_replace("'", '"', $tpl) . "' data-name='" . $field . "' title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='text' data-pk='" . $id . "' " . $setValue . " data-url='" . e_SELF . "?mode={$mode}&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>" . $value . "</a>";
             }
             $value = vartrue($parms['pre']) . $value . vartrue($parms['post']);
             break;
         case 'text':
             if (!empty($parms['constant'])) {
                 $value = defset($value, $value);
             }
             if (vartrue($parms['truncate'])) {
                 $value = $tp->text_truncate($value, $parms['truncate'], '...');
             } elseif (vartrue($parms['htmltruncate'])) {
                 $value = $tp->html_truncate($value, $parms['htmltruncate'], '...');
             }
             if (vartrue($parms['wrap'])) {
                 $value = $tp->htmlwrap($value, (int) $parms['wrap'], varset($parms['wrapChar'], ' '));
             }
             if (vartrue($parms['link']) && $id) {
                 $link = str_replace('[id]', $id, $parms['link']);
                 $link = $tp->replaceConstants($link);
                 // SEF URL is not important since we're in admin.
                 $dialog = vartrue($parms['target']) == 'dialog' ? " e-dialog" : "";
                 // iframe
                 $ext = vartrue($parms['target']) == 'blank' ? " rel='external' " : "";
                 // new window
                 $modal = vartrue($parms['target']) == 'modal' ? " data-toggle='modal' data-cache='false' data-target='#uiModal' " : "";
                 if ($parms['link'] == 'sef' && $this->getController()->getListModel()) {
                     $model = $this->getController()->getListModel();
                     // copy url config
                     if (!$model->getUrl()) {
                         $model->setUrl($this->getController()->getUrl());
                     }
                     // assemble the url
                     $link = $model->url();
                 } elseif (vartrue($data[$parms['link']])) {
                     $link = $tp->replaceConstants(vartrue($data[$parms['link']]));
                 }
                 // in case something goes wrong...
                 if ($link) {
                     $value = "<a class='e-tip{$dialog}' {$ext} href='" . $link . "' {$modal} title='Quick View' >" . $value . "</a>";
                 }
             }
             if (empty($value)) {
                 $value = '-';
                 $setValue = "data-value=''";
             } else {
                 $setValue = "";
                 if ($attributes['type'] == 'tags' && !empty($value)) {
                     $setValue = "data-value='" . $value . "'";
                     $value = str_replace(",", ", ", $value);
                     // add spaces so it wraps, but don't change the actual values.
                 }
             }
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
                 $value = "<a class='e-tip e-editable editable-click' data-emptytext='-' data-name='" . $field . "' title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='text' data-pk='" . $id . "' " . $setValue . " data-url='" . e_SELF . "?mode={$mode}&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>" . $value . "</a>";
             }
             $value = vartrue($parms['pre']) . $value . vartrue($parms['post']);
             break;
         case 'bbarea':
         case 'textarea':
             if ($attributes['type'] == 'textarea' && !vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 return $this->renderInline($field, $id, $attributes['title'], $value, substr($value, 0, 50) . "...", 'textarea');
                 //FIXME.
             }
             $expand = '...';
             $toexpand = false;
             if ($attributes['type'] == 'bbarea' && !isset($parms['bb'])) {
                 $parms['bb'] = true;
             }
             //force bb parsing for bbareas
             $elid = trim(str_replace('_', '-', $field)) . '-' . $id;
             if (!vartrue($parms['noparse'])) {
                 $value = $tp->toHTML($value, vartrue($parms['bb']) ? true : false, vartrue($parms['parse']));
             }
             if (vartrue($parms['expand']) || vartrue($parms['truncate']) || vartrue($parms['htmltruncate'])) {
                 $ttl = vartrue($parms['expand']);
                 if ($ttl == 1) {
                     $ttl = $expand . "<button class='btn btn-default btn-xs btn-mini pull-right'>More..</button>";
                     $ttl1 = "<button class='btn btn-default btn-xs btn-mini pull-right'>..Less</button>";
                 } else {
                     $ttl1 = null;
                 }
                 $expands = '<a href="#' . $elid . '-expand" class="e-show-if-js e-expandit">' . defset($ttl, $ttl) . "</a>";
                 $contracts = '<a href="#' . $elid . '-expand" class="e-show-if-js e-expandit">' . defset($ttl1, $ttl1) . "</a>";
             }
             $oldval = $value;
             if (vartrue($parms['truncate'])) {
                 $value = $oldval = strip_tags($value);
                 $value = $tp->text_truncate($value, $parms['truncate'], '');
                 $toexpand = $value != $oldval;
             } elseif (vartrue($parms['htmltruncate'])) {
                 $value = $tp->html_truncate($value, $parms['htmltruncate'], '');
                 $toexpand = $value != $oldval;
             }
             if ($toexpand) {
                 // force hide! TODO - core style .expand-c (expand container)
                 // TODO: Hide 'More..' button when text fully displayed.
                 $value .= '<span class="expand-c" style="display: none" id="' . $elid . '-expand"><span>' . str_replace($value, '', $oldval) . $contracts . '</span></span>';
                 $value .= $expands;
                 // 'More..' button. Keep it at the bottom so it does't cut the sentence.
             }
             break;
         case 'icon':
             $value = $tp->toIcon($value, array('size' => '2x'));
             break;
         case 'file':
             if (vartrue($parms['base'])) {
                 $url = $parms['base'] . $value;
             } else {
                 $url = e107::getParser()->replaceConstants($value, 'full');
             }
             $name = basename($value);
             $value = '<a href="' . $url . '" title="Direct link to ' . $name . '" rel="external">' . $name . '</a>';
             break;
         case 'image':
             //TODO - thumb, js tooltip...
             if ($value) {
                 if (strpos($value, ",") !== false) {
                     $tmp = explode(",", $value);
                     $value = $tmp[0];
                     unset($tmp);
                 }
                 $vparm = array('thumb' => 'tag', 'w' => vartrue($parms['thumb_aw'], '80'));
                 if ($video = e107::getParser()->toVideo($value, $vparm)) {
                     return $video;
                 }
                 $fileOnly = basename($value);
                 // Not an image but a file.  (media manager)
                 if (!preg_match("/\\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF)\$/", $fileOnly) && false !== strpos($fileOnly, '.')) {
                     $icon = "{e_IMAGE}filemanager/zip_32.png";
                     $src = $tp->replaceConstants(vartrue($parms['pre']) . $icon, 'abs');
                     //	return $value;
                     return e107::getParser()->toGlyph('fa-file', 'size=2x');
                     //		return '<img src="'.$src.'" alt="'.$value.'" class="e-thumb" title="'.$value.'" />';
                 }
                 if (vartrue($parms['thumb'])) {
                     $thparms = array();
                     // Support readParms example: thumb=1&w=200&h=300
                     // Support readParms example: thumb=1&aw=80&ah=30
                     if (isset($parms['h'])) {
                         $thparms['h'] = intval($parms['h']);
                     }
                     if (isset($parms['ah'])) {
                         $thparms['ah'] = intval($parms['ah']);
                     }
                     if (isset($parms['w'])) {
                         $thparms['w'] = intval($parms['w']);
                     }
                     if (isset($parms['aw'])) {
                         $thparms['aw'] = intval($parms['aw']);
                     }
                     // Support readParms example: thumb=200x300 (wxh)
                     if (strpos($parms['thumb'], 'x') !== false) {
                         list($thparms['w'], $thparms['h']) = explode('x', $parms['thumb']);
                     }
                     // Support readParms example: thumb={width}
                     if (!isset($parms['w']) && is_numeric($parms['thumb']) && '1' != $parms['thumb']) {
                         $thparms['w'] = intval($parms['thumb']);
                     } elseif (vartrue($parms['thumb_aw'])) {
                         $thparms['aw'] = intval($parms['thumb_aw']);
                     }
                     //	return print_a($thparms,true);
                     $src = $tp->replaceConstants(vartrue($parms['pre']) . $value, 'abs');
                     $thsrc = $tp->thumbUrl(vartrue($parms['pre']) . $value, $thparms, varset($parms['thumb_urlraw']));
                     $alt = basename($src);
                     $ttl = '<img src="' . $thsrc . '" alt="' . $alt . '" class="thumbnail e-thumb" />';
                     $value = '<a href="' . $src . '" data-modal-caption="' . $alt . '" data-target="#uiModal" class="e-modal e-image-preview" title="' . $alt . '" rel="external">' . $ttl . '</a>';
                 } else {
                     $src = $tp->replaceConstants(vartrue($parms['pre']) . $value, 'abs');
                     $alt = $src;
                     //basename($value);
                     $ttl = vartrue($parms['title'], 'LAN_PREVIEW');
                     $value = '<a href="' . $src . '" class="e-image-preview" title="' . $alt . '" rel="external">' . defset($ttl, $ttl) . '</a>';
                 }
             }
             break;
         case 'files':
             $ret = '<ol>';
             for ($i = 0; $i < 5; $i++) {
                 $k = $key . '[' . $i . '][path]';
                 $ival = $value[$i]['path'];
                 $ret .= '<li>' . $ival . '</li>';
             }
             $ret .= '</ol>';
             $value = $ret;
             break;
         case 'datestamp':
             $value = $value ? e107::getDate()->convert_date($value, vartrue($parms['mask'], 'short')) : '';
             break;
         case 'date':
             // just show original value
             break;
         case 'userclass':
             $dispvalue = $this->_uc->uc_get_classname($value);
             // Inline Editing.
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
                 $uc_options = vartrue($parms['classlist'], 'public,guest,nobody,member,admin,main,classes');
                 // defaults to 'public,guest,nobody,member,classes' (userclass handler)
                 unset($parms['classlist']);
                 $array = e107::getUserClass()->uc_required_class_list($uc_options);
                 //XXX Ugly looking (non-standard) function naming - TODO discuss name change.
                 $source = str_replace('"', "'", json_encode($array, JSON_FORCE_OBJECT));
                 //NOTE Leading ',' required on $value; so it picks up existing value.
                 $value = "<a class='e-tip e-editable editable-click' data-placement='left' data-value='" . $value . "' data-name='" . $field . "' data-source=\"" . $source . "\" title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='select' data-pk='" . $id . "' data-url='" . e_SELF . "?mode={$mode}&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>" . $dispvalue . "</a>";
             } else {
                 $value = $dispvalue;
             }
             break;
         case 'userclasses':
             //	return $value;
             $classes = explode(',', $value);
             $uv = array();
             foreach ($classes as $cid) {
                 if (!empty($parms['defaultLabel']) && $cid === '') {
                     $uv[] = $parms['defaultLabel'];
                     continue;
                 }
                 $uv[] = $this->_uc->getName($cid);
             }
             $dispvalue = implode(vartrue($parms['separator'], "<br />"), $uv);
             // Inline Editing.
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 $uc_options = vartrue($parms['classlist'], 'public,guest, nobody,member,admin,main,classes');
                 // defaults to 'public,guest,nobody,member,classes' (userclass handler)
                 $array = e107::getUserClass()->uc_required_class_list($uc_options);
                 //XXX Ugly looking (non-standard) function naming - TODO discuss name change.
                 //$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], ''));
                 $mode = $tp->filter(vartrue($_GET['mode'], ''), 'w');
                 $source = str_replace('"', "'", json_encode($array, JSON_FORCE_OBJECT));
                 //NOTE Leading ',' required on $value; so it picks up existing value.
                 $value = "<a class='e-tip e-editable editable-click' data-placement='bottom' data-value='," . $value . "' data-name='" . $field . "' data-source=\"" . $source . "\" title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='checklist' data-pk='" . $id . "' data-url='" . e_SELF . "?mode={$mode}&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>" . $dispvalue . "</a>";
             } else {
                 $value = $dispvalue;
             }
             unset($parms['classlist']);
             break;
             /*case 'user_name':
             		case 'user_loginname':
             		case 'user_login':
             		case 'user_customtitle':
             		case 'user_email':*/
         /*case 'user_name':
         		case 'user_loginname':
         		case 'user_login':
         		case 'user_customtitle':
         		case 'user_email':*/
         case 'user':
             /*if(is_numeric($value))
             		{
             			$value = e107::user($value);
             			if($value)
             			{
             				$value = $value[$attributes['type']] ? $value[$attributes['type']] : $value['user_name'];
             			}
             			else
             			{
             				$value = 'not found';
             			}
             		}*/
             $row_id = $id;
             // Dirty, but the only way for now
             $id = 0;
             $ttl = LAN_ANONYMOUS;
             //Defaults to user_id and user_name (when present) and when idField and nameField are not present.
             // previously set - real parameters are idField && nameField
             $id = vartrue($parms['__idval']);
             if ($value && !is_numeric($value)) {
                 $id = vartrue($parms['__idval']);
                 $ttl = $value;
             } elseif ($value && is_numeric($value)) {
                 $id = $value;
                 if (vartrue($parms['__nameval'])) {
                     $ttl = $parms['__nameval'];
                 } else {
                     $user = e107::user($value);
                     if (vartrue($user['user_name'])) {
                         $ttl = $user['user_name'];
                     }
                 }
             }
             if (!empty($parms['link']) && $id && $ttl && is_numeric($id)) {
                 // Stay in admin area.
                 $link = e_ADMIN . "users.php?mode=main&action=edit&id=" . $id . "&readonly=1&iframe=1";
                 // e107::getUrl()->create('user/profile/view', array('id' => $id, 'name' => $ttl))
                 $value = '<a class="e-modal" data-modal-caption="User #' . $id . ' : ' . $ttl . '" href="' . $link . '" title="Go to user profile">' . $ttl . '</a>';
             } else {
                 $value = $ttl;
             }
             // Inline Editing.
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 // Need a Unique Field ID to store field settings using e107::js('settings').
                 $fieldID = $this->name2id($field . '_' . microtime(true));
                 // Unique ID for each rows.
                 $eEditableID = $this->name2id($fieldID . '_' . $row_id);
                 $tpl = $this->userpicker($field, '', $ttl, $id, array('id' => $fieldID, 'selectize' => array('e_editable' => $eEditableID)));
                 $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
                 $value = "<a id='" . $eEditableID . "' class='e-tip e-editable editable-click editable-userpicker' data-clear='false' data-tpl='" . str_replace("'", '"', $tpl) . "' data-name='" . $field . "' title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='text' data-pk='" . $row_id . "' data-value='" . $id . "' data-url='" . e_SELF . "?mode={$mode}&amp;action=inline&amp;id={$row_id}&amp;ajax_used=1' href='#'>" . $ttl . "</a>";
             }
             break;
         case 'bool':
         case 'boolean':
             $false = vartrue($parms['trueonly']) ? "" : ADMIN_FALSE_ICON;
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) {
                 if (isset($parms['false'])) {
                     $false = $parms['false'];
                 } else {
                     $false = $value === '' ? "&square;" : "&cross;";
                 }
                 $true = varset($parms['true'], '&check;');
                 // custom representation for 'true'. (supports font-awesome when set by css)
                 $value = intval($value);
                 $wparms = vartrue($parms['reverse']) ? array(0 => $true, 1 => $false) : array(0 => $false, 1 => $true);
                 $dispValue = $wparms[$value];
                 return $this->renderInline($field, $id, $attributes['title'], $value, $dispValue, 'select', $wparms);
             }
             if (vartrue($parms['reverse'])) {
                 $value = $value ? $false : ADMIN_TRUE_ICON;
             } else {
                 $value = $value ? ADMIN_TRUE_ICON : $false;
             }
             break;
         case 'url':
             if (!$value) {
                 break;
             }
             $ttl = $value;
             if (vartrue($parms['href'])) {
                 return $tp->replaceConstants(vartrue($parms['pre']) . $value, varset($parms['replace_mod'], 'abs'));
             }
             if (vartrue($parms['truncate'])) {
                 $ttl = $tp->text_truncate($value, $parms['truncate'], '...');
             }
             $value = "<a href='" . $tp->replaceConstants(vartrue($parms['pre']) . $value, 'abs') . "' title='{$value}'>" . $ttl . "</a>";
             break;
         case 'email':
             if (!$value) {
                 break;
             }
             $ttl = $value;
             if (vartrue($parms['truncate'])) {
                 $ttl = $tp->text_truncate($value, $parms['truncate'], '...');
             }
             $value = "<a href='mailto:" . $value . "' title='{$value}'>" . $ttl . "</a>";
             break;
         case 'method':
             // Custom Function
             $method = $attributes['field'];
             // prevents table alias in method names. ie. u.my_method.
             $_value = $value;
             if ($attributes['data'] == 'array') {
                 $value = e107::unserialize($value);
                 // (saved as array, return it as an array)
             }
             $meth = !empty($attributes['method']) ? $attributes['method'] : $method;
             if (method_exists($this, $meth)) {
                 $parms['field'] = $field;
                 $value = call_user_func_array(array($this, $meth), array($value, 'read', $parms));
             } else {
                 return "<span class='label label-important label-danger'>Missing: " . $method . "()</span>";
             }
             //	 print_a($attributes);
             // Inline Editing.
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable'])) {
                 $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
                 $methodParms = call_user_func_array(array($this, $method), array($value, 'inline', $parms));
                 if (!empty($methodParms['inlineType'])) {
                     $attributes['inline'] = $methodParms['inlineType'];
                     $methodParms = !empty($methodParms['inlineData']) ? $methodParms['inlineData'] : null;
                 }
                 if (is_string($attributes['inline'])) {
                     switch ($attributes['inline']) {
                         case 'checklist':
                             $xtype = 'checklist';
                             break;
                         case 'select':
                         case 'dropdown':
                             $xtype = 'select';
                             break;
                         case 'textarea':
                             $xtype = 'textarea';
                             break;
                         default:
                             $xtype = 'text';
                             $methodParms = null;
                             break;
                     }
                 }
                 if (!empty($xtype)) {
                     $value = $this->renderInline($field, $id, $attributes['title'], $_value, $value, $xtype, $methodParms);
                 }
             }
             break;
         case 'hidden':
             return vartrue($parms['show']) ? $value ? $value : vartrue($parms['empty']) : '';
             break;
         case 'language':
             // All Known Languages.
             if (!empty($value)) {
                 $_value = $value;
                 if (strlen($value) === 2) {
                     $value = e107::getLanguage()->convert($value);
                 }
             }
             if (!vartrue($attributes['noedit']) && vartrue($parms['editable'])) {
                 $wparms = e107::getLanguage()->getList();
                 return $this->renderInline($field, $id, $attributes['title'], $_value, $value, 'select', $wparms);
             }
             return $value;
             break;
         case 'lanlist':
             // installed languages.
             $options = e107::getLanguage()->getLanSelectArray();
             if ($options) {
                 if (!is_array($attributes['writeParms'])) {
                     parse_str($attributes['writeParms'], $attributes['writeParms']);
                 }
                 $wparms = $attributes['writeParms'];
                 if (!is_array(varset($wparms['__options']))) {
                     parse_str($wparms['__options'], $wparms['__options']);
                 }
                 $opts = $wparms['__options'];
                 if ($opts['multiple']) {
                     $ret = array();
                     $value = is_array($value) ? $value : explode(',', $value);
                     foreach ($value as $v) {
                         if (isset($options[$v])) {
                             $ret[] = $options[$v];
                         }
                     }
                     $value = implode(', ', $ret);
                 } else {
                     $ret = '';
                     if (isset($options[$value])) {
                         $ret = $options[$value];
                     }
                     $value = $ret;
                 }
                 $value = $value ? vartrue($parms['pre']) . $value . vartrue($parms['post']) : '';
             } else {
                 $value = '';
             }
             break;
             //TODO - order
         //TODO - order
         default:
             //unknown type
             break;
     }
     return $value;
 }
Example #20
0
 //	define('USER_AUDIT_EMAILACK',12);			// User responded to registration email
 //	define('USER_AUDIT_LOGIN',13);				// User logged in
 //	define('USER_AUDIT_LOGOUT',14);				// User logged out
 //	define('USER_AUDIT_NEW_DN',15);				// User changed display name
 //	define('USER_AUDIT_NEW_PW',16);				// User changed password
 //	define('USER_AUDIT_NEW_EML',17);			// User changed email
 //	define('USER_AUDIT_NEW_SET',19);			// User changed other settings (intentional gap in numbering)
 //	define('USER_AUDIT_ADD_ADMIN', 20); 		// User added by admin
 //	define('USER_AUDIT_MAIL_BOUNCE', 21); 		// User mail bounce
 //	define('USER_AUDIT_BANNED', 22); 			// User banned
 //	define('USER_AUDIT_BOUNCE_RESET', 23); 		// User bounce reset
 //	define('USER_AUDIT_TEMP_ACCOUNT', 24); 		// User temporary account
 $audit_checkboxes = array(USER_AUDIT_SIGNUP => RL_LAN_071, USER_AUDIT_EMAILACK => RL_LAN_072, USER_AUDIT_LOGIN => RL_LAN_073, USER_AUDIT_NEW_DN => RL_LAN_075, USER_AUDIT_NEW_PW => RL_LAN_076, USER_AUDIT_PW_RES => RL_LAN_078, USER_AUDIT_NEW_EML => RL_LAN_077, USER_AUDIT_NEW_SET => RL_LAN_079, USER_AUDIT_ADD_ADMIN => RL_LAN_080, USER_AUDIT_MAIL_BOUNCE => RL_LAN_081, USER_AUDIT_BANNED => RL_LAN_082, USER_AUDIT_BOUNCE_RESET => RL_LAN_083, USER_AUDIT_TEMP_ACCOUNT => RL_LAN_084);
 if (!isset($e_userclass) && !is_object($e_userclass)) {
     require_once e_HANDLER . "userclass_class.php";
     $e_userclass = new user_class();
 }
 $user_signup_opts = array_flip(explode(',', varset($pref['user_audit_opts'], '')));
 // Common to all logs
 $text = "\r\n\t<fieldset id='core-admin-log-config'>\r\n\t<legend class='e-hideme'>" . RL_LAN_121 . "</legend>\r\n\t<form method='post' action='" . e_SELF . "?config'>\r\n\t\t<fieldset id='core-admin-log-options'>\r\n\t\t\t<legend>" . RL_LAN_122 . "</legend>\r\n\t\t\t<table class='table adminform'>\r\n\t\t\t\t<colgroup>\r\n\t\t\t\t\t<col class='col-label' />\r\n\t\t\t\t\t<col class='col-control' />\r\n\t\t\t\t</colgroup>\r\n\t\t\t\t<tbody>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td>" . RL_LAN_044 . "</td>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t<select name='sys_log_perpage' class='tbox select'>\r\n\t\t\t\t\t\t\t\t<option value='10' " . ($pref['sys_log_perpage'] == '10' ? " selected='selected' " : "") . " >10</option>\r\n\t\t\t\t\t\t\t\t<option value='20' " . ($pref['sys_log_perpage'] == '20' ? " selected='selected' " : "") . " >20</option>\r\n\t\t\t\t\t\t\t\t<option value='30' " . ($pref['sys_log_perpage'] == '30' ? " selected='selected' " : "") . " >30</option>\r\n\t\t\t\t\t\t\t\t<option value='40' " . ($pref['sys_log_perpage'] == '40' ? " selected='selected' " : "") . " >40</option>\r\n\t\t\t\t\t\t\t\t<option value='50' " . ($pref['sys_log_perpage'] == '50' ? " selected='selected' " : "") . " >50</option>\r\n\t\t\t\t\t\t\t</select>\r\n\t\t\t\t\t\t\t<div class='field-help'>" . RL_LAN_064 . "</div>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t";
 // User Audit Trail Options
 $text .= "\r\n\t\t<tr>\r\n\t\t\t<td>" . RL_LAN_123 . "</td>\r\n\t\t\t<td>\r\n\t\t\t\t<select class='tbox' name='user_audit_class'>\r\n\t\t\t\t\t" . $e_userclass->vetted_tree('user_audit_class', array($e_userclass, 'select'), varset($pref['user_audit_class'], ''), 'nobody,admin,member,new,mods,main,classes') . "\r\n\t\t\t\t</select>\r\n\t\t\t\t<div class='field-help'>" . RL_LAN_026 . "</div>\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td>" . RL_LAN_124 . "</td>\r\n\t\t\t<td>\r\n\t\t\t\t" . RL_LAN_031 . "\r\n\t";
 foreach ($audit_checkboxes as $k => $t) {
     $text .= "\r\n\t\t\t\t\t\t\t<div class='field-spacer'><input class='checkbox' type='checkbox' id='user-audit-opts-{$k}' name='user_audit_opts[]' value='{$k}' " . (isset($user_signup_opts[$k]) ? " checked='checked' " : "") . " /><label for='user-audit-opts-{$k}'>{$t}</label></div>\r\n\t\t";
 }
 $text .= "\r\n\t\t\t\t\t\t\t<div class='field-spacer f-left'>" . $frm->admin_button('check_all', 'jstarget:user_audit_opts', 'action', LAN_CHECKALL) . $frm->admin_button('uncheck_all', 'jstarget:user_audit_opts', 'action', LAN_UNCHECKALL) . "</div>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t";
 // Rolling log options
 //====================
 $text .= "\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td>" . RL_LAN_008 . "</td>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t<div class='auto-toggle-area autocheck'>\r\n\t\t\t\t\t\t\t\t<input class='checkbox' type='checkbox' name='roll_log_active' value='1' " . ($pref['roll_log_active'] == 1 ? " checked='checked' " : "") . " />\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td>" . RL_LAN_009 . "</td>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t   <input class='tbox' type='text' name='roll_log_days' size='10' value='" . $pref['roll_log_days'] . "' maxlength='5' />\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</tbody>\r\n\t\t\t</table>\r\n\t\t\t<div class='buttons-bar center'>\r\n\t\t\t\t" . $frm->admin_button('setoptions', 'no-value', 'update', LAN_UPDATE) . "\r\n\t\t\t</div>\r\n\t\t</fieldset>\r\n\t</form>\r\n\t";
 // Admin log maintenance
 //==================
Example #21
0
function show_upload_filetypes()
{
    global $ns;
    //TODO is there an e107:: copy of this
    if (!is_object($e_userclass)) {
        $e_userclass = new user_class();
    }
    if (!getperms("0")) {
        exit;
    }
    //TODO still needed?
    $definition_source = DOWLAN_71;
    $source_file = '';
    $edit_upload_list = varset($_POST['upload_do_edit'], false);
    if (isset($_POST['generate_filetypes_xml'])) {
        // Write back edited data to filetypes_.xml
        $file_text = "<e107Filetypes>\n";
        foreach ($_POST['file_class_select'] as $k => $c) {
            if (!isset($_POST['file_line_delete_' . $c]) && varsettrue($_POST['file_type_list'][$k])) {
                $file_text .= "   <class name='{$c}' type='{$_POST['file_type_list'][$k]}' maxupload='" . varsettrue($_POST['file_maxupload'][$k], ini_get('upload_max_filesize')) . "'/>\n";
            }
        }
        $file_text .= "</e107Filetypes>";
        if (($handle = fopen(e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES, 'wt')) == FALSE || fwrite($handle, $file_text) == FALSE || fclose($handle) == FALSE) {
            $text = DOWLAN_88 . e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES;
        } else {
            $text = DOWLAN_86 . e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES . '<br/>' . DOWLAN_87 . e_ADMIN . e_READ_FILETYPES . '<br/>';
        }
        $ns->tablerender(DOWLAN_49, $text);
    }
    $current_perms = array();
    if ($edit_upload_list && is_readable(e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES) || !$edit_upload_list && is_readable(e_ADMIN . e_READ_FILETYPES)) {
        require_once e_HANDLER . 'xml_class.php';
        $xml = new xmlClass();
        $xml->setOptArrayTags('class');
        $source_file = $edit_upload_list ? e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES : e_ADMIN . e_READ_FILETYPES;
        $temp_vars = $xml->loadXMLfile($source_file, true, false);
        if ($temp_vars === FALSE) {
            echo "Error parsing XML file!";
        } else {
            foreach ($temp_vars['class'] as $v1) {
                $v = $v1['@attributes'];
                $current_perms[$v['name']] = array('type' => $v['type'], 'maxupload' => $v['maxupload']);
            }
        }
    } elseif (is_readable(e_ADMIN . 'filetypes.php')) {
        $source_file = 'filetypes.php';
        $current_perms[e_UC_MEMBER] = array('type' => implode(',', array_keys(get_allowed_filetypes('filetypes.php', ''))), 'maxupload' => '2M');
        if (is_readable(e_ADMIN . 'admin_filetypes.php')) {
            $current_perms[e_UC_ADMIN] = array('type' => implode(',', array_keys(get_allowed_filetypes('admin_filetypes.php', ''))), 'maxupload' => '2M');
            $source_file .= ' + admin_filetypes.php';
        }
    } else {
        // Set a default
        $current_perms[e_UC_MEMBER] = array('type' => 'zip,tar,gz,jpg,png', 'maxupload' => '2M');
    }
    $frm = new e_form(true);
    //enable inner tabindex counter
    $columnInfo = array("ftypes_userclass" => array("title" => DOWLAN_73, "type" => "", "width" => "auto", "thclass" => "", "forced" => true), "ftypes_extension" => array("title" => DOWLAN_74, "type" => "", "width" => "auto", "thclass" => ""), "ftypes_max_size" => array("title" => DOWLAN_75, "type" => "", "width" => "auto", "thclass" => ""), "ftypes_confirm_del" => array("title" => DOWLAN_76, "type" => "", "width" => "auto", "thclass" => "last"));
    $filterColumns = array("ftypes_userclass", "ftypes_extension", "ftypes_max_size", "ftypes_confirm_del");
    $text = "\n         <form method='post' action='" . e_SELF . "?filetypes'>\n            <fieldset id='core-download-upload1'>\n               <div>\n                  <div>\n                     <input type='hidden' name='upload_do_edit' value='1'/><p>" . str_replace(array('--SOURCE--', '--DEST--'), array(e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES, e_ADMIN . e_READ_FILETYPES), DOWLAN_85) . "</p><p>" . DOWLAN_72 . $source_file . "\n                  </p></div>\n                  <table style='" . ADMIN_WIDTH . "' class='adminlist'>" . $frm->colGroup($columnInfo) . $frm->thead($columnInfo, $filterColumns) . "\n                     <tbody>\n      ";
    foreach ($current_perms as $uclass => $uinfo) {
        $text .= "\n            <tr>\n               <td>\n                  <select name='file_class_select[]' class='tbox'>\n                     " . $e_userclass->vetted_tree('file_class_select', array($e_userclass, 'select'), $uclass, 'member,main,classes,admin') . "\n                  </select>\n               </td>\n               <td><input type='text' name='file_type_list[]' value='{$uinfo['type']}' class='tbox' size='40'/></td>\n               <td><input type='text' name='file_maxupload[]' value='{$uinfo['maxupload']}' class='tbox' size='10'/></td>\n               <td><input type='checkbox' value='1' name='file_line_delete_{$uclass}'/></td>\n            </tr>\n         ";
    }
    // Now put up a box to add a new setting
    $text .= "\n                        <tr>\n                           <td colspan='" . count($columnInfo) . "'>" . DOWLAN_90 . "</td>\n                        </tr>\n                        <tr>\n                           <td><select name='file_class_select[]' class='tbox'>\n                           " . $e_userclass->vetted_tree('file_class_select', array($e_userclass, 'select'), '', 'member,main,classes,admin,blank') . "\n                           </select></td>\n                           <td><input type='text' name='file_type_list[]' value='' class='tbox' size='40'/></td>\n                           <td colspan='2'><input type='text' name='file_maxupload[]' value='" . ini_get('upload_max_filesize') . "' class='tbox' size='10'/></td>\n                        </tr>\n                     </tbody>\n                  </table>\n               </div>\n            </fieldset>\n            <div class='buttons-bar center'>\n               <input class='button' type='submit' name='generate_filetypes_xml' value='" . DOWLAN_77 . "'/>\n               </div>\n        \t\t</form>\n      ";
    $ns->tablerender(DOWLAN_23, $text);
}
Example #22
0
 function user_class($curval, $mode)
 {
     $e_userclass = new user_class();
     $frm = e107::getForm();
     $list = $e_userclass->uc_required_class_list("classes");
     if ($mode == 'filter') {
         return $list;
     }
     if ($mode == 'write') {
         return $frm->selectbox('user_class', $list, $curval, 'description=1&multiple=1');
         // return $frm->uc_select('user_class[]', $curval, 'admin,classes', 'description=1&multiple=1');// doesn't work correctly.
     }
     //FIXME TODO - option to append userclass to existing value.
     if ($mode == 'batch') {
         $list['#delete'] = "(clear userclass)";
         // special
         return $list;
     }
     $tmp = explode(",", $curval);
     $text = array();
     foreach ($tmp as $v) {
         $text[] = $list[$v];
     }
     return implode("<br />", $text);
     // $list[$curval];
 }
Example #23
0
<?php

include_once '../kernel.php';
session_start();
$user_id = isset($_SESSION[conf::app . '_user_id']) ? (int) $_SESSION[conf::app . '_user_id'] : -1;
$user = new user_class($user_id);
$user->sabt_khorooj();
$user->logout();
session_destroy();
session_start();
$_SESSION[conf::app . "_login"] = "******";
$content = '';
?>
<html>
	<head>
		<!-- Style Includes -->
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	        <title> 
			<?php 
echo lang_fa_class::title;
?>
	        </title>
		<link type="text/css" href="../js/jquery/themes/trontastic/jquery-ui.css" rel="stylesheet" />
		<link type="text/css" href="../js/jquery/window/css/jquery.window.css" rel="stylesheet" />
		<link type="text/css" href="../css/style.css" rel="stylesheet" />	
		<style>
		</style>	
		<script language="javascript">
			function onEnterpress(e)

				{
Example #24
0
//             echo "false";
//        }
//    } catch (Exception $e) {
//        die("There was a problem: " . $e->getMessage());
//
//    }
//}
require_once '../db/user_class.php';
if (!isset($_POST['username']) || !isset($_POST['password'])) {
    die("false");
} else {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $password = sha1($password);
    try {
        $user = user_class::getUserObject($username);
        if ($user == false) {
            die("false");
        } else {
            if ($user->getpass() != $password) {
                die("false");
            } else {
                session_start();
                $_SESSION['user'] = $user;
                //  $_SESSION['username'] =$user->username;
                echo $user->role_id;
            }
        }
    } catch (Exception $e) {
        die("There was a problem: " . $e->getMessage());
    }
Example #25
0
 /**
  *	Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->isAdmin = TRUE;
 }
Example #26
0
 /**
  * Render Field Value
  * @param string $field field name
  * @param mixed $value field value
  * @param array $attributes field attributes including render parameters, element options - see e_admin_ui::$fields for required format
  * @return string
  */
 function renderValue($field, $value, $attributes, $id = 0)
 {
     $parms = array();
     if (isset($attributes['readParms'])) {
         if (!is_array($attributes['readParms'])) {
             parse_str($attributes['readParms'], $attributes['readParms']);
         }
         $parms = $attributes['readParms'];
     }
     $tp = e107::getParser();
     switch ($field) {
         case 'options':
             if ($attributes['type'] == 'method') {
                 $attributes['mode'] = "read";
                 if (isset($attributes['method']) && $attributes['method'] && method_exists($this, $attributes['method'])) {
                     $method = $attributes['method'];
                     return $this->{$method}($parms, $value, $id, $attributes);
                 } elseif (method_exists($this, 'options')) {
                     //return  $this->options($field, $value, $attributes, $id);
                     // consistent method arguments, fixed in admin cron administration
                     return $this->options($parms, $value, $id, $attributes);
                     // OLD breaks admin->cron 'options' column
                 }
             }
             if (!$value) {
                 parse_str(str_replace('&amp;', '&', e_QUERY), $query);
                 //FIXME - FIX THIS
                 // keep other vars in tact
                 $query['action'] = 'edit';
                 $query['id'] = $id;
                 //$edit_query = array('mode' => varset($query['mode']), 'action' => varset($query['action']), 'id' => $id);
                 $query = http_build_query($query);
                 $value = "";
                 if (vartrue($parms['sort'])) {
                     $value .= "<a class='e-sort' style='cursor:move' href='" . e_SELF . "?" . (e_QUERY ? e_QUERY . "&amp;ajax_used=1" : "ajax_used=1") . "' title='Re-order'>" . ADMIN_SORT_ICON . "</a> ";
                 }
                 $value .= "<a href='" . e_SELF . "?{$query}' class='e-tip' title='" . LAN_EDIT . "' data-placement='left'>\r\n\t\t\t\t\t<img class='icon action edit list' src='" . ADMIN_EDIT_ICON_PATH . "' alt='" . LAN_EDIT . "' /></a>";
                 $delcls = vartrue($attributes['noConfirm']) ? ' no-confirm' : '';
                 if (varset($parms['deleteClass'])) {
                     $cls = deftrue($parms['deleteClass']) ? constant($parms['deleteClass']) : $parms['deleteClass'];
                     if (check_class($cls)) {
                         $value .= $this->submit_image('etrigger_delete[' . $id . ']', $id, 'delete', LAN_DELETE . ' [ ID: ' . $id . ' ]', array('class' => 'action delete' . $delcls));
                     }
                 } else {
                     $value .= $this->submit_image('etrigger_delete[' . $id . ']', $id, 'delete', LAN_DELETE . ' [ ID: ' . $id . ' ]', array('class' => 'action delete' . $delcls));
                 }
             }
             //$attributes['type'] = 'text';
             return $value;
             break;
         case 'checkboxes':
             $value = $this->checkbox(vartrue($attributes['toggle'], 'multiselect') . '[' . $id . ']', $id);
             //$attributes['type'] = 'text';
             return $value;
             break;
     }
     switch ($attributes['type']) {
         case 'number':
             if (!$value) {
                 $value = '0';
             }
             if ($parms) {
                 if (!isset($parms['sep'])) {
                     $value = number_format($value, $parms['decimals']);
                 } else {
                     $value = number_format($value, $parms['decimals'], vartrue($parms['point'], '.'), vartrue($parms['sep'], ' '));
                 }
             }
             $value = vartrue($parms['pre']) . $value . vartrue($parms['post']);
             // else same
             break;
         case 'ip':
             //$e107 = e107::getInstance();
             $value = e107::getIPHandler()->ipDecode($value);
             // else same
             break;
         case 'templates':
         case 'layouts':
             $pre = vartrue($parms['pre']);
             $post = vartrue($parms['post']);
             unset($parms['pre'], $parms['post']);
             if ($parms) {
                 $attributes['writeParms'] = $parms;
             } elseif (isset($attributes['writeParms'])) {
                 if (is_string($attributes['writeParms'])) {
                     parse_str($attributes['writeParms'], $attributes['writeParms']);
                 }
             }
             $attributes['writeParms']['raw'] = true;
             $tmp = $this->renderElement($field, '', $attributes);
             //	$value = $pre.vartrue($tmp[$value]).$post; // FIXME "Fatal error: Only variables can be passed by reference" featurebox list page.
             break;
         case 'dropdown':
             // XXX - should we use readParams at all here? see writeParms check below
             if ($parms && is_array($parms)) {
                 $value = vartrue($parms['pre']) . vartrue($parms[$value]) . vartrue($parms['post']);
                 break;
             }
             // NEW - multiple (array values) support
             // FIXME - add support for multi-level arrays (option groups)
             if (!is_array($attributes['writeParms'])) {
                 parse_str($attributes['writeParms'], $attributes['writeParms']);
             }
             $wparms = $attributes['writeParms'];
             if (!is_array(varset($wparms['__options']))) {
                 parse_str($wparms['__options'], $wparms['__options']);
             }
             $opts = $wparms['__options'];
             unset($wparms['__options']);
             if ($opts['multiple'] || $attributes['data'] == 'comma') {
                 $ret = array();
                 $value = is_array($value) ? $value : explode(',', $value);
                 foreach ($value as $v) {
                     if (isset($wparms[$v])) {
                         $ret[] = $wparms[$v];
                     }
                 }
                 $value = implode(', ', $ret);
             } else {
                 $ret = '';
                 if (isset($wparms[$value])) {
                     $ret = $wparms[$value];
                 }
                 $value = $ret;
             }
             $value = $value ? vartrue($parms['pre']) . defset($value, $value) . vartrue($parms['post']) : '';
             // return ;
             break;
         case 'radio':
             if ($parms && is_array($parms)) {
                 $value = vartrue($parms['pre']) . vartrue($parms[$value]) . vartrue($parms['post']);
                 break;
             }
             if (!is_array($attributes['writeParms'])) {
                 parse_str($attributes['writeParms'], $attributes['writeParms']);
             }
             $value = vartrue($parms['pre']) . vartrue($parms[$value]) . vartrue($parms['post']);
             break;
         case 'text':
             if (vartrue($parms['truncate'])) {
                 $value = $tp->text_truncate($value, $parms['truncate'], '...');
             } elseif (vartrue($parms['htmltruncate'])) {
                 $value = $tp->html_truncate($value, $parms['htmltruncate'], '...');
             }
             if (vartrue($parms['wrap'])) {
                 $value = $tp->htmlwrap($value, (int) $parms['wrap'], varset($parms['wrapChar'], ' '));
             }
             if (vartrue($parms['link']) && $id && is_numeric($id)) {
                 $link = str_replace('[id]', $id, $parms['link']);
                 $link = $tp->replaceConstants($link);
                 // SEF URL is not important since we're in admin.
                 $dialog = vartrue($parms['dialog']) ? "e-dialog" : "";
                 $value = "<a class='e-tip {$dialog}' href='" . $link . "' title='Quick View'>" . $value . "</a>";
             }
             $value = vartrue($parms['pre']) . $value . vartrue($parms['post']);
             break;
         case 'bbarea':
         case 'textarea':
             $expand = '...';
             $toexpand = false;
             if ($attributes['type'] == 'bbarea' && !isset($parms['bb'])) {
                 $parms['bb'] = true;
             }
             //force bb parsing for bbareas
             $elid = trim(str_replace('_', '-', $field)) . '-' . $id;
             if (!vartrue($parms['noparse'])) {
                 $value = $tp->toHTML($value, vartrue($parms['bb']) ? true : false, vartrue($parms['parse']));
             }
             if (vartrue($parms['expand']) || vartrue($parms['truncate']) || vartrue($parms['htmltruncate'])) {
                 $ttl = vartrue($parms['expand'], '&nbsp;...');
                 $expand = '&nbsp;<a href="#' . $elid . '-expand" class="e-show-if-js e-expandit">' . defset($ttl, $ttl) . "</a>";
             }
             $oldval = $value;
             if (vartrue($parms['truncate'])) {
                 $value = $oldval = strip_tags($value);
                 $value = $tp->text_truncate($value, $parms['truncate'], $expand);
                 $truncated = str_replace($expand, '', $value);
                 $toexpand = $value != $oldval;
             } elseif (vartrue($parms['htmltruncate'])) {
                 $value = $tp->html_truncate($value, $parms['htmltruncate'], $expand);
                 $toexpand = $value != $oldval;
             }
             if ($toexpand) {
                 // force hide! TODO - core style .expand-c (expand container)
                 $value .= '<div class="expand-c" style="display: none" id="' . $elid . '-expand"><div>' . str_replace($truncated, ' ', $oldval) . '</div></div>';
             }
             break;
         case 'icon':
             $value = '<img src="' . $tp->replaceConstants(vartrue($parms['pre']) . $value, 'abs') . '" alt="' . basename($value) . '" class="icon' . (vartrue($parms['class']) ? ' ' . $parms['class'] : '') . '" />';
             break;
         case 'file':
             if (vartrue($parms['base'])) {
                 $url = $parms['base'] . $value;
             } else {
                 $url = e107::getParser()->replaceConstants($value, 'full');
             }
             $name = basename($value);
             $value = '<a href="' . $url . '" title="Direct link to ' . $name . '" rel="external">' . $name . '</a>';
             break;
         case 'image':
             //TODO - thumb, js tooltip...
             if ($value) {
                 if (!preg_match("/[a-zA-z0-9_-\\s\\(\\)]+\\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF)\$/", $value)) {
                     $icon = "{e_IMAGE}filemanager/zip_32.png";
                     $src = $tp->replaceConstants(vartrue($parms['pre']) . $icon, 'abs');
                     return '<img src="' . $src . '" alt="' . $value . '" class="e-thumb" title="' . $value . '" />';
                 }
                 if (vartrue($parms['thumb'])) {
                     $src = $tp->replaceConstants(vartrue($parms['pre']) . $value, 'abs');
                     $thumb = $parms['thumb'];
                     $thparms = array();
                     if (is_numeric($thumb) && '1' != $thumb) {
                         $thparms['w'] = intval($thumb);
                     } elseif (vartrue($parms['thumb_aw'])) {
                         $thparms['aw'] = intval($parms['thumb_aw']);
                     }
                     $thsrc = $tp->thumbUrl(vartrue($parms['pre']) . $value, $thparms, varset($parms['thumb_urlraw']));
                     $alt = $src;
                     $ttl = '<img src="' . $thsrc . '" alt="' . $alt . '" class="e-thumb" />';
                     $value = '<a href="' . $src . '" class="e-dialog e-image-preview" title="' . $alt . '" rel="external">' . $ttl . '</a>';
                 } else {
                     $src = $tp->replaceConstants(vartrue($parms['pre']) . $value, 'abs');
                     $alt = $src;
                     //basename($value);
                     $ttl = vartrue($parms['title'], 'LAN_PREVIEW');
                     $value = '<a href="' . $src . '" class="e-image-preview" title="' . $alt . '" rel="external">' . defset($ttl, $ttl) . '</a>';
                 }
             }
             break;
         case 'datestamp':
             $value = $value ? e107::getDate()->convert_date($value, vartrue($parms['mask'], 'short')) : '';
             break;
         case 'date':
             // just show original value
             break;
         case 'userclass':
             $value = $this->_uc->uc_get_classname($value);
             break;
         case 'userclasses':
             $classes = explode(',', $value);
             $value = array();
             foreach ($classes as $cid) {
                 $value[] = $this->_uc->uc_get_classname($cid);
             }
             $value = implode(vartrue($parms['separator'], "<br />"), $value);
             break;
             /*case 'user_name':
             		case 'user_loginname':
             		case 'user_login':
             		case 'user_customtitle':
             		case 'user_email':*/
         /*case 'user_name':
         		case 'user_loginname':
         		case 'user_login':
         		case 'user_customtitle':
         		case 'user_email':*/
         case 'user':
             /*if(is_numeric($value))
             		{
             			$value = get_user_data($value);
             			if($value)
             			{
             				$value = $value[$attributes['type']] ? $value[$attributes['type']] : $value['user_name'];
             			}
             			else
             			{
             				$value = 'not found';
             			}
             		}*/
             // Dirty, but the only way for now
             $id = 0;
             $ttl = '';
             //Defaults to user_id and user_name (when present) and when idField and nameField are not present.
             // previously set - real parameters are idField && nameField
             $id = vartrue($parms['__idval']);
             if ($value && !is_numeric($value)) {
                 $id = vartrue($parms['__idval']);
                 $ttl = $value;
             } elseif ($value && is_numeric($value)) {
                 $id = $value;
                 $ttl = vartrue($parms['__nameval']);
             }
             if (vartrue($parms['link']) && $id && $ttl && is_numeric($id)) {
                 $value = '<a href="' . e107::getUrl()->create('user/profile/view', array('id' => $id, 'name' => $ttl)) . '" title="Go to user profile">' . $ttl . '</a>';
             } else {
                 $value = $ttl;
             }
             break;
         case 'bool':
         case 'boolean':
             $false = vartrue($parms['trueonly']) ? "" : ADMIN_FALSE_ICON;
             if (vartrue($parms['reverse'])) {
                 $value = $value ? $false : ADMIN_TRUE_ICON;
             } else {
                 $value = $value ? ADMIN_TRUE_ICON : $false;
             }
             break;
         case 'url':
             if (!$value) {
                 break;
             }
             $ttl = $value;
             if (vartrue($parms['href'])) {
                 return $tp->replaceConstants(vartrue($parms['pre']) . $value, varset($parms['replace_mod'], 'abs'));
             }
             if (vartrue($parms['truncate'])) {
                 $ttl = $tp->text_truncate($value, $parms['truncate'], '...');
             }
             $value = "<a href='" . $tp->replaceConstants(vartrue($parms['pre']) . $value, 'abs') . "' title='{$value}'>" . $ttl . "</a>";
             break;
         case 'email':
             if (!$value) {
                 break;
             }
             $ttl = $value;
             if (vartrue($parms['truncate'])) {
                 $ttl = $tp->text_truncate($value, $parms['truncate'], '...');
             }
             $value = "<a href='mailto:" . $value . "' title='{$value}'>" . $ttl . "</a>";
             break;
         case 'method':
             // Custom Function
             $method = $attributes['field'];
             // prevents table alias in method names. ie. u.my_method.
             $value = call_user_func_array(array($this, $method), array($value, 'read', $parms));
             break;
         case 'hidden':
             return vartrue($parms['show']) ? $value ? $value : vartrue($parms['empty']) : '';
             break;
         case 'lanlist':
             $options = e107::getLanguage()->getLanSelectArray();
             if ($options) {
                 if (!is_array($attributes['writeParms'])) {
                     parse_str($attributes['writeParms'], $attributes['writeParms']);
                 }
                 $wparms = $attributes['writeParms'];
                 if (!is_array(varset($wparms['__options']))) {
                     parse_str($wparms['__options'], $wparms['__options']);
                 }
                 $opts = $wparms['__options'];
                 if ($opts['multiple']) {
                     $ret = array();
                     $value = is_array($value) ? $value : explode(',', $value);
                     foreach ($value as $v) {
                         if (isset($options[$v])) {
                             $ret[] = $options[$v];
                         }
                     }
                     $value = implode(', ', $ret);
                 } else {
                     $ret = '';
                     if (isset($options[$value])) {
                         $ret = $options[$value];
                     }
                     $value = $ret;
                 }
                 $value = $value ? vartrue($parms['pre']) . $value . vartrue($parms['post']) : '';
             } else {
                 $value = '';
             }
             break;
             //TODO - order
         //TODO - order
         default:
             //unknown type
             break;
     }
     return $value;
 }
/*
 * e107 website system
 *
 * Copyright (C) 2008-2013 e107 Inc (e107.org)
 * Released under the terms and conditions of the
 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
 *
 */
$eplug_admin = TRUE;
require_once "../../class2.php";
include_lan(e_PLUGIN . "user_menu/languages/" . e_LANGUAGE . ".php");
require_once e_HANDLER . 'userclass_class.php';
global $e_userclass;
if (!is_object($e_userclass)) {
    $e_userclass = new user_class();
}
if (!getperms("2")) {
    e107::redirect('admin');
    exit;
}
require_once e_ADMIN . "auth.php";
$frm = e107::getForm();
// Get the list of available themes
$handle = opendir(e_THEME);
while ($file = readdir($handle)) {
    if ($file != "." && $file != ".." && $file != "templates" && $file != "" && $file != "CVS") {
        if (is_readable(e_THEME . $file . "/theme.php")) {
            $themeOptions[] = $file;
            $themeCount[$file] = 0;
        }
Example #28
0
 function sc_userclasses($parm)
 {
     global $e_userclass;
     $tp = e107::getParser();
     $pref = e107::getPref();
     $ret = "";
     if (ADMIN && $this->var['user_id'] != USERID) {
         return "";
     }
     if (!is_object($e_userclass)) {
         $e_userclass = new user_class();
     }
     $ucList = $e_userclass->get_editable_classes(USERCLASS_LIST, TRUE);
     // List of classes which this user can edit (as array)
     $ret = '';
     if (!count($ucList)) {
         return;
     }
     $is_checked = array();
     foreach ($ucList as $cid) {
         if (check_class($cid, $this->var['user_class'])) {
             $is_checked[$cid] = $cid;
         }
         if (isset($_POST['class'])) {
             //	  $is_checked[$cid] = in_array($cid, $_POST['class']);
         }
     }
     $inclass = implode(',', $is_checked);
     //	  $ret = "<table style='width:95%;margin-left:0px'><tr><td class='defaulttext'>";
     $ret .= $e_userclass->vetted_tree('class', array($e_userclass, checkbox_desc), $inclass, 'editable');
     //	  $ret .= "</td></tr></table>\n";
     return $ret;
 }
Example #29
0
require_once '../../db/site_log_class.php';
require_once '../../db/user_class.php';
define('INCLUDE_CHECK', true);
session_start();
if (isset($_POST['userName'])) {
    $username = $_POST['userName'];
} else {
    die("Enter User Name");
}
if (isset($_POST['password'])) {
    $password = $_POST['password'];
} else {
    die("Enter Password");
}
if (isset($_POST['confirmPassword'])) {
    $cpassword = $_POST['confirmPassword'];
} else {
    die("Enter Confirm Password");
}
if ($password != $cpassword) {
    die("Password mis-match");
}
if (isset($_POST['roles'])) {
    $id = $_POST['roles'];
} else {
    die("Select Role");
}
$u = new user_class($username, $password, $id);
echo $u->updateUser();
$l = new site_log(NULL, NULL, $_SESSION['user']->username, $_SERVER['REMOTE_ADDR'], $username . " user details updated");
$l->insertlog();
Example #30
0
 function sc_signup_userclass_subscribe()
 {
     global $pref, $e_userclass, $USERCLASS_SUBSCRIBE_START, $USERCLASS_SUBSCRIBE_END, $signupData;
     $ret = "";
     if ($pref['signup_option_class']) {
         if (!is_object($e_userclass)) {
             require_once e_HANDLER . 'userclass_class.php';
             $e_userclass = new user_class();
         }
         $ucList = $e_userclass->get_editable_classes();
         // List of classes which this user can edit
         $ret = '';
         if (!$ucList) {
             return;
         }
         /*
         		  function show_signup_class($treename, $classnum, $current_value, $nest_level)
         		  {
         			global $USERCLASS_SUBSCRIBE_ROW, $e_userclass, $tp;
         			$tmp = explode(',',$current_value);
         			$search = array('{USERCLASS_ID}', '{USERCLASS_NAME}', '{USERCLASS_DESCRIPTION}', '{USERCLASS_INDENT}', '{USERCLASS_CHECKED}');
         			$replace = array($classnum, $tp->toHTML($e_userclass->uc_get_classname($classnum), FALSE, 'defs'), 
         							$tp->toHTML($e_userclass->uc_get_classdescription($classnum), FALSE, 'defs'), " style='text-indent:".(1.2*$nest_level)."em'",
         							( in_array($classnum, $tmp) ? " checked='checked'" : ''));
         			return str_replace($search, $replace, $USERCLASS_SUBSCRIBE_ROW);
         		  }*/
         $ret = $USERCLASS_SUBSCRIBE_START;
         $ret .= $e_userclass->vetted_tree('class', array($this, 'show_signup_class'), varset($signupData['user_class'], ''), 'editable, no-excludes');
         $ret .= $USERCLASS_SUBSCRIBE_END;
         return $ret;
     }
 }