Ejemplo n.º 1
0
 public function view()
 {
     $db = Loader::db();
     $r = $db->query("SELECT * FROM btProBlogSettings");
     while ($row = $r->fetchrow()) {
         $this->set('tweet', $row['tweet']);
         $this->set('google', $row['google']);
         $this->set('fb_like', $row['fb_like']);
         $this->set('addthis', $row['addthis']);
         $this->set('sharethis', $row['sharethis']);
         $this->set('embedly', $row['embedly']);
         $this->set('alchemy', $row['alchemy']);
         $this->set('author', $row['author']);
         $this->set('comments', $row['comments']);
         $this->set('trackback', $row['trackback']);
         $this->set('canonical', $row['canonical']);
         $this->set('search_path', $row['search_path']);
         $this->set('mobile_path', $row['mobile_path']);
         $this->set('disqus', $row['disqus']);
         $this->set('icon_color', $row['icon_color']);
         $this->set('thumb_width', $row['thumb_width']);
         $this->set('thumb_height', $row['thumb_height']);
         $this->set('ctID', $row['ctID']);
         $this->set('breakSyntax', $row['breakSyntax']);
         $this->set('pageTemplate', $row['pageTemplate']);
     }
     $this->set('pageTemplates', $this->getPageTemplates());
     //        $request = \Request::getInstance();
     //        $session = $request->getSession();
     //        if(!$session) {
     //            $session = new SymfonySession();
     //        }
     $this->set('session', \Core::make('session'));
 }
 public function view()
 {
     session_write_close();
     $keywords = $_REQUEST['q'];
     $pl = new \PageList();
     $pl->filterByName($keywords);
     $pl->sortBy('cID', 'asc');
     $pl->setItemsPerPage(5);
     $pl->setPermissionsChecker(function ($page) {
         $pp = new \Permissions($page);
         return $pp->canViewPageInSitemap();
     });
     $pagination = $pl->getPagination();
     $pages = $pagination->getCurrentPageResults();
     $results = array();
     $nh = \Core::make('helper/navigation');
     foreach ($pages as $c) {
         $obj = new \stdClass();
         $obj->href = $nh->getLinkToCollection($c);
         $obj->cID = $c->getCollectionID();
         $obj->name = $c->getCollectionName();
         $results[] = $obj;
     }
     echo json_encode($results);
     \Core::shutdown(array('jobs' => true));
 }
Ejemplo n.º 3
0
 /**
  * @return Community
  */
 public function getService()
 {
     if (!$this->service) {
         $this->service = \Core::make('authentication/community');
     }
     return $this->service;
 }
Ejemplo n.º 4
0
 public function up(Schema $schema)
 {
     \Concrete\Core\Database\Schema\Schema::refreshCoreXMLSchema(array('Stacks'));
     if (\Core::make('multilingual/detector')->isEnabled()) {
         StackList::rescanMultilingualStacks();
     }
 }
Ejemplo n.º 5
0
 public function action()
 {
     $token = isset($this->validationToken) ? $this->validationToken : get_class($this);
     $url = call_user_func_array('parent::action', func_get_args());
     $url .= '?ccm_token=' . \Core::make('helper/validation/token')->generate($token);
     return $url;
 }
Ejemplo n.º 6
0
 public static function process($source, $process = array())
 {
     $args = func_get_args();
     if (count($args) > 2) {
         $process = array_slice($args, 1);
     }
     if (empty($process)) {
         return $source;
     }
     $process = (array) $process;
     foreach ($process as $name => $config) {
         if (is_int($name) && is_string($config)) {
             $name = $config;
             $config = array();
         } else {
             if (is_int($name) && is_array($config)) {
                 $source = self::process($source, $config);
             }
         }
         if (!isset(self::$process[$name])) {
             continue;
         }
         if (!is_string(self::$process[$name])) {
             $source = Core::invoke(self::$process[$name], array($source));
         } else {
             $p = Core::make(self::$process[$name]);
             if (!Core_Types::is_subclass_of('Text.Process.ProcessInterface', $p)) {
                 continue;
             }
             $p->configure($config);
             $source = $p->process($source);
         }
     }
     return $source;
 }
 public function getObjectCollection(\SimpleXMLElement $element)
 {
     $manager = \Core::make('migration/manager/import/attribute/key');
     $categoryManager = \Core::make('migration/manager/import/attribute/category');
     $collection = new AttributeKeyObjectCollection();
     if ($element->attributekeys->attributekey) {
         foreach ($element->attributekeys->attributekey as $node) {
             $importer = $manager->driver((string) $node['type']);
             $key = $importer->getEntity();
             $key->setHandle((string) $node['handle']);
             $key->setName((string) $node['name']);
             $key->setPackage((string) $node['package']);
             $categoryImporter = $categoryManager->driver((string) $node['category']);
             $category = $categoryImporter->getEntity();
             $categoryImporter->loadFromXml($category, $node);
             $key->setCategory($category);
             if ((string) $node['indexed'] == 1) {
                 $key->setIsIndexed(true);
             }
             if ((string) $node['internal'] == 1) {
                 $key->setIsInternal(true);
             }
             if ((string) $node['searchable'] == 1) {
                 $key->setIsSearchable(true);
             }
             $importer->loadFromXml($key, $node);
             $collection->getKeys()->add($key);
             $key->setCollection($collection);
         }
     }
     return $collection;
 }
 public function getObjectCollection(\SimpleXMLElement $element)
 {
     $manager = \Core::make('migration/manager/import/permission/access_entity');
     $collection = new KeyObjectCollection();
     if ($element->permissionkeys->permissionkey) {
         foreach ($element->permissionkeys->permissionkey as $node) {
             $key = new Key();
             $key->setHandle((string) $node['handle']);
             $key->setName((string) $node['name']);
             $key->setPackage((string) $node['package']);
             $key->setCategory((string) $node['category']);
             if ((string) $node['can-trigger-workflow']) {
                 $key->setCanTriggerWorkflow(true);
             }
             if ((string) $node['has-custom-class']) {
                 $key->setHasCustomClass(true);
             }
             if (isset($node->access)) {
                 foreach ($node->access->children() as $ch) {
                     if ($ch->getName() == 'entity') {
                         $importer = $manager->driver((string) $ch['type']);
                         $entity = $importer->getEntity();
                         $entity->setEntityType((string) $ch['type']);
                         $importer->loadFromXml($entity, $ch);
                         $entity->setKey($key);
                         $key->getAccessEntities()->add($entity);
                     }
                 }
             }
             $collection->getKeys()->add($key);
             $key->setCollection($collection);
         }
     }
     return $collection;
 }
Ejemplo n.º 9
0
 public function storage()
 {
     if (!self::$storage_object) {
         self::$storage_object = Core::make(self::$storage);
     }
     return self::$storage_object;
 }
Ejemplo n.º 10
0
 public function quickSelect($key, $cID = false, $args = array())
 {
     $v = \View::getInstance();
     $v->requireAsset('selectize');
     $selectedCID = 0;
     if (isset($_REQUEST[$key])) {
         $selectedCID = $_REQUEST[$key];
     } else {
         if ($cID > 0) {
             $selectedCID = $cID;
         }
     }
     $cName = '';
     if ($selectedCID > 0) {
         $oc = Page::getByID($selectedCID);
         $cp = new Permissions($oc);
         if ($cp->canViewPage()) {
             $cName = $oc->getCollectionName();
         }
     }
     $valt = Core::make('helper/validation/token');
     $token = $valt->generate('quick_page_select_' . $key);
     $html = "\n\t\t<script type=\"text/javascript\">\n\t\t\$(function () {\n\t\t\t\$('#ccm-quick-page-selector-" . $key . " input').unbind().selectize({\n                valueField: 'value',\n                labelField: 'label',\n                searchField: ['label'],";
     if ($selectedCID) {
         $html .= "options: [{'label': '" . h($cName) . "', 'value': " . intval($selectedCID) . "}],\n\t\t\t\titems: [" . intval($selectedCID) . "],";
     }
     $html .= "maxItems: 1,\n                load: function(query, callback) {\n                    if (!query.length) return callback();\n                    \$.ajax({\n                        url: '" . REL_DIR_FILES_TOOLS_REQUIRED . "/pages/autocomplete?key=" . $key . "&token=" . $token . "&term=' + encodeURIComponent(query),\n                        type: 'GET',\n\t\t\t\t\t\tdataType: 'json',\n                        error: function() {\n                            callback();\n                        },\n                        success: function(res) {\n                            callback(res);\n                        }\n                    });\n                }\n\t\t    });\n\t\t} );\n\t\t</script>";
     $form = \Core::make("helper/form");
     $html .= '<span id="ccm-quick-page-selector-' . $key . '">' . $form->hidden($key, '', $args) . '</span>';
     return $html;
 }
Ejemplo n.º 11
0
 public function update_profiles()
 {
     /** @var Token $token */
     $token = \Core::make('token');
     if (!$token->validate("update_profile")) {
         $this->error->add('Invalid Token.');
         return;
     }
     if ($this->isPost()) {
         $config = $this->getSite()->getConfigRepository();
         $config->save('user.profiles_enabled', $this->post('public_profiles') ? true : false);
         $config->save('user.gravatar.enabled', $this->post('gravatar_fallback') ? true : false);
         $config->save('user.gravatar.max_level', Loader::helper('security')->sanitizeString($this->post('gravatar_max_level')));
         $config->save('user.gravatar.image_set', Loader::helper('security')->sanitizeString($this->post('gravatar_image_set')));
         // $message = ($this->post('public_profiles')?t('Public profiles have been enabled'):t('Public profiles have been disabled.'));
         if ($this->post('public_profiles')) {
             Single::add('/members');
             $c = Single::add('/members/profile');
             Single::add('/members/directory');
             $c->update(['cName' => 'View Profile']);
             $this->redirect('/dashboard/system/registration/profiles/profiles_enabled');
         } else {
             foreach ($this->app->make('site')->getList() as $site) {
                 foreach (['/members/directory', '/members/profile', '/members'] as $path) {
                     $c = \Page::getByPath($path, 'RECENT', $site);
                     $c->delete();
                 }
             }
             $this->redirect('/dashboard/system/registration/profiles/profiles_disabled');
         }
     }
 }
Ejemplo n.º 12
0
    /**
     * @return RuleInterface
     */
    protected function getPrettyUrlRule()
    {
        $rule = new Rule(function (Rule $rule) {
            $DIR_REL = $rule->getOption('dir_rel')->getValue();
            if ($DIR_REL === null) {
                if (\Core::make('app')->isRunThroughCommandLineInterface()) {
                    throw new Exception(t('When executed from the command line, you need to specify the %s option', 'dir_rel'));
                } else {
                    $DIR_REL = DIR_REL;
                }
            }
            $DIR_REL = trim((string) $DIR_REL, '/');
            if ($DIR_REL !== '') {
                $DIR_REL = '/' . $DIR_REL;
            }
            $DISPATCHER_FILENAME = DISPATCHER_FILENAME;
            return <<<EOT
<IfModule mod_rewrite.c>
\tRewriteEngine On
\tRewriteBase {$DIR_REL}/
\tRewriteCond %{REQUEST_FILENAME} !-f
\tRewriteCond %{REQUEST_FILENAME}/index.html !-f
\tRewriteCond %{REQUEST_FILENAME}/index.php !-f
\tRewriteRule . {$DISPATCHER_FILENAME} [L]
</IfModule>
EOT;
        }, function () {
            return (bool) \Config::get('concrete.seo.url_rewriting');
        }, "# -- concrete5 urls start --", "# -- concrete5 urls end --");
        $option = new RuleOption(t('concrete5 path relative to website root'), function () {
            return \Core::make('app')->isRunThroughCommandLineInterface();
        });
        $rule->addOption('dir_rel', $option);
        return $rule;
    }
 protected function fixTrackingCode()
 {
     $this->output(t('Updating tracking code.'));
     $service = \Core::make('site');
     $site = $service->getDefault();
     $config = $site->getConfigRepository();
     $proceed = true;
     $tracking = $config->get('seo.tracking');
     if (is_array($tracking) && isset($tracking['header']) && $tracking['header']) {
         $proceed = false;
     }
     if (is_array($tracking) && isset($tracking['footer']) && $tracking['footer']) {
         $proceed = false;
     }
     if ($proceed) {
         // we saved it in the wrong place on the 8.0 upgrade.
         $tracking = (array) \Config::get('concrete.seo.tracking', []);
         $trackingCode = array_get($tracking, 'code');
         if (!is_array($trackingCode)) {
             array_set($tracking, 'code', ['header' => '', 'footer' => '']);
             $trackingCode = (string) $trackingCode;
             switch (array_get($tracking, 'code_position')) {
                 case 'top':
                     array_set($tracking, 'code.header', $trackingCode);
                     break;
                 case 'bottom':
                 default:
                     array_set($tracking, 'code.footer', $trackingCode);
                     break;
             }
         }
         unset($tracking['code_position']);
         $config->save('seo.tracking', $tracking);
     }
 }
Ejemplo n.º 14
0
 public function transform($entity, ItemInterface $item, TargetItem $targetItem, Batch $batch)
 {
     $mapper = new \PortlandLabs\Concrete5\MigrationTool\Batch\ContentMapper\Type\Attribute();
     $ak = $mapper->getTargetItemContentObject($targetItem);
     if (is_object($ak)) {
         $type = $ak->getAttributeKeyType()->getAttributeTypeHandle();
     } else {
         $collection = $batch->getObjectCollection('attribute_key');
         foreach ($collection->getKeys() as $key) {
             if ($key->getHandle() == $item->getIdentifier()) {
                 $type = $key->getType();
                 break;
             }
         }
     }
     if (isset($type)) {
         $manager = \Core::make('migration/manager/import/attribute/value');
         try {
             $driver = $manager->driver($type);
         } catch (\Exception $e) {
         }
         if (isset($driver)) {
             $xml = simplexml_load_string($entity->getValue());
             $value = $driver->parse($xml);
             $attribute = $entity->getAttribute();
             $attribute->setAttributeValue($value);
             $manager = \ORM::entityManager('migration_tools');
             $manager->persist($attribute);
             $manager->remove($entity);
             $manager->flush();
         }
     }
 }
Ejemplo n.º 15
0
 /**
  * @return Facebook
  */
 public function getService()
 {
     if (!$this->service) {
         $this->service = \Core::make('authentication/facebook');
     }
     return $this->service;
 }
Ejemplo n.º 16
0
 /**
  * Registers the services provided by this provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton('url/canonical/resolver', function () {
         return new CanonicalUrlResolver();
     });
     $this->app->singleton('url/canonical', function () {
         return \Core::make('url/canonical/resolver')->resolve(array());
     });
     $this->app->bindShared('url/resolver/path', function () {
         return new PathUrlResolver();
     });
     $this->app->bindShared('url/resolver/page', function () {
         return new PageUrlResolver(\Core::make('url/resolver/path'));
     });
     $this->app->bindShared('url/resolver/route', function () {
         $generator = \Route::getGenerator();
         $list = \Route::getList();
         return new RouteUrlResolver(\Core::make('url/resolver/path'), $generator, $list);
     });
     $this->app->bind('url/manager', function () {
         $manager = new ResolverManager('concrete.path', \Core::make('url/resolver/path'));
         $manager->addResolver('concrete.page', \Core::make('url/resolver/page'));
         $manager->addResolver('concrete.route', \Core::make('url/resolver/route'));
         return $manager;
     });
 }
 public function scanSourceTree($sourceDir)
 {
     $fh = \Core::make('helper/file');
     echo "Scanning {$sourceDir} \n";
     $list = $fh->getDirectoryContents($sourceDir, array(), true);
     foreach ($list as $file) {
         if (!preg_match('/\\.php$/', $file)) {
             continue;
         }
         $content = $fh->getContents($file);
         if (!preg_match(',^\\s*const\\s*.*\\s*//!<\\s*@javascript-exported,m', $content)) {
             continue;
         }
         $ns = '';
         $class = '';
         $var = '';
         $content = str_replace("\n\r", "\n", $content);
         $ln = 0;
         foreach (explode("\n", $content) as $line) {
             ++$ln;
             if (preg_match('/\\s*namespace .*\\;/', $line)) {
                 $ns = preg_replace(',\\s*namespace\\s+([^ -;]+);.*$,', '\\1', $line);
             }
             if (preg_match('/^\\s*class.*/', $line)) {
                 $class = preg_replace(',\\s*class\\s+([^ -;\\{]+).*$,', '\\1', $line);
             }
             if (preg_match(',^\\s*const\\s*.*\\s*//!<\\s*@javascript-exported,', $line)) {
                 $var = preg_replace(',\\s*const\\s+([^ ]+)\\s*=.*$,', '\\1', $line);
                 $const = "{$ns}\\{$class}::{$var}";
                 $this->addConstant($const);
             }
         }
     }
 }
Ejemplo n.º 18
0
 public function remove_tree_node()
 {
     $node = $this->getNode();
     $tree = $node->getTreeObject();
     $treeNodeID = $node->getTreeNodeID();
     $error = \Core::make('error');
     if (!\Core::make('token')->validate("remove_tree_node")) {
         $error->add(\Core::make('token')->getErrorMessage());
     }
     if (!is_object($node)) {
         $error->add(t('Invalid node.'));
     }
     if ($node->getTreeNodeParentID() == 0) {
         $error->add(t('You may not remove the top level node.'));
     }
     if (!$error->has()) {
         $response = new EditResponse();
         $response->setMessage(t('%s deleted successfully.', $node->getTreeNodeDisplayName()));
         $response->setAdditionalDataAttribute('treeNodeID', $treeNodeID);
         $node->delete();
         return new JsonResponse($response);
     } else {
         return new JsonResponse($error);
     }
 }
Ejemplo n.º 19
0
 public function testThemeGridAreaLayoutContainer()
 {
     $layout = \Concrete\Core\Area\Layout\ThemeGridLayout::add();
     $layout->addLayoutColumn()->setAreaLayoutColumnSpan(4);
     $column = $layout->addLayoutColumn();
     $column->setAreaLayoutColumnSpan(2);
     $column->setAreaLayoutColumnOffset(2);
     $layout->addLayoutColumn()->setAreaLayoutColumnSpan(6);
     $elemental = \Concrete\Core\Page\Theme\Theme::add('elemental');
     Page::addHomePage();
     Core::make('cache/request')->disable();
     $c = Page::getByID(1);
     $c->setTheme($elemental);
     $c = Page::getByID(1);
     $req = Request::getInstance();
     $req->setCurrentPage($c);
     $layout = \Concrete\Core\Area\Layout\Layout::getByID(1);
     $this->assertInstanceOf('\\Concrete\\Core\\Area\\Layout\\ThemeGridLayout', $layout);
     $columns = $layout->getAreaLayoutColumns();
     $this->assertEquals(3, count($columns));
     $formatter = $layout->getFormatter();
     $this->assertInstanceOf('\\Concrete\\Core\\Area\\Layout\\Formatter\\ThemeGridFormatter', $formatter);
     $this->assertEquals('<div class="row"></div>', (string) $formatter->getLayoutContainerHtmlObject());
     $req->clearCurrentPage();
 }
 public function subscribe()
 {
     if ($this->isPost()) {
         $json = $this->post('json', false);
         $data = array();
         $data['ip'] = \Core::make('helper/validation/ip')->getRequestIP()->getIp();
         $data['email'] = $this->post('email');
         $error = NewsletterEmail::validate($data);
         if (!$error->has()) {
             NewsletterEmail::add($data);
             $state = 'success';
         } else {
             $state = 'failure';
             $list = $error->getList();
             if ($json) {
                 header('Content-Type: application/json');
                 echo json_encode(array('errors' => $list));
                 exit;
             } else {
                 $this->set('state', $state);
                 $this->set('errors', $list);
             }
         }
     }
 }
Ejemplo n.º 21
0
 public function preview()
 {
     $request = \Request::getInstance();
     $c = \Page::getByID($this->request->get('cID'));
     $cp = new \Permissions($c);
     if ($cp->canViewPageVersions()) {
         $c->loadVersionObject(\Core::make('helper/security')->sanitizeInt($_REQUEST['cvID']));
         $spoofed_request = \Request::createFromGlobals();
         if ($device_handle = $request->headers->get('x-device-handle')) {
             if ($device = \Core::make('device/manager')->get($device_handle)) {
                 if ($agent = $device->getUserAgent()) {
                     $spoofed_request->headers->set('User-Agent', $agent);
                 }
             }
         }
         $spoofed_request->setCustomRequestUser(-1);
         $spoofed_request->setCurrentPage($c);
         \Request::setInstance($spoofed_request);
         $controller = $c->getPageController();
         $controller->runTask('view', array());
         $view = $controller->getViewObject();
         $response = new \Response();
         $content = $view->render();
         // Reset just in case.
         \Request::setInstance($request);
         $response->setContent($content);
         $response->send();
         exit;
     }
 }
Ejemplo n.º 22
0
 /**
  * Returns a flag for a passed country/region.
  */
 public static function getFlagIcon($region, $filePathOnly = false)
 {
     $val = \Core::make('helper/validation/strings');
     if ($val->alphanum($region, false, true)) {
         $region = h(strtolower($region));
     } else {
         $region = false;
     }
     if ($region) {
         $v = \View::getInstance();
         if ($v->getThemeDirectory() != '' && file_exists($v->getThemeDirectory() . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png')) {
             $icon = $v->getThemePath() . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
         } elseif (file_exists(DIR_APPLICATION . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png')) {
             $icon = REL_DIR_APPLICATION . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
         } else {
             $icon = ASSETS_URL . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
         }
         if (isset($icon)) {
             if ($filePathOnly) {
                 return $icon;
             } else {
                 $img = new Image($icon, $region, ['id' => 'ccm-region-flag-' . $region, 'class' => 'ccm-region-flag']);
                 return $img;
             }
         }
     }
 }
 public function execute(Batch $batch)
 {
     $inspector = \Core::make('import/value_inspector');
     $feeds = $batch->getObjectCollection('page_feed');
     if (!$feeds) {
         return;
     }
     foreach ($feeds->getFeeds() as $feed) {
         if (!$feed->getPublisherValidator()->skipItem()) {
             $f = new Feed();
             $parentID = intval($inspector->inspect($feed->getParent())->getReplacedValue());
             $pageType = intval($inspector->inspect($feed->getPageType())->getReplacedValue());
             $f->setTitle($feed->getTitle());
             $f->setHandle($feed->getHandle());
             $f->setDescription($feed->getDescription());
             $f->setParentID($parentID);
             $f->setPageTypeID($pageType);
             $f->setIncludeAllDescendents($feed->getIncludeAllDescendants());
             $f->setDisplayFeaturedOnly($feed->getDisplayFeaturedOnly());
             $f->setDisplayAliases($feed->getDisplayAliases());
             if ($feed->getContentType() == 'description') {
                 $f->displayShortDescriptionContent();
             } else {
                 $f->displayAreaContent($feed->getContentTypeArea());
             }
             $f->save();
         }
     }
 }
Ejemplo n.º 24
0
 public function getResults(Request $request)
 {
     $pl = new PageList();
     $query = $request->query->all();
     $keywords = $query['keywords'];
     $ptID = $query['ptID'];
     $startingPoint = intval($query['startingPoint']);
     $datetime = \Core::make('helper/form/date_time')->translate('datetime', $query);
     $pl->ignorePermissions();
     if ($startingPoint) {
         $parent = \Page::getByID($startingPoint, 'ACTIVE');
         $pl->filterByPath($parent->getCollectionPath());
     }
     if ($datetime) {
         $pl->filterByPublicDate($datetime, '>=');
     }
     if ($ptID) {
         $pl->filterByPageTypeID($ptID);
     }
     if ($keywords) {
         $pl->filterByKeywords($keywords);
     }
     $pl->setItemsPerPage(1000);
     $results = $pl->getResults();
     $items = array();
     foreach ($results as $c) {
         $item = new \PortlandLabs\Concrete5\MigrationTool\Entity\Export\Page();
         $item->setItemId($c->getCollectionID());
         $items[] = $item;
     }
     return $items;
 }
Ejemplo n.º 25
0
 /**
  * Returns a flag for a passed country/region
  */
 public function getFlagIcon($region, $filePathOnly = false)
 {
     $val = \Core::make('helper/validation/strings');
     if ($val->alphanum($region, false, true)) {
         $region = h(strtolower($region));
     } else {
         $region = false;
     }
     if ($region) {
         $v = \View::getInstance();
         if ($v->getThemeDirectory() != '' && file_exists($v->getThemeDirectory() . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png')) {
             $icon = $v->getThemePath() . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
         } elseif (file_exists(DIR_APPLICATION . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png')) {
             $icon = REL_DIR_APPLICATION . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
         } else {
             $icon = ASSETS_URL . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
         }
         if (isset($icon)) {
             if ($filePathOnly) {
                 return $icon;
             } else {
                 return '<img class="ccm-region-flag img-responsive" id="ccm-region-flag-' . $region . '" src="' . $icon . '" alt="' . $region . '" />';
             }
         }
     }
 }
Ejemplo n.º 26
0
 public function view()
 {
     $btl = new BlockTypeList();
     $blockTypes = $btl->get();
     $dsh = Loader::helper('concrete/dashboard');
     $dashboardBlockTypes = array();
     if ($dsh->inDashboard()) {
         $dashboardBlockTypes = BlockTypeList::getDashboardBlockTypes();
     }
     $blockTypes = array_merge($blockTypes, $dashboardBlockTypes);
     if ($this->page->isMasterCollection()) {
         $bt = BlockType::getByHandle(BLOCK_HANDLE_PAGE_TYPE_OUTPUT_PROXY);
         $blockTypes[] = $bt;
     }
     if ($_REQUEST['tab']) {
         Session::set('panels_page_add_block_tab', $_REQUEST['tab']);
         $tab = $_REQUEST['tab'];
     } else {
         $tab = Session::get('panels_page_add_block_tab');
     }
     $sp = Pile::getDefault();
     $contents = $sp->getPileContentObjects('date_desc');
     $stacks = new StackList();
     if (\Core::make('multilingual/detector')->isEnabled()) {
         $stacks->filterByPageLanguage($this->page);
     }
     $stacks->filterByUserAdded();
     $this->set('stacks', $stacks->get());
     $this->set('contents', $contents);
     $this->set('tab', $tab);
     $this->set('blockTypes', $blockTypes);
     $this->set('ih', Loader::helper('concrete/ui'));
     $this->set('ci', Loader::helper('concrete/urls'));
 }
Ejemplo n.º 27
0
 public function getPermissionKeyByID($pkID)
 {
     $txt = Loader::helper('text');
     $className = core_class('\\Core\\Permission\\Key\\' . \Core::make("helper/text")->camelcase($this->pkCategoryHandle) . 'Key', $this->getPackageHandle());
     $ak = call_user_func(array($className, 'getByID'), $pkID);
     return $ak;
 }
Ejemplo n.º 28
0
 public function view_detail($mpID = null)
 {
     parent::view_detail($mpID);
     $html = \Core::make('helper/html');
     $this->addFooterItem($html->javascript(ASSETS_URL . '/' . DIRNAME_BLOCKS . '/image_slider/view.js'));
     $this->addHeaderItem($html->css(ASSETS_URL . '/' . DIRNAME_BLOCKS . '/image_slider/view.css'));
 }
Ejemplo n.º 29
0
 public function rescan_locale()
 {
     if ($this->token->validate('rescan_locale')) {
         $u = new \User();
         if ($u->isSuperUser()) {
             \Core::make('cache/request')->disable();
             $section = Section::getByID($_REQUEST['locale']);
             $target = new MultilingualProcessorTarget($section);
             $processor = new Processor($target);
             if ($_POST['process']) {
                 foreach ($processor->receive() as $task) {
                     $processor->execute($task);
                 }
                 $obj = new \stdClass();
                 $obj->totalItems = $processor->getTotalTasks();
                 echo json_encode($obj);
                 exit;
             } else {
                 $processor->process();
             }
             $totalItems = $processor->getTotalTasks();
             \View::element('progress_bar', array('totalItems' => $totalItems, 'totalItemsSummary' => t2("%d task", "%d tasks", $totalItems)));
             exit;
         }
     }
 }
 public function getService()
 {
     if (!$this->service) {
         $this->service = \Core::make('authentication/worldskills');
     }
     return $this->service;
 }