function subscriptionList()
{
    global $bdd;
    global $_TABLES;
    $content = "";
    $view = new Template(dirname(dirname(__FILE__)) . '/html/media.html');
    if (!is_null($bdd) && !is_null($_TABLES)) {
        if (isset($_SESSION['user_id'])) {
            $user_id = $_SESSION['user_id'];
            $objWebsiteSubscription = new WebsiteSubscription($bdd, $_TABLES);
            $website_subscriptions = $objWebsiteSubscription->getAllWebsiteSubscriptionsByUser($user_id);
            if (!is_null($website_subscriptions)) {
                $objWebsite = new Website($bdd, $_TABLES);
                foreach ($website_subscriptions as $key => $value) {
                    $website = $objWebsite->getData($value->website_id);
                    if (!is_null($website)) {
                        $temp_subscription = "<div class='unsubscription' website_id='%%website_id%%'></div>";
                        $content .= $view->getView(array("url" => $website->url, "title" => $website->website, "logo_site" => $website->logo, "alt_logo_site" => $website->website, "title_site" => $website->website, "subscription" => $temp_subscription, "website_id" => $website->id));
                    }
                }
                return $content;
            } else {
                // 404
                return "404 Not Found";
            }
        } else {
            // 404
            return "404 Not Found";
        }
    } else {
        error_log("BDD ERROR : " . json_encode($bdd));
        error_log("TABLES ERROR : " . json_encode($_TABLES));
    }
}
Example #2
0
function save_website($datas)
{
    global $templatesList;
    load_lib();
    //Etape 1 : sauvegarde du site
    require_once MODELS . DS . 'website.php';
    $websiteModel = new Website();
    $templateId = $datas['template_id'];
    $template = $templatesList[$templateId];
    $datas['tpl_layout'] = $template['layout'];
    $datas['tpl_code'] = $template['code'];
    $datas['search_engine_position'] = 'header';
    $datas['created_by'] = 1;
    $datas['modified_by'] = 1;
    $datas['online'] = 1;
    $websiteModel->save($datas);
    define('CURRENT_WEBSITE_ID', $websiteModel->id);
    //Etape 2 : sauvegarde du menu racine
    require_once MODELS . DS . 'category.php';
    $categoryModel = new Category();
    unset($categoryModel->searches_params);
    ////////////////////////////////////////////////////////
    //   INITIALISATION DE LA CATEGORIE PARENTE DU SITE   //
    $categorie = array('parent_id' => 0, 'type' => 3, 'name' => 'Racine Site ' . $websiteModel->id, 'slug' => 'racine-site-' . $websiteModel->id, 'online' => 1, 'redirect_category_id' => 0, 'display_contact_form' => 0, 'website_id' => $websiteModel->id);
    $categoryModel->save($categorie);
    return $websiteModel->id + $categoryModel->id;
}
Example #3
0
 /**
  * Constructor
  *
  * @access public
  */
 public function __construct()
 {
     parent::__construct();
     $this->load->model('Questionnaire_model', 'Questionnaire_model', True);
     $this->load->model('Visistor_questionnaire_answer_model', 'Visistor_questionnaire_answer_model', True);
     $this->load->controller('Website');
     $website_object = new Website();
     $website_object->load();
 }
Example #4
0
 /**
  * Constructor
  *
  * @access public
  */
 public function __construct()
 {
     parent::__construct();
     $this->load->model('Collaborate_model', 'Collaborate_model', True);
     $this->load->model('Menu_link_model', 'Menu_link_model', True);
     $this->load->model('Email_setting_model', 'Email_setting_model', True);
     $this->load->controller('Website');
     $website_object = new Website();
     $website_object->load();
 }
Example #5
0
 /**
  * Constructor
  *
  * @access public
  */
 public function __construct()
 {
     parent::__construct();
     $this->load->model('Video_model', 'Video_model', True);
     $this->load->model('Page_model', 'Page_model', True);
     $this->load->model('Writer_model', 'Writer_model', True);
     $this->load->model('Page_selected_model', 'Page_selected_model', True);
     $this->load->controller('Website');
     $website_object = new Website();
     $website_object->load();
 }
Example #6
0
 public function testBeforeSave()
 {
     $websiteId = 1;
     $object = $this->getMockBuilder('Magento\\Framework\\Object')->disableOriginalConstructor()->setMethods(['hasData', 'setData'])->getMock();
     $store = $this->getMockBuilder('Magento\\Framework\\Object')->setMethods(['getWebsiteId'])->getMock();
     $store->expects($this->once())->method('getWebsiteId')->will($this->returnValue($websiteId));
     $this->storeManager->expects($this->once())->method('getStore')->will($this->returnValue($store));
     $object->expects($this->once())->method('hasData')->with('website_id')->will($this->returnValue(false));
     $object->expects($this->once())->method('setData')->with($this->logicalOr('website_id', $websiteId))->will($this->returnSelf());
     /** @var \Magento\Framework\Object $object */
     $this->assertInstanceOf('Magento\\Customer\\Model\\Customer\\Attribute\\Backend\\Website', $this->testable->beforeSave($object));
 }
Example #7
0
function getwebsitepages($websiteid)
{
    $website = new Website();
    $res = $website->fetchwebpages($websiteid);
    $pagearr = array();
    $count = 0;
    while ($pagerow = $website->fetch_assoc($res)) {
        if (empty($pagecontent)) {
            $pagearr[$count] = $pagerow['page_id'];
            $count++;
        }
    }
    return $pagearr;
}
 public function trigger($nickname = null)
 {
     $user = $this->load_user($nickname);
     Website::triggerAll($user);
     Site::Flash('notice', 'Update has been triggered');
     Redirect("admin/users/" . $user->permalink());
 }
 public function action_index()
 {
     // get acl
     $acl = Acl::instance();
     // get modules
     $modules = Settings::factory('modules')->as_array();
     // get navigation
     $settings = Settings::factory('navigation', array('settings' . DIRECTORY_SEPARATOR . Website::instance()->id() . DIRECTORY_SEPARATOR, 'settings'));
     $navigation = $settings->get('menu');
     // filter out allowed modules
     $allowedModules = array();
     foreach ($modules as $module => $data) {
         if ($acl->allowed($module, 'access')) {
             $allowedModules[$module] = $data;
         }
     }
     // fill up sections
     $sections = array();
     foreach ($navigation as $section => $modules) {
         foreach ($modules as $module) {
             if (isset($allowedModules[$module])) {
                 // section has a allowed module, so include it
                 if (!isset($sections[$section])) {
                     $sections[$section] = array();
                 }
                 // add module to section
                 $sections[$section][$module] = $allowedModules[$module];
             }
         }
     }
     $view = View::factory('start', array('sections' => $sections));
     $this->response->body($view->render());
 }
 /**
  * get instance
  */
 public static function instance()
 {
     if (self::$_instance === FALSE) {
         self::$_instance = new Website();
     }
     return self::$_instance;
 }
Example #11
0
 function website()
 {
     $website_id = $this->parent_id;
     if (empty($website_id)) {
         return null;
     }
     $where = "blog_id = " . $website_id;
     require_once 'class.mt_website.php';
     $website = new Website();
     $sites = $website->Find($where);
     $site = null;
     if (!empty($sites)) {
         $site = $sites[0];
     }
     return $site;
 }
 /**
  * init: check if user is logged in
  * 
  * if not: redirect to login
  */
 public function init()
 {
     // call parent before first
     parent::init();
     // only check if the controller is not auth
     if (Request::initial()->controller() != 'Auth') {
         // url to loginpage
         $url = URL::to('Auth@login');
         // init identity
         $identity = Identity::instance();
         //revert identity to original user (maybe assume was called somewhere else)
         $identity->revert();
         // check authentication
         if (!$identity->authenticated()) {
             // if user is not allready authenticated, redirect to login page
             $this->redirect($url);
         } else {
             $website = Website::instance();
             // else: initialise acl
             Acl::init($identity, new Model_Rights($website->websites()));
             // set current environment
             Acl::environment($website->id());
             // if user is not entitled to access backend
             if (!Acl::instance()->allowed('Backend', 'access')) {
                 $this->redirect($url);
             }
             // if user is not entitled to access controller
             if (!Acl::instance()->allowed(Request::initial()->controller(), 'access')) {
                 $this->redirect($url);
             }
         }
     }
 }
Example #13
0
 public function __construct($type, $limit = 5, $page = 0, $worldId = 0, $vocation = '')
 {
     $this->highscoreConfig = Website::getWebsiteConfig();
     parent::__construct();
     $this->skillType = $type;
     $this->setLimit($limit);
     $this->setOffset($page * $limit);
     $this->worldId = $worldId;
     $this->vocation = $vocation;
     switch ($type) {
         case self::SKILL_FIST:
         case self::SKILL_CLUB:
         case self::SKILL_SWORD:
         case self::SKILL_AXE:
         case self::SKILL_DISTANCE:
         case self::SKILL_SHIELD:
         case self::SKILL_FISHING:
             $this->loadSkill();
             break;
         case self::SKILL__MAGLEVEL:
             $this->loadMagic();
             break;
         case self::SKILL__LEVEL:
             $this->loadLevel();
             break;
         default:
             new Error_Critic('', __METHOD__ . '(), unknown type: ' . htmlspecialchars($type));
             break;
     }
 }
 public function run()
 {
     Banner::truncate();
     Website::truncate();
     $user = User::create(array("username" => "danheyman", "name" => "Daniel Heyman", "email" => "*****@*****.**", "password" => "hello", "newsletter" => true, "admin_emails" => true, "membership" => "platinum", "paypal" => "", "membership_expires" => Carbon::now()->addMonth(), "referrals" => 0, "upline" => "", "cash" => 0, "credits" => 0, "credits_today" => 0, "views_total" => 0, "views_today" => 0, 'auto_assign' => 0, 'register_ip' => Request::getClientIp(), 'last_login' => Carbon::now()));
     for ($x = 0; $x < 20; $x++) {
         $website = new Website();
         $website->url = "http://listviral.com";
         $website->enabled = true;
         $website->credits = 10000;
         $website->views = 0;
         $website->days = array();
         $website->hours = array();
         $user->websites()->save($website);
         $banner = new Banner();
         $banner->banner = "http://brisksurf.com/banner.png";
         $banner->url = "http://brisksurf.com";
         $banner->enabled = true;
         $banner->credits = 10000;
         $banner->views = 0;
         $banner->days = array();
         $banner->hours = array();
         $user->banners()->save($banner);
     }
 }
Example #15
0
 /**
  * @before _secure, _admin
  */
 public function websites($user_id)
 {
     $this->seo(array("title" => "View Users Websites", "keywords" => "admin", "description" => "admin", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $websites = Website::all(array("user_id = ?" => $user_id));
     $view->set("websites", $websites);
 }
Example #16
0
 public function getAvatarUrl()
 {
     if (!$this->_resourceUrl) {
         throw new \Exception("Can't getWebsiteUrl() because resourceUrl not set on this HistoryItem object");
     }
     $this->load($this->_resourceUrl);
     foreach ($this->_data['associatedWebsites'] as $websiteResourceUrl) {
         $website = new Website();
         $website->load($websiteResourceUrl);
         $avatarUrl = $website->getAvatarUrl();
         if ($avatarUrl) {
             return $avatarUrl;
         }
     }
     return "https://app.buzzstream.com/img/default_avatar_media.png";
 }
Example #17
0
 public function dvHomePortalsMenusLinksHtml($link_alias)
 {
     $link_alias = urldecode($link_alias);
     $this->load->controller('Website');
     $website_object = new Website();
     //$link_alias=$_POST['alias'];
     $home_portals_row = $this->Pagecat_model->get_by_alias($link_alias);
     if (count($home_portals_row) > 0) {
         $pagecat_id = $home_portals_row->id;
         $page_rows = $this->Page_model->get_by_pagecat($pagecat_id, 4);
         $page_row_counter = 1;
         foreach ($page_rows as $page_row) {
             $page_alias = $page_row->alias;
             $page_writer_alias = $page_row->writer_alias;
             if ($this->lang->lang() == 'ar') {
                 $title = $page_row->title_ar;
                 $page_brief = $page_row->brief_ar;
                 $page_writer_name = $page_row->writer_name_ar;
             } else {
                 $title = $page_row->title;
                 $page_brief = $page_row->brief;
                 $page_writer_name = $page_row->writer_name;
             }
             $banner_file_selected = base_url() . $page_row->banner_file_selected;
             $full_link_url = base_url() . $this->lang->lang() . '/page/content/' . $page_alias;
             $page_writer_full_link_url = base_url() . $this->lang->lang() . '/writer/content/' . $page_writer_alias;
             $hijri_date = $website_object->getHijri($page_row->last_modify_date);
             $miladi_date = $website_object->getDateForamt($page_row->last_modify_date);
             if ($page_row_counter == 1) {
                 $page_row_li_style = "class='first'";
             } else {
                 if ($page_row_counter == 2) {
                     $page_row_li_style = "class='zebra'";
                 } else {
                     if ($page_row_counter == 4) {
                         $page_row_li_style = "class='last zebra'";
                     } else {
                         $page_row_li_style = "";
                     }
                 }
             }
             $page_row_counter++;
             echo "\n         \t<li {$page_row_li_style}>\n                <div class='first last'>\n                  <div class='first'>\n                    <div class='first'><a class='first last' href='{$full_link_url}'><img class='first last' src='{$banner_file_selected}' alt='{$title}' /></a></div>\n                    <div class='last'>\n                      <h2 class='first'><a class='first last' href='{$full_link_url}'>{$title}</a></h2>\n                        <div class='articleTime'>{$hijri_date} - {$miladi_date}</div>\n\n                        <div><span class='first'>" . lang('writer') . ":</span> <a href='{$page_writer_full_link_url}'>{$page_writer_name}</a></div>\n                      <p class='last'>{$page_brief} ..</p>\n                    </div>\n                  </div>\n                  <div class='readMoreContainer' class='last'><a class='first last' href='{$full_link_url}'>" . lang('more') . "</a></div>\n                </div>\n            </li>\n\t\t   ";
         }
     }
     exit;
 }
Example #18
0
 /**
  *
  */
 public function __construct($controllerID, $xml)
 {
     $this->_xml = $xml;
     $this->_controllerID = $controllerID;
     if (!defined('_WEBSITE_HELPER_CHECKED_PATTERNS_') && count($block = $this->_xml->xpath("//patterns")) > 0) {
         define('_WEBSITE_HELPER_CHECKED_PATTERNS_', true);
         Website::setUrlPatterns($block[0]->pattern);
     }
 }
Example #19
0
 public function __toString()
 {
     $table = '';
     $name = Website::getDBHandle()->fieldName($this->name);
     if (!empty($this->table)) {
         $table = Website::getDBHandle()->tableName($this->table) . '.';
     }
     return $table . $name;
 }
Example #20
0
 public function saveToFile($path = false)
 {
     if ($path) {
         $savePath = $path;
     } else {
         $savePath = $this->loadedFromPath;
     }
     Website::putFileContents($savePath, '<?php' . chr(0xa) . $this->getConfigAsString() . '?>');
 }
Example #21
0
 public function __construct()
 {
     foreach (Website::getDBHandle()->query('SELECT * FROM ' . Website::getDBHandle()->tableName('groups')) as $group) {
         $groupData = array();
         $groupData['id'] = $group['id'];
         $groupData['name'] = $group['name'];
         $this->groups[$groupData['id']] = new Group($groupData);
     }
 }
Example #22
0
 public function getDatabaseHandler()
 {
     /* CUSTOM VERSION, FASTER, BUT IT IS POSSIBLE TO SHOW DATABASE PASSWORD WHEN ERROR OCCUR
     	CAN BE INTERESTING IF YOU EXECUTE 1000 OR 10.000 SQL QUERIES PER PAGE, FOR NORMAL USEAGE NOT NEEDED
     		if(!isset($this->SQL))
     			$this->SQL = Website::getDBHandle();
     
     		return $this->SQL;
     */
     return Website::getDBHandle();
 }
Example #23
0
 public function reAction($token)
 {
     $item = Website::find(array('conditions' => 'token = ?1', 'bind' => array(1 => $token), 'cache' => array('key' => $token, 'lifetime' => 7200 * 24)))->getFirst();
     if ($item) {
         $item->vote += rand(1, 10);
         $item->save();
         $this->response->redirect($item->href, true);
     } else {
         $this->response->redirect('/', true);
     }
 }
 protected static function load_website($id = null)
 {
     if (!$id) {
         $id = $_GET['id'];
     }
     $website = Website::find_by_id($id);
     if ($website) {
         return $website;
     } else {
         throw new Error404('Unable to find Website');
     }
 }
Example #25
0
 /**
  * @return Website[]
  * @throws \Exception
  */
 public function getWebsites()
 {
     $apiResourceModel = new Website();
     $params = array('offset' => 0, 'max_results' => 200, 'project' => $this->getId());
     $url = Api::$apiUrl . '/' . 'websites';
     $url .= '?' . http_build_query($params);
     $cachedResponse = $apiResourceModel->_getCachedRequest($url);
     if ($cachedResponse) {
         return $cachedResponse;
     }
     $objects = array();
     $apiResponse = $apiResourceModel->_request($url);
     if (!isset($apiResponse['list'])) {
         throw new \Exception("No 'list' found for URL ({$url}): " . print_r($apiResponse, 1));
     }
     foreach ($apiResponse['list'] as $resourceUrl) {
         $objects[] = (new Website())->load($resourceUrl);
     }
     // Cache the list for 1/10th of a day
     $apiResourceModel->_putCachedRequest($url, $objects, 0.1);
     return $objects;
 }
Example #26
0
 public static function getAllWebsites()
 {
     if (is_null(self::$allWebsites) || !is_array(self::$allWebsites)) {
         self::$allWebsites = array();
         QueryBuilder::create(SQL::getConnection())->withQuery("SELECT id, display_name, folder_name FROM websites")->build()->forEachResult(function ($row) {
             self::$allWebsites[] = new Website($row['id'], $row['display_name'], $row['folder_name']);
         });
         if (count(self::$allWebsites) == 0) {
             throw new Exception("You suck.");
         }
     }
     return self::$allWebsites;
 }
Example #27
0
function setServerPath($newPath)
{
    $file = fopen("./config/config.php", "r");
    $lines = array();
    while (!feof($file)) {
        $lines[] = fgets($file);
    }
    fclose($file);
    $newConfig = array();
    foreach ($lines as $i => $line) {
        if (substr($line, 0, strlen('$config[\'site\'][\'serverPath\']')) == '$config[\'site\'][\'serverPath\']') {
            $newConfig[] = '$config[\'site\'][\'serverPath\'] = "' . str_replace('"', '\\"', $newPath) . '";' . PHP_EOL;
        } else {
            $newConfig[] = $line;
        }
    }
    Website::putFileContents("./config/config.php", implode('', $newConfig));
}
 /**
  * [home 网站设置]
  * @return [type] [description]
  */
 public function home()
 {
     if (IS_POST) {
         $data = ['web_title' => I('post.web_title'), 'web_keyword' => I('post.web_keyword'), 'web_desription' => I('post.web_desription'), 'web_footer' => I('post.web_footer')];
         Website::where(['id' => 1])->update($data);
         View::success('更新成功');
         die;
     }
     $webData = Website::find(1)->toArray();
     //print_r($webData);
     $this->smarty->assign('webData', $webData);
     $this->smarty->assign('title', '网站设置_ISisWeb中文网后台管理_ISirPHPFramework');
     $this->smarty->display('Admin/System/home.html');
     die;
     // $this->view = View::make('/Admin/System/home')
     // 			   ->with('webData',$webData)
     // 			   ->with('title','网站设置_ISirWeb中文网');
 }
Example #29
0
 public function __toString()
 {
     if ($this->leftSide instanceof SQL_Field or $this->leftSide instanceof SQL_Filter) {
         $ret = $this->leftSide->__toString();
     } else {
         $ret = Website::getDBHandle()->quote($this->leftSide);
     }
     $ret .= $this->filterType;
     if ($this->rightSide instanceof SQL_Field or $this->rightSide instanceof SQL_Filter) {
         $ret .= $this->rightSide->__toString();
     } else {
         $ret .= Website::getDBHandle()->quote($this->rightSide);
     }
     if ($this->bracket) {
         return '(' . $ret . ')';
     } else {
         return $ret;
     }
 }
 public function gotosite($site = null)
 {
     if ($this->GetData('site')) {
         $site = $this->GetData('site');
     }
     $site = Website::find_by_code($site);
     if (!$site) {
         Site::Flash('error', 'Unable to find the site you want to go to');
         Redirect('');
     }
     if ($user = Site::CurrentUser()) {
         try {
             $login = new Login();
             $login->user_id = $user->id;
             $login->user = $user;
             $login->website_id = $site->id;
             $login->website = $site;
             $login->ip = Site::RemoteIP();
             if ($login->save()) {
                 header("Location: {$login->url}");
                 die;
             } else {
                 Site::Flash('error', 'Unable to redirect you');
                 Redirect('');
             }
         } catch (Error500 $e) {
             $error = 'Error';
             if ($e->getMessage()) {
                 $error .= ': ' . $e->getMessage();
             }
             Site::Flash('error', $error);
             Redirect('');
         }
     } else {
         if ($site) {
             header("Location: {$site->url}");
             die;
         }
         Site::Flash('error', 'Unable to go to site');
         Redirect('');
     }
 }