<commit_before><?php
namespace Concrete\Controller\SinglePage\Dashboard\System\Basics;

use Concrete\Core\Page\Controller\DashboardPageController;
use Concrete\Core\Page\Controller\DashboardSitePageController;
use Concrete\Core\Sharing\SocialNetwork\Link;
use Concrete\Core\Sharing\SocialNetwork\ServiceList;
use Concrete\Core\Sharing\SocialNetwork\Service;
use Core;

class Social extends DashboardSitePageController
{
    public function view()
    {
        $this->set('links', Link::getList());
    }

    public function link_updated()
    {
        $this->set('success', t("Link Updated."));
        $this->view();
    }

    public function link_deleted()
    {
        $this->set('success', t("Link Deleted."));
        $this->view();
    }

    public function link_added()
    {
        $this->set('success', t("Social Link Added."));
        $this->view();
    }

    protected function validatePageRequest($token)
    {
        if (!$this->token->validate($token)) {
            $this->error->add($this->token->getErrorMessage());
        }

        $ssHandle = $this->request->request->get('ssHandle');
        $existingLink = false;
        if ($ssHandle) {
            $service = Service::getByHandle($ssHandle);
            $existingLink = Link::getByServiceHandle($ssHandle);
        }
        $sec = Core::make('helper/security');
        $url = $sec->sanitizeURL($this->request->request->get('url'));
        if (!$url) {
            $this->error->add(t('You must specify a valid URL.'));<commit_msg>Making social links work in the dashboard<commit_after><?php
namespace Concrete\Controller\SinglePage\Dashboard\System\Basics;

use Concrete\Core\Page\Controller\DashboardPageController;
use Concrete\Core\Page\Controller\DashboardSitePageController;
use Concrete\Core\Sharing\SocialNetwork\Link;
use Concrete\Core\Sharing\SocialNetwork\ServiceList;
use Concrete\Core\Sharing\SocialNetwork\Service;
use Core;

class Social extends DashboardSitePageController
{
    public function view()
    {
        $this->set('links', Link::getList($this->getSite()));
    }

    public function link_updated()
    {
        $this->set('success', t("Link Updated."));
        $this->view();
    }

    public function link_deleted()
    {
        $this->set('success', t("Link Deleted."));
        $this->view();
    }

    public function link_added()
    {
        $this->set('success', t("Social Link Added."));
        $this->view();
    }

    protected function validatePageRequest($token)
    {
        if (!$this->token->validate($token)) {
            $this->error->add($this->token->getErrorMessage());
        }

        $ssHandle = $this->request->request->get('ssHandle');
        $existingLink = false;
        if ($ssHandle) {
            $service = Service::getByHandle($ssHandle);
            $existingLink = Link::getByServiceHandle($ssHandle, $this->getSite());
        }
        $sec = Core::make('helper/security');
        $url = $sec->sanitizeURL($this->request->request->get('url'));
        if (!$url) {
            $this->error->add(t('You must specify a valid URL.'));
{'fraction_non_alphanumeric': 0.16096774193548388, 'fraction_numerical': 0.0, 'mean_word_length': 2.9756410256410257, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5396382', 'n_tokens_mistral': 906, 'n_tokens_neox': 899, 'n_words': 154}