Example #1
0
function persian_normalizer($str)
{
    $str = numbers($str);
    return persian_letters($str);
}
 /**
  * Gets the correct error message.
  *
  * Methoed tries to use $lang-Object. If not available, hardcoded english phrases will be used.
  * 
  * @return	string		error message
  */
 function get_error()
 {
     if ($this->error == null) {
         return false;
     }
     global $lang;
     if (is_object($lang)) {
         switch ($this->error) {
             case UPLOAD_ERR_FILE_INDEX:
                 $message = $lang->phrase('upload_error_noupload');
                 break;
             case UPLOAD_ERR_FILE_SIZE:
                 $lang->assign('mfs', formatFilesize($this->max_filesize));
                 $message = $lang->phrase('upload_error_maxfilesize');
                 break;
             case UPLOAD_ERR_IMAGE_WIDTH:
             case UPLOAD_ERR_IMAGE_HEIGHT:
                 $lang->assign('mih', $this->max_image_height > 0 ? numbers($this->max_image_height) : $lang->phrase('upload_unspecified'));
                 $lang->assign('miw', $this->max_image_width > 0 ? numbers($this->max_image_width) : $lang->phrase('upload_unspecified'));
                 $message = $lang->phrase('upload_error_maximagesize');
                 break;
             case UPLOAD_ERR_FILE_TYPE:
                 $lang->assign('aft', implode($lang->phrase('listspacer'), $this->file_types));
                 $message = $lang->phrase('upload_error_wrongfiletype');
                 break;
             case UPLOAD_ERR_COPY:
                 $message = $lang->phrase('upload_error_noaccess');
                 break;
             case UPLOAD_ERR_FILE_EXISTS:
                 $message = $lang->phrase('upload_error_fileexists');
                 break;
             default:
                 $message = $lang->phrase('upload_error_default');
         }
         if (!empty($this->file['name'])) {
             return "{$this->file['name']}: {$message}";
         } else {
             return $message;
         }
     } else {
         switch ($this->error) {
             case UPLOAD_ERR_FILE_INDEX:
                 $message = 'No file has been uploaded.';
                 break;
             case UPLOAD_ERR_FILE_SIZE:
                 $message = 'Max. filesize reached. The file is not allowed to be bigger than ' . formatFilesize($this->max_filesize) . '.';
                 break;
             case UPLOAD_ERR_IMAGE_WIDTH:
             case UPLOAD_ERR_IMAGE_HEIGHT:
                 $mih = $this->max_image_height > 0 ? numbers($this->max_image_height) : 'any';
                 $miw = $this->max_image_width > 0 ? numbers($this->max_image_width) : 'any';
                 $message = "Max. imagesize reached. Image is not allowed to be greater than {$miw} x {$mih} pixels.";
                 break;
             case UPLOAD_ERR_FILE_TYPE:
                 $lang->assign('aft', implode($lang->phrase('listspacer'), $this->file_types));
                 $message = 'Only ' . implode(', ', $this->file_types) . ' files are allowed to be uploaded.';
                 break;
             case UPLOAD_ERR_COPY:
                 $message = 'Access denied. Could not copy file.';
                 break;
             case UPLOAD_ERR_FILE_EXISTS:
                 $message = 'File already exists.';
                 break;
             default:
                 $message = 'An unknown error occured while uploading.';
         }
         if (!empty($this->file['name'])) {
             return "{$this->file['name']}: {$message}";
         } else {
             return $message;
         }
     }
 }
while ($row = $gpc->prepare($db->fetch_assoc($result))) {
    if (isset($row['regdate'])) {
        $row['regdate'] = gmdate($lang->phrase('dformat2'), times($row['regdate']));
    }
    if (isset($row['location'])) {
        $row['location'] = iif(!empty($row['location']), $row['location'], $lang->phrase('location_no_data'));
    }
    if (isset($row['gender'])) {
        if ($row['gender'] == 'm' || $row['gender'] == 'w') {
            $row['gender'] = $lang->phrase('gender_' . $row['gender']);
        } else {
            $row['gender'] = $lang->phrase('gender_na');
        }
    }
    if (isset($row['posts'])) {
        $row['posts'] = numbers($row['posts']);
    }
    if (isset($row['birthday'])) {
        $bday = explode('-', $row['birthday']);
        if ($row['birthday'] != null && $row['birthday'] != '0000-00-00') {
            $row['birthday'] = iif($bday[0] > 0, $lang->phrase('members_bday_full'), $lang->phrase('members_bday_short'));
        } else {
            $row['birthday'] = $lang->phrase('members_na');
        }
    }
    if (!empty($row['pic']) && !file_exists($row['pic'])) {
        $row['pic'] = '';
    }
    if (isset($row['lastvisit'])) {
        $row['lastvisit'] = iif($row['lastvisit'] > 0, gmdate($lang->phrase('dformat1'), times($row['lastvisit'])), $lang->phrase('members_na'));
    }
function BoardSelect($board = 0)
{
    global $config, $my, $tpl, $db, $gpc, $lang, $scache, $plugins, $slog;
    $found = false;
    $sub_cache = $forum_cache = $last_cache = $forums = $cat = array();
    $categories_obj = $scache->load('categories');
    $cat_cache = $categories_obj->get();
    $memberdata_obj = $scache->load('memberdata');
    $memberdata = $memberdata_obj->get();
    $index_moderators = $scache->load('index_moderators');
    $mod_cache = $index_moderators->get();
    $prefix_obj = $scache->load('prefix');
    $prefix = $prefix_obj->get();
    ($code = $plugins->load('forums_query')) ? eval($code) : null;
    // Fetch Forums
    $result = $db->query("\n\tSELECT\n\t\tf.id, f.name, f.description, f.opt, f.optvalue, f.parent, f.topics, f.replies, f.last_topic, f.invisible,\n\t\tt.topic as l_topic, t.prefix AS l_prefix, t.id as l_tid, t.last as l_date, u.name AS l_uname, t.last_name AS l_name, f.id AS l_bid\n\tFROM {$db->pre}forums AS f\n\t\tLEFT JOIN {$db->pre}topics AS t ON f.last_topic=t.id\n\t\tLEFT JOIN {$db->pre}user AS u ON t.last_name=u.id\n\tORDER BY f.parent, f.position\n\t");
    $keys = array('l_prefix' => null, 'l_topic_full' => null, 'l_topic' => null, 'l_tid' => null, 'l_date' => null, 'l_uname' => null, 'l_name' => null, 'l_bid' => null);
    while ($row = $db->fetch_assoc($result)) {
        $row['name'] = $gpc->prepare($row['name']);
        $row['l_uname'] = $gpc->prepare($row['l_uname']);
        $row['l_name'] = $gpc->prepare($row['l_name']);
        $row['bid'] = $cat_cache[$row['parent']]['parent'];
        // Caching for Subforums
        if (!empty($row['bid'])) {
            $sub_cache[$row['bid']][] = $row;
        }
        // Caching the Forums
        if ($row['bid'] == $board) {
            $forum_cache[$row['parent']][] = $row;
        }
        $last_cache[$row['id']] = $row;
        ($code = $plugins->load('forums_caching')) ? eval($code) : null;
    }
    $cats = array();
    $hidden = 0;
    // Work with the chached data!
    foreach ($cat_cache as $cat) {
        $cat['forums'] = array();
        if (isset($forum_cache[$cat['id']]) == false) {
            continue;
        }
        foreach ($forum_cache[$cat['id']] as $forum) {
            $found = true;
            $forum['new'] = false;
            $forum['show'] = true;
            // Subforendaten vererben (Letzter Beitrag, Markierung)
            if (isset($sub_cache[$forum['id']])) {
                $substats = SubStats($forum['topics'], $forum['replies'], $forum['id'], $sub_cache);
                $forum['topics'] = $substats[0];
                $forum['replies'] = $substats[1];
            }
            // Letzter Beitrag
            $last = $last_cache[$forum['id']];
            if (isset($sub_cache[$forum['id']])) {
                foreach ($substats[2] as $last_bid) {
                    $sub = $last_cache[$last_bid];
                    if ($last['l_date'] < $sub['l_date'] && check_forumperm($sub)) {
                        $last = $sub;
                    }
                }
            }
            $forum = array_merge($forum, array_intersect_key($last, $keys));
            if (is_id($forum['l_name']) && isset($memberdata[$forum['l_name']])) {
                $forum['l_name'] = array($forum['l_uname'], $forum['l_name']);
            } else {
                $forum['l_name'] = array($forum['l_name'], 0);
            }
            // Rechte und Gelesensystem
            if ($forum['opt'] != 're') {
                if (!check_forumperm($forum)) {
                    if ($forum['invisible'] != 0) {
                        $forum['show'] = false;
                    }
                    $forum['foldimg'] = $tpl->img('cat_locked');
                    $forum['state'] = BOARD_STATE_LOCKED;
                    $forum['topics'] = '-';
                    $forum['replies'] = '-';
                    $forum['l_topic'] = false;
                    $forum['l_topic_full'] = '';
                } else {
                    if ($slog->isForumRead($forum['id'], $forum['l_date']) || $forum['topics'] < 1) {
                        $forum['foldimg'] = $tpl->img('cat_open');
                        $forum['state'] = BOARD_STATE_OLD;
                    } else {
                        $forum['foldimg'] = $tpl->img('cat_red');
                        $forum['state'] = BOARD_STATE_NEW;
                        $forum['new'] = true;
                    }
                    if (!empty($forum['l_topic'])) {
                        if (isset($prefix[$forum['id']][$forum['l_prefix']]) && $forum['l_prefix'] > 0) {
                            $lang->assign('prefix', $prefix[$forum['id']][$forum['l_prefix']]['value']);
                            $forum['l_prefix'] = $lang->phrase('showtopic_prefix_title');
                        } else {
                            $forum['l_prefix'] = '';
                        }
                        if (strxlen($forum['l_topic']) > $config['lasttopic_chars']) {
                            $forum['l_topic_full'] = $forum['l_prefix'] . $forum['l_topic'];
                            $forum['l_topic'] = subxstr($forum['l_topic'], 0, $config['lasttopic_chars']);
                            $forum['l_topic'] .= "...";
                        } else {
                            $forum['l_topic_full'] = '';
                        }
                        $forum['l_date'] = str_date($lang->phrase('dformat1'), times($forum['l_date']));
                    }
                }
            }
            $forum['topics'] = numbers($forum['topics']);
            $forum['replies'] = numbers($forum['replies']);
            // Moderatoren
            $forum['mod'] = array();
            if (isset($mod_cache[$forum['id']])) {
                $anz2 = count($mod_cache[$forum['id']]);
                for ($i = 0; $i < $anz2; $i++) {
                    if ($anz2 != $i + 1) {
                        $mod_cache[$forum['id']][$i]['sep'] = ', ';
                    } else {
                        $mod_cache[$forum['id']][$i]['sep'] = '';
                    }
                    $forum['mod'][] = $mod_cache[$forum['id']][$i];
                }
            }
            // Unterforen
            $forum['sub'] = array();
            if ($config['showsubfs']) {
                if (isset($sub_cache[$forum['id']])) {
                    $anz2 = count($sub_cache[$forum['id']]);
                    $sub = array();
                    for ($i = 0; $i < $anz2; $i++) {
                        $show = true;
                        $sub_cache[$forum['id']][$i]['new'] = false;
                        if ($sub_cache[$forum['id']][$i]['opt'] != 're') {
                            if (!check_forumperm($sub_cache[$forum['id']][$i])) {
                                if ($sub_cache[$forum['id']][$i]['invisible'] != 0) {
                                    $show = false;
                                } else {
                                    $sub_cache[$forum['id']][$i]['foldimg'] = $tpl->img('subcat_locked');
                                    $sub_cache[$forum['id']][$i]['state'] = BOARD_STATE_LOCKED;
                                }
                            } else {
                                if ($slog->isForumRead($sub_cache[$forum['id']][$i]['id'], $sub_cache[$forum['id']][$i]['l_date']) || $sub_cache[$forum['id']][$i]['topics'] < 1) {
                                    $sub_cache[$forum['id']][$i]['foldimg'] = $tpl->img('subcat_open');
                                    $sub_cache[$forum['id']][$i]['state'] = BOARD_STATE_OLD;
                                } else {
                                    $sub_cache[$forum['id']][$i]['foldimg'] = $tpl->img('subcat_red');
                                    $sub_cache[$forum['id']][$i]['state'] = BOARD_STATE_NEW;
                                    $sub_cache[$forum['id']][$i]['new'] = true;
                                }
                            }
                        } else {
                            $sub_cache[$forum['id']][$i]['foldimg'] = $tpl->img('subcat_redirect');
                            $sub_cache[$forum['id']][$i]['state'] = BOARD_STATE_WWW;
                        }
                        if ($show == true) {
                            $forum['sub'][] = $sub_cache[$forum['id']][$i];
                        }
                    }
                }
            }
            ($code = $plugins->load('forums_entry_prepared')) ? eval($code) : null;
            if ($forum['show'] == true) {
                $cat['forums'][] = $forum;
            } elseif ($forum['invisible'] != 2) {
                $hidden++;
            }
        }
        if (count($cat['forums']) > 0) {
            $cats[] = $cat;
        }
    }
    ($code = $plugins->load('forums_prepared')) ? eval($code) : null;
    $error_state = count($cats) == 0 && $board == 0;
    if (count($cats) > 0 || $error_state) {
        $tpl->globalvars(compact("cats", "board", "hidden", "error_state"));
        echo $tpl->parse("categories");
    }
    // Else: This is a forum without sub forums (that should be displayed)
    return $found;
}
         $vote['voted'] = $row['aid'];
     }
     // Create element in array with name (+ member id as key) at the selected answer
     $vote['voter'][$row['aid']][$row['mid']] = $memberdata[$row['mid']];
 }
 if ($vote['results'] == false) {
     // When we only show the form to submit/change a vote
     ($code = $plugins->load('showtopic_vote_prepared')) ? eval($code) : null;
     $inner['vote_result'] = $tpl->parse("showtopic/vote");
 } else {
     // Show the results
     foreach ($vote['entries'] as $key => $row) {
         if ($row['votes'] > 0) {
             $row['percent'] = $row['votes'] / $vote['count'] * 100;
             if (strstr($row['percent'], '.') > 0) {
                 $row['percent'] = numbers($row['percent'], 1);
             }
         } else {
             $row['percent'] = 0;
         }
         $vote['entries'][$key] = $row;
         // Make comma separated string from array of users
         // Keys: (0 = Voter separated by comma, 1,2,3,... = Voter name with id as key)
         if (count($vote['voter'][$row['id']]) > 0) {
             $vote['voter'][$row['id']][0] = implode(', ', $vote['voter'][$row['id']]);
         } else {
             $vote['voter'][$row['id']][0] = '-';
         }
     }
     if ($my->vlogin && $my->p['voting'] == 1 && $info['status'] == 0) {
         $vote['phrase'] = iif($vote['voted'] > 0, 'vote_change_option', 'vote_go_form');
function BoardSelect($board = 0)
{
    global $config, $my, $tpl, $db, $gpc, $lang, $scache, $plugins;
    $found = false;
    $sub_cache = array();
    $sub_cache_last = array();
    $cat_cache = array();
    $mod_cache = array();
    $forum_cache = array();
    $categories_obj = $scache->load('categories');
    $cat_cache = $categories_obj->get();
    $memberdata_obj = $scache->load('memberdata');
    $memberdata = $memberdata_obj->get();
    $index_moderators = $scache->load('index_moderators');
    $mod_cache = $index_moderators->get();
    ($code = $plugins->load('forums_query')) ? eval($code) : null;
    // Fetch Forums
    $result = $db->query("SELECT \n    \tc.id, c.name, c.desc, c.opt, c.optvalue, c.bid, c.topics, c.replys, c.cid, c.last_topic, c.invisible,  \n    \tt.topic as btopic, t.id as btopic_id, t.last as bdate, u.name AS uname, t.last_name AS bname\n    FROM {$db->pre}cat AS c\n        LEFT JOIN {$db->pre}topics AS t ON c.last_topic=t.id \n        LEFT JOIN {$db->pre}user AS u ON t.last_name=u.id \n    ORDER BY c.cid, c.c_order, c.id", __LINE__, __FILE__);
    if ($db->num_rows($result) == 0) {
        $errormsg = array('There are currently no boards to show. Pleas visit the <a href="admin.php' . SID2URL_1 . '">Admin Control Panel</a> and create some forums.');
        $errorurl = '';
        $tpl->globalvars(compact("errorurl", "errormsg"));
        echo $tpl->parse('main/error');
        return $found;
    }
    while ($row = $db->fetch_assoc($result)) {
        $gpc->prepare($row['name']);
        $gpc->prepare($row['btopic']);
        $gpc->prepare($row['uname']);
        $gpc->prepare($row['bname']);
        // Caching for Subforums
        if ($row['bid'] > 0) {
            $sub_cache[$row['bid']][] = $row;
            $sub_cache_last[$row['id']] = $row;
        }
        // Caching the Forums
        if ($row['bid'] == $board) {
            $forum_cache[$row['cid']][] = $row;
        }
        ($code = $plugins->load('forums_caching')) ? eval($code) : null;
    }
    // Work with the chached data!
    foreach ($cat_cache as $cat) {
        $forums = array();
        if (isset($forum_cache[$cat['id']]) == false) {
            continue;
        }
        foreach ($forum_cache[$cat['id']] as $forum) {
            $found = true;
            $forum['new'] = false;
            $forum['show'] = true;
            $forum['mbdate'] = $forum['bdate'];
            // Subforendaten vererben (Letzter Beitrag, Markierung)
            if (isset($sub_cache[$forum['id']])) {
                $substats = SubStats($forum['topics'], $forum['replys'], $forum['id'], $sub_cache);
                $forum['topics'] = $substats[0];
                $forum['replys'] = $substats[1];
                $bids = $substats[2];
            }
            $last = $forum['last_topic'];
            $last_date = $forum['bdate'];
            if (isset($sub_cache[$forum['id']])) {
                foreach ($bids as $bidf) {
                    $sub = $sub_cache_last[$bidf];
                    if ($last_date < $sub['bdate']) {
                        $last = $sub['id'];
                        $last_date = $sub['bdate'];
                    }
                }
            }
            $forum['lname'] = is_id($forum['bname']) ? $forum['uname'] : $forum['bname'];
            if ($last != $forum['last_topic']) {
                $forum['id2'] = $last;
                $forum['last_topic'] = $sub_cache_last[$forum['id2']]['last_topic'];
                $forum['btopic_id'] = $sub_cache_last[$forum['id2']]['btopic_id'];
                $forum['btopic'] = $sub_cache_last[$forum['id2']]['btopic'];
                $forum['bdate'] = $sub_cache_last[$forum['id2']]['bdate'];
                if (!isset($sub_cache_last[$forum['id2']]['lname'])) {
                    $forum['lname'] = is_id($sub_cache_last[$forum['id2']]['bname']) ? $sub_cache_last[$forum['id2']]['uname'] : $sub_cache_last[$forum['id2']]['bname'];
                } else {
                    $forum['lname'] = $sub_cache_last[$forum['id2']]['lname'];
                }
            } else {
                $forum['id2'] = $forum['id'];
            }
            $id = array_search(trim($forum['lname']), $memberdata);
            if (is_id($id)) {
                $forum['lname'] = array($forum['lname'], $id);
            } else {
                $forum['lname'] = array($forum['lname'], 0);
            }
            if ($forum['btopic_id']) {
                $forum['tid'] = $forum['btopic_id'];
            } else {
                $forum['tid'] = $forum['last_topic'];
            }
            // Rechte und Gelesensystem
            if ($forum['opt'] != 're') {
                if (!check_forumperm($forum)) {
                    if ($forum['invisible'] == 1) {
                        $forum['show'] = false;
                    }
                    $forum['foldimg'] = $tpl->img('cat_locked');
                    $forum['topics'] = '-';
                    $forum['replys'] = '-';
                    $forum['btopic'] = false;
                } else {
                    if (isset($my->mark['f'][$forum['id']]) && $my->mark['f'][$forum['id']] > $forum['bdate'] || $forum['bdate'] < $my->clv || $forum['topics'] < 1) {
                        $forum['foldimg'] = $tpl->img('cat_open');
                    } else {
                        $forum['foldimg'] = $tpl->img('cat_red');
                        $forum['new'] = true;
                    }
                    if ($forum['btopic']) {
                        if (strxlen($forum['btopic']) >= 40) {
                            $forum['btopic'] = substr($forum['btopic'], 0, 40);
                            $forum['btopic'] .= "...";
                        }
                        $forum['bdate'] = str_date($lang->phrase('dformat1'), times($forum['bdate']));
                    }
                }
            }
            $forum['topics'] = numbers($forum['topics']);
            $forum['replys'] = numbers($forum['replys']);
            // Moderatoren
            $forum['mod'] = array();
            if (isset($mod_cache[$forum['id']])) {
                $anz2 = count($mod_cache[$forum['id']]);
                for ($i = 0; $i < $anz2; $i++) {
                    if ($anz2 != $i + 1) {
                        $mod_cache[$forum['id']][$i]['sep'] = ', ';
                    } else {
                        $mod_cache[$forum['id']][$i]['sep'] = '';
                    }
                    $forum['mod'][] = $mod_cache[$forum['id']][$i];
                }
            }
            // Unterforen
            $forum['sub'] = array();
            if ($config['showsubfs']) {
                if (isset($sub_cache[$forum['id']])) {
                    $anz2 = count($sub_cache[$forum['id']]);
                    $sub = array();
                    for ($i = 0; $i < $anz2; $i++) {
                        $show = true;
                        $sub_cache[$forum['id']][$i]['new'] = false;
                        if ($sub_cache[$forum['id']][$i]['opt'] != 're') {
                            if (!check_forumperm($sub_cache[$forum['id']][$i])) {
                                if ($sub_cache[$forum['id']][$i]['invisible'] == 1) {
                                    $show = false;
                                } else {
                                    $sub_cache[$forum['id']][$i]['foldimg'] = $tpl->img('subcat_locked');
                                }
                            } else {
                                if (isset($my->mark['f'][$sub_cache[$forum['id']][$i]['id']]) && $my->mark['f'][$sub_cache[$forum['id']][$i]['id']] > $sub_cache[$forum['id']][$i]['bdate'] || $sub_cache[$forum['id']][$i]['bdate'] < $my->clv || $sub_cache[$forum['id']][$i]['topics'] < 1) {
                                    $sub_cache[$forum['id']][$i]['foldimg'] = $tpl->img('subcat_open');
                                } else {
                                    $sub_cache[$forum['id']][$i]['foldimg'] = $tpl->img('subcat_red');
                                    $sub_cache[$forum['id']][$i]['new'] = true;
                                }
                            }
                        } else {
                            $sub_cache[$forum['id']][$i]['foldimg'] = $tpl->img('subcat_redirect');
                        }
                        if ($show == true) {
                            $forum['sub'][] = $sub_cache[$forum['id']][$i];
                        }
                    }
                }
            }
            ($code = $plugins->load('forums_entry_prepared')) ? eval($code) : null;
            if ($forum['show'] == true) {
                $forums[] = $forum;
            }
        }
        if (count($forums) > 0) {
            $tpl->globalvars(compact("cat", "forums"));
            ($code = $plugins->load('forums_prepared')) ? eval($code) : null;
            echo $tpl->parse("categories");
        }
    }
    return $found;
}
     $db->query("UPDATE {$db->pre}postratings SET mid = '0' WHERE mid = '{$user['id']}'");
     // Step 10: Set post ratings from member to guests-group II
     $db->query("UPDATE {$db->pre}postratings SET aid = '0' WHERE aid = '{$user['id']}'");
     // Step 11: Delete pic
     removeOldImages('uploads/pics/', $user['id']);
     // Step 12: Delete user himself
     $db->query("DELETE FROM {$db->pre}user WHERE id = '{$user['id']}'");
     // Step 13: Delete user's custom profilefields
     $db->query("DELETE FROM {$db->pre}userfields WHERE ufid = '{$user['id']}'");
     $cache = $scache->load('memberdata');
     $cache = $cache->delete();
     ($code = $plugins->load('managemembers_delete_end')) ? eval($code) : null;
     ok($lang->phrase('member_deleted'), 'members.php' . SID2URL_1);
 } elseif ($_GET['action'] == 'edit') {
     $lang->group("timezones");
     $chars = numbers($config['maxaboutlength']);
     BBProfile($bbcode);
     ($code = $plugins->load('managemembers_edit_start')) ? eval($code) : null;
     if (empty($user['template'])) {
         $user['template'] = $config['templatedir'];
     }
     if (empty($user['language'])) {
         $user['language'] = $config['langdir'];
     }
     $user['icq'] = iif(empty($user['icq']), '', $user['icq']);
     // Settings
     $loaddesign_obj = $scache->load('loaddesign');
     $design = $loaddesign_obj->get();
     $mydesign = $design[$user['template']]['name'];
     $loadlanguage_obj = $scache->load('loadlanguage');
     $language = $loadlanguage_obj->get();
	echo $tpl->parse("header");
	echo $tpl->parse("menu");

	if ($db->num_rows($result) == 1) {
		$row = $slog->cleanUserData($db->fetch_object($result));

		$days2 = null;
		if ($config['showpostcounter'] == 1) {
			$days2 = $row->posts / ((time() - $row->regdate) / 86400);
			$days2 = sprintf("%01.2f", $days2);
			if ($row->posts < $days2) {
				$days2 = $row->posts;
			}
		}

		$row->posts = numbers($row->posts);

		$row->p = $slog->StrangerPermissions($row->groups, true);
		$row->level = $slog->getStatus($row->groups);

		$row->regdate = gmdate($lang->phrase('dformat2'), times($row->regdate));
		if ($row->lastvisit > 0) {
			$row->lastvisit = str_date($lang->phrase('dformat1'), times($row->lastvisit));
		}
		else {
			$row->lastvisit = $lang->phrase('profile_never');
		}

		BBProfile($bbcode);
		$bbcode->setSmileys(1);
		$bbcode->setReplace(0);
Example #9
0
				<div class="form-group">
					<table class="table table-striped table-bordered bootstrap-datatable responsive">
						<thead>
							<tr>
								<th class="col-md-2">Account</th>
								<th class="col-md-2">Amount</th>
								<th class="col-md-3">Remark</th>
							</tr>
						</thead>
						<tbody>
						<?php 
//print_mz($detail);
foreach ($detail as $isi) {
    if ($pay) {
        $isi['id'] = 0;
        $isi['debit'] = numbers($isi['total']);
        $isi['remark'] = $isi['desc'];
        $isi['ref'] = $isi['invoice'];
        $isi['kurs'] = 1;
    } elseif ($costruck) {
        $truck = GetValue('code', 'master_truck', array('id' => 'where/' . $isi['truck']));
        if ($truck == 0) {
            $truck = GetValue('name', 'master_vendor', array('id' => 'where/' . $val['vendor']));
            $mess = 'Penyewaan Truck Client ' . $truck . " Periode " . $val['period'];
        } else {
            $mess = 'Pembayaran Truck ' . $truck . " Periode " . $val['period'];
        }
        $isi['id'] = 0;
        $isi['kredit'] = $isi['amount'];
        $isi['remark'] = $mess;
        $isi['kurs'] = 1;
 /**
  * Gets the correct error message.
  *
  * Methoed tries to use $lang-Object. If not available, hardcoded english phrases will be used.
  *
  * @return	string		error message
  */
 function get_error()
 {
     if ($this->error == null) {
         return false;
     }
     $lang = new lang();
     $lang->group("classes");
     switch ($this->error) {
         case UPLOAD_ERR_FILE_INDEX:
             $message = $lang->phrase('upload_error_noupload');
             break;
         case UPLOAD_ERR_FILE_SIZE:
             $lang->assign('mfs', formatFilesize($this->max_filesize));
             $message = $lang->phrase('upload_error_maxfilesize');
             break;
         case UPLOAD_ERR_IMAGE_WIDTH:
         case UPLOAD_ERR_IMAGE_HEIGHT:
             $lang->assign('mih', $this->max_image_height > 0 ? numbers($this->max_image_height) : $lang->phrase('upload_unspecified'));
             $lang->assign('miw', $this->max_image_width > 0 ? numbers($this->max_image_width) : $lang->phrase('upload_unspecified'));
             $message = $lang->phrase('upload_error_maximagesize');
             break;
         case UPLOAD_ERR_FILE_TYPE:
             $lang->assign('aft', implode(', ', $this->file_types));
             $message = $lang->phrase('upload_error_wrongfiletype');
             break;
         case UPLOAD_ERR_COPY:
             $message = $lang->phrase('upload_error_noaccess');
             break;
         case UPLOAD_ERR_FILE_EXISTS:
             $message = $lang->phrase('upload_error_fileexists');
             break;
         default:
             $message = $lang->phrase('upload_error_default');
     }
     if (!empty($this->file['name'])) {
         return "{$this->file['name']}: {$message}";
     } else {
         return $message;
     }
 }
Example #11
0
<?php

include 'functions.php';
writeHello();
writeMsg('hello');
writeMsg('byebye');
writeMsgTo('Cemre', 'Function are cool!');
writeMsgTo('Henk');
$result = numbers(5, 7);
echo 'The outcome of 5 + 7 = ' . $result . '<br/>';
$result = calcRect(5, 7);
echo 'The area of a rectangle of 5 and 7 =' . $result . '<br/>';
?>

<br>
Exercise 2 BMI:
<form action="bmicalculator.php" method="post">
Lengte in M : <input type="text" name="lengte"></input>
Gewicht in kg : <input type="text" name="gewicht"></input>
<input type="submit" value="Bereken BMI"></input>
</form>

//$bmi = weight / (height * height);
    ## No version info. I'll lie and hope for the best.
    $version = '5.0.0';
}
## Old PHP version detected. EJECT! EJECT! EJECT!
if (!version_compare($version, '5.2.0', '>=')) {
    return JError::raise(E_ERROR, 500, 'PHP 4.x, 5.0 and 5.1 is no longer supported by RD-Media.', 'The version of PHP used on your site is obsolete and contains known security vulenrabilities. Moreover, it is missing features required by Ticketmaster to work properly or at all. Please ask your host to upgrade your server to the latest PHP 5.2 or 5.3 release. Thank you!');
}
## Starting a session.
$session =& JFactory::getSession();
## Gettig the orderid if there is one.
$ordercode = $session->get('ordercode');
## If there none.. Create a session for the order process.
if ($ordercode == '') {
    ## Creating an ordernumber for the client.
    ## This will be 8 numbers.
    $numbers = numbers();
    $session->set('ordercode', $numbers);
}
## Require the base controller
require_once JPATH_COMPONENT . DS . 'controller.php';
## Require specific controller if requested
if ($controller = JRequest::getWord('controller')) {
    $path = JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php';
    if (file_exists($path)) {
        require_once $path;
    } else {
        $controller = '';
    }
}
## Create the controller
$classname = 'TicketmasterController' . ucfirst($controller);
function BoardSelect($board = 0)
{
    global $config, $my, $tpl, $db, $gpc, $lang, $scache, $plugins;
    $found = false;
    $sub_cache = $forum_cache = $last_cache = array();
    $categories_obj = $scache->load('categories');
    $cat_cache = $categories_obj->get();
    $memberdata_obj = $scache->load('memberdata');
    $memberdata = $memberdata_obj->get();
    $index_moderators = $scache->load('index_moderators');
    $mod_cache = $index_moderators->get();
    ($code = $plugins->load('forums_query')) ? eval($code) : null;
    // Fetch Forums
    $result = $db->query("\n\tSELECT\n    \tf.id, f.name, f.description, f.opt, f.optvalue, f.parent, f.topics, f.replies, f.last_topic, f.invisible,\n    \tt.topic as l_topic, t.id as l_tid, t.last as l_date, u.name AS l_uname, t.last_name AS l_name, f.id AS l_bid\n    FROM {$db->pre}forums AS f\n        LEFT JOIN {$db->pre}topics AS t ON f.last_topic=t.id\n        LEFT JOIN {$db->pre}user AS u ON t.last_name=u.id\n    ORDER BY f.parent, f.position\n\t", __LINE__, __FILE__);
    $keys = array('l_topic' => null, 'l_tid' => null, 'l_date' => null, 'l_uname' => null, 'l_name' => null, 'l_bid' => null);
    if ($db->num_rows($result) == 0) {
        $errormsg = array('There are currently no boards to show. Pleas visit the <a href="admin.php' . SID2URL_1 . '">Admin Control Panel</a> and create some forums.');
        $errorurl = $js_errorurl = '';
        $tpl->globalvars(compact("js_errorurl", "errorurl", "errormsg"));
        echo $tpl->parse('main/error');
        return $found;
    }
    while ($row = $db->fetch_assoc($result)) {
        $row['name'] = $gpc->prepare($row['name']);
        $row['l_uname'] = $gpc->prepare($row['l_uname']);
        $row['l_name'] = $gpc->prepare($row['l_name']);
        $row['bid'] = $cat_cache[$row['parent']]['parent'];
        // Caching for Subforums
        if (!empty($row['bid'])) {
            $sub_cache[$row['bid']][] = $row;
        }
        // Caching the Forums
        if ($row['bid'] == $board) {
            $forum_cache[$row['parent']][] = $row;
        }
        $last_cache[$row['id']] = $row;
        ($code = $plugins->load('forums_caching')) ? eval($code) : null;
    }
    // Work with the chached data!
    foreach ($cat_cache as $cat) {
        $forums = array();
        if (isset($forum_cache[$cat['id']]) == false) {
            continue;
        }
        foreach ($forum_cache[$cat['id']] as $forum) {
            $found = true;
            $forum['new'] = false;
            $forum['show'] = true;
            // Subforendaten vererben (Letzter Beitrag, Markierung)
            if (isset($sub_cache[$forum['id']])) {
                $substats = SubStats($forum['topics'], $forum['replies'], $forum['id'], $sub_cache);
                $forum['topics'] = $substats[0];
                $forum['replies'] = $substats[1];
            }
            // Letzter Beitrag
            $last = $last_cache[$forum['id']];
            if (isset($sub_cache[$forum['id']])) {
                foreach ($substats[2] as $last_bid) {
                    $sub = $last_cache[$last_bid];
                    if ($last['l_date'] < $sub['l_date'] && check_forumperm($sub)) {
                        $last = $sub;
                    }
                }
            }
            $forum = array_merge($forum, array_intersect_key($last, $keys));
            if (is_id($forum['l_name']) && isset($memberdata[$forum['l_name']])) {
                $forum['l_name'] = array($forum['l_uname'], $forum['l_name']);
            } else {
                $forum['l_name'] = array($forum['l_name'], 0);
            }
            // Rechte und Gelesensystem
            if ($forum['opt'] != 're') {
                if (!check_forumperm($forum)) {
                    if ($forum['invisible'] != 0) {
                        $forum['show'] = false;
                    }
                    $forum['foldimg'] = $tpl->img('cat_locked');
                    $forum['topics'] = '-';
                    $forum['replies'] = '-';
                    $forum['l_topic'] = false;
                } else {
                    if (isset($my->mark['f'][$forum['id']]) && $my->mark['f'][$forum['id']] > $forum['l_date'] || $forum['l_date'] < $my->clv || $forum['topics'] < 1) {
                        $forum['foldimg'] = $tpl->img('cat_open');
                    } else {
                        $forum['foldimg'] = $tpl->img('cat_red');
                        $forum['new'] = true;
                    }
                    if (!empty($forum['l_topic'])) {
                        if (strxlen($forum['l_topic']) > $config['lasttopic_chars']) {
                            $forum['l_topic'] = substr($forum['l_topic'], 0, $config['lasttopic_chars']);
                            $forum['l_topic'] .= "...";
                        }
                        $forum['l_topic'] = $gpc->prepare($forum['l_topic']);
                        $forum['l_date'] = str_date($lang->phrase('dformat1'), times($forum['l_date']));
                    }
                }
            }
            $forum['topics'] = numbers($forum['topics']);
            $forum['replies'] = numbers($forum['replies']);
            // Moderatoren
            $forum['mod'] = array();
            if (isset($mod_cache[$forum['id']])) {
                $anz2 = count($mod_cache[$forum['id']]);
                for ($i = 0; $i < $anz2; $i++) {
                    if ($anz2 != $i + 1) {
                        $mod_cache[$forum['id']][$i]['sep'] = ', ';
                    } else {
                        $mod_cache[$forum['id']][$i]['sep'] = '';
                    }
                    $forum['mod'][] = $mod_cache[$forum['id']][$i];
                }
            }
            // Unterforen
            $forum['sub'] = array();
            if ($config['showsubfs']) {
                if (isset($sub_cache[$forum['id']])) {
                    $anz2 = count($sub_cache[$forum['id']]);
                    $sub = array();
                    for ($i = 0; $i < $anz2; $i++) {
                        $show = true;
                        $sub_cache[$forum['id']][$i]['new'] = false;
                        if ($sub_cache[$forum['id']][$i]['opt'] != 're') {
                            if (!check_forumperm($sub_cache[$forum['id']][$i])) {
                                if ($sub_cache[$forum['id']][$i]['invisible'] != 0) {
                                    $show = false;
                                } else {
                                    $sub_cache[$forum['id']][$i]['foldimg'] = $tpl->img('subcat_locked');
                                }
                            } else {
                                if (isset($my->mark['f'][$sub_cache[$forum['id']][$i]['id']]) && $my->mark['f'][$sub_cache[$forum['id']][$i]['id']] > $sub_cache[$forum['id']][$i]['l_date'] || $sub_cache[$forum['id']][$i]['l_date'] < $my->clv || $sub_cache[$forum['id']][$i]['topics'] < 1) {
                                    $sub_cache[$forum['id']][$i]['foldimg'] = $tpl->img('subcat_open');
                                } else {
                                    $sub_cache[$forum['id']][$i]['foldimg'] = $tpl->img('subcat_red');
                                    $sub_cache[$forum['id']][$i]['new'] = true;
                                }
                            }
                        } else {
                            $sub_cache[$forum['id']][$i]['foldimg'] = $tpl->img('subcat_redirect');
                        }
                        if ($show == true) {
                            $forum['sub'][] = $sub_cache[$forum['id']][$i];
                        }
                    }
                }
            }
            ($code = $plugins->load('forums_entry_prepared')) ? eval($code) : null;
            if ($forum['show'] == true) {
                $forums[] = $forum;
            }
        }
        if (count($forums) > 0) {
            $tpl->globalvars(compact("cat", "forums"));
            ($code = $plugins->load('forums_prepared')) ? eval($code) : null;
            echo $tpl->parse("categories");
        }
    }
    return $found;
}
Example #14
0
        echo $k;
    }
}
function numbers()
{
    for ($m = 1; $m < 9; $m++) {
        echo $m;
    }
}
function pass($pass)
{
    echo md5($pass);
}
convert();
echo "<pre>";
numbers();
echo "</pre>";
convert2();
if (empty($_POST['submit'])) {
    echo "<form action='probba17.php' method='post'>";
    echo "<p>user name</p>";
    echo "<input type='text' name='username' placeholder='enter some name...'>";
    echo "<p>password </p>";
    echo "<p><input type='password' name='password' placeholder='enter the pss...'></p>";
    echo "<input type='submit' name='submit' value='go'>";
    echo "</form>";
} else {
    echo "<pre>";
    pass($_POST['password']);
    echo "</pre>";
}