function uloginUninstall($self)
{
    tusers::i()->unbind('tregserviceuser');
    turlmap::unsub($self);
    $man = tdbmanager::i();
    $man->deletetable($self->table);
    if ($man->column_exists('users', 'phone')) {
        $man->alter('users', "drop phone");
    }
    $alogin = tadminlogin::i();
    $alogin->widget = $self->deletepanel($alogin->widget);
    $alogin->save();
    $areg = tadminreguser::i();
    $areg->widget = $self->deletepanel($areg->widget);
    $areg->save();
    $tc = ttemplatecomments::i();
    $tc->regaccount = $self->deletepanel($tc->regaccount);
    $tc->save();
    $js = tjsmerger::i();
    $js->lock();
    $js->deletefile('default', '/plugins/ulogin/resource/ulogin.popup.min.js');
    $js->deletefile('default', '/plugins/ulogin/resource/' . litepublisher::$options->language . '.ulogin.popup.min.js');
    $js->unlock();
    tcssmerger::i()->deletefile('default', '/plugins/ulogin/resource/ulogin.popup.css');
    tjsonserver::i()->unbind($self);
    litepublisher::$classes->delete('emailauth');
}
function TRSSPrevNextUninstall($self)
{
    $rss = trss::i();
    $rss->unbind($self);
    $urlmap = turlmap::i();
    $urlmap->clearcache();
}
 public function getcontent()
 {
     $id = tadminhtml::idparam();
     $menus = tmenus::i();
     if ($id != 0 && !$menus->itemexists($id)) {
         return self::error403();
     }
     $menu = tmenu::i($id);
     if (litepublisher::$options->group == 'author' && litepublisher::$options->user != $menu->author) {
         return self::error403();
     }
     if ($id > 0 && !$menus->itemexists($id)) {
         return self::error403();
     }
     $views = tviews::i();
     $theme = tview::i($views->defaults['admin'])->theme;
     $html = tadminhtml::i();
     $html->section = 'menu';
     switch ($_GET['get']) {
         case 'view':
             $result = tadminviews::getcomboview($id == 0 ? $views->defaults['menu'] : $menu->idview);
             break;
         case 'seo':
             $args = targs::i();
             $args->url = $menu->url;
             $args->keywords = $menu->keywords;
             $args->description = $menu->description;
             $args->head = $menu->data['head'];
             $result = $html->parsearg('[text=url] [text=description] [text=keywords] [editor=head]', $args);
             break;
         default:
             $result = var_export($_GET, true);
     }
     return turlmap::htmlheader(false) . $result;
 }
Esempio n. 4
0
function installClasses()
{
    litepublisher::$urlmap = turlmap::i();
    litepublisher::$urlmap->lock();
    $posts = tposts::i();
    $posts->lock();
    $xmlrpc = TXMLRPC::i();
    $xmlrpc->lock();
    ttheme::$defaultargs = array();
    $theme = ttheme::getinstance('default');
    //  $html = tadminhtml::i();
    //      $html->loadinstall();
    foreach (litepublisher::$classes->items as $class => $item) {
        //echo "$class<br>\n";
        if (preg_match('/^(titem|titem_storage|titemspostsowner|tcomment|IXR_Client|IXR_Server|tautoform|tchildpost|tchildposts|tlitememcache)$/', $class)) {
            continue;
        }
        $obj = getinstance($class);
        if (method_exists($obj, 'install')) {
            $obj->install();
        }
    }
    $xmlrpc->unlock();
    $posts->unlock();
    litepublisher::$urlmap->unlock();
}
function tsitemapUninstall($self)
{
    turlmap::unsub($self);
    tcron::i()->deleteclass($self);
    $meta = tmetawidget::i();
    $meta->delete('sitemap');
}
function tlinkswidgetUninstall($self)
{
    if (get_class($self) != 'tlinkswidget') {
        return;
    }
    turlmap::unsub($self);
}
 public function processform()
 {
     litepublisher::$options->dateformat = $_POST['dateformat'];
     litepublisher::$options->language = $_POST['language'];
     if (litepublisher::$options->timezone != $_POST['timezone']) {
         litepublisher::$options->timezone = $_POST['timezone'];
         $archives = tarchives::i();
         turlmap::unsub($archives);
         $archives->PostsChanged();
     }
     $merger = tlocalmerger::i();
     $merger->lock();
     //$merger->items = array();
     //$merger->install();
     foreach (array_keys($merger->items) as $name) {
         $keys = array_keys($merger->items[$name]['texts']);
         $merger->setfiles($name, $_POST[$name . '_files']);
         foreach ($keys as $key) {
             $merger->addtext($name, $key, $_POST[$name . '_text_' . $key]);
         }
     }
     $merger->html = explode("\n", trim($_POST['adminhtml_files']));
     foreach ($merger->html as $i => $filename) {
         $merger->html[$i] = trim($filename);
     }
     $merger->unlock();
 }
function tcommontagsUninstall($self)
{
    tposts::unsub($self);
    turlmap::unsub($self);
    $widgets = twidgets::i();
    $widgets->deleteclass(get_class($self));
}
Esempio n. 9
0
 public function import($s)
 {
     require_once litepublisher::$paths->lib . 'domrss.class.php';
     $a = xml2array($s);
     $urlmap = turlmap::i();
     $urlmap->lock();
     $cats = tcategories::i();
     $cats->lock();
     $tags = ttags::i();
     $tags->lock();
     $posts = tposts::i();
     $posts->lock();
     foreach ($a['rss']['channel'][0]['item'] as $item) {
         if ($post = $this->add($item)) {
             $posts->add($post);
             if (isset($item['wp:comment']) && is_array($item['wp:comment'])) {
                 $this->importcomments($item['wp:comment'], $post->id);
             }
             if (!tfilestorage::$disabled) {
                 $post->free();
             }
         }
     }
     $posts->unlock();
     $tags->unlock();
     $cats->unlock();
     $urlmap->unlock();
 }
function trssMultimediaUninstall($self)
{
    turlmap::unsub($self);
    $files = tfiles::i();
    $files->unbind($self);
    $meta = tmetawidget::i();
    $meta->delete('media');
}
function tkeywordspluginUninstall($self)
{
    turlmap::unsub($self);
    $widgets = twidgets::i();
    $widgets->deleteclass('tkeywordswidget');
    litepublisher::$classes->delete('tkeywordswidget');
    //TFiler::DeleteFiles(litepublisher::$paths->data . 'keywords' . DIRECTORY_SEPARATOR  , true);
}
function tprofileUninstall($self)
{
    turlmap::unsub($self);
    $sitemap = tsitemap::i();
    $sitemap->delete('/profile.htm');
    $template = ttemplate::i();
    $template->deletefromhead('	<link rel="author profile" title="Profile" href="$site.url/profile.htm" />');
}
 public function getcontent()
 {
     $type = tadminhtml::getparam('type', 'tags') == 'tags' ? 'tags' : 'categories';
     $tags = $type == 'tags' ? ttags::i() : tcategories::i();
     if ($err = self::auth()) {
         return $err;
     }
     $id = tadminhtml::idparam();
     if ($id > 0 && !$tags->itemexists($id)) {
         return self::error403();
     }
     $theme = tview::i(tviews::i()->defaults['admin'])->theme;
     $html = tadminhtml::i();
     $html->section = 'tags';
     $lang = tlocal::i('tags');
     if ($id == 0) {
         $views = tviews::i();
         $name = $type == 'tags' ? 'tag' : 'category';
         $item = array('title' => '', 'idview' => isset($views->defaults[$name]) ? $views->defaults[$name] : 1, 'idperm' => 0, 'icon' => 0, 'includechilds' => $tags->includechilds, 'includeparents' => $tags->includeparents, 'invertorder' => false, 'lite' => $tags->lite, 'liteperpage' => 1000, 'url' => '', 'keywords' => '', 'description' => '', 'head' => '');
     } else {
         $item = $tags->getitem($id);
     }
     switch ($_GET['get']) {
         case 'view':
             if ($id > 0) {
                 foreach (array('includechilds', 'includeparents', 'invertorder', 'lite') as $prop) {
                     $item[$prop] = (int) $item[$prop] > 0;
                 }
             }
             $args = new targs();
             $args->add($item);
             $result = $html->parsearg('[checkbox=includechilds] [checkbox=includeparents] [checkbox=invertorder] [checkbox=lite] [text=liteperpage]', $args);
             $result .= $this->getviewicon($item['idview'], $item['icon']);
             $result .= tadminperms::getcombo($item['idperm']);
             break;
         case 'seo':
             $args = targs::i();
             if ($id == 0) {
                 $args->url = '';
                 $args->keywords = '';
                 $args->description = '';
                 $args->head = '';
             } else {
                 $args->add($tags->contents->getitem($id));
                 $args->url = $tags->items[$id]['url'];
             }
             $result = $html->parsearg('[text=url] [text=description] [text=keywords] [editor=head]', $args);
             break;
         case 'text':
             $result = $this->geteditor('raw', $id == 0 ? '' : $tags->contents->getcontent($id), true);
             $result .= $this->gethead();
             break;
         default:
             $result = var_export($_GET, true);
     }
     return turlmap::htmlheader(false) . $result;
 }
Esempio n. 14
0
 public function uninstall()
 {
     turlmap::unsub($this);
     $template = ttemplate::i();
     $template->deletefromhead($this->get_head());
     $merger = tlocalmerger::i();
     $merger->deleteplugin(tplugins::getname(__FILE__));
     litepublisher::$urlmap->clearcache();
 }
Esempio n. 15
0
 public function delete($id)
 {
     if (parent::delete($id)) {
         $urlmap = turlmap::i();
         $urlmap->clearcache();
         return true;
     }
     return false;
 }
function thomepageUninstall($self)
{
    turlmap::unsub($self);
    tposts::unsub($self);
    $menus = tmenus::i();
    $menus->lock();
    unset($menus->items[$menus->idhome]);
    $menus->sort();
    $menus->unlock();
}
Esempio n. 17
0
 public function add($value)
 {
     if (!in_array($value, $this->items)) {
         $this->items[] = $value;
         $this->save();
         $urlmap = turlmap::i();
         $urlmap->setexpired($this->idurl);
         $this->added($value);
     }
 }
Esempio n. 18
0
function trssUninstall($self)
{
    turlmap::unsub($self);
    tcomments::i()->unbind($self);
    $meta = tmetawidget::i();
    $meta->lock();
    $meta->delete('rss');
    $meta->delete('comments');
    $meta->unlock();
}
Esempio n. 19
0
 protected function prepareurl($host, $url)
 {
     parent::prepareurl($host, $url);
     if (strbegin($this->url, litepublisher::$mobile . '/') || $this->url == litepublisher::$mobile) {
         if ($this->url == litepublisher::$mobile) {
             $this->url = '/';
         } else {
             $this->url = substr($this->url, strlen(litepublisher::$mobile));
         }
     }
 }
Esempio n. 20
0
 private function dochanged($name, $value)
 {
     if ($name == 'perpage') {
         $this->perpagechanged();
         $urlmap = turlmap::i();
         $urlmap->clearcache();
     } elseif ($name == 'cache') {
         $urlmap = turlmap::i();
         $urlmap->clearcache();
     } else {
         $this->changed($name, $value);
     }
 }
function texternallinksUninstall($self)
{
    $filter = tcontentfilter::i();
    $filter->unbind($self);
    $cron = tcron::i();
    $cron->deleteclass(get_class($self));
    turlmap::unsub($self);
    if (dbversion) {
        $manager = tdbmanager::i();
        $manager->deletetable($self->table);
    }
    tposts::i()->addrevision();
}
function tregservicesUninstall($self)
{
    $name = basename(dirname(__FILE__));
    tcommentform::i()->unbind($self);
    turlmap::unsub($self);
    foreach ($self->items as $id => $classname) {
        litepublisher::$classes->delete($classname);
    }
    litepublisher::$classes->delete('tregserviceuser');
    litepublisher::$classes->delete('toauth');
    tfiler::delete(litepublisher::$paths->data . 'regservices', true, true);
    tusers::i()->unbind('tregserviceuser');
    tdbmanager::i()->deletetable('regservices');
    $css = tcssmerger::i();
    $css->deletestyle("/plugins/{$name}/regservices.min.css");
}
 public function request($arg)
 {
     $id = isset($_GET['id']) ? (int) $_GET['id'] : 1;
     if (!$this->itemexists($id)) {
         return turlmap::redir301('/');
     }
     $item = $this->getitem($id);
     $url = $item['url'];
     if (!strpos($url, '.')) {
         $url = litepublisher::$options->url . litepublisher::$options->home;
     }
     if (!strbegin($url, 'http://')) {
         $url = 'http://' . $url;
     }
     turlmap::redir($url);
 }
 public function ping($from, $to)
 {
     if (!strbegin($to, litepublisher::$site->url)) {
         return new IXR_Error(0, 'Is there no link to us?');
     }
     $url = substr($to, strlen(litepublisher::$site->url));
     $urlmap = turlmap::i();
     if (!($item = $urlmap->finditem($url))) {
         return $this->xerror(0, 'Is there no link to us?');
     }
     if ($item['class'] != litepublisher::$classes->classes['post']) {
         return $this->xerror(33, 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.');
     }
     $post = tpost::i($item['arg']);
     if (!$post->pingenabled || $post->status != 'published') {
         return $this->xerror(33, 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.');
     }
     $pingbacks = $post->pingbacks;
     if ($pingbacks->exists($from)) {
         return new IXR_Error(48, 'The pingback has already been registered.');
     }
     if (!($s = http::get($from))) {
         return new IXR_Error(16, 'The source URL does not exist.');
     }
     $s = str_replace('<!DOC', '<DOC', $s);
     $s = preg_replace('/[\\s\\r\\n\\t]+/', ' ', $s);
     // normalize spaces
     if (!preg_match('|<title>([^<]*?)</title>|is', $s, $matchtitle) || empty($matchtitle[1])) {
         return new IXR_Error(32, 'We cannot find a title on that page.');
     }
     $s = strip_tags($s, '<a>');
     if (!preg_match("|<a([^>]+?" . preg_quote($to) . "[^>]*)>[^>]+?</a>|", $s, $match)) {
         return new IXR_Error(17, 'The source URL does not contain a link to the target URL, and so cannot be used as a source.');
     }
     if (preg_match('/nofollow|noindex/is', $match[1])) {
         return new IXR_Error(32, 'The source URL contain nofollow or noindex atribute');
     }
     $pingbacks->add($from, $matchtitle[1]);
     return "Pingback from {$from} to {$to} registered. Keep the web talking! :-)";
 }
Esempio n. 25
0
function tfoafUninstall($self)
{
    $merger = tlocalmerger::i();
    $merger->deleteplugin(tplugins::getname(__FILE__));
    $actions = TXMLRPCAction::i();
    $actions->deleteclass(get_class($self));
    $urlmap = litepublisher::$urlmap;
    $urlmap->lock();
    turlmap::unsub($self);
    $classes = litepublisher::$classes;
    $classes->lock();
    $classes->delete('tfoafutil');
    $classes->delete('tprofile');
    $classes->delete('tfriendswidget');
    $classes->delete('tadminfoaf');
    $classes->unlock();
    $admin = tadminmenus::i();
    $admin->lock();
    $admin->deleteurl('/admin/foaf/profiletemplate/');
    $admin->deleteurl('/admin/foaf/profile/');
    $admin->deleteurl('/admin/foaf/');
    $admin->unlock();
    $urlmap->unlock();
    if ($self->dbversion) {
        $manager = tdbmanager::i();
        $manager->deletetable($self->table);
    }
    $template = ttemplate::i();
    $template->deletefromhead('	<link rel="meta" type="application/rdf+xml" title="FOAF" href="$site.url/foaf.xml" />');
    $meta = tmetawidget::i();
    $meta->lock();
    $meta->delete('foaf');
    $meta->delete('profile');
    $meta->unlock();
    ttheme::clearcache();
}
Esempio n. 26
0
 public function request($arg)
 {
     $this->cache = false;
     turlmap::nocache();
     if (empty($_GET['oauth_token'])) {
         return 403;
     }
     tsession::start(md5($_GET['oauth_token']));
     if (!isset($_SESSION['tokens'])) {
         session_destroy();
         return 403;
     }
     $tokens = $_SESSION['tokens'];
     session_destroy();
     $oauth = $this->getoauth();
     $oauth->settokens($tokens['oauth_token'], $tokens['oauth_token_secret']);
     if ($tokens = $oauth->getaccesstoken($_REQUEST['oauth_verifier'])) {
         if ($r = $oauth->get_data('https://api.twitter.com/1/account/verify_credentials.json')) {
             $info = json_decode($r);
             return $this->adduser(array('uid' => $info->id, 'name' => $info->name, 'website' => 'http://twitter.com/account/redirect_by_id?id=' . $info->id_str), $info);
         }
     }
     return $this->errorauth();
 }
Esempio n. 27
0
 public function request($arg)
 {
     $this->cache = false;
     $id = self::getget('id');
     $sidebar = self::getget('sidebar');
     $this->idurlcontext = self::getget('idurl');
     if ($id === false || $sidebar === false || !$this->itemexists($id)) {
         return $this->error_request('Invalid params');
     }
     $themename = isset($_GET['themename']) ? trim($_GET['themename']) : tview::i(1)->themename;
     if (!preg_match('/^\\w[\\w\\.\\-_]*+$/', $themename) || !ttheme::exists($themename)) {
         $themename = tviews::i(1)->themename;
     }
     $theme = ttheme::getinstance($themename);
     try {
         $result = $this->getwidgetcontent($id, $sidebar);
         return turlmap::htmlheader(false) . $result;
     } catch (Exception $e) {
         return $this->error_request('Cant get widget content');
     }
 }
Esempio n. 28
0
    require_once litepublisher::$paths->lib . 'events.class.php';
    require_once litepublisher::$paths->lib . 'items.class.php';
    require_once litepublisher::$paths->lib . 'classes.php';
    require_once litepublisher::$paths->lib . 'options.class.php';
} else {
    require_once litepublisher::$paths->lib . 'kernel.php';
}
litepublisher::$classes = tclasses::instance();
litepublisher::$options = toptions::instance();
if (!litepublisher::$options->installed) {
    require_once litepublisher::$paths->lib . 'install' . DIRECTORY_SEPARATOR . 'install.php';
}
if (dbversion) {
    litepublisher::$db = new tdatabase();
}
litepublisher::$options->admincookie = litepublisher::$options->cookieenabled && litepublisher::$options->authcookie();
litepublisher::$urlmap = turlmap::instance();
if (!defined('litepublisher_mode')) {
    litepublisher::$urlmap->request(strtolower($_SERVER['HTTP_HOST']), $_SERVER['REQUEST_URI']);
}
litepublisher::$options->cache = false;
litepublisher::$options->savemodified();
litepublisher::$options->showerrors();
if (dbversion && !preg_match('/(^\\/rpc\\.xml|\\/rss|\\/comments\\.)|(\\.xml$)/', $_SERVER['REQUEST_URI'])) {
    echo "<pre>\n";
    $man = tdbmanager::instance();
    //$man->deletealltables();
    //echo  $man->performance();
    //file_put_contents(litepublisher::$pathshome. "litepublisher::$domain .sql", $man->export());
}
//
Esempio n. 29
0
        require_once litepublisher::$paths->lib . 'options.class.php';
        require_once litepublisher::$paths->lib . 'site.class.php';
    } else {
        require_once litepublisher::$paths->lib . 'kernel.php';
    }
    define('dbversion', true);
    /*
    if (class_exists('Memcache')) {
      tfilestorage::$memcache =  new Memcache;
      tfilestorage::$memcache->connect('127.0.0.1', 11211);
    }
    */
    if (!tstorage::loaddata()) {
        if (file_exists(litepublisher::$paths->data . 'storage.php') && filesize(litepublisher::$paths->data . 'storage.php')) {
            die('Storage not loaded');
        }
        require_once litepublisher::$paths->lib . 'install' . DIRECTORY_SEPARATOR . 'install.php';
    }
    litepublisher::$classes = tclasses::i();
    litepublisher::$options = toptions::i();
    litepublisher::$db = tdatabase::i();
    litepublisher::$site = tsite::i();
    litepublisher::$urlmap = turlmap::i();
    if (!defined('litepublisher_mode')) {
        litepublisher::$urlmap->request(strtolower($_SERVER['HTTP_HOST']), $_SERVER['REQUEST_URI']);
    }
} catch (Exception $e) {
    litepublisher::$options->handexception($e);
}
litepublisher::$options->savemodified();
litepublisher::$options->showerrors();
Esempio n. 30
0
 public function processform()
 {
     switch ($_POST['formtype']) {
         case 'colors':
             foreach ($_POST as $name => $value) {
                 if (strbegin($name, 'color_')) {
                     $name = substr($name, strlen('color_'));
                     $this->setcolor($name, $value);
                 }
             }
             $this->sendfile();
             break;
         case 'uploadcolors':
             if (isset($_FILES['filename'])) {
                 if (isset($_FILES['filename']['error']) && $_FILES['filename']['error'] > 0) {
                     $lang = tlocal::admin('uploaderrors');
                     return sprintf('<h4>%s</h4>', $lang->__get($_FILES['filename']['error']));
                 } elseif (!is_uploaded_file($_FILES['filename']['tmp_name'])) {
                     return sprintf('<h4>%s</h4>', $lng['attack']);
                 } else {
                     $this->colorsuploaded = true;
                     $colors = parse_ini_file($_FILES['filename']['tmp_name']);
                     foreach ($colors as $name => $value) {
                         $this->setcolor($name, $value);
                     }
                 }
             }
             break;
         case 'headerurl':
             if (!isset($_FILES['Filedata']) || !is_uploaded_file($_FILES['Filedata']['tmp_name']) || $_FILES['Filedata']['error'] != 0) {
                 return 403;
             }
             if ($result = $this->imageresize($_FILES['Filedata']['name'], $_FILES['Filedata']['tmp_name'], $this->colors['headerwidth'], $this->colors['headerheight'])) {
                 return turlmap::htmlheader(false) . $result;
             }
             return 403;
         case 'logourl':
             if (!isset($_FILES['Filedata']) || !is_uploaded_file($_FILES['Filedata']['tmp_name']) || $_FILES['Filedata']['error'] != 0) {
                 return 403;
             }
             if ($result = $this->uploadlogo($_FILES['Filedata']['name'], $_FILES['Filedata']['tmp_name'], $this->colors['logopadding'], $this->colors['logoheight'])) {
                 return turlmap::htmlheader(false) . json_encode($result);
             }
             return 403;
     }
     return '';
 }