Auth.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  1. <?php
  2. namespace Manage\Src;
  3. use Dever;
  4. use Dever\Routing\Uri;
  5. use Dever\Session\Oper;
  6. use Dever\String\Encrypt;
  7. class Auth
  8. {
  9. /**
  10. * 后台的session名
  11. *
  12. * @var string
  13. */
  14. private $name;
  15. /**
  16. * save
  17. *
  18. * @var Dever\Plad\Save
  19. */
  20. private $save;
  21. private $top;
  22. /**
  23. * __construct
  24. *
  25. * @return mixed
  26. */
  27. public function __construct()
  28. {
  29. $this->save = new Oper(false, 'session');
  30. $this->name = 'manage';
  31. }
  32. public function test()
  33. {
  34. return array('name' => 'test', 'check' => false, 'data' => array
  35. (
  36. 0 => array('name' => 'haha1'),
  37. 1 => array('name' => 'haha2'),
  38. ));
  39. }
  40. /**
  41. * 只获取中间的内容部分
  42. *
  43. * @return mixed
  44. */
  45. public function loading()
  46. {
  47. $set = Dever::input('loading');
  48. if ($set) {
  49. Dever::config('base')->url = 'loading=' . $set;
  50. }
  51. return $set;
  52. }
  53. /**
  54. * 获取角色
  55. *
  56. * @return mixed
  57. */
  58. public function role_api()
  59. {
  60. $data = Dever::db('manage/role')->alls(array
  61. (
  62. /* list和all可以自定义参数
  63. 'option' => array
  64. (
  65. 'name' => array('yes', 'like')
  66. ),
  67. */
  68. //'option_name' => '%' . Dever::input('term', 'test') . '%')
  69. 'option_name' => Dever::input('term', 'test'))
  70. );
  71. //Dever::debug($data);
  72. if ($data) {
  73. return $data;
  74. }
  75. return array
  76. (
  77. 0 => array('id' => -1, 'value' => '没有找到您搜索的数据', 'label' => '没有找到您搜索的数据'),
  78. );
  79. }
  80. public function blur()
  81. {
  82. $value = Dever::input('value');
  83. return 1;
  84. }
  85. /**
  86. * 获取当前登录的管理员信息
  87. *
  88. * @return mixed
  89. */
  90. public function info($state = true)
  91. {
  92. return $this->real($this->data(), $state);
  93. }
  94. /**
  95. * 获取当前登录的管理员信息
  96. *
  97. * @return mixed
  98. */
  99. public function authData($state = true)
  100. {
  101. $data = $this->info($state);
  102. if (isset($data['role_info']['auth_data'])) {
  103. return $data['role_info']['auth_data'];
  104. }
  105. return '';
  106. }
  107. /**
  108. * 实时读取信息
  109. *
  110. * @return mixed
  111. */
  112. public function real($info, $state = true)
  113. {
  114. if ($state == true && Dever::config('base')->getAdmin && $info && isset($info['id'])) {
  115. $admin = Dever::db('manage/admin')->one($info['id']);
  116. if ($admin['top']) {
  117. $info['top'] = $admin['top'];
  118. }
  119. }
  120. if (!$info) {
  121. $info = $this->auth();
  122. if ($info) {
  123. $this->save($info);
  124. Dever::location(Dever::url(''));
  125. }
  126. }
  127. if (isset($info['role']) && $info['role']) {
  128. $info['role_info'] = Dever::db('manage/role')->one($info['role']);
  129. $info['rolename'] = '未分组';
  130. if ($info['role_info']['name']) {
  131. $info['rolename'] = $info['role_info']['name'];
  132. }
  133. $info['self'] = $info['role_info']['self'];
  134. $info['col_update'] = $info['role_info']['col_update'];
  135. $info['col_insert'] = $info['role_info']['col_insert'];
  136. $info['col_select'] = $info['role_info']['col_select'];
  137. }
  138. if (isset($info['group']) && $info['group']) {
  139. $info['group_info'] = Dever::db('manage/group')->one($info['group']);
  140. }
  141. return $info;
  142. }
  143. /**
  144. * 获取当前登录的管理员信息
  145. *
  146. * @return mixed
  147. */
  148. public function data($state = true)
  149. {
  150. return $this->save->get($this->name);
  151. }
  152. private function auth()
  153. {
  154. # 此处可以接入当前的用户系统
  155. /*
  156. $user = \CondeAdminUser::GetAdminInfo('manage', '后台管理');
  157. $info = Dever::load('manage/admin-user', array('where_username' => $user['name']));
  158. //$info = Dever::load('manage/admin-user', array('where_email' => $user['email']));
  159. if(!$info)
  160. {
  161. $id = Dever::load('manage/admin-insert', array('add_role' => 1, 'add_username' => $user['name'], 'add_email' => $user['email']));
  162. $info = Dever::load('manage/admin-one', $id);
  163. }
  164. return $info;
  165. */
  166. return false;
  167. }
  168. /**
  169. * 获取公告
  170. *
  171. * @return mixed
  172. */
  173. public function notice()
  174. {
  175. $admin = $this->info();
  176. if ($admin && $admin['config'] && isset($admin['config']['id']) && $admin['config']['id'] > 0) {
  177. $data = Dever::db('manage/notice')->getAll(array('where_config' => $admin['config']['id']));
  178. return $data;
  179. }
  180. return array();
  181. }
  182. /**
  183. * 获取当前登录的管理员信息
  184. *
  185. * @return mixed
  186. */
  187. public function manage()
  188. {
  189. $admin = $this->info();
  190. if ($admin && $admin['id'] == 1) {
  191. return '';
  192. }
  193. return 'display:none;';
  194. }
  195. /**
  196. * 退出登录
  197. *
  198. * @return mixed
  199. */
  200. public function quit_api()
  201. {
  202. if ($this->info()) {
  203. $this->save->un($this->name);
  204. }
  205. Dever::location('login');
  206. }
  207. /**
  208. * login
  209. *
  210. * @return mixed
  211. */
  212. public function login_api()
  213. {
  214. //$param['where_username'] = Dever::input('username');
  215. $username = Dever::input('username');
  216. if (strstr($username, '@')) {
  217. $param['where_email'] = $username;
  218. $method = 'email';
  219. } else {
  220. $param['where_mobile'] = $username;
  221. $method = 'mobile';
  222. }
  223. $password = hash('sha256', Dever::input('password'));
  224. $user = Dever::db('manage/admin')->$method($param);
  225. if (!$user) {
  226. $total = Dever::db('manage/admin')->total();
  227. if ($total <= 0) {
  228. $insert['username'] = $username;
  229. $insert[$method] = $username;
  230. $insert['password'] = Dever::input('password');
  231. $insert['status'] = $insert['state'] = 1;
  232. $insert['role'] = 1;
  233. Dever::db('manage/admin')->insert($insert);
  234. $param['time'] = 1;
  235. $user = Dever::db('manage/admin')->$method($param);
  236. } else {
  237. Dever::alert('登录失败');
  238. }
  239. }
  240. if ($user && $user['password'] == $password) {
  241. $this->save($user);
  242. $refer = Dever::input('refer');
  243. if ($refer) {
  244. $refer = Encrypt::decode($refer);
  245. Dever::out($refer);
  246. } else {
  247. Dever::out(Dever::url('home'));
  248. }
  249. } else {
  250. Dever::alert('登录失败');
  251. }
  252. }
  253. public function update($id)
  254. {
  255. $id = Dever::input('update_where_id');
  256. $admin = $this->info();
  257. if ($id > 0 && $id == $admin['id']) {
  258. $user = Dever::db('manage/admin')->one($id);
  259. $this->save($user);
  260. }
  261. }
  262. public function save(&$user)
  263. {
  264. if ($user['config']) {
  265. $user['config'] = Dever::db('manage/config')->one($user['config']);
  266. }
  267. if ($user['id'] == 1) {
  268. $user['oper'] = 'all';
  269. $user['auth'] = 'all';
  270. $user['auth_data'] = 'all';
  271. $user['top'] = 'all';
  272. } else {
  273. $user = $this->role($user);
  274. }
  275. $this->save->add($this->name, $user, 3600 * 24 * 7);
  276. }
  277. /**
  278. * get_role
  279. *
  280. * @return mixed
  281. */
  282. private function role($user)
  283. {
  284. $role = Dever::db('manage/role')->get(array('where_id' => $user['role']));
  285. if ($role) {
  286. $user['oper'] = array();
  287. $user['auth'] = array();
  288. $user['auth_data'] = array();
  289. $user['self'] = 2;
  290. $top = array();
  291. foreach ($role as $k => $v) {
  292. if ($v['oper']) {
  293. if (strpos($v['oper'], ',') !== false) {
  294. $user['oper'] += explode(',', $v['oper']);
  295. } else {
  296. $user['oper'][] = $v['oper'];
  297. }
  298. }
  299. if ($v['auth']) {
  300. $user['auth'][] = $v['auth'];
  301. }
  302. if ($v['auth_data']) {
  303. $user['auth_data'][] = $v['auth_data'];
  304. }
  305. if (!$user['top'] && $v['top']) {
  306. $top[] = $v['top'];
  307. }
  308. if ($v['self'] == 1) {
  309. $user['self'] = $v['self'];
  310. }
  311. }
  312. $user['oper'] = implode(',', $user['oper']);
  313. $user['auth'] = implode(',', $user['auth']);
  314. $user['auth_data'] = implode(',', $user['auth_data']);
  315. if (!$user['top'] && $top) {
  316. $user['top'] = implode(',', $top);
  317. }
  318. $user['oper'] = $this->super($user['oper']);
  319. $user['auth'] = $this->super($user['auth']);
  320. $user['auth_data'] = $this->super($user['auth_data']);
  321. $user['top'] = $this->super($user['top']);
  322. if ($user['top'] != 'all') {
  323. # 这块暂时不用
  324. //$top = explode(',', $user['top']);
  325. //Dever::load('manage/top.update_action', $top[0]);
  326. }
  327. /*
  328. if (strpos($user['oper'], 'all') !== false) {
  329. $user['oper'] = 'all';
  330. }
  331. if (strpos($user['auth'], 'all') !== false) {
  332. $user['auth'] = 'all';
  333. }
  334. if (strpos($user['auth_data'], 'all') !== false) {
  335. $user['auth_data'] = 'all';
  336. }
  337. if (strpos($user['top'], 'all') !== false) {
  338. $user['top'] = 'all';
  339. } elseif ($user['top']) {
  340. # 这块暂时不用
  341. //$top = explode(',', $user['top']);
  342. //Dever::load('manage/top.update_action', $top[0]);
  343. }
  344. */
  345. }
  346. return $user;
  347. }
  348. private function super($auth)
  349. {
  350. return $auth;
  351. if ($auth == 'all' || strpos($auth, 'all,') !== false) {
  352. $auth = 'all';
  353. }
  354. return $auth;
  355. }
  356. /**
  357. * location_login
  358. *
  359. * @return mixed
  360. */
  361. public function location_login()
  362. {
  363. $refer = Encrypt::encode(Dever::url());
  364. return Dever::location('manage/login?refer=' . $refer);
  365. }
  366. /**
  367. * init
  368. *
  369. * @return mixed
  370. */
  371. public function init()
  372. {
  373. if (isset($this->load)) {
  374. return;
  375. }
  376. $this->load = true;
  377. $admin = $this->info();
  378. if (!$admin) {
  379. return $this->location_login();
  380. }
  381. if ($admin['id'] == 1) {
  382. return;
  383. }
  384. $menu = Dever::input('menu');
  385. $project = Dever::input('key');
  386. $table = Dever::input('table');
  387. $menu_id = Dever::input('menu_id');
  388. if ($menu_id && $menu_id > 0) {
  389. $menu = Dever::db('manage/menu')->info($menu_id);
  390. if (!$menu) {
  391. Dever::alert('没有该权限');
  392. }
  393. if ($menu['key']) {
  394. if (isset($admin['auth']) && $admin['auth']) {
  395. if ($admin['auth'] == 'all' || $admin['auth'] == '') {
  396. return;
  397. }
  398. $admin['auth'] = explode(',', $admin['auth']);
  399. if (!in_array($menu['key'], $admin['auth'])) {
  400. Dever::alert('您没有操作权限');
  401. }
  402. } else {
  403. Dever::alert('您没有操作权限');
  404. }
  405. } else {
  406. Dever::alert('您没有操作权限');
  407. }
  408. } else {
  409. //Dever::alert('您没有操作权限');
  410. }
  411. }
  412. # 得到当前管理员的权限
  413. public function admin()
  414. {
  415. $admin = $this->info();
  416. return $admin['auth'] == 'all' ? '' : explode(',', $admin['auth']);
  417. }
  418. # 得到当前头部菜单的权限
  419. public function top()
  420. {
  421. $admin = $this->info();
  422. return $admin['top'] == 'all' ? '' : $admin['top'];
  423. return $admin['top'] == 'all' ? '' : explode(',', $admin['top']);
  424. }
  425. # 设置头部菜单的权限
  426. public function _setTop($info)
  427. {
  428. if ($info) {
  429. $info['key'] = explode('_', $info['key']);
  430. $count = count($info['key']);
  431. if ($count > 2) {
  432. foreach ($info['key'] as $k => $v) {
  433. if ($k+1 < $count) {
  434. $key[] = $v;
  435. }
  436. }
  437. $key = implode('_', $key);
  438. } else {
  439. $key = $info['key'][0];
  440. }
  441. $data = $this->data();
  442. $key = str_replace('/', '-', $key);
  443. $this->top = $info;
  444. $this->save->add($this->name . '_topgetv1_' . $key . '_a' . $data['id'], $info, 3600 * 24 * 365);
  445. }
  446. }
  447. # 得到当前头部菜单
  448. public function getTop($key)
  449. {
  450. $state = false;
  451. if (is_array($key)) {
  452. $key = $key[0];
  453. $state = true;
  454. }
  455. $data = $this->data();
  456. $key = str_replace('/', '-', $key);
  457. $data = $this->save->get($this->name . '_topgetv1_' . $key . '_a' . $data['id']);
  458. $top = Dever::input('top');
  459. if ($top) {
  460. $data = Dever::db('manage/top')->one($top);
  461. }
  462. //print_r($data);die;
  463. # 当数据不存在时,先从数据库里取出一个最新的
  464. if (!$data && $state == true) {
  465. $info = Dever::db('manage/top')->key(array('where_key' => $key));
  466. if ($info) {
  467. $data = Dever::db('manage/top')->getOne(array('where_top_id' => $info['id']));
  468. }
  469. } elseif (!$data && $this->top) {
  470. $data = $this->top;
  471. }
  472. return $data;
  473. }
  474. public function config()
  475. {
  476. $admin = $this->info();
  477. if (!$admin && $id = Dever::input('auth')) {
  478. $admin['config']['id'] = $id;
  479. }
  480. if ($admin['config'] && $admin['config']['id'] > 0) {
  481. $admin['config'] = Dever::db('manage/config')->info(array('where_id' => $admin['config']['id']));
  482. }
  483. $state = isset($admin['config']) && $admin['config'];
  484. $admin['config']['title'] = ($state && $admin['config']['title']) ? $admin['config']['title'] : Dever::config('base')->name . '';
  485. $admin['config']['info'] = ($state && $admin['config']['info']) ? $admin['config']['info'] : Dever::config('base')->name . ' 欢迎您';
  486. $admin['config']['content'] = ($state && $admin['config']['content']) ? $admin['config']['content'] : '欢迎您使用' . $admin['config']['title'];
  487. $admin['config']['template'] = ($state && $admin['config']['template']) ? $admin['config']['template'] : 1;
  488. $admin['config']['front_url'] = Dever::config('base')->host;
  489. $admin['config']['front_name'] = '访问' . Dever::config('base')->name;
  490. $admin['config']['front_display'] = $admin['config']['front_url'] ? 'display:' : 'display:none';
  491. $admin['config']['version'] = Dever::config('base')->version;
  492. $admin['config']['refer'] = Dever::input('refer');
  493. $admin['config']['login_url'] = Dever::url("auth.login");
  494. $admin['config']['copyright'] = Dever::config("base")->copyright;
  495. return $admin['config'];
  496. }
  497. /**
  498. * oper的判断
  499. *
  500. * @param uri string
  501. * @return mixed
  502. */
  503. public function oper($type = 1)
  504. {
  505. $oper = '';
  506. $admin = $this->info();
  507. //$role['oper'] = '1,2,3,4,5';
  508. if ($admin && isset($admin['oper']) && $admin['oper'] != 'all') {
  509. if (strpos(',' . $admin['oper'], ',' . $type) !== false) {
  510. return true;
  511. } else {
  512. return false;
  513. }
  514. } else {
  515. return true;
  516. }
  517. }
  518. /**
  519. * 获取当前uri的类型
  520. *
  521. * @param uri string
  522. * @return mixed
  523. */
  524. private function table($table, $project)
  525. {
  526. if ($table == 'other') {
  527. $table = '';
  528. } else {
  529. $path = Dever::load('manage/src/project.path', $project);
  530. $config = Dever::database(DEVER_PATH . $path . 'database/' . $table . '.php');
  531. $table = $config['lang'];
  532. }
  533. return $table;
  534. }
  535. /**
  536. * check
  537. *
  538. * @return mixed
  539. */
  540. public function check($id)
  541. {
  542. $id = Dever::input('update_where_id');
  543. # 先验证email是否已经存在
  544. $email = Dever::input('update_email');
  545. $info = Dever::db('manage/admin')->one(array('option_email' => $email));
  546. if ($id > 0 && $info && $info['id'] != $id) {
  547. Dever::alert('该邮箱已经存在');
  548. } elseif ($id < 0 && $info) {
  549. Dever::alert('该邮箱已经存在');
  550. }
  551. }
  552. /**
  553. * 获取当前uri的类型
  554. *
  555. * @param uri string
  556. * @return mixed
  557. */
  558. public function type($uri)
  559. {
  560. if (strpos($uri, '.') !== false) {
  561. $type = 3;
  562. } elseif (strpos($uri, '-') !== false) {
  563. $type = 2;
  564. } else {
  565. $type = 1;
  566. }
  567. return $type;
  568. }
  569. /**
  570. * 获取所有权限列表,并进行统计处理
  571. *
  572. * @return mixed
  573. */
  574. public function get($state = true)
  575. {
  576. $result = Dever::load('manage/src/menu.left', $state);
  577. $result['state'] = 1;
  578. return $result;
  579. }
  580. /**
  581. * 获取所有数据权限列表,并进行统计处理
  582. *
  583. * @return mixed
  584. */
  585. public function getByData()
  586. {
  587. $key = Dever::config('base')->manageAuthData;
  588. $result = array();
  589. if ($key) {
  590. $result = Dever::load($key);
  591. $result['state'] = 1;
  592. }
  593. return $result;
  594. }
  595. /**
  596. * 修改当前管理员的密码
  597. *
  598. * @return mixed
  599. */
  600. public function password()
  601. {
  602. $admin = $this->info();
  603. $new = Dever::input('new');
  604. $old = Dever::input('old');
  605. if ($admin && $admin['id'] > 0 && $new && $old && $new != $old && hash('sha256', ($old)) == $admin['password']) {
  606. $param['set_password'] = $new;
  607. $param['where_id'] = $admin['id'];
  608. Dever::db('manage/admin')->password($param);
  609. $admin['password'] = hash('sha256', ($new));
  610. $this->save->add($this->name, $admin);
  611. return '修改成功';
  612. } else {
  613. return '修改失败';
  614. }
  615. }
  616. /**
  617. * 更新数据到数据库
  618. *
  619. * @return array
  620. */
  621. public function update_action($param = array())
  622. {
  623. if (isset($param['key'])) {
  624. $info = Dever::db('manage/auth')->key(array('where_key' => $param['key']));
  625. //print_r($info);die;
  626. if (!$info) {
  627. $update['add_project'] = $param['project'];
  628. $update['add_project_name'] = $param['project_name'];
  629. $update['add_key'] = $param['key'];
  630. $update['add_name'] = $param['name'];
  631. $update['add_auth_id'] = isset($param['auth']) ? $param['auth'] : -1;
  632. $update['add_value'] = $param['value'];
  633. $update['add_state'] = isset($param['state']) ? $param['state'] : 1;
  634. $info['id'] = Dever::db('manage/auth')->insert($update);
  635. } else {
  636. $update['set_project'] = $param['project'];
  637. $update['set_project_name'] = $param['project_name'];
  638. $update['set_name'] = $param['name'];
  639. $update['set_value'] = $param['value'];
  640. $update['set_state'] = isset($param['state']) ? $param['state'] : 1;
  641. $update['where_id'] = $info['id'];
  642. Dever::db('manage/auth')->update($update);
  643. }
  644. return $info['id'];
  645. }
  646. return false;
  647. }
  648. /**
  649. * 同步子权限更新到数据库
  650. *
  651. * @return array
  652. */
  653. public function sync($param = array())
  654. {
  655. if (isset($param[0]) && isset($param[1])) {
  656. $key = $param[1]['key'];
  657. $info = Dever::db('manage/auth')->key(array('where_key' => $key));
  658. if ($info) {
  659. $update['value'] = Dever::input('where_id', $param[0]);
  660. $update['name'] = Dever::input('name', '-u');
  661. $update['top'] = $info['id'];
  662. $update['key'] = $key . '_' . $update['value'];
  663. $update['state'] = Dever::input('state', '-u');
  664. $this->update_action($update);
  665. }
  666. }
  667. }
  668. /**
  669. * 获取所有的项目精细权限
  670. *
  671. * @return array
  672. */
  673. public function all()
  674. {
  675. $data = Dever::db('manage/auth')->main;
  676. if ($data) {
  677. $child = Dever::db('manage/auth')->child;
  678. foreach ($data as $t => $d) {
  679. foreach ($d as $k => $v) {
  680. if (isset($child[$v['id']])) {
  681. $c = 0;
  682. foreach ($child[$v['id']] as $i => $j) {
  683. $data[$t][$k]['child'][$i] = $j;
  684. $c++;
  685. }
  686. if (!isset($data[$t][$k]['child'])) {
  687. unset($data[$t][$k]);
  688. }
  689. }
  690. }
  691. $data[$t]['state'] = 1;
  692. }
  693. }
  694. return $data;
  695. }
  696. /**
  697. * opt push
  698. *
  699. * @return mixed
  700. */
  701. public function opt($param = false)
  702. {
  703. $opt = new Opt;
  704. $opt->push($param);
  705. }
  706. /**
  707. * opt push
  708. *
  709. * @return mixed
  710. */
  711. public function opt_api($param = false)
  712. {
  713. $opt = new Opt;
  714. $opt->push($param);
  715. }
  716. /**
  717. * opt push
  718. *
  719. * @return mixed
  720. */
  721. public function api($param = false)
  722. {
  723. $api = new Api;
  724. $api->push($param);
  725. }
  726. /**
  727. * opt push
  728. *
  729. * @return mixed
  730. */
  731. public function api_api($param = false)
  732. {
  733. $api = new Api;
  734. $api->push($param);
  735. }
  736. }