/** * Constructor creates the necessary variables needed later on. * * @ignore * @access private */ function __construct() { $s = new Sites(); $this->site = $s->get(); $this->nzb = new Nzb(); $this->indexes = array("releases", "releasefiles", "releasenfo", "nzbs", "predb"); }
/** * Process headers and store in database for all active groups. */ function updateAllGroups() { $n = $this->n; $groups = new Groups(); $res = $groups->getActive(); $s = new Sites(); echo $s->getLicense(); if ($res) { shuffle($res); $alltime = microtime(true); echo 'Updating: ' . sizeof($res) . ' groups - Using compression? ' . ($this->compressedHeaders ? 'Yes' : 'No') . $n; $nntp = new Nntp(); if ($nntp->doConnect()) { $pos = 0; foreach ($res as $groupArr) { $pos++; echo 'Group ' . $pos . ' of ' . sizeof($res) . $n; $this->message = array(); $this->updateGroup($nntp, $groupArr); } $nntp->doQuit(); echo 'Updating completed in ' . number_format(microtime(true) - $alltime, 2) . ' seconds' . $n; } else { echo "Failed to get NNTP connection.{$n}"; } } else { echo "No groups specified. Ensure groups are added to newznab's database and activated before updating.{$n}"; } }
public static function getMailEnt($OER) { $idS = $OER->getSiteId(); $Nom = $OER->getNomUsuari(); $Activitat = $OER->getNomActivitat(); $OH = $OER->getHoraris(); $OS = SitesPeer::retrieveByPK($OER->getSiteId()); if (!$OS instanceof Sites) { $OS = new Sites(); } $TEXT = OptionsPeer::getString('BODY_MAIL_ENTRADES', $idS); $TEXT = str_replace('{{NOM}}', $OER->getNomUsuari(), $TEXT); $TEXT = str_replace('{{NUM_ENTRADES}}', $OER->getQuantitat(), $TEXT); $TEXT = str_replace('{{ACTIVITAT}}', $OER->getNomActivitat(), $TEXT); $TEXT = str_replace('{{ENTITAT}}', $OS->getNom(), $TEXT); $TEXT = str_replace('{{TEL_ENTITAT}}', $OS->getTelefon(), $TEXT); $TEXT = str_replace('{{MAIL_ENTITAT}}', $OS->getEmail(), $TEXT); $TEXT = str_replace('{{TEL_ADMIN}}', '972.20.20.13', $TEXT); $TEXT = str_replace('{{MAIL_ADMIN}}', OptionsPeer::getString('MAIL_ADMIN', $idS), $TEXT); $TEXT = str_replace('{{DIA}}', $OH->getDia('d/m/Y'), $TEXT); $TEXT = str_replace('{{HORA}}', $OH->getHorainici('H:i'), $TEXT); $TEXT = str_replace('{{ESPAI}}', implode(',', Horaris::getArrayEspais()), $TEXT); $TEXT = str_replace('{{CODI}}', sha1($OER->getIdentrada()), $TEXT); return $TEXT; }
function PostProcess($echooutput = false) { $this->echooutput = $echooutput; $s = new Sites(); $this->site = $s->get(); $this->mediafileregex = 'AVI|VOB|MKV|MP4|TS|WMV|MOV|M4V|F4V|MPG|MPEG'; }
public function getsitelist() { $sites = new Sites(); $select = $sites->select(); // $select'id, name'; echo $select->__toString(); return $sites->fetchAll($select)->toArray(); }
function Movie($echooutput = false) { $this->echooutput = $echooutput; $s = new Sites(); $site = $s->get(); $this->apikey = $site->tmdbkey; $this->imgSavePath = WWW_DIR . 'covers/movies/'; }
function BasePage() { @session_start(); if (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc() || ini_get('magic_quotes_sybase')) { foreach ($_GET as $k => $v) { $_GET[$k] = is_array($v) ? array_map("stripslashes", $v) : stripslashes($v); } foreach ($_POST as $k => $v) { $_POST[$k] = is_array($v) ? array_map("stripslashes", $v) : stripslashes($v); } foreach ($_REQUEST as $k => $v) { $_REQUEST[$k] = is_array($v) ? array_map("stripslashes", $v) : stripslashes($v); } foreach ($_COOKIE as $k => $v) { $_COOKIE[$k] = is_array($v) ? array_map("stripslashes", $v) : stripslashes($v); } } // set site variable $s = new Sites(); $this->site = $s->get(); $this->smarty = new Smarty(); $this->smarty->template_dir = WWW_DIR . 'views/templates/' . $this->template_dir; $this->smarty->compile_dir = SMARTY_DIR . 'templates_c/'; $this->smarty->config_dir = SMARTY_DIR . 'configs/'; $this->smarty->cache_dir = SMARTY_DIR . 'cache/'; $this->smarty->error_reporting = E_ALL - E_NOTICE; $this->smarty->assign('site', $this->site); $this->smarty->assign('page', $this); if (isset($_SERVER["SERVER_NAME"])) { $this->serverurl = (isset($_SERVER["HTTPS"]) ? "https://" : "http://") . $_SERVER["SERVER_NAME"] . ($_SERVER["SERVER_PORT"] != "80" ? ":" . $_SERVER["SERVER_PORT"] : "") . WWW_TOP . '/'; $this->smarty->assign('serverroot', $this->serverurl); } $this->page = isset($_GET['page']) ? $_GET['page'] : 'content'; $users = new Users(); if ($users->isLoggedIn()) { $this->userdata = $users->getById($users->currentUserId()); $this->userdata["categoryexclusions"] = $users->getCategoryExclusion($users->currentUserId()); //update lastlogin every 15 mins if (strtotime($this->userdata['now']) - 900 > strtotime($this->userdata['lastlogin'])) { $users->updateSiteAccessed($this->userdata['ID']); } $this->smarty->assign('userdata', $this->userdata); $this->smarty->assign('loggedin', "true"); $sab = new SABnzbd($this); if ($sab->integrated !== false && $sab->url != '' && $sab->apikey != '') { $this->smarty->assign('sabintegrated', $sab->integrated); $this->smarty->assign('sabapikeytype', $sab->apikeytype); } if ($this->userdata["role"] == Users::ROLE_ADMIN) { $this->smarty->assign('isadmin', "true"); } $this->floodCheck(true, $this->userdata["role"]); } else { $this->smarty->assign('isadmin', "false"); $this->smarty->assign('loggedin', "false"); $this->floodCheck(false, ""); } }
/** * Default constructor. */ function PostProcess($echooutput = false) { $this->echooutput = $echooutput; $s = new Sites(); $this->site = $s->get(); $this->mediafileregex = 'AVI|VOB|MKV|MP4|TS|WMV|MOV|M4V|F4V|MPG|MPEG|M2TS'; $this->audiofileregex = 'MP3|AAC|OGG'; $this->mp3SavePath = WWW_DIR . 'covers/audio/'; }
function Music($echooutput = false) { $this->echooutput = $echooutput; $s = new Sites(); $site = $s->get(); $this->pubkey = $site->amazonpubkey; $this->privkey = $site->amazonprivkey; $this->imgSavePath = WWW_DIR . 'covers/music/'; }
/** * Default constructor. */ function Book($echooutput = false) { $this->echooutput = $echooutput; $s = new Sites(); $site = $s->get(); $this->pubkey = $site->amazonpubkey; $this->privkey = $site->amazonprivkey; $this->asstag = $site->amazonassociatetag; $this->imgSavePath = WWW_DIR . 'covers/book/'; }
/** * Inicialitza un formulari de Site * @param $idS Site ID * @return SitesForm() * */ public static function initialize($idS) { $OO = self::retrieveByPK($idS); if (!$OO instanceof Sites) { $OO = new Sites(); $OO->setNom(''); $OO->setActiu(true); } return new SitesForm($OO, array('IDS' => $idS)); }
public function addComment($id, $text, $userid, $host) { $db = new DB(); $site = new Sites(); $s = $site->get(); if ($s->storeuserips != "1") { $host = ""; } $comid = $db->queryInsert(sprintf("INSERT INTO releasecomment (`releaseID`, \t`text`, \t`userID`, \t`createddate`, \t`host`\t)\t\n\t\t\t\t\t\tVALUES (%d, \t%s, \t%d, \tnow(), \t%s\t)", $id, $db->escapeString($text), $userid, $db->escapeString($host))); $this->updateReleaseCommentCount($id); return $comid; }
/** * Builds a full path to the nzb file on disk. nzbs are stored in a subdir of their first char. */ function getNZBPath($releaseGuid, $sitenzbpath = "", $createIfDoesntExist = false) { if ($sitenzbpath == "") { $s = new Sites(); $site = $s->get(); $sitenzbpath = $site->nzbpath; } $nzbpath = $sitenzbpath . substr($releaseGuid, 0, 1) . "/"; if ($createIfDoesntExist && !file_exists($nzbpath)) { mkdir($nzbpath); } return $nzbpath . $releaseGuid . ".nzb.gz"; }
function AdminPage() { $this->template_dir = 'admin'; parent::BasePage(); $users = new Users(); if (!$users->isLoggedIn() || !isset($this->userdata["role"]) || $this->userdata["role"] != Users::ROLE_ADMIN) { $this->show403(true); } // set site variable $s = new Sites(); $this->site = $s->get(); $this->smarty->assign('site', $this->site); }
function doConnect($retries = 5, $throw = False, $overridecompression = false) { if ($this->_isConnected()) { return true; } $s = new Sites(); $site = $s->get(); $this->compressedHeaders = $site->compressedheaders == "1" ? true : false; $enc = false; if (defined("NNTP_SSLENABLED") && NNTP_SSLENABLED == true) { $enc = 'ssl'; } while ($retries >= 1) { $retries--; $enc = false; if (defined("NNTP_SSLENABLED") && NNTP_SSLENABLED == true) { $enc = 'ssl'; } $ret = $this->connect(NNTP_SERVER, $enc, NNTP_PORT); if ($this->isError($ret)) { $err = "Cannot connect to server " . NNTP_SERVER . (!$enc ? " (nonssl) " : "(ssl) ") . ": " . $ret->getMessage(); echo $err; if ($retries < 1 && $throw) { throw new NNTPException($err); } continue; } if (!defined(NNTP_USERNAME) && NNTP_USERNAME != "") { $ret2 = $this->authenticate(NNTP_USERNAME, NNTP_PASSWORD); if ($this->isError($ret2)) { $err = "Cannot authenticate to server " . NNTP_SERVER . (!$enc ? " (nonssl) " : " (ssl) ") . " - " . NNTP_USERNAME . " (" . $ret2->getMessage() . ")"; echo $err; if ($retries < 1 && $throw) { throw new NNTPException($err); } continue; } } if ($this->compressedHeaders && !$overridecompression) { $response = $this->_sendCommand('XFEATURE COMPRESS GZIP'); if ($this->isError($response) || $response != 290) { //echo "NNTP: XFeature not supported.\n"; } else { $this->enableXFCompression(); } } return true; } return false; }
public function site() { if ($this->site == null) { $this->site = Sites::findFirst($this->site_id); } return $this->site; }
public function addLinkBy(Users $byUser, $url) { $data = array('url' => $url, 'linkable_id' => $this->id, 'linkable_type' => get_class($this), 'site_id' => Sites::findByUrl($url)->id, 'user_id' => $byUser->id); $link = new Links(); $link->save($data); return $this; }
public function rcbAction() { $site_id = $this->request->getQuery('site_id'); $site = Sites::findFirst($site_id); $this->view->site_id = $site_id; $this->view->site_url = $site->url; }
/** * Default constructor. */ function Parsing($echoonly = false, $limited = true, $verbose = false) { $this->echoonly = $echoonly; $this->limited = $limited; $this->verbose = $verbose; $this->releasestocheck = 0; $this->numupdated = 0; $this->numcleaned = 0; $this->numnuked = 0; $this->nummiscd = 0; $this->nfosprocessed = 0; $this->parsprocessed = 0; $this->releasefilesprocessed = 0; $this->cleanup = array('nuke' => array(), 'misc' => array()); $s = new Sites(); $this->site = $s->get(); }
function test_Sites_set() { //Arrange $id = null; $services_id = null; $name = 'hotel deluxe'; $analytics_profile = '5271170'; $test_site = new Sites($id, $services_id, $name, $analytics_profile); //Act $test_site->setName('hotel max'); $result1 = $test_site->getName(); $test_site->setAnalyticsProfile('5271201'); $result2 = $test_site->getAnalyticsProfile(); //Assert $this->assertEquals('hotel max', $result1); $this->assertEquals('5271201', $result2); }
public function testGetGroup() { $wikipedias = Sites::singleton()->getSiteGroup("wikipedia"); $this->assertFalse($wikipedias->isEmpty()); /* @var Site $site */ foreach ($wikipedias as $site) { $this->assertEquals('wikipedia', $site->getGroup()); } }
/** * Retrieves and stores current rankings for the keyword. * * @return null */ public function update_rankings() { $db = DB::connect(); $site = Sites::get(array('id' => $this->site_id)); $rank = Scroogle::get_ranking($this->text, $site->domain); $q = "INSERT INTO keyword_rank (site_id, search_engine_id, keyword_id, created_at, rank)" . " VALUES ({$site->id}, 1, {$this->id}, NOW(), {$rank})"; $db->exec($q); $rank = Yahoo::get_ranking($this->text, $site->domain); $q = "INSERT INTO keyword_rank (site_id, search_engine_id, keyword_id, created_at, rank)" . " VALUES ({$site->id}, 2, {$this->id}, NOW(), {$rank})"; $db->exec($q); }
public static function currentSite($siteId = null) { $_this = Sites::getInstance(); self::$_site = $_this->_getSite($siteId); $_this->_overrideSetting(array('title', 'tagline', 'theme', 'timezone', 'locale', 'status')); if (!empty(self::$_site['SiteMeta'])) { $_this->_overrideMeta(); } CakeSession::write(self::$_sessionKey, self::$_site); return self::$_site; }
public function initialize(Controller $controller) { $this->controller = $controller; if (1 == $controller->Auth->user('role_id') && isset($controller->params['admin'])) { $Model =& $controller->{$controller->modelClass}; if ($Model->Behaviors->attached('SiteFilter')) { $Model->Behaviors->SiteFilter->disableFilter($Model); } } $site = Sites::currentSite(); }
public function beforeFind() { $attrs = $this->attributeLabels(); if ($this->tableName() != "sites") { if (@$attrs['site_id']) { $this->getDbCriteria()->mergeWith(array('alias' => 't', 'condition' => "t.site_id=" . (int) Sites::model()->getCurrentSite()->id)); } } //var_dump($this->dbCriteria); parent::beforeFind(); }
public function initialize(Controller $controller, $settings = array()) { if (1 == $controller->Auth->user('role_id') && isset($controller->params['admin'])) { if ($controller->{$controller->modelClass}) { $Model =& $controller->{$controller->modelClass}; if ($Model instanceof Model && $Model->useTable && $Model->Behaviors->attached('SiteFilter')) { $Model->Behaviors->SiteFilter->disableFilter($Model); } } } $site = Sites::currentSite(); }
function add($request, $response, $args) { $add = false; $body = $request->getParsedBody(); $body['dateStarted'] = $this->formatDate($body['dateStarted']); if ($body['dateFinished']) { $body['dateFinished'] = $this->formatDate($body['dateFinished']); } $stillUsing = false; if (isset($body['stillUsing'])) { $stillUsing = $body['stillUsing']; } $site = new Sites(); $result = $site::where('title', $body['title'])->first(); if ($result) { if ($body['title'] !== $result->title) { $add = true; } else { $error['duplicate'] = $body['title'] . " is already present"; } } else { $add = true; } if ($add) { $site->title = $body['title']; $site->url = $body['url']; $site->dateStarted = $body['dateStarted']; $site->dateFinished = $body['dateFinished']; $site->stillUsing = $stillUsing; $site->save(); foreach ($body['skills'] as $skill) { $association = [$skill]; $site->skills()->attach($association); } foreach ($body['images'] as $image) { $association = [$image]; $site->images()->attach($association); } } }
static function find($search_id) { $found_site = ''; $sites = Sites::getAll(); foreach ($sites as $site) { // $site_id = $site->getId(); if ($id === $search_id) { $found_site = $site; print_r($found_site); return $found_site; } } }
function Page() { parent::BasePage(); $this->page = isset($_GET['page']) ? $_GET['page'] : 'content'; // set site variable $s = new Sites(); $this->site = $s->get(); $this->smarty->assign('site', $this->site); $role = Users::ROLE_GUEST; if ($this->userdata != null) { $role = $this->userdata["role"]; } $content = new Contents(); $menu = new Menu(); $this->smarty->assign('menulist', $menu->get($role, $this->serverurl)); $this->smarty->assign('usefulcontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEUSEFUL, $role)); $this->smarty->assign('articlecontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEARTICLE, $role)); $this->smarty->assign('main_menu', $this->smarty->fetch('mainmenu.tpl')); $this->smarty->assign('useful_menu', $this->smarty->fetch('usefullinksmenu.tpl')); $this->smarty->assign('article_menu', $this->smarty->fetch('articlesmenu.tpl')); $category = new Category(); if ($this->userdata != null) { $parentcatlist = $category->getForMenu($this->userdata["categoryexclusions"]); } else { $parentcatlist = $category->getForMenu(); } $this->smarty->assign('parentcatlist', $parentcatlist); $searchStr = ''; if ($this->page == 'search' && isset($_REQUEST["id"])) { $searchStr = (string) $_REQUEST["id"]; } $this->smarty->assign('header_menu_search', $searchStr); if (isset($_REQUEST["t"])) { $this->smarty->assign('header_menu_cat', $_REQUEST["t"]); } $header_menu = $this->smarty->fetch('headermenu.tpl'); $this->smarty->assign('header_menu', $header_menu); }
public function init() { $site = Sites::model()->getCurrentSite(); //echo $site->theme; Yii::app()->theme = $site->theme; $this->site_id = $site->id; Yii::import('application.extensions.sesmail.*'); require_once 'vendors/aws-sdk/sdk.class.php'; $this->ses = new YiiSesMail(); if (stristr($_SERVER['REQUEST_URI'], 'admin')) { //if(!Yii::app()->user->isSuperUser) { // $this->redirect("/"); // exit; //} $session = new CHttpSession(); $session->open(); $site_id = $session['site_id']; // override the site_id (since switched) if ($site_id) { $this->site_id = $site_id; } $this->sites = CHtml::listData(Sites::model()->findAll(), 'id', 'name'); $this->admin = 1; $this->layout = '//layouts/admin'; } else { $this->isEditor = Yii::app()->user->checkAccess('admin'); $this->niches = Offers::model()->getNiches($this->site_id); //$this->site_id = $site->getCurrentSite(); //Yii::import('application.extensions.sesmail.*'); //require_once('protected/extensions/sesmail/YiiSesMail.php'); //require_once('vendors/aws-sdk/sdk.class.php'); $session = new CHttpSession(); $session->open(); $seenOffer = $session['seenBackout']; if ($seenOffer) { $this->hideBackout = true; } Yii::import('application.modules.user.models.*'); $this->registration_model = new RegistrationForm(); $this->login_model = new UserLogin(); } parent::init(); }