当前位置: 首页>>代码示例>>PHP>>正文


PHP isValidURL函数代码示例

本文整理汇总了PHP中isValidURL函数的典型用法代码示例。如果您正苦于以下问题:PHP isValidURL函数的具体用法?PHP isValidURL怎么用?PHP isValidURL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了isValidURL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: redirect

 public static function redirect($url, $query_parameters = array())
 {
     $request = RequestModel::currentRequest();
     $redirect_host = parse_url($url, PHP_URL_HOST);
     // Check that we're redirecting to our own domain, avoids potential security issues...
     if (!isValidURL($url)) {
         $url = '/';
         // fallback
     } else {
         if ($redirect_host !== HOSTNAME) {
             // Remote Domain!
             (new Log(SECURITY_LOG))->logMessage("Attempted redirect to external URL: {$url}");
             $url = '/';
             // fallback
         } else {
             // URL is OK, modify the existing URL if parameters were specified...
             if (!empty($query_parameters)) {
                 $url = addQueryParams($url, $query_parameters);
             }
         }
     }
     // OK to Redirect User?
     if (headers_sent($file, $line)) {
         // Log Error
         (new Log(ERROR_LOG))->logMessage("Unable to redirect, headers already sent in {$file} on line {$line}");
         // Ask user for manual redirection...
         echo "Unable to redirect automatically, please click this link: <a href=\"{$url}\">{$url}</a>";
     } else {
         // We're OK to Redirect
         header("Location: {$url}");
     }
     exit;
     // terminate
 }
开发者ID:bitcalc,项目名称:allspark,代码行数:34,代码来源:appcontroller.php

示例2: getinfolog

/**
	fetches infolog.txt and normalize it
*/
function getinfolog()
{
    global $_REQUEST;
    if (array_key_exists('url', $_REQUEST)) {
        $url = $_REQUEST['url'];
    } else {
        $url = "";
    }
    if ($url != "") {
        //url parameter unset
        if (!isValidURL($url)) {
            die("Invalid url!");
        }
        $infolog = file_get_contents($url, false, NULL, -1, 100000);
        //retrieve remote infolog.txt
    } else {
        if (array_key_exists('request', $_REQUEST)) {
            $infolog = $_REQUEST['request'];
        } else {
            return "";
        }
    }
    $infolog = addslashes($infolog);
    $infolog = str_replace("\r\n", "\n", $infolog);
    //windows linebreaks f'up some things here...
    $infolog = str_replace("\n\n", "\n", $infolog);
    return stripslashes($infolog);
}
开发者ID:spring,项目名称:spring,代码行数:31,代码来源:index.php

示例3: updateCarLink

 public function updateCarLink($carlink)
 {
     $error = false;
     //text
     if (trim($carlink->getText()) == "") {
         $phpError["carlinktext"] = "Text is a required field!";
         $error = true;
     }
     //url
     if (trim($carlink->getURL()) == "") {
         $phpError["carlinkurl"] = "URL is a required field!";
         $error = true;
     } elseif (!isValidURL(trim($carlink->getURL()))) {
         $phpError["carlinkurl"] = "URL link is not valid!";
         $error = true;
     }
     //car
     $dalCar = new DALCar();
     $nrCars = $dalCar->getCarCount($carlink->getCarId());
     if ($nrCars == 0) {
         $phpError["carlinkcar"] = "Car was not found!";
         $error = true;
     }
     if ($error == true) {
         return $phpError;
     } else {
         parent::updateCarLink($carlink);
         $id = $carlink->getId();
         return $id;
     }
 }
开发者ID:janb87,项目名称:media-cars,代码行数:31,代码来源:BLCarLink.php

示例4: awpcp_maybe_add_http_to_url

/**
 * @since 3.4
 */
function awpcp_maybe_add_http_to_url($url)
{
    if (empty($url) || preg_match('#^(https?|s?ftp)://#', $url)) {
        return $url;
    }
    $new_url = sprintf('http://%s', $url);
    if (isValidURL($new_url)) {
        return $new_url;
    } else {
        return $url;
    }
}
开发者ID:sabdev1,项目名称:ljcdevsab,代码行数:15,代码来源:format.php

示例5: updateCarMovie

 public function updateCarMovie($carmovie)
 {
     $error = false;
     //url
     if (trim($carmovie->getUrl()) == "") {
         $phpError["carmovieurl"] = "Url is a required field!";
         $error = true;
     } elseif ($carmovie->getTypeId() == 1) {
         if (strtolower(findexts($carmovie->getUrl())) != "wmv" && strtolower(findexts($carmovie->getUrl())) != "mp4") {
             $phpError["carmovieurl"] = "LR link must be a wmv or mp4 file!";
             $error = true;
         }
     } elseif ($carmovie->getTypeId() == 2) {
         if (strtolower(findexts($carmovie->getUrl())) != "mpg" && strtolower(findexts($carmovie->getUrl())) != "mpeg" && strtolower(findexts($carmovie->getUrl())) != "mov" && strtolower(findexts($carmovie->getUrl())) != "mp4") {
             $phpError["carmovieurl"] = "HR link must be mpg, mpeg, mov or mp4 file!";
             $error = true;
         }
     } elseif ($carmovie->getTypeId() == 3) {
         if (!isValidURL(trim($carmovie->getUrl()))) {
             $phpError["carmovieurl"] = "Not a valid link!";
             $error = true;
         }
     } elseif ($carmovie->getTypeId() == 4) {
         //to be defined
     } elseif ($carmovie->getTypeId() == 5) {
         //to be defined
     } else {
         $phpError["carmovieurl"] = "Type not found!";
         $error = true;
     }
     //text
     if (trim($carmovie->getText()) == "") {
         $phpError["carmovietext"] = "Text is a required field!";
         $error = true;
     }
     //car
     $dalCar = new DALCar();
     $nrCars = $dalCar->getCarCount($carmovie->getCarId());
     if ($nrCars == 0) {
         $phpError["carmoviecar"] = "Car not found!";
         $error = true;
     }
     if ($error == true) {
         return $phpError;
     } else {
         parent::updateCarMovie($carmovie);
         return $carmovie->getId();
     }
 }
开发者ID:janb87,项目名称:media-cars,代码行数:49,代码来源:BLCarMovie.php

示例6: updateCar

 public function updateCar($car)
 {
     $error = false;
     //type
     if (trim($car->getType()) == "") {
         $phpError["type"] = "Type is a required field!";
         $error = true;
     }
     /* $dalCar = new DALCar();
               $nrCars=$dalCar->getCarByTypeExcludeId($car->getType(),$car->getId());
     
               if ($nrCars != 0) {
               $phpError["type"] = "This type is allready used!";
               $error = true;
               }
              */
     //previewlink
     if (trim($car->getPreviewLink()) == "") {
         $phpError["previewlink"] = "Preview link is a required field!";
         $error = true;
     } elseif (!isValidURL($car->getPreviewLink())) {
         $phpError["previewlink"] = "Preview link must be a youtube link!";
         $error = true;
     }
     //releasedate
     $date = $car->getReleaseDate();
     if (substr($date, 0, 4) == "0000" || substr($date, 5, 2) == "00") {
         $phpError["releasedate"] = "Release date is a required field!";
         $error = true;
     }
     //presscontact
     $dalPressContact = new DALPressContact();
     $nrpresscontacts = $dalPressContact->getPressContactCount($car->getPressContactId());
     if ($nrpresscontacts == 0) {
         $phpError["presscontact"] = "Presscontact was not found!";
         $error = true;
     }
     if ($error == true) {
         return $phpError;
     } else {
         parent::updateCar($car);
         $id = $car->getId();
         return $id;
     }
 }
开发者ID:janb87,项目名称:media-cars,代码行数:45,代码来源:BLCar.php

示例7: Hookyt2rsViewreplacedownloadoptions

function Hookyt2rsViewreplacedownloadoptions()
{
    // Replace download options
    global $ref, $yt2rs_field_id, $baseurl_short, $lang;
    $youtube_url = get_data_by_field($ref, $yt2rs_field_id);
    if ($youtube_url !== "" && isValidURL($youtube_url)) {
        ?>
			<table cellpadding="0" cellspacing="0">
				<tr >
					<td>File Information</td>
					<td>File Size </td>
					<td>Options</td>
				</tr>
				<tr class="DownloadDBlend">
					<td><h2>Online Preview</h2><p>Youtube Video</p></td>
					<td>N/A</td>
					<td class="DownloadButton HorizontalWhiteNav"><a href="<?php 
        echo $baseurl_short;
        ?>
pages/resource_request.php?ref=<?php 
        echo urlencode($ref);
        ?>
&k=<?php 
        echo getval("k", "");
        ?>
" onClick="return CentralSpaceLoad(this,true);">
				<?php 
        echo $lang["action-request"];
        ?>
</td>
				</tr>
			</table>
<?php 
        return true;
    } else {
        return false;
    }
}
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:38,代码来源:view.php

示例8: add_dos_link

function add_dos_link($link, $target, $title, $method)
{
    require_once $PHP_INCLUDE_PATH . "hash.php";
    require_once $PHP_INCLUDE_PATH . "validate.php";
    if (isValidURL($link) && isValidURL($target)) {
        $target = escapeURL($target);
        $link = escapeURL($link);
    } else {
        die("Invalid url entered.");
    }
    $title = htmlentities($_POST['title']);
    if (is_banned_domain($target)) {
        die("This domain is disallowed.");
    }
    $res = exec_query("SELECT * FROM dos_links WHERE link='" . mysql_real_escape_string($link) . "' AND target='" . mysql_real_escape_string($target) . "' AND title='" . mysql_real_escape_string($title) . "' AND use_get=" . $method . ";");
    if (mysql_num_rows($res) != 0) {
        $row = mysql_fetch_assoc($res);
        return $row['hash'];
    } else {
        $hash = calc_new_hash($link . $target . $title);
        $res = insert_new_entry($hash, $link, $title, $target, $method);
        return $hash;
    }
}
开发者ID:codegooglecom,项目名称:d0z-me,代码行数:24,代码来源:db_functions.php

示例9: array

<?php

include_once "/php/settings.php";
include_once "/php/db.php";
include_once "/php/url.php";
if ($_SERVER["REQUEST_METHOD"] === "POST") {
    if (empty($_POST)) {
        die;
    }
    // Create a new shortened URL
    if (array_key_exists("destURL", $_POST)) {
        // Make sure the new destURL is valid.
        if (!isValidURL(htmlspecialchars($_POST["destURL"], ENT_QUOTES))) {
            $retArray = array("success" => false, "message" => "URL is not valid.");
            echo json_encode($retArray, true);
            die;
        }
        $mysqli = connectToDB();
        if ($mysqli->connect_errno) {
            die("Faild to connect to database:" . PHP_EOL . $mysqli->connect_errno . PHP_EOL . $mysqli->connect_error . PHP_EOL);
        }
        // Add the new link
        if ($shortID = addNewURL($mysqli, $_POST["destURL"])) {
            $retArray = array("success" => true, "shortURL" => Settings::$DOMAIN_BASE . Settings::$REDIRECT_PATH . $shortID, "fakeDomain" => Settings::$FAKE_DOMAIN . Settings::$REDIRECT_PATH, "shortID" => $shortID);
            echo json_encode($retArray, true);
        }
        $mysqli->close();
    }
    die;
} else {
    if ($_SERVER["REQUEST_METHOD"] === "GET") {
开发者ID:Daxda,项目名称:ToManyChars,代码行数:31,代码来源:index.php

示例10: updateAllyPrefs

 /**
  * Saves the updated alliance preferences.
  *
  * @param boolean $showmember		Show member list to everyone
  * @param boolean $showhomepage		Show homepage to everyone
  * @param boolean $open				Open applications
  * @param string $foundername		Founder rank name
  * @param integer $memberlistsort	Default memer list sort
  * @param string $textextern		Extern alliance text
  * @param string $textintern		Intern alliance text
  * @param string $logo				Logo URL
  * @param string $homepage			Homepage URL
  * @param string $applicationtext	Application template
  *
  * @return Bengine_Game_Controller_Alliance
  */
 protected function updateAllyPrefs($showmember, $showhomepage, $open, $foundername, $memberlistsort, $textextern, $textintern, $logo, $homepage, $applicationtext)
 {
     $foundername = trim($foundername);
     $logo = trim($logo);
     $homepage = trim($homepage);
     Hook::event("UpdateAlliancePreferences");
     if ($showmember == 1) {
         $showmember = 1;
     } else {
         $showmember = 0;
     }
     if ($showhomepage == 1) {
         $showhomepage = 1;
     } else {
         $showhomepage = 0;
     }
     if ($open == 1) {
         $open = 1;
     } else {
         $open = 0;
     }
     if (Str::length($foundername) > Core::getOptions()->get("MAX_CHARS_ALLY_NAME")) {
         $foundername = "";
     }
     $further = 1;
     if (Str::length($textextern) > Core::getOptions()->get("MAX_ALLIANCE_TEXT_LENGTH")) {
         $further = 0;
     }
     if (Str::length($textintern) > Core::getOptions()->get("MAX_ALLIANCE_TEXT_LENGTH")) {
         $further = 0;
     }
     if ((!isValidImageURL($logo) || Str::length($logo) > 128) && $logo != "") {
         $further = 0;
     }
     if ((!isValidURL($homepage) || Str::length($homepage) > 128) && $homepage != "") {
         $further = 0;
     }
     if (Str::length($applicationtext) > Core::getOptions()->get("MAX_APPLICATION_TEXT_LENGTH")) {
         $further = 0;
     }
     if ($further == 1) {
         $spec = array("logo" => $logo, "textextern" => richText($textextern), "textintern" => richText($textintern), "applicationtext" => Str::validateXHTML($applicationtext), "homepage" => $homepage, "showmember" => $showmember, "showhomepage" => $showhomepage, "memberlistsort" => $memberlistsort, "open" => $open, "foundername" => Str::validateXHTML($foundername));
         Core::getQuery()->update("alliance", $spec, "aid = ?", array($this->aid));
         $this->redirect("game/" . SID . "/Alliance/Manage");
     } else {
         if (Str::length($textextern) > Core::getOptions()->get("MAX_ALLIANCE_TEXT_LENGTH")) {
             Core::getTPL()->assign("externerr", Logger::getMessageField("TEXT_INVALID"));
         }
         if (Str::length($textintern) > Core::getOptions()->get("MAX_ALLIANCE_TEXT_LENGTH")) {
             Core::getTPL()->assign("internerr", Logger::getMessageField("TEXT_INVALID"));
         }
         if (Str::length($applicationtext) > Core::getOptions()->get("MAX_APPLICATION_TEXT_LENGTH")) {
             Core::getTPL()->assign("apperr", Logger::getMessageField("TEXT_INVALID"));
         }
         if ((!isValidImageURL($logo) || Str::length($logo) > 128) && $logo != "") {
             Core::getTPL()->assign("logoerr", Logger::getMessageField("LOGO_INVALID"));
         }
         if ((!isValidURL($homepage) || Str::length($homepage) > 128) && $homepage != "") {
             Core::getTPL()->assign("hperr", Logger::getMessageField("HOMEPAGE_INVALID"));
         }
     }
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:79,代码来源:Alliance.php

示例11: array

}
$invalid = array();
if (sizeof($_POST) > 0) {
    if (!empty($_POST['drugs'])) {
        header("Location: {$rootURL}/{$id}");
    }
    if (empty($_POST['name'])) {
        $invalid['name'] = true;
    }
    if (empty($_POST['email'])) {
        $invalid['email'] = true;
    } elseif (!isValidEmail($_POST['email'])) {
        $invalid['email'] = true;
    }
    if (empty($_POST['url'])) {
    } elseif (!isValidURL($_POST['url'])) {
        $invalid['url'] = true;
    }
    if (empty($_POST['comment'])) {
        $invalid['comment'] = true;
    }
    $vote = $_POST['vote'] == '1' ? 1 : 0;
    if (empty($invalid)) {
        $time = time();
        $ip = $_SERVER['REMOTE_ADDR'];
        mysql_query("INSERT INTO errors_comments ( error, name, email, url, comment, posted, ip, vote )\n             VALUES ( '{$id}', '{$_POST['name']}', '{$_POST['email']}', '{$_POST['url']}', '{$_POST['comment']}', '{$time}', '{$ip}', '{$vote}' )");
        $comment = mysql_insert_id();
        if ($vote == 1) {
            mysql_query("UPDATE errors\n                 SET votes = votes + 1\n                 WHERE id = '{$id}'\n                 LIMIT 1");
        }
        header("Location: {$rootURL}/{$id}#comment-{$comment}");
开发者ID:joksnet,项目名称:php-old,代码行数:31,代码来源:error.php

示例12: get_json

 public function get_json()
 {
     $event_json = array();
     $filters = $this->in->exists('filters', 'int') ? $this->in->getArray('filters', 'int') : false;
     // parse the feeds
     $feeds = $this->pdh->get('calendars', 'idlist', array('feed', $filters));
     if (is_array($feeds) && count($feeds) > 0) {
         foreach ($feeds as $feed) {
             $feedurl = $this->pdh->get('calendars', 'feed', array($feed));
             if (isValidURL($feedurl)) {
                 require_once $this->root_path . 'libraries/icalcreator/iCalcreator.class.php';
                 $vcalendar = new vcalendar(array('url' => $feedurl));
                 if (TRUE === $vcalendar->parse()) {
                     $vcalendar->sort();
                     while ($comp = $vcalendar->getComponent('vevent')) {
                         $startdate = $comp->getProperty('dtstart', 1);
                         $enddate = $comp->getProperty('dtend', 1);
                         $startdate_out = $startdate['year'] . '-' . $startdate['month'] . '-' . $startdate['day'] . ' ' . (isset($startdate['hour']) ? $startdate['hour'] . ':' . $startdate['min'] : '00:00');
                         $enddate_out = $enddate['year'] . '-' . $enddate['month'] . '-' . $enddate['day'] . ' ' . (isset($enddate['hour']) ? $enddate['hour'] . ':' . $enddate['min'] : '00:00');
                         $allday = isset($enddate['hour']) && isset($startdate['hour']) ? false : true;
                         $eventcolor = $this->pdh->get('calendars', 'color', $feed);
                         $eventcolor_txt = get_brightness($eventcolor) > 130 ? 'black' : 'white';
                         $event_json[] = array('eventid' => $calid, 'title' => $comp->getProperty('summary', 1), 'start' => $startdate_out, 'end' => $enddate_out, 'allDay' => $allday, 'note' => $comp->getProperty('description', 1), 'color' => '#' . $eventcolor, 'textColor' => $eventcolor_txt);
                     }
                 }
             }
         }
     }
     // add the calendar events to the json feed
     $calendars = $this->pdh->get('calendars', 'idlist', array('nofeed', $filters));
     $caleventids = $this->pdh->get('calendar_events', 'id_list', array(false, $this->in->get('start', 0), $this->in->get('end', 0)));
     if (is_array($caleventids) && count($caleventids) > 0) {
         foreach ($caleventids as $calid) {
             $eventextension = $this->pdh->get('calendar_events', 'extension', array($calid));
             $raidmode = $eventextension['calendarmode'];
             $eventcolor = $this->pdh->get('calendars', 'color', $this->pdh->get('calendar_events', 'calendar_id', array($calid)));
             $eventcolor_txt = get_brightness($eventcolor) > 130 ? 'black' : 'white';
             if (in_array($this->pdh->get('calendar_events', 'calendar_id', array($calid)), $calendars)) {
                 if ($raidmode == 'raid') {
                     // fetch the attendees
                     $attendees_raw = $this->pdh->get('calendar_raids_attendees', 'attendees', array($calid));
                     $attendees = array();
                     if (is_array($attendees_raw)) {
                         foreach ($attendees_raw as $attendeeid => $attendeerow) {
                             $attendees[$attendeerow['signup_status']][$attendeeid] = $attendeerow;
                         }
                     }
                     // Build the guest array
                     $guests = array();
                     if (registry::register('config')->get('calendar_raid_guests') == 1) {
                         $guestarray = registry::register('plus_datahandler')->get('calendar_raids_guests', 'members', array($calid));
                         if (is_array($guestarray)) {
                             foreach ($guestarray as $guest_row) {
                                 $guests[] = $guest_row['name'];
                             }
                         }
                     }
                     // fetch per raid data
                     $raidcal_status = unserialize($this->config->get('calendar_raid_status'));
                     $rstatusdata = '';
                     if (is_array($raidcal_status)) {
                         foreach ($raidcal_status as $raidcalstat_id) {
                             if ($raidcalstat_id != 4) {
                                 $actcount = isset($attendees[$raidcalstat_id]) ? count($attendees[$raidcalstat_id]) : 0;
                                 if ($raidcalstat_id == 0) {
                                     $actcount += is_array($guests) ? count($guests) : 0;
                                 }
                                 $rstatusdata .= '<div class="raid_status' . $raidcalstat_id . '">' . $this->user->lang(array('raidevent_raid_status', $raidcalstat_id)) . ': ' . $actcount . '</div>';
                             }
                         }
                     }
                     $rstatusdata .= '<div class="raid_status_total">' . $this->user->lang('raidevent_raid_required') . ': ' . (isset($eventextension) ? $eventextension['attendee_count'] : 0) . '</div>';
                     $deadlinedate = $this->pdh->get('calendar_events', 'time_start', array($calid)) - $eventextension['deadlinedate'] * 3600;
                     $deadline = $deadlinedate > $this->time->time || $this->config->get('calendar_raid_allowstatuschange') == '1' && $this->pdh->get('calendar_raids_attendees', 'status', array($calid, $this->user->id)) > 0 && $this->pdh->get('calendar_raids_attendees', 'status', array($calid, $this->user->id)) != 4 && $this->pdh->get('calendar_events', 'time_end', array($calid)) > $this->time->time ? false : true;
                     $deadlineflag = $deadline ? '<img src="' . $this->root_path . 'images/calendar/clock_s.png" alt="Deadline" title="' . $this->user->lang('raidevent_raid_deadl_reach') . '" />' : '';
                     // Build the JSON
                     $event_json[] = array('title' => $this->in->decode_entity($this->pdh->get('calendar_events', 'name', array($calid))), 'start' => $this->time->date('Y-m-d H:i', $this->pdh->get('calendar_events', 'time_start', array($calid))), 'end' => $this->time->date('Y-m-d H:i', $this->pdh->get('calendar_events', 'time_end', array($calid))), 'closed' => $this->pdh->get('calendar_events', 'raidstatus', array($calid)) == 1 ? true : false, 'editable' => true, 'eventid' => $calid, 'flag' => $deadlineflag . $this->pdh->get('calendar_raids_attendees', 'html_status', array($calid, $this->user->data['user_id'])), 'url' => 'calendar/viewcalraid.php' . $this->SID . '&eventid=' . $calid, 'icon' => $eventextension['raid_eventid'] ? $this->pdh->get('event', 'icon', array($eventextension['raid_eventid'], true, true)) : '', 'note' => $this->pdh->get('calendar_events', 'notes', array($calid)), 'raidleader' => $eventextension['raidleader'] > 0 ? implode(', ', $this->pdh->aget('member', 'name', 0, array($eventextension['raidleader']))) : '', 'rstatusdata' => $rstatusdata, 'color' => '#' . $eventcolor, 'textColor' => $eventcolor_txt);
                 } else {
                     $event_json[] = array('eventid' => $calid, 'title' => $this->pdh->get('calendar_events', 'name', array($calid)), 'start' => $this->time->date('Y-m-d H:i', $this->pdh->get('calendar_events', 'time_start', array($calid))), 'end' => $this->time->date('Y-m-d H:i', $this->pdh->get('calendar_events', 'time_end', array($calid))), 'allDay' => $this->pdh->get('calendar_events', 'allday', array($calid)) > 0 ? true : false, 'note' => $this->pdh->get('calendar_events', 'notes', array($calid)), 'color' => '#' . $eventcolor, 'textColor' => $eventcolor_txt);
                 }
             }
         }
     }
     // Output the array as JSON
     echo json_encode($event_json);
     exit;
 }
开发者ID:ubick,项目名称:lorekeepers.org,代码行数:87,代码来源:calendar.php

示例13: __

<?php

require_once 'db.inc.php';
require_once 'facilities.inc.php';
$header = __("Department Contact Listing");
$dept = new Department();
if (!isset($_REQUEST['deptid'])) {
    // No soup for you.
    header('Location: ' . redirect());
    exit;
}
$deptID = intval($_REQUEST['deptid']);
$contactList = $person->GetPeopleByDepartment($deptID);
$dept->DeptID = $deptID;
$dept->GetDeptByID();
if (isset($config->ParameterArray['UserLookupURL']) && isValidURL($config->ParameterArray['UserLookupURL'])) {
    $el = 1;
    //enable displaying lookup options
} else {
    $el = 0;
    //default to not showing lookup options
}
$subheader = $dept->Name;
?>
<!doctype html>
<html>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
  <meta http-equiv="EXPIRES" content="Mon, 01 Jan 1997 01:00:00 GMT">
开发者ID:paragm,项目名称:openDCIM,代码行数:31,代码来源:contactpopup.php

示例14: do_kml

function do_kml()
{
    // emits JS for kml-type files in noted directory - added 5/23/08
    $dir = "./kml_files";
    // required as directory
    if (is_dir($dir)) {
        $dh = opendir($dir);
        $temp = explode("/", $_SERVER['REQUEST_URI']);
        $temp[count($temp) - 1] = substr($dir, 2);
        // home subdir
        $server_str = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . implode("/", $temp) . "/";
        while (false !== ($filename = readdir($dh))) {
            switch (get_ext($filename)) {
                // drop all other types, incl directories
                case "kml":
                case "kmz":
                case "xml":
                    $url = $server_str . $filename;
                    echo "\tmap.addOverlay(new GGeoXml(\"" . $url . "\"));\n";
                    break;
                    // ---------------------------------
                // ---------------------------------
                case "txt":
                    $the_addr = "{$dir}/{$filename}";
                    $lines = file($the_addr);
                    foreach ($lines as $line_num => $line) {
                        // Loop through our array.
                        if (isValidURL(trim($line))) {
                            echo "\n\t map.addOverlay(new GGeoXml(\"" . trim($line) . "\"));\n";
                        }
                    }
                    break;
                    // --------------------------------
            }
            // end switch ()
        }
        // end while ()
    }
    // end is_dir()
}
开发者ID:sharedgeo,项目名称:TicketsCAD-SharedGeo-Dev,代码行数:40,代码来源:functions.inc.php

示例15: save_changes

function save_changes($redir, $current_tab)
{
    global $contentManager, $db, $addslashes, $msg, $stripslashes;
    $_POST['pid'] = intval($_POST['pid']);
    $_POST['cid'] = intval($_POST['cid']);
    $_POST['alternatives'] = intval($_POST['alternatives']);
    $_POST['title'] = trim($_POST['title']);
    $_POST['head'] = trim($_POST['head']);
    $_POST['use_customized_head'] = isset($_POST['use_customized_head']) ? $_POST['use_customized_head'] : 0;
    // $_POST['body_text']	= $stripslashes(trim($_POST['body_text'])); //this line breaks LaTex
    $_POST['body_text'] = trim($_POST['body_text']);
    $_POST['weblink_text'] = trim($_POST['weblink_text']);
    $_POST['formatting'] = intval($_POST['formatting']);
    $_POST['keywords'] = $stripslashes(trim($_POST['keywords']));
    $_POST['test_message'] = trim($_POST['test_message']);
    $_POST['allow_test_export'] = intval($_POST['allow_test_export']);
    //if weblink is selected, use it
    if ($_POST['formatting'] == CONTENT_TYPE_WEBLINK) {
        $url = $_POST['weblink_text'];
        $validated_url = isValidURL($url);
        if (!validated_url || $validated_url !== $url) {
            $msg->addError(array('INVALID_INPUT', _AT('weblink')));
        } else {
            $_POST['body_text'] = $url;
            $content_type_pref = CONTENT_TYPE_WEBLINK;
        }
    } else {
        $content_type_pref = CONTENT_TYPE_CONTENT;
    }
    if (!($release_date = generate_release_date())) {
        $msg->addError('BAD_DATE');
    }
    if ($_POST['title'] == '') {
        $msg->addError(array('EMPTY_FIELDS', _AT('title')));
    }
    if (!$msg->containsErrors()) {
        $orig_body_text = $_POST['body_text'];
        // used to populate a4a tables
        /*	
        		$_POST['title']			= $addslashes($_POST['title']);
        		$_POST['body_text']		= $addslashes($_POST['body_text']);
        		$_POST['head']  		= $addslashes($_POST['head']);
        		$_POST['keywords']		= $addslashes($_POST['keywords']);
        		$_POST['test_message']	= $addslashes($_POST['test_message']);		
        */
        // add or edit content
        if ($_POST['cid']) {
            /* editing an existing page */
            $err = $contentManager->editContent($_POST['cid'], $_POST['title'], $_POST['body_text'], $_POST['keywords'], $_POST['related'], $_POST['formatting'], $release_date, $_POST['head'], $_POST['use_customized_head'], $_POST['test_message'], $_POST['allow_test_export'], $content_type_pref);
            $cid = $_POST['cid'];
        } else {
            /* insert new */
            $cid = $contentManager->addContent($_SESSION['course_id'], $_POST['pid'], $_POST['ordering'], $_POST['title'], $_POST['body_text'], $_POST['keywords'], $_POST['related'], $_POST['formatting'], $release_date, $_POST['head'], $_POST['use_customized_head'], $_POST['test_message'], $_POST['allow_test_export'], $content_type_pref);
            $_POST['cid'] = $cid;
            $_REQUEST['cid'] = $cid;
        }
        // re-populate a4a tables based on the new content
        populate_a4a($cid, $orig_body_text, $_POST['formatting']);
    } else {
        return;
    }
    /* insert glossary terms */
    if (is_array($_POST['glossary_defs']) && ($num_terms = count($_POST['glossary_defs']))) {
        global $glossary, $glossary_ids, $msg;
        foreach ($_POST['glossary_defs'] as $w => $d) {
            $old_w = $w;
            $key = in_array_cin($w, $glossary_ids);
            $w = urldecode($w);
            $d = $addslashes($d);
            if ($key !== false && ($glossary[$old_w] != $d || isset($_POST['related_term'][$old_w]))) {
                $w = addslashes($w);
                $related_id = intval($_POST['related_term'][$old_w]);
                $sql = "UPDATE %sglossary SET definition='%s', related_word_id=%d WHERE word_id=%d AND course_id=%d";
                $result = queryDB($sql, array(TABLE_PREFIX, $d, $related_id, $key, $_SESSION['course_id']));
                $glossary[$old_w] = $d;
            } else {
                if ($key === false && $d != '') {
                    $w = addslashes($w);
                    $related_id = intval($_POST['related_term'][$old_w]);
                    $sql = "INSERT INTO %sglossary VALUES (NULL, %d, '%s', '%s', %d)";
                    $result = queryDB($sql, array(TABLE_PREFIX, $_SESSION['course_id'], $w, $d, $related_id));
                    $glossary[$old_w] = $d;
                }
            }
        }
    }
    if (isset($_GET['tab'])) {
        $current_tab = intval($_GET['tab']);
    }
    if (isset($_POST['current_tab'])) {
        $current_tab = intval($_POST['current_tab']);
    }
    // adapted content: save primary content type
    if (isset($_POST['use_post_for_alt'])) {
        // 1. delete old primary content type
        $sql = "DELETE FROM %sprimary_resources_types\n\t\t         WHERE primary_resource_id in \n\t\t               (SELECT DISTINCT primary_resource_id \n\t\t                  FROM %sprimary_resources\n\t\t                 WHERE content_id=%d\n\t\t                   AND language_code='%s')";
        $result = queryDB($sql, array(TABLE_PREFIX, TABLE_PREFIX, $cid, $_SESSION['lang']));
        // 2. insert the new primary content type
        $sql = "SELECT pr.primary_resource_id, rt.type_id\n\t\t          FROM %sprimary_resources pr, \n\t\t                 %sresource_types rt\n\t\t         WHERE pr.content_id = %d\n\t\t           AND pr.language_code = '%s'";
        $all_types_result = queryDB($sql, array(TABLE_PREFIX, TABLE_PREFIX, $cid, $_SESSION['lang']));
//.........这里部分代码省略.........
开发者ID:genaromendezl,项目名称:ATutor,代码行数:101,代码来源:editor_tab_functions.inc.php


注:本文中的isValidURL函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。