-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnewposts.model.php
87 lines (79 loc) · 1.76 KB
/
newposts.model.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/**
* vi:set sw=4 ts=4 noexpandtab fileencoding=utf8:
* @class newpostsModel
* @author NURIGO ([email protected])
* @brief newpostsModel
*/
class newpostsModel extends newposts
{
/**
* @brief constructor
*
*/
function init()
{
}
/**
* @brief get newposts module config
*
**/
function getModuleConfig()
{
if (!$GLOBALS['__newposts_config__'])
{
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('newposts');
$GLOBALS['__newposts_config__'] = $config;
}
return $GLOBALS['__newposts_config__'];
}
/**
* @brief get config list by module srl
*
**/
function getConfigListByModuleSrl($module_srl)
{
if (!$module_srl) return false;
$args->module_srl = $module_srl;
$output = executeQueryArray("newposts.getConfigByModuleSrl", $args);
if (!$output->toBool() || !$output->data) return false;
$config_list = $output->data;
foreach($config_list as $key=>$val)
{
$extra_vars = unserialize($val->extra_vars);
if ($extra_vars)
{
foreach ($extra_vars as $key2 => $val2)
{
$config_list[$key]->{$key2} = $val2;
}
}
}
return $config_list;
}
/**
* @brief get registered sender ids
*/
function getRegisteredSenderIds()
{
$coolsms = $this->__getCoolsms();
$coolsms->get_senderid_list();
$result = $coolsms->getResult();
return $result;
}
/**
* @brief get coolsms object
*/
function __getCoolsms()
{
$logged_info = Context::get('logged_info');
if(!$logged_info) return new Object(-1, 'login required');
$user_id = $logged_info->user_id;
$password = $logged_info->password;
require "coolsms.php";
return new Coolsms($user_id, $password, true);
}
}
/* End of file newposts.model.php */
/* Location: ./modules/newposts/newposts.model.php */