Best Phoronix-test-suite code snippet using module_info.run
module.ctrl.php
Source:module.ctrl.php
...16if ($_W['role'] != ACCOUNT_MANAGE_NAME_OWNER && $_W['role'] != ACCOUNT_MANAGE_NAME_MANAGER && $_W['role'] != ACCOUNT_MANAGE_NAME_FOUNDER) {17 message('æ æéæä½ï¼', referer(), 'error');18}19load()->func('logging');20logging_run($do);21if ($do == 'get_upgrade_info') {22 $module_name = trim($_GPC['name']);23 $module_info = module_fetch($module_name);24 $cloud_m_upgrade_info = cloud_m_upgradeinfo($module_name);25 $module = array(26 'version' => $cloud_m_upgrade_info['version'],27 'name' => $cloud_m_upgrade_info['name'],28 'branches' => $cloud_m_upgrade_info['branches'],29 'site_branch' => $cloud_m_upgrade_info['branches'][$cloud_m_upgrade_info['version']['branch_id']],30 'from' => 'cloud'31 );32 $module['site_branch']['id'] = intval($module['site_branch']['id']);33 if (!empty($module['branches'])) {34 foreach ($module['branches'] as &$branch) {35 $branch['id'] = intval($branch['id']);36 }37 unset($branch);38 }39 if (ver_compare($module_info['version'], $module['site_branch']['version']['version']) != '-1') {40 unset($module['branches'][$module['site_branch']['id']]);41 }42 message(error(0, $module), '', 'ajax');43}44if ($do == 'check_upgrade') {45 $module_list = $_GPC['module_list']; if (!empty($module_list) && is_array($module_list)) {46 $module_list = pdo_getall('modules', array('name' => $module_list));47 } else {48 message(error(0), '', 'ajax');49 }50 $cloud_prepare_result = cloud_prepare();51 $cloud_m_query_module = cloud_m_query();52 if (is_error($cloud_m_query_module)) {53 $cloud_m_query_module = array();54 }55 foreach ($module_list as &$module) {56 $manifest = ext_module_manifest($module['name']);57 if (!empty($manifest)&& is_array($manifest)) {58 if (ver_compare($module['version'], $manifest['application']['version']) == '-1') {59 $module['upgrade'] = true;60 } else {61 $module['upgrade'] = false;62 }63 $module['from'] = 'local';64 }65 if (empty($manifest)) {66 if (in_array($module['name'], array_keys($cloud_m_query_module))) {67 $cloud_m_info = $cloud_m_query_module[$module['name']];68 $site_branch = $cloud_m_info['site_branch']['id'];69 if (empty($site_branch)) {70 $site_branch = $cloud_m_info['branch'];71 }72 $cloud_branch_version = $cloud_m_info['branches'][$site_branch]['version'];73 $branch_id_list = array_keys($cloud_m_info['branches']);74 if (empty($branch_id_list)) {75 $module['upgrade'] = false;76 continue;77 }78 $best_branch_id = max($branch_id_list);79 $best_branch = $cloud_m_info['branches'][$best_branch_id];80 if (ver_compare($module['version'], $cloud_branch_version) == -1 || ($cloud_m_info['branch'] < $best_branch['id'] && !empty($cloud_m_info['version']))) {81 $module['upgrade'] = true;82 } else {83 $module['upgrade'] = false;84 }85 $module['from'] = 'cloud';86 }87 }88 }89 unset($module);90 message(error(0, $module_list), '', 'ajax');91}92if ($do == 'upgrade') {93 $points = ext_module_bindings();94 $module_name = addslashes($_GPC['module_name']);95 $module_info = module_fetch($module_name);96 if (empty($module_info)) {97 message('模åå·²ç»è¢«å¸è½½ææ¯ä¸åå¨ï¼', '', 'error');98 }99 $manifest = ext_module_manifest($module_name);100 if (empty($manifest)) {101 $cloud_prepare = cloud_prepare();102 if (is_error($cloud_prepare)) {103 message($cloud_prepare['message'], '', 'ajax');104 }105 $module_info = cloud_m_upgradeinfo($module_name);106 if (is_error($module_info)) {107 message($module_info, '', 'ajax');108 }109 if (!empty($_GPC['flag'])) {110 define('ONLINE_MODULE', true);111 $packet = cloud_m_build($module_name);112 $manifest = ext_module_manifest_parse($packet['manifest']);113 }114 }115 if (empty($manifest)) {116 message('模åå®è£
é
ç½®æ件ä¸åå¨ææ¯æ ¼å¼ä¸æ£ç¡®ï¼', '', 'error');117 }118 $check_manifest_result = manifest_check($module_name, $manifest);119 if (is_error($check_manifest_result)) {120 message($check_manifest_result['message'], '', 'error');121 }122 $module_path = IA_ROOT . '/addons/' . $module_name . '/';123 if (!file_exists($module_path . 'processor.php') && !file_exists($module_path . 'module.php') && !file_exists($module_path . 'receiver.php') && !file_exists($module_path . 'site.php')) {124 message('模å缺失æ件ï¼è¯·æ£æ¥æ¨¡åæ件ä¸site.php, processor.php, module.php, receiver.php æ件æ¯å¦åå¨ï¼', '', 'error');125 }126 $module = ext_module_convert($manifest);127 unset($module['name']);128 unset($module['id']);129 $wxapp_support = false;130 $app_support = false;131 if (!empty($module['supports'])) {132 foreach ($module['supports'] as $support) {133 if ($support == 'wxapp') {134 $wxapp_support = true;135 }136 if ($support == 'app') {137 $app_support = true;138 }139 }140 }141 $module['wxapp_support'] = !empty($wxapp_support) ? 2 : 1;142 $module['app_support'] = !empty($app_support) ? 2 : 1;143 $bindings = array_elements(array_keys($points), $module, false);144 foreach ($points as $point_name => $point_info) {145 unset($module[$point_name]);146 if (is_array($bindings[$point_name]) && !empty($bindings[$point_name])) {147 foreach ($bindings[$point_name] as $entry) {148 $entry['module'] = $manifest['application']['identifie'];149 $entry['entry'] = $point_name;150 if ($point_name == 'page' && !empty($wxapp_support)) {151 $entry['url'] = $entry['do'];152 $entry['do'] = '';153 }154 if ($entry['title'] && $entry['do']) {155 $not_delete_do[] = $entry['do'];156 $not_delete_title[] = $entry['title'];157 $module_binding = pdo_get('modules_bindings',array('module' => $manifest['application']['identifie'], 'entry' => $point_name, 'title' => $entry['title'], 'do' => $entry['do']));158 if (!empty($module_binding)) {159 pdo_update('modules_bindings', $entry, array('eid' => $module_binding['eid']));160 continue;161 }162 } elseif ($entry['call']) {163 $not_delete_call[] = $entry['call'];164 $module_binding = pdo_get('modules_bindings',array('module' => $manifest['application']['identifie'], 'entry' => $point_name, 'call' => $entry['call']));165 if (!empty($module_binding)) {166 pdo_update('modules_bindings', $entry, array('eid' => $module_binding['eid']));167 continue;168 }169 }170 pdo_insert('modules_bindings', $entry);171 }172 if (!empty($not_delete_do)) {173 pdo_query('DELETE FROM ' . tablename('modules_bindings') . " WHERE module = :module AND entry = :entry AND `call` = '' AND do NOT IN ('" . implode("','", $not_delete_do) . "')", array(':module' => $manifest['application']['identifie'], ':entry' => $point_name));174 unset($not_delete_do);175 }176 if (!empty($not_delete_title)) {177 pdo_query('DELETE FROM ' . tablename('modules_bindings') . " WHERE module = :module AND entry = :entry AND `call` = '' AND title NOT IN ('" . implode("','", $not_delete_title) . "')", array(':module' => $manifest['application']['identifie'], ':entry' => $point_name));178 unset($not_delete_title);179 }180 if (!empty($not_delete_call)) {181 pdo_query('DELETE FROM ' . tablename('modules_bindings') . " WHERE module = :module AND entry = :entry AND do = '' AND title = '' AND `call` NOT IN ('" . implode("','", $not_delete_call) . "')", array(':module' => $manifest['application']['identifie'], ':entry' => $point_name));182 unset($not_delete_call);183 }184 }185 }186 unset($module['page']);187 unset($module['supports']);188 if (!empty($manifest['upgrade'])) {189 if (strexists($manifest['upgrade'], '.php')) {190 if (file_exists($module_path . $manifest['upgrade'])) {191 include_once $module_path . $manifest['upgrade'];192 }193 } else {194 pdo_run($manifest['upgrade']);195 }196 }197 $module['permissions'] = iserializer($module['permissions']);198 if (!empty($module_info['version']['cloud_setting'])) {199 $module['settings'] = 2;200 } else {201 $module['settings'] = empty($module['settings']) ? 0 : 1;202 }203 if ($modulename == 'we7_coupon') {204 $module['issystem'] = 1;205 $module['settings'] = 2;206 }207 pdo_update('modules', $module, array('name' => $module_name));208 cache_build_account_modules();209 if (!empty($module['subscribes'])) {210 ext_check_module_subscribe($module['name']);211 }212 cache_delete('cloud:transtoken');213 message('模åæ´æ°æåï¼', url('system/module', array('account_type' => ACCOUNT_TYPE)), 'success');214}215if ($do =='install') {216 $points = ext_module_bindings();217 $module_name = trim($_GPC['module_name']);218 $is_recycle_module = pdo_get('modules_recycle', array('modulename' => $module_name));219 if (empty($_W['isfounder'])) {220 message('æ¨æ²¡æå®è£
模åçæé', '', 'error');221 }222 if (module_fetch($module_name)) {223 message('模åå·²ç»å®è£
ææ¯å¯ä¸æ è¯å·²åå¨ï¼', '', 'error');224 }225 $manifest = ext_module_manifest($module_name);226 // austin modify 注éæ æå¡ç«¯éªè¯åè½227 // if (!empty($manifest)) {228 // $result = cloud_m_prepare($module_name);229 // if (is_error($result)) {230 // message($result['message'], url('system/module/not_installed', array('account_type' => ACCOUNT_TYPE)), 'error');231 // }232 // } else {233 // $result = cloud_prepare();234 // if (is_error($result)) {235 // message($result['message'], url('cloud/profile'), 'error');236 // }237 // $module_info = cloud_m_info($module_name);238 // if (!is_error($module_info)) {239 // if (empty($_GPC['flag'])) {240 // header('location: ' . url('cloud/process', array('account_type' => ACCOUNT_TYPE, 'm' => $module_name)));241 // exit;242 // } else {243 // define('ONLINE_MODULE', true);244 // $packet = cloud_m_build($module_name);245 // $manifest = ext_module_manifest_parse($packet['manifest']);246 // }247 // } else {248 // message($module_info['message'], '', 'error');249 // }250 // }251 if (empty($manifest)) {252 message('模åå®è£
é
ç½®æ件ä¸åå¨ææ¯æ ¼å¼ä¸æ£ç¡®ï¼è¯·å·æ°éè¯ï¼', url('system/module/not_installed', array('account_type' => ACCOUNT_TYPE)), 'error');253 }254 $check_manifest_result = manifest_check($module_name, $manifest);255 if (is_error($check_manifest_result)) {256 message($check_manifest_result['message'], '', 'error');257 }258 $module_path = IA_ROOT . '/addons/' . $module_name . '/';259 if (!file_exists($module_path . 'processor.php') && !file_exists($module_path . 'module.php') && !file_exists($module_path . 'receiver.php') && !file_exists($module_path . 'site.php')) {260 message('模å缺失æ件ï¼è¯·æ£æ¥æ¨¡åæ件ä¸site.php, processor.php, module.php, receiver.php æ件æ¯å¦åå¨ï¼', '', 'error');261 }262 $module = ext_module_convert($manifest);263 $module_group = uni_groups();264 if (!$_W['ispost'] || empty($_GPC['flag'])) {265 template('system/select-module-group');266 exit;267 }268 $module['app_support'] = empty($module['supports']) || in_array('app', $module['supports']) ? 2 : 1;269 $module['wxapp_support'] = in_array('wxapp', $module['supports']) ? 2 : 1;270 $post_groups = $_GPC['group'];271 ext_module_clean($module_name);272 $bindings = array_elements(array_keys($points), $module, false);273 if (!empty($points)) {274 foreach ($points as $name => $point) {275 unset($module[$name]);276 if (is_array($bindings[$name]) && !empty($bindings[$name])) {277 foreach ($bindings[$name] as $entry) {278 $entry['module'] = $manifest['application']['identifie'];279 $entry['entry'] = $name;280 if ($name == 'page' && !empty($wxapp_support)) {281 $entry['url'] = $entry['do'];282 $entry['do'] = '';283 }284 pdo_insert('modules_bindings', $entry);285 }286 }287 }288 }289 unset($module['page']);290 unset($module['supports']);291 $module['permissions'] = iserializer($module['permissions']);292 $module_subscribe_success = true;293 if (!empty($module['subscribes'])) {294 $subscribes = iunserializer($module['subscribes']);295 if (!empty($subscribes)) {296 $module_subscribe_success = ext_check_module_subscribe($module['name']);297 }298 }299 if (!empty($module_info['version']['cloud_setting'])) {300 $module['settings'] = 2;301 }302 $pinyin = new Pinyin_Pinyin();303 $module['title_initial'] = $pinyin->get_first_char($module['title']);304 if (pdo_insert('modules', $module)) {305 if (strexists($manifest['install'], '.php')) {306 if (file_exists($module_path . $manifest['install'])) {307 include_once $module_path . $manifest['install'];308 }309 } else {310 pdo_run($manifest['install']);311 }312 if (defined('ONLINE_MODULE')) {313 ext_module_script_clean($module['name'], $manifest);314 }315 if ($_GPC['flag'] && !empty($post_groups) && $module['name']) {316 foreach ($post_groups as $groupid) {317 $group_info = pdo_get('uni_group', array('id' => intval($groupid)), array('id', 'name', 'modules'));318 if (empty($group_info)) {319 continue;320 }321 $group_info['modules'] = iunserializer($group_info['modules']);322 if (in_array($module['name'], $group_info['modules'])) {323 continue;324 }325 $group_info['modules'][] = $module['name'];326 $group_info['modules'] = iserializer($group_info['modules']);327 pdo_update('uni_group', $group_info, array('id' => $groupid));328 }329 }330 if (!empty($is_recycle_module)) {331 pdo_delete('modules_recycle', array('modulename' => $module_name));332 }333 module_build_privileges();334 cache_build_module_subscribe_type();335 cache_build_account_modules();336 cache_build_uninstalled_module();337 if (empty($module_subscribe_success)) {338 message('模åå®è£
æåï¼æ¨¡å订é
æ¶æ¯æé误ï¼ç³»ç»å·²ç¦ç¨è¯¥æ¨¡åç订é
æ¶æ¯ï¼è¯¦ç»ä¿¡æ¯è¯·æ¥ç <div><a class="btn btn-primary" style="width:80px;" href="' . url('system/module/module_detail', array('name' => $module['name'])) . '">订é
管ç</a> <a class="btn btn-default" href="' . url('system/module', array('account_type' => ACCOUNT_TYPE)) . '">è¿å模åå表</a></div>', '', 'tips');339 } else {340 message('模åå®è£
æå!', url('system/module', array('account_type' => ACCOUNT_TYPE)), 'success');341 }342 } else {343 message('模åå®è£
失败, 请è系模åå¼åè
ï¼');344 }345}346if ($do == 'change_receive_ban') {347 $modulename = $_GPC['modulename'];348 $module_exist = module_fetch($modulename);349 if (empty($module_exist)) {350 message(error(1, '模åä¸åå¨'), '', 'ajax');;351 }352 if (!is_array($_W['setting']['module_receive_ban'])) {353 $_W['setting']['module_receive_ban'] = array();354 }355 if (in_array($modulename, $_W['setting']['module_receive_ban'])) {356 unset($_W['setting']['module_receive_ban'][$modulename]);357 } else {358 $_W['setting']['module_receive_ban'][$modulename] = $modulename;359 }360 setting_save($_W['setting']['module_receive_ban'], 'module_receive_ban');361 cache_build_module_subscribe_type();362 message(error(0), '', 'ajax');363}364if ($do == 'save_module_info') {365 $module_info = $_GPC['moduleinfo'];366 if (!empty($module_info['logo'])) {367 $image = file_get_contents(parse_path($module_info['logo']));368 $result = file_put_contents(IA_ROOT . "/addons/" . $module_info['name'] . '/icon-custom.jpg', $image);369 }370 if (!empty($module_info['preview'])) {371 $image = file_get_contents(parse_path($module_info['preview']));372 $result = file_put_contents(IA_ROOT."/addons/".$module_info['name'] . '/preview-custom.jpg', $image);373 }374 unset($module_info['logo'], $module_info['preview']);375 $data = array(376 'title' => $module_info['title'],377 'ability' => $module_info['ability'],378 'description' => $module_info['description'],379 );380 $result = pdo_update('modules', $data, array('mid' => $module_info['mid']));381 message(error(0), '', 'ajax');382}383if ($do == 'get_module_info') {384 $mid = intval($_GPC['mid']);385 if ($mid) {386 $module = pdo_get('modules', array('mid' => $mid));387 if (file_exists(IA_ROOT.'/addons/'.$module['name'].'/icon-custom.jpg')) {388 $module['logo'] = tomedia(IA_ROOT.'/addons/'.$module['name'].'/icon-custom.jpg');389 } else {390 $module['logo'] = tomedia(IA_ROOT.'/addons/'.$module['name'].'/icon.jpg');391 }392 if (file_exists(IA_ROOT.'/addons/'.$module['name'].'/preview-custom.jpg')) {393 $module['preview'] = tomedia(IA_ROOT.'/addons/'.$module['name'].'/preview-custom.jpg');394 } else {395 $module['preview'] = tomedia(IA_ROOT.'/addons/'.$module['name'].'/preview.jpg');396 }397 }398 message(error(0, $module), '', 'ajax');399}400if ($do == 'module_detail') {401 $_W['page']['title'] = '模å详æ
';402 $module_name = trim($_GPC['name']);403 $module_info = module_fetch($module_name);404 $module_info['logo'] = file_exists(IA_ROOT. "/addons/". $module_info['name']. "/icon-custom.jpg") ? IA_ROOT. "/addons/". $module_info['name']. "/icon-custom.jpg" : IA_ROOT. "/addons/". $module_info['name']. "/icon.jpg";405 $module_group_list = pdo_getall('uni_group', array('uniacid' => 0));406 $module_group = array();407 if (!empty($module_group_list)) {408 foreach ($module_group_list as $group) {409 $group['modules'] = iunserializer($group['modules']);410 if (in_array($module_name, $group['modules'])) {411 $module_group[] = $group;412 }413 }414 }415 $module_subscribes = array();416 $module['subscribes'] = iunserializer($module_info['subscribes']);417 if (!empty($module['subscribes'])) {418 foreach ($module['subscribes'] as $event) {419 if ($event == 'text' || $event == 'enter') {420 continue;421 }422 $module_subscribes = $module['subscribes'];423 }424 }425 $mtypes = ext_module_msg_types();426 $module_ban = $_W['setting']['module_receive_ban'];427 if (!is_array($module_ban)) {428 $module_ban = array();429 }430 $receive_ban = in_array($module_info['name'], $module_ban) ? 1 : 2;431 $modulename = $_GPC['modulename'];432 433 $pageindex = max(1, $_GPC['page']);434 $pagesize = 20;435 $use_module_account = array();436 437 $total = count($use_module_account);438 $use_module_account = array_slice($use_module_account, ($pageindex - 1) * $pagesize, $pagesize);439 $pager = pagination($total, $pageindex, $pagesize);440}441if ($do == 'uninstall') {442 if (empty($_W['isfounder'])) {443 message('æ¨æ²¡æå¸è½½æ¨¡åçæé', '', 'error');444 }445 $name = trim($_GPC['name']);446 logging_run($name,"å¸è½½æ¨¡åéªè¯å称");447 $module = module_fetch($name);448 if (empty($module)) {449 message('模åå·²ç»è¢«å¸è½½ææ¯ä¸åå¨ï¼', '', 'error');450 }451 if (!empty($module['issystem'])) {452 message('ç³»ç»æ¨¡åä¸è½å¸è½½ï¼', '', 'error');453 }454 if ($module['isrulefields'] && !isset($_GPC['confirm'])) {455 message('å¸è½½æ¨¡åæ¶åæ¶å é¤è§åæ°æ®å, å é¤è§åæ°æ®å°åæ¶å é¤ç¸å
³è§åçç»è®¡åææ°æ®ï¼<div><a class="btn btn-primary" style="width:80px;" href="' . url('system/module/uninstall', array('name' => $name, 'confirm' => 1)) . '">æ¯</a> <a class="btn btn-default" style="width:80px;" href="' . url('system/module/uninstall', array('account_type' => ACCOUNT_TYPE, 'name' => $name, 'confirm' => 0)) . '">å¦</a></div>', '', 'tips');456 } else {457 $modulepath = IA_ROOT . '/addons/' . $name . '/';458 $manifest = ext_module_manifest($module['name']);459 if (empty($manifest)) {460 $r = cloud_prepare();461 if (is_error($r)) {462 message($r['message'], url('cloud/profile'), 'error');463 }464 $packet = cloud_m_build($module['name'], $do);465 if ($packet['sql']) {466 pdo_run(base64_decode($packet['sql']));467 } elseif ($packet['script']) {468 $uninstall_file = $modulepath . TIMESTAMP . '.php';469 file_put_contents($uninstall_file, base64_decode($packet['script']));470 require($uninstall_file);471 unlink($uninstall_file);472 }473 } elseif (!empty($manifest['uninstall'])) {474 if (strexists($manifest['uninstall'], '.php')) {475 if (file_exists($modulepath . $manifest['uninstall'])) {476 require($modulepath . $manifest['uninstall']);477 }478 } else {479 pdo_run($manifest['uninstall']);480 }481 }482 pdo_insert('modules_recycle', array('modulename' => $module['name']));483 ext_module_clean($name, $_GPC['confirm'] == '1');484 cache_build_account_modules();485 cache_build_module_subscribe_type();486 cache_build_uninstalled_module();487 message('模åå·²æ¾å
¥åæ¶ç«ï¼', url('system/module', array('account_type' => ACCOUNT_TYPE)), 'success');488 }489}490if ($do == 'installed') {491 $_W['page']['title'] = 'åºç¨å表';492 logging_run("è·åå·²å®è£
模å");493 $uninstalled_module = module_get_all_unistalled('uninstalled');494 logging_run($uninstalled_module);495 if( !empty($uninstalled_module)){496 $total_uninstalled = $uninstalled_module['module_count'];497 }else{498 $total_uninstalled = 0;499 }500 501 $pageindex = max($_GPC['page'], 1);502 $pagesize = 20;503 $letter = $_GPC['letter'];504 $title = $_GPC['title'];505 $letters = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');506 $condition = " WHERE (issystem = 0 OR name = 'we7_coupon') ";507 $params = array();508 if (ACCOUNT_TYPE == ACCOUNT_TYPE_APP_NORMAL) {509 $condition .= " AND `wxapp_support` = :wxapp_support";510 $params[':wxapp_support'] = 2;511 } else {512 $condition .= " AND `app_support` = :app_support";513 $params[':app_support'] = 2;514 }515 if (!empty($letter) && strlen($letter) == 1) {516 if(in_array($letter, $letters)){517 $condition .= " AND `title_initial` = :letter";518 }else {519 $condition .= " AND `title_initial` NOT IN ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z')";520 }521 $params[':letter'] = $letter;522 }523 if (!empty($title)) {524 $condition .= " AND title LIKE :title";525 $params[':title'] = "%".$title. "%";526 }527 if (empty($_W['isfounder'])) {528 $user_info = pdo_get('users', array('uid' => $_W['uid']));529 $user_group = pdo_get('users_group', array('id' => $user_info['groupid']));530 $user_group['package'] = iunserializer($user_group['package']);531 if (!empty($user_group['package']) && is_array($user_group['package']) && !in_array('-1', $user_group)) {532 $user_have_group = array();533 foreach ($user_group['package'] as $groupid) {534 $group = pdo_get('uni_group', array('id' => $groupid));535 $group['modules'] = iunserializer($group['modules']);536 if (!empty($group['modules']) && is_array($group['modules'])) {537 $user_have_group = array_merge($user_have_group, $group['modules']);538 }539 }540 unset($group);541 if (!empty($user_have_group) && is_array($user_have_group)) {542 $condition .= " AND name in ". "('". implode("','", $user_have_group). "')";543 } else {544 message('没æå¯ç¨æ¨¡å', referer(), 'info');545 }546 }547 }548 // logging_run("æ¥çæ°æ®åºè¯»åç模åå表");549 // logging_run($condition);550 // logging_run($params);551 $total = pdo_fetchcolumn("SELECT COUNT(*) FROM ". tablename('modules'). $condition, $params);552 // logging_run($total);553 $module_list = pdo_fetchall("SELECT * FROM ". tablename('modules'). $condition. " ORDER BY `issystem` DESC, `mid` DESC". " LIMIT ".($pageindex-1)*$pagesize.", ". $pagesize, $params, 'name');554 $pager = pagination($total, $pageindex, $pagesize);555 if (!empty($module_list)) {556 foreach ($module_list as &$module) {557 $module['use_account'] = 0;558 $module['enabled_use_account'] = 0;559 if (file_exists(IA_ROOT.'/addons/'.$module['name'].'/icon-custom.jpg')) {560 $module['logo'] = tomedia(IA_ROOT.'/addons/'.$module['name'].'/icon-custom.jpg'). "?v=". time();561 } else {562 $module['logo'] = tomedia(IA_ROOT.'/addons/'.$module['name'].'/icon.jpg'). "?v=". time();563 }564 }565 unset($module);566 }...
nkf_similar_products.php
Source:nkf_similar_products.php
...54 $data['help_use_category'] = $this->language->get('help_use_category');55 $data['entry_category'] = $this->language->get('entry_category');56 $data['button_save'] = $this->language->get('button_save');57 $data['button_cancel'] = $this->language->get('button_cancel');58 $data['button_run'] = $this->language->get('button_run');59 $data['token'] = $this->session->data['token'];60 if (isset($this->error['warning'])) {61 $data['error_warning'] = $this->error['warning'];62 } else {63 $data['error_warning'] = '';64 }65 if (isset($this->error['name'])) {66 $data['error_name'] = $this->error['name'];67 } else {68 $data['error_name'] = '';69 }70 if (isset($this->error['title'])) {71 $data['error_title'] = $this->error['title'];72 } else {73 $data['error_title'] = '';74 }75 if (isset($this->error['width'])) {76 $data['error_width'] = $this->error['width'];77 } else {78 $data['error_width'] = '';79 }80 if (isset($this->error['height'])) {81 $data['error_height'] = $this->error['height'];82 } else {83 $data['error_height'] = '';84 }85 $data['breadcrumbs'] = array();86 $data['breadcrumbs'][] = array(87 'text' => $this->language->get('text_home'),88 'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL')89 );90 $data['breadcrumbs'][] = array(91 'text' => $this->language->get('text_module'),92 'href' => $this->url->link('extension/extension', 'token=' . $this->session->data['token'], 'SSL')93 );94 if (!isset($this->request->get['module_id'])) {95 $data['breadcrumbs'][] = array(96 'text' => $this->language->get('heading_title'),97 'href' => $this->url->link('extension/module/nkf_similar_products', 'token=' . $this->session->data['token'], 'SSL')98 );99 } else {100 $data['breadcrumbs'][] = array(101 'text' => $this->language->get('heading_title'),102 'href' => $this->url->link('extension/module/nkf_similar_products', 'token=' . $this->session->data['token'] . '&module_id=' . $this->request->get['module_id'], 'SSL')103 );104 }105 if (!isset($this->request->get['module_id'])) {106 $data['action'] = $this->url->link('extension/module/nkf_similar_products', 'token=' . $this->session->data['token'], 'SSL');107 } else {108 $data['action'] = $this->url->link('extension/module/nkf_similar_products', 'token=' . $this->session->data['token'] . '&module_id=' . $this->request->get['module_id'], 'SSL');109 }110 $data['cancel'] = $this->url->link('extension/extension', 'token=' . $this->session->data['token'], 'SSL');111 if (isset($this->request->get['module_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {112 $module_info = $this->model_extension_module->getModule($this->request->get['module_id']);113 }114 if (isset($this->request->get['module_id']))115 $data['module_id']=$this->request->get['module_id'];116 else117 $data['module_id']=0;118 if (isset($this->request->post['name'])) {119 $data['name'] = $this->request->post['name'];120 } elseif (!empty($module_info) && isset($module_info['name'])) {121 $data['name'] = $module_info['name'];122 } else {123 $data['name'] = '';124 }125 if (isset($this->request->post['title'])) {126 $data['title'] = $this->request->post['title'];127 } elseif (!empty($module_info) && isset($module_info['title'])) {128 $data['title'] = $module_info['title'];129 } else {130 $data['title'] = '';131 }132 $data['run']='';133 if (!empty($module_info) && isset($module_info['use_cache']) && $module_info['use_cache'])134 $data['run'] = $this->url->link('extension/module/nkf_similar_products/run', 'module_id='.$this->request->get['module_id'].'&token=' . $this->session->data['token'], true);135 if (isset($this->request->post['limit'])) {136 $data['limit'] = $this->request->post['limit'];137 } elseif (!empty($module_info) && isset($module_info['limit'])) {138 $data['limit'] = $module_info['limit'];139 } else {140 $data['limit'] = 5;141 }142 if (isset($this->request->post['use_category'])) {143 $data['use_category'] = $this->request->post['use_category'];144 } elseif (!empty($module_info) && isset($module_info['use_category'])) {145 $data['use_category'] = $module_info['use_category'];146 } else {147 $data['use_category'] = 0;148 }149 if (isset($this->request->post['delimiter'])) {150 $data['delimiter'] = $this->request->post['delimiter'];151 } elseif (!empty($module_info) && isset($module_info['delimiter'])) {152 $data['delimiter'] = $module_info['delimiter'];153 } else {154 $data['delimiter'] = '';155 }156 if (isset($this->request->post['use_price'])) {157 $data['use_price'] = $this->request->post['use_price'];158 } elseif (!empty($module_info) && isset($module_info['use_price'])) {159 $data['use_price'] = $module_info['use_price'];160 } else {161 $data['use_price'] = 1;162 }163 if (isset($this->request->post['use_cache'])) {164 $data['use_cache'] = $this->request->post['use_cache'];165 } elseif (!empty($module_info) && isset($module_info['use_cache'])) {166 $data['use_cache'] = $module_info['use_cache'];167 } else {168 $data['use_cache'] = 1;169 }170 if (isset($this->request->post['use_quantity'])) {171 $data['use_quantity'] = $this->request->post['use_quantity'];172 } elseif (!empty($module_info) && isset($module_info['use_quantity'])) {173 $data['use_quantity'] = $module_info['use_quantity'];174 } else {175 $data['use_quantity'] = 1;176 }177 if (isset($this->request->post['use_manufacturer'])) {178 $data['use_manufacturer'] = $this->request->post['use_manufacturer'];179 } elseif (!empty($module_info) && isset($module_info['use_manufacturer'])) {180 $data['use_manufacturer'] = $module_info['use_manufacturer'];181 } else {182 $data['use_manufacturer'] = 0;183 }184 if (isset($this->request->post['add_diff_attributes'])) {185 $data['add_diff_attributes'] = $this->request->post['add_diff_attributes'];186 } elseif (!empty($module_info) && isset($module_info['add_diff_attributes'])) {187 $data['add_diff_attributes'] = $module_info['add_diff_attributes'];188 } else {189 $data['add_diff_attributes'] = 1;190 }191 if (isset($this->request->post['use_featured_template'])) {192 $data['use_featured_template'] = $this->request->post['use_featured_template'];193 } elseif (!empty($module_info) && isset($module_info['use_featured_template'])) {194 $data['use_featured_template'] = $module_info['use_featured_template'];195 } else {196 $data['use_featured_template'] = 0;197 }198 // Categories199 $this->load->model('catalog/category');200 if (isset($this->request->post['included_categories'])) {201 $categories = $this->request->post['included_categories'];202 } elseif (!empty($module_info) && isset($module_info['included_categories'])) {203 $categories = $module_info['included_categories'];204 } else {205 $categories = array();206 }207 $data['included_categories'] = array();208 foreach ($categories as $category_id) {209 $category_info = $this->model_catalog_category->getCategory($category_id);210 if ($category_info) {211 $data['included_categories'][] = array(212 'category_id' => $category_info['category_id'],213 'name' => ($category_info['path']) ? $category_info['path'] . ' > ' . $category_info['name'] : $category_info['name']214 );215 }216 }217 if (isset($this->request->post['cnt_diff'])) {218 $data['cnt_diff'] = $this->request->post['cnt_diff'];219 } elseif (!empty($module_info) && isset($module_info['cnt_diff'])) {220 $data['cnt_diff'] = $module_info['cnt_diff'];221 } else {222 $data['cnt_diff'] = 3;223 }224 if (isset($this->request->post['excluded_attributes'])) {225 $data['excluded_attributes'] = $this->request->post['excluded_attributes'];226 } elseif (!empty($module_info) && isset($module_info['excluded_attributes'])) {227 $data['excluded_attributes'] = $module_info['excluded_attributes'];228 } else {229 $data['excluded_attributes'] = array();230 }231 $this->load->model('catalog/attribute');232 $data['attributes'] = $this->model_catalog_attribute->getAttributes();233 if (isset($this->request->post['width'])) {234 $data['width'] = $this->request->post['width'];235 } elseif (!empty($module_info) && isset($module_info['width'])) {236 $data['width'] = $module_info['width'];237 } else {238 $data['width'] = 200;239 }240 if (isset($this->request->post['height'])) {241 $data['height'] = $this->request->post['height'];242 } elseif (!empty($module_info) && isset($module_info['height'])) {243 $data['height'] = $module_info['height'];244 } else {245 $data['height'] = 200;246 }247 if (isset($this->request->post['status'])) {248 $data['status'] = $this->request->post['status'];249 } elseif (!empty($module_info) && isset($module_info['status'])) {250 $data['status'] = $module_info['status'];251 } else {252 $data['status'] = '';253 }254 $data['header'] = $this->load->controller('common/header');255 $data['column_left'] = $this->load->controller('common/column_left');256 $data['footer'] = $this->load->controller('common/footer');257 $this->response->setOutput($this->load->view('extension/module/nkf_similar_products', $data));258 }259 protected function validate() {260 if (!$this->user->hasPermission('modify', 'extension/module/nkf_similar_products')) {261 $this->error['warning'] = $this->language->get('error_permission');262 }263 if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 64)) {264 $this->error['name'] = $this->language->get('error_name');265 }266 if (!$this->request->post['width']) {267 $this->error['width'] = $this->language->get('error_width');268 }269 if (!$this->request->post['height']) {270 $this->error['height'] = $this->language->get('error_height');271 }272 return !$this->error;273 }274 public function install()275 {276 $this->load->model('extension/module/nkf_similar_products');277 $this->model_extension_module_nkf_similar_products->checkTables();278 }279 public function run() {280 $this->load->model('extension/module/nkf_similar_products');281 $this->model_extension_module_nkf_similar_products->checkTables();282 $this->load->language('extension/module/nkf_similar_products');283 if ($this->validateRun()) {284 $this->load->model('extension/module/nkf_similar_products');285 $this->model_extension_module_nkf_similar_products->run();286 $this->session->data['success'] = $this->language->get('text_success_run');287 }288 $this->response->redirect($this->url->link('extension/module/nkf_similar_products', 'module_id='.$this->request->get['module_id'].'&token=' . $this->session->data['token'], 'SSL'));289 }290 protected function validateRun() {291 if (!$this->user->hasPermission('modify', 'extension/module/nkf_similar_products')) {292 $this->error['warning'] = $this->language->get('error_permission');293 }294 return !$this->error;295 }296 public function uninstall() {297 $this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "nkf_similar_product`");298 }299}...
scheduled_posts_install.php
Source:scheduled_posts_install.php
...7 $module_info['update_url'] = '';8 $module_info['creator'] = 'redwine';9 10 //Adding an entry in the misc_data table11 $module_info['db_sql'][] = "INSERT IGNORE into " . table_misc_data . " (name,data) VALUES ('scheduled_run','')";...
run
Using AI Code Generation
1require_once("module_info.php");2$module_info = new module_info();3$module_info->run();4require_once("module_info.php");5$module_info = new module_info();6$module_info->run();7require_once("module_info.php");8$module_info = new module_info();9$module_info->run();10require_once("module_info.php");11$module_info = new module_info();12$module_info->run();13require_once("module_info.php");14$module_info = new module_info();15$module_info->run();16require_once("module_info.php");17$module_info = new module_info();18$module_info->run();19require_once("module_info.php");20$module_info = new module_info();21$module_info->run();22require_once("module_info.php");23$module_info = new module_info();24$module_info->run();25require_once("module_info.php");26$module_info = new module_info();27$module_info->run();28require_once("module_info.php");29$module_info = new module_info();30$module_info->run();31require_once("module_info.php");32$module_info = new module_info();33$module_info->run();34require_once("module_info.php");35$module_info = new module_info();36$module_info->run();37require_once("module_info.php");38$module_info = new module_info();39$module_info->run();
run
Using AI Code Generation
1$module_info = new Module_info;2$module_info->run();3$module_info = new Module_info;4$module_info->run();5$module_info = new Module_info;6$module_info->run();7$module_info = new Module_info;8$module_info->run();9$module_info = new Module_info;10$module_info->run();11$module_info = new Module_info;12$module_info->run();13$module_info = new Module_info;14$module_info->run();15$module_info = new Module_info;16$module_info->run();17$module_info = new Module_info;18$module_info->run();19$module_info = new Module_info;20$module_info->run();21$module_info = new Module_info;22$module_info->run();23$module_info = new Module_info;24$module_info->run();25$module_info = new Module_info;26$module_info->run();27$module_info = new Module_info;28$module_info->run();29$module_info = new Module_info;30$module_info->run();31$module_info = new Module_info;32$module_info->run();
run
Using AI Code Generation
1$mod = new module_info();2$mod->run();3class derived_class_name extends base_class_name{4}5class base_class{6}7class derived_class extends base_class{8}9class derived_class_name extends base_class_1, base_class_2, base_class_3{10}11class base_class_1{12}13class base_class_2{14}15class derived_class extends base_class_1, base_class_2{16}17class base_class{18}19class derived_class extends base_class{20}
run
Using AI Code Generation
1$module = new module_info();2$module->run();3{4 public function run()5 {6 echo "This is run method of module_info class";7 }8}9$module = new module_info();10$module->run();
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with run on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!