コード例 #1
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 function SiteblogBrowseForm()
 {
     parent::MailForm();
     $this->parseSettings('inc/app/siteblog/forms/browse/settings.php');
     echo '<h2> Search for Posts </h2>';
     $years = array();
     $years[] = 'All Years';
     $currYear = date('Y');
     for ($i = 2000; $i <= $currYear + 1; $i++) {
         $years[$i] = $i;
     }
     $months = array(0 => 'All Months', 1 => 'January', 2 => 'February', 3 => 'March', 4 => 'April', 5 => 'May', 6 => 'June', 7 => 'July', 8 => 'August', 9 => 'September', 10 => 'October', 11 => 'November', 12 => 'December');
     $authors[] = 'All Users';
     foreach (db_shift_array('select distinct author from siteblog_post') as $a) {
         $authors[$a] = $a;
     }
     $cats = db_fetch_array('select * from siteblog_category');
     $newcats = array();
     foreach ($cats as $c) {
         $newcats[$c->id] = $c->title;
     }
     $this->widgets['author']->setValues($authors);
     $this->widgets['month']->setValues($months);
     $this->widgets['year']->setValues($years);
     $this->widgets['category']->setValues($newcats);
 }
コード例 #2
0
ファイル: Filters.php プロジェクト: vojtajina/sitellite
function sitewiki_filter_body($body)
{
    $wiki = new Text_Wiki();
    $wiki->setRenderConf('xhtml', 'wikilink', 'view_url', site_prefix() . '/index/sitewiki-app/show.');
    $wiki->setRenderConf('xhtml', 'wikilink', 'new_url', site_prefix() . '/index/sitewiki-app/show.');
    $pages = db_shift_array('select distinct id from sitewiki_page');
    $wiki->setRenderConf('xhtml', 'wikilink', 'pages', $pages);
    return $wiki->transform($body, 'Xhtml');
}
コード例 #3
0
ファイル: DBMan.php プロジェクト: rajimenez12/dbman
 /**
  * List all tables.
  */
 public static function list_tables()
 {
     switch (DBMan::driver()) {
         case 'sqlite':
             return db_shift_array('select name from sqlite_master where type = "table" order by name asc');
         case 'mysql':
             return db_shift_array('show tables');
     }
     return array();
 }
コード例 #4
0
ファイル: Filters.php プロジェクト: vojtajina/sitellite
function sitefaq_facet_assigned_to()
{
    $res = db_shift_array('select distinct assigned_to from sitefaq_submission order by assigned_to asc');
    $ret = array();
    foreach ($res as $a) {
        if (empty($a)) {
            continue;
            $ret[''] = intl_get('None');
        } else {
            $ret[$a] = db_shift('select concat(lastname, ", ", firstname, " (", username, ")") from sitellite_user where username = ?', $a);
        }
    }
    return $ret;
}
コード例 #5
0
ファイル: index.php プロジェクト: vojtajina/sitellite
    function onSubmit($vals)
    {
        // 1. insert into sitefaq_submission table
        if ($vals['url'] == 'http://') {
            $vals['url'] = '';
        }
        $member_id = session_username();
        if (!$member_id) {
            $member_id = '';
        }
        if (!$vals['name']) {
            $vals['name'] = '';
        }
        if (!$vals['age']) {
            $vals['age'] = '';
        }
        if (!$vals['url']) {
            $vals['url'] = '';
        }
        db_execute('insert into sitefaq_submission
				(id, question, answer, ts, assigned_to, email, member_id, ip, name, age, url, sitellite_status, sitellite_access, sitellite_owner, sitellite_team)
			values
				(null, ?, "", now(), "", ?, ?, ?, ?, ?, ?, "draft", "private", "", "none")', $vals['question'], $vals['email'], $member_id, $_SERVER['REMOTE_ADDR'], $vals['name'], $vals['age'], $vals['url']);
        // 2. email all admins
        $admin_roles = session_admin_roles();
        $emails = db_shift_array('select distinct email from sitellite_user
			where role in("' . join('", "', $admin_roles) . '")');
        foreach ($emails as $email) {
            @mail($email, intl_get('FAQ Submission Notice'), template_simple('email_notice.spt', $vals), 'From: faq@' . str_replace('www.', '', site_domain()));
        }
        // 4. if the user provided an email address, send a thank you
        if (!empty($vals['email'])) {
            @mail($vals['email'], intl_get('FAQ Submission Received'), template_simple('email_thank_you.spt', $vals), 'From: faq@' . str_replace('www.', '', site_domain()));
        }
        // 3. output a thank you
        page_title(intl_get('Thank You'));
        echo template_simple('thank_you.spt', $vals);
    }
コード例 #6
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 function onSubmit($vals)
 {
     $sql = 'select distinct email_address from sitellite_form_submission';
     if ($vals['include_no_consent']) {
         $sql .= ' where (may_we_contact_you is null or may_we_contact_you = "yes")';
     } else {
         $sql .= ' where may_we_contact_you = "yes"';
     }
     if ($vals['send_to']) {
         $sql .= ' and form_type = ' . db_quote($vals['send_to']);
     }
     $emails = db_shift_array($sql);
     set_time_limit(0);
     foreach ($emails as $email) {
         // send email
         @mail($email, $vals['subject'], $vals['message'], 'From: ' . $vals['from_name'] . ' <' . $vals['from_email'] . ">\r\n");
     }
     // send copy to sender
     @mail($vals['from_email'], $vals['subject'], $vals['message'], 'From: ' . $vals['from_name'] . ' <' . $vals['from_email'] . ">\r\n");
     page_title(intl_get('Email Sent'));
     echo '<p>' . intl_get('Email sent to') . ' ' . count($emails) . ' ' . intl_get('recipients') . '.</p>';
     echo '<p><a href="' . site_prefix() . '/index/cms-browse-action?collection=sitellite_form_submission">Continue</a></p>';
 }
コード例 #7
0
ファイル: index.php プロジェクト: vojtajina/sitellite
    return;
}
echo '<p><strong>Fixing Web Files...</strong></p><p>';
set_time_limit(0);
$c = 0;
// 1. fix folder names
loader_import('saf.File.Directory');
$struct = Dir::getStruct('inc/data');
foreach ($struct as $dir) {
    $lower = strtolower($dir);
    if ($dir != $lower) {
        rename($dir, $lower);
    }
}
// 2. select all web files
$files = db_shift_array('select distinct name from sitellite_filesystem_sv order by name asc');
foreach ($files as $file) {
    $lower = strtolower($file);
    if ($file != $lower) {
        // 3. rename in filesystem
        rename('inc/data/' . $file, 'inc/data/' . $lower);
        // 4. rename in db
        db_execute('update sitellite_filesystem_sv set name = ? where name = ?', $lower, $file);
        $info = pathinfo($file);
        $linfo = pathinfo($lower);
        db_execute('update sitellite_filesystem set name = ?, path = ?, extension = ? where name = ? and path = ? and extension = ?', basename($linfo['basename'], '.' . $linfo['extension']), $linfo['dirname'], $linfo['extension'], basename($info['basename'], '.' . $info['extension']), $info['dirname'], $info['extension']);
        echo $file . '<br />';
        $c++;
    }
}
echo '</p><p>Fixed ' . $c . ' files.</p>';
コード例 #8
0
ファイル: index.php プロジェクト: vojtajina/sitellite
<?php

if (!session_allowed('imagechooser_delete', 'rw', 'resource')) {
    die('Delete not permitted.');
}
$res = db_shift_array('select id from sitellite_page where body like ?', '%' . $parameters['location'] . '/' . $parameters['src'] . '%');
if (count($res) > 0) {
    $parameters['deleted'] = false;
    page_title(intl_get('Image in Use') . ': ' . $parameters['location'] . '/' . $parameters['src']);
    $parameters['err'] = intl_get('Unable to delete image because it is still in use on the following pages:');
    $parameters['list'] = $res;
} else {
    if (!@unlink(site_docroot() . $parameters['location'] . '/' . $parameters['src'])) {
        $parameters['deleted'] = false;
        page_title(intl_get('Delete Failed') . ': ' . $parameters['location'] . '/' . $parameters['src']);
        $parameters['err'] = intl_get('Unable to delete image.  Check your server filesystem permissions and try again.');
    } else {
        $parameters['deleted'] = true;
        page_title(intl_get('Image Deleted') . ': ' . $parameters['location'] . '/' . $parameters['src']);
    }
}
if ($parameters['admin']) {
    $app = '-admin-action';
} else {
    $app = '-app';
}
global $cgi;
if ($parameters['err']) {
    session_set('imagechooser_err', $parameters['err']);
    session_set('imagechooser_pagelist', $parameters['list']);
} else {
コード例 #9
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 *
 * Transition is one of:
 * - add
 * - edit
 *
 * Action is one of:
 * - null: Document was added
 * - modify: Ordinary modifications (source and store)
 * - replace: A change was approved, overwriting the live version
 * - republish: A change was made as a draft, requiring approval
 * - update: Update to a draft that was republished
 */
loader_import('cms.Workspace.Message');
loader_import('cms.Versioning.Rex');
loader_import('multilingual.Translation');
$msg = new WorkspaceMessage();
$rex = new Rex($parameters['collection']);
$tr = new Translation($parameters['collection']);
if ($parameters['transition'] == 'add') {
    // 1. find the associated translator(s) and email them
    $users = db_shift_array('select username from sitellite_user where team = ? and role = "translator"', $parameters['data']['sitellite_team']);
    $url = sprintf('%s/index/multilingual-translate-form?_collection=%s&_key=%s', site_prefix(), $parameters['collection'], $parameters['key']);
    $msg->send(intl_get('New Translation Notice'), template_simple('services_translation_new.spt', array('url' => $url, 'changelog' => $parameters['changelog'], 'collection' => $rex->info['Collection']['display'], 'key' => $parameters['key'])), $users);
} else {
    // 1. expire the translations
    $tr->expire($parameters['key']);
    // 2. find the associated translator(s) and email them
    $users = db_shift_array('select username from sitellite_user where team = ? and role = "translator"', $parameters['data']['sitellite_team']);
    $url = sprintf('%s/index/multilingual-translate-form?_collection=%s&_key=%s', site_prefix(), $parameters['collection'], $parameters['key']);
    $msg->send(intl_get('Translation Update Notice'), template_simple('services_translation_update.spt', array('url' => $url, 'changelog' => $parameters['changelog'], 'collection' => $rex->info['Collection']['display'], 'key' => $parameters['key'])), $users);
}
コード例 #10
0
ファイル: index.php プロジェクト: vojtajina/sitellite
<?php

page_title(intl_get('Authors'));
loader_import('sitewiki.Filters');
$res = db_shift_array('select distinct sv_author from sitewiki_page_sv where sv_author != "" order by sv_author asc');
foreach ($res as $k => $v) {
    unset($res[$k]);
    if ($v == 'system') {
        $v = 'anonymous';
        $res[$v] = db_shift_array('select distinct id from sitewiki_page_sv where sv_author = ? and id != "" order by id asc', 'system');
    } else {
        $res[$v] = db_shift_array('select distinct id from sitewiki_page_sv where sv_author = ? and id != "" order by id asc', $v);
    }
    foreach ($res[$v] as $key => $pg) {
        $res[$v][$key] = '<a href="' . site_prefix() . '/index/sitewiki-app/show.' . $pg . '">' . sitewiki_filter_id($pg) . '</a>';
        if ($key < count($res[$v]) - 1) {
            $res[$v][$key] .= ', ';
        }
    }
}
$data = new StdClass();
$data->list = $res;
$data->screen = 'authors';
echo template_simple('authors.spt', $data);
コード例 #11
0
ファイル: index.php プロジェクト: vojtajina/sitellite
<?php

$keywords = array();
$selected = preg_split('/, ?/', $parameters['sel']);
foreach (db_shift_array('select * from sitellite_keyword order by word asc') as $k) {
    $sel = in_array($k, $selected) ? true : false;
    $keywords[] = array('name' => $k, 'sel' => $sel);
}
page_title('Global Keywords');
loader_import('saf.GUI.Prompt');
echo template_simple('keywords.spt', array('keywords' => $keywords, 'el' => $parameters['el'], 'sel' => $parameters['sel']));
コード例 #12
0
ファイル: index.php プロジェクト: vojtajina/sitellite
<?php

/* Parameters contains:
 * - collection: The collection the item belongs to
 * - key: The primary key value of the item
 * - message: A brief description of the event
 *
 * Note that services are triggered *after* the change has been
 * made.  The only way you can undo changes in a service is by
 * using the cms.Versioning.Rex API if the collection in question
 * supports versioning (not all do).  Also, you can, if necessary,
 * create further modifications to the document, also via the
 * Rex API.
 */
if ($parameters['collection'] == 'sitellite_page') {
    $rex = new Rex($parameters['collection']);
    $current = $rex->getCurrent($parameters['key']);
    if (!$current) {
        $current = new StdClass();
        $current->below_page = '';
    }
    foreach (db_shift_array('select id from sitellite_page where below_page = ?', $parameters['key']) as $child) {
        $method = $rex->determineAction($child);
        if (!$method) {
            die($rex->error);
        }
        $rex->{$method}($child, array('below_page' => $current->below_page), 'Relocated due to deleted parent page.');
    }
}
コード例 #13
0
ファイル: index.php プロジェクト: vojtajina/sitellite
			<tr>
				<td>&nbsp;</td>
				<td><input type="submit" value="Enter" /></td>
			</tr>
		</table>
		</form>', $cgi);
    return;
}
page_title('To Do\'s');
$projs = db_shift_array('select * from todo_project order by name asc');
foreach ($projs as $k => $v) {
    if (!db_shift('select count(*) from todo_list where done = "0000-00-00 00:00:00" and project = ?', $v)) {
        unset($projs[$k]);
    }
}
$ppl = db_shift_array('select * from todo_person order by name asc');
foreach ($ppl as $k => $v) {
    if (!db_shift('select count(*) from todo_list where done = "0000-00-00 00:00:00" and person = ?', $v)) {
        unset($ppl[$k]);
    }
}
global $cgi;
if (empty($cgi->pp)) {
    //$cgi->pp = $ppl[0];
    if (in_array(session_username(), $ppl)) {
        $cgi->pp = session_username();
    } else {
        $cgi->pp = '';
    }
}
if (!isset($cgi->proj)) {
コード例 #14
0
ファイル: Xspel.php プロジェクト: vojtajina/sitellite
 function getPersonal()
 {
     if (!session_valid()) {
         $this->personal = array();
     }
     $this->personal = db_shift_array('select word from xed_speling_personal where username = ? order by word asc', session_username());
 }
コード例 #15
0
ファイル: index.php プロジェクト: vojtajina/sitellite
			</tr>
			<tr>
				<td>&nbsp;</td>
				<td><input type="submit" value="Enter" /></td>
			</tr>
		</table>
		</form>');
    return;
}
if ($parameters['clear'] == 'yes') {
    db_execute('delete from webfiles_log');
    header('Location: ' . site_prefix() . '/webfiles-admin-action');
    exit;
}
if (isset($parameters['type']) && $parameters['type'] != '') {
    $res = db_fetch_array('select * from webfiles_log where http_status = ? order by id desc', $parameters['type']);
} else {
    $res = db_fetch_array('select * from webfiles_log order by id desc');
}
$file = @file('inc/app/webfiles/lib/Server.php');
page_title('Web Files - Log');
foreach ($res as $k => $row) {
    $start = $row->line - 7 > 0 ? $row->line - 7 : 0;
    $end = $row->line + 7 < count($file) - 1 ? $row->line + 7 : count($file) - 1;
    $res[$k]->code = array();
    for ($i = $start; $i <= $end; $i++) {
        $res[$k]->code[$i] = $file[$i];
    }
}
echo template_simple('admin.spt', array('log' => $res, 'type' => $parameters['type'], 'types' => db_shift_array('select distinct http_status from webfiles_log order by http_status asc')));
コード例 #16
0
ファイル: index.php プロジェクト: vojtajina/sitellite
                case 11:
                    $display_month = 'November';
                    break;
                case 12:
                    $display_month = 'December';
                    break;
                default:
                    $j;
            }
            echo template_simple('bydate.spt', array('year' => $k, 'monthnum' => $j, 'count' => count($month), 'month' => $display_month));
        }
        echo "\n<br />\n";
    }
} elseif ($cgi->by == 'user') {
    echo template_simple('browsehead.spt', array('title' => 'Browsing Posts by: Author'));
    foreach (db_shift_array('select distinct author from siteblog_post') as $a) {
        $count = db_shift('select count(id) from siteblog_post where author = ?', $a);
        echo template_simple('bylink.spt', array('var' => 'author', 'value' => $a, 'display' => $a, 'count' => $count));
    }
} elseif ($cgi->by == 'category') {
    echo template_simple('browsehead.spt', array('title' => 'Browsing Posts by: Category'));
    foreach (db_fetch_array('select * from siteblog_category') as $a) {
        if ($a->title == 'All Blogs') {
            $count = db_shift('select count(id) from siteblog_post', $a->id);
        } elseif ($a->title == 'Personal Blog') {
            $count = db_shift('select count(id) from siteblog_post where author = ? and category = ?', session_username(), $a->id);
        } else {
            $count = db_shift('select count(id) from siteblog_post where category = ?', $a->id);
        }
        echo template_simple('bylink.spt', array('var' => 'category', 'value' => $a->id, 'display' => $a->title, 'title' => $a->title, 'count' => $count));
    }
コード例 #17
0
ファイル: Versions.php プロジェクト: nathanieltite/elefant
 /**
  * Get a list of classes that have objects stored.
  */
 public static function get_classes()
 {
     return db_shift_array('select distinct class from versions order by class asc');
 }
コード例 #18
0
ファイル: Builder.php プロジェクト: vojtajina/sitellite
 function _db($file, $data)
 {
     if (!@file_exists($file)) {
         return true;
     }
     $data = parse_ini_file($file);
     echo '<ul>';
     foreach ($data as $table => $fields) {
         echo '<li>table: ' . $table . '/' . $fields . '</li>';
         $fields = preg_split('/, ?/', $fields);
         if (!is_array($fields)) {
             $fields = array($fields);
         }
         foreach ($fields as $field) {
             $res = db_shift_array(sprintf('select distinct %s from %s where %s is not null and %s != ""', $field, $table, $field, $field));
             foreach ($res as $row) {
                 $this->buffer->set($this->intl->serialize($row), array('string' => $row, 'params' => false, 'file' => $file, 'line' => false));
             }
         }
     }
     echo '</ul>';
     return true;
 }
コード例 #19
0
ファイル: _log.php プロジェクト: vojtajina/sitellite
$pg->url = site_prefix() . '/index/usradm-browse-action?list=log&orderBy=' . urlencode($cgi->orderBy) . '&sort=' . urlencode($cgi->sort) . '&_type=' . urlencode($cgi->_type) . '&_user='******'&_range=' . urlencode($cgi->_range);
$pg->setData($res);
$pg->update();
loader_import('saf.Misc.TableHeader');
$headers = array(new TableHeader('ts', intl_get('Date/Time')), new TableHeader('type', intl_get('Type')), new TableHeader('user', intl_get('User')), new TableHeader('ip', intl_get('IP Address')), new TableHeader('message', intl_get('Message')));
loader_import('cms.Versioning.Rex');
loader_import('cms.Versioning.Facets');
$rex = new Rex(false);
$rex->bookmark = true;
$rex->facets['type'] = new rSelectFacet('type', array('display' => intl_get('Type'), 'type' => 'select'));
$rex->facets['type']->preserve = array('list', 'offset', 'orderBy', 'sort');
$rex->facets['type']->options = assocify(db_shift_array('select distinct type from sitellite_log where type != "" order by type asc'));
$rex->facets['type']->count = false;
$rex->facets['user'] = new rSelectFacet('user', array('display' => intl_get('User'), 'type' => 'select'));
$rex->facets['user']->preserve = array('list', 'offset', 'orderBy', 'sort');
$rex->facets['user']->options = assocify(db_shift_array('select distinct user from sitellite_log where user != "" order by user asc'));
$rex->facets['user']->count = false;
$rex->facets['range'] = new rSelectFacet('range', array('display' => intl_get('Date Range'), 'type' => 'select'));
$rex->facets['range']->preserve = array('list', 'offset', 'orderBy', 'sort');
$rex->facets['range']->options = array('day' => intl_get('Day'), 'week' => intl_get('Week'), 'month' => intl_get('Month'), 'year' => intl_get('Year'));
$rex->facets['range']->count = false;
$rex->facets['range']->all = false;
echo '<p style="clear: both">' . $rex->renderFacets() . '</p>';
function usradm_filter_stats_date($date)
{
    global $cgi;
    return Date::format($date, appconf('date_format_' . $cgi->_range));
}
echo template_simple('<p>
<table border="0" cellpadding="3" cellspacing="0" width="100%">
	<tr>
コード例 #20
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 function onSubmit($vals)
 {
     if ($vals['below_page'] == $vals['id']) {
         $this->invalid_field = 'below_page';
         $this->invalid['below_page'] = intl_getf('You cannot set this page to be a child of itself.');
         return $this->show();
     }
     loader_box('sitellite/nav/init');
     if (menu_is_child_of($vals['below_page'], $vals['id'])) {
         $this->invalid_field = 'below_page';
         $this->invalid['below_page'] = intl_getf('You cannot set this page to be a child of one of its own child pages.');
         return $this->show();
     }
     loader_import('cms.Versioning.Rex');
     $collection = $vals['_collection'];
     unset($vals['_collection']);
     if (empty($collection)) {
         $collection = 'sitellite_page';
     }
     $rex = new Rex($collection);
     // default: database, database
     unset($vals['submit_button']);
     unset($vals['tab1']);
     unset($vals['tab2']);
     unset($vals['tab3']);
     unset($vals['tab-end']);
     unset($vals['section1']);
     unset($vals['section3']);
     $key = $vals['_key'];
     unset($vals['_key']);
     $return = $vals['_return'];
     unset($vals['_return']);
     $changelog = $vals['changelog'];
     unset($vals['changelog']);
     $method = $rex->determineAction($key, $vals['sitellite_status']);
     if (!$method) {
         die($rex->error);
     }
     $res = $rex->{$method}($key, $vals, $changelog);
     // remove lock when editing is finished
     lock_remove($collection, $key);
     if ($key != $vals[$rex->key]) {
         if ($return == site_prefix() . '/index/' . $key || $return == site_prefix() . '/' . $key) {
             $return = '';
         }
     }
     if (!$res) {
         if (empty($return)) {
             $return = site_prefix() . '/index/' . $key;
         }
         echo loader_box('cms/error', array('message' => $rex->error, 'collection' => $collection, 'key' => $key, 'action' => $method, 'data' => $vals, 'changelog' => $changelog, 'return' => $return));
     } else {
         foreach (db_shift_array('select id from sitellite_page where below_page = ?', $key) as $child) {
             $method = $rex->determineAction($key);
             if (!$method) {
                 die($rex->error);
             }
             $rex->{$method}($child, array('below_page' => $vals['id']), 'Updating renamed parent reference');
         }
         loader_import('cms.Workflow');
         echo Workflow::trigger('edit', array('collection' => $collection, 'key' => $key, 'action' => $method, 'data' => $vals, 'changelog' => $changelog, 'message' => 'Collection: ' . $collection . ', Item: ' . $key));
         session_set('sitellite_alert', intl_get('Your item has been saved.'));
         if ($key != $vals[$rex->key]) {
             if ($return == site_prefix() . '/index/' . $key || $return == site_prefix() . '/' . $key) {
                 $return = '';
             }
         }
         if (!empty($return)) {
             header('Location: ' . $return);
             exit;
         }
         header('Location: ' . site_prefix() . '/index/' . $vals[$rex->key]);
         exit;
     }
 }
コード例 #21
0
ファイル: Facets.php プロジェクト: vojtajina/sitellite
 function getCondition()
 {
     global $cgi;
     if (!$cgi->{'_' . $this->field}) {
         return false;
     }
     $ids = db_shift_array(sprintf('select %s from %s where %s = ?', $this->join_main_key, $this->join_table, $this->join_foreign_key), $cgi->{'_' . $this->field});
     return new rList($this->pkey, $ids);
 }
コード例 #22
0
ファイル: index.php プロジェクト: vojtajina/sitellite
<ul>
<?php 
loader_import('siteblog.Filters');
$res = db_shift_array('select extract(YEAR_MONTH FROM created) as d from siteblog_post group by d order by d desc limit 10');
$months = array('01' => intl_get('January'), '02' => intl_get('February'), '03' => intl_get('March'), '04' => intl_get('April'), '05' => intl_get('May'), '06' => intl_get('June'), '07' => intl_get('July'), '08' => intl_get('August'), '09' => intl_get('September'), '10' => intl_get('October'), '11' => intl_get('November'), '12' => intl_get('December'));
foreach ($res as $d) {
    echo '<li><a href="' . site_prefix() . '/index/siteblog-archive-action/d.' . $d . '">' . siteblog_filter_archive_date($d) . '</a></li>';
}
?>
</ul>
コード例 #23
0
ファイル: index.php プロジェクト: vojtajina/sitellite
<?php

page_title(intl_get('Search'));
loader_import('saf.Misc.Search');
loader_import('sitewiki.Filters');
global $cgi;
$q = search_split_query($cgi->query);
$j = ' ';
$w = '(';
$b = array();
foreach ($q as $term) {
    $w .= $j . 'body like ?';
    $b[] = '%' . $term . '%';
    $j = ' AND ';
}
$w .= ')';
$res = db_shift_array('select id from sitewiki_page where ' . $w, $b);
if (count($res) == 0) {
    echo template_simple('nav.spt', new StdClass());
    echo '<p>0 results for "' . $cgi->query . '"</p>';
    return;
} elseif (count($res) == 1) {
    header('Location: ' . site_prefix() . '/index/sitewiki-app/show.' . $res[0]);
    exit;
}
echo template_simple('search.spt', (object) array('total' => count($res), 'query' => $cgi->query, 'list' => $res, 'screen' => 'search'));
コード例 #24
0
ファイル: index.php プロジェクト: vojtajina/sitellite
}
if ($box['context'] == 'action') {
    if (!isset($parameters['category']) || $parameters['category'] == '') {
        page_title(intl_get('Presentations'));
        $parameters['category'] = '';
    } else {
        page_title(intl_get('Presentations') . ': ' . $parameters['category']);
    }
    $presentations = db_fetch_array('select * from sitepresenter_presentation where category = ? and ' . $allowed . ' order by ts desc ' . $limit, $parameters['category']);
} else {
    if (!isset($parameters['category']) || $parameters['category'] == '') {
        $presentations = db_fetch_array('select id, title, ts, sitellite_status, sitellite_access, sitellite_team from sitepresenter_presentation where ' . $allowed . ' order by ts desc ' . $limit);
    } else {
        $presentations = db_fetch_array('select id, title, ts, sitellite_status, sitellite_access, sitellite_team from sitepresenter_presentation where category = ? and ' . $allowed . ' order by ts desc ' . $limit, $parameters['category']);
    }
}
loader_import('saf.Date');
foreach (array_keys($presentations) as $key) {
    $presentations[$key]->fmdate = Date::format($presentations[$key]->ts, 'M j, Y');
}
$action = $box['context'] == 'action' ? true : false;
if ($action) {
    $categories = db_shift_array('select distinct category from sitepresenter_presentation where category != "" order by category asc');
    if (count($categories) == 0) {
        $categories = false;
    }
} else {
    $categories = false;
}
loader_import('sitepresenter.Filters');
echo template_simple('list.spt', array('action' => $action, 'list' => $presentations, 'categories' => $categories, 'category' => $parameters['category']));
コード例 #25
0
ファイル: index.php プロジェクト: vojtajina/sitellite
<?php

$res = db_shift_array('select distinct category from sitellite_news order by date desc limit 6');
$list = array();
$sub = array();
foreach ($res as $key) {
    $res = db_fetch_array('select * from sitellite_news where category = ? order by date desc limit 3', $key);
    $list[$key] = array_shift($res);
    $sub[$key] = $res;
}
loader_import('news.Functions');
page_title(intl_get('Latest Articles'));
echo template_simple('overview.spt', array('list' => $list, 'sub' => $sub));
コード例 #26
0
ファイル: index.php プロジェクト: vojtajina/sitellite
<?php

global $cgi;
if (!$cgi->format) {
    $cgi->format = 'sql';
}
if (is_array($cgi->table)) {
    $tables = $cgi->table;
} elseif (!empty($cgi->table)) {
    $tables = array($cgi->table);
} else {
    $tables = db_shift_array('show tables');
}
if (count($tables) == 1) {
    $fn = $tables[0];
} else {
    $fn = conf('Database', 'database');
}
//info ($tables);
//exit;
set_time_limit(0);
header('Cache-control: private');
header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename=' . $fn . '-' . date('Y-m-d') . '.' . $cgi->format);
foreach ($tables as $table) {
    if ($cgi->format == 'csv') {
        echo '----- table: ' . $table . " -----\n";
        $q = db_query('select * from ' . $table);
        $q->execute();
        $headers = false;
        while ($row = $q->fetch()) {
コード例 #27
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 * - modify: Ordinary modifications (source and store)
 * - replace: A change was approved, overwriting the live version
 * - republish: A change was made as a draft, requiring approval
 * - update: Update to a draft that was republished
 */
// note that changes to ID or file name take effect right away, even though
// the rest of the changes to the document require approval.
loader_import('cms.Versioning.Rex');
if ($parameters['collection'] == 'sitellite_page') {
    $ids = db_shift_array('select id from sitellite_page where body like ?', '%/' . $parameters['key'] . '"%');
    $rex = new Rex('sitellite_page');
    foreach ($ids as $id) {
        $c = $rex->getCurrent($id);
        if (is_object($c)) {
            $c->body = str_replace('/' . $parameters['key'] . '"', '/' . $parameters['data']['id'] . '"', $c->body);
            $method = $rex->determineAction($id, $c->sitellite_status);
            $rex->{$method}($id, (array) $c, 'A page linked to in this page was renamed, updating link.');
        }
    }
} elseif ($parameters['collection'] == 'sitellite_filesystem') {
    $ids = db_shift_array('select id from sitellite_page where body like ?', '%/' . $parameters['key'] . '"%');
    $rex = new Rex('sitellite_page');
    foreach ($ids as $id) {
        $c = $rex->getCurrent($id);
        if (is_object($c)) {
            $c->body = str_replace('/' . $parameters['key'] . '"', '/' . $parameters['data']['name'] . '"', $c->body);
            $method = $rex->determineAction($id, $c->sitellite_status);
            $rex->{$method}($id, (array) $c, 'A file linked to in this page was renamed, updating link.');
        }
    }
}
コード例 #28
0
ファイル: index.php プロジェクト: vojtajina/sitellite
<?php

page_title(intl_get('All Pages'));
$data = new StdClass();
$data->all = db_shift_array('select distinct id from sitewiki_page where id != "" order by id asc');
$bodies = db_pairs('select id, body from sitewiki_page where body regexp "(([A-Z][a-z0-9]+){2,})"');
$data->wanted = array();
foreach ($bodies as $id => $body) {
    preg_match_all('/(([A-Z][a-z0-9]+){2,})/s', $body, $regs, PREG_SET_ORDER);
    foreach ($regs as $reg) {
        if (!in_array($reg[1], $data->all) && !in_array($reg[1], $data->wanted)) {
            $data->wanted[$reg[1]] = $id;
        }
    }
}
ksort($data->wanted);
$data->screen = 'all';
loader_import('sitewiki.Filters');
echo template_simple('all.spt', $data);
コード例 #29
0
ファイル: index.php プロジェクト: vojtajina/sitellite
        } elseif ($rid > $res->revision) {
            $res->forward++;
            if ($res->next == 0 || $rid < $res->next) {
                $res->next = $rid;
            }
        }
    }
    if ($res->forward == 0) {
        $res->rollback = false;
        $res->editable = $level >= $res->edit_level ? true : false;
    }
} else {
    $res->revision = false;
    $res->editable = $level >= $res->edit_level ? true : false;
    $res->back = db_shift('select count(*) from sitewiki_page_sv where id = ?', $res->id);
    $res->back--;
    $res->prev = db_shift('select sv_autoid from sitewiki_page_sv where id = ? order by sv_autoid desc limit 1, 1', $res->id);
    $res->forward = 0;
    $res->next = false;
}
$res->linked_from = db_shift_array('select id from sitewiki_page where body like "%' . $res->id . '%" and id != ?', $res->id);
$res->files = db_fetch_array('select * from sitewiki_file where page_id = ? order by name asc', $res->id);
foreach (array_keys($res->files) as $k) {
    $res->files[$k]->size = filesize('inc/app/sitewiki/data/' . $res->id . '_' . $res->files[$k]->id);
}
loader_import('sitewiki.Filters');
loader_import('saf.Misc.RPC');
page_title(sitewiki_filter_id($res->id));
echo template_simple('page.spt', $res);
echo rpc_init();
//info ($res, true);
コード例 #30
0
ファイル: Story.php プロジェクト: vojtajina/sitellite
 function getCategories()
 {
     $res1 = array('' => '- SELECT -');
     $res2 = assocify(db_shift_array('select distinct name from sitellite_news_category where name != "" order by name asc'));
     return array_merge($res1, $res2);
 }