Наследование: extends Illuminate\Support\Facades\URL
Пример #1
0
function display_page($errors = array())
{
    global $PAGE, $this_page, $THEUSER;
    $PAGE->page_start();
    $PAGE->stripe_start();
    if ($THEUSER->isloggedin()) {
        // Shouldn't really get here, but you never know.
        $URL = new URL('userlogout');
        ?>
	<p><strong>You are already logged in. <a href="<?php 
        echo $URL->generate();
        ?>
">Log out?</a></strong></p>
<?php 
        $PAGE->stripe_end();
        $PAGE->page_end();
        return;
    }
    ?>
	
				<p>Not yet a member? <a href="<?php 
    $URL = new URL("userjoin");
    echo $URL->generate();
    ?>
">Join now</a>!</p>

<?php 
    $PAGE->login_form($errors);
    $PAGE->stripe_end(array(array('type' => 'include', 'content' => 'userlogin')));
    $PAGE->page_end();
}
 /**
  * Build the user interface to ask for membership
  * 
  */
 function buildInterface()
 {
     $groupId = isset($GLOBALS['group_id']) ? $GLOBALS['group_id'] : $this->url->getGroupIdFromUrl($_SERVER['REQUEST_URI']);
     $userId = $this->getUserManager()->getCurrentUser()->getId();
     $param = $this->returnBuildInterfaceParam();
     echo "<b>" . $GLOBALS['Language']->getText($this->getTextBase(), 'perm_denied') . "</b>";
     echo '<br></br>';
     echo "<br>" . $GLOBALS['Language']->getText($this->getTextBase(), $param['index']);
     //In case of restricted user, we only show the zone text area to ask for membership
     //just when the requested page belongs to a project
     if (!($param['func'] == 'restricted_user_request' && !isset($groupId))) {
         $message = $GLOBALS['Language']->getText('project_admin_index', 'member_request_delegation_msg_to_requester');
         $pm = ProjectManager::instance();
         $dar = $pm->getMessageToRequesterForAccessProject($groupId);
         if ($dar && !$dar->isError() && $dar->rowCount() == 1) {
             $row = $dar->current();
             if ($row['msg_to_requester'] != "member_request_delegation_msg_to_requester") {
                 $message = $row['msg_to_requester'];
             }
         }
         echo $GLOBALS['Language']->getText($this->getTextBase(), 'request_to_admin');
         echo '<br></br>';
         echo '<form action="' . $param['action'] . '" method="post" name="display_form">
               <textarea wrap="virtual" rows="5" cols="70" name="' . $param['name'] . '">' . $message . ' </textarea></p>
               <input type="hidden" id="func" name="func" value="' . $param['func'] . '">
               <input type="hidden" id="groupId" name="groupId" value="' . $groupId . '">
               <input type="hidden" id="userId" name="userId" value="' . $userId . '">
               <input type="hidden" id="data" name="url_data" value="' . $_SERVER['REQUEST_URI'] . '">
               <br><input name="Submit" type="submit" value="' . $GLOBALS['Language']->getText('include_exit', 'send_mail') . '"/></br>
           </form>';
     }
 }
Пример #3
0
 /**
  * Get Menu Links
  *
  * Takes an array of pages and returns an array suitable for use in links.
  */
 private function get_menu_links($pages)
 {
     global $DATA, $this_page;
     $links = array();
     foreach ($pages as $page) {
         //get meta data
         $menu = $DATA->page_metadata($page, 'menu');
         if ($menu) {
             $title = $menu['text'];
         } else {
             $title = $DATA->page_metadata($page, 'title');
         }
         $url = $DATA->page_metadata($page, 'url');
         $tooltip = $DATA->page_metadata($page, 'heading');
         //check for external vs internal menu links
         if (!valid_url($url)) {
             $URL = new \URL($page);
             $url = $URL->generate();
         }
         //make the link
         if ($page == $this_page) {
             $links[] = array('href' => '#', 'title' => '', 'classes' => '', 'text' => $title);
         } else {
             $links[] = array('href' => $url, 'title' => $tooltip, 'classes' => '', 'text' => $title);
         }
     }
     return $links;
 }
Пример #4
0
function _api_getPerson_row($row, $has_party = FALSE)
{
    global $parties;
    $row['full_name'] = member_full_name($row['house'], $row['title'], $row['first_name'], $row['last_name'], $row['constituency']);
    if ($row['house'] == 1) {
        $URL = new URL('mp');
        $row['url'] = $URL->generate('none') . make_member_url($row['full_name'], $row['constituency'], $row['house']);
    }
    if ($has_party && isset($parties[$row['party']])) {
        $row['party'] = $parties[$row['party']];
    }
    list($image, $sz) = find_rep_image($row['person_id']);
    if ($image) {
        list($width, $height) = getimagesize(str_replace(IMAGEPATH, BASEDIR . '/images/', $image));
        $row['image'] = $image;
        $row['image_height'] = $height;
        $row['image_width'] = $width;
    }
    if ($row['house'] == 1 && ($row['left_house'] == '9999-12-31' || $row['left_house'] == '2010-04-12')) {
        # XXX
        # Ministerialships and Select Committees
        $db = new ParlDB();
        $q = $db->query('SELECT * FROM moffice WHERE to_date="9999-12-31" and person=' . $row['person_id'] . ' ORDER BY from_date DESC');
        for ($i = 0; $i < $q->rows(); $i++) {
            $row['office'][] = $q->row($i);
        }
    }
    foreach ($row as $k => $r) {
        if (is_string($r)) {
            $row[$k] = html_entity_decode($r);
        }
    }
    return $row;
}
 /**
  * Connect to store using a DSN
  *
  * @param   string dsn
  * @return  bool success
  * @see     php://imap_open
  * @throws  lang.IllegalArgumentException in case scheme is not recognized
  * @throws  peer.mail.MessagingException
  */
 public function connect($dsn)
 {
     $flags = OP_HALFOPEN;
     // Parse DSN
     $u = new URL($dsn);
     $attr = $u->getParams();
     // DSN supported?
     if (FALSE === $this->_supports($u, $attr)) {
         return FALSE;
     }
     // Read-only?
     if ($u->getParam('open')) {
         $flags ^= OP_HALFOPEN;
     }
     if ($u->getParam('read-only')) {
         $flags |= OP_READONLY;
     }
     $mbx = isset($attr['mbx']) ? $attr['mbx'] : sprintf('{%s:%d/%s}', $u->getHost(), $u->getPort($attr['port']), $u->getParam('proto', $attr['proto']));
     // Connect
     if (FALSE === ($conn = $this->_connect($mbx, @$u->getUser(), @$u->getPassword(), $flags))) {
         throw new MessagingException('Connect to "' . $u->getUser() . '@' . $mbx . '" failed', $this->_errors());
     }
     $this->_hdl = array($conn, $mbx);
     return TRUE;
 }
Пример #6
0
 protected function getURLs()
 {
     $urls = array();
     $regional = new \URL('msp');
     $urls['regional'] = $regional->generate();
     return $urls;
 }
Пример #7
0
function get_listurl($q) {
	global $hansardmajors;
	$id_data = array(
		'gid' => fix_gid_from_db($q->field(0, 'gid')),
		'major' => $q->field(0, 'major'),
		'htype' => $q->field(0, 'htype'),
		'subsection_id' => $q->field(0, 'subsection_id'),
	);
	$db = new ParlDB;
	$LISTURL = new URL($hansardmajors[$id_data['major']]['page_all']);
	$fragment = '';
	if ($id_data['htype'] == '11' || $id_data['htype'] == '10') {
		$LISTURL->insert( array( 'id' => $id_data['gid'] ) );
	} else {
		$parent_epobject_id = $id_data['subsection_id'];
		$parent_gid = '';
		$r = $db->query("SELECT gid
				FROM 	hansard
				WHERE	epobject_id = '" . mysql_real_escape_string($parent_epobject_id) . "'
				");
		if ($r->rows() > 0) {
			$parent_gid = fix_gid_from_db( $r->field(0, 'gid') );
		}
		if ($parent_gid != '') {
			$LISTURL->insert( array( 'id' => $parent_gid ) );
			$fragment = '#g' . gid_to_anchor($id_data['gid']);
		}
	}
	return $LISTURL->generate('none') . $fragment;
}
 /**
  * @param APPLICATION $context
  */
 public function __construct($context)
 {
     parent::__construct($context);
     $cmd = $this->make_command();
     $cmd->id = 'create';
     $cmd->caption = 'New user';
     $cmd->link = "create_user.php";
     $cmd->icon = '{icons}buttons/create';
     $cmd->executable = $this->login->is_allowed(Privilege_set_user, Privilege_create);
     $cmd->importance = Command_importance_high + Command_importance_increment;
     $this->append($cmd);
     $link_url = new URL($this->env->url(Url_part_no_host_path));
     $link_url->replace_argument('show_anon', '');
     $cmd = $this->make_command();
     $cmd->id = 'show_registered';
     $cmd->caption = 'Show registered users';
     $cmd->link = $link_url->as_text();
     $cmd->icon = '{icons}buttons/login';
     $cmd->executable = read_var('show_anon');
     $cmd->importance = Command_importance_high;
     $this->append($cmd);
     $link_url->replace_argument('show_anon', 1);
     $cmd = $this->make_command();
     $cmd->id = 'show_anonymous';
     $cmd->caption = 'Show anonymous users';
     $cmd->link = $link_url->as_text();
     $cmd->icon = '{icons}buttons/anonymous';
     $cmd->executable = !read_var('show_anon');
     $cmd->importance = Command_importance_high;
     $this->append($cmd);
 }
Пример #9
0
function generate_rows($q)
{
    global $db;
    $rows = array();
    $USERURL = new URL('userview');
    for ($row = 0; $row < $q->rows(); $row++) {
        $email = $q->field($row, 'email');
        $criteria = $q->field($row, 'criteria');
        $SEARCHENGINE = new SEARCHENGINE($criteria);
        $r = $db->query("SELECT user_id,firstname,lastname FROM users WHERE email = '" . mysql_escape_string($email) . "'");
        if ($r->rows() > 0) {
            $user_id = $r->field(0, 'user_id');
            $USERURL->insert(array('u' => $user_id));
            $name = '<a href="' . $USERURL->generate() . '">' . $r->field(0, 'firstname') . ' ' . $r->field(0, 'lastname') . '</a>';
        } else {
            $name = $email;
        }
        $created = $q->field($row, 'created');
        if ($created == '0000-00-00 00:00:00') {
            $created = '&nbsp;';
        }
        $rows[] = array($name, $SEARCHENGINE->query_description_long(), $created);
    }
    return $rows;
}
Пример #10
0
 protected function generate_votes($votes, $id, $gid)
 {
     /*
     Returns HTML for the 'Does this answer the question?' links (wrans) in the sidebar.
     $votes = => array (
         'user'    => array ( 'yes' => '21', 'no' => '3' ),
         'anon'    => array ( 'yes' => '132', 'no' => '30' )
     )
     */
     global $this_page;
     # If there's a "q" we assume it's a question and ignore it
     if (strstr($gid, 'q')) {
         return;
     }
     $data = array();
     if ($this->votelinks_so_far > 0 || strstr($gid, 'r')) {
         $yesvotes = $votes['user']['yes'] + $votes['anon']['yes'];
         $novotes = $votes['user']['no'] + $votes['anon']['no'];
         $yesplural = $yesvotes == 1 ? 'person thinks' : 'people think';
         $noplural = $novotes == 1 ? 'person thinks' : 'people think';
         $URL = new \URL($this_page);
         $returl = $URL->generate();
         $VOTEURL = new \URL('epvote');
         $VOTEURL->insert(array('v' => '1', 'id' => $id, 'ret' => $returl));
         $yes_vote_url = $VOTEURL->generate();
         $VOTEURL->insert(array('v' => '0'));
         $no_vote_url = $VOTEURL->generate();
         $data = array('yesvotes' => $yesvotes, 'yesplural' => $yesplural, 'yesvoteurl' => $yes_vote_url, 'novoteurl' => $no_vote_url, 'novotes' => $novotes, 'noplural' => $noplural);
     }
     $this->votelinks_so_far++;
     return $data;
 }
Пример #11
0
 function FileReader($file = NULL)
 {
     $fileobj = NULL;
     if (!isset($file)) {
         return;
     }
     if (URL::validClass($file)) {
         $fileobj = $file;
         $path = $fileobj->toString();
     } else {
         if (File::validClass($file)) {
             $fileobj = $file;
             $path = $fileobj->getFilePath();
         } else {
             $str = StringBuffer::toStringBuffer($file);
             if ($str->startsWith('http://') || $str->startsWith('ftp://') || $str->startsWith('php://')) {
                 $fileobj = new URL($str);
                 $path = $fileobj->toString();
             } else {
                 $fileobj = new File($file);
                 $path = $fileobj->getFilePath();
             }
         }
     }
     if (isset($fileobj)) {
         $this->handle = @fopen($path, 'r');
         if (isset($this->handle)) {
             $this->file = $fileobj;
         }
     }
 }
Пример #12
0
 function done($locator)
 {
     $response = $locator->get('Response');
     $url = new URL('action');
     $response->setRedirect($url->getURL('foo'));
     #		echo 'Form1View: DoneHandler: STATE DONE<br/>';
 }
Пример #13
0
 /**
  * Get FROB URL
  *
  * @param   &com.flickr.xmlrpc.Client client
  * @return  string url
  */
 public function getFrobURL($client)
 {
     $arguments = array('frob' => $this->getFrobValue(), 'perms' => 'read');
     $arguments = $client->signArray($arguments);
     $url = new URL('http://flickr.com/services/auth');
     $url->addParams($arguments);
     return $url->getURL();
 }
Пример #14
0
 /**
  * Check whether a given URL is excluded
  *
  * @param   peer.URL url
  * @return  bool
  */
 public function isExcluded(URL $url)
 {
     foreach ($this->excludes as $pattern) {
         if (stristr($url->getHost(), $pattern)) {
             return TRUE;
         }
     }
     return FALSE;
 }
 static function rewrite(Location $l) {
   $rv = Location::rewrite($l);
   $u = new URL($rv);
   
   $action = $u->query['action'];
   unSet($u->query['action']);
   $u->resource = $action;
   return str_replace('?', '/', $u->toString());
 }
Пример #16
0
 private function getPostCodeChangeURL()
 {
     global $THEUSER;
     $CHANGEURL = new \URL('userchangepc');
     if ($THEUSER->isloggedin()) {
         $CHANGEURL = new \URL('useredit');
     }
     return $CHANGEURL->generate();
 }
 /**
  * Render the grid itself.
  * @param ALBUM_ENTRY[] $objects
  * @access private
  */
 protected function _draw($objects)
 {
     if (sizeof($objects)) {
         $this->_url = new URL($objects[0]->home_page());
         $url = new URL($this->env->url(Url_part_no_host_path));
         $this->_url->replace_arguments($url->query_string());
     }
     parent::_draw($objects);
 }
Пример #18
0
 /**
  * Set URL
  *
  * @param   peer.URL url object
  */
 public function setUrl(URL $url)
 {
     $this->url = $url;
     if ($url->getUser() && $url->getPassword()) {
         $this->headers['Authorization'] = array('Basic ' . base64_encode($url->getUser() . ':' . $url->getPassword()));
     }
     $port = $this->url->getPort(-1);
     $this->headers['Host'] = array($this->url->getHost() . (-1 == $port ? '' : ':' . $port));
     $this->target = $this->url->getPath('/');
 }
 static function rewrite(Location $l) {
   $rv = Location::rewrite($l);
   $u = new URL($rv);
   
   list($path, $res) = explode('?', $rv);
   $res = base64_encode($res); 
   $u->query = array();
   $u->resource = '';
   return $u->toString() . $res;
 }
Пример #20
0
 /**
  * Set URL
  *
  * @param   peer.URL url object
  */
 public function setUrl(URL $url)
 {
     $this->url = $url;
     if ($url->getUser() && $url->getPassword()) {
         $this->setHeader('Authorization', new BasicAuthorization($url->getUser(), new SecureString($url->getPassword())));
     }
     $port = $this->url->getPort(-1);
     $this->headers['Host'] = array($this->url->getHost() . (-1 == $port ? '' : ':' . $port));
     $this->target = $this->url->getPath('/');
 }
 /**
  * Create client by inspecting the URL
  * 
  * @param string url The API url
  * @return com.atlassian.jira.api.JiraClientProtocol
  */
 public static function forURL($url)
 {
     $u = new URL($url);
     // Check for REST API client v2
     if (create(new String($u->getPath()))->contains('/rest/api/2')) {
         return XPClass::forName('com.atlassian.jira.api.protocol.JiraClientRest2Protocol')->newInstance($u);
         // No suitable protocol found
     } else {
         throw new IllegalArgumentException('No suitable client found for ' . $url);
     }
 }
Пример #22
0
 protected function getURLs()
 {
     $urls = array();
     $search = new \URL('search');
     $urls['search'] = $search->generate();
     $alert = new \URL('alert');
     $urls['alert'] = $alert->generate();
     $regional = new \URL('msp');
     $urls['regional'] = $regional->generate();
     return $urls;
 }
Пример #23
0
 public function __construct($params = null)
 {
     parent::loadParamMap(array(), $params);
     $ud = new URL(parent::getParam(0));
     if (!$ud->id) {
         header('Location: /');
     } else {
         $ud->addLog();
         header('Location: ' . $ud->destinationURL);
     }
     exit;
 }
/**
 * Providing the standard PHP interface.
 *
 * Mostly compatible to {@link http://php.net/manual/en/function.parse-url.php \parse_url()}
 *
 * The 2nd parameter which can be provided in the original php function can't
 * be supported here, because there are no constants for the additional values.
 *
 * As this function wants to be compatible to {@link http://php.net/manual/en/function.parse-url.php \parse_url()}
 * it returns <tt>false</tt> (instead of throwing exceptions) in case of
 * failiures.
 *
 * @return array|boolean
 * @param $url string
 * @author akrys
 */
function parse_url($url)
{
    try {
        $obj = new URL($url);
        return $obj->parse();
    } catch (\Exception $e) {
        //some error handling one could think of.
        //for simple dev purposes, a simple var_dump should be enough
        //		print $e->getMessage();
        //		var_dump($e->getTraceAsString());
    }
    return false;
}
Пример #25
0
 public static function getModule($module)
 {
     $auth = new Auth();
     $mod = new Module();
     $url = new URL();
     $config = new Config();
     $pm = new PageManager();
     if ($url->getRequestedFunction() == 'angular') {
         if (!isset($mod->moduleRegister[$module]) && !is_file(realpath(root . DS . "views" . DS) . "/" . $module . ".php") && !$pm->isPage($module)) {
             return 'error';
         } else {
             if (!$auth->isAdmin() && (isset($mod->moduleRegister[$module][1]) && $mod->moduleRegister[$module][1] == 'admin')) {
                 return 'login';
             } else {
                 if (is_file(realpath(root . DS . "views" . DS) . "/" . $module . ".php")) {
                     return $module;
                 } else {
                     if ($pm->isPage($module)) {
                         return $pm->deaultPage;
                     }
                 }
             }
         }
     } else {
         if (!isset($mod->moduleRegister[$module]) && !is_file(realpath(root . DS . "views" . DS) . "/" . $module . ".php")) {
             return 'index';
         } else {
             if (isset($mod->moduleRegister[$module]) && !isset($mod->moduleRegister[$module][1])) {
                 return 'index';
             } else {
                 if (!$auth->isAdmin() && isset($mod->moduleRegister[$module][1]) && $mod->moduleRegister[$module][1] == 'admin') {
                     if ($auth->isItAuthUser()) {
                         return 'error';
                     } else {
                         header("Location:" . $config->site_address . "login");
                         return 'login';
                     }
                 } else {
                     if ($auth->isItAuthUser() && (isset($mod->moduleRegister[$module][1]) && ($mod->moduleRegister[$module][1] == 'auth' || $mod->moduleRegister[$module][1] == 'admin'))) {
                         return 'dashboard';
                     } else {
                         if (is_file(realpath(root . DS . "views" . DS) . "/" . $module . ".php")) {
                             return $module;
                         }
                     }
                 }
             }
         }
     }
     return $mod->moduleRegister[$module][0];
 }
Пример #26
0
 public function get_values()
 {
     global $this_page;
     $data = array();
     // TODO: think about not hard coding these
     $current_question = 3;
     $always_ask = 1;
     $data['survey_site'] = "twfy-mini-{$current_question}";
     $show_survey_qn = 0;
     $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
     $has_answered_question = get_http_var('answered_survey');
     $hide_question = get_http_var('hide_survey');
     $data['show'] = false;
     if ($hide_question) {
         $always_ask = 0;
         $show_survey_qn = $current_question;
         setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/');
     } elseif ($has_answered_question == $current_question && !$always_ask) {
         $show_survey_qn = $current_question;
         setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/');
     } elseif (isset($_COOKIE['survey'])) {
         $show_survey_qn = $_COOKIE['survey'];
     }
     if ($show_survey_qn < $current_question && !$has_answered_question) {
         $data['show'] = true;
         $page_url = '';
         $hide_url = '';
         if (in_array($this_page, array('mp', 'peer', 'msp', 'mla', 'royal'))) {
             global $MEMBER;
             if ($MEMBER) {
                 $page_url = $MEMBER->url() . "?answered_survey={$current_question}";
                 $hide_url = $MEMBER->url() . "?hide_survey={$current_question}";
             }
         } else {
             $URL = new \URL($this_page);
             $URL->insert(array('answered_survey' => $current_question));
             $page_url = 'http://' . DOMAIN . $URL->generate();
             $URL = new \URL($this_page);
             $URL->insert(array('hide_survey' => $current_question));
             $hide_url = 'http://' . DOMAIN . $URL->generate();
         }
         $data['page_url'] = $page_url;
         $data['hide_url'] = $hide_url;
         $data['user_code'] = bin2hex(urandom_bytes(16));
         $data['auth_signature'] = auth_sign_with_shared_secret($data['user_code'], OPTION_SURVEY_SECRET);
         $data['datetime'] = time();
     }
     $data['current_q'] = $current_question;
     $data['answered'] = $has_answered_question;
     return $data;
 }
Пример #27
0
function gid_to_url($gid)
{
    if (!$gid) {
        return '';
    }
    global $hansardmajors;
    global $db;
    $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array(':gid' => $gid));
    $url_gid = fix_gid_from_db($gid);
    $url = new \URL($hansardmajors[$q->field(0, 'major')]['page']);
    $url->insert(array('id' => $url_gid));
    $url = 'http://' . DOMAIN . $url->generate();
    return $url;
}
Пример #28
0
 public function internalToSeo(URL $internal_url)
 {
     $address = trim($internal_url->getAddress(), ' /');
     $address_parts = explode('/', $address);
     $first_part = isset($address_parts[0]) ? $address_parts[0] : '';
     $is_inside_var_or_temp = in_array($first_part, array('var', 'temp'));
     if ($is_inside_var_or_temp) {
         $new_address = $address;
     } else {
         $new_address = $address ? "admin/{$address}" : "admin";
     }
     $internal_url->setAddress($new_address);
     return $internal_url;
 }
Пример #29
0
 function testURLSetGet()
 {
     $url = new URL();
     $serverstr = 'http://' . $_SERVER['HTTP_HOST'];
     $expected = $serverstr . $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
     $urlstr = $url->URL();
     echo "{$urlstr}, {$expected}<br/>";
     $this->assertTrue($urlstr == $expected);
     $targetstr = '/test/test.php';
     $expected = $serverstr . $targetstr;
     $urlstr = $url->URL($targetstr);
     echo "{$urlstr}, {$expected}<br/>";
     $this->assertTrue($urlstr == $expected);
 }
Пример #30
0
 public function action_new()
 {
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('New field')));
     $this->template->title = __('New Custom Field for Advertisement');
     //find all, for populating form select fields
     $categories = Model_Category::get_as_array();
     $order_categories = Model_Category::get_multidimensional();
     if ($_POST) {
         if (count(Model_Field::get_all()) > 65) {
             Alert::set(Alert::ERROR, __('You have reached the maximum number of custom fields allowed.'));
             HTTP::redirect(Route::url('oc-panel', array('controller' => 'fields', 'action' => 'index')));
         }
         $name = URL::title(Core::post('name'));
         $field = new Model_Field();
         try {
             $options = array('label' => Core::post('label'), 'tooltip' => Core::post('tooltip'), 'required' => Core::post('required') == 'on' ? TRUE : FALSE, 'searchable' => Core::post('searchable') == 'on' ? TRUE : FALSE, 'admin_privilege' => Core::post('admin_privilege') == 'on' ? TRUE : FALSE, 'show_listing' => Core::post('show_listing') == 'on' ? TRUE : FALSE);
             if ($field->create($name, Core::post('type'), Core::post('values'), Core::post('categories'), $options)) {
                 Core::delete_cache();
                 Alert::set(Alert::SUCCESS, sprintf(__('Field %s created'), $name));
             } else {
                 Alert::set(Alert::WARNING, sprintf(__('Field %s already exists'), $name));
             }
         } catch (Exception $e) {
             throw HTTP_Exception::factory(500, $e->getMessage());
         }
         HTTP::redirect(Route::url('oc-panel', array('controller' => 'fields', 'action' => 'index')));
     }
     $this->template->content = View::factory('oc-panel/pages/fields/new', array('categories' => $categories, 'order_categories' => $order_categories));
 }