Пример #1
0
function refresh_tgs($talent_gateways, $see_response = false)
{
    $refresh_result = array();
    $refresh_result['skipped'] = array();
    foreach ($talent_gateways as $tg_table => $tg_data) {
        /* foreach passed TG */
        $pages = get_total_pages($tg_data['employee_id'], $tg_data['client_id'], $tg_data['site_id'], $tg_data['qids'], $see_response, $tg_data['soap_url']);
        if ($pages['max_pages'] != 0) {
            $current_page = 1;
            $truncate = false;
            while ($current_page <= $pages['max_pages']) {
                $truncate = $current_page == 1 ? true : false;
                $questions = array("job_brassring_req_code", "job_title", "job_city", "job_state", "unnamed_2", "unnamed_3", "job_category");
                $tg_result = refresh_cache($tg_data['employee_id'], $tg_data['client_id'], $tg_data['site_id'], $tg_data['tg_name'], $tg_table, $tg_data['custom_fields'], $tg_data['qids'], $truncate, $current_page, $see_response, $tg_data['soap_url']);
                $refresh_result[] = $tg_result;
                $current_page++;
            }
        } else {
            if ($pages['successful_api_call'] == false) {
                $refresh_result['skipped'][$tg_data['site_id']]['message'] = 'Failed in the API call. Site id: ' . $tg_data['site_id'];
                $refresh_result['skipped'][$tg_data['site_id']]['message_2'] = 'The table for that TG was not modified.';
            } elseif ($pages['successful_api_call'] == true && $pages['max_pages'] == 0) {
                $refresh_result['skipped'][$tg_data['site_id']]['message'] = 'The TG has no jobs. Site id: ' . $tg_data['site_id'];
                /* If TG has no jobs, truncate the table */
                if (truncate_one_table($tg_table)) {
                    $refresh_result['skipped'][$tg_data['site_id']]['message_2'] = 'The table for this TG has been truncated';
                } else {
                    $refresh_result['skipped'][$tg_data['site_id']]['message_2'] = 'An attempt to truncate the table for this TG failed.';
                }
            }
        }
    }
    return $refresh_result;
}
Пример #2
0
 $_CFG = get_cache('config');
 refresh_page_cache();
 $_PAGE = get_cache('page');
 refresh_nav_cache();
 $_NAV = get_cache('nav');
 refresh_category_cache();
 refresh_cache('text');
 refresh_cache('mailconfig');
 refresh_cache('mail_templates');
 refresh_cache('locoyspider');
 refresh_cache('sms_config');
 refresh_cache('sms_templates');
 refresh_cache('captcha');
 refresh_cache('baiduxml');
 refresh_cache('weixin_config');
 refresh_cache('baidu_submiturl');
 refresh_content_key_link_cache('content_key_link');
 refresh_plug_cache();
 refresh_category_cache();
 refresh_points_rule_cache();
 refresh_subsite_cache();
 //生成分类JS
 makejs_classify();
 $html = "";
 $html .= "<script type=\"text/javascript\">\n";
 $html .= "\$('#installing').append('<p>缓存数据添加成功!...</p><p>安装完成!</p>');\n";
 $html .= "var div = document.getElementById('installing');";
 $html .= "div.scrollTop = div.scrollHeight;";
 $html .= "</script>";
 echo $html;
 ob_flush();
Пример #3
0
    $info['thisname'] = trim($_GET['thisname']);
    $smarty->assign('info', $info);
    $smarty->assign('title', $title);
    $smarty->assign('label', $label);
    $smarty->assign('navlabel', 'templates');
    $smarty->display('mail/admin_mail_templates_edit.htm');
} elseif ($act == 'templates_save') {
    check_token();
    $templates_value = trim($_POST['templates_value']);
    $templates_name = trim($_POST['templates_name']);
    $title = trim($_POST['title']);
    !$db->query("UPDATE " . table('mail_templates') . " SET value='" . $templates_value . "' WHERE name='" . $templates_name . "'") ? adminmsg('设置失败', 1) : "";
    !$db->query("UPDATE " . table('mail_templates') . " SET value='" . $title . "' WHERE name='" . $templates_name . "_title'") ? adminmsg('设置失败', 1) : "";
    $link[0]['text'] = "返回上一页";
    $link[0]['href'] = "?act=email_set_templates";
    refresh_cache('mail_templates');
    write_log("修改邮件发送模版", $_SESSION['admin_name'], 3);
    adminmsg("保存成功!", 2, $link);
} elseif ($act == 'send') {
    get_token();
    $smarty->assign('pageheader', "邮件营销");
    require_once dirname(__FILE__) . '/include/admin_mailqueue_fun.php';
    require_once QISHI_ROOT_PATH . 'include/page.class.php';
    $uid = intval($_GET['uid']);
    $email = trim($_GET['email']);
    $wheresql = ' WHERE m_uid=' . $uid . ' ORDER BY m_id DESC ';
    $total_sql = "SELECT COUNT(*) AS num FROM " . table('mailqueue') . $wheresql;
    $perpage = 10;
    $page = new page(array('total' => $db->get_total($total_sql), 'perpage' => $perpage));
    $currenpage = $page->nowindex;
    $offset = ($currenpage - 1) * $perpage;
Пример #4
0
            $flistd[$key]['file_url'] = $_CFG['site_domain'] . $_CFG['site_dir'] . $trimxmldir . $file;
            $flistd[$key]['file_name'] = $file;
        }
    }
    $smarty->assign('flist', $flistd);
    $smarty->display('baiduxml/admin_baiduxml_li.htm');
} elseif ($act == 'set') {
    $smarty->assign('xml', get_cache('baiduxml'));
    $smarty->display('baiduxml/admin_baiduxml_set.htm');
} elseif ($act == 'setsave') {
    $_POST['xmlmax'] = intval($_POST['xmlmax']);
    $_POST['xmlpagesize'] = intval($_POST['xmlpagesize']) == 0 ? 1 : intval($_POST['xmlpagesize']);
    foreach ($_POST as $k => $v) {
        !$db->query("UPDATE " . table('baiduxml') . " SET value='{$v}' WHERE name='{$k}'") ? adminmsg('保存失败', 1) : "";
    }
    refresh_cache('baiduxml');
    write_log("修改百度开放平台配置", $_SESSION['admin_name'], 3);
    adminmsg("保存成功!", 2);
} elseif ($act == 'del') {
    $xmlset = get_cache('baiduxml');
    $xmldir = '../' . $xmlset['xmldir'];
    $file_name = $_POST['file_name'];
    if (empty($file_name)) {
        adminmsg("请选择文档!", 1);
    }
    if (!is_array($file_name)) {
        $file_name = array($file_name);
    }
    foreach ($file_name as $f) {
        @unlink($xmldir . $f);
    }
Пример #5
0
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用;不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
*/
define('IN_QISHI', true);
require_once dirname(__FILE__) . '/../data/config.php';
require_once dirname(__FILE__) . '/include/admin_common.inc.php';
$act = !empty($_GET['act']) ? trim($_GET['act']) : 'set';
$smarty->assign('act', $act);
$smarty->assign('pageheader', "个人设置");
check_permissions($_SESSION['admin_purview'], "set_per");
if ($act == 'set') {
    get_token();
    $smarty->assign('config', $_CFG);
    $smarty->assign('text', get_cache('text'));
    $smarty->display('set_per/admin_set_per.htm');
} elseif ($act == 'set_save') {
    check_token();
    //填写管理员日志
    write_log("后台更新设置", $_SESSION['admin_name'], 3);
    foreach ($_POST as $k => $v) {
        !$db->query("UPDATE " . table('config') . " SET value='{$v}' WHERE name='{$k}'") ? adminmsg('更新设置失败', 1) : "";
    }
    foreach ($_POST as $k => $v) {
        !$db->query("UPDATE " . table('text') . " SET value='{$v}' WHERE name='{$k}'") ? adminmsg('更新设置失败', 1) : "";
    }
    refresh_cache('config');
    refresh_cache('text');
    adminmsg("保存成功!", 2);
}
Пример #6
0
} elseif ($act == 'set_save') {
    check_token();
    check_permissions($_SESSION['admin_purview'], "mb_set");
    foreach ($_POST as $k => $v) {
        !$db->query("UPDATE " . table('config') . " SET value='{$v}' WHERE name='{$k}'") ? adminmsg('更新设置失败', 1) : "";
    }
    foreach ($_POST as $k => $v) {
        !$db->query("UPDATE " . table('text') . " SET value='{$v}' WHERE name='{$k}'") ? adminmsg('更新设置失败', 1) : "";
    }
    refresh_cache('config');
    refresh_cache('text');
    //填写管理员日志
    write_log("后台成功更新设置", $_SESSION['admin_name'], 3);
    adminmsg("保存成功!", 2);
} elseif ($act == 'search') {
    get_token();
    $smarty->assign('pageheader', "搜索设置");
    $smarty->assign('config', $_CFG);
    $smarty->display('set/admin_set_search.htm');
} elseif ($act == 'search_save') {
    check_token();
    check_permissions($_SESSION['admin_purview'], "set_search");
    foreach ($_POST as $k => $v) {
        !$db->query("UPDATE " . table('config') . " SET value='{$v}' WHERE name='{$k}'") ? adminmsg('更新设置失败', 1) : "";
    }
    //填写管理员日志
    write_log("后台成功更新搜索设置", $_SESSION['admin_name'], 3);
    refresh_cache('config');
    write_log("配置搜索设置", $_SESSION['admin_name'], 3);
    adminmsg("保存成功!", 2);
}
Пример #7
0
    refresh_cache('config');
    adminmsg("保存成功!", 2);
}
if ($act == 'captcha') {
    get_token();
    $smarty->assign('captcha', get_cache('captcha'));
    $smarty->assign('navlabel', 'captcha');
    $smarty->display('safety/admin_safety_captcha.htm');
} elseif ($act == 'captcha_save') {
    check_token();
    if ($_POST['captcha_lang'] == 'cn') {
        $dir = QISHI_ROOT_PATH . 'data/font/cn/';
        if ($handle = @opendir($dir)) {
            $i = 0;
            while (false !== ($file = @readdir($handle))) {
                if (strcasecmp(substr($file, -4), '.ttf') === 0) {
                    $list[] = $file;
                    $i++;
                }
            }
        }
        if (empty($list)) {
            adminmsg("修改失败,使用中文验证码需要把中文汉字的TTF文件上传到 data/font/cn 目录下", 0);
        }
    }
    foreach ($_POST as $k => $v) {
        !$db->query("UPDATE " . table('captcha') . " SET value='{$v}' WHERE name='{$k}'") ? adminmsg('更新站点设置失败', 1) : "";
    }
    refresh_cache('captcha');
    adminmsg("保存成功!", 2);
}
Пример #8
0
if ($act == "set") {
    get_token();
    $smarty->assign('navlabel', "set");
    $smarty->display('locoyspider/admin_locoyspider.htm');
} elseif ($act == "set_news") {
    get_token();
    $smarty->assign('navlabel', "set_news");
    $smarty->display('locoyspider/admin_locoyspider_news.htm');
} elseif ($act == "set_company") {
    get_token();
    $smarty->assign('navlabel', "set_company");
    $smarty->display('locoyspider/admin_locoyspider_company.htm');
} elseif ($act == "set_jobs") {
    get_token();
    $smarty->assign('navlabel', "set_jobs");
    $smarty->display('locoyspider/admin_locoyspider_jobs.htm');
} elseif ($act == "set_user") {
    get_token();
    $smarty->assign('navlabel', "set_user");
    $smarty->display('locoyspider/admin_locoyspider_user.htm');
} elseif ($act == 'set_save') {
    check_token();
    if (intval($_POST['search_threshold']) > 100 || intval($_POST['search_threshold']) == 0) {
        unset($_POST['search_threshold']);
    }
    foreach ($_POST as $k => $v) {
        !$db->query("UPDATE " . table('locoyspider') . " SET value='{$v}' WHERE name='{$k}' LIMIT 1") ? adminmsg('更新失败', 1) : "";
    }
    refresh_cache('locoyspider');
    adminmsg("保存成功!", 2);
}
Пример #9
0
        $sql = "select * from " . table('sms_templates') . " where name='" . $templates_name . "'";
        $info = $db->getone($sql);
    }
    $info['thisname'] = trim($_GET['thisname']);
    $smarty->assign('info', $info);
    $smarty->assign('label', $label);
    $smarty->assign('navlabel', 'templates');
    $smarty->display('sms/admin_sms_templates_edit.htm');
} elseif ($act == 'templates_save') {
    check_token();
    $templates_value = trim($_POST['templates_value']);
    $templates_name = trim($_POST['templates_name']);
    !$db->query("UPDATE " . table('sms_templates') . " SET value='{$templates_value}' WHERE name='{$templates_name}'") ? adminmsg('设置失败', 1) : "";
    $link[0]['text'] = "返回上一页";
    $link[0]['href'] = "?act=set_tpl";
    refresh_cache('sms_templates');
    adminmsg("保存成功!", 2, $link);
} elseif ($act == 'send') {
    get_token();
    $smarty->assign('pageheader', "短信营销");
    require_once dirname(__FILE__) . '/include/admin_smsqueue_fun.php';
    require_once QISHI_ROOT_PATH . 'include/page.class.php';
    $uid = intval($_GET['uid']);
    $mobile = trim($_GET['mobile']);
    $wheresql = ' WHERE s_uid=' . $uid . ' ORDER BY s_id DESC ';
    $total_sql = "SELECT COUNT(*) AS num FROM " . table('smsqueue') . $wheresql;
    $perpage = 10;
    $page = new page(array('total' => $db->get_total($total_sql), 'perpage' => $perpage));
    $currenpage = $page->nowindex;
    $offset = ($currenpage - 1) * $perpage;
    $sms_log = get_smsqueue($offset, $perpage, $wheresql);
$userModel = Mage :: getModel( 'admin/user' );
$userModel -> setUserId( 0 );
Mage :: getSingleton( 'admin/session' ) -> setUser( $userModel );

function refresh_cache() 
{    
    try {
        $allTypes = Mage::app()->useCache();
        foreach($allTypes as $type => $blah) {
          Mage::app()->getCacheInstance()->cleanType($type);
        }
      } catch (Exception $e) {
          echo $e->getMessage() . " <br>";
      }
    try{
        echo "<br>";
        $indexingProcesses = Mage::getSingleton('index/indexer')->getProcessesCollection(); 
        foreach ($indexingProcesses as $process) {
              $process->reindexEverything();
        }
    }
    catch (Exception $e){
        echo $e->getMessage() . " <br>";
    }
}

refresh_cache(); 
echo "<br>";  
echo "All cache types refreshed & all processes reindexed<br />";

?>
Пример #11
0
        $setsqlarr['uid'] = $value['uid'];
        $setsqlarr['utype'] = $value['utype'];
        $setsqlarr['username'] = addslashes($value['username']);
        $setsqlarr['weixin_openid'] = $value['weixin_openid'];
        $db->inserttable(table("weixin_msg_list"), $setsqlarr, 1);
    }
    adminmsg("发送成功!", 2);
} elseif ($act == 'del_weixin_msg') {
    check_token();
    $id = $_REQUEST['id'];
    if ($num = del_weixin_msg($id)) {
        write_log("删除消息,共删除" . $num . "条记录", $_SESSION['admin_name'], 3);
        adminmsg("删除成功!共删除" . $num . "条记录", 2);
    } else {
        adminmsg("删除失败!", 1);
    }
} elseif ($act == 'rule') {
    get_token();
    $smarty->assign('navlabel', 'rule');
    $smarty->assign('weixin_config', get_cache('weixin_config'));
    $smarty->display('weixin/admin_weixin_rule.htm');
} elseif ($act == 'weixin_rule_save') {
    check_token();
    foreach ($_POST as $k => $v) {
        !$db->query("UPDATE " . table('weixin_config') . " SET value='{$v}' WHERE name='{$k}'") ? adminmsg('更新站点设置失败', 1) : "";
    }
    //填写管理员日志
    write_log("后台设置微信通知规则!", $_SESSION['admin_name'], 3);
    refresh_cache('weixin_config');
    adminmsg("保存成功!", 2);
}
Пример #12
0
            sql_query("UPDATE settings SET value='true' WHERE name='pcron';");
        }
        $feeds = array();
        $feeds_d = array();
        $feeds_q = sql_get_array("SELECT * FROM feeds;");
        for ($n = 0; $n < count($feeds_q); $n++) {
            $feed = $feeds_q[$n];
            if ($feed['approved'] == 1) {
                $feeds[] = $feed['url'];
            }
            $feeds_d[] = $feed;
        }
        cache(serialize($feeds), $feeds_ch);
        cache(serialize($feeds_d), $feeds_d_ch);
        sleep(1);
        refresh_cache(false);
        sql_close();
        log_cache_refresh($start_caching, time());
        /* We have been working hard, we should sleep now :)  */
        if (!isset($_GET['force'])) {
            sleep(3600);
            $n++;
        } else {
            die;
        }
    } while (true);
}
?>
<html>
	<head>
		<title>Planetoid cron</title>
Пример #13
0
    }
} else {
    print 'No tg name provided.';
    die;
}
print_r($cache_report);
/* Try to re cache failed requests */
$tc = 0;
$result_two = array();
$skipped = array();
$keys = array();
foreach ($cache_report as $k => $v) {
    if (!is_string($k)) {
        if ($v['response'] == 0) {
            $tc++;
            //$result_two['second_round'][] = refresh_cache($v['employee_id'],$v['client_id'], $v['site_id'], $v['tg_name'], $v['table_name'], $v['questions'], $v['truncate'], $v['page']);
            $result_two['second_round'][] = refresh_cache($v['employee_id'], $v['client_id'], $v['site_id'], $v['qids'], $v['tg_name'], $v['table_name'], $v['questions'], $v['truncate'], $v['page'], false, $v['soap_url']);
        }
    } else {
        //if($v['response'] == 0){
        if (count($cache_report['skipped'])) {
            $skipped['skipped'][] = $v;
        }
    }
}
print_r($result_two);
print_r($skipped);
?>