summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2013-05-10 23:26:13 +0200
committerFlorian Pritz <bluewind@xinu.at>2013-05-10 23:26:13 +0200
commitd575e1bcb35dc228f3851fbf1f9d4a1de0bdecc4 (patch)
tree3485b0aabda72fb468697fd6f6106e621eeb529b /application
parent42695b54153bcee27d2d66bd9d50bcced30d3ec1 (diff)
Hide function not supported by auth driver
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application')
-rw-r--r--application/helpers/filebin_helper.php15
-rw-r--r--application/views/file/upload_form.php8
-rw-r--r--application/views/header.php8
3 files changed, 27 insertions, 4 deletions
diff --git a/application/helpers/filebin_helper.php b/application/helpers/filebin_helper.php
index 0951527fe..0063b6526 100644
--- a/application/helpers/filebin_helper.php
+++ b/application/helpers/filebin_helper.php
@@ -284,4 +284,19 @@ function getNormalizedFILES()
return $ret;
}
+// Allow simple checking inside views
+function auth_driver_function_implemented($function)
+{
+ static $result = array();
+ if (isset($result[$function])) {
+ return $result[$function];
+ }
+
+ $CI =& get_instance();
+ $CI->load->driver("duser");
+ $result[$function] = $CI->duser->is_implemented($function);;
+
+ return $result[$function];
+}
+
# vim: set noet:
diff --git a/application/views/file/upload_form.php b/application/views/file/upload_form.php
index 0596fcbaf..be449ee6e 100644
--- a/application/views/file/upload_form.php
+++ b/application/views/file/upload_form.php
@@ -41,7 +41,9 @@
<input type="text" name="username" placeholder="Username" />
<input type="password" name="password" placeholder="Password" />
<input type="submit" class="btn btn-primary" value="Login" name="process" style="margin-bottom: 9px" />
- <p style="display: inline"><?php echo anchor("user/reset_password", "Forgot your password?"); ?></p>
+ <?php if(auth_driver_function_implemented("can_reset_password")) { ?>
+ <p style="display: inline"><?php echo anchor("user/reset_password", "Forgot your password?"); ?></p>
+ <?php } ?>
</form>
<?php } ?>
<div class="row">
@@ -65,7 +67,9 @@
<div class="span6">
<div class="page-header"><h1>Information</h1></div>
<p>This website's primary goal is aiding developers, power users, students and alike in solving problems, debugging software, sharing their configuration, etc. It is not intended to distribute confidential or harmful information, scripts or software.</p>
- <p>If you believe you deserve an account, ask someone who is already using this service to <a href="<?php echo site_url("user/invite"); ?>">invite</a> you.</p>
+ <?php if(auth_driver_function_implemented("can_register_new_users")) { ?>
+ <p>If you believe you deserve an account, ask someone who is already using this service to <a href="<?php echo site_url("user/invite"); ?>">invite</a> you.</p>
+ <?php } ?>
<?php if(isset($contact_me_url) && $contact_me_url) { ?>
<p>If you experience any problems feel free to <a href="<?php echo $contact_me_url; ?>">contact me</a>.</p>
<?php } ?>
diff --git a/application/views/header.php b/application/views/header.php
index be0cffdab..40bb6e6a3 100644
--- a/application/views/header.php
+++ b/application/views/header.php
@@ -41,7 +41,9 @@ if (is_cli_client() && !isset($force_full_html)) {
<li class="dropdown">
<a class="dropdown-toggle" href="#" data-toggle="dropdown">Login <b class="caret"></b></a>
<div class="dropdown-menu" style="padding: 15px;">
- <p><?php echo anchor("user/reset_password", "Forgot your password?"); ?></p>
+ <?php if(auth_driver_function_implemented("can_reset_password")) { ?>
+ <p><?php echo anchor("user/reset_password", "Forgot your password?"); ?></p>
+ <?php } ?>
<?php echo form_open("user/login"); ?>
<input type="text" name="username" placeholder="Username" class="input-medium">
<input type="password" name="password" placeholder="Password" class="input-medium">
@@ -56,7 +58,9 @@ if (is_cli_client() && !isset($force_full_html)) {
<?php if(isset($username) && $username) { ?>
<li><a href="<?php echo site_url("file/index") ?>"><i class="icon-pencil icon-white"></i> New</a></li>
<li><a href="<?php echo site_url("file/upload_history") ?>"><i class="icon-book icon-white"></i> History</a></li>
- <li><a href="<?php echo site_url("user/invite") ?>"><i class="icon-plus icon-white"></i> Invite</a></li>
+ <?php if(auth_driver_function_implemented("can_register_new_users")) { ?>
+ <li><a href="<?php echo site_url("user/invite") ?>"><i class="icon-plus icon-white"></i> Invite</a></li>
+ <?php } ?>
<?php } ?>
</ul>
</div>