public function load($resource, $type = null)
 {
     $typCfg = explode('_', $type);
     $res = explode('@', $resource);
     if (isset($this->loaded[$res[0]])) {
         throw new \RuntimeException('Do not add the "nyrocms" with "' . $res[0] . '" loader twice');
     }
     $rootContent = $this->container->get('nyrocms_db')->getContentRepository()->findOneBy(array('level' => 0, 'handler' => $res[0]));
     if (!$rootContent) {
         throw new \RuntimeException('No root content found with handler "' . $res[0] . '"');
     }
     /* @var $rootContent \NyroDev\NyroCmsBundle\Model\Content */
     $routes = new RouteCollection();
     $locale = $this->container->get('nyrocms')->getDefaultLocale($rootContent);
     $locales = $this->container->get('nyrocms')->getLocales($rootContent, true);
     $routes->add($res[0] . '_homepage_noLocale', new Route('/' . (in_array('forceLang', $typCfg, true) ? $locale . '/' : ''), array('_controller' => $res[1] . ':index', '_locale' => $locale, '_config' => $res[0]), array(), array(), $rootContent->getHost()));
     if ($rootContent->getXmlSitemap()) {
         $routes->add($res[0] . '_sitemap_xml_index', new Route('/sitemap.{_format}', array('_controller' => $res[1] . ':sitemapIndexXml', '_config' => $res[0]), array('_format' => 'xml'), array(), $rootContent->getHost()));
         $routes->add($res[0] . '_sitemapXml', new Route('/{_locale}/sitemap.{_format}', array('_controller' => $res[1] . ':sitemapXml', '_locale' => $locale, '_config' => $res[0]), array('_locale' => $locales, '_format' => 'xml'), array(), $rootContent->getHost()));
     }
     $routes->add($res[0] . '_homepage', new Route('/{_locale}/', array('_controller' => $res[1] . ':index', '_locale' => $locale, '_config' => $res[0]), array('_locale' => $locales), array(), $rootContent->getHost()));
     $routes->add($res[0] . '_search', new Route('/{_locale}/search', array('_controller' => $res[1] . ':search', '_locale' => $locale, '_config' => $res[0]), array('_locale' => $locales), array(), $rootContent->getHost()));
     $routes->add($res[0] . '_content_spec_handler', new Route('/{_locale}/{url}/{id}/{title}/handler/{handler}', array('_controller' => $res[1] . ':contentSpec', '_locale' => $locale, '_config' => $res[0]), array('_locale' => $locales, 'url' => '.+', 'id' => '\\d+', 'handler' => '.+'), array(), $rootContent->getHost()));
     $routes->add($res[0] . '_content_spec', new Route('/{_locale}/{url}/{id}/{title}', array('_controller' => $res[1] . ':contentSpec', '_locale' => $locale, '_config' => $res[0]), array('_locale' => $locales, 'url' => '.+', 'id' => '\\d+'), array(), $rootContent->getHost()));
     $routes->add($res[0] . '_content_handler', new Route('/{_locale}/{url}/handler/{handler}', array('_controller' => $res[1] . ':content', '_locale' => $locale, '_config' => $res[0]), array('_locale' => $locales, 'url' => '.+', 'handler' => '.+'), array(), $rootContent->getHost()));
     $routes->add($res[0] . '_content', new Route('/{_locale}/{url}', array('_controller' => $res[1] . ':content', '_locale' => $locale, '_config' => $res[0]), array('_locale' => $locales, 'url' => '.+'), array(), $rootContent->getHost()));
     $this->loaded[$res[0]] = true;
     return $routes;
 }
 public function load(ObjectManager $manager)
 {
     $data = (include __DIR__ . '/../fixtures/user/users.php');
     $encoder = $this->container->get('security.password_encoder');
     $userManager = $this->container->get('medievistes.user_manager');
     $connection = $manager->getConnection();
     if ($connection->getDatabasePlatform()->getName() === 'mysql') {
         $connection->exec("ALTER TABLE {$manager->getClassMetadata(User::class)->getTableName()} AUTO_INCREMENT = 1;");
     }
     foreach ($data as $userData) {
         $class = $userManager->getUserClass($userData['type']);
         $user = (new $class())->setId((int) $userData['id'])->setUsername($userData['username'])->setEmail($userData['email'])->setPlainPassword($userData['plain_password'])->setSalt(md5(uniqid(null, true)))->enable((bool) $userData['is_active'])->setCreatedAt(new \DateTime($userData['created_at']))->setUpdatedAt(new \DateTime($userData['updated_at']));
         if (!empty($userData['activation_link_id'])) {
             $user->setActivationLink($this->getReference("activation-link-{$userData['activation_link_id']}"));
         }
         foreach ($userData['roles'] as $role) {
             $user->addRole($role);
         }
         foreach ($userData['troops'] as $troop) {
             $association = (new Association())->setUser($user)->setTroop($this->getReference("troop-{$troop['troop_id']}"))->setRole($this->getReference("troop-role-{$troop['role_id']}"));
             $user->addTroopAssociation($association);
             $manager->persist($association);
         }
         $password = $encoder->encodePassword($user, $userData['plain_password']);
         $user->setPassword($password);
         $manager->persist($user);
         $manager->flush();
         $this->addReference("user-{$user->getId()}", $user);
     }
     $manager->clear($class);
     $manager->clear(Association::class);
 }
 function main($id, $mode)
 {
     global $phpbb_container, $user, $template, $config, $request;
     $this->phpbb_container = $phpbb_container;
     $this->user = $user;
     $this->template = $template;
     $this->config = $config;
     $this->request = $request;
     $this->log = $this->phpbb_container->get('log');
     $this->tpl_name = 'acp_codebox_plus';
     $this->page_title = $this->user->lang('CODEBOX_PLUS_TITLE');
     add_form_key('o0johntam0o/acp_codebox_plus');
     if ($this->request->is_set_post('submit')) {
         if (!check_form_key('o0johntam0o/acp_codebox_plus')) {
             trigger_error('FORM_INVALID');
         }
         $this->config->set('codebox_plus_syntax_highlighting', $request->variable('codebox_plus_syntax_highlighting', 0));
         $this->config->set('codebox_plus_expanded', $request->variable('codebox_plus_expanded', 0));
         $this->config->set('codebox_plus_download', $request->variable('codebox_plus_download', 0));
         $this->config->set('codebox_plus_login_required', $request->variable('codebox_plus_login_required', 0));
         $this->config->set('codebox_plus_prevent_bots', $request->variable('codebox_plus_prevent_bots', 0));
         $this->config->set('codebox_plus_captcha', $request->variable('codebox_plus_captcha', 0));
         $this->config->set('codebox_plus_max_attempt', $request->variable('codebox_plus_max_attempt', 0));
         $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'CODEBOX_PLUS_LOG_MSG');
         trigger_error($this->user->lang('CODEBOX_PLUS_SAVED') . adm_back_link($this->u_action));
     }
     $this->template->assign_vars(array('U_ACTION' => $this->u_action, 'S_CODEBOX_PLUS_VERSION' => isset($this->config['codebox_plus_version']) ? $this->config['codebox_plus_version'] : 0, 'S_CODEBOX_PLUS_SYNTAX_HIGHLIGHTING' => isset($this->config['codebox_plus_syntax_highlighting']) ? $this->config['codebox_plus_syntax_highlighting'] : 0, 'S_CODEBOX_PLUS_EXPANDED' => isset($this->config['codebox_plus_expanded']) ? $this->config['codebox_plus_expanded'] : 0, 'S_CODEBOX_PLUS_DOWNLOAD' => isset($this->config['codebox_plus_download']) ? $this->config['codebox_plus_download'] : 0, 'S_CODEBOX_PLUS_LOGIN_REQUIRED' => isset($this->config['codebox_plus_login_required']) ? $this->config['codebox_plus_login_required'] : 0, 'S_CODEBOX_PLUS_PREVENT_BOTS' => isset($this->config['codebox_plus_prevent_bots']) ? $this->config['codebox_plus_prevent_bots'] : 0, 'S_CODEBOX_PLUS_CAPTCHA' => isset($this->config['codebox_plus_captcha']) ? $this->config['codebox_plus_captcha'] : 0, 'S_CODEBOX_PLUS_MAX_ATTEMPT' => isset($this->config['codebox_plus_max_attempt']) ? $this->config['codebox_plus_max_attempt'] : 0));
 }
Exemple #4
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->container = (include './config/container.php');
     $this->config = $this->container->get('config')['dataStore'];
     $this->dbTableName = $this->config['testDbTable']['tableName'];
     $this->adapter = $this->container->get('db');
     $this->object = $this->container->get('testDbTable');
 }
 /**
  * set current parent template from matching theme
  * @return type
  */
 public function getCurrentLayoutTemplate()
 {
     $theme_schema = $this->builder->getCurrentThemeSchema();
     if (array_key_exists('theme', $theme_schema)) {
         $currentThemePath = $this->container->get('layout.layout_theme.helper')->getThemeBundle() . '::themes/' . $theme_schema['theme'] . '/';
         return $currentThemePath . $theme_schema['template'];
     }
     return '';
 }
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     if (count($options['contacts']) > 1) {
         $choices = array();
         foreach ($options['contacts'] as $k => $v) {
             $choices[$k] = $this->container->get('nyrodev')->trans($v['name']);
         }
         $builder->add('dest', ChoiceType::class, array('label' => $this->container->get('nyrodev')->trans('nyrocms.handler.contact.dest'), 'placeholder' => '', 'choices' => $choices, 'required' => true));
     }
     $builder->add('lastname', TextType::class, array('label' => $this->container->get('nyrodev')->trans('nyrocms.handler.contact.lastname'), 'constraints' => array(new Constraints\NotBlank())))->add('firstname', TextType::class, array('label' => $this->container->get('nyrodev')->trans('nyrocms.handler.contact.firstname'), 'constraints' => array(new Constraints\NotBlank())))->add('company', TextType::class, array('label' => $this->container->get('nyrodev')->trans('nyrocms.handler.contact.company'), 'required' => false))->add('phone', TextType::class, array('label' => $this->container->get('nyrodev')->trans('nyrocms.handler.contact.phone'), 'required' => false))->add('email', EmailType::class, array('label' => $this->container->get('nyrodev')->trans('nyrocms.handler.contact.email'), 'constraints' => array(new Constraints\NotBlank(), new Constraints\Email())))->add('message', TextareaType::class, array('label' => $this->container->get('nyrodev')->trans('nyrocms.handler.contact.message'), 'constraints' => array(new Constraints\NotBlank())))->add('submit', SubmitType::class, array('label' => $this->container->get('nyrodev')->trans('nyrocms.handler.contact.send')));
 }
Exemple #7
0
 /**
  * @param $property
  * @return mixed|null
  * @throws Exception
  */
 public function __get($property)
 {
     if (!is_object($this->dependencyInjector) || !$this->dependencyInjector instanceof ContainerInterface) {
         throw new Exception('A dependency injection object is required');
     }
     if ($this->dependencyInjector->has($property)) {
         $service = $this->dependencyInjector->get($property);
         $this->{$property} = $service;
         return $service;
     }
     return null;
 }
 /**
  * Returns the rendered breadcrumbs
  *
  * @return string
  */
 public function renderBreadcrumbs()
 {
     $router = $this->container->get('router');
     $request = $this->container->get('request');
     $route = $request->get('_route');
     try {
         $params = $router->match(rawurldecode($request->getPathInfo()));
     } catch (MethodNotAllowedException $e) {
         return;
     }
     return $this->container->get("templating")->render("XiBreadcrumbsBundle:Default:breadcrumbs.html.twig", array('breadcrumbs' => $this->service->getBreadcrumbs((string) $route, $params)));
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $kernel = static::createKernel();
     $kernel->boot();
     $this->_container = $kernel->getContainer();
     $this->_em = $this->_container->get('doctrine.orm.entity_manager');
     AnnotationRegistry::registerFile($kernel->getRootDir() . "/../vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php");
     if (!isset($GLOBALS['TEST_CHARGED'])) {
         $this->_createSchemas();
         $this->_insertData();
         $GLOBALS['TEST_CHARGED'] = true;
     }
 }
 /**
  * {@inheritDoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->container = $this->getContainer();
     $output->writeln("<comment>Updating...</comment>\n");
     $em = $this->container->get('doctrine.orm.entity_manager');
     $loader = new ContainerAwareLoader($this->container);
     $loader->loadFromDirectory($input->getOption('fixtures'));
     $purger = new ORMPurger($em);
     $executor = new ORMExecutor($em, $purger);
     $executor->setLogger(function ($message) use($output) {
         $output->writeln(sprintf('  <comment>></comment> <info>%s</info>', $message));
     });
     $executor->execute($loader->getFixtures(), true);
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->container = (include './config/container.php');
     $this->adapter = $this->container->get('db');
     $this->tableName = 'test_create_table';
     $this->object = new TableManagerMysql($this->adapter, $this->config);
     if ($this->object->hasTable($this->tableName)) {
         $this->object->deleteTable($this->tableName);
     }
     if ($this->object->hasTable('table_master')) {
         $this->object->deleteTable('table_master');
     }
     if ($this->object->hasTable('table_slave')) {
         $this->object->deleteTable('table_slave');
     }
 }
 public function load(ObjectManager $manager)
 {
     $data = (include __DIR__ . '/../fixtures/troop/troops.php');
     foreach ($data as $troopData) {
         $troop = (new Troop())->setId((int) $troopData['id'])->setName($troopData['name'])->setSlug($this->container->get('medievistes.slugger')->slugify($troopData['name']))->setDescription($troopData['description'])->setAddress($this->getReference("address-{$troopData['address_id']}"));
         if (isset($troopData['coat-of-arms'])) {
             $troop->setCoatOfArms((new CoatOfArms())->setName($troopData['name'])->setPath($troopData['coat-of-arms']));
         }
         foreach ($troopData['centuries'] as $century) {
             $troop->addCentury($this->getReference("century-{$century}"));
         }
         $manager->persist($troop);
         $this->addReference("troop-{$troop->getId()}", $troop);
     }
     $manager->flush();
     $manager->clear(Troop::class);
 }
Exemple #13
0
 public function resolveFileCollision($fileName, $clientOriginalName, $attempt = 1)
 {
     if ($this->hasNamer()) {
         $firstNamer = current($this->config['namer']);
         $newFileName = call_user_func(array($this->container->get($firstNamer['service']), 'resolveCollision'), $fileName, $attempt);
         //return dirName and path
         $resolveData = $this->useDirectoryNamer($newFileName, $clientOriginalName);
         $resolveData[] = $newFileName;
         return $resolveData;
     }
     throw new \Exception('Filename resolving collision not supported (namer is empty).Duplicate filename ' . $fileName);
 }
 function main($id, $mode)
 {
     global $user, $template, $cache, $config, $phpbb_root_path, $phpEx, $phpbb_container, $request;
     $this->config = $config;
     $this->phpbb_container = $phpbb_container;
     $this->config_text = $this->phpbb_container->get('config_text');
     $this->log = $this->phpbb_container->get('log');
     $this->request = $request;
     $this->template = $template;
     $this->user = $user;
     $this->phpbb_root_path = $phpbb_root_path;
     $this->php_ext = $phpEx;
     $this->user->add_lang_ext('davidiq/reimg', 'reimg_acp');
     $this->tpl_name = 'reimg';
     $this->page_title = 'ACP_REIMG_SETTINGS';
     $form_name = 'acp_reimg';
     add_form_key($form_name);
     $reimg_swap_portrait = $this->request->variable('reimg_swap_portrait', (bool) $this->config['reimg_swap_portrait']);
     $reimg_resize_sig_img = $this->request->variable('reimg_resize_sig_img', (bool) $this->config['reimg_resize_sig_img']);
     $reimg_link = $this->request->variable('reimg_link', $this->config['reimg_link']);
     $reimg_zoom = $this->request->variable('reimg_zoom', $this->config['reimg_zoom']);
     $reimg_attachments = $this->request->variable('reimg_attachments', (bool) $this->config['reimg_attachments']);
     $reimg_for_all = $this->request->variable('reimg_for_all', (bool) $this->config['reimg_for_all']);
     if ($this->request->is_set_post('submit')) {
         if (!check_form_key($form_name)) {
             trigger_error($this->user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
         }
         //Update configuration now
         $this->config->set('reimg_swap_portrait', $reimg_swap_portrait);
         $this->config->set('reimg_resize_sig_img', $reimg_resize_sig_img);
         $this->config->set('reimg_link', $reimg_link);
         $this->config->set('reimg_zoom', $reimg_zoom);
         $this->config->set('reimg_attachments', $reimg_attachments);
         $this->config->set('reimg_for_all', $reimg_for_all);
         $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_REIMG_UPDATED');
         trigger_error($user->lang['REIMG_UPDATED'] . adm_back_link($this->u_action));
     }
     $template->assign_vars(array('S_REIMG_SWAP_PORTRAIT' => $reimg_swap_portrait, 'S_REIMG_RESIZE_SIG_IMG' => $reimg_resize_sig_img, 'S_REIMG_LINK' => $this->select_reimg_link_method($reimg_link), 'S_REIMG_ZOOM' => $this->select_reimg_zoom_method($reimg_zoom), 'S_REIMG_ATTACHMENTS' => $reimg_attachments, 'S_REIMG_FOR_ALL' => $reimg_for_all, 'U_ACTION' => $this->u_action));
 }
 public function load($routingResource, $type = null)
 {
     $routes = parent::load($routingResource, $type);
     if (!$this->use) {
         return $routes;
     }
     /* @var $request Request */
     $request = $this->container->get("request");
     foreach ($this->am->getNames() as $name) {
         $asset = $this->am->get($name);
         $formula = $this->am->getFormula($name);
         $debug = isset($formula[2]['debug']) ? $formula[2]['debug'] : $this->am->isDebug();
         $combine = isset($formula[2]['combine']) ? $formula[2]['combine'] : !$debug;
         if (!$combine && $debug) {
             $i = 0;
             foreach ($asset as $leaf) {
                 $routeName = "_assetic_" . $name . "_" . $i++;
                 $route = $routes->get($routeName);
                 if ($route && ($pos = strpos($leaf->getSourcePath(), '.')) !== false && in_array(substr($leaf->getSourcePath(), $pos), ['.js', '.css', '.scss'])) {
                     if ($this->https == self::HTTPS_MODE_DETECT && $request->isSecure() || $this->https == self::HTTPS_MODE_FULL) {
                         $route->setHost($this->host . ($this->portHttps ? ":" . $this->portHttps : ""));
                         if ($this->portHttps) {
                             $route->setSchemes("https");
                         }
                         $route->setPath($leaf->getSourceRoot() . "/" . $leaf->getSourcePath() . "?" . $route->getPath());
                     } else {
                         $route->setHost($this->host . ":" . ($this->port ? ":" . $this->port : ""));
                         if ($this->port) {
                             $route->setSchemes("http");
                         }
                         $route->setPath($leaf->getSourceRoot() . "/" . $leaf->getSourcePath() . "?" . $route->getPath());
                     }
                 }
             }
         }
     }
     return $routes;
 }
Exemple #16
0
    public function advanced_profile_system($event)
    {
        $member = $event['member'];
        $user_id = (int) $member['user_id'];
        // Get user_id of user we are viewing
        $username = $member['username'];
        $user_extra_rank_data = array('title' => null, 'img' => null, 'img_src' => null);
        $ranks_sql = 'SELECT *
				FROM ' . RANKS_TABLE . '
				WHERE rank_special != 1';
        $normal_ranks = $this->db->sql_query($ranks_sql);
        $spec_sql = 'SELECT rank_special 
					FROM ' . RANKS_TABLE . '
					WHERE rank_id = ' . $member['user_rank'];
        $special = $this->db->sql_query($spec_sql);
        if ($special !== 1) {
            if ($member['user_posts'] !== false) {
                if (!empty($normal_ranks)) {
                    foreach ($normal_ranks as $rank) {
                        if ($member['user_posts'] >= $rank['rank_min']) {
                            $user_extra_rank_data['title'] = $rank['rank_title'];
                            $user_extra_rank_data['img_src'] = !empty($rank['rank_image']) ? $this->phpbb_root_path . $this->config['ranks_path'] . '/' . $rank['rank_image'] : '';
                            $user_extra_rank_data['img'] = !empty($rank['rank_image']) ? '<img src="' . $user_extra_rank_data['img_src'] . '" alt="' . $rank['rank_title'] . '" title="' . $rank['rank_title'] . '" />' : '';
                            break;
                        }
                    }
                }
            }
        }
        $this->template->assign_vars(array('EXTRA_RANK_TITLE' => $user_extra_rank_data['title'], 'EXTRA_RANK_IMG' => $user_extra_rank_data['img']));
        /****************
         * PROFILE VIEWS *
         ****************/
        //	Make sure we have a session			Make sure user is not a bot.	 Do not increase view count if viewing own profile.
        if (isset($this->user->data['session_page']) && !$this->user->data['is_bot'] && $this->user->data['user_id'] != $user_id) {
            $incr_profile_views = 'UPDATE ' . USERS_TABLE . '
									SET user_profile_views = user_profile_views + 1
									WHERE user_id = ' . $user_id;
            $this->db->sql_query($incr_profile_views);
        }
        /****************
         * ACTIVITY FEED *
         ****************/
        $activity_feed_ary = array('SELECT' => 'p.*, t.*, u.username, u.user_colour', 'FROM' => array(POSTS_TABLE => 'p'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'u.user_id = p.poster_id'), array('FROM' => array(TOPICS_TABLE => 't'), 'ON' => 'p.topic_id = t.topic_id')), 'WHERE' => $this->db->sql_in_set('t.forum_id', array_keys($this->auth->acl_getf('f_read', true))) . ' 
							AND t.topic_status <> ' . ITEM_MOVED . '
							AND t.topic_visibility = 1
							AND p.poster_id = ' . $user_id, 'ORDER_BY' => 'p.post_time DESC');
        $activity_feed = $this->db->sql_build_query('SELECT', $activity_feed_ary);
        $activity_feed_result = $this->db->sql_query_limit($activity_feed, 5);
        // Only get last five posts
        while ($af_row = $this->db->sql_fetchrow($activity_feed_result)) {
            $topic_id = $af_row['topic_id'];
            $post_id = $af_row['post_id'];
            $post_date = $this->user->format_date($af_row['post_time']);
            $post_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->phpEx}", 't=' . $topic_id . '&amp;p=' . $post_id) . '#p' . $post_id;
            // Parse the posts
            $af_row['bbcode_options'] = ($af_row['enable_bbcode'] ? OPTION_FLAG_BBCODE : 0) + ($af_row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0) + ($af_row['enable_magic_url'] ? OPTION_FLAG_LINKS : 0);
            $text = generate_text_for_display($af_row['post_text'], $af_row['bbcode_uid'], $af_row['bbcode_bitfield'], $af_row['bbcode_options']);
            // Set a max length for the post to display
            $cutoff = ' …';
            $text = strlen($text) > 200 ? mb_substr($text, 0, 200) . $cutoff : $text;
            // See if user is able to view posts..
            $this->template->assign_block_vars('af', array('SUBJECT' => $af_row['post_subject'], 'TEXT' => $text, 'TIME' => $post_date, 'URL' => $post_url));
        }
        $this->db->sql_freeresult($activity_feed_result);
        // Master gave Dobby a sock, now Dobby is free!
        /***************
         * TOTAL TOPICS *
         ***************/
        $tt = 'SELECT COUNT(topic_poster) AS topic_author_count
				FROM ' . TOPICS_TABLE . '
				WHERE topic_poster = ' . $user_id;
        $total_topics_result = $this->db->sql_query($tt);
        $total_topics = (int) $this->db->sql_fetchfield('topic_author_count');
        $this->db->sql_freeresult($total_topics_result);
        // Master gave Dobby a sock, now Dobby is free!
        /***************
         * FRIENDS LIST *
         ***************/
        $sql_friend = array('SELECT' => 'u.user_id, u.username, u.username_clean, u.user_colour, MAX(s.session_time) as online_time, MIN(s.session_viewonline) AS viewonline', 'FROM' => array(USERS_TABLE => 'u', ZEBRA_TABLE => 'z'), 'LEFT_JOIN' => array(array('FROM' => array(SESSIONS_TABLE => 's'), 'ON' => 's.session_user_id = z.zebra_id')), 'WHERE' => 'z.user_id = ' . $user_id . '
				AND z.friend = 1
				AND u.user_id = z.zebra_id', 'GROUP_BY' => 'z.zebra_id, u.user_id, u.username_clean, u.user_colour, u.username', 'ORDER_BY' => 'u.username_clean ASC');
        $sql_friend_list = $this->db->sql_build_query('SELECT_DISTINCT', $sql_friend);
        $friend_result = $this->db->sql_query($sql_friend_list);
        while ($friend_row = $this->db->sql_fetchrow($friend_result)) {
            $img = phpbb_get_user_avatar($friend_row);
            // Use phpBB's Built in Avatar creator, for all types
            $has_avatar = false;
            if ($img == '') {
                $has_avatar = false;
                // This friend has no avatar..
            } else {
                $has_avatar = true;
                // This friend has an avatar
                $offset = 25;
                //Start off the img src
                $end = strpos($img, '"', $offset);
                // Find end of img src
                $length = $end - $offset;
                // Determine src length
                $friend_avatar = substr($img, $offset, $length);
                // Grab just the src
            }
            $this->template->assign_block_vars('friends', array('USERNAME' => get_username_string('full', $friend_row['user_id'], $friend_row['username'], $friend_row['user_colour']), 'AVATAR' => $friend_avatar, 'HAS_AVATAR' => $has_avatar));
        }
        $this->db->sql_freeresult($friend_result);
        // Master gave Dobby a sock, now Dobby is free!
        /*******
         * WALL *
         *******/
        // INSERTING A WALL POST
        add_form_key('postwall');
        $sendwall = isset($_POST['sendwall']) ? true : false;
        if ($sendwall) {
            if (check_form_key('postwall') && $this->auth->acl_get('u_wall_post')) {
                $msg_text = $this->request->variable('msg_text', '', true);
                $uid = $bitfield = $options = '';
                // will be modified by generate_text_for_storage
                $allow_bbcode = $allow_urls = $allow_smilies = true;
                generate_text_for_storage($msg_text, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
                $msg_time = time();
                $wall_ary = array('user_id' => $user_id, 'poster_id' => $this->user->data['user_id'], 'msg' => $msg_text, 'msg_time' => (int) $msg_time, 'bbcode_uid' => $uid, 'bbcode_bitfield' => $bitfield, 'bbcode_options' => $options);
                $insertwall = 'INSERT INTO ' . $this->wall_table . ' ' . $this->db->sql_build_array('INSERT', $wall_ary);
                $this->db->sql_query($insertwall);
                if ($user_id != $this->user->data['user_id']) {
                    $msg_id = (int) $this->db->sql_nextid();
                    $poster_name = get_username_string('no_profile', $this->user->data['user_id'], $this->user->data['username'], $this->user->data['user_colour']);
                    $notification_msg = $msg_text;
                    strip_bbcode($notification_msg, $uid);
                    $wall_notification_data = array('msg_id' => $msg_id, 'user_id' => $user_id, 'poster_name' => $poster_name, 'notification_msg' => strlen($notification_msg) > 30 ? substr($notification_msg, 0, 30) . '...' : $notification_msg);
                    $phpbb_notifications = $this->container->get('notification_manager');
                    $phpbb_notifications->add_notifications('posey.aps.notification.type.wall', $wall_notification_data);
                }
            } else {
                trigger_error($this->user->lang['FORM_INVALID']);
            }
        }
        // DISPLAYING WALL POSTS
        $getwall_ary = array('SELECT' => 'w.*, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height', 'FROM' => array($this->wall_table => 'w'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'u.user_id = w.poster_id')), 'WHERE' => 'w.user_id = ' . $user_id, 'ORDER_BY' => 'w.msg_id DESC');
        $getwall = $this->db->sql_build_query('SELECT_DISTINCT', $getwall_ary);
        $wallresult = $this->db->sql_query_limit($getwall, 10);
        // Only get latest 10 wall posts
        while ($wall = $this->db->sql_fetchrow($wallresult)) {
            $wall_msg = generate_text_for_display($wall['msg'], $wall['bbcode_uid'], $wall['bbcode_bitfield'], $wall['bbcode_options']);
            // Parse wall message text
            $msg_id = $wall['msg_id'];
            $msg_time = $this->user->format_date($wall['msg_time']);
            $this->template->assign_block_vars('wall', array('MSG' => $wall_msg, 'ID' => $wall['msg_id'], 'MSG_TIME' => $msg_time, 'POSTER' => get_username_string('full', $wall['poster_id'], $wall['username'], $wall['user_colour']), 'POSTER_AVATAR' => phpbb_get_user_avatar($wall), 'S_HIDDEN_FIELDS' => build_hidden_fields(array('deletewallid' => $wall['msg_id']))));
        }
        $this->db->sql_freeresult($wallresult);
        // Master gave Dobby a sock, now Dobby is free!
        // DELETE WALL POST
        $deletewall = isset($_POST['deletewall']) ? true : false;
        if ($deletewall) {
            if (confirm_box(true)) {
                $deletewallid = request_var('deletewallid', 0);
                $delete_msg = 'DELETE FROM ' . $this->wall_table . '
								WHERE msg_id = ' . $deletewallid;
                $this->db->sql_query($delete_msg);
                $msg_deleted_redirect = append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", "mode=viewprofile&amp;u=" . $user_id . "#wall");
                $message = $this->user->lang['CONFIRM_WALL_DEL'] . '<br /><br />' . sprintf($this->user->lang['RETURN_WALL'], '<a href="' . $msg_deleted_redirect . '">', $username, '</a>');
                meta_refresh(3, $msg_deleted_redirect);
                trigger_error($message);
            } else {
                $s_hidden_fields = build_hidden_fields(array('deletewall' => true, 'deletewallid' => request_var('deletewallid', 0)));
                confirm_box(false, $this->user->lang['CONFIRM_WALL_DEL_EXPLAIN'], $s_hidden_fields);
            }
        }
        /***********************
         * Let's set some links *
         ***********************/
        $post_wall_action = append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", "mode=viewprofile&amp;u=" . $user_id);
        // Needed for wall form
        $total_topics_url = append_sid("{$this->phpbb_root_path}search.{$this->phpEx}", 'author_id=' . $user_id . '&amp;sr=topics');
        // Link to search URL for user's topics
        /****************************
         * ASSIGN TEMPLATE VARIABLES *
         ****************************/
        $this->template->assign_vars(array('TOTAL_TOPICS' => $total_topics, 'PROFILE_VIEWS' => $member['user_profile_views'], 'NO_WALL_POSTS' => sprintf($this->user->lang['FIRST_POST_WALL'], '<strong>' . $username . '</strong>'), 'USER_NO_POSTS' => sprintf($this->user->lang['USER_NO_POSTS'], '<strong>' . $username . '</strong>'), 'COVERPHOTO' => $member['user_coverphoto'], 'CP_PANEL_ID' => $this->config['cp_panel_id'] ? $this->config['cp_panel_id'] : 1, 'FL_ENABLED' => $this->config['fl_enabled'] ? true : false, 'CP_ENABLED' => $this->config['cp_enabled'] ? true : false, 'AF_ENABLED' => $this->config['af_enabled'] ? true : false, 'U_SEARCH_USER_TOPICS' => $total_topics_url, 'S_POST_WALL' => $post_wall_action, 'S_CAN_POST_WALL' => $this->auth->acl_get('u_wall_post') ? true : false, 'S_CAN_READ_WALL' => $this->auth->acl_get('u_wall_read') ? true : false, 'S_CAN_DEL_WALL' => $this->auth->acl_get('u_wall_del') ? true : false, 'S_MOD_DEL_WALL' => $this->auth->acl_get('m_wall_del') ? true : false));
    }
 protected function get($containerId)
 {
     return self::$container->get($containerId);
 }
Exemple #18
0
 public function getSession()
 {
     return $this->request->getSession()->set('nickname', $this->container->get('security.context')->getToken()->getUser());
 }
 /**
  * {@inheritdoc}
  */
 public static function create(ContainerInterface $container)
 {
     return new static('', $container->get('features.manager'), $container->get('features_assigner'), $container->get('config.factory'));
 }
 /**
  * Return users matching the specified criteria
  *
  * @param array $criteria
  *
  * @return array
  */
 protected function findUsersBy(array $criteria)
 {
     return $this->container->get('oro_user.manager')->getRepository()->findBy($criteria);
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->container = (include './config/container.php');
     $this->object = new TableGatewayAbstractFactory();
     $this->adapter = $this->container->get('db');
 }
 /**
  * {@inheritdoc}
  */
 public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 {
     return new static($configuration, $plugin_id, $plugin_definition, $container->get('event_dispatcher'));
 }
Exemple #23
0
 /**
  * Assign common template variables
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function assign_common_template_variables($event)
 {
     $context = $this->container->get('template_context');
     $rootref =& $context->get_root_ref();
     $this->template->assign_vars(array('U_AJAX_BASE' => $this->helper->route('senky_ajaxbase_controller'), 'TOTAL_USERS_ONLINE' => '<span id="who_is_online_wrapper">' . $rootref['TOTAL_USERS_ONLINE'], 'LOGGED_IN_USER_LIST' => $rootref['LOGGED_IN_USER_LIST'] . '</span>'));
 }
 public function renderTip($tipMessage)
 {
     return $this->container->get('templating')->render('NewscoopNewscoopBundle::tooltip.html.twig', array('tipMessage' => $tipMessage));
 }
Exemple #25
0
 /**
  * Get current installed version number
  *
  * @param ContainerInterface $container
  * @return string
  * @throws \Exception
  */
 public static function defineCurrentInstalledCoreVersion($container)
 {
     $moduleTable = 'module_vars';
     try {
         $stmt = $container->get('doctrine.dbal.default_connection')->executeQuery("SELECT value FROM {$moduleTable} WHERE modname = 'ZConfig' AND name = 'Version_Num'");
         $result = $stmt->fetch(\PDO::FETCH_NUM);
         define('ZIKULACORE_CURRENT_INSTALLED_VERSION', unserialize($result[0]));
     } catch (\Doctrine\DBAL\Exception\TableNotFoundException $e) {
         throw new \Exception("ERROR: Could not find {$moduleTable} table. Maybe you forgot to copy it to your server, or you left a custom_parameters.yml file in place with installed: true in it.");
     } catch (\Exception $e) {
         // now what? @todo
     }
 }
    function main($id, $mode)
    {
        global $phpbb_container, $user, $template, $config, $request;
        $this->phpbb_container = $phpbb_container;
        $this->user = $user;
        $this->template = $template;
        $this->config = $config;
        $this->request = $request;
        $this->log = $this->phpbb_container->get('log');
        $action = $this->request->variable('action', '');
        $ads_id = $this->request->variable('ads_id', 0);
        $this->tpl_name = 'acp_quick_ads';
        $this->page_title = $this->user->lang('QUICK_ADS_TITLE');
        if ($mode == 'quick_ads_config') {
            add_form_key('o0johntam0o/acp_quick_ads');
        } else {
            if ($mode == 'quick_ads_config_details') {
                add_form_key('o0johntam0o/acp_quick_ads_details');
            }
        }
        if ($mode == 'quick_ads_config_details') {
            global $db, $table_prefix;
            $this->db = $db;
            $this->table_prefix = $table_prefix;
        }
        // **************** INPUT **************** //
        if ($this->request->is_set_post('submit')) {
            if ($mode == 'quick_ads_config') {
                if (!check_form_key('o0johntam0o/acp_quick_ads')) {
                    trigger_error('FORM_INVALID');
                }
                $this->config->set('quick_ads_allow_bot', $this->request->variable('quick_ads_allow_bot', 0));
                if ($this->request->variable('quick_ads_custom_id', '') == '') {
                    $this->config->set('quick_ads_custom_id', 'quick_ads_');
                } else {
                    $this->config->set('quick_ads_custom_id', $this->request->variable('quick_ads_custom_id', ''));
                }
                $this->config->set('quick_ads_zindex', $this->request->variable('quick_ads_zindex', 100));
                $this->config->set('quick_ads_closebt', $this->request->variable('quick_ads_closebt', 1));
                $this->config->set('quick_ads_cookie', $this->request->variable('quick_ads_cookie', 0));
                $this->config->set('quick_ads_cookie_time', $this->request->variable('quick_ads_cookie_time', 0) < 0 ? 0 : $this->request->variable('quick_ads_cookie_time', 0));
                $this->config->set('quick_ads_wmin_left', $this->request->variable('quick_ads_wmin_left', 0) < 0 ? 0 : $this->request->variable('quick_ads_wmin_left', 0));
                $this->config->set('quick_ads_hmin_left', $this->request->variable('quick_ads_hmin_left', 0) < 0 ? 0 : $this->request->variable('quick_ads_hmin_left', 0));
                $this->config->set('quick_ads_wmin_right', $this->request->variable('quick_ads_wmin_right', 0) < 0 ? 0 : $this->request->variable('quick_ads_wmin_right', 0));
                $this->config->set('quick_ads_hmin_right', $this->request->variable('quick_ads_hmin_right', 0) < 0 ? 0 : $this->request->variable('quick_ads_hmin_right', 0));
                $this->config->set('quick_ads_wmin_top', $this->request->variable('quick_ads_wmin_top', 0) < 0 ? 0 : $this->request->variable('quick_ads_wmin_top', 0));
                $this->config->set('quick_ads_hmin_top', $this->request->variable('quick_ads_hmin_top', 0) < 0 ? 0 : $this->request->variable('quick_ads_hmin_top', 0));
                $this->config->set('quick_ads_wmin_bottom', $this->request->variable('quick_ads_wmin_bottom', 0) < 0 ? 0 : $this->request->variable('quick_ads_wmin_bottom', 0));
                $this->config->set('quick_ads_hmin_bottom', $this->request->variable('quick_ads_hmin_bottom', 0) < 0 ? 0 : $this->request->variable('quick_ads_hmin_bottom', 0));
                $this->config->set('quick_ads_wmin_top_static', $this->request->variable('quick_ads_wmin_top_static', 0) < 0 ? 0 : $this->request->variable('quick_ads_wmin_top_static', 0));
                $this->config->set('quick_ads_hmin_top_static', $this->request->variable('quick_ads_hmin_top_static', 0) < 0 ? 0 : $this->request->variable('quick_ads_hmin_top_static', 0));
                $this->config->set('quick_ads_wmin_bottom_static', $this->request->variable('quick_ads_wmin_bottom_static', 0) < 0 ? 0 : $this->request->variable('quick_ads_wmin_bottom_static', 0));
                $this->config->set('quick_ads_hmin_bottom_static', $this->request->variable('quick_ads_hmin_bottom_static', 0) < 0 ? 0 : $this->request->variable('quick_ads_hmin_bottom_static', 0));
            } else {
                if ($mode == 'quick_ads_config_details') {
                    if (!check_form_key('o0johntam0o/acp_quick_ads_details')) {
                        trigger_error('FORM_INVALID');
                    }
                    $quick_ads_sql = 'SELECT ads_id FROM ' . $this->table_prefix . 'quick_ads';
                    $result = $this->db->sql_query($quick_ads_sql);
                    while ($row = $this->db->sql_fetchrow($result)) {
                        // Onpage string
                        $ads_onpage_arr = $this->request->variable('quick_ads_onpage_' . $row['ads_id'], array(0));
                        $ads_onpage_sql = '';
                        foreach ($ads_onpage_arr as $key => $value) {
                            $value = (int) $value;
                            switch ($value) {
                                case 0:
                                    $ads_onpage_sql .= 'NULL,';
                                    break;
                                case 1:
                                    $ads_onpage_sql .= 'faq,';
                                    break;
                                case 2:
                                    $ads_onpage_sql .= 'index,';
                                    break;
                                case 3:
                                    $ads_onpage_sql .= 'mcp,';
                                    break;
                                case 4:
                                    $ads_onpage_sql .= 'memberlist,';
                                    break;
                                case 5:
                                    $ads_onpage_sql .= 'posting,';
                                    break;
                                case 6:
                                    $ads_onpage_sql .= 'report,';
                                    break;
                                case 7:
                                    $ads_onpage_sql .= 'search,';
                                    break;
                                case 8:
                                    $ads_onpage_sql .= 'ucp,';
                                    break;
                                case 9:
                                    $ads_onpage_sql .= 'viewforum,';
                                    break;
                                case 10:
                                    $ads_onpage_sql .= 'viewonline,';
                                    break;
                                case 11:
                                    $ads_onpage_sql .= 'viewtopic,';
                                    break;
                                    // === Custom pages ===
                                    // case 12:
                                    //	$ads_onpage_sql .= 'custom_page,';
                                    // break;
                                    // === Custom pages ===
                                // === Custom pages ===
                                // case 12:
                                //	$ads_onpage_sql .= 'custom_page,';
                                // break;
                                // === Custom pages ===
                                default:
                                    $ads_onpage_sql .= 'NULL,';
                                    break;
                            }
                        }
                        $ads_onpage_arr = $ads_onpage_sql . 'NULL';
                        // Group string
                        $ads_group_arr = $this->request->variable('quick_ads_group_' . $row['ads_id'], array(0));
                        $ads_group_sql = '';
                        foreach ($ads_group_arr as $key => $value) {
                            $ads_group_sql .= (int) $value . ',';
                        }
                        $ads_group_arr = $ads_group_sql . 'NULL';
                        // Main query
                        $quick_ads_sql = array('ads_name' => utf8_normalize_nfc($this->request->variable('quick_ads_name_' . $row['ads_id'], $this->user->lang['QUICK_ADS_NEW_ADS_NAME'], true)), 'ads_pos' => $this->request->variable('quick_ads_pos_' . $row['ads_id'], 2), 'ads_onpage' => $ads_onpage_arr, 'ads_text' => utf8_normalize_nfc($this->request->variable('quick_ads_text_' . $row['ads_id'], '', true)), 'ads_width' => $this->request->variable('quick_ads_width_' . $row['ads_id'], 50) < 0 ? 0 : $this->request->variable('quick_ads_width_' . $row['ads_id'], 50), 'ads_height' => $this->request->variable('quick_ads_height_' . $row['ads_id'], 50) < 0 ? 0 : $this->request->variable('quick_ads_height_' . $row['ads_id'], 50), 'ads_border' => $this->request->variable('quick_ads_border_' . $row['ads_id'], 1) < 0 ? 0 : $this->request->variable('quick_ads_border_' . $row['ads_id'], 1), 'ads_bg_img' => utf8_normalize_nfc($this->request->variable('quick_ads_bg_img_' . $row['ads_id'], '')), 'ads_bg_color' => utf8_normalize_nfc($this->request->variable('quick_ads_bg_color_' . $row['ads_id'], 'transparent')), 'ads_href' => utf8_normalize_nfc($this->request->variable('quick_ads_href_' . $row['ads_id'], '')), 'ads_overf' => $this->request->variable('quick_ads_overf_' . $row['ads_id'], 0), 'ads_group' => $ads_group_arr, 'ads_priority' => $this->request->variable('quick_ads_priority_' . $row['ads_id'], 99));
                        $quick_ads_sql = 'UPDATE ' . $this->table_prefix . 'quick_ads' . '
							SET ' . $this->db->sql_build_array('UPDATE', $quick_ads_sql) . '
							WHERE ads_id = ' . (int) $row['ads_id'];
                        $this->db->sql_query($quick_ads_sql);
                    }
                    $this->db->sql_freeresult($result);
                }
            }
            $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'QUICK_ADS_LOG_MSG');
            trigger_error($this->user->lang('QUICK_ADS_SAVED') . adm_back_link($this->u_action));
        } else {
            if ($mode == 'quick_ads_config_details') {
                if ($this->request->is_set_post('add_field')) {
                    if (!check_form_key('o0johntam0o/acp_quick_ads_details')) {
                        trigger_error('FORM_INVALID');
                    }
                    $quick_ads_sql = array('ads_name' => utf8_normalize_nfc($this->request->variable('quick_ads_name_new', $this->user->lang['QUICK_ADS_NEW_ADS_NAME'], true)), 'ads_pos' => $this->request->variable('quick_ads_pos_new', 2), 'ads_text' => utf8_normalize_nfc($this->request->variable('quick_ads_text_new', '', true)), 'ads_width' => $this->request->variable('quick_ads_width_new', 50) < 0 ? 0 : $this->request->variable('quick_ads_width_new', 50), 'ads_height' => $this->request->variable('quick_ads_height_new', 50) < 0 ? 0 : $this->request->variable('quick_ads_height_new', 50), 'ads_bg_img' => utf8_normalize_nfc($this->request->variable('quick_ads_bg_img_new', '')));
                    $quick_ads_sql = 'INSERT INTO ' . $this->table_prefix . 'quick_ads ' . $this->db->sql_build_array('INSERT', $quick_ads_sql);
                    $this->db->sql_query($quick_ads_sql);
                    $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'QUICK_ADS_LOG_MSG');
                    trigger_error($this->user->lang('QUICK_ADS_SAVED') . adm_back_link($this->u_action));
                } else {
                    if ($action == 'delete') {
                        if (confirm_box(true)) {
                            $quick_ads_sql = 'DELETE FROM ' . $this->table_prefix . 'quick_ads WHERE ads_id=' . $ads_id;
                            $this->db->sql_query($quick_ads_sql);
                            $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'QUICK_ADS_LOG_MSG');
                            if ($request->is_ajax()) {
                                $json_response = new \phpbb\json_response();
                                $json_response->send(array('MESSAGE_TITLE' => $this->user->lang['INFORMATION'], 'MESSAGE_TEXT' => $this->user->lang['QUICK_ADS_DEL_ADS_DELETED'], 'REFRESH_DATA' => array('time' => 3)));
                            }
                        } else {
                            confirm_box(false, $this->user->lang['QUICK_ADS_DEL_ADS_CONFIRM'], build_hidden_fields(array('i' => $id, 'mode' => $mode, 'ads_id' => $ads_id)));
                        }
                    }
                }
            }
        }
        // **************** OUTPUT **************** //
        if ($mode == 'quick_ads_config') {
            $this->template->assign_vars(array('S_QUICK_ADS_ACP_INDEX' => true, 'S_QUICK_ADS_ALLOW_BOT' => isset($this->config['quick_ads_allow_bot']) ? $this->config['quick_ads_allow_bot'] : false, 'S_QUICK_ADS_CUSTOM_ID' => isset($this->config['quick_ads_custom_id']) ? $this->config['quick_ads_custom_id'] : '', 'S_QUICK_ADS_ZINDEX' => isset($this->config['quick_ads_zindex']) ? $this->config['quick_ads_zindex'] : 0, 'S_QUICK_ADS_CLOSEBT' => isset($this->config['quick_ads_closebt']) ? $this->config['quick_ads_closebt'] : 1, 'S_QUICK_ADS_COOKIE' => isset($this->config['quick_ads_cookie']) ? $this->config['quick_ads_cookie'] : 0, 'S_QUICK_ADS_COOKIE_TIME' => isset($this->config['quick_ads_cookie_time']) ? $this->config['quick_ads_cookie_time'] : 0, 'S_QUICK_ADS_WMIN_LEFT' => isset($this->config['quick_ads_wmin_left']) ? $this->config['quick_ads_wmin_left'] : 0, 'S_QUICK_ADS_HMIN_LEFT' => isset($this->config['quick_ads_hmin_left']) ? $this->config['quick_ads_hmin_left'] : 0, 'S_QUICK_ADS_WMIN_RIGHT' => isset($this->config['quick_ads_wmin_right']) ? $this->config['quick_ads_wmin_right'] : 0, 'S_QUICK_ADS_HMIN_RIGHT' => isset($this->config['quick_ads_hmin_right']) ? $this->config['quick_ads_hmin_right'] : 0, 'S_QUICK_ADS_WMIN_TOP' => isset($this->config['quick_ads_wmin_top']) ? $this->config['quick_ads_wmin_top'] : 0, 'S_QUICK_ADS_HMIN_TOP' => isset($this->config['quick_ads_hmin_top']) ? $this->config['quick_ads_hmin_top'] : 0, 'S_QUICK_ADS_WMIN_BOTTOM' => isset($this->config['quick_ads_wmin_bottom']) ? $this->config['quick_ads_wmin_bottom'] : 0, 'S_QUICK_ADS_HMIN_BOTTOM' => isset($this->config['quick_ads_hmin_bottom']) ? $this->config['quick_ads_hmin_bottom'] : 0, 'S_QUICK_ADS_WMIN_TOP_STATIC' => isset($this->config['quick_ads_wmin_top_static']) ? $this->config['quick_ads_wmin_top_static'] : 0, 'S_QUICK_ADS_HMIN_TOP_STATIC' => isset($this->config['quick_ads_hmin_top_static']) ? $this->config['quick_ads_hmin_top_static'] : 0, 'S_QUICK_ADS_WMIN_BOTTOM_STATIC' => isset($this->config['quick_ads_wmin_bottom_static']) ? $this->config['quick_ads_wmin_bottom_static'] : 0, 'S_QUICK_ADS_HMIN_BOTTOM_STATIC' => isset($this->config['quick_ads_hmin_bottom_static']) ? $this->config['quick_ads_hmin_bottom_static'] : 0));
        } else {
            if ($mode == 'quick_ads_config_details') {
                // Fetch group items
                $group_sql = array('SELECT' => 'g.group_id, g.group_name, g.group_type', 'FROM' => array(GROUPS_TABLE => 'g'), 'ORDER_BY' => 'g.group_id ASC');
                // Fetch Quick Ads items
                $quick_ads_sql = array('SELECT' => 'qa.*', 'FROM' => array($this->table_prefix . 'quick_ads' => 'qa'), 'ORDER_BY' => 'qa.ads_name ASC');
                $result = $this->db->sql_query($this->db->sql_build_query('SELECT', $quick_ads_sql));
                while ($row = $this->db->sql_fetchrow($result)) {
                    $ads_onpage_arr = explode(',', $row['ads_onpage']);
                    $ads_group_arr = explode(',', $row['ads_group']);
                    $this->template->assign_block_vars('quick_ads_row', array('QUICK_ADS_LEGEND' => sprintf($this->user->lang('QUICK_ADS_LEGEND'), $row['ads_name'], $row['ads_priority']), 'QUICK_ADS_ID' => $row['ads_id'], 'QUICK_ADS_NAME' => $row['ads_name'], 'U_QUICK_ADS_DELETE' => $this->u_action . '&amp;action=delete&amp;ads_id=' . $row['ads_id'], 'QUICK_ADS_POS' => $row['ads_pos'], 'QUICK_ADS_ONPAGE_FAQ' => in_array('faq', $ads_onpage_arr) ? 1 : 0, 'QUICK_ADS_ONPAGE_INDEX' => in_array('index', $ads_onpage_arr) ? 1 : 0, 'QUICK_ADS_ONPAGE_MCP' => in_array('mcp', $ads_onpage_arr) ? 1 : 0, 'QUICK_ADS_ONPAGE_MEMBERLIST' => in_array('memberlist', $ads_onpage_arr) ? 1 : 0, 'QUICK_ADS_ONPAGE_POSTING' => in_array('posting', $ads_onpage_arr) ? 1 : 0, 'QUICK_ADS_ONPAGE_REPORT' => in_array('report', $ads_onpage_arr) ? 1 : 0, 'QUICK_ADS_ONPAGE_SEARCH' => in_array('search', $ads_onpage_arr) ? 1 : 0, 'QUICK_ADS_ONPAGE_UCP' => in_array('ucp', $ads_onpage_arr) ? 1 : 0, 'QUICK_ADS_ONPAGE_VIEWFORUM' => in_array('viewforum', $ads_onpage_arr) ? 1 : 0, 'QUICK_ADS_ONPAGE_VIEWONLINE' => in_array('viewonline', $ads_onpage_arr) ? 1 : 0, 'QUICK_ADS_ONPAGE_VIEWTOPIC' => in_array('viewtopic', $ads_onpage_arr) ? 1 : 0, 'QUICK_ADS_TEXT' => $row['ads_text'], 'QUICK_ADS_WIDTH' => $row['ads_width'], 'QUICK_ADS_HEIGHT' => $row['ads_height'], 'QUICK_ADS_BORDER' => $row['ads_border'], 'QUICK_ADS_BG_IMG' => $row['ads_bg_img'], 'QUICK_ADS_BG_COLOR' => $row['ads_bg_color'], 'QUICK_ADS_HREF' => $row['ads_href'], 'QUICK_ADS_OVERF' => $row['ads_overf'], 'QUICK_ADS_PRIORITY' => $row['ads_priority']));
                    $result2 = $this->db->sql_query($this->db->sql_build_query('SELECT', $group_sql));
                    while ($row2 = $this->db->sql_fetchrow($result2)) {
                        if ($row2['group_name'] != 'BOTS') {
                            $this->template->assign_block_vars('quick_ads_row.group', array('GROUP_ID' => $row2['group_id'], 'GROUP_NAME' => $row2['group_type'] == GROUP_SPECIAL ? $this->user->lang('G_' . $row2['group_name']) : $row2['group_name'], 'GROUP_CHECKED' => in_array($row2['group_id'], $ads_group_arr) ? 1 : 0));
                        }
                    }
                    $this->db->sql_freeresult($result2);
                }
                $this->db->sql_freeresult($result);
                $this->template->assign_vars(array('S_QUICK_ADS_TEXT_EXPLAIN' => sprintf($this->user->lang('QUICK_ADS_TEXT_EXPLAIN'), $this->user->data['username'], $this->user->data['user_id'], sprintf($this->user->lang('CURRENT_TIME'), $this->user->format_date(time(), false, true)), generate_board_url(true), generate_board_url(), $this->config['sitename'], $this->config['site_desc'])));
            }
        }
        $this->template->assign_vars(array('U_ACTION' => $this->u_action, 'S_QUICK_ADS_VERSION' => isset($this->config['quick_ads_version']) ? $this->config['quick_ads_version'] : false));
    }
 protected function setUp()
 {
     $this->container = (include './config/container.php');
     $this->object = $this->container->get('timeline_datastore');
     $this->rqlParser = new RqlParser();
 }
Exemple #28
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->container = (include './config/container.php');
     $this->config = $this->container->get('config')['dataStore'];
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->container = (include './config/container.php');
     $this->object = new DataStore\Factory\DbTableAbstractFactory();
     $this->adapter = $this->container->get('db');
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->container = (include './config/container.php');
     $this->object = new RestRqlFactory();
     $this->adapter = $this->container->get('db');
 }