function init_module($module) { $modpath = BASEPATH . 'modules/' . $module . '/'; if (is_dir($modpath)) { $modcfg = array('name' => $module, 'path' => $modpath, 'validate' => 'user', 'redirect' => 'login', 'layout' => 'main'); if (file_exists($modpath . 'config.php')) { $config = (include $modpath . 'config.php'); foreach ($config as $key => $val) { $modcfg[$key] = $val; } } $modcfg = json_decode(json_encode($modcfg)); add_module($module, $modcfg); if ($modcfg->validate) { if (!has_session($modcfg->validate)) { if (is_ajax()) { echo json_encode(array('success' => false, 'message' => __('Your session has been expired !'), 'redirect' => site_url($modcfg->redirect))); exit; } else { redirect($modcfg->redirect); } } } } else { show_404(sprintf(__('Page %s does not found!'), $module)); } return get_module($module); }
function get_new_record_form() { require_once 'modules/DynamicLayout/AddField.php'; global $image_path, $mod_strings; global $sugar_version, $sugar_config; if (!empty($_REQUEST['edit_label_MSI']) && !empty($_SESSION['dyn_layout_module'])) { $module_name = $_SESSION['dyn_layout_module']; $html = get_left_form_header($mod_strings['LBL_TOOLBOX']); $html .= <<<EOQ \t<table class="contentBox" cellpadding="0" cellspacing="0" border="0" width="100%" id="sugar_labels_MSI">Sugar Labels <br><iframe name="labeleditor" height='400' id="labeleditor" frameborder="0" width="280" marginwidth="0" marginheight="0" style="border: 1px solid #444444;" src="index.php?module=LabelEditor&action=LabelList&module_name={$module_name}&sugar_body_only=1" ></iframe></td></tr></table> EOQ; $html .= get_left_form_footer(); return $html; } else { if (!empty($_REQUEST['edit_subpanel_MSI']) || empty($_REQUEST['edit_row_MSI']) && empty($_REQUEST['edit_col_MSI']) && $_REQUEST['action'] != 'SelectFile' && !empty($_SESSION['dyn_layout_file'])) { $addfield = new AddField(); if (isset($_SESSION['dyn_layout_file'])) { $the_module = get_module($_SESSION['dyn_layout_file']); } $font_slot = '<IMG src="' . $image_path . 'slot.gif" alt="Slot" border="0" >'; $slot_path = $image_path . "slot.gif"; $html = get_left_form_header($mod_strings['LBL_TOOLBOX']); $add_field_icon = get_image($image_path . "plus_inline", 'style="margin-left:4px;margin-right:4px;" alt="Add Field" border="0" align="absmiddle"'); $minus_field_icon = get_image($image_path . "minus_inline", 'style="margin-left:4px;margin-right:4px;" alt="Add Field" border="0" align="absmiddle"'); $edit_field_icon = get_image($image_path . "edit_inline", 'style="margin-left:4px;margin-right:4px;" alt="Add Field" border="0" align="absmiddle"'); $delete = get_image($image_path . "delete_inline", "border='0' alt='Delete' style='margin-left:4px;margin-right:4px;'"); $show_bin = true; if (isset($_REQUEST['edit_subpanel_MSI'])) { $show_bin = false; } $delete_items = $addfield->get_html(true, $show_bin); $html .= "\n\t<script>\n\tvar slot_path = '{$slot_path}';\n\tvar font_slot = '{$font_slot}';\n\t</script>\n\t<script type=\"text/javascript\" src=\"modules/DynamicLayout/DynamicLayout_3.js?s=" . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . "\">\n\t</script>\n\t<p>\n"; if (isset($_REQUEST['edit_col_MSI'])) { // do nothing } else { if (!isset($_REQUEST['edit_subpanel_MSI'])) { $html .= "\n\t<input type='checkbox' class=\"checkbox\" style='vertical-align: middle;' id='display_html_MSI' name='display_html_MSI' > {$mod_strings['LBL_DISPLAY_HTML']} <br>\n\t<a href='#' onclick='addFieldPOPUP()' class='leftColumnModuleS3Link'>{$add_field_icon}</a> <a href='#' onclick='addFieldPOPUP()' class='leftColumnModuleS3Link'>{$mod_strings['LBL_ADD_FIELDS']}</a>\n\t<br>"; } $html .= "\n\t<a href=\"#\" onclick=\"editCustomFields();\" class='leftColumnModuleS3Link'>{$edit_field_icon}</a>\n\t<a href='#' onclick=\"editCustomFields();\" class='leftColumnModuleS3Link'>{$mod_strings['LBL_EDIT_FIELDS']}</a><br>\n\t\n\t<p>{$delete_items}</p>"; } $html .= get_left_form_footer(); return $html; } } }
protected function _update() { $id = $_POST['id']; $model = D("Node"); if (false === $model->create()) { $this->error($model->getError()); } if (strpos($model->url, '##') !== false) { $model->sub_folder = ucfirst(get_module(str_replace("##", "", $model->url))) . "Folder"; } else { $model->sub_folder = ''; } // 更新数据 $list = $model->save(); if (false !== $list) { //成功提示 $this->assign('jumpUrl', get_return_url()); $this->success('编辑成功!'); } else { //错误提示 $this->error('编辑失败!'); } }
function update() { $updateSuccess = new XCube_Delegate(); $updateSuccess->register('Legacy_ModuleUpdateAction.UpdateSuccess'); $updateFail = new XCube_Delegate(); $updateFail->register('Legacy_ModuleUpdateAction.UpdateFail'); $module = get_module($this->name); $dirname = $module->get('dirname'); $installer = Legacy_ModuleInstallUtils::createUpdater($dirname); $installer->setCurrentXoopsModule($module); // Load the manifesto, and set it as the target object. $module->loadInfoAsVar($dirname); $module->set('name', $module->get('name')); $installer->setTargetXoopsModule($module); $installer->executeUpgrade(); if ($installer->mLog->hasError() === false) { $updateSuccess->call(new XCube_Ref($module), new XCube_Ref($installer->mLog)); XCube_DelegateUtils::call('Legacy.Admin.Event.ModuleUpdate.' . ucfirst($dirname . '.Success'), new XCube_Ref($module), new XCube_Ref($installer->mLog)); $success = true; } else { $updateFail->call(new XCube_Ref($module), new XCube_Ref($installer->mLog)); XCube_DelegateUtils::call('Legacy.Admin.Event.ModuleUpdate.' . ucfirst($dirname . '.Fail'), new XCube_Ref($module), new XCube_Ref($installer->mLog)); $success = false; } /* foreach ($installer->mLog->mMessages as $message) { echo sprintf('[%s] update: %s', date('Y-m-d H:i:s'), $message['message']), PHP_EOL; // TODO >> observer } */ return $success; }
} else { unset($_SESSION['editinplace']); } header('Location: index.php?action=index&module=Home'); } //MAKE SURE A FILE IS SELECTED require_once 'modules/DynamicLayout/HTMLPHPMapping.php'; if (isset($_REQUEST['edit_subpanel_MSI'])) { $fileType = 'subpanel'; require_once 'modules/DynamicLayout/plugins/SubPanelParser.php'; SubPanelParser::indexPage(); //else if we should be editing columns (listview) lets get that done } else { if (!empty($_SESSION['dyn_layout_file'])) { $file = $_SESSION['dyn_layout_file']; $the_module = get_module($file); $fileType = ''; if (substr_count($file, 'EditView') > 0 || isset($html_php_mapping_edit[$file])) { $fileType = 'edit'; } else { if (substr_count($file, 'DetailView') > 0 || isset($html_php_mapping_detail[$file])) { $fileType = 'detail'; } else { if (substr_count($file, 'ListView') > 0 || isset($html_php_mapping_subpanel[$file])) { $fileType = 'list'; } else { if (substr_count($file, 'SearchForm') > 0 || isset($html_php_mapping_searchform[$file])) { $fileType = 'search'; } else { if (isset($html_php_mapping_other[$file])) { $fileType = 'other';
function dr_page_url($data, $page = NULL) { if (!$data) { return SITE_URL; } if ($page) { $data['page'] = $page = is_numeric($page) ? max((int) $page, 1) : $page; } if ($data['module'] && ($module = get_module($data['module']))) { $path = $module['url']; } else { $path = SITE_URL; } $ci =& get_instance(); $rule = $ci->get_cache('urlrule', (int) $data['urlrule'], 'value'); if ($rule && $rule['page'] && $rule['page_page']) { // URL模式为自定义,且已经设置规则 $data['pdirname'] .= $data['dirname']; $data['pdirname'] = str_replace('/', $rule['catjoin'], $data['pdirname']); $url = $page ? $rule['page_page'] : $rule['page']; // 兼容php5.5 if (version_compare(PHP_VERSION, '5.5.0') >= 0) { $rep = new php5replace($data); $url = preg_replace_callback("#{([a-z_0-9]+)}#Ui", array($rep, 'php55_replace_data'), $url); $url = preg_replace_callback('#{([a-z_0-9]+)\\((.*)\\)}#Ui', array($rep, 'php55_replace_function'), $url); unset($rep); } else { $url = preg_replace('#{([a-z_0-9]+)}#Uei', "\$data[\\1]", $url); $url = preg_replace('#{([a-z_0-9]+)\\((.*)\\)}#Uie', "\\1(dr_safe_replace('\\2'))", $url); } return $path . $url; } return $path . 'index.php?c=page&id=' . $data['id'] . ($page ? '&page=' . $page : ''); }
foreach (glob($LANG_DIR . '/??.inc.php') as $file) { $LanCode = strtolower(substr(basename($file), 0, 2)); $LANGS[$LanCode] = get_vars($file); $MENUS[$LanCode] = get_menu(strtoupper($LanCode)); } $BACKS = $LANGS; unset($LANGS['en']); unset($MENUS['en']); $HTTFlags = array('HTTFlags_SelectX' => 'HTTSelectX', 'HTTFlags_SelectM' => 'HTTSelectM', 'HTTFlags_SelectE' => 'HTTSelectE', 'HTTFlags_3Arrows' => 'HTT3Arrows', 'HTTFlags_LasVegasMode' => 'HTTLasVegasMode', 'HTTFlags_DistanceTotal' => 'HTTDistanceTotal', 'HTTFlags_Min6_A' => 'HTTMin6_A', 'HTTFlags_Min6_B' => 'HTTMin6_B', 'HTTFlags_Min6_C' => 'HTTMin6_C', 'HTTFlags_Min6_D' => 'HTTMin6_D', 'HTTFlags_TargetLetter' => 'HTTTargetLetter', 'HTTFlags_GameInfo' => 'HTTGameInfo', 'HTTFlags_ResetInfo' => 'ResetInfo', 'HTTFlags_ResetID' => 'HTTResetID'); foreach ($MODULES as $Module) { $lang = array(); include $Module; // prepara i files vuoti per ogni lingua $Files = array(); foreach (array_keys($LANGS) as $LanCode) { $Files[$LanCode] = get_module("{$LANG_DIR}/{$LanCode}/" . basename($Module)); } // inizia il lavoro: per ogni chiave del modulo cerco la corrispondente variabile nei files di lingua // la inserisco nel file di lingua corrispondente foreach ($lang as $key => $val) { foreach ($LANGS as $LanCode => $vars) { $val2 = ''; if (strstr($key, 'DayOfWeek_') == $key) { $val2 = $vars['StrDayOfWeek'][substr($key, -1)]; // unset($BACKS[$LanCode]['StrDayOfWeek'][substr($key,-1)]); // unset($BACKS['en']['StrDayOfWeek'][substr($key,-1)]); } elseif (strstr($key, 'HTTFlags_') == $key) { $val2 = $vars['StrHTTFlags'][$HTTFlags[$key]]; // unset($BACKS[$LanCode]['StrHTTFlags'][$HTTFlags[$key]]); // unset($BACKS['en']['StrHTTFlags'][$HTTFlags[$key]]); } elseif (strstr($key, 'Eliminations_') == $key) {
?> </ul> <?php } ?> <?php } ?> <?php } ?> <div style="clear:both"></div> <?php if ($registry['post'][0]['test'] > 0) { ?> <?php get_module('vic'); ?> <?php } ?> <div style="clear:both"></div> <?php /*?><div class="fb-comments" data-href="http://<?=$_SERVER['SERVER_NAME'];?>/<?=$registry['post'][0]['cat_chpu'];?>/<?=$registry['post'][0]['chpu'];?>/" data-width="100%" data-numposts="5" data-colorscheme="light"></div> </div><?php */ ?> <br>
public function unpublish() { $path = $this->getStaticPath(); if (file_exists($path)) { array_map('unlink', glob($path . "/*")); rmdir($path); } // Load CDN publishing class $config = $GLOBALS['dw_config']; if (!empty($config['publish'])) { // remove files from CDN $pub = get_module('publish', dirname(__FILE__) . '/../../../../'); $id = $this->getID(); $chart_files = array(); $chart_files[] = "{$id}/index.html"; $chart_files[] = "{$id}/data"; $chart_files[] = "{$id}/{$id}.min.js"; $pub->unpublish($chart_files); } }
function get_module_name($module_name) { // New Function Name get_module($init_file); }
/** * 模块字段的选项值(用于options参数的字段,如复选框、下拉选择框、单选按钮) * * @param string $name * @param intval $catid * @param string $dirname * @return array */ function dr_field_options($name, $catid = 0, $dirname = APP_DIR) { if (!$name) { return NULL; } $module = get_module($dirname, SITE_ID); if (!$module) { return NULL; } $field = $catid && isset($module['category'][$catid]['field'][$name]) ? $module['category'][$catid]['field'][$name] : $module['field'][$name]; if (!$field) { return NULL; } $option = $field['setting']['option']['options']; if (!$option) { return NULL; } $data = explode(PHP_EOL, str_replace(array(chr(13), chr(10)), PHP_EOL, $option)); $return = array(); foreach ($data as $t) { if ($t) { list($i, $v) = explode('|', $t); $v = is_null($v) || !strlen($v) ? trim($i) : trim($v); $return[$v] = trim($i); } } return $return; }
if (function_exists('get_banner')) { ?> <?php if (get_banner('F3', 1) == true) { ?> <?php echo get_banner('F3', 1); ?> <?php } else { ?> <span>სარეკლამო ბანერი (800x100)</span> <?php } ?> <?php } ?> </div> </div> <!-- END BANNER PLACE--> <?php get_module('loadmore'); ?> </div> </div>
if (!empty($module)) { delete_module('mcp', $module); } } //Delete ACP Management Modules $acp_management_modules = array('ACP_GARAGE_BUSINESS', 'ACP_GARAGE_CATEGORIES', 'ACP_GARAGE_MODELS', 'ACP_GARAGE_PRODUCTS', 'ACP_GARAGE_QUOTAS', 'ACP_GARAGE_TOOLS', 'ACP_GARAGE_TRACK', 'ACP_GARAGE_MANAGEMENT'); for ($i = 0, $count = sizeof($acp_management_modules); $i < $count; $i++) { $module = get_module('acp', $acp_management_modules[$i]); if (!empty($module)) { delete_module('acp', $module); } } //Delete ACP Settings Modules $acp_settings_modules = array('ACP_GARAGE_GENERAL_SETTINGS', 'ACP_GARAGE_MENU_SETTINGS', 'ACP_GARAGE_INDEX_SETTINGS', 'ACP_GARAGE_IMAGES_SETTINGS', 'ACP_GARAGE_QUARTERMILE_SETTINGS', 'ACP_GARAGE_DYNORUN_SETTINGS', 'ACP_GARAGE_TRACK_SETTINGS', 'ACP_GARAGE_INSURANCE_SETTINGS', 'ACP_GARAGE_BUSINESS_SETTINGS', 'ACP_GARAGE_RATING_SETTINGS', 'ACP_GARAGE_GUESTBOOK_SETTINGS', 'ACP_GARAGE_PRODUCT_SETTINGS', 'ACP_GARAGE_SERVICE_SETTINGS', 'ACP_GARAGE_BLOG_SETTINGS', 'ACP_GARAGE_SETTINGS'); for ($i = 0, $count = sizeof($acp_settings_modules); $i < $count; $i++) { $module = get_module('acp', $acp_settings_modules[$i]); if (!empty($module)) { delete_module('acp', $module); } } $modules->remove_cache_file(); $template->assign_vars(array('MESSAGE_TITLE' => 'MODULES DELETED', 'MESSAGE_TEXT' => 'UCP, MCP & ACP Modules Deleted')); break; } page_footer(); function create_modules($module_data) { global $modules; for ($i = 0, $count = sizeof($module_data); $i < $count; $i++) { if ($module_data[$i]['module_class'] == 'acp') { $modules->module_class = 'acp';
public function unpublish() { $path = $this->getStaticPath(); if (file_exists($path)) { $dirIterator = new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS); $itIterator = new RecursiveIteratorIterator($dirIterator, RecursiveIteratorIterator::CHILD_FIRST); foreach ($itIterator as $entry) { $file = realpath((string) $entry); if (is_dir($file)) { rmdir($file); } else { unlink($file); } } rmdir($path); } // Load CDN publishing class $config = $GLOBALS['dw_config']; if (!empty($config['publish'])) { // remove files from CDN $pub = get_module('publish', dirname(__FILE__) . '/../../../../'); $id = $this->getID(); $chart_files = array(); $chart_files[] = "{$id}/index.html"; $chart_files[] = "{$id}/data"; $chart_files[] = "{$id}/{$id}.min.js"; $pub->unpublish($chart_files); } // remove all jobs related to this chart JobQuery::create()->filterByChart($this)->delete(); }
<a href="index.php?setlang=de"><img src="images/flags/de.png" border=0></a> <a href="index.php?setlang=en"><img src="images/flags/gb.png" border=0></a> <a href="index.php?setlang=ru"><img src="images/flags/ru.png" border=0></a> <br><br> <input type="submit" value=" <?php echo __('Войти'); ?> "/> </form> </div> </center> <?php } else { define("user_id", $iUsrId); if (get_params($sModule, 'show_to_user')) { if (!($sPath = get_module($sModule))) { echo '<br><br><br><br><center>' . __('Ошибка: модуль не подключен') . '</center><br><br><br><br>'; } else { include $sPath; } } else { echo '<br><br><br><br><center>' . __('Ошибка: недостаточно прав') . '</center><br><br><br><br>'; } } ?> </div> </article> <footer> <div class="foot_logo"> © <A href="/">callservice.com.ua</A> 2009-<?php
} else { ?> <?php include 'new_slider.php'; ?> <!-- ახალი სლაიდერის სტილები და ჯავასკრიპტი --> <?php } } ?> <!-- end pretty Photo --> <?php if ($registry['deviceType'] == 'computer' or $registry['deviceType'] == 'tablet') { get_module('new-articles'); } ?> <script> $(document).ready(function(){ //var uagent = '<?php echo $_SERVER['HTTP_USER_AGENT']; ?> '; var iOS = /iPad|iPhone|iPod/i.test( navigator.userAgent ); var Android = /Android/i.test( navigator.userAgent ); if(/Android|iPhone|iPod/i.test( navigator.userAgent )){ var bannerNum = $('div.mobile-content a').length; }else{ var bannerNum = $('div.post-content a').length; }
public function list_tag($_params) { if (!$this->ci) { return NULL; } $system = array('num' => '', 'form' => '', 'page' => '', 'site' => '', 'flag' => '', 'more' => '', 'catid' => '', 'field' => '', 'order' => '', 'space' => '', 'cache' => (int) SITE_QUERY_CACHE, 'action' => '', 'return' => '', 'module' => APP_DIR, 'modelid' => '', 'keyword' => '', 'urlrule' => '', 'pagesize' => ''); $param = $where = array(); $params = explode(' ', $_params); $sysadj = array('IN', 'BEWTEEN', 'BETWEEN', 'LIKE', 'NOTIN', 'NOT', 'BW'); foreach ($params as $t) { $var = substr($t, 0, strpos($t, '=')); $val = substr($t, strpos($t, '=') + 1); if (!$var) { continue; } if (isset($system[$var])) { // 系统参数,只能出现一次,不能添加修饰符 $system[$var] = $val; } else { if (preg_match('/^([A-Z_]+)(.+)/', $var, $match)) { // 筛选修饰符参数 $_pre = explode('_', $match[1]); $_adj = ''; foreach ($_pre as $p) { if (in_array($p, $sysadj)) { $_adj = $p; } } $where[] = array('adj' => $_adj, 'name' => $match[2], 'value' => $val); } else { $where[] = array('adj' => '', 'name' => $var, 'value' => $val); } $param[$var] = $val; // 用于特殊action } } // 替换order中的非法字符 if (isset($system['order']) && $system['order']) { $system['order'] = str_ireplace(array('"', "'", ')', '(', ';', 'select', 'insert'), '', $system['order']); } // action switch ($system['action']) { case 'cache': // 系统缓存数据 if (!isset($param['name'])) { return $this->_return($system['return'], 'name参数不存在'); } $pos = strpos($param['name'], '.'); if ($pos !== FALSE) { $_name = substr($param['name'], 0, $pos); $_param = substr($param['name'], $pos + 1); } else { $_name = $param['name']; $_param = NULL; } $cache = $this->_cache_var($_name, !$system['site'] ? SITE_ID : $system['site']); if (!$cache) { return $this->_return($system['return'], "缓存({$_name})不存在,请在后台更新缓存"); } if ($_param) { @eval('$data=$cache' . $this->_get_var($_param) . ';'); if (!$data) { return $this->_return($system['return'], "缓存({$_name})参数不存在!!"); } } else { $data = $cache; } return $this->_return($system['return'], $data, ''); break; case 'content': // 模块文档内容 if (!isset($param['id'])) { return $this->_return($system['return'], 'id参数不存在'); } $dirname = $system['module'] ? $system['module'] : APP_DIR; if (!$dirname) { return $this->_return($system['return'], 'module参数不能为空'); } $system['site'] = !$system['site'] ? SITE_ID : $system['site']; // 默认站点参数 $module = get_module($dirname, $system['site']); if (!$module) { return $this->_return($system['return'], "模块({$system['module']})未安装"); } // 定义的模块内容模型类 $file = FCPATH . $module['dirname'] . '/models/Content_model.php'; if (!is_file($file)) { return $this->_return($system['return'], "模块({$system['module']})文件models/Content_model.php不存在"); } require_once $file; $db = new Content_model(); $db->link = $this->ci->site[$system['site']]; $db->prefix = $this->ci->db->dbprefix($system['site'] . '_' . $module['dirname']); // 缓存查询结果 $data = $db->get($param['id']); $page = max(1, (int) $_GET['page']); $name = 'list-action-content-' . md5(dr_array2string($param)) . '-' . $page; $cache = $this->ci->get_cache_data($name); if (!$cache) { $fields = $module['field']; $fields = $module['category'][$data['catid']]['field'] ? array_merge($fields, $module['category'][$data['catid']]['field']) : $fields; // 模块表的系统字段 $fields['inputtime'] = array('fieldtype' => 'Date'); $fields['updatetime'] = array('fieldtype' => 'Date'); // 格式化数据 $data = $this->ci->field_format_value($fields, $data, $page, $module['dirname']); if ($system['field'] && $data) { $_field = explode(',', $system['field']); foreach ($data as $i => $t) { if (strpos($i, '_') !== 0 && !in_array($i, $_field)) { unset($data[$i]); } } } // 格式化显示自定义字段内容 $cache = $this->ci->set_cache_data($name, $data, $system['cache']); } return $this->_return($system['return'], array($cache), ''); break; case 'category': // 栏目 $dirname = $system['module'] ? $system['module'] : APP_DIR; if (!$dirname) { return $this->_return($system['return'], 'module参数不能为空'); } $system['site'] = !$system['site'] ? SITE_ID : $system['site']; // 默认站点参数 $module = get_module($dirname, $system['site']); if (!$module || count($module['category']) == 0) { return $this->_return($system['return'], "模块({$system['module']})尚未安装"); } $i = 0; $show = isset($param['show']) ? 1 : 0; // 有show参数表示显示隐藏栏目 $return = array(); foreach ($module['category'] as $t) { if ($system['num'] && $i >= $system['num']) { break; } if (!$t['show'] && !$show) { continue; } if (isset($param['pid']) && $t['pid'] != (int) $param['pid']) { continue; } if (isset($param['letter']) && $t['letter'] != $param['letter']) { continue; } if (isset($param['id']) && !in_array($t['id'], explode(',', $param['id']))) { continue; } if (isset($system['more']) && !$system['more']) { unset($t['field'], $t['setting']); } $return[] = $t; $i++; } if (!$return) { return $this->_return($system['return'], '没有匹配到内容'); } return $this->_return($system['return'], $return, ''); break; case 'linkage': // 联动菜单 $system['site'] = !$system['site'] ? SITE_ID : $system['site']; // 默认站点参数 $linkage = $this->ci->get_cache('linkage-' . $system['site'] . '-' . $param['code']); if (!$linkage) { return $this->_return($system['return'], "联动菜单{$param['code']}不存在,请在后台更新缓存"); } $i = 0; $return = array(); foreach ($linkage as $t) { if ($system['num'] && $i >= $system['num']) { break; } if (isset($param['pid']) && $t['pid'] != (int) $param['pid']) { continue; } if (isset($param['id']) && !in_array($t['id'], explode(',', $param['id']))) { continue; } $return[] = $t; $i++; } if (!$return) { foreach ($linkage as $t) { if ($t['pid'] == (int) $linkage[$param['pid']]['pid']) { if ($system['num'] && $i >= $system['num']) { break; } if (isset($param['id']) && !in_array($t['id'], explode(',', $param['id']))) { continue; } $return[] = $t; $i++; } } if (!$return) { return $this->_return($system['return'], '没有匹配到内容'); } } return $this->_return($system['return'], isset($param['call']) && $param['call'] ? @array_reverse($return) : $return, ''); break; case 'search_field': // 搜索字段筛选 $catid = $system['catid']; $system['site'] = !$system['site'] ? SITE_ID : $system['site']; // 默认站点参数 $module = get_module($system['module'] ? $system['module'] : APP_DIR, $system['site']); if (!$module || count($module['category'][$catid]['field']) == 0) { return $this->_return($system['return'], '模块未安装或者此栏目无附加字段'); } $return = array(); foreach ($module['category'][$catid]['field'] as $t) { if ($t['issearch'] && $t['ismain'] && ($t['fieldtype'] == 'Select' || $t['fieldtype'] == 'Radio')) { $data = @explode(PHP_EOL, $t['setting']['option']['options']); if ($data) { $list = array(); foreach ($data as $c) { list($name, $value) = @explode('|', $c); if ($name && !is_null($value)) { $list[] = array('name' => trim($name), 'value' => trim($value)); } } if ($list) { $return[] = array('name' => $t['name'], 'field' => $t['fieldname'], 'data' => $list); } } } } return $this->_return($system['return'], $return, ''); break; case 'navigator': // 网站导航 $system['site'] = !$system['site'] ? SITE_ID : $system['site']; // 默认站点参数 $navigator = $this->ci->get_cache('navigator-' . $system['site']); // 导航缓存 if (!$navigator) { return $this->_return($system['return'], '导航数据为空'); } $i = 0; $show = isset($param['show']) ? 1 : 0; // 有show参数表示显示隐藏栏目 $data = $navigator[(int) $param['type']]; if (!$data) { // 没有查询到内容 return $this->_return($system['return'], '没有查询到内容'); } $return = array(); foreach ($data as $t) { if ($system['num'] && $i >= $system['num']) { break; } if (isset($param['pid']) && $t['pid'] != (int) $param['pid']) { continue; } if (isset($param['id']) && $t['id'] != (int) $param['id']) { continue; } if (!$t['show'] && !$show) { continue; } $return[] = $t; $i++; } if (!$return) { return $this->_return($system['return'], '没有匹配到内容'); } return $this->_return($system['return'], $return, ''); break; case 'page': // 单页调用 $system['site'] = !$system['site'] ? SITE_ID : $system['site']; // 默认站点参数 $name = $system['module'] ? $system['module'] : 'index'; $data = $this->ci->get_cache('page-' . $system['site'], 'data', $name); // 单页缓存 if (!$data) { return $this->_return($system['return'], '没有查询到内容'); } $i = 0; $show = isset($param['show']) ? 1 : 0; // 有show参数表示显示隐藏栏目 $field = $this->ci->dcache->get('page-field-' . $system['site']); $return = array(); foreach ($data as $id => $t) { if (!is_numeric($id)) { continue; } if ($system['num'] && $i >= $system['num']) { break; } if (!$t['show'] && !$show) { continue; } if (isset($param['pid']) && $t['pid'] != (int) $param['pid']) { continue; } if (isset($param['id']) && !in_array($t['id'], explode(',', $param['id']))) { continue; } $t['setting'] = dr_string2array($t['setting']); $return[] = $this->ci->field_format_value($field, $t, 1); $i++; } if (!$return) { return $this->_return($system['return'], '没有匹配到内容'); } return $this->_return($system['return'], $return, $sql); break; case 'related': // 相关文章 $system['site'] = !$system['site'] ? SITE_ID : $system['site']; // 默认站点参数 $module = get_module($system['module'] ? $system['module'] : APP_DIR, $system['site']); if (!$module) { return $this->_return($system['return'], "模块({$system['module']})未安装"); // 没有模块数据时返回空 } if (!$param['tag']) { return $this->_return($system['return'], '没有查询到内容'); // 没有查询到内容 } else { $where = array(); $array = explode(',', $param['tag']); foreach ($array as $name) { if ($name) { $where[] = '(`title` LIKE "%' . $this->ci->db->escape_str($name) . '%" OR `keywords` LIKE "%' . $this->ci->db->escape_str($name) . '%")'; } } $where = implode(' OR ', $where); } $table = $this->ci->db->dbprefix($system['site'] . '_' . $module['dirname']); // 模块主表 $sql = "SELECT " . ($system['field'] ? $system['field'] : "*") . " FROM {$table} WHERE {$where} ORDER BY updatetime DESC LIMIT " . ($system['num'] ? $system['num'] : 10); $data = $this->_query($sql, $system['site'], $system['cache']); // 缓存查询结果 $name = 'list-action-sql-' . md5($sql); $cache = $this->ci->get_cache_data($name); if (!$cache) { $fields = $module['field']; // 模块表的系统字段 $fields['inputtime'] = array('fieldtype' => 'Date'); $fields['updatetime'] = array('fieldtype' => 'Date'); // 格式化显示自定义字段内容 foreach ($data as $i => $t) { $data[$i] = $this->ci->field_format_value($fields, $t, 1, $module['dirname']); } $cache = $this->ci->set_cache_data($name, $data, $system['cache']); } return $this->_return($system['return'], $cache, $sql); break; case 'tag': // 调用tag $system['site'] = !$system['site'] ? SITE_ID : $system['site']; // 默认站点参数 $module = get_module($system['module'] ? $system['module'] : APP_DIR, $system['site']); if (!$module) { // 没有模块数据时返回空 return $this->_return($system['return'], "模块({$system['module']})未安装"); } $table = $this->ci->db->dbprefix($system['site'] . '_' . $module['dirname'] . '_tag'); // tag表 $sql = "SELECT id,name,code,hits FROM {$table} ORDER BY hits DESC LIMIT " . ($system['num'] ? $system['num'] : 10); $data = $this->_query($sql, $system['site'], $system['cache']); // 没有查询到内容 if (!$data) { return $this->_return($system['return'], '没有查询到内容'); } // 缓存查询结果 $name = 'list-action-tag-' . md5($sql); $cache = $this->ci->get_cache_data($name); if (!$cache) { foreach ($data as $i => $t) { $data[$i]['url'] = dr_tag_url($module, $t['name'], 1, $module['dirname']); } $cache = $this->ci->set_cache_data($name, $data, $system['cache']); } return $this->_return($system['return'], $cache, $sql); break; case 'sql': // 直接sql查询 if (preg_match('/sql=\'(.+)\'/sU', $_params, $sql)) { $db = !$system['site'] ? $system['module'] ? $this->ci->site[SITE_ID] : $this->ci->db : $this->ci->site[$system['site']]; // 数据库对象 $system['site'] = !$system['site'] ? SITE_ID : $system['site']; // 默认站点参数 $sql = str_replace('@#', $db->dbprefix, trim($sql[1])); if (stripos($sql, 'SELECT') !== 0) { return $this->_return($system['return'], 'SQL语句只能是SELECT查询语句'); } $total = 0; $pages = ''; // 如存在分页条件才进行分页查询 if ($system['page'] && $system['urlrule']) { $page = max(1, (int) $_GET['page']); $row = $this->_query(preg_replace('/select(.*)from/iUs', 'SELECT count(*) as c FROM', $sql), $system['site'], $system['cache'], FALSE); $total = (int) $row['c']; $pagesize = $system['pagesize'] ? $system['pagesize'] : 10; // 没有数据时返回空 if (!$total) { return $this->_return($system['return'], '没有查询到内容', $sql, 0); } $sql .= ' LIMIT ' . $pagesize * ($page - 1) . ',' . $pagesize; $pages = $this->_get_pagination(str_replace('[page]', '{page}', urldecode($system['urlrule'])), $pagesize, $total); } $data = $this->_query($sql, $system['site'], $system['cache']); $fields = NULL; if ($system['module'] && ($module = get_module($system['module'], $system['site']))) { $fields = $module['field']; // 模块主表的字段 } elseif ($system['modelid'] && ($model = $this->ci->get_cache('space-model', $system['modelid']))) { $fields = $model['field']; // 空间模型的字段 } if ($fields) { // 缓存查询结果 $name = 'list-action-sql-' . md5($sql); $cache = $this->ci->get_cache_data($name); if (!$cache) { // 模块表的系统字段 $fields['inputtime'] = array('fieldtype' => 'Date'); $fields['updatetime'] = array('fieldtype' => 'Date'); // 格式化显示自定义字段内容 foreach ($data as $i => $t) { $data[$i] = $this->ci->field_format_value($fields, $t, 1, isset($module['dirname']) && $module['dirname'] ? $module['dirname'] : ''); } $cache = $this->ci->set_cache_data($name, $data, $system['cache']); } $data = $cache; } return $this->_return($system['return'], $data, $sql, $total, $pages); } else { return $this->_return($system['return'], '参数不正确,SQL语句必须用单引号包起来'); // 没有查询到内容 } break; case 'model': // 空间模型 $uid = (int) $system['space']; $mid = (int) $system['modelid']; if (!$mid) { return $this->_return($system['return'], 'modelid参数必须存在,请在后台更新缓存'); // 参数判断 } $model = $this->ci->get_cache('space-model', $mid); if (!$model) { return $this->_return($system['return'], "空间模型({$system['modelid']})未安装"); // 没有模型数据时返回空 } $tableinfo = $this->ci->get_cache('table'); if (!$tableinfo) { $this->ci->load->model('system_model'); $tableinfo = $this->ci->system_model->cache(); // 表结构缓存 } if (!$tableinfo) { return $this->_return($system['return'], '表结构缓存不存在(排查方式:后台-系统-数据备份,查看是否显示正常的表结构)'); // 没有表结构缓存时返回空 } $system['order'] = !$system['order'] ? 'updatetime' : $system['order']; // 默认排序参数 if ($uid) { $where[] = array('adj' => '', 'name' => 'space_id', 'value' => $uid); if (isset($system['catid']) && $system['catid']) { $this->ci->load->model('space_category_model'); $category = $this->ci->space_category_model->get_data(0, $uid, 1); // 栏目id集合不存在时则重新修复栏目数据 if (!$category[$system['catid']]['childids']) { $this->ci->space_category_model->repair($uid); } $where[] = array('adj' => $category[$system['catid']]['child'] ? 'IN' : '', 'name' => 'catid', 'value' => $category[$system['catid']]['child'] ? $category[$system['catid']]['childids'] : $system['catid']); } } $table = $this->ci->db->dbprefix('space_' . $model['table']); // 模块主表 $where = $this->_set_where_field_prefix($where, $tableinfo[$table]['field'], $table); // 给条件字段加上表前缀 $system['field'] = $this->_set_select_field_prefix($system['field'], $tableinfo[$table]['field'], $table); // 给显示字段加上表前缀 $system['order'] = $this->_set_order_field_prefix($system['order'], $tableinfo[$table]['field'], $table); // 给排序字段加上表前缀 $total = 0; $fields = $model['field']; // 主表的字段 $sql_from = $table; // sql的from子句 $sql_limit = $pages = ''; $sql_where = $this->_get_where($where); // sql的where子句 // 当前作者不缓存 if ($this->ci->uid == $uid) { $system['cache'] = 0; } if ($system['page'] && $system['urlrule']) { $page = max(1, (int) $_GET['page']); $urlrule = str_replace('[page]', '{page}', urldecode($system['urlrule'])); $pagesize = (int) $system['pagesize']; $pagesize = $pagesize ? $pagesize : 10; $sql = "SELECT count(*) as c FROM {$sql_from} " . ($sql_where ? "WHERE {$sql_where}" : "") . " ORDER BY NULL"; $row = $this->_query($sql, 0, $system['cache'], FALSE); $total = (int) $row['c']; // 没有数据时返回空 if (!$total) { return $this->_return($system['return'], '没有查询到内容', $sql, 0); } $sql_limit = 'LIMIT ' . $pagesize * ($page - 1) . ',' . $pagesize; $pages = $this->_get_pagination($urlrule, $pagesize, $total); } elseif ($system['num']) { $sql_limit = "LIMIT {$system['num']}"; } $sql = "SELECT " . ($system['field'] ? $system['field'] : "*") . " FROM {$sql_from} " . ($sql_where ? "WHERE {$sql_where}" : "") . " " . ($system['order'] ? "ORDER BY {$system['order']}" : "") . " {$sql_limit}"; $data = $this->_query($sql, 0, $system['cache']); // 缓存查询结果 $name = 'list-action-space-' . md5($sql); $cache = $this->ci->get_cache_data($name); if (!$cache) { // 模块表的系统字段 $fields['inputtime'] = array('fieldtype' => 'Date'); $fields['updatetime'] = array('fieldtype' => 'Date'); // 格式化显示自定义字段内容 foreach ($data as $i => $t) { $data[$i] = $this->ci->field_format_value($fields, $t); } $cache = $this->ci->set_cache_data($name, $data, $system['cache']); } return $this->_return($system['return'], $cache, $sql, $total, $pages); break; case 'space_content': // 空间模型文档内容 $id = (int) $param['id']; $mid = (int) $system['modelid']; if (!$id) { return $this->_return($system['return'], 'id参数不存在'); } if (!$mid) { return $this->_return($system['return'], 'modelid参数必须存在,请在后台更新缓存'); // 参数判断 } // 模型缓存 $model = $this->ci->get_cache('space-model', $mid); if (!$model) { return $this->_return($system['return'], "空间模型({$system['modelid']})未安装"); // 没有模型数据时返回空 } // 模型表名称和缓存 $name = $this->ci->db->dbprefix('space_' . $model['table']) . '-space-show-' . $id; $data = $this->ci->get_cache_data($name); $time = $system['cache'] ? $system['cache'] : 36000; if ($time && !$data) { $data = $this->ci->db->where('id', $id)->get('space_' . $model['table'])->row_array(); $this->ci->set_cache_data($name, $data, $time); } // 格式化输出自定义字段 $fields = $model['field']; $fields['inputtime'] = array('fieldtype' => 'Date'); $fields['updatetime'] = array('fieldtype' => 'Date'); $data = $this->ci->field_format_value($fields, $data, max(1, (int) $_GET['page'])); // 输出返回字段 $field = $system['field'] ? explode(',', $system['field']) : NULL; if ($field) { $temp = $data; $data = array(); foreach ($field as $i) { $data[$i] = isset($temp[$i]) ? $temp[$i] : ''; } } return $this->_return($system['return'], array($data), ''); break; case 'extend': // 子内容调用 $system['site'] = !$system['site'] ? SITE_ID : $system['site']; // 默认站点参数 $dirname = $system['module'] ? $system['module'] : APP_DIR; if (!$dirname) { return $this->_return($system['return'], 'module参数不能为空'); } $module = get_module($dirname, $system['site']); if (!$module) { return $this->_return($system['return'], "模块({$dirname})未安装"); // 没有模块数据时返回空 } $tableinfo = $this->ci->get_cache('table'); if (!$tableinfo) { $this->ci->load->model('system_model'); $tableinfo = $this->ci->system_model->cache(); // 表结构缓存 } if (!$tableinfo) { return $this->_return($system['return'], '表结构缓存不存在(排查方式:后台-系统-数据备份,查看是否显示正常的表结构)'); // 没有表结构缓存时返回空 } $system['order'] = !$system['order'] ? 'displayorder desc,inputtime asc' : $system['order']; // 默认排序参数 $table = $this->ci->db->dbprefix($system['site'] . '_' . $module['dirname'] . '_extend'); // 表名称 $where = $this->_set_where_field_prefix($where, $tableinfo[$table]['field'], $table); // 给条件字段加上表前缀 $system['field'] = $this->_set_select_field_prefix($system['field'], $tableinfo[$table]['field'], $table); // 给显示字段加上表前缀 $system['order'] = $this->_set_order_field_prefix($system['order'], $tableinfo[$table]['field'], $table); // 给排序字段加上表前缀 $total = 0; $fields = $module['extend']; // 主表的字段 $sql_from = $table; // sql的from子句 $sql_limit = $pages = ''; $sql_where = $this->_get_where($where); // sql的where子句 if (defined('MODULE_HTML') && MODULE_HTML) { $system['cache'] = 0; } if ($system['page'] && $system['urlrule']) { $page = max(1, (int) $_GET['page']); $urlrule = str_replace('[page]', '{page}', urldecode($system['urlrule'])); $pagesize = (int) $system['pagesize']; $pagesize = $pagesize ? $pagesize : 10; $sql = "SELECT count(*) as c FROM {$sql_from} " . ($sql_where ? "WHERE {$sql_where}" : "") . " ORDER BY NULL"; $row = $this->_query($sql, 0, $system['cache'], FALSE); $total = (int) $row['c']; // 没有数据时返回空 if (!$total) { return $this->_return($system['return'], '没有查询到内容', $sql, 0); } $sql_limit = 'LIMIT ' . $pagesize * ($page - 1) . ',' . $pagesize; $pages = $this->_get_pagination($urlrule, $pagesize, $total); } elseif ($system['num']) { $sql_limit = "LIMIT {$system['num']}"; } $sql = "SELECT " . ($system['field'] ? $system['field'] : "*") . " FROM {$sql_from} " . ($sql_where ? "WHERE {$sql_where}" : "") . " " . ($system['order'] ? "ORDER BY {$system['order']}" : "") . " {$sql_limit}"; $data = $this->_query($sql, $system['site'], $system['cache']); // 缓存查询结果 $name = 'list-action-extend-' . md5($sql); $cache = $this->ci->get_cache_data($name); if (!$cache) { // 表的系统字段 $fields['inputtime'] = array('fieldtype' => 'Date'); // 格式化显示自定义字段内容 foreach ($data as $i => $t) { $data[$i] = $this->ci->field_format_value($fields, $t, 1, $module['dirname']); } $cache = $this->ci->set_cache_data($name, $data, $system['cache']); } return $this->_return($system['return'], $cache, $sql, $total, $pages); break; case 'form': // 表单调用 $mid = $system['form']; $site = $system['site'] ? $system['site'] : SITE_ID; // 表单参数为数字时按id读取 if (is_numeric($mid)) { $form = $this->ci->get_cache('form-' . $site, $mid); } else { $form = $this->ci->get_cache('form-name-' . $site, $mid); } // 判断是否存在 if (!$form) { return $this->_return($system['return'], "表单({$mid})不存在"); // 参数判断 } // 表结构缓存 $tableinfo = $this->ci->get_cache('table'); if (!$tableinfo) { $this->ci->load->model('system_model'); $tableinfo = $this->ci->system_model->cache(); } if (!$tableinfo) { return $this->_return($system['return'], '表结构缓存不存在(排查方式:后台-系统-数据备份,查看是否显示正常的表结构)'); // 没有表结构缓存时返回空 } // 将catid作为普通字段 if (isset($system['catid']) && $system['catid']) { $where[] = array('adj' => '', 'name' => 'catid', 'value' => $system['catid']); } $system['order'] = !$system['order'] ? 'inputtime' : $system['order']; // 默认排序参数 $table = $this->ci->db->dbprefix($site . '_form_' . $form['table']); // 表单表名称 $where = $this->_set_where_field_prefix($where, $tableinfo[$table]['field'], $table); // 给条件字段加上表前缀 $system['field'] = $this->_set_select_field_prefix($system['field'], $tableinfo[$table]['field'], $table); // 给显示字段加上表前缀 $system['order'] = $this->_set_order_field_prefix($system['order'], $tableinfo[$table]['field'], $table); // 给排序字段加上表前缀 $total = 0; $fields = $form['field']; // 主表的字段 $sql_from = $table; // sql的from子句 $sql_limit = $pages = ''; $sql_where = $this->_get_where($where); // sql的where子句 if ($system['page'] && $system['urlrule']) { $page = max(1, (int) $_GET['page']); $urlrule = str_replace('[page]', '{page}', urldecode($system['urlrule'])); $pagesize = (int) $system['pagesize']; $pagesize = $pagesize ? $pagesize : 10; $sql = "SELECT count(*) as c FROM {$sql_from} " . ($sql_where ? "WHERE {$sql_where}" : "") . " ORDER BY NULL"; $row = $this->_query($sql, $site, $system['cache'], FALSE); $total = (int) $row['c']; // 没有数据时返回空 if (!$total) { return $this->_return($system['return'], '没有查询到内容', $sql, 0); } $sql_limit = 'LIMIT ' . $pagesize * ($page - 1) . ',' . $pagesize; $pages = $this->_get_pagination($urlrule, $pagesize, $total); } elseif ($system['num']) { $sql_limit = "LIMIT {$system['num']}"; } $sql = "SELECT " . ($system['field'] ? $system['field'] : "*") . " FROM {$sql_from} " . ($sql_where ? "WHERE {$sql_where}" : "") . " " . ($system['order'] ? "ORDER BY {$system['order']}" : "") . " {$sql_limit}"; $data = $this->_query($sql, 0, $system['cache']); // 缓存查询结果 $name = 'list-action-form-' . md5($sql); $cache = $this->ci->get_cache_data($name); if (!$cache) { // 表的系统字段 $fields['inputtime'] = array('fieldtype' => 'Date'); // 格式化显示自定义字段内容 foreach ($data as $i => $t) { $data[$i] = $this->ci->field_format_value($fields, $t); } $cache = $this->ci->set_cache_data($name, $data, $system['cache']); } return $this->_return($system['return'], $cache, $sql, $total, $pages); break; case 'mform': // 模块表单调用 $site = $system['site'] = !$system['site'] ? SITE_ID : $system['site']; // 默认站点参数 $dirname = $system['module'] ? $system['module'] : APP_DIR; if (!$dirname) { return $this->_return($system['return'], 'module参数不能为空'); } $module = get_module($dirname, $system['site']); if (!$module) { return $this->_return($system['return'], "模块({$dirname})未安装"); // 没有模块数据时返回空 } $fid = $system['form']; $form = $module['form'][$fid]; if (!$form) { return $this->_return($system['return'], "模块表单({$fid})不存在"); // 参数判断 } $tableinfo = $this->ci->get_cache('table'); if (!$tableinfo) { $this->ci->load->model('system_model'); $tableinfo = $this->ci->system_model->cache(); // 表结构缓存 } if (!$tableinfo) { return $this->_return($system['return'], '表结构缓存不存在(排查方式:后台-系统-数据备份,查看是否显示正常的表结构)'); // 没有表结构缓存时返回空 } $system['order'] = !$system['order'] ? 'inputtime' : $system['order']; // 默认排序参数 $table = $this->ci->db->dbprefix($site . '_' . $module['dirname'] . '_form_' . $fid); // 表单表名称 $where = $this->_set_where_field_prefix($where, $tableinfo[$table]['field'], $table); // 给条件字段加上表前缀 $system['field'] = $this->_set_select_field_prefix($system['field'], $tableinfo[$table]['field'], $table); // 给显示字段加上表前缀 $system['order'] = $this->_set_order_field_prefix($system['order'], $tableinfo[$table]['field'], $table); // 给排序字段加上表前缀 $total = NULL; $fields = $form['field']; // 主表的字段 $sql_from = $table; // sql的from子句 $sql_where = $this->_get_where($where); // sql的where子句 $sql_limit = $pages = ''; if ($system['page'] && $system['urlrule']) { $page = max(1, (int) $_GET['page']); $urlrule = str_replace('[page]', '{page}', urldecode($system['urlrule'])); $pagesize = (int) $system['pagesize']; $pagesize = $pagesize ? $pagesize : 10; $sql = "SELECT count(*) as c FROM {$sql_from} " . ($sql_where ? "WHERE {$sql_where}" : "") . " ORDER BY NULL"; $row = $this->_query($sql, $site, $system['cache'], FALSE); $total = (int) $row['c']; // 没有数据时返回空 if (!$total) { return $this->_return($system['return'], '没有查询到内容', $sql, 0); } $sql_limit = 'LIMIT ' . $pagesize * ($page - 1) . ',' . $pagesize; $pages = $this->_get_pagination($urlrule, $pagesize, $total); } elseif ($system['num']) { $sql_limit = "LIMIT {$system['num']}"; } $sql = "SELECT " . ($system['field'] ? $system['field'] : "*") . " FROM {$sql_from} " . ($sql_where ? "WHERE {$sql_where}" : "") . " " . ($system['order'] ? "ORDER BY {$system['order']}" : "") . " {$sql_limit}"; $data = $this->_query($sql, $site, $system['cache']); // 缓存查询结果 $name = 'list-action-mform-' . md5($sql); $cache = $this->ci->get_cache_data($name); if (!$cache) { // 表的系统字段 $fields['inputtime'] = array('fieldtype' => 'Date'); // 格式化显示自定义字段内容 foreach ($data as $i => $t) { $data[$i] = $this->ci->field_format_value($fields, $t, 1, $module['dirname']); } $cache = $this->ci->set_cache_data($name, $data, $system['cache']); } return $this->_return($system['return'], $cache, $sql, $total, $pages); break; case 'member': // 会员信息 $tableinfo = $this->ci->get_cache('table'); if (!$tableinfo) { $this->ci->load->model('system_model'); $tableinfo = $this->ci->system_model->cache(); // 表结构缓存 } if (!$tableinfo) { // 没有表结构缓存时返回空 return $this->_return($system['return'], '表结构缓存不存在(排查方式:后台-系统-数据备份,查看是否显示正常的表结构)'); } $table = $this->ci->db->dbprefix('member'); // 主表 $system['order'] = !$system['order'] ? 'uid' : $system['order']; // 默认排序参数 $where = $this->_set_where_field_prefix($where, $tableinfo[$table]['field'], $table); // 给条件字段加上表前缀 $system['field'] = $this->_set_select_field_prefix($system['field'], $tableinfo[$table]['field'], $table); // 给显示字段加上表前缀 $system['order'] = $this->_set_order_field_prefix($system['order'], $tableinfo[$table]['field'], $table); // 给排序字段加上表前缀 $sql_from = $table; // sql的from子句 if ($system['more']) { // 会员附表 $more = $this->ci->db->dbprefix('member_data'); // 附表 $where = $this->_set_where_field_prefix($where, $tableinfo[$more]['field'], $more); // 给条件字段加上表前缀 $system['field'] = $this->_set_select_field_prefix($system['field'], $tableinfo[$more]['field'], $more); // 给显示字段加上表前缀 $system['order'] = $this->_set_order_field_prefix($system['order'], $tableinfo[$more]['field'], $more); // 给排序字段加上表前缀 $sql_from .= " LEFT JOIN {$more} ON `{$table}`.`uid`=`{$more}`.`uid`"; // sql的from子句 } $total = 0; $sql_limit = ''; $sql_where = $this->_get_where($where); // sql的where子句 if ($system['page'] && $system['urlrule']) { // 如存在分页条件才进行分页查询 $page = max(1, (int) $_GET['page']); $urlrule = str_replace('[page]', '{page}', urldecode($system['urlrule'])); $pagesize = (int) $system['pagesize']; $pagesize = $pagesize ? $pagesize : 10; $row = $this->_query("SELECT count(*) as c FROM {$sql_from} " . ($sql_where ? "WHERE {$sql_where}" : "") . " ORDER BY NULL", $system['site'], $system['cache'], FALSE); $total = (int) $row['c']; if (!$total) { // 没有数据时返回空 return $this->_return($system['return'], '没有查询到内容', $sql, 0); } $sql_limit = ' LIMIT ' . $pagesize * ($page - 1) . ',' . $pagesize; $pages = $this->_get_pagination(str_replace('[page]', '{page}', $urlrule), $pagesize, $total); } elseif ($system['num']) { $sql_limit = "LIMIT {$system['num']}"; } $sql = "SELECT " . ($system['field'] ? $system['field'] : "*") . " FROM {$sql_from} " . ($sql_where ? "WHERE {$sql_where}" : "") . " " . ($system['order'] == "null" ? "" : " ORDER BY {$system['order']}") . " {$sql_limit}"; $data = $this->_query($sql, $system['site'], $system['cache']); // 缓存查询结果 $name = 'list-action-member-' . md5($sql); $cache = $this->ci->get_cache_data($name); if (!$cache) { // 系统字段 $fields['regtime'] = array('fieldtype' => 'Date'); // 格式化显示自定义字段内容 foreach ($data as $i => $t) { $data[$i] = $this->ci->field_format_value($fields, $t); } $cache = $this->ci->set_cache_data($name, $data, $system['cache']); } return $this->_return($system['return'], $cache, $sql, $total, $pages); break; case 'space': // 空间数据 $tableinfo = $this->ci->get_cache('table'); if (!$tableinfo) { $this->ci->load->model('system_model'); $tableinfo = $this->ci->system_model->cache(); // 表结构缓存 } if (!$tableinfo) { return $this->_return($system['return'], '表结构缓存不存在(排查方式:后台-系统-数据备份,查看是否显示正常的表结构)'); // 没有表结构缓存时返回空 } $table = $this->ci->db->dbprefix('space'); // 空间主表 $system['order'] = !$system['order'] ? 'displayorder' : $system['order']; // 默认排序参数 if ($system['keyword']) { $where[] = array('adj' => 'LIKE', 'name' => 'name', 'value' => '%' . $system['keyword'] . '%'); } $where[] = array('adj' => '', 'name' => 'status', 'value' => 1); $where = $this->_set_where_field_prefix($where, $tableinfo[$table]['field'], $table); // 给条件字段加上表前缀 $system['field'] = $this->_set_select_field_prefix($system['field'], $tableinfo[$table]['field'], $table); // 给显示字段加上表前缀 $system['order'] = $this->_set_order_field_prefix($system['order'], $tableinfo[$table]['field'], $table); // 给排序字段加上表前缀 $sql_from = $table; // sql的from子句 if ($system['more']) { // 会员附表 $more = $this->ci->db->dbprefix('member_data'); // 附表 $where = $this->_set_where_field_prefix($where, $tableinfo[$more]['field'], $more); // 给条件字段加上表前缀 $system['field'] = $this->_set_select_field_prefix($system['field'], $tableinfo[$more]['field'], $more); // 给显示字段加上表前缀 $system['order'] = $this->_set_order_field_prefix($system['order'], $tableinfo[$more]['field'], $more); // 给排序字段加上表前缀 $sql_from .= " LEFT JOIN {$more} ON `{$table}`.`uid`=`{$more}`.`uid`"; // sql的from子句 } if ($system['more'] == 2) { // 会员主表 $more2 = $this->ci->db->dbprefix('member'); // 附表 $where = $this->_set_where_field_prefix($where, $tableinfo[$more2]['field'], $more2); // 给条件字段加上表前缀 if ($system['field']) { $system['field'] = $this->_set_select_field_prefix($system['field'], $tableinfo[$more2]['field'], $more2); // 给显示字段加上表前缀 } else { $system['field'] = "`{$table}`.*" . ($more ? ",`{$more}`.*" : "") . ",`{$more2}`.`username`,`{$more2}`.`groupid`,`{$more2}`.`uid`"; } $system['order'] = $this->_set_order_field_prefix($system['order'], $tableinfo[$more2]['field'], $more2); // 给排序字段加上表前缀 $sql_from .= " LEFT JOIN {$more2} ON `{$table}`.`uid`=`{$more2}`.`uid`"; // sql的from子句 } $total = 0; $sql_limit = ''; $sql_where = $this->_get_where($where); // sql的where子句 if ($system['flag']) { // 推荐位调用 $_ids = $this->_query("select uid from {$table}_flag where `flag`=" . (int) $system['flag'], $system['site'], $system['cache']); $in = array(); foreach ($_ids as $t) { $in[] = $t['uid']; } if (!$in) { // 没有查询到内容 return $this->_return($system['return'], '没有查询到推荐位内容'); } $sql_where = ($sql_where ? $sql_where . ' AND' : '') . " `{$table}`.`uid` IN (" . implode(',', $in) . ")"; } if ($system['page'] && $system['urlrule']) { // 如存在分页条件才进行分页查询 $page = max(1, (int) $_GET['page']); $urlrule = str_replace('[page]', '{page}', urldecode($system['urlrule'])); $pagesize = (int) $system['pagesize']; $pagesize = $pagesize ? $pagesize : 10; $sql = "SELECT count(*) as c FROM {$sql_from} " . ($sql_where ? "WHERE {$sql_where}" : "") . " ORDER BY NULL"; $row = $this->_query($sql, $system['site'], $system['cache'], FALSE); $total = (int) $row['c']; if (!$total) { // 没有数据时返回空 return $this->_return($system['return'], '没有查询到内容', $sql, 0); } $sql_limit = ' LIMIT ' . $pagesize * ($page - 1) . ',' . $pagesize; $pages = $this->_get_pagination(str_replace('[page]', '{page}', $urlrule), $pagesize, $total); } elseif ($system['num']) { $sql_limit = "LIMIT {$system['num']}"; } $sql = "SELECT " . ($system['field'] ? $system['field'] : "*") . " FROM {$sql_from} " . ($sql_where ? "WHERE {$sql_where}" : "") . " " . ($system['order'] == "null" ? "" : " ORDER BY {$system['order']}") . " {$sql_limit}"; $data = $this->_query($sql, $system['site'], $system['cache']); // 缓存查询结果 $name = 'list-action-space-' . md5($sql); $cache = $this->ci->get_cache_data($name); if (!$cache) { // 系统字段 $fields['regtime'] = array('fieldtype' => 'Date'); // 格式化显示自定义字段内容 foreach ($data as $i => $t) { $data[$i] = $this->ci->field_format_value($fields, $t); } $cache = $this->ci->set_cache_data($name, $data, $system['cache']); } return $this->_return($system['return'], $cache, $sql, $total, $pages); break; case 'module': // 模块数据 $dirname = $system['module'] ? $system['module'] : APP_DIR; if (!$dirname) { return $this->_return($system['return'], 'module参数不能为空'); } $system['site'] = !$system['site'] ? SITE_ID : $system['site']; // 默认站点参数 $module = get_module($dirname, $system['site']); if (!$module) { // 没有模块数据时返回空 return $this->_return($system['return'], "模块({$dirname})未安装"); } $tableinfo = $this->ci->get_cache('table'); if (!$tableinfo) { $this->ci->load->model('system_model'); $tableinfo = $this->ci->system_model->cache(); // 表结构缓存 } if (!$tableinfo) { // 没有表结构缓存时返回空 return $this->_return($system['return'], '表结构缓存不存在(排查方式:后台-系统-数据备份,查看是否显示正常的表结构)'); } $table = $this->ci->db->dbprefix($system['site'] . '_' . $module['dirname']); // 模块主表 if (!isset($tableinfo[$table]['field'])) { return $this->_return($system['return'], '表(' . $table . ')结构缓存不存在(排查方式:后台-系统-数据备份,查看是否显示正常的表结构)'); } // 排序操作 if (!$system['order'] && $where[0]['adj'] == 'IN' && $where[0]['name'] == 'id') { // 按id序列来排序 $system['order'] = strlen($where[0]['value']) < 10000 ? 'instr("' . $where[0]['value'] . '", `' . $table . '`.`id`)' : 'NULL'; } else { if (!$system['order']) { if ($system['flag']) { $system['order'] = 'displayorder_desc,updatetime_desc'; // 默认排序参数 } else { $system['order'] = 'updatetime'; // 默认排序参数 } } } // 栏目筛选 if ($system['catid']) { if (strpos($system['catid'], ',') !== FALSE) { $where[] = array('adj' => 'IN', 'name' => 'catid', 'value' => $system['catid']); } elseif ($module['category'][$system['catid']]['child']) { $where[] = array('adj' => 'IN', 'name' => 'catid', 'value' => $module['category'][$system['catid']]['childids']); } else { $where[] = array('adj' => '', 'name' => 'catid', 'value' => (int) $system['catid']); } } $fields = $module['field']; // 主表的字段 $where = $this->_set_where_field_prefix($where, $tableinfo[$table]['field'], $table); // 给条件字段加上表前缀 $system['field'] = $this->_set_select_field_prefix($system['field'], $tableinfo[$table]['field'], $table); // 给显示字段加上表前缀 $system['order'] = $this->_set_order_field_prefix($system['order'], $tableinfo[$table]['field'], $table); // 给排序字段加上表前缀 $sql_from = $table; // sql的from子句 // 关联栏目附加表 if ($system['more']) { $_catid = (int) $system['catid']; if (isset($module['category'][$_catid]['field']) && $module['category'][$_catid]['field']) { $fields = array_merge($fields, $module['category'][$_catid]['field']); $table_more = $table . '_category_data'; // 栏目附加表 $where = $this->_set_where_field_prefix($where, $tableinfo[$table_more]['field'], $table_more); // 给条件字段加上表前缀 $system['field'] = $this->_set_select_field_prefix($system['field'], $tableinfo[$table_more]['field'], $table_more); // 给显示字段加上表前缀 $system['order'] = $this->_set_order_field_prefix($system['order'], $tableinfo[$table_more]['field'], $table_more); // 给排序字段加上表前缀 $sql_from .= " LEFT JOIN {$table_more} ON `{$table_more}`.`id`=`{$table}`.`id`"; // sql的from子句 } } $total = 0; $sql_limit = $pages = ''; $sql_where = $this->_get_where($where); // sql的where子句 // 推荐位调用 if ($system['flag']) { $_w = strpos($sytem['flag'], ',') ? '`flag` IN (' . $sytem['flag'] . ')' : '`flag`=' . (int) $system['flag']; $_i = $this->_query("select id from {$table}_flag where " . $_w, $system['site'], $system['cache']); $in = array(); foreach ($_i as $t) { $in[] = $t['id']; } // 没有查询到内容 if (!$in) { return $this->_return($system['return'], '没有查询到内容'); } $sql_where = ($sql_where ? $sql_where . ' AND' : '') . "`{$table}`.`id` IN (" . implode(',', $in) . ")"; unset($_w, $_i, $in); } if ($system['page']) { $page = max(1, (int) $_GET['page']); if (is_numeric($system['catid'])) { $urlrule = dr_category_url($module, $module['category'][$system['catid']], '{page}'); $pagesize = $system['pagesize'] ? (int) $system['pagesize'] : (int) $module['category'][$system['catid']]['setting']['template']['pagesize']; } else { $urlrule = str_replace('[page]', '{page}', urldecode($system['urlrule'])); $pagesize = (int) $system['pagesize']; } $pagesize = $pagesize ? $pagesize : 10; $sql = "SELECT count(*) as c FROM {$sql_from} " . ($sql_where ? "WHERE {$sql_where}" : "") . " ORDER BY NULL"; $row = $this->_query($sql, $system['site'], $system['cache'], FALSE); $total = (int) $row['c']; // 没有数据时返回空 if (!$total) { return $this->_return($system['return'], '没有查询到内容', $sql, 0); } $sql_limit = 'LIMIT ' . $pagesize * ($page - 1) . ',' . $pagesize; $pages = $this->_get_pagination($urlrule, $pagesize, $total); } elseif ($system['num']) { $sql_limit = "LIMIT {$system['num']}"; } $sql = "SELECT " . ($system['field'] ? $system['field'] : '*') . " FROM {$sql_from} " . ($sql_where ? "WHERE {$sql_where}" : "") . ($system['order'] == "null" ? "" : " ORDER BY {$system['order']}") . " {$sql_limit}"; $data = $this->_query($sql, $system['site'], $system['cache']); // 缓存查询结果 $name = 'list-action-module-' . md5($sql); $cache = $this->ci->get_cache_data($name); if (!$cache && is_array($data)) { // 模块表的系统字段 $fields['inputtime'] = array('fieldtype' => 'Date'); $fields['updatetime'] = array('fieldtype' => 'Date'); // 格式化显示自定义字段内容 foreach ($data as $i => $t) { $data[$i] = $this->ci->field_format_value($fields, $t, 1, $module['dirname']); } $cache = $this->ci->set_cache_data($name, $data, $system['cache']); } return $this->_return($system['return'], $cache ? $cache : $data, $sql, $total, $pages); break; case 'search': // 模块的搜索 $total = (int) $param['total']; // 没有数据时返回空 if (!$total) { return $this->_return($system['return'], 'total参数为空', $sql, 0); } $dirname = $system['module'] ? $system['module'] : APP_DIR; if (!$dirname) { return $this->_return($system['return'], 'module参数不能为空'); } // 没有id时返回空 if (!$param['id']) { return $this->_return($system['return'], 'id参数为空', $sql, 0); } $system['site'] = !$system['site'] ? SITE_ID : $system['site']; // 默认站点参数 $module = get_module($dirname, $system['site']); if (!$module) { // 没有模块数据时返回空 return $this->_return($system['return'], "模块({$dirname})未安装"); } $tableinfo = $this->ci->get_cache('table'); if (!$tableinfo) { $this->ci->load->model('system_model'); $tableinfo = $this->ci->system_model->cache(); // 表结构缓存 } if (!$tableinfo) { // 没有表结构缓存时返回空 return $this->_return($system['return'], '表结构缓存不存在(排查方式:后台-系统-数据备份,查看是否显示正常的表结构)'); } $table = $this->ci->db->dbprefix($system['site'] . '_' . $module['dirname']); // 模块主表 if (!isset($tableinfo[$table]['field'])) { return $this->_return($system['return'], '表(' . $table . ')结构缓存不存在(排查方式:后台-系统-数据备份,查看是否显示正常的表结构)'); } $fields = $module['field']; // 主表的字段 $sql_from = $table; // sql的from子句 $system['catid'] = intval($system['catid']); // 排序操作 $system['order'] = $this->_set_order_field_prefix($system['order'] ? $system['order'] : 'updatetime', $tableinfo[$table]['field'], $table); // 给排序字段加上表前缀 // 关联栏目附加表 if ($system['more'] && isset($module['category'][$system['catid']]['field']) && $module['category'][$system['catid']]['field']) { $fields = array_merge($fields, $module['category'][$system['catid']]['field']); $table_more = $table . '_category_data'; // 栏目附加表 $sql_from .= " LEFT JOIN {$table_more} ON `{$table_more}`.`id`=`{$table}`.`id`"; // sql的from子句 $system['order'] = $this->_set_order_field_prefix($system['order'], $tableinfo[$table_more]['field'], $table_more); // 给排序字段加上表前缀 } $sql_limit = $pages = ''; $sql_where = '`id` IN(SELECT `cid` FROM `' . $table . '_search_index` WHERE `id`="' . $param['id'] . '")'; // sql的where子句 // 搜索分页 $page = max(1, (int) $_GET['page']); $urlrule = str_replace('[page]', '{page}', urldecode($system['urlrule'])); $pagesize = (int) $system['pagesize']; $pagesize = $pagesize ? $pagesize : 10; $sql_limit = 'LIMIT ' . $pagesize * ($page - 1) . ',' . $pagesize; $pages = $this->_get_pagination($urlrule, $pagesize, $total); $sql = "SELECT " . ($system['field'] ? $system['field'] : '*') . " FROM {$sql_from} WHERE {$sql_where} ORDER BY {$system['order']} {$sql_limit}"; $data = $this->_query($sql, $system['site'], $system['cache']); // 缓存查询结果 $name = 'list-action-search-' . md5($sql); $cache = $this->ci->get_cache_data($name); if (!$cache) { // 模块表的系统字段 $fields['inputtime'] = array('fieldtype' => 'Date'); $fields['updatetime'] = array('fieldtype' => 'Date'); // 格式化显示自定义字段内容 foreach ($data as $i => $t) { $data[$i] = $this->ci->field_format_value($fields, $t, 1, $module['dirname']); } $cache = $this->ci->set_cache_data($name, $data, $system['cache']); } return $this->_return($system['return'], $cache, $sql, $total, $pages); break; default: return $this->_return($system['return'], 'list标签必须含有参数action或者action参数错误'); break; } }
private function _field_module($tableinfo, $name) { $_field = $this->db->where('fieldname', $name)->where('relatedid', $this->relatedid)->where('relatedname', $this->relatedname)->count_all_results('field'); if (!$_field) { $module = get_module($this->data['dirname'], SITE_ID); $_field = isset($module['field'][$name]) ? 1 : 0; } $_system = $tableinfo[$this->db->dbprefix(SITE_ID . '_' . $this->data['dirname'])]['field']; return $_field ? 1 : (isset($_system[$name]) ? 1 : 0); }
function get_xtpl_file_and_cache($file) { include 'modules/DynamicLayout/HTMLPHPMapping.php'; global $beanList; if (!empty($html_php_mapping_subpanel[$file])) { $xtpl = $html_php_mapping_subpanel[$file]; } else { if (!empty($html_php_mapping_edit[$file])) { $xtpl = $html_php_mapping_edit[$file]; } else { if (!empty($html_php_mapping_detail[$file])) { $xtpl = $html_php_mapping_detail[$file]; } else { if (!empty($html_php_mapping_other[$file])) { $xtpl = $html_php_mapping_other[$file]; } else { $xtpl = $file; } } } } $xtpl = str_replace(array('.html', 'SearchForm'), array('.php', 'ListView'), $xtpl); $xtpl_fp = fopen($xtpl, 'r'); $buffer = fread($xtpl_fp, filesize($xtpl)); fclose($xtpl_fp); $cache_file = create_cache_directory('layout/' . $file); $xtpl_cache = create_cache_directory('layout/' . $xtpl); $module = get_module($file); $form_string = "require_once('modules/" . $module . "/Forms.php');"; if (substr_count($file, 'DetailView') > 0) { $buffer = str_replace('header(', 'if(false) header(', $buffer); } if (substr_count($file, 'DetailView') > 0 || substr_count($file, 'EditView') > 0) { if (empty($_REQUEST['record'])) { $buffer = preg_replace('(\\$xtpl[\\ ]*=)', "\$focus->assign_display_fields('{$module}'); \$0", $buffer); } else { $buffer = preg_replace('(\\$xtpl[\\ ]*=)', "\$focus->retrieve('" . $_REQUEST['record'] . "');\n\$focus->assign_display_fields('{$module}');\n \$0", $buffer); } } $_REQUEST['query'] = true; if (substr_count($file, 'SearchForm') > 0) { $temp_xtpl = new XTemplate($file); if ($temp_xtpl->exists('advanced')) { global $current_language; $mods = return_module_language($current_language, 'DynamicLayout'); $class_name = $beanList[$module]; if ($class_name == 'aCase') { $class_file = 'Case'; } else { $class_file = $class_name; } require_once "modules/{$module}/{$class_file}.php"; $mod = new $class_name(); populate_request_from_buffer($file); $mod->assign_display_fields($module); $buffer = str_replace(array('$search_form->parse("advanced");', '$search_form->out("advanced");', '$search_form->parse("main");', '$search_form->out("main");'), array('', '', '', ''), $buffer); $buffer = str_replace('echo get_form_footer();', '$search_form->parse("main");' . "\n" . '$search_form->out("main");' . "\necho '<br><b>" . translate('LBL_ADVANCED', 'DynamicLayout') . "</b><br>';" . '$search_form->parse("advanced");' . "\n" . '$search_form->out("advanced");' . "\necho get_form_footer();\n \$sugar_config['list_max_entries_per_page'] = 1;", $buffer); } } if (!empty($html_php_mapping_subpanel[$file])) { global $beanList; if (!empty($_REQUEST['mod_class'])) { $bean = $beanList[$_REQUEST['mod_class']]; } else { $bean = $beanList[$module]; } $buffer = str_replace('replace_file_name', $file, $buffer); if (empty($_REQUEST['record'])) { $buffer = str_replace('global $focus_list;', "global \$focus_list;\n\$focus_list = new {$bean}();\n\$focus_list->assign_display_fields('{$module}');", $buffer); } else { $buffer = str_replace('global $focus_list;', "global \$focus_list;\n\$focus_list = new {$bean}();\n\$focus_list->retrieve('" . $_REQUEST['record'] . "');", $buffer); } } if (!empty($html_php_mapping_subpanel[$file])) { foreach ($html_php_mapping_subpanel as $key => $val) { if ($val == $xtpl) { $buffer = str_replace($key, $cache_file, $buffer); } } } else { $buffer = str_replace($file, $cache_file, $buffer); } $buffer = "<?php\n\$sugar_config['list_max_entries_per_page'] = 1;\n ?>" . $buffer; $buffer = str_replace($form_string, '', $buffer); $buffer = replace_inputs($buffer); $xtpl_fp_cache = fopen($xtpl_cache, 'w'); fwrite($xtpl_fp_cache, $buffer); fclose($xtpl_fp_cache); return $xtpl_cache; }
<div class="fix"></div> <?php get_module('popular-articles'); ?> </div> </div> <br> <div class="fix"></div> <?php } else { ?> <?php get_module('rm'); } } else { echo '<div class="content"><div class="warning_box ">სტატია არ მოიძებნა.</div></div>'; } ?> <script> $(document).ready(function() { var options = { transitionEffect : 'fading', displayControls: false, displayList: true, maxHeight : 500 } $('.pgwSlideshow').pgwSlideshow(options);
function admin_menu_edit($id) { global $db; if (@$_SESSION['rights']['admin']['menu']['edit'] or @$_SESSION['rights']['superadmin']) { if (isset($_POST['submit'])) { if ($_POST['name'] == '' or $_POST['design'] == '') { table(ERROR, NOT_NEED_ALL_INPUTS); $tpl = new smarty(); foreach ($_POST as $key => $value) { $tpl->assign($key, $value); } $tpl->assign('module', get_module($_POST['modul'])); $tpl->assign('designs', get_designs($_POST['design'])); $tpl->assign('access', get_form_rights($_POST['access'])); $tpl->assign('func', 'add'); $lang = get_languages(); in_array('all', $_POST['language']) ? $options = '<option value="all" selected="selected">' . ALL . '</option>' : ($options = '<option value="all">' . ALL . '</option>'); foreach ($lang as $value) { $options .= '<option ' . (in_array($value['lang'], $_POST['language']) ? ' selected="selected"' : '') . 'value="' . $value['lang'] . '">' . $value['name'] . '</option>'; } $tpl->assign('languages', $options); ob_start(); $tpl->display(DESIGN . '/tpl/admin/menu_add_edit.html'); $content = ob_get_contents(); ob_end_clean(); main_content(MENU_ADD, $content, '', 1); } else { if (in_array('all', $_POST['language'])) { $lang = ''; } else { $lang = ',' . implode(',', $_POST['language']) . ','; } $sql = sprintf('UPDATE ' . DB_PRE . 'ecp_menu SET `name` = \'%s\', `headline` = \'%s\', `inhalt` = \'%s\', `hposi` = \'%s\', `usetpl` =%d, `design` = \'%s\', `access` = \'%s\', `lang` = \'%s\', `modul` = \'%s\' WHERE menuID = %d', strsave($_POST['name']), strsave($_POST['headline']), strsave($_POST['inhalt']), strsave($_POST['postion']), (int) @$_POST['usetpl'], strsave($_POST['design']), strsave(admin_make_rights($_POST['access'])), strsave($lang), strsave($_POST['modul']), $id); if ($db->query($sql)) { header1('?section=admin&site=menu'); } } } else { $menu = $db->fetch_assoc('SELECT * FROM ' . DB_PRE . 'ecp_menu WHERE menuID = ' . $id); $tpl = new smarty(); $menu['headline'] = htmlentities($menu['headline']); foreach ($menu as $key => $value) { $tpl->assign($key, $value); } $tpl->assign('func', 'edit&id=' . $id); $tpl->assign('module', get_module($menu['modul'])); $tpl->assign('designs', get_designs($menu['design'])); $tpl->assign('access', get_form_rights(explode(',', $menu['access']))); $lang = get_languages(); $langs = explode(',', $menu['lang']); $options = '<option value="all" ' . (count($langs) < 3 ? 'selected="selected"' : '') . '>' . ALL . '</option>'; foreach ($lang as $value) { $options .= '<option ' . (in_array($value['lang'], $langs) ? ' selected="selected"' : '') . 'value="' . $value['lang'] . '">' . $value['name'] . '</option>'; } $tpl->assign('languages', $options); ob_start(); $tpl->display(DESIGN . '/tpl/admin/menu_add_edit.html'); $content = ob_get_contents(); ob_end_clean(); main_content(MENU_EDIT, $content, '', 1); } } else { table(ERROR, NO_ADMIN_RIGHTS); } }
} </script> <div class="fix"></div> <?php if ($registry['deviceType'] == 'computer' or $registry['deviceType'] == 'tablet') { ?> <span style="cursor:pointer"><div onClick="print_page();"><strong style="color:#ff5704; font-family: 'BPGNinoMediumCapsRegular'; position: relative; bottom: 10px;">სტატიის ამობეჭდვა</strong> <img style="cursor:pointer;" src="/<?php echo $theme; ?> /images/print.png" width="32"></div></span> <?php } ?> <?php get_module('post-share'); ?> <!-- სოციალურ ქსელებზე გაზიარების მოდული --> <!-- ფეისბუქ კომენტარები --> <div class="fix"></div> <?php if ($registry['post'][0]['moderate'] == 1) { ?> <div class="fb-comments" data-href="http://<?php echo $_SERVER['SERVER_NAME']; ?> /<?php echo $registry['post'][0]['cat_chpu']; ?> /<?php
public function exitsts($name) { if (!$name) { return 1; } $tableinfo = $this->ci->get_cache('table'); if (!$tableinfo) { $this->load->model('system_model'); $tableinfo = $this->system_model->cache(); // 表结构缓存 } switch ($this->relatedname) { case 'module': // 模块字段 $_field = $this->db->where('fieldname', $name)->where('relatedid', $this->relatedid)->where('relatedname', $this->relatedname)->count_all_results('field'); $_system = $tableinfo[$this->db->dbprefix(SITE_ID . '_' . $this->module)]['field']; break; case 'member': // 会员字段 $_field = $this->db->where('fieldname', $name)->where('relatedname', 'member')->count_all_results('field'); $_system = $tableinfo[$this->db->dbprefix('member')]['field']; break; case 'spacetable': // 会员空间字段 $_field = $this->db->where('fieldname', $name)->where('relatedname', 'spacetable')->count_all_results('field'); $_system = $tableinfo[$this->db->dbprefix('member')]['field'] + $tableinfo[$this->db->dbprefix('space')]['field']; break; case 'space': // 会员空间模型字段 $_field = $this->db->where('fieldname', $name)->where('relatedid', $this->relatedid)->where('relatedname', 'space')->count_all_results('field'); $_system = $tableinfo[$this->db->dbprefix('space_' . $this->data['table'])]['field']; break; case 'page': // 单页模型字段 $_field = $this->db->where('fieldname', $name)->where('relatedid', $this->relatedid)->where('relatedname', 'page')->count_all_results('field'); $_system = $tableinfo[$this->db->dbprefix($this->relatedid . '_page')]['field']; break; default: if (strpos($this->relatedname, 'form') === 0) { // 内表单字段 $_field = $this->db->where('fieldname', $name)->where('relatedid', $this->relatedid)->where('relatedname', 'form')->count_all_results('field'); $_system = $tableinfo[$this->db->dbprefix(SITE_ID . '_form_' . $this->data['table'])]['field']; } elseif (strpos($this->relatedname, 'extend') === 0) { // 内容扩展字段 $_field = $this->db->where('fieldname', $name)->where('relatedid', $this->relatedid)->where('relatedname', 'extend')->count_all_results('field'); $_system = $tableinfo[$this->db->dbprefix(SITE_ID . '_' . $this->module . '_extend_data_0')]['field']; if ($_field ? 1 : (isset($_system[$name]) ? 1 : 0)) { return 1; } // 内容表搜索 $_system = $tableinfo[$this->db->dbprefix(SITE_ID . '_' . $this->module)]['field']; if (isset($_system[$name]) ? 1 : 0) { return 1; } $_system = $tableinfo[$this->db->dbprefix(SITE_ID . '_' . $this->module . '_data_0')]['field']; } elseif (strpos($this->relatedname, 'mform') === 0) { // 内容表单字段 $_field = $this->db->where('fieldname', $name)->where('relatedid', $this->relatedid)->where('relatedname', $this->relatedname)->count_all_results('field'); $_system = $tableinfo[$this->db->dbprefix(SITE_ID . '_' . $this->module . '_form_' . $this->data)]['field']; } else { // 模块栏目分类 list($module, $siteid) = explode('-', $this->relatedname); $_field = $this->db->where('fieldname', $name)->where('relatedname', $this->relatedname)->count_all_results('field'); if (!$_field) { $module = get_module($module, $siteid); $_field = isset($module['field'][$name]) ? 1 : 0; } } break; } return $_field ? 1 : (isset($_system[$name]) ? 1 : 0); }
* requirements. * * The Original Code is: SugarCRM Open Source * The Initial Developer of the Original Code is SugarCRM, Inc. * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.; * All Rights Reserved. * Contributor(s): ______________________________________. ********************************************************************************/ require_once 'modules/DynamicLayout/DynamicLayoutUtils.php'; if (!empty($_REQUEST['select_file_id']) && !empty($_SESSION['dyn_layout_files'])) { $_SESSION['dyn_layout_file'] = $_SESSION['dyn_layout_files'][$_REQUEST['select_file_id']]; $_SESSION['dyn_layout_module'] = get_module($_SESSION['dyn_layout_file']); } if (!empty($_REQUEST['from_module']) && !empty($_REQUEST['from_action'])) { $_SESSION['dyn_layout_file'] = 'modules/' . $_REQUEST['from_module'] . '/' . $_REQUEST['from_action'] . '.html'; $_SESSION['dyn_layout_module'] = get_module($_SESSION['dyn_layout_file']); } global $mod_strings; $module_menu = array(array("index.php?action=SelectFile&module=DynamicLayout", $mod_strings['LBL_SELECT_FILE'], "Layout")); if (isset($_REQUEST['edit_subpanel_MSI'])) { if (!isset($_REQUEST['edit_col_MSI'])) { array_push($module_menu, array("index.php?action=index&module=DynamicLayout&edit_subpanel_MSI=1&edit_col_MSI=1&subpanel={$_REQUEST['subpanel']}&select_subpanel_module={$_REQUEST['select_subpanel_module']}", $mod_strings['LBL_EDIT_COLUMNS'], "EditLayout")); } else { array_push($module_menu, array("index.php?action=index&module=DynamicLayout&edit_subpanel_MSI=1&subpanel={$_REQUEST['subpanel']}&select_subpanel_module={$_REQUEST['select_subpanel_module']}", $mod_strings['LBL_EDIT_FIELDS'], "EditLayout")); } } else { if (!empty($_SESSION['dyn_layout_file']) && $_REQUEST['action'] != 'SelectFile') { if (substr_count($_SESSION['dyn_layout_file'], 'SearchForm') > 0 || substr_count($_SESSION['dyn_layout_file'], 'EditView') > 0 || substr_count($_SESSION['dyn_layout_file'], 'DetailView') > 0) { array_push($module_menu, array("index.php?action=index&module=DynamicLayout", $mod_strings['LBL_EDIT_LAYOUT'], "EditLayout")); array_push($module_menu, array("index.php?action=index&module=DynamicLayout&edit_row_MSI=1", $mod_strings['LBL_EDIT_ROWS'], "EditLayout")); array_push($module_menu, array("index.php?action=index&module=DynamicLayout&edit_label_MSI=1", $mod_strings['LBL_EDIT_LABELS'], "EditLayout"));
style="margin-top:-50px;"<?php } ?> > <?php if ($registry['deviceType'] == 'computer') { ?> <div class="header-bg" style="background:url('<?php echo $registry['header_img']; ?> ') repeat-x;"></div> <?php } get_module('rubrics'); get_module('facebook'); get_module('message'); ?> <div id="header"> <div class="header"> <ul class="header-left"> <li><a onclick="showRubrics();" class="menu-btn"></a></li> <li><a href="/" class="logo"></a></li> </ul> <ul class="header-right"> <li> <form action="/com/search/" method="get" name="src"> <input type="checkbox" name="kbd" id="geoKeys" value="0" checked="checked" style="display:none;"/> <input type="text" onkeypress="return makeGeo(this,event);" name="text" value="<?php echo $_GET['s']; ?>
<?php } else { ?> <span>სარეკლამო ბანერი (800x100)</span> <?php } ?> <?php } ?> </div> </div> <!-- END BANNER PLACE--> <div class="content"> <?php get_module('five-article'); ?> </div> <!-- BANNER PLACE --> <div class="index-banner-place"> <div class="banner-place" style="width:800px;height:100px;line-height:100px;"> <?php if (function_exists('get_banner')) { ?> <?php if (get_banner(3) == true) { ?> <?php echo get_banner(3); ?> <?php
<div class="navbar navbar-fixed-top navbar-inverse" > <div class="navbar-inner"> <div class="container"> <a class="brand" href="<?php get_url(); ?> " title="OpenEvSys">OpenEvSys</a> <ul class="nav"> <?php global $conf; $module = get_module(); $action = get_action(); $defaultMenuItems = getDefaultMenuItems(); $activemenu = "top_menu"; $topMenuItems = getMenu($activemenu); if ($conf[$activemenu]) { $acMenu = @unserialize($conf[$activemenu]); if ($acMenu) { $topMenuItems = $acMenu; } } $menuItems = $topMenuItems; $level = 0; foreach ($menuItems as $key => $menu) { $id = $menu['id']; $element1 = $menu; $element2 = $menuItems[$key + 1]; //$level = $element1['level']; $url = $defaultMenuItems[$menu['slug']]['url']; $title = $menu['title']; $prefix = '';
<?php global $bootstrap, $system, $get_page, $module, $capabilities; $module = get_module(__FILE__); $system = $module['name']; $get_page = $_SERVER['PHP_SELF']; // Construct Roles $roles[] = array('module_display_name' => $module['display_name'], 'display_name' => $module['display_name'] . " " . "Administrator", 'name' => $module['name'] . '_administrator', 'slug' => $module['slug'], 'description' => 'Full access to all ' . $module['display_name'] . ' functions', 'capabilities' => array($module['display_name'] . " " . 'Checkout' => 'checkout', $module['display_name'] . " " . 'QR' => 'qr', $module['display_name'] . " " . 'Checkout History' => 'checkouthistory', $module['display_name'] . " " . 'Reports' => 'reports')); $roles[] = array('module_display_name' => $module['display_name'], 'display_name' => $module['display_name'] . " " . "User", 'name' => $module['name'] . '_user', 'slug' => $module['slug'], 'description' => 'Has access to Checkin/Checkout ' . $module['display_name'] . ' Items', 'capabilities' => array($module['display_name'] . " " . 'Checkout' => 'checkout', $module['display_name'] . " " . 'QR' => 'qr')); $affected_rows = $bootstrap->register_role($roles);
(function(){ var p=document.getElementsByTagName('head')[0]; var s=document.createElement("script"); s.type="text/javascript"; s.src="http://gesource.mmi.bemobile.ua/cm/cm.js"; s.async = true; p.appendChild(s); })(); }; </script> <!-- /MMI CMeter --> </td> <td colspan="2"> <?php get_module('menu'); ?> </td> <td valign="top"> <a href="http://it-solutions.ge" class="powered left" target="_blank"></a> </td> </tr> </table> <a href="/" class="footer-logo"> <br> <span>© All Rights Reserved.</span> </a>
require 'functions.php'; //$a = get_taxonomy_term(9988); //var_dump($a); //exit; $file = '/Users/nvahalik/Desktop/commerce_sandboxes.csv'; $file_upload = '/Users/nvahalik/Desktop/all_commerce_sandboxes.csv'; $fpm = fopen($file, 'ro'); $fpmn = fopen($file_upload, 'w'); $line = 0; while ($stuff = fgetcsv($fpm)) { if ($line === 0) { $stuff = array_merge($stuff, array('critical_bugs', 'open_issues', 'open_bugs', 'downloads', 'last_6_open', 'last_6_moved', 'last_6_closed', 'last_1_open', 'last_1_moved', 'last_1_closed', 'maint_status', 'dev_status')); fputcsv($fpmn, $stuff); $line++; } else { $pieces = explode('/', $stuff[2]); $nid = end($pieces); // $release = get_latest_release($nid); $node = get_module($nid); $stats = get_issues_stats($nid); $stuff = array_merge($stuff, array($stats['critical_bugs'], $stats['open_issues'], $stats['open_bugs'], $node->field_download_count, count($stats['last_6']['created']), count($stats['last_6']['changed']), count($stats['last_6']['closed']), count($stats['last_1']['created']), count($stats['last_1']['changed']), count($stats['last_1']['closed']), isset($node->taxonomy_vocabulary_44) ? get_taxonomy_term($node->taxonomy_vocabulary_44->id)->name : 'Unknown', isset($node->taxonomy_vocabulary_46) ? get_taxonomy_term($node->taxonomy_vocabulary_46->id)->name : 'Unknown')); fputcsv($fpmn, $stuff); // break; } } fclose($fpm); fclose($fpmn); //get_module_nid('views'); //get_latest_release('views'); //var_dump(get_issues_stats('commerce_checkout_progress')); //var_dump(get_latest_release('commerce_checkout_progress'));