Beispiel #1
0
 static function remove_metadata_field()
 {
     $migrated = modOpts::GetOption('metadata_migrated');
     if ($migrated) {
         return;
     }
     try {
         $obj = utopia::GetInstance('uWidgets', false);
         $obj->BypassSecurity(true);
         $ds = database::query('SELECT * FROM tabledef_Widgets WHERE `block_type` = ? AND `__metadata` IS NOT NULL', array('uCustomWidget'));
         while ($row = $ds->fetch()) {
             $pk = $row['widget_id'];
             $meta = utopia::jsonTryDecode($row['__metadata']);
             foreach ($meta as $field => $val) {
                 $obj->UpdateField($field, $val, $pk);
             }
         }
         $obj->BypassSecurity(false);
         $ds = database::query('UPDATE tabledef_Widgets SET `__metadata` = NULL WHERE `block_type` = ? AND `__metadata` IS NOT NULL', array('uCustomWidget'));
     } catch (Exception $e) {
     }
     try {
         $obj = utopia::GetInstance('uWidgets', false);
         $obj->BypassSecurity(true);
         $ds = database::query('SELECT * FROM tabledef_Widgets WHERE `block_type` = ? AND `__metadata` IS NOT NULL', array('uTextWidget'));
         while ($row = $ds->fetch()) {
             $pk = $row['widget_id'];
             $meta = utopia::jsonTryDecode($row['__metadata']);
             foreach ($meta as $field => $val) {
                 $obj->UpdateField($field, $val, $pk);
             }
         }
         $obj->BypassSecurity(false);
         $ds = database::query('UPDATE tabledef_Widgets SET `__metadata` = NULL WHERE `block_type` = ? AND `__metadata` IS NOT NULL', array('uTextWidget'));
     } catch (Exception $e) {
     }
     try {
         $obj = utopia::GetInstance('uWidgets', false);
         $obj->BypassSecurity(true);
         $ds = database::query('SELECT * FROM tabledef_Widgets WHERE `block_type` = ? AND `__metadata` IS NOT NULL', array('uTwitterWidget'));
         while ($row = $ds->fetch()) {
             $pk = $row['widget_id'];
             $meta = utopia::jsonTryDecode($row['__metadata']);
             foreach ($meta as $field => $val) {
                 $obj->UpdateField($field, $val, $pk);
             }
         }
         $obj->BypassSecurity(false);
         $ds = database::query('UPDATE tabledef_Widgets SET `__metadata` = NULL WHERE `block_type` = ? AND `__metadata` IS NOT NULL', array('uTwitterWidget'));
     } catch (Exception $e) {
     }
     $ds = database::query('SHOW TABLES');
     while ($t = $ds->fetch(PDO::FETCH_NUM)) {
         try {
             database::query('ALTER TABLE ' . $t[0] . ' DROP `__metadata`');
         } catch (Exception $e) {
         }
     }
     modOpts::SetOption('metadata_migrated', true);
 }
Beispiel #2
0
 public static function Draw25()
 {
     if (modOpts::GetOption('site_online')) {
         return;
     }
     if (!uUserRoles::IsAdmin()) {
         return;
     }
     $modOptsObj = utopia::GetInstance('modOpts');
     $row = $modOptsObj->LookupRecord('site_online');
     echo '<p>This website is currently offline. Go Online? ' . $modOptsObj->GetCell('value', $row) . '</p>';
 }
Beispiel #3
0
 public static function uCMS_publish_update()
 {
     $done = modOpts::GetOption('cms_publish_update');
     if ($done) {
         return;
     }
     $o = utopia::GetInstance('uCMS_Edit');
     $o->BypassSecurity(true);
     $ds = $o->GetDataset(array('{content_published_time} > {content_time}'));
     while ($row = $ds->fetch()) {
         $o->UpdateFieldRaw('content_published_time', '`content_time`', $row['cms_id']);
     }
     $o->BypassSecurity(false);
     modOpts::SetOption('cms_publish_update', true);
 }
Beispiel #4
0
 static function GetSiteURL()
 {
     if (!self::$siteurl) {
         self::$siteurl = rtrim(modOpts::GetOption('site_url'), '/');
     }
     return self::$siteurl;
 }
Beispiel #5
0
 public function RunModule()
 {
     if (!modOpts::GetOption('open_user_registration')) {
         echo '<h1>User Registration</h1>';
         echo '<p>Sorry. User registrations have been disabled by the administrator.</p>';
         return;
     }
     if ($usr = $this->RegisterForm()) {
         uVerifyEmail::VerifyAccount($usr);
         echo '<p>Thank you for creating an account.  We need to verify your email before you can continue.</p>';
         echo '<p>Please check your inbox, and follow the instructions we have sent you.</p>';
     }
 }
Beispiel #6
0
 public function ProcessDomDocument($o, $e, $doc)
 {
     $head = $doc->getElementsByTagName('head')->item(0);
     // add OG protocol
     if (isset($_GET['news_id'])) {
         $rec = $this->LookupRecord($_GET['news_id']);
         $img = 'http://' . utopia::GetDomainName() . uBlob::GetLink(get_class($this), 'image', $rec['news_id']);
         $meta = $doc->createElement('meta');
         $meta->setAttribute('property', 'og:title');
         $meta->setAttribute('content', $rec['heading']);
         $head->appendChild($meta);
         $meta = $doc->createElement('meta');
         $meta->setAttribute('property', 'og:type');
         $meta->setAttribute('content', 'article');
         $head->appendChild($meta);
         $meta = $doc->createElement('meta');
         $meta->setAttribute('property', 'og:url');
         $meta->setAttribute('content', 'http://' . utopia::GetDomainName() . $_SERVER['REQUEST_URI']);
         $head->appendChild($meta);
         if ($rec['image']) {
             // image exists?
             $meta = $doc->createElement('meta');
             $meta->setAttribute('property', 'og:image');
             $meta->setAttribute('content', $img);
             $head->appendChild($meta);
         }
         $meta = $doc->createElement('meta');
         $meta->setAttribute('property', 'og:site_name');
         $meta->setAttribute('content', modOpts::GetOption('site_name'));
         $head->appendChild($meta);
         $meta = $doc->createElement('meta');
         $meta->setAttribute('property', 'og:description');
         $meta->setAttribute('content', $rec['description']);
         $head->appendChild($meta);
     }
     // add RSS link
     $rssobj = utopia::GetInstance('module_NewsRSS');
     $link = $doc->createElement('link');
     $link->setAttribute('rel', 'alternate');
     $link->setAttribute('type', 'application/atom+xml');
     $link->setAttribute('title', modOpts::GetOption('site_name') . ' News Feed');
     $link->setAttribute('href', $rssobj->GetURL());
     $head->appendChild($link);
 }
Beispiel #7
0
 public static function Initialise()
 {
     uCSS::IncludeFile(utopia::GetRelativePath(dirname(__FILE__) . '/cms.css'));
     $nTemplates = utopia::GetTemplates(false, true);
     $dTemplate = '/' . basename(PATH_REL_CORE) . '/themes/default';
     modOpts::AddOption('default_template', 'Default Template', NULL, $dTemplate, itCOMBO, $nTemplates);
     utopia::RegisterAjax('reorderCMS', 'uCMS_List::reorderCMS');
     uUserRoles::LinkRoles('Page Editor', array('uCMS_List', 'uCMS_Edit'));
     self::AddParent('/');
 }