示例#1
0
/**
 * This function allows you to redirect people.
 *
 * This function uses an HTTP redirect to redirect people. That means it MUST be done before anycontent is displayed! The second argument is whether or not it is relative to the root of the site. For example,
 * if you should use <code>cc_redirect('http://google.com/');
 * cc_redirect('cc-admin/', true);</code>
 *
 * @param string $url The path to redirect to.
 * @param bool $relative Whether or not to redirect relative to TH_CORE
 * @return null This method will never return anything.
 */
function cc_redirect($url, $relative = false)
{
    $continue = true;
    Hooks::execute('cc_redirect', array(&$url, &$relative, &$continue));
    if ($continue === false) {
        return;
    }
    if ($relative) {
        header(sprintf('location: %s', TH_PUB_ROOT . $url));
    }
    header(sprintf('location: %s', $url));
}
示例#2
0
 /**
  * Sets up hooks for form submission.
  */
 public static function setupPostHandles()
 {
     if (!empty($_POST['cc_form'])) {
         Hooks::execute('post_' . $_POST['cc_form']);
     }
 }
示例#3
0
 /**
  * Validates an ABSOLUTE link.
  *
  * @param string $url The string to preform the test on.
  * @return bool True if is a valid link, false otherwise.
  */
 public static function link($url)
 {
     $r = filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED);
     Hooks::execute('validate_link', array(&$url, &$r));
     return $r;
 }