function DisplayErrorPage(&$mod, &$smarty, &$db, &$params, $err = TRUE, $message = '') { if ($err) { $smarty->assign('title', $mod->Lang('err_system')); } if (!empty($params['bracket_id'])) { $sql = "SELECT name FROM " . cms_db_prefix() . "module_tmt_brackets WHERE bracket_id=?"; $name = $db->GetOne($sql, array($params['alias'])); } elseif (!empty($params['alias'])) { $sql = "SELECT name FROM " . cms_db_prefix() . "module_tmt_brackets WHERE alias=?"; $name = $db->GetOne($sql, array($params['alias'])); } else { $name = false; } if ($name) { $smarty->assign('name', $mod->Lang('tournament') . ': ' . $name); } if ($message) { $detail = $message; if ($err) { $detail .= '<br /><br />' . $mod->Lang('telladmin'); } } else { $detail = ''; } $smarty->assign('message', $detail); echo $mod->ProcessTemplate('error.tpl'); }
function GetFieldInput($id, &$params, $returnid) { $mod = $this->form_ptr->module_ptr; if ($this->Value !== false) { $ret = $mod->CreateInputHidden($id, 'fbrp__' . $this->Id, $this->Value); if ($this->GetOption('show_to_user', '0') == '1') { $ret .= $this->Value; } } else { if ($this->GetOption('use_random_generator', '0') == '1') { $times = $this->GetOption('numbers_to_generate', '5') ? $this->GetOption('numbers_to_generate', '5') : 5; $number = $this->generate_numbers(0, 9, $times); $ret = $mod->CreateInputHidden($id, 'fbrp__' . $this->Id, $number); if ($this->GetOption('show_to_user', '0') == '1') { $ret .= $number; } } else { $db = $mod->dbHandle; $seq = $db->GenID(cms_db_prefix() . 'module_fb_uniquefield_seq'); $ret = $mod->CreateInputHidden($id, 'fbrp__' . $this->Id, $seq); if ($this->GetOption('show_to_user', '0') == '1') { $ret .= $seq; } } } return $ret; }
function smarty_function_recently_updated($params, &$template) { $smarty = $template->smarty; if (empty($params['number'])) { $number = 10; } else { $number = $params['number']; } if (empty($params['leadin'])) { $leadin = "Modified: "; } else { $leadin = $params['leadin']; } if (empty($params['showtitle'])) { $showtitle = 'true'; } else { $showtitle = $params['showtitle']; } $dateformat = isset($params['dateformat']) ? $params['dateformat'] : "d.m.y h:m"; $css_class = isset($params['css_class']) ? $params['css_class'] : ""; if (isset($params['css_class'])) { $output = '<div class="' . $css_class . '"><ul>'; } else { $output = '<ul>'; } $gCms = cmsms(); $hm = $gCms->GetHierarchyManager(); $db = $gCms->GetDb(); // Get list of most recently updated pages excluding the home page $q = "SELECT * FROM " . cms_db_prefix() . "content WHERE (type='content' OR type='link')\nAND default_content != 1 AND active = 1 AND show_in_menu = 1 \nORDER BY modified_date DESC LIMIT " . (int) $number; $dbresult = $db->Execute($q); if (!$dbresult) { echo 'DB error: ' . $db->ErrorMsg() . "<br/>"; } while ($dbresult && ($updated_page = $dbresult->FetchRow())) { $curnode = $hm->getNodeById($updated_page['content_id']); $curcontent =& $curnode->GetContent(); $output .= '<li>'; $output .= '<a href="' . $curcontent->GetURL() . '">' . $updated_page['content_name'] . '</a>'; if (FALSE == empty($updated_page['titleattribute']) && $showtitle == 'true') { $output .= '<br />'; $output .= $updated_page['titleattribute']; } $output .= '<br />'; $output .= $leadin; $output .= date($dateformat, strtotime($updated_page['modified_date'])); $output .= '</li>'; } $output .= '</ul>'; if (isset($params['css_class'])) { $output .= '</div>'; } if (isset($params['assign'])) { $smarty->assign(trim($params['assign']), $output); return; } return $output; }
function __construct() { parent::__construct(); $this->AddImageDir('images'); $this->categories_table_name = cms_db_prefix() . 'module_cgcalendar_categories'; $this->events_to_categories_table_name = cms_db_prefix() . 'module_cgcalendar_events_to_categories'; $this->events_table_name = cms_db_prefix() . 'module_cgcalendar_events'; $this->event_field_values_table_name = cms_db_prefix() . 'module_cgcalendar_event_field_values'; $this->fields_table_name = cms_db_prefix() . 'module_cgcalendar_fields'; $this->admin_tools_loaded = false; }
protected function fetch($name, &$source, &$mtime) { debug_buffer('', 'CMSModuleDbTemplateResource start' . $name); $db = cmsms()->GetDb(); $tmp = explode(';', $name); $query = "SELECT * from " . cms_db_prefix() . "module_templates WHERE module_name = ? and template_name = ?"; $row = $db->GetRow($query, preg_split('/;/', $name)); if ($row) { $source = $row['content']; $mtime = $db->UnixTimeStamp($row['modified_date']); } debug_buffer('', 'CMSModuleDbTemplateResource end' . $name); }
/** DeleteBracket: @mod: reference to Tourney module object @bracket_id: single bracket identifier, or array of them */ function DeleteBracket(&$mod, $bracket_id) { $db = cmsms()->GetDb(); $pref = cms_db_prefix(); if (!is_array($bracket_id)) { $bracket_id = array($bracket_id); } foreach ($bracket_id as $bid) { $sql = 'SELECT chartcss FROM ' . $pref . 'module_tmt_brackets WHERE bracket_id=?'; $file = $db->GetOne($sql, array($bid)); if ($file) { $sql = 'SELECT COUNT(*) AS sharers FROM ' . $pref . 'module_tmt_brackets WHERE chartcss=?'; $num = $db->GetOne($sql, array($file)); if ($num < 2) { if ($mod->GetPreference('uploads_dir')) { $path = cms_join_path($config['uploads_path'], $mod->GetPreference('uploads_dir'), $file); } else { $path = cms_join_path($config['uploads_path'], $file); } if (is_file($path)) { unlink($path); } } } $file = $mod->ChartImageFile($bid); if ($file) { unlink($file); } $sql = 'DELETE FROM ' . $pref . 'module_tmt_tweet WHERE bracket_id=?'; $db->Execute($sql, array($bid)); $sql = 'DELETE FROM ' . $pref . 'module_tmt_people WHERE id IN (SELECT team_id FROM ' . $pref . 'module_tmt_teams WHERE bracket_id=?)'; $db->Execute($sql, array($bid)); $sql = 'DELETE FROM ' . $pref . 'module_tmt_teams WHERE bracket_id=?'; $db->Execute($sql, array($bid)); $sql = 'DELETE FROM ' . $pref . 'module_tmt_matches WHERE bracket_id=?'; $db->Execute($sql, array($bid)); $sql = 'DELETE FROM ' . $pref . 'module_tmt_brackets WHERE bracket_id=?'; $db->Execute($sql, array($bid)); $bid = $params['bracket_id']; $mod->DeleteTemplate('mailout_' . $bid . '_template'); $mod->DeleteTemplate('mailcancel_' . $bid . '_template'); $mod->DeleteTemplate('mailrequest_' . $bid . '_template'); $mod->DeleteTemplate('mailin_' . $bid . '_template'); $mod->DeleteTemplate('tweetout_' . $bid . '_template'); $mod->DeleteTemplate('tweetcancel_' . $bid . '_template'); $mod->DeleteTemplate('tweetrequest_' . $bid . '_template'); $mod->DeleteTemplate('tweetin_' . $bid . '_template'); $mod->DeleteTemplate('chart_' . $bid . '_template'); } }
function preContent(&$db) { $test = new StdClass(); $test->error = false; $test->messages = array(); $db->SetFetchMode(ADODB_FETCH_ASSOC); $current_version = 1; $query = "SELECT version from " . cms_db_prefix() . "version"; $dbresult = $db->Execute($query); if (!$dbresult) { $test->messages[] = ilang('invalid_query', $query); $test->error = true; } else { while ($row = $dbresult->FetchRow()) { $current_version = $row["version"]; } if ($current_version == 1) { $test->messages[] = ilang('empty_query', $query); $test->error = true; } } if (!$test->error && $current_version < CMS_SCHEMA_VERSION) { $test->messages[] = ilang('need_upgrade_schema', $current_version, CMS_SCHEMA_VERSION); while ($current_version < CMS_SCHEMA_VERSION) { $filename = cms_join_path(CMS_INSTALL_BASE, 'upgrades', "upgrade.{$current_version}.to." . ($current_version + 1) . '.php'); if (file_exists($filename)) { if ($this->debug) { include $filename; } else { @(include $filename); } } else { $test->messages[] = ilang('nofiles') . ": {$filename}"; } $current_version++; } $test->messages[] = ilang('schema_ok', $current_version); } elseif (!$test->error) { $test->messages[] = ilang('noneed_upgrade_schema', CMS_SCHEMA_VERSION); } if (isset($_SESSION['disable_hierarchy'])) { // gotta move the hierarchy stuff $query = 'UPDATE ' . cms_db_prefix() . 'content SET page_url = content_alias'; $db->Execute($query); set_site_preference('content_autocreate_urls', 1); set_site_preference('content_autocreate_flaturls', 1); $test->messages[] = ilang('setup_flat_urls'); unset($_SESSION['disable_hierarchy']); } $this->smarty->assign('test', $test); }
public function execute($time = '') { if (!$time) { $time = time(); } // do the task. $lifetime = (int) get_site_preference(self::LIFETIME_SITEPREF, 60 * 60 * 24 * 31); $db = cmsms()->GetDB(); $q = "DELETE FROM " . cms_db_prefix() . "adminlog WHERE timestamp<?"; $p = array(time() - $lifetime); $dbresult = $db->Execute($q, $p); //$gCms->clear_cached_files($age_days); return TRUE; }
function OrderTeamMembers(&$db, $tid) { $pref = cms_db_prefix(); $sql = 'SELECT * FROM ' . $pref . 'module_tmt_people WHERE id=? AND flags!=2 ORDER BY displayorder'; $rows = $db->GetAll($sql, array($tid)); if ($rows) { //to avoid overwrites,in the first pass stored orders are < 0,-1-based $tmporder = -1; $sql = 'UPDATE ' . $pref . 'module_tmt_people SET displayorder=? WHERE id=? AND displayorder=?'; foreach ($rows as &$row) { $db->Execute($sql, array($tmporder, $tid, $row['displayorder'])); $row['displayorder'] = -$tmporder; $tmporder--; $row['id'] = (int) $row['id']; //cleanups $row['flags'] = (int) $row['flags']; } unset($row); $sql = 'UPDATE ' . $pref . 'module_tmt_people SET displayorder=-displayorder WHERE id=?'; $db->Execute($sql, array($tid)); } return $rows; }
<?php echo '<p>Adding stylesheet association ordering capability... '; $dbdict = NewDataDictionary($db); $sqlarray = $dbdict->AddColumnSQL(cms_db_prefix() . 'css_assoc', 'assoc_order I'); $dbdict->ExecuteSQLArray($sqlarray); // Now update the values $query = 'SELECT assoc_to_id, assoc_css_id FROM ' . cms_db_prefix() . 'css_assoc ORDER BY assoc_to_id, assoc_css_id'; $allrows = $db->GetArray($query); $assoc_to_id = -1; foreach ($allrows as $row) { if ($assoc_to_id != $row['assoc_to_id']) { $ord = 1; $assoc_to_id = $row['assoc_to_id']; } $q2 = 'UPDATE ' . cms_db_prefix() . 'css_assoc SET assoc_order = ? WHERE assoc_to_id = ? AND assoc_css_id = ?'; $db->Execute($q2, array($ord, $row['assoc_to_id'], $row['assoc_css_id'])); $ord++; } echo '[done]</p>'; echo '<p>Updating schema version... '; $query = "UPDATE " . cms_db_prefix() . "version SET version = 30"; $db->Execute($query); echo '[done]</p>';
<?php /* This file is part of CMS Made Simple module: Tourney. Copyright (C) 2014-2015 Tom Phane <*****@*****.**> Refer to licence and other details at the top of file Tourney.module.php More info at http://dev.cmsmadesimple.org/projects/tourney */ if (!$this->CheckAccess('admin')) { return $this->Lang('lackpermission'); } $pref = cms_db_prefix(); $taboptarray = array('mysql' => 'ENGINE MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci', 'mysqli' => 'ENGINE MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci'); $dict = NewDataDictionary($db); switch ($oldversion) { case '0.1.0': case '0.1.1': $rel = $this->GetPreference('uploads_dir'); if (!$rel) { $this->SetPreference('uploads_dir', $this->GetName()); } $this->SetPreference('phone_regex', '^(\\+|\\d)[0-9]{7,16}$'); $flds = "\n\ttype I(1) DEFAULT " . Tourney::KOTYPE . ",\n\tmatch_days C(256),\n\tplaygap N(6.2),\n\tplaygaptype I(1) DEFAULT 2,\n\tplacegap N(6.2),\n\tplacegaptype I(1) DEFAULT 2\n"; $sql = $dict->AlterColumnSQL($pref . 'module_tmt_brackets', $flds); if (!$dict->ExecuteSQLArray($sql)) { $msg = $this->Lang('err_upgrade', 'change fields'); $this->Audit(0, $this->Lang('friendlyname'), $msg); return $msg; } $flds = "\n\tadmin_editgroup,\n\tmatch_hours,\n"; $sql = $dict->DropColumnSQL($pref . 'module_tmt_brackets', $flds);
/** * Grab URLs from the content table and register them with the route manager. * * @since 1.9 * @author Robert Campbell <*****@*****.**> * @internal * @access private */ public function register_routes() { $gCms = cmsms(); $db = $gCms->GetDb(); $query = 'SELECT content_id,page_url FROM ' . cms_db_prefix() . 'content WHERE active = 1 AND default_content = 0 AND page_url != \'\''; $data = $db->GetArray($query); if (is_array($data)) { foreach ($data as $onerow) { $route = new CmsRoute($onerow['page_url'], $onerow['content_id'], '', TRUE); cms_route_manager::register($route); } } }
<?php if (!isset($gCms)) { exit; } // Typical Database Initialization $db =& $this->cms->db; $dict = NewDataDictionary($db); $sqlarray = $dict->DropTableSQL(cms_db_prefix() . "module_attach_attachments"); $dict->ExecuteSQLArray($sqlarray); $db->DropSequence(cms_db_prefix() . "module_attach_attachments_seq"); $sqlarray = $dict->DropTableSQL(cms_db_prefix() . "module_attach_restypes"); $dict->ExecuteSQLArray($sqlarray); $db->DropSequence(cms_db_prefix() . "module_attach_restypes_seq"); $this->DeleteTemplate("", $this->GetName()); $this->RemovePreference(); // permissions $this->RemovePermission("attach_use"); $this->RemovePermission("attach_admin"); // put mention into the admin log $this->Audit(0, $this->Lang("friendlyname"), $this->Lang("uninstalled"));
if (!isset($gCms)) { exit; } $this->CheckPermission('dummy permission'); //Redirect if not logged in if (isset($params['reindex'])) { $this->Reindex(); echo '<div class="pagemcontainer"><p class="pagemessage">' . $this->Lang('reindexcomplete') . '</p></div>'; } else { if (isset($params['clearwordcount'])) { $query = 'DELETE FROM ' . cms_db_prefix() . 'module_search_words'; $db->Execute($query); } else { if (isset($params['exportcsv'])) { $query = 'SELECT * FROM ' . cms_db_prefix() . 'module_search_words ORDER BY count DESC'; $data = $db->GetArray($query); if (is_array($data)) { header('Content-Description: File Transfer'); header('Content-Type: application/force-download'); header('Content-Disposition: attachment; filename=search.csv'); while (@ob_end_clean()) { } $output = ''; for ($i = 0; $i < count($data); $i++) { $output .= "\"{$data[$i]['word']}\",{$data[$i]['count']}\n"; } echo $output; exit; } } else {
//end switch $smarty->assign('message', $this->Lang('addslides_bulksuccess')); } //end if $params['imgselect'] } // end is multiactionsubmit $navigation = $this->CreateLink($id, 'addpicture', $returnid, '<img src="../modules/Showtime/images/add_picture.png" class="systemicon">', array('showid' => $showid), '', false, false, '') . ' ' . $this->CreateLink($id, 'addpicture', $returnid, $this->Lang('addpicture'), array('showid' => $showid), '', false, false, 'class="pageoptions"'); $navigation .= " "; $navigation .= $this->CreateLink($id, 'editshow', $returnid, '<img src="../modules/Showtime/images/showoptions.gif" class="systemicon">', array('showid' => $showid), '', false, true, '') . ' ' . $this->CreateLink($id, 'editshow', $returnid, $this->Lang('EditShow'), array('showid' => $showid), '', false, true, ''); $navigation .= " "; $navigation .= $this->CreateLink($id, 'defaultadmin', $returnid, '<img src="../modules/Showtime/images/edit_show.png" class="systemicon">', array('showid' => $showid), '', false, false, '') . ' ' . $this->CreateLink($id, 'defaultadmin', $returnid, $this->Lang('back_to_admin'), array('showid' => $showid), '', false, false, 'class="pageoptions"'); $navigation .= ' <strong>Slidehow ' . $showid . ' (' . $showname . ')</strong>'; $this->smarty->assign('navigation', $navigation); $counter = 0; $entryarray = array(); $sql = 'SELECT * FROM ' . cms_db_prefix() . 'module_showtime WHERE show_id=' . $showid . ' order by picture_number;'; $result = $db->Execute($sql); $picturenumber = $result->_numOfRows; if ($picturenumber > 0) { $this->smarty->assign('picturetable', 1); //print header if there are pictures $this->smarty->assign('L_picture', $this->Lang('picture')); $this->smarty->assign('L_order', $this->Lang('order')); $this->smarty->assign('L_picture_name', $this->Lang('picture_name')); $this->smarty->assign('L_picture_link', $this->Lang('picture_link')); $this->smarty->assign('L_picture_descriptioin', $this->Lang('picture_descriptioin')); $this->smarty->assign('L_change_picture', $this->Lang('change_picture')); $this->smarty->assign('L_status', $this->Lang('status')); $this->smarty->assign('L_edit_picture', $this->Lang('edit_picture')); while (!$result->EOF()) { $fields = $result->fields;
$templateprops = $this->_GetTemplateprops($params['template']); if ($params['mode'] == 'show') { $smarty->assign('formstart', $this->CreateFormStart($id, 'edittplabout', $returnid, 'post', '', false, '', array('template' => $params['template'], 'mode' => "edit"))); $smarty->assign('templatename', $params['template']); $smarty->assign('version', $templateprops['version']); $smarty->assign('about', $templateprops['about']); $smarty->assign('submit', $this->CreateInputSubmit($id, 'editbutton', $this->Lang('edit'))); } elseif ($params['mode'] == 'edit') { $smarty->assign('formstart', $this->CreateFormStart($id, 'edittplabout', $returnid, 'post', '', false, '', array('template' => $params['template'], 'mode' => "do_edit"))); $smarty->assign('templatename', $params['template']); $smarty->assign('version', $this->CreateInputText($id, 'version', $templateprops['version'], 10, 20)); $smarty->assign('about', $this->CreateTextArea(true, $id, $templateprops['about'], 'about', '', '', '', '', '80', '15')); $smarty->assign('submit', $this->CreateInputSubmit($id, 'submitbutton', $this->Lang('submit'))); } else { // do_edit $query = "UPDATE " . cms_db_prefix() . "module_gallery_templateprops\r\n\t\t\t\t\t\tSET version=?, about=?\r\n\t\t\t\t\t\tWHERE template=?"; $result = $db->Execute($query, array($params['version'], $params['about'], $params['template'])); if (!$result) { echo 'ERROR: ' . mysql_error(); exit; } $this->Redirect($id, 'edittplabout', '', array('template' => $params['template'], 'mode' => "show", 'module_message' => $this->Lang('templateupdated'))); exit; } $smarty->assign('title', $this->Lang('prompt_about')); $smarty->assign('prompt_templatename', $this->Lang('prompt_templatename')); $smarty->assign('prompt_version', $this->Lang('prompt_version')); $smarty->assign('prompt_about', $this->Lang('prompt_about')); $smarty->assign('cancel', $this->CreateInputSubmit($id, 'cancel', $this->Lang('cancel'))); $smarty->assign('formend', $this->CreateFormEnd()); echo $this->ProcessTemplate('edittplabout.tpl');
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Or read it online: http: //www.gnu.org/licenses/licenses.html#GPL # #------------------------------------------------------------------------- if (!isset($gCms)) { exit; } if (!isset($params['upload_id'])) { return; } $upload_id = (int) $params['upload_id']; // 1. get the upload info $query = 'SELECT upload_category_id FROM ' . cms_db_prefix() . 'module_uploads WHERE upload_id = ?'; $category_id = $db->GetOne($query, array($upload_id)); if (!$category_id) { return; } // 2. get the category $query = 'SELECT upload_category_deletable FROM ' . cms_db_prefix() . 'module_uploads_categories WHERE upload_category_id = ?'; $deletable = $db->GetOne($query, array($category_id)); // 2. check if we can delete if (!$this->GetPreference('allow_delete', 0) == 1 || !$deletable) { $this->RedirectContent($returnid); } $this->_AdminDoDeleteUpload($upload_id, $params, $returnid, 0); $this->RedirectContent($returnid); // # # EOF #
$smarty->assign('input_notified', $this->CreateInputCheckbox($id, 'notified', 'true', $commentinfo['notified'] ? 'true' : 'false')); $smarty->assign('prompt_ip', $this->Lang('ip')); $smarty->assign('input_ip', $this->CreateInputText($id, 'ip', $commentinfo['ip'], 25, 25)); // Display Template echo $this->ProcessTemplate('admin_editcomment.tpl'); } else { // Set vars and images $imagenostandard = $gCms->variables['admintheme']->DisplayImage('icons/system/false.gif', $this->Lang('makestandard'), '', '', 'systemicon'); $imageinactive = $gCms->variables['admintheme']->DisplayImage('icons/system/false.gif', $this->Lang('makeactive'), '', '', 'systemicon'); $imagestandard = $gCms->variables['admintheme']->DisplayImage('icons/system/true.gif', $this->Lang('standard'), '', '', 'systemicon'); $imageactive = $gCms->variables['admintheme']->DisplayImage('icons/system/true.gif', $this->Lang('makeinactive'), '', '', 'systemicon'); $imageedit = $gCms->variables['admintheme']->DisplayImage('icons/system/edit.gif', $this->Lang('edit'), '', '', 'systemicon'); $imagedelete = $gCms->variables['admintheme']->DisplayImage('icons/system/delete.gif', $this->Lang('delete'), '', '', 'systemicon'); $imagenew = $gCms->variables['admintheme']->DisplayImage('icons/system/newobject.gif', $this->Lang('newtemplate'), '', '', 'systemicon'); // Get comments $allcomments = $db->GetAll('SELECT comment_id id,comment_title,comment_data,comment_author,comment_date,active,trackback,editor,create_date,modified_date FROM ' . cms_db_prefix() . 'module_acomments ORDER BY comment_date DESC'); if (!is_array($allcomments)) { $allcomments = array(); } // Show domain $rowarray = array(); $rowclass = 'row1'; foreach ($allcomments as $c) { // Build a new row $row = new StdClass(); $row->rowclass = $rowclass; // ID $row->id = $c['id']; // Build comment with edit link $row->comment = trim(strip_tags($c['comment_title'])); if (!$row->comment) {
if (!isset($gCms)) { exit; } // CreateFormStart sets up a proper form tag that will cause the submit to // return control to this module for processing. $smarty->assign('startform', $this->CreateFormStart($id, 'updateoptions', $returnid)); $smarty->assign('endform', $this->CreateFormEnd()); $smarty->assign('title_formsubmit_emailaddress', $this->Lang('formsubmit_emailaddress')); $smarty->assign('input_formsubmit_emailaddress', $this->CreateInputText($id, 'formsubmit_emailaddress', $this->GetPreference('formsubmit_emailaddress', ''), 50, 255)); $smarty->assign('title_email_subject', $this->Lang('email_subject')); $smarty->assign('input_email_subject', $this->CreateInputText($id, 'email_subject', $this->GetPreference('email_subject', ''), 50, 255)); $smarty->assign('title_email_template', $this->Lang('email_template')); $smarty->assign('input_email_template', $this->CreateTextArea(false, $id, $this->GetTemplate('email_template'), 'email_template')); $categorylist = array(); $query = "SELECT * FROM " . cms_db_prefix() . "module_news_categories ORDER BY hierarchy"; $dbresult = $db->Execute($query); while ($dbresult && ($row = $dbresult->FetchRow())) { $categorylist[$row['long_name']] = $row['news_category_id']; } $smarty->assign('title_default_category', $this->Lang('default_category')); $smarty->assign('input_default_category', $this->CreateInputDropdown($id, 'default_category', $categorylist, -1, $this->GetPreference('default_category', ''))); $smarty->assign('title_allowed_upload_types', $this->Lang('allowed_upload_types')); $smarty->assign('input_allowed_upload_types', $this->CreateInputText($id, 'allowed_upload_types', $this->GetPreference('allowed_upload_types', ''), 50)); $smarty->assign('title_auto_create_thumbnails', $this->Lang('auto_create_thumbnails')); $smarty->assign('submit', $this->CreateInputSubmit($id, 'optionssubmitbutton', $this->Lang('submit'))); $smarty->assign('title_hide_summary_field', $this->Lang('hide_summary_field')); $smarty->assign('input_hide_summary_field', $this->CreateInputCheckbox($id, 'hide_summary_field', '1', $this->GetPreference('hide_summary_field', '0'))); $smarty->assign('title_allow_summary_wysiwyg', $this->Lang('allow_summary_wysiwyg')); $smarty->assign('input_allow_summary_wysiwyg', $this->CreateInputCheckbox($id, 'allow_summary_wysiwyg', '1', $this->GetPreference('allow_summary_wysiwyg', 1))); $smarty->assign('title_expiry_interval', $this->Lang('expiry_interval'));
# This project's homepage is: http://www.cmsmadesimple.org # #------------------------------------------------------------------------- # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Or read it online: http: //www.gnu.org/licenses/licenses.html#GPL # #------------------------------------------------------------------------- #------------------------------------------------------------------------- if (!$this->CheckPermission('Manage Uploads')) { return; } if (!isset($params['typeid'])) { $this->ShowErrors($this->Lang('error_missingparams')); } $typeid = trim($params['typeid']); $db =& $this->GetDb(); $db->Execute("DELETE FROM " . cms_db_prefix() . "module_uploads_filetypes \n WHERE id = ?", array($params['typeid'])); $this->Redirect($id, 'defaultadmin', $returnid, $params); // EOF
} $db =& $gCms->GetDb(); $taboptarray = array('mysql' => 'TYPE=MyISAM'); $dict = NewDataDictionary($db); // table schema description $flds = "\r\n\tshow_id I KEY,\r\n\tshow_name C(80),\r\n\tst_animationtype C(15),\r\n\tst_height I,\r\n\tst_width I,\r\n\tst_rotatetime F,\r\n\tst_transitiontime F,\r\n\tst_transition C(30),\r\n\tst_easeFunc C(30),\r\n\tst_ease C(30),\r\n\tst_autoplay I1,\r\n\tst_showcontrols I1,\r\n\tst_showcontrolssub I,\r\n\tst_textbgcolor C(10),\r\n\tst_showtext I1,\r\n\tst_showcomment I1,\r\n\tst_showalt I1,\r\n\tst_textcolor C(10),\r\n\tst_textsize I,\r\n\tst_titlesize I,\r\n\tst_fonttype C(50),\r\n\tst_bgcolor C(10),\r\n\tst_scale C(30),\r\n\tst_shuffle I1,\r\n\tst_wmode C(20),\r\n\tst_commentpos C(10),\r\n\tst_navbut I1,\r\n\tst_nav_bordercolor C(10),\r\n\tst_nav_bordersize I,\r\n\tst_nav_radius I,\r\n\tst_nav_bgcolor C(10),\r\n\tst_nav_bgactivecolor C(10),\r\n\tst_nav_textcolor C(10),\r\n\tst_nav_showtext I1,\r\n\tst_nav_size I,\r\n\tst_nav_pos C(20),\r\n\tst_nav_padding I,\r\n\tst_target C(15), \r\n\tst_link C(20)\r\n\t"; $sqlarray = $dict->CreateTableSQL(cms_db_prefix() . "module_showtime_name", $flds, $taboptarray); $dict->ExecuteSQLArray($sqlarray); // create a sequence $db->CreateSequence(cms_db_prefix() . "module_showtime_name_seq"); // table schema description $flds = "picture_id I KEY,\r\n\t\t\tactive I1 DEFAULT 1,\r\n\t\t\tshow_id I,\r\n\t\t\tpicture_name C(80),\r\n\t\t\tpicture_number I,\r\n\t\t\tpicture_url C(255),\r\n\t\t\tthumbnail_path C(255),\r\n\t\t\tpicture_path C(255),\r\n\t\t\tcomment X\r\n\t\t\t"; $sqlarray = $dict->CreateTableSQL(cms_db_prefix() . "module_showtime", $flds, $taboptarray); $dict->ExecuteSQLArray($sqlarray); // create a sequence $db->CreateSequence(cms_db_prefix() . "module_showtime_seq"); // create Prefenences $this->SetPreference("uploadmethode", 'swf'); $this->SetPreference("watermark_onoff", '0'); $this->SetPreference("watermark_file", 'watermark.png'); $this->SetPreference("watermark_pos", 'bottom_right'); $this->SetPreference("watermark_transparant", '70'); $this->SetPreference("watermark_padding_x", '10'); $this->SetPreference("watermark_padding_y", '10'); $this->SetPreference("load_jQuery_scripts", '1'); // create a permission $this->CreatePermission('Use Showtime', 'Use Showtime'); $this->CreatePermission('Use Showtime Prefs', 'Use Showtime Prefs'); // register an event $this->CreateEvent('OnShowtimePreferenceChange'); $this->AddEventHandler('Core', 'ContentPostRender', false);
} } } if (FALSE == empty($error)) { echo $themeObject->ShowErrors('<ul class="error">' . $error . '</ul>'); } ?> <div class="pagecontainer"> <div class="pageoverflow"> <?php $userid = get_userid(); $edit = check_permission($userid, 'Modify Users'); $remove = check_permission($userid, 'Remove Users'); $query = "SELECT user_id, username, active FROM " . cms_db_prefix() . "users ORDER BY user_id"; $result = $db->Execute($query); $userops = $gCms->GetUserOperations(); $userlist =& $userops->LoadUsers(); $page = 1; if (isset($_GET['page'])) { $page = $_GET['page']; } $limit = 20; if (count($userlist) > $limit) { echo "<p class=\"pageshowrows\">" . pagination($page, count($userlist), $limit) . "</p>"; } echo $themeObject->ShowHeader('currentusers') . '</div>'; if ($userlist && count($userlist) > 0) { echo "<table cellspacing=\"0\" class=\"pagetable\">\n"; echo '<thead>';
function getAttachments($where = array(), $admin = false, $id, $returnid, $types = false) { if (!is_array($types)) { $types = $this->getResTypes(); } global $gCms; $db =& $this->GetDb(); $wherestring = ''; $wherevalues = array(); $orderbytype = false; foreach ($where as $key => $value) { if ($key == "orderbytype" && $value) { $orderbytype = true; } elseif (is_array($value)) { $tmp = ''; foreach ($value as $oneval) { $tmp .= ($tmp == '' ? '' : ' OR ') . $key . '=?'; $wherevalues[] = $value; } $wherestring .= " AND (" . $tmp . ")"; } else { $wherestring .= " AND " . $key . "=?"; $wherevalues[] = $value; } } $query = "SELECT A.* FROM " . cms_db_prefix() . "module_attach_attachments A, " . cms_db_prefix() . "module_attach_restypes B WHERE A.desttype = B.typeid " . $wherestring . " ORDER BY " . ($orderbytype ? "B.typename" : "name"); $dbresult = $db->Execute($query, $wherevalues); $itemlist = array(); while ($dbresult && ($row = $dbresult->FetchRow())) { $item = new stdClass(); foreach ($row as $key => $value) { $item->{$key} = stripslashes($value); } $item->ressource_type = $types[$item->desttype]; $item = $this->getRessourceInfo($item, $types, $id, $returnid); if ($admin) { $item = $this->admin_getRessourceInfo($item, $types, $id, $returnid); } array_push($itemlist, $item); } return $itemlist; }
# end of if result if ($modify || $addasso) { # this var is used to store the css ids that should not appear in the # dropdown $notinto = ""; foreach ($csslist as $key) { $notinto .= "{$key},"; } $notinto = substr($notinto, 0, strlen($notinto) - 1); # this var contains the dropdown $dropdown = ""; # we generate the dropdown if ("" == $notinto) { $query = "SELECT * FROM " . cms_db_prefix() . "templates WHERE active = 1 ORDER BY template_name"; } else { $query = "SELECT * FROM " . cms_db_prefix() . "templates WHERE template_id NOT IN (" . $notinto . ") AND active = 1 ORDER BY template_name"; } $result = $db->Execute($query); if ($result && $result->RecordCount() > 0) { ?> <form action="addtemplateassoc.php" method="post"> <div> <input type="hidden" name="<?php echo CMS_SECURE_PARAM_NAME; ?> " value="<?php echo $_SESSION[CMS_USER_KEY]; ?> " /> </div> <div class="pageoverflow"><p class="pageoptions">
$group_id = $db->GetOne("SELECT group_id FROM " . cms_db_prefix() . "groups WHERE group_name = 'Editor'"); $count = $db->GetOne("SELECT count(*) FROM " . cms_db_prefix() . "group_perms WHERE group_id = ? AND permission_id = ?", array($group_id, $perm_id)); if (isset($count) && intval($count) == 0) { $new_id = $db->GenID(cms_db_prefix() . "group_perms_seq"); $query = "INSERT INTO " . cms_db_prefix() . "group_perms (group_perm_id, group_id, permission_id, create_date, modified_date) VALUES (" . $new_id . ", " . $group_id . ", " . $perm_id . ", " . $db->DBTimeStamp(time()) . ", " . $db->DBTimeStamp(time()) . ")"; $db->Execute($query); } # Indexes $sqlarray = $dict->CreateIndexSQL(cms_db_prefix() . 'news_postdate', cms_db_prefix() . 'module_news', 'news_date'); $dict->ExecuteSQLArray($sqlarray); $sqlarray = $dict->CreateIndexSQL(cms_db_prefix() . 'news_daterange', cms_db_prefix() . 'module_news', 'start_time,end_time'); $dict->ExecuteSQLArray($sqlarray); $sqlarray = $dict->CreateIndexSQL(cms_db_prefix() . 'news_author', cms_db_prefix() . 'module_news', 'author_id'); $dict->ExecuteSQLArray($sqlarray); $sqlarray = $dict->CreateIndexSQL(cms_db_prefix() . 'news_hier', cms_db_prefix() . 'module_news', 'news_category_id'); $dict->ExecuteSQLArray($sqlarray); $sqlarray = $dict->CreateIndexSQL(cms_db_prefix() . 'news_url', cms_db_prefix() . 'module_news', 'news_url'); $dict->ExecuteSQLArray($sqlarray); $sqlarray = $dict->CreateIndexSQL(cms_db_prefix() . 'news_startenddate', cms_db_prefix() . 'module_news', 'start_time,end_time'); $dict->ExecuteSQLArray($sqlarray); #Setup events $this->CreateEvent('NewsArticleAdded'); $this->CreateEvent('NewsArticleEdited'); $this->CreateEvent('NewsArticleDeleted'); $this->CreateEvent('NewsCategoryAdded'); $this->CreateEvent('NewsCategoryEdited'); $this->CreateEvent('NewsCategoryDeleted'); $this->RegisterModulePlugin(TRUE); $this->RegisterSmartyPlugin('news', 'function', 'function_plugin'); // and routes... $this->CreateStaticRoutes();
if ($albumid == '' && (isset($params['cancel']) || isset($params['filename']))) { $albumid = $this->GetAlbumId($pictureid); } if (isset($params['cancel'])) { if (isset($albumid)) { $this->Redirect($id, 'editalbum', $returnid, array('albumid' => $albumid)); } else { $this->Redirect($id, 'defaultadmin', $returnid); } } if (isset($params['filename'])) { $newthumb = $params['filename']; if ($pictureid != '') { $query = 'UPDATE ' . cms_db_prefix() . 'module_album_pictures SET thumbnail_path=? WHERE picture_id = ?'; $db->Execute($query, array($newthumb, $pictureid)); } elseif ($albumid != '') { if ($params['filename'] != '') { $query = 'UPDATE ' . cms_db_prefix() . 'module_album_albums SET thumbnail_path=? WHERE album_id = ?'; $db->Execute($query, array($newthumb, $albumid)); } else { $query = 'UPDATE ' . cms_db_prefix() . 'module_album_albums SET thumbnail_path=NULL WHERE album_id = ?'; $db->Execute($query, array($albumid)); } } if (isset($albumid)) { $this->Redirect($id, 'editalbum', $returnid, array('albumid' => $albumid)); } else { $this->Redirect($id, 'defaultadmin', $returnid); } } include dirname(__FILE__) . '/lib.browsepictures.php';
if ($row) { $onerow = new stdClass(); $onerow->id = $row['news_id']; $onerow->title = $row['news_title']; $onerow->content = $row['news_data']; $onerow->summary = $row['summary']; $onerow->postdate = $row['news_date']; $onerow->startdate = $row['start_time']; $onerow->enddate = $row['end_time']; $onerow->category = $row['news_category_name']; $this->smarty->assign_by_ref('entry', $onerow); } // // Handle the custom fields // $query3 = 'SELECT A.value,B.id,B.name,B.type FROM ' . cms_db_prefix() . 'module_news_fieldvals A, ' . cms_db_prefix() . 'module_news_fielddefs B WHERE A.fielddef_id = B.id AND A.news_id = ? AND B.public = 1 ORDER BY B.item_order'; $dbr3 = $db->Execute($query3, array($row['news_id'])); $fields = array(); $fieldsbyname = array(); while ($dbr3 && ($row3 = $dbr3->FetchRow())) { $alias = strtolower(str_replace(' ', '_', $row3['name'])); $onerow->{$alias} = $row3['value']; $obj = new StdClass(); foreach ($row3 as $k => $v) { $obj->{$k} = $v; } $fields[] = $obj; $fieldsbyname[$alias] = $obj; } $onerow->fieldsbyname = $fieldsbyname; $onerow->fields = $fields;
if (version_compare($oldversion, '2.10.6') < 0) { $dict = NewDataDictionary($db); $sqlarray = $dict->AddColumnSQL(cms_db_prefix() . "module_news", "news_url C(255)"); $dict->ExecuteSQLArray($sqlarray); } if (version_compare($oldversion, '2.12.7') < 0) { $tmp = $db->GetOne('SELECT version FROM ' . cms_db_prefix() . 'version'); if ($tmp && $tmp < CMS_SCHEMA_VERSION) { return FALSE; } $res = $this->RegisterModulePlugin(true); $this->RegisterSmartyPlugin('news', 'function', 'function_plugin'); $this->CreateStaticRoutes(); // Setup Simplex Theme HTML5 sample summary template $fn = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'Summary_Simplex_template.tpl'; if (file_exists($fn)) { $template = @file_get_contents($fn); $this->SetTemplate('summarySummary_Simplex', $template); } // Setup Simplex Theme HTML5 sample detail template $fn = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'Simplex_Detail_template.tpl'; if (file_exists($fn)) { $template = @file_get_contents($fn); $this->SetTemplate('detailSimplex_Detail', $template); } } if (version_compare($oldversion, '2.13') < 0) { $dict = NewDataDictionary($db); $sqlarray = $dict->AddColumnSQL(cms_db_prefix() . 'module_news_fielddefs', 'extra X'); $dict->ExecuteSQLArray($sqlarray); }
function get_sibling($dir, $assign = '', $alias = '') { $gCms = cmsms(); $db = $gCms->GetDb(); $smarty = $gCms->GetSmarty(); $contentops = $gCms->GetContentOperations(); if (empty($alias)) { $alias = $smarty->get_template_vars('page_alias'); } $content = $contentops->LoadContentFromAlias($alias); if (!is_object($content)) { return false; } // get the last item out of the hierarchy // and rebuild $query = 'SELECT content_alias FROM ' . cms_db_prefix() . 'content WHERE parent_id = ? AND item_order %s ? AND active = 1 ORDER BY item_order %s LIMIT 1'; switch (strtolower($dir)) { case '-1': case 'prev': $thechar = '<'; $order = 'DESC'; break; default: $thechar = '>'; $order = 'ASC'; break; } $res = $db->GetOne(sprintf($query, $thechar, $order), array($content->ParentId(), $content->ItemOrder())); if (!empty($assign)) { $smarty->assign(trim($assign), $res); return; } return $res; }
exit; } // now iterate through this group properties while ($frow = $dbresultf->FetchRow()) { if (!isset($fields[$frow['name']])) { $output_heading .= "," . '"' . $frow['name'] . '"'; $fields[$frow['name']] = 'true'; } } $groups[$grow['groupname']] = 'true'; } } $line[] = implode(':', $ugroups); // For this user, get all their fields and use a right join to "fill in the blanks" // for any missing fields which shouldbe in this group $pquery = "SELECT * FROM " . cms_db_prefix() . "module_feusers_properties as c WHERE userid=?"; $dbresultp = $db->Execute($pquery, array($urow['id'])); $props = array(); if ($dbresultp && $dbresultp->RecordCount() > 0) { while ($prow = $dbresultp->FetchRow()) { if (isset($propdefns[$prow['title']])) { $props[$prow['title']] = array($prow['data'], $propdefns[$prow['title']]); } else { // todo, fatal error echo "DEBUG: FATAL, could not find property definition for " . $prow['title'] . "<br/>"; exit; } } } foreach ($fields as $key => $value) { if (isset($props[$key])) {