예제 #1
0
function print_out_all($data, $type = 'default')
{
    if ($type === 'tsv') {
        foreach ($data as $key => $_d) {
            print_out([$key => $_d], $type);
        }
    } else {
        print_out($data, $type);
    }
}
예제 #2
0
    }
} else {
    if (isset($login_cookie)) {
        $data = explode(":", $login_cookie);
        $username = mysql_clean($data[0]);
        $password = mysql_clean($data[1]);
        $sql = "SELECT * FROM users WHERE username = '******' AND password = '******'";
        $result = @$database->query($sql) or die("No.");
        // Huge error
        // Cookies don't match and no session, so tell them to logout!
        if ($database->num($result) < 1) {
            session_destroy();
            unset($username);
            unset($password);
            include $config['template_path'] . "header.php";
            print_out(lang('error_with_cookies'), lang_parse('error_cookie_body', array($config['url_path'] . '/logout.php')), false);
        } else {
            if ($database->num($result) > 0) {
                // Get the users data
                $user_data = $database->fetch($result);
                // What is this user classified as?
                $type = type($user_data['username']);
                // Tell us what they are
                switch ($type) {
                    case 1:
                        $_SESSION['admin'] = true;
                        break;
                    case 2:
                        $_SESSION['moderator'] = true;
                        break;
                    case 3:
예제 #3
0
                    case 908:
                        $error = lang('error_user_doesnt_exist');
                        break;
                    case 905:
                        $error = lang_parse('error_invalid_given', array(lang('email')));
                        break;
                    case 906:
                        $error = lang_parse('error_no_given', array(lang('key')));
                        break;
                    case 907:
                        $error = lang_parse('error_invalid_given', array(lang('key')));
                        break;
                    case 904:
                        $error = lang_parse('error_no_given', array(lang('email')));
                        break;
                    default:
                        print_out(lang('account_verified'), lang('redirect'));
                        break;
                }
            } else {
                print_out(lang('account_verified'), lang('redirect'));
            }
        }
    }
}
// Header
include $config['template_path'] . "navigation.php";
// Registration Form
include $config['template_path'] . "user/register.php";
// Footer
include $config['template_path'] . "footer.php";
예제 #4
0
                }
            } else {
                $posts = fetch(false, false, intval($_GET['id']), 'reply`, `time', 'ASC', $start_on, $config['messages_per_topic']);
            }
            // Number of pages
            $pagination = generate_pagination($topic_url, forum_count(false, $topic['id'], ''), $config['messages_per_topic'], $start);
        } else {
            print_out(lang('error_topic_missing'), lang('redirecting'));
        }
    } else {
        if (!is_numeric($id)) {
            print_out(lang_parse('error_given_not_numeric', array(lang('id_c'))), lang('redirecting'));
        }
    }
} else {
    print_out(lang_parse('error_invalid_given', array(lang('id'))), lang('redirecting'));
}
// Lets tell navigation we are viewing a topic
$in_topic = true;
/**
 * Include navigation template
 */
include $config['template_path'] . "navigation.php";
// Show first post
if ($config['show_first_post'] || $page == 0) {
    // First post showing~
    $author = user_data($topic['starter_id']);
    // The authors avatar if they have one
    $avatar_url = get_avatar($author['id']);
    // Topic status
    if ($closed) {
예제 #5
0
            if (is_string($data) && !is_numeric($data)) {
                $error = $data;
            } else {
                $data = topic($_GET['edit']);
                // Are we replying or is it a topic?
                if ($data['reply']) {
                    $id = $data['reply'];
                    $success = lang('success_edited_post');
                } else {
                    $id = $data['id'];
                    $success = lang('success_edited_topic');
                }
                // Create the url
                $redirect = $config['url_path'] . '/read.php?id=' . $id;
                // Redirect back to the topic!
                print_out($success, lang('redirecting_topic'), $redirect);
            }
        }
    }
}
// sanitize $reply
if (isset($_GET['reply'])) {
    if ($_GET['reply'] != 0) {
        /**
         * Validate reply with alpha
         */
        if (alpha($_GET['reply'], 'numeric')) {
            $reply = $_GET['reply'];
            // Get topic data
            $topic = topic($reply, 'subject');
            if ($topic) {
예제 #6
0
파일: zipcode.php 프로젝트: n0nick/scripts
        $result['zipcode'] = $zipcode;
    }
    if (!$success) {
        $result['error'] = 'An error has occured. Maybe one of the parameters is missing?';
    }
    print json_encode($result);
    exit;
}
$location = GET_or_default('location', 'תל אביב');
$pob = GET_or_default('pob', null);
$street = GET_or_default('street', null);
$house = GET_or_default('house', null);
$params = array('OpenAgent' => '', 'location' => $location);
switch (TRUE) {
    case !empty($pob):
        $params['pob'] = $pob;
        break;
    case !empty($street) && !empty($house):
        $params['street'] = $street;
        $params['house'] = $house;
        break;
    default:
        print_out(false);
}
$result = @file_get_contents(ZIPCODE_URL . http_build_query($params));
$result = @preg_match('/<body(?:.*?)>\\s*(?:RES)?8?(\\d*)/', $result, $matches);
if ($result && !empty($matches[1])) {
    print_out(true, $matches[1]);
} else {
    print_out(false);
}
예제 #7
0
 * Require common.php
 */
require "include/common.php";
// gets cookie if there is one
$login_cookie = @$_COOKIE["login"];
// if cookie is found, reset cookie and destroy session
if (isset($login_cookie)) {
    // logging out
    load_hook('logout');
    setcookie("login", "", time() - 60000 * 24 * 30);
    @session_start();
    session_destroy();
    /**
     * include header template
     */
    include $config['template_path'] . "header.php";
    print_out(lang('success_logout'), lang('redirecting'));
} else {
    // logging out
    load_hook('logout');
    @session_start();
    session_destroy();
    /**
     * include header template
     */
    include $config['template_path'] . "header.php";
    print_out(lang('success_logout'), lang('redirecting'));
}
?>
</body>
</html>
예제 #8
0
                    ?>
"><?php 
                    echo ago($row['date'] + $config['zone']);
                    ?>
 ago</span>
		</div>
<?php 
                }
            }
            ?>
	</div>
<?php 
            add_hook('footer_right', 'copyright', array());
            include $config['template_path'] . "footer.php";
        } else {
            print_out(lang('error_not_logged'), lang('redirecting'));
        }
    }
}
/**
 * Setup user title if no title is present.
 */
function get_title($data)
{
    if (!is_array($data)) {
        return 'err';
    }
    if (!$data['title']) {
        if ($data['admin']) {
            $data['title'] = "Administrator";
        } else {
예제 #9
0
파일: users.php 프로젝트: nijikokun/NinkoBB
                }
                // Include the navigation
                include $config['template_path'] . "user/navigation.php";
                // Include profile template
                include $config['template_path'] . "user/profile.php";
            } else {
                if ($action == "signature") {
                    // Include the navigation
                    include $config['template_path'] . "user/navigation.php";
                    // Include profile template
                    include $config['template_path'] . "user/signature.php";
                } else {
                    if ($action == "view") {
                        if (isset($_GET['id'])) {
                            if (alpha($_GET['id'], 'numeric')) {
                                $viewing = user_data($_GET['id']);
                            } else {
                                print_out(lang_parse('error_invalid_given'), array(lang('id')));
                            }
                        } else {
                            print_out(lang_parse('error_no_given'), array(lang('id')));
                        }
                        // Include profile template
                        include $config['template_path'] . "user/view.php";
                    }
                }
            }
        }
    }
}
include $config['template_path'] . "footer.php";
예제 #10
0
 /**
  * Render
  *
  * @access  public
  * @return  string
  */
 public function render(array $attr = array())
 {
     $output = array();
     if (!empty($this->_rows)) {
         if ($this->_responsive) {
             $output[] = '<div class="table-responsive">';
         }
         $this->_attributes['class'] = implode(' ', $this->_attributes['class']);
         $output[] = '<table' . $this->_stringify_attributes() . '>';
         if (isset($this->_caption)) {
             $output[] = '<caption>' . $this->_caption . '</caption>';
         }
         foreach ($this->_rows as $row) {
             $output[] = '<tr>';
             foreach ($this->_headers as $key => $header) {
                 $output[] = '<td>' . $row[$key] . '</td>';
             }
             $output[] = '</tr>';
         }
         $output[] = '</table>';
         if ($this->_responsive) {
             $output[] = '</div>';
         }
     }
     $output = implode(PHP_EOL, $output);
     print_out($output);
 }