protected function __construct($name, $dir, $dirTmp) { set_time_limit(0); if (!is_dir($dir)) { trigger_error(__METHOD__ . " invalid directory '{$dir}'", E_USER_ERROR); } if (substr($dirTmp, -1) != '/') { $dirTmp .= '/'; } if (!is_dir($dirTmp)) { mkdir($dirTmp); } $this->count = 0; $this->name = $name; $this->logFname = $dir . $name . '.log'; $this->dirTmp = $dirTmp; $this->cookiejarFname = $this->dirTmp . "{$name}.cookiejar"; self::$curlCmd = trim(`which curl`); // delete stashed pages if (self::SAVE_PAGES) { $files = glob($this->dirTmp . "{$this->name}-*"); foreach ($files as $file) { @unlink($file); funx::debug("Removed: '{$file}'"); } } }
/** * protected функция считывает данные из таблицы БД * * @return bool */ protected function pGetCategorys() { if (CONF_ENABLE_CACHING) { if ($this->getCachingEntrys()) { return true; } else { // записываем в робота дату обновления кеша $articles = new articles(); $strWhere = "token IN ('active') AND datetime>NOW()"; $arrFields = array('datetime'); $arrArticle = $articles->getArticle($strWhere, $arrFields); $arrRobotData[$this->retTableName()] = !empty($arrArticle['datetime']) ? strtotime($arrArticle['datetime']) : false; robot::putClearCacheData($arrRobotData); return !$this->getSubSelectEntrys(false, true, $this->pRetCategoryConf()) ? false : $this->setCachingEntrys(); } } else { return !$this->getSubSelectEntrys(false, true, $this->pRetCategoryConf()) ? false : true; } }
set_include_path(__DIR__); require_once 'lib/db.php'; require_once 'lib/team.php'; require_once 'lib/robot.php'; require_once 'lib/competition.php'; $con = DB::connect(); $number = $_GET["number"]; $team = team::selectTeam($con, $number); session_start(); $compid = $_SESSION["competitionid"]; $comp = competition::select($con, $compid); $robot = robot::select($con, $number); if ($robot == null) { // make a new robot if necessary $robot = new robot(); $robot->TeamNumber = $number; $robot->insert($con); } function makeSelector($enum, $value) { print "<select>\n"; foreach ($enum as $val => $name) { print "<option value='{$val}'>{$name}</option>\n"; } print "</select>\n"; } function makeRoleSelector($value) { makeSelector(array('offensive' => 'Offensive', 'defensive' => 'Defensive', 'climber' => 'Climber'), $value); }
* инициализация списка регионов */ $regions = new regions(); $arrDataRegions = $regions->retCategorys(); $smarty->assignByRef('regions', $arrDataRegions); /** * инициализация списка городов */ $citys = new citys(); $arrDataCitys = $citys->retCategorys(); $smarty->assignByRef('citys', $arrDataCitys); /** * Робот сайта * Запуск робота */ robot::start($arrRobotConf); /** * Рассылка * Запуск рассылки * в течение трех часов с установленного времени */ if (time() >= CONF_SUBSCRIPTIONS_START_TIME && time() < CONF_SUBSCRIPTIONS_START_TIME + 10800) { include_once 'core/includes/do.subscription.php'; } /** * Обработка текущей локализации */ if (1 < count($existLangs)) { foreach ($existLangs as &$lang) { $siteLangs[] = array('id' => &$lang, 'description' => @constant('SITE_LANGUAGE_' . strtoupper($lang))); }
/** * Sets robot property value. * * @param robot $robot robot * @param string $name property name * @param string $value property value * @param boolean $append true if value should be appended to existing value, false otherwise */ function setRobotProperty($robot, $name, $value, $append) { if (!isset($robot) || !isset($name) || !isset($value)) { return; } $value = trim($value); if ($this->startsWith($name, 'robot-id')) { $robot->setId($value); } else { if ($this->startsWith($name, 'robot-name')) { $robot->setName($value); } else { if ($this->startsWith($name, 'robot-cover-url')) { $robot->setCoverUrl($value); } else { if ($this->startsWith($name, 'robot-details-url')) { $robot->setDetailsUrl($value); } else { if ($this->startsWith($name, 'robot-owner-name')) { $robot->setOwnerName($value); } else { if ($this->startsWith($name, 'robot-owner-url')) { $robot->setOwnerUrl($value); } else { if ($this->startsWith($name, 'robot-owner-email')) { $robot->setOwnerEmail($value); } else { if ($this->startsWith($name, 'robot-status')) { $robot->setStatus($value); } else { if ($this->startsWith($name, 'robot-purpose')) { $robot->setPurpose($value); } else { if ($this->startsWith($name, 'robot-type')) { $robot->setType($value); } else { if ($this->startsWith($name, 'robot-platform')) { $robot->setPlatform($value); } else { if ($this->startsWith($name, 'robot-availability')) { $robot->setAvailability($value); } else { if ($this->startsWith($name, 'robot-exclusion-useragent')) { $robot->setExclusionUserAgent($value); } else { if ($this->startsWith($name, 'robot-exclusion')) { $robot->setExclusion($value); } else { if ($this->startsWith($name, 'robot-noindex')) { $robot->setNoindex($value); } else { if ($this->startsWith($name, 'robot-host')) { $robot->setHost($value); } else { if ($this->startsWith($name, 'robot-from')) { $robot->setFrom($value); } else { if ($this->startsWith($name, 'robot-useragent')) { $robot->setUserAgent($value); } else { if ($this->startsWith($name, 'robot-language')) { $robot->setLanguage($value); } else { if ($this->startsWith($name, 'robot-description')) { $description = $robot->getDescription(); if (append && isset($description)) { $robot->setDescription($description . ' ' . $value); } else { $robot->setDescription($value); } } else { if ($this->startsWith($name, 'robot-history')) { $history = $robot->getHistory(); if (append && isset($history)) { $robot->setHistory($history . ' ' . $value); } else { $robot->setHistory($value); } } else { if ($this->startsWith($name, 'robot-environment')) { $robot->setEnvironment($value); } else { if ($this->startsWith($name, 'modified-date')) { $robot->setModifiedDate($value); } else { if ($this->startsWith($name, 'modified-by')) { $robot->setModifiedBy($value); } } } } } } } } } } } } } } } } } } } } } } } } }