本文整理汇总了PHP中Common::inc_module_factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Common::inc_module_factory方法的具体用法?PHP Common::inc_module_factory怎么用?PHP Common::inc_module_factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common
的用法示例。
在下文中一共展示了Common::inc_module_factory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: incroute
function incroute($data)
{
if (is_array($data)) {
foreach ($data as $modulename => $route_function) {
//wake up module
if ($module = Common::inc_module_factory($modulename)) {
//execute + result context
$module->executex($route_function, $this);
}
}
}
}
示例2: send_link
function send_link($params)
{
global $_COMMON_SITE_CONF;
$m = Common::inc_module_factory('Mail');
$m->From($_COMMON_SITE_CONF['admin_email']);
$m->To($params['email']);
$m->Content_type('text/html');
$m->Subject('ссылка с сайта ' . HOST . ' от ' . $_SESSION['siteuser']['userdata']['Name']);
$m->Body('Ђ«дравствуйте, ваш коллега ' . $_SESSION['siteuser']['userdata']['Name'] . ' из компании ' . $_SESSION['siteuser']['userdata']['Company'] . ' просматрива¤ ассортимент бизнес-сувениров на сайте <a href="upress.by">upress.by</a> решил рекомендовать вам следующий товар:
<a href=' . $params['href'] . '>' . $params['href'] . '</a>', 'windows-1251');
$m->Priority(1);
$m->Send();
$this->result['ok'] = true;
}
示例3: list_recycled
function list_recycled($parameters)
{
$TD = Common::inc_module_factory('TTreeSource');
$options['startNode'] = $parameters['anc_id'];
$options['shownodesWithObjType'] = array('_RECYCLEOBJ');
$options['columnsAsParameters'] = array('name' => 'Name', 'createTime' => 'createTime', 'module' => 'module');
$options['filter']['createTime'] = array('name' => 'fromtimestamp', 'format' => 'd-m-y H:i:s');
$options['preventDots'] = true;
$options['columnsAsStructs'] = array('id' => 'id');
$options['sequence'] = array('id', 'name', 'createTime', 'module');
$options['gridFormat'] = 1;
$TD->init_from_source($this->_tree);
$TD->setOptions($options);
$TD->CreateView(1);
$this->result['data_set'] = $TD->result['data_set'];
}
示例4: rss
function rss()
{
global $REQUEST_ASSOC, $TPA;
if ($node = $this->_tree->getNodeInfo($REQUEST_ASSOC['id'])) {
Common::inc_module_factory('feedWriter', true);
//Creating an instance of FeedWriter class.
//The constant RSS2 is passed to mention the version
$feed = new FeedWriter();
//Setting the channel elements
//Use wrapper functions for common channel elements
$feed->setTitle(CHOST . ' - ' . $node['basic']);
$feed->setLink(CHOST);
$feed->setDescription(CHOST);
//Image title and link must match with the 'title' and 'link' channel elements for RSS 2.0
//$TestFeed->setImage('Testing the RSS writer class','http://www.ajaxray.com/projects/rss','http://www.rightbrainsolution.com/images/logo.gif');
//Use core setChannelElement() function for other optional channels
$node['params']['lang'] = 'ru';
$feed->setChannelElement('language', $node['params']['lang']);
if ($interval = $this->_common_obj->select_news_interval($node_id, 0, 10, '', '', false, $active = 1)) {
foreach ($interval as $news) {
//Create an empty FeedItem
$newItem = $feed->createNewItem();
//Add elements to the feed item
//Use wrapper functions to add common feed elements
$newItem->setTitle($news['header']);
$newItem->setLink($TPA->page_link . '/~shownews/' . $news['id']);
//The parameter is a timestamp for setDate() function
$date = strtotime($news['sortdate']);
$newItem->setDate($date);
$newItem->setDescription($news['news_short']);
$newItem->addElement('author', 'admin@admi.ru');
//Attributes have to passed as array in 3rd parameter
$newItem->addElement('guid', 'http://www.ajaxray.com', array('isPermaLink' => 'true'));
//Now add the feed item
$feed->addItem($newItem);
}
$feed->genarateFeed();
die;
}
}
}
示例5: add_question
function add_question($params)
{
global $TDB, $TMS, $TPA, $_COMMON_SITE_CONF;
if ($_SESSION['captcha'][intval($_POST["category"])] == $_POST['captcha']) {
unset($_SESSION['captcha'][(int) $_POST["category"]]);
} else {
return $TMS->parseSection('error');
}
$TMS->AddFileSection(Common::get_fmodule_tpl_path('faq', $params['cTemplate']));
$cat_id = (int) $_POST['category'];
$cat = $this->_tree->getNodeInfo($cat_id);
$cat["params"]["moderation"] ? $active = 2 : ($active = 1);
$fields = array("active" => $active, "date" => "'" . date('Y-m-d G:i:s') . "'", "user" => "'" . mysql_real_escape_string($_POST["user"]) . "'", "email" => "'" . mysql_real_escape_string($_POST["email"]) . "'", "question" => "'" . mysql_real_escape_string($_POST["question"]) . "'", "sanswer" => "''", "answer" => "''");
$HL = array_keys($fields);
$query = 'INSERT INTO `faq` (cat_id,' . implode(',', $HL) . ') VALUES(' . $cat_id . ', ' . implode(',', array_values($fields)) . ');';
if ($TDB->query($query)) {
if ($cat['params']['email'] != '') {
$TMS->AddMassReplace('letter', $fields);
$TMS->AddReplace('letter', 'category_name', $cat['params']['Name']);
$TMS->AddReplace('letter_subject', 'category_name', $cat['params']['Name']);
$m = Common::inc_module_factory('Mail');
$m->To($cat['params']['email']);
$m->From($_COMMON_SITE_CONF['admin_email']);
$m->Subject($TMS->parseSection('letter_subject'));
$m->Content_type('text/html');
$m->Body($TMS->parseSection('letter'), $_COMMON_SITE_CONF['site_encoding']);
$m->Send();
}
if (!$cat["params"]["moderation"]) {
$query = "SELECT count(*) as xcount FROM `faq` WHERE `cat_id` = " . $cat["id"] . " AND `active` = 1;";
$r = $TDB->get_results($query);
$cat["params"]["count"] = $r[1]["xcount"];
$this->_tree->ReInitTreeOBJ($cat["id"], '%SAME%', $cat["params"]);
}
$TMS->AddReplace('success', 'backlink', $TPA->page_link);
return $TMS->parseSection('success');
} else {
return $TMS->parseSection('error');
}
}
示例6: start_subscribe
function start_subscribe($params)
{
global $TDB, $TMS, $_CONFIG;
if ($params['first']) {
unset($_SESSION['emails'], $_SESSION['slist'], $_SESSION['sended'], $_SESSION['total'], $_SESSION['subcur']);
}
if (!isset($_SESSION['slist']) && !isset($_SESSION['emails'])) {
if ($subs = $TDB->get_results("SELECT * FROM subscribe WHERE status = 'incoming' ORDER BY cat_id, id")) {
$i = 0;
$ucount = 0;
$scount = count($subs);
// сохраняем список рассылки сессию
foreach ($subs as $sub) {
$_SESSION['slist'][$i] = $sub;
$users = $TDB->get_results('
SELECT subscribers_params.user_id AS user_id, subscribers_list.email AS email
FROM subscribers_params
LEFT JOIN subscribers_list ON subscribers_params.user_id = subscribers_list.id
WHERE subscribers_params.subscribe_id = ' . $sub['cat_id'] . ' AND subscribers_list.status = \'active\'
');
$ucount += count($users);
$_SESSION['emails'][$i] = array_values($users);
$i++;
}
$_SESSION['sended'] = 0;
$_SESSION['total'] = $ucount;
} else {
// рассылок, ожидающих отправки нет
$this->result['ready'] = false;
$this->result['error'] = true;
return $this->result;
}
// возвращаем для повторного входа
$this->result['ready'] = true;
$this->result['error'] = false;
$this->result['scount'] = $scount;
$this->result['ucount'] = $ucount;
return $this->result;
}
if (isset($_SESSION['emails']) && is_array($_SESSION['emails']) && isset($_SESSION['slist']) && is_array($_SESSION['slist'])) {
$list = $_SESSION['slist'];
$arr = $_SESSION['emails'];
$last_sub = end(array_keys($list));
reset($list);
reset($arr);
$sended = array();
while (list($key, $item) = each($list)) {
if (isset($arr[$key])) {
$cat_params = $this->_tree->getNodeParam($item['cat_id']);
$fields = $this->parseMessageFields($item, $cat_params);
$theme = $cat_params['theme'];
if (!empty($item['theme'])) {
$theme = $item['theme'];
}
$theme = XCODE::win2utf($theme);
$m = Common::inc_module_factory('Mail');
$m->From($cat_params['from']);
$m->Subject($theme);
$m->Content_type($fields['content-type']);
$m->Body($fields['message'], $fields['encoding']);
if (!empty($item['files'])) {
if (is_string($item['files'])) {
$item['files'] = split(',', $item['files']);
}
if (is_array($item['files'])) {
foreach ($item['files'] as $f) {
$type = pathinfo($f, PATHINFO_EXTENSION);
$f = DOCUMENT_ROOT . $f;
if (isset($this->mtype[$type])) {
$m->Attach($f, $this->mtype[$type]);
} else {
$m->Attach($f);
}
}
}
}
$start = Common::getmicrotime();
$last_key = end(array_keys($arr[$key]));
foreach ($arr[$key] as $k => $i) {
$m->sendto = array();
$m->To($i['email']);
if ($m->Send()) {
$sended = array_shift($_SESSION['emails'][$key]);
$_SESSION['sended']++;
if ($last_key == $k) {
// если последний адрес
$this->markSent($item['cat_id']);
// array_shift($_SESSION['slist'][$key]);
unset($_SESSION['slist'][$key]);
}
if (Common::getmicrotime() - $start > $_CONFIG['subscribe']['update_interval']) {
$this->result['next'] = true;
$this->result['sub'] = $item;
// инфо о рассылке
$this->result['sended'] = $sended;
}
}
}
if ($last_sub == $key) {
$this->result['next'] = false;
//.........这里部分代码省略.........
示例7: indexes_table
function indexes_table($parameters)
{
global $_CONFIG;
$TTS = Common::inc_module_factory('TTableSource');
$options['table'] = 'search_pages_index';
$options['where'] = '1=1 order by id';
$options['gridFormat'] = 1;
$options['columns'] = array('id', 'url', 'title', 'body', 'status');
$options['sequence'] = array('id', 'url', 'title', 'body', 'status');
$options['filter']['body'] = array('name' => 'cutwords', 'count' => '30');
$TTS->setOptions($options);
$this->result['data_set'] = $TTS->CreateView();
}
示例8: save_edited_question
function save_edited_question($params)
{
global $_COMMON_SITE_CONF, $TMS;
if ($params) {
global $TDB;
$q = "UPDATE `faq` SET `cat_id` = '" . (int) $params['category'] . "'" . ",`question` = '" . mysql_real_escape_string($params['question']) . "'" . ",`date` = '" . mysql_real_escape_string($params['date']) . "'" . ",`sanswer` = '" . mysql_real_escape_string($params['sanswer']) . "'" . ",`answer` = '" . mysql_real_escape_string($params['answer']) . "'" . ",`user` = '" . mysql_real_escape_string($params['user']) . "'" . ",`email` = '" . mysql_real_escape_string($params['email']) . "'" . ",`active` = '" . (int) $params['active'] . "'" . ' WHERE id = ' . (int) $params['id'];
$TDB->get_results($q);
$this->result['is_saved'] = $TDB->result;
$cat = $this->_tree->getNodeParam($params['category']);
$answer = $params['answer'];
if ($params["lTemplate"] && $params["send_answer"]) {
$TMS->AddFileSection(Common::get_fmodule_tpl_path('faq', $params["lTemplate"]));
$TMS->AddMassReplace('letter', $params);
$TMS->AddMassReplace('letter', array('server' => $_SERVER['HTTP_HOST']));
$TMS->AddReplace('letter', 'category_name', $cat["Name"]);
$TMS->AddReplace('letter_subject', 'category_name', $cat["Name"]);
$m = Common::inc_module_factory('Mail');
$m->To($params['email']);
if ($cat["email"]) {
$m->From($cat["email"]);
}
$m->Subject($TMS->parseSection('letter_subject'));
$m->Content_type('text/html');
$m->Body($TMS->parseSection('letter'), $_COMMON_SITE_CONF['site_encoding']);
$this->result['emailed'] = $m->Send();
} else {
$this->result['emailed'] = false;
}
$this->reinit_formsgroup($params['category']);
}
}
示例9: parse_xls_file
function parse_xls_file($params)
{
$params = $params[0];
Common::inc_module_factory('ExcelReader', true);
$data = new Spreadsheet_Excel_Reader(PATH_ . $params['xls_file']);
return $data->dump(false, false, 0, $params['class']);
}
示例10: load_xlist_data
function load_xlist_data($parameters)
{
$TD = Common::inc_module_factory('TTreeSource');
$options['startNode'] = $parameters['anc_id'];
$options['shownodesWithObjType'] = array('_CONTENTGROUP', '_CONTENT');
$options['columnsAsParameters'] = array('LastModified' => 'LastModified', 'name' => 'Name');
$options['columnsAsStructs'] = array('image' => 'obj_type');
$options['transformResults']['image'] = array('_CONTENTGROUP' => 'group', '_CONTENT' => 'page');
$options['selectable'] = array('image' => array('_CONTENT'));
//obj_tree является прямым потомком Tree поэтому его использование обосновано
$this->result['data_set'] = null;
$TD->init_from_source($this->_common_obj->obj_tree);
$TD->setOptions($options);
$TD->CreateView($parameters['anc_id']);
$this->result['data_set'] = $TD->result['data_set'];
}
示例11: fusers_table
function fusers_table($params)
{
$TD = Common::inc_module_factory('TTreeSource');
$options['startNode'] = $params['id'];
$options['shownodesWithObjType'] = array('_FUSER');
$options['columnsAsParameters'] = array('name' => 'Name', 'fio' => 'Email', 'active' => 'Active');
$options['preventDots'] = true;
$options['columnsAsStructs'] = array('id' => 'id', 'basic' => 'basic');
$options['gridFormat'] = 1;
$TD->init_from_source($this->_tree);
$TD->setOptions($options);
$TD->CreateView($params['id']);
$this->result = $TD->result;
}
示例12: goods_to_order
function goods_to_order($user_id, $template = null)
{
global $TDB, $TMS, $_COMMON_SITE_CONF;
if (!empty($_SESSION['siteuser']['cart'])) {
$_POST['hours'] = isset($_POST['hours']) ? $_POST['hours'] : '00';
$_POST['minutes'] = isset($_POST['minutes']) ? $_POST['minutes'] : '00';
$deliv_time = $_POST['hours'] . ':' . $_POST['minutes'] . ':' . '00';
$tunes = $this->_common_obj->get_tunes();
if (!$_SESSION['siteuser']['paysystem']) {
$_SESSION['siteuser']['paysystem'] = $_POST['payment_method'];
}
if ($_SESSION['siteuser']['userdata']) {
if (isset($_POST['address']) && $_POST['address']) {
$address = mysql_real_escape_string(isset($_POST['address']) ? $_POST['address'] : ' ');
} else {
$address = mysql_real_escape_string($_SESSION['siteuser']['userdata']['address']);
}
$phone = $_SESSION['siteuser']['userdata']['Phone'];
$email = $_SESSION['siteuser']['userdata']['Email'];
$name = $_SESSION['siteuser']['userdata']['Name'];
} else {
$address = mysql_real_escape_string(isset($_POST['address']) ? $_POST['address'] : ' ');
$phone = isset($_POST['phone']) ? $_POST['phone'] : ' ';
$email = mysql_real_escape_string(isset($_POST['email']) ? $_POST['email'] : ' ');
$name = $_POST['fio'];
}
if ($paysystem = $_SESSION['siteuser']['paysystem']) {
$paysystem_order_num = $_SESSION['siteuser']['cart'][$paysystem . '_order_num'];
}
$order_data = array('id' => 'null', 'date' => 'NOW()', 'client' => isset($user_id) ? (int) $user_id : 0, 'currency' => isset($_SESSION['currency']) ? $_SESSION['currency']['alias'] : ' ', 'delivery_type' => isset($_POST['deliveryType']) ? $_POST['deliveryType'] : ' ', 'Name' => $name, 'address' => $address, 'phone' => $phone, 'email' => $email, 'total_sum' => 0, 'status' => 1, 'comments' => mysql_real_escape_string($_POST['comments']), 'deliv_time' => $deliv_time, 'paysystem' => $paysystem, 'paysystem_order_num' => $paysystem_order_num);
if ($paysystem) {
if (method_exists($this, $paysystem)) {
$order_data = $this->{$paysystem}($order_data);
}
}
$TMS->AddMassReplace('ishop_cart_email', $order_data);
if ($TDB->InsertIN('ishop_orders', $order_data)) {
$lid = $TDB->last_inserted;
$total_sum = 0;
$order_data['id'] = $lid;
foreach ($_SESSION['siteuser']['cart'] as $id => $obj) {
if ($obj['ext_data']['outer_price']) {
$price = (double) str_replace(array(',', ' '), array('.', ''), $obj['ext_data']['outer_price']);
} else {
$price = $obj['details']['props'][$tunes['PriceProperty']];
}
if (!$tunes['NameProperty']) {
$tunes['NameProperty'] = 'Name';
}
$order_item = array('id' => 'null', 'order_id' => $lid, 'cat_id' => $obj['details']['id'], 'count' => $obj['count'], 'name' => $obj['details']['props'][$tunes['NameProperty']], 'comments' => $obj['comments'], 'price' => $price);
$TMS->AddMassReplace('ishop_cart_object_email', $obj['details']['props']);
$TMS->AddMassReplace('ishop_cart_object_email', $order_item);
$TMS->parseSection('ishop_cart_object_email', true);
$TDB->InsertIN('ishop_orders_goods', $order_item);
$total_sum += floatval($price) * $obj['count'];
}
$ts = round($total_sum, 2);
if ($_POST['extended']) {
$TMS->AddMassReplace('ishop_cart_email', $_POST['extended']);
}
$order_data['total_sum'] = $ts;
if ($_SESSION['siteuser']['userdata']) {
$order_data['email'] = $_SESSION['siteuser']['userdata']['Email'];
$order_data['Name'] = $_SESSION['siteuser']['userdata']['Name'];
$order_data['company'] = $_SESSION['siteuser']['userdata']['Company'];
}
if ($paysystem) {
if (method_exists($this, $pa = $paysystem . '_after')) {
$order_data = $this->{$pa}($order_data);
}
}
$this->order_data = $order_data;
$TMS->AddMassReplace('ishop_cart_email', $order_data);
if ($tunes['Emails'] && ($emails = explode(',', $tunes['Emails']))) {
$m = Common::inc_module_factory('Mail');
$m->From($_COMMON_SITE_CONF['admin_email']);
$m->To($emails);
$m->Content_type('text/html');
$m->Subject($tunes['EmailSubject']);
$m->Body($TMS->parseSection('ishop_cart_email'), $tunes['EmailEncoding']);
$m->Priority(2);
$m->Send();
}
$TDB->UpdateIN('ishop_orders', $lid, array('total_sum' => $ts));
return true;
}
}
}
示例13: load_xlist_link_pages
function load_xlist_link_pages($parameters)
{
Common::call_common_instance('pages');
$pages =& pages_module_common::getInstance(true);
$TD = Common::inc_module_factory('TTreeSource');
$options['startNode'] = $parameters['anc_id'];
$options['shownodesWithObjType'] = array('_PAGE', '_LINK', '_GROUP', '_ROOT');
$options['columnsAsParameters'] = array('name' => 'Name');
$options['columnsAsStructs'] = array('image' => 'obj_type');
$options['transformResults']['image'] = array('_GROUP' => 'group', '_PAGE' => 'page', '_LINK' => 'page', '_ROOT' => 'group');
$options['selectable'] = array('image' => array('_PAGE', '_LINK', '_GROUP', '_ROOT'));
$this->result['data_set'] = null;
$TD->init_from_source($pages->obj_tree);
$TD->setOptions($options);
$TD->CreateView($parameters['anc_id']);
$this->result = array_merge_recursive($TD->result, $this->result);
}
示例14: get_banner_info
function get_banner_info($fname, $type)
{
$fname = Common::media_path($this->_module_name) . $params['fname'];
switch ($type) {
case 'gif':
$size = getimagesize($fname);
$banner_info = array('width' => $size[0], 'height' => $size[1]);
break;
case 'flash':
$SWF = Common::inc_module_factory('swfheader');
$SWF->loadswf($fname);
$banner_info = array('width' => $SWF->width, 'height' => $SWF->height);
break;
}
return $banner_info;
}
示例15: load_messages
function load_messages($parameters)
{
global $_CONFIG;
$TTS = Common::inc_module_factory('TTableSource');
$options['startRow'] = 0;
$options['table'] = 'messages';
$options['where'] = 'archive=' . $parameters['archive'] . ' order by id DESC';
$options['rows_per_page'] = $_CONFIG['news']['admin_rows_per_page'];
$options['columns'] = array('id', 'form_id', 'Name', 'date', 'status', 'archive');
$options['gridFormat'] = 1;
$options['sequence'] = array('id', 'date', 'Name', 'status');
$this->result['data_set'] = null;
$TTS->setOptions($options);
$this->result['data_set'] = $TTS->CreateView();
}